From aabd12223bda6260756ab19430082477d5669c0a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 24 Sep 2009 16:35:49 +0200 Subject: Update src/3rdparty/javascriptcore and adapt src/script to the changes. Reviewed-by: Simon Hausmann --- .../javascriptcore/JavaScriptCore/API/APICast.h | 35 +- .../javascriptcore/JavaScriptCore/API/JSBase.h | 5 +- .../JavaScriptCore/API/JSCallbackConstructor.h | 2 +- .../JavaScriptCore/API/JSCallbackFunction.cpp | 1 + .../JavaScriptCore/API/JSCallbackFunction.h | 2 +- .../JavaScriptCore/API/JSCallbackObject.h | 2 +- .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 27 +- .../javascriptcore/JavaScriptCore/API/JSClassRef.h | 2 +- .../JavaScriptCore/API/JSObjectRef.cpp | 1 + .../JavaScriptCore/API/JSObjectRef.h | 3 +- .../JavaScriptCore/API/JSStringRef.h | 2 +- .../javascriptcore/JavaScriptCore/ChangeLog | 7269 +++++++++++++++++++- .../JavaScriptCore/JavaScriptCore.gypi | 7 +- .../JavaScriptCore/JavaScriptCore.pri | 24 +- .../JavaScriptCore/JavaScriptCore.pro | 69 + .../JavaScriptCore/assembler/ARMAssembler.cpp | 82 +- .../JavaScriptCore/assembler/ARMAssembler.h | 207 +- .../JavaScriptCore/assembler/ARMv7Assembler.h | 119 +- .../assembler/AbstractMacroAssembler.h | 22 +- .../assembler/AssemblerBufferWithConstantPool.h | 25 +- .../JavaScriptCore/assembler/MacroAssembler.h | 4 +- .../JavaScriptCore/assembler/MacroAssemblerARM.cpp | 67 + .../JavaScriptCore/assembler/MacroAssemblerARM.h | 327 +- .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 17 +- .../assembler/MacroAssemblerCodeRef.h | 6 +- .../JavaScriptCore/assembler/MacroAssemblerX86.h | 13 + .../assembler/MacroAssemblerX86Common.h | 221 +- .../assembler/MacroAssemblerX86_64.h | 72 +- .../JavaScriptCore/assembler/X86Assembler.h | 163 +- .../JavaScriptCore/bytecode/CodeBlock.cpp | 182 +- .../JavaScriptCore/bytecode/CodeBlock.h | 152 +- .../JavaScriptCore/bytecode/EvalCodeCache.h | 36 +- .../JavaScriptCore/bytecode/Instruction.h | 2 +- .../JavaScriptCore/bytecode/Opcode.h | 3 +- .../JavaScriptCore/bytecode/SamplingTool.cpp | 2 +- .../JavaScriptCore/bytecode/SamplingTool.h | 2 +- .../JavaScriptCore/bytecode/StructureStubInfo.cpp | 28 +- .../JavaScriptCore/bytecode/StructureStubInfo.h | 49 +- .../bytecompiler/BytecodeGenerator.cpp | 90 +- .../bytecompiler/BytecodeGenerator.h | 28 +- .../javascriptcore/JavaScriptCore/config.h | 2 + .../JavaScriptCore/debugger/Debugger.cpp | 65 +- .../JavaScriptCore/debugger/Debugger.h | 28 +- .../JavaScriptCore/debugger/DebuggerActivation.cpp | 23 +- .../JavaScriptCore/debugger/DebuggerActivation.h | 12 +- .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 16 +- .../JavaScriptCore/generated/Grammar.cpp | 2124 +++--- .../JavaScriptCore/generated/Grammar.h | 111 +- .../JavaScriptCore/interpreter/CachedCall.h | 3 +- .../JavaScriptCore/interpreter/CallFrame.h | 8 +- .../JavaScriptCore/interpreter/CallFrameClosure.h | 4 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 430 +- .../JavaScriptCore/interpreter/Interpreter.h | 20 +- .../JavaScriptCore/interpreter/Register.h | 63 +- .../JavaScriptCore/interpreter/RegisterFile.h | 16 +- .../JavaScriptCore/jit/ExecutableAllocator.h | 44 +- .../jit/ExecutableAllocatorPosix.cpp | 5 +- .../JavaScriptCore/jit/ExecutableAllocatorWin.cpp | 5 +- .../javascriptcore/JavaScriptCore/jit/JIT.cpp | 499 +- .../javascriptcore/JavaScriptCore/jit/JIT.h | 835 ++- .../JavaScriptCore/jit/JITArithmetic.cpp | 1309 +++- .../javascriptcore/JavaScriptCore/jit/JITCall.cpp | 497 +- .../javascriptcore/JavaScriptCore/jit/JITCode.h | 6 +- .../JavaScriptCore/jit/JITInlineMethods.h | 752 +- .../JavaScriptCore/jit/JITOpcodes.cpp | 1934 +++++- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 994 ++- .../JavaScriptCore/jit/JITStubCall.h | 136 +- .../javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 880 ++- .../javascriptcore/JavaScriptCore/jit/JITStubs.h | 217 +- src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp | 14 +- .../JavaScriptCore/os-win32/stdbool.h | 4 +- .../JavaScriptCore/os-win32/stdint.h | 7 +- .../JavaScriptCore/os-wince/ce_time.cpp | 677 -- .../JavaScriptCore/os-wince/ce_time.h | 16 - .../javascriptcore/JavaScriptCore/parser/Grammar.y | 491 +- .../javascriptcore/JavaScriptCore/parser/Lexer.cpp | 112 +- .../javascriptcore/JavaScriptCore/parser/Lexer.h | 16 +- .../JavaScriptCore/parser/NodeConstructors.h | 43 +- .../javascriptcore/JavaScriptCore/parser/Nodes.cpp | 411 +- .../javascriptcore/JavaScriptCore/parser/Nodes.h | 375 +- .../JavaScriptCore/parser/Parser.cpp | 29 +- .../javascriptcore/JavaScriptCore/parser/Parser.h | 58 +- .../JavaScriptCore/parser/ParserArena.cpp | 81 +- .../JavaScriptCore/parser/ParserArena.h | 82 +- .../JavaScriptCore/parser/SourcePoolQt.cpp | 109 - .../JavaScriptCore/parser/SourcePoolQt.h | 93 - .../JavaScriptCore/parser/SourceProvider.h | 4 + .../javascriptcore/JavaScriptCore/pcre/dftables | 2 +- .../JavaScriptCore/profiler/ProfileGenerator.cpp | 1 + .../JavaScriptCore/profiler/ProfileGenerator.h | 2 +- .../JavaScriptCore/profiler/Profiler.cpp | 24 +- .../JavaScriptCore/profiler/Profiler.h | 2 +- .../JavaScriptCore/runtime/ArgList.cpp | 10 +- .../JavaScriptCore/runtime/ArgList.h | 10 +- .../JavaScriptCore/runtime/Arguments.cpp | 51 +- .../JavaScriptCore/runtime/Arguments.h | 44 +- .../JavaScriptCore/runtime/ArrayConstructor.cpp | 14 +- .../JavaScriptCore/runtime/ArrayConstructor.h | 2 +- .../JavaScriptCore/runtime/ArrayPrototype.cpp | 21 +- .../JavaScriptCore/runtime/ArrayPrototype.h | 1 + .../runtime/BatchedTransitionOptimizer.h | 2 +- .../JavaScriptCore/runtime/BooleanObject.h | 5 + .../JavaScriptCore/runtime/BooleanPrototype.cpp | 4 +- .../JavaScriptCore/runtime/CallData.h | 4 +- .../JavaScriptCore/runtime/ClassInfo.h | 2 +- .../JavaScriptCore/runtime/Collector.cpp | 343 +- .../JavaScriptCore/runtime/Collector.h | 36 +- .../JavaScriptCore/runtime/CommonIdentifiers.h | 13 + .../JavaScriptCore/runtime/Completion.cpp | 27 +- .../JavaScriptCore/runtime/ConstructData.h | 4 +- .../JavaScriptCore/runtime/DateConstructor.cpp | 28 +- .../JavaScriptCore/runtime/DatePrototype.cpp | 82 +- .../JavaScriptCore/runtime/DatePrototype.h | 3 +- .../JavaScriptCore/runtime/Error.cpp | 6 + .../javascriptcore/JavaScriptCore/runtime/Error.h | 1 + .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 10 +- .../JavaScriptCore/runtime/ExceptionHelpers.h | 5 +- .../JavaScriptCore/runtime/Executable.cpp | 280 + .../JavaScriptCore/runtime/Executable.h | 315 + .../JavaScriptCore/runtime/FunctionConstructor.cpp | 34 +- .../JavaScriptCore/runtime/FunctionConstructor.h | 4 - .../JavaScriptCore/runtime/FunctionPrototype.cpp | 13 +- .../JavaScriptCore/runtime/FunctionPrototype.h | 2 +- .../JavaScriptCore/runtime/GetterSetter.cpp | 52 +- .../JavaScriptCore/runtime/GetterSetter.h | 22 +- .../JavaScriptCore/runtime/GlobalEvalFunction.cpp | 9 +- .../JavaScriptCore/runtime/GlobalEvalFunction.h | 9 +- .../JavaScriptCore/runtime/Identifier.h | 2 + .../JavaScriptCore/runtime/InitializeThreading.cpp | 1 - .../JavaScriptCore/runtime/InternalFunction.h | 2 +- .../JavaScriptCore/runtime/JSAPIValueWrapper.cpp | 31 + .../JavaScriptCore/runtime/JSAPIValueWrapper.h | 64 + .../JavaScriptCore/runtime/JSActivation.cpp | 38 +- .../JavaScriptCore/runtime/JSActivation.h | 21 +- .../JavaScriptCore/runtime/JSArray.cpp | 112 +- .../JavaScriptCore/runtime/JSArray.h | 106 +- .../JavaScriptCore/runtime/JSByteArray.cpp | 19 +- .../JavaScriptCore/runtime/JSByteArray.h | 5 +- .../JavaScriptCore/runtime/JSCell.cpp | 48 +- .../javascriptcore/JavaScriptCore/runtime/JSCell.h | 214 +- .../JavaScriptCore/runtime/JSFunction.cpp | 85 +- .../JavaScriptCore/runtime/JSFunction.h | 57 +- .../JavaScriptCore/runtime/JSGlobalData.cpp | 26 +- .../JavaScriptCore/runtime/JSGlobalData.h | 31 +- .../JavaScriptCore/runtime/JSGlobalObject.cpp | 96 +- .../JavaScriptCore/runtime/JSGlobalObject.h | 33 +- .../runtime/JSGlobalObjectFunctions.cpp | 28 +- .../JavaScriptCore/runtime/JSImmediate.cpp | 77 - .../JavaScriptCore/runtime/JSImmediate.h | 145 +- .../JavaScriptCore/runtime/JSNotAnObject.cpp | 17 +- .../JavaScriptCore/runtime/JSNotAnObject.h | 7 +- .../JavaScriptCore/runtime/JSNumberCell.cpp | 46 +- .../JavaScriptCore/runtime/JSNumberCell.h | 163 +- .../JavaScriptCore/runtime/JSONObject.cpp | 207 +- .../JavaScriptCore/runtime/JSONObject.h | 5 +- .../JavaScriptCore/runtime/JSObject.cpp | 220 +- .../JavaScriptCore/runtime/JSObject.h | 129 +- .../runtime/JSPropertyNameIterator.cpp | 46 +- .../runtime/JSPropertyNameIterator.h | 33 +- .../JavaScriptCore/runtime/JSStaticScopeObject.cpp | 10 +- .../JavaScriptCore/runtime/JSStaticScopeObject.h | 4 +- .../JavaScriptCore/runtime/JSString.cpp | 27 + .../JavaScriptCore/runtime/JSString.h | 31 +- .../javascriptcore/JavaScriptCore/runtime/JSType.h | 6 +- .../JavaScriptCore/runtime/JSTypeInfo.h | 8 +- .../JavaScriptCore/runtime/JSValue.cpp | 98 +- .../JavaScriptCore/runtime/JSValue.h | 545 +- .../JavaScriptCore/runtime/JSVariableObject.cpp | 17 +- .../JavaScriptCore/runtime/JSVariableObject.h | 8 +- .../JavaScriptCore/runtime/JSWrapperObject.cpp | 10 +- .../JavaScriptCore/runtime/JSWrapperObject.h | 20 +- .../JavaScriptCore/runtime/LiteralParser.cpp | 6 +- .../JavaScriptCore/runtime/LiteralParser.h | 2 +- .../javascriptcore/JavaScriptCore/runtime/Lookup.h | 60 +- .../JavaScriptCore/runtime/MarkStack.cpp | 40 + .../JavaScriptCore/runtime/MarkStack.h | 187 + .../JavaScriptCore/runtime/MarkStackPosix.cpp | 72 + .../JavaScriptCore/runtime/MarkStackWin.cpp | 53 + .../JavaScriptCore/runtime/MathObject.cpp | 12 +- .../JavaScriptCore/runtime/MathObject.h | 3 +- .../JavaScriptCore/runtime/NumberConstructor.cpp | 5 + .../JavaScriptCore/runtime/NumberConstructor.h | 3 +- .../JavaScriptCore/runtime/NumberObject.h | 12 +- .../JavaScriptCore/runtime/NumericStrings.h | 74 + .../JavaScriptCore/runtime/ObjectConstructor.cpp | 233 +- .../JavaScriptCore/runtime/ObjectConstructor.h | 2 +- .../JavaScriptCore/runtime/ObjectPrototype.cpp | 19 + .../JavaScriptCore/runtime/ObjectPrototype.h | 6 + .../JavaScriptCore/runtime/Operations.h | 46 +- .../JavaScriptCore/runtime/PropertyDescriptor.cpp | 195 + .../JavaScriptCore/runtime/PropertyDescriptor.h | 80 + .../JavaScriptCore/runtime/PropertyMapHashTable.h | 1 + .../JavaScriptCore/runtime/PropertySlot.cpp | 3 +- .../JavaScriptCore/runtime/PropertySlot.h | 23 +- .../JavaScriptCore/runtime/RegExpConstructor.cpp | 10 +- .../JavaScriptCore/runtime/RegExpConstructor.h | 3 +- .../JavaScriptCore/runtime/RegExpMatchesArray.h | 11 +- .../JavaScriptCore/runtime/RegExpObject.cpp | 5 + .../JavaScriptCore/runtime/RegExpObject.h | 5 +- .../JavaScriptCore/runtime/RegExpPrototype.cpp | 13 +- .../JavaScriptCore/runtime/ScopeChain.cpp | 2 +- .../JavaScriptCore/runtime/ScopeChain.h | 5 +- .../JavaScriptCore/runtime/ScopeChainMark.h | 11 +- .../JavaScriptCore/runtime/SmallStrings.cpp | 10 +- .../JavaScriptCore/runtime/SmallStrings.h | 6 +- .../JavaScriptCore/runtime/StringObject.cpp | 33 +- .../JavaScriptCore/runtime/StringObject.h | 9 +- .../StringObjectThatMasqueradesAsUndefined.h | 2 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 37 +- .../JavaScriptCore/runtime/StringPrototype.h | 1 + .../JavaScriptCore/runtime/Structure.cpp | 197 +- .../JavaScriptCore/runtime/Structure.h | 119 +- .../JavaScriptCore/runtime/StructureChain.cpp | 5 +- .../runtime/StructureTransitionTable.h | 159 +- .../JavaScriptCore/runtime/SymbolTable.h | 4 + .../JavaScriptCore/runtime/TimeoutChecker.cpp | 7 + .../JavaScriptCore/runtime/TimeoutChecker.h | 1 + .../JavaScriptCore/runtime/Tracing.d | 40 - .../JavaScriptCore/runtime/UString.cpp | 85 +- .../JavaScriptCore/runtime/UString.h | 9 +- .../JavaScriptCore/wrec/WRECGenerator.cpp | 12 +- .../JavaScriptCore/wrec/WRECGenerator.h | 28 +- src/3rdparty/javascriptcore/JavaScriptCore/wscript | 103 + .../javascriptcore/JavaScriptCore/wtf/Assertions.h | 30 +- .../javascriptcore/JavaScriptCore/wtf/ByteArray.h | 13 + .../JavaScriptCore/wtf/CurrentTime.cpp | 65 +- .../javascriptcore/JavaScriptCore/wtf/DateMath.cpp | 5 + .../JavaScriptCore/wtf/DisallowCType.h | 32 +- .../JavaScriptCore/wtf/FastAllocBase.h | 12 +- .../JavaScriptCore/wtf/FastMalloc.cpp | 248 +- .../javascriptcore/JavaScriptCore/wtf/FastMalloc.h | 80 +- .../javascriptcore/JavaScriptCore/wtf/HashSet.h | 18 + .../javascriptcore/JavaScriptCore/wtf/ListRefPtr.h | 20 +- .../JavaScriptCore/wtf/MainThread.cpp | 2 +- .../JavaScriptCore/wtf/Noncopyable.h | 2 +- .../javascriptcore/JavaScriptCore/wtf/PassRefPtr.h | 59 +- .../javascriptcore/JavaScriptCore/wtf/Platform.h | 148 +- .../JavaScriptCore/wtf/PossiblyNull.h | 59 + .../JavaScriptCore/wtf/PtrAndFlags.h | 23 +- .../JavaScriptCore/wtf/RandomNumberSeed.h | 1 - .../javascriptcore/JavaScriptCore/wtf/RefPtr.h | 34 +- .../JavaScriptCore/wtf/RefPtrHashMap.h | 2 +- .../JavaScriptCore/wtf/SegmentedVector.h | 3 + .../JavaScriptCore/wtf/StdLibExtras.h | 5 + .../JavaScriptCore/wtf/StringExtras.h | 16 + .../javascriptcore/JavaScriptCore/wtf/TCSpinLock.h | 6 - .../JavaScriptCore/wtf/TCSystemAlloc.cpp | 64 +- .../JavaScriptCore/wtf/TCSystemAlloc.h | 2 +- .../JavaScriptCore/wtf/ThreadSpecific.h | 20 +- .../javascriptcore/JavaScriptCore/wtf/Threading.h | 17 +- .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 3 + .../JavaScriptCore/wtf/VectorTraits.h | 8 +- .../JavaScriptCore/wtf/unicode/Unicode.h | 7 + .../JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 2 +- .../wtf/unicode/wince/UnicodeWince.cpp | 175 + .../wtf/unicode/wince/UnicodeWince.h | 216 + .../JavaScriptCore/yarr/RegexInterpreter.cpp | 226 +- .../JavaScriptCore/yarr/RegexInterpreter.h | 4 +- .../JavaScriptCore/yarr/RegexJIT.cpp | 98 +- src/3rdparty/javascriptcore/VERSION | 11 + src/3rdparty/javascriptcore/WebKit.pri | 133 + src/script/api/qscriptcontextinfo.cpp | 7 +- src/script/api/qscriptengine.cpp | 136 +- src/script/api/qscriptengine_p.h | 6 +- src/script/api/qscriptvalue.cpp | 34 +- src/script/api/qscriptvalueiterator.cpp | 2 +- src/script/bridge/qscriptactivationobject.cpp | 6 +- src/script/bridge/qscriptactivationobject_p.h | 2 +- src/script/bridge/qscriptclassobject.cpp | 8 +- src/script/bridge/qscriptclassobject_p.h | 5 +- src/script/bridge/qscriptglobalobject.cpp | 28 +- src/script/bridge/qscriptglobalobject_p.h | 31 +- src/script/bridge/qscriptobject.cpp | 33 +- src/script/bridge/qscriptobject_p.h | 15 +- src/script/bridge/qscriptqobject.cpp | 109 +- src/script/bridge/qscriptqobject_p.h | 20 +- src/script/bridge/qscriptvariant.cpp | 5 +- src/script/bridge/qscriptvariant_p.h | 4 +- src/script/script.pro | 31 +- .../qscriptengineagent/tst_qscriptengineagent.cpp | 1 - .../qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 3 + tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 2 + 282 files changed, 23538 insertions(+), 8315 deletions(-) create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.cpp delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.h delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.cpp delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSAPIValueWrapper.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSAPIValueWrapper.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MarkStack.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MarkStack.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MarkStackPosix.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MarkStackWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumericStrings.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyDescriptor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyDescriptor.h delete mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Tracing.d create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wscript create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PossiblyNull.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h create mode 100644 src/3rdparty/javascriptcore/VERSION create mode 100644 src/3rdparty/javascriptcore/WebKit.pri diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h index 762a15e..b6d1532 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h @@ -26,7 +26,7 @@ #ifndef APICast_h #define APICast_h -#include "JSNumberCell.h" +#include "JSAPIValueWrapper.h" #include "JSValue.h" #include #include @@ -58,18 +58,18 @@ inline JSC::ExecState* toJS(JSGlobalContextRef c) return reinterpret_cast(c); } -inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) +inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v) { - JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast(const_cast(v))); -#if USE(ALTERNATE_JSIMMEDIATE) - UNUSED_PARAM(exec); +#if USE(JSVALUE32_64) + JSC::JSCell* jsCell = reinterpret_cast(const_cast(v)); + if (!jsCell) + return JSC::JSValue(); + if (jsCell->isAPIValueWrapper()) + return static_cast(jsCell)->value(); + return jsCell; #else - if (jsValue && jsValue.isNumber()) { - ASSERT(jsValue.isAPIMangledNumber()); - return JSC::jsNumber(exec, jsValue.uncheckedGetNumber()); - } + return JSC::JSValue::decode(reinterpret_cast(const_cast(v))); #endif - return jsValue; } inline JSC::JSObject* toJS(JSObjectRef o) @@ -89,15 +89,16 @@ inline JSC::JSGlobalData* toJS(JSContextGroupRef g) inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v) { -#if USE(ALTERNATE_JSIMMEDIATE) - UNUSED_PARAM(exec); +#if USE(JSVALUE32_64) + if (!v) + return 0; + if (!v.isCell()) + return reinterpret_cast(asCell(JSC::jsAPIValueWrapper(exec, v))); + return reinterpret_cast(asCell(v)); #else - if (v && v.isNumber()) { - ASSERT(!v.isAPIMangledNumber()); - return reinterpret_cast(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber()))); - } -#endif + UNUSED_PARAM(exec); return reinterpret_cast(JSC::JSValue::encode(v)); +#endif } inline JSObjectRef toRef(JSC::JSObject* o) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h index 9f3d88e..0a0dcda 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h @@ -64,10 +64,10 @@ typedef struct OpaqueJSValue* JSObjectRef; /* JavaScript symbol exports */ -#undef JS_EXPORT +#if !defined(JS_EXPORT) #if defined(BUILDING_WX__) #define JS_EXPORT -#elif defined(__GNUC__) +#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__) #define JS_EXPORT __attribute__((visibility("default"))) #elif defined(_WIN32_WCE) #if defined(JS_BUILDING_JS) @@ -90,6 +90,7 @@ typedef struct OpaqueJSValue* JSObjectRef; #else #define JS_EXPORT #endif +#endif #ifdef __cplusplus extern "C" { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h index 1f06249..0497aa2 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h @@ -41,7 +41,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames)); } private: diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp index 1b3217b..b7dd768 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp @@ -28,6 +28,7 @@ #include "JSCallbackFunction.h" #include "APICast.h" +#include "CodeBlock.h" #include "JSFunction.h" #include "FunctionPrototype.h" #include diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h index 7dd87b5..3a17fa2 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h @@ -41,7 +41,7 @@ public: // refactor the code so this override isn't necessary static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); } private: diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h index 4360baa..e767cb5 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h @@ -66,7 +66,7 @@ private: virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); - virtual void getPropertyNames(ExecState*, PropertyNameArray&, unsigned listedAttributes = Structure::Prototype); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual double toNumber(ExecState*) const; virtual UString toString(ExecState*) const; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h index 669b3cd..c84c191 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -318,11 +318,12 @@ bool JSCallbackObject::hasInstance(ExecState* exec, JSValue value, JSValue for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) { + JSValueRef valueRef = toRef(exec, value); JSValueRef exception = 0; bool result; { JSLock::DropAllLocks dropAllLocks(exec); - result = hasInstance(execRef, thisRef, toRef(exec, value), &exception); + result = hasInstance(execRef, thisRef, valueRef, &exception); } exec->setException(toJS(exec, exception)); return result; @@ -372,7 +373,7 @@ JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, } template -void JSCallbackObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, unsigned listedAttributes) +void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { JSContextRef execRef = toRef(exec); JSObjectRef thisRef = toRef(this); @@ -380,7 +381,7 @@ void JSCallbackObject::getPropertyNames(ExecState* exec, PropertyNameArray for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) { JSLock::DropAllLocks dropAllLocks(exec); - getPropertyNames(execRef, thisRef, toRef(&propertyNames), listedAttributes); + getPropertyNames(execRef, thisRef, toRef(&propertyNames)); } if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { @@ -406,7 +407,7 @@ void JSCallbackObject::getPropertyNames(ExecState* exec, PropertyNameArray } } - Base::getPropertyNames(exec, propertyNames, listedAttributes); + Base::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable); } template @@ -428,11 +429,13 @@ double JSCallbackObject::toNumber(ExecState* exec) const JSLock::DropAllLocks dropAllLocks(exec); value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); } - exec->setException(toJS(exec, exception)); - if (value) { - double dValue; - return toJS(exec, value).getNumber(dValue) ? dValue : NaN; + if (exception) { + exec->setException(toJS(exec, exception)); + return 0; } + + double dValue; + return toJS(exec, value).getNumber(dValue) ? dValue : NaN; } return Base::toNumber(exec); @@ -452,11 +455,11 @@ UString JSCallbackObject::toString(ExecState* exec) const JSLock::DropAllLocks dropAllLocks(exec); value = convertToType(ctx, thisRef, kJSTypeString, &exception); } - exec->setException(toJS(exec, exception)); - if (value) - return toJS(exec, value).getString(); - if (exception) + if (exception) { + exec->setException(toJS(exec, exception)); return ""; + } + return toJS(exec, value).getString(); } return Base::toString(exec); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h index c742d96..c4777dd 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h @@ -58,7 +58,7 @@ struct StaticFunctionEntry : FastAllocBase { typedef HashMap, StaticValueEntry*> OpaqueJSClassStaticValuesTable; typedef HashMap, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTable; -class OpaqueJSClass; +struct OpaqueJSClass; // An OpaqueJSClass (JSClass) is created without a context, so it can be used with any context, even across context groups. // This structure holds data members that vary across context groups. diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp index 87d36ec..06ef578 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp @@ -28,6 +28,7 @@ #include "JSObjectRef.h" #include "APICast.h" +#include "CodeBlock.h" #include "DateConstructor.h" #include "ErrorConstructor.h" #include "FunctionConstructor.h" diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h index 86921bd..3e8b0eb 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h @@ -187,7 +187,6 @@ typedef bool @param ctx The execution context to use. @param object The JSObject whose property names are being collected. @param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties. -@param flag Specify which property should be included @discussion If you named your function GetPropertyNames, you would declare it like this: void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); @@ -197,7 +196,7 @@ Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. */ typedef void -(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames, unsigned flag); +(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); /*! @typedef JSObjectCallAsFunctionCallback diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h index 8b17ee2..41d8978 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h @@ -37,7 +37,7 @@ extern "C" { #endif -#if !defined(WIN32) && !defined(_WIN32) +#if (!defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__)) /*! @typedef JSChar @abstract A Unicode character. diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog index 24fc7e7..20bfc23 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog @@ -1,3 +1,7264 @@ +2009-09-24 Gabor Loki + + Reviewed by Gavin Barraclough. + + Avoid __clear_cache built-in function if DISABLE_BUILTIN_CLEAR_CACHE define is set + https://bugs.webkit.org/show_bug.cgi?id=28886 + + There are some GCC packages (for example GCC-2006q3 from CodeSourcery) + which contain __clear_cache built-in function only for C while the C++ + version of __clear_cache is missing on ARM architectures. + + Fixed a small bug in the inline assembly of cacheFlush function on + ARM_TRADITIONAL. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-09-21 Gustavo Noronha Silva + + Unreviewed make dist build fix. Missing files. + + * GNUmakefile.am: + +2009-09-19 Gavin Barraclough + + Reviewed by Sam 'Cabin Boy' Weinig. + + Fix stack alignment with ARM THUMB2 JIT. + https://bugs.webkit.org/show_bug.cgi?id=29526 + + Stack is currently being decremented by 0x3c, bump this to 0x40 to make this a + multiple of 16 bytes. + + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + +2009-09-20 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + SNES is too slow + https://bugs.webkit.org/show_bug.cgi?id=29534 + + The problem was that the emulator used multiple classes with + more properties than our dictionary cutoff allowed, this resulted + in more or less all critical logic inside the emulator requiring + uncached property access. + + Rather than simply bumping the dictionary cutoff, this patch + recognises that there are two ways to create a "dictionary" + structure. Either by adding a large number of properties, or + by removing a property. In the case of adding properties we + know all the existing properties will maintain their existing + offsets, so we could cache access to those properties, if we + know they won't be removed. + + To make this possible, this patch adds the logic required to + distinguish a dictionary created by addition from one created + by removal. With this logic in place we can now cache access + to objects with large numbers of properties. + + SNES performance improved by more than 6x. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-19 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Implement ES5 Object.create function + https://bugs.webkit.org/show_bug.cgi?id=29524 + + Implement Object.create. Very simple patch, effectively Object.defineProperties + only creating the target object itself. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorCreate): + +2009-09-19 Dan Bernstein + + Fix clean debug builds. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Joerg Bornemann + + Reviewed by George Staikos. + + QtWebKit Windows CE compile fix + + https://bugs.webkit.org/show_bug.cgi?id=29379 + + There is no _aligned_alloc or _aligned_free on Windows CE. + We just use the Windows code that was there before and use VirtualAlloc. + But that also means that the BLOCK_SIZE must be 64K as this function + allocates on 64K boundaries. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlock): + * runtime/Collector.h: + +2009-09-19 Oliver Hunt + + Reviewed by Sam Weinig. + + Implement ES5 Object.defineProperties function + https://bugs.webkit.org/show_bug.cgi?id=29522 + + Implement Object.defineProperties. Fairly simple patch, simply makes use of + existing functionality used for defineProperty. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::defineProperties): + (JSC::objectConstructorDefineProperties): + +2009-09-19 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Windows build fix part2 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Oliver Hunt + + Reviewed by NOBODY (Buildfix). + + Windows build fix part 1. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-18 Oliver Hunt + + Reviewed by Geoff Garen. + + Implement ES5 Object.defineProperty function + https://bugs.webkit.org/show_bug.cgi?id=29503 + + Implement Object.defineProperty. This requires adding the API to + ObjectConstructor, along with a helper function that implements the + ES5 internal [[ToPropertyDescriptor]] function. It then adds + JSObject::defineOwnProperty that implements the appropriate ES5 semantics. + Currently defineOwnProperty uses a delete followed by a put to redefine + attributes of a property, clearly this is less efficient than it could be + but we can improve this if it needs to be possible in future. + + * JavaScriptCore.exp: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::defineGetter): + (JSC::DebuggerActivation::defineSetter): + * debugger/DebuggerActivation.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + Update defineGetter/Setter calls + * runtime/CommonIdentifiers.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertySlot): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::defineGetter): + (JSC::JSGlobalObject::defineSetter): + * runtime/JSGlobalObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + (JSC::putDescriptor): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorGetOwnPropertyDescriptor): + (JSC::toPropertyDescriptor): + (JSC::objectConstructorDefineProperty): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + * runtime/PropertyDescriptor.cpp: + (JSC::PropertyDescriptor::writable): + (JSC::PropertyDescriptor::enumerable): + (JSC::PropertyDescriptor::configurable): + (JSC::PropertyDescriptor::isDataDescriptor): + (JSC::PropertyDescriptor::isGenericDescriptor): + (JSC::PropertyDescriptor::isAccessorDescriptor): + (JSC::PropertyDescriptor::getter): + (JSC::PropertyDescriptor::setter): + (JSC::PropertyDescriptor::setDescriptor): + (JSC::PropertyDescriptor::setAccessorDescriptor): + (JSC::PropertyDescriptor::setWritable): + (JSC::PropertyDescriptor::setEnumerable): + (JSC::PropertyDescriptor::setConfigurable): + (JSC::PropertyDescriptor::setSetter): + (JSC::PropertyDescriptor::setGetter): + (JSC::PropertyDescriptor::equalTo): + (JSC::PropertyDescriptor::attributesEqual): + (JSC::PropertyDescriptor::attributesWithOverride): + * runtime/PropertyDescriptor.h: + (JSC::PropertyDescriptor::PropertyDescriptor): + (JSC::PropertyDescriptor::value): + (JSC::PropertyDescriptor::setValue): + (JSC::PropertyDescriptor::isEmpty): + (JSC::PropertyDescriptor::writablePresent): + (JSC::PropertyDescriptor::enumerablePresent): + (JSC::PropertyDescriptor::configurablePresent): + (JSC::PropertyDescriptor::setterPresent): + (JSC::PropertyDescriptor::getterPresent): + (JSC::PropertyDescriptor::operator==): + (JSC::PropertyDescriptor::): + +2009-09-18 Gabor Loki + + Reviewed by Gavin Barraclough. + + Build fix to enable ARM_THUMB2 on Linux + https://bugs.webkit.org/show_bug.cgi?id= + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + * jit/JITStubs.cpp: + * wtf/Platform.h: + +2009-09-18 Gabor Loki + + Reviewed by Gavin Barraclough. + + Defines two pseudo-platforms for ARM and Thumb-2 instruction set. + https://bugs.webkit.org/show_bug.cgi?id=29122 + + Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 + macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used + when Thumb-2 instruction set is the required target. The + PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In + case where the code is common the PLATFORM(ARM) have to be used. + + * assembler/ARMAssembler.cpp: + * assembler/ARMAssembler.h: + * assembler/ARMv7Assembler.h: + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.cpp: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerCodeRef.h: + (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): + * jit/ExecutableAllocator.h: + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::preserveReturnAddressAfterCall): + (JSC::JIT::restoreReturnAddressBeforeReturn): + (JSC::JIT::restoreArgumentReference): + (JSC::JIT::restoreArgumentReferenceForTrampoline): + * jit/JITOpcodes.cpp: + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + * wtf/Platform.h: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): + +2009-09-18 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Fix the Qt/Windows CE build. + + * JavaScriptCore.pri: Build the ce_time.cpp functions from + within Qt externally. + * wtf/DateMath.cpp: Removed unnecessary Qt #ifdef, for the + Qt build these functions are no external, too. + +2009-09-17 Janne Koskinen + + Reviewed by Simon Hausmann. + + Symbian/WINSCW build fox. + + Repeat Q_OS_WIN wchar_t hack for WINSCW, similar to + revision 24774. + + WINSCW defines wchar_t, thus UChar has to be wchar_t + + * wtf/unicode/qt4/UnicodeQt4.h: + +2009-09-17 Janne Koskinen + + Reviewed by Simon Hausmann. + + Symbian/WINSCW build fix. + + https://bugs.webkit.org/show_bug.cgi?id=29186 + + WINSCW Template specialisation name in declaration must the be the same as in implementation. + + * runtime/LiteralParser.h: + +2009-09-15 Norbert Leser + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27060 + + Symbian compiler for emulator target (WINSCW) fails with + "illegal operand" for m_attributesInPrevious in structure.ccp + (when calling make_pair functions). + This error is apparently due to the compiler not properly + resolving the unsigned type of the declared bitfield. + + Initial patch explicitly casted m_attributesInPrevious + to unsigned, but since bitfield optimization is not critical for + the emulator target, this conditional change in header file + appears to be least intrusive. + + * runtime/Structure.h: + +2009-09-16 Gabor Loki + + Reviewed by Darin Adler. + + Fix GCC warnings on ARM_THUMB2 platform + + * assembler/ARMv7Assembler.h: + (JSC::ARMThumbImmediate::countLeadingZerosPartial): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::branchTruncateDoubleToInt32): + (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding): + +2009-09-16 Greg Bolsinga + + Add ENABLE(INSPECTOR) + https://bugs.webkit.org/show_bug.cgi?id=29260 + + Reviewed by David Kilzer. + + * wtf/Platform.h: + +2009-09-16 Greg Bolsinga + + Add ENABLE(CONTEXT_MENUS) + https://bugs.webkit.org/show_bug.cgi?id=29225 + + Reviewed by David Kilzer. + + * wtf/Platform.h: + +2009-09-16 Benjamin C Meyer + + Reviewed by Eric Seidel. + + The webkit stdint and stdbool headers exists because + the compiler MSVC doesn't include them. The check + should not check for PLATFORM(WIN_OS) but for MSVC. + + * os-win32/stdbool.h: + * os-win32/stdint.h: + +2009-09-16 Greg Bolsinga + + Add ENABLE(DRAG_SUPPORT) + https://bugs.webkit.org/show_bug.cgi?id=29233 + + Reviewed by David Kilzer. + + * wtf/Platform.h: + +2009-09-16 Kevin Ollivier + + waf build fix after flag was moved to correct place. + + * wscript: + +2009-09-16 Tor Arne Vestbø + + Reviewed by Simon Hausmann. + + [Qt] Build fix for 64-bit Qt on Mac OS X + + * wtf/Platform.h: Use JSVALUE64 on DARWIN, not only on MAC + +2009-09-16 Zoltan Herczeg + + Reviewed by Simon Hausmann. + + [Qt] Fix wtf/ThreadSpecific.h under Qt to free thread local objects. + https://bugs.webkit.org/show_bug.cgi?id=29295 + + This is an important fix when JavaScript workers are in use, since + unfreed ThreadGlobalDatas leak a big amount of memory (50-100k each). + QThreadStorage calls the destructor of a given object, which is the + ThreadSpecific::Data. Unlike pthread, Qt is object oriented, and does + not support the calling of a static utility function when the thread + is about to close. In this patch we call the ThreadSpecific::destroy() + utility function from the destructor of ThreadSpecific::Data. Moreover, + since Qt resets all thread local values to 0 before the calling of the + appropriate destructors, we set back the pointer to its original value. + This is necessary because the get() method of the ThreadSpecific + object may be called during the exuction of the destructor. + + * wtf/ThreadSpecific.h: + (WTF::ThreadSpecific::Data::~Data): + (WTF::::~ThreadSpecific): + (WTF::::set): + (WTF::::destroy): + +2009-09-10 Oliver Hunt + + Reviewed by Geoff Garen. + + Allow anonymous storage inside JSObject + https://bugs.webkit.org/show_bug.cgi?id=29168 + + Add the concept of anonymous slots to Structures so that it is + possible to store references to values that need marking in the + standard JSObject storage buffer. This allows us to reduce the + malloc overhead of some objects (by allowing them to store JS + values in the inline storage of the object) and reduce the + dependence of custom mark functions (if all an objects children + are in the standard object property storage there's no need to + mark them manually). + + * JavaScriptCore.exp: + * runtime/JSObject.h: + (JSC::JSObject::putAnonymousValue): + (JSC::JSObject::getAnonymousValue): + (JSC::JSObject::addAnonymousSlots): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + (JSC::JSWrapperObject::JSWrapperObject): + (JSC::JSWrapperObject::setInternalValue): + * runtime/PropertyMapHashTable.h: + * runtime/Structure.cpp: + (JSC::Structure::~Structure): + (JSC::Structure::materializePropertyMap): + (JSC::Structure::addAnonymousSlotsTransition): + (JSC::Structure::copyPropertyTable): + (JSC::Structure::put): + (JSC::Structure::rehashPropertyMapHashTable): + * runtime/Structure.h: + (JSC::Structure::propertyStorageSize): + (JSC::StructureTransitionTable::reifySingleTransition): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTable::TransitionTable::addSlotTransition): + (JSC::StructureTransitionTable::TransitionTable::removeSlotTransition): + (JSC::StructureTransitionTable::TransitionTable::getSlotTransition): + (JSC::StructureTransitionTable::getAnonymousSlotTransition): + (JSC::StructureTransitionTable::addAnonymousSlotTransition): + (JSC::StructureTransitionTable::removeAnonymousSlotTransition): + +2009-09-15 Alex Milowski + + Reviewed by Tor Arne Vestbø. + + Added the ENABLE_MATHML define to the features + + * Configurations/FeatureDefines.xcconfig: + +2009-09-15 Csaba Osztrogonac + + Reviewed by Tor Arne Vestbø. + + [Qt] Build fix for windows. + + After http://trac.webkit.org/changeset/47795 the MinGW build broke, + because MinGW has __mingw_aligned_malloc instead of _aligned_malloc. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): MinGW case added. + (JSC::Heap::freeBlock): MinGW case added. + +2009-09-15 Csaba Osztrogonac + + Reviewed by Tor Arne Vestbø. + + [Qt] Build fix for Windows/MinGW + + https://bugs.webkit.org/show_bug.cgi?id=29268 + + * wtf/Platform.h: JSVALUE32_64 temporarily disabled on PLATFORM(WIN_OS) with COMPILER(MINGW) + +2009-09-14 Gabor Loki + + Reviewed by Gavin Barraclough. + + Detect VFP at runtime in generic ARM port on Linux platform. + https://bugs.webkit.org/show_bug.cgi?id=29076 + + * JavaScriptCore.pri: + * assembler/MacroAssemblerARM.cpp: Added. + (JSC::isVFPPresent): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::supportsFloatingPoint): + +2009-09-14 Csaba Osztrogonac + + Reviewed by Tor Arne Vestbø. + + [Qt] Build fix for windows build. + + * JavaScriptCore.pri: Correct a logic error. + * pcre/dftables: Add missing paranthesis for tmpdir function. + +2009-09-12 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Build fix for windows exports (again). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-12 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Build fix for windows exports. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-12 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Correct fix for non-allinonefile builds + + * runtime/ObjectConstructor.cpp: + +2009-09-12 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Fix non-allinonefile builds + + * runtime/ObjectConstructor.cpp: + +2009-09-12 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + [ES5] Implement Object.keys + https://bugs.webkit.org/show_bug.cgi?id=29170 + + This patch basically requires two separate steps, the first is to split getPropertyNames + into two functions -- getOwnPropertyNames and getPropertyNames, basically making them behave + in the same way as getOwnPropertySlot and getPropertySlot. In essence getOwnPropertyNames + produces the list of properties on an object excluding its prototype chain and getPropertyNames + just iterates the the object and its prototype chain calling getOwnPropertyNames at each level. + + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertyNames): + * JavaScriptCore.exp: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::getOwnPropertyNames): + * debugger/DebuggerActivation.h: + * runtime/CommonIdentifiers.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertyNames): + * runtime/JSArray.h: + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::getOwnPropertyNames): + * runtime/JSByteArray.h: + * runtime/JSNotAnObject.cpp: + (JSC::JSNotAnObject::getOwnPropertyNames): + * runtime/JSNotAnObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::getOwnPropertyNames): + * runtime/JSObject.h: + * runtime/JSVariableObject.cpp: + (JSC::JSVariableObject::getOwnPropertyNames): + * runtime/JSVariableObject.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorKeys): + * runtime/RegExpMatchesArray.h: + (JSC::RegExpMatchesArray::getOwnPropertyNames): + * runtime/StringObject.cpp: + (JSC::StringObject::getOwnPropertyNames): + * runtime/StringObject.h: + * runtime/Structure.cpp: + (JSC::Structure::getOwnEnumerablePropertyNames): + (JSC::Structure::getEnumerablePropertyNames): + * runtime/Structure.h: + +2009-09-11 Oliver Hunt + + Reviewed by Sam Weinig. + + getPropertyNames caching is invalid when the prototype chain contains objects with custom getPropertyNames + https://bugs.webkit.org/show_bug.cgi?id=29214 + + Add a flag to TypeInfo to indicate whether a type overrides getPropertyNames. + This flag is used to make sure that caching of the property name data is safe. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::hasDefaultGetPropertyNames): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-11 Alexey Proskuryakov + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=29207 + Add checks for using WebCore JS context on secondary threads + + * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + Added a new mainThreadOnly flag that WebCore would set. + + * runtime/Collector.cpp: (JSC::Heap::registerThread): JSC API methods always call this, + so this is a good place to check that the API isn't used form a wrong thread. + +2009-09-11 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + Compiling JavaScriptCore on sparc 64 with gcc fails. + + ThreadSafeShared uses the atomic __gnu_cxx::__exchange_and_add with an int, + however on sparc 64 the _Atomic_word argument is typedefed to long (8 bytes). + + The patch disables WTF_USE_LOCKFREE_THREADSAFESHARED in ThreadSafeShared to use + a mutex instead when compiling for sparc 64 with gcc. + + https://bugs.webkit.org/show_bug.cgi?id=29175 + + * wtf/Platform.h: + __sparc64__ is not defined on all OS. + Uses instead: __sparc__ && __arch64__ || __sparcv9 + * wtf/Threading.h: + +2009-09-11 Prasanth Ullattil + + Reviewed by Simon Hausmann. + + Fix compile error on Windows7(64Bit) with latest SDK. + + Added the missing include file. + + * runtime/UString.cpp: + +2009-09-11 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Qt/Windows CE compile fix, include the executable allocator and + markstack implementation in the windows build. + + * JavaScriptCore.pri: + +2009-09-08 John Abd-El-Malek + + Reviewed by Dimitri Glazkov. + + Remove unneeded define for ActiveX. + https://bugs.webkit.org/show_bug.cgi?id=29054 + + * wtf/Platform.h: + +2009-09-10 Mark Rowe + + Rubber-stamped by Sam Weinig. + + Update JavaScriptCore and WebKit's FeatureDefines.xcconfig so that they are in sync with WebCore as they need to be. + + * Configurations/FeatureDefines.xcconfig: + +2009-09-10 Fumitoshi Ukai + + Reviewed by Alexey Proskuryakov. + + Export WTF::tryFastMalloc used in WebSocketChannel. + https://bugs.webkit.org/show_bug.cgi?id=28038 + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-10 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Make StructureTransitionTable use an enum for the PtrAndFlags member + used for the single transition slot optimisation. + + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTable::StructureTransitionTable): + (JSC::StructureTransitionTable::usingSingleTransitionSlot): + (JSC::StructureTransitionTable::): + +2009-09-10 Oliver Hunt + + Reviewed by Geoff Garen. + + Refactor StructureTransitionTable and Structure to unify handling of the single slot optimization + https://bugs.webkit.org/show_bug.cgi?id=29141 + + Make StructureTransitionTable encapsulate the single transition slot optimization. + + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::~Structure): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::removePropertyWithoutTransition): + (JSC::Structure::hasTransition): + * runtime/Structure.h: + (JSC::StructureTransitionTable::contains): + (JSC::StructureTransitionTable::get): + (JSC::StructureTransitionTable::hasTransition): + (JSC::StructureTransitionTable::reifySingleTransition): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTable::StructureTransitionTable): + (JSC::StructureTransitionTable::~StructureTransitionTable): + (JSC::StructureTransitionTable::remove): + (JSC::StructureTransitionTable::add): + (JSC::StructureTransitionTable::table): + (JSC::StructureTransitionTable::singleTransition): + (JSC::StructureTransitionTable::usingSingleTransitionSlot): + (JSC::StructureTransitionTable::setSingleTransition): + (JSC::StructureTransitionTable::setTransitionTable): + (JSC::StructureTransitionTable::): + * wtf/PtrAndFlags.h: + (WTF::PtrAndFlags::PtrAndFlags): + +2009-09-10 Zoltan Horvath + + Reviewed by Darin Adler. + + Implement fastDeleteSkippingDestructor for FastAllocBase and fastDeleteAllValues for HashSet + https://bugs.webkit.org/show_bug.cgi?id=25930 + + FastAllocBase has been extended with fastDeleteSkippingDestructor function which + releases memory without destructor call. fastDeleteAllValues has been implemented + similar as deleteAllValues but it uses fastDelete function to release memory. + + * wtf/FastAllocBase.h: + (WTF::fastDeleteSkippingDestructor): + * wtf/HashSet.h: + (WTF::fastDeleteAllValues): + +2009-09-10 Laszlo Gombos + + Reviewed by Darin Adler. + + ARM compiler does not understand GCC visibility attribute + https://bugs.webkit.org/show_bug.cgi?id=29079 + + * API/JSBase.h: Make the test more specific to hit only + the GCC compiler + +2009-09-10 Adam Barth + + Unreviewed revert of the previous change. It broke the tests. + + * wtf/dtoa.cpp: + (WTF::dtoa): + +2009-09-10 Ben Laurie + + Reviewed by Adam Barth. + + + + If dtoa was given a small buffer and the number was either infinite or + NaN, then the buffer would be overflowed. + + * wtf/dtoa.cpp: + +2009-09-09 Laszlo Gombos + + Reviewed by Darin Adler. + + Change reinterpret_cast to static_cast in r48212. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-09-09 Laszlo Gombos + + Reviewed by Darin Adler. + + Remove WTF_PLATFORM_FORCE_PACK as it is no longer used + https://bugs.webkit.org/show_bug.cgi?id=29066 + + * wtf/Platform.h: + +2009-09-09 Laszlo Gombos + + Reviewed by Ariya Hidayat. + + Implement flushing the instruction cache for Symbian + https://bugs.webkit.org/show_bug.cgi?id=29075 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): Call IMB_Range to flush + the instruction cache on Symbian + +2009-09-09 Kent Hansen + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=29024 + Make JavaScriptCore compile on platforms with case-insensitive file systems and typeinfo.h in STL + + These platforms include Microsoft Visual Studio 2003, and Symbian with Metrowerks compiler. + + * JavaScriptCore.gypi: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSTypeInfo.h: Copied from JavaScriptCore/runtime/TypeInfo.h. + * runtime/Structure.h: + * runtime/TypeInfo.h: Removed. + +2009-09-08 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + JSON.stringify(Date) loses the milliseconds information + https://bugs.webkit.org/show_bug.cgi?id=29063 + + Make sure we include milliseconds in the output of toISOString. + + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToISOString): + +2009-09-08 Kevin Ollivier + + wx build fix, generate derived sources earlier in order to make sure + they're found by the build system when generating the list of sources to build. + + * wscript: + +2009-09-08 Laszlo Gombos + + Reviewed by Simon Hausmann. + + Build fix when USE(LOCKFREE_THREADSAFESHARED) is not defined + https://bugs.webkit.org/show_bug.cgi?id=29011 + + * wtf/Threading.h: Use LOCKFREE_THREADSAFESHARED guard for + atomicIncrement and atomicDecrement + +2009-09-07 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control in Yarr's RegexInterpreter + https://bugs.webkit.org/show_bug.cgi?id=29025 + + Inherits RegexInterpreter classes from FastAllocBase (bug #20422), which has + been instantiated by 'new': + + class ByteDisjunction + -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1462 + + struct BytecodePattern + -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1279 + + * yarr/RegexInterpreter.h: + +2009-09-07 Drew Wilson + + Reverting r48121 to fix Windows build errors. + + * JavaScriptCore.exp: + +2009-09-07 Drew Wilson + + Reviewed by David Levin. + + Enable SHARED_WORKERS by default + https://bugs.webkit.org/show_bug.cgi?id=28959 + + * Configurations/FeatureDefines.xcconfig: + +2009-09-07 Fumitoshi Ukai + + Reviewed by Alexey Proskuryakov. + + Export WTF::tryFastMalloc used in WebSocketChannel. + https://bugs.webkit.org/show_bug.cgi?id=28038 + + * JavaScriptCore.exp: + +2009-09-04 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Fix windows export files + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-04 Oliver Hunt + + Reviewed by Gavin Barraclough. + + [[ToString]] conversion should use the actual toString function for String objects. + + Remove incorrect specialisations of toString conversions on StringObject. + + * JavaScriptCore.exp: + * runtime/StringObject.cpp: + * runtime/StringObject.h: + +2009-09-04 Steve Falkenburg + + Windows build fix. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Add new export. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Add new export. + +2009-09-04 Steve Falkenburg + + Windows build fix. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove unneeded export. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Remove unneeded export. + +2009-09-04 Darin Adler + + Reviewed by Geoff Garen. + + DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32) + https://bugs.webkit.org/show_bug.cgi?id=28909 + + Part two. + + Make some improvements to garbage collection code: + + 1) Create a runtime assertion that catches any classes that + override markChildren but have the HasDefaultMark bit set. + 2) Remove checks of the mark bit outside the MarkStack::append + function; they are redundant. + 3) Improve the efficiency of the asObject and asArray functions + when called on JSCell* to avoid a round trip to JSValue. + 4) Make more callers use the checked asCell and asObject + casting functions rather than unchecked casts. + 5) Removed the JSCell::marked function and other GC-related + functions because these operations are no longer things that + code other than the core GC code needs to do directly. Fixed + callers that were calling them. + + * runtime/Collector.cpp: + (JSC::Heap::markConservatively): Removed unneeded call to MarkStack::drain. + (JSC::Heap::markProtectedObjects): Removed unneeded check of the mark + bit and call to MarkStack::drain. + (JSC::Heap::collect): Removed unneeded checks of the mark bit and also + changed call to SmallStrings::mark to call markChildren instead to match + the rest of the objects. + (JSC::typeName): Removed unneeded cast to JSObject*. + + * runtime/JSArray.h: + (JSC::asArray): Added an overload for JSCell* and changed the JSValue + version to call it. Removed some unneeded casts. + (JSC::JSArray::markChildrenDirect): Marked this function inline. It's in + a header, and if not marked inline this could lead to linking problems. + (JSC::MarkStack::markChildren): Added. This helper function is used by + the drain function to avoid repating code. Also added the code here to + check fro default mark violations in debug code. If a markChildren + function adds something to the mark stack, but the type info claimed + hasDefaultMark was true, then we will get an assertion now. Also fixed + the assertion about the mark bit to use the Heap function directly + because we don't have a JSCell::marked function any more. + (JSC::MarkStack::drain): Changed a local variable from "v" to "value", + and from "currentCell" to "cell". Changed to call markChildren in two + places instead of repeating a chain of if statements twice. Changed + code that reads and writes the mark bit to use Heap::isCellMarked and + Heap::markCell so we can eliminate the JSCell::marked and + JSCell::markCellDirect functions. + + * runtime/JSCell.h: Removed JSCell's markCellDirect and marked member + functions. Added a comment explaining that asCell should be deprecated + in favor of the JSValue asCell member function. + (JSC::MarkStack::append): Added the assertion that catches callers + that have set the HasDefaultMark bit incorrectly. Changed + code that reads and writes the mark bit to use Heap::isCellMarked and + Heap::markCell so we can eliminate the JSCell::marked and + JSCell::markCellDirect functions. Moved the overload of + MarkStack::append for JSValue here so it can call through to the cell + version. The old version had a copy of all the code instead, but that + repeated the conversion from JSValue to JSCell* and the check for + whether a value is a cell multiple times. + (JSC::Structure::markAggregate): Moved this function here to avoid + dependencies for Structure.h, since this calls MarkStack::append. + + * runtime/JSObject.cpp: + (JSC::JSObject::markChildren): Added code to clear + m_isCheckingForDefaultMarkViolation so the marking done by JSObject + doesn't trigger the assertion. + + * runtime/JSValue.h: Moved some stray includes that were outside the + header guard inside it. Not sure how that happened! Removed the + GC-related member functions markChildren, hasChildren, marked, and + markDirect. + + * runtime/JSWrapperObject.h: Made markChildren private. + (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the + HasDefaultMark bit was set. + + * runtime/MarkStack.h: Added m_isCheckingForDefaultMarkViolation and + initialized it to false. Moved the append function body from here to + JSCell.h. Added a declaration of a private markChildren function used + inside the drain function. + + * runtime/SmallStrings.cpp: + (JSC::SmallStrings::markChildren): Changed the name and style of this + function to match other functions. This allows us to share the normal + mark stack code path. + + * runtime/SmallStrings.h: Changed the name and interface of mark to + the more-normal markChildren style. + + * runtime/Structure.h: Moved the body of markAggregate into the + JSCell.h to avoid a circular dependency with JSCell.h. + +2009-09-04 Darin Adler + + Reviewed by Geoff Garen. + + DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32) + https://bugs.webkit.org/show_bug.cgi?id=28909 + + Part one. + + Make some improvements to garbage collection code: + + 1) Fix the two classes that had the default mark bit set but + should not. + 2) Remove checks of the mark bit outside the MarkStack::append + function; they are redundant. + 3) Make more callers use the checked asCell and asObject + casting functions rather than unchecked casts. + 4) Removed some GC-related functions because these operations are + no longer things that code other than the core GC code needs + to do directly. Fixed callers that were calling them. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::markAggregate): Removed unneeded check of the mark + bit before calling MarkStack::append. + + * interpreter/Register.h: Removed unneeded marked and markChildren + functions. + + * jit/JITStubs.cpp: + (op_eq): Removed unneeded assertions, instead using checked casting + functions such as asObject. + + * runtime/ArgList.h: Added now-needed forward declaration of MarkStack. + + * runtime/GetterSetter.cpp: + (JSC::GetterSetter::markChildren): Remmoved unneeded check of the mark bit. + + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): Added. Fixes a bug where the + HasDefaultMark bit was set. + + * runtime/JSCell.cpp: + (JSC::JSCell::getObject): Use asObject to avoid a direct static_cast. + + * runtime/JSObject.h: + (JSC::asObject): Added an overload for JSCell* and changed the JSValue + version to call it. + (JSC::JSValue::get): Use asObject to avoid a direct static_cast. + + * runtime/JSWrapperObject.h: Made markChildren private. + (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the + HasDefaultMark bit was set. Later we may want to optimize this for + wrapper types that never have cells in their internal values, but there + is no measured performance regression in SunSpider or V8 doing this + all the time. + + * runtime/MarkStack.cpp: Tweaked formatting. + +2009-09-04 Kevin Ollivier + + wx build fix. Switch USE_ defines over to the compiler so that they can be + checked by files not including config.h (like WebCorePrefix.h). + + * wtf/Platform.h: + +2009-09-03 Yong Li + + Reviewed by David Levin. + + Remove unnecessary dependency on unistd.h + https://bugs.webkit.org/show_bug.cgi?id=28962 + + * runtime/Completion.cpp: + +2009-09-03 Fumitoshi Ukai + + Reviewed by Eric Seidel. + + Add strnstr for Linux and Windows in StringExtras.h + https://bugs.webkit.org/show_bug.cgi?id=28901 + + * wtf/StringExtras.h: + (strnstr): + +2009-09-03 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's HashEntry class + https://bugs.webkit.org/show_bug.cgi?id=27830 + + Inherits HashEntry class from FastAllocBase because it has been + instantiated by 'new' JavaScriptCore/runtime/Lookup.cpp:32. + + * runtime/Lookup.h: + +2009-09-02 Gavin Barraclough + + Should crash if JIT code buffer allocation fails. + + https://bugs.webkit.org/show_bug.cgi?id=28926 + + + * jit/ExecutableAllocatorPosix.cpp: + (JSC::ExecutablePool::systemAlloc): + * jit/ExecutableAllocatorWin.cpp: + (JSC::ExecutablePool::systemAlloc): + +2009-09-02 Kevin Ollivier + + waf build fixes for Windows/MSVC. + + * wscript: + +2009-09-02 Kevin Ollivier + + Build fix for building on Windows. + + * wtf/ThreadingPthreads.cpp: + +2009-09-02 Norbert Leser + + Reviewed by Eric Seidel. + + Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled + + RegisterFile constructor currently throws #error when both + MMAP and VIRTUALALLOC conditions fail. + On any platform that does not provide these features + (for instance, Symbian), + the fallback should be regular malloc (or fastMalloc). + It is functionally equivalent in this case, even though it may + have certain drawbacks such as lack of dynamic pre-allocation. + + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + * interpreter/RegisterFile.h: + (JSC::RegisterFile::RegisterFile): + +2009-08-31 Robert Agoston + + Reviewed by Gavin Barraclough. + + Fixed typo. + https://bugs.webkit.org/show_bug.cgi?id=28691 + + * parser/Parser.h: + (JSC::Parser::parse): + +2009-08-27 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + JSON Stringifier does not follow ES5 spec for handling of Number, String and Boolean objects + https://bugs.webkit.org/show_bug.cgi?id=28797 + + Fixed unwrapBoxedPrimitive to do the right thing, which necessitated a couple of new exception + checks, and corrected the logic in gap to correctly convert Number and String objects. + + * runtime/JSONObject.cpp: + (JSC::unwrapBoxedPrimitive): + (JSC::gap): + (JSC::Stringifier::Stringifier): + (JSC::Stringifier::appendStringifiedValue): + +2009-08-27 Oliver Hunt + + Reviewed by Adam Roben. + + JSON.stringify replacer array does not accept values that are not string primitives. + https://bugs.webkit.org/show_bug.cgi?id=28788 + + Update the JSON stringifier to initialise its replacer array according to the most + recent version of the spec. + + * runtime/Identifier.h: + (JSC::Identifier::from): + * runtime/JSONObject.cpp: + (JSC::Stringifier::Stringifier): + +2009-08-27 Alexey Proskuryakov + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=28753 + Excessive number of threads (and a crash) + + * wtf/Threading.h: (WTF::atomicIncrement): Changed atomicIncrement to match decrement + and return the new value. Also added using directives for these functions, to match + te rest of WTF. + +2009-08-27 Brent Fulgham + + Reviewed by Adam Roben. + + Link the testapi against CFLite when building the WinCairo port. + + * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add new Release_CFLite + target. Update all targets to inherit from either the + JavaScriptCF.vsprops (Apple target) or the JavaScriptCFLite.vsprops + file (WinCairo target). + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Remove + input file CoreFoundation.lib. This is provided by either the + JavaScriptCF.vsprops or JavaScriptCFLite.vsprops file. + +2009-08-27 Steve Falkenburg + + Reviewed by Geoff Garen. + + Fix Windows-specific crash due to missing memory clearing call. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + +2009-08-27 Brent Fulgham + + Build fix: JavaScriptCore_debug.def missing some exports. Apple + Windows build does not use this file, so it was not noticed previously. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-27 Gavin Barraclough + + Reviewed by Oliver Hunt. + + x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates. + https://bugs.webkit.org/show_bug.cgi?id=28317 + + Missed one, fix part II. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::move): + * assembler/X86Assembler.h: + (JSC::CAN_SIGN_EXTEND_8_32): + +2009-08-27 Oliver Hunt + + Reviewed by Adam Roben. + + JSON.stringify replacer array does not accept values that are not string primitives. + https://bugs.webkit.org/show_bug.cgi?id=28788 + + Update the JSON stringifier to initialise its replacer array according to the most + recent version of the spec. + + * runtime/Identifier.h: + (JSC::Identifier::from): + * runtime/JSONObject.cpp: + (JSC::Stringifier::Stringifier): + +2009-08-27 Oliver Hunt + + Reviewed by Alexey Proskuryakov. + + JSON parser accepts trailing comma in array literals + https://bugs.webkit.org/show_bug.cgi?id=28779 + + Update parser to correctly fail if there's a trailing comma. + + * runtime/LiteralParser.cpp: + (JSC::LiteralParser::parse): + +2009-08-26 Oliver Hunt + + Reviewed by Gavin Barraclough. + + 'this' in JSON.parse reviver is the global object + https://bugs.webkit.org/show_bug.cgi?id=28752 + + This is a technically simple change, we merely update the code for calling + the reviver function to pass the correct this object. Doing so however + exposes the holder to arbitrary mutation by the reviver function so it is + necessary for us to now guard all property accesses against the possibility + of failure. + + * runtime/JSArray.h: + JSON needs to delete a property from the array, so we friend its + Walker class so that we can make a non-virtual call to the arrays + delete and getOwnPropertySlot methods. + * runtime/JSONObject.cpp: + (JSC::Walker::callReviver): + We need to pass the correct this object + (JSC::Walker::walk): + Update calls to callReviver, and update property logic logic + to correctly handle the holder being mutated by the reviver + function. + +2009-08-26 Alice Liu + + Windows build fix: added some exported symbols + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-26 Geoffrey Garen + + Windows build fix: Removed some exported symbols that no longer exist. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-26 Gavin Barraclough + + Reviewed by Olliejver Hunt. + + x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates. + https://bugs.webkit.org/show_bug.cgi?id=28317 + + We rely on a slightly OS X specific behaviour, that x86-64 applications have a 4Gb zero page, + so pointers are never representable as a 32-bit integer, and always have to be represented by + a separate immediate load instruction, rather than within the immediate field of an arithmetic + or memory operation. + + We explicitly check for a couple of cases where a value might be representable in 32-bit, but + these probably never kick in on Mac OS, and only kick in to hose GTK. Deleting these does not + show a performance degradation on SunSpider. Remove. + + * assembler/MacroAssemblerX86_64.h: + (JSC::MacroAssemblerX86_64::storePtr): + (JSC::MacroAssemblerX86_64::branchPtr): + +2009-08-26 Geoffrey Garen + + Reviewed by Oliver Hunt. + + A bit of Collector refatoring. + + SunSpider says no change. v8 says 1.003x faster (1.02x faster on splay). + + * JavaScriptCore.exp: + + * runtime/JSCell.cpp: + (JSC::JSCell::toPrimitive): + (JSC::JSCell::getPrimitiveNumber): + (JSC::JSCell::toBoolean): + (JSC::JSCell::toNumber): + (JSC::JSCell::toString): + (JSC::JSCell::toObject): Removed pure virtual functions from + JSCell, so the collector can construct one. This allowed + me to remove a bunch of ASSERT_NOT_REACHED throughout the + code, too. + + * runtime/JSCell.h: + (JSC::JSCell::JSCell): ditto + (JSC::Heap::heap): Inlined this function because it's trivial. + + * JavaScriptCore.exp: + + * runtime/Collector.cpp: + (JSC::Heap::destroy): + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlock): + (JSC::Heap::freeBlocks): Renamed freeHeap to freeBlocks, since + it doesn't actually free the Heap object. + (JSC::Heap::heapAllocate): + (JSC::Heap::sweep): + * runtime/Collector.h: Refactored block allocation and destruction + into helper functions. + + * runtime/GetterSetter.cpp: + * runtime/JSAPIValueWrapper.cpp: + * runtime/JSPropertyNameIterator.cpp: Removed dummy implementations + of pure virtual functions. (See above.) + +=== End re-roll-in of r47738:47740 with Windows crash fixed === + +2009-08-26 Geoffrey Garen + + Build fix: start out with a 32-bit value to avoid a shortening warning. + + * runtime/Collector.cpp: + (JSC::Heap::sweep): + +2009-08-24 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Substantially reduced VM thrash in the GC heap. + + 1.08x faster on v8 (1.60x faster on v8-splay). + + 1.40x faster on bench-alloc-nonretained. + + 1.90x faster on bench-alloc-retained. + + SunSpider says no change. + + * runtime/Collector.cpp: + (JSC::Heap::heapAllocate): Fixed a long-standing bug: update a few local + variables unconditionally after calling collect(), since they may be used + even if we don't "goto scan". (In the bug I saw, usedBlocks got out of + sync with heap.usedBlocks). + (JSC::Heap::sweep): Keep enough free heap space to accomodate + the number of objects we'll allocate before the next GC, plus 25%, for + good measure. + * runtime/Collector.h: Bumped the block size to 256k. This seems to give + the best cache performance, and it prevents us from initiating lots of + VM traffic to recover very small chunks of memory. + +=== Begin re-roll-in of r47738:47740 with Windows crash fixed === + +2009-08-25 Drew Wilson + + Reviewed by David Levin. + + postMessage() spec now supports sending arrays of ports + https://bugs.webkit.org/show_bug.cgi?id=26902 + + Added OwnPtr to VectorTraits so we can store OwnPtrs in Vectors. + + * wtf/VectorTraits.h: + +2009-08-26 Xan Lopez + + Rubber-stamped by Gustavo Noronha. + + Remove duplicated files from file list. + + * GNUmakefile.am: + +2009-08-26 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + More export fixes. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-26 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Hopefully fix all the exports from JSC on windows + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-26 Oliver Hunt + + Reviewed by NOBODY (Build fixes). + + Forgot I added files to JavaScriptCore. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCoreSources.bkl: + +2009-08-25 Oliver Hunt + + Reviewed by Gavin Barraclough. + + [ES5] Implement getOwnPropertyDescriptor + https://bugs.webkit.org/show_bug.cgi?id=28724 + + Implement the core runtime support for getOwnPropertyDescriptor. + This adds a virtual getOwnPropertyDescriptor method to every class + that implements getOwnPropertySlot that shadows the behaviour of + getOwnPropertySlot. The alternative would be to make getOwnPropertySlot + (or PropertySlots in general) provide property attribute information, + but quick testing showed this to be a regression. + + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/Arguments.cpp: + (JSC::Arguments::getOwnPropertyDescriptor): + * runtime/Arguments.h: + * runtime/ArrayPrototype.cpp: + (JSC::ArrayPrototype::getOwnPropertyDescriptor): + * runtime/ArrayPrototype.h: + * runtime/CommonIdentifiers.h: + * runtime/DatePrototype.cpp: + (JSC::DatePrototype::getOwnPropertyDescriptor): + * runtime/DatePrototype.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertyDescriptor): + * runtime/JSArray.h: + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::getOwnPropertyDescriptor): + * runtime/JSByteArray.h: + * runtime/JSFunction.cpp: + (JSC::JSFunction::getOwnPropertyDescriptor): + * runtime/JSFunction.h: + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::getOwnPropertyDescriptor): + * runtime/JSNotAnObject.cpp: + (JSC::JSNotAnObject::getOwnPropertyDescriptor): + * runtime/JSNotAnObject.h: + * runtime/JSONObject.cpp: + (JSC::JSONObject::getOwnPropertySlot): + (JSC::JSONObject::getOwnPropertyDescriptor): + * runtime/JSONObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::getOwnPropertyDescriptor): + (JSC::JSObject::getPropertyDescriptor): + * runtime/JSObject.h: + * runtime/JSString.cpp: + (JSC::JSString::getStringPropertyDescriptor): + (JSC::JSString::getOwnPropertyDescriptor): + * runtime/JSString.h: + * runtime/JSVariableObject.cpp: + (JSC::JSVariableObject::symbolTableGet): + * runtime/JSVariableObject.h: + * runtime/Lookup.h: + (JSC::getStaticPropertyDescriptor): + (JSC::getStaticFunctionDescriptor): + (JSC::getStaticValueDescriptor): + Add property descriptor equivalents of the lookup + table access functions + + * runtime/MathObject.cpp: + (JSC::MathObject::getOwnPropertySlot): + (JSC::MathObject::getOwnPropertyDescriptor): + * runtime/MathObject.h: + * runtime/NumberConstructor.cpp: + (JSC::NumberConstructor::getOwnPropertyDescriptor): + * runtime/NumberConstructor.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorGetOwnPropertyDescriptor): + * runtime/PropertyDescriptor.cpp: Added. + (JSC::PropertyDescriptor::writable): + (JSC::PropertyDescriptor::enumerable): + (JSC::PropertyDescriptor::configurable): + (JSC::PropertyDescriptor::hasAccessors): + (JSC::PropertyDescriptor::setUndefined): + (JSC::PropertyDescriptor::getter): + (JSC::PropertyDescriptor::setter): + (JSC::PropertyDescriptor::setDescriptor): + (JSC::PropertyDescriptor::setAccessorDescriptor): + * runtime/PropertyDescriptor.h: Added. + (JSC::PropertyDescriptor::PropertyDescriptor): + (JSC::PropertyDescriptor::attributes): + (JSC::PropertyDescriptor::isValid): + (JSC::PropertyDescriptor::value): + * runtime/RegExpConstructor.cpp: + (JSC::RegExpConstructor::getOwnPropertyDescriptor): + * runtime/RegExpConstructor.h: + * runtime/RegExpMatchesArray.h: + (JSC::RegExpMatchesArray::getOwnPropertyDescriptor): + * runtime/RegExpObject.cpp: + (JSC::RegExpObject::getOwnPropertyDescriptor): + * runtime/RegExpObject.h: + * runtime/StringObject.cpp: + (JSC::StringObject::getOwnPropertyDescriptor): + * runtime/StringObject.h: + * runtime/StringPrototype.cpp: + (JSC::StringPrototype::getOwnPropertyDescriptor): + * runtime/StringPrototype.h: + +2009-08-24 Gavin Barraclough + + Reviewed by Darin Adler. + + How many copies of the parameters do you need? + https://bugs.webkit.org/show_bug.cgi?id=28701 + + The function parameters in JSC get copied a lot - and unnecessarily so. + + Originally this happened due to duplicating FunctionBodyNodes on recompilation, + though the problem has been exacerbated by copying the parameters from the + original function body onto the executable, then back onto the real body that + will be generated (this happens on every function). And this is all made worse + since the data structures in question are a little ugly - C style arrays of C++ + objects containing ref counts, so they need a full copy-construct (rather than + a simple memcpy). + + This can all be greatly simplified by just punting the parameters off into + their own ref-counted object, and forgoing all the copying. + + ~no performance change, possible slight progression. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::makeFunction): + * parser/Nodes.cpp: + (JSC::FunctionParameters::FunctionParameters): + (JSC::FunctionBodyNode::FunctionBodyNode): + (JSC::FunctionBodyNode::finishParsing): + * parser/Nodes.h: + (JSC::FunctionBodyNode::parameters): + (JSC::FunctionBodyNode::parameterCount): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::~FunctionExecutable): + (JSC::FunctionExecutable::compile): + (JSC::FunctionExecutable::reparseExceptionInfo): + (JSC::FunctionExecutable::fromGlobalCode): + (JSC::FunctionExecutable::paramString): + * runtime/Executable.h: + (JSC::FunctionExecutable::FunctionExecutable): + (JSC::FunctionExecutable::parameterCount): + +2009-08-25 Brent Fulgham + + Reviewed by NOBODY (Buildfix). + + * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add Debug_CFLite target + that inherits from the debug_wincairo property sheet and therefore + links to the proper debug library. + * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add Debug_CFLite target + that inherits from the debug_wincairo property sheet and therefore + links to the proper debug library. + +2009-08-25 Chris Marrin + + Reviewed by Simon Fraser. + + Export tryFastMalloc for Canvas3D work + https://bugs.webkit.org/show_bug.cgi?id=28018 + + * JavaScriptCore.exp: + +2009-08-25 David Levin + + Reviewed by Adam Roben. + + PLATFORM(CFNETWORK) should be USE(CFNETWORK). + https://bugs.webkit.org/show_bug.cgi?id=28713 + + * wtf/Platform.h: Added a #define to catch this issue in the + future. The define would generate an error on gcc without the + space in the expansion, but Visual C++ needs the space to cause an error. + +2009-08-24 Brent Fulgham + + Reviewed by Steve Falkenburg. + + Revise CFLite Debug build to emit DLL's with _debug label. + https://bugs.webkit.org/show_bug.cgi?id=28695. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Modify + Cairo debug build to inherit from new debug_cairo property sheet. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops: + Modify to look for debug CFLite when in debug build. + +2009-08-24 Gavin Barraclough + + Reviewed by Oliver Adler & Darin Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=28691 + Do not retain ScopeNodes outside of parsing + + There is now no need for these to exist outside of parsing - their use in the runtime is replaced by Executable types. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::makeFunction): + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + (JSC::Interpreter::prepareForRepeatCall): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * parser/Nodes.cpp: + (JSC::ScopeNodeData::ScopeNodeData): + (JSC::ProgramNode::create): + (JSC::EvalNode::create): + (JSC::FunctionBodyNode::create): + * parser/Nodes.h: + (JSC::ScopeNode::adoptData): + (JSC::FunctionBodyNode::parameterCount): + * parser/Parser.cpp: + * parser/Parser.h: + (JSC::Parser::arena): + (JSC::Parser::Parser): + (JSC::Parser::parse): + * runtime/ArrayPrototype.cpp: + (JSC::isNumericCompareFunction): + (JSC::arrayProtoFuncSort): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::~FunctionExecutable): + (JSC::EvalExecutable::compile): + (JSC::ProgramExecutable::checkSyntax): + (JSC::ProgramExecutable::compile): + (JSC::FunctionExecutable::compile): + (JSC::EvalExecutable::generateJITCode): + (JSC::ProgramExecutable::generateJITCode): + (JSC::FunctionExecutable::generateJITCode): + (JSC::FunctionExecutable::reparseExceptionInfo): + (JSC::EvalExecutable::reparseExceptionInfo): + (JSC::FunctionExecutable::recompile): + (JSC::FunctionExecutable::fromGlobalCode): + (JSC::FunctionExecutable::copyParameters): + (JSC::FunctionExecutable::paramString): + * runtime/Executable.h: + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::ScriptExecutable::sourceID): + (JSC::ScriptExecutable::sourceURL): + (JSC::ScriptExecutable::lineNo): + (JSC::ScriptExecutable::lastLine): + (JSC::ScriptExecutable::usesEval): + (JSC::ScriptExecutable::usesArguments): + (JSC::ScriptExecutable::needsActivation): + (JSC::ScriptExecutable::recordParse): + (JSC::EvalExecutable::bytecode): + (JSC::EvalExecutable::jitCode): + (JSC::ProgramExecutable::bytecode): + (JSC::ProgramExecutable::reparseExceptionInfo): + (JSC::ProgramExecutable::jitCode): + (JSC::FunctionExecutable::FunctionExecutable): + (JSC::FunctionExecutable::make): + (JSC::FunctionExecutable::bytecode): + (JSC::FunctionExecutable::isGenerated): + (JSC::FunctionExecutable::name): + (JSC::FunctionExecutable::parameterCount): + (JSC::FunctionExecutable::jitCode): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::numericCompareFunction): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-08-24 Darin Adler + + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::put): Landed revised version I had tested but forgot + to land. Leave out the branch, since we don't need one. + +2009-08-24 Darin Adler + + Reviewed by Geoff Garen. + + Array index miss case creates a string every time + https://bugs.webkit.org/show_bug.cgi?id=28664 + + SunSpider test results I saw: + + 0.5% faster overall + 1% faster on crypto-aes + 20% faster on crypto-md5 + 13% faster on crypto-sha1 + + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): Initialize m_hasNoPropertiesWithUInt32Names + to true. + (JSC::ObjectPrototype::put): Clearly m_hasNoPropertiesWithUInt32Names if the new + property has a name that is the string form of a UInt32. + (JSC::ObjectPrototype::getOwnPropertySlot): Don't call JSObject::getOwnPropertySlot + if m_hasNoPropertiesWithUInt32Names is true, and it is highly likely to be true. + + * runtime/ObjectPrototype.h: Added declarations for the above. + +2009-08-24 Gustavo Noronha Silva + + Unreviewed. Fix a typo in my distcheck build fix. + + * GNUmakefile.am: + +2009-08-23 Gustavo Noronha Silva + + Unreviewed build fix for make distcheck. + + * GNUmakefile.am: Added files required for the build. + +2009-08-22 Maciej Stachowiak + + Reviewed by Mark Rowe. + + REGRESSION(r47639-r47660): Webkit crashes on launch on PowerPC + https://bugs.webkit.org/show_bug.cgi?id=28655 + + * runtime/JSFunction.cpp: + (JSC::JSFunction::JSFunction): Initialize properly with a VPtrHackExecutable. + * wtf/Platform.h: + +2009-08-22 Darin Adler + + Fix storage leak from syntax tree arena allocation patch. + + * parser/Nodes.h: CommaNode needs to inherit from ParserArenaDeletable + because it has a vector. + +2009-08-21 Darin Adler + + Fix Qt build. + + * parser/Nodes.cpp: + (JSC::ScopeNodeData::ScopeNodeData): Made non-inline again. + This is used outside Nodes.cpp so can't be inline unless + it is in the header. + +2009-08-21 Darin Adler + + Two loose ends from the last commit. + + * JavaScriptCore.xcodeproj/project.pbxproj: Made ParserArena.h + and create_hash_table project-internal instead of "private". + * runtime/Executable.h: Removed accidentally-added constructor. + +2009-08-21 Darin Adler + + Reviewed by Gavin Barraclough. + + Syntax tree nodes should use arena allocation + https://bugs.webkit.org/show_bug.cgi?id=25674 + + Use an actual arena now. 0.6% speedup on SunSpider. + + New and improved with 100% less leaking of the universe. + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + Removed all exports involving the class FunctionBodyNode, which no + longer needs to be used outside JavaScriptCore. + + * JavaScriptCore.xcodeproj/project.pbxproj: Made Nodes.h and + Executable.h project-internal instead of "private". + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack + contains const Identifier* now. + + * parser/Grammar.y: Made identifiers from the lexer be const + Identifier* and updated since VarStack contains const Identifier* now. + + * parser/Lexer.cpp: + (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers. + (JSC::Lexer::makeIdentifier): Changed return type to const Identifier* + and changed to call ParserArena. + (JSC::Lexer::clear): Removed the code to manage m_identifiers and + added code to set m_arena to 0. + * parser/Lexer.h: Updated for changes above. + + * parser/NodeConstructors.h: + (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable + on the arena. + (JSC::ParserArenaDeletable::operator new): Changed to call the + allocateDeletable function on the arena instead of deleteWithArena. + (JSC::PropertyNode::PropertyNode): Added new constructor that makes + numeric identifiers. Some day we might want to optimize this for + integers so it doesn't create a string for each one. + (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier + since it's now a const Identifier& so it can't be left uninitialized. + (JSC::BreakNode::BreakNode): Ditto. + (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements* + to keep track of the statements rather than a separate statement vector. + (JSC::BlockNode::BlockNode): Ditto. + (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier. + + * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here. + It seemed strangely out of place in the header. + (JSC::ThrowableExpressionData::emitThrowError): Added an overload for + UString as well as Identifier. + (JSC::SourceElements::singleStatement): Added. + (JSC::SourceElements::lastStatement): Added. + (JSC::RegExpNode::emitBytecode): Changed the throwError code to use + the substitution mechanism instead of doing a string append. + (JSC::SourceElements::emitBytecode): Added. Replaces the old + statementListEmitCode function, since we now keep the SourceElements + objects around. + (JSC::BlockNode::lastStatement): Added. + (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of + statementListEmitCode. + (JSC::CaseClauseNode::emitBytecode): Added. + (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode + instead of statementListEmitCode. + (JSC::ScopeNodeData::ScopeNodeData): Changed to store the + SourceElements* instead of using releaseContentsIntoVector. + (JSC::ScopeNode::emitStatementsBytecode): Added. + (JSC::ScopeNode::singleStatement): Added. + (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead + of statementListEmitCode. + (JSC::EvalNode::emitBytecode): Ditto. + (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode + insetad of statementListEmitCode and check for the return node using + the new functions. + + * parser/Nodes.h: Changed VarStack to store const Identifier* instead + of Identifier and rely on the arena to control lifetime. Added a new + ParserArenaFreeable class. Made ParserArenaDeletable inherit from + FastAllocBase instead of having its own operator new. Base the Node + class on ParserArenaFreeable. Changed the various Node classes + to use const Identifier& instead of Identifier to avoid the need to + call their destructors and allow them to function as "freeable" in the + arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions. + Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode, + CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable + as a base class since they do not descend from Node. Eliminated the + StatementVector type and instead have various classes use SourceElements* + instead of StatementVector. This prevents those classes from having to + use ParserArenaDeletable to make sure the vector destructor is called. + + * parser/Parser.cpp: + (JSC::Parser::parse): Pass the arena to the lexer. + + * parser/Parser.h: Added an include of ParserArena.h, which is no longer + included by Nodes.h. + (JSC::Parser::parseFunctionFromGlobalCode): Changed to use the + singleStatement function, since there is no longer any children function. + Removed some unneeded use of RefPtr. + + * parser/ParserArena.cpp: + (JSC::ParserArena::ParserArena): Added. Initializes the new members, + m_freeableMemory, m_freeablePoolEnd, and m_identifiers. + (JSC::ParserArena::freeablePool): Added. Computes the pool pointer, + since we store only the current pointer and the end of pool pointer. + (JSC::ParserArena::deallocateObjects): Added. Contains the common + memory-deallocation logic used by both the destructor and the + reset function. + (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects. + (JSC::ParserArena::reset): Ditto. Also added code to zero out the + new structures, and switched to use clear() instead of shrink(0) since + we don't really reuse arenas. + (JSC::ParserArena::makeNumericIdentifier): Added. + (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool + is empty. + (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine + since this is used only for assertions at the moment. + (JSC::ParserArena::derefWithArena): Make non-inline. + + * parser/ParserArena.h: Added an actual arena of "freeable" objects, + ones that don't need destructors to be called. Also added a separate + IdentifierArena object, a segmented vector of identifiers that used + to be in the Lexer. + + * runtime/Executable.h: Moved the definition of the + FunctionExecutable::make function here. It can't go in JSFunction.h + since that header has to be used outside JavaScriptCore and so can't + include this, which includes Nodes.h. The function could be moved + elswhere if we don't want to include JSFunction.h in this header, but + for now this seems to be the best place. + + * runtime/JSFunction.h: Removed the include of Executable.h and + definition of the FunctionExecutable::make function. + + * wtf/FastMalloc.cpp: Fixed an incorrect comment. + +2009-08-21 Mark Rowe + + Fix the non-JIT build. + + * runtime/Executable.cpp: + * runtime/Executable.h: + +2009-08-21 Gavin Barraclough + + Speculative QuickTime build fix. + + * runtime/JSArray.cpp: + +2009-08-21 Gavin Barraclough + + Speculative QT build fix. + + * runtime/StringPrototype.cpp: + +2009-08-21 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Restructure Executable types so that host functions do not hold a FunctionExecutable. + https://bugs.webkit.org/show_bug.cgi?id=28621 + + All JSFunction objects have a pointer to an Executable*. This is currently always a + FunctionExecutable, however this has a couple of drawbacks. Host functions do not + store a range of information that the FunctionExecutable provides (source, name, + CodeBlock & information presently held on the FunctionBodyNode). + + [ * nearly all... see below! ] + + Instead, make JSFunctions hold a pointer to an ExecutableBase, move fields specific + to JS sourced executable types (source, node) into a new subclass (ScriptExecutable), + and create a new NativeExecutable type. We now provide a new method in JSFunction + to access & downcast to FunctionExecutable, but in doing so we can make an early + check (with an ASSERT) to ensure that the Executable read from a function will only + be treated as a FunctionExecutable (and thus the JS sepcific fields will only be + accessed) if the JSFunction is not a host function. + + There is one JSFunction that currently does not have an Executable, which is the + object created to allow us to read out the vtable pointer. By making this change + we can also add a new Executable type fror this object (VPtrHackExecutable). + Since this means that really all JSFunctions have an Executable we no longer have + to null-check m_executable before us it - particularly in isHostFunction(). + + This patch removes CacheableEvalExecutable, since all subclasses of ExecutableBase + can now be ref-counted - since both JSFunction holds (and ref-counts) an ExecutableBase + that might be a FunctionExecutable or a NativeExecutable. This does now mean that all + ProgramExecutables and EvalExecutables (unnecessarily) provide an interface to be + ref-counted, however this seems less-bad than host functions unnecessarily providing + interface to access non-host specific information. + + The class hierarcy has changed from this: + + - ExecutableBase + - ProgramExecutable + - EvalExecutable + - CacheableEvalExecutable (also RefCounted by multiple-inheritance) + - FunctionExecutable (also RefCounted by multiple-inheritance, 'special' FunctionExecutable also used for host functions) + + To this: + + - RefCounted + - ExecutableBase + - NativeExecutable + - VPtrHackExecutable + - ScriptExecutable + - ProgramExecutable + - EvalExecutable + - FunctionExecutable + + This patch speeds up sunspidey by a couple of ms (presumably due to the changes to isHostFunction()). + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::CodeBlock): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::ownerExecutable): + (JSC::GlobalCodeBlock::GlobalCodeBlock): + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * interpreter/CachedCall.h: + (JSC::CachedCall::CachedCall): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * profiler/Profiler.cpp: + (JSC::createCallIdentifierFromFunctionImp): + * runtime/Arguments.h: + (JSC::Arguments::getArgumentsData): + (JSC::Arguments::Arguments): + * runtime/Executable.cpp: + (JSC::NativeExecutable::~NativeExecutable): + (JSC::VPtrHackExecutable::~VPtrHackExecutable): + * runtime/Executable.h: + (JSC::ExecutableBase::ExecutableBase): + (JSC::ExecutableBase::~ExecutableBase): + (JSC::ExecutableBase::isHostFunction): + (JSC::NativeExecutable::NativeExecutable): + (JSC::VPtrHackExecutable::VPtrHackExecutable): + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::ScriptExecutable::source): + (JSC::ScriptExecutable::sourceID): + (JSC::ScriptExecutable::sourceURL): + (JSC::ScriptExecutable::lineNo): + (JSC::ScriptExecutable::lastLine): + (JSC::ScriptExecutable::usesEval): + (JSC::ScriptExecutable::usesArguments): + (JSC::ScriptExecutable::needsActivation): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::create): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSFunction.cpp: + (JSC::JSFunction::JSFunction): + (JSC::JSFunction::~JSFunction): + (JSC::JSFunction::markChildren): + (JSC::JSFunction::getCallData): + (JSC::JSFunction::call): + (JSC::JSFunction::lengthGetter): + (JSC::JSFunction::getConstructData): + (JSC::JSFunction::construct): + * runtime/JSFunction.h: + (JSC::JSFunction::executable): + (JSC::JSFunction::jsExecutable): + (JSC::JSFunction::isHostFunction): + +2009-08-20 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Browser hangs on opening Web Inspector. + https://bugs.webkit.org/show_bug.cgi?id=28438 + + Code generation needs to be able to walk the entire scopechain in some + cases, however the symbol table used by activations was a member of the + codeblock. Following recompilation this may no longer exist, leading + to a crash or hang on lookup. + + We fix this by introducing a refcounted SymbolTable subclass, SharedSymbolTable, + for the CodeBlocks used by function code. This allows activations to + maintain ownership of a copy of the symbol table even after recompilation so + they can continue to work. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::CodeBlock): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::symbolTable): + (JSC::CodeBlock::sharedSymbolTable): + (JSC::GlobalCodeBlock::GlobalCodeBlock): + (JSC::FunctionCodeBlock::FunctionCodeBlock): + (JSC::FunctionCodeBlock::~FunctionCodeBlock): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::retrieveArguments): + * runtime/Executable.cpp: + (JSC::EvalExecutable::generateBytecode): + (JSC::FunctionExecutable::generateBytecode): + (JSC::FunctionExecutable::reparseExceptionInfo): + (JSC::EvalExecutable::reparseExceptionInfo): + * runtime/JSActivation.h: + (JSC::JSActivation::JSActivationData::JSActivationData): + (JSC::JSActivation::JSActivationData::~JSActivationData): + * runtime/SymbolTable.h: + +2009-08-20 Xan Lopez + + Add new file to GTK+ build. + + * GNUmakefile.am: + +2009-08-20 Geoffrey Garen + + Reviewed by Maciej Stachowiak. + + Added a number => string cache. + + 1.07x faster on v8 (1.7x faster on v8-splay). + 1.004x faster on SunSpider. + + * runtime/JSCell.h: Moved JSValue::toString to JSString.h. + * runtime/JSGlobalData.h: Holds the cache. + * runtime/JSNumberCell.cpp: + (JSC::JSNumberCell::toString): + (JSC::JSNumberCell::toThisString): Removed -0 special case. + UString handles this now, since too many clients were + special-casing it. + + * runtime/JSString.h: + (JSC::JSValue::toString): Use the cache when converting + an int or double to string. + + * runtime/Operations.h: + (JSC::concatenateStrings): Call toString to take advantage + of the cache. + + * runtime/SmallStrings.h: + (JSC::NumericStrings::add): + (JSC::NumericStrings::lookup): The cache. + + * runtime/UString.cpp: + (JSC::UString::from): Added -0 special case mentioned above. + Removed appendNumeric because it's mutually exclusive with the + cache. + +2009-08-20 Oliver Hunt + + Reviewed by Gavin Barraclough. + + REGRESSION: fast/profiler/call.html is crashing occasionally + https://bugs.webkit.org/show_bug.cgi?id=28476 + + Using the codeblock for information about how many parameters and + locals a function has is unsafe in certain circumstances. The + basic scenario is all function code being cleared in response to + the debugger or profiler being enabled, and then an activation is + marked before its associated function is re-executed. + + To deal with this scenario we store the variable count of a function + directly in the FunctionExecutable, and then use that information. + + * runtime/Arguments.h: + (JSC::Arguments::getArgumentsData): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::generateBytecode): + * runtime/Executable.h: + (JSC::FunctionExecutable::FunctionExecutable): + (JSC::FunctionExecutable::variableCount): + * runtime/JSActivation.cpp: + (JSC::JSActivation::markChildren): + +2009-08-20 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Numbering of arguments to emitGetJITStubArg/emitPutJITStubArg incorrect + + + The argumentNumber argument to emitGetJITStubArg/emitPutJITStubArg should match + the argument number used within the stub functions in JITStubs.cpp, but it doesn't. + + Firstly, all the numbers changed when we added a void* 'reserved' as the first slot + (rather than leaving argument 0 unused), and secondly in 32_64 builds the index to + peek/poke needs to be multiplies by 2 (since the argument to peek/poke is a number + of machine words, and on 32_64 build the argument slots to stub functions are two + words wide). + + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallSetupArgs): + (JSC::JIT::compileOpConstructSetupArgs): + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpCall): + * jit/JITInlineMethods.h: + (JSC::JIT::emitPutJITStubArg): + (JSC::JIT::emitPutJITStubArgConstant): + (JSC::JIT::emitGetJITStubArg): + (JSC::JIT::emitPutJITStubArgFromVirtualRegister): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + +2009-08-20 Oliver Hunt + + Reviewed by Geoff Garen. + + REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest + https://bugs.webkit.org/show_bug.cgi?id=28332 + + Follow up style fixes that were missed in review. + + * runtime/Structure.cpp: + (JSC::Structure::hasTransition): + * runtime/Structure.h: + (JSC::Structure::get): + (JSC::StructureTransitionTable::contains): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTable::add): + +2009-08-20 Oliver Hunt + + Add new exports to windows jsc build + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-20 Oliver Hunt + + Reviewed by Gavin Barraclough. + + REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest + https://bugs.webkit.org/show_bug.cgi?id=28332 + + The method check optimisation made transitions aware of the value being + assigned when a transition was assigning a function. This had the side + effect of making every assignment of a function expression result in a + new transition, and thus a new Structure. The net result of this is that + the common JS idiom of + + function MyObject() { + this.myFunction = function(...){...}; + } + new MyObject(); + + Will produce a unique structure on every iteration, meaning that all + caching is defeated and there is a significant amount of structure churn. + + The fix is to return the transition to its original form where it is + keyed off a property name + attributes tuple, but have each transition + support an optional transition on a specific value. + + * JavaScriptCore.exp: + * runtime/JSObject.h: + (JSC::JSObject::putDirectInternal): + * runtime/Structure.cpp: + (JSC::Structure::~Structure): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::hasTransition): + * runtime/Structure.h: + (JSC::Structure::transitionedFor): + (JSC::Structure::hasTransition): + (JSC::Structure::): + (JSC::StructureTransitionTable::contains): + (JSC::StructureTransitionTable::get): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTableHashTraits::emptyValue): + (JSC::StructureTransitionTable::hasTransition): + (JSC::StructureTransitionTable::remove): + (JSC::StructureTransitionTable::add): + +2009-08-20 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Remove FunctionCodeBlock. + https://bugs.webkit.org/show_bug.cgi?id=28502 + + These only exist to allow JIT code to dereference properties off the + CodeBlock for any callee, regardless of whether it is a host function. + + Instead just use the FunctionExecutable. Copy the m_parameters field + from the CodeBlock into the Executable, and use this to distinguish + between host functions, functions that have been bytecompiled, and + functions that have not. + + m_parameters is moved to ExecutableBase rather than FunctionExecutable + so that (as a separate change) we can move make a separate class of + executable for host code, which is not devived from FunctionExecutable + (host code does not feature any of the properties that normal executable + do and will provide, such as source, attributes, and a parsed name). + + 1% win on v8 tests, 0.5% on sunspider. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::derefStructures): + (JSC::CodeBlock::refStructures): + (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): + (JSC::CodeBlock::handlerForBytecodeOffset): + (JSC::CodeBlock::lineNumberForBytecodeOffset): + (JSC::CodeBlock::expressionRangeForBytecodeOffset): + (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): + (JSC::CodeBlock::functionRegisterForBytecodeOffset): + (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset): + (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset): + * bytecode/CodeBlock.h: + (JSC::): + (JSC::CodeBlock::source): + (JSC::CodeBlock::sourceOffset): + (JSC::CodeBlock::evalCodeCache): + (JSC::CodeBlock::createRareDataIfNecessary): + + remove NativeCodeBlocks and the NativeCode code type. + + * jit/JIT.cpp: + (JSC::JIT::linkCall): + + Revert to previous behaviour (as currently still commented!) that Hhost functions have a null codeblock. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallInitializeCallFrame): + (JSC::JIT::compileOpCallSetupArgs): + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpConstructSetupArgs): + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::compileOpCall): + (JSC::JIT::compileOpCallSlowCase): + + Bring the 32_64 & non-32_64 JITs into line with each other, callee in regT0. + + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + + Rewrite call trampolines to not use the CodeBlock. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + + Make call_JSFunction & call_arityCheck return the callee, don't expect to be passed the CodeBlock. + + * runtime/Executable.cpp: + (JSC::FunctionExecutable::generateBytecode): + (JSC::FunctionExecutable::recompile): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/Executable.h: + (JSC::ExecutableBase::): + (JSC::ExecutableBase::ExecutableBase): + (JSC::FunctionExecutable::isHostFunction): + + Add m_numParameters. + + * runtime/JSFunction.cpp: + (JSC::JSFunction::~JSFunction): + + Only call generatedBytecode() on JSFunctions non-host FunctionExecutables. + +2009-08-20 Yongjun Zhang + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28054 + + Use a helper function to work around winscw compiler forward declaration bug + regarding templated classes. + + Add parenthesis around (PassRefPtr::*UnspecifiedBoolType) to make winscw compiler + work with the default UnSpecifiedBoolType() operator, which removes the winscw + specific bool cast hack. + + * wtf/PassRefPtr.h: + (WTF::derefIfNotNull): + (WTF::PassRefPtr::~PassRefPtr): + +2009-08-19 Yong Li + + Reviewed by Gavin Barraclough. + + Change namespace ARM to ARMRegisters + X86 to X86Registers to avoid conflict with macros + https://bugs.webkit.org/show_bug.cgi?id=28428 + + * assembler/ARMAssembler.cpp: + * assembler/ARMAssembler.h: + * assembler/ARMv7Assembler.h: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerARMv7.h: + * assembler/MacroAssemblerX86Common.h: + * assembler/MacroAssemblerX86_64.h: + * assembler/X86Assembler.h: + * jit/JIT.h: + * jit/JITArithmetic.cpp: + * jit/JITInlineMethods.h: + * jit/JITOpcodes.cpp: + * wrec/WRECGenerator.cpp: + * wrec/WRECGenerator.h: + * yarr/RegexJIT.cpp: + +2009-08-19 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Devirtualise marking + https://bugs.webkit.org/show_bug.cgi?id=28294 + + We actually need to mark the value in a number object if we're using the + 32bit number representation. + + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + +2009-08-19 Gavin Barraclough + + Reviewed by Darin Adler. + + We probably shouldn't be keeping the AST for eval nodes around forevar. + https://bugs.webkit.org/show_bug.cgi?id=28469 + + EvalNodes don't destroyData() (delete their parser data) since they need to hold onto + their varStack. Copy a list of variable onto EvalCodeBlock, and this can go away. + + * bytecode/CodeBlock.h: + (JSC::EvalCodeBlock::variable): + (JSC::EvalCodeBlock::numVariables): + (JSC::EvalCodeBlock::adoptVariables): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + * parser/Nodes.h: + * runtime/Executable.cpp: + (JSC::EvalExecutable::generateBytecode): + * runtime/Executable.h: + +2009-08-19 Jungshik Shin + + Reviewed by Darin Adler. + + http://bugs.webkit.org/show_bug.cgi?id=28441 + + Fix a build issue with ICU 4.2 or later on Windows with Visual C++. + Instead of defining all isXXX and toupper/tolower as + WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h, + #define them to be different by prepending 'WTF_...ASCIIType_h' with + the originial names like 'toupper_WTF_...ASCIIType_h'. + + * wtf/DisallowCType.h: + +2009-08-18 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Assigning a function to an object should always use the existing transition, even if the transition is not specialized + https://bugs.webkit.org/show_bug.cgi?id=28442 + + Check for an unspecialized transition as an alternative to always failing if specialisation does not match. + + * runtime/Structure.cpp: + (JSC::Structure::addPropertyTransitionToExistingStructure): + +2009-08-18 Dirk Schulze + + Reviewed by Oliver Hunt. + + Added additional getter to ByteArray with an unsigned char as return. + ByteArray can take unsigned char directly now. + + * wtf/ByteArray.h: + (WTF::ByteArray::set): + (WTF::ByteArray::get): + +2009-08-18 Peter Kasting + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28415 + Set svn:eol-style CRLF on all .sln and .vcproj files that don't already + have it. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: + * JavaScriptCore.vcproj/testapi/testapi.vcproj: + +2009-08-18 Xan Lopez + + Try to fix the GTK+ build. + + * GNUmakefile.am: + +2009-08-17 Gavin Barraclough + + Reviewed by Sam Weinig. + + No, silly runtime, AST nodes are not for you. + + We still use AST nodes (ScopeNodes, particularly FunctionBodyNodes) within + the runtime, which means that these nodes must be persisted outside of the + arena, contain both parser & runtime data, etc. This is all a bit of a mess. + + Move functionality into a new FunctionExecutable class. + + * API/JSCallbackFunction.cpp: + * API/JSObjectRef.cpp: + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::CodeBlock): + (JSC::CodeBlock::markAggregate): + (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): + (JSC::CodeBlock::lineNumberForBytecodeOffset): + (JSC::CodeBlock::shrinkToFit): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::getBytecodeIndex): + (JSC::CodeBlock::discardBytecode): + (JSC::CodeBlock::instructionCount): + (JSC::CodeBlock::getJITCode): + (JSC::CodeBlock::executablePool): + (JSC::CodeBlock::ownerExecutable): + (JSC::CodeBlock::extractExceptionInfo): + (JSC::CodeBlock::addFunctionDecl): + (JSC::CodeBlock::functionDecl): + (JSC::CodeBlock::numberOfFunctionDecls): + (JSC::CodeBlock::addFunctionExpr): + (JSC::CodeBlock::functionExpr): + (JSC::GlobalCodeBlock::GlobalCodeBlock): + (JSC::ProgramCodeBlock::ProgramCodeBlock): + (JSC::EvalCodeBlock::EvalCodeBlock): + (JSC::FunctionCodeBlock::FunctionCodeBlock): + (JSC::NativeCodeBlock::NativeCodeBlock): + * bytecode/EvalCodeCache.h: + * bytecode/SamplingTool.cpp: + (JSC::SamplingTool::doRun): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * interpreter/CachedCall.h: + (JSC::CachedCall::CachedCall): + * interpreter/CallFrameClosure.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + (JSC::Interpreter::throwException): + (JSC::Interpreter::execute): + (JSC::Interpreter::prepareForRepeatCall): + (JSC::Interpreter::debug): + (JSC::Interpreter::privateExecute): + (JSC::Interpreter::retrieveLastCaller): + * interpreter/Interpreter.h: + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + * jit/JIT.h: + (JSC::JIT::compile): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + (JSC::JIT::emit_op_new_func): + (JSC::JIT::emit_op_new_func_exp): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): + * parser/Nodes.cpp: + (JSC::FunctionBodyNode::reparseDataIfNecessary): + * parser/Nodes.h: + (JSC::EvalNode::partialDestroyData): + * parser/Parser.h: + * profiler/ProfileGenerator.cpp: + * profiler/Profiler.cpp: + (JSC::Profiler::createCallIdentifier): + (JSC::createCallIdentifierFromFunctionImp): + * runtime/Arguments.h: + (JSC::Arguments::getArgumentsData): + (JSC::Arguments::Arguments): + (JSC::JSActivation::copyRegisters): + * runtime/ArrayPrototype.cpp: + (JSC::isNumericCompareFunction): + * runtime/CallData.h: + (JSC::): + * runtime/Collector.cpp: + (JSC::Heap::collect): + * runtime/ConstructData.h: + (JSC::): + * runtime/ExceptionHelpers.cpp: + (JSC::createUndefinedVariableError): + (JSC::createInvalidParamError): + (JSC::createNotAConstructorError): + (JSC::createNotAFunctionError): + (JSC::createNotAnObjectError): + * runtime/Executable.cpp: Added. + (JSC::EvalExecutable::generateBytecode): + (JSC::ProgramExecutable::generateBytecode): + (JSC::FunctionExecutable::generateBytecode): + (JSC::EvalExecutable::generateJITCode): + (JSC::ProgramExecutable::generateJITCode): + (JSC::FunctionExecutable::generateJITCode): + (JSC::FunctionExecutable::isHostFunction): + (JSC::FunctionExecutable::markAggregate): + (JSC::FunctionExecutable::reparseExceptionInfo): + (JSC::EvalExecutable::reparseExceptionInfo): + (JSC::FunctionExecutable::recompile): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/Executable.h: + (JSC::ExecutableBase::~ExecutableBase): + (JSC::ExecutableBase::ExecutableBase): + (JSC::ExecutableBase::source): + (JSC::ExecutableBase::sourceID): + (JSC::ExecutableBase::lastLine): + (JSC::ExecutableBase::usesEval): + (JSC::ExecutableBase::usesArguments): + (JSC::ExecutableBase::needsActivation): + (JSC::ExecutableBase::astNode): + (JSC::ExecutableBase::generatedJITCode): + (JSC::ExecutableBase::getExecutablePool): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::bytecode): + (JSC::EvalExecutable::varStack): + (JSC::EvalExecutable::evalNode): + (JSC::EvalExecutable::jitCode): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::ProgramExecutable::reparseExceptionInfo): + (JSC::ProgramExecutable::bytecode): + (JSC::ProgramExecutable::programNode): + (JSC::ProgramExecutable::jitCode): + (JSC::FunctionExecutable::FunctionExecutable): + (JSC::FunctionExecutable::name): + (JSC::FunctionExecutable::bytecode): + (JSC::FunctionExecutable::generatedBytecode): + (JSC::FunctionExecutable::usesEval): + (JSC::FunctionExecutable::usesArguments): + (JSC::FunctionExecutable::parameterCount): + (JSC::FunctionExecutable::paramString): + (JSC::FunctionExecutable::isGenerated): + (JSC::FunctionExecutable::body): + (JSC::FunctionExecutable::jitCode): + (JSC::FunctionExecutable::createNativeThunk): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSActivation.cpp: + (JSC::JSActivation::JSActivation): + (JSC::JSActivation::markChildren): + (JSC::JSActivation::isDynamicScope): + (JSC::JSActivation::argumentsGetter): + * runtime/JSActivation.h: + (JSC::JSActivation::JSActivationData::JSActivationData): + * runtime/JSFunction.cpp: + (JSC::JSFunction::isHostFunction): + (JSC::JSFunction::JSFunction): + (JSC::JSFunction::~JSFunction): + (JSC::JSFunction::markChildren): + (JSC::JSFunction::getCallData): + (JSC::JSFunction::call): + (JSC::JSFunction::lengthGetter): + (JSC::JSFunction::getConstructData): + (JSC::JSFunction::construct): + * runtime/JSFunction.h: + (JSC::JSFunction::executable): + (JSC::FunctionExecutable::make): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::numericCompareFunction): + * runtime/JSGlobalData.h: + +2009-08-17 Mark Rowe + + Reviewed by Darin Adler. + + Fix 300,000+ leaks seen during the regression tests. + + EvalCodeCache::get was heap-allocating an EvalExecutable instance without adopting the initial reference. + While fixing this we noticed that EvalExecutable was a RefCounted type that was sometimes stack allocated. + To make this cleaner and to prevent clients from attempting to ref a stack-allocated instance, we move the + refcounting down to a new CacheableEvalExecutable class that derives from EvalExecutable. EvalCodeCache::get + now uses CacheableEvalExecutable::create and avoids the leak. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + * runtime/Executable.h: + (JSC::CacheableEvalExecutable::create): + (JSC::CacheableEvalExecutable::CacheableEvalExecutable): + +2009-08-17 Oliver Hunt + + RS=Mark Rowe. + + REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes + https://bugs.webkit.org/show_bug.cgi?id=28341 + + + Reverting r47292. Alas Prototype.js breaks with Arguments inheriting + from Array as ES5 attempted. Prototype.js defines $A in terms of a + function it places on (among other global objects) the Array prototype, + thus breaking $A for arrays. + + * runtime/Arguments.h: + (JSC::Arguments::Arguments): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): + * runtime/ObjectPrototype.h: + * tests/mozilla/ecma_3/Function/arguments-001.js: + +2009-08-17 Peter Kasting + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2009-08-17 Xan Lopez + + Reviewed by Mark Rowe. + + Fix build with FAST_MALLOC_MATCH_VALIDATION enabled. + + * wtf/FastMalloc.cpp: + (WTF::fastMalloc): + (WTF::fastCalloc): + (WTF::fastRealloc): + +2009-08-16 Holger Hans Peter Freyther + + Reviewed by Mark Rowe. + + Fix crash on ./ecma_2/RegExp/exec-002.js. + https://bugs.webkit.org/show_bug.cgi?id=28353 + + Change the order of freeParenthesesDisjunctionContext and + popParenthesesDisjunctionContext on all call sites as the pop + method is accessing backTrack->lastContext which is the context + that is about to be freed. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::parenthesesDoBacktrack): + (JSC::Yarr::Interpreter::backtrackParentheses): + +2009-08-16 Holger Hans Peter Freyther + + Reviewed by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=28352 + + Fix coding style violations. Use m_ for C++ class members. Remove + trailing whitespace on empty lines. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext): + (JSC::Yarr::Interpreter::tryConsumeCharacter): + (JSC::Yarr::Interpreter::tryConsumeBackReference): + (JSC::Yarr::Interpreter::parenthesesDoBacktrack): + (JSC::Yarr::Interpreter::backtrackParentheses): + (JSC::Yarr::ByteCompiler::ByteCompiler): + (JSC::Yarr::ByteCompiler::compile): + (JSC::Yarr::ByteCompiler::checkInput): + (JSC::Yarr::ByteCompiler::assertionBOL): + (JSC::Yarr::ByteCompiler::assertionEOL): + (JSC::Yarr::ByteCompiler::assertionWordBoundary): + (JSC::Yarr::ByteCompiler::atomPatternCharacter): + (JSC::Yarr::ByteCompiler::atomCharacterClass): + (JSC::Yarr::ByteCompiler::atomBackReference): + (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin): + (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin): + (JSC::Yarr::ByteCompiler::popParenthesesStack): + (JSC::Yarr::ByteCompiler::closeAlternative): + (JSC::Yarr::ByteCompiler::closeBodyAlternative): + (JSC::Yarr::ByteCompiler::atomParenthesesEnd): + (JSC::Yarr::ByteCompiler::regexBegin): + (JSC::Yarr::ByteCompiler::alterantiveBodyDisjunction): + (JSC::Yarr::ByteCompiler::alterantiveDisjunction): + (JSC::Yarr::ByteCompiler::emitDisjunction): + +2009-08-15 Mark Rowe + + Fix the build with JIT disabled. + + * runtime/Arguments.h: Only compile the jitCode method when the JIT is enabled. + * runtime/Executable.h: Include PrototypeFunction.h so the compiler knows what + NativeFunctionWrapper is when the JIT is disabled. + +2009-08-15 Adam Bergkvist + + Reviewed by Sam Weinig. + + Added ENABLE_EVENTSOURCE flag. + https://bugs.webkit.org/show_bug.cgi?id=14997 + + * Configurations/FeatureDefines.xcconfig: + +2009-08-14 Gavin Barraclough + + * parser/Parser.h: + (JSC::EvalExecutable::parse): + (JSC::ProgramExecutable::parse): + * runtime/Executable.h: + +2009-08-14 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Remove AST nodes from use within the Runtime (outside of parsing), stage 1 + https://bugs.webkit.org/show_bug.cgi?id=28330 + + Remove the EvalNode and ProgramNode from use in the runtime. They still exist + after this patch, but are hidden behind EvalExecutable and FunctionExecutable, + and are also still reachable behind CodeBlock::m_ownerNode. + + The next step will be to beat back FunctionBodyNode in the same fashion. + Then remove the usage via CodeBlock, then only construct these nodes only on + demand during bytecode generation. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.h: + (JSC::GlobalCodeBlock::GlobalCodeBlock): + (JSC::GlobalCodeBlock::~GlobalCodeBlock): + (JSC::ProgramCodeBlock::ProgramCodeBlock): + (JSC::EvalCodeBlock::EvalCodeBlock): + (JSC::FunctionCodeBlock::FunctionCodeBlock): + (JSC::NativeCodeBlock::NativeCodeBlock): + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * debugger/Debugger.cpp: + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + (JSC::Interpreter::execute): + * interpreter/Interpreter.h: + * parser/Nodes.cpp: + (JSC::FunctionBodyNode::createNativeThunk): + (JSC::FunctionBodyNode::generateBytecode): + (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse): + * parser/Parser.h: + (JSC::Parser::parse): + (JSC::Parser::reparse): + (JSC::Parser::parseFunctionFromGlobalCode): + (JSC::::parse): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Error.cpp: + (JSC::throwError): + * runtime/Error.h: + * runtime/Executable.h: Added. + (JSC::TemplateExecutable::TemplateExecutable): + (JSC::TemplateExecutable::markAggregate): + (JSC::TemplateExecutable::sourceURL): + (JSC::TemplateExecutable::lineNo): + (JSC::TemplateExecutable::bytecode): + (JSC::TemplateExecutable::jitCode): + (JSC::EvalExecutable::EvalExecutable): + (JSC::ProgramExecutable::ProgramExecutable): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/FunctionConstructor.h: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::numericCompareFunction): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::~JSGlobalObject): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::codeBlocks): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-08-14 Darin Adler + + Reviewed by Sam Weinig. + + Rename the confusing isObject() to inherits(). + It still works on non-objects, returning false. + + * runtime/ArrayConstructor.cpp: + (JSC::arrayConstructorIsArray): Removed unneeded isObject call + and updated remaining isObject call to new name, inherits. + + * runtime/JSCell.h: Renamed isObject() to inherits() + but more importantly, made it non-virtual (it was already inline) + so it is now as fast as JSObject::inherits was. + + * runtime/JSObject.h: Removed inherits function since the one + in the base class is fine as-is. Also made various JSCell functions + that should not be called on JSObject uncallable by making them + both private and not implemented. + (JSC::JSCell::inherits): Updated name. + (JSC::JSValue::inherits): Ditto. + + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncConcat): + * runtime/BooleanPrototype.cpp: + (JSC::booleanProtoFuncToString): + (JSC::booleanProtoFuncValueOf): + * runtime/DateConstructor.cpp: + (JSC::constructDate): + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToLocaleString): + (JSC::dateProtoFuncToLocaleDateString): + (JSC::dateProtoFuncToLocaleTimeString): + (JSC::dateProtoFuncGetTime): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetMilliSeconds): + (JSC::dateProtoFuncGetUTCMilliseconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::dateProtoFuncSetTime): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSActivation.cpp: + (JSC::JSActivation::argumentsGetter): + * runtime/JSValue.h: + * runtime/RegExpConstructor.cpp: + (JSC::constructRegExp): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncTest): + (JSC::regExpProtoFuncExec): + (JSC::regExpProtoFuncCompile): + (JSC::regExpProtoFuncToString): + * runtime/ScopeChain.cpp: + (JSC::ScopeChain::localDepth): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncToString): + (JSC::stringProtoFuncMatch): + (JSC::stringProtoFuncSearch): + (JSC::stringProtoFuncSplit): + Updated to new name, inherits, from old name, isObject. + +2009-07-31 Harald Fernengel + + Reviewed by Simon Hausmann. + + Adding QNX as a platform. Currently only tested with Qt. + + https://bugs.webkit.org/show_bug.cgi?id=27885 + + * JavaScriptCore/runtime/Collector.cpp: Added retrieving of stack base + since QNX doesn't have the pthread _nt functions + * JavaScriptCore/wtf/Platform.h: Added WTF_PLATFORM_QNX and corresponding + defines + * WebCore/bridge/npapi.h: Build fix for missing typedefs on QNX + +2009-08-14 Gabor Loki + + Reviewed by Simon Hausmann. + + Currently generic ARM and ARMv7 platforms work only with JSVALUE32 + https://bugs.webkit.org/show_bug.cgi?id=28300 + + * wtf/Platform.h: + +2009-08-14 Gabor Loki + + Reviewed by Simon Hausmann. + + Enable JIT on ARM for QT by default + https://bugs.webkit.org/show_bug.cgi?id=28259 + + * wtf/Platform.h: + +2009-08-14 Gabor Loki + + Reviewed by Simon Hausmann. + + Enable YARR_JIT on ARM for QT by default + https://bugs.webkit.org/show_bug.cgi?id=28259 + + * wtf/Platform.h: + +2009-08-14 Oliver Hunt + + Reviewed by Gavin Barraclough. + + [ES5] Arguments object should inherit from Array + https://bugs.webkit.org/show_bug.cgi?id=28298 + + Make the Arguments object conform to the behaviour specified in ES5. + The simple portion of this is to make Arguments use Array.prototype + as its prototype rather than Object.prototype. + + The spec then requires us to set instance.constructor to the pristine + Object constructor, and instance.toString and instance.toLocaleString + to the pristine versions from Object.prototype. To do this we now + make the ObjectPrototype constructor return its toString and + toLocaleString functions (similar to the call and apply functions + from FunctionPrototype). + + Oddly enough this reports itself as a slight win, but given the code + isn't hit in the tests that claim to have improved I put this down to + code motion. + + * runtime/Arguments.h: + (JSC::Arguments::Arguments): + (JSC::Arguments::initializeStandardProperties): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): + (JSC::JSGlobalObject::objectConstructor): + (JSC::JSGlobalObject::objectToStringFunction): + (JSC::JSGlobalObject::objectToLocaleStringFunction): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): + * runtime/ObjectPrototype.h: + * tests/mozilla/ecma_3/Function/arguments-001.js: + Update test to new es5 behaviour + +2009-08-14 Oliver Hunt + + Remove MarkStack::drain from the JSC exports file + + MarkStack::drain is now marked inline, the including it in the exports file + produces an ld warning + + * JavaScriptCore.exp: + +2009-08-13 Sam Weinig + + Reviewed by Oliver Hunt. + + Remove accidentally left in debugging statement. + + * runtime/JSArray.h: + (JSC::MarkStack::drain): + +2009-08-13 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + [ES5] Implement Array.isArray + https://bugs.webkit.org/show_bug.cgi?id=28296 + + Add support for Array.isArray to the Array constructor + + * runtime/ArrayConstructor.cpp: + (JSC::ArrayConstructor::ArrayConstructor): + (JSC::arrayConstructorIsArray): + * runtime/ArrayConstructor.h: + * runtime/CommonIdentifiers.h: + * runtime/JSArray.h: + (JSC::MarkStack::drain): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + +2009-08-13 Oliver Hunt + + Reviewed by NOBODY (Buildfix). + + Attempt to fix windows build + + * runtime/Collector.cpp: + +2009-08-13 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Devirtualise marking + https://bugs.webkit.org/show_bug.cgi?id=28294 + + Add a bit to TypeInfo to indicate that an object uses the standard + JSObject::markChildren method. This allows us to devirtualise marking + of most objects (though a branch is still needed). We also add a branch + to identify arrays thus devirtualising marking in that case as well. + + In order to make the best use of this devirtualisation I've also reworked + the MarkStack::drain() logic to make the iteration more efficient. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * JavaScriptCore.exp: + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::JSAPIValueWrapper): + * runtime/JSArray.cpp: + (JSC::JSArray::markChildren): + * runtime/JSArray.h: + (JSC::JSArray::markChildrenDirect): + (JSC::MarkStack::drain): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSCell.h: + (JSC::MarkStack::append): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.cpp: + (JSC::JSObject::markChildren): + * runtime/JSObject.h: + (JSC::JSObject::markChildrenDirect): + (JSC::JSObject::createStructure): + * runtime/JSString.h: + (JSC::JSString::createStructure): + * runtime/JSType.h: + (JSC::): + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStack): + (JSC::MarkStack::MarkSet::MarkSet): + (JSC::MarkStack::MarkStackArray::last): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + * runtime/TypeInfo.h: + (JSC::TypeInfo::hasDefaultMark): + +2009-08-13 Darin Adler + + Reviewed by Mark Rowe. + + Some small bits of housekeeping. + + * JavaScriptCore.xcodeproj/project.pbxproj: Make Parser.h + project instead of private. Remove JSONObject.lut.h. + + * assembler/ARMAssembler.h: Remove unneeded WTF prefix. + * assembler/AssemblerBufferWithConstantPool.h: Ditto. + * bytecompiler/BytecodeGenerator.h: Ditto. + + * wtf/SegmentedVector.h: Add a "using" statement as we do + with the other WTF headers. + +2009-08-13 Darin Adler + + Fix Tiger build. + + * parser/Grammar.y: Use a template function so we can compile + setStatementLocation even if it comes before YYLTYPE is defined. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + Too much use of void* in Grammar.y + https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Changed all the helper functions to + take a JSGlobalData* instead of a void*. A couple formatting + tweaks that I missed when breaking this into pieces. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Reduced and sorted includes. Tweaked comment + format. Marked a few more functions inline. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Pass the number to the PropertyNode instead of + first turning it into an Identifier. + + * parser/NodeConstructors.h: + (JSC::PropertyNode::PropertyNode): Add an overload that takes a double + so the code to convert to a string can be here instead of Grammar.y. + * parser/Nodes.h: Ditto. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Eliminate the DBG macro. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Eliminate the SET_EXCEPTION_LOCATION macro. + +2009-08-13 Darin Adler + + Reviewed by George Staikos. + + George asked me to break the patch from + https://bugs.webkit.org/show_bug.cgi?id=28287 + into smaller pieces and land it in stages. + + * parser/Grammar.y: Eliminate the LEXER macro. + +2009-08-13 Mark Rowe + + Try some more to fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto. + +2009-08-13 Mark Rowe + + Try and fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto. + +2009-08-13 Darin Adler + + Reviewed by David Levin. + + JavaScriptCore tweaks to get ready for the parser arena + https://bugs.webkit.org/show_bug.cgi?id=28243 + + Eliminate dependencies on Nodes.h outside JavaScriptCore, + and cut down on them inside JavaScriptCore. + + Change regular expression parsing to use identifiers as + with other strings we parse. + + Fix a couple things that are needed to use const Identifier + more, which will be part of the parser arena work. + + * JavaScriptCore.exp: Resorted and updated. + + * JavaScriptCore.xcodeproj/project.pbxproj: Changed + CollectorHeapIterator.h to be project-internal. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitPushNewScope): Added const. + * bytecompiler/BytecodeGenerator.h: Ditto. + + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): Moved this function + here from WebCore. Here is better since it uses so many internals. + Removed unimportant optimization for the no listener case. + * debugger/Debugger.h: Ditto. Also removed unneeded include + and tweaked formatting and comments. + + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::functionName): Call asFunction instead + of doing the unchecked static_cast. + (JSC::DebuggerCallFrame::calculatedFunctionName): Ditto. + + * jit/JITStubs.cpp: + (JSC::op_call_JSFunction): Call isHostFunction on the body rather + than on the JSFunction. + (JSC::vm_lazyLinkCall): Ditto. + (JSC::op_construct_JSConstruct): Ditto. + + * parser/Grammar.y: Changed callers to use new scanRegExp with + out arguments instead of relying on state in the Lexer. And + callers that just want to skip a regular expression to use + skipRegExp. + + * parser/Lexer.cpp: + (JSC::Lexer::scanRegExp): Changed to use out arguments, and to + add a prefix argument so we can add in the "=" character as needed. + Also rewrote to streamline the logic a bit inspired by suggestions + by David Levin. + (JSC::Lexer::skipRegExp): Added. Version of the function above that + does not actually put the regular expression into a string. + (JSC::Lexer::clear): Removed code to clear m_pattern and m_flags. + * parser/Lexer.h: Changed scanRegExp to have out arguments. Added + skipRegExp. Eliminated pattern, flags, m_pattern, and m_flags. + + * parser/NodeConstructors.h: + (JSC::RegExpNode::RegExpNode): Changed to take const Identifier&. + * parser/Nodes.cpp: + (JSC::RegExpNode::emitBytecode): Changed since m_pattern and + m_flags are now Identifier instead of UString. + (JSC::FunctionBodyNode::make): Moved this function here instead + of putting it in the JSFunction.h header. + * parser/Nodes.h: Changed RegExpNode to use Identifier. + + * profiler/Profiler.cpp: + (JSC::Profiler::createCallIdentifier): Changed to use isHostFunction + on the body instead of on the JSFunction object. + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): Ditto. + + * runtime/JSFunction.cpp: + (JSC::JSFunction::isHostFunction): Moved here from header. + (JSC::JSFunction::isHostFunctionNonInline): Added. + (JSC::JSFunction::JSFunction): Removed unneeded initialization of + m_body to 0. + (JSC::JSFunction::setBody): Moved here from header. + + * runtime/JSFunction.h: Removed unneeded includes. Moved private + constructor down to the private section. Made virtual functions + private. Removed unneeded overload of setBody and moved the body + of the function into the .cpp file. Changed assertions to use + the non-inline version of isHostFunction. + + * runtime/PropertySlot.cpp: + (JSC::PropertySlot::functionGetter): Use asFunction instead + of doing the unchecked static_cast. + + * wtf/SegmentedVector.h: + (WTF::SegmentedVector::isEmpty): Added. + +2009-08-13 Mark Rowe + + Rubber-stamped by Darin Adler. + + Use the version of operator new that takes a JSGlobalData when allocating FuncDeclNode and FuncExprNode + from within the grammar to prevent these nodes from being leaked. + + * parser/Grammar.y: + +2009-08-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Remove the special-case for Qt wrt JSVALUE_32 introduced in + r46709. It must've been a dependency issue on the bot, as + after a manual build all the tests pass on amd64 and ia32. + + * wtf/Platform.h: + +2009-08-12 Gabor Loki + + Reviewed by Gavin Barraclough. + + Add optimize call and property access support for ARM JIT. + https://bugs.webkit.org/show_bug.cgi?id=24986 + + For tightly coupled sequences the BEGIN_UNINTERRUPTED_SEQUENCE and + END_UNINTERRUPTED_SEQUENCE macros have been introduced which ensure + space for instructions and constants of the named sequence. This + method is vital for those architecture which are using constant pool. + + The 'latePatch' method - which was linked to JmpSrc - is replaced with + a port specific solution (each calls are marked to place their address + on the constant pool). + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::linkBranch): + (JSC::ARMAssembler::executableCopy): Add extra align for constant pool. + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::JmpSrc::JmpSrc): + (JSC::ARMAssembler::sizeOfConstantPool): + (JSC::ARMAssembler::jmp): + (JSC::ARMAssembler::linkCall): + * assembler/ARMv7Assembler.h: + * assembler/AbstractMacroAssembler.h: + * assembler/AssemblerBufferWithConstantPool.h: + (JSC::AssemblerBufferWithConstantPool::flushIfNoSpaceFor): Fix the + computation of the remaining space. + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::branch32): + (JSC::MacroAssemblerARM::nearCall): + (JSC::MacroAssemblerARM::call): + (JSC::MacroAssemblerARM::branchPtrWithPatch): + (JSC::MacroAssemblerARM::ensureSpace): + (JSC::MacroAssemblerARM::sizeOfConstantPool): + (JSC::MacroAssemblerARM::prepareCall): + * assembler/X86Assembler.h: + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::endUninterruptedSequence): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::emit_op_put_by_id): + +2009-08-12 Gavin Barraclough + + Rubber Stamped by Dave Kilzer. + + Disable WTF_USE_JSVALUE32_64 on iPhone for now (support not yet added for ARMv7). + + * wtf/Platform.h: + +2009-08-12 Gavin Barraclough + + Reviewed by Maciej Stachoviak. + + Ooops - moved code that had been accidentally added to op_new_func instead of + op_new_func_exp, to where it shoulds be. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * wtf/Platform.h: + +2009-08-12 Ada Chan + + Added workaround for the limitation that VirtualFree with MEM_RELEASE + can only accept the base address returned by VirtualAlloc when the region + was reserved and it can only free the entire region, and not a part of it. + + Reviewed by Oliver Hunt. + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackWin.cpp: + (JSC::MarkStack::releaseStack): + +2009-08-12 Balazs Kelemen + + Reviewed by Ariya Hidayat. + + Build fix: use std::numeric_limits::min() instead of LLONG_MIN + since LLONG_MIN is not defined in standard c++. + + * runtime/UString.cpp: + (JSC::UString::from): + +2009-08-12 Benjamin Otte + + Reviewed by Jan Alonzo. + + Buildfix for Gtk platforms debug builds. + + * GNUmakefile.am: Choose MarkStackPosix.cpp or MarkStackWin.cpp + depending on platform. + +2009-08-12 Simon Hausmann + + Prospective build fix for Mac and 32-bit Windows. + + * runtime/UString.cpp: Include wtf/StringExtras.h for snprintf. + (JSC::UString::from): Use %lld instead of %I64d for snprintf + on non-windows platforms. + +2009-08-12 Prasanth Ullattil + + Reviewed by Simon Hausmann. + + Fix compile error on 64Bit Windows, when UString::from + is called with an intptr_t. + + Added new UString::From overload with long long parameter. + + Thanks to Holger for the long long idea. + + * runtime/UString.cpp: + (JSC::UString::from): + * runtime/UString.h: + +2009-08-11 Oliver Hunt + + Reviewed by Mark Rowe. + + Minor style fixes. + + * runtime/UString.h: + (JSC::UString::Rep::createEmptyBuffer): + * wtf/FastMalloc.h: + (WTF::TryMallocReturnValue::getValue): + +2009-08-11 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Make it harder to misuse try* allocation routines + https://bugs.webkit.org/show_bug.cgi?id=27469 + + Jump through a few hoops to make it much harder to accidentally + miss null-checking of values returned by the try-* allocation + routines. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSArray.cpp: + (JSC::JSArray::putSlowCase): + (JSC::JSArray::increaseVectorLength): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncLink): + * runtime/UString.cpp: + (JSC::allocChars): + (JSC::reallocChars): + (JSC::expandCapacity): + (JSC::UString::Rep::reserveCapacity): + (JSC::UString::expandPreCapacity): + (JSC::createRep): + (JSC::concatenate): + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + (JSC::UString::append): + (JSC::UString::operator=): + * runtime/UString.h: + (JSC::UString::Rep::createEmptyBuffer): + * wtf/FastMalloc.cpp: + (WTF::tryFastZeroedMalloc): + (WTF::tryFastMalloc): + (WTF::tryFastCalloc): + (WTF::tryFastRealloc): + (WTF::TCMallocStats::tryFastMalloc): + (WTF::TCMallocStats::tryFastCalloc): + (WTF::TCMallocStats::tryFastRealloc): + * wtf/FastMalloc.h: + (WTF::TryMallocReturnValue::TryMallocReturnValue): + (WTF::TryMallocReturnValue::~TryMallocReturnValue): + (WTF::TryMallocReturnValue::operator PossiblyNull): + (WTF::TryMallocReturnValue::getValue): + * wtf/Platform.h: + * wtf/PossiblyNull.h: Added. + (WTF::PossiblyNull::PossiblyNull): + (WTF::PossiblyNull::~PossiblyNull): + (WTF::::getValue): + +2009-08-11 Gavin Barraclough + + Reviewed by NOBODY (build fix part deux). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Gavin Barraclough + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Restrict use of FuncDeclNode & FuncExprNode to the parser. + https://bugs.webkit.org/show_bug.cgi?id=28209 + + These objects were also being referenced from the CodeBlock. By changing this + to just retain pointers to FunctionBodyNodes these classes can be restricted to + use during parsing. + + No performance impact (or sub-percent progression). + + * JavaScriptCore.exp: + Update symbols. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::mark): + (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): + (JSC::CodeBlock::shrinkToFit): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::addFunction): + (JSC::CodeBlock::function): + Unify m_functions & m_functionExpressions into a single Vector >. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::addConstant): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + (JSC::Interpreter::privateExecute): + Update to reflect chnages in CodeBlock. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_new_func_exp): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): + Update to reflect chnages in CodeBlock. + + * parser/Grammar.y: + FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes. + + * parser/NodeConstructors.h: + (JSC::FuncExprNode::FuncExprNode): + (JSC::FuncDeclNode::FuncDeclNode): + * parser/Nodes.cpp: + (JSC::ScopeNodeData::mark): + (JSC::FunctionBodyNode::finishParsing): + * parser/Nodes.h: + (JSC::FunctionBodyNode::ident): + Move m_ident & make methods from FuncDeclNode & FuncExprNode to FunctionBodyNode. + + * runtime/JSFunction.h: + (JSC::FunctionBodyNode::make): + Make this method inline (was FuncDeclNode::makeFunction). + +2009-08-11 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Native JSON.stringify does not omit functions + https://bugs.webkit.org/show_bug.cgi?id=28117 + + Objects that are callable should be treated as undefined when + serialising to JSON. + + * runtime/JSONObject.cpp: + (JSC::Stringifier::appendStringifiedValue): + +2009-08-11 Oliver Hunt + + Reviewed by Geoff Garen. + + REGRESSION: Hang/crash in BytecodeGenerator::constRegisterFor loading simple page + https://bugs.webkit.org/show_bug.cgi?id=28169 + + Handle the case where someone has attempted to shadow a property + on the global object with a constant. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::constRegisterFor): + * parser/Nodes.cpp: + (JSC::ConstDeclNode::emitCodeSingle): + +2009-08-11 John Gregg + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25463 + + Adds ENABLE_NOTIFICATION flag. + + * Configurations/FeatureDefines.xcconfig: + * wtf/Platform.h: + +2009-08-11 Maxime Simon + + Reviewed by Eric Seidel. + + Modifications on JavaScriptCore to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28121 + + * runtime/Collector.cpp: Haiku doesn't have sys/mman.h, using OS.h instead. + (JSC::currentThreadStackBase): Haiku uses its own threading system. + * wtf/Platform.h: Defining all Haiku platform values. + * wtf/haiku/MainThreadHaiku.cpp: Adding a missing header (NotImplemented.h). + +2009-08-11 Jessie Berlin + + Reviewed by Adam Roben. + + Fix windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Csaba Osztrogonac + + Reviewed by Tor Arne Vestbø. + + Buildfix for Qt-win platforms. + + * JavaScriptCore.pri: Choose MarkStackPosix.cpp or MarkStackWin.cpp depend on platform. + +2009-08-10 Oliver Hunt + + Reviewed by NOBODY (And another build fix). + + Add new exports for MSVC + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-08-10 Oliver Hunt + + Reviewed by NOBODY (yet another build fix). + + Remove obsolete entries from MSVC exports file + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-10 Oliver Hunt + + Add includes needed for non-allinonefile builds + + * runtime/GetterSetter.h: + * runtime/ScopeChain.h: + +2009-08-10 Oliver Hunt + + Fix export file for last build fix + + * JavaScriptCore.exp: + +2009-08-10 Oliver Hunt + + Hoist page size initialization into platform specific code. + + * jit/ExecutableAllocatorPosix.cpp: + * jit/ExecutableAllocatorWin.cpp: + * runtime/MarkStack.h: + (JSC::MarkStack::pageSize): + * runtime/MarkStackPosix.cpp: + (JSC::MarkStack::initializePagesize): + * runtime/MarkStackWin.cpp: + (JSC::MarkStack::initializePagesize): + +2009-08-07 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Stack overflow crash in JavaScript garbage collector mark pass + https://bugs.webkit.org/show_bug.cgi?id=12216 + + Make the GC mark phase iterative by using an explicit mark stack. + To do this marking any single object is performed in multiple stages + * The object is appended to the MarkStack, this sets the marked + bit for the object using the new markDirect() function, and then + returns + * When the MarkStack is drain()ed the object is popped off the stack + and markChildren(MarkStack&) is called on the object to collect + all of its children. drain() then repeats until the stack is empty. + + Additionally I renamed a number of methods from 'mark' to 'markAggregate' + in order to make it more clear that marking of those object was not + going to result in an actual recursive mark. + + * GNUmakefile.am + * JavaScriptCore.exp: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::markAggregate): + * bytecode/CodeBlock.h: + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::markAggregate): + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::markChildren): + * debugger/DebuggerActivation.h: + * interpreter/Register.h: + * interpreter/RegisterFile.h: + (JSC::RegisterFile::markGlobals): + (JSC::RegisterFile::markCallFrames): + * parser/Nodes.cpp: + (JSC::ScopeNodeData::markAggregate): + (JSC::EvalNode::markAggregate): + (JSC::FunctionBodyNode::markAggregate): + * parser/Nodes.h: + (JSC::ScopeNode::markAggregate): + * runtime/ArgList.cpp: + (JSC::MarkedArgumentBuffer::markLists): + * runtime/ArgList.h: + * runtime/Arguments.cpp: + (JSC::Arguments::markChildren): + * runtime/Arguments.h: + * runtime/Collector.cpp: + (JSC::Heap::markConservatively): + (JSC::Heap::markCurrentThreadConservativelyInternal): + (JSC::Heap::markCurrentThreadConservatively): + (JSC::Heap::markOtherThreadConservatively): + (JSC::Heap::markStackObjectsConservatively): + (JSC::Heap::markProtectedObjects): + (JSC::Heap::collect): + * runtime/Collector.h: + * runtime/GetterSetter.cpp: + (JSC::GetterSetter::markChildren): + * runtime/GetterSetter.h: + (JSC::GetterSetter::GetterSetter): + (JSC::GetterSetter::createStructure): + * runtime/GlobalEvalFunction.cpp: + (JSC::GlobalEvalFunction::markChildren): + * runtime/GlobalEvalFunction.h: + * runtime/JSActivation.cpp: + (JSC::JSActivation::markChildren): + * runtime/JSActivation.h: + * runtime/JSArray.cpp: + (JSC::JSArray::markChildren): + * runtime/JSArray.h: + * runtime/JSCell.h: + (JSC::JSCell::markCellDirect): + (JSC::JSCell::markChildren): + (JSC::JSValue::markDirect): + (JSC::JSValue::markChildren): + (JSC::JSValue::hasChildren): + (JSC::MarkStack::append): + (JSC::MarkStack::drain): + * runtime/JSFunction.cpp: + (JSC::JSFunction::markChildren): + * runtime/JSFunction.h: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * runtime/JSGlobalObject.cpp: + (JSC::markIfNeeded): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + * runtime/JSNotAnObject.cpp: + (JSC::JSNotAnObject::markChildren): + * runtime/JSNotAnObject.h: + * runtime/JSONObject.cpp: + (JSC::Stringifier::markAggregate): + (JSC::JSONObject::markStringifiers): + * runtime/JSONObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::markChildren): + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + * runtime/JSObject.h: + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::markChildren): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::createStructure): + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): + (JSC::JSPropertyNameIterator::create): + * runtime/JSStaticScopeObject.cpp: + (JSC::JSStaticScopeObject::markChildren): + * runtime/JSStaticScopeObject.h: + * runtime/JSType.h: + (JSC::): + * runtime/JSValue.h: + * runtime/JSWrapperObject.cpp: + (JSC::JSWrapperObject::markChildren): + * runtime/JSWrapperObject.h: + * runtime/MarkStack.cpp: Added. + (JSC::MarkStack::compact): + * runtime/MarkStack.h: Added. + (JSC::): + (JSC::MarkStack::MarkStack): + (JSC::MarkStack::append): + (JSC::MarkStack::appendValues): + (JSC::MarkStack::~MarkStack): + (JSC::MarkStack::MarkSet::MarkSet): + (JSC::MarkStack::pageSize): + + MarkStackArray is a non-shrinking, mmap-based vector type + used for storing objects to be marked. + (JSC::MarkStack::MarkStackArray::MarkStackArray): + (JSC::MarkStack::MarkStackArray::~MarkStackArray): + (JSC::MarkStack::MarkStackArray::expand): + (JSC::MarkStack::MarkStackArray::append): + (JSC::MarkStack::MarkStackArray::removeLast): + (JSC::MarkStack::MarkStackArray::isEmpty): + (JSC::MarkStack::MarkStackArray::size): + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackPosix.cpp: Added. + (JSC::MarkStack::allocateStack): + (JSC::MarkStack::releaseStack): + * runtime/MarkStackWin.cpp: Added. + (JSC::MarkStack::allocateStack): + (JSC::MarkStack::releaseStack): + + * runtime/ScopeChain.h: + * runtime/ScopeChainMark.h: + (JSC::ScopeChain::markAggregate): + * runtime/SmallStrings.cpp: + (JSC::SmallStrings::mark): + * runtime/Structure.h: + (JSC::Structure::markAggregate): + +2009-08-10 Mark Rowe + + Reviewed by Darin Adler. + + Fix hundreds of "pointer being freed was not allocated" errors seen on the build bot. + + * wtf/FastMalloc.h: Implement nothrow variants of the delete and delete[] operators since + we implement the nothrow variants of new and new[]. The nothrow variant of delete is called + explicitly in the implementation of std::sort which was resulting in FastMalloc-allocated + memory being passed to the system allocator to free. + +2009-08-10 Jan Michael Alonzo + + [Gtk] Unreviewed build fix. Move JSAPIValueWrapper.cpp/.h in the debug + section. This file is already part of AllInOneFile in Release builds. + + * GNUmakefile.am: + +2009-08-10 Darin Adler + + * wtf/FastMalloc.h: Fix build. + +2009-08-10 Darin Adler + + Reviewed by Mark Rowe. + + FastMalloc.h has cross-platform code but marked as WinCE-only + https://bugs.webkit.org/show_bug.cgi?id=28160 + + 1) The support for nothrow was inside #if PLATFORM(WINCE) even though it is + not platform-specific. + 2) The code tried to override operator delete nothrow, which does not exist. + 3) The code in the header checks the value of USE_SYSTEM_MALLOC, but the code + in FastMalloc.cpp checks only if the macro is defined. + + * wtf/FastMalloc.h: See above. + * wtf/FastMalloc.cpp: Ditto. + +2009-08-10 Sam Weinig + + Reviewed by Anders Carlsson. + + Fix an annoying indentation issue. + + * runtime/DateConstructor.cpp: + (JSC::constructDate): + +2009-08-10 Xan Lopez + + Unreviewed build fix. + + Add new files to makefile. + + * GNUmakefile.am: + +2009-08-10 Simon Hausmann + + Fix compilation with the interpreter instead of the JIT by including + PrototypeFunction.h as forward-declared through NativeFunctionWrapper.h. + + * runtime/ObjectConstructor.cpp: + +2009-08-09 Oliver Hunt + + Reviewed by George Staikos. + + JSON.stringify replacer returning undefined does not omit object properties + https://bugs.webkit.org/show_bug.cgi?id=28118 + + Correct behaviour of stringify when using a replacer function that returns + undefined. This is a simple change to move the undefined value check to + after the replacer function is called. This means that the replacer function + is now called for properties with the value undefined, however i've confirmed + that this behaviour is correct. + + In addition I've made the cyclic object exception have a more useful error + message. + + * runtime/JSONObject.cpp: + (JSC::Stringifier::appendStringifiedValue): + +2009-08-08 Oliver Hunt + + Reviewed by Eric Seidel and Sam Weinig. + + [ES5] Implement Object.getPrototypeOf + https://bugs.webkit.org/show_bug.cgi?id=28114 + + Implement getPrototypeOf + + * runtime/CommonIdentifiers.h: + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConsGetPrototypeOf): + * runtime/ObjectConstructor.h: + +2009-08-07 Zoltan Horvath + + Reviewed by Eric Seidel. + + Allow custom memory allocation control for Noncopyable class + https://bugs.webkit.org/show_bug.cgi?id=27879 + + Several classes which are inherited from Noncopyable are instantiated by + operator new, so Noncopyable class has been inherited from FastAllocBase. + + * wtf/Noncopyable.h: + +2009-08-07 George Staikos + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=27305 + Implement WinCE-specific unicode layer. + Written by George Staikos + with bug fixes by Yong Li + refactored by Joe Mason + + * wtf/Platform.h: + * wtf/unicode/Unicode.h: + * wtf/unicode/wince/UnicodeWince.cpp: Added. + (WTF::Unicode::toLower): + (WTF::Unicode::toUpper): + (WTF::Unicode::foldCase): + (WTF::Unicode::isPrintableChar): + (WTF::Unicode::isSpace): + (WTF::Unicode::isLetter): + (WTF::Unicode::isUpper): + (WTF::Unicode::isLower): + (WTF::Unicode::isDigit): + (WTF::Unicode::isPunct): + (WTF::Unicode::toTitleCase): + (WTF::Unicode::direction): + (WTF::Unicode::category): + (WTF::Unicode::decompositionType): + (WTF::Unicode::combiningClass): + (WTF::Unicode::mirroredChar): + (WTF::Unicode::digitValue): + * wtf/unicode/wince/UnicodeWince.h: Added. + (WTF::Unicode::): + (WTF::Unicode::isSeparatorSpace): + (WTF::Unicode::isHighSurrogate): + (WTF::Unicode::isLowSurrogate): + (WTF::Unicode::isArabicChar): + (WTF::Unicode::hasLineBreakingPropertyComplexContext): + (WTF::Unicode::umemcasecmp): + (WTF::Unicode::surrogateToUcs4): + +2009-08-07 Yongjun Zhang + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28069 + + Add inline to help winscw compiler resolve specialized argument in + templated functions. + + * runtime/LiteralParser.cpp: + (JSC::LiteralParser::Lexer::lexString): + +2009-08-07 Zoltan Horvath + + Reviewed by Eric Seidel. + + Allow custom memory allocation control for RegExpObjectData struct + http://bugs.webkit.org/show_bug.cgi?id=26750 + + Inherits RegExpObjectData struct from FastAllocBase because + it has been instantiated by 'new' in JavaScriptCore/runtime/RegExpObject.cpp:62 + + * runtime/RegExpObject.h: + +2009-08-06 Norbert Leser + + Reviewed by Darin Adler. + + Updated patch for bug #27059: + Symbian platform always uses little endian encoding, + regardless of compiler. + We need to make sure that we correctly detect EABI architecture + for armv5 targets on Symbian, + where __EABI__ is set but not __ARM_EABI__ + + * wtf/Platform.h: + +2009-08-06 Adam Barth + + Unreviewed revert. + + http://bugs.webkit.org/show_bug.cgi?id=27879 + + Revert 46877 because it broke GTK. + + * wtf/Noncopyable.h: + +2009-08-06 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Make get_by_id/put_by_id/method_check/call defer optimization using a data flag rather than a code modification. + ( https://bugs.webkit.org/show_bug.cgi?id=27635 ) + + This improves performance of ENABLE(ASSEMBLER_WX_EXCLUSIVE) builds by 2-2.5%, reducing the overhead to about 2.5%. + (No performance impact with ASSEMBLER_WX_EXCLUSIVE disabled). + + * bytecode/CodeBlock.cpp: + (JSC::printStructureStubInfo): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * bytecode/CodeBlock.h: + (JSC::): + (JSC::CallLinkInfo::seenOnce): + (JSC::CallLinkInfo::setSeen): + (JSC::MethodCallLinkInfo::seenOnce): + (JSC::MethodCallLinkInfo::setSeen): + - Change a pointer in CallLinkInfo/MethodCallLinkInfo to use a PtrAndFlags, use a flag to track when an op has been executed once. + + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::StructureStubInfo): + (JSC::StructureStubInfo::initGetByIdSelf): + (JSC::StructureStubInfo::initGetByIdProto): + (JSC::StructureStubInfo::initGetByIdChain): + (JSC::StructureStubInfo::initGetByIdSelfList): + (JSC::StructureStubInfo::initGetByIdProtoList): + (JSC::StructureStubInfo::initPutByIdTransition): + (JSC::StructureStubInfo::initPutByIdReplace): + (JSC::StructureStubInfo::seenOnce): + (JSC::StructureStubInfo::setSeen): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID, add a flag to track when an op has been executed once. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitGetById): + (JSC::BytecodeGenerator::emitPutById): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + (JSC::JIT::unlinkCall): + - Remove the "don't lazy link" stage of calls. + + * jit/JIT.h: + (JSC::JIT::compileCTIMachineTrampolines): + - Remove the "don't lazy link" stage of calls. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallSlowCase): + - Remove the "don't lazy link" stage of calls. + + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::JITStubs::DEFINE_STUB_FUNCTION): + (JSC::JITStubs::getPolymorphicAccessStructureListSlot): + - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check. + + * jit/JITStubs.h: + (JSC::JITThunks::ctiStringLengthTrampoline): + (JSC::JITStubs::): + - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check. + + * wtf/PtrAndFlags.h: + (WTF::PtrAndFlags::PtrAndFlags): + (WTF::PtrAndFlags::operator!): + (WTF::PtrAndFlags::operator->): + - Add ! and -> operators, add constuctor with pointer argument. + +2009-08-06 Zoltan Horvath + + Reviewed by Adam Barth. + + Allow custom memory allocation control for Noncopyable class + https://bugs.webkit.org/show_bug.cgi?id=27879 + + Several classes which inherited from Noncopyable are instantiated by + operator new, so Noncopyable class has been inherited from FastAllocBase. + + * wtf/Noncopyable.h: + +2009-08-06 Mark Rowe + + Rubber-stamped by Sam Weinig. + + Add explicit dependencies for our build verification scripts to ensure that they always run after linking has completed. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-08-06 Mark Rowe + + Bring a little order to our otherwise out of control lives. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-08-06 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's PolymorphicAccessStructureList struct + https://bugs.webkit.org/show_bug.cgi?id=27877 + + Inherits PolymorphicAccessStructureList struct from FastAllocBase because it has been instantiated by + 'new' in JavaScriptCore/jit/JITStubs.cpp:1229. + + * bytecode/Instruction.h: + +2009-08-05 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's ScopeNodeData struct + https://bugs.webkit.org/show_bug.cgi?id=27875 + + Inherits ScopeNodeData struct from FastAllocBase because it has been instantiated by + 'new' in JavaScriptCore/parser/Nodes.cpp:1848. + + * parser/Nodes.h: + +2009-08-05 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + Add floating point support for generic ARM port. + https://bugs.webkit.org/show_bug.cgi?id=24986 + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::doubleTransfer): + * assembler/ARMAssembler.h: + (JSC::ARM::): + (JSC::ARMAssembler::): + (JSC::ARMAssembler::faddd_r): + (JSC::ARMAssembler::fsubd_r): + (JSC::ARMAssembler::fmuld_r): + (JSC::ARMAssembler::fcmpd_r): + (JSC::ARMAssembler::fdtr_u): + (JSC::ARMAssembler::fdtr_d): + (JSC::ARMAssembler::fmsr_r): + (JSC::ARMAssembler::fsitod_r): + (JSC::ARMAssembler::fmstat): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::): + (JSC::MacroAssemblerARM::supportsFloatingPoint): + (JSC::MacroAssemblerARM::loadDouble): + (JSC::MacroAssemblerARM::storeDouble): + (JSC::MacroAssemblerARM::addDouble): + (JSC::MacroAssemblerARM::subDouble): + (JSC::MacroAssemblerARM::mulDouble): + (JSC::MacroAssemblerARM::convertInt32ToDouble): + (JSC::MacroAssemblerARM::branchDouble): + * jit/JIT.h: + +2009-08-05 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + Add JIT support for generic ARM port without optimizations. + https://bugs.webkit.org/show_bug.cgi?id=24986 + + All JIT optimizations are disabled. + + Signed off by Zoltan Herczeg + Signed off by Gabor Loki + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::baseIndexTransfer32): + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::Imm32::Imm32): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::store32): + (JSC::MacroAssemblerARM::move): + (JSC::MacroAssemblerARM::branch32): + (JSC::MacroAssemblerARM::add32): + (JSC::MacroAssemblerARM::sub32): + (JSC::MacroAssemblerARM::load32): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::getBytecodeIndex): + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::restoreArgumentReference): + * jit/JITOpcodes.cpp: + * jit/JITStubs.cpp: + * jit/JITStubs.h: + (JSC::JITStackFrame::returnAddressSlot): + * wtf/Platform.h: + +2009-08-04 Gavin Barraclough + + Rubber Stamped by Oiver Hunt. + + Revert r46643 since this breaks the Yarr::Interpreter running the v8 tests. + https://bugs.webkit.org/show_bug.cgi?id=27874 + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::allocDisjunctionContext): + (JSC::Yarr::Interpreter::freeDisjunctionContext): + (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): + (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): + +2009-08-04 Oliver Hunt + + PPC64 Build fix + + * wtf/Platform.h: + +2009-08-04 Benjamin C Meyer + + Reviewed by Adam Treat + + Explicitly include limits.h header when using INT_MAX and INT_MIN + + * interpreter/Interpreter.cpp + +2009-08-03 Harald Fernengel + + Reviewed by Darin Adler. + + Fix compile error for ambigous call to abs() + https://bugs.webkit.org/show_bug.cgi?id=27873 + + Fix ambiguity in abs(long int) call by calling labs() instead + + * wtf/DateMath.cpp: replace call to abs() with labs() + +2009-08-03 Laszlo Gombos + + Reviewed by Eric Seidel. + + [Qt] Consolidate common gcc flags to WebKit.pri + https://bugs.webkit.org/show_bug.cgi?id=27934 + + * JavaScriptCore.pro: + +2009-08-03 Ada Chan + + Fixed the Tiger build. + + * wtf/FastMalloc.cpp: + +2009-08-03 Ada Chan + + Reviewed by Darin Adler. + + Don't use background thread to scavenge memory on Tiger until we figure out why it causes a crash. + https://bugs.webkit.org/show_bug.cgi?id=27900 + + * wtf/FastMalloc.cpp: + +2009-08-03 Fumitoshi Ukai + + Reviewed by Jan Alonzo. + + Fix build break on Gtk/x86_64. + https://bugs.webkit.org/show_bug.cgi?id=27936 + + Use JSVALUE64 for X86_64 LINUX, except Qt. + + * wtf/Platform.h: + +2009-08-02 Xan Lopez + + Fix the GTK+ build. + + * wtf/Platform.h: + +2009-08-02 Geoffrey Garen + + Reviewed by Sam Weinig. + + Disabled JSVALUE32_64 on Qt builds, since all layout tests mysteriously + crash with it enabled. + + * wtf/Platform.h: + +2009-08-02 Geoffrey Garen + + Qt build fix. + + Added JSAPIValueWrapper.cpp to the build. + + * JavaScriptCore.pri: + +2009-08-02 Geoffrey Garen + + Windows build fix. + + Exported symbols for JSAPIValueWrapper. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-02 Geoffrey Garen + + GTK build fix. + + * jit/JITStubs.cpp: #include , for a definition of va_start. + +2009-08-02 Geoffrey Garen + + Qt build fix. + + * runtime/Collector.cpp: #include , for a definition of ULONG_MAX. + +2009-08-02 Geoffrey Garen + + Windows build fix: Nixed JSImmediate::prototype, JSImmediate::toObject, + and JSImmediate::toThisObject, and removed their exported symbols. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + * runtime/JSImmediate.cpp: + * runtime/JSImmediate.h: + +2009-08-02 Geoffrey Garen + + Reviewed by Mark Rowe. + + Enabled JSVALUE32_64 by default on all platforms other than x86_64 (which uses JSVALUE64). + + * wtf/Platform.h: + +2009-08-02 Kevin Ollivier + + Reviewed by Jan Alonzo. + + Script for building the JavaScriptCore library for wx. + https://bugs.webkit.org/show_bug.cgi?id=27619 + + * wscript: Added. + +2009-08-02 Yong Li + + Reviewed by George Staikos. + + DateMath depends on strftime and localtime, which need to be imported manually on WinCE + https://bugs.webkit.org/show_bug.cgi?id=26558 + + * wtf/DateMath.cpp: + +2009-08-01 David Kilzer + + wtf/Threading.h: added include of Platform.h + + Reviewed by Mark Rowe. + + * wtf/Threading.h: Added #include "Platform.h" since this header + uses PLATFORM() and other macros. + +2009-08-01 Mark Rowe + + Rubber-stamped by Oliver Hunt. + + Roll out r46668 as it was misinformed. ScopeChain is only used with placement new. + + * runtime/ScopeChain.h: + +2009-08-01 Zoltan Horvath + + Allow custom memory allocation control for JavaScriptCore's HashMap class + http://bugs.webkit.org/show_bug.cgi?id=27871 + + Inherits HashMap class from FastAllocBase because it has been + instantiated by 'new' in JavaScriptCore/API/JSClassRef.cpp:148. + + * wtf/RefPtrHashMap.h: + (WTF::): + +2009-08-01 Zoltan Horvath + + Allow custom memory allocation control for JavaScriptCore's ScopeChain class + https://bugs.webkit.org/show_bug.cgi?id=27834 + + Inherits ScopeChain class from FastAllocBase because it has been + instantiated by 'new' in JavaScriptCore/runtime/JSFunction.h:109. + + * runtime/ScopeChain.h: + +2009-08-01 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's RegExpConstructorPrivate struct + https://bugs.webkit.org/show_bug.cgi?id=27833 + + Inherits RegExpConstructorPrivate class from FastAllocBase because it has been + instantiated by 'new' in JavaScriptCore/runtime/RegExpConstructor.cpp:152. + + * runtime/RegExpConstructor.cpp: + +2009-07-31 Yong Li + + Reviewed by George Staikos. + + Resurrect the old GetTickCount implementation of currentTime, controlled by WTF_USE_QUERY_PERFORMANCE_COUNTER + currentSystemTime taken from older WebKit; currentTime written by Yong Li ; cleanup by Joe Mason + https://bugs.webkit.org/show_bug.cgi?id=27848 + + * wtf/CurrentTime.cpp: + (WTF::currentSystemTime): get current time with GetCurrentFT + (WTF::currentTime): track msec elapsed since first currentSystemTime call using GetTickCount + * wtf/Platform.h: + +2009-07-31 Ada Chan + + Fixes the Windows release-PGO build. + + Reviewed by Jon Honeycutt. + + * JavaScriptCore.vcproj/WTF/WTF.vcproj: Suppresses the warning about unreachable code that we get by adding "return 0" to WTF::TCMalloc_PageHeap::runScavengerThread(). + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::runScavengerThread): Fixes the error about the method not returning a value in the release-PGO build. + +2009-07-31 Zoltan Horvath + + Change malloc to fastMalloc and free to fastFree in Yarr's RegexInterpreter.cpp + https://bugs.webkit.org/show_bug.cgi?id=27874 + + Use fastMalloc and fastFree instead of malloc and free in RegexInterpreter.cpp's methods. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::allocDisjunctionContext): + (JSC::Yarr::Interpreter::freeDisjunctionContext): + (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): + (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): + +2009-07-30 Xan Lopez + + Reviewed by Jan Alonzo. + + Fix compiler warning. + + GCC does not like C++-style comments in preprocessor directives. + + * wtf/Platform.h: + +2009-07-30 John McCall + + Reviewed by Gavin Barraclough. + + Optimize the X86_64 trampolines: avoid the need for filler arguments + and move the stub-args area closer to the stack pointer. + + * jit/JIT.h: adjust patch offsets because of slight code-size change + * jit/JITCode.h: + (JSC::JITCode::execute): don't pass filler args + * jit/JITStubs.cpp: + (ctiTrampoline): (X86_64): push args onto stack, use args directly + (ctiVMThrowTrampoline): (X86_64): adjust %rsp by correct displacement + (ctiOpThrowNotCaught): (X86_64): adjust %rsp by correct displacement + * jit/JITStubs.h: + (JITStackFrame): (X86_64): move args area earlier + (ctiTrampoline): remove filler args from prototype + +2009-07-30 Gavin Barraclough + + Temporarily revert r46618 since this is b0rking on Linux. + +2009-07-23 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Make get_by_id/put_by_id/method_check/call defer optimization using a data flag rather than a code modification. + ( https://bugs.webkit.org/show_bug.cgi?id=27635 ) + + This improves performance of ENABLE(ASSEMBLER_WX_EXCLUSIVE) builds by 2-2.5%, reducing the overhead to about 2.5%. + (No performance impact with ASSEMBLER_WX_EXCLUSIVE disabled). + + * bytecode/CodeBlock.cpp: + (JSC::printStructureStubInfo): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * bytecode/CodeBlock.h: + (JSC::): + (JSC::CallLinkInfo::seenOnce): + (JSC::CallLinkInfo::setSeen): + (JSC::MethodCallLinkInfo::seenOnce): + (JSC::MethodCallLinkInfo::setSeen): + - Change a pointer in CallLinkInfo/MethodCallLinkInfo to use a PtrAndFlags, use a flag to track when an op has been executed once. + + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::StructureStubInfo): + (JSC::StructureStubInfo::initGetByIdSelf): + (JSC::StructureStubInfo::initGetByIdProto): + (JSC::StructureStubInfo::initGetByIdChain): + (JSC::StructureStubInfo::initGetByIdSelfList): + (JSC::StructureStubInfo::initGetByIdProtoList): + (JSC::StructureStubInfo::initPutByIdTransition): + (JSC::StructureStubInfo::initPutByIdReplace): + (JSC::StructureStubInfo::seenOnce): + (JSC::StructureStubInfo::setSeen): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID, add a flag to track when an op has been executed once. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitGetById): + (JSC::BytecodeGenerator::emitPutById): + - Make StructureStubInfo store the type as an integer, rather than an OpcodeID. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + (JSC::JIT::unlinkCall): + - Remove the "don't lazy link" stage of calls. + + * jit/JIT.h: + (JSC::JIT::compileCTIMachineTrampolines): + - Remove the "don't lazy link" stage of calls. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallSlowCase): + - Remove the "don't lazy link" stage of calls. + + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::JITStubs::DEFINE_STUB_FUNCTION): + (JSC::JITStubs::getPolymorphicAccessStructureListSlot): + - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check. + + * jit/JITStubs.h: + (JSC::JITThunks::ctiStringLengthTrampoline): + (JSC::JITStubs::): + - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check. + + * wtf/PtrAndFlags.h: + (WTF::PtrAndFlags::PtrAndFlags): + (WTF::PtrAndFlags::operator!): + (WTF::PtrAndFlags::operator->): + - Add ! and -> operators, add constuctor with pointer argument. + +2009-07-30 Geoffrey Garen + + Reviewed by Gavin Barraclough. + + Fixed failing tests seen on Windows buildbot. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): Use "int" instead of "bool" to guarantee a 32-bit result, + regardless of compiler. gcc on mac uses 32-bit values for bool, + but gcc on linux and MSVC on Windows use 8-bit values. + +2009-07-30 Geoffrey Garen + + Windows build fix: added missing symbols on Windows. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-30 Geoffrey Garen + + Windows build fix: removed stale symbols on Windows. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +=== End merge of nitro-extreme branch 2009-07-30 === + +2009-07-20 Geoffrey Garen + + Fixed a post-review typo in r46066 that caused tons of test failures. + + SunSpider reports no change. + + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): Initialize the full vector capacity, to avoid + uninitialized members at the end. + +2009-07-20 Geoffrey Garen + + Windows WebKit build fix: Added some missing exports. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-17 Geoffrey Garen + + Reviewed by Sam Weinig. + + Get the branch working on windows. + https://bugs.webkit.org/show_bug.cgi?id=27391 + + SunSpider says 0.3% faster. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Updated + MSVC export lists to fix linker errors. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added / removed + new / old project files. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): Used #pragma pack to tell + MSVC that these structures represent actual memory layout, and should not be + automatically aligned. Changed the return value load to load a 64bit quantity + into the canonical registers. + + * jit/JIT.h: Moved OBJECT_OFFSETOF definition to StdLibExtras.h because + it's needed by more than just the JIT, and it supplements a standard library + macro (offsetof). + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallInitializeCallFrame): Fixed an incorrectly signed + cast to resolve an MSVC warning. + + * jit/JITStubs.h: Used #pragma pack to tell MSVC that these structures + represent actual memory layout, and should not be automatically aligned. + + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): Replaced memset_pattern8 with a for loop, since + memset_pattern8 is not portable. (I verified that this version of the loop + gives the best performance / generated code in GCC.) + + * runtime/JSObject.h: + (JSC::JSObject::JSObject): Removed accidental usage of FIELD_OFFSET -- + OBJECT_OFFSETOF is our new macro name. (FIELD_OFFSET conflicts with a + definition in winnt.h.) + + * runtime/JSValue.cpp: Added some headers needed by non-all-in-one builds. + + * runtime/JSValue.h: + (JSC::JSValue::): Made the tag signed, to match MSVC's signed enum values. + (GCC doesn't seem to care one way or the other.) + + * wtf/MainThread.cpp: Moved the StdLibExtras.h #include -- I did this a + while ago to resolve a conflict with winnt.h. I can't remember if it's truly + still needed, but what the heck. + + * wtf/StdLibExtras.h: Moved OBJECT_OFFSETOF definition here. + +2009-07-06 Geoffrey Garen + + Reviewed by Sam Weinig (?). + + Fixed an assertion seen during the stress test. + + Don't assume that, if op1 is constant, op2 is not, and vice versa. Sadly, + not all constants get folded. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitSlow_op_jnlesseq): + +2009-07-06 Geoffrey Garen + + Reviewed by Sam Weinig. + + Include op_convert_this in result caching. + + No change on SunSpider or v8. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_convert_this): + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): Made the op_convert_this JIT stub return an EncodedJSValue, so + to maintain the result caching contract that { tag, payload } can be + found in { regT1, regT0 }. + +2009-07-06 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented result chaining. + + 1% faster on SunSpider. 4%-5% faster on v8. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::move): + * assembler/X86Assembler.h: + (JSC::X86Assembler::movl_rr): Added an optimization to eliminate + no-op mov instructions, to simplify chaining. + + * jit/JIT.cpp: + (JSC::JIT::JIT): + * jit/JIT.h: Added data members and helper functions for recording + chained results. We record both a mapping from virtual to machine register + and the opcode for which the mapping is valid, to help ensure that the + mapping isn't used after the mapped register has been stomped by other + instructions. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::compileOpCallVarargsSlowCase): + (JSC::JIT::emit_op_ret): + (JSC::JIT::emit_op_construct_verify): + (JSC::JIT::compileOpCall): + (JSC::JIT::compileOpCallSlowCase): Chain function call results. + + * jit/JITInlineMethods.h: + (JSC::JIT::emitLoadTag): + (JSC::JIT::emitLoadPayload): + (JSC::JIT::emitLoad): + (JSC::JIT::emitLoad2): + (JSC::JIT::isLabeled): + (JSC::JIT::map): + (JSC::JIT::unmap): + (JSC::JIT::isMapped): + (JSC::JIT::getMappedPayload): + (JSC::JIT::getMappedTag): Use helper functions when loading virtual + registers into machine registers, in case the loads can be eliminated + by chaining. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_mov): + (JSC::JIT::emit_op_end): + (JSC::JIT::emit_op_instanceof): + (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_jneq_ptr): + (JSC::JIT::emit_op_next_pname): + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emit_op_catch): Chain results from these opcodes. + + (JSC::JIT::emit_op_profile_will_call): + (JSC::JIT::emit_op_profile_did_call): Load the profiler into regT2 to + avoid stomping a chained result. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_get_by_id): Chain results from these opcodes. + + * jit/JITStubCall.h: + (JSC::JITStubCall::addArgument): Always use { regT1, regT0 }, to facilitate + chaining. + + (JSC::JITStubCall::call): Unmap all mapped registers, since our callee + stub might stomp them. + +2009-07-01 Sam Weinig + + Reviewed by Gavin Barraclough. + + Don't reload values in emitBinaryDoubleOp. + + SunSpider reports a 0.6% progression. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitBinaryDoubleOp): + +2009-07-01 Sam Weinig + + Reviewed by Geoffrey Garen. + + Convert op_div to load op1 and op2 up front. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_div): + +2009-07-01 Sam Weinig + + Reviewed by Geoffrey Garen. + + Don't emit code in emitBinaryDoubleOp if code is unreachable, observable + via an empty (unlinked) jumplist passed in. This only effects op_jnless + and op_jnlesseq at present. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emitSlow_op_jnlesseq): + (JSC::JIT::emitBinaryDoubleOp): + +2009-07-01 Geoffrey Garen + + Reviewed by Sam Weinig. + + Converted op_mod to put { tag, payload } in { regT1, regT0 }, and + tidied up its constant case. + + SunSpider reports a 0.2% regression, but a micro-benchmark of op_mod + shows a 12% speedup, and the SunSpider test that uses op_mod most should + benefit a lot from result caching in the end, since it almost always + performs (expression) % constant. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mod): + (JSC::JIT::emitSlow_op_mod): + +2009-06-30 Sam Weinig + + Reviewed by Geoffrey Garen. + + Converted some more arithmetic ops to put { tag, payload } in + { regT1, regT0 }. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + +2009-06-30 Geoffrey Garen + + Reviewed by Sam Weinig. + + Converted some more arithmetic ops to put { tag, payload } in + { regT1, regT0 }, and added a case for subtract constant. + + SunSpider says no change. v8 says 0.3% slower. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (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): + +2009-06-30 Gavin Barraclough + + Reviewed by Sam Weinig. + + Remove more uses of addressFor(), load double constants directly from + the constantpool in the CodeBlock, rather than from the register file. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitAdd32Constant): + (JSC::JIT::emitBinaryDoubleOp): + +2009-06-30 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed a bug in postfix ops, where we would treat x = x++ and x = x-- + as a no-op, even if x were not an int, and the ++/-- could have side-effects. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_post_inc): + (JSC::JIT::emitSlow_op_post_inc): + (JSC::JIT::emit_op_post_dec): + (JSC::JIT::emitSlow_op_post_dec): + +2009-06-30 Geoffrey Garen + + Reviewed by Sam Weinig. + + Converted some arithmetic ops to put { tag, payload } in + { regT1, regT0 }. + + SunSpider says 0.7% faster. v8 says no change. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emit_op_lshift): + (JSC::JIT::emit_op_rshift): + (JSC::JIT::emit_op_bitand): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emit_op_bitxor): + * jit/JITInlineMethods.h: + (JSC::JIT::isOperandConstantImmediateInt): + (JSC::JIT::getOperandConstantImmediateInt): + +2009-06-30 Gavin Barraclough + + Reviewed by Sam Weinig. + + Start removing cases of addressFor(). + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emitAdd32Constant): + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_div): + * jit/JITInlineMethods.h: + (JSC::JIT::emitLoadDouble): + (JSC::JIT::emitLoadInt32ToDouble): + (JSC::JIT::emitStoreDouble): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jtrue): + +2009-06-30 Geoffrey Garen + + Rolled back in my last patch with regression fixed. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emit_op_resolve_global): + (JSC::JIT::emitSlow_op_resolve_global): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emitSlow_op_neq): + +2009-06-30 Geoffrey Garen + + Rolled out my last patch because it was a 2% SunSpider regression. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emit_op_resolve_global): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emitSlow_op_neq): + +2009-06-30 Geoffrey Garen + + Reviewed by Gavin "Sam Weinig" Barraclough. + + Standardized the rest of our opcodes to put { tag, payload } in + { regT1, regT0 } where possible. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emit_op_resolve_global): + (JSC::JIT::emitSlow_op_resolve_global): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emitSlow_op_neq): + +2009-06-30 Gavin Barraclough + + Reviewed by Geoffrey Garen. + + Replace calls to store32(tagFor()) and store32(payloadFor()) + with emitStoreInt32(), emitStoreBool(), and emitStoreCell(). + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_negate): + (JSC::JIT::emit_op_lshift): + (JSC::JIT::emit_op_rshift): + (JSC::JIT::emit_op_bitand): + (JSC::JIT::emitBitAnd32Constant): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emitBitOr32Constant): + (JSC::JIT::emit_op_bitxor): + (JSC::JIT::emitBitXor32Constant): + (JSC::JIT::emit_op_bitnot): + (JSC::JIT::emit_op_post_inc): + (JSC::JIT::emit_op_post_dec): + (JSC::JIT::emit_op_pre_inc): + (JSC::JIT::emit_op_pre_dec): + (JSC::JIT::emit_op_add): + (JSC::JIT::emitAdd32Constant): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitSub32ConstantLeft): + (JSC::JIT::emitSub32ConstantRight): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emit_op_div): + (JSC::JIT::emit_op_mod): + * jit/JITCall.cpp: + (JSC::JIT::emit_op_load_varargs): + * jit/JITInlineMethods.h: + (JSC::JIT::emitStoreInt32): + (JSC::JIT::emitStoreCell): + (JSC::JIT::emitStoreBool): + (JSC::JIT::emitStore): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emit_op_not): + (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_eq_null): + (JSC::JIT::emit_op_neq_null): + * jit/JITStubCall.h: + (JSC::JITStubCall::call): + +2009-06-30 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized the rest of the property access instructions to put { tag, + payload } in { regT1, regT0 }. + + Small v8 speedup, 0.2% SunSpider slowdown. + + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitLoad): + (JSC::JIT::emitLoad2): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + (JSC::JIT::emit_op_put_by_id): + (JSC::JIT::emitSlow_op_put_by_id): + (JSC::JIT::patchPutByIdReplace): + +2009-06-29 Sam Weinig + + Reviewed by Gavin Barraclough. + + Various cleanups. + - Use fpRegT* instead of X86::xmm*. + - Use a switch statement in emitBinaryDoubleOp instead of a bunch of + if/elses. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitAdd32Constant): + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_div): + +2009-06-29 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add inline code dealing with doubles for op_jfalse and op_jtrue. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::): + (JSC::MacroAssemblerX86Common::zeroDouble): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jtrue): + +2009-06-28 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized op_get_by_id to put { tag, payload } in { regT1, regT0 }. + + SunSpider and v8 report maybe 0.2%-0.4% regressions, but the optimization + this enables will win much more than that back. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::patchGetByIdSelf): + (JSC::JIT::privateCompilePatchGetArrayLength): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + +2009-06-26 Geoffrey Garen + + Reviewed by Maciej Stachowiak. + + Standardized op_call to put { tag, payload } in { regT1, regT0 }. + + SunSpider and v8 report no change. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallInitializeCallFrame): + (JSC::JIT::compileOpCallSetupArgs): + (JSC::JIT::compileOpConstructSetupArgs): + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::compileOpCall): + (JSC::JIT::compileOpCallSlowCase): + +2009-06-26 Sam Weinig + + Reviewed by Geoffrey Garen. + + Handle multiplying by zero a little better by + inlining the case that both operands are non-negative + into the slowpath. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::branchOr32): + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig. + + Optimize x++ to ++x inside for loops. + + Sadly, no measurable speedup, but this should help with result chaining. + + * parser/Nodes.cpp: + (JSC::ForNode::emitBytecode): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_bitnot): + (JSC::JIT::emit_op_post_inc): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_bitnot): + (JSC::JIT::emit_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): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_negate): + (JSC::JIT::emitSlow_op_negate): + * jit/JITCall.cpp: + (JSC::JIT::emit_op_construct_verify): + (JSC::JIT::emitSlow_op_construct_verify): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig. + + Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_true): + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jtrue): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_eq_null): + (JSC::JIT::emit_op_neq_null): + +2009-06-25 Geoffrey Garen + + Reviewed by Sam Weinig (sort of, maybe). + + Fixed some ASSERTs in http/tests/security. + + These ASSERTs were introduced by http://trac.webkit.org/changeset/45057, + but the underlying problem was actually older. http://trac.webkit.org/changeset/45057 + just exposed the problem by enabling optimization in more cases. + + The ASSERTs fired because we tested PropertySlot::slotBase() for validity, + but slotBase() ASSERTs if it's invalid, so we would ASSERT before + the test could happen. Solution: Remove the ASSERT. Maybe it was valid + once, but it clearly goes against a pattern we've deployed of late. + + The underlying problem was that WebCore would re-use a PropertySlot in + the case of a forwarding access, and the second use would not completely + overwrite the first use. Solution: Make sure to overwrite m_offset when + setting a value on a PropertySlot. (Other values already get implicitly + overwritten during reuse.) + + * runtime/PropertySlot.h: + (JSC::PropertySlot::PropertySlot): + (JSC::PropertySlot::setValueSlot): + (JSC::PropertySlot::setValue): + (JSC::PropertySlot::setRegisterSlot): + (JSC::PropertySlot::setUndefined): + (JSC::PropertySlot::slotBase): + (JSC::PropertySlot::clearOffset): + +2009-06-24 Gavin Barraclough + + Reviewed by Geoff Garen. + + Enable JIT_OPTIMIZE_METHOD_CALLS on the branch, implementation matches current implemenatation in ToT. + + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::emitSlow_op_method_check): + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::compileGetByIdSlowCase): + +2009-06-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Bit off a tiny bit more of standardizing opcode behavior to help with result + caching. + + SunSpider reports no change, v8 maybe a tiny speedup. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emitSlow_op_to_jsnumber): + (JSC::JIT::emit_op_convert_this): + (JSC::JIT::emitSlow_op_convert_this): + +2009-06-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Bit off a tiny bit more of standardizing opcode behavior to help with result + caching -- including removing my old enemy, op_resolve_function, because + it was non-standard, and removing it felt better than helping it limp along. + + SunSpider reports no change, v8 maybe a tiny speedup. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + * bytecode/Opcode.h: + * bytecompiler/BytecodeGenerator.cpp: + * bytecompiler/BytecodeGenerator.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_get_scoped_var): + (JSC::JIT::emit_op_put_scoped_var): + (JSC::JIT::emit_op_to_primitive): + (JSC::JIT::emitSlow_op_to_primitive): + * jit/JITStubs.cpp: + * jit/JITStubs.h: + * parser/Nodes.cpp: + (JSC::FunctionCallResolveNode::emitBytecode): + +2009-06-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Bit off a tiny bit of standardizing opcode behavior to help with result + caching. + + 0.6% SunSpider speedup. 0.3% v8 speedup. + + * jit/JITInlineMethods.h: + (JSC::JIT::emitLoad): Accomodate a base register that overlaps with payload + by loading tag before payload, to avoid stomping base/payload. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_mov): Abide by the standard "tag in regT1, payload in + regT0" semantics. + + (JSC::JIT::emit_op_get_global_var): + (JSC::JIT::emit_op_put_global_var): Ditto. Also, removed some irrelevent + loads while I was at it. The global object's "d" pointer never changes + after construction. + +2009-06-23 Gavin Barraclough + + Reviewed by Sam Weinig. + + Remove 'arguments' field from Register union (again). + This time do so without breaking tests (radical, I know). + + * interpreter/CallFrame.h: + (JSC::ExecState::optionalCalleeArguments): + (JSC::ExecState::setArgumentCount): + (JSC::ExecState::init): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::dumpRegisters): + (JSC::Interpreter::unwindCallFrame): + (JSC::Interpreter::privateExecute): + (JSC::Interpreter::retrieveArguments): + * interpreter/Register.h: + (JSC::Register::withInt): + (JSC::Register::): + (JSC::Register::Register): + (JSC::Register::i): + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_tear_off_arguments): + * runtime/Arguments.h: + (JSC::JSActivation::copyRegisters): + (JSC::Register::arguments): + * runtime/JSActivation.cpp: + (JSC::JSActivation::argumentsGetter): + * runtime/JSActivation.h: + +2009-06-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Removed some result register tracking cruft in preparation for a new + result tracking mechanism. + + SunSpider reports no change. + + * assembler/AbstractMacroAssembler.h: + * assembler/X86Assembler.h: + (JSC::X86Assembler::JmpDst::JmpDst): No need to track jump targets in + machine code; we already do this in bytecode. + + * jit/JIT.cpp: + (JSC::JIT::JIT): + (JSC::JIT::emitTimeoutCheck): Make sure to save and restore the result + registers, so an opcode with a timeout check can still benefit from result + register caching. + + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): Removed calls to killLastResultRegister() + in preparation for something new. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + * jit/JITInlineMethods.h: + (JSC::JIT::emitGetFromCallFrameHeaderPtr): + (JSC::JIT::emitGetFromCallFrameHeader32): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jmp): + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_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_jmp_scopes): ditto + + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): + (JSC::JITStubCall::getArgument): added a mechanism for reloading an argument + you passed to a JIT stub, for use in emitTimeoutCheck. + +2009-06-23 Sam Weinig + + Reviewed by Geoffrey Garen. + + Remove now-useless inplace variants of binary ops. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_bitand): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emit_op_bitxor): + (JSC::JIT::emit_op_add): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emit_op_mul): + +2009-06-23 Sam Weinig + + Reviewed by Geoffrey Garen. + + Move off memory operands to aid in re-enabling result caching. + + - No regression measured. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_negate): + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emit_op_lshift): + (JSC::JIT::emit_op_rshift): + (JSC::JIT::emit_op_bitand): + (JSC::JIT::emitBitAnd32Constant): + (JSC::JIT::emitBitAnd32InPlace): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emitBitOr32Constant): + (JSC::JIT::emitBitOr32InPlace): + (JSC::JIT::emit_op_bitxor): + (JSC::JIT::emitBitXor32Constant): + (JSC::JIT::emitBitXor32InPlace): + (JSC::JIT::emit_op_bitnot): + (JSC::JIT::emit_op_post_inc): + (JSC::JIT::emit_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::emitAdd32InPlace): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlowAdd32Constant): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitSlow_op_sub): + (JSC::JIT::emitSub32ConstantLeft): + (JSC::JIT::emitSub32ConstantRight): + (JSC::JIT::emitSub32InPlaceLeft): + (JSC::JIT::emitSub32InPlaceRight): + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitMul32InPlace): + (JSC::JIT::emit_op_div): + (JSC::JIT::emit_op_mod): + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargs): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emit_op_to_primitive): + (JSC::JIT::emit_op_not): + (JSC::JIT::emit_op_jneq_ptr): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emit_op_to_jsnumber): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + +2009-06-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed some missing and/or misplaced labels in bytecode generation, so + we don't have to work around them in JIT code generation. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitJumpSubroutine): + * parser/Nodes.cpp: + (JSC::TryNode::emitBytecode): + +2009-06-22 Geoffrey Garen + + Reviewed by Sam Weinig. + + For member function calls, emit "this" directly into the "this" slot + for the function call, instead of moving it there later. This reduces + time spent in op_mov during certain calls, like "a.b.c()". + + 1%-2% speedup on v8, mostly richards and delta-blue. + + * parser/Nodes.cpp: + (JSC::FunctionCallDotNode::emitBytecode): + +2009-06-22 Gavin Barraclough + + Reviewed by Sam Weinig. + + Remove 'arguments' field from Register union. Having JSCell derived types in the union is + dangerous since it opens the possibility for the field to be written as a raw pointer but + then read as a JSValue. This will lead to statle data being read for the tag, which may + be dangerous. Having removed Arguments* types form Register, all arguments objects must + always explicitly be stored in the register file as JSValues. + + * interpreter/CallFrame.h: + (JSC::ExecState::optionalCalleeArguments): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + (JSC::Interpreter::privateExecute): + (JSC::Interpreter::retrieveArguments): + * interpreter/Register.h: + (JSC::Register::): + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_tear_off_arguments): + * runtime/Arguments.h: + (JSC::JSActivation::copyRegisters): + * runtime/JSActivation.cpp: + (JSC::JSActivation::argumentsGetter): + * runtime/JSActivation.h: + +2009-06-03 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add back known this value optimization by abstracting + slow case if not JSCell jumps. + + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::compileOpCallVarargsSlowCase): + (JSC::JIT::compileOpCall): + (JSC::JIT::compileOpCallSlowCase): + * jit/JITInlineMethods.h: + (JSC::JIT::emitJumpSlowCaseIfNotJSCell): + (JSC::JIT::linkSlowCaseIfNotJSCell): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emitSlow_op_instanceof): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::emit_op_put_by_id): + (JSC::JIT::emitSlow_op_put_by_id): + +2009-06-01 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed some of the regression in crypto-aes.js. (8.5% speedup in + crypto-aes.js.) + + SunSpider reports no change overall. + + Division was producing double results, which took the slow path through + array access code. + + Strangely, all my attempts at versions of this patch that modified array + access code to accept ints encoded as doubles along the fast or slow paths + were regressions. So I did this instead. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_div): When dividing an int by an int, go ahead and try + to turn the result into an int. Don't just do int division, though, because + testing shows it to be slower than SSE double division, and the corner + cases are pretty complicated / lengthy on top of that. Also, don't try + to canonicalize division of known tiny numerators into ints, since that's a + waste of time. + +2009-05-26 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed a regression caused by my recent fix for NaN. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitBinaryDoubleOp): Actually do the comparison in reverse + order, like the ChangeLog said we would, bokay? + +2009-05-26 Geoffrey Garen + + Reviewed by Sam Weinig and Oliver Hunt. + + Fixed two edge cases in %: + + - Don't do -2147483648 % x as a fast case, since you might do -2147483648 % -1, + which will signal a hardware exception due to overflow. + + - In the case of a zero remainder, be sure to store negative zero if the + dividend was zero. + + SunSpider reports no change. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mod): + (JSC::JIT::emitSlow_op_mod): + +2009-05-25 Geoffrey Garen + + Reviewed by Maciej Stachowiak. + + Fixed a regression when comparing to NaN. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitBinaryDoubleOp): For op_jnless and op_jnless_eq, do the + comparison in reverse order, and jump if the result is below or + below-or-equal. This ensures that we do jump in the case of NaN. + +2009-05-25 Geoffrey Garen + + Reviewed by Oliver Hunt. + + SunSpider says no change. + + Fixed regressions in fast/js/var-declarations-shadowing.html and + fast/js/equality.html, caused by recent == and != optimizations. + + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_eq): Don't treat "compare to string" as always + numeric or string comparison. If the second operand is an object, you + need to ToPrimitive it, and start all over again. Also, I wrote out each + of the possible cases explicitly, to cut down on redundant branching. + +2009-05-25 Sam Weinig + + Reviewed by Mark Rowe. + + Fix bug in fast/js/constant-folding.html where we were not negating + -0 properly. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_negate): + +2009-05-23 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Refactored new slow case codegen for == and !=. + + SunSpider reports no change, maybe a tiny speedup. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emitSlow_op_neq): Made a vptr comparison a *Ptr operation, + instead of *32, to make it portable to 64bit. Reorganized the string + and generic cases to make their control flow a little clearer. + +2009-05-23 Geoffrey Garen + + Reviewed by Maciej Stachowiak. + + Optimized == and != for our new value representation -- especially for strings. + + 14% speedup on date-format-tofte. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_eq): + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emitSlow_op_neq): + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_eq): + (JSC::JITStubs::cti_op_eq_strings): + (JSC::JITStubs::cti_op_call_eval): + * jit/JITStubs.h: + (JSC::): + * runtime/JSValue.h: + +2009-05-22 Sam Weinig + + Reviewed by Gavin Barraclough. + + Fix non-SSE enabled builds. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_add): Don't early return here, we still need to call the JIT stub. + (JSC::JIT::emitSlow_op_sub): Ditto. + +2009-05-22 Geoffrey Garen + + Reviewed by Sam Weinig. + + Here's a thought: let's not take a jit stub call just to multiply by 1, + bokay? + + imul doesn't set the zero flag, so to test for a zero result, we need + an explicit instruction. (Luckily, it does set the overflow flag, so + we can still use that.) + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emitMul32InPlace): + +2009-05-22 Sam Weinig + + Reviewed by Geoffrey "Premature Commit" Garen. + + Add back constant integer cases for op_add. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_add): + (JSC::JIT::emitAdd32Constant): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlowAdd32Constant): + * jit/JITInlineMethods.h: + (JSC::JIT::getConstantOperandImmediateDouble): + (JSC::JIT::isOperandConstantImmediateDouble): + +2009-05-22 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added fast double cases for op_jnless and op_jnlesseq. + + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::JumpList::jumps): New accesor, used by + addSlowCase. + + * assembler/X86Assembler.h: + (JSC::X86Assembler::ucomisd_rm): New method for comparing register to + memory. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitSlow_op_jnlesseq): + (JSC::JIT::emit_op_add): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emit_op_div): Modified emitBinaryDoubleOp to accept comparison/jump + operations in addition to operations with explicit result registers. + + * jit/JITInlineMethods.h: + (JSC::JIT::addSlowCase): Added an "addSlowCase" for JumpLists, so clients + can track multiple jumps to the same slow case condition together. + +2009-05-21 Sam Weinig + + Reviewed by Gavin Barraclough. + + Implement op_negate inline fast cases. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::neg32): + * assembler/X86Assembler.h: + (JSC::X86Assembler::): + (JSC::X86Assembler::negl_m): + (JSC::X86Assembler::xorpd_rr): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_negate): + (JSC::JIT::emitSlow_op_negate): + +2009-05-20 Sam Weinig + + Reviewed by Gavin Barraclough. + + Update the patchOffsetGetByIdSlowCaseCall constant for the + case that OPCODE_SAMPLING is enabled. + + * jit/JIT.h: + +2009-05-20 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added support for inline subtraction of doubles. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitSlow_op_sub): + (JSC::JIT::emitSlowSub32InPlaceLeft): + (JSC::JIT::emitBinaryDoubleOp): + +2009-05-20 Sam Weinig + + Reviewed by Geoffrey Garen. + + Added support for inline division. + + * assembler/X86Assembler.h: + (JSC::X86Assembler::): + (JSC::X86Assembler::divsd_rr): + (JSC::X86Assembler::divsd_mr): + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + * bytecode/Opcode.h: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitBinaryOp): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_div): + (JSC::JIT::emitSlow_op_div): + +2009-05-20 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added support for inline addition of doubles. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_add): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlowAdd32InPlace): + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + +2009-05-20 Geoffrey Garen + + Reviewed by Sam Weinig. + + Factored inline double operations into a helper function, so that we + can reuse this code for other math operations. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_mul): + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallInitializeCallFrame): + +2009-05-20 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added support for inline multiplication of doubles. + + * assembler/X86Assembler.h: + (JSC::X86Assembler::cvtsi2sd_mr): New function, useful for loading an + int32 into a double register. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): Filled out these cases for double arithmetic. + + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::addressFor): New function, useful for addressing a JSValue's + full 64bits as a double. + +2009-05-19 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement and enable optimized calls. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): Add ENABLE(JIT_OPTIMIZE_CALL) guards + around the the optimize call only trampolines (virtualCallPreLink and virtualCallLink). + Update the trampolines to account for the new JSValue representation. + (JSC::JIT::unlinkCall): Use NULL instead of JSValue noValue. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): Update to account for the new JSValue representation + (JSC::JIT::compileOpCallSlowCase): Ditto. + + * jit/JITStubs.h: Remove incorrect !ENABLE(JIT_OPTIMIZE_CALL) guard. + + * wtf/Platform.h: Enable ENABLE_JIT_OPTIMIZE_CALL. + +2009-05-19 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement and enable optimized property access. + + * assembler/AbstractMacroAssembler.h: Fix comment. + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): Remove array length trampoline + and implement the string length trampoline. + * jit/JIT.h: Add new constants for patch offsets. + * jit/JITInlineMethods.h: Remove FIELD_OFFSET which is now in StdLibExtras.h. + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::emit_op_put_by_id): + (JSC::JIT::emitSlow_op_put_by_id): + (JSC::JIT::compilePutDirectOffset): + (JSC::JIT::compileGetDirectOffset): + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::patchGetByIdSelf): + (JSC::JIT::patchPutByIdReplace): + (JSC::JIT::privateCompilePatchGetArrayLength): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + * jit/JITStubCall.h: + (JSC::JITStubCall::addArgument): Add version of addArgument that takes + two registers for the tag and payload. + * jit/JITStubs.cpp: + (JSC::JITStubs::JITStubs): Remove array length trampoline pointer. + (JSC::JITStubs::cti_op_get_by_id_self_fail): + * jit/JITStubs.h: + * runtime/JSObject.h: + (JSC::JSObject::JSObject): Move m_inheritorID below the property storage + to align it to a 16 byte boundary. + * wtf/Platform.h: Enable ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS + * wtf/StdLibExtras.h: Move FIELD_OFFSET here. + +2009-05-17 Sam Weinig + + Reviewed by Geoffrey Garen. + + Remove unneeded ExecState parameter from the number JSValue constructors. + + * runtime/JSValue.h: + (JSC::jsNumber): + (JSC::jsNaN): + (JSC::JSValue::JSValue): + +2009-05-15 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implemented fast path for op_put_by_val when putting to arrays. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + +2009-05-15 Geoffrey Garen (Mostly by Sam) + + Reviewed by Sam Weinig. + + Implemented fast path for op_get_by_val when accessing array. + + * jit/JIT.cpp: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed a failure in fast/js/math-transforms.html caused by failing to + preserve -0 in multiplication. + + * assembler/X86Assembler.h: + (JSC::X86Assembler::jz): + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emitMul32Constant): + (JSC::JIT::emitMul32InPlace): Check both for overflow and for zero when + doing multiplication. Use a slow case to get these right. + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed a bug in the varargs calling convention. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargs): Move the argument count into regT1, + since that's where ctiVirtualCall expects it to be. + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed a small bug in instanceof's looping code. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): NULL means the object has no prototype, + so only loop when *not* equal to NULL. + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed a small bug in instanceof's result writing code. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): Make sure to fill out the payload bits + in all cases. + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + Removed an invalid assertion in cti_op_urshift which + depended on a fast path for op_urshift which has + never existed. + + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_urshift): + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed loop_if_true, which had the same reversed test that jtrue had. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_true): + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + In op_neq, we apparently want to check that one value + does *not* equal another. Go figure. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_neq): + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + The slow case of op_mod should call op_mod's jit stub, + not op_mul. That would be dumb. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_mod): + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed problems when using 'arguments' due to a half-initialized register. + + * interpreter/CallFrame.h: + (JSC::ExecState::setCalleeArguments): + (JSC::ExecState::init): Require a full JSValue when setting up the + 'arguments' virtual register, since this register is accessible from JIT + code and bytecode, and needs to be a true JSValue. + + * interpreter/CallFrameClosure.h: + (JSC::CallFrameClosure::resetCallFrame): ditto + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): ditto + + * interpreter/Register.h: Removed the constructor that allowed assignment + of a JSArguments* to a register. That is not safe. See above. + + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_create_arguments): + (JSC::JITStubs::cti_op_create_arguments_no_params): ditto + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + We really want to go to the slow case in op_jfalse and + op_jtrue if the value is *not* boolean. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jtrue): + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + Flipped the condition when emitting a an op_loop_if_less or op_loop_if_lesseq + if the first operand is a constant. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + Added missing return in op_jnless and op_jnlesseq. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + +2009-05-14 Sam Weinig + + Reviewed by Geoffrey Garen. + + Load constants into the the register file as a temporary measure to + aid bring up. This allows us to use to treat constants like any + other virtual register. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_enter): + (JSC::JIT::emit_op_enter_with_activation): + +2009-05-14 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented op_strict_eq. Original patch by Snowy, by way of Sam and Gavin. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::set8): Added set8, since it's slightly + faster than set32, and the new value representation usually doesn't + need set32. + + * jit/JIT.cpp: + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitLoadTag): + (JSC::JIT::emitLoadPayload): Added helper functions for dealing with + constants. Eventually, we should write special cases for all constants, + but these are helpful in the short term. + + * jit/JITOpcodes.cpp: + (JSC::JIT::compileOpStrictEq): + (JSC::JIT::emitSlow_op_stricteq): + (JSC::JIT::emitSlow_op_nstricteq): teh opcodez. + + * runtime/JSValue.h: + (JSC::JSValue::): + (JSC::JSValue::isDouble): Added a LowestTag for clarity. + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fixed some bugs in host function calls. + + testapi now passes! + + * jit/JIT.cpp: Changed some registers around to avoid overwriting edx:eax, + which is how JSValues are now returned. Also changed the code that + passes thisValue to pass the full 64bits of the value. Also added + an #error compiler directive to other platform builds, since the JSValue + return signature probably won't return in edx:eax on those platforms, + and we'll have to investigate a solution. + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Removed parameters from functions that are intended never to use their + parameters. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Ported op_instance_of from TOT. It's basically the same, but some register + stuff changed to memory stuff. + + * jit/JITInlineMethods.h: + (JSC::JIT::emitPutJITStubArgFromVirtualRegister): + (JSC::JIT::emitStore): Changed to use helper functions. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emitSlow_op_instanceof): Ported from TOT. + +2009-05-13 Geoffrey Garen + + Reviewed by Gavin Barraclough. + + Added a comment to explain an exception-handling subtelty that we found + hard to remember when reviewing my last patch. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_catch): + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented try/catch. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_throw): Updated to use JITStackFrame abstraction. + (JSC::JIT::emit_op_catch): Filled out. + +2009-05-13 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implemented op_loop_if_true, op_jfalse, op_jtrue, op_jeq_null and op_jneq_null + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_instanceof): Moved from below to be next to its + fast brother. + + (JSC::JIT::emit_op_loop_if_true): Similar to the old version + in that it tries to do the integer case first and reduce the + number of jumps you might need to take. + (JSC::JIT::emitSlow_op_loop_if_true): + + (JSC::JIT::emit_op_jfalse): Very similar to op_loop_if_true, only + the inverse and without a timeout check. + (JSC::JIT::emitSlow_op_jfalse): + + (JSC::JIT::emit_op_jtrue): Very similar to op_loop_if_true except + without the timeout check. + (JSC::JIT::emitSlow_op_jtrue): + + (JSC::JIT::emit_op_jeq_null): Very similar to the implementation + of op_eq, except it takes jumps instead of copying the condition + to a dst. + (JSC::JIT::emit_op_jneq_null): Ditto but for op_neq. + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented op_call_varargs. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::emit_op_call): + (JSC::JIT::emit_op_call_eval): + (JSC::JIT::emit_op_load_varargs): + (JSC::JIT::emit_op_call_varargs): + (JSC::JIT::emit_op_construct): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jneq_ptr): + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented op_call_eval. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpCall): + * jit/JITStubCall.h: + (JSC::CallEvalJITStub::CallEvalJITStub): + +2009-05-13 Sam Weinig + + Reviewed by Gavin Barraclough. + + Implemented op_not. (Gavin did most of the work!) + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_not): + (JSC::JIT::emitSlow_op_not): + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Implemented op_global_resolve. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): Added back accidentally removed + early returns. + + (JSC::JIT::emit_op_resolve_global): + * jit/JITStubs.cpp: + (JSC::JITStubs::cti_op_resolve_global): Pretty similar to the old code, + but we need two reads and a TimesEight step in order to account for the + 64bit value size. + + * jit/JITStubs.h: + (JSC::): Slightly tweaked this code to specialize for a JSGlobalObject*, + to avoid having to pass an irrelevant tag pointer to the stub. + +2009-05-13 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implemented op_to_jsnumber. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emitSlow_op_to_jsnumber): + +2009-05-13 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implemented op_convert_this. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_convert_this): + (JSC::JIT::emitSlow_op_convert_this): + +2009-05-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Got basic JS function and constructor calls working. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallSetupArgs): + (JSC::JIT::compileOpCallVarargsSetupArgs): + (JSC::JIT::compileOpConstructSetupArgs): + (JSC::JIT::emit_op_ret): + (JSC::JIT::emit_op_construct_verify): + (JSC::JIT::emitSlow_op_construct_verify): + (JSC::JIT::emitSlow_op_call): + (JSC::JIT::emitSlow_op_call_eval): + (JSC::JIT::emitSlow_op_call_varargs): + (JSC::JIT::emitSlow_op_construct): + (JSC::JIT::compileOpCall): Filled out these cases, with call_eval #if'd out. + + * jit/JITInlineMethods.h: + (JSC::JIT::emitPutJITStubArgFromVirtualRegister): + (JSC::JIT::emitLoad): Restored some legacy "*CTIArg*" functions, + since I wanted to avoid the complexity of revamping the API here while + trying to bring it up. Eventually, we should re-remove all of these functions. + + (JSC::JIT::recordJumpTarget): Removed unnecessary macro cruft. You will + not silence me, Sam Weinig! The world will know that you are a crufty, + crufty, crufty programmer!!! + + * jit/JITOpcodes.cpp: + * jit/JITStubs.cpp: + (JSC::): + * jit/JITStubs.h: Changed up some offsets in the JITStackFrame class, since + and off-by-one error was causing stack misalignment. + +2009-05-13 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement op_eq_null and op_neq_null. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::set8): + (JSC::MacroAssemblerX86Common::setTest8): + * jit/JITOpcodes.cpp: + (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.cpp: + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement op_new_error. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_new_error): + * jit/JITStubCall.h: + (JSC::JITStubCall::addArgument): Add a version of addArgument + that takes a constant JSValue. + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Remove now unused emitGetVariableObjectRegister and emitPutVariableObjectRegister. + + * jit/JIT.cpp: + * jit/JIT.h: + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement op_to_primitive and op_next_pname. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_construct_verify): + (JSC::JIT::emit_op_to_primitive): + (JSC::JIT::emitSlow_op_to_primitive): + (JSC::JIT::emitSlow_op_loop_if_true): + (JSC::JIT::emit_op_jtrue): + (JSC::JIT::emit_op_next_pname): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add op_get_global_var, op_put_global_var, emit_op_get_scoped_var, emit_op_put_scoped_var and + op_unexpected_load. + + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::tagFor): + (JSC::JIT::payloadFor): + (JSC::JIT::emitLoad): + (JSC::JIT::emitStore): + (JSC::JIT::emitLoadReturnValue): + * jit/JITOpcodes.cpp: + (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_unexpected_load): + +2009-05-12 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added overflow handling to op_sub. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_sub): + (JSC::JIT::emitSlowSub32InPlaceLeft): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Remove a function call by folding op_get_by_id and op_put_by_id into + their respective compile functions. + + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::emit_op_put_by_id): + (JSC::JIT::emitSlow_op_put_by_id): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Make JITStubCall work in 64bit by making the stack index + step dependent on the size of void*. + + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): + (JSC::JITStubCall::addArgument): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement simple version of property access opcodes + which just call a stub functions. + + * jit/JITOpcodes.cpp: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emitSlow_op_put_by_id): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + (JSC::JIT::emit_op_put_by_index): + (JSC::JIT::emit_op_put_getter): + (JSC::JIT::emit_op_put_setter): + (JSC::JIT::emit_op_del_by_id): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compilePutByIdHotPath): + * jit/JITStubCall.h: + (JSC::JITStubCall::addArgument): + * jsc.cpp: + +2009-05-12 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added work-around for XCode debugging echo problem. + + * jsc.cpp: + (runInteractive): + +2009-05-12 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added overflow handling to op_add. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlowAdd32InPlace): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add slow cases for op_jnless or emit_op_jnlesseq. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emitSlow_op_jnlesseq): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add implementations for op_jnless, emit_op_jnlesseq, op_loop_if_less and op_loop_if_lesseq. + No slow cases for op_jnless or emit_op_jnlesseq yet. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitSlow_op_jnlesseq): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emitSlow_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emitSlow_op_loop_if_lesseq): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Turn the RECORD_JUMP_TARGET macro into an inline function. + + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::recordJumpTarget): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jmp): + (JSC::JIT::emit_op_jsr): + (JSC::JIT::emit_op_jmp_scopes): + +2009-05-12 Sam Weinig + + Add MacroAssemblerX86Common::set8 to fix the build. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::set8): + +2009-05-12 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added overflow recovery for pre_inc and pre_dec. + + Turned some short-circuit code into early returns, as is the WebKit style. + + * jit/JITArithmetic.cpp: + (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::emitSlow_op_pre_inc): + (JSC::JIT::emitSlow_op_pre_dec): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement op_jmp, op_loop, op_eq and op_neq. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jmp): + (JSC::JIT::emit_op_loop): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emitSlow_op_eq): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emitSlow_op_neq): + (JSC::JIT::emit_op_enter): + (JSC::JIT::emit_op_enter_with_activation): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement the slow cases for arithmetic opcodes. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_lshift): + (JSC::JIT::emitSlow_op_rshift): + (JSC::JIT::emitSlow_op_bitand): + (JSC::JIT::emitSlow_op_bitor): + (JSC::JIT::emitSlow_op_bitxor): + (JSC::JIT::emitSlow_op_bitnot): + (JSC::JIT::emitSlow_op_sub): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emitSlow_op_mod): + (JSC::JIT::emit_op_mod): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Implement op_bitnot. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::not32): + * assembler/X86Assembler.h: + (JSC::X86Assembler::notl_m): + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_bitnot): + +2009-05-12 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add arithmetic opcode implementations from the old nitro-extreme branch. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (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::emitBitAnd32Constant): + (JSC::JIT::emitBitAnd32InPlace): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emitSlow_op_bitor): + (JSC::JIT::emitBitOr32Constant): + (JSC::JIT::emitBitOr32InPlace): + (JSC::JIT::emit_op_bitxor): + (JSC::JIT::emitSlow_op_bitxor): + (JSC::JIT::emitBitXor32Constant): + (JSC::JIT::emitBitXor32InPlace): + (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::emitAdd32InPlace): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emit_op_sub): + (JSC::JIT::emitSlow_op_sub): + (JSC::JIT::emitSub32ConstantLeft): + (JSC::JIT::emitSub32ConstantRight): + (JSC::JIT::emitSub32InPlaceLeft): + (JSC::JIT::emitSub32InPlaceRight): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emitSlow_op_mul): + (JSC::JIT::emitMul32Constant): + (JSC::JIT::emitMul32InPlace): + (JSC::JIT::emit_op_mod): + (JSC::JIT::emitSlow_op_mod): + * jit/JITOpcodes.cpp: + +2009-05-12 Geoffrey Garen + + Removed JIT_OPTIMIZE_ARITHMETIC setting, since it was all about 32bit + value representations. + + Added JSAPIValueWrapper to the repository. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + * runtime/JSAPIValueWrapper.cpp: Added. + (JSC::JSAPIValueWrapper::toPrimitive): + (JSC::JSAPIValueWrapper::getPrimitiveNumber): + (JSC::JSAPIValueWrapper::toBoolean): + (JSC::JSAPIValueWrapper::toNumber): + (JSC::JSAPIValueWrapper::toString): + (JSC::JSAPIValueWrapper::toObject): + * runtime/JSAPIValueWrapper.h: Added. + (JSC::JSAPIValueWrapper::value): + (JSC::JSAPIValueWrapper::isAPIValueWrapper): + (JSC::JSAPIValueWrapper::JSAPIValueWrapper): + (JSC::jsAPIValueWrapper): + * wtf/Platform.h: + +2009-05-12 Geoffrey Garen + + Turned on the JIT and got it building and running the most trivial of + programs. + + All configurable optimizations are turned off, and a few opcodes are ad + hoc #if'd out. + + So far, I've only merged op_mov and op_end, but some stub-reliant + opcodes work as-is from TOT. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::~CodeBlock): + * bytecode/CodeBlock.h: + * jit/JIT.cpp: + (JSC::JIT::compileOpStrictEq): + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_lshift): + (JSC::JIT::emitSlow_op_lshift): + (JSC::JIT::emit_op_rshift): + (JSC::JIT::emitSlow_op_rshift): + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitSlow_op_jnlesseq): + (JSC::JIT::emit_op_bitand): + (JSC::JIT::emitSlow_op_bitand): + (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_mod): + (JSC::JIT::emitSlow_op_mod): + (JSC::JIT::emit_op_add): + (JSC::JIT::emit_op_mul): + (JSC::JIT::emit_op_sub): + (JSC::JIT::compileBinaryArithOpSlowCase): + (JSC::JIT::emitSlow_op_add): + (JSC::JIT::emitSlow_op_mul): + * jit/JITCall.cpp: + (JSC::JIT::compileOpCallInitializeCallFrame): + (JSC::JIT::compileOpConstructSetupArgs): + (JSC::JIT::compileOpCallVarargs): + (JSC::JIT::compileOpCall): + (JSC::JIT::compileOpCallSlowCase): + * jit/JITInlineMethods.h: + (JSC::JIT::getConstantOperandImmediateInt): + (JSC::JIT::isOperandConstantImmediateInt): + (JSC::JIT::emitInitRegister): + (JSC::JIT::addSlowCase): + (JSC::JIT::addJump): + (JSC::JIT::emitJumpSlowToHot): + (JSC::JIT::tagFor): + (JSC::JIT::payloadFor): + (JSC::JIT::emitLoad): + (JSC::JIT::emitLoadReturnValue): + (JSC::JIT::emitStore): + (JSC::JIT::emitStoreReturnValue): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_mov): + (JSC::JIT::emit_op_end): + (JSC::JIT::emit_op_jmp): + (JSC::JIT::emit_op_loop): + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emit_op_instanceof): + (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_ret): + (JSC::JIT::emit_op_construct_verify): + (JSC::JIT::emit_op_to_primitive): + (JSC::JIT::emit_op_loop_if_true): + (JSC::JIT::emit_op_resolve_global): + (JSC::JIT::emit_op_not): + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_jneq_ptr): + (JSC::JIT::emit_op_unexpected_load): + (JSC::JIT::emit_op_eq): + (JSC::JIT::emit_op_bitnot): + (JSC::JIT::emit_op_jtrue): + (JSC::JIT::emit_op_neq): + (JSC::JIT::emit_op_bitxor): + (JSC::JIT::emit_op_bitor): + (JSC::JIT::emit_op_throw): + (JSC::JIT::emit_op_next_pname): + (JSC::JIT::emit_op_push_scope): + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emit_op_push_new_scope): + (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_eq_null): + (JSC::JIT::emit_op_neq_null): + (JSC::JIT::emit_op_convert_this): + (JSC::JIT::emit_op_profile_will_call): + (JSC::JIT::emit_op_profile_did_call): + (JSC::JIT::emitSlow_op_construct_verify): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emitSlow_op_loop_if_less): + (JSC::JIT::emitSlow_op_loop_if_lesseq): + (JSC::JIT::emitSlow_op_put_by_val): + (JSC::JIT::emitSlow_op_not): + (JSC::JIT::emitSlow_op_instanceof): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emit_op_put_by_index): + (JSC::JIT::emit_op_put_getter): + (JSC::JIT::emit_op_put_setter): + (JSC::JIT::emit_op_del_by_id): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compilePutByIdHotPath): + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): + (JSC::JITStubCall::addArgument): + (JSC::JITStubCall::call): + (JSC::JITStubCall::): + (JSC::CallEvalJITStub::CallEvalJITStub): + * jit/JITStubs.cpp: + (JSC::): + (JSC::JITStubs::cti_op_add): + (JSC::JITStubs::cti_op_pre_inc): + (JSC::JITStubs::cti_op_mul): + (JSC::JITStubs::cti_op_get_by_val): + (JSC::JITStubs::cti_op_get_by_val_string): + (JSC::JITStubs::cti_op_get_by_val_byte_array): + (JSC::JITStubs::cti_op_sub): + (JSC::JITStubs::cti_op_put_by_val): + (JSC::JITStubs::cti_op_put_by_val_array): + (JSC::JITStubs::cti_op_put_by_val_byte_array): + (JSC::JITStubs::cti_op_negate): + (JSC::JITStubs::cti_op_div): + (JSC::JITStubs::cti_op_pre_dec): + (JSC::JITStubs::cti_op_post_inc): + (JSC::JITStubs::cti_op_eq): + (JSC::JITStubs::cti_op_lshift): + (JSC::JITStubs::cti_op_bitand): + (JSC::JITStubs::cti_op_rshift): + (JSC::JITStubs::cti_op_bitnot): + (JSC::JITStubs::cti_op_mod): + (JSC::JITStubs::cti_op_neq): + (JSC::JITStubs::cti_op_post_dec): + (JSC::JITStubs::cti_op_urshift): + (JSC::JITStubs::cti_op_bitxor): + (JSC::JITStubs::cti_op_bitor): + (JSC::JITStubs::cti_op_switch_imm): + * jit/JITStubs.h: + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + * runtime/JSFunction.cpp: + (JSC::JSFunction::~JSFunction): + * runtime/JSValue.h: + (JSC::JSValue::payload): + * wtf/Platform.h: + +2009-05-07 Sam Weinig + + Reviewed by Geoffrey Garen. + + Add some new MacroAssembler and assembler functions that will be needed shortly. + + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::add32): + (JSC::MacroAssemblerX86Common::and32): + (JSC::MacroAssemblerX86Common::mul32): + (JSC::MacroAssemblerX86Common::neg32): + (JSC::MacroAssemblerX86Common::or32): + (JSC::MacroAssemblerX86Common::sub32): + (JSC::MacroAssemblerX86Common::xor32): + (JSC::MacroAssemblerX86Common::branchAdd32): + (JSC::MacroAssemblerX86Common::branchMul32): + (JSC::MacroAssemblerX86Common::branchSub32): + * assembler/X86Assembler.h: + (JSC::X86Assembler::): + (JSC::X86Assembler::addl_rm): + (JSC::X86Assembler::andl_mr): + (JSC::X86Assembler::andl_rm): + (JSC::X86Assembler::andl_im): + (JSC::X86Assembler::negl_r): + (JSC::X86Assembler::notl_r): + (JSC::X86Assembler::orl_rm): + (JSC::X86Assembler::orl_im): + (JSC::X86Assembler::subl_rm): + (JSC::X86Assembler::xorl_mr): + (JSC::X86Assembler::xorl_rm): + (JSC::X86Assembler::xorl_im): + (JSC::X86Assembler::imull_mr): + +2009-05-11 Sam Weinig + + Reviewed by Cameron Zwarich. + + Remove the NumberHeap. + + * JavaScriptCore.exp: + * runtime/Collector.cpp: + (JSC::Heap::Heap): + (JSC::Heap::destroy): + (JSC::Heap::recordExtraCost): + (JSC::Heap::heapAllocate): + (JSC::Heap::markConservatively): + (JSC::Heap::sweep): + (JSC::Heap::collect): + (JSC::Heap::objectCount): + (JSC::Heap::statistics): + (JSC::typeName): + (JSC::Heap::isBusy): + * runtime/Collector.h: + (JSC::Heap::globalData): + * runtime/JSCell.h: + +2009-05-11 Geoffrey Garen + + Reviewed by Sam Weinig. + + Land initial commit of new number representation for 32 bit platforms, + with JIT disabled. + + * API/APICast.h: + (toJS): + (toRef): + * API/JSCallbackObjectFunctions.h: + (JSC::::hasInstance): + (JSC::::toNumber): + (JSC::::toString): + * API/tests/testapi.c: + (EvilExceptionObject_convertToType): + * AllInOneFile.cpp: + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + (JSC::valueToSourceString): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitLoad): + (JSC::BytecodeGenerator::emitUnexpectedLoad): + (JSC::keyForImmediateSwitch): + * bytecompiler/BytecodeGenerator.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::dumpRegisters): + (JSC::Interpreter::privateExecute): + * parser/Nodes.cpp: + (JSC::ArrayNode::emitBytecode): + (JSC::processClauseList): + * runtime/ArgList.h: + * runtime/Collector.h: + (JSC::sizeof): + * runtime/DateMath.cpp: + * runtime/ExceptionHelpers.h: + * runtime/InitializeThreading.cpp: + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + * runtime/JSCell.cpp: + * runtime/JSCell.h: + (JSC::JSCell::isAPIValueWrapper): + (JSC::JSValue::isString): + (JSC::JSValue::isGetterSetter): + (JSC::JSValue::isObject): + (JSC::JSValue::getString): + (JSC::JSValue::getObject): + (JSC::JSValue::getCallData): + (JSC::JSValue::getConstructData): + (JSC::JSValue::getUInt32): + (JSC::JSValue::marked): + (JSC::JSValue::toPrimitive): + (JSC::JSValue::getPrimitiveNumber): + (JSC::JSValue::toBoolean): + (JSC::JSValue::toNumber): + (JSC::JSValue::toString): + (JSC::JSValue::needsThisConversion): + (JSC::JSValue::toThisString): + (JSC::JSValue::getJSNumber): + (JSC::JSValue::toObject): + (JSC::JSValue::toThisObject): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * runtime/JSGlobalObject.h: + (JSC::Structure::prototypeForLookup): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncParseInt): + * runtime/JSImmediate.h: + * runtime/JSNumberCell.cpp: Removed. + * runtime/JSNumberCell.h: Removed. + * runtime/JSObject.h: + (JSC::JSValue::get): + (JSC::JSValue::put): + * runtime/JSString.h: + (JSC::JSValue::toThisJSString): + * runtime/JSValue.cpp: + (JSC::JSValue::toInteger): + (JSC::JSValue::toIntegerPreserveNaN): + (JSC::JSValue::toObjectSlowCase): + (JSC::JSValue::toThisObjectSlowCase): + (JSC::JSValue::synthesizeObject): + (JSC::JSValue::synthesizePrototype): + (JSC::JSValue::description): + (JSC::nonInlineNaN): + * runtime/JSValue.h: + (JSC::JSValue::): + (JSC::EncodedJSValueHashTraits::emptyValue): + (JSC::jsNaN): + (JSC::operator==): + (JSC::operator!=): + (JSC::toInt32): + (JSC::toUInt32): + (JSC::JSValue::encode): + (JSC::JSValue::decode): + (JSC::JSValue::JSValue): + (JSC::JSValue::operator bool): + (JSC::JSValue::operator==): + (JSC::JSValue::operator!=): + (JSC::JSValue::isUndefined): + (JSC::JSValue::isNull): + (JSC::JSValue::isUndefinedOrNull): + (JSC::JSValue::isCell): + (JSC::JSValue::isInt32): + (JSC::JSValue::isUInt32): + (JSC::JSValue::isDouble): + (JSC::JSValue::isTrue): + (JSC::JSValue::isFalse): + (JSC::JSValue::tag): + (JSC::JSValue::asInt32): + (JSC::JSValue::asUInt32): + (JSC::JSValue::asDouble): + (JSC::JSValue::asCell): + (JSC::JSValue::isNumber): + (JSC::JSValue::isBoolean): + (JSC::JSValue::getBoolean): + (JSC::JSValue::uncheckedGetNumber): + (JSC::JSValue::toJSNumber): + (JSC::JSValue::getNumber): + (JSC::JSValue::toInt32): + (JSC::JSValue::toUInt32): + * runtime/Operations.h: + (JSC::JSValue::equal): + (JSC::JSValue::equalSlowCaseInline): + (JSC::JSValue::strictEqual): + (JSC::JSValue::strictEqualSlowCaseInline): + (JSC::jsLess): + (JSC::jsLessEq): + (JSC::jsAdd): + * runtime/PropertySlot.h: + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncCharAt): + (JSC::stringProtoFuncCharCodeAt): + (JSC::stringProtoFuncIndexOf): + * wtf/Platform.h: + +=== Start merge of nitro-extreme branch 2009-07-30 === + +2009-07-29 Laszlo Gombos + + Reviewed by George Staikos. + + Resolve class/struct mixup in forward declarations + https://bugs.webkit.org/show_bug.cgi?id=27708 + + * API/JSClassRef.h: + * bytecode/SamplingTool.h: + * interpreter/Interpreter.h: + * jit/JIT.h: + * profiler/ProfileGenerator.h: + * profiler/Profiler.h: + * runtime/ClassInfo.h: + * runtime/ExceptionHelpers.h: + * runtime/JSByteArray.h: + * runtime/JSCell.h: + * runtime/JSFunction.h: + * runtime/JSGlobalData.h: + * runtime/JSObject.h: + * runtime/JSString.h: + +2009-07-28 Ada Chan + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27236 + - Implement TCMalloc_SystemRelease and TCMalloc_SystemCommit for Windows. + - Use a background thread to periodically scavenge memory to release back to the system. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::init): + (WTF::TCMalloc_PageHeap::runScavengerThread): + (WTF::TCMalloc_PageHeap::scavenge): + (WTF::TCMalloc_PageHeap::shouldContinueScavenging): + (WTF::TCMalloc_PageHeap::New): + (WTF::TCMalloc_PageHeap::AllocLarge): + (WTF::TCMalloc_PageHeap::Delete): + (WTF::TCMalloc_PageHeap::GrowHeap): + (WTF::sleep): + (WTF::TCMalloc_PageHeap::scavengerThread): + * wtf/TCSystemAlloc.cpp: + (TCMalloc_SystemRelease): + (TCMalloc_SystemCommit): + * wtf/TCSystemAlloc.h: + 2009-07-28 Xan Lopez Add new files, fixes distcheck. @@ -429,8 +7690,6 @@ 2009-07-20 Oliver Hunt - Reviewed by NOBODY (Build fix). - Build fix attempt #2 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: @@ -438,8 +7697,6 @@ 2009-07-20 Oliver Hunt - Reviewed by NOBODY (Build fix). - Build fix attempt #1 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: @@ -1455,8 +8712,6 @@ 2009-07-09 Oliver Hunt - Reviewed by NOBODY (Build fix). - * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): @@ -2091,8 +9346,6 @@ 2009-06-21 Oliver Hunt - Reviewed by NOBODY (Build fix). - Remove dead code. * runtime/LiteralParser.cpp: diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi index 5a75ab7..15a0c0f 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi @@ -255,6 +255,7 @@ 'runtime/JSString.cpp', 'runtime/JSString.h', 'runtime/JSType.h', + 'runtime/JSTypeInfo.h', 'runtime/JSValue.cpp', 'runtime/JSValue.h', 'runtime/JSVariableObject.cpp', @@ -265,6 +266,9 @@ 'runtime/LiteralParser.h', 'runtime/Lookup.cpp', 'runtime/Lookup.h', + 'runtime/MarkStack.cpp', + 'runtime/MarkStack.h', + 'runtime/MarkStackWin.cpp', 'runtime/MathObject.cpp', 'runtime/MathObject.h', 'runtime/NativeErrorConstructor.cpp', @@ -284,6 +288,8 @@ 'runtime/ObjectPrototype.h', 'runtime/Operations.cpp', 'runtime/Operations.h', + 'runtime/PropertyDescriptor.cpp', + 'runtime/PropertyDescriptor.h', 'runtime/PropertyMapHashTable.h', 'runtime/PropertyNameArray.cpp', 'runtime/PropertyNameArray.h', @@ -323,7 +329,6 @@ 'runtime/TimeoutChecker.cpp', 'runtime/TimeoutChecker.h', 'runtime/Tracing.h', - 'runtime/JSTypeInfo.h', 'runtime/UString.cpp', 'runtime/UString.h', 'wrec/CharacterClass.cpp', diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 85645be..8483469 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -50,12 +50,7 @@ win32-* { } } -win32-msvc*: INCLUDEPATH += $$PWD/os-win32 -wince* { - INCLUDEPATH += $$PWD/os-wince - INCLUDEPATH += $$PWD/os-win32 - SOURCES += $$PWD/os-wince/ce_time.cpp -} +wince*: SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp include(pcre/pcre.pri) @@ -105,11 +100,13 @@ SOURCES += \ runtime/JSNotAnObject.cpp \ runtime/JSONObject.cpp \ runtime/LiteralParser.cpp \ + runtime/MarkStack.cpp \ runtime/TimeoutChecker.cpp \ bytecode/CodeBlock.cpp \ bytecode/StructureStubInfo.cpp \ bytecode/JumpTable.cpp \ assembler/ARMAssembler.cpp \ + assembler/MacroAssemblerARM.cpp \ jit/JIT.cpp \ jit/JITCall.cpp \ jit/JITArithmetic.cpp \ @@ -128,8 +125,13 @@ SOURCES += \ yarr/RegexJIT.cpp \ interpreter/RegisterFile.cpp -win32-*|wince*: SOURCES += jit/ExecutableAllocatorWin.cpp -else: SOURCES += jit/ExecutableAllocatorPosix.cpp +win32-*|wince* { + SOURCES += jit/ExecutableAllocatorWin.cpp \ + runtime/MarkStackWin.cpp +} else { + SOURCES += jit/ExecutableAllocatorPosix.cpp \ + runtime/MarkStackPosix.cpp +} # AllInOneFile.cpp helps gcc analize and optimize code # Other compilers may be able to do this at link time @@ -159,6 +161,7 @@ SOURCES += \ runtime/ErrorInstance.cpp \ runtime/ErrorPrototype.cpp \ interpreter/CallFrame.cpp \ + runtime/Executable.cpp \ runtime/FunctionConstructor.cpp \ runtime/FunctionPrototype.cpp \ runtime/GetterSetter.cpp \ @@ -167,6 +170,7 @@ SOURCES += \ runtime/InternalFunction.cpp \ runtime/Completion.cpp \ runtime/JSArray.cpp \ + runtime/JSAPIValueWrapper.cpp \ runtime/JSByteArray.cpp \ runtime/JSCell.cpp \ runtime/JSFunction.cpp \ @@ -192,6 +196,7 @@ SOURCES += \ runtime/Operations.cpp \ parser/Parser.cpp \ parser/ParserArena.cpp \ + runtime/PropertyDescriptor.cpp \ runtime/PropertyNameArray.cpp \ runtime/PropertySlot.cpp \ runtime/PrototypeFunction.cpp \ @@ -216,8 +221,7 @@ SOURCES += \ wtf/DateMath.cpp \ wtf/FastMalloc.cpp \ wtf/Threading.cpp \ - wtf/qt/MainThreadQt.cpp \ - parser/SourcePoolQt.cpp + wtf/qt/MainThreadQt.cpp !contains(DEFINES, ENABLE_SINGLE_THREADED=1) { SOURCES += wtf/qt/ThreadingQt.cpp diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro new file mode 100644 index 0000000..0cd2e1a --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro @@ -0,0 +1,69 @@ +# JavaScriptCore - qmake build info +CONFIG += building-libs +include($$PWD/../WebKit.pri) + +TEMPLATE = lib +CONFIG += staticlib +TARGET = JavaScriptCore + +CONFIG += depend_includepath + +contains(QT_CONFIG, embedded):CONFIG += embedded + +CONFIG(QTDIR_build) { + GENERATED_SOURCES_DIR = $$PWD/generated + OLDDESTDIR = $$DESTDIR + include($$QT_SOURCE_TREE/src/qbase.pri) + INSTALLS = + DESTDIR = $$OLDDESTDIR + PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h + DEFINES *= NDEBUG +} + +isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = tmp +GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} + +INCLUDEPATH += $$GENERATED_SOURCES_DIR + +!CONFIG(QTDIR_build) { + CONFIG(debug, debug|release) { + OBJECTS_DIR = obj/debug + } else { # Release + OBJECTS_DIR = obj/release + } +} + +CONFIG(release):!CONFIG(QTDIR_build) { + contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions +} + +linux-*: DEFINES += HAVE_STDINT_H +freebsd-*: DEFINES += HAVE_PTHREAD_NP_H + +DEFINES += BUILD_WEBKIT + +win32-*: DEFINES += _HAS_TR1=0 + +# Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC +win32-g++ { + TMPPATH = $$quote($$(INCLUDE)) + QMAKE_INCDIR_POST += $$split(TMPPATH,";") + TMPPATH = $$quote($$(LIB)) + QMAKE_LIBDIR_POST += $$split(TMPPATH,";") +} + +DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 + +DEFINES += WTF_CHANGES=1 + +include(JavaScriptCore.pri) + +QMAKE_EXTRA_TARGETS += generated_files + +lessThan(QT_MINOR_VERSION, 4) { + DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" +} + +*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 +*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp index dafc482..1324586 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" @@ -49,11 +49,11 @@ ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool) return reinterpret_cast(addr - (*insn & SDT_OFFSET_MASK)); } -void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to) +void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool) { ARMWord* insn = reinterpret_cast(code) + (from.m_offset / sizeof(ARMWord)); - if (!from.m_latePatch) { + if (!useConstantPool) { int diff = reinterpret_cast(to) - reinterpret_cast(insn + 2); if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { @@ -291,10 +291,10 @@ void ARMAssembler::dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID bas if (offset <= 0xfff) dtr_u(isLoad, srcDst, base, offset); else if (offset <= 0xfffff) { - add_r(ARM::S0, base, OP2_IMM | (offset >> 12) | (10 << 8)); - dtr_u(isLoad, srcDst, ARM::S0, offset & 0xfff); + add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8)); + dtr_u(isLoad, srcDst, ARMRegisters::S0, offset & 0xfff); } else { - ARMWord reg = getImm(offset, ARM::S0); + ARMWord reg = getImm(offset, ARMRegisters::S0); dtr_ur(isLoad, srcDst, base, reg); } } else { @@ -302,10 +302,10 @@ void ARMAssembler::dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID bas if (offset <= 0xfff) dtr_d(isLoad, srcDst, base, offset); else if (offset <= 0xfffff) { - sub_r(ARM::S0, base, OP2_IMM | (offset >> 12) | (10 << 8)); - dtr_d(isLoad, srcDst, ARM::S0, offset & 0xfff); + sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8)); + dtr_d(isLoad, srcDst, ARMRegisters::S0, offset & 0xfff); } else { - ARMWord reg = getImm(offset, ARM::S0); + ARMWord reg = getImm(offset, ARMRegisters::S0); dtr_dr(isLoad, srcDst, base, reg); } } @@ -319,30 +319,70 @@ void ARMAssembler::baseIndexTransfer32(bool isLoad, RegisterID srcDst, RegisterI op2 = lsl(index, scale); if (offset >= 0 && offset <= 0xfff) { - add_r(ARM::S0, base, op2); - dtr_u(isLoad, srcDst, ARM::S0, offset); + add_r(ARMRegisters::S0, base, op2); + dtr_u(isLoad, srcDst, ARMRegisters::S0, offset); return; } if (offset <= 0 && offset >= -0xfff) { - add_r(ARM::S0, base, op2); - dtr_d(isLoad, srcDst, ARM::S0, -offset); + add_r(ARMRegisters::S0, base, op2); + dtr_d(isLoad, srcDst, ARMRegisters::S0, -offset); return; } - moveImm(offset, ARM::S0); - add_r(ARM::S0, ARM::S0, op2); - dtr_ur(isLoad, srcDst, base, ARM::S0); + ldr_un_imm(ARMRegisters::S0, offset); + add_r(ARMRegisters::S0, ARMRegisters::S0, op2); + dtr_ur(isLoad, srcDst, base, ARMRegisters::S0); +} + +void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID base, int32_t offset) +{ + if (offset & 0x3) { + if (offset <= 0x3ff && offset >= 0) { + fdtr_u(isLoad, srcDst, base, offset >> 2); + return; + } + if (offset <= 0x3ffff && offset >= 0) { + add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8)); + fdtr_u(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff); + return; + } + offset = -offset; + + if (offset <= 0x3ff && offset >= 0) { + fdtr_d(isLoad, srcDst, base, offset >> 2); + return; + } + if (offset <= 0x3ffff && offset >= 0) { + sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8)); + fdtr_d(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff); + return; + } + offset = -offset; + } + + ldr_un_imm(ARMRegisters::S0, offset); + add_r(ARMRegisters::S0, ARMRegisters::S0, base); + fdtr_u(isLoad, srcDst, ARMRegisters::S0, 0); } void* ARMAssembler::executableCopy(ExecutablePool* allocator) { + // 64-bit alignment is required for next constant pool and JIT code as well + m_buffer.flushWithoutBarrier(true); + if (m_buffer.uncheckedSize() & 0x7) + bkpt(0); + char* data = reinterpret_cast(m_buffer.executableCopy(allocator)); for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) { - ARMWord* ldrAddr = reinterpret_cast(data + *iter); - ARMWord* offset = getLdrImmAddress(ldrAddr); - if (*offset != 0xffffffff) - linkBranch(data, JmpSrc(*iter), data + *offset); + // The last bit is set if the constant must be placed on constant pool. + int pos = (*iter) & (~0x1); + ARMWord* ldrAddr = reinterpret_cast(data + pos); + ARMWord offset = *getLdrImmAddress(ldrAddr); + if (offset != 0xffffffff) { + JmpSrc jmpSrc(pos); + linkBranch(data, jmpSrc, data + offset, ((*iter) & 1)); + } } return data; @@ -350,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h index d6bb43e..9f9a450 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h @@ -29,50 +29,55 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "AssemblerBufferWithConstantPool.h" #include namespace JSC { -typedef uint32_t ARMWord; - -namespace ARM { - typedef enum { - r0 = 0, - r1, - r2, - r3, - S0 = r3, - r4, - r5, - r6, - r7, - r8, - S1 = r8, - r9, - r10, - r11, - r12, - r13, - sp = r13, - r14, - lr = r14, - r15, - pc = r15 - } RegisterID; - - typedef enum { - fp0 //FIXME - } FPRegisterID; -} // namespace ARM + typedef uint32_t ARMWord; + + namespace ARMRegisters { + typedef enum { + r0 = 0, + r1, + r2, + r3, + S0 = r3, + r4, + r5, + r6, + r7, + r8, + S1 = r8, + r9, + r10, + r11, + r12, + r13, + sp = r13, + r14, + lr = r14, + r15, + pc = r15 + } RegisterID; + + typedef enum { + d0, + d1, + d2, + d3, + SD0 = d3 + } FPRegisterID; + + } // namespace ARMRegisters class ARMAssembler { public: - typedef ARM::RegisterID RegisterID; - typedef ARM::FPRegisterID FPRegisterID; + typedef ARMRegisters::RegisterID RegisterID; + typedef ARMRegisters::FPRegisterID FPRegisterID; typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer; - typedef WTF::SegmentedVector Jumps; + typedef SegmentedVector Jumps; ARMAssembler() { } @@ -115,13 +120,21 @@ namespace ARM { MVN = (0xf << 21), MUL = 0x00000090, MULL = 0x00c00090, + FADDD = 0x0e300b00, + FSUBD = 0x0e300b40, + FMULD = 0x0e200b00, + FCMPD = 0x0eb40b40, DTR = 0x05000000, LDRH = 0x00100090, STRH = 0x00000090, STMDB = 0x09200000, LDMIA = 0x08b00000, + FDTR = 0x0d000b00, B = 0x0a000000, BL = 0x0b000000, + FMSR = 0x0e000a10, + FSITOD = 0x0eb80bc0, + FMSTAT = 0x0ef1fa10, #if ARM_ARCH_VERSION >= 5 CLZ = 0x016f0f10, BKPT = 0xe120070, @@ -167,20 +180,16 @@ namespace ARM { public: JmpSrc() : m_offset(-1) - , m_latePatch(false) { } - void enableLatePatch() { m_latePatch = true; } private: JmpSrc(int offset) : m_offset(offset) - , m_latePatch(false) { } - int m_offset : 31; - int m_latePatch : 1; + int m_offset; }; class JmpDst { @@ -321,12 +330,12 @@ namespace ARM { void mov_r(int rd, ARMWord op2, Condition cc = AL) { - emitInst(static_cast(cc) | MOV, rd, ARM::r0, op2); + emitInst(static_cast(cc) | MOV, rd, ARMRegisters::r0, op2); } void movs_r(int rd, ARMWord op2, Condition cc = AL) { - emitInst(static_cast(cc) | MOV | SET_CC, rd, ARM::r0, op2); + emitInst(static_cast(cc) | MOV | SET_CC, rd, ARMRegisters::r0, op2); } void bic_r(int rd, int rn, ARMWord op2, Condition cc = AL) @@ -341,12 +350,12 @@ namespace ARM { void mvn_r(int rd, ARMWord op2, Condition cc = AL) { - emitInst(static_cast(cc) | MVN, rd, ARM::r0, op2); + emitInst(static_cast(cc) | MVN, rd, ARMRegisters::r0, op2); } void mvns_r(int rd, ARMWord op2, Condition cc = AL) { - emitInst(static_cast(cc) | MVN | SET_CC, rd, ARM::r0, op2); + emitInst(static_cast(cc) | MVN | SET_CC, rd, ARMRegisters::r0, op2); } void mul_r(int rd, int rn, int rm, Condition cc = AL) @@ -364,14 +373,34 @@ namespace ARM { m_buffer.putInt(static_cast(cc) | MULL | RN(rdhi) | RD(rdlo) | RS(rn) | RM(rm)); } + void faddd_r(int dd, int dn, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FADDD, dd, dn, dm); + } + + void fsubd_r(int dd, int dn, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FSUBD, dd, dn, dm); + } + + void fmuld_r(int dd, int dn, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FMULD, dd, dn, dm); + } + + void fcmpd_r(int dd, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FCMPD, dd, 0, dm); + } + void ldr_imm(int rd, ARMWord imm, Condition cc = AL) { - m_buffer.putIntWithConstantInt(static_cast(cc) | DTR | DT_LOAD | DT_UP | RN(ARM::pc) | RD(rd), imm, true); + m_buffer.putIntWithConstantInt(static_cast(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm, true); } void ldr_un_imm(int rd, ARMWord imm, Condition cc = AL) { - m_buffer.putIntWithConstantInt(static_cast(cc) | DTR | DT_LOAD | DT_UP | RN(ARM::pc) | RD(rd), imm); + m_buffer.putIntWithConstantInt(static_cast(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm); } void dtr_u(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL) @@ -414,26 +443,53 @@ namespace ARM { emitInst(static_cast(cc) | STRH | HDT_UH | DT_UP | DT_PRE, rd, rn, rm); } + void fdtr_u(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL) + { + ASSERT(op2 <= 0xff); + emitInst(static_cast(cc) | FDTR | DT_UP | (isLoad ? DT_LOAD : 0), rd, rb, op2); + } + + void fdtr_d(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL) + { + ASSERT(op2 <= 0xff); + emitInst(static_cast(cc) | FDTR | (isLoad ? DT_LOAD : 0), rd, rb, op2); + } + void push_r(int reg, Condition cc = AL) { ASSERT(ARMWord(reg) <= 0xf); - m_buffer.putInt(cc | DTR | DT_WB | RN(ARM::sp) | RD(reg) | 0x4); + m_buffer.putInt(cc | DTR | DT_WB | RN(ARMRegisters::sp) | RD(reg) | 0x4); } void pop_r(int reg, Condition cc = AL) { ASSERT(ARMWord(reg) <= 0xf); - m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARM::sp) | RD(reg) | 0x4); + m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARMRegisters::sp) | RD(reg) | 0x4); } inline void poke_r(int reg, Condition cc = AL) { - dtr_d(false, ARM::sp, 0, reg, cc); + dtr_d(false, ARMRegisters::sp, 0, reg, cc); } inline void peek_r(int reg, Condition cc = AL) { - dtr_u(true, reg, ARM::sp, 0, cc); + dtr_u(true, reg, ARMRegisters::sp, 0, cc); + } + + void fmsr_r(int dd, int rn, Condition cc = AL) + { + emitInst(static_cast(cc) | FMSR, rn, dd, 0); + } + + void fsitod_r(int dd, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FSITOD, dd, 0, dm); + } + + void fmstat(Condition cc = AL) + { + m_buffer.putInt(static_cast(cc) | FMSTAT); } #if ARM_ARCH_VERSION >= 5 @@ -449,49 +505,49 @@ namespace ARM { m_buffer.putInt(BKPT | ((value & 0xff0) << 4) | (value & 0xf)); #else // Cannot access to Zero memory address - dtr_dr(true, ARM::S0, ARM::S0, ARM::S0); + dtr_dr(true, ARMRegisters::S0, ARMRegisters::S0, ARMRegisters::S0); #endif } static ARMWord lsl(int reg, ARMWord value) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); ASSERT(value <= 0x1f); return reg | (value << 7) | 0x00; } static ARMWord lsr(int reg, ARMWord value) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); ASSERT(value <= 0x1f); return reg | (value << 7) | 0x20; } static ARMWord asr(int reg, ARMWord value) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); ASSERT(value <= 0x1f); return reg | (value << 7) | 0x40; } static ARMWord lsl_r(int reg, int shiftReg) { - ASSERT(reg <= ARM::pc); - ASSERT(shiftReg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); + ASSERT(shiftReg <= ARMRegisters::pc); return reg | (shiftReg << 8) | 0x10; } static ARMWord lsr_r(int reg, int shiftReg) { - ASSERT(reg <= ARM::pc); - ASSERT(shiftReg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); + ASSERT(shiftReg <= ARMRegisters::pc); return reg | (shiftReg << 8) | 0x30; } static ARMWord asr_r(int reg, int shiftReg) { - ASSERT(reg <= ARM::pc); - ASSERT(shiftReg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); + ASSERT(shiftReg <= ARMRegisters::pc); return reg | (shiftReg << 8) | 0x50; } @@ -507,6 +563,11 @@ namespace ARM { m_buffer.ensureSpace(insnSpace, constSpace); } + int sizeOfConstantPool() + { + return m_buffer.sizeOfConstantPool(); + } + JmpDst label() { return JmpDst(m_buffer.size()); @@ -515,16 +576,17 @@ namespace ARM { JmpDst align(int alignment) { while (!m_buffer.isAligned(alignment)) - mov_r(ARM::r0, ARM::r0); + mov_r(ARMRegisters::r0, ARMRegisters::r0); return label(); } - JmpSrc jmp(Condition cc = AL) + JmpSrc jmp(Condition cc = AL, int useConstantPool = 0) { - int s = size(); - ldr_un_imm(ARM::pc, 0xffffffff, cc); - m_jumps.append(s); + ensureSpace(sizeof(ARMWord), sizeof(ARMWord)); + int s = m_buffer.uncheckedSize(); + ldr_un_imm(ARMRegisters::pc, 0xffffffff, cc); + m_jumps.append(s | (useConstantPool & 0x1)); return JmpSrc(s); } @@ -533,7 +595,7 @@ namespace ARM { // Patching helpers static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0); - static void linkBranch(void* code, JmpSrc from, void* to); + static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0); static void patchPointerInternal(intptr_t from, void* to) { @@ -600,7 +662,7 @@ namespace ARM { static void linkCall(void* code, JmpSrc from, void* to) { - linkBranch(code, from, to); + linkBranch(code, from, to, true); } static void relinkCall(void* from, void* to) @@ -653,6 +715,7 @@ namespace ARM { void dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, int32_t offset); void baseIndexTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, RegisterID index, int scale, int32_t offset); + void doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID base, int32_t offset); // Constant pool hnadlers @@ -666,25 +729,25 @@ namespace ARM { private: ARMWord RM(int reg) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); return reg; } ARMWord RS(int reg) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); return reg << 8; } ARMWord RD(int reg) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); return reg << 12; } ARMWord RN(int reg) { - ASSERT(reg <= ARM::pc); + ASSERT(reg <= ARMRegisters::pc); return reg << 16; } @@ -701,6 +764,6 @@ namespace ARM { } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // ARMAssembler_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h index f7e2fb4..078de44 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #include "AssemblerBuffer.h" #include @@ -37,7 +37,7 @@ namespace JSC { -namespace ARM { +namespace ARMRegisters { typedef enum { r0, r1, @@ -199,7 +199,7 @@ class ARMThumbImmediate { }; } PatternBytes; - ALWAYS_INLINE static int32_t countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N) + ALWAYS_INLINE static void countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N) { if (value & ~((1<>= N; /* if any were set, lose the bottom N */ \ @@ -407,8 +407,8 @@ register writeback class ARMv7Assembler { public: - typedef ARM::RegisterID RegisterID; - typedef ARM::FPRegisterID FPRegisterID; + typedef ARMRegisters::RegisterID RegisterID; + typedef ARMRegisters::FPRegisterID FPRegisterID; // (HS, LO, HI, LS) -> (AE, B, A, BE) // (VS, VC) -> (O, NO) @@ -442,7 +442,6 @@ public: { } - void enableLatePatch() { } private: JmpSrc(int offset) : m_offset(offset) @@ -481,7 +480,7 @@ private: // ARMv7, Appx-A.6.3 bool BadReg(RegisterID reg) { - return (reg == ARM::sp) || (reg == ARM::pc); + return (reg == ARMRegisters::sp) || (reg == ARMRegisters::pc); } bool isSingleRegister(FPRegisterID reg) @@ -693,16 +692,16 @@ public: void add(RegisterID rd, RegisterID rn, ARMThumbImmediate imm) { // Rd can only be SP if Rn is also SP. - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isValid()); - if (rn == ARM::sp) { + if (rn == ARMRegisters::sp) { if (!(rd & 8) && imm.isUInt10()) { m_formatter.oneWordOp5Reg3Imm8(OP_ADD_SP_imm_T1, rd, imm.getUInt10() >> 2); return; - } else if ((rd == ARM::sp) && imm.isUInt9()) { + } else if ((rd == ARMRegisters::sp) && imm.isUInt9()) { m_formatter.oneWordOp9Imm7(OP_ADD_SP_imm_T2, imm.getUInt9() >> 2); return; } @@ -726,9 +725,9 @@ public: void add(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); m_formatter.twoWordOp12Reg4FourFours(OP_ADD_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm)); } @@ -750,9 +749,9 @@ public: void add_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm) { // Rd can only be SP if Rn is also SP. - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isEncodedImm()); if (!((rd | rn) & 8)) { @@ -771,9 +770,9 @@ public: // Not allowed in an IT (if then) block? void add_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); m_formatter.twoWordOp12Reg4FourFours(OP_ADD_S_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm)); } @@ -839,7 +838,7 @@ public: // Only allowed in IT (if then) block if last instruction. JmpSrc blx(RegisterID rm) { - ASSERT(rm != ARM::pc); + ASSERT(rm != ARMRegisters::pc); m_formatter.oneWordOp8RegReg143(OP_BLX, rm, (RegisterID)8); return JmpSrc(m_formatter.size()); } @@ -858,7 +857,7 @@ public: void cmn(RegisterID rn, ARMThumbImmediate imm) { - ASSERT(rn != ARM::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isEncodedImm()); m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_CMN_imm, rn, (RegisterID)0xf, imm); @@ -866,7 +865,7 @@ public: void cmp(RegisterID rn, ARMThumbImmediate imm) { - ASSERT(rn != ARM::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isEncodedImm()); if (!(rn & 8) && imm.isUInt8()) @@ -877,7 +876,7 @@ public: void cmp(RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { - ASSERT(rn != ARM::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); m_formatter.twoWordOp12Reg4FourFours(OP_CMP_reg_T2, rn, FourFours(shift.hi4(), 0xf, shift.lo4(), rm)); } @@ -939,15 +938,15 @@ public: m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond, inst2if, inst3if, inst4if)); } - // rt == ARM::pc only allowed if last instruction in IT (if then) block. + // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block. void ldr(RegisterID rt, RegisterID rn, ARMThumbImmediate imm) { - ASSERT(rn != ARM::pc); // LDR (literal) + ASSERT(rn != ARMRegisters::pc); // LDR (literal) ASSERT(imm.isUInt12()); if (!((rt | rn) & 8) && imm.isUInt7()) m_formatter.oneWordOp5Imm5Reg3Reg3(OP_LDR_imm_T1, imm.getUInt7() >> 2, rn, rt); - else if ((rn == ARM::sp) && !(rt & 8) && imm.isUInt10()) + else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10()) m_formatter.oneWordOp5Reg3Imm8(OP_LDR_imm_T2, rt, imm.getUInt10() >> 2); else m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T3, rn, rt, imm.getUInt12()); @@ -966,8 +965,8 @@ public: // if (wback) REG[rn] = _tmp void ldr(RegisterID rt, RegisterID rn, int offset, bool index, bool wback) { - ASSERT(rt != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT(rt != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(index || wback); ASSERT(!wback | (rt != rn)); @@ -986,10 +985,10 @@ public: m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T4, rn, rt, offset); } - // rt == ARM::pc only allowed if last instruction in IT (if then) block. + // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block. void ldr(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0) { - ASSERT(rn != ARM::pc); // LDR (literal) + ASSERT(rn != ARMRegisters::pc); // LDR (literal) ASSERT(!BadReg(rm)); ASSERT(shift <= 3); @@ -999,10 +998,10 @@ public: m_formatter.twoWordOp12Reg4FourFours(OP_LDR_reg_T2, rn, FourFours(rt, 0, shift, rm)); } - // rt == ARM::pc only allowed if last instruction in IT (if then) block. + // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block. void ldrh(RegisterID rt, RegisterID rn, ARMThumbImmediate imm) { - ASSERT(rn != ARM::pc); // LDR (literal) + ASSERT(rn != ARMRegisters::pc); // LDR (literal) ASSERT(imm.isUInt12()); if (!((rt | rn) & 8) && imm.isUInt6()) @@ -1024,8 +1023,8 @@ public: // if (wback) REG[rn] = _tmp void ldrh(RegisterID rt, RegisterID rn, int offset, bool index, bool wback) { - ASSERT(rt != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT(rt != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(index || wback); ASSERT(!wback | (rt != rn)); @@ -1047,7 +1046,7 @@ public: void ldrh(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0) { ASSERT(!BadReg(rt)); // Memory hint - ASSERT(rn != ARM::pc); // LDRH (literal) + ASSERT(rn != ARMRegisters::pc); // LDRH (literal) ASSERT(!BadReg(rm)); ASSERT(shift <= 3); @@ -1198,16 +1197,16 @@ public: m_formatter.twoWordOp12Reg4FourFours(OP_SMULL_T1, rn, FourFours(rdLo, rdHi, 0, rm)); } - // rt == ARM::pc only allowed if last instruction in IT (if then) block. + // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block. void str(RegisterID rt, RegisterID rn, ARMThumbImmediate imm) { - ASSERT(rt != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT(rt != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isUInt12()); if (!((rt | rn) & 8) && imm.isUInt7()) m_formatter.oneWordOp5Imm5Reg3Reg3(OP_STR_imm_T1, imm.getUInt7() >> 2, rn, rt); - else if ((rn == ARM::sp) && !(rt & 8) && imm.isUInt10()) + else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10()) m_formatter.oneWordOp5Reg3Imm8(OP_STR_imm_T2, rt, imm.getUInt10() >> 2); else m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T3, rn, rt, imm.getUInt12()); @@ -1226,8 +1225,8 @@ public: // if (wback) REG[rn] = _tmp void str(RegisterID rt, RegisterID rn, int offset, bool index, bool wback) { - ASSERT(rt != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT(rt != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(index || wback); ASSERT(!wback | (rt != rn)); @@ -1246,10 +1245,10 @@ public: m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T4, rn, rt, offset); } - // rt == ARM::pc only allowed if last instruction in IT (if then) block. + // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block. void str(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0) { - ASSERT(rn != ARM::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); ASSERT(shift <= 3); @@ -1262,12 +1261,12 @@ public: void sub(RegisterID rd, RegisterID rn, ARMThumbImmediate imm) { // Rd can only be SP if Rn is also SP. - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isValid()); - if ((rn == ARM::sp) && (rd == ARM::sp) && imm.isUInt9()) { + if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) { m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2); return; } else if (!((rd | rn) & 8)) { @@ -1290,9 +1289,9 @@ public: void sub(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); m_formatter.twoWordOp12Reg4FourFours(OP_SUB_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm)); } @@ -1310,12 +1309,12 @@ public: void sub_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm) { // Rd can only be SP if Rn is also SP. - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(imm.isValid()); - if ((rn == ARM::sp) && (rd == ARM::sp) && imm.isUInt9()) { + if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) { m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2); return; } else if (!((rd | rn) & 8)) { @@ -1334,9 +1333,9 @@ public: // Not allowed in an IT (if then) block? void sub_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift) { - ASSERT((rd != ARM::sp) || (rn == ARM::sp)); - ASSERT(rd != ARM::pc); - ASSERT(rn != ARM::pc); + ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp)); + ASSERT(rd != ARMRegisters::pc); + ASSERT(rn != ARMRegisters::pc); ASSERT(!BadReg(rm)); m_formatter.twoWordOp12Reg4FourFours(OP_SUB_S_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm)); } @@ -1754,6 +1753,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #endif // ARMAssembler_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h index 95b5afc..525fe98 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -173,7 +173,7 @@ public: struct Imm32 { explicit Imm32(int32_t value) : m_value(value) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM) , m_isPointer(false) #endif { @@ -182,7 +182,7 @@ public: #if !PLATFORM(X86_64) explicit Imm32(ImmPtr ptr) : m_value(ptr.asIntptr()) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM) , m_isPointer(true) #endif { @@ -190,7 +190,7 @@ public: #endif int32_t m_value; -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM) // We rely on being able to regenerate code to recover exception handling // information. Since ARMv7 supports 16-bit immediates there is a danger // that if pointer values change the layout of the generated code will change. @@ -320,11 +320,6 @@ public: return Call(jump.m_jmp, Linkable); } - void enableLatePatch() - { - m_jmp.enableLatePatch(); - } - JmpSrc m_jmp; private: Flags m_flags; @@ -361,11 +356,6 @@ public: masm->m_assembler.linkJump(m_jmp, label.m_label); } - void enableLatePatch() - { - m_jmp.enableLatePatch(); - } - private: JmpSrc m_jmp; }; @@ -378,6 +368,8 @@ public: friend class LinkBuffer; public: + typedef Vector JumpVector; + void link(AbstractMacroAssembler* masm) { size_t size = m_jumps.size(); @@ -408,9 +400,11 @@ public: { return !m_jumps.size(); } + + const JumpVector& jumps() { return m_jumps; } private: - Vector m_jumps; + JumpVector m_jumps; }; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h index f15b7f3..af3c3be 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h @@ -34,6 +34,8 @@ #include "AssemblerBuffer.h" #include +#define ASSEMBLER_HAS_CONSTANT_POOL 1 + namespace JSC { /* @@ -84,7 +86,7 @@ namespace JSC { template class AssemblerBufferWithConstantPool: public AssemblerBuffer { - typedef WTF::SegmentedVector LoadOffsets; + typedef SegmentedVector LoadOffsets; public: enum { UniqueConst, @@ -177,6 +179,11 @@ public: return AssemblerBuffer::size(); } + int uncheckedSize() + { + return AssemblerBuffer::size(); + } + void* executableCopy(ExecutablePool* allocator) { flushConstantPool(false); @@ -207,10 +214,10 @@ public: } // This flushing mechanism can be called after any unconditional jumps. - void flushWithoutBarrier() + void flushWithoutBarrier(bool isForced = false) { // Flush if constant pool is more than 60% full to avoid overuse of this function. - if (5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t)) + if (isForced || 5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t)) flushConstantPool(false); } @@ -219,6 +226,11 @@ public: return m_pool; } + int sizeOfConstantPool() + { + return m_numConsts; + } + private: void correctDeltas(int insnSize) { @@ -276,7 +288,8 @@ private: { if (m_numConsts == 0) return; - if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t))) + int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0; + if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t))) flushConstantPool(); } @@ -284,8 +297,8 @@ private: { if (m_numConsts == 0) return; - if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)) || - (m_numConsts + nextConstSize / sizeof(uint32_t) >= maxPoolSize)) + if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) || + (m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize)) flushConstantPool(); } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h index 9e1c5d3..2743ab4 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h @@ -30,11 +30,11 @@ #if ENABLE(ASSEMBLER) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) #include "MacroAssemblerARMv7.h" namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; }; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; }; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp new file mode 100644 index 0000000..43648c4 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2009 University of Szeged + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) + +#include "MacroAssemblerARM.h" + +#if PLATFORM(LINUX) +#include +#include +#include +#include +#include +#include +#endif + +namespace JSC { + +static bool isVFPPresent() +{ +#if PLATFORM(LINUX) + int fd = open("/proc/self/auxv", O_RDONLY); + if (fd > 0) { + Elf32_auxv_t aux; + while (read(fd, &aux, sizeof(Elf32_auxv_t))) { + if (aux.a_type == AT_HWCAP) { + close(fd); + return aux.a_un.a_val & HWCAP_VFP; + } + } + close(fd); + } +#endif + + return false; +} + +const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); + +} + +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h index 27879a9..0c696c9 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -30,7 +30,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" #include "AbstractMacroAssembler.h" @@ -57,15 +57,14 @@ public: }; enum DoubleCondition { - DoubleEqual, //FIXME - DoubleNotEqual, //FIXME - DoubleGreaterThan, //FIXME - DoubleGreaterThanOrEqual, //FIXME - DoubleLessThan, //FIXME - DoubleLessThanOrEqual, //FIXME + DoubleEqual = ARMAssembler::EQ, + DoubleGreaterThan = ARMAssembler::GT, + DoubleGreaterThanOrEqual = ARMAssembler::GE, + DoubleLessThan = ARMAssembler::LT, + DoubleLessThanOrEqual = ARMAssembler::LE, }; - static const RegisterID stackPointerRegister = ARM::sp; + static const RegisterID stackPointerRegister = ARMRegisters::sp; static const Scale ScalePtr = TimesFour; @@ -76,20 +75,20 @@ public: void add32(Imm32 imm, Address address) { - load32(address, ARM::S1); - add32(imm, ARM::S1); - store32(ARM::S1, address); + load32(address, ARMRegisters::S1); + add32(imm, ARMRegisters::S1); + store32(ARMRegisters::S1, address); } void add32(Imm32 imm, RegisterID dest) { - m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0)); + m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); } void add32(Address src, RegisterID dest) { - load32(src, ARM::S1); - add32(ARM::S1, dest); + load32(src, ARMRegisters::S1); + add32(ARMRegisters::S1, dest); } void and32(RegisterID src, RegisterID dest) @@ -99,7 +98,7 @@ public: void and32(Imm32 imm, RegisterID dest) { - ARMWord w = m_assembler.getImm(imm.m_value, ARM::S0, true); + ARMWord w = m_assembler.getImm(imm.m_value, ARMRegisters::S0, true); if (w & ARMAssembler::OP2_INV_IMM) m_assembler.bics_r(dest, dest, w & ~ARMAssembler::OP2_INV_IMM); else @@ -119,16 +118,16 @@ public: void mul32(RegisterID src, RegisterID dest) { if (src == dest) { - move(src, ARM::S0); - src = ARM::S0; + move(src, ARMRegisters::S0); + src = ARMRegisters::S0; } m_assembler.muls_r(dest, dest, src); } void mul32(Imm32 imm, RegisterID src, RegisterID dest) { - move(imm, ARM::S0); - m_assembler.muls_r(dest, src, ARM::S0); + move(imm, ARMRegisters::S0); + m_assembler.muls_r(dest, src, ARMRegisters::S0); } void not32(RegisterID dest) @@ -143,7 +142,7 @@ public: void or32(Imm32 imm, RegisterID dest) { - m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0)); + m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); } void rshift32(RegisterID shift_amount, RegisterID dest) @@ -163,20 +162,20 @@ public: void sub32(Imm32 imm, RegisterID dest) { - m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0)); + m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); } void sub32(Imm32 imm, Address address) { - load32(address, ARM::S1); - sub32(imm, ARM::S1); - store32(ARM::S1, address); + load32(address, ARMRegisters::S1); + sub32(imm, ARMRegisters::S1); + store32(ARMRegisters::S1, address); } void sub32(Address src, RegisterID dest) { - load32(src, ARM::S1); - sub32(ARM::S1, dest); + load32(src, ARMRegisters::S1); + sub32(ARMRegisters::S1, dest); } void xor32(RegisterID src, RegisterID dest) @@ -186,7 +185,7 @@ public: void xor32(Imm32 imm, RegisterID dest) { - m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARM::S0)); + m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); } void load32(ImplicitAddress address, RegisterID dest) @@ -202,8 +201,8 @@ public: DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) { DataLabel32 dataLabel(this); - m_assembler.ldr_un_imm(ARM::S0, 0); - m_assembler.dtr_ur(true, dest, address.base, ARM::S0); + m_assembler.ldr_un_imm(ARMRegisters::S0, 0); + m_assembler.dtr_ur(true, dest, address.base, ARMRegisters::S0); return dataLabel; } @@ -216,18 +215,18 @@ public: void load16(BaseIndex address, RegisterID dest) { - m_assembler.add_r(ARM::S0, address.base, m_assembler.lsl(address.index, address.scale)); + m_assembler.add_r(ARMRegisters::S0, address.base, m_assembler.lsl(address.index, address.scale)); if (address.offset>=0) - m_assembler.ldrh_u(dest, ARM::S0, ARMAssembler::getOp2Byte(address.offset)); + m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset)); else - m_assembler.ldrh_d(dest, ARM::S0, ARMAssembler::getOp2Byte(-address.offset)); + m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset)); } DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address) { DataLabel32 dataLabel(this); - m_assembler.ldr_un_imm(ARM::S0, 0); - m_assembler.dtr_ur(false, src, address.base, ARM::S0); + m_assembler.ldr_un_imm(ARMRegisters::S0, 0); + m_assembler.dtr_ur(false, src, address.base, ARMRegisters::S0); return dataLabel; } @@ -243,21 +242,27 @@ public: void store32(Imm32 imm, ImplicitAddress address) { - move(imm, ARM::S1); - store32(ARM::S1, address); + if (imm.m_isPointer) + m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value); + else + move(imm, ARMRegisters::S1); + store32(ARMRegisters::S1, address); } void store32(RegisterID src, void* address) { - m_assembler.moveImm(reinterpret_cast(address), ARM::S0); - m_assembler.dtr_u(false, src, ARM::S0, 0); + m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast(address)); + m_assembler.dtr_u(false, src, ARMRegisters::S0, 0); } void store32(Imm32 imm, void* address) { - m_assembler.moveImm(reinterpret_cast(address), ARM::S0); - m_assembler.moveImm(imm.m_value, ARM::S1); - m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0); + m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast(address)); + if (imm.m_isPointer) + m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value); + else + m_assembler.moveImm(imm.m_value, ARMRegisters::S1); + m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0); } void pop(RegisterID dest) @@ -272,19 +277,22 @@ public: void push(Address address) { - load32(address, ARM::S1); - push(ARM::S1); + load32(address, ARMRegisters::S1); + push(ARMRegisters::S1); } void push(Imm32 imm) { - move(imm, ARM::S0); - push(ARM::S0); + move(imm, ARMRegisters::S0); + push(ARMRegisters::S0); } void move(Imm32 imm, RegisterID dest) { - m_assembler.moveImm(imm.m_value, dest); + if (imm.m_isPointer) + m_assembler.ldr_un_imm(dest, imm.m_value); + else + m_assembler.moveImm(imm.m_value, dest); } void move(RegisterID src, RegisterID dest) @@ -294,14 +302,14 @@ public: void move(ImmPtr imm, RegisterID dest) { - m_assembler.mov_r(dest, m_assembler.getImm(reinterpret_cast(imm.m_value), ARM::S0)); + move(Imm32(imm), dest); } void swap(RegisterID reg1, RegisterID reg2) { - m_assembler.mov_r(ARM::S0, reg1); + m_assembler.mov_r(ARMRegisters::S0, reg1); m_assembler.mov_r(reg1, reg2); - m_assembler.mov_r(reg2, ARM::S0); + m_assembler.mov_r(reg2, ARMRegisters::S0); } void signExtend32ToPtr(RegisterID src, RegisterID dest) @@ -316,40 +324,44 @@ public: move(src, dest); } - Jump branch32(Condition cond, RegisterID left, RegisterID right) + Jump branch32(Condition cond, RegisterID left, RegisterID right, int useConstantPool = 0) { m_assembler.cmp_r(left, right); - return Jump(m_assembler.jmp(ARMCondition(cond))); + return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool)); } - Jump branch32(Condition cond, RegisterID left, Imm32 right) + Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0) { - m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0)); - return Jump(m_assembler.jmp(ARMCondition(cond))); + if (right.m_isPointer) { + m_assembler.ldr_un_imm(ARMRegisters::S0, right.m_value); + m_assembler.cmp_r(left, ARMRegisters::S0); + } else + m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0)); + return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool)); } Jump branch32(Condition cond, RegisterID left, Address right) { - load32(right, ARM::S1); - return branch32(cond, left, ARM::S1); + load32(right, ARMRegisters::S1); + return branch32(cond, left, ARMRegisters::S1); } Jump branch32(Condition cond, Address left, RegisterID right) { - load32(left, ARM::S1); - return branch32(cond, ARM::S1, right); + load32(left, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); } Jump branch32(Condition cond, Address left, Imm32 right) { - load32(left, ARM::S1); - return branch32(cond, ARM::S1, right); + load32(left, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); } Jump branch32(Condition cond, BaseIndex left, Imm32 right) { - load32(left, ARM::S1); - return branch32(cond, ARM::S1, right); + load32(left, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); } Jump branch16(Condition cond, BaseIndex left, RegisterID right) @@ -363,9 +375,9 @@ public: Jump branch16(Condition cond, BaseIndex left, Imm32 right) { - load16(left, ARM::S0); - move(right, ARM::S1); - m_assembler.cmp_r(ARM::S0, ARM::S1); + load16(left, ARMRegisters::S0); + move(right, ARMRegisters::S1); + m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S1); return m_assembler.jmp(ARMCondition(cond)); } @@ -379,9 +391,9 @@ public: Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1)) { ASSERT((cond == Zero) || (cond == NonZero)); - ARMWord w = m_assembler.getImm(mask.m_value, ARM::S0, true); + ARMWord w = m_assembler.getImm(mask.m_value, ARMRegisters::S0, true); if (w & ARMAssembler::OP2_INV_IMM) - m_assembler.bics_r(ARM::S0, reg, w & ~ARMAssembler::OP2_INV_IMM); + m_assembler.bics_r(ARMRegisters::S0, reg, w & ~ARMAssembler::OP2_INV_IMM); else m_assembler.tst_r(reg, w); return Jump(m_assembler.jmp(ARMCondition(cond))); @@ -389,14 +401,14 @@ public: Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1)) { - load32(address, ARM::S1); - return branchTest32(cond, ARM::S1, mask); + load32(address, ARMRegisters::S1); + return branchTest32(cond, ARMRegisters::S1, mask); } Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1)) { - load32(address, ARM::S1); - return branchTest32(cond, ARM::S1, mask); + load32(address, ARMRegisters::S1); + return branchTest32(cond, ARMRegisters::S1, mask); } Jump jump() @@ -406,12 +418,12 @@ public: void jump(RegisterID target) { - move(target, ARM::pc); + move(target, ARMRegisters::pc); } void jump(Address address) { - load32(address, ARM::pc); + load32(address, ARMRegisters::pc); } Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest) @@ -431,11 +443,11 @@ public: void mull32(RegisterID src1, RegisterID src2, RegisterID dest) { if (src1 == dest) { - move(src1, ARM::S0); - src1 = ARM::S0; + move(src1, ARMRegisters::S0); + src1 = ARMRegisters::S0; } - m_assembler.mull_r(ARM::S1, dest, src2, src1); - m_assembler.cmp_r(ARM::S1, m_assembler.asr(dest, 31)); + m_assembler.mull_r(ARMRegisters::S1, dest, src2, src1); + m_assembler.cmp_r(ARMRegisters::S1, m_assembler.asr(dest, 31)); } Jump branchMul32(Condition cond, RegisterID src, RegisterID dest) @@ -454,8 +466,8 @@ public: { ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); if (cond == Overflow) { - move(imm, ARM::S0); - mull32(ARM::S0, src, dest); + move(imm, ARMRegisters::S0); + mull32(ARMRegisters::S0, src, dest); cond = NonZero; } else @@ -485,13 +497,13 @@ public: Call nearCall() { prepareCall(); - return Call(m_assembler.jmp(), Call::LinkableNear); + return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear); } Call call(RegisterID target) { prepareCall(); - move(ARM::pc, target); + move(ARMRegisters::pc, target); JmpSrc jmpSrc; return Call(jmpSrc, Call::None); } @@ -503,7 +515,7 @@ public: void ret() { - pop(ARM::pc); + pop(ARMRegisters::pc); } void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) @@ -515,67 +527,67 @@ public: void set32(Condition cond, RegisterID left, Imm32 right, RegisterID dest) { - m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0)); + m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0)); m_assembler.mov_r(dest, ARMAssembler::getOp2(0)); m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest) { - load32(address, ARM::S1); + load32(address, ARMRegisters::S1); if (mask.m_value == -1) - m_assembler.cmp_r(0, ARM::S1); + m_assembler.cmp_r(0, ARMRegisters::S1); else - m_assembler.tst_r(ARM::S1, m_assembler.getImm(mask.m_value, ARM::S0)); + m_assembler.tst_r(ARMRegisters::S1, m_assembler.getImm(mask.m_value, ARMRegisters::S0)); m_assembler.mov_r(dest, ARMAssembler::getOp2(0)); m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } void add32(Imm32 imm, RegisterID src, RegisterID dest) { - m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARM::S0)); + m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); } void add32(Imm32 imm, AbsoluteAddress address) { - m_assembler.moveImm(reinterpret_cast(address.m_ptr), ARM::S1); - m_assembler.dtr_u(true, ARM::S1, ARM::S1, 0); - add32(imm, ARM::S1); - m_assembler.moveImm(reinterpret_cast(address.m_ptr), ARM::S0); - m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0); + m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast(address.m_ptr)); + m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0); + add32(imm, ARMRegisters::S1); + m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast(address.m_ptr)); + m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0); } void sub32(Imm32 imm, AbsoluteAddress address) { - m_assembler.moveImm(reinterpret_cast(address.m_ptr), ARM::S1); - m_assembler.dtr_u(true, ARM::S1, ARM::S1, 0); - sub32(imm, ARM::S1); - m_assembler.moveImm(reinterpret_cast(address.m_ptr), ARM::S0); - m_assembler.dtr_u(false, ARM::S1, ARM::S0, 0); + m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast(address.m_ptr)); + m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0); + sub32(imm, ARMRegisters::S1); + m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast(address.m_ptr)); + m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0); } void load32(void* address, RegisterID dest) { - m_assembler.moveImm(reinterpret_cast(address), ARM::S0); - m_assembler.dtr_u(true, dest, ARM::S0, 0); + m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast(address)); + m_assembler.dtr_u(true, dest, ARMRegisters::S0, 0); } Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right) { - load32(left.m_ptr, ARM::S1); - return branch32(cond, ARM::S1, right); + load32(left.m_ptr, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); } Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right) { - load32(left.m_ptr, ARM::S1); - return branch32(cond, ARM::S1, right); + load32(left.m_ptr, ARMRegisters::S1); + return branch32(cond, ARMRegisters::S1, right); } Call call() { prepareCall(); - return Call(m_assembler.jmp(), Call::Linkable); + return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable); } Call tailRecursiveCall() @@ -597,25 +609,23 @@ public: Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0)) { - dataLabel = moveWithPatch(initialRightValue, ARM::S1); - Jump jump = branch32(cond, left, ARM::S1); - jump.enableLatePatch(); + dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S1); + Jump jump = branch32(cond, left, ARMRegisters::S1, true); return jump; } Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0)) { - load32(left, ARM::S1); - dataLabel = moveWithPatch(initialRightValue, ARM::S0); - Jump jump = branch32(cond, ARM::S0, ARM::S1); - jump.enableLatePatch(); + load32(left, ARMRegisters::S1); + dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S0); + Jump jump = branch32(cond, ARMRegisters::S0, ARMRegisters::S1, true); return jump; } DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address) { - DataLabelPtr dataLabel = moveWithPatch(initialValue, ARM::S1); - store32(ARM::S1, address); + DataLabelPtr dataLabel = moveWithPatch(initialValue, ARMRegisters::S1); + store32(ARMRegisters::S1, address); return dataLabel; } @@ -627,7 +637,7 @@ public: // Floating point operators bool supportsFloatingPoint() const { - return false; + return s_isVFPPresent; } bool supportsFloatingPointTruncate() const @@ -637,74 +647,58 @@ public: void loadDouble(ImplicitAddress address, FPRegisterID dest) { - UNUSED_PARAM(address); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + m_assembler.doubleTransfer(true, dest, address.base, address.offset); } void storeDouble(FPRegisterID src, ImplicitAddress address) { - UNUSED_PARAM(src); - UNUSED_PARAM(address); - ASSERT_NOT_REACHED(); + m_assembler.doubleTransfer(false, src, address.base, address.offset); } void addDouble(FPRegisterID src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + m_assembler.faddd_r(dest, dest, src); } void addDouble(Address src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + loadDouble(src, ARMRegisters::SD0); + addDouble(ARMRegisters::SD0, dest); } void subDouble(FPRegisterID src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + m_assembler.fsubd_r(dest, dest, src); } void subDouble(Address src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + loadDouble(src, ARMRegisters::SD0); + subDouble(ARMRegisters::SD0, dest); } void mulDouble(FPRegisterID src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + m_assembler.fmuld_r(dest, dest, src); } void mulDouble(Address src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + loadDouble(src, ARMRegisters::SD0); + mulDouble(ARMRegisters::SD0, dest); } void convertInt32ToDouble(RegisterID src, FPRegisterID dest) { - UNUSED_PARAM(src); - UNUSED_PARAM(dest); - ASSERT_NOT_REACHED(); + m_assembler.fmsr_r(dest, src); + m_assembler.fsitod_r(dest, dest); } Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { - UNUSED_PARAM(cond); - UNUSED_PARAM(left); - UNUSED_PARAM(right); - ASSERT_NOT_REACHED(); - return jump(); + m_assembler.fcmpd_r(left, right); + m_assembler.fmstat(); + return Jump(m_assembler.jmp(static_cast(cond))); } // Truncates 'src' to an integer, and places the resulting 'dest'. @@ -725,46 +719,56 @@ protected: return static_cast(cond); } + void ensureSpace(int insnSpace, int constSpace) + { + m_assembler.ensureSpace(insnSpace, constSpace); + } + + int sizeOfConstantPool() + { + return m_assembler.sizeOfConstantPool(); + } + void prepareCall() { - m_assembler.ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); + ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); // S0 might be used for parameter passing - m_assembler.add_r(ARM::S1, ARM::pc, ARMAssembler::OP2_IMM | 0x4); - m_assembler.push_r(ARM::S1); + m_assembler.add_r(ARMRegisters::S1, ARMRegisters::pc, ARMAssembler::OP2_IMM | 0x4); + m_assembler.push_r(ARMRegisters::S1); } void call32(RegisterID base, int32_t offset) { - if (base == ARM::sp) + if (base == ARMRegisters::sp) offset += 4; if (offset >= 0) { if (offset <= 0xfff) { prepareCall(); - m_assembler.dtr_u(true, ARM::pc, base, offset); + m_assembler.dtr_u(true, ARMRegisters::pc, base, offset); } else if (offset <= 0xfffff) { - m_assembler.add_r(ARM::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8)); + m_assembler.add_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8)); prepareCall(); - m_assembler.dtr_u(true, ARM::pc, ARM::S0, offset & 0xfff); + m_assembler.dtr_u(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff); } else { - ARMWord reg = m_assembler.getImm(offset, ARM::S0); + ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0); prepareCall(); - m_assembler.dtr_ur(true, ARM::pc, base, reg); + m_assembler.dtr_ur(true, ARMRegisters::pc, base, reg); } } else { offset = -offset; if (offset <= 0xfff) { prepareCall(); - m_assembler.dtr_d(true, ARM::pc, base, offset); + m_assembler.dtr_d(true, ARMRegisters::pc, base, offset); } else if (offset <= 0xfffff) { - m_assembler.sub_r(ARM::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8)); + m_assembler.sub_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8)); prepareCall(); - m_assembler.dtr_d(true, ARM::pc, ARM::S0, offset & 0xfff); + m_assembler.dtr_d(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff); } else { - ARMWord reg = m_assembler.getImm(offset, ARM::S0); + ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0); prepareCall(); - m_assembler.dtr_dr(true, ARM::pc, base, reg); + m_assembler.dtr_dr(true, ARMRegisters::pc, base, reg); } } } @@ -788,10 +792,11 @@ private: ARMAssembler::relinkCall(call.dataLocation(), destination.executableAddress()); } + static const bool s_isVFPPresent; }; } -#endif +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // MacroAssemblerARM_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h index f7a8402..999056b 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -39,9 +39,9 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler { // FIXME: switch dataTempRegister & addressTempRegister, or possibly use r7? // - dTR is likely used more than aTR, and we'll get better instruction // encoding if it's in the low 8 registers. - static const ARM::RegisterID dataTempRegister = ARM::ip; - static const RegisterID addressTempRegister = ARM::r3; - static const FPRegisterID fpTempRegister = ARM::d7; + static const ARMRegisters::RegisterID dataTempRegister = ARMRegisters::ip; + static const RegisterID addressTempRegister = ARMRegisters::r3; + static const FPRegisterID fpTempRegister = ARMRegisters::d7; struct ArmAddress { enum AddressType { @@ -102,8 +102,8 @@ public: DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS, }; - static const RegisterID stackPointerRegister = ARM::sp; - static const RegisterID linkRegister = ARM::lr; + static const RegisterID stackPointerRegister = ARMRegisters::sp; + static const RegisterID linkRegister = ARMRegisters::lr; // Integer arithmetic operations: // @@ -532,6 +532,7 @@ public: Jump branchTruncateDoubleToInt32(FPRegisterID, RegisterID) { ASSERT_NOT_REACHED(); + return jump(); } @@ -546,13 +547,13 @@ public: void pop(RegisterID dest) { // store postindexed with writeback - m_assembler.ldr(dest, ARM::sp, sizeof(void*), false, true); + m_assembler.ldr(dest, ARMRegisters::sp, sizeof(void*), false, true); } void push(RegisterID src) { // store preindexed with writeback - m_assembler.str(src, ARM::sp, -sizeof(void*), true, true); + m_assembler.str(src, ARMRegisters::sp, -sizeof(void*), true, true); } void push(Address address) @@ -1038,7 +1039,7 @@ protected: return addressTempRegister; } - DataLabel32 moveFixedWidthEncoding(Imm32 imm, RegisterID dst) + void moveFixedWidthEncoding(Imm32 imm, RegisterID dst) { uint32_t value = imm.m_value; m_assembler.movT3(dst, ARMThumbImmediate::makeUInt16(value & 0xffff)); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 341a7ff..568260a 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -37,7 +37,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded // into the processor are decorated with the bottom bit set, indicating that this is // thumb code (as oposed to 32-bit traditional ARM). The first test checks for both @@ -124,7 +124,7 @@ public: } explicit MacroAssemblerCodePtr(void* value) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // Decorate the pointer as a thumb code pointer. : m_value(reinterpret_cast(value) + 1) #else @@ -141,7 +141,7 @@ public: } void* executableAddress() const { return m_value; } -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // To use this pointer as a data address remove the decoration. void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast(m_value) - 1; } #else diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h index 0b9ff35..6e96240 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h @@ -51,6 +51,8 @@ public: using MacroAssemblerX86Common::store32; using MacroAssemblerX86Common::branch32; using MacroAssemblerX86Common::call; + using MacroAssemblerX86Common::loadDouble; + using MacroAssemblerX86Common::convertInt32ToDouble; void add32(Imm32 imm, RegisterID src, RegisterID dest) { @@ -87,6 +89,17 @@ public: m_assembler.movl_mr(address, dest); } + void loadDouble(void* address, FPRegisterID dest) + { + ASSERT(isSSE2Present()); + m_assembler.movsd_mr(address, dest); + } + + void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) + { + m_assembler.cvtsi2sd_mr(src.m_ptr, dest); + } + void store32(Imm32 imm, void* address) { m_assembler.movl_i32m(imm.m_value, address); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h index cea691e..61e0e17 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -57,13 +57,14 @@ public: enum DoubleCondition { DoubleEqual = X86Assembler::ConditionE, + DoubleNotEqual = X86Assembler::ConditionNE, DoubleGreaterThan = X86Assembler::ConditionA, DoubleGreaterThanOrEqual = X86Assembler::ConditionAE, DoubleLessThan = X86Assembler::ConditionB, DoubleLessThanOrEqual = X86Assembler::ConditionBE, }; - static const RegisterID stackPointerRegister = X86::esp; + static const RegisterID stackPointerRegister = X86Registers::esp; // Integer arithmetic operations: // @@ -91,6 +92,11 @@ public: { m_assembler.addl_mr(src.offset, src.base, dest); } + + void add32(RegisterID src, Address dest) + { + m_assembler.addl_rm(src, dest.offset, dest.base); + } void and32(RegisterID src, RegisterID dest) { @@ -102,6 +108,16 @@ public: m_assembler.andl_ir(imm.m_value, dest); } + void and32(RegisterID src, Address dest) + { + m_assembler.andl_rm(src, dest.offset, dest.base); + } + + void and32(Address src, RegisterID dest) + { + m_assembler.andl_mr(src.offset, src.base, dest); + } + void and32(Imm32 imm, Address address) { m_assembler.andl_im(imm.m_value, address.offset, address.base); @@ -116,20 +132,20 @@ public: { // On x86 we can only shift by ecx; if asked to shift by another register we'll // need rejig the shift amount into ecx first, and restore the registers afterwards. - if (shift_amount != X86::ecx) { - swap(shift_amount, X86::ecx); + if (shift_amount != X86Registers::ecx) { + swap(shift_amount, X86Registers::ecx); // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx" if (dest == shift_amount) - m_assembler.shll_CLr(X86::ecx); + m_assembler.shll_CLr(X86Registers::ecx); // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx" - else if (dest == X86::ecx) + else if (dest == X86Registers::ecx) m_assembler.shll_CLr(shift_amount); // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx" else m_assembler.shll_CLr(dest); - swap(shift_amount, X86::ecx); + swap(shift_amount, X86Registers::ecx); } else m_assembler.shll_CLr(dest); } @@ -138,16 +154,36 @@ public: { m_assembler.imull_rr(src, dest); } + + void mul32(Address src, RegisterID dest) + { + m_assembler.imull_mr(src.offset, src.base, dest); + } void mul32(Imm32 imm, RegisterID src, RegisterID dest) { m_assembler.imull_i32r(src, imm.m_value, dest); } - + + void neg32(RegisterID srcDest) + { + m_assembler.negl_r(srcDest); + } + + void neg32(Address srcDest) + { + m_assembler.negl_m(srcDest.offset, srcDest.base); + } + void not32(RegisterID srcDest) { m_assembler.notl_r(srcDest); } + + void not32(Address srcDest) + { + m_assembler.notl_m(srcDest.offset, srcDest.base); + } void or32(RegisterID src, RegisterID dest) { @@ -159,6 +195,16 @@ public: m_assembler.orl_ir(imm.m_value, dest); } + void or32(RegisterID src, Address dest) + { + m_assembler.orl_rm(src, dest.offset, dest.base); + } + + void or32(Address src, RegisterID dest) + { + m_assembler.orl_mr(src.offset, src.base, dest); + } + void or32(Imm32 imm, Address address) { m_assembler.orl_im(imm.m_value, address.offset, address.base); @@ -168,20 +214,20 @@ public: { // On x86 we can only shift by ecx; if asked to shift by another register we'll // need rejig the shift amount into ecx first, and restore the registers afterwards. - if (shift_amount != X86::ecx) { - swap(shift_amount, X86::ecx); + if (shift_amount != X86Registers::ecx) { + swap(shift_amount, X86Registers::ecx); // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx" if (dest == shift_amount) - m_assembler.sarl_CLr(X86::ecx); + m_assembler.sarl_CLr(X86Registers::ecx); // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx" - else if (dest == X86::ecx) + else if (dest == X86Registers::ecx) m_assembler.sarl_CLr(shift_amount); // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx" else m_assembler.sarl_CLr(dest); - swap(shift_amount, X86::ecx); + swap(shift_amount, X86Registers::ecx); } else m_assembler.sarl_CLr(dest); } @@ -211,14 +257,35 @@ public: m_assembler.subl_mr(src.offset, src.base, dest); } + void sub32(RegisterID src, Address dest) + { + m_assembler.subl_rm(src, dest.offset, dest.base); + } + + void xor32(RegisterID src, RegisterID dest) { m_assembler.xorl_rr(src, dest); } - void xor32(Imm32 imm, RegisterID srcDest) + void xor32(Imm32 imm, Address dest) { - m_assembler.xorl_ir(imm.m_value, srcDest); + m_assembler.xorl_im(imm.m_value, dest.offset, dest.base); + } + + void xor32(Imm32 imm, RegisterID dest) + { + m_assembler.xorl_ir(imm.m_value, dest); + } + + void xor32(RegisterID src, Address dest) + { + m_assembler.xorl_rm(src, dest.offset, dest.base); + } + + void xor32(Address src, RegisterID dest) + { + m_assembler.xorl_mr(src.offset, src.base, dest); } @@ -300,6 +367,18 @@ public: m_assembler.addsd_mr(src.offset, src.base, dest); } + void divDouble(FPRegisterID src, FPRegisterID dest) + { + ASSERT(isSSE2Present()); + m_assembler.divsd_rr(src, dest); + } + + void divDouble(Address src, FPRegisterID dest) + { + ASSERT(isSSE2Present()); + m_assembler.divsd_mr(src.offset, src.base, dest); + } + void subDouble(FPRegisterID src, FPRegisterID dest) { ASSERT(isSSE2Present()); @@ -330,6 +409,11 @@ public: m_assembler.cvtsi2sd_rr(src, dest); } + void convertInt32ToDouble(Address src, FPRegisterID dest) + { + m_assembler.cvtsi2sd_mr(src.offset, src.base, dest); + } + Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { ASSERT(isSSE2Present()); @@ -337,6 +421,12 @@ public: return Jump(m_assembler.jCC(x86Condition(cond))); } + Jump branchDouble(DoubleCondition cond, FPRegisterID left, Address right) + { + m_assembler.ucomisd_mr(right.offset, right.base, left); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + // Truncates 'src' to an integer, and places the resulting 'dest'. // If the result is not representable as a 32 bit value, branch. // May also branch for some values that are representable in 32 bits @@ -348,6 +438,12 @@ public: return branch32(Equal, dest, Imm32(0x80000000)); } + void zeroDouble(FPRegisterID srcDest) + { + ASSERT(isSSE2Present()); + m_assembler.xorpd_rr(srcDest, srcDest); + } + // Stack manipulation operations: // @@ -397,15 +493,13 @@ public: { // Note: on 64-bit this is is a full register move; perhaps it would be // useful to have separate move32 & movePtr, with move32 zero extending? - m_assembler.movq_rr(src, dest); + if (src != dest) + m_assembler.movq_rr(src, dest); } void move(ImmPtr imm, RegisterID dest) { - if (CAN_SIGN_EXTEND_U32_64(imm.asIntptr())) - m_assembler.movl_i32r(static_cast(imm.asIntptr()), dest); - else - m_assembler.movq_i64r(imm.asIntptr(), dest); + m_assembler.movq_i64r(imm.asIntptr(), dest); } void swap(RegisterID reg1, RegisterID reg2) @@ -605,12 +699,40 @@ public: return Jump(m_assembler.jCC(x86Condition(cond))); } + Jump branchAdd32(Condition cond, Imm32 src, Address dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + add32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchAdd32(Condition cond, RegisterID src, Address dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + add32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchAdd32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + add32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + Jump branchMul32(Condition cond, RegisterID src, RegisterID dest) { ASSERT(cond == Overflow); mul32(src, dest); return Jump(m_assembler.jCC(x86Condition(cond))); } + + Jump branchMul32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + mul32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest) { @@ -632,7 +754,35 @@ public: sub32(imm, dest); return Jump(m_assembler.jCC(x86Condition(cond))); } - + + Jump branchSub32(Condition cond, Imm32 imm, Address dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + sub32(imm, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchSub32(Condition cond, RegisterID src, Address dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + sub32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchSub32(Condition cond, Address src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); + sub32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); + or32(src, dest); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + // Miscellaneous operations: @@ -661,6 +811,27 @@ public: m_assembler.ret(); } + void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + m_assembler.cmpl_rr(right, left); + m_assembler.setCC_r(x86Condition(cond), dest); + } + + void set8(Condition cond, Address left, RegisterID right, RegisterID dest) + { + m_assembler.cmpl_mr(left.offset, left.base, right); + m_assembler.setCC_r(x86Condition(cond), dest); + } + + void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest) + { + if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) + m_assembler.testl_rr(left, left); + else + m_assembler.cmpl_ir(right.m_value, left); + m_assembler.setCC_r(x86Condition(cond), dest); + } + void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) { m_assembler.cmpl_rr(right, left); @@ -682,6 +853,16 @@ public: // The mask should be optional... paerhaps the argument order should be // dest-src, operations always have a dest? ... possibly not true, considering // asm ops like test, or pseudo ops like pop(). + + void setTest8(Condition cond, Address address, Imm32 mask, RegisterID dest) + { + if (mask.m_value == -1) + m_assembler.cmpl_im(0, address.offset, address.base); + else + m_assembler.testl_i32m(mask.m_value, address.offset, address.base); + m_assembler.setCC_r(x86Condition(cond), dest); + } + void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest) { if (mask.m_value == -1) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h index df0090a..0f95fe6 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -38,7 +38,7 @@ namespace JSC { class MacroAssemblerX86_64 : public MacroAssemblerX86Common { protected: - static const X86::RegisterID scratchRegister = X86::r11; + static const X86Registers::RegisterID scratchRegister = X86Registers::r11; public: static const Scale ScalePtr = TimesEight; @@ -50,6 +50,8 @@ public: using MacroAssemblerX86Common::load32; using MacroAssemblerX86Common::store32; using MacroAssemblerX86Common::call; + using MacroAssemblerX86Common::loadDouble; + using MacroAssemblerX86Common::convertInt32ToDouble; void add32(Imm32 imm, AbsoluteAddress address) { @@ -77,21 +79,33 @@ public: void load32(void* address, RegisterID dest) { - if (dest == X86::eax) + if (dest == X86Registers::eax) m_assembler.movl_mEAX(address); else { - move(X86::eax, dest); + move(X86Registers::eax, dest); m_assembler.movl_mEAX(address); - swap(X86::eax, dest); + swap(X86Registers::eax, dest); } } + void loadDouble(void* address, FPRegisterID dest) + { + move(ImmPtr(address), scratchRegister); + loadDouble(scratchRegister, dest); + } + + void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) + { + move(Imm32(*static_cast(src.m_ptr)), scratchRegister); + m_assembler.cvtsi2sd_rr(scratchRegister, dest); + } + void store32(Imm32 imm, void* address) { - move(X86::eax, scratchRegister); - move(imm, X86::eax); + move(X86Registers::eax, scratchRegister); + move(imm, X86Registers::eax); m_assembler.movl_EAXm(address); - move(scratchRegister, X86::eax); + move(scratchRegister, X86Registers::eax); } Call call() @@ -182,20 +196,20 @@ public: { // On x86 we can only shift by ecx; if asked to shift by another register we'll // need rejig the shift amount into ecx first, and restore the registers afterwards. - if (shift_amount != X86::ecx) { - swap(shift_amount, X86::ecx); + if (shift_amount != X86Registers::ecx) { + swap(shift_amount, X86Registers::ecx); // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx" if (dest == shift_amount) - m_assembler.sarq_CLr(X86::ecx); + m_assembler.sarq_CLr(X86Registers::ecx); // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx" - else if (dest == X86::ecx) + else if (dest == X86Registers::ecx) m_assembler.sarq_CLr(shift_amount); // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx" else m_assembler.sarq_CLr(dest); - swap(shift_amount, X86::ecx); + swap(shift_amount, X86Registers::ecx); } else m_assembler.sarq_CLr(dest); } @@ -244,12 +258,12 @@ public: void loadPtr(void* address, RegisterID dest) { - if (dest == X86::eax) + if (dest == X86Registers::eax) m_assembler.movq_mEAX(address); else { - move(X86::eax, dest); + move(X86Registers::eax, dest); m_assembler.movq_mEAX(address); - swap(X86::eax, dest); + swap(X86Registers::eax, dest); } } @@ -271,24 +285,19 @@ public: void storePtr(RegisterID src, void* address) { - if (src == X86::eax) + if (src == X86Registers::eax) m_assembler.movq_EAXm(address); else { - swap(X86::eax, src); + swap(X86Registers::eax, src); m_assembler.movq_EAXm(address); - swap(X86::eax, src); + swap(X86Registers::eax, src); } } void storePtr(ImmPtr imm, ImplicitAddress address) { - intptr_t ptr = imm.asIntptr(); - if (CAN_SIGN_EXTEND_32_64(ptr)) - m_assembler.movq_i32m(static_cast(ptr), address.offset, address.base); - else { - move(imm, scratchRegister); - storePtr(scratchRegister, address); - } + move(imm, scratchRegister); + storePtr(scratchRegister, address); } DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address) @@ -325,17 +334,8 @@ public: Jump branchPtr(Condition cond, RegisterID left, ImmPtr right) { - intptr_t imm = right.asIntptr(); - if (CAN_SIGN_EXTEND_32_64(imm)) { - if (!imm) - m_assembler.testq_rr(left, left); - else - m_assembler.cmpq_ir(imm, left); - return Jump(m_assembler.jCC(x86Condition(cond))); - } else { - move(right, scratchRegister); - return branchPtr(cond, left, scratchRegister); - } + move(right, scratchRegister); + return branchPtr(cond, left, scratchRegister); } Jump branchPtr(Condition cond, RegisterID left, Address right) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h index 745bc60..cbbaaa5 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h @@ -38,12 +38,8 @@ namespace JSC { inline bool CAN_SIGN_EXTEND_8_32(int32_t value) { return value == (int32_t)(signed char)value; } -#if PLATFORM(X86_64) -inline bool CAN_SIGN_EXTEND_32_64(intptr_t value) { return value == (intptr_t)(int32_t)value; } -inline bool CAN_SIGN_EXTEND_U32_64(intptr_t value) { return value == (intptr_t)(uint32_t)value; } -#endif -namespace X86 { +namespace X86Registers { typedef enum { eax, ecx, @@ -80,8 +76,8 @@ namespace X86 { class X86Assembler { public: - typedef X86::RegisterID RegisterID; - typedef X86::XMMRegisterID XMMRegisterID; + typedef X86Registers::RegisterID RegisterID; + typedef X86Registers::XMMRegisterID XMMRegisterID; typedef XMMRegisterID FPRegisterID; typedef enum { @@ -114,10 +110,12 @@ private: OP_OR_GvEv = 0x0B, OP_2BYTE_ESCAPE = 0x0F, OP_AND_EvGv = 0x21, + OP_AND_GvEv = 0x23, OP_SUB_EvGv = 0x29, OP_SUB_GvEv = 0x2B, PRE_PREDICT_BRANCH_NOT_TAKEN = 0x2E, OP_XOR_EvGv = 0x31, + OP_XOR_GvEv = 0x33, OP_CMP_EvGv = 0x39, OP_CMP_GvEv = 0x3B, #if PLATFORM(X86_64) @@ -169,6 +167,8 @@ private: OP2_ADDSD_VsdWsd = 0x58, OP2_MULSD_VsdWsd = 0x59, OP2_SUBSD_VsdWsd = 0x5C, + OP2_DIVSD_VsdWsd = 0x5E, + OP2_XORPD_VpdWpd = 0x57, OP2_MOVD_VdEd = 0x6E, OP2_MOVD_EdVd = 0x7E, OP2_JCC_rel32 = 0x80, @@ -205,6 +205,7 @@ private: GROUP3_OP_TEST = 0, GROUP3_OP_NOT = 2, + GROUP3_OP_NEG = 3, GROUP3_OP_IDIV = 7, GROUP5_OP_CALLN = 2, @@ -226,7 +227,6 @@ public: { } - void enableLatePatch() { } private: JmpSrc(int offset) : m_offset(offset) @@ -319,6 +319,11 @@ public: m_formatter.oneByteOp(OP_ADD_GvEv, dst, base, offset); } + void addl_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_ADD_EvGv, src, base, offset); + } + void addl_ir(int imm, RegisterID dst) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -386,6 +391,16 @@ public: m_formatter.oneByteOp(OP_AND_EvGv, src, dst); } + void andl_mr(int offset, RegisterID base, RegisterID dst) + { + m_formatter.oneByteOp(OP_AND_GvEv, dst, base, offset); + } + + void andl_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_AND_EvGv, src, base, offset); + } + void andl_ir(int imm, RegisterID dst) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -437,11 +452,26 @@ public: } #endif + void negl_r(RegisterID dst) + { + m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NEG, dst); + } + + void negl_m(int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NEG, base, offset); + } + void notl_r(RegisterID dst) { m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NOT, dst); } + void notl_m(int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NOT, base, offset); + } + void orl_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp(OP_OR_EvGv, src, dst); @@ -452,6 +482,11 @@ public: m_formatter.oneByteOp(OP_OR_GvEv, dst, base, offset); } + void orl_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_OR_EvGv, src, base, offset); + } + void orl_ir(int imm, RegisterID dst) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -513,6 +548,11 @@ public: m_formatter.oneByteOp(OP_SUB_GvEv, dst, base, offset); } + void subl_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_SUB_EvGv, src, base, offset); + } + void subl_ir(int imm, RegisterID dst) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -569,6 +609,27 @@ public: m_formatter.oneByteOp(OP_XOR_EvGv, src, dst); } + void xorl_mr(int offset, RegisterID base, RegisterID dst) + { + m_formatter.oneByteOp(OP_XOR_GvEv, dst, base, offset); + } + + void xorl_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp(OP_XOR_EvGv, src, base, offset); + } + + void xorl_im(int imm, int offset, RegisterID base) + { + if (CAN_SIGN_EXTEND_8_32(imm)) { + m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_XOR, base, offset); + m_formatter.immediate8(imm); + } else { + m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_XOR, base, offset); + m_formatter.immediate32(imm); + } + } + void xorl_ir(int imm, RegisterID dst) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -649,7 +710,12 @@ public: { m_formatter.twoByteOp(OP2_IMUL_GvEv, dst, src); } - + + void imull_mr(int offset, RegisterID base, RegisterID dst) + { + m_formatter.twoByteOp(OP2_IMUL_GvEv, dst, base, offset); + } + void imull_i32r(RegisterID src, int32_t value, RegisterID dst) { m_formatter.oneByteOp(OP_IMUL_GvEvIz, dst, src); @@ -1048,7 +1114,7 @@ public: #else void movl_rm(RegisterID src, void* addr) { - if (src == X86::eax) + if (src == X86Registers::eax) movl_EAXm(addr); else m_formatter.oneByteOp(OP_MOV_EvGv, src, addr); @@ -1056,7 +1122,7 @@ public: void movl_mr(void* addr, RegisterID dst) { - if (dst == X86::eax) + if (dst == X86Registers::eax) movl_mEAX(addr); else m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr); @@ -1154,6 +1220,11 @@ public: return m_formatter.immediateRel32(); } + JmpSrc jz() + { + return je(); + } + JmpSrc jl() { m_formatter.twoByteOp(jccRel32(ConditionL)); @@ -1246,6 +1317,20 @@ public: m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, src); } + void cvtsi2sd_mr(int offset, RegisterID base, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_F2); + m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, base, offset); + } + +#if !PLATFORM(X86_64) + void cvtsi2sd_mr(void* address, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_F2); + m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, address); + } +#endif + void cvttsd2si_rr(XMMRegisterID src, RegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1284,6 +1369,14 @@ public: m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, base, offset); } +#if !PLATFORM(X86_64) + void movsd_mr(void* address, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_F2); + m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, address); + } +#endif + void mulsd_rr(XMMRegisterID src, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1321,6 +1414,30 @@ public: m_formatter.twoByteOp(OP2_UCOMISD_VsdWsd, (RegisterID)dst, (RegisterID)src); } + void ucomisd_mr(int offset, RegisterID base, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_UCOMISD_VsdWsd, (RegisterID)dst, base, offset); + } + + void divsd_rr(XMMRegisterID src, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_F2); + m_formatter.twoByteOp(OP2_DIVSD_VsdWsd, (RegisterID)dst, (RegisterID)src); + } + + void divsd_mr(int offset, RegisterID base, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_F2); + m_formatter.twoByteOp(OP2_DIVSD_VsdWsd, (RegisterID)dst, base, offset); + } + + void xorpd_rr(XMMRegisterID src, XMMRegisterID dst) + { + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_XORPD_VpdWpd, (RegisterID)dst, (RegisterID)src); + } + // Misc instructions: void int3() @@ -1605,6 +1722,16 @@ private: memoryModRM(reg, base, index, scale, offset); } +#if !PLATFORM(X86_64) + void twoByteOp(TwoByteOpcodeID opcode, int reg, void* address) + { + m_buffer.ensureSpace(maxInstructionSize); + m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE); + m_buffer.putByteUnchecked(opcode); + memoryModRM(reg, address); + } +#endif + #if PLATFORM(X86_64) // Quad-word-sized operands: // @@ -1761,23 +1888,23 @@ private: // Internals; ModRm and REX formatters. - static const RegisterID noBase = X86::ebp; - static const RegisterID hasSib = X86::esp; - static const RegisterID noIndex = X86::esp; + static const RegisterID noBase = X86Registers::ebp; + static const RegisterID hasSib = X86Registers::esp; + static const RegisterID noIndex = X86Registers::esp; #if PLATFORM(X86_64) - static const RegisterID noBase2 = X86::r13; - static const RegisterID hasSib2 = X86::r12; + static const RegisterID noBase2 = X86Registers::r13; + static const RegisterID hasSib2 = X86Registers::r12; // Registers r8 & above require a REX prefixe. inline bool regRequiresRex(int reg) { - return (reg >= X86::r8); + return (reg >= X86Registers::r8); } // Byte operand register spl & above require a REX prefix (to prevent the 'H' registers be accessed). inline bool byteRegRequiresRex(int reg) { - return (reg >= X86::esp); + return (reg >= X86Registers::esp); } // Format a REX prefix byte. diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp index 596d89a..7e5f6cf 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp @@ -33,6 +33,8 @@ #include "JIT.h" #include "JSValue.h" #include "Interpreter.h" +#include "JSFunction.h" +#include "JSStaticScopeObject.h" #include "Debugger.h" #include "BytecodeGenerator.h" #include @@ -57,6 +59,9 @@ static UString escapeQuotes(const UString& str) static UString valueToSourceString(ExecState* exec, JSValue val) { + if (!val) + return "0"; + if (val.isString()) { UString result("\""); result += escapeQuotes(val.toString(exec)) + "\""; @@ -227,44 +232,44 @@ static void printGlobalResolveInfo(const GlobalResolveInfo& resolveInfo, unsigne static void printStructureStubInfo(const StructureStubInfo& stubInfo, unsigned instructionOffset) { - switch (stubInfo.opcodeID) { - case op_get_by_id_self: + switch (stubInfo.accessType) { + case access_get_by_id_self: printf(" [%4d] %s: %s\n", instructionOffset, "get_by_id_self", pointerToSourceString(stubInfo.u.getByIdSelf.baseObjectStructure).UTF8String().c_str()); return; - case op_get_by_id_proto: + case access_get_by_id_proto: printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(stubInfo.u.getByIdProto.baseObjectStructure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.getByIdProto.prototypeStructure).UTF8String().c_str()); return; - case op_get_by_id_chain: + case access_get_by_id_chain: printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(stubInfo.u.getByIdChain.baseObjectStructure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.getByIdChain.chain).UTF8String().c_str()); return; - case op_get_by_id_self_list: + case access_get_by_id_self_list: printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_self_list", pointerToSourceString(stubInfo.u.getByIdSelfList.structureList).UTF8String().c_str(), stubInfo.u.getByIdSelfList.listSize); return; - case op_get_by_id_proto_list: + case access_get_by_id_proto_list: printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_proto_list", pointerToSourceString(stubInfo.u.getByIdProtoList.structureList).UTF8String().c_str(), stubInfo.u.getByIdProtoList.listSize); return; - case op_put_by_id_transition: + case access_put_by_id_transition: printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(stubInfo.u.putByIdTransition.previousStructure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.putByIdTransition.structure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.putByIdTransition.chain).UTF8String().c_str()); return; - case op_put_by_id_replace: + case access_put_by_id_replace: printf(" [%4d] %s: %s\n", instructionOffset, "put_by_id_replace", pointerToSourceString(stubInfo.u.putByIdReplace.baseObjectStructure).UTF8String().c_str()); return; - case op_get_by_id: + case access_get_by_id: printf(" [%4d] %s\n", instructionOffset, "get_by_id"); return; - case op_put_by_id: + case access_put_by_id: printf(" [%4d] %s\n", instructionOffset, "put_by_id"); return; - case op_get_by_id_generic: + case access_get_by_id_generic: printf(" [%4d] %s\n", instructionOffset, "op_get_by_id_generic"); return; - case op_put_by_id_generic: + case access_put_by_id_generic: printf(" [%4d] %s\n", instructionOffset, "op_put_by_id_generic"); return; - case op_get_array_length: + case access_get_array_length: printf(" [%4d] %s\n", instructionOffset, "op_get_array_length"); return; - case op_get_string_length: + case access_get_string_length: printf(" [%4d] %s\n", instructionOffset, "op_get_string_length"); return; default: @@ -595,6 +600,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_div: { printBinaryOp(location, it, "div"); + ++it; break; } case op_mod: { @@ -739,13 +745,6 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } - case op_resolve_func: { - int r0 = (++it)->u.operand; - int r1 = (++it)->u.operand; - int id0 = (++it)->u.operand; - printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); - break; - } case op_get_by_id: { printGetByIdOp(location, it, m_identifiers, "get_by_id"); break; @@ -1250,45 +1249,23 @@ void CodeBlock::dumpStatistics() #endif } -CodeBlock::CodeBlock(ScopeNode* ownerNode) - : m_numCalleeRegisters(0) - , m_numVars(0) - , m_numParameters(0) - , m_ownerNode(ownerNode) - , m_globalData(0) -#ifndef NDEBUG - , m_instructionCount(0) -#endif - , m_needsFullScopeChain(false) - , m_usesEval(false) - , m_usesArguments(false) - , m_isNumericCompareFunction(false) - , m_codeType(NativeCode) - , m_source(0) - , m_sourceOffset(0) - , m_exceptionInfo(0) -{ -#if DUMP_CODE_BLOCK_STATISTICS - liveCodeBlockSet.add(this); -#endif -} - -CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr sourceProvider, unsigned sourceOffset) +CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr sourceProvider, unsigned sourceOffset, SymbolTable* symTab) : m_numCalleeRegisters(0) , m_numVars(0) , m_numParameters(0) - , m_ownerNode(ownerNode) + , m_ownerExecutable(ownerExecutable) , m_globalData(0) #ifndef NDEBUG , m_instructionCount(0) #endif - , m_needsFullScopeChain(ownerNode->needsActivation()) - , m_usesEval(ownerNode->usesEval()) - , m_usesArguments(ownerNode->usesArguments()) + , m_needsFullScopeChain(ownerExecutable->needsActivation()) + , m_usesEval(ownerExecutable->usesEval()) + , m_usesArguments(ownerExecutable->usesArguments()) , m_isNumericCompareFunction(false) , m_codeType(codeType) , m_source(sourceProvider) , m_sourceOffset(sourceOffset) + , m_symbolTable(symTab) , m_exceptionInfo(new ExceptionInfo) { ASSERT(m_source); @@ -1325,20 +1302,23 @@ CodeBlock::~CodeBlock() if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure) { structure->deref(); // Both members must be filled at the same time - ASSERT(m_methodCallLinkInfos[i].cachedPrototypeStructure); + ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure); m_methodCallLinkInfos[i].cachedPrototypeStructure->deref(); } } +#if ENABLE(JIT_OPTIMIZE_CALL) unlinkCallers(); #endif +#endif // !ENABLE(JIT) + #if DUMP_CODE_BLOCK_STATISTICS liveCodeBlockSet.remove(this); #endif } -#if ENABLE(JIT) +#if ENABLE(JIT_OPTIMIZE_CALL) void CodeBlock::unlinkCallers() { size_t size = m_linkedCallerList.size(); @@ -1353,7 +1333,6 @@ void CodeBlock::unlinkCallers() void CodeBlock::derefStructures(Instruction* vPC) const { - ASSERT(m_codeType != NativeCode); Interpreter* interpreter = m_globalData->interpreter; if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { @@ -1399,7 +1378,6 @@ void CodeBlock::derefStructures(Instruction* vPC) const void CodeBlock::refStructures(Instruction* vPC) const { - ASSERT(m_codeType != NativeCode); Interpreter* interpreter = m_globalData->interpreter; if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { @@ -1431,26 +1409,18 @@ void CodeBlock::refStructures(Instruction* vPC) const ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic)); } -void CodeBlock::mark() +void CodeBlock::markAggregate(MarkStack& markStack) { for (size_t i = 0; i < m_constantRegisters.size(); ++i) - if (!m_constantRegisters[i].marked()) - m_constantRegisters[i].mark(); - - for (size_t i = 0; i < m_functionExpressions.size(); ++i) - m_functionExpressions[i]->body()->mark(); - - if (m_rareData) { - for (size_t i = 0; i < m_rareData->m_functions.size(); ++i) - m_rareData->m_functions[i]->body()->mark(); - - m_rareData->m_evalCodeCache.mark(); - } + markStack.append(m_constantRegisters[i].jsValue()); + for (size_t i = 0; i < m_functionExprs.size(); ++i) + m_functionExprs[i]->markAggregate(markStack); + for (size_t i = 0; i < m_functionDecls.size(); ++i) + m_functionDecls[i]->markAggregate(markStack); } void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame) { - ASSERT(m_codeType != NativeCode); if (m_exceptionInfo) return; @@ -1467,61 +1437,11 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame) scopeChain = scopeChain->next; } - switch (m_codeType) { - case FunctionCode: { - FunctionBodyNode* ownerFunctionBodyNode = static_cast(m_ownerNode); - RefPtr newFunctionBody = m_globalData->parser->reparse(m_globalData, ownerFunctionBodyNode); - ASSERT(newFunctionBody); - newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount()); - - m_globalData->scopeNodeBeingReparsed = newFunctionBody.get(); - - CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain, this); - ASSERT(newCodeBlock.m_exceptionInfo); - ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); - -#if ENABLE(JIT) - JIT::compile(m_globalData, &newCodeBlock); - ASSERT(newFunctionBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); -#endif - - m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); - - m_globalData->scopeNodeBeingReparsed = 0; - - break; - } - case EvalCode: { - EvalNode* ownerEvalNode = static_cast(m_ownerNode); - RefPtr newEvalBody = m_globalData->parser->reparse(m_globalData, ownerEvalNode); - - m_globalData->scopeNodeBeingReparsed = newEvalBody.get(); - - EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain, this); - ASSERT(newCodeBlock.m_exceptionInfo); - ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); - -#if ENABLE(JIT) - JIT::compile(m_globalData, &newCodeBlock); - ASSERT(newEvalBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); -#endif - - m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); - - m_globalData->scopeNodeBeingReparsed = 0; - - break; - } - default: - // CodeBlocks for Global code blocks are transient and therefore to not gain from - // from throwing out there exception information. - ASSERT_NOT_REACHED(); - } + m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this)); } HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) { - ASSERT(m_codeType != NativeCode); ASSERT(bytecodeOffset < m_instructionCount); if (!m_rareData) @@ -1540,14 +1460,13 @@ HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset) { - ASSERT(m_codeType != NativeCode); ASSERT(bytecodeOffset < m_instructionCount); reparseForExceptionInfoIfNecessary(callFrame); ASSERT(m_exceptionInfo); if (!m_exceptionInfo->m_lineInfo.size()) - return m_ownerNode->source().firstLine(); // Empty function + return m_ownerExecutable->source().firstLine(); // Empty function int low = 0; int high = m_exceptionInfo->m_lineInfo.size(); @@ -1560,13 +1479,12 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco } if (!low) - return m_ownerNode->source().firstLine(); + return m_ownerExecutable->source().firstLine(); return m_exceptionInfo->m_lineInfo[low - 1].lineNumber; } int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset) { - ASSERT(m_codeType != NativeCode); ASSERT(bytecodeOffset < m_instructionCount); reparseForExceptionInfoIfNecessary(callFrame); @@ -1606,7 +1524,6 @@ int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned b bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, OpcodeID& opcodeID) { - ASSERT(m_codeType != NativeCode); ASSERT(bytecodeOffset < m_instructionCount); reparseForExceptionInfoIfNecessary(callFrame); @@ -1635,7 +1552,6 @@ bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsi #if ENABLE(JIT) bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex) { - ASSERT(m_codeType != NativeCode); ASSERT(bytecodeOffset < m_instructionCount); if (!m_rareData || !m_rareData->m_functionRegisterInfos.size()) @@ -1662,7 +1578,6 @@ bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& #if !ENABLE(JIT) bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset) { - ASSERT(m_codeType != NativeCode); if (m_globalResolveInstructions.isEmpty()) return false; @@ -1683,7 +1598,6 @@ bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOff #else bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset) { - ASSERT(m_codeType != NativeCode); if (m_globalResolveInfos.isEmpty()) return false; @@ -1703,18 +1617,6 @@ bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset) } #endif -#if ENABLE(JIT) -void CodeBlock::setJITCode(JITCode jitCode) -{ - ASSERT(m_codeType != NativeCode); - ownerNode()->setJITCode(jitCode); -#if !ENABLE(OPCODE_SAMPLING) - if (!BytecodeGenerator::dumpsGeneratedCode()) - m_instructions.clear(); -#endif -} -#endif - void CodeBlock::shrinkToFit() { m_instructions.shrinkToFit(); @@ -1730,7 +1632,8 @@ void CodeBlock::shrinkToFit() #endif m_identifiers.shrinkToFit(); - m_functionExpressions.shrinkToFit(); + m_functionDecls.shrinkToFit(); + m_functionExprs.shrinkToFit(); m_constantRegisters.shrinkToFit(); if (m_exceptionInfo) { @@ -1741,7 +1644,6 @@ void CodeBlock::shrinkToFit() if (m_rareData) { m_rareData->m_exceptionHandlers.shrinkToFit(); - m_rareData->m_functions.shrinkToFit(); m_rareData->m_regexps.shrinkToFit(); m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); m_rareData->m_characterSwitchJumpTables.shrinkToFit(); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h index e9f2697..0163540 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h @@ -36,6 +36,7 @@ #include "JSGlobalObject.h" #include "JumpTable.h" #include "Nodes.h" +#include "PtrAndFlags.h" #include "RegExp.h" #include "UString.h" #include @@ -54,9 +55,13 @@ static const int FirstConstantRegisterIndex = 0x40000000; namespace JSC { + enum HasSeenShouldRepatch { + hasSeenShouldRepatch + }; + class ExecState; - enum CodeType { GlobalCode, EvalCode, FunctionCode, NativeCode }; + enum CodeType { GlobalCode, EvalCode, FunctionCode }; static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits::max(); } @@ -105,25 +110,44 @@ namespace JSC { CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; - CodeBlock* ownerCodeBlock; + PtrAndFlags ownerCodeBlock; CodeBlock* callee; unsigned position; void setUnlinked() { callee = 0; } bool isLinked() { return callee; } + + bool seenOnce() + { + return ownerCodeBlock.isFlagSet(hasSeenShouldRepatch); + } + + void setSeen() + { + ownerCodeBlock.setFlag(hasSeenShouldRepatch); + } }; struct MethodCallLinkInfo { MethodCallLinkInfo() : cachedStructure(0) - , cachedPrototypeStructure(0) { } + bool seenOnce() + { + return cachedPrototypeStructure.isFlagSet(hasSeenShouldRepatch); + } + + void setSeen() + { + cachedPrototypeStructure.setFlag(hasSeenShouldRepatch); + } + CodeLocationCall callReturnLocation; CodeLocationDataLabelPtr structureLabel; Structure* cachedStructure; - Structure* cachedPrototypeStructure; + PtrAndFlags cachedPrototypeStructure; }; struct FunctionRegisterInfo { @@ -224,17 +248,27 @@ namespace JSC { } #endif + struct ExceptionInfo : FastAllocBase { + Vector m_expressionInfo; + Vector m_lineInfo; + Vector m_getByIdExceptionInfo; + +#if ENABLE(JIT) + Vector m_callReturnIndexVector; +#endif + }; + class CodeBlock : public FastAllocBase { friend class JIT; + protected: + CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr, unsigned sourceOffset, SymbolTable* symbolTable); public: - CodeBlock(ScopeNode* ownerNode); - CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr, unsigned sourceOffset); - ~CodeBlock(); + virtual ~CodeBlock(); - void mark(); + void markAggregate(MarkStack&); void refStructures(Instruction* vPC) const; void derefStructures(Instruction* vPC) const; -#if ENABLE(JIT) +#if ENABLE(JIT_OPTIMIZE_CALL) void unlinkCallers(); #endif @@ -305,7 +339,7 @@ namespace JSC { unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress) { reparseForExceptionInfoIfNecessary(callFrame); - return binaryChop(m_exceptionInfo->m_callReturnIndexVector.begin(), m_exceptionInfo->m_callReturnIndexVector.size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex; + return binaryChop(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerExecutable()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex; } bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex); @@ -315,17 +349,19 @@ namespace JSC { bool isNumericCompareFunction() { return m_isNumericCompareFunction; } Vector& instructions() { return m_instructions; } + void discardBytecode() { m_instructions.clear(); } + #ifndef NDEBUG + unsigned instructionCount() { return m_instructionCount; } void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; } #endif #if ENABLE(JIT) - JITCode& getJITCode() { return ownerNode()->generatedJITCode(); } - void setJITCode(JITCode); - ExecutablePool* executablePool() { return ownerNode()->getExecutablePool(); } + JITCode& getJITCode() { return ownerExecutable()->generatedJITCode(); } + ExecutablePool* executablePool() { return ownerExecutable()->getExecutablePool(); } #endif - ScopeNode* ownerNode() const { return m_ownerNode; } + ScriptExecutable* ownerExecutable() const { return m_ownerExecutable; } void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; } @@ -341,8 +377,8 @@ namespace JSC { CodeType codeType() const { return m_codeType; } - SourceProvider* source() const { ASSERT(m_codeType != NativeCode); return m_source.get(); } - unsigned sourceOffset() const { ASSERT(m_codeType != NativeCode); return m_sourceOffset; } + SourceProvider* source() const { return m_source.get(); } + unsigned sourceOffset() const { return m_sourceOffset; } size_t numberOfJumpTargets() const { return m_jumpTargets.size(); } void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); } @@ -380,6 +416,7 @@ namespace JSC { bool hasExceptionInfo() const { return m_exceptionInfo; } void clearExceptionInfo() { m_exceptionInfo.clear(); } + ExceptionInfo* extractExceptionInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo.release(); } void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_expressionInfo.append(expressionInfo); } void addGetByIdExceptionInfo(const GetByIdExceptionInfo& info) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_getByIdExceptionInfo.append(info); } @@ -404,13 +441,11 @@ namespace JSC { ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; } ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } - unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; } - FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); } - - unsigned addFunction(FuncDeclNode* n) { createRareDataIfNecessary(); unsigned size = m_rareData->m_functions.size(); m_rareData->m_functions.append(n); return size; } - FuncDeclNode* function(int index) const { ASSERT(m_rareData); return m_rareData->m_functions[index].get(); } - - bool hasFunctions() const { return m_functionExpressions.size() || (m_rareData && m_rareData->m_functions.size()); } + unsigned addFunctionDecl(PassRefPtr n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; } + FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); } + int numberOfFunctionDecls() { return m_functionDecls.size(); } + unsigned addFunctionExpr(PassRefPtr n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; } + FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; } RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } @@ -431,9 +466,10 @@ namespace JSC { StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; } - SymbolTable& symbolTable() { return m_symbolTable; } + SymbolTable* symbolTable() { return m_symbolTable; } + SharedSymbolTable* sharedSymbolTable() { ASSERT(m_codeType == FunctionCode); return static_cast(m_symbolTable); } - EvalCodeCache& evalCodeCache() { ASSERT(m_codeType != NativeCode); createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } + EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } void shrinkToFit(); @@ -452,12 +488,11 @@ namespace JSC { void createRareDataIfNecessary() { - ASSERT(m_codeType != NativeCode); if (!m_rareData) m_rareData.set(new RareData); } - ScopeNode* m_ownerNode; + ScriptExecutable* m_ownerExecutable; JSGlobalData* m_globalData; Vector m_instructions; @@ -493,26 +528,17 @@ namespace JSC { // Constant Pool Vector m_identifiers; Vector m_constantRegisters; - Vector > m_functionExpressions; - - SymbolTable m_symbolTable; + Vector > m_functionDecls; + Vector > m_functionExprs; - struct ExceptionInfo : FastAllocBase { - Vector m_expressionInfo; - Vector m_lineInfo; - Vector m_getByIdExceptionInfo; + SymbolTable* m_symbolTable; -#if ENABLE(JIT) - Vector m_callReturnIndexVector; -#endif - }; OwnPtr m_exceptionInfo; struct RareData : FastAllocBase { Vector m_exceptionHandlers; // Rare Constants - Vector > m_functions; Vector > m_regexps; // Jump Tables @@ -532,16 +558,16 @@ namespace JSC { // Program code is not marked by any function, so we make the global object // responsible for marking it. - class ProgramCodeBlock : public CodeBlock { + class GlobalCodeBlock : public CodeBlock { public: - ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr sourceProvider) - : CodeBlock(ownerNode, codeType, sourceProvider, 0) + GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject) + : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable) , m_globalObject(globalObject) { m_globalObject->codeBlocks().add(this); } - ~ProgramCodeBlock() + ~GlobalCodeBlock() { if (m_globalObject) m_globalObject->codeBlocks().remove(this); @@ -551,20 +577,54 @@ namespace JSC { private: JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool. + SymbolTable m_unsharedSymbolTable; + }; + + class ProgramCodeBlock : public GlobalCodeBlock { + public: + ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr sourceProvider) + : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject) + { + } }; - class EvalCodeBlock : public ProgramCodeBlock { + class EvalCodeBlock : public GlobalCodeBlock { public: - EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr sourceProvider, int baseScopeDepth) - : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider) + EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr sourceProvider, int baseScopeDepth) + : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject) , m_baseScopeDepth(baseScopeDepth) { } int baseScopeDepth() const { return m_baseScopeDepth; } + const Identifier& variable(unsigned index) { return m_variables[index]; } + unsigned numVariables() { return m_variables.size(); } + void adoptVariables(Vector& variables) + { + ASSERT(m_variables.isEmpty()); + m_variables.swap(variables); + } + private: int m_baseScopeDepth; + Vector m_variables; + }; + + class FunctionCodeBlock : public CodeBlock { + public: + // Rather than using the usual RefCounted::create idiom for SharedSymbolTable we just use new + // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared + // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref + // in the destructor. + FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr sourceProvider, unsigned sourceOffset) + : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, new SharedSymbolTable) + { + } + ~FunctionCodeBlock() + { + sharedSymbolTable()->deref(); + } }; inline Register& ExecState::r(int index) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h index f0ce73e..0e1fb1e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h @@ -29,6 +29,7 @@ #ifndef EvalCodeCache_h #define EvalCodeCache_h +#include "Executable.h" #include "JSGlobalObject.h" #include "Nodes.h" #include "Parser.h" @@ -41,44 +42,33 @@ namespace JSC { class EvalCodeCache { public: - PassRefPtr get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) + PassRefPtr get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) { - RefPtr evalNode; + RefPtr evalExecutable; if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject()) - evalNode = m_cacheMap.get(evalSource.rep()); + evalExecutable = m_cacheMap.get(evalSource.rep()); - if (!evalNode) { - int errorLine; - UString errorMessage; - - SourceCode source = makeSource(evalSource); - evalNode = exec->globalData().parser->parse(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage); - if (evalNode) { - if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) - m_cacheMap.set(evalSource.rep(), evalNode); - } else { - exceptionValue = Error::create(exec, SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0); + if (!evalExecutable) { + evalExecutable = EvalExecutable::create(makeSource(evalSource)); + exceptionValue = evalExecutable->compile(exec, scopeChain); + if (exceptionValue) return 0; - } + + if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) + m_cacheMap.set(evalSource.rep(), evalExecutable); } - return evalNode.release(); + return evalExecutable.release(); } bool isEmpty() const { return m_cacheMap.isEmpty(); } - void mark() - { - EvalCacheMap::iterator end = m_cacheMap.end(); - for (EvalCacheMap::iterator ptr = m_cacheMap.begin(); ptr != end; ++ptr) - ptr->second->mark(); - } private: static const int maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; - typedef HashMap, RefPtr > EvalCacheMap; + typedef HashMap, RefPtr > EvalCacheMap; EvalCacheMap m_cacheMap; }; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h index 594c4dd..bc2de19 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h @@ -54,7 +54,7 @@ namespace JSC { class StructureChain; // Structure used by op_get_by_id_self_list and op_get_by_id_proto_list instruction to hold data off the main opcode stream. - struct PolymorphicAccessStructureList { + struct PolymorphicAccessStructureList : FastAllocBase { struct PolymorphicStubInfo { bool isChain; PolymorphicAccessStructureListStubRoutineType stubRoutine; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h index 4baa0be..cf50442 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h @@ -67,7 +67,7 @@ namespace JSC { macro(op_negate, 3) \ macro(op_add, 5) \ macro(op_mul, 5) \ - macro(op_div, 4) \ + macro(op_div, 5) \ macro(op_mod, 4) \ macro(op_sub, 5) \ \ @@ -98,7 +98,6 @@ namespace JSC { macro(op_put_global_var, 4) \ macro(op_resolve_base, 3) \ macro(op_resolve_with_base, 4) \ - macro(op_resolve_func, 4) \ macro(op_get_by_id, 8) \ macro(op_get_by_id_self, 8) \ macro(op_get_by_id_self_list, 8) \ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp index 8651723..8d0faa1 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp @@ -197,7 +197,7 @@ void SamplingTool::doRun() #if ENABLE(CODEBLOCK_SAMPLING) if (CodeBlock* codeBlock = sample.codeBlock()) { MutexLocker locker(m_scopeSampleMapMutex); - ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerNode()); + ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); ASSERT(record); record->sample(codeBlock, sample.vPC()); } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h index fa95603..1a3f7cf 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h @@ -136,7 +136,7 @@ namespace JSC { class SamplingTool { public: - friend class CallRecord; + friend struct CallRecord; friend class HostCallRecord; #if ENABLE(OPCODE_SAMPLING) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp index bf3fdc4..018d832 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp @@ -31,44 +31,44 @@ namespace JSC { #if ENABLE(JIT) void StructureStubInfo::deref() { - switch (opcodeID) { - case op_get_by_id_self: + switch (accessType) { + case access_get_by_id_self: u.getByIdSelf.baseObjectStructure->deref(); return; - case op_get_by_id_proto: + case access_get_by_id_proto: u.getByIdProto.baseObjectStructure->deref(); u.getByIdProto.prototypeStructure->deref(); return; - case op_get_by_id_chain: + case access_get_by_id_chain: u.getByIdChain.baseObjectStructure->deref(); u.getByIdChain.chain->deref(); return; - case op_get_by_id_self_list: { + case access_get_by_id_self_list: { PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; polymorphicStructures->derefStructures(u.getByIdSelfList.listSize); delete polymorphicStructures; return; } - case op_get_by_id_proto_list: { + case access_get_by_id_proto_list: { PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList; polymorphicStructures->derefStructures(u.getByIdProtoList.listSize); delete polymorphicStructures; return; } - case op_put_by_id_transition: + case access_put_by_id_transition: u.putByIdTransition.previousStructure->deref(); u.putByIdTransition.structure->deref(); u.putByIdTransition.chain->deref(); return; - case op_put_by_id_replace: + case access_put_by_id_replace: u.putByIdReplace.baseObjectStructure->deref(); return; - case op_get_by_id: - case op_put_by_id: - case op_get_by_id_generic: - case op_put_by_id_generic: - case op_get_array_length: - case op_get_string_length: + case access_get_by_id: + case access_put_by_id: + case access_get_by_id_generic: + case access_put_by_id_generic: + case access_get_array_length: + case access_get_string_length: // These instructions don't ref their Structures. return; default: diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h index 95dd266..8e2c489 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h @@ -35,15 +35,32 @@ namespace JSC { + enum AccessType { + access_get_by_id_self, + access_get_by_id_proto, + access_get_by_id_chain, + access_get_by_id_self_list, + access_get_by_id_proto_list, + access_put_by_id_transition, + access_put_by_id_replace, + access_get_by_id, + access_put_by_id, + access_get_by_id_generic, + access_put_by_id_generic, + access_get_array_length, + access_get_string_length, + }; + struct StructureStubInfo { - StructureStubInfo(OpcodeID opcodeID) - : opcodeID(opcodeID) + StructureStubInfo(AccessType accessType) + : accessType(accessType) + , seen(false) { } void initGetByIdSelf(Structure* baseObjectStructure) { - opcodeID = op_get_by_id_self; + accessType = access_get_by_id_self; u.getByIdSelf.baseObjectStructure = baseObjectStructure; baseObjectStructure->ref(); @@ -51,7 +68,7 @@ namespace JSC { void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure) { - opcodeID = op_get_by_id_proto; + accessType = access_get_by_id_proto; u.getByIdProto.baseObjectStructure = baseObjectStructure; baseObjectStructure->ref(); @@ -62,7 +79,7 @@ namespace JSC { void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain) { - opcodeID = op_get_by_id_chain; + accessType = access_get_by_id_chain; u.getByIdChain.baseObjectStructure = baseObjectStructure; baseObjectStructure->ref(); @@ -73,7 +90,7 @@ namespace JSC { void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize) { - opcodeID = op_get_by_id_self_list; + accessType = access_get_by_id_self_list; u.getByIdProtoList.structureList = structureList; u.getByIdProtoList.listSize = listSize; @@ -81,7 +98,7 @@ namespace JSC { void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize) { - opcodeID = op_get_by_id_proto_list; + accessType = access_get_by_id_proto_list; u.getByIdProtoList.structureList = structureList; u.getByIdProtoList.listSize = listSize; @@ -91,7 +108,7 @@ namespace JSC { void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain) { - opcodeID = op_put_by_id_transition; + accessType = access_put_by_id_transition; u.putByIdTransition.previousStructure = previousStructure; previousStructure->ref(); @@ -105,7 +122,7 @@ namespace JSC { void initPutByIdReplace(Structure* baseObjectStructure) { - opcodeID = op_put_by_id_replace; + accessType = access_put_by_id_replace; u.putByIdReplace.baseObjectStructure = baseObjectStructure; baseObjectStructure->ref(); @@ -113,7 +130,19 @@ namespace JSC { void deref(); - OpcodeID opcodeID; + bool seenOnce() + { + return seen; + } + + void setSeen() + { + seen = true; + } + + int accessType : 31; + int seen : 1; + union { struct { Structure* baseObjectStructure; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 711beb4..74bf4f8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -256,15 +256,15 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d m_nextGlobalIndex -= symbolTable->size(); for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - globalObject->removeDirect(funcDecl->m_ident); // Make sure our new function is not shadowed by an old property. - emitNewFunction(addGlobalVar(funcDecl->m_ident, false), funcDecl); + FunctionBodyNode* function = functionStack[i]; + globalObject->removeDirect(function->ident()); // Make sure our new function is not shadowed by an old property. + emitNewFunction(addGlobalVar(function->ident(), false), function); } Vector newVars; for (size_t i = 0; i < varStack.size(); ++i) - if (!globalObject->hasProperty(exec, varStack[i].first)) - newVars.append(addGlobalVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant)); + if (!globalObject->hasProperty(exec, *varStack[i].first)) + newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant)); preserveLastVar(); @@ -272,16 +272,16 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d emitLoad(newVars[i], jsUndefined()); } else { for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - globalObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec, scopeChain.node()), DontDelete); + FunctionBodyNode* function = functionStack[i]; + globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(function), scopeChain.node()), DontDelete); } for (size_t i = 0; i < varStack.size(); ++i) { - if (globalObject->hasProperty(exec, varStack[i].first)) + if (globalObject->hasProperty(exec, *varStack[i].first)) continue; int attributes = DontDelete; if (varStack[i].second & DeclarationStacks::IsConstant) attributes |= ReadOnly; - globalObject->putWithAttributes(exec, varStack[i].first, jsUndefined(), attributes); + globalObject->putWithAttributes(exec, *varStack[i].first, jsUndefined(), attributes); } preserveLastVar(); @@ -327,7 +327,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug } else emitOpcode(op_enter); - if (usesArguments) { + if (usesArguments) { emitOpcode(op_init_arguments); // The debugger currently retrieves the arguments object from an activation rather than pulling @@ -339,18 +339,18 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - const Identifier& ident = funcDecl->m_ident; + FunctionBodyNode* function = functionStack[i]; + const Identifier& ident = function->ident(); m_functions.add(ident.ustring().rep()); - emitNewFunction(addVar(ident, false), funcDecl); + emitNewFunction(addVar(ident, false), function); } const DeclarationStacks::VarStack& varStack = functionBody->varStack(); for (size_t i = 0; i < varStack.size(); ++i) - addVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant); + addVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant); - const Identifier* parameters = functionBody->parameters(); - size_t parameterCount = functionBody->parameterCount(); + FunctionParameters& parameters = *functionBody->parameters(); + size_t parameterCount = parameters.size(); m_nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1; m_parameters.grow(1 + parameterCount); // reserve space for "this" @@ -397,6 +397,18 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge codeBlock->setGlobalData(m_globalData); m_codeBlock->m_numParameters = 1; // Allocate space for "this" + const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); + for (size_t i = 0; i < functionStack.size(); ++i) + m_codeBlock->addFunctionDecl(makeFunction(functionStack[i])); + + const DeclarationStacks::VarStack& varStack = evalNode->varStack(); + unsigned numVariables = varStack.size(); + Vector variables; + variables.reserveCapacity(numVariables); + for (size_t i = 0; i < numVariables; ++i) + variables.append(*varStack[i].first); + codeBlock->adoptVariables(variables); + preserveLastVar(); } @@ -470,7 +482,8 @@ RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident) return 0; SymbolTableEntry entry = symbolTable().get(ident.ustring().rep()); - ASSERT(!entry.isNull()); + if (entry.isNull()) + return 0; return ®isterFor(entry.getIndex()); } @@ -765,18 +778,6 @@ PassRefPtr