See More

2010-05-24 Gavin Barraclough Rubber Stamped by Sam Weinig. Accidentally committed double write of codeblock in Interpreter. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): 2010-05-24 Gavin Barraclough Reviewed by Sam Weinig. https://bugs.webkit.org/show_bug.cgi?id=39583 Move creation of 'this' object from caller to callee in construction. Presently the caller of a constructor is responsible for providing a this object. Instead, move the object creation into a new op_create_this opcode, planted in the head of the contructor bytecode for a function. Since the prototype for the object is provided by performing a get_by_id on the callee, also add a new get_callee opcode (this is used to get the callee JSFunction into a register so that a normal get_by_id can be used). Currently the caller is also responsible for detecting when op_construct is performed on a JSFunction representing a host function, in which case an exception is thrown – and this check currently takes place when constructing the this object. Instead, mirroring the recent changes for non-host functions, add a parallel code-path for native constructors to follow, with a thunk for invoking native constructors provided by JITStubs, and a constructor-specific NativeFunction on NativeExecutable. Provide an implementation of a host constructor which will throw an exception. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): * bytecode/CodeBlock.h: * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitConstruct): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitGetByIdExceptionInfo): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): * jit/JITCall32_64.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): * jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::privateCompileCTINativeCall): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_convert_this): (JSC::JIT::emit_op_get_callee): (JSC::JIT::emit_op_create_this): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::privateCompileCTINativeCall): (JSC::JIT::emit_op_get_callee): (JSC::JIT::emit_op_create_this): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): (JSC::JITThunks::hostFunctionStub): * jit/JITStubs.h: (JSC::JITThunks::ctiNativeConstruct): (JSC::): * runtime/ExceptionHelpers.cpp: (JSC::createNotAnObjectError): * runtime/Executable.h: (JSC::NativeExecutable::create): (JSC::NativeExecutable::NativeExecutable): * runtime/JSFunction.cpp: (JSC::callHostFunctionAsConstructor): * runtime/JSFunction.h: 2010-05-23 Sam Weinig Fix windows build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-23 Sam Weinig Reviewed by Oliver Hunt. Fix for https://bugs.webkit.org/show_bug.cgi?id=39575 Make JS DOMObject inherit from JSObjectWithGlobalObject instead of JSObject Expose the global object stored in JSObjectWithGlobalObject. * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSObjectWithGlobalObject.cpp: (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject): (JSC::JSObjectWithGlobalObject::globalObject): * runtime/JSObjectWithGlobalObject.h: 2010-05-21 Oliver Hunt "asm volatile" isn't valid outside of functions. Reviewed by Gavin Barraclough. * jit/JITStubs.cpp: 2010-05-21 Gavin Barraclough Unreviewed build fix. Interpreter fix following r59974. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * runtime/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::get): * runtime/JSPropertyNameIterator.h: 2010-05-21 Gavin Barraclough Rubber stamped by Oliver Hunt. Interpreter fix following r59939. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): 2010-05-21 David Levin Unreviewed build fix. * wtf/SizeLimits.cpp: Removed a check while I figure out how to write it properly. 2010-05-21 David Levin Reviewed by Darin Adler. Enforce size constraints on various data structures in JavaScriptCore/wtf. https://bugs.webkit.org/show_bug.cgi?id=39327 I only modified the default build for OSX and Chromium's build file to include WTFCompileAsserts.cpp as those should be sufficient to catch regressions on the size of the data structures. * JavaScriptCore.gypi: Added the WTFCompileAsserts.cpp file. * JavaScriptCore.xcodeproj/project.pbxproj: Added the WTFCompileAsserts.cpp file. * runtime/UString.cpp: Added a compile assert for UString size. * wtf/SizeLimits.cpp: Added compile asserts for data structures that didn't have cpp files. * wtf/text/StringImpl.cpp: Added a compile assert for StringImpl size. 2010-05-21 Gavin Barraclough Reviewed by Oliver Hunt. Bug 39509 - Exceptions raised when JSString::value() is called not always properly thrown. Missing some CHECK_FOR_EXCEPTION()s, cleanup NativeError construction (adding a property via the prototype was inefficient, and whilst trivially true that the property is is not a rope - and thus couldn't except - it would be hard to prove this). * interpreter/Interpreter.cpp: (JSC::Interpreter::callEval): (JSC::Interpreter::privateExecute): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/InternalFunction.cpp: (JSC::InternalFunction::name): (JSC::InternalFunction::displayName): * runtime/JSFunction.cpp: (JSC::JSFunction::name): (JSC::JSFunction::displayName): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): * runtime/JSPropertyNameIterator.cpp: * runtime/JSPropertyNameIterator.h: * runtime/JSString.h: (JSC::RopeBuilder::tryGetValue): (JSC::JSString::getIndex): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): * runtime/NativeErrorConstructor.h: * runtime/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::NativeErrorPrototype): * runtime/NativeErrorPrototype.h: * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): 2010-05-21 Gavin Barraclough Reviewed by NOBODY (build fix). Fix interpreter build. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): 2010-05-21 Geoffrey Garen Reviewed by Gavin Barraclough. Split out JITCall32_64.cpp, and tightened up some #ifdefs in the hopes of improving compile times. https://bugs.webkit.org/show_bug.cgi?id=39507 * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JIT.cpp: * jit/JITArithmetic.cpp: * jit/JITArithmetic32_64.cpp: * jit/JITCall.cpp: * jit/JITCall32_64.cpp: Copied from jit/JITCall.cpp. * jit/JITOpcodes.cpp: * jit/JITOpcodes32_64.cpp: * jit/JITPropertyAccess.cpp: * jit/JITPropertyAccess32_64.cpp: * jit/JITStubs.cpp: 2010-05-21 Csaba Osztrogonác Unreviewed buildfix for Qt after r59941. * JavaScriptCore.pro: missing runtime/JSObjectWithGlobalObject.cpp added to SOURCES. 2010-05-21 Oliver Hunt Windows build fix #3 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-21 Oliver Hunt Windows build fix #2 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-21 Oliver Hunt Windows build fix #1 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-21 Oliver Hunt Reviewed by Geoffrey Garen. All callable objects should have a global object reference https://bugs.webkit.org/show_bug.cgi?id=39495 All objects that may ever return a value other CallTypeNone or ConstructTypeNone now get a global object in their constructor and store that in their first anonymous slot. We add a new type JSObjectWithGlobalObject to allow us to share this logic as much as possible, however some objects have specific inheritance requirements so we can't just use it universally. To enforce this requirement JSValue::getCallData and getConstructData make use of a new "isValidCallee" function to assert that any object that returns a value other than CallType/ConstructTypeNone has a global object in anonymous slot 0. In order to ensure that static function slots are converted into function objects with the correct global object, all prototype objects and other classes with static function slots also gain a global object reference. Happily this fixes the long standing issue where host function objects get a prototype from the lexical global object of the first function that calls them, instead of the global object that they are defined on. * API/JSCallbackConstructor.cpp: (JSC::JSCallbackConstructor::JSCallbackConstructor): * API/JSCallbackConstructor.h: * API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::JSCallbackFunction): * API/JSCallbackFunction.h: * API/JSCallbackObject.cpp: (JSC::): * API/JSCallbackObject.h: * API/JSCallbackObjectFunctions.h: (JSC::::JSCallbackObject): (JSC::::staticFunctionGetter): * API/JSClassRef.cpp: (OpaqueJSClass::prototype): * API/JSContextRef.cpp: * API/JSObjectRef.cpp: (JSObjectMake): (JSObjectMakeFunctionWithCallback): (JSObjectMakeConstructor): (JSObjectGetPrivate): (JSObjectSetPrivate): (JSObjectGetPrivateProperty): (JSObjectSetPrivateProperty): (JSObjectDeletePrivateProperty): * API/JSValueRef.cpp: (JSValueIsObjectOfClass): * API/JSWeakObjectMapRefPrivate.cpp: * CMakeLists.txt: * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jsc.cpp: (GlobalObject::GlobalObject): * runtime/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor): * runtime/ArrayConstructor.h: * runtime/ArrayPrototype.cpp: (JSC::ArrayPrototype::ArrayPrototype): * runtime/ArrayPrototype.h: (JSC::ArrayPrototype::createStructure): * runtime/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor): * runtime/BooleanConstructor.h: * runtime/BooleanPrototype.cpp: (JSC::BooleanPrototype::BooleanPrototype): * runtime/BooleanPrototype.h: * runtime/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor): * runtime/DateConstructor.h: * runtime/DatePrototype.cpp: (JSC::DatePrototype::DatePrototype): * runtime/DatePrototype.h: * runtime/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor): * runtime/ErrorConstructor.h: * runtime/ErrorPrototype.cpp: (JSC::ErrorPrototype::ErrorPrototype): * runtime/ErrorPrototype.h: * runtime/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor): * runtime/FunctionConstructor.h: * runtime/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype): (JSC::FunctionPrototype::addFunctionProperties): * runtime/FunctionPrototype.h: * runtime/GlobalEvalFunction.cpp: (JSC::GlobalEvalFunction::GlobalEvalFunction): * runtime/GlobalEvalFunction.h: * runtime/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction): * runtime/InternalFunction.h: * runtime/JSCell.h: (JSC::JSValue::getCallData): (JSC::JSValue::getConstructData): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): * runtime/JSFunction.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSONObject.cpp: (JSC::JSONObject::JSONObject): * runtime/JSONObject.h: * runtime/JSObject.h: * runtime/JSObjectWithGlobalObject.cpp: Added. (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject): * runtime/JSObjectWithGlobalObject.h: Added. (JSC::JSObjectWithGlobalObject::createStructure): (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject): * runtime/JSValue.cpp: (JSC::JSValue::isValidCallee): * runtime/JSValue.h: * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): * runtime/MathObject.cpp: (JSC::MathObject::MathObject): * runtime/MathObject.h: * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): * runtime/NativeErrorConstructor.h: * runtime/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::NativeErrorPrototype): * runtime/NativeErrorPrototype.h: * runtime/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor): * runtime/NumberConstructor.h: * runtime/NumberPrototype.cpp: (JSC::NumberPrototype::NumberPrototype): * runtime/NumberPrototype.h: * runtime/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor): * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.cpp: (JSC::ObjectPrototype::ObjectPrototype): * runtime/ObjectPrototype.h: * runtime/PrototypeFunction.cpp: (JSC::PrototypeFunction::PrototypeFunction): * runtime/PrototypeFunction.h: * runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): (JSC::constructRegExp): * runtime/RegExpConstructor.h: * runtime/RegExpObject.cpp: (JSC::RegExpObject::RegExpObject): * runtime/RegExpObject.h: * runtime/RegExpPrototype.cpp: (JSC::RegExpPrototype::RegExpPrototype): * runtime/RegExpPrototype.h: * runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): * runtime/StringConstructor.h: * runtime/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype): * runtime/StringPrototype.h: 2010-05-21 Geoffrey Garen Reviewed by Oliver Hunt. Removed the unused entry in the CallFrame https://bugs.webkit.org/show_bug.cgi?id=39470 Removed the unused entry in the CallFrame, and reordered CallFrame writes on the hot path to be in forwards order. SunSpider says 0.3% faster. * interpreter/RegisterFile.h: (JSC::RegisterFile::): * jit/JITCall.cpp: (JSC::JIT::compileOpCall): 2010-05-21 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Split the QScriptValue autotest into smaller chunks. File tst_qscriptvalue_generated.cpp was huge and it was difficult to compile it with MSVS2008, because of the code optimization. Tests were splited into a few files for better use of distributed compilation. Repeated calls to insert() and operator<<() where replaced by loops, that should reduce time of code optimizing. New files were generated by the same application, test logic wasn't changed. [Qt] The QScriptValue autotest should be refactored. https://bugs.webkit.org/show_bug.cgi?id=38987 * qt/tests/qscriptvalue/qscriptvalue.pro: * qt/tests/qscriptvalue/tst_qscriptvalue.h: * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Removed. * qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp: Added. (tst_QScriptValue::initScriptValues): * qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp: Added. (tst_QScriptValue::isValid_initData): (tst_QScriptValue::isValid_makeData): (tst_QScriptValue::isValid_test): (tst_QScriptValue::isBool_initData): (tst_QScriptValue::isBool_makeData): (tst_QScriptValue::isBool_test): (tst_QScriptValue::isBoolean_initData): (tst_QScriptValue::isBoolean_makeData): (tst_QScriptValue::isBoolean_test): (tst_QScriptValue::isNumber_initData): (tst_QScriptValue::isNumber_makeData): (tst_QScriptValue::isNumber_test): (tst_QScriptValue::isFunction_initData): (tst_QScriptValue::isFunction_makeData): (tst_QScriptValue::isFunction_test): (tst_QScriptValue::isNull_initData): (tst_QScriptValue::isNull_makeData): (tst_QScriptValue::isNull_test): (tst_QScriptValue::isString_initData): (tst_QScriptValue::isString_makeData): (tst_QScriptValue::isString_test): (tst_QScriptValue::isUndefined_initData): (tst_QScriptValue::isUndefined_makeData): (tst_QScriptValue::isUndefined_test): (tst_QScriptValue::isObject_initData): (tst_QScriptValue::isObject_makeData): (tst_QScriptValue::isObject_test): * qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp: Added. (tst_QScriptValue::toString_initData): (tst_QScriptValue::toString_makeData): (tst_QScriptValue::toString_test): (tst_QScriptValue::toNumber_initData): (tst_QScriptValue::toNumber_makeData): (tst_QScriptValue::toNumber_test): (tst_QScriptValue::toBool_initData): (tst_QScriptValue::toBool_makeData): (tst_QScriptValue::toBool_test): (tst_QScriptValue::toBoolean_initData): (tst_QScriptValue::toBoolean_makeData): (tst_QScriptValue::toBoolean_test): (tst_QScriptValue::toInteger_initData): (tst_QScriptValue::toInteger_makeData): (tst_QScriptValue::toInteger_test): (tst_QScriptValue::toInt32_initData): (tst_QScriptValue::toInt32_makeData): (tst_QScriptValue::toInt32_test): (tst_QScriptValue::toUInt32_initData): (tst_QScriptValue::toUInt32_makeData): (tst_QScriptValue::toUInt32_test): (tst_QScriptValue::toUInt16_initData): (tst_QScriptValue::toUInt16_makeData): (tst_QScriptValue::toUInt16_test): 2010-05-21 Kwang Yul Seo Reviewed by Eric Seidel. Add COMPILER(MSVC) guard for strnstr https://bugs.webkit.org/show_bug.cgi?id=39397 BREWMP uses MSVC for simulator build, but it is not OS(WINDOWS). Add COMPILER(MSVC) guard for strnstr. * wtf/StringExtras.h: 2010-05-21 Kwang Yul Seo Reviewed by Eric Seidel. [BREWMP] Add !PLATFORM(BREWMP) guard for isMainThread https://bugs.webkit.org/show_bug.cgi?id=39396 BREWMP sets ENABLE(SINGLE_THREADED), so it uses isMainThread from ThreadingNone.cpp. Exclude isMainThread in MainThread.cpp. * wtf/MainThread.cpp: 2010-05-20 Kwang Yul Seo Reviewed by Eric Seidel. [BREWMP] Use skia as BREW MP's graphics backend. https://bugs.webkit.org/show_bug.cgi?id=39407 Define WTF_PLATFORM_SKIA=1 for BREW MP. * wtf/Platform.h: 2010-05-20 Geoffrey Garen Reviewed by Beth Dakin. Fixed naming mixup: it's op_call_put_result, not ret_result. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): 2010-05-20 Geoffrey Garen Reviewed by Oliver Hunt. Whittling away at CodeBlock use: Removed a little wonkiness in closure lookup https://bugs.webkit.org/show_bug.cgi?id=39444 Calculate all lookup depths at compile time. I'm not sure why we couldn't do this before, but whatever the reason, it seems to be gone now. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::findScopedProperty): * bytecompiler/BytecodeGenerator.h: * interpreter/Interpreter.cpp: (JSC::Interpreter::resolveSkip): (JSC::Interpreter::resolveGlobalDynamic): (JSC::Interpreter::privateExecute): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_resolve_skip): (JSC::JIT::emit_op_resolve_global_dynamic): (JSC::JIT::emitSlow_op_resolve_global_dynamic): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_resolve_skip): 2010-05-20 Darin Adler Reviewed by Eric Seidel. Fix warnings seen on the buildbots today https://bugs.webkit.org/show_bug.cgi?id=39368 * profiler/ProfileNode.cpp: (JSC::getCount): Removed unneeded initialization of global variable. These are all initialized to zero anyway, so no need to try to initialize it and get a warning. * wtf/CurrentTime.cpp: (WTF::currentTime): Removed unused global variable. 2010-05-20 Geoffrey Garen Reviewed by Darin Adler. Removed some reliance on callFame[CodeBlock] by storing CodeBlock in a local variable in the Interpreter. https://bugs.webkit.org/show_bug.cgi?id=39447 Small speedup on SunSpider in Interpreter mode. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jsc.cpp: * wtf/Platform.h: 2010-05-19 Gavin Barraclough Reviewed by Oliver Hunt. Bug 39408 - Unify JIT/interpreter return behaviour. Presently the JIT and the interpreter have differing implementations in how they handle storing the result of a function call back to the register file. In both cases the op_call ( / _eval / _varargs / op_construct) opcode has an operand indicating the VM register in which the result should be stored. The JIT plants code after the call to store the result, so the value will be stored as soon as the callee has returned. In the interpreter the call passes the return value register id into the callee via the callee callframe, and the callee is responsible for writing the result back into its callers register file after it has restored the parents callframe pointer, but before returning. Instead, move the task of writing the call result to the register file into a new opcode (op_call_put_result), and after returning the callee should leave the return value in a canonical location. In the case of the interpreter, this canonical location is a local variable in privateExecute (functionReturnValue), in the case of the JIT this is the normal return value registers (regT0, or regT1:regT0 in JSVALUE32_64). op_call_put_result stores the result from the canonical location to the registerfile. In addition to unifying JIT & interpreter behaviour this change allows us to remove a slot from the callframe, omit the write of the result where the return value from the call is not used, and provides a 2% speedup on sunspider in the interpreter. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitConstruct): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::finalDestinationOrIgnored): * bytecompiler/NodesCodegen.cpp: (JSC::NewExprNode::emitBytecode): (JSC::FunctionCallValueNode::emitBytecode): (JSC::FunctionCallResolveNode::emitBytecode): (JSC::FunctionCallBracketNode::emitBytecode): (JSC::FunctionCallDotNode::emitBytecode): (JSC::CallFunctionCallDotNode::emitBytecode): (JSC::ApplyFunctionCallDotNode::emitBytecode): * interpreter/CallFrame.h: (JSC::ExecState::init): (JSC::ExecState::noCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): (JSC::Interpreter::throwException): (JSC::Interpreter::privateExecute): * interpreter/RegisterFile.h: (JSC::RegisterFile::): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::compileOpCallSetupArgs): (JSC::JIT::compileOpConstructSetupArgs): (JSC::JIT::emit_op_call_put_result): (JSC::JIT::compileOpCallVarargs): (JSC::JIT::compileOpCallVarargsSlowCase): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::compileOpCallVarargsSetupArgs): 2010-05-20 Steve Block Reviewed by Jeremy Orlow. Provide bindings for DeviceOrientation https://bugs.webkit.org/show_bug.cgi?id=39210 Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled. * Configurations/FeatureDefines.xcconfig: 2010-05-19 Gavin Barraclough Reviewed by Geoff Garen. Errk! rename op_constructor_ret as requested in review of Bug 39399. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitReturn): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::emit_op_ret_object_or_this): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_ret_object_or_this): 2010-05-19 Gavin Barraclough Reviewed by Geoff Garen. Bug 39399 - Move responsibility for verifying constructors return objects from the caller to the callee. This is a necessary step to move object creation from caller to callee. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitConstruct): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::isConstructor): * bytecompiler/NodesCodegen.cpp: (JSC::FunctionBodyNode::emitBytecode): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::emit_op_constructor_ret): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_constructor_ret): 2010-05-19 Gavin Barraclough Reviewed by NOBODY (build fix). Fix windows build II. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-19 Gavin Barraclough Reviewed by NOBODY (build fix). Fix windows build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-19 Gavin Barraclough Reviewed by Oliver Hunt. Bug 39393 - JSFunction need not be a subclass of InternalFunction. re-landing r59800. * JavaScriptCore.exp: * interpreter/Interpreter.cpp: (JSC::Interpreter::retrieveCaller): (JSC::Interpreter::findFunctionCallFrame): * interpreter/Interpreter.h: * profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): * runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): * runtime/JSFunction.cpp: (JSC::): (JSC::JSFunction::JSFunction): (JSC::JSFunction::name): (JSC::JSFunction::displayName): (JSC::JSFunction::calculatedDisplayName): * runtime/JSFunction.h: * runtime/JSObject.cpp: (JSC::JSObject::putDirectFunction): (JSC::JSObject::putDirectFunctionWithoutTransition): * runtime/JSObject.h: * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): 2010-05-19 Gavin Barraclough Reviewed by NOBODY (build fix). Reverting r59800, this b0rked stuff. * JavaScriptCore.exp: * interpreter/Interpreter.cpp: (JSC::Interpreter::retrieveCaller): (JSC::Interpreter::findFunctionCallFrame): * interpreter/Interpreter.h: * profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): * runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): * runtime/JSFunction.cpp: (JSC::): (JSC::JSFunction::JSFunction): * runtime/JSFunction.h: * runtime/JSObject.cpp: * runtime/JSObject.h: * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): 2010-05-19 Gavin Barraclough Reviewed by Oliver Hunt. Bug 39393 - JSFunction need not be a subclass of InternalFunction. This may prevent us from introducing a more useful parent class to JSFunction, e.g. a JSObject that holds an executable, which could also reference an eval or program executable. * JavaScriptCore.exp: * interpreter/Interpreter.cpp: (JSC::Interpreter::retrieveCaller): (JSC::Interpreter::findFunctionCallFrame): * interpreter/Interpreter.h: * profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): * runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): * runtime/JSFunction.cpp: (JSC::): (JSC::JSFunction::JSFunction): (JSC::JSFunction::name): (JSC::JSFunction::displayName): (JSC::JSFunction::calculatedDisplayName): * runtime/JSFunction.h: * runtime/JSObject.cpp: (JSC::JSObject::putDirectFunction): (JSC::JSObject::putDirectFunctionWithoutTransition): * runtime/JSObject.h: * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): 2010-05-19 Oliver Hunt Reviewed by Geoffrey Garen. emitJumpIfNotJSCell should special case constant immediate values https://bugs.webkit.org/show_bug.cgi?id=39392 Make emitJumpSlowCaseIfNotJSCell special case constant immediate values, in addition to the immediate JSCell optimisation. Also add assertions to make sure no one else produces code that attempts to load constants from the register file. * jit/JITInlineMethods.h: (JSC::JIT::emitJumpSlowCaseIfNotJSCell): * jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::emitJumpIfNotJSCell): (JSC::JSInterfaceJIT::emitLoadInt32): (JSC::JSInterfaceJIT::tagFor): (JSC::JSInterfaceJIT::payloadFor): (JSC::JSInterfaceJIT::emitLoadDouble): (JSC::JSInterfaceJIT::addressFor): * jit/ThunkGenerators.cpp: 2010-05-19 Geoffrey Garen Reviewed by Sam Weinig. Slight refactoring to CodeBlock bytecode access https://bugs.webkit.org/show_bug.cgi?id=39384 * bytecode/CodeBlock.h: (JSC::CodeBlock::bytecodeOffset): * interpreter/CallFrame.h: (JSC::ExecState::returnPC): * interpreter/Interpreter.cpp: (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::retrieveLastCaller): Moved bytecode access into a CodeBlock helper function. Changed CallFrame to accurately represent how the returnPC is stored in JIT vs Interpreter. 2010-05-19 Geoffrey Garen Reviewed by Sam Weinig. Don't build the Interpreter into JIT builds. https://bugs.webkit.org/show_bug.cgi?id=39373 SunSpider says no change. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * interpreter/Interpreter.h: * wtf/Platform.h: 2010-05-19 Geoffrey Garen Reviewed by Gavin Barraclough. Standardized naming: "bytecode offset" wins; "bytecode index" loses. Also renamed getBytecodeOffset to bytecodeOffset, to match the WebKit naming style. * bytecode/CodeBlock.h: (JSC::CallReturnOffsetToBytecodeOffset::CallReturnOffsetToBytecodeOffset): (JSC::getCallReturnOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::callReturnIndexVector): * interpreter/Interpreter.cpp: (JSC::bytecodeOffsetForPC): * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileLinkPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JIT.h: (JSC::CallRecord::CallRecord): (JSC::JumpTable::JumpTable): (JSC::SwitchRecord::SwitchRecord): * jit/JITCall.cpp: (JSC::JIT::compileOpCallVarargsSlowCase): (JSC::JIT::compileOpCall): * jit/JITInlineMethods.h: (JSC::JIT::emitNakedCall): (JSC::JIT::addSlowCase): (JSC::JIT::addJump): (JSC::JIT::emitJumpSlowToHot): (JSC::JIT::isLabeled): (JSC::JIT::map): (JSC::JIT::unmap): (JSC::JIT::isMapped): (JSC::JIT::getMappedPayload): (JSC::JIT::getMappedTag): (JSC::JIT::emitGetVirtualRegister): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_new_error): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emit_op_to_jsnumber): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_new_error): (JSC::JIT::emit_op_convert_this): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_method_check): (JSC::JIT::emitSlow_op_method_check): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_method_check): (JSC::JIT::emitSlow_op_method_check): (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_pname): * jit/JITStubCall.h: (JSC::JITStubCall::call): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): 2010-05-19 Peter Varga Reviewed by Darin Adler. The backtrackParenthesesOnceEnd function should store the start position of the subpattern's non-greedy match at the place of the subpattern's start index in the output array instead of the place of the subpattern's end index. Add layout test for checking of non-greedy matching of subpattern in regular expressions. https://bugs.webkit.org/show_bug.cgi?id=39289 * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd): 2010-05-18 Gavin Barraclough Reviewed by Geoff Garen. Bug 39343 - Dynamically generate a native call thunk per NativeFunction https://bugs.webkit.org/show_bug.cgi?id=39252 regressed performance on i386, by adding an extra indirection to making a native call. By introducing per- NativeFunction thunks we can hard code the function pointer into the thunk so that it need not be loaded from the callee. * jit/JIT.h: (JSC::JIT::compileCTINativeCall): * jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTINativeCall): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTINativeCall): * jit/JITPropertyAccess.cpp: (JSC::JIT::emitSlow_op_get_by_val): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emitSlow_op_get_by_val): * jit/JITStubs.cpp: (JSC::JITThunks::ctiStub): (JSC::JITThunks::hostFunctionStub): * jit/JITStubs.h: * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::finalize): * jit/ThunkGenerators.cpp: (JSC::charCodeAtThunkGenerator): (JSC::charAtThunkGenerator): (JSC::fromCharCodeThunkGenerator): (JSC::sqrtThunkGenerator): (JSC::powThunkGenerator): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::getHostFunction): * runtime/JSGlobalData.h: (JSC::JSGlobalData::getCTIStub): * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): * runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): * wtf/Platform.h: 2010-05-18 Geoffrey Garen Reviewed by Darin Adler. Simplified handling of 'arguments' -- 1.2% SunSpider speedup https://bugs.webkit.org/show_bug.cgi?id=39200 Removed the reserved OptionalCalleeArguments slot from the CallFrame. Now, slots for 'arguments' are allocated and initialized only by functions that might need them. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): Updated for new bytecode operands. (JSC::CodeBlock::CodeBlock): * bytecode/CodeBlock.h: (JSC::unmodifiedArgumentsRegister): Added a helper function for mapping from the arguments register to its unmodified counterpart. (JSC::CodeBlock::setArgumentsRegister): (JSC::CodeBlock::argumentsRegister): (JSC::CodeBlock::usesArguments): Changed from a "usesArguments" bool to an optional int index representing the arguments register. * bytecode/Opcode.h: Updated for new bytecode operands. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addVar): Factored out a helper function for allocating an anonymous var. (JSC::BytecodeGenerator::BytecodeGenerator): Merged / simplified some arguments vs activation logic, and added code to allocate the arguments registers when needed. (JSC::BytecodeGenerator::createArgumentsIfNecessary): Updated for new bytecode operands. (JSC::BytecodeGenerator::emitCallEval): No need to create the arguments object before calling eval; the activation object will lazily create the arguments object if eval resolves it. (JSC::BytecodeGenerator::emitReturn): Updated for new bytecode operands. (JSC::BytecodeGenerator::emitPushScope): (JSC::BytecodeGenerator::emitPushNewScope): Ditto emitCallEval. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::addVar): Factored out a helper function for allocating an anonymous var. (JSC::BytecodeGenerator::registerFor): No more need for special handling of the arguments registers; they're allocated just like normal registers now. * interpreter/CallFrame.h: (JSC::ExecState::callerFrame): (JSC::ExecState::init): * interpreter/CallFrameClosure.h: (JSC::CallFrameClosure::resetCallFrame): Nixed optionalCalleeArguments. * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::privateExecute): (JSC::Interpreter::retrieveArguments): Opcodes accessing 'arguments' now take operands specifying registers, just like all other opcodes. JSActivation::copyRegisters is no longer responsible for tearing off the arguments object; instead, the VM is responsible for both. Also, a behavior change: Each access to f.arguments creates a new object, unless f itself uses 'arguments'. This matches Chrome, and is necessary for the optimization. f.arguments is a nonstandard, deprecated feature, so high fidelity to a given implementation is not necessarily a goal. Also, as illustrated by the new test case, the identity of f.arguments has been broken since 2008, except in the case where f itself accesses f.arguments -- but nobody seemed to notice. So, hopefully this change won't break the web. * interpreter/Register.h: Nixed the special arguments accessor. It's no longer needed. * interpreter/RegisterFile.h: (JSC::RegisterFile::): * jit/JITCall.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCall): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_tear_off_activation): (JSC::JIT::emit_op_tear_off_arguments): (JSC::JIT::emit_op_create_arguments): (JSC::JIT::emit_op_init_arguments): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_tear_off_activation): (JSC::JIT::emit_op_tear_off_arguments): (JSC::JIT::emit_op_create_arguments): (JSC::JIT::emit_op_init_arguments): The actual optimization: Removed OptionalCalleeArguments from the callframe slot. Now, it doesn't need to be initialized for most calls. * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::): Updated stubs to support arbitrary 'arguments' registers, instead of hard-coding something in the call frame. * runtime/Arguments.h: (JSC::JSActivation::copyRegisters): Removed some obfuscatory abstraction. * runtime/Executable.h: (JSC::FunctionExecutable::generatedByteCode): Added a helper for accessing the 'arguments' register. In a future patch, that kind of data should probably move out of CodeBlock and into Executable. * runtime/JSActivation.cpp: (JSC::JSActivation::getOwnPropertySlot): (JSC::JSActivation::argumentsGetter): * runtime/JSActivation.h: Simplified / fixed access to 'arguments' via the activation object. It now implements the same behavior implemented by optimized variable access in the VM. This simplifies some other things, too -- like eval code generation. 2010-05-18 Sam Weinig Try to fix the windows build. * API/JSStringRefBSTR.cpp: 2010-05-18 Anders Carlsson Reviewed by Sam Weinig. Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set. https://bugs.webkit.org/show_bug.cgi?id=39304 Add an inlineCapacity template parameter to ListHashSet. * wtf/ListHashSet.h: (WTF::::ListHashSet): (WTF::::operator): (WTF::::swap): (WTF::::~ListHashSet): (WTF::::size): (WTF::::capacity): (WTF::::isEmpty): (WTF::::begin): (WTF::::end): (WTF::::find): (WTF::::contains): (WTF::::add): (WTF::::insertBefore): (WTF::::remove): (WTF::::clear): (WTF::::unlinkAndDelete): (WTF::::appendNode): (WTF::::insertNodeBefore): (WTF::::deleteAllNodes): (WTF::::makeIterator): (WTF::::makeConstIterator): (WTF::deleteAllValues): 2010-05-18 Gabor Loki Reviewed by Darin Adler. Fix the interpreter after r59637 https://bugs.webkit.org/show_bug.cgi?id=39287 * runtime/Executable.h: * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::getCallData): * runtime/JSGlobalData.cpp: * runtime/JSGlobalData.h: 2010-05-17 Gavin Barraclough Reviewed by Geoff Garen. Oops, meant ebx not eax there. Fix Qt (and probably Win too). * jit/JITOpcodes32_64.cpp: 2010-05-17 Gavin Barraclough Reviewed by Geoff Garen. Bug 39252 - Move host/native JSFunction's NativeFunction onto NativeExecutable. Currently host functions reuse JSFunction's ScopeChain as storage for their NativeFunction (the C function pointer to the host function implementation). Instead, move this onto NativeExecutable. This will allow host functions to have a scopechain (which will be implemented as a separate patch). * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCall): * jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): * jit/JITOpcodes32_64.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitSlow_op_get_by_val): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitSlow_op_get_by_val): * jit/JITStubs.cpp: (JSC::JITThunks::specializedThunk): * jit/JITStubs.h: (JSC::JITThunks::ctiNativeCall): * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::finalize): * jit/ThunkGenerators.cpp: (JSC::charCodeAtThunkGenerator): (JSC::charAtThunkGenerator): (JSC::fromCharCodeThunkGenerator): (JSC::sqrtThunkGenerator): (JSC::powThunkGenerator): * jit/ThunkGenerators.h: * runtime/Executable.h: (JSC::NativeExecutable::create): (JSC::NativeExecutable::function): (JSC::NativeExecutable::NativeExecutable): (JSC::JSFunction::nativeFunction): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::~JSFunction): (JSC::JSFunction::markChildren): (JSC::JSFunction::getCallData): (JSC::JSFunction::call): (JSC::JSFunction::getOwnPropertySlot): (JSC::JSFunction::getConstructData): (JSC::JSFunction::construct): * runtime/JSFunction.h: (JSC::JSFunction::scope): * runtime/JSGlobalData.h: (JSC::JSGlobalData::getThunk): * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): * runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): 2010-05-17 Patrick Gansterer Reviewed by Laszlo Gombos. [Qt] Remove WinCE endian dedection. https://bugs.webkit.org/show_bug.cgi?id=38511 Windows CE supports little-endian format only. Correct dedection was added in r57804. * wtf/Platform.h: 2010-05-16 Simon Fraser Reviewed by Darin Adler. Reduce the size of FunctionExecutable https://bugs.webkit.org/show_bug.cgi?id=39180 Change m_numVariables from a size_t to 31 bits in a bitfield, packed with another bit for m_forceUsesArguments (which in turn get packed with the base class). Reduces the size of FunctionExecutable from 160 to 152 bytes. * runtime/Executable.h: (JSC::FunctionExecutable::variableCount): (JSC::FunctionExecutable::FunctionExecutable): 2010-05-15 Oliver Hunt Reviewed by Maciej Stachowiak. Incorrect codegen for slowcase of < in 64-bit https://bugs.webkit.org/show_bug.cgi?id=39151 Call the correct stud for the slowcases of the < operator. * jit/JITArithmetic.cpp: (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jless): 2010-05-15 Leo Yang Reviewed by Darin Adler. Fix bug https://bugs.webkit.org/show_bug.cgi?id=38890 * runtime/DatePrototype.cpp: (JSC::formatLocaleDate): 2010-05-15 Leandro Pereira Reviewed by Adam Treat. [EFL] Add build system for the EFL port. http://webkit.org/b/37945 * CMakeLists.txt: Added. * CMakeListsEfl.txt: Added. * config.h: Add conditional to look for cmakeconfig.h. * jsc/CMakeLists.txt: Added. * jsc/CMakeListsEfl.txt: Added. * wtf/CMakeLists.txt: Added. * wtf/CMakeListsEfl.txt: Added. 2010-05-15 Chao-ying Fu Reviewed by Oliver Hunt. Update MIPS JIT for unsigned right shift, Math.sqrt, load16 https://bugs.webkit.org/show_bug.cgi?id=38412 Fixed MIPS build failure. * assembler/MIPSAssembler.h: (JSC::MIPSAssembler::srl): (JSC::MIPSAssembler::srlv): (JSC::MIPSAssembler::sqrtd): * assembler/MacroAssemblerMIPS.h: (JSC::MacroAssemblerMIPS::urshift32): (JSC::MacroAssemblerMIPS::sqrtDouble): (JSC::MacroAssemblerMIPS::load16): (JSC::MacroAssemblerMIPS::supportsFloatingPointSqrt): * jit/JSInterfaceJIT.h: 2010-05-15 Ilya Tikhonovsky Reviewed by Geoffrey Garen. WebInspector: JSC Should provide heap size info for Timeline panel. https://bugs.webkit.org/show_bug.cgi?id=38420 * JavaScriptCore.exp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * runtime/Collector.cpp: (JSC::Heap::size): * runtime/Collector.h: 2010-05-15 Dave Tapuska Reviewed by Darin Adler. Add a new define for we need strict arena alignment. ARMv5 with double word instructions set this value. * wtf/Platform.h: 2010-05-14 Stephanie Lewis Rubber-stamped by Mark Rowe. Update order files. * JavaScriptCore.order: 2010-05-14 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Implementation of QtScript API that provide method to convert a value to an object. [Qt] QtScript is missing toObject API https://bugs.webkit.org/show_bug.cgi?id=36594 * qt/api/qscriptengine.cpp: (QScriptEngine::toObject): * qt/api/qscriptengine.h: * qt/api/qscriptvalue.cpp: (QScriptValue::toObject): * qt/api/qscriptvalue.h: * qt/api/qscriptvalue_p.h: (QScriptValuePrivate::toObject): * qt/tests/qscriptengine/tst_qscriptengine.cpp: (tst_QScriptEngine::toObject): (tst_QScriptEngine::toObjectTwoEngines): * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: (tst_QScriptValue::toObjectSimple): * qt/tests/qscriptvalue/tst_qscriptvalue.h: 2010-05-14 Chao-ying Fu Reviewed by Oliver Hunt. String Indexing Failure on JSVALUE32 targets https://bugs.webkit.org/show_bug.cgi?id=39034 Remove zero-extend/shift-right code on regT1, because we already have it in emit_op_get_by_val(). * jit/JITPropertyAccess.cpp: (JSC::JIT::stringGetByValStubGenerator): 2010-05-10 Jocelyn Turcotte Reviewed by Alexey Proskuryakov. Fix a VS2010 assert in std::copy https://bugs.webkit.org/show_bug.cgi?id=38630 The assert complains that the output iterator is null. * wtf/Vector.h: (WTF::::operator): 2010-05-13 Maciej Stachowiak No review, attempted build fix. Try to fix Tiger build with some gratuitous initialization of seemingly uninitialized variables. * wtf/text/StringImpl.h: (WebCore::StringImpl::tryCreateUninitialized): 2010-05-13 Maciej Stachowiak Reviewed by Mark Rowe. Various JavaScript string optimizations https://bugs.webkit.org/show_bug.cgi?id=39051 Approximately 1% SunSpider speedup. * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncJoin): Remove branches from the hot code path by moving the first pass outside the loop, and duplicating the hot loop to extract the loop-invariant branch. * runtime/RegExp.cpp: (JSC::RegExp::match): resize ovector to 0 instead of clearing to avoid thrash in case of large matches. * runtime/RegExpConstructor.h: (JSC::RegExpConstructor::performMatch): Mark ALWAYS_INLINE to make the compiler respect our authority. * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstringsWithSeparators): Inline. (JSC::stringProtoFuncSubstring): Rewrite boundary condition checks to reduce the number of floating point comparisons and branches. 2010-05-12 Gavin Barraclough Reviewed by Oliver Hunt. https://bugs.webkit.org/show_bug.cgi?id=39039 Provide support for separate bytecode/JIT code translations for call/construct usage This will allow us to produce code generated specifically for use as a constructor, not for general function use. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::unlinkCallers): * bytecode/CodeBlock.h: (JSC::CodeBlock::getBytecodeIndex): (JSC::CodeBlock::getJITCode): (JSC::CodeBlock::executablePool): (JSC::GlobalCodeBlock::GlobalCodeBlock): (JSC::FunctionCodeBlock::FunctionCodeBlock): * interpreter/Interpreter.cpp: (JSC::Interpreter::executeCall): (JSC::Interpreter::executeConstruct): (JSC::Interpreter::prepareForRepeatCall): (JSC::Interpreter::execute): (JSC::Interpreter::privateExecute): * interpreter/Interpreter.h: * jit/JIT.cpp: (JSC::JIT::unlinkCallOrConstruct): (JSC::JIT::linkConstruct): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): * jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): * jit/JITPropertyAccess.cpp: (JSC::JIT::emitSlow_op_get_by_val): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emitSlow_op_get_by_val): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::JITThunks::ctiVirtualConstructLink): (JSC::JITThunks::ctiVirtualConstruct): (JSC::): * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::finalize): * runtime/Arguments.h: (JSC::JSActivation::copyRegisters): * runtime/ArrayPrototype.cpp: (JSC::isNumericCompareFunction): * runtime/Executable.cpp: (JSC::FunctionExecutable::~FunctionExecutable): (JSC::FunctionExecutable::compileForCall): (JSC::FunctionExecutable::compileForConstruct): (JSC::EvalExecutable::generateJITCode): (JSC::ProgramExecutable::generateJITCode): (JSC::FunctionExecutable::generateJITCodeForCall): (JSC::FunctionExecutable::generateJITCodeForConstruct): (JSC::FunctionExecutable::markAggregate): (JSC::FunctionExecutable::reparseExceptionInfo): (JSC::EvalExecutable::reparseExceptionInfo): (JSC::FunctionExecutable::recompile): * runtime/Executable.h: (JSC::ExecutableBase::ExecutableBase): (JSC::ExecutableBase::isHostFunction): (JSC::ExecutableBase::generatedJITCodeForCall): (JSC::ExecutableBase::generatedJITCodeForConstruct): (JSC::NativeExecutable::NativeExecutable): (JSC::EvalExecutable::jitCode): (JSC::ProgramExecutable::jitCode): (JSC::FunctionExecutable::bytecodeForCall): (JSC::FunctionExecutable::isGeneratedForCall): (JSC::FunctionExecutable::generatedBytecodeForCall): (JSC::FunctionExecutable::bytecodeForConstruct): (JSC::FunctionExecutable::isGeneratedForConstruct): (JSC::FunctionExecutable::generatedBytecodeForConstruct): (JSC::FunctionExecutable::symbolTable): (JSC::FunctionExecutable::FunctionExecutable): (JSC::FunctionExecutable::jitCodeForCall): (JSC::FunctionExecutable::jitCodeForConstruct): * runtime/JSActivation.h: (JSC::JSActivation::JSActivationData::JSActivationData): * runtime/JSFunction.cpp: (JSC::JSFunction::~JSFunction): (JSC::JSFunction::call): (JSC::JSFunction::construct): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::numericCompareFunction): 2010-05-12 Oliver Hunt build fix REGRESSION (r59282): Tiger PPC build broken * runtime/UString.h: (JSC::tryMakeString): 2010-05-12 Oliver Hunt Reviewed by Gavin Barraclough. Incorrect 32-bit codegen for op_jnlesseq https://bugs.webkit.org/show_bug.cgi?id=39038 Correct the use of incorrect comparison operators. * jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emitBinaryDoubleOp): 2010-05-12 Caio Marcelo de Oliveira Filho Reviewed by Eric Seidel. JavaScriptCore: fix build when some optimizations are disabled https://bugs.webkit.org/show_bug.cgi?id=38800 Remove outdated UNUSED_PARAMs when using JIT but with ENABLE_JIT_OPTIMIZE_CALL and ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS disabled. * jit/JITOpcodes.cpp: * jit/JITOpcodes32_64.cpp: 2010-05-12 Oliver Hunt Reviewed by Gavin Barraclough. Work around GCC stupidity by either explicitly inlining or by using ALWAYS_INLINE * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): * runtime/UString.h: (JSC::UString::~UString): * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): (WTF::RefPtr::~RefPtr): * wtf/text/StringImpl.h: (WebCore::StringImpl::create): (WebCore::StringImpl::tryCreateUninitialized): 2010-05-12 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Detect debug mode consistently https://bugs.webkit.org/show_bug.cgi?id=38863 * JavaScriptCore.pri: * JavaScriptCore.pro: * jsc.pro: * qt/api/QtScript.pro: 2010-05-12 Peter Varga Reviewed by Gavin Barraclough. Remove a direct jump in generatePatternCharacterGreedy() and generatePatternCharacterClassGreedy() functions if quantityCount of the term is unlimited. https://bugs.webkit.org/show_bug.cgi?id=38898 * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy): (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy): 2010-05-11 Geoffrey Garen Reviewed by Gavin Barraclough. Slight simplification to the calling convention: read RegisterFile::end() from an absolute address, instead of from a pointer to the RegisterFile on the stack. SunSpider reports no change. This should free us to remove the RegisterFile argument from the stack. * jit/JIT.cpp: (JSC::JIT::privateCompile): 2010-05-11 Brian Weinstein Possible Gtk build fix - use ALWAYS_INLINE on functions that were inlined. * wtf/text/AtomicString.h: (WebCore::AtomicString::add): Use ALWAYS_INLINE. * wtf/text/WTFString.h: (WebCore::String::length): Ditto. (WebCore::String::isEmpty): Ditto. 2010-05-11 Anders Carlsson Reviewed by Sam Weinig. Add a compile time assert that sizeof(String) == sizeof(AtomicString). * wtf/text/AtomicString.cpp: 2010-05-11 Anders Carlsson Reviewed by Mark Rowe. https://bugs.webkit.org/show_bug.cgi?id=38961 Move some member variables around to reduce class sizes. Make AtomicString no longer inherit from FastAllocBase. Since AtomicString's first (and only) member variable, a RefPtr, also inherits from FastAllocBase this was causing the size of AtomicString to contain sizeof(void*) bytes of padding. * wtf/text/AtomicString.h: 2010-05-11 Brian Weinstein Reviewed by Maciej Stachowiak. Patch by Gavin Barraclough. Rest of REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF. https://bugs.webkit.org/show_bug.cgi?id=38930 Inline string functions that are commonly used in WTFString, CString, and AtomicString. * JavaScriptCore.exp: Remove exports of inline functions. * wtf/text/AtomicString.cpp: (WebCore::AtomicString::addSlowCase): Rename add to addSlowCase, and inline the fast path of add. * wtf/text/AtomicString.h: (WebCore::AtomicString::add): Inline the fast path of add. * wtf/text/CString.cpp: Inline implementation of data and length in the header. * wtf/text/CString.h: (WTF::CString::data): Inline implementation of data. (WTF::CString::length): Inline implementation of length. * wtf/text/WTFString.cpp: Remove implementations of functions to be inlined. * wtf/text/WTFString.h: (WebCore::String::String): Inline implementation. (WebCore::String::length): Ditto. (WebCore::String::characters): Ditto. (WebCore::String::operator[]): Ditto. (WebCore::String::isEmpty): Ditto. 2010-05-11 Brian Weinstein Reviewed by Steve Falkenburg and Jon Honeycutt. Patch by Gavin Barraclough. REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF. https://bugs.webkit.org/show_bug.cgi?id=38930 When the String classes were moved from WebCore to WTF, it meant that on Windows, all operations on Strings in WebCore had to cross a DLL boundary (from WebKit.dll to JavaScript.dll). We fix this by refactoring some of the WTF string code, so the code in AtomicString, StringImpl, and WTFString can be built by both WebCore and WTF, and we don't need to talk across a DLL to do operations on Strings. * GNUmakefile.am: Add new file to build system. * JavaScriptCore.gypi: Ditto. * JavaScriptCore.pro: Ditto. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove string exports, because these are now handled in WebCore. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove the post-build step that was added here (the post build step is in JavaScriptCoreCommon.vsprops). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Copy the three cpp files that need to be compiled by WebCore into the WebKitOutputDir directory. * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add the StringStatics file. * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add the three WTF string cpp files to this project. * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Remove the need to link against WTF.lib (since jsc links against JavaScriptCore). * JavaScriptCore.xcodeproj/project.pbxproj: Add the StringStatics file. * wtf/text/AtomicString.cpp: Moved code to StringStatics. * wtf/text/StringImpl.cpp: Ditto. * wtf/text/StringStatics.cpp: Added. Move functions in WTF Strings that define static variables to here, so the rest of the files can be compiled in WebCore. (WebCore::StringImpl::empty): Moved from StringImpl.cpp to here. (WebCore::AtomicString::init): Moved from AtomicString.cpp to here. 2010-05-11 Alice Liu Rubber-stamped by Gavin Barraclough. Fix build error when enabling debugging block in WebKit win painting code * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-11 Mark Rowe Fix the world. In r59162 a change was made to WebCore's FeatureDefines.xcconfig that enabled FILE_READER and FILE_WRITER. The author and reviewer of that patch ignored the carefully-worded warning at the top of that file asking that changes to the file be kept in sync across JavaScriptCore, WebCore and WebKit, as well as being kept in sync with build-webkit. This led to WebCore and WebKit having different views of Document's vtable and results in crashes in Safari shortly after launch when virtual function calls resulted in the wrong function in WebCore being called. We fix this by bringing the FeatureDefines.xcconfig files in to sync. Based on the ChangeLog message and other changes in r59162 it appears that enabling FILE_WRITER was unintentional so that particular change has been reverted. * Configurations/FeatureDefines.xcconfig: 2010-05-11 Sheriff Bot Unreviewed, rolling out r59171. http://trac.webkit.org/changeset/59171 https://bugs.webkit.org/show_bug.cgi?id=38933 "Broke the world" (Requested by bweinstein on #webkit). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.vcproj/jsc/jsc.vcproj: * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/text/AtomicString.cpp: (WebCore::AtomicString::init): * wtf/text/StringImpl.cpp: (WebCore::StringImpl::empty): * wtf/text/StringStatics.cpp: Removed. 2010-05-11 Brian Weinstein Reviewed by Steve Falkenburg. Patch by Gavin Barraclough. REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF. https://bugs.webkit.org/show_bug.cgi?id=38930 When the String classes were moved from WebCore to WTF, it meant that on Windows, all operations on Strings in WebCore had to cross a DLL boundary (from WebKit.dll to JavaScript.dll). We fix this by refactoring some of the WTF string code, so the code in AtomicString, StringImpl, and WTFString can be built by both WebCore and WTF, and we don't need to talk across a DLL to do operations on Strings. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove string exports, because these are now handled in WebCore. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove the post-build step that was added here (the post build step is in JavaScriptCoreCommon.vsprops). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Copy the three cpp files that need to be compiled by WebCore into the WebKitOutputDir directory. * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add the StringStatics file. * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add the three WTF string cpp files to this project. * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Remove the need to link against WTF.lib (since jsc links against JavaScriptCore). * JavaScriptCore.xcodeproj/project.pbxproj: Add the StringStatics file. * wtf/text/AtomicString.cpp: Moved code to StringStatics. * wtf/text/StringImpl.cpp: Ditto. * wtf/text/StringStatics.cpp: Added. Move functions in WTF Strings that define static variables to here, so the rest of the files can be compiled in WebCore. (WebCore::StringImpl::empty): Moved from StringImpl.cpp to here. (WebCore::AtomicString::init): Moved from AtomicString.cpp to here. 2010-05-11 Geoffrey Garen Fixed test failures seen on SnowLeopard buildbot. * runtime/JSString.cpp: (JSC::JSString::replaceCharacter): Don't use size_t and wtf::notFound. Instead, use the individual types and notFound values of the string APIs we're using, since they're not necessarily the same in 64bit. 2010-05-11 Geoffrey Garen Reviewed by Oliver Hunt and Darin Adler. Start using ropes in String.prototype.replace. 1%-1.5% speedup on SunSpider. * runtime/JSString.cpp: (JSC::JSString::resolveRope): Updated for RopeImpl refactoring. (JSC::JSString::replaceCharacter): Added a replaceCharacter function, which creates a rope for the resulting replacement. * runtime/JSString.h: A few changes here: (JSC::): (JSC::RopeBuilder::RopeIterator::RopeIterator): (JSC::RopeBuilder::RopeIterator::operator++): (JSC::RopeBuilder::RopeIterator::operator*): (JSC::RopeBuilder::RopeIterator::operator!=): (JSC::RopeBuilder::RopeIterator::WorkItem::WorkItem): (JSC::RopeBuilder::RopeIterator::WorkItem::operator!=): (JSC::RopeBuilder::RopeIterator::skipRopes): Created a RopeIterator abstraction. We use this to do a substring find without having to resolve the rope. (We could use this iterator when resolving ropes, too, but resolving ropes backwards is usually more efficient.) (JSC::RopeBuilder::JSString): Added constructors for 2 & 3 UStrings. (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): (JSC::RopeBuilder::size): Updated for RopeImpl refactoring. * runtime/Operations.h: Updated for RopeImpl refactoring. (JSC::jsString): Added jsString functions for 2 & 3 UStrings. * runtime/RopeImpl.cpp: (JSC::RopeImpl::derefFibersNonRecursive): * runtime/RopeImpl.h: (JSC::RopeImpl::initializeFiber): (JSC::RopeImpl::size): (JSC::RopeImpl::fibers): (JSC::RopeImpl::deref): (JSC::RopeImpl::RopeImpl): A little refactoring to make this patch easier: Moved statics to the top of the class; put multi-statement functions on multiple lines; renamed "fiberCount" to "size" to match other collections; changed the "fibers" accessor to return the fibers buffer, instead of an item in the buffer, to make iteration easier. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): Don't resolve a rope unless we need to. Do use our new replaceCharacter function if possible. Do use a rope to represent splicing three strings together. 2010-05-10 Laszlo Gombos Reviewed by Darin Adler. [Qt] Disable JIT support for mingw-w64 https://bugs.webkit.org/show_bug.cgi?id=38747 Disale JIT for mingw-w64 as it is reportedly unstable. Thanks for Vanboxem Rruben for the investigation. * wtf/Platform.h: 2010-05-09 Fumitoshi Ukai Reviewed by Eric Seidel. JavaScriptCore/wtf/MD5.h: checksum should take a reference to output. https://bugs.webkit.org/show_bug.cgi?id=38723 * JavaScriptCore.exp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * wtf/MD5.cpp: (WTF::expectMD5): Fix for checksum change. (WTF::MD5::checksum): Take a reference to output, instead of returning the result by value, to reduce coping for performance. * wtf/MD5.h: 2010-05-09 Oliver Hunt Build fix. Fix accidental repeat addition of emit_op_new_regexp * jit/JITOpcodes.cpp: 2010-05-09 Oliver Hunt Reviewed by Gavin Barraclough. REGRESSION(r57955): RegExp literals should not actually be cached, so r57955 should be rolled out. https://bugs.webkit.org/show_bug.cgi?id=38828 Rollout r57955 * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): (JSC::regexpName): (JSC::CodeBlock::dump): (JSC::CodeBlock::shrinkToFit): * bytecode/CodeBlock.h: (JSC::CodeBlock::addRegExp): (JSC::CodeBlock::regexp): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addRegExp): (JSC::BytecodeGenerator::emitNewRegExp): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::RegExpNode::emitBytecode): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_regexp): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::): 2010-05-09 Geoffrey Garen Reviewed by Oliver Hunt. Reserve a large-ish initial capacity for Lexer::m_buffer16. SunSpider says 0.3% faster. m_buffer16 is used when parsing complex strings -- for example, strings with escape sequences in them. These kinds of strings can be really long, and we want to avoid repeatedly copying as we grow m_buffer16. The net memory cost is quite low, since it's proporitional to source code we already have in memory, and we throw away m_buffer16 right when we're done parsing. * parser/Lexer.cpp: (JSC::Lexer::Lexer): No need to reserve initial capacity in our constructor, since setCode will be called before we're asked to lex anything. (JSC::Lexer::setCode): Reserve enough space to lex half the source code as a complex string without having to copy. (JSC::Lexer::clear): No need to reserve initial capacity here either, since setCode will be called before we're asked to lex anything. 2010-05-09 Laszlo Gombos Reviewed by Eric Seidel. [Qt] Remove YARR configuration rules from Qt make system https://bugs.webkit.org/show_bug.cgi?id=38819 Setting YARR based on JIT seeting is now in Platform.h for all ports. This patch essentially reverses r49238. * JavaScriptCore.pri: 2010-05-09 Oliver Hunt Reviewed by Maciej Stachowiak. Improve string indexing performance https://bugs.webkit.org/show_bug.cgi?id=38814 Add an assembly stub to do indexed loads from strings much more cheaply than the current stub dispatch logic. We can do this because we are able to make guarantees about the register contents when entering the stub so the call overhead is negligible. * jit/JIT.h: * jit/JITInlineMethods.h: * jit/JITOpcodes.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitSlow_op_get_by_val): Moved from JITOpcodes.cpp to keep the slowcase next to the normal case codegen as we do for everything else. * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitSlow_op_get_by_val): * jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::emitFastArithImmToInt): 2010-05-09 Maciej Stachowiak Fixed version of: "Optimized o[s] where o is a cell and s is a string" https://bugs.webkit.org/show_bug.cgi?id=38815 Fixed the previous patch for this from Geoff Garen. The two problems were a missing exception check and a PropertySlot initialized improperly, leading to crashes and failures in the case of getters accessed with bracket syntax. Previous patch: Optimized o[s] where o is a cell and s is a string, removing some old code that wasn't really tuned for the JIT. SunSpider says 0.8% faster. * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/JSCell.h: 2010-05-08 Laszlo Gombos Unreviewed, build fix. Fix missing terminating ' character warning The warning has been only seen on the Gtk buildbots. * wtf/Platform.h: 2010-05-08 Laszlo Gombos Reviewed by Gavin Barraclough. Refactor YARR and YARR_JIT default rules in Platform.h https://bugs.webkit.org/show_bug.cgi?id=38727 Turn on YARR and YARR JIT by default of JIT is enabled. Ports can overrule this default decisions as they wish. * wtf/Platform.h: 2010-05-08 Oliver Hunt Reviewed by Gavin Barraclough. Split JSVALUE32_64 code out of JITOpcodes.cpp and into JITOpcodes32_64.cpp https://bugs.webkit.org/show_bug.cgi?id=38808 * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JITOpcodes.cpp: * jit/JITOpcodes32_64.cpp: Added. (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_loop_if_lesseq): (JSC::JIT::emitSlow_op_loop_if_lesseq): (JSC::JIT::emit_op_new_object): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_tear_off_activation): (JSC::JIT::emit_op_tear_off_arguments): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_resolve): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emitSlow_op_to_primitive): (JSC::JIT::emit_op_strcat): (JSC::JIT::emit_op_resolve_base): (JSC::JIT::emit_op_resolve_skip): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global): (JSC::JIT::emit_op_not): (JSC::JIT::emitSlow_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emitSlow_op_jfalse): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emitSlow_op_jtrue): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_jsr): (JSC::JIT::emit_op_sret): (JSC::JIT::emit_op_eq): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emit_op_neq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emitSlow_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::emitSlow_op_nstricteq): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_resolve_with_base): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_get_pnames): (JSC::JIT::emit_op_next_pname): (JSC::JIT::emit_op_push_scope): (JSC::JIT::emit_op_pop_scope): (JSC::JIT::emit_op_to_jsnumber): (JSC::JIT::emitSlow_op_to_jsnumber): (JSC::JIT::emit_op_push_new_scope): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_jmp_scopes): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_new_error): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_enter_with_activation): (JSC::JIT::emit_op_create_arguments): (JSC::JIT::emit_op_init_arguments): (JSC::JIT::emit_op_convert_this): (JSC::JIT::emitSlow_op_convert_this): (JSC::JIT::emit_op_profile_will_call): (JSC::JIT::emit_op_profile_did_call): 2010-05-08 Gabor Loki Reviewed by Gavin Barraclough. Fix halfword loads on ARM https://bugs.webkit.org/show_bug.cgi?id=38741 The BaseIndex and ImplicitAddress are contain 32bit wide offset, but the load16 functions were working with 8 bit data (encoded in the instruction). If the offset cannot be encoded in an instruction, it should be stored in a temporary register. * assembler/ARMAssembler.h: (JSC::ARMAssembler::getOffsetForHalfwordDataTransfer): * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::load16): 2010-05-08 Gabor Loki Reviewed by Gavin Barraclough. Fix spanning branch instruction on Cortex-A8 with Thumb-2 JIT https://bugs.webkit.org/show_bug.cgi?id=38280 If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and the target of the branch falls within the first region it is possible for the processor to incorrectly determine the branch instruction, and it is also possible in some cases for the processor to enter a deadlock state. * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::linkJumpAbsolute): 2010-05-08 Adam Barth Reviewed by Darin Fisher. [WTFURL] Add a buffer for managing the output of the canonicalizer https://bugs.webkit.org/show_bug.cgi?id=38671 The canonicalizer produces a stream of canonicalized characters, which we will store in a URLBuffer. URLBuffer is quite similar to Vector, but serves as an abstraction to isolate us from the underlying character storage. In the case of WebKit, we'll probably implement a subclass of URLBuffer with Vector. In Chromium, the backing store is a std::string, which avoids an unnecessary memcpy that would be caused by using Vector instead. * wtf/url/src/URLBuffer.h: Added. (WTF::URLBuffer::URLBuffer): (WTF::URLBuffer::~URLBuffer): (WTF::URLBuffer::at): (WTF::URLBuffer::set): (WTF::URLBuffer::capacity): (WTF::URLBuffer::length): (WTF::URLBuffer::data): (WTF::URLBuffer::setLength): (WTF::URLBuffer::append): (WTF::URLBuffer::grow): 2010-05-08 Eric Seidel Unreviewed, just reverting commit. REGRESSION(59000): r59000 contained all sorts of changes it should not have, needs revert. https://bugs.webkit.org/show_bug.cgi?id=38798 * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitResolve): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_resolve_global): 2010-05-04 Jer Noble Reviewed by Maciej Stachowiak Safari pegs CPU and drops tons of frames using HTML5 Vimeo player Added cancelCallOnMainThread. callOnMainThread should always now be paired with cancelCallOnMainThread in situations where the refcon passed to callOnMainThread may be dealloced before the main thread function can be dispatched. * wtf/MainThread.cpp: (WTF::FunctionWithContext::operator == ): Supports the FunctionWithContextFinder predicate functor. (WTF::FunctionWithContextFinder::FunctionWithContextFinder): Predicate functor for use with Dequeue::findIf (WTF::FunctionWithContextFinder::operator()): (WTF::cancelCallOnMainThread): * wtf/MainThread.h: 2010-05-07 Oliver Hunt Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-07 Eric Seidel Unreviewed, rolling out r58990. http://trac.webkit.org/changeset/58990 Broke 4 tests on Snow Leopard and Qt. * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/JSCell.h: 2010-05-07 Oliver Hunt Reviewed by Gavin Barraclough. Optimize access to the global object from a function that uses eval https://bugs.webkit.org/show_bug.cgi?id=38644 Fix bug where cross scope access to a global var (vs. property) would be allowed without checking for intervening dynamic scopes. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitResolve): 2010-05-07 Oliver Hunt 32-bit buildfix. Macro expansion I stab at thee! * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_resolve_global): 2010-05-07 Geoffrey Garen Reviewed by Darin Adler. Optimized o[s] where o is a cell and s is a string, removing some old code that wasn't really tuned for the JIT. SunSpider says 0.8% faster. * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/JSCell.h: 2010-05-07 Oliver Hunt Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-07 Oliver Hunt Reviewed by Geoffrey Garen. Optimize access to the global object from a function that uses eval https://bugs.webkit.org/show_bug.cgi?id=38644 Add op_resolve_global_dynamic, a variant of op_resolve_global that checks each node in the scope chain for dynamically inserted properties and falls back to the normal resolve logic in that case. * JavaScriptCore.exp: * bytecode/CodeBlock.cpp: (JSC::isGlobalResolve): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::derefStructures): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::findScopedProperty): Now take an additional reference parameter to used to indicate that there were nodes that may gain dynamic properties (JSC::BytecodeGenerator::emitResolve): (JSC::BytecodeGenerator::emitResolveBase): (JSC::BytecodeGenerator::emitResolveWithBase): deal with additional argument to findScopedProperty * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): (JSC::PostfixResolveNode::emitBytecode): (JSC::PrefixResolveNode::emitBytecode): (JSC::ReadModifyResolveNode::emitBytecode): (JSC::AssignResolveNode::emitBytecode): These functions use findScopedProperty directly in order to optimise lookup. They cannot trivially handle any degree of dynamism in the lookup so we just give up in such case. * interpreter/Interpreter.cpp: (JSC::Interpreter::resolveGlobalDynamic): (JSC::Interpreter::execute): (JSC::Interpreter::privateExecute): * interpreter/Interpreter.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emit_op_resolve_global_dynamic): (JSC::JIT::emitSlow_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global_dynamic): Happily resolve_global_dynamic can share the slow case! * jit/JITStubs.h: (JSC::): * runtime/JSActivation.cpp: (JSC::JSActivation::isDynamicScope): * runtime/JSActivation.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::isDynamicScope): * runtime/JSGlobalObject.h: * runtime/JSStaticScopeObject.cpp: (JSC::JSStaticScopeObject::isDynamicScope): * runtime/JSStaticScopeObject.h: * runtime/JSVariableObject.h: 2010-05-07 Geoffrey Garen Reviewed by Gavin Barraclough. Fixed Sputnik failure seen on buildbot. * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): Cast to unsigned before checking magnitude, to efficiently exclude negative numbers, which require two characters instead of one. 2010-05-07 Geoffrey Garen Reviewed by Alexey Proskuryakov. Slightly more effective way to guarantee a compile-time constant, at least on gcc. * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): Use pointer notation instead of array notation, so the compiler treats the string and its contents as constant. 2010-05-07 Adam Barth Reviewed by Alexey Proskuryakov. [WTFURL] Add core URL parser https://bugs.webkit.org/show_bug.cgi?id=38572 This patch adds the core of the URL parser. The URL parser uses a templated notion of a code unit to support different string types. Later we'll add some non-templated APIs with concrete types that clients can use more conveniently. The URLParser has a couple calls to ASSERT(), which I've commented out for now. I'm not 100% sure how to handle the dependency issues there yet, so I've punted on the issue for now. Also, there are a number of methods that are declared public in this patch that are only used by the canonicalizer. My plan is to make those private or protected and make the canonicalizer a friend of the parser. The details will be in a later patch. * wtf/url/src/URLComponent.h: (WTF::URLComponent::fromRange): (WTF::URLComponent::isNonEmpty): (WTF::URLComponent::isEmptyOrInvalid): * wtf/url/src/URLParser.h: Added. (WTF::URLParser::): (WTF::URLParser::isPossibleAuthorityTerminator): (WTF::URLParser::parseAuthority): (WTF::URLParser::extractScheme): (WTF::URLParser::parseAfterScheme): (WTF::URLParser::parseStandardURL): (WTF::URLParser::parsePath): (WTF::URLParser::parsePathURL): (WTF::URLParser::parseMailtoURL): (WTF::URLParser::parsePort): (WTF::URLParser::extractFileName): (WTF::URLParser::extractQueryKeyValue): (WTF::URLParser::isURLSlash): (WTF::URLParser::shouldTrimFromURL): (WTF::URLParser::trimURL): (WTF::URLParser::consecutiveSlashes): (WTF::URLParser::isPortDigit): (WTF::URLParser::nextAuthorityTerminator): (WTF::URLParser::parseUserInfo): (WTF::URLParser::parseServerInfo): 2010-05-07 Geoffrey Garen Reviewed by Oliver Hunt. Added a fast path for number-to-character conversion via Number.prototype.toString base 36. 0.7% speedup on SunSpider. * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): Made radix interpretation a little more efficient by keeping it in int space. Turned "const char" into "static const char" just in case. Added a fast path for base 36 conversion of something that will turn into a character. 2010-05-07 Adam Barth Reviewed by Darin Fisher. [WTFURL] Add a malloc-backed URLBuffer https://bugs.webkit.org/show_bug.cgi?id=38694 This patch adds a URLBuffer that uses new/delete to manage the backing store for the buffer. * wtf/url/src/RawURLBuffer.h: Added. (WTF::RawURLBuffer::RawURLBuffer): (WTF::RawURLBuffer::~RawURLBuffer): (WTF::RawURLBuffer::resize): 2010-05-06 Fumitoshi Ukai Reviewed by Alexey Proskuryakov. JavaScriptCore/wtf/RandomNumber.h should provide using WTF::* https://bugs.webkit.org/show_bug.cgi?id=38719 * wtf/RandomNumber.h: Add using directives. 2010-05-06 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Enable YARR_JIT for X86 Mac for QtWebKit https://bugs.webkit.org/show_bug.cgi?id=38668 * wtf/Platform.h: 2010-05-06 Gavin Barraclough Reviewed by Geoff Garen. Bug 38714 - Add result caching for Math.sin Math.sin is frequently called with the same operand, caching the result should improve performance. CachedTranscendentalFunction adds a generic mechanism to cache results for pure functions with the signature "double func(double)", and where NaN maps to NaN. CachedTranscendentalFunction uses a very simple hash function designed to be fast to execute since we cannot cache the result, and trivial to JIT generate, should we wish to do so. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/CachedTranscendentalFunction.h: Added. (JSC::CachedTranscendentalFunction::CachedTranscendentalFunction): (JSC::CachedTranscendentalFunction::~CachedTranscendentalFunction): (JSC::CachedTranscendentalFunction::operator()): (JSC::CachedTranscendentalFunction::initialize): (JSC::CachedTranscendentalFunction::hash): * runtime/JSGlobalData.h: * runtime/MathObject.cpp: (JSC::mathProtoFuncSin): * wtf/Platform.h: 2010-05-06 Geoffrey Garen Windows build fix. * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::sample): Use a cast, so Windows will be happy when this code is enabled. * wtf/Platform.h: Reverted last change to this file, which seems to have been accidental. 2010-05-06 Gavin Barraclough Reviewed by Oliver Hunt. Add compile switch to make debugger keyword plant breakpoint instructions. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitDebugHook): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_debug): * wtf/Platform.h: 2010-05-06 Oliver Hunt Build fix Fix ARM builds * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::load16): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::load16): 2010-05-06 Oliver Hunt Reviewed by Geoffrey Garen. Improve performance of single character string compares https://bugs.webkit.org/show_bug.cgi?id=38659 Add logic to the jit to identify comparisons to single character string literals and then just perform the comparison inline, rather than ignoring the evidence and attempting to perform an integer comparison. Multiple changes required -- add jnlesseq opcode, add helper function to identify single character string constants, add a helper to load single character strings. Then add the 32_64 and normal codepaths to the JIT. * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::load16): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitJumpIfTrue): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jnless): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emit_op_jless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jnlesseq): * jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_jnless): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emit_op_jless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitBinaryDoubleOp): * jit/JITInlineMethods.h: (JSC::JIT::emitLoadCharacterString): (JSC::JIT::isOperandConstantImmediateChar): * jit/JSInterfaceJIT.h: (JSC::ThunkHelpers::stringImplDataOffset): (JSC::ThunkHelpers::jsStringLengthOffset): (JSC::ThunkHelpers::jsStringValueOffset): Moved from ThunkGenerators to make it possible to share. * jit/ThunkGenerators.cpp: 2010-05-06 Martin Robinson Reviewed by Gustavo Noronha Silva. [GTK] Enable DOM clipboard and drag-and-drop access https://bugs.webkit.org/show_bug.cgi?id=30623 Convert dragging portion of drag-and-drop to use DataObjectGtk. * wtf/gobject/GRefPtr.h: Add forward declarations for GObject functions. 2010-05-06 Steve Block Reviewed by Eric Seidel. MAC_JAVA_BRIDGE should be renamed JAVA_BRIDGE https://bugs.webkit.org/show_bug.cgi?id=38544 * wtf/Platform.h: 2010-05-06 Adam Barth Reviewed by Maciej Stachowiak. [WTFURL] Add a class to represent the segments of a URL https://bugs.webkit.org/show_bug.cgi?id=38566 When paired with a string, this class represents a parsed URL. * wtf/url/src/URLSegments.cpp: Added. (WTF::URLSegments::length): (WTF::URLSegments::charactersBefore): * wtf/url/src/URLSegments.h: Added. (WTF::URLSegments::): (WTF::URLSegments::URLSegments): * wtf/url/wtfurl.gyp: 2010-05-05 Tony Gentilcore Reviewed by Adam Barth. Adding comment with link to RefPtr documentation. https://bugs.webkit.org/show_bug.cgi?id=38601 * wtf/RefPtr.h: 2010-05-05 Gavin Barraclough Reviewed by Darin Adler. Bug 38604 - workers-gc2 crashing on Qt This appears to be due to a couple of issues. (1) When the atomic string table is deleted it does not clear the 'inTable' bit on AtomicStrings - it implicitly assumes that all AtomicStrings have already been deleted at this point (otherwise they will crash in their destructor when they try to remove themselves from the atomic string table). (2) We don't fix the ordering in which WTF::WTFThreadData and WebCore::ThreadGlobalData are destructed. We should make sure that ThreadGlobalData is cleaned up before worker threads terminate and WTF::WTFThreadData is destroyed, and we should clear the inTable bit of members on atomic string table destruction. WTF changes (fix issue 1, above) - ensure inTable property is cleared when the atomic string table is destroyed (also, rename InTable to IsAtomic, to make it clear which table we are refering to!) * wtf/text/AtomicString.cpp: (WebCore::AtomicStringTable::destroy): (WebCore::CStringTranslator::translate): (WebCore::UCharBufferTranslator::translate): (WebCore::HashAndCharactersTranslator::translate): (WebCore::AtomicString::add): * wtf/text/StringImpl.cpp: (WebCore::StringImpl::~StringImpl): * wtf/text/StringImpl.h: (WebCore::StringImpl::isAtomic): (WebCore::StringImpl::setIsAtomic): * wtf/text/StringImplBase.h: 2010-05-05 Oliver Hunt Reviewed by Geoffrey Garen. Make Array.join specialised for actual arrays https://bugs.webkit.org/show_bug.cgi?id=38592 Bring Array.join in line with the other array methods by specialising for this === an array. * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncJoin): 2010-05-04 Yongjun Zhang Reviewed by Darin Adler. WebKit crashes at DebuggerCallFrame::functionName() if m_callFrame is the top global callframe. https://bugs.webkit.org/show_bug.cgi?id=38535 Don't call asFunction if callee is not a FunctionType to prevent assertion failure in JSCell::isObject(). * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::functionName): (JSC::DebuggerCallFrame::calculatedFunctionName): 2010-05-04 Steve Falkenburg Remove redundant exports to fix Windows build warnings. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-05-04 Jedrzej Nowacki Reviewed by Holger Freyther. Fix a memory leak inside the QScriptValue. QSciptValuePrivate::toString should release all temporary variables. [Qt] QScriptValue::toString have a memory leak. https://bugs.webkit.org/show_bug.cgi?id=38112 * qt/api/qscriptvalue_p.h: (QScriptValuePrivate::toString): 2010-05-04 Gustavo Noronha Silva Reviewed by Darin Adler. Does not work on SPARC because of alignment issues https://bugs.webkit.org/show_bug.cgi?id=38455 Use AllocAlignmentInteger instead of void* on pageheap_memory to avoid crashing at runtime in some architectures. Investigated by Mike Hommey , change suggested by Darin Adler. * wtf/FastMalloc.cpp: 2010-05-04 Adam Barth Reviewed by Maciej Stachowiak. Add first WTFURL file https://bugs.webkit.org/show_bug.cgi?id=38470 This class represents a component of a URL, such as the scheme or path. Essentially, the class is an index into a string buffer. * wtf/url: Added. - There was some discussion about where to put the URL library. There are a number of reasonable options, but putting the library in the WTF directory seems like a reasonable alternative. This location will make more sense once WTF is moved out of JavaScriptCore and into a top-level directory. * wtf/url/src: Added. - I've added this extra directory to the usual structure because we eventually want a "public" folder that defines the public interface to this library that clients outside of svn.webkit.org can rely upon, much like the various subfolders of the WebKit directory often define a public API. * wtf/url/src/URLComponent.h: Added. - I've added this somewhat trivial class to get the ball rolling. (WTF::URLComponent::URLComponent): (WTF::URLComponent::isValid): (WTF::URLComponent::isNonempty): (WTF::URLComponent::reset): (WTF::URLComponent::operator==): (WTF::URLComponent::begin): (WTF::URLComponent::setBegin): (WTF::URLComponent::length): (WTF::URLComponent::setLength): (WTF::URLComponent::end): * wtf/url/wtfurl.gyp: Added. - WTFURL will be an independently buildable library, hence the beginnings of a wtfurl.gyp file. 2010-05-03 Stephanie Lewis Reviewed by Geoff Garen. https://bugs.webkit.org/show_bug.cgi?id=38368 REGRESSSION: 1.5% PLT regression due to 56028 (return memory quicker). Instead of returning everything but the smallest spans spread out the spans kept over several size lists. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::scavenge): 2010-05-03 James Robinson Reviewed by Eric Seidel. Clean up a few compiler warnings https://bugs.webkit.org/show_bug.cgi?id=38073 * wtf/text/StringImpl.cpp: (WebCore::StringImpl::ascii): 2010-05-03 Gavin Barraclough Reviewed by NOBODY (reverting previous commit). Rolling out r58114 - this introduced memory leaks of AtomicStrings then workers terminated. * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * jit/ThunkGenerators.cpp: (JSC::ThunkHelpers::stringImplDataOffset): * runtime/Identifier.cpp: (JSC::IdentifierTable::~IdentifierTable): (JSC::IdentifierTable::add): (JSC::IdentifierCStringTranslator::hash): (JSC::IdentifierCStringTranslator::equal): (JSC::IdentifierCStringTranslator::translate): (JSC::Identifier::add): (JSC::IdentifierUCharBufferTranslator::hash): (JSC::IdentifierUCharBufferTranslator::equal): (JSC::IdentifierUCharBufferTranslator::translate): (JSC::Identifier::addSlowCase): * runtime/Identifier.h: * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): * runtime/JSGlobalData.h: * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): (WTF::WTFThreadData::~WTFThreadData): * wtf/WTFThreadData.h: (JSC::IdentifierTable::remove): (JSC::IdentifierTable::literalTable): (WTF::WTFThreadData::atomicStringTable): * wtf/text/AtomicString.cpp: (WebCore::AtomicStringTable::create): (WebCore::AtomicStringTable::table): (WebCore::AtomicStringTable::destroy): (WebCore::stringTable): (WebCore::CStringTranslator::hash): (WebCore::CStringTranslator::equal): (WebCore::CStringTranslator::translate): (WebCore::operator==): (WebCore::AtomicString::add): (WebCore::equal): (WebCore::UCharBufferTranslator::hash): (WebCore::UCharBufferTranslator::equal): (WebCore::UCharBufferTranslator::translate): (WebCore::HashAndCharactersTranslator::hash): (WebCore::HashAndCharactersTranslator::equal): (WebCore::HashAndCharactersTranslator::translate): (WebCore::AtomicString::find): (WebCore::AtomicString::remove): * wtf/text/AtomicStringTable.h: Removed. * wtf/text/StringImpl.cpp: (WebCore::StringImpl::~StringImpl): * wtf/text/StringImpl.h: (WebCore::StringImpl::inTable): (WebCore::StringImpl::setInTable): (WebCore::equal): * wtf/text/StringImplBase.h: (WTF::StringImplBase::StringImplBase): 2010-05-03 Kevin Watters Reviewed by Kevin Ollivier. [wx] Implement scheduleDispatchFunctionsOnMainThread for wx port. https://bugs.webkit.org/show_bug.cgi?id=38480 * wtf/wx/MainThreadWx.cpp: (wxCallAfter::wxCallAfter): (wxCallAfter::OnCallback): (WTF::scheduleDispatchFunctionsOnMainThread): 2010-05-03 Kevin Watters Reviewed by Kevin Ollivier. [wx] Build and use Mac's ComplexTextController to support complex text in wx. https://bugs.webkit.org/show_bug.cgi?id=38482 * wtf/Platform.h: 2010-05-03 Oliver Hunt Reviewed by Maciej Stachowiak. Interpreter crashes due to incorrect refcounting of cached structures. https://bugs.webkit.org/show_bug.cgi?id=38491 rdar://problem/7926160 Make sure we ref/deref structures used for cached custom property getters * bytecode/CodeBlock.cpp: (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::refStructures): 2010-05-02 Laszlo Gombos Reviewed by Eric Seidel. [Qt] Enable JIT for QtWebKit on Symbian https://bugs.webkit.org/show_bug.cgi?id=38339 JIT on Symbian has been stable for quite some time, it is time to turn it on by default. * wtf/Platform.h: 2010-04-29 Oliver Hunt Reviewed by Gavin Barraclough. Add codegen support for unsigned right shift https://bugs.webkit.org/show_bug.cgi?id=38375 Expose unsigned right shift in the macro assembler, and make use of it from the jit. Currently if the result is outside the range 0..2^31-1 we simply fall back to the slow case, even in JSVALUE64 and JSVALUE32_64 where technically we could still return an immediate value. * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::urshift32): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::urshift32): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::urshift32): * assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::shrl_i8r): (JSC::X86Assembler::shrl_CLr): Add unsigned right shift to the x86 assembler * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): op_rshift no longer simply get thrown to a stub function * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_urshift): (JSC::JIT::emitSlow_op_urshift): JSVALUE32 and JSVALUE64 implementation. Only supports double lhs in JSVALUE64. * jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::JIT::emitSlow_op_urshift): Refactor right shift code to have shared implementation between signed and unsigned versions. 2010-04-29 Oliver Hunt Reviewed by Gavin Barraclough. Handle double on righthand side of a right shift https://bugs.webkit.org/show_bug.cgi?id=38363 In 64-bit we support right shift of a double, and there's no reason not to in 32-bit either. This is a 1.1% sunspider improvement in 32bit. Given high performance javascript code frequently makes use of bit operators to perform double->int conversion i'll follow this patch up with similar patches for bitwise 'and' and 'or'. * jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_rshift): 2010-04-29 Oliver Hunt Reviewed by Geoff Garen. Hoist JSVALUE32_64 arithmetic implementations into a separate file. * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JITArithmetic.cpp: (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emit_op_mod): (JSC::JIT::compileBinaryArithOpSlowCase): (JSC::JIT::emit_op_div): (JSC::JIT::compileBinaryArithOp): * jit/JITArithmetic32_64.cpp: Added. (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emit_op_jnless): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emit_op_jless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitSlow_op_lshift): (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_rshift): (JSC::JIT::emit_op_bitand): (JSC::JIT::emitSlow_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emitSlow_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emitSlow_op_bitxor): (JSC::JIT::emit_op_bitnot): (JSC::JIT::emitSlow_op_bitnot): (JSC::JIT::emit_op_post_inc): (JSC::JIT::emitSlow_op_post_inc): (JSC::JIT::emit_op_post_dec): (JSC::JIT::emitSlow_op_post_dec): (JSC::JIT::emit_op_pre_inc): (JSC::JIT::emitSlow_op_pre_inc): (JSC::JIT::emit_op_pre_dec): (JSC::JIT::emitSlow_op_pre_dec): (JSC::JIT::emit_op_add): (JSC::JIT::emitAdd32Constant): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSub32Constant): (JSC::JIT::emitSlow_op_sub): (JSC::JIT::emitBinaryDoubleOp): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_div): (JSC::JIT::emitSlow_op_div): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): 2010-04-29 Zoltan Herczeg Reviewed by Oliver Hunt Add sqrt() instruction support for ARM assembler (using VFP) https://bugs.webkit.org/show_bug.cgi?id=38312 * assembler/ARMAssembler.h: (JSC::ARMAssembler::): (JSC::ARMAssembler::fsqrtd_r): * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::supportsFloatingPointSqrt): (JSC::MacroAssemblerARM::sqrtDouble): 2010-04-29 Laszlo Gombos Reviewed by Simon Hausmann. [Qt] Refactor qtscriptglobal.h https://bugs.webkit.org/show_bug.cgi?id=37953 Use the same pattern in qtscriptglobal.h as in qwebkitglobal.h without checking for specific OSs. * qt/api/qtscriptglobal.h: 2010-04-29 Jedrzej Nowacki Reviewed by Simon Hausmann. Small cleanup. QScriptValuePrivate constructor shouldn't take QScriptEngine pointer as a parameter, because it breaks a private / public separation rule. QScriptEnginePrivate::get(QScriptEngine*) should return a QScriptEnginePrivate pointer instead of a QScriptEnginePtr, it simplifies implementation. [Qt] QScriptValuePrivate class needs some cleanup. https://bugs.webkit.org/show_bug.cgi?id=37729 * qt/api/qscriptengine_p.h: (QScriptEnginePrivate::get): * qt/api/qscriptvalue.cpp: (QScriptValue::QScriptValue): * qt/api/qscriptvalue_p.h: (QScriptValuePrivate::QScriptValuePrivate): 2010-04-29 Kwang Yul Seo Reviewed by Simon Hausmann. [WINCE] Export g_stackBase with JS_EXPORTDATA https://bugs.webkit.org/show_bug.cgi?id=37437 Export g_stackBase with JS_EXPORTDATA as it is used by SharedTimerWince.cpp. * runtime/Collector.cpp: 2010-04-28 Oliver Hunt Do an unordered compare so that we don't treat NaN incorrectly. RS=Gavin Barraclough * jit/ThunkGenerators.cpp: (JSC::powThunkGenerator): 2010-04-28 Oliver Hunt Reviewed by Gavin Barraclough. Add fast paths for Math.pow and Math.sqrt https://bugs.webkit.org/show_bug.cgi?id=38294 Add specialized thunks for Math.pow and Math.sqrt. This requires adding a sqrtDouble function to the MacroAssembler and sqrtsd to the x86 assembler. Math.pow is slightly more complicated, in that we have to implement exponentiation ourselves rather than relying on hardware support. The inline exponentiation is restricted to positive integer exponents on a numeric base. Exponentiation is finally performed through the "Exponentiation by Squaring" algorithm. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr): * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::supportsFloatingPointSqrt): (JSC::MacroAssemblerARM::loadDouble): (JSC::MacroAssemblerARM::sqrtDouble): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::supportsFloatingPointSqrt): (JSC::MacroAssemblerARMv7::sqrtDouble): * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::loadDouble): (JSC::MacroAssemblerX86::supportsFloatingPointSqrt): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::sqrtDouble): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::loadDouble): (JSC::MacroAssemblerX86_64::supportsFloatingPointSqrt): * assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::movsd_mr): (JSC::X86Assembler::sqrtsd_rr): (JSC::X86Assembler::X86InstructionFormatter::twoByteOp): (JSC::X86Assembler::X86InstructionFormatter::memoryModRM): * create_hash_table: * jit/JIT.h: * jit/JITInlineMethods.h: * jit/JITOpcodes.cpp: * jit/JITStubs.h: (JSC::JITThunks::ctiNativeCallThunk): * jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::emitLoadDouble): (JSC::JSInterfaceJIT::emitJumpIfImmediateNumber): (JSC::JSInterfaceJIT::emitJumpIfNotImmediateNumber): (JSC::JSInterfaceJIT::emitLoadInt32): * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::loadDoubleArgument): (JSC::SpecializedThunkJIT::loadInt32Argument): (JSC::SpecializedThunkJIT::returnJSValue): (JSC::SpecializedThunkJIT::returnDouble): (JSC::SpecializedThunkJIT::finalize): * jit/ThunkGenerators.cpp: (JSC::sqrtThunkGenerator): (JSC::powThunkGenerator): * jit/ThunkGenerators.h: * runtime/Executable.h: (JSC::NativeExecutable::NativeExecutable): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): 2010-04-28 Mike Thole Reviewed by Mark Rowe. Reenable WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK now that an exports file for it has been added. * wtf/Platform.h: 2010-04-28 Mike Thole Build fix, not reviewed. * wtf/Platform.h: Disable WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK until an exports file is created. 2010-04-28 Mike Thole Reviewed by David Kilzer. Add canAuthenticateAgainstProtectionSpace() to frame loader so that a protection space can be inspected before attempting to authenticate against it https://bugs.webkit.org/show_bug.cgi?id=38271 * wtf/Platform.h: Add WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK define. 2010-04-28 Darin Adler Reviewed by Sam Weinig. Don't use CFAbsoluteTimeGetCurrent on Mac OS X, since it's just a cover for gettimeofday anyway. * wtf/CurrentTime.cpp: (WTF::currentTime): Remove the CF version of this. Change the "other POSIX" version to pass 0 for the time zone instead of ignoring a return value. Also get rid of unneeded type casts, since operations involving both integers and doubles are always evaluated as doubles in C without explicit type casting. 2010-04-28 Darin Fisher Reviewed by David Levin. [Chromium] callOnMainThread should equate to MessageLoop::PostTask https://bugs.webkit.org/show_bug.cgi?id=38276 * JavaScriptCore.gyp/JavaScriptCore.gyp: * wtf/MainThread.cpp: * wtf/chromium/ChromiumThreading.h: * wtf/chromium/MainThreadChromium.cpp: (WTF::initializeMainThread): (WTF::callOnMainThread): (WTF::callOnMainThreadAndWait): (WTF::setMainThreadCallbacksPaused): (WTF::isMainThread): 2010-04-28 Simon Hausmann , Kent Hansen Reviewed by Darin Adler. JSC's currentThreadStackBase is not reentrant on some platforms https://bugs.webkit.org/show_bug.cgi?id=37195 This function needs to be reentrant to avoid memory corruption on platforms where the implementation uses global variables. This patch adds a mutex lock where necessary and makes the Symbian implementation reentrant. * runtime/Collector.cpp: (JSC::currentThreadStackBaseMutex): (JSC::currentThreadStackBase): 2010-04-28 Thiago Macieira Reviewed by Simon Hausmann. Fix compilation with gcc 3.4. AtomicStringImpl.h:29: error: base `WebCore::StringImpl' with only non-default constructor in class without a constructor * wtf/text/AtomicStringImpl.h: (WebCore::AtomicStringImpl::AtomicStringImpl): Provide a default constructor. * wtf/text/StringImpl.h: Allow AtomicStringImpl to call a StringImpl constructor through a friend declaration. 2010-04-27 Stephanie Lewis Fix Tiger build. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::Carve): 2010-04-26 Stephanie Lewis Reviewed by Geoff Garen. https://bugs.webkit.org/show_bug.cgi?id=38154 FastMalloc calls madvise too often. REGRESSSION: 1.5% PLT regression due to 56028 (return memory quicker). To save on madvise calls when recommitting memory recommit the entire span and then carve it instead of carving the span up and only committing the part that will be used immediately. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::New): (WTF::TCMalloc_PageHeap::AllocLarge): (WTF::TCMalloc_PageHeap::Carve): 2010-04-26 Oliver Hunt Reviewed by Maciej Stachowiak. Add specialized thunks for a char code related string functions https://bugs.webkit.org/show_bug.cgi?id=38177 This is a simple extension to my prior patch. Basically hoist the existing character loading logic from the charCodeAt thunk and into a helper function, then add a helper to load strings from the small string cache. This allows trivial implementations of fromCharCode and charAt. * create_hash_table: * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::returnJSCell): (JSC::SpecializedThunkJIT::tagReturnAsJSCell): * jit/ThunkGenerators.cpp: (JSC::stringCharLoad): (JSC::charToString): (JSC::charCodeAtThunkGenerator): (JSC::charAtThunkGenerator): (JSC::fromCharCodeThunkGenerator): * jit/ThunkGenerators.h: * runtime/SmallStrings.h: (JSC::SmallStrings::singleCharacterStrings): * runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): 2010-04-27 Thomas Zander Reviewed by Simon Hausmann. [Qt] Fix the build on Symbian on Linux using the Makefile based mkspec * JavaScriptCore.pri: It is necessary to specify the library search path when linking against JavaScriptCore. 2010-04-21 Jocelyn Turcotte Reviewed by Simon Hausmann. Compile fix for Visual Studio 2010 https://bugs.webkit.org/show_bug.cgi?id=37867 Patch by Prasanth Ullattil * runtime/Structure.cpp: (JSC::Structure::transitionTableAdd): * wtf/MathExtras.h: * wtf/Platform.h: 2010-04-27 Jocelyn Turcotte Reviewed by Simon Hausmann. Rename COMPILER(MSVC7) to COMPILER(MSVC7_OR_LOWER) * config.h: (JSC::Structure::transitionTableAdd): * wtf/Assertions.h: * wtf/Atomics.h: * wtf/CurrentTime.h: (WTF::getLocalTime): * wtf/Platform.h: * wtf/StaticConstructors.h: * wtf/StringExtras.h: * wtf/Vector.h: (WTF::::append): 2010-04-15 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Fix Mac build break. https://bugs.webkit.org/show_bug.cgi?id=37867 - Make sure JavaScriptCore's debug_and_release config follows that of WebCore. - Use different name for JavaScriptCore target in debug and release since they might be written in the same path at the same time on parallel builds - Consolidate the DESTDIR determination logic in JavaScriptCore.pri * JavaScriptCore.pri: * JavaScriptCore.pro: 2010-04-21 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Make sure WebKit is not compiled using C++0x. https://bugs.webkit.org/show_bug.cgi?id=37867 As the rest of Qt compiles in the C++0x mode, people might start compiling it in this mode. WebKit don't support this yet. Patch by Thiago Macieira * JavaScriptCore.pro: 2010-04-26 Oliver Hunt Fix windows * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::argumentToVirtualRegister): 2010-04-26 Oliver Hunt Reviewed by Gavin Barraclough. Need to support more efficient dispatch of lightweight builtins https://bugs.webkit.org/show_bug.cgi?id=38155 The problem with calling lightweight builtins is that marshalling the call from the nitro calling convention to the system calling convention is very expensive relative to the cost of the actually evaluating the function. To work around this problem this patch adds the ability to define a custom thunk for a builtin. This allows us to use high performance custom implementations of the common and sensible versions of simple builtins. This patch includes a simple (use of which is currently hardcoded) thunk for charCodeAt. This adds a JSInterfaceJIT subclass called SpecializedThunkJIT that has helper functions to remove (or at least reduce) the need to have separate thunk implementations for each JSValue encoding. * GNUmakefile.am: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: Many project file updates * create_hash_table: Add thunk generation callbacks to the hash tables, currently we hardcode the script to only support charCodeAt * jit/JITStubCall.h: * jit/JITStubs.cpp: (JSC::JITThunks::~JITThunks): (JSC::JITThunks::specializedThunk): * jit/JITStubs.h: * jit/SpecializedThunkJIT.h: Added. (JSC::SpecializedThunkJIT::SpecializedThunkJIT): (JSC::SpecializedThunkJIT::loadCellArgument): (JSC::SpecializedThunkJIT::loadJSStringArgument): (JSC::SpecializedThunkJIT::loadInt32Argument): (JSC::SpecializedThunkJIT::appendFailure): (JSC::SpecializedThunkJIT::returnInt32): (JSC::SpecializedThunkJIT::finalize): (JSC::SpecializedThunkJIT::argumentToVirtualRegister): (JSC::SpecializedThunkJIT::tagReturnAsInt32): * jit/ThunkGenerators.cpp: Added. (JSC::ThunkHelpers::stringImplDataOffset): (JSC::ThunkHelpers::jsStringLengthOffset): (JSC::ThunkHelpers::jsStringValueOffset): (JSC::charCodeAtThunkGenerator): * jit/ThunkGenerators.h: Added. * runtime/Executable.h: (JSC::NativeExecutable::NativeExecutable): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): * runtime/JSFunction.h: * runtime/JSGlobalData.h: (JSC::JSGlobalData::getThunk): * runtime/JSString.h: (JSC::): * runtime/JSValue.h: Protect some of the JSVALUE32 and JSVALUE32_64 only constants and function behind appropriate USE() guards to make it harder to use the wrong flags for the target build. * runtime/Lookup.cpp: (JSC::HashTable::createTable): (JSC::setUpStaticFunctionSlot): * runtime/Lookup.h: (JSC::HashEntry::initialize): (JSC::HashEntry::generator): (JSC::HashEntry::): Make the lookup tables use a specialized thunkGenerator if present * wtf/text/StringImpl.h: 2010-04-26 Oliver Hunt Build fix * runtime/JSImmediate.h: * runtime/JSValue.h: 2010-04-26 Oliver Hunt Reviewed by Gavin Barraclough. Factor some basic JS interface logic out of JIT and into a superclass https://bugs.webkit.org/show_bug.cgi?id=38163 Create JSInterfaceJIT to hold some common low level functions for interacting with the JS RegisterFile. Doing this separately from https://bugs.webkit.org/show_bug.cgi?id=38155 to ease reviewing. * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JIT.h: * jit/JITInlineMethods.h: (JSC::JIT::emitJumpSlowCaseIfNotJSCell): * jit/JSInterfaceJIT.h: Added. (JSC::JSInterfaceJIT::emitLoadJSCell): (JSC::JSInterfaceJIT::emitJumpIfNotJSCell): (JSC::JSInterfaceJIT::emitLoadInt32): (JSC::JSInterfaceJIT::tagFor): (JSC::JSInterfaceJIT::payloadFor): (JSC::JSInterfaceJIT::addressFor): 2010-04-26 Sam Weinig Fix Tiger build. * wtf/mac/MainThreadMac.mm: (WTF::isMainThread): 2010-04-26 Geoffrey Garen Reviewed by Sam Weinig. Fixed a crash seen when using the JavaScriptCore API with WebKit. No layout test because DumpRenderTree doesn't use the JavaScriptCore API in this way. * interpreter/RegisterFile.cpp: (JSC::RegisterFile::setGlobalObject): (JSC::RegisterFile::clearGlobalObject): (JSC::RegisterFile::globalObject): * interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile): Use WeakGCPtr for managing m_globalObject, since it's a weak pointer. (We never noticed this error before because, in WebKit, global objects always have a self-reference in a global variable, so marking the register file's global variables would keep m_globalObject alive. In the JavaScriptCore API, you can allocate a global object with no self-reference.) * runtime/JSActivation.h: Removed unneeded #include. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::~JSGlobalObject): Don't use ==, since a weak pointer is 0 when the object it points to runs its destructor. * runtime/WeakGCPtr.h: (JSC::WeakGCPtr::clear): Changed to return a bool indicating whether the clear actually happened. (JSC::WeakGCPtr::assign): Changed to forbid assignment of 0 as a shorthand for calling clear(). A client should never clear by assigning 0, since clear() should be conditional on whether the object doing the clearing is still pointed to by the weak pointer. (Otherwise, a zombie object might clear a pointer to a new, valid object.) 2010-04-25 Sam Weinig Reviewed by Maciej Stachowiak. Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 Disentangle initializing the main thread from initializing threading This is the first step in getting rid of the WEB_THREAD #define and paving the way to allowing mac both WebKit and WebKit2 to use the same WebCore. * JavaScriptCore.exp: Export initializeMainThread and initializeMainThreadToProcessMainThread. * JavaScriptCore.xcodeproj/project.pbxproj: Sort files. * wtf/MainThread.cpp: (WTF::mainThreadInitializationMutex): (WTF::mainThreadFunctionQueueMutex): (WTF::initializeMainThread): (WTF::deprecatedInitializeMainThread): * wtf/MainThread.h: Added Mac only initializeMainThreadToProcessMainThread which sets up callOnMainThread and isMainThead calls to assume that WebCore's main thread is also the process's main thread. Since it is possible that both initializeMainThread and initializeMainThreadToProcessMainThread could be called, the first one called wins (either will work). * wtf/Threading.h: Moved to top of file. * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading): Remove call to initializeMainThread. * wtf/ThreadingWin.cpp: (WTF::initializeThreading): Ditto. * wtf/gtk/ThreadingGtk.cpp: (WTF::initializeThreading): Ditto. * wtf/mac/MainThreadMac.mm: (WTF::initializeMainThreadPlatform): (WTF::initializeMainThreadToProcessMainThread): (WTF::scheduleDispatchFunctionsOnMainThread): (WTF::isMainThread): Add runtime switch between the old behavior of using the system's main thread and a stored pointer to the main thread. Tiger always uses the system's main thread. * wtf/qt/ThreadingQt.cpp: (WTF::initializeThreading): Remove call to initializeMainThread. * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): Add call to initializeCurrentThreadInternal removed from initializeThreading. 2010-04-26 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Fix a memory leak in the QScriptString. QScriptStringPrivate's constructor shouldn't call JSStringRetain as QScriptConverter implicitly pass a JSStringRef ownership. [Qt] QScriptStringPrivate c'tor problem https://bugs.webkit.org/show_bug.cgi?id=38110 * qt/api/qscriptstring_p.h: (QScriptStringPrivate::QScriptStringPrivate): 2010-04-24 Darin Adler Reviewed by Dan Bernstein. REGRESSION (r56560): Crash in parseFloat if passed invalid UTF-16 data https://bugs.webkit.org/show_bug.cgi?id=38083 rdar://problem/7901044 Tests: fast/js/ToNumber.html fast/js/parseFloat.html * runtime/JSGlobalObjectFunctions.cpp: (JSC::parseInt): Added a FIXME comment about a problem I noticed. (JSC::parseFloat): Added a FIXME comment about a problem I noticed; covered by test cases in the test I added. * runtime/UString.cpp: (JSC::UString::toDouble): Added FIXME comments about two problems I noticed; covered by test cases in the tests I added. Added a return statement so we don't crash when illegal UTF-16 sequences are present. 2010-04-24 Anton Muhin Reviewed by Darin Adler. Allow to construct HashTraits<:qualifiedname>::constructDeletedValue Former implementation attempted to use AtomicString(HashTableDeletedValue) however those values cannot be used that way: one cannot construct QualifiedNameImpl out of such AtomicString as we'll try to lookup this string in the table, for example. https://bugs.webkit.org/show_bug.cgi?id=37722 * wtf/RefPtr.h: expose hash table deleted value 2010-04-23 Sam Weinig Reviewed by David Levin. Fix for https://bugs.webkit.org/show_bug.cgi?id=38060 Split up Threading.h Move bits for of Threading.h into 3 new files. - Atomics.h for atomic operations. - ThreadSafeShared.h for the ThreadSafeShared class. - ThreadingPrimitives.h for the primitives and platform types. Basic threading operations (creation, etc.) remain in Threading.h. * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/Atomics.h: Copied from wtf/Threading.h. * wtf/ThreadSafeShared.h: Copied from wtf/Threading.h. * wtf/Threading.h: * wtf/ThreadingPrimitives.h: Copied from wtf/Threading.h. 2010-04-23 Sam Weinig Fix Qt build. * wtf/qt/MainThreadQt.cpp: #include 2010-04-22 Sam Weinig Reviewed by Anders Carlsson. Fix for https://bugs.webkit.org/show_bug.cgi?id=38022 Move isMainThread predicate function to MainThread.h * wtf/MainThread.cpp: (WTF::initializeMainThread): (WTF::isMainThread): * wtf/MainThread.h: * wtf/Threading.h: * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading): * wtf/ThreadingWin.cpp: (WTF::initializeThreading): * wtf/gtk/ThreadingGtk.cpp: (WTF::initializeThreading): * wtf/mac/MainThreadMac.mm: (WTF::initializeMainThreadPlatform): (WTF::isMainThread): * wtf/qt/MainThreadQt.cpp: (WTF::isMainThread): * wtf/qt/ThreadingQt.cpp: (WTF::initializeThreading): * wtf/text/AtomicString.cpp: 2010-04-23 Gabor Rapcsanyi Reviewed by Laszlo Gombos. Add RVCT support for Linux Developed in cooperation with Gabor Loki. * API/JSStringRef.h: * jit/ExecutableAllocator.h: * jit/ExecutableAllocatorPosix.cpp: (JSC::ExecutableAllocator::cacheFlush): * jit/JITStubs.cpp: * wtf/MathExtras.h: * wtf/unicode/qt4/UnicodeQt4.h: 2010-04-23 Patrick Gansterer Reviewed by Laszlo Gombos. [WIN] Move OwnPtrWin.cpp into platform specific folder. https://bugs.webkit.org/show_bug.cgi?id=38042 * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * wtf/OwnPtrWin.cpp: Removed. * wtf/win/OwnPtrWin.cpp: Copied from JavaScriptCore/wtf/OwnPtrWin.cpp. 2010-04-23 Patrick Gansterer Reviewed by Laszlo Gombos. [BREWMP] Move OwnPtrBrew.cpp into platform specific folder. https://bugs.webkit.org/show_bug.cgi?id=38042 * wtf/OwnPtrBrew.cpp: Removed. * wtf/brew/OwnPtrBrew.cpp: Copied from JavaScriptCore/wtf/OwnPtrBrew.cpp. 2010-04-22 Steve Block Reviewed by Adam Barth. Update Android to use isfinite, isinf, isnan and signbit from namespace std. https://bugs.webkit.org/show_bug.cgi?id=37948 * wtf/MathExtras.h: 2010-04-22 Fumitoshi Ukai Unreviewed build fix. * wtf/MD5.cpp: fix include path of CString.h 2010-04-22 Fumitoshi Ukai Reviewed by Adam Barth. MD5 is required for WebSocket new protocol implementation https://bugs.webkit.org/show_bug.cgi?id=37913 * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/MD5.cpp: Added. * wtf/MD5.h: Added. 2010-04-22 Gavin Barraclough Reviewed by NOBODY (build fix). Errk, accidentally committed commenting out two ASSERTs! reverting. * runtime/Collector.cpp: (JSC::Heap::protect): (JSC::Heap::unprotect): 2010-04-22 Gavin Barraclough Reviewed by Geoff Garen. https://bugs.webkit.org/show_bug.cgi?id=38006 Change lifetime of JSC::IdentifierTables used by WebCores to match AtomicStringTable Presently JSC's IdentifierTables are owned by the JSGlobalData. For JSGlobalData objects created via the API this should continue to be the case, but for the JSGlobalData objects used by WebCore (the main thread's common global data, and those for workers) use a IdentifierTable provided (and owned) by wtfThreadData. This allow the lifetime of these IdentifierTable to match those of the corresponding AtomicStringTables. * API/APIShims.h: (JSC::APIEntryShim::APIEntryShim): * API/JSContextRef.cpp: (JSContextGroupCreate): * runtime/Collector.cpp: (JSC::Heap::protect): (JSC::Heap::unprotect): (JSC::Heap::markRoots): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): (JSC::JSGlobalData::createContextGroup): (JSC::JSGlobalData::create): (JSC::JSGlobalData::sharedInstance): * runtime/JSGlobalData.h: (JSC::JSGlobalData::): (JSC::JSGlobalData::isSharedInstance): * runtime/JSLock.cpp: (JSC::JSLock::JSLock): (JSC::JSLock::lock): (JSC::JSLock::unlock): (JSC::JSLock::DropAllLocks::DropAllLocks): * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): (WTF::WTFThreadData::~WTFThreadData): 2010-04-22 Sheriff Bot Unreviewed, rolling out r58110. http://trac.webkit.org/changeset/58110 https://bugs.webkit.org/show_bug.cgi?id=38007 Caused an internal compiler error on Qt (Requested by abarth on #webkit). * wtf/MathExtras.h: 2010-04-22 Gavin Barraclough Reviewed by NOBODY (windows build fix). * API/JSWeakObjectMapRefPrivate.cpp: 2010-04-22 Gavin Barraclough Reviewed by NOBODY (windows build fix). * API/JSBase.cpp: * API/JSCallbackObject.cpp: 2010-04-22 Gavin Barraclough Reviewed by Geoff Garen. https://bugs.webkit.org/show_bug.cgi?id=37978 Unify JSC::IdentifierTable and WebCore::AtomicStringTable implementations. These two classes both implement a HashSet of uniqued StringImpls, with translator classes to avoid unnecessary object creation. The only difference between the classes is which flag (isIdentifier or inTable) is set. Combine the two classes using a template predicated on which flag to use. New class AtomicStringTable created, containing all the goodness from IdentifierTable & AtomicStringTable, expect for Identifier's literalTable, which has been moved onto JSGlobalData. Removed duplicate string translator classes. Renamed StringImpl's inTable flag to more explicit 'isAtomic', and set this on the empty string (which matches Identifier behaviour, and removes a redundant check for zero-length). * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/Identifier.cpp: (JSC::createLiteralTable): (JSC::deleteLiteralTable): (JSC::Identifier::add): (JSC::Identifier::addSlowCase): * runtime/Identifier.h: * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): * runtime/JSGlobalData.h: * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): (WTF::WTFThreadData::~WTFThreadData): * wtf/WTFThreadData.h: (WTF::WTFThreadData::atomicStringTable): * wtf/text/AtomicString.cpp: (WebCore::table): (WebCore::operator==): (WebCore::AtomicString::add): (WebCore::AtomicString::find): (WebCore::AtomicString::remove): * wtf/text/AtomicStringTable.h: Added. (WTF::CStringTranslator::hash): (WTF::CStringTranslator::equal): (WTF::CStringTranslator::translate): (WTF::UCharBufferTranslator::hash): (WTF::UCharBufferTranslator::equal): (WTF::UCharBufferTranslator::translate): (WTF::HashAndCharactersTranslator::hash): (WTF::HashAndCharactersTranslator::equal): (WTF::HashAndCharactersTranslator::translate): (WTF::IdentifierOrAtomicStringTable::remove): (WTF::::~IdentifierOrAtomicStringTable): (WTF::::add): (WTF::::find): * wtf/text/StringImpl.cpp: (WebCore::StringImpl::~StringImpl): * wtf/text/StringImpl.h: (WebCore::StringImpl::isAtomic): (WebCore::StringImpl::setIsAtomic): (WebCore::equal): * wtf/text/StringImplBase.h: (WTF::StringImplBase::StringImplBase): 2010-04-22 Steve Block Reviewed by Adam Barth. Update Android to use isfinite, isinf, isnan and signbit from namespace std. https://bugs.webkit.org/show_bug.cgi?id=37948 * wtf/MathExtras.h: 2010-04-22 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Remove dependency of JSC to QtGui https://bugs.webkit.org/show_bug.cgi?id=37867 The patch also make sure that hal.h is in the include path on Symbian. The dependency to QtGui took care of that before. Patch by Thiago Macieira and Rohan McGovern * JavaScriptCore.pri: * JavaScriptCore.pro: 2010-04-22 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Corrects symbols visibility for JavaScriptCore. https://bugs.webkit.org/show_bug.cgi?id=37867 * JavaScriptCore.pro: 2010-04-22 Gabor Loki Reviewed by Gavin Barraclough. Use BLX and BX to keep happy the return stack predictor above ARMv4 https://bugs.webkit.org/show_bug.cgi?id=37862 Inspired by Jacob Bramley's patch from JaegerMonkey * assembler/ARMAssembler.cpp: (JSC::ARMAssembler::executableCopy): * assembler/ARMAssembler.h: (JSC::ARMAssembler::): (JSC::ARMAssembler::bx): (JSC::ARMAssembler::blx): (JSC::ARMAssembler::loadBranchTarget): (JSC::ARMAssembler::jmp): (JSC::ARMAssembler::getLdrImmAddress): * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::jump): (JSC::MacroAssemblerARM::nearCall): (JSC::MacroAssemblerARM::call): (JSC::MacroAssemblerARM::ret): (JSC::MacroAssemblerARM::prepareCall): (JSC::MacroAssemblerARM::call32): 2010-04-21 Andy Estes Rubber stamped by Mark Rowe. Export WTF::deleteOwnedPtr(HFONT). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-04-21 Gavin Barraclough Rubber Stamped by Oliver Hunt. Make SmallStrings store an array of RefPtr, instead of a direct array of StringImpls. This allows us to remove a friend (and a layering violation) from WTF::StringImpl, and makes it so that all StringImpls are individually heap allocated. * runtime/SmallStrings.cpp: (JSC::SmallStringsStorage::rep): (JSC::SmallStringsStorage::SmallStringsStorage): * wtf/text/StringImpl.h: 2010-04-21 Sam Weinig Reviewed by Geoffrey Garen. Fix for https://bugs.webkit.org/show_bug.cgi?id=37937 Wean JavaScriptCore off calls to isMainThread() - Replace use of isMainThread() for interpreter reentry checks with a stored value on the JSGlobalData. - Replace use of isMainThread() for useMainThread only check in the collector with a stored exclusive thread. * API/JSContextRef.cpp: (JSContextGroupCreate): Always default to a small stack type for uses of the JSC API. It is unlikely that the interpreter reentry required on the web will be as important for other uses of JavaScriptCore. * JavaScriptCore.exp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Update exports. * interpreter/Interpreter.cpp: (JSC::Interpreter::execute): (JSC::Interpreter::prepareForRepeatCall): Use new stored JSGlobalData::maxReentryDepth instead of isMainThread(). * interpreter/Interpreter.h: Rename MaxMainThreadReentryDepth to MaxLargeThreadReentryDepth and MaxSecondaryThreadReentryDepth to MaxSmallThreadReentryDepth. * jsc.cpp: (main): Use the a large stack for jsc since it is always using the main thread. * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToString): (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): Use new stored JSGlobalData::maxReentryDepth instead of isMainThread(). * runtime/Collector.cpp: (JSC::Heap::registerThread): Use the concept of making JSC run on an exclusiveThread instead of forcing a mainThreadOnly assertion. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::createNonDefault): (JSC::JSGlobalData::create): (JSC::JSGlobalData::createLeaked): (JSC::JSGlobalData::sharedInstance): * runtime/JSGlobalData.h: Add ThreadStackType argument to JSGlobalData constructors and set maxReentryDepth based on it. 2010-04-21 Gavin Barraclough Reviewed by NOBODY (windows build fix pt. 3). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-04-21 Gavin Barraclough Reviewed by NOBODY (windows build fix pt. 2). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-04-21 Gavin Barraclough Reviewed by NOBODY (Qt build fix). * JavaScriptCore.gypi: * JavaScriptCore.pro: * wtf/qt/StringQt.cpp: Copied from WebCore/platform/text/qt/StringQt.cpp. 2010-04-21 Gavin Barraclough Reviewed by NOBODY (windows build fix). * API/JSValueRef.cpp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * runtime/Identifier.cpp: (JSC::IdentifierTable::~IdentifierTable): (JSC::IdentifierTable::add): * runtime/Identifier.h: * wtf/WTFThreadData.h: (JSC::IdentifierTable::remove): (JSC::IdentifierTable::literalTable): * wtf/text/StringImpl.cpp: (WebCore::StringImpl::~StringImpl): 2010-04-20 Gavin Barraclough Reviewed by Oliver Hunt, Darin Adler. Bug 37906 - Remove JSC::UStringImpl; unify with StringImpl. JSC::UStringImpl and WebCore::StringImpl (soon to be renamed to WTF::StringImpl) are almost identical. Remove duplication of code by unifying the two, move missing features from UStringImpl into StringImpl & delete the class UStringImpl. * API/JSClassRef.cpp: * API/JSContextRef.cpp: * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.pro: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/EvalCodeCache.h: * bytecode/JumpTable.cpp: * profiler/ProfileNode.cpp: * runtime/Identifier.cpp: (JSC::Identifier::add): * runtime/Identifier.h: (JSC::Identifier::equal): * runtime/UString.cpp: * runtime/UString.h: (WTF::): * runtime/UStringImpl.cpp: Removed. * runtime/UStringImpl.h: * wtf/text/StringHash.h: (WebCore::StringHash::equal): (WebCore::CaseFoldingHash::equal): * wtf/text/StringImpl.cpp: (WebCore::StringImpl::~StringImpl): (WebCore::StringImpl::empty): (WebCore::StringImpl::sharedBuffer): (WebCore::equal): * wtf/text/StringImpl.h: (WebCore::StringImpl::StringImpl): (WebCore::StringImpl::create): (WebCore::StringImpl::tryCreateUninitialized): (WebCore::StringImpl::cost): (WebCore::StringImpl::isIdentifier): (WebCore::StringImpl::setIsIdentifier): (WebCore::StringImpl::computeHash): (WebCore::StringImpl::copyChars): (WebCore::StringImpl::): 2010-04-21 Patrick Gansterer Reviewed by Darin Adler. Added missing #include "Lookup.h" in LUT source files. https://bugs.webkit.org/show_bug.cgi?id=37903 * runtime/ArrayPrototype.cpp: * runtime/DatePrototype.cpp: * runtime/JSONObject.cpp: * runtime/MathObject.cpp: * runtime/NumberConstructor.cpp: * runtime/RegExpConstructor.cpp: * runtime/RegExpObject.cpp: * runtime/StringPrototype.cpp: 2010-04-21 Gustavo Sverzut Barbieri Reviewed by Nikolas Zimmermann. Add missing EFL JavaScriptCore file. http://webkit.org/b/37854 * wtf/efl: Added. * wtf/efl/MainThreadEfl.cpp: Added. (WTF::initializeMainThreadPlatform): (WTF::timeoutFired): (WTF::scheduleDispatchFunctionsOnMainThread): 2010-04-20 Xan Lopez Another attempt to fix the build. * GNUmakefile.am: 2010-04-20 Oliver Hunt Reviewed by Maciej Stachowiak. [ES5] RegExp literals are constants that should be persistent across multiple function calls. https://bugs.webkit.org/show_bug.cgi?id=37908 Dump the separate RegExp constant pool, and just use the standard JS constant pool in codeblock. This allows us to drop op_new_regexp and all associated code as well. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::shrinkToFit): * bytecode/CodeBlock.h: * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitLoad): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::RegExpNode::emitBytecode): * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITOpcodes.cpp: * jit/JITStubs.cpp: * jit/JITStubs.h: (JSC::): 2010-04-20 Oliver Hunt Fix license on create_regex_tables * create_regex_tables: 2010-04-20 Oliver Hunt Reviewed by NOBODY (Build fix). Fix gtk * GNUmakefile.am: * make-generated-sources.sh: 2010-04-20 Gavin Barraclough Reviewed by Oliver Hunt. Bug 37895 - Share common code from UStringImplBase with StringImpl The implementation of StringImpl & UStringImpl is very similar. Restructure StringImpl to match UStringImpl, moving the flags and length into a base class, so that this can be shared between both string types to increase code reuse. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/RopeImpl.h: (JSC::RopeImpl::RopeImpl): * runtime/UStringImpl.h: (JSC::UStringImpl::UStringImpl): * wtf/text/StringImpl.h: (WebCore::StringImpl::StringImpl): (WebCore::StringImpl::characters): * wtf/text/StringImplBase.h: Copied from JavaScriptCore/runtime/UStringImpl.h. (WTF::StringImplBase::length): (WTF::StringImplBase::operator new): (WTF::StringImplBase::StringImplBase): 2010-04-20 Oliver Hunt Reviewed by Gavin Barraclough. Autogenerate yarr character tables https://bugs.webkit.org/show_bug.cgi?id=37877 Use a python script to automatically generate character tables for the builtin YARR character classes. This allows us to generate actual tables as well, by using these tables we can both increase performance of the check (for complex builtins) and reduce the actual code size. 4-8% win on string-unpack-code, but lots of noise on other tests so i'm only confident saying its a 1% win overall. * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::ExtendedAddress::ExtendedAddress): * assembler/MacroAssembler.h: (JSC::MacroAssembler::branchTest8): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::branchTest8): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::branchTest8): * assembler/X86Assembler.h: (JSC::X86Assembler::cmpb_im): (JSC::X86Assembler::testb_im): * bytecode/SamplingTool.cpp: (JSC::SamplingTool::dump): * create_regex_tables: Added. * yarr/RegexCompiler.cpp: (JSC::Yarr::CharacterClassConstructor::charClass): * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::matchCharacterClass): (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy): (JSC::Yarr::RegexGenerator::generatePatternCharacterNonGreedy): (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy): * yarr/RegexPattern.h: (JSC::Yarr::CharacterClassTable::create): (JSC::Yarr::CharacterClassTable::CharacterClassTable): (JSC::Yarr::CharacterClass::CharacterClass): 2010-04-20 Gavin Barraclough Reviewed by NOBODY (speculative windows fix - missed a bit!). * wtf/text/AtomicString.h: 2010-04-20 Gavin Barraclough Reviewed by NOBODY (speculative windows fix). * wtf/text/AtomicString.h: 2010-04-20 Gavin Barraclough Reviewed by NOBODY (windows build fix). Add missing .def file entries. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-04-20 Gavin Barraclough Reviewed by Geoff Garen. Bug 37869 - Move URopeImpl to its own .h/.cpp Currently Ropes are implemented by the class URopeImpl, which is defined in UStringImpl.h, and then typedefed to the name JSString::Rope. Remove the typedef, and rename all uses of URopeImpl and JSString::Rope to just RopeImpl. Move RopeImpl to its own header, and remove all remaining references to ropes from UStringImpl (rename UStringOrRopeImpl to UStringImplBase, rename or move the isRope & deref methods from UStringOrRopeImpl). * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSString.cpp: (JSC::JSString::resolveRope): * runtime/JSString.h: (JSC::): (JSC::RopeBuilder::JSString): (JSC::RopeBuilder::~JSString): (JSC::RopeBuilder::appendStringInConstruct): (JSC::RopeBuilder::JSStringFinalizerStruct::): * runtime/RopeImpl.cpp: Copied from JavaScriptCore/runtime/UStringImpl.cpp. (JSC::RopeImpl::derefFibersNonRecursive): (JSC::RopeImpl::destructNonRecursive): * runtime/RopeImpl.h: Copied from JavaScriptCore/runtime/UStringImpl.h. (JSC::RopeImpl::tryCreateUninitialized): (JSC::RopeImpl::isRope): (JSC::RopeImpl::deref): (JSC::RopeImpl::RopeImpl): * runtime/UStringImpl.cpp: * runtime/UStringImpl.h: (JSC::UStringImplBase::isInvalid): (JSC::UStringImplBase::ref): (JSC::UStringImplBase::UStringImplBase): (JSC::UStringImplBase::): (JSC::UStringImpl::UStringImpl): 2010-04-20 Gavin Barraclough Reviewed by Geoff Garen. Bug 37828 - Move WebCore's String classes to WTF Move these classes up to WTF so they are available to all clients of WTF (in particular JSC). As a first patch, making the most minimal change possible, since this patch could easily grow rather large since we'll have to change every class forward declaration ( e.g. every "namespace WebCore { class String; }" much change to "namespace WTF { class String; }"). Moving the files, but leaving the classes logically in the WebCore namespace - which is technically a layering violation - I'll come back and fix this up in a subsequent patch. * Android.mk: * Android.v8.wtf.mk: * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * config.h: * wtf/StaticConstructors.h: Copied from WebCore/platform/StaticConstructors.h. * wtf/text/AtomicString.cpp: Copied from WebCore/platform/text/AtomicString.cpp. * wtf/text/AtomicString.h: Copied from WebCore/platform/text/AtomicString.h. * wtf/text/AtomicStringImpl.h: Copied from WebCore/platform/text/AtomicStringImpl.h. * wtf/text/StringBuffer.h: Copied from WebCore/platform/text/StringBuffer.h. * wtf/text/StringHash.h: Copied from WebCore/platform/text/StringHash.h. * wtf/text/StringImpl.cpp: Copied from WebCore/platform/text/StringImpl.cpp. * wtf/text/StringImpl.h: Copied from WebCore/platform/text/StringImpl.h. * wtf/text/WTFString.cpp: Copied from WebCore/platform/text/String.cpp. (WebCore::charactersToFloat): * wtf/text/WTFString.h: Copied from WebCore/platform/text/PlatformString.h. 2010-04-20 Csaba Osztrogonác [Qt] Unreviewed speculative buildfix for WinCE after r57882 https://bugs.webkit.org/show_bug.cgi?id=37701 * JavaScriptCore.pri: missing wince* case added. 2010-04-20 Gavin Barraclough Reviewed by NOBODY (build fix). Speculative Chromium/Win build fix, attempt #2. * config.h: 2010-04-20 Gavin Barraclough Reviewed by NOBODY (build fix). Speculative Chromium/Win build fix. * config.h: JS_EXPORTDATA should do nothing on !JSC builds. 2010-04-20 Csaba Osztrogonác Reviewed by Simon Hausmann. [Qt] Target(WebCore,jsc,...) must depends on static library of JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=37701 * JavaScriptCore.pri: dependency added. 2010-04-20 Gavin Barraclough Rubber stamped by Maciej Stachowiak (relanding r57829). Added missing JS_EXPORTDATA * API/APIShims.h: (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): (JSC::APICallbackShim::APICallbackShim): (JSC::APICallbackShim::~APICallbackShim): * API/JSContextRef.cpp: * Android.mk: * Android.v8.wtf.mk: * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/Completion.cpp: (JSC::checkSyntax): (JSC::evaluate): * runtime/Identifier.cpp: (JSC::Identifier::remove): (JSC::Identifier::checkCurrentIdentifierTable): * runtime/Identifier.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreadingOnce): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::create): * wtf/WTFThreadData.cpp: Copied from JavaScriptCore/wtf/WTFThreadData.cpp. * wtf/WTFThreadData.h: Copied from JavaScriptCore/wtf/WTFThreadData.h. 2010-04-19 Gavin Barraclough Reviewed by NOBODY (rolling out r57829). This broke windows. * API/APIShims.h: (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): (JSC::APICallbackShim::APICallbackShim): (JSC::APICallbackShim::~APICallbackShim): * API/JSContextRef.cpp: * Android.mk: * Android.v8.wtf.mk: * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.gypi: * JavaScriptCore.pro: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/Completion.cpp: (JSC::checkSyntax): (JSC::evaluate): * runtime/Identifier.cpp: (JSC::Identifier::remove): (JSC::Identifier::checkCurrentIdentifierTable): (JSC::createIdentifierTableSpecificCallback): (JSC::createIdentifierTableSpecific): * runtime/Identifier.h: (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData): (JSC::defaultIdentifierTable): (JSC::setDefaultIdentifierTable): (JSC::currentIdentifierTable): (JSC::setCurrentIdentifierTable): (JSC::resetCurrentIdentifierTable): * runtime/InitializeThreading.cpp: (JSC::initializeThreadingOnce): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::create): * wtf/WTFThreadData.cpp: Removed. * wtf/WTFThreadData.h: Removed. 2010-04-19 Douglas Gregor Reviewed and landed by Anders Carlsson. * runtime/UStringImpl.h: Fix class/struct declaration mismatches. 2010-04-19 Geoffrey Garen Reviewed by Beth Dakin. Checked in these tests I wrote becuase Balazs Kelemen wanted to use them. * tests/perf: Added. * tests/perf/bench-allocate-nonretained.js: Added. * tests/perf/bench-allocate-retained.js: Added. 2010-04-19 Gavin Barraclough Reviewed by NOBODY (windows build fix). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-04-16 Gavin Barraclough Reviewed by Sam Weinig. https://bugs.webkit.org/show_bug.cgi?id=37745 Move string uniquing tables to (new) WTFThreadData class. Remove AtomicString's dependency on ThreadGlobalData so that we can move WebCore's string classes up to WTF. WTFThreadData.cpp/.h are based on ThreadGlobalData from WebCore. Moved JSC & WebCore's string uniquing tables to this class. This patch introduces a temporary layering violation in providing forward declarations of classes from JSC and WTF; this will be resolved as we move more string code up to WTF. * API/APIShims.h: (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): (JSC::APICallbackShim::APICallbackShim): (JSC::APICallbackShim::~APICallbackShim): * API/JSContextRef.cpp: * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/Completion.cpp: (JSC::checkSyntax): (JSC::evaluate): * runtime/Identifier.cpp: (JSC::Identifier::remove): (JSC::Identifier::checkCurrentIdentifierTable): * runtime/Identifier.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreadingOnce): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::create): * wtf/WTFThreadData.cpp: Copied from WebCore/platform/ThreadGlobalData.cpp. (WTF::WTFThreadData::WTFThreadData): (WTF::WTFThreadData::~WTFThreadData): * wtf/WTFThreadData.h: Copied from WebCore/platform/ThreadGlobalData.h. (WTF::WTFThreadData::atomicStringTable): (WTF::WTFThreadData::initializeIdentifierTable): (WTF::WTFThreadData::currentIdentifierTable): (WTF::WTFThreadData::setCurrentIdentifierTable): (WTF::WTFThreadData::resetCurrentIdentifierTable): (WTF::wtfThreadData): 2010-04-19 Jocelyn Turcotte Reviewed by Simon Hausmann. [Qt] Build fix for WinCE. Moved the include of the non-existing errno.h header file inside platform guard macros. * jit/ExecutableAllocatorFixedVMPool.cpp: 2010-04-18 Kwang Yul Seo Reviewed by Laszlo Gombos. [WINCE] Don't define WTF_CPU_MIDDLE_ENDIAN=1 https://bugs.webkit.org/show_bug.cgi?id=37434 Windows CE supports little-endian format only, so don't define WTF_CPU_MIDDLE_ENDIAN=1. * wtf/Platform.h: 2010-04-18 Simon Hausmann Reviewed by Laszlo Gombos. [Qt] Fix JavaScriptCore's include path for WinCE builds https://bugs.webkit.org/show_bug.cgi?id=36751 * JavaScriptCore.pri: 2010-04-16 Gavin Barraclough Reviewed by nobody, build fix. 2010-04-16 Gavin Barraclough Reviewed by nobody, build fix. 2010-04-16 Gavin Barraclough Reviewed by Oliver Hunt. Bug 37730 - Remove JSC::UString dependencies from WebCore::StringImpl (Following on from bug #37675). Make the argument ordering for UStringImpl's constructor & create methods match, when passed a shared buffer. * JavaScriptCore.exp: * runtime/UStringImpl.cpp: (JSC::UStringImpl::create): * runtime/UStringImpl.h: 2010-04-15 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Fix memory leak in QScriptEngine::evaluate(). QScriptEnginePrivate::evaluate should release temporary variables. [Qt] QScriptEngine::evaluate has memory leak. https://bugs.webkit.org/show_bug.cgi?id=37596 * qt/api/qscriptengine_p.cpp: (QScriptEnginePrivate::evaluate): * qt/api/qscriptengine_p.h: 2010-04-14 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Fix a memory leak in QScriptValue::inherits. [Qt] QScriptValue::inherits has a memory leak. https://bugs.webkit.org/show_bug.cgi?id=37617 * qt/api/qscriptvalue_p.h: (QScriptValuePrivate::inherits): 2010-04-14 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Fix a few memory leaks in QScriptEngine. Syntax checking caused memory leak, not all temporary variables were released. [Qt] Syntax checking in the QtScript cause a memory leak. https://bugs.webkit.org/show_bug.cgi?id=37610 * qt/api/qscriptengine_p.cpp: (QScriptEnginePrivate::checkSyntax): * qt/api/qscriptsyntaxcheckresult.cpp: (QScriptSyntaxCheckResultPrivate::errorMessage): (QScriptSyntaxCheckResultPrivate::errorLineNumber): 2010-04-14 Jedrzej Nowacki Reviewed by Kenneth Rohde Christiansen. Fix memory leak inside QScriptEnginePrivate::makeJSValue. QScriptEnginePrivate::makeJSValue should release temporary JSStringRef variable. [Qt] tst_QScriptValue::toString has a memory leak. https://bugs.webkit.org/show_bug.cgi?id=37598 * qt/api/qscriptengine_p.h: (QScriptEnginePrivate::makeJSValue): 2010-04-14 Peter Varga Reviewed by Geoffrey Garen. Move the YARR JIT fallback detection from RegexJIT.cpp to RegexCompiler.cpp. https://bugs.webkit.org/show_bug.cgi?id=37571 * yarr/RegexCompiler.cpp: (JSC::Yarr::RegexPatternConstructor::atomBackReference): (JSC::Yarr::RegexPatternConstructor::quantifyAtom): * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateTerm): (JSC::Yarr::RegexGenerator::RegexGenerator): (JSC::Yarr::jitCompileRegex): * yarr/RegexJIT.h: (JSC::Yarr::RegexCodeBlock::operator!): * yarr/RegexPattern.h: (JSC::Yarr::RegexPattern::RegexPattern): (JSC::Yarr::RegexPattern::reset): 2010-04-14 Kent Hansen Reviewed by Maciej Stachowiak. Mac OS X: Use deployment target to determine whether memory tagging should be enabled https://bugs.webkit.org/show_bug.cgi?id=34888 When building on (Snow) Leopard but targeting Tiger (TARGETING_TIGER defined, BUILDING_ON_TIGER not defined), WebKit would crash on Tiger because the tags passed to mmap caused those function calls to fail. Conversely, when building on Tiger but targeting Leopard (BUILDING_ON_TIGER defined, TARGETING_LEOPARD defined), WebKit would crash on Leopard because the tags passed to vm_map and vm_allocate caused those function calls to fail. Solution: Use TARGETING_TIGER rather than BUILDING_ON_TIGER to govern the tag definitions. Use the same tags for vm_map and vm_allocate regardless of target, since they work on both. Fall back to the mmap tags that work on Tiger (that is, "no tags") if targeting Tiger, since those tags also work on Leopard. * wtf/VMTags.h: 2010-04-12 Jocelyn Turcotte Reviewed by nobody, build fix. [Qt] Build fix for Mac when building with build-webkit --qt Specifying no configuration on Mac builds WebCore both in debug and release. JavaScriptCore has to follow this rule as well. * JavaScriptCore.pro: 2010-04-11 Mark Rowe Reviewed by Sam Weinig. Fix the build. * wtf/FastMalloc.cpp: (WTF::TCMallocStats::): Initialize extra members of malloc_introspection_t to zero. 2010-04-09 Mikhail Naganov