diff options
Diffstat (limited to 'Source/JavaScriptCore')
294 files changed, 12821 insertions, 4805 deletions
diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.cpp b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp index e8ae274..fa9d216 100644 --- a/Source/JavaScriptCore/API/JSCallbackConstructor.cpp +++ b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -38,7 +38,7 @@ namespace JSC { const ClassInfo JSCallbackConstructor::s_info = { "CallbackConstructor", &JSObjectWithGlobalObject::s_info, 0, 0 }; -JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback) +JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback) : JSObjectWithGlobalObject(globalObject, structure) , m_class(jsClass) , m_callback(callback) diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.h b/Source/JavaScriptCore/API/JSCallbackConstructor.h index 001c416..64b237d 100644 --- a/Source/JavaScriptCore/API/JSCallbackConstructor.h +++ b/Source/JavaScriptCore/API/JSCallbackConstructor.h @@ -33,13 +33,13 @@ namespace JSC { class JSCallbackConstructor : public JSObjectWithGlobalObject { public: - JSCallbackConstructor(JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback); + JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback); virtual ~JSCallbackConstructor(); JSClassRef classRef() const { return m_class; } JSObjectCallAsConstructorCallback callback() const { return m_callback; } static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.h b/Source/JavaScriptCore/API/JSCallbackFunction.h index 11fb95c..55c9ed4 100644 --- a/Source/JavaScriptCore/API/JSCallbackFunction.h +++ b/Source/JavaScriptCore/API/JSCallbackFunction.h @@ -39,7 +39,7 @@ public: // InternalFunction mish-mashes constructor and function behavior -- we should // refactor the code so this override isn't necessary - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/API/JSCallbackObject.cpp b/Source/JavaScriptCore/API/JSCallbackObject.cpp index e3ef7a4..6a7462a 100644 --- a/Source/JavaScriptCore/API/JSCallbackObject.cpp +++ b/Source/JavaScriptCore/API/JSCallbackObject.cpp @@ -39,4 +39,16 @@ ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>); template <> const ClassInfo JSCallbackObject<JSObjectWithGlobalObject>::s_info = { "CallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 }; template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0 }; +void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context) +{ + JSClassRef jsClass = static_cast<JSClassRef>(context); + JSObjectRef thisRef = toRef(asObject(handle.get())); + + for (; jsClass; jsClass = jsClass->parentClass) + if (JSObjectFinalizeCallback finalize = jsClass->finalize) + finalize(thisRef); + HandleSlot slot = handle.slot(); + HandleHeap::heapFor(slot)->deallocate(slot); +} + } // namespace JSC diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h index a0adb44..d2e0dcb 100644 --- a/Source/JavaScriptCore/API/JSCallbackObject.h +++ b/Source/JavaScriptCore/API/JSCallbackObject.h @@ -34,7 +34,7 @@ namespace JSC { -struct JSCallbackObjectData { +struct JSCallbackObjectData : WeakHandleOwner { JSCallbackObjectData(void* privateData, JSClassRef jsClass) : privateData(privateData) , jsClass(jsClass) @@ -110,15 +110,15 @@ struct JSCallbackObjectData { PrivatePropertyMap m_propertyMap; }; OwnPtr<JSPrivatePropertyMap> m_privateProperties; + virtual void finalize(Handle<Unknown>, void*); }; template <class Base> class JSCallbackObject : public Base { public: - JSCallbackObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, void* data); - JSCallbackObject(JSClassRef, NonNullPassRefPtr<Structure>); - virtual ~JSCallbackObject(); + JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data); + JSCallbackObject(JSGlobalData&, JSClassRef, Structure*); void setPrivate(void* data); void* getPrivate(); @@ -128,7 +128,7 @@ public: JSClassRef classRef() const { return m_callbackObjectData->jsClass; } bool inherits(JSClassRef) const; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h index ca15e1f..8639e1a 100644 --- a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -50,7 +50,7 @@ inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue } template <class Base> -JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data) +JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data) : Base(globalObject, structure) , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass))) { @@ -61,8 +61,8 @@ JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* global // Global object constructor. // FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one. template <class Base> -JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass, NonNullPassRefPtr<Structure> structure) - : Base(structure) +JSCallbackObject<Base>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure) + : Base(globalData, structure) , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass))) { ASSERT(Base::inherits(&s_info)); @@ -88,16 +88,16 @@ void JSCallbackObject<Base>::init(ExecState* exec) JSObjectInitializeCallback initialize = initRoutines[i]; initialize(toRef(exec), toRef(this)); } -} -template <class Base> -JSCallbackObject<Base>::~JSCallbackObject() -{ - JSObjectRef thisRef = toRef(this); - - for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) - if (JSObjectFinalizeCallback finalize = jsClass->finalize) - finalize(thisRef); + bool needsFinalizer = false; + for (JSClassRef jsClassPtr = classRef(); jsClassPtr && !needsFinalizer; jsClassPtr = jsClassPtr->parentClass) + needsFinalizer = jsClassPtr->finalize; + if (needsFinalizer) { + HandleSlot slot = exec->globalData().allocateGlobalHandle(); + HandleHeap::heapFor(slot)->makeWeak(slot, m_callbackObjectData.get(), classRef()); + HandleHeap::heapFor(slot)->writeBarrier(slot, this); + *slot = this; + } } template <class Base> diff --git a/Source/JavaScriptCore/API/JSClassRef.cpp b/Source/JavaScriptCore/API/JSClassRef.cpp index 70668bd..08dc721 100644 --- a/Source/JavaScriptCore/API/JSClassRef.cpp +++ b/Source/JavaScriptCore/API/JSClassRef.cpp @@ -254,7 +254,7 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec) jsClassData.cachedPrototype.set(exec->globalData(), new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction if (parentClass) { if (JSObject* prototype = parentClass->prototype(exec)) - jsClassData.cachedPrototype->setPrototype(prototype); + jsClassData.cachedPrototype->setPrototype(exec->globalData(), prototype); } } return jsClassData.cachedPrototype.get(); diff --git a/Source/JavaScriptCore/API/JSClassRef.h b/Source/JavaScriptCore/API/JSClassRef.h index 239c5a4..d346cc5 100644 --- a/Source/JavaScriptCore/API/JSClassRef.h +++ b/Source/JavaScriptCore/API/JSClassRef.h @@ -28,10 +28,10 @@ #include "JSObjectRef.h" -#include <runtime/JSObject.h> -#include <runtime/Protect.h> -#include <runtime/UString.h> -#include <runtime/WeakGCPtr.h> +#include "Weak.h" +#include "JSObject.h" +#include "Protect.h" +#include "UString.h" #include <wtf/HashMap.h> struct StaticValueEntry { @@ -82,7 +82,7 @@ public: OpaqueJSClassStaticValuesTable* staticValues; OpaqueJSClassStaticFunctionsTable* staticFunctions; - JSC::WeakGCPtr<JSC::JSObject> cachedPrototype; + JSC::Weak<JSC::JSObject> cachedPrototype; }; struct OpaqueJSClass : public ThreadSafeRefCounted<OpaqueJSClass> { diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index e5c778f..03d0622 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -97,12 +97,12 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec())); } - JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull())); + JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull())); ExecState* exec = globalObject->globalExec(); JSValue prototype = globalObjectClass->prototype(exec); if (!prototype) prototype = jsNull(); - globalObject->resetPrototype(prototype); + globalObject->resetPrototype(*globalData, prototype); return JSGlobalContextRetain(toGlobalRef(exec)); } @@ -141,9 +141,10 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx) // it may release a lot of GC memory - run the garbage collector now. // * If there are more references remaining the the global object, then do nothing // (specifically that is more protects, which we assume come from other JSGlobalContextRefs). - if (releasingContextGroup) + if (releasingContextGroup) { + globalData.clearBuiltinStructures(); globalData.heap.destroy(); - else if (releasingGlobalObject) + } else if (releasingGlobalObject) globalData.heap.collectAllGarbage(); globalData.deref(); diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp index b7030e4..2df010a 100644 --- a/Source/JavaScriptCore/API/JSObjectRef.cpp +++ b/Source/JavaScriptCore/API/JSObjectRef.cpp @@ -83,7 +83,7 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); if (JSObject* prototype = jsClass->prototype(exec)) - object->setPrototype(prototype); + object->setPrototype(exec->globalData(), prototype); return toRef(object); } @@ -235,7 +235,7 @@ void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); - jsObject->setPrototypeWithCycleCheck(jsValue.isObject() ? jsValue : jsNull()); + jsObject->setPrototypeWithCycleCheck(exec->globalData(), jsValue.isObject() ? jsValue : jsNull()); } bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) diff --git a/Source/JavaScriptCore/Android.mk b/Source/JavaScriptCore/Android.mk index bf60ab0..48f326a 100644 --- a/Source/JavaScriptCore/Android.mk +++ b/Source/JavaScriptCore/Android.mk @@ -44,13 +44,20 @@ LOCAL_SRC_FILES := \ bytecompiler/BytecodeGenerator.cpp \ bytecompiler/NodesCodegen.cpp \ \ - collector/handles/HandleHeap.cpp \ - collector/handles/HandleStack.cpp \ - \ debugger/Debugger.cpp \ debugger/DebuggerActivation.cpp \ debugger/DebuggerCallFrame.cpp \ \ + heap/ConservativeRoots.cpp \ + heap/HandleHeap.cpp \ + heap/HandleStack.cpp \ + heap/Heap.cpp \ + heap/MachineStackMarker.cpp \ + heap/MarkStack.cpp \ + heap/MarkStackPosix.cpp \ + heap/MarkedBlock.cpp \ + heap/MarkedSpace.cpp \ + \ interpreter/CallFrame.cpp \ interpreter/Interpreter.cpp \ interpreter/RegisterFile.cpp \ @@ -87,9 +94,6 @@ LOCAL_SRC_FILES := \ runtime/BooleanObject.cpp \ runtime/BooleanPrototype.cpp \ runtime/CallData.cpp \ - runtime/MarkedBlock.cpp \ - runtime/MarkedSpace.cpp \ - runtime/Heap.cpp \ runtime/CommonIdentifiers.cpp \ runtime/Completion.cpp \ runtime/ConstructData.cpp \ @@ -120,10 +124,8 @@ LOCAL_SRC_FILES := \ runtime/JSGlobalData.cpp \ runtime/JSGlobalObject.cpp \ runtime/JSGlobalObjectFunctions.cpp \ - runtime/JSImmediate.cpp \ runtime/JSLock.cpp \ runtime/JSNotAnObject.cpp \ - runtime/JSNumberCell.cpp \ runtime/JSONObject.cpp \ runtime/JSObject.cpp \ runtime/JSObjectWithGlobalObject.cpp \ @@ -135,10 +137,6 @@ LOCAL_SRC_FILES := \ runtime/JSWrapperObject.cpp \ runtime/LiteralParser.cpp \ runtime/Lookup.cpp \ - runtime/MachineStackMarker.cpp \ - runtime/ConservativeSet.cpp \ - runtime/MarkStack.cpp \ - runtime/MarkStackPosix.cpp \ runtime/MathObject.cpp \ runtime/NativeErrorConstructor.cpp \ runtime/NativeErrorPrototype.cpp \ diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index 247d372..c994611 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -6,7 +6,7 @@ SET(JavaScriptCore_INCLUDE_DIRECTORIES "${JAVASCRIPTCORE_DIR}/assembler" "${JAVASCRIPTCORE_DIR}/bytecode" "${JAVASCRIPTCORE_DIR}/bytecompiler" - "${JAVASCRIPTCORE_DIR}/collector/handles" + "${JAVASCRIPTCORE_DIR}/heap" "${JAVASCRIPTCORE_DIR}/debugger" "${JAVASCRIPTCORE_DIR}/interpreter" "${JAVASCRIPTCORE_DIR}/jit" @@ -41,8 +41,14 @@ SET(JavaScriptCore_SOURCES bytecompiler/BytecodeGenerator.cpp bytecompiler/NodesCodegen.cpp - collector/handles/HandleHeap.cpp - collector/handles/HandleStack.cpp + heap/Heap.cpp + heap/HandleHeap.cpp + heap/HandleStack.cpp + heap/MachineStackMarker.cpp + heap/MarkedBlock.cpp + heap/MarkedSpace.cpp + heap/ConservativeRoots.cpp + heap/MarkStack.cpp debugger/Debugger.cpp debugger/DebuggerActivation.cpp @@ -85,9 +91,6 @@ SET(JavaScriptCore_SOURCES runtime/BooleanObject.cpp runtime/BooleanPrototype.cpp runtime/CallData.cpp - runtime/MarkedBlock.cpp - runtime/MarkedSpace.cpp - runtime/Heap.cpp runtime/CommonIdentifiers.cpp runtime/Completion.cpp runtime/ConstructData.cpp @@ -117,10 +120,8 @@ SET(JavaScriptCore_SOURCES runtime/JSGlobalData.cpp runtime/JSGlobalObject.cpp runtime/JSGlobalObjectFunctions.cpp - runtime/JSImmediate.cpp runtime/JSLock.cpp runtime/JSNotAnObject.cpp - runtime/JSNumberCell.cpp runtime/JSObject.cpp runtime/JSObjectWithGlobalObject.cpp runtime/JSONObject.cpp @@ -133,9 +134,6 @@ SET(JavaScriptCore_SOURCES runtime/JSZombie.cpp runtime/LiteralParser.cpp runtime/Lookup.cpp - runtime/MachineStackMarker.cpp - runtime/ConservativeSet.cpp - runtime/MarkStack.cpp runtime/MathObject.cpp runtime/NativeErrorConstructor.cpp runtime/NativeErrorPrototype.cpp @@ -197,28 +195,29 @@ SET(JavaScriptCore_LIBRARIES # GENERATOR 1-A: LUT creator FOREACH (_file ${JavaScriptCore_LUT_FILES}) GET_FILENAME_COMPONENT(_name ${_file} NAME_WE) - GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_DIR}/${_name}.lut.h) - LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/${_name}.lut.h) + GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h) + LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h) ENDFOREACH () # GENERATOR 1-B: particular LUT creator (for 1 file only) -GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY) -LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h) +GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h MAIN_DEPENDENCY) +LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h) #GENERATOR: "RegExpJitTables.h": tables used by Yarr ADD_CUSTOM_COMMAND( - OUTPUT ${DERIVED_SOURCES_DIR}/RegExpJitTables.h + OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables - COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_DIR}/RegExpJitTables.h + COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h VERBATIM) -ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_DIR}/RegExpJitTables.h) +ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h) IF (WTF_CPU_ARM) LIST(APPEND JavaScriptCore_SOURCES assembler/ARMAssembler.cpp + assembler/ARMv7Assembler.cpp assembler/MacroAssemblerARM.cpp ) ELSEIF (WTF_CPU_MIPS) diff --git a/Source/JavaScriptCore/CMakeListsEfl.txt b/Source/JavaScriptCore/CMakeListsEfl.txt index 9d3c71e..cdc3fe2 100644 --- a/Source/JavaScriptCore/CMakeListsEfl.txt +++ b/Source/JavaScriptCore/CMakeListsEfl.txt @@ -1,7 +1,7 @@ LIST(APPEND JavaScriptCore_SOURCES jit/ExecutableAllocatorFixedVMPool.cpp jit/ExecutableAllocator.cpp - runtime/MarkStackPosix.cpp + heap/MarkStackPosix.cpp wtf/OSAllocatorPosix.cpp ) diff --git a/Source/JavaScriptCore/CMakeListsWinCE.txt b/Source/JavaScriptCore/CMakeListsWinCE.txt index 58a535e..d878863 100644 --- a/Source/JavaScriptCore/CMakeListsWinCE.txt +++ b/Source/JavaScriptCore/CMakeListsWinCE.txt @@ -1,7 +1,7 @@ LIST(APPEND JavaScriptCore_SOURCES jit/ExecutableAllocator.cpp - runtime/MarkStackWin.cpp + heap/MarkStackWin.cpp ) IF (ENABLE_JIT AND WTF_CPU_ARM) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 7cc1d15..bb10264 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,2847 @@ +2011-04-19 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove unneeded deprecated methods from MarkStack + https://bugs.webkit.org/show_bug.cgi?id=58853 + + Remove deprecated methods + + * heap/MarkStack.h: + +2011-04-19 Mark Rowe <mrowe@apple.com> + + Things work best when the Xcode project refers to the file at a path that exists. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2011-04-19 Renata Hodovan <reni@webkit.org> + + Reviewed by Eric Seidel. + + Move the alignment related macros in Vector.h to new Alignment.h. + https://bugs.webkit.org/show_bug.cgi?id=56000 + + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * wtf/Alignment.h: Added. + * wtf/CMakeLists.txt: + * wtf/Vector.h: + +2011-04-19 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove DeprecatedPtr + https://bugs.webkit.org/show_bug.cgi?id=58718 + + Remove the class an all functions that still exist to support it. + + * heap/MarkStack.h: + (JSC::MarkStack::append): + * runtime/JSValue.h: + * runtime/WriteBarrier.h: + +2011-04-19 Jungshik Shin <jshin@chromium.org> + + Reviewed by David Levin + + Add U+FEFF (Zero width no-break space) to CharacterNames.h. + It's added to the list of characters to treat as zero-width + in WebCore. + + https://bugs.webkit.org/show_bug.cgi?id=48860 + + * wtf/unicode/CharacterNames.h: + +2011-04-19 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] REGRESSION(84176): http/tests/xmlhttprequest/event-listener-gc.html fails + https://bugs.webkit.org/show_bug.cgi?id=58871 + + Unreviewed, rolling out r84176, r84178, r84186, r84212 and r84231. + http://trac.webkit.org/changeset/84176 (original patch) + http://trac.webkit.org/changeset/84178 (original patch - part 2) + http://trac.webkit.org/changeset/84186 (build fix) + http://trac.webkit.org/changeset/84212 + http://trac.webkit.org/changeset/84231 (skip failing test) + + original bugs: + - https://bugs.webkit.org/show_bug.cgi?id=58718 + - https://bugs.webkit.org/show_bug.cgi?id=58853 + + * heap/MarkStack.h: + (JSC::MarkStack::deprecatedAppendValues): + (JSC::MarkStack::append): + (JSC::MarkStack::deprecatedAppend): + * runtime/JSValue.h: + * runtime/WriteBarrier.h: + (JSC::DeprecatedPtr::DeprecatedPtr): + (JSC::DeprecatedPtr::get): + (JSC::DeprecatedPtr::operator*): + (JSC::DeprecatedPtr::operator->): + (JSC::DeprecatedPtr::slot): + (JSC::DeprecatedPtr::operator UnspecifiedBoolType*): + (JSC::DeprecatedPtr::operator!): + (JSC::operator==): + +2011-04-18 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove unneeded deprecated methods from MarkStack + https://bugs.webkit.org/show_bug.cgi?id=58853 + + Remove deprecated methods + + * heap/MarkStack.h: + +2011-04-18 Oliver Hunt <oliver@apple.com> + + Reviewed by Adam Roben. + + Off by one initialising repeat callframe + https://bugs.webkit.org/show_bug.cgi?id=58838 + <rdar://problem/8756810> + + If the end of a callframe made for a repeat call landed on + a page boundary the following page may not have been committed + which means that the off by one could lead to a crash. However + it could only happen in this case and only on windows which is + why it was so hard to repro. Alas given the steps needed to + reproduce are such that it's not really possible to make a + testcase. + + This fix makes the code a little less squirrely by not trying + to avoid the unnecessary initialisation of |this|. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::prepareForRepeatCall): + +2011-04-18 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + Bug 58829 - DFG JIT - Optimize add/sub immediate, multiply. + + Add code generation for add/subtract instruction with immediate operands + (where a child is a constant), and don't bail to non-speculative if an + integer multiple results in a +0 result (only if it should be generating -0). + + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::isDoubleConstantWithInt32Value): + +2011-04-18 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + Bug 58817 - DFG JIT - if speculative compilation fails, throw away code. + + If we detect a logical conflict, throw away generated code, + and only compile through the NonSpeculativeJIT. + + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::rewindToLabel): + * assembler/AssemblerBuffer.h: + (JSC::AssemblerBuffer::rewindToOffset): + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::branchAdd32): + (JSC::MacroAssemblerX86Common::branchSub32): + * assembler/X86Assembler.h: + (JSC::X86Assembler::rewindToLabel): + (JSC::X86Assembler::X86InstructionFormatter::rewindToLabel): + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::linkSpeculationChecks): + (JSC::DFG::JITCompiler::compileFunction): + * dfg/DFGNode.h: + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculationCheckIndexIterator::SpeculationCheckIndexIterator): + +2011-04-18 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove DeprecatedPtr + https://bugs.webkit.org/show_bug.cgi?id=58718 + + As simple as it sounds. + + * runtime/JSValue.h: + * runtime/WriteBarrier.h: + +2011-04-17 Cameron Zwarich <zwarich@apple.com> + + Reviewed by Dan Bernstein. + + JSC no longer builds with Clang due to -Woverloaded-virtual warning + https://bugs.webkit.org/show_bug.cgi?id=58760 + + Rename Structure's specificValue overload of put to putSpecificValue to avoid + Clang's warning for overloading a virtual function. + + * runtime/Structure.cpp: + (JSC::Structure::addPropertyTransition): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::putSpecificValue): + * runtime/Structure.h: + +2011-04-17 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Remove WTF_PLATFORM_SGL + https://bugs.webkit.org/show_bug.cgi?id=58743 + + WTF_PLATFORM_SGL and PLATFORM(SGL) are not used in the code anywhere. + + * wtf/Platform.h: + +2011-04-17 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Rename PLATFORM(CA) to USE(CA) + https://bugs.webkit.org/show_bug.cgi?id=58742 + + * wtf/Platform.h: + +2011-04-17 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Rename PLATFORM(CG) to USE(CG) + https://bugs.webkit.org/show_bug.cgi?id=58729 + + * wtf/Platform.h: + +2011-04-16 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Eric Seidel. + + Rename PLATFORM(CAIRO) to USE(CAIRO) + https://bugs.webkit.org/show_bug.cgi?id=55192 + + * wtf/Platform.h: + * wtf/gobject/GTypedefs.h: + +2011-04-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r84067. + http://trac.webkit.org/changeset/84067 + https://bugs.webkit.org/show_bug.cgi?id=58724 + + qt build are failing. (Requested by loislo2 on #webkit). + + * heap/MarkStack.h: + (JSC::MarkStack::append): + * runtime/JSValue.h: + * runtime/WriteBarrier.h: + (JSC::DeprecatedPtr::DeprecatedPtr): + (JSC::DeprecatedPtr::get): + (JSC::DeprecatedPtr::operator*): + (JSC::DeprecatedPtr::operator->): + (JSC::DeprecatedPtr::slot): + (JSC::DeprecatedPtr::operator UnspecifiedBoolType*): + (JSC::DeprecatedPtr::operator!): + (JSC::operator==): + +2011-04-15 Shishir Agrawal <shishir@chromium.org> + + Reviewed by James Robinson. + + Add a flag to guard Page Visibility API changes. + https://bugs.webkit.org/show_bug.cgi?id=58464 + + * Configurations/FeatureDefines.xcconfig: + +2011-04-15 Gavin Barraclough <barraclough@apple.com> + + Errrk! - build fix from !x86-64. + + * dfg/DFGNode.h: + +2011-04-15 David Levin <levin@chromium.org> + + Revert of r83974. + + JavaScriptCore shouldn't depend on ../ThirdParty/gtest/xcode/gtest.xcodeproj + https://bugs.webkit.org/show_bug.cgi?id=58716 + + * JavaScriptCore.xcodeproj/project.pbxproj: + * wtf/tests/RunAllWtfTests.cpp: Removed. + * wtf/tests/StringTests.cpp: Removed. + +2011-04-15 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove DeprecatedPtr + https://bugs.webkit.org/show_bug.cgi?id=58718 + + As simple as it sounds. + + * heap/MarkStack.h: + (JSC::MarkStack::append): + * runtime/JSValue.h: + * runtime/WriteBarrier.h: + +2011-04-15 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Add a simple tool to gather statistics on whether functions + are completed through the new or old JIT. + + * dfg/DFGNode.h: + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + +2011-04-15 Oliver Hunt <oliver@apple.com> + + GC allocate Structure + https://bugs.webkit.org/show_bug.cgi?id=58483 + + Rolling r83894 r83827 r83810 r83809 r83808 back in with + a workaround for the gcc bug seen by the gtk bots + + * API/JSCallbackConstructor.cpp: + (JSC::JSCallbackConstructor::JSCallbackConstructor): + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * API/JSCallbackObjectFunctions.h: + (JSC::::JSCallbackObject): + * API/JSContextRef.cpp: + * JavaScriptCore.JSVALUE32_64only.exp: + * JavaScriptCore.JSVALUE64only.exp: + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::~CodeBlock): + (JSC::CodeBlock::markStructures): + (JSC::CodeBlock::markAggregate): + * bytecode/CodeBlock.h: + (JSC::MethodCallLinkInfo::setSeen): + (JSC::GlobalResolveInfo::GlobalResolveInfo): + * bytecode/Instruction.h: + (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): + (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): + (JSC::PolymorphicAccessStructureList::markAggregate): + (JSC::Instruction::Instruction): + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + (JSC::StructureStubInfo::markAggregate): + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::initGetByIdSelf): + (JSC::StructureStubInfo::initGetByIdProto): + (JSC::StructureStubInfo::initGetByIdChain): + (JSC::StructureStubInfo::initPutByIdTransition): + (JSC::StructureStubInfo::initPutByIdReplace): + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::DebuggerActivation): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * heap/Handle.h: + * heap/MarkStack.cpp: + (JSC::MarkStack::markChildren): + (JSC::MarkStack::drain): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::MarkedBlock): + (JSC::MarkedBlock::sweep): + * heap/Strong.h: + (JSC::Strong::Strong): + (JSC::Strong::set): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::resolveGlobalDynamic): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::uncachePutByID): + (JSC::Interpreter::tryCacheGetByID): + (JSC::Interpreter::uncacheGetByID): + (JSC::Interpreter::privateExecute): + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::patchMethodCallProto): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::patchMethodCallProto): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + (JSC::getPolymorphicAccessStructureListSlot): + * jit/JSInterfaceJIT.h: + (JSC::JSInterfaceJIT::storePtrWithWriteBarrier): + * jsc.cpp: + (cleanupGlobalData): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + (JSC::Arguments::Arguments): + (JSC::JSActivation::copyRegisters): + * runtime/ArrayConstructor.cpp: + (JSC::ArrayConstructor::ArrayConstructor): + (JSC::constructArrayWithSizeQuirk): + * runtime/ArrayConstructor.h: + * runtime/ArrayPrototype.cpp: + (JSC::ArrayPrototype::ArrayPrototype): + (JSC::arrayProtoFuncSplice): + * runtime/ArrayPrototype.h: + (JSC::ArrayPrototype::createStructure): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/BooleanConstructor.cpp: + (JSC::BooleanConstructor::BooleanConstructor): + * runtime/BooleanConstructor.h: + * runtime/BooleanObject.cpp: + (JSC::BooleanObject::BooleanObject): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/BooleanPrototype.cpp: + (JSC::BooleanPrototype::BooleanPrototype): + * runtime/BooleanPrototype.h: + * runtime/DateConstructor.cpp: + (JSC::DateConstructor::DateConstructor): + * runtime/DateConstructor.h: + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + * runtime/DateInstance.h: + (JSC::DateInstance::createStructure): + * runtime/DatePrototype.cpp: + (JSC::DatePrototype::DatePrototype): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/Error.cpp: + (JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction): + * runtime/ErrorConstructor.cpp: + (JSC::ErrorConstructor::ErrorConstructor): + * runtime/ErrorConstructor.h: + * runtime/ErrorInstance.cpp: + (JSC::ErrorInstance::ErrorInstance): + (JSC::ErrorInstance::create): + * runtime/ErrorInstance.h: + (JSC::ErrorInstance::createStructure): + * runtime/ErrorPrototype.cpp: + (JSC::ErrorPrototype::ErrorPrototype): + * runtime/ErrorPrototype.h: + * runtime/ExceptionHelpers.cpp: + (JSC::InterruptedExecutionError::InterruptedExecutionError): + (JSC::TerminatedExecutionError::TerminatedExecutionError): + * runtime/Executable.cpp: + * runtime/Executable.h: + (JSC::ExecutableBase::ExecutableBase): + (JSC::ExecutableBase::createStructure): + (JSC::NativeExecutable::createStructure): + (JSC::NativeExecutable::NativeExecutable): + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::EvalExecutable::createStructure): + (JSC::ProgramExecutable::createStructure): + (JSC::FunctionExecutable::createStructure): + * runtime/FunctionConstructor.cpp: + (JSC::FunctionConstructor::FunctionConstructor): + * runtime/FunctionConstructor.h: + * runtime/FunctionPrototype.cpp: + (JSC::FunctionPrototype::FunctionPrototype): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GetterSetter.h: + (JSC::GetterSetter::GetterSetter): + (JSC::GetterSetter::createStructure): + * runtime/InitializeThreading.cpp: + (JSC::initializeThreadingOnce): + * runtime/InternalFunction.cpp: + (JSC::InternalFunction::InternalFunction): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::createStructure): + (JSC::JSAPIValueWrapper::JSAPIValueWrapper): + * runtime/JSActivation.cpp: + (JSC::JSActivation::JSActivation): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::JSByteArray): + (JSC::JSByteArray::createStructure): + * runtime/JSByteArray.h: + (JSC::JSByteArray::JSByteArray): + * runtime/JSCell.cpp: + (JSC::isZombie): + * runtime/JSCell.h: + (JSC::JSCell::JSCell::JSCell): + (JSC::JSCell::JSCell::addressOfStructure): + (JSC::JSCell::JSCell::structure): + (JSC::JSCell::JSCell::markChildren): + (JSC::JSCell::JSValue::isZombie): + * runtime/JSFunction.cpp: + (JSC::JSFunction::JSFunction): + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::storeVPtrs): + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::clearBuiltinStructures): + (JSC::JSGlobalData::createLeaked): + * runtime/JSGlobalData.h: + (JSC::allocateGlobalHandle): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::markChildren): + (JSC::JSGlobalObject::copyGlobalsFrom): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::JSGlobalObject): + (JSC::JSGlobalObject::createStructure): + (JSC::Structure::prototypeChain): + (JSC::Structure::isValid): + (JSC::constructEmptyArray): + * runtime/JSNotAnObject.h: + (JSC::JSNotAnObject::JSNotAnObject): + (JSC::JSNotAnObject::createStructure): + * runtime/JSONObject.cpp: + (JSC::JSONObject::JSONObject): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.cpp: + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + (JSC::JSObject::seal): + (JSC::JSObject::freeze): + (JSC::JSObject::preventExtensions): + (JSC::JSObject::removeDirect): + (JSC::JSObject::createInheritorID): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + (JSC::JSObject::JSObject): + (JSC::JSNonFinalObject::createStructure): + (JSC::JSNonFinalObject::JSNonFinalObject): + (JSC::JSFinalObject::create): + (JSC::JSFinalObject::createStructure): + (JSC::JSFinalObject::JSFinalObject): + (JSC::constructEmptyObject): + (JSC::createEmptyObjectStructure): + (JSC::JSObject::~JSObject): + (JSC::JSObject::setPrototype): + (JSC::JSObject::setStructure): + (JSC::JSObject::inheritorID): + (JSC::JSObject::putDirectInternal): + (JSC::JSObject::transitionTo): + (JSC::JSObject::markChildrenDirect): + * runtime/JSObjectWithGlobalObject.cpp: + (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject): + * runtime/JSObjectWithGlobalObject.h: + (JSC::JSObjectWithGlobalObject::createStructure): + (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject): + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): + (JSC::JSPropertyNameIterator::create): + (JSC::JSPropertyNameIterator::get): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::createStructure): + (JSC::JSPropertyNameIterator::setCachedStructure): + (JSC::Structure::setEnumerationCache): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::JSStaticScopeObject): + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSString.h: + (JSC::RopeBuilder::JSString): + (JSC::RopeBuilder::createStructure): + * runtime/JSType.h: + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::TypeInfo): + * runtime/JSValue.h: + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + (JSC::JSVariableObject::JSVariableObject): + (JSC::JSVariableObject::copyRegisterArray): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + (JSC::JSWrapperObject::JSWrapperObject): + * runtime/JSZombie.cpp: + * runtime/JSZombie.h: + (JSC::JSZombie::JSZombie): + (JSC::JSZombie::createStructure): + * runtime/MathObject.cpp: + (JSC::MathObject::MathObject): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NativeErrorConstructor.cpp: + (JSC::NativeErrorConstructor::NativeErrorConstructor): + (JSC::NativeErrorConstructor::markChildren): + (JSC::constructWithNativeErrorConstructor): + * runtime/NativeErrorConstructor.h: + (JSC::NativeErrorConstructor::createStructure): + * runtime/NativeErrorPrototype.cpp: + (JSC::NativeErrorPrototype::NativeErrorPrototype): + * runtime/NativeErrorPrototype.h: + * runtime/NumberConstructor.cpp: + (JSC::NumberConstructor::NumberConstructor): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.cpp: + (JSC::NumberObject::NumberObject): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/NumberPrototype.cpp: + (JSC::NumberPrototype::NumberPrototype): + * runtime/NumberPrototype.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + * runtime/ObjectConstructor.h: + (JSC::ObjectConstructor::createStructure): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): + * runtime/ObjectPrototype.h: + * runtime/PropertyMapHashTable.h: + (JSC::PropertyTable::PropertyTable): + * runtime/RegExpConstructor.cpp: + (JSC::RegExpConstructor::RegExpConstructor): + (JSC::RegExpMatchesArray::RegExpMatchesArray): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.cpp: + (JSC::RegExpObject::RegExpObject): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/RegExpPrototype.cpp: + (JSC::RegExpPrototype::RegExpPrototype): + * runtime/RegExpPrototype.h: + * runtime/ScopeChain.h: + (JSC::ScopeChainNode::ScopeChainNode): + (JSC::ScopeChainNode::createStructure): + * runtime/StrictEvalActivation.cpp: + (JSC::StrictEvalActivation::StrictEvalActivation): + * runtime/StringConstructor.cpp: + (JSC::StringConstructor::StringConstructor): + * runtime/StringConstructor.h: + * runtime/StringObject.cpp: + (JSC::StringObject::StringObject): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined): + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + * runtime/StringPrototype.cpp: + (JSC::StringPrototype::StringPrototype): + * runtime/StringPrototype.h: + (JSC::StringPrototype::createStructure): + * runtime/Structure.cpp: + (JSC::StructureTransitionTable::remove): + (JSC::StructureTransitionTable::add): + (JSC::Structure::Structure): + (JSC::Structure::~Structure): + (JSC::Structure::materializePropertyMap): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::sealTransition): + (JSC::Structure::freezeTransition): + (JSC::Structure::preventExtensionsTransition): + (JSC::Structure::flattenDictionaryStructure): + (JSC::Structure::copyPropertyTable): + (JSC::Structure::put): + (JSC::Structure::markChildren): + * runtime/Structure.h: + (JSC::Structure::create): + (JSC::Structure::setPrototypeWithoutTransition): + (JSC::Structure::createStructure): + (JSC::JSCell::createDummyStructure): + (JSC::StructureTransitionTable::keyForWeakGCMapFinalizer): + * runtime/StructureChain.cpp: + (JSC::StructureChain::StructureChain): + (JSC::StructureChain::markChildren): + * runtime/StructureChain.h: + (JSC::StructureChain::create): + (JSC::StructureChain::head): + (JSC::StructureChain::createStructure): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTable::WeakGCMapFinalizerCallback::finalizerContextFor): + (JSC::StructureTransitionTable::WeakGCMapFinalizerCallback::keyForFinalizer): + (JSC::StructureTransitionTable::~StructureTransitionTable): + (JSC::StructureTransitionTable::slot): + (JSC::StructureTransitionTable::setMap): + (JSC::StructureTransitionTable::singleTransition): + (JSC::StructureTransitionTable::clearSingleTransition): + (JSC::StructureTransitionTable::setSingleTransition): + * runtime/WeakGCMap.h: + (JSC::DefaultWeakGCMapFinalizerCallback::finalizerContextFor): + (JSC::DefaultWeakGCMapFinalizerCallback::keyForFinalizer): + (JSC::WeakGCMap::contains): + (JSC::WeakGCMap::find): + (JSC::WeakGCMap::remove): + (JSC::WeakGCMap::add): + (JSC::WeakGCMap::set): + (JSC::WeakGCMap::finalize): + * runtime/WriteBarrier.h: + (JSC::writeBarrier): + (JSC::WriteBarrierBase::set): + (JSC::WriteBarrierBase::operator*): + (JSC::WriteBarrierBase::operator->): + (JSC::WriteBarrierBase::setWithoutWriteBarrier): + +2011-04-15 Fridrich Strba <fridrich.strba@bluewin.ch> + + Reviewed by Gavin Barraclough. + + Correctly prefix symbols. Since gcc 4.5.0, Windows x64 symbols + are not prefixed by underscore anymore. This is consistent with + what MSVC does. + https://bugs.webkit.org/show_bug.cgi?id=58573 + + * jit/JITStubs.cpp: + +2011-04-15 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + Bug 58705 - DFG JIT Add support for flow control (branch, jump). + + Add support for control flow by breaking the CodeBlock up into multiple + basic blocks, generating code for each basic block in turn through the + speculative JIT & then the non-speculative JIT. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::setTemporary): + (JSC::DFG::ByteCodeParser::addToGraph): + (JSC::DFG::ByteCodeParser::parseBlock): + (JSC::DFG::ByteCodeParser::parse): + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dump): + * dfg/DFGGraph.h: + (JSC::DFG::BasicBlock::BasicBlock): + (JSC::DFG::BasicBlock::getBytecodeOffset): + (JSC::DFG::Graph::blockIndexForBytecodeOffset): + * dfg/DFGJITCodeGenerator.h: + (JSC::DFG::JITCodeGenerator::JITCodeGenerator): + (JSC::DFG::JITCodeGenerator::addBranch): + (JSC::DFG::JITCodeGenerator::linkBranches): + (JSC::DFG::JITCodeGenerator::BranchRecord::BranchRecord): + * dfg/DFGNode.h: + (JSC::DFG::Node::Node): + (JSC::DFG::Node::isJump): + (JSC::DFG::Node::isBranch): + (JSC::DFG::Node::takenBytecodeOffset): + (JSC::DFG::Node::notTakenBytecodeOffset): + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGNonSpeculativeJIT.h: + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.h: + +2011-04-15 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + Bug 58701 - DFG JIT - add GetLocal/SetLocal nodes + + Use these for both access to arguments & local variables, adds ability + to set locals, such that values will persist between basic blocks. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::ByteCodeParser): + (JSC::DFG::ByteCodeParser::get): + (JSC::DFG::ByteCodeParser::set): + (JSC::DFG::ByteCodeParser::getVariable): + (JSC::DFG::ByteCodeParser::setVariable): + (JSC::DFG::ByteCodeParser::getArgument): + (JSC::DFG::ByteCodeParser::setArgument): + (JSC::DFG::ByteCodeParser::getThis): + (JSC::DFG::ByteCodeParser::setThis): + (JSC::DFG::ByteCodeParser::VariableRecord::VariableRecord): + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dump): + (JSC::DFG::Graph::derefChildren): + * dfg/DFGGraph.h: + (JSC::DFG::Graph::ref): + (JSC::DFG::Graph::deref): + * dfg/DFGNode.h: + (JSC::DFG::Node::hasLocal): + (JSC::DFG::Node::local): + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2011-04-15 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + Bug 58696 - DFG JIT split handling of vars/temporaries + + Presently all callee registers are treated as having single block scope, + since the DFG JIT can only compile single block functions. In order to + expand the JIT to support control flow we will need to change to retaining + locals (but not temporaries) across basic block boundaries. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::ByteCodeParser): + (JSC::DFG::ByteCodeParser::get): + (JSC::DFG::ByteCodeParser::set): + (JSC::DFG::ByteCodeParser::getVariable): + (JSC::DFG::ByteCodeParser::setVariable): + (JSC::DFG::ByteCodeParser::getTemporary): + (JSC::DFG::ByteCodeParser::setTemporary): + (JSC::DFG::ByteCodeParser::getArgument): + (JSC::DFG::ByteCodeParser::getInt32Constant): + (JSC::DFG::ByteCodeParser::getDoubleConstant): + (JSC::DFG::ByteCodeParser::getJSConstant): + (JSC::DFG::ByteCodeParser::constantUndefined): + (JSC::DFG::ByteCodeParser::constantNull): + (JSC::DFG::ByteCodeParser::one): + (JSC::DFG::ByteCodeParser::parseBlock): + (JSC::DFG::ByteCodeParser::parse): + (JSC::DFG::parse): + * dfg/DFGNode.h: + * dfg/DFGScoreBoard.h: + (JSC::DFG::ScoreBoard::ScoreBoard): + (JSC::DFG::ScoreBoard::~ScoreBoard): + (JSC::DFG::ScoreBoard::allocate): + (JSC::DFG::ScoreBoard::use): + +2011-04-15 Michael Saboff <msaboff@apple.com> + + Reviewed by Oliver Hunt. + + globalObject moved to JSObjectWithGlobalObject.cpp inhibits inlining + https://bugs.webkit.org/show_bug.cgi?id=58677 + + Moved JSObjectWithGlobalObject::globalObject() to + runtime/JSObjectWithGlobalObject.h to allow the compiler to inline + it for a performance benefit. An equivalent instance had been in + a header file before r60057. + + * JavaScriptCore.exp: + * runtime/JSObjectWithGlobalObject.cpp: + * runtime/JSObjectWithGlobalObject.h: + (JSC::JSObjectWithGlobalObject::globalObject): + +2011-04-14 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make JSNodeFilterCondition handle its lifetime correctly + https://bugs.webkit.org/show_bug.cgi?id=58622 + + Add export + + * JavaScriptCore.exp: + +2011-04-14 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2: Password field input does not switch to ASCII-compatible source + https://bugs.webkit.org/show_bug.cgi?id=58583 + <rdar://problem/9059651> + + * wtf/Platform.h: Removed WTF_USE_CARBON_SECURE_INPUT_MODE. It's now only used by Chromium, + and shouldn't be enabled on any other platforms, so there is no reason to make it + configurable via Platform.h. + +2011-04-15 Dmitry Lomov <dslomov@google.com> + + Reviewed by David Levin. + + Add a sample test case for GTest framework + https://bugs.webkit.org/show_bug.cgi?id=58509 + + Add an example of GTest testcase, complete with a runner, to JavaScriptCore. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * wtf/tests/RunAllWtfTests.cpp: Added. + (main): + * wtf/tests/StringTests.cpp: Added. + +2011-04-15 Anna Cavender <annacc@chromium.org> + + Reviewed by Eric Carlson. + + Renaming TRACK feature define to VIDEO_TRACK + https://bugs.webkit.org/show_bug.cgi?id=53556 + + * Configurations/FeatureDefines.xcconfig: + +2011-04-14 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Geoffrey Garen. + + Hide DFG_JIT_RESTRICTIONS behind ARITHMETIC_OP() macro, and rename + m_regressionGuard to m_parseFailed, such that it can be reused for + other failure cases. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::ByteCodeParser): + (JSC::DFG::ByteCodeParser::parse): + +2011-04-14 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoffrey Garen. + + Bug 58620 - DFG JIT - loading of arguments should not be lazy + + This optimization is overly simplistic. It only works because we never + write out definitions to arguments (since we currently only compile + single block functions). Revert this for now, we may want to reintroduce + something like this again in the future, but it will need to be aware + how to schedule definitions to arguments versus lazy loads that have not + yet been performed. + + * dfg/DFGGenerationInfo.h: + (JSC::DFG::GenerationInfo::needsSpill): + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dump): + * dfg/DFGGraph.h: + * dfg/DFGJITCodeGenerator.cpp: + (JSC::DFG::JITCodeGenerator::fillInteger): + (JSC::DFG::JITCodeGenerator::fillDouble): + (JSC::DFG::JITCodeGenerator::fillJSValue): + * dfg/DFGJITCodeGenerator.h: + (JSC::DFG::JITCodeGenerator::initConstantInfo): + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::fillNumericToDouble): + (JSC::DFG::JITCompiler::fillInt32ToInteger): + (JSC::DFG::JITCompiler::fillToJS): + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::isKnownInteger): + (JSC::DFG::NonSpeculativeJIT::isKnownNumeric): + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): + (JSC::DFG::SpeculativeJIT::fillSpeculateCell): + (JSC::DFG::SpeculativeJIT::compile): + +2011-04-14 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoffrey Garen. + + Bug 58600 - DFG JIT bugs in ValueToInt, PutByVal + + The bug in PutByVal is that an operand is in JSValueOperand - when this + locks an integer into a register it will always retag the value without + checking if the register is already locked. This is a problem where the + value being stored by a PutByVal is the same as the subscript. + The subscript is locked into a register first, as a strict integer. + Locking the value results in the subscript being modified. + + The bug in ValueToInt related to the function of sillentFillAllRegisters. + The problem is that this method will restore all register values from + prior to the call, overwriting the result of the call out. Allow a + register to be passed to specifically be excluded from being preserved. + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::debugOffset): + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::ARMInstructionFormatter::debugOffset): + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::debugOffset): + * assembler/AssemblerBuffer.h: + (JSC::AssemblerBuffer::debugOffset): + * assembler/LinkBuffer.h: + (JSC::LinkBuffer::debugAddress): + * assembler/MIPSAssembler.h: + (JSC::MIPSAssembler::debugOffset): + * assembler/MacroAssemblerX86_64.h: + (JSC::MacroAssemblerX86_64::orPtr): + * assembler/X86Assembler.h: + (JSC::X86Assembler::debugOffset): + (JSC::X86Assembler::X86InstructionFormatter::debugOffset): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parse): + * dfg/DFGGenerationInfo.h: + * dfg/DFGJITCodeGenerator.cpp: + (JSC::DFG::JITCodeGenerator::fillJSValue): + * dfg/DFGJITCodeGenerator.h: + (JSC::DFG::JITCodeGenerator::isConstant): + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::compileFunction): + * dfg/DFGJITCompiler.h: + (JSC::DFG::JITCompiler::isConstant): + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::valueToNumber): + (JSC::DFG::NonSpeculativeJIT::valueToInt32): + (JSC::DFG::NonSpeculativeJIT::numberToInt32): + (JSC::DFG::NonSpeculativeJIT::isKnownInteger): + (JSC::DFG::NonSpeculativeJIT::isKnownNumeric): + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGNonSpeculativeJIT.h: + (JSC::DFG::NonSpeculativeJIT::silentSpillGPR): + (JSC::DFG::NonSpeculativeJIT::silentSpillFPR): + (JSC::DFG::NonSpeculativeJIT::silentFillGPR): + (JSC::DFG::NonSpeculativeJIT::silentFillFPR): + (JSC::DFG::NonSpeculativeJIT::silentSpillAllRegisters): + (JSC::DFG::NonSpeculativeJIT::silentFillAllRegisters): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2011-04-14 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Drain the mark stack while marking weak handles, not after. + https://bugs.webkit.org/show_bug.cgi?id=58574 + + Otherwise, items that would have caused more weak handle marking are + processed after all weak handle marking has finished, and referenced + weak handles get recycled. + + * heap/HandleHeap.cpp: + (JSC::HandleHeap::markWeakHandles): Removed looping from here, since we + want Heap::markRoots to be responsible for draining the mark stack. + + * heap/Heap.cpp: + (JSC::Heap::markRoots): Moved looping to here, as explained above. + + For efficiency's sake, drain the mark stack before starting to mark weak + handles. Otherwise, items drained while marking weak handles may force + an extra trip through the weak handle list. + + For correctness's sake, drain the mark stack each time through the weak + handle list. Otherwise, opaque roots that would make weak handles reachable + are not discovered until after weak handle marking is over. + +2011-04-14 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make protected object list in caches window reflect reality + https://bugs.webkit.org/show_bug.cgi?id=58565 + + Make sure the heap includes objects protected by Strong handles + in its list of protected objects. + + * heap/HandleHeap.h: + * heap/Heap.cpp: + (JSC::HandleHeap::protectedObjectTypeCounts): + +2011-04-14 Satish Sampath <satish@chromium.org> + + Reviewed by Anders Carlsson. + + Don't emit RegExp tables for chromium where they are not used + https://bugs.webkit.org/show_bug.cgi?id=58544 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + * create_regex_tables: Added the "--notables" command line argument. + +2011-04-13 Geoffrey Garen <ggaren@apple.com> + + Try to fix ASSERTs seen on Windows bots. + + * wtf/HashTable.h: + (WTF::hashTableSwap): Force MSVC to use the right version of swap. + +2011-04-13 Ryuan Choi <ryuan.choi@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [CMAKE] Separate DerivedSources. + https://bugs.webkit.org/show_bug.cgi?id=58427 + + * CMakeLists.txt: Change DERIVED_SOURCES_DIR to DERIVED_SOURCES_JAVASCRIPTCORE_DIR. + +2011-04-13 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Switched DOM wrappers to use HashMap of Weak<T> instead of WeakGCMap<T> + https://bugs.webkit.org/show_bug.cgi?id=58482 + + This will allow wrappers to make individual decisions about their lifetimes. + + * heap/HandleHeap.h: + (JSC::HandleHeap::copyWeak): New function for copying a weak handle. + It's wasn't previously possible to perform this operation using HandleHeap + API because the HandleHeap doesn't expose its underlying Node structure. + + * heap/Local.h: + (JSC::::set): + * heap/Strong.h: + (JSC::Strong::set): Added ASSERTs to verify that dead objects are not + resurrected by placement into handles. + + (JSC::swap): Added a swap helper, so use of Strong<T> inside a hash table + is efficient. + + * heap/Weak.h: + (JSC::Weak::Weak): Fixed a bug where copying a weak pointer would not + copy its weak callback and context. + + (JSC::Weak::operator=): Added an assignment operator, since the default + C++ assignment operator did the wrong thing. + + (JSC::Weak::set): Added ASSERTs to verify that dead objects are not + resurrected by placement into handles. + + (JSC::swap): Added a swap helper, so use of Strong<T> inside a hash table + is efficient, and can be done without copying, which is illegal during + the handle finalization phase. + +2011-04-13 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Make PropertyMapEntry use a WriteBarrier for specificValue + https://bugs.webkit.org/show_bug.cgi?id=58407 + + Make PropertyMapEntry use a WriteBarrier for specificValue, and then + propagate the required JSGlobalData through all the methods it ends + up being needed. + + * API/JSClassRef.cpp: + (OpaqueJSClass::prototype): + * API/JSContextRef.cpp: + * API/JSObjectRef.cpp: + (JSObjectMake): + (JSObjectSetPrototype): + * JavaScriptCore.exp: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + * interpreter/Interpreter.cpp: + (JSC::appendSourceToError): + (JSC::Interpreter::tryCacheGetByID): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/InternalFunction.cpp: + (JSC::InternalFunction::name): + (JSC::InternalFunction::displayName): + * runtime/JSActivation.cpp: + (JSC::JSActivation::getOwnPropertySlot): + * runtime/JSFunction.cpp: + (JSC::JSFunction::name): + (JSC::JSFunction::displayName): + (JSC::JSFunction::getOwnPropertySlot): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::putWithAttributes): + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::resetPrototype): + * runtime/JSGlobalObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::put): + (JSC::JSObject::deleteProperty): + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + (JSC::JSObject::lookupGetter): + (JSC::JSObject::lookupSetter): + (JSC::JSObject::getPropertySpecificValue): + (JSC::JSObject::getOwnPropertyNames): + (JSC::JSObject::seal): + (JSC::JSObject::freeze): + (JSC::JSObject::preventExtensions): + (JSC::JSObject::removeDirect): + (JSC::JSObject::getOwnPropertyDescriptor): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + (JSC::JSObject::getDirect): + (JSC::JSObject::getDirectLocation): + (JSC::JSObject::isSealed): + (JSC::JSObject::isFrozen): + (JSC::JSObject::setPrototypeWithCycleCheck): + (JSC::JSObject::setPrototype): + (JSC::JSObject::inlineGetOwnPropertySlot): + (JSC::JSObject::putDirectInternal): + (JSC::JSObject::putDirectWithoutTransition): + (JSC::JSObject::putDirectFunctionWithoutTransition): + * runtime/Lookup.cpp: + (JSC::setUpStaticFunctionSlot): + * runtime/ObjectConstructor.cpp: + (JSC::objectConstructorCreate): + (JSC::objectConstructorSeal): + (JSC::objectConstructorFreeze): + (JSC::objectConstructorPreventExtensions): + (JSC::objectConstructorIsSealed): + (JSC::objectConstructorIsFrozen): + * runtime/Operations.h: + (JSC::normalizePrototypeChain): + * runtime/PropertyMapHashTable.h: + (JSC::PropertyMapEntry::PropertyMapEntry): + (JSC::PropertyTable::PropertyTable): + (JSC::PropertyTable::copy): + * runtime/Structure.cpp: + (JSC::Structure::materializePropertyMap): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::sealTransition): + (JSC::Structure::freezeTransition): + (JSC::Structure::preventExtensionsTransition): + (JSC::Structure::isSealed): + (JSC::Structure::isFrozen): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::removePropertyWithoutTransition): + (JSC::Structure::copyPropertyTable): + (JSC::Structure::get): + (JSC::Structure::despecifyFunction): + (JSC::Structure::despecifyAllFunctions): + (JSC::Structure::put): + (JSC::Structure::getPropertyNames): + * runtime/Structure.h: + (JSC::Structure::get): + (JSC::Structure::materializePropertyMapIfNecessary): + +2011-04-13 Paul Knight <pknight@apple.com> + + Reviewed by Gavin Barraclough. + + BACKTRACE() macro should check for Debug configuration in macro, not WTFReportBacktrace definition + https://bugs.webkit.org/show_bug.cgi?id=58405 + + The BACKTRACE() macro requires JavaScriptCore be built with a Debug + configuration in order for it to be enabled. Move the NDEBUG check to + the header so it will be enabled when the calling framework or + application is built with a Debug configuration, similar to how + ASSERT() and friends work. + + * wtf/Assertions.cpp: + * wtf/Assertions.h: + +2011-04-12 Ben Taylor <bentaylor.solx86@gmail.com> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=58131 + + Provide a workaround for an obscure Studio 12 compiler bug, which + couldn't call src->~T() on a const T *src. + + * wtf/Vector.h: + +2011-04-12 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=58395 + Exceptions thrown from property getters called from Array prototype functions can be missed + + This is caught by an ASSERT in the top of Interpreter::executeCall. + Check for exceptions after accessing properties that could be getters. + + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncSort): + (JSC::arrayProtoFuncFilter): + (JSC::arrayProtoFuncMap): + (JSC::arrayProtoFuncEvery): + (JSC::arrayProtoFuncForEach): + (JSC::arrayProtoFuncSome): + (JSC::arrayProtoFuncReduce): + (JSC::arrayProtoFuncReduceRight): + - Add exception checks. + +2011-04-12 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make API callback objects use weak handles to run their finalizers + https://bugs.webkit.org/show_bug.cgi?id=58389 + + Make the API object's private data struct act as a finalizer for + an api object if the callback object has a API defined finalizer. + + * API/JSCallbackObject.cpp: + (JSC::JSCallbackObjectData::finalize): + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::init): + * heap/Handle.h: + +2011-04-12 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Geoffrey Garen. + + Cleaned up hash traits, and added hash traits for handles + https://bugs.webkit.org/show_bug.cgi?id=58381 + + * heap/Handle.h: + (JSC::HandleBase::swap): + (JSC::Handle::Handle): + (JSC::Handle::swap): Implemented swap, so we can rehash efficiently, and + without creating new handles (which is not allowed during handle finalization). + + * heap/Strong.h: + (JSC::Strong::swap): Use new SimpleClassHashTraits to avoid duplication. + + * heap/Weak.h: + (JSC::Weak::isHashTableDeletedValue): + (JSC::Weak::Weak): + (JSC::Weak::swap): + (JSC::Weak::hashTableDeletedValue): Ditto. + + * wtf/HashTraits.h: + (WTF::SimpleClassHashTraits::constructDeletedValue): + (WTF::SimpleClassHashTraits::isDeletedValue): Added SimpleClassHashTraits, + which are analogous to SimpleClassVectorTraits, since they are used in a + bunch of places. + + * wtf/RetainPtr.h: Use new SimpleClassHashTraits to avoid duplication. + + * wtf/text/StringHash.h: Use new SimpleClassHashTraits to avoid duplication. + +2011-04-12 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Cleaned up some Vector traits, and added missing Vector traits for handles + https://bugs.webkit.org/show_bug.cgi?id=58372 + + * heap/Local.h: Inherit from SimpleClassVectorTraits to avoid duplication. + + * heap/Strong.h: Ditto. + + * heap/Weak.h: Ditto. + + * parser/JSParser.cpp: Fixed a traits error. No test case because this + particular trait is not currently exercised by the parser. + + * runtime/UString.h: No need to override canInitializeWithMemset, since + our base class sets it to true. + + * wtf/VectorTraits.h: Inherit from VectorTraitsBase to avoid duplication. + + * wtf/text/WTFString.h: No need to override canInitializeWithMemset, since + our base class sets it to true. + +2011-04-12 Thouraya ANDOLSI <thouraya.andolsi@st.com> + + Reviewed by Eric Seidel. + + [Qt] Enable JIT build for SH4 platforms. + https://bugs.webkit.org/show_bug.cgi?id=58317 + enable JIT build for QT backend for SH4 platforms. + + * JavaScriptCore.pro: + * wtf/Platform.h: + +2011-04-11 Ben Taylor <bentaylor.solx86@gmail.com> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=58289 + + Fix compilation on Solaris/Studio 12 C++ in wtf/FastMalloc.cpp, + WTF::TCMalloc_PageHeap::runScavengerThread(void*) expected to return a value. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::runScavengerThread): + +2011-04-11 Mark Rowe <mrowe@apple.com> + + Fix the build. + + * JavaScriptCore.xcodeproj/project.pbxproj: Headers used outside of JavaScriptCore need to be marked as private. + +2011-04-11 Anna Cavender <annacc@chromium.org> + + Reviewed by Eric Carlson. + + Setup ENABLE(TRACK) feature define + https://bugs.webkit.org/show_bug.cgi?id=53556 + + + * Configurations/FeatureDefines.xcconfig: + +2011-04-11 Geoffrey Garen <ggaren@apple.com> + + Try to fix a few builds. + + Updated a few more build configurations for file moves. + + * CMakeListsWinCE.txt: + +2011-04-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + Bug 58263 - Use EncodedValueDescriptor on both JSVALUE32_64, JSVALUE64 + + The JSJITInterface already uses EncodedValueDescriptor to access the tag/payload + separately on JSVALUE64, even though EncodedValueDescriptor is not used in + JSVALUE64's implementation of JSValue. Remove the separate definition for m_ptr + on X86_64. Using the union allows us to remove a layer of makeImmediate()/ + immedaiteValue() methods. + + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * jit/JITInlineMethods.h: + (JSC::JIT::emitTagAsBoolImmediate): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_not): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_get_pnames): + (JSC::JIT::emit_op_eq_null): + (JSC::JIT::emit_op_neq_null): + (JSC::JIT::emitSlow_op_not): + * runtime/JSCell.h: + * runtime/JSValue.h: + * runtime/JSValueInlineMethods.h: + (JSC::JSValue::encode): + (JSC::JSValue::decode): + (JSC::JSValue::operator==): + (JSC::JSValue::operator!=): + (JSC::JSValue::JSValue): + (JSC::JSValue::operator bool): + (JSC::JSValue::asInt32): + (JSC::JSValue::isUndefinedOrNull): + (JSC::JSValue::isBoolean): + (JSC::JSValue::isCell): + (JSC::JSValue::isInt32): + (JSC::JSValue::asDouble): + (JSC::JSValue::isNumber): + (JSC::JSValue::asCell): + +2011-04-11 Geoffrey Garen <ggaren@apple.com> + + Try to fix a few builds. + + Updated a few more build configurations for file moves. + + * CMakeListsEfl.txt: + * wscript: + +2011-04-11 Geoffrey Garen <ggaren@apple.com> + + Build fix: Updated a file name. + + * CMakeLists.txt: + +2011-04-11 Geoffrey Garen <ggaren@apple.com> + + Rubber-stamped by Sam Weinig. + + Moved remaining heap implementation files to the heap folder. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pro: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * heap/ConservativeRoots.cpp: Copied from runtime/ConservativeSet.cpp. + * heap/ConservativeRoots.h: Copied from runtime/ConservativeSet.h. + * heap/Handle.h: + * heap/Heap.cpp: + * heap/MachineStackMarker.cpp: Copied from runtime/MachineStackMarker.cpp. + * heap/MachineStackMarker.h: Copied from runtime/MachineStackMarker.h. + * heap/MarkStack.cpp: Copied from runtime/MarkStack.cpp. + * heap/MarkStack.h: Copied from runtime/MarkStack.h. + * heap/MarkStackPosix.cpp: Copied from runtime/MarkStackPosix.cpp. + * heap/MarkStackSymbian.cpp: Copied from runtime/MarkStackSymbian.cpp. + * heap/MarkStackWin.cpp: Copied from runtime/MarkStackWin.cpp. + * heap/MarkedBlock.cpp: Copied from runtime/MarkedBlock.cpp. + * heap/MarkedBlock.h: Copied from runtime/MarkedBlock.h. + * heap/MarkedSpace.cpp: Copied from runtime/MarkedSpace.cpp. + * heap/MarkedSpace.h: Copied from runtime/MarkedSpace.h. + * interpreter/RegisterFile.cpp: + * runtime/ConservativeSet.cpp: Removed. + * runtime/ConservativeSet.h: Removed. + * runtime/MachineStackMarker.cpp: Removed. + * runtime/MachineStackMarker.h: Removed. + * runtime/MarkStack.cpp: Removed. + * runtime/MarkStack.h: Removed. + * runtime/MarkStackPosix.cpp: Removed. + * runtime/MarkStackSymbian.cpp: Removed. + * runtime/MarkStackWin.cpp: Removed. + * runtime/MarkedBlock.cpp: Removed. + * runtime/MarkedBlock.h: Removed. + * runtime/MarkedSpace.cpp: Removed. + * runtime/MarkedSpace.h: Removed. + +2011-04-11 Gavin Barraclough <barraclough@apple.com> + + Windows build fix. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2011-04-09 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + Bug 58198 - Clean up JSValue implementation for JSVALUE64 + + Remove JSNumberCell, JSImmediate, unify some methods between JSVALUE32_64/JSVALUE64 + + JSNumberCell.h largely just contained the constructors for JSValue on JSVALUE64, + which should not have been here. JSImmediate mostly contained uncalled methods, + along with the internal implementation of the JSValue constructors split unnecessarily + across a number of layers of function calls. These could largely be merged back + together. Many methods and constructors from JSVALUE32_64 and JSVALUE64 can by unified. + + The .cpp files were empty. + + Moving all these methods into JSValue.h seems to be a repro measurable regression, so + I have kept these methods in a separate JSValueInlineMethods.h. Adding the 64-bit tag + values as static const members of JSValue also measures as a repro regression, so I + have made these #defines. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.exp: + * JavaScriptCore.gypi: + * JavaScriptCore.pro: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + - Removed JSImmediate.h, JSNumberCell.h. + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitLoad): + - Removed class JSImmediate. + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + - Removed class JSImmediate. + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + - Removed class JSImmediate. + * jit/JITArithmetic.cpp: + (JSC::JIT::compileBinaryArithOpSlowCase): + - Removed class JSImmediate. + * jit/JITInlineMethods.h: + (JSC::JIT::emitJumpIfJSCell): + (JSC::JIT::emitJumpIfNotJSCell): + (JSC::JIT::emitJumpIfImmediateInteger): + (JSC::JIT::emitJumpIfNotImmediateInteger): + (JSC::JIT::emitFastArithDeTagImmediate): + (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero): + (JSC::JIT::emitFastArithReTagImmediate): + (JSC::JIT::emitTagAsBoolImmediate): + - Removed class JSImmediate. + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_not): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_get_pnames): + (JSC::JIT::emit_op_eq_null): + (JSC::JIT::emit_op_neq_null): + (JSC::JIT::emitSlow_op_not): + - Removed class JSImmediate. + * jit/JSInterfaceJIT.h: + - Removed class JSImmediate. + * runtime/JSCell.h: + - Removed JSImmediate.h, JSNumberCell.h. + * runtime/JSImmediate.cpp: Removed. + * runtime/JSImmediate.h: Removed. + * runtime/JSNumberCell.cpp: Removed. + * runtime/JSNumberCell.h: Removed. + - Removed. + * runtime/JSObject.h: + - Removed JSImmediate.h, JSNumberCell.h. + * runtime/JSString.h: + - Removed JSImmediate.h, JSNumberCell.h. + * runtime/JSValue.h: + - Added tags for JSVALUE64, moved out some JSVALUE32_64 methods, unified with JSVALUE64. + * runtime/JSValueInlineMethods.h: Added. + (JSC::JSValue::toInt32): + (JSC::JSValue::toUInt32): + (JSC::JSValue::isUInt32): + (JSC::JSValue::asUInt32): + (JSC::JSValue::uncheckedGetNumber): + (JSC::JSValue::toJSNumber): + (JSC::jsNaN): + (JSC::JSValue::getNumber): + (JSC::JSValue::getBoolean): + (JSC::JSValue::JSValue): + (JSC::JSValue::encode): + (JSC::JSValue::decode): + (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::isDouble): + (JSC::JSValue::isTrue): + (JSC::JSValue::isFalse): + (JSC::JSValue::tag): + (JSC::JSValue::payload): + (JSC::JSValue::asInt32): + (JSC::JSValue::asDouble): + (JSC::JSValue::asCell): + (JSC::JSValue::isNumber): + (JSC::JSValue::isBoolean): + (JSC::JSValue::makeImmediate): + (JSC::JSValue::immediateValue): + (JSC::reinterpretDoubleToIntptr): + (JSC::reinterpretIntptrToDouble): + - Methods moved here from JSImmediate.h/JSNumberCell.h/JSValue.h. + * runtime/Operations.h: + - Removed JSImmediate.h, JSNumberCell.h. + * wtf/StdLibExtras.h: + - Export bitwise_cast. + +2011-04-11 Thouraya ANDOLSI <thouraya.andolsi@st.com> + + Reviewed by Oliver Hunt. + + SH4 JIT SUPPORT. + https://bugs.webkit.org/show_bug.cgi?id=44329 + + Add JIT remaining part for SH4 platforms. + + * assembler/MacroAssemblerSH4.h: + * jit/JIT.h: + * jit/JITInlineMethods.h: + * jit/JITOpcodes32_64.cpp: + * jit/JITPropertyAccess32_64.cpp: + * jit/JITStubs.cpp: + * jit/JITStubs.h: + * jit/JSInterfaceJIT.h: + +2011-04-10 Geoffrey Garen <ggaren@apple.com> + + Rubber-stamped by Beth Dakin. + + Moved Heap.h and Heap.cpp to the heap folder, because anything less + would be uncivilized. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pro: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * heap/Heap.cpp: Copied from JavaScriptCore/runtime/Heap.cpp. + * heap/Heap.h: Copied from JavaScriptCore/runtime/Heap.h. + * runtime/Heap.cpp: Removed. + * runtime/Heap.h: Removed. + +2011-04-10 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Darin Adler. + + Remove duplicated code from AtomicString::fromUTF8() + https://bugs.webkit.org/show_bug.cgi?id=53711 + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/text/AtomicString.cpp: + (WTF::AtomicString::fromUTF8Internal): + * wtf/text/AtomicString.h: + (WTF::AtomicString::fromUTF8): + * wtf/unicode/UTF8.cpp: + (WTF::Unicode::calculateStringHashAndLengthFromUTF8): + * wtf/unicode/UTF8.h: + +2011-04-10 Maciej Stachowiak <mjs@apple.com> + + Not reviewed. + + Fix build (at least on Lion) by adding some newish header files to + PrivateHeaders. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2011-04-09 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Try recommitting some things svn left out of its last commit. + + * heap/Handle.h: + (JSC::HandleBase::operator!): + (JSC::HandleBase::HandleBase): + (JSC::HandleBase::slot): + (JSC::HandleBase::setSlot): + (JSC::Handle::Handle): + * heap/HandleHeap.cpp: + (JSC::HandleHeap::markWeakHandles): + (JSC::HandleHeap::finalizeWeakHandles): + (JSC::HandleHeap::isValidWeakNode): + * heap/HandleHeap.h: + (JSC::HandleHeap::globalData): + +2011-04-08 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + A few heap-related renames and file moves. + + WeakGCPtr<T> => Weak<T> + Global<T> => Strong<T> + collector/ => heap/ + collector/* => heap/* + runtime/WeakGCPtr.h => heap/Weak.h + + (Eventually, even more files should move into the heap directory. Like + Heap.h and Heap.cpp, for example.) + + * API/JSClassRef.h: + * CMakeLists.txt: + * GNUmakefile.am: + * GNUmakefile.list.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.pro: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/SamplingTool.h: + * bytecompiler/BytecodeGenerator.h: + * collector: Removed. + * collector/handles: Removed. + * collector/handles/Global.h: Removed. + * collector/handles/Handle.h: Removed. + * collector/handles/HandleHeap.cpp: Removed. + * collector/handles/HandleHeap.h: Removed. + * collector/handles/HandleStack.cpp: Removed. + * collector/handles/HandleStack.h: Removed. + * collector/handles/Local.h: Removed. + * collector/handles/LocalScope.h: Removed. + * heap: Copied from collector. + * heap/Handle.h: Copied from collector/handles/Handle.h. + * heap/HandleHeap.cpp: Copied from collector/handles/HandleHeap.cpp. + * heap/HandleHeap.h: Copied from collector/handles/HandleHeap.h. + * heap/HandleStack.cpp: Copied from collector/handles/HandleStack.cpp. + * heap/HandleStack.h: Copied from collector/handles/HandleStack.h. + * heap/Local.h: Copied from collector/handles/Local.h. + * heap/LocalScope.h: Copied from collector/handles/LocalScope.h. + * heap/Strong.h: Copied from collector/handles/Global.h. + (JSC::Strong::Strong): + (JSC::Strong::~Strong): + (JSC::Strong::operator=): + * heap/Weak.h: Copied from runtime/WeakGCPtr.h. + (JSC::Weak::Weak): + (JSC::Weak::~Weak): + * heap/handles: Removed. + * interpreter/RegisterFile.h: + * jit/JITStubs.cpp: + (JSC::JITThunks::hostFunctionStub): + * jit/JITStubs.h: + * runtime/Structure.h: + * runtime/WeakGCPtr.h: Removed. + +2011-04-08 Alpha Lam <hclam@chromium.org> + + Unreviewed, rolling out r83335. + http://trac.webkit.org/changeset/83335 + https://bugs.webkit.org/show_bug.cgi?id=53556 + + GTK and QT bots are broken + + * Configurations/FeatureDefines.xcconfig: + +2011-04-08 Gavin Barraclough <barraclough@apple.com> + + Ooops, typo, build fix. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parse): + +2011-04-08 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Bug 58154 - Add support for comparison operators to the DFG JIT. + + Add support for <, <=, ==, ===, and also !. Add support for all corresponding + bytecode ops, including the not- and -null forms. Initially add functionally + correct support, we'll revisit the performance. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::ByteCodeParser): + (JSC::DFG::ByteCodeParser::constantNull): + (JSC::DFG::ByteCodeParser::parse): + - Add support for parsing of bytecode opcodes, + * dfg/DFGJITCodeGenerator.h: + (JSC::DFG::JITCodeGenerator::callOperation): + - Add new operation call types, return bool values. + * dfg/DFGNode.h: + - Add new node types. + * dfg/DFGNonSpeculativeJIT.cpp: + (JSC::DFG::NonSpeculativeJIT::compile): + - Add code generation for new nodes. + * dfg/DFGOperations.cpp: + (JSC::DFG::operationCompareLess): + (JSC::DFG::operationCompareLessEq): + (JSC::DFG::operationCompareEq): + (JSC::DFG::operationCompareStrictEq): + (JSC::DFG::dfgConvertJSValueToBoolean): + * dfg/DFGOperations.h: + - Add operation callbacks to implement new ops. + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + - Add code generation for new nodes. + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + - Switched to a simpler <0 check, rather than relying on an internal value in JSImmediate. + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePatchGetArrayLength): + - Switched to a simpler <0 check, rather than relying on an internal value in JSImmediate. + * runtime/JSImmediate.h: + - Make tag values public, rather than relying on a friend - this matches JSVALUE32_64. + +2011-04-07 Anna Cavender <annacc@chromium.org> + + Reviewed by Eric Carlson. + + Setup ENABLE(TRACK) feature define + https://bugs.webkit.org/show_bug.cgi?id=53556 + + + * Configurations/FeatureDefines.xcconfig: + +2011-04-07 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [WK2][Qt][GTK] Introduce common use flag for the shared UNIX domain socket IPC implementation + https://bugs.webkit.org/show_bug.cgi?id=58030 + + * wtf/Platform.h: Introduce USE(UNIX_DOMAIN_SOCKETS) for WebKit2. + +2011-04-08 Adam Roben <aroben@apple.com> + + Clean build fix + + * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: Don't try to delete directories that + don't exist. Also switched from del /s to rmdir /s, which has the benefit of deleting the + directory itself in addition to the files it contains. + +2011-04-07 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Maciej Stachowiak. + + Some Handle<T> cleanup + https://bugs.webkit.org/show_bug.cgi?id=58109 + + * bytecode/SamplingTool.h: Sorted alphabetically because that's the + WebKit style. Added a Global.h #include that was previously missing + but harmless. + + * collector/handles/Global.h: + (JSC::Global::Global): Added a null constructor. No need for a special + tag, and the tag is incompatible with some data structures. + + (JSC::Global::isHashTableDeletedValue): + (JSC::Global::~Global): + (JSC::Global::set): + (JSC::Global::operator=): + (JSC::Global::clear): + (JSC::Global::hashTableDeletedValue): Reordered constructors to be near + each other. + + (JSC::Global::setWithWriteBarrier): Renamed internalSet to + setWithWriteBarrier for clarity, and funneled more code into using set + and setWithWriteBarrier to reduce duplication. + + * collector/handles/Handle.h: + (JSC::HandleBase::operator!): + (JSC::HandleBase::HandleBase): Removed isEmpty(), since we already have + boolean and ! operators. + + (JSC::HandleBase::slot): + (JSC::HandleBase::setSlot): + (JSC::Handle::Handle): Added general support for null Handles. This was + previously outlawed by ASSERTs, but our code has grown to support and + rely on null Handles. + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::markWeakHandles): + (JSC::HandleHeap::finalizeWeakHandles): + (JSC::HandleHeap::isValidWeakNode): Migrated from isValidWeakHandle, + and beefed this up a bit. + + * collector/handles/HandleHeap.h: + (JSC::HandleHeap::globalData): Added accessor, used by some new set functions. + + * collector/handles/Local.h: Moved hash traits to the bottom of the file, + since this file is about the Local class, not the traits. + + (JSC::::Local): Updated for removal of invalidate(). + + (JSC::::operator): Deployed "using" to avoid a lot of this-> + template funny business. + + (JSC::::setWithSlotCheck): Renamed from internalSet, more specific now. + + * interpreter/RegisterFile.h: + (JSC::RegisterFile::RegisterFile): Updated to use null constructor. + + * jit/JITStubs.cpp: + (JSC::JITThunks::hostFunctionStub): + + * runtime/JSPropertyNameIterator.h: + (JSC::Structure::setEnumerationCache): + * runtime/Structure.h: Removed clearEnumerationCache + because it was an unused holdover from when the enumeration cache was + not a handle. + + * runtime/WeakGCMap.h: + (JSC::WeakGCMap::set): Finish initializing our handle before putting it + in the table. This seemed more logical, and at one point was required + to avoid triggering an ASSERT. + + * runtime/WeakGCPtr.h: Inherit from Handle instead of rolling our own + handle-like behavior, to avoid duplication. + + (JSC::WeakGCPtr::WeakGCPtr): + (JSC::WeakGCPtr::~WeakGCPtr): + (JSC::WeakGCPtr::get): + (JSC::WeakGCPtr::clear): + (JSC::WeakGCPtr::set): + (JSC::WeakGCPtr::setWithWriteBarrier): Removed duplicate code and + standardized on Handle idioms. + +2011-04-07 Adam Barth <abarth@webkit.org> + + Reviewed by Martin Robinson. + + Refactor Gtk build system to separate list of files + https://bugs.webkit.org/show_bug.cgi?id=58090 + + This is the first step towards generating part of the GTK build system + using GYP. In the first iteration, our plan is to just generate the + list of files. This patch is the first step, which is to separate out + the part of JavaScriptCore build system that we intend to generate from + the rest of the build system. + + * GNUmakefile.am: + * GNUmakefile.list.am: Added. + +2011-04-07 Zoltan Herczeg <zherczeg@webkit.org> + + Reviewed by Gavin Barraclough. + + Mapping booleans the same way as integers + https://bugs.webkit.org/show_bug.cgi?id=56913 + + Instead of having a seperate tag field for booleans, + the logical values are stored in the payload field + (for JSValue32_64 representation). + + 1.007x speedup on SunSpider. + + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitStoreBool): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emit_op_not): + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emitSlow_op_jfalse): + (JSC::JIT::emit_op_jtrue): + (JSC::JIT::emitSlow_op_jtrue): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_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/JSInterfaceJIT.h: + * runtime/JSValue.h: + (JSC::JSValue::JSValue): + (JSC::JSValue::isTrue): + (JSC::JSValue::isFalse): + (JSC::JSValue::getBoolean): + +2011-04-07 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Add stub support for generating Gtk build system from gyp + https://bugs.webkit.org/show_bug.cgi?id=58086 + + This does not produce a buildable JavaScriptCore, but it + does allow running gyp/configure --port=gtk and having + it generate a gtk.Makefile which we can use for testing + the rest of the plumbing. + + * gyp/gtk.gyp: Added. + +2011-04-07 Andrew Scherkus <scherkus@chromium.org> + + Revert ENABLE_TRACK patch due to compile failures. + + * Configurations/FeatureDefines.xcconfig: + +2011-04-07 Adam Barth <abarth@webkit.org> + + Fix whitespace in GNUmakefile.am. + + * GNUmakefile.am: + +2011-04-07 Gavin Barraclough <barraclough@apple.com> + + Fix a couple of typos in comments that Darin spotted. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_not): + * runtime/JSImmediate.h: + +2011-04-06 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + Bug 58057 - Store boolean payload in low bit of JSImmediate + + And remove some uncalled functions from JSImmediate.h + + * jit/JITInlineMethods.h: + (JSC::JIT::emitTagAsBoolImmediate): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_not): + * runtime/JSImmediate.h: + (JSC::JSImmediate::makeInt): + (JSC::JSImmediate::makeBool): + (JSC::JSImmediate::intValue): + (JSC::JSImmediate::boolValue): + (JSC::JSImmediate::asInt32): + (JSC::JSImmediate::toDouble): + (JSC::JSValue::asInt32): + (JSC::JSValue::isUInt32): + (JSC::JSValue::asUInt32): + +2011-04-07 Liang Qi <liang.qi@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt][Symbian] Enable webkit build with GCCE on Symbian. + https://bugs.webkit.org/show_bug.cgi?id=57841 + + * wtf/MathExtras.h: GCCE compiler doesn't support those std static functions. + +2011-04-06 Dai Mikurube <dmikurube@chromium.org> + + Reviewed by David Levin. + + Add QUOTA build flag for unified quota API + https://bugs.webkit.org/show_bug.cgi?id=57918 + + * Configurations/FeatureDefines.xcconfig: Added QUOTA build flag + +2011-04-06 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Make sure JS_EXPORT_PRIVATE is an empty define when we aren't using the export macros. + + https://bugs.webkit.org/show_bug.cgi?id=27551 + + * config.h: + +2011-04-06 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Stop JSObject::isUsingInlineStorage() from using the structure + https://bugs.webkit.org/show_bug.cgi?id=57986 + + Make the isUsingInlineStorage() implementation just look at + whether the property storage is inside the object. + + * runtime/JSObject.h: + (JSC::JSObject::isUsingInlineStorage): + (JSC::JSObject::JSObject): + +2011-04-06 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Geoff Garen. + + Update comments documenting JSVALUE64/JSVALUE32_64 JSValue representations. + + * runtime/JSImmediate.h: + * runtime/JSValue.h: + +2011-04-06 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + cmake: Fix build for ARMv7 + + * CMakeLists.txt: add missing file. + +2011-04-06 Liang Qi <liang.qi@nokia.com> + + Reviewed by Benjamin Poulain. + + Correct a include file name. + https://bugs.webkit.org/show_bug.cgi?id=57839 + + * wtf/PageAllocatorSymbian.h: It should be case sensitive. This fix + builds on Unix hosts. + +2011-04-06 Adam Roben <aroben@apple.com> + + Build fix after r83056 + + * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: Added property svn:executable. + +2011-04-06 Adam Roben <aroben@apple.com> + + Move JavaScriptCoreGenerated's file-copying logic out to a new script + + Hopefully this will make it easier to modify this logic in the future. I also made the + script much quieter than the old logic, since it didn't seem helpful to see long lists of + filenames during the copying phase. + + If we like this new style, we could copy it for our other projects. + + Fixes <http://webkit.org/b/57950> JavaScriptCoreGenerated's file-copying logic is hard to + modify and noisy + + Reviewed by Steve Falkenburg. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Moved logic to copy + files from here... + * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: ...to here. (Added.) + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added copy-files.cmd + for convenience. + +2011-04-05 Geoffrey Garen <ggaren@apple.com> + + Try to fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Who likes export files? I do! + +2011-04-05 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Introduced the concept of opaque roots, in preparation for marking the DOM with them + https://bugs.webkit.org/show_bug.cgi?id=57903 + + * JavaScriptCore.exp: Who likes export files? I do! + + * collector/handles/HandleHeap.cpp: + (JSC::isValidWeakHandle): Factored out a helper function for ASSERTs. + + (JSC::WeakHandleOwner::~WeakHandleOwner): Moved from header to avoid + weak linkage problems. + + (JSC::WeakHandleOwner::isReachableFromOpaqueRoots): New callback. + Currently unused. + + (JSC::WeakHandleOwner::finalize): Switched from pure virtual to a + default empty implementation, since not all clients necessarily want + or need non-trivial finalizers. + + (JSC::HandleHeap::markWeakHandles): Split updateWeakHandles into two + passes. The first pass marks all reachable weak handles. The second pass + finalizes all unreachable weak handles. This must be two passes because + we don't know the set of finalizable weak handles until we're done + marking all weak handles. + + (JSC::HandleHeap::finalizeWeakHandles): Use new helper function. + + * collector/handles/HandleHeap.h: Ditto. + + * runtime/Heap.cpp: + (JSC::Heap::destroy): + (JSC::Heap::markRoots): + (JSC::Heap::reset): Split out handle marking from handle finalization. + + * runtime/MarkStack.cpp: + (JSC::MarkStack::reset): + * runtime/MarkStack.h: + (JSC::MarkStack::addOpaqueRoot): + (JSC::MarkStack::containsOpaqueRoot): + (JSC::MarkStack::opaqueRootCount): + (JSC::HeapRootMarker::markStack): New helper functions for managing the + set of opaque roots. + + * runtime/WeakGCMap.h: + (JSC::WeakGCMap::finalize): Renamed to match parent class declaration. + +2011-04-05 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Darin Adler. + + Build fix for YarrParser.h + https://bugs.webkit.org/show_bug.cgi?id=57822 + + * yarr/YarrParser.h: + (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate): + +2011-04-05 Steve Falkenburg <sfalken@apple.com> + + Follow-up Windows build fix. + Don't skip react-to-vsprops-changes.py for all production builds, + only those initiated via JavaScriptCore.make. + + * JavaScriptCore.vcproj/JavaScriptCore.make: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: + +2011-04-05 Oliver Hunt <oliver@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r82849): 85,000+ JSC-related leaks seen on SnowLeopard Intel Leaks + https://bugs.webkit.org/show_bug.cgi?id=57857 + + Whoops, accidentally removed a deref(). + + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + +2011-04-05 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Add per-configuration vsprops files. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops: Removed inheritance from common.vsprops. + Set production environment variable before calling make. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebug.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugAll.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugCairoCFLite.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedProduction.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedRelease.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops: Added. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleasePGO.vsprops: Added. + +2011-04-05 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Make caches window show more info about non-jsobject GC values + https://bugs.webkit.org/show_bug.cgi?id=57874 + + Add ClassInfo to the various internal JS types that currently + don't have any, and make the text for caches window show the + classname for non-JSObject instances. + + * runtime/Executable.cpp: + * runtime/Executable.h: + (JSC::ExecutableBase::createStructure): + (JSC::NativeExecutable::createStructure): + (JSC::NativeExecutable::NativeExecutable): + (JSC::EvalExecutable::createStructure): + (JSC::ProgramExecutable::createStructure): + (JSC::FunctionExecutable::createStructure): + * runtime/Heap.cpp: + (JSC::TypeCounter::typeName): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * runtime/ScopeChain.cpp: + * runtime/ScopeChain.h: + (JSC::ScopeChainNode::createStructure): + * runtime/StructureChain.cpp: + * runtime/StructureChain.h: + (JSC::StructureChain::createStructure): + +2011-04-05 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Andreas Kling. + + Cleanup StringConcatenate + https://bugs.webkit.org/show_bug.cgi?id=57836 + + Don't use PassRefPtr in local variables, properly store in RefPtrs and release on return. + Add a makeString() variant taking 9 arguments, needed by a follow-up patch. + + * wtf/text/StringConcatenate.h: + (WTF::tryMakeString): + (WTF::makeString): + +2011-04-04 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r82876. + http://trac.webkit.org/changeset/82876 + https://bugs.webkit.org/show_bug.cgi?id=57816 + + Caused a lot of test crashes (Requested by tkent on #webkit). + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/FastMalloc.cpp: + (WTF::tryFastMalloc): + (WTF::fastMalloc): + (WTF::tryFastCalloc): + (WTF::fastCalloc): + (WTF::fastFree): + (WTF::tryFastRealloc): + (WTF::fastRealloc): + (WTF::fastMallocSize): + (WTF::TCMalloc_PageHeap::isScavengerSuspended): + (WTF::TCMalloc_PageHeap::scheduleScavenger): + (WTF::TCMalloc_PageHeap::suspendScavenger): + (WTF::TCMalloc_PageHeap::signalScavenger): + (WTF::TCMallocStats::malloc): + (WTF::TCMallocStats::free): + (WTF::TCMallocStats::fastCalloc): + (WTF::TCMallocStats::tryFastCalloc): + (WTF::TCMallocStats::calloc): + (WTF::TCMallocStats::fastRealloc): + (WTF::TCMallocStats::tryFastRealloc): + (WTF::TCMallocStats::realloc): + (WTF::TCMallocStats::fastMallocSize): + * wtf/FastMalloc.h: + (WTF::Internal::fastMallocMatchValidationType): + (WTF::Internal::fastMallocMatchValidationValue): + (WTF::Internal::setFastMallocMatchValidationType): + (WTF::fastMallocMatchValidateFree): + * wtf/Platform.h: + +2011-04-04 Oliver Hunt <oliver@apple.com> + + Reviewed by Antti Koivisto. + + Stop JSCell.h from including Structure.h + https://bugs.webkit.org/show_bug.cgi?id=57809 + + * runtime/GetterSetter.h: + * runtime/JSAPIValueWrapper.h: + * runtime/JSCell.h: + (JSC::JSCell::JSValue::toThisObject): + * runtime/JSString.h: + * runtime/ScopeChain.h: + * runtime/Structure.h: + (JSC::JSCell::isObject): + (JSC::JSCell::isString): + (JSC::JSCell::classInfo): + (JSC::JSCell::createDummyStructure): + (JSC::JSValue::needsThisConversion): + (JSC::MarkStack::internalAppend): + * runtime/StructureChain.h: + +2011-04-04 Oliver Hunt <oliver@apple.com> + + Fix clang build. + + * wtf/FastMalloc.cpp: + (WTF::fastMalloc): + (WTF::fastCalloc): + (WTF::fastRealloc): + +2011-04-04 Oliver Hunt <oliver@apple.com> + + Remove accidental change to Platform.h + + * wtf/Platform.h: + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Fixed a weak-handle-related leak in RegisterFile + https://bugs.webkit.org/show_bug.cgi?id=57793 + + * interpreter/RegisterFile.cpp: Nixed leaky GlobalObjectNotifier. + * interpreter/RegisterFile.h: + (JSC::RegisterFile::GlobalObjectOwner::finalize): + (JSC::RegisterFile::RegisterFile): Replaced GlobalObjectNotifier with + a per-RegisterFile weak handle owner, which does not leak. + + * runtime/WeakGCPtr.h: + (JSC::WeakGCPtr::set): Allow set() to take a context argument, since + RegisterFile now needs this. (Seems like it was an accidental omission + all along.) + +2011-04-04 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make malloc validation useful + https://bugs.webkit.org/show_bug.cgi?id=57502 + + This patch changes FAST_MALLOC_MATCH_VALIDATION with a general + corruption check that tags the beginning and end of all allocations + to check for write overflows and overwrites the contents of + memory on free in order to (hopefully) show up use-after-free issues + sooner. + + We also turn it on by default for debug builds. + + * JavaScriptCore.exp: + * wtf/FastMalloc.cpp: + (WTF::tryFastMalloc): + (WTF::fastMalloc): + (WTF::tryFastCalloc): + (WTF::fastCalloc): + (WTF::fastFree): + (WTF::tryFastRealloc): + (WTF::fastRealloc): + (WTF::TCMalloc_PageHeap::isScavengerSuspended): + (WTF::TCMalloc_PageHeap::scheduleScavenger): + (WTF::TCMalloc_PageHeap::suspendScavenger): + (WTF::TCMalloc_PageHeap::signalScavenger): + (WTF::TCMallocStats::malloc): + (WTF::TCMallocStats::free): + (WTF::TCMallocStats::fastCalloc): + (WTF::TCMallocStats::tryFastCalloc): + (WTF::TCMallocStats::calloc): + (WTF::TCMallocStats::fastRealloc): + (WTF::TCMallocStats::tryFastRealloc): + (WTF::TCMallocStats::realloc): + * wtf/FastMalloc.h: + (WTF::Internal::fastMallocValidationHeader): + (WTF::Internal::fastMallocValidationSuffix): + (WTF::Internal::fastMallocMatchValidationType): + (WTF::Internal::setFastMallocMatchValidationType): + (WTF::fastMallocMatchValidateFree): + (WTF::fastMallocValidate): + * wtf/Platform.h: + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Renamed clearWeakPointers => updateWeakHandles and removed misleading comment + https://bugs.webkit.org/show_bug.cgi?id=57790 + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::updateWeakHandles): Updated for rename. + + * collector/handles/HandleHeap.h: Removed comment claiming that this + function should only be called during teardown, because it's actually + called after every GC pass. + + * runtime/Heap.cpp: + (JSC::Heap::destroy): + (JSC::Heap::markRoots): Updated for rename. + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Standardized handling of handles for immediate values + https://bugs.webkit.org/show_bug.cgi?id=57788 + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::clearWeakPointers): Don't check for null or non-cell + values here, because our write barrier guarantees that such values are + not in the weak list. + + (JSC::HandleHeap::writeBarrier): Standardized on checking for null before + checking for cell, and on using early return instead of if/else. + + * collector/handles/HandleHeap.h: + (JSC::HandleHeap::deallocate): + (JSC::HandleHeap::makeWeak): Ditto. + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Removed a redundant variable from HandleHeap + https://bugs.webkit.org/show_bug.cgi?id=57786 + + Forgot to commit the file that actually removes the data member! + + * collector/handles/HandleHeap.h: + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Removed a redundant variable from HandleHeap + https://bugs.webkit.org/show_bug.cgi?id=57786 + + We don't need a specific variable to indicate that we're in the middle + of the finalization phase, since m_nextToFinalize already does this. + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::HandleHeap): + (JSC::HandleHeap::clearWeakPointers): + (JSC::HandleHeap::writeBarrier): + +2011-04-04 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Renamed Finalizer => WeakHandleOwner (in preparation for adding a reachability callback) + https://bugs.webkit.org/show_bug.cgi?id=57775 + + Also renamed noFinalizer => emptyWeakOwner, since this is really an + optimization for a weak owner with empty callbacks. + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::clearWeakPointers): Updated for renames. Removed + redundant initialization of m_nextToFinalize. Moved deletion check inside + weak owner check, since the weak owner can't delete the node if there is + no weak owner! + + * collector/handles/HandleHeap.h: + (JSC::WeakHandleOwner::~WeakHandleOwner): + (JSC::HandleHeap::makeWeak): Updated for renames. + + (JSC::HandleHeap::hasWeakOwner): Changed getFinalizer to hasWeakOwner, + to clarify this function's role in assertions. + + (JSC::HandleHeap::Node::Node): + (JSC::HandleHeap::Node::makeWeak): + (JSC::HandleHeap::Node::isWeak): + (JSC::HandleHeap::Node::weakOwner): + (JSC::HandleHeap::Node::weakOwnerContext): + (JSC::HandleHeap::Node::emptyWeakOwner): + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::globalObjectCollectedNotifier): + * interpreter/RegisterFile.h: + * runtime/WeakGCMap.h: + * runtime/WeakGCPtr.h: + (JSC::WeakGCPtr::WeakGCPtr): + (JSC::WeakGCPtr::set): Updated for renames. + +2011-04-04 Oliver Hunt <oliver@apple.com> + + Fix WinCE build. + + * bytecode/Instruction.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + +2011-04-04 Adam Roben <aroben@apple.com> + + Delete mt.dep files when doing a clean build due to .vsprops file changes + + Apparently this is yet another file that Visual Studio can't figure out it needs to rebuild. + + Fixes <http://webkit.org/b/57777> r82850 failed to build on Windows Debug (Build) + + Reviewed by Brian Weinstein. + + * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py: + (main): Added dep to the list of extensions we look for when choosing files to delete. + +2011-04-01 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + Make StructureChain GC allocated + https://bugs.webkit.org/show_bug.cgi?id=56695 + + Make StructureChain GC allocated, and make the various owners + mark it correctly. + + * JavaScriptCore.exp: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + (JSC::CodeBlock::derefStructures): + (JSC::CodeBlock::refStructures): + (JSC::CodeBlock::markAggregate): + * bytecode/Instruction.h: + (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): + (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): + (JSC::PolymorphicAccessStructureList::derefStructures): + (JSC::PolymorphicAccessStructureList::markAggregate): + (JSC::Instruction::Instruction): + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + (JSC::StructureStubInfo::markAggregate): + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::initGetByIdChain): + (JSC::StructureStubInfo::initPutByIdTransition): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): + (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): + * collector/handles/Handle.h: + (JSC::HandleConverter::operator->): + (JSC::HandleConverter::operator*): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jneq_ptr): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::emit_op_jneq_ptr): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompileGetByIdChainList): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::privateCompileGetByIdChainList): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::getPolymorphicAccessStructureListSlot): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSCell.h: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * runtime/JSGlobalObject.cpp: + (JSC::markIfNeeded): + * runtime/JSGlobalObject.h: + (JSC::Structure::prototypeChain): + * runtime/JSObject.h: + (JSC::JSObject::putDirectInternal): + (JSC::JSObject::markChildrenDirect): + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): + (JSC::JSPropertyNameIterator::get): + (JSC::JSPropertyNameIterator::markChildren): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::setCachedPrototypeChain): + * runtime/JSZombie.cpp: + (JSC::JSZombie::leakedZombieStructure): + * runtime/JSZombie.h: + * runtime/MarkStack.h: + (JSC::MarkStack::append): + * runtime/MarkedBlock.cpp: + (JSC::MarkedBlock::sweep): + * runtime/Structure.cpp: + (JSC::Structure::addPropertyTransition): + * runtime/Structure.h: + (JSC::Structure::markAggregate): + * runtime/StructureChain.cpp: + (JSC::StructureChain::StructureChain): + (JSC::StructureChain::~StructureChain): + (JSC::StructureChain::markChildren): + * runtime/StructureChain.h: + (JSC::StructureChain::create): + (JSC::StructureChain::createStructure): + * runtime/WriteBarrier.h: + (JSC::WriteBarrierBase::get): + (JSC::WriteBarrierBase::operator*): + (JSC::WriteBarrierBase::operator->): + +2011-04-01 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Removed some complexity from HandleHeap + https://bugs.webkit.org/show_bug.cgi?id=57650 + + Eliminated pointer-tagging flags. + + Tied being weak to having a finalizer (or at least a finalizer sentinel). + + * collector/handles/HandleHeap.cpp: + (JSC::HandleHeap::clearWeakPointers): Removed the special self-destroying + flag. It was unused. If we bring it back, we'll probably use a shared + autodeallocating finalizer instead. + + * collector/handles/HandleHeap.h: + (JSC::HandleHeap::makeWeak): makeWeak and adding a finalizer are now + a single, atomic operation -- this makes the relationship between + finalizers and weak pointers clearer, and impossible to get wrong. + + (JSC::HandleHeap::Node::Node): + (JSC::HandleHeap::Node::handleHeap): No more flags. + + (JSC::HandleHeap::Node::makeWeak): + (JSC::HandleHeap::Node::isWeak): Ditto above. We use a special sentienl + value in the finalizer slot to indicate that a handle is weak but doesn't + require an external function call for finalization. + +2011-04-01 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Removed WeakGCMap::deprecatedRemove because it was deprecated and unused + https://bugs.webkit.org/show_bug.cgi?id=57648 + + * runtime/WeakGCMap.h: + +2011-04-01 Adam Roben <aroben@apple.com> + + Maintain the invariant that Lexer::m_current is set to -1 when at the end of the code buffer + + Covered by existing tests. + + Fixes <http://webkit.org/b/56699>. + + Reviewed by Oliver Hunt. + + * parser/Lexer.h: + (JSC::Lexer::setOffset): Copied code from Lexer::shift to update m_current, because + supposedly the idiom that function uses is fast. + +2011-03-31 Thouraya ANDOLSI <thouraya.andolsi@st.com> + + Reviewed by Oliver Hunt. + + SH4 JIT SUPPORT. + https://bugs.webkit.org/show_bug.cgi?id=44329 + + Add YARR support for SH4 platforms (disabled by default). + + * GNUmakefile.am: + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerSH4.cpp: Added. + * assembler/MacroAssemblerSH4.h: Added. + * assembler/SH4Assembler.h: Added. + * yarr/YarrJIT.cpp: + +2011-03-30 Adam Roben <aroben@apple.com> + + Clean build fix + + * JavaScriptCore.vcproj/JavaScriptCore.sln: Serialized project dependencies so projects + don't try to build in parallel (which doesn't mesh with our buildfailed mechanism). + +2011-03-30 Oliver Hunt <oliver@apple.com> + + Rollout r82500 + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + (JSC::CodeBlock::derefStructures): + (JSC::CodeBlock::refStructures): + (JSC::CodeBlock::markAggregate): + * bytecode/Instruction.h: + (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): + (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): + (JSC::PolymorphicAccessStructureList::derefStructures): + (JSC::Instruction::Instruction): + * bytecode/StructureStubInfo.cpp: + (JSC::StructureStubInfo::deref): + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::initGetByIdChain): + (JSC::StructureStubInfo::initPutByIdTransition): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): + (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jneq_ptr): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::emit_op_jneq_ptr): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompileGetByIdChainList): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::privateCompileGetByIdChainList): + * jit/JITStubs.cpp: + (JSC::getPolymorphicAccessStructureListSlot): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSCell.h: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * runtime/JSGlobalObject.cpp: + (JSC::markIfNeeded): + * runtime/JSGlobalObject.h: + (JSC::Structure::prototypeChain): + * runtime/JSObject.h: + (JSC::JSObject::markChildrenDirect): + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): + (JSC::JSPropertyNameIterator::get): + (JSC::JSPropertyNameIterator::markChildren): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::setCachedPrototypeChain): + * runtime/MarkStack.h: + (JSC::MarkStack::append): + * runtime/Structure.h: + * runtime/StructureChain.cpp: + (JSC::StructureChain::StructureChain): + * runtime/StructureChain.h: + (JSC::StructureChain::create): + +2011-03-29 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Use the Accelerate vImage vectorized (un)premultiplyImageData functions for ImageBufferCG + + https://bugs.webkit.org/show_bug.cgi?id=53134 + + * wtf/Platform.h: Added in WTF flag for using the Accelerate framework + +2011-03-30 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Share most vsprops between Release and Production builds in releaseproduction.vsprops + https://bugs.webkit.org/show_bug.cgi?id=57508 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops: + * JavaScriptCore.vcproj/WTF/WTFProduction.vsprops: + * JavaScriptCore.vcproj/WTF/WTFRelease.vsprops: + * JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops: + * JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops: + * JavaScriptCore.vcproj/jsc/jscProduction.vsprops: + * JavaScriptCore.vcproj/jsc/jscRelease.vsprops: + * JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops: + * JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops: + * JavaScriptCore.vcproj/testapi/testapiProduction.vsprops: + * JavaScriptCore.vcproj/testapi/testapiRelease.vsprops: + * JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops: + +2011-03-30 Mark Rowe <mrowe@apple.com> + + Reviewed by Adam Roben. + + Explicitly prevent testapi and minidom from being installed rather than relying + on Xcode's current behavior of not installing if INSTALL_PATH is not explicitly + set at the target level. + + <rdar://problem/9206357> + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2011-03-30 Timur Iskhodzhanov <timurrrr@google.com> + + Reviewed by Alexey Proskuryakov. + + Add some dynamic annotations to JavaScriptCore/wtf + https://bugs.webkit.org/show_bug.cgi?id=53747 + + By using these annotations we can improve the precision of finding + WebKit errors using dynamic analysis tools like ThreadSanitizer and Valgrind. + These annotations don't affect the compiled binaries unless USE(DYNAMIC_ANNOTATIONS) is "1". + + These files don't add new functionality, so don't need extra tests. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * wtf/CMakeLists.txt: + * wtf/DynamicAnnotations.cpp: Added. + (WTFAnnotateBenignRaceSized): + (WTFAnnotateHappensBefore): + (WTFAnnotateHappensAfter): + * wtf/DynamicAnnotations.h: Added. + * wtf/ThreadSafeRefCounted.h: + (WTF::ThreadSafeRefCountedBase::derefBase): + * wtf/text/StringStatics.cpp: + (WTF::StringImpl::empty): + 2011-03-30 Oliver Hunt <oliver@apple.com> Reviewed by Geoffrey Garen. diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 0c1d13c..73d3a47 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -23,8 +23,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // The contents of this file must be kept in sync with FeatureDefines.xcconfig in JavaScriptCore, -// WebCore and WebKit. Also the default values of the ENABLE_FEATURE_NAME macros in build-webkit -// should match the values below, but they do not need to be in the same order. +// WebCore, WebKit and WebKit2. Also the default values of the ENABLE_FEATURE_NAME macros in +// build-webkit should match the values below, but they do not need to be in the same order. // Keep this list of features (not enabled/disabled state) in sync with FeatureDefines.vsprops // and FeatureDefinesCairo.vsprops in WebKitLibraries/win/tools/vsprops. @@ -91,8 +91,11 @@ ENABLE_MATHML = ENABLE_MATHML; ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; +ENABLE_PAGE_VISIBILITY_API = ; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_QUOTA = ; + ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); @@ -109,6 +112,7 @@ ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; +ENABLE_VIDEO_TRACK = ; ENABLE_MEDIA_STATISTICS = ; @@ -127,4 +131,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_WEBGL) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_WEBGL) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_QUOTA) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index 59988e3..8ea0822 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 27; +MINOR_VERSION = 30; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/JavaScriptCore/GNUmakefile.am b/Source/JavaScriptCore/GNUmakefile.am index 31e70a0..9030a21 100644 --- a/Source/JavaScriptCore/GNUmakefile.am +++ b/Source/JavaScriptCore/GNUmakefile.am @@ -1,3 +1,5 @@ +include $(srcdir)/Source/JavaScriptCore/GNUmakefile.list.am + javascriptcore_cppflags += \ -I$(srcdir)/Source \ -I$(srcdir)/Source/JavaScriptCore \ @@ -5,7 +7,7 @@ javascriptcore_cppflags += \ -I$(srcdir)/Source/JavaScriptCore/assembler \ -I$(srcdir)/Source/JavaScriptCore/bytecode \ -I$(srcdir)/Source/JavaScriptCore/bytecompiler \ - -I$(srcdir)/Source/JavaScriptCore/collector/handles \ + -I$(srcdir)/Source/JavaScriptCore/heap \ -I$(srcdir)/Source/JavaScriptCore/debugger \ -I$(srcdir)/Source/JavaScriptCore/ForwardingHeaders \ -I$(srcdir)/Source/JavaScriptCore/interpreter \ @@ -25,593 +27,6 @@ javascriptcore_cppflags += \ -I$(top_builddir)/Source/JavaScriptCore/parser \ -I$(top_builddir)/Source/JavaScriptCore/runtime -javascriptcore_h_api += \ - Source/JavaScriptCore/API/JSBase.h \ - Source/JavaScriptCore/API/JSContextRef.h \ - Source/JavaScriptCore/API/JSObjectRef.h \ - Source/JavaScriptCore/API/JSStringRef.h \ - Source/JavaScriptCore/API/JSStringRefBSTR.h \ - Source/JavaScriptCore/API/JSStringRefCF.h \ - Source/JavaScriptCore/API/JSValueRef.h \ - Source/JavaScriptCore/API/JavaScript.h \ - Source/JavaScriptCore/API/JavaScriptCore.h \ - Source/JavaScriptCore/API/WebKitAvailability.h - -javascriptcore_built_nosources += \ - Source/JavaScriptCore/Lexer.lut.h \ - Source/JavaScriptCore/RegExpJitTables.h \ - Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \ - Source/JavaScriptCore/runtime/DatePrototype.lut.h \ - Source/JavaScriptCore/runtime/JSONObject.lut.h \ - Source/JavaScriptCore/runtime/MathObject.lut.h \ - Source/JavaScriptCore/runtime/NumberConstructor.lut.h \ - Source/JavaScriptCore/runtime/ObjectConstructor.lut.h \ - Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \ - Source/JavaScriptCore/runtime/RegExpObject.lut.h \ - Source/JavaScriptCore/runtime/StringPrototype.lut.h - -javascriptcore_sources += \ - Source/JavaScriptCore/API/APICast.h \ - Source/JavaScriptCore/API/APIShims.h \ - Source/JavaScriptCore/API/JSBase.cpp \ - Source/JavaScriptCore/API/JSBasePrivate.h \ - Source/JavaScriptCore/API/JSCallbackConstructor.cpp \ - Source/JavaScriptCore/API/JSCallbackConstructor.h \ - Source/JavaScriptCore/API/JSCallbackFunction.cpp \ - Source/JavaScriptCore/API/JSCallbackFunction.h \ - Source/JavaScriptCore/API/JSCallbackObject.cpp \ - Source/JavaScriptCore/API/JSCallbackObjectFunctions.h \ - Source/JavaScriptCore/API/JSCallbackObject.h \ - Source/JavaScriptCore/API/JSClassRef.cpp \ - Source/JavaScriptCore/API/JSClassRef.h \ - Source/JavaScriptCore/API/JSContextRef.cpp \ - Source/JavaScriptCore/API/JSContextRefPrivate.h \ - Source/JavaScriptCore/API/JSObjectRef.cpp \ - Source/JavaScriptCore/API/JSObjectRefPrivate.h \ - Source/JavaScriptCore/API/JSRetainPtr.h \ - Source/JavaScriptCore/API/JSStringRef.cpp \ - Source/JavaScriptCore/API/JSValueRef.cpp \ - Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h \ - Source/JavaScriptCore/API/OpaqueJSString.cpp \ - Source/JavaScriptCore/API/OpaqueJSString.h \ - Source/JavaScriptCore/assembler/AbstractMacroAssembler.h \ - Source/JavaScriptCore/assembler/ARMAssembler.cpp \ - Source/JavaScriptCore/assembler/ARMAssembler.h \ - Source/JavaScriptCore/assembler/ARMv7Assembler.cpp \ - Source/JavaScriptCore/assembler/ARMv7Assembler.h \ - Source/JavaScriptCore/assembler/AssemblerBuffer.h \ - Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h \ - Source/JavaScriptCore/assembler/CodeLocation.h \ - Source/JavaScriptCore/assembler/LinkBuffer.h \ - Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp \ - Source/JavaScriptCore/assembler/MacroAssemblerARM.h \ - Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h \ - Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h \ - Source/JavaScriptCore/assembler/MacroAssembler.h \ - Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h \ - Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h \ - Source/JavaScriptCore/assembler/MacroAssemblerX86.h \ - Source/JavaScriptCore/assembler/RepatchBuffer.h \ - Source/JavaScriptCore/assembler/X86Assembler.h \ - Source/JavaScriptCore/bytecode/CodeBlock.cpp \ - Source/JavaScriptCore/bytecode/CodeBlock.h \ - Source/JavaScriptCore/bytecode/EvalCodeCache.h \ - Source/JavaScriptCore/bytecode/Instruction.h \ - Source/JavaScriptCore/bytecode/JumpTable.cpp \ - Source/JavaScriptCore/bytecode/JumpTable.h \ - Source/JavaScriptCore/bytecode/Opcode.cpp \ - Source/JavaScriptCore/bytecode/Opcode.h \ - Source/JavaScriptCore/bytecode/SamplingTool.cpp \ - Source/JavaScriptCore/bytecode/SamplingTool.h \ - Source/JavaScriptCore/bytecode/StructureStubInfo.cpp \ - Source/JavaScriptCore/bytecode/StructureStubInfo.h \ - Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp \ - Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h \ - Source/JavaScriptCore/bytecompiler/Label.h \ - Source/JavaScriptCore/bytecompiler/LabelScope.h \ - Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp \ - Source/JavaScriptCore/bytecompiler/RegisterID.h \ - Source/JavaScriptCore/collector/handles/Global.h \ - Source/JavaScriptCore/collector/handles/Handle.h \ - Source/JavaScriptCore/collector/handles/HandleHeap.cpp \ - Source/JavaScriptCore/collector/handles/HandleHeap.h \ - Source/JavaScriptCore/collector/handles/HandleStack.cpp \ - Source/JavaScriptCore/collector/handles/HandleStack.h \ - Source/JavaScriptCore/collector/handles/Local.h \ - Source/JavaScriptCore/collector/handles/LocalScope.h \ - Source/JavaScriptCore/config.h \ - Source/JavaScriptCore/debugger/DebuggerActivation.cpp \ - Source/JavaScriptCore/debugger/DebuggerActivation.h \ - Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp \ - Source/JavaScriptCore/debugger/DebuggerCallFrame.h \ - Source/JavaScriptCore/debugger/Debugger.cpp \ - Source/JavaScriptCore/debugger/Debugger.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h \ - Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \ - Source/JavaScriptCore/icu/unicode/parseerr.h \ - Source/JavaScriptCore/icu/unicode/platform.h \ - Source/JavaScriptCore/icu/unicode/putil.h \ - Source/JavaScriptCore/icu/unicode/uchar.h \ - Source/JavaScriptCore/icu/unicode/ucnv_err.h \ - Source/JavaScriptCore/icu/unicode/ucnv.h \ - Source/JavaScriptCore/icu/unicode/ucol.h \ - Source/JavaScriptCore/icu/unicode/uconfig.h \ - Source/JavaScriptCore/icu/unicode/uenum.h \ - Source/JavaScriptCore/icu/unicode/uiter.h \ - Source/JavaScriptCore/icu/unicode/uloc.h \ - Source/JavaScriptCore/icu/unicode/umachine.h \ - Source/JavaScriptCore/icu/unicode/unorm.h \ - Source/JavaScriptCore/icu/unicode/urename.h \ - Source/JavaScriptCore/icu/unicode/uset.h \ - Source/JavaScriptCore/icu/unicode/ustring.h \ - Source/JavaScriptCore/icu/unicode/utf16.h \ - Source/JavaScriptCore/icu/unicode/utf8.h \ - Source/JavaScriptCore/icu/unicode/utf.h \ - Source/JavaScriptCore/icu/unicode/utf_old.h \ - Source/JavaScriptCore/icu/unicode/utypes.h \ - Source/JavaScriptCore/icu/unicode/uversion.h \ - Source/JavaScriptCore/interpreter/CachedCall.h \ - Source/JavaScriptCore/interpreter/CallFrameClosure.h \ - Source/JavaScriptCore/interpreter/CallFrame.cpp \ - Source/JavaScriptCore/interpreter/CallFrame.h \ - Source/JavaScriptCore/interpreter/Interpreter.cpp \ - Source/JavaScriptCore/interpreter/Interpreter.h \ - Source/JavaScriptCore/interpreter/RegisterFile.cpp \ - Source/JavaScriptCore/interpreter/RegisterFile.h \ - Source/JavaScriptCore/interpreter/Register.h \ - Source/JavaScriptCore/JavaScriptCorePrefix.h \ - Source/JavaScriptCore/jit/ExecutableAllocator.cpp \ - Source/JavaScriptCore/jit/ExecutableAllocator.h \ - Source/JavaScriptCore/jit/JITArithmetic32_64.cpp \ - Source/JavaScriptCore/jit/JITArithmetic.cpp \ - Source/JavaScriptCore/jit/JITCall32_64.cpp \ - Source/JavaScriptCore/jit/JITCall.cpp \ - Source/JavaScriptCore/jit/JITCode.h \ - Source/JavaScriptCore/jit/JIT.cpp \ - Source/JavaScriptCore/jit/JIT.h \ - Source/JavaScriptCore/jit/JITInlineMethods.h \ - Source/JavaScriptCore/jit/JITOpcodes32_64.cpp \ - Source/JavaScriptCore/jit/JITOpcodes.cpp \ - Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp \ - Source/JavaScriptCore/jit/JITPropertyAccess.cpp \ - Source/JavaScriptCore/jit/JITStubCall.h \ - Source/JavaScriptCore/jit/JITStubs.cpp \ - Source/JavaScriptCore/jit/JITStubs.h \ - Source/JavaScriptCore/jit/JSInterfaceJIT.h \ - Source/JavaScriptCore/jit/SpecializedThunkJIT.h \ - Source/JavaScriptCore/jit/ThunkGenerators.cpp \ - Source/JavaScriptCore/jit/ThunkGenerators.h \ - Source/JavaScriptCore/os-win32/stdbool.h \ - Source/JavaScriptCore/os-win32/stdint.h \ - Source/JavaScriptCore/parser/ASTBuilder.h \ - Source/JavaScriptCore/parser/JSParser.cpp \ - Source/JavaScriptCore/parser/JSParser.h \ - Source/JavaScriptCore/parser/Lexer.cpp \ - Source/JavaScriptCore/parser/Lexer.h \ - Source/JavaScriptCore/parser/NodeConstructors.h \ - Source/JavaScriptCore/parser/NodeInfo.h \ - Source/JavaScriptCore/parser/Nodes.cpp \ - Source/JavaScriptCore/parser/Nodes.h \ - Source/JavaScriptCore/parser/ParserArena.cpp \ - Source/JavaScriptCore/parser/ParserArena.h \ - Source/JavaScriptCore/parser/Parser.cpp \ - Source/JavaScriptCore/parser/Parser.h \ - Source/JavaScriptCore/parser/ResultType.h \ - Source/JavaScriptCore/parser/SourceCode.h \ - Source/JavaScriptCore/parser/SourceProvider.h \ - Source/JavaScriptCore/parser/SourceProviderCache.cpp \ - Source/JavaScriptCore/parser/SourceProviderCache.h \ - Source/JavaScriptCore/parser/SourceProviderCacheItem.h \ - Source/JavaScriptCore/parser/SyntaxChecker.h \ - Source/JavaScriptCore/profiler/CallIdentifier.h \ - Source/JavaScriptCore/profiler/Profile.cpp \ - Source/JavaScriptCore/profiler/ProfileGenerator.cpp \ - Source/JavaScriptCore/profiler/ProfileGenerator.h \ - Source/JavaScriptCore/profiler/Profile.h \ - Source/JavaScriptCore/profiler/ProfileNode.cpp \ - Source/JavaScriptCore/profiler/ProfileNode.h \ - Source/JavaScriptCore/profiler/Profiler.cpp \ - Source/JavaScriptCore/profiler/Profiler.h \ - Source/JavaScriptCore/runtime/ArgList.cpp \ - Source/JavaScriptCore/runtime/ArgList.h \ - Source/JavaScriptCore/runtime/Arguments.cpp \ - Source/JavaScriptCore/runtime/Arguments.h \ - Source/JavaScriptCore/runtime/ArrayConstructor.cpp \ - Source/JavaScriptCore/runtime/ArrayConstructor.h \ - Source/JavaScriptCore/runtime/ArrayPrototype.cpp \ - Source/JavaScriptCore/runtime/ArrayPrototype.h \ - Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h \ - Source/JavaScriptCore/runtime/BooleanConstructor.cpp \ - Source/JavaScriptCore/runtime/BooleanConstructor.h \ - Source/JavaScriptCore/runtime/BooleanObject.cpp \ - Source/JavaScriptCore/runtime/BooleanObject.h \ - Source/JavaScriptCore/runtime/BooleanPrototype.cpp \ - Source/JavaScriptCore/runtime/BooleanPrototype.h \ - Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h \ - Source/JavaScriptCore/runtime/CallData.cpp \ - Source/JavaScriptCore/runtime/CallData.h \ - Source/JavaScriptCore/runtime/ClassInfo.h \ - Source/JavaScriptCore/runtime/MarkedBlock.cpp \ - Source/JavaScriptCore/runtime/MarkedBlock.h \ - Source/JavaScriptCore/runtime/MarkedSpace.cpp \ - Source/JavaScriptCore/runtime/MarkedSpace.h \ - Source/JavaScriptCore/runtime/Heap.cpp \ - Source/JavaScriptCore/runtime/Heap.h \ - Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \ - Source/JavaScriptCore/runtime/CommonIdentifiers.h \ - Source/JavaScriptCore/runtime/Completion.cpp \ - Source/JavaScriptCore/runtime/Completion.h \ - Source/JavaScriptCore/runtime/ConstructData.cpp \ - Source/JavaScriptCore/runtime/ConstructData.h \ - Source/JavaScriptCore/runtime/DateConstructor.cpp \ - Source/JavaScriptCore/runtime/DateConstructor.h \ - Source/JavaScriptCore/runtime/DateConversion.cpp \ - Source/JavaScriptCore/runtime/DateConversion.h \ - Source/JavaScriptCore/runtime/DateInstanceCache.h \ - Source/JavaScriptCore/runtime/DateInstance.cpp \ - Source/JavaScriptCore/runtime/DateInstance.h \ - Source/JavaScriptCore/runtime/DatePrototype.cpp \ - Source/JavaScriptCore/runtime/DatePrototype.h \ - Source/JavaScriptCore/runtime/ErrorConstructor.cpp \ - Source/JavaScriptCore/runtime/ErrorConstructor.h \ - Source/JavaScriptCore/runtime/Error.cpp \ - Source/JavaScriptCore/runtime/Error.h \ - Source/JavaScriptCore/runtime/ErrorInstance.cpp \ - Source/JavaScriptCore/runtime/ErrorInstance.h \ - Source/JavaScriptCore/runtime/ErrorPrototype.cpp \ - Source/JavaScriptCore/runtime/ErrorPrototype.h \ - Source/JavaScriptCore/runtime/ExceptionHelpers.cpp \ - Source/JavaScriptCore/runtime/ExceptionHelpers.h \ - Source/JavaScriptCore/runtime/Executable.cpp \ - Source/JavaScriptCore/runtime/Executable.h \ - Source/JavaScriptCore/runtime/FunctionConstructor.cpp \ - Source/JavaScriptCore/runtime/FunctionConstructor.h \ - Source/JavaScriptCore/runtime/FunctionPrototype.cpp \ - Source/JavaScriptCore/runtime/FunctionPrototype.h \ - Source/JavaScriptCore/runtime/GCActivityCallback.cpp \ - Source/JavaScriptCore/runtime/GCActivityCallback.h \ - Source/JavaScriptCore/runtime/GetterSetter.cpp \ - Source/JavaScriptCore/runtime/GetterSetter.h \ - Source/JavaScriptCore/runtime/Identifier.cpp \ - Source/JavaScriptCore/runtime/Identifier.h \ - Source/JavaScriptCore/runtime/InitializeThreading.cpp \ - Source/JavaScriptCore/runtime/InitializeThreading.h \ - Source/JavaScriptCore/runtime/InternalFunction.cpp \ - Source/JavaScriptCore/runtime/InternalFunction.h \ - Source/JavaScriptCore/runtime/JSActivation.cpp \ - Source/JavaScriptCore/runtime/JSActivation.h \ - Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp \ - Source/JavaScriptCore/runtime/JSAPIValueWrapper.h \ - Source/JavaScriptCore/runtime/JSArray.cpp \ - Source/JavaScriptCore/runtime/JSArray.h \ - Source/JavaScriptCore/runtime/JSByteArray.cpp \ - Source/JavaScriptCore/runtime/JSByteArray.h \ - Source/JavaScriptCore/runtime/JSCell.cpp \ - Source/JavaScriptCore/runtime/JSCell.h \ - Source/JavaScriptCore/runtime/JSFunction.cpp \ - Source/JavaScriptCore/runtime/JSFunction.h \ - Source/JavaScriptCore/runtime/JSGlobalData.cpp \ - Source/JavaScriptCore/runtime/JSGlobalData.h \ - Source/JavaScriptCore/runtime/JSGlobalObject.cpp \ - Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp \ - Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h \ - Source/JavaScriptCore/runtime/JSGlobalObject.h \ - Source/JavaScriptCore/runtime/JSImmediate.cpp \ - Source/JavaScriptCore/runtime/JSImmediate.h \ - Source/JavaScriptCore/runtime/JSLock.cpp \ - Source/JavaScriptCore/runtime/JSLock.h \ - Source/JavaScriptCore/runtime/JSNotAnObject.cpp \ - Source/JavaScriptCore/runtime/JSNotAnObject.h \ - Source/JavaScriptCore/runtime/JSNumberCell.cpp \ - Source/JavaScriptCore/runtime/JSNumberCell.h \ - Source/JavaScriptCore/runtime/JSObject.cpp \ - Source/JavaScriptCore/runtime/JSObject.h \ - Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp \ - Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h \ - Source/JavaScriptCore/runtime/JSONObject.cpp \ - Source/JavaScriptCore/runtime/JSONObject.h \ - Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp \ - Source/JavaScriptCore/runtime/JSPropertyNameIterator.h \ - Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp \ - Source/JavaScriptCore/runtime/JSStaticScopeObject.h \ - Source/JavaScriptCore/runtime/JSStringBuilder.h \ - Source/JavaScriptCore/runtime/JSString.cpp \ - Source/JavaScriptCore/runtime/JSString.h \ - Source/JavaScriptCore/runtime/JSType.h \ - Source/JavaScriptCore/runtime/JSTypeInfo.h \ - Source/JavaScriptCore/runtime/JSValue.cpp \ - Source/JavaScriptCore/runtime/JSValue.h \ - Source/JavaScriptCore/runtime/JSVariableObject.cpp \ - Source/JavaScriptCore/runtime/JSVariableObject.h \ - Source/JavaScriptCore/runtime/JSWrapperObject.cpp \ - Source/JavaScriptCore/runtime/JSWrapperObject.h \ - Source/JavaScriptCore/runtime/JSZombie.h \ - Source/JavaScriptCore/runtime/LiteralParser.cpp \ - Source/JavaScriptCore/runtime/LiteralParser.h \ - Source/JavaScriptCore/runtime/Lookup.cpp \ - Source/JavaScriptCore/runtime/Lookup.h \ - Source/JavaScriptCore/runtime/MachineStackMarker.cpp \ - Source/JavaScriptCore/runtime/MachineStackMarker.h \ - Source/JavaScriptCore/runtime/ConservativeSet.cpp \ - Source/JavaScriptCore/runtime/ConservativeSet.h \ - Source/JavaScriptCore/runtime/MarkStack.cpp \ - Source/JavaScriptCore/runtime/MarkStack.h \ - Source/JavaScriptCore/runtime/MathObject.cpp \ - Source/JavaScriptCore/runtime/MathObject.h \ - Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp \ - Source/JavaScriptCore/runtime/NativeErrorConstructor.h \ - Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp \ - Source/JavaScriptCore/runtime/NativeErrorPrototype.h \ - Source/JavaScriptCore/runtime/NumberConstructor.cpp \ - Source/JavaScriptCore/runtime/NumberConstructor.h \ - Source/JavaScriptCore/runtime/NumberObject.cpp \ - Source/JavaScriptCore/runtime/NumberObject.h \ - Source/JavaScriptCore/runtime/NumberPrototype.cpp \ - Source/JavaScriptCore/runtime/NumberPrototype.h \ - Source/JavaScriptCore/runtime/NumericStrings.h \ - Source/JavaScriptCore/runtime/ObjectConstructor.cpp \ - Source/JavaScriptCore/runtime/ObjectConstructor.h \ - Source/JavaScriptCore/runtime/ObjectPrototype.cpp \ - Source/JavaScriptCore/runtime/ObjectPrototype.h \ - Source/JavaScriptCore/runtime/Operations.cpp \ - Source/JavaScriptCore/runtime/Operations.h \ - Source/JavaScriptCore/runtime/PropertyDescriptor.cpp \ - Source/JavaScriptCore/runtime/PropertyDescriptor.h \ - Source/JavaScriptCore/runtime/PropertyMapHashTable.h \ - Source/JavaScriptCore/runtime/PropertyNameArray.cpp \ - Source/JavaScriptCore/runtime/PropertyNameArray.h \ - Source/JavaScriptCore/runtime/PropertySlot.cpp \ - Source/JavaScriptCore/runtime/PropertySlot.h \ - Source/JavaScriptCore/runtime/Protect.h \ - Source/JavaScriptCore/runtime/PutPropertySlot.h \ - Source/JavaScriptCore/runtime/RegExpCache.cpp \ - Source/JavaScriptCore/runtime/RegExpCache.h \ - Source/JavaScriptCore/runtime/RegExpConstructor.cpp \ - Source/JavaScriptCore/runtime/RegExpConstructor.h \ - Source/JavaScriptCore/runtime/RegExp.cpp \ - Source/JavaScriptCore/runtime/RegExp.h \ - Source/JavaScriptCore/runtime/RegExpKey.h \ - Source/JavaScriptCore/runtime/RegExpMatchesArray.h \ - Source/JavaScriptCore/runtime/RegExpObject.cpp \ - Source/JavaScriptCore/runtime/RegExpObject.h \ - Source/JavaScriptCore/runtime/RegExpPrototype.cpp \ - Source/JavaScriptCore/runtime/RegExpPrototype.h \ - Source/JavaScriptCore/runtime/RopeImpl.cpp \ - Source/JavaScriptCore/runtime/RopeImpl.h \ - Source/JavaScriptCore/runtime/ScopeChain.cpp \ - Source/JavaScriptCore/runtime/ScopeChain.h \ - Source/JavaScriptCore/runtime/ScopeChainMark.h \ - Source/JavaScriptCore/runtime/SmallStrings.cpp \ - Source/JavaScriptCore/runtime/SmallStrings.h \ - Source/JavaScriptCore/runtime/StrictEvalActivation.cpp \ - Source/JavaScriptCore/runtime/StrictEvalActivation.h \ - Source/JavaScriptCore/runtime/StringConstructor.cpp \ - Source/JavaScriptCore/runtime/StringConstructor.h \ - Source/JavaScriptCore/runtime/StringObject.cpp \ - Source/JavaScriptCore/runtime/StringObject.h \ - Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h \ - Source/JavaScriptCore/runtime/StringPrototype.cpp \ - Source/JavaScriptCore/runtime/StringPrototype.h \ - Source/JavaScriptCore/runtime/StringRecursionChecker.cpp \ - Source/JavaScriptCore/runtime/StringRecursionChecker.h \ - Source/JavaScriptCore/runtime/StructureChain.cpp \ - Source/JavaScriptCore/runtime/StructureChain.h \ - Source/JavaScriptCore/runtime/Structure.cpp \ - Source/JavaScriptCore/runtime/Structure.h \ - Source/JavaScriptCore/runtime/StructureTransitionTable.h \ - Source/JavaScriptCore/runtime/SymbolTable.h \ - Source/JavaScriptCore/runtime/Terminator.h \ - Source/JavaScriptCore/runtime/TimeoutChecker.cpp \ - Source/JavaScriptCore/runtime/TimeoutChecker.h \ - Source/JavaScriptCore/runtime/Tracing.h \ - Source/JavaScriptCore/runtime/UString.cpp \ - Source/JavaScriptCore/runtime/UString.h \ - Source/JavaScriptCore/runtime/UStringBuilder.h \ - Source/JavaScriptCore/runtime/UStringConcatenate.h \ - Source/JavaScriptCore/runtime/WeakGCMap.h \ - Source/JavaScriptCore/runtime/WeakGCPtr.h \ - Source/JavaScriptCore/runtime/WeakRandom.h \ - Source/JavaScriptCore/runtime/WriteBarrier.h \ - Source/JavaScriptCore/wtf/AlwaysInline.h \ - Source/JavaScriptCore/wtf/ASCIICType.h \ - Source/JavaScriptCore/wtf/Assertions.cpp \ - Source/JavaScriptCore/wtf/Assertions.h \ - Source/JavaScriptCore/wtf/Atomics.h \ - Source/JavaScriptCore/wtf/AVLTree.h \ - Source/JavaScriptCore/wtf/Bitmap.h \ - Source/JavaScriptCore/wtf/BlockStack.h \ - Source/JavaScriptCore/wtf/BloomFilter.h \ - Source/JavaScriptCore/wtf/BumpPointerAllocator.h \ - Source/JavaScriptCore/wtf/ByteArray.cpp \ - Source/JavaScriptCore/wtf/ByteArray.h \ - Source/JavaScriptCore/wtf/CrossThreadRefCounted.h \ - Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp \ - Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h \ - Source/JavaScriptCore/wtf/CurrentTime.cpp \ - Source/JavaScriptCore/wtf/CurrentTime.h \ - Source/JavaScriptCore/wtf/DateMath.cpp \ - Source/JavaScriptCore/wtf/DateMath.h \ - Source/JavaScriptCore/wtf/DecimalNumber.h \ - Source/JavaScriptCore/wtf/DecimalNumber.cpp \ - Source/JavaScriptCore/wtf/Decoder.h \ - Source/JavaScriptCore/wtf/Deque.h \ - Source/JavaScriptCore/wtf/DisallowCType.h \ - Source/JavaScriptCore/wtf/DoublyLinkedList.h \ - Source/JavaScriptCore/wtf/dtoa.cpp \ - Source/JavaScriptCore/wtf/dtoa.h \ - Source/JavaScriptCore/wtf/Encoder.h \ - Source/JavaScriptCore/wtf/FastAllocBase.h \ - Source/JavaScriptCore/wtf/FastMalloc.cpp \ - Source/JavaScriptCore/wtf/FastMalloc.h \ - Source/JavaScriptCore/wtf/FixedArray.h \ - Source/JavaScriptCore/wtf/Forward.h \ - Source/JavaScriptCore/wtf/GetPtr.h \ - Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp \ - Source/JavaScriptCore/wtf/gobject/GOwnPtr.h \ - Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp \ - Source/JavaScriptCore/wtf/gobject/GRefPtr.h \ - Source/JavaScriptCore/wtf/gobject/GTypedefs.h \ - Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp \ - Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp \ - Source/JavaScriptCore/wtf/HashCountedSet.h \ - Source/JavaScriptCore/wtf/HashFunctions.h \ - Source/JavaScriptCore/wtf/HashIterators.h \ - Source/JavaScriptCore/wtf/HashMap.h \ - Source/JavaScriptCore/wtf/HashSet.h \ - Source/JavaScriptCore/wtf/HashTable.cpp \ - Source/JavaScriptCore/wtf/HashTable.h \ - Source/JavaScriptCore/wtf/HashTraits.h \ - Source/JavaScriptCore/wtf/HexNumber.h \ - Source/JavaScriptCore/wtf/ListHashSet.h \ - Source/JavaScriptCore/wtf/ListRefPtr.h \ - Source/JavaScriptCore/wtf/Locker.h \ - Source/JavaScriptCore/wtf/MainThread.cpp \ - Source/JavaScriptCore/wtf/MainThread.h \ - Source/JavaScriptCore/wtf/MallocZoneSupport.h \ - Source/JavaScriptCore/wtf/MathExtras.h \ - Source/JavaScriptCore/wtf/MD5.cpp \ - Source/JavaScriptCore/wtf/MD5.h \ - Source/JavaScriptCore/wtf/MessageQueue.h \ - Source/JavaScriptCore/wtf/NonCopyingSort.h \ - Source/JavaScriptCore/wtf/Noncopyable.h \ - Source/JavaScriptCore/wtf/NotFound.h \ - Source/JavaScriptCore/wtf/NullPtr.h \ - Source/JavaScriptCore/wtf/OSAllocator.h \ - Source/JavaScriptCore/wtf/OSRandomSource.cpp \ - Source/JavaScriptCore/wtf/OSRandomSource.h \ - Source/JavaScriptCore/wtf/OwnArrayPtr.h \ - Source/JavaScriptCore/wtf/OwnFastMallocPtr.h \ - Source/JavaScriptCore/wtf/OwnPtrCommon.h \ - Source/JavaScriptCore/wtf/OwnPtr.h \ - Source/JavaScriptCore/wtf/PageAllocation.h \ - Source/JavaScriptCore/wtf/PageAllocationAligned.cpp \ - Source/JavaScriptCore/wtf/PageAllocationAligned.h \ - Source/JavaScriptCore/wtf/PageReservation.h \ - Source/JavaScriptCore/wtf/PageBlock.cpp \ - Source/JavaScriptCore/wtf/PageBlock.h \ - Source/JavaScriptCore/wtf/PassOwnArrayPtr.h \ - Source/JavaScriptCore/wtf/PassOwnPtr.h \ - Source/JavaScriptCore/wtf/PassRefPtr.h \ - Source/JavaScriptCore/wtf/Platform.h \ - Source/JavaScriptCore/wtf/PossiblyNull.h \ - Source/JavaScriptCore/wtf/RandomNumber.cpp \ - Source/JavaScriptCore/wtf/RandomNumber.h \ - Source/JavaScriptCore/wtf/RandomNumberSeed.h \ - Source/JavaScriptCore/wtf/RefCounted.h \ - Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp \ - Source/JavaScriptCore/wtf/RefCountedLeakCounter.h \ - Source/JavaScriptCore/wtf/RefPtr.h \ - Source/JavaScriptCore/wtf/RefPtrHashMap.h \ - Source/JavaScriptCore/wtf/RetainPtr.h \ - Source/JavaScriptCore/wtf/SegmentedVector.h \ - Source/JavaScriptCore/wtf/SentinelLinkedList.h \ - Source/JavaScriptCore/wtf/SHA1.cpp \ - Source/JavaScriptCore/wtf/SHA1.h \ - Source/JavaScriptCore/wtf/SinglyLinkedList.h \ - Source/JavaScriptCore/wtf/StackBounds.cpp \ - Source/JavaScriptCore/wtf/StackBounds.h \ - Source/JavaScriptCore/wtf/StaticConstructors.h \ - Source/JavaScriptCore/wtf/StdLibExtras.h \ - Source/JavaScriptCore/wtf/StringExtras.h \ - Source/JavaScriptCore/wtf/StringHasher.h \ - Source/JavaScriptCore/wtf/TCPackedCache.h \ - Source/JavaScriptCore/wtf/TCPageMap.h \ - Source/JavaScriptCore/wtf/TCSpinLock.h \ - Source/JavaScriptCore/wtf/TCSystemAlloc.cpp \ - Source/JavaScriptCore/wtf/TCSystemAlloc.h \ - Source/JavaScriptCore/wtf/text/AtomicString.cpp \ - Source/JavaScriptCore/wtf/text/AtomicString.h \ - Source/JavaScriptCore/wtf/text/AtomicStringHash.h \ - Source/JavaScriptCore/wtf/text/AtomicStringImpl.h \ - Source/JavaScriptCore/wtf/text/CString.cpp \ - Source/JavaScriptCore/wtf/text/CString.h \ - Source/JavaScriptCore/wtf/text/StringBuffer.h \ - Source/JavaScriptCore/wtf/text/StringBuilder.cpp \ - Source/JavaScriptCore/wtf/text/StringBuilder.h \ - Source/JavaScriptCore/wtf/text/StringConcatenate.h \ - Source/JavaScriptCore/wtf/text/StringHash.h \ - Source/JavaScriptCore/wtf/text/StringImplBase.h \ - Source/JavaScriptCore/wtf/text/StringImpl.cpp \ - Source/JavaScriptCore/wtf/text/StringImpl.h \ - Source/JavaScriptCore/wtf/text/StringStatics.cpp \ - Source/JavaScriptCore/wtf/text/TextPosition.h \ - Source/JavaScriptCore/wtf/text/WTFString.cpp \ - Source/JavaScriptCore/wtf/text/WTFString.h \ - Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \ - Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \ - Source/JavaScriptCore/wtf/Threading.cpp \ - Source/JavaScriptCore/wtf/Threading.h \ - Source/JavaScriptCore/wtf/ThreadingPrimitives.h \ - Source/JavaScriptCore/wtf/ThreadingPthreads.cpp \ - Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h \ - Source/JavaScriptCore/wtf/ThreadSpecific.h \ - Source/JavaScriptCore/wtf/TypeTraits.cpp \ - Source/JavaScriptCore/wtf/TypeTraits.h \ - Source/JavaScriptCore/wtf/unicode/CharacterNames.h \ - Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp \ - Source/JavaScriptCore/wtf/unicode/Collator.h \ - Source/JavaScriptCore/wtf/unicode/Unicode.h \ - Source/JavaScriptCore/wtf/unicode/UTF8.cpp \ - Source/JavaScriptCore/wtf/unicode/UTF8.h \ - Source/JavaScriptCore/wtf/UnusedParam.h \ - Source/JavaScriptCore/wtf/ValueCheck.h \ - Source/JavaScriptCore/wtf/Vector.h \ - Source/JavaScriptCore/wtf/VectorTraits.h \ - Source/JavaScriptCore/wtf/VMTags.h \ - Source/JavaScriptCore/wtf/WTFThreadData.cpp \ - Source/JavaScriptCore/wtf/WTFThreadData.h \ - Source/JavaScriptCore/yarr/Yarr.h \ - Source/JavaScriptCore/yarr/YarrInterpreter.cpp \ - Source/JavaScriptCore/yarr/YarrInterpreter.h \ - Source/JavaScriptCore/yarr/YarrJIT.cpp \ - Source/JavaScriptCore/yarr/YarrJIT.h \ - Source/JavaScriptCore/yarr/YarrParser.h \ - Source/JavaScriptCore/yarr/YarrPattern.cpp \ - Source/JavaScriptCore/yarr/YarrPattern.h \ - Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp \ - Source/JavaScriptCore/yarr/YarrSyntaxChecker.h - -if TARGET_WIN32 -javascriptcore_sources += \ - Source/JavaScriptCore/runtime/MarkStackWin.cpp \ - Source/JavaScriptCore/wtf/OSAllocatorWin.cpp -else -javascriptcore_sources += \ - Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \ - Source/JavaScriptCore/runtime/MarkStackPosix.cpp \ - Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp -endif - -# ---- -# icu unicode backend -# ---- -if USE_ICU_UNICODE -javascriptcore_sources += \ - Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \ - Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h -endif # USE_ICU_UNICODE - -# ---- -# glib unicode backend -# ---- -if USE_GLIB_UNICODE -javascriptcore_sources += \ - Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h \ - Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \ - Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp -endif - Source/JavaScriptCore/Lexer.lut.h: $(srcdir)/Source/JavaScriptCore/create_hash_table $(srcdir)/Source/JavaScriptCore/parser/Keywords.table $(AM_V_GEN)$(PERL) $^ > $@ @@ -630,18 +45,6 @@ noinst_PROGRAMS += \ Programs/jsc \ Programs/minidom -# minidom -Programs_minidom_SOURCES = \ - Source/JavaScriptCore/API/tests/JSNode.c \ - Source/JavaScriptCore/API/tests/JSNode.h \ - Source/JavaScriptCore/API/tests/JSNodeList.c \ - Source/JavaScriptCore/API/tests/JSNodeList.h \ - Source/JavaScriptCore/API/tests/Node.c \ - Source/JavaScriptCore/API/tests/Node.h \ - Source/JavaScriptCore/API/tests/NodeList.c \ - Source/JavaScriptCore/API/tests/NodeList.h \ - Source/JavaScriptCore/API/tests/minidom.c - Programs_minidom_CPPFLAGS = \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -668,9 +71,6 @@ Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@$(EXEEXT): Programs/jsc$(EXEEXT) Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_LDADD = Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_SOURCES = -Programs_jsc_SOURCES = \ - Source/JavaScriptCore/jsc.cpp - Programs_jsc_CPPFLAGS = \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -698,6 +98,7 @@ EXTRA_DIST += \ Source/JavaScriptCore/THANKS # Clean rules for JavaScriptCore +# FIXME: Should this list be generated from javascriptcore_built_nosources? CLEANFILES += \ Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \ Source/JavaScriptCore/runtime/DatePrototype.lut.h \ diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am new file mode 100644 index 0000000..ade4691 --- /dev/null +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -0,0 +1,603 @@ +javascriptcore_h_api += \ + Source/JavaScriptCore/API/JSBase.h \ + Source/JavaScriptCore/API/JSContextRef.h \ + Source/JavaScriptCore/API/JSObjectRef.h \ + Source/JavaScriptCore/API/JSStringRef.h \ + Source/JavaScriptCore/API/JSStringRefBSTR.h \ + Source/JavaScriptCore/API/JSStringRefCF.h \ + Source/JavaScriptCore/API/JSValueRef.h \ + Source/JavaScriptCore/API/JavaScript.h \ + Source/JavaScriptCore/API/JavaScriptCore.h \ + Source/JavaScriptCore/API/WebKitAvailability.h + +javascriptcore_built_nosources += \ + Source/JavaScriptCore/Lexer.lut.h \ + Source/JavaScriptCore/RegExpJitTables.h \ + Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \ + Source/JavaScriptCore/runtime/DatePrototype.lut.h \ + Source/JavaScriptCore/runtime/JSONObject.lut.h \ + Source/JavaScriptCore/runtime/MathObject.lut.h \ + Source/JavaScriptCore/runtime/NumberConstructor.lut.h \ + Source/JavaScriptCore/runtime/ObjectConstructor.lut.h \ + Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \ + Source/JavaScriptCore/runtime/RegExpObject.lut.h \ + Source/JavaScriptCore/runtime/StringPrototype.lut.h + +javascriptcore_sources += \ + Source/JavaScriptCore/API/APICast.h \ + Source/JavaScriptCore/API/APIShims.h \ + Source/JavaScriptCore/API/JSBase.cpp \ + Source/JavaScriptCore/API/JSBasePrivate.h \ + Source/JavaScriptCore/API/JSCallbackConstructor.cpp \ + Source/JavaScriptCore/API/JSCallbackConstructor.h \ + Source/JavaScriptCore/API/JSCallbackFunction.cpp \ + Source/JavaScriptCore/API/JSCallbackFunction.h \ + Source/JavaScriptCore/API/JSCallbackObject.cpp \ + Source/JavaScriptCore/API/JSCallbackObjectFunctions.h \ + Source/JavaScriptCore/API/JSCallbackObject.h \ + Source/JavaScriptCore/API/JSClassRef.cpp \ + Source/JavaScriptCore/API/JSClassRef.h \ + Source/JavaScriptCore/API/JSContextRef.cpp \ + Source/JavaScriptCore/API/JSContextRefPrivate.h \ + Source/JavaScriptCore/API/JSObjectRef.cpp \ + Source/JavaScriptCore/API/JSObjectRefPrivate.h \ + Source/JavaScriptCore/API/JSRetainPtr.h \ + Source/JavaScriptCore/API/JSStringRef.cpp \ + Source/JavaScriptCore/API/JSValueRef.cpp \ + Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h \ + Source/JavaScriptCore/API/OpaqueJSString.cpp \ + Source/JavaScriptCore/API/OpaqueJSString.h \ + Source/JavaScriptCore/assembler/AbstractMacroAssembler.h \ + Source/JavaScriptCore/assembler/ARMAssembler.cpp \ + Source/JavaScriptCore/assembler/ARMAssembler.h \ + Source/JavaScriptCore/assembler/ARMv7Assembler.cpp \ + Source/JavaScriptCore/assembler/ARMv7Assembler.h \ + Source/JavaScriptCore/assembler/AssemblerBuffer.h \ + Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h \ + Source/JavaScriptCore/assembler/CodeLocation.h \ + Source/JavaScriptCore/assembler/LinkBuffer.h \ + Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp \ + Source/JavaScriptCore/assembler/MacroAssemblerARM.h \ + Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h \ + Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h \ + Source/JavaScriptCore/assembler/MacroAssembler.h \ + Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h \ + Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h \ + Source/JavaScriptCore/assembler/MacroAssemblerX86.h \ + Source/JavaScriptCore/assembler/MacroAssemblerSH4.h \ + Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp \ + Source/JavaScriptCore/assembler/SH4Assembler.h \ + Source/JavaScriptCore/assembler/RepatchBuffer.h \ + Source/JavaScriptCore/assembler/X86Assembler.h \ + Source/JavaScriptCore/bytecode/CodeBlock.cpp \ + Source/JavaScriptCore/bytecode/CodeBlock.h \ + Source/JavaScriptCore/bytecode/EvalCodeCache.h \ + Source/JavaScriptCore/bytecode/Instruction.h \ + Source/JavaScriptCore/bytecode/JumpTable.cpp \ + Source/JavaScriptCore/bytecode/JumpTable.h \ + Source/JavaScriptCore/bytecode/Opcode.cpp \ + Source/JavaScriptCore/bytecode/Opcode.h \ + Source/JavaScriptCore/bytecode/SamplingTool.cpp \ + Source/JavaScriptCore/bytecode/SamplingTool.h \ + Source/JavaScriptCore/bytecode/StructureStubInfo.cpp \ + Source/JavaScriptCore/bytecode/StructureStubInfo.h \ + Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp \ + Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h \ + Source/JavaScriptCore/bytecompiler/Label.h \ + Source/JavaScriptCore/bytecompiler/LabelScope.h \ + Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp \ + Source/JavaScriptCore/bytecompiler/RegisterID.h \ + Source/JavaScriptCore/heap/ConservativeRoots.cpp \ + Source/JavaScriptCore/heap/ConservativeRoots.h \ + Source/JavaScriptCore/heap/Handle.h \ + Source/JavaScriptCore/heap/HandleHeap.cpp \ + Source/JavaScriptCore/heap/HandleHeap.h \ + Source/JavaScriptCore/heap/HandleStack.cpp \ + Source/JavaScriptCore/heap/HandleStack.h \ + Source/JavaScriptCore/heap/Heap.cpp \ + Source/JavaScriptCore/heap/Heap.h \ + Source/JavaScriptCore/heap/Local.h \ + Source/JavaScriptCore/heap/LocalScope.h \ + Source/JavaScriptCore/heap/MachineStackMarker.cpp \ + Source/JavaScriptCore/heap/MachineStackMarker.h \ + Source/JavaScriptCore/heap/MarkStack.cpp \ + Source/JavaScriptCore/heap/MarkStack.h \ + Source/JavaScriptCore/heap/MarkedBlock.cpp \ + Source/JavaScriptCore/heap/MarkedBlock.h \ + Source/JavaScriptCore/heap/MarkedSpace.cpp \ + Source/JavaScriptCore/heap/MarkedSpace.h \ + Source/JavaScriptCore/heap/Strong.h \ + Source/JavaScriptCore/heap/Weak.h \ + Source/JavaScriptCore/config.h \ + Source/JavaScriptCore/debugger/DebuggerActivation.cpp \ + Source/JavaScriptCore/debugger/DebuggerActivation.h \ + Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp \ + Source/JavaScriptCore/debugger/DebuggerCallFrame.h \ + Source/JavaScriptCore/debugger/Debugger.cpp \ + Source/JavaScriptCore/debugger/Debugger.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h \ + Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \ + Source/JavaScriptCore/icu/unicode/parseerr.h \ + Source/JavaScriptCore/icu/unicode/platform.h \ + Source/JavaScriptCore/icu/unicode/putil.h \ + Source/JavaScriptCore/icu/unicode/uchar.h \ + Source/JavaScriptCore/icu/unicode/ucnv_err.h \ + Source/JavaScriptCore/icu/unicode/ucnv.h \ + Source/JavaScriptCore/icu/unicode/ucol.h \ + Source/JavaScriptCore/icu/unicode/uconfig.h \ + Source/JavaScriptCore/icu/unicode/uenum.h \ + Source/JavaScriptCore/icu/unicode/uiter.h \ + Source/JavaScriptCore/icu/unicode/uloc.h \ + Source/JavaScriptCore/icu/unicode/umachine.h \ + Source/JavaScriptCore/icu/unicode/unorm.h \ + Source/JavaScriptCore/icu/unicode/urename.h \ + Source/JavaScriptCore/icu/unicode/uset.h \ + Source/JavaScriptCore/icu/unicode/ustring.h \ + Source/JavaScriptCore/icu/unicode/utf16.h \ + Source/JavaScriptCore/icu/unicode/utf8.h \ + Source/JavaScriptCore/icu/unicode/utf.h \ + Source/JavaScriptCore/icu/unicode/utf_old.h \ + Source/JavaScriptCore/icu/unicode/utypes.h \ + Source/JavaScriptCore/icu/unicode/uversion.h \ + Source/JavaScriptCore/interpreter/CachedCall.h \ + Source/JavaScriptCore/interpreter/CallFrameClosure.h \ + Source/JavaScriptCore/interpreter/CallFrame.cpp \ + Source/JavaScriptCore/interpreter/CallFrame.h \ + Source/JavaScriptCore/interpreter/Interpreter.cpp \ + Source/JavaScriptCore/interpreter/Interpreter.h \ + Source/JavaScriptCore/interpreter/RegisterFile.cpp \ + Source/JavaScriptCore/interpreter/RegisterFile.h \ + Source/JavaScriptCore/interpreter/Register.h \ + Source/JavaScriptCore/JavaScriptCorePrefix.h \ + Source/JavaScriptCore/jit/ExecutableAllocator.cpp \ + Source/JavaScriptCore/jit/ExecutableAllocator.h \ + Source/JavaScriptCore/jit/JITArithmetic32_64.cpp \ + Source/JavaScriptCore/jit/JITArithmetic.cpp \ + Source/JavaScriptCore/jit/JITCall32_64.cpp \ + Source/JavaScriptCore/jit/JITCall.cpp \ + Source/JavaScriptCore/jit/JITCode.h \ + Source/JavaScriptCore/jit/JIT.cpp \ + Source/JavaScriptCore/jit/JIT.h \ + Source/JavaScriptCore/jit/JITInlineMethods.h \ + Source/JavaScriptCore/jit/JITOpcodes32_64.cpp \ + Source/JavaScriptCore/jit/JITOpcodes.cpp \ + Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp \ + Source/JavaScriptCore/jit/JITPropertyAccess.cpp \ + Source/JavaScriptCore/jit/JITStubCall.h \ + Source/JavaScriptCore/jit/JITStubs.cpp \ + Source/JavaScriptCore/jit/JITStubs.h \ + Source/JavaScriptCore/jit/JSInterfaceJIT.h \ + Source/JavaScriptCore/jit/SpecializedThunkJIT.h \ + Source/JavaScriptCore/jit/ThunkGenerators.cpp \ + Source/JavaScriptCore/jit/ThunkGenerators.h \ + Source/JavaScriptCore/os-win32/stdbool.h \ + Source/JavaScriptCore/os-win32/stdint.h \ + Source/JavaScriptCore/parser/ASTBuilder.h \ + Source/JavaScriptCore/parser/JSParser.cpp \ + Source/JavaScriptCore/parser/JSParser.h \ + Source/JavaScriptCore/parser/Lexer.cpp \ + Source/JavaScriptCore/parser/Lexer.h \ + Source/JavaScriptCore/parser/NodeConstructors.h \ + Source/JavaScriptCore/parser/NodeInfo.h \ + Source/JavaScriptCore/parser/Nodes.cpp \ + Source/JavaScriptCore/parser/Nodes.h \ + Source/JavaScriptCore/parser/ParserArena.cpp \ + Source/JavaScriptCore/parser/ParserArena.h \ + Source/JavaScriptCore/parser/Parser.cpp \ + Source/JavaScriptCore/parser/Parser.h \ + Source/JavaScriptCore/parser/ResultType.h \ + Source/JavaScriptCore/parser/SourceCode.h \ + Source/JavaScriptCore/parser/SourceProvider.h \ + Source/JavaScriptCore/parser/SourceProviderCache.cpp \ + Source/JavaScriptCore/parser/SourceProviderCache.h \ + Source/JavaScriptCore/parser/SourceProviderCacheItem.h \ + Source/JavaScriptCore/parser/SyntaxChecker.h \ + Source/JavaScriptCore/profiler/CallIdentifier.h \ + Source/JavaScriptCore/profiler/Profile.cpp \ + Source/JavaScriptCore/profiler/ProfileGenerator.cpp \ + Source/JavaScriptCore/profiler/ProfileGenerator.h \ + Source/JavaScriptCore/profiler/Profile.h \ + Source/JavaScriptCore/profiler/ProfileNode.cpp \ + Source/JavaScriptCore/profiler/ProfileNode.h \ + Source/JavaScriptCore/profiler/Profiler.cpp \ + Source/JavaScriptCore/profiler/Profiler.h \ + Source/JavaScriptCore/runtime/ArgList.cpp \ + Source/JavaScriptCore/runtime/ArgList.h \ + Source/JavaScriptCore/runtime/Arguments.cpp \ + Source/JavaScriptCore/runtime/Arguments.h \ + Source/JavaScriptCore/runtime/ArrayConstructor.cpp \ + Source/JavaScriptCore/runtime/ArrayConstructor.h \ + Source/JavaScriptCore/runtime/ArrayPrototype.cpp \ + Source/JavaScriptCore/runtime/ArrayPrototype.h \ + Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h \ + Source/JavaScriptCore/runtime/BooleanConstructor.cpp \ + Source/JavaScriptCore/runtime/BooleanConstructor.h \ + Source/JavaScriptCore/runtime/BooleanObject.cpp \ + Source/JavaScriptCore/runtime/BooleanObject.h \ + Source/JavaScriptCore/runtime/BooleanPrototype.cpp \ + Source/JavaScriptCore/runtime/BooleanPrototype.h \ + Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h \ + Source/JavaScriptCore/runtime/CallData.cpp \ + Source/JavaScriptCore/runtime/CallData.h \ + Source/JavaScriptCore/runtime/ClassInfo.h \ + Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \ + Source/JavaScriptCore/runtime/CommonIdentifiers.h \ + Source/JavaScriptCore/runtime/Completion.cpp \ + Source/JavaScriptCore/runtime/Completion.h \ + Source/JavaScriptCore/runtime/ConstructData.cpp \ + Source/JavaScriptCore/runtime/ConstructData.h \ + Source/JavaScriptCore/runtime/DateConstructor.cpp \ + Source/JavaScriptCore/runtime/DateConstructor.h \ + Source/JavaScriptCore/runtime/DateConversion.cpp \ + Source/JavaScriptCore/runtime/DateConversion.h \ + Source/JavaScriptCore/runtime/DateInstanceCache.h \ + Source/JavaScriptCore/runtime/DateInstance.cpp \ + Source/JavaScriptCore/runtime/DateInstance.h \ + Source/JavaScriptCore/runtime/DatePrototype.cpp \ + Source/JavaScriptCore/runtime/DatePrototype.h \ + Source/JavaScriptCore/runtime/ErrorConstructor.cpp \ + Source/JavaScriptCore/runtime/ErrorConstructor.h \ + Source/JavaScriptCore/runtime/Error.cpp \ + Source/JavaScriptCore/runtime/Error.h \ + Source/JavaScriptCore/runtime/ErrorInstance.cpp \ + Source/JavaScriptCore/runtime/ErrorInstance.h \ + Source/JavaScriptCore/runtime/ErrorPrototype.cpp \ + Source/JavaScriptCore/runtime/ErrorPrototype.h \ + Source/JavaScriptCore/runtime/ExceptionHelpers.cpp \ + Source/JavaScriptCore/runtime/ExceptionHelpers.h \ + Source/JavaScriptCore/runtime/Executable.cpp \ + Source/JavaScriptCore/runtime/Executable.h \ + Source/JavaScriptCore/runtime/FunctionConstructor.cpp \ + Source/JavaScriptCore/runtime/FunctionConstructor.h \ + Source/JavaScriptCore/runtime/FunctionPrototype.cpp \ + Source/JavaScriptCore/runtime/FunctionPrototype.h \ + Source/JavaScriptCore/runtime/GCActivityCallback.cpp \ + Source/JavaScriptCore/runtime/GCActivityCallback.h \ + Source/JavaScriptCore/runtime/GetterSetter.cpp \ + Source/JavaScriptCore/runtime/GetterSetter.h \ + Source/JavaScriptCore/runtime/Identifier.cpp \ + Source/JavaScriptCore/runtime/Identifier.h \ + Source/JavaScriptCore/runtime/InitializeThreading.cpp \ + Source/JavaScriptCore/runtime/InitializeThreading.h \ + Source/JavaScriptCore/runtime/InternalFunction.cpp \ + Source/JavaScriptCore/runtime/InternalFunction.h \ + Source/JavaScriptCore/runtime/JSActivation.cpp \ + Source/JavaScriptCore/runtime/JSActivation.h \ + Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp \ + Source/JavaScriptCore/runtime/JSAPIValueWrapper.h \ + Source/JavaScriptCore/runtime/JSArray.cpp \ + Source/JavaScriptCore/runtime/JSArray.h \ + Source/JavaScriptCore/runtime/JSByteArray.cpp \ + Source/JavaScriptCore/runtime/JSByteArray.h \ + Source/JavaScriptCore/runtime/JSCell.cpp \ + Source/JavaScriptCore/runtime/JSCell.h \ + Source/JavaScriptCore/runtime/JSFunction.cpp \ + Source/JavaScriptCore/runtime/JSFunction.h \ + Source/JavaScriptCore/runtime/JSGlobalData.cpp \ + Source/JavaScriptCore/runtime/JSGlobalData.h \ + Source/JavaScriptCore/runtime/JSGlobalObject.cpp \ + Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp \ + Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h \ + Source/JavaScriptCore/runtime/JSGlobalObject.h \ + Source/JavaScriptCore/runtime/JSLock.cpp \ + Source/JavaScriptCore/runtime/JSLock.h \ + Source/JavaScriptCore/runtime/JSNotAnObject.cpp \ + Source/JavaScriptCore/runtime/JSNotAnObject.h \ + Source/JavaScriptCore/runtime/JSObject.cpp \ + Source/JavaScriptCore/runtime/JSObject.h \ + Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp \ + Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h \ + Source/JavaScriptCore/runtime/JSONObject.cpp \ + Source/JavaScriptCore/runtime/JSONObject.h \ + Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp \ + Source/JavaScriptCore/runtime/JSPropertyNameIterator.h \ + Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp \ + Source/JavaScriptCore/runtime/JSStaticScopeObject.h \ + Source/JavaScriptCore/runtime/JSStringBuilder.h \ + Source/JavaScriptCore/runtime/JSString.cpp \ + Source/JavaScriptCore/runtime/JSString.h \ + Source/JavaScriptCore/runtime/JSType.h \ + Source/JavaScriptCore/runtime/JSTypeInfo.h \ + Source/JavaScriptCore/runtime/JSValue.cpp \ + Source/JavaScriptCore/runtime/JSValue.h \ + Source/JavaScriptCore/runtime/JSValueInlineMethods.h \ + Source/JavaScriptCore/runtime/JSVariableObject.cpp \ + Source/JavaScriptCore/runtime/JSVariableObject.h \ + Source/JavaScriptCore/runtime/JSWrapperObject.cpp \ + Source/JavaScriptCore/runtime/JSWrapperObject.h \ + Source/JavaScriptCore/runtime/JSZombie.h \ + Source/JavaScriptCore/runtime/LiteralParser.cpp \ + Source/JavaScriptCore/runtime/LiteralParser.h \ + Source/JavaScriptCore/runtime/Lookup.cpp \ + Source/JavaScriptCore/runtime/Lookup.h \ + Source/JavaScriptCore/runtime/MathObject.cpp \ + Source/JavaScriptCore/runtime/MathObject.h \ + Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp \ + Source/JavaScriptCore/runtime/NativeErrorConstructor.h \ + Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp \ + Source/JavaScriptCore/runtime/NativeErrorPrototype.h \ + Source/JavaScriptCore/runtime/NumberConstructor.cpp \ + Source/JavaScriptCore/runtime/NumberConstructor.h \ + Source/JavaScriptCore/runtime/NumberObject.cpp \ + Source/JavaScriptCore/runtime/NumberObject.h \ + Source/JavaScriptCore/runtime/NumberPrototype.cpp \ + Source/JavaScriptCore/runtime/NumberPrototype.h \ + Source/JavaScriptCore/runtime/NumericStrings.h \ + Source/JavaScriptCore/runtime/ObjectConstructor.cpp \ + Source/JavaScriptCore/runtime/ObjectConstructor.h \ + Source/JavaScriptCore/runtime/ObjectPrototype.cpp \ + Source/JavaScriptCore/runtime/ObjectPrototype.h \ + Source/JavaScriptCore/runtime/Operations.cpp \ + Source/JavaScriptCore/runtime/Operations.h \ + Source/JavaScriptCore/runtime/PropertyDescriptor.cpp \ + Source/JavaScriptCore/runtime/PropertyDescriptor.h \ + Source/JavaScriptCore/runtime/PropertyMapHashTable.h \ + Source/JavaScriptCore/runtime/PropertyNameArray.cpp \ + Source/JavaScriptCore/runtime/PropertyNameArray.h \ + Source/JavaScriptCore/runtime/PropertySlot.cpp \ + Source/JavaScriptCore/runtime/PropertySlot.h \ + Source/JavaScriptCore/runtime/Protect.h \ + Source/JavaScriptCore/runtime/PutPropertySlot.h \ + Source/JavaScriptCore/runtime/RegExpCache.cpp \ + Source/JavaScriptCore/runtime/RegExpCache.h \ + Source/JavaScriptCore/runtime/RegExpConstructor.cpp \ + Source/JavaScriptCore/runtime/RegExpConstructor.h \ + Source/JavaScriptCore/runtime/RegExp.cpp \ + Source/JavaScriptCore/runtime/RegExp.h \ + Source/JavaScriptCore/runtime/RegExpKey.h \ + Source/JavaScriptCore/runtime/RegExpMatchesArray.h \ + Source/JavaScriptCore/runtime/RegExpObject.cpp \ + Source/JavaScriptCore/runtime/RegExpObject.h \ + Source/JavaScriptCore/runtime/RegExpPrototype.cpp \ + Source/JavaScriptCore/runtime/RegExpPrototype.h \ + Source/JavaScriptCore/runtime/RopeImpl.cpp \ + Source/JavaScriptCore/runtime/RopeImpl.h \ + Source/JavaScriptCore/runtime/ScopeChain.cpp \ + Source/JavaScriptCore/runtime/ScopeChain.h \ + Source/JavaScriptCore/runtime/ScopeChainMark.h \ + Source/JavaScriptCore/runtime/SmallStrings.cpp \ + Source/JavaScriptCore/runtime/SmallStrings.h \ + Source/JavaScriptCore/runtime/StrictEvalActivation.cpp \ + Source/JavaScriptCore/runtime/StrictEvalActivation.h \ + Source/JavaScriptCore/runtime/StringConstructor.cpp \ + Source/JavaScriptCore/runtime/StringConstructor.h \ + Source/JavaScriptCore/runtime/StringObject.cpp \ + Source/JavaScriptCore/runtime/StringObject.h \ + Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h \ + Source/JavaScriptCore/runtime/StringPrototype.cpp \ + Source/JavaScriptCore/runtime/StringPrototype.h \ + Source/JavaScriptCore/runtime/StringRecursionChecker.cpp \ + Source/JavaScriptCore/runtime/StringRecursionChecker.h \ + Source/JavaScriptCore/runtime/StructureChain.cpp \ + Source/JavaScriptCore/runtime/StructureChain.h \ + Source/JavaScriptCore/runtime/Structure.cpp \ + Source/JavaScriptCore/runtime/Structure.h \ + Source/JavaScriptCore/runtime/StructureTransitionTable.h \ + Source/JavaScriptCore/runtime/SymbolTable.h \ + Source/JavaScriptCore/runtime/Terminator.h \ + Source/JavaScriptCore/runtime/TimeoutChecker.cpp \ + Source/JavaScriptCore/runtime/TimeoutChecker.h \ + Source/JavaScriptCore/runtime/Tracing.h \ + Source/JavaScriptCore/runtime/UString.cpp \ + Source/JavaScriptCore/runtime/UString.h \ + Source/JavaScriptCore/runtime/UStringBuilder.h \ + Source/JavaScriptCore/runtime/UStringConcatenate.h \ + Source/JavaScriptCore/runtime/WeakGCMap.h \ + Source/JavaScriptCore/runtime/WeakRandom.h \ + Source/JavaScriptCore/runtime/WriteBarrier.h \ + Source/JavaScriptCore/wtf/AlwaysInline.h \ + Source/JavaScriptCore/wtf/ASCIICType.h \ + Source/JavaScriptCore/wtf/Assertions.cpp \ + Source/JavaScriptCore/wtf/Assertions.h \ + Source/JavaScriptCore/wtf/Atomics.h \ + Source/JavaScriptCore/wtf/AVLTree.h \ + Source/JavaScriptCore/wtf/Bitmap.h \ + Source/JavaScriptCore/wtf/BlockStack.h \ + Source/JavaScriptCore/wtf/BloomFilter.h \ + Source/JavaScriptCore/wtf/BumpPointerAllocator.h \ + Source/JavaScriptCore/wtf/ByteArray.cpp \ + Source/JavaScriptCore/wtf/ByteArray.h \ + Source/JavaScriptCore/wtf/CrossThreadRefCounted.h \ + Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp \ + Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h \ + Source/JavaScriptCore/wtf/CurrentTime.cpp \ + Source/JavaScriptCore/wtf/CurrentTime.h \ + Source/JavaScriptCore/wtf/DateMath.cpp \ + Source/JavaScriptCore/wtf/DateMath.h \ + Source/JavaScriptCore/wtf/DecimalNumber.h \ + Source/JavaScriptCore/wtf/DecimalNumber.cpp \ + Source/JavaScriptCore/wtf/Decoder.h \ + Source/JavaScriptCore/wtf/Deque.h \ + Source/JavaScriptCore/wtf/DisallowCType.h \ + Source/JavaScriptCore/wtf/DoublyLinkedList.h \ + Source/JavaScriptCore/wtf/dtoa.cpp \ + Source/JavaScriptCore/wtf/dtoa.h \ + Source/JavaScriptCore/wtf/DynamicAnnotations.cpp \ + Source/JavaScriptCore/wtf/DynamicAnnotations.h \ + Source/JavaScriptCore/wtf/Encoder.h \ + Source/JavaScriptCore/wtf/FastAllocBase.h \ + Source/JavaScriptCore/wtf/FastMalloc.cpp \ + Source/JavaScriptCore/wtf/FastMalloc.h \ + Source/JavaScriptCore/wtf/FixedArray.h \ + Source/JavaScriptCore/wtf/Forward.h \ + Source/JavaScriptCore/wtf/GetPtr.h \ + Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp \ + Source/JavaScriptCore/wtf/gobject/GOwnPtr.h \ + Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp \ + Source/JavaScriptCore/wtf/gobject/GRefPtr.h \ + Source/JavaScriptCore/wtf/gobject/GTypedefs.h \ + Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp \ + Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp \ + Source/JavaScriptCore/wtf/HashCountedSet.h \ + Source/JavaScriptCore/wtf/HashFunctions.h \ + Source/JavaScriptCore/wtf/HashIterators.h \ + Source/JavaScriptCore/wtf/HashMap.h \ + Source/JavaScriptCore/wtf/HashSet.h \ + Source/JavaScriptCore/wtf/HashTable.cpp \ + Source/JavaScriptCore/wtf/HashTable.h \ + Source/JavaScriptCore/wtf/HashTraits.h \ + Source/JavaScriptCore/wtf/HexNumber.h \ + Source/JavaScriptCore/wtf/ListHashSet.h \ + Source/JavaScriptCore/wtf/ListRefPtr.h \ + Source/JavaScriptCore/wtf/Locker.h \ + Source/JavaScriptCore/wtf/MainThread.cpp \ + Source/JavaScriptCore/wtf/MainThread.h \ + Source/JavaScriptCore/wtf/MallocZoneSupport.h \ + Source/JavaScriptCore/wtf/MathExtras.h \ + Source/JavaScriptCore/wtf/MD5.cpp \ + Source/JavaScriptCore/wtf/MD5.h \ + Source/JavaScriptCore/wtf/MessageQueue.h \ + Source/JavaScriptCore/wtf/NonCopyingSort.h \ + Source/JavaScriptCore/wtf/Noncopyable.h \ + Source/JavaScriptCore/wtf/NotFound.h \ + Source/JavaScriptCore/wtf/NullPtr.h \ + Source/JavaScriptCore/wtf/OSAllocator.h \ + Source/JavaScriptCore/wtf/OSRandomSource.cpp \ + Source/JavaScriptCore/wtf/OSRandomSource.h \ + Source/JavaScriptCore/wtf/OwnArrayPtr.h \ + Source/JavaScriptCore/wtf/OwnFastMallocPtr.h \ + Source/JavaScriptCore/wtf/OwnPtrCommon.h \ + Source/JavaScriptCore/wtf/OwnPtr.h \ + Source/JavaScriptCore/wtf/PageAllocation.h \ + Source/JavaScriptCore/wtf/PageAllocationAligned.cpp \ + Source/JavaScriptCore/wtf/PageAllocationAligned.h \ + Source/JavaScriptCore/wtf/PageReservation.h \ + Source/JavaScriptCore/wtf/PageBlock.cpp \ + Source/JavaScriptCore/wtf/PageBlock.h \ + Source/JavaScriptCore/wtf/PassOwnArrayPtr.h \ + Source/JavaScriptCore/wtf/PassOwnPtr.h \ + Source/JavaScriptCore/wtf/PassRefPtr.h \ + Source/JavaScriptCore/wtf/Platform.h \ + Source/JavaScriptCore/wtf/PossiblyNull.h \ + Source/JavaScriptCore/wtf/RandomNumber.cpp \ + Source/JavaScriptCore/wtf/RandomNumber.h \ + Source/JavaScriptCore/wtf/RandomNumberSeed.h \ + Source/JavaScriptCore/wtf/RefCounted.h \ + Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp \ + Source/JavaScriptCore/wtf/RefCountedLeakCounter.h \ + Source/JavaScriptCore/wtf/RefPtr.h \ + Source/JavaScriptCore/wtf/RefPtrHashMap.h \ + Source/JavaScriptCore/wtf/RetainPtr.h \ + Source/JavaScriptCore/wtf/SegmentedVector.h \ + Source/JavaScriptCore/wtf/SentinelLinkedList.h \ + Source/JavaScriptCore/wtf/SHA1.cpp \ + Source/JavaScriptCore/wtf/SHA1.h \ + Source/JavaScriptCore/wtf/SinglyLinkedList.h \ + Source/JavaScriptCore/wtf/StackBounds.cpp \ + Source/JavaScriptCore/wtf/StackBounds.h \ + Source/JavaScriptCore/wtf/StaticConstructors.h \ + Source/JavaScriptCore/wtf/StdLibExtras.h \ + Source/JavaScriptCore/wtf/StringExtras.h \ + Source/JavaScriptCore/wtf/StringHasher.h \ + Source/JavaScriptCore/wtf/TCPackedCache.h \ + Source/JavaScriptCore/wtf/TCPageMap.h \ + Source/JavaScriptCore/wtf/TCSpinLock.h \ + Source/JavaScriptCore/wtf/TCSystemAlloc.cpp \ + Source/JavaScriptCore/wtf/TCSystemAlloc.h \ + Source/JavaScriptCore/wtf/text/AtomicString.cpp \ + Source/JavaScriptCore/wtf/text/AtomicString.h \ + Source/JavaScriptCore/wtf/text/AtomicStringHash.h \ + Source/JavaScriptCore/wtf/text/AtomicStringImpl.h \ + Source/JavaScriptCore/wtf/text/CString.cpp \ + Source/JavaScriptCore/wtf/text/CString.h \ + Source/JavaScriptCore/wtf/text/StringBuffer.h \ + Source/JavaScriptCore/wtf/text/StringBuilder.cpp \ + Source/JavaScriptCore/wtf/text/StringBuilder.h \ + Source/JavaScriptCore/wtf/text/StringConcatenate.h \ + Source/JavaScriptCore/wtf/text/StringHash.h \ + Source/JavaScriptCore/wtf/text/StringImplBase.h \ + Source/JavaScriptCore/wtf/text/StringImpl.cpp \ + Source/JavaScriptCore/wtf/text/StringImpl.h \ + Source/JavaScriptCore/wtf/text/StringStatics.cpp \ + Source/JavaScriptCore/wtf/text/TextPosition.h \ + Source/JavaScriptCore/wtf/text/WTFString.cpp \ + Source/JavaScriptCore/wtf/text/WTFString.h \ + Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \ + Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \ + Source/JavaScriptCore/wtf/Threading.cpp \ + Source/JavaScriptCore/wtf/Threading.h \ + Source/JavaScriptCore/wtf/ThreadingPrimitives.h \ + Source/JavaScriptCore/wtf/ThreadingPthreads.cpp \ + Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h \ + Source/JavaScriptCore/wtf/ThreadSpecific.h \ + Source/JavaScriptCore/wtf/TypeTraits.cpp \ + Source/JavaScriptCore/wtf/TypeTraits.h \ + Source/JavaScriptCore/wtf/unicode/CharacterNames.h \ + Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp \ + Source/JavaScriptCore/wtf/unicode/Collator.h \ + Source/JavaScriptCore/wtf/unicode/Unicode.h \ + Source/JavaScriptCore/wtf/unicode/UTF8.cpp \ + Source/JavaScriptCore/wtf/unicode/UTF8.h \ + Source/JavaScriptCore/wtf/UnusedParam.h \ + Source/JavaScriptCore/wtf/ValueCheck.h \ + Source/JavaScriptCore/wtf/Vector.h \ + Source/JavaScriptCore/wtf/VectorTraits.h \ + Source/JavaScriptCore/wtf/VMTags.h \ + Source/JavaScriptCore/wtf/WTFThreadData.cpp \ + Source/JavaScriptCore/wtf/WTFThreadData.h \ + Source/JavaScriptCore/yarr/Yarr.h \ + Source/JavaScriptCore/yarr/YarrInterpreter.cpp \ + Source/JavaScriptCore/yarr/YarrInterpreter.h \ + Source/JavaScriptCore/yarr/YarrJIT.cpp \ + Source/JavaScriptCore/yarr/YarrJIT.h \ + Source/JavaScriptCore/yarr/YarrParser.h \ + Source/JavaScriptCore/yarr/YarrPattern.cpp \ + Source/JavaScriptCore/yarr/YarrPattern.h \ + Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp \ + Source/JavaScriptCore/yarr/YarrSyntaxChecker.h + +if TARGET_WIN32 +javascriptcore_sources += \ + Source/JavaScriptCore/heap/MarkStackWin.cpp \ + Source/JavaScriptCore/wtf/OSAllocatorWin.cpp +else +javascriptcore_sources += \ + Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \ + Source/JavaScriptCore/heap/MarkStackPosix.cpp \ + Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp +endif + +# ---- +# icu unicode backend +# ---- +if USE_ICU_UNICODE +javascriptcore_sources += \ + Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \ + Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h +endif # USE_ICU_UNICODE + +# ---- +# glib unicode backend +# ---- +if USE_GLIB_UNICODE +javascriptcore_sources += \ + Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h \ + Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \ + Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp +endif # USE_GLIB_UNICODE + +# minidom +Programs_minidom_SOURCES = \ + Source/JavaScriptCore/API/tests/JSNode.c \ + Source/JavaScriptCore/API/tests/JSNode.h \ + Source/JavaScriptCore/API/tests/JSNodeList.c \ + Source/JavaScriptCore/API/tests/JSNodeList.h \ + Source/JavaScriptCore/API/tests/Node.c \ + Source/JavaScriptCore/API/tests/Node.h \ + Source/JavaScriptCore/API/tests/NodeList.c \ + Source/JavaScriptCore/API/tests/NodeList.h \ + Source/JavaScriptCore/API/tests/minidom.c + +Programs_jsc_SOURCES = \ + Source/JavaScriptCore/jsc.cpp diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp index 2f1166c..f9eee85 100644 --- a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp +++ b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp @@ -1 +1 @@ -__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E +__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureEiRKNS_10IdentifierEPFxS2_E diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp index c693322..eaa9f51 100644 --- a/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp +++ b/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp @@ -1 +1 @@ -__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E +__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureEiRKNS_10IdentifierEPFPvS2_E diff --git a/Source/JavaScriptCore/JavaScriptCore.exp b/Source/JavaScriptCore/JavaScriptCore.exp index e2647d1..1b00c66 100644 --- a/Source/JavaScriptCore/JavaScriptCore.exp +++ b/Source/JavaScriptCore/JavaScriptCore.exp @@ -114,14 +114,14 @@ __ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE __ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE __ZN3JSC11JSByteArray13s_defaultInfoE __ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataENS_7JSValueEPKNS_9ClassInfoE -__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayE +__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE __ZN3JSC11MarkedSpace21allocateFromSizeClassERNS0_9SizeClassE __ZN3JSC11ParserArena5resetEv __ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE __ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC11regExpFlagsERKNS_7UStringE __ZN3JSC12DateInstance6s_infoE -__ZN3JSC12DateInstanceC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd +__ZN3JSC12DateInstanceC1EPNS_9ExecStateEPNS_9StructureEd __ZN3JSC12JSGlobalData10ClientDataD2Ev __ZN3JSC12JSGlobalData11jsArrayVPtrE __ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeE @@ -132,10 +132,11 @@ __ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE __ZN3JSC12JSGlobalData14resetDateCacheEv __ZN3JSC12JSGlobalData14sharedInstanceEv __ZN3JSC12JSGlobalData15dumpRegExpTraceEv +__ZN3JSC12JSGlobalData22clearBuiltinStructuresEv __ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE __ZN3JSC12JSGlobalDataD1Ev __ZN3JSC12RegExpObject6s_infoE -__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEENS4_INS_6RegExpEEE +__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEN3WTF17NonNullPassRefPtrINS_6RegExpEEE __ZN3JSC12SamplingTool5setupEv __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE __ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh @@ -146,8 +147,7 @@ __ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArr __ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE __ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE __ZN3JSC12StringObject6s_infoE -__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringE -__ZN3JSC12jsNumberCellEPNS_9ExecStateEd +__ZN3JSC12StringObjectC2EPNS_9ExecStateEPNS_9StructureERKNS_7UStringE __ZN3JSC12nonInlineNaNEv __ZN3JSC13SamplingFlags4stopEv __ZN3JSC13SamplingFlags5startEv @@ -169,11 +169,14 @@ __ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE __ZN3JSC14TimeoutChecker5resetEv __ZN3JSC14throwTypeErrorEPNS_9ExecStateE __ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE +__ZN3JSC15WeakHandleOwner26isReachableFromOpaqueRootsENS_6HandleINS_7UnknownEEEPvRNS_9MarkStackE +__ZN3JSC15WeakHandleOwner8finalizeENS_6HandleINS_7UnknownEEEPv +__ZN3JSC15WeakHandleOwnerD2Ev __ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC16InternalFunction12vtableAnchorEv __ZN3JSC16InternalFunction4nameEPNS_9ExecStateE __ZN3JSC16InternalFunction6s_infoE -__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE +__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEPNS_9StructureERKNS_10IdentifierE __ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE __ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE __ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE @@ -204,7 +207,8 @@ __ZN3JSC23AbstractSamplingCounter4dumpEv __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE __ZN3JSC24DynamicGlobalObjectScopeC1ERNS_12JSGlobalDataEPNS_14JSGlobalObjectE -__ZN3JSC24JSObjectWithGlobalObjectC2EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEE +__ZN3JSC24JSObjectWithGlobalObjectC2EPNS_14JSGlobalObjectEPNS_9StructureE +__ZN3JSC24JSObjectWithGlobalObjectC2ERNS_12JSGlobalDataEPNS_14JSGlobalObjectEPNS_9StructureE __ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE __ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE __ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE @@ -253,9 +257,9 @@ __ZN3JSC7JSArray15setSubclassDataEPv __ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE __ZN3JSC7JSArray6s_infoE __ZN3JSC7JSArray9setLengthEj -__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE -__ZN3JSC7JSArrayC1ERNS_12JSGlobalDataEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE -__ZN3JSC7JSArrayC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE +__ZN3JSC7JSArrayC1ERNS_12JSGlobalDataEPNS_9StructureE +__ZN3JSC7JSArrayC1ERNS_12JSGlobalDataEPNS_9StructureERKNS_7ArgListE +__ZN3JSC7JSArrayC2ERNS_12JSGlobalDataEPNS_9StructureE __ZN3JSC7JSArrayD2Ev __ZN3JSC7JSValue13isValidCalleeEv __ZN3JSC7Profile10restoreAllEv @@ -308,21 +312,20 @@ __ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE __ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE __ZN3JSC8Profiler8profilerEv __ZN3JSC8evaluateEPNS_9ExecStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7JSValueE +__ZN3JSC8isZombieEPKNS_6JSCellE __ZN3JSC9CodeBlockD1Ev __ZN3JSC9CodeBlockD2Ev __ZN3JSC9MarkStack10s_pageSizeE __ZN3JSC9MarkStack18initializePagesizeEv -__ZN3JSC9Structure17stopIgnoringLeaksEv -__ZN3JSC9Structure18startIgnoringLeaksEv -__ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjPNS_6JSCellERm -__ZN3JSC9Structure22materializePropertyMapEv -__ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE -__ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE -__ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE -__ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEjPNS_6JSCellE -__ZN3JSC9Structure3getEPN3WTF10StringImplERjRPNS_6JSCellE +__ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm +__ZN3JSC9Structure22materializePropertyMapERNS_12JSGlobalDataE +__ZN3JSC9Structure25changePrototypeTransitionERNS_12JSGlobalDataEPS0_NS_7JSValueE +__ZN3JSC9Structure27despecifyDictionaryFunctionERNS_12JSGlobalDataERKNS_10IdentifierE +__ZN3JSC9Structure27despecifyFunctionTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierE +__ZN3JSC9Structure28addPropertyWithoutTransitionERNS_12JSGlobalDataERKNS_10IdentifierEjPNS_6JSCellE +__ZN3JSC9Structure3getERNS_12JSGlobalDataEPN3WTF10StringImplERjRPNS_6JSCellE __ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjPNS_6JSCellERm -__ZN3JSC9StructureC1ENS_7JSValueERKNS_8TypeInfoEjPKNS_9ClassInfoE +__ZN3JSC9StructureC1ERNS_12JSGlobalDataENS_7JSValueERKNS_8TypeInfoEjPKNS_9ClassInfoE __ZN3JSC9StructureD1Ev __ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE __ZN3JSCeqERKNS_7UStringEPKc @@ -371,22 +374,21 @@ __ZN3WTF11dtoaRoundDPEPcdiRbRiRj __ZN3WTF11dtoaRoundSFEPcdiRbRiRj __ZN3WTF11fastReallocEPvm __ZN3WTF12AtomicString11addSlowCaseEPNS_10StringImplE +__ZN3WTF12AtomicString16fromUTF8InternalEPKcS2_ __ZN3WTF12AtomicString3addEPKc __ZN3WTF12AtomicString3addEPKt __ZN3WTF12AtomicString3addEPKtj __ZN3WTF12AtomicString3addEPKtjj __ZN3WTF12AtomicString4findEPKtjj __ZN3WTF12AtomicString4initEv -__ZN3WTF12AtomicString8fromUTF8EPKc -__ZN3WTF12AtomicString8fromUTF8EPKcm __ZN3WTF12createThreadEPFPvS0_ES0_ __ZN3WTF12createThreadEPFPvS0_ES0_PKc __ZN3WTF12detachThreadEj __ZN3WTF12isMainThreadEv __ZN3WTF12randomNumberEv -__ZN3WTF13StringBuilder15reserveCapacityEj __ZN3WTF13StringBuilder11reifyStringEv __ZN3WTF13StringBuilder11shrinkToFitEv +__ZN3WTF13StringBuilder15reserveCapacityEj __ZN3WTF13StringBuilder6appendEPKcj __ZN3WTF13StringBuilder6appendEPKtj __ZN3WTF13StringBuilder6resizeEj @@ -526,7 +528,6 @@ __ZNK3JSC18PropertyDescriptor6getterEv __ZNK3JSC18PropertyDescriptor6setterEv __ZNK3JSC18PropertyDescriptor8writableEv __ZNK3JSC19SourceProviderCache8byteSizeEv -__ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv __ZNK3JSC4Heap11objectCountEv __ZNK3JSC4Heap4sizeEv __ZNK3JSC4Heap8capacityEv @@ -596,6 +597,7 @@ __ZTVN3JSC12StringObjectE __ZTVN3JSC14JSGlobalObjectE __ZTVN3JSC14ScopeChainNodeE __ZTVN3JSC15JSWrapperObjectE +__ZTVN3JSC15WeakHandleOwnerE __ZTVN3JSC16InternalFunctionE __ZTVN3JSC16JSVariableObjectE __ZTVN3JSC8DebuggerE diff --git a/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp index 9b93d97..27596fc 100644 --- a/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp +++ b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp @@ -206,10 +206,13 @@ 'inputs': [ '../create_regex_tables', ], + 'arguments': [ + '--no-tables', + ], 'outputs': [ '<(INTERMEDIATE_DIR)/RegExpJitTables.h', ], - 'action': ['python', '<@(_inputs)', '<@(_outputs)'], + 'action': ['python', '<@(_inputs)', '<@(_arguments)', '<@(_outputs)'], }, ], 'include_dirs': [ diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi index cb93a29..352ec97 100644 --- a/Source/JavaScriptCore/JavaScriptCore.gypi +++ b/Source/JavaScriptCore/JavaScriptCore.gypi @@ -27,12 +27,15 @@ 'API/OpaqueJSString.h', 'assembler/MacroAssemblerCodeRef.h', 'bytecode/Opcode.h', - 'collector/handles/Global.h', - 'collector/handles/Handle.h', - 'collector/handles/HandleHeap.h', - 'collector/handles/HandleStack.h', - 'collector/handles/Local.h', - 'collector/handles/LocalScope.h', + 'heap/ConservativeRoots.h', + 'heap/Handle.h', + 'heap/HandleHeap.h', + 'heap/HandleStack.h', + 'heap/Heap.h', + 'heap/Local.h', + 'heap/LocalScope.h', + 'heap/Strong.h', + 'heap/Weak.h', 'config.h', 'debugger/Debugger.h', 'debugger/DebuggerActivation.h', @@ -69,7 +72,6 @@ 'runtime/FunctionConstructor.h', 'runtime/FunctionPrototype.h', 'runtime/GCActivityCallback.h', - 'runtime/Heap.h', 'runtime/Identifier.h', 'runtime/InitializeThreading.h', 'runtime/InternalFunction.h', @@ -80,7 +82,6 @@ 'runtime/JSFunction.h', 'runtime/JSGlobalData.h', 'runtime/JSGlobalObject.h', - 'runtime/JSImmediate.h', 'runtime/JSLock.h', 'runtime/JSNumberCell.h', 'runtime/JSObject.h', @@ -89,13 +90,10 @@ 'runtime/JSType.h', 'runtime/JSTypeInfo.h', 'runtime/JSValue.h', + 'runtime/JSValueInlineMethods.h', 'runtime/JSVariableObject.h', 'runtime/JSWrapperObject.h', 'runtime/Lookup.h', - 'runtime/MachineStackMarker.h', - 'runtime/MarkStack.h', - 'runtime/MarkedBlock.h', - 'runtime/MarkedSpace.h', 'runtime/MathObject.h', 'runtime/MemoryStatistics.h', 'runtime/NumberObject.h', @@ -128,11 +126,11 @@ 'runtime/UString.h', 'runtime/UStringBuilder.h', 'runtime/WeakGCMap.h', - 'runtime/WeakGCPtr.h', 'runtime/WeakRandom.h', 'runtime/WriteBarrier.h', 'wtf/ASCIICType.h', 'wtf/AVLTree.h', + 'wtf/Alignment.h', 'wtf/AlwaysInline.h', 'wtf/Assertions.h', 'wtf/Atomics.h', @@ -310,8 +308,21 @@ 'bytecompiler/LabelScope.h', 'bytecompiler/NodesCodegen.cpp', 'bytecompiler/RegisterID.h', - 'collector/handles/HandleHeap.cpp', - 'collector/handles/HandleStack.cpp', + 'heap/ConservativeRoots.cpp', + 'heap/HandleHeap.cpp', + 'heap/HandleStack.cpp', + 'heap/Heap.cpp', + 'heap/MachineStackMarker.cpp', + 'heap/MachineStackMarker.h', + 'heap/MarkStack.cpp', + 'heap/MarkStack.h', + 'heap/MarkStackPosix.cpp', + 'heap/MarkStackSymbian.cpp', + 'heap/MarkStackWin.cpp', + 'heap/MarkedBlock.cpp', + 'heap/MarkedBlock.h', + 'heap/MarkedSpace.cpp', + 'heap/MarkedSpace.h', 'debugger/Debugger.cpp', 'debugger/DebuggerActivation.cpp', 'debugger/DebuggerCallFrame.cpp', @@ -456,8 +467,6 @@ 'runtime/CallData.cpp', 'runtime/CommonIdentifiers.cpp', 'runtime/Completion.cpp', - 'runtime/ConservativeSet.cpp', - 'runtime/ConservativeSet.h', 'runtime/ConstructData.cpp', 'runtime/DateConstructor.cpp', 'runtime/DateConstructor.h', @@ -482,7 +491,6 @@ 'runtime/GCActivityCallbackCF.cpp', 'runtime/GetterSetter.cpp', 'runtime/GetterSetter.h', - 'runtime/Heap.cpp', 'runtime/Identifier.cpp', 'runtime/InitializeThreading.cpp', 'runtime/InternalFunction.cpp', @@ -497,7 +505,6 @@ 'runtime/JSGlobalObject.cpp', 'runtime/JSGlobalObjectFunctions.cpp', 'runtime/JSGlobalObjectFunctions.h', - 'runtime/JSImmediate.cpp', 'runtime/JSLock.cpp', 'runtime/JSNotAnObject.cpp', 'runtime/JSNotAnObject.h', @@ -520,13 +527,6 @@ 'runtime/LiteralParser.cpp', 'runtime/LiteralParser.h', 'runtime/Lookup.cpp', - 'runtime/MachineStackMarker.cpp', - 'runtime/MarkStack.cpp', - 'runtime/MarkStackPosix.cpp', - 'runtime/MarkStackSymbian.cpp', - 'runtime/MarkStackWin.cpp', - 'runtime/MarkedBlock.cpp', - 'runtime/MarkedSpace.cpp', 'runtime/MathObject.cpp', 'runtime/MemoryStatistics.cpp', 'runtime/NativeErrorConstructor.cpp', @@ -577,6 +577,8 @@ 'wtf/CurrentTime.cpp', 'wtf/DateMath.cpp', 'wtf/DecimalNumber.cpp', + 'wtf/DynamicAnnotations.cpp', + 'wtf/DynamicAnnotations.h', 'wtf/FastMalloc.cpp', 'wtf/HashTable.cpp', 'wtf/MD5.cpp', diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri index 941a708..c342936 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pri +++ b/Source/JavaScriptCore/JavaScriptCore.pri @@ -25,7 +25,7 @@ JAVASCRIPTCORE_INCLUDEPATH = \ $$PWD/assembler \ $$PWD/bytecode \ $$PWD/bytecompiler \ - $$PWD/collector/handles \ + $$PWD/heap \ $$PWD/dfg \ $$PWD/debugger \ $$PWD/interpreter \ diff --git a/Source/JavaScriptCore/JavaScriptCore.pro b/Source/JavaScriptCore/JavaScriptCore.pro index 80ad3e8..7a3653b 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pro +++ b/Source/JavaScriptCore/JavaScriptCore.pro @@ -62,6 +62,9 @@ SOURCES += \ assembler/ARMAssembler.cpp \ assembler/ARMv7Assembler.cpp \ assembler/MacroAssemblerARM.cpp \ + assembler/MacroAssemblerSH4.h \ + assembler/MacroAssemblerSH4.cpp \ + assembler/SH4Assembler.h \ bytecode/CodeBlock.cpp \ bytecode/JumpTable.cpp \ bytecode/Opcode.cpp \ @@ -69,8 +72,17 @@ SOURCES += \ bytecode/StructureStubInfo.cpp \ bytecompiler/BytecodeGenerator.cpp \ bytecompiler/NodesCodegen.cpp \ - collector/handles/HandleHeap.cpp \ - collector/handles/HandleStack.cpp \ + heap/ConservativeRoots.cpp \ + heap/HandleHeap.cpp \ + heap/HandleStack.cpp \ + heap/Heap.cpp \ + heap/MachineStackMarker.cpp \ + heap/MarkStack.cpp \ + heap/MarkStackPosix.cpp \ + heap/MarkStackSymbian.cpp \ + heap/MarkStackWin.cpp \ + heap/MarkedBlock.cpp \ + heap/MarkedSpace.cpp \ debugger/DebuggerActivation.cpp \ debugger/DebuggerCallFrame.cpp \ debugger/Debugger.cpp \ @@ -115,9 +127,6 @@ SOURCES += \ runtime/BooleanObject.cpp \ runtime/BooleanPrototype.cpp \ runtime/CallData.cpp \ - runtime/MarkedBlock.cpp \ - runtime/MarkedSpace.cpp \ - runtime/Heap.cpp \ runtime/CommonIdentifiers.cpp \ runtime/Completion.cpp \ runtime/ConstructData.cpp \ @@ -147,10 +156,8 @@ SOURCES += \ runtime/JSGlobalData.cpp \ runtime/JSGlobalObject.cpp \ runtime/JSGlobalObjectFunctions.cpp \ - runtime/JSImmediate.cpp \ runtime/JSLock.cpp \ runtime/JSNotAnObject.cpp \ - runtime/JSNumberCell.cpp \ runtime/JSObject.cpp \ runtime/JSObjectWithGlobalObject.cpp \ runtime/JSONObject.cpp \ @@ -162,12 +169,6 @@ SOURCES += \ runtime/JSWrapperObject.cpp \ runtime/LiteralParser.cpp \ runtime/Lookup.cpp \ - runtime/MachineStackMarker.cpp \ - runtime/MarkStackPosix.cpp \ - runtime/MarkStackSymbian.cpp \ - runtime/MarkStackWin.cpp \ - runtime/ConservativeSet.cpp \ - runtime/MarkStack.cpp \ runtime/MathObject.cpp \ runtime/NativeErrorConstructor.cpp \ runtime/NativeErrorPrototype.cpp \ @@ -199,6 +200,11 @@ SOURCES += \ runtime/UString.cpp \ yarr/YarrJIT.cpp \ +*sh4* { + QMAKE_CXXFLAGS += -mieee -w + QMAKE_CFLAGS += -mieee -w +} + # Generated files, simply list them for JavaScriptCore symbian: { diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make index b5461e4..bd47530 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make @@ -5,6 +5,7 @@ BUILDSTYLE=Release_PGO !ENDIF install: + set OFFICIAL_BUILD=1 set WebKitLibrariesDir=$(SRCROOT)\AppleInternal set WebKitOutputDir=$(OBJROOT) set ConfigurationBuildDir=$(OBJROOT)\$(BUILDSTYLE) diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln index 0b610e2..f2846cc 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln @@ -3,18 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}" ProjectSection(ProjectDependencies) = postProject - {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} + {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsc", "jsc\jsc.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}" ProjectSection(ProjectDependencies) = postProject - {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6} {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}" + ProjectSection(ProjectDependencies) = postProject + {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindSafari", "..\..\..\Tools\FindSafari\FindSafari.vcproj", "{DA31DA52-6675-48D4-89E0-333A7144397C}" + ProjectSection(ProjectDependencies) = postProject + {C59E5129-B453-49B7-A52B-1E104715F76E} = {C59E5129-B453-49B7-A52B-1E104715F76E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCoreGenerated", "JavaScriptCore\JavaScriptCoreGenerated.vcproj", "{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}" EndProject diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index d7cddf4..0fa73f1 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -3,24 +3,25 @@ EXPORTS ??0CString@WTF@@QAE@PBD@Z ??0CString@WTF@@QAE@PBDI@Z ??0Collator@WTF@@QAE@PBD@Z - ??0DateInstance@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@N@Z + ??0DateInstance@JSC@@QAE@PAVExecState@1@PAVStructure@1@N@Z ??0DefaultGCActivityCallback@JSC@@QAE@PAVHeap@1@@Z ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z - ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z - ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z - ??0JSArray@JSC@@QAE@AAVJSGlobalData@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z - ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z - ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@@Z - ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z + ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z + ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@PAVStructure@1@ABVIdentifier@1@@Z + ??0JSArray@JSC@@QAE@AAVJSGlobalData@1@PAVStructure@1@@Z + ??0JSArray@JSC@@QAE@AAVJSGlobalData@1@PAVStructure@1@ABVArgList@1@@Z + ??0JSByteArray@JSC@@QAE@PAVExecState@1@PAVStructure@1@PAVByteArray@WTF@@@Z + ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@PAVStructure@1@HABVIdentifier@1@P6I_J0@Z@Z ??0JSLock@JSC@@QAE@PAVExecState@1@@Z - ??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z + ??0JSObjectWithGlobalObject@JSC@@IAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@PAVStructure@1@@Z + ??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@@Z ??0MD5@WTF@@QAE@XZ ??0Mutex@WTF@@QAE@XZ ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z - ??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@V?$NonNullPassRefPtr@VRegExp@JSC@@@4@@Z + ??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@PAVStructure@1@V?$NonNullPassRefPtr@VRegExp@JSC@@@WTF@@@Z ??0SHA1@WTF@@QAE@XZ - ??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z - ??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z + ??0StringObject@JSC@@QAE@PAVExecState@1@PAVStructure@1@ABVUString@1@@Z + ??0Structure@JSC@@AAE@AAVJSGlobalData@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z ??0ThreadCondition@WTF@@QAE@XZ ??0UString@JSC@@QAE@PBD@Z ??0UString@JSC@@QAE@PBDI@Z @@ -37,9 +38,9 @@ EXPORTS ??1RefCountedLeakCounter@WTF@@QAE@XZ ??1RegExp@JSC@@QAE@XZ ??1SourceProviderCache@JSC@@QAE@XZ - ??1Structure@JSC@@QAE@XZ ??1ThreadCondition@WTF@@QAE@XZ ??1WTFThreadData@WTF@@QAE@XZ + ??1WeakHandleOwner@JSC@@UAE@XZ ??2JSGlobalObject@JSC@@SAPAXIPAVJSGlobalData@1@@Z ??8JSC@@YA_NABVUString@0@0@Z ??8WTF@@YA_NABVCString@0@0@Z @@ -51,9 +52,9 @@ EXPORTS ?addBytes@MD5@WTF@@QAEXPBEI@Z ?addBytes@SHA1@WTF@@QAEXPBEI@Z ?addCurrentThread@MachineThreads@JSC@@QAEXXZ - ?addPropertyTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z - ?addPropertyTransitionToExistingStructure@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z - ?addPropertyWithoutTransition@Structure@JSC@@QAEIABVIdentifier@2@IPAVJSCell@2@@Z + ?addPropertyTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z + ?addPropertyTransitionToExistingStructure@Structure@JSC@@SAPAV12@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z + ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@IPAVJSCell@2@@Z ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z ?allocate@Heap@JSC@@QAEPAXI@Z ?allocateFromSizeClass@MarkedSpace@JSC@@AAEPAXAAUSizeClass@12@@Z @@ -69,8 +70,7 @@ EXPORTS ?byteCompile@Yarr@JSC@@YA?AV?$PassOwnPtr@UBytecodePattern@Yarr@JSC@@@WTF@@AAUYarrPattern@12@PAVBumpPointerAllocator@4@@Z ?byteSize@SourceProviderCache@JSC@@QBEIXZ ?calculateDSTOffset@WTF@@YANNN@Z - ?calculateStringHashAndLengthFromUTF8@Unicode@WTF@@YAIPBDAAI1@Z - ?calculateStringHashFromUTF8@Unicode@WTF@@YAIPBD0AAI@Z + ?calculateStringHashAndLengthFromUTF8@Unicode@WTF@@YAIPBD0AAI1@Z ?calculateUTCOffset@WTF@@YAHXZ ?calculatedFunctionName@DebuggerCallFrame@JSC@@QBE?AVUString@2@XZ ?call@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@W4CallType@1@ABTCallData@1@1ABVArgList@1@@Z @@ -78,13 +78,14 @@ EXPORTS ?callOnMainThreadAndWait@WTF@@YAXP6AXPAX@Z0@Z ?cancelCallOnMainThread@WTF@@YAXP6AXPAX@Z0@Z ?capacity@Heap@JSC@@QBEIXZ - ?changePrototypeTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@VJSValue@2@@Z + ?changePrototypeTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VJSValue@2@@Z ?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVExecState@2@@Z ?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVJSGlobalData@2@@Z ?checkSyntax@JSC@@YA?AVCompletion@1@PAVExecState@1@ABVSourceCode@1@@Z ?checksum@MD5@WTF@@QAEXAAV?$Vector@E$0BA@@2@@Z ?className@JSObject@JSC@@UBE?AVUString@2@XZ ?clear@SourceProviderCache@JSC@@QAEXXZ + ?clearBuiltinStructures@JSGlobalData@JSC@@QAEXXZ ?collate@Collator@WTF@@QBE?AW4Result@12@PB_WI0I@Z ?collectAllGarbage@Heap@JSC@@QAEXXZ ?computeHash@SHA1@WTF@@QAEXAAV?$Vector@E$0BE@@2@@Z @@ -108,7 +109,7 @@ EXPORTS ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z ?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z - ?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@AAVJSGlobalData@2@VJSValue@2@PBUClassInfo@2@@Z + ?createStructure@JSByteArray@JSC@@SAPAVStructure@2@AAVJSGlobalData@2@VJSValue@2@PBUClassInfo@2@@Z ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z ?createThread@WTF@@YAIP6APAXPAX@Z0@Z @@ -143,8 +144,8 @@ EXPORTS ?deleteProperty@JSVariableObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z ?deleteProperty@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z ?deleteTable@HashTable@JSC@@QBEXXZ - ?despecifyDictionaryFunction@Structure@JSC@@QAEXABVIdentifier@2@@Z - ?despecifyFunctionTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@@Z + ?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z + ?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@@Z ?destroy@Heap@JSC@@QAEXXZ ?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z ?detachThread@WTF@@YAXI@Z @@ -166,12 +167,14 @@ EXPORTS ?fastStrDup@WTF@@YAPADPBD@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z + ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@H@Z ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@I@Z ?functionGetter@PropertySlot@JSC@@ABE?AVJSValue@2@PAVExecState@2@@Z ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ - ?get@Structure@JSC@@QAEIPAVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z + ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@AAIAAPAVJSCell@2@@Z + ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@PAVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z ?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z ?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ @@ -222,9 +225,9 @@ EXPORTS ?isGetterSetter@JSCell@JSC@@UBE_NXZ ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ ?isMainThread@WTF@@YA_NXZ + ?isReachableFromOpaqueRoots@WeakHandleOwner@JSC@@UAE_NV?$Handle@W4Unknown@JSC@@@2@PAXAAVMarkStack@2@@Z ?isValidCallee@JSValue@JSC@@QAE_NXZ ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ - ?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z ?jsOwnedString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z ?jsString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z ?length@CString@WTF@@QBEIXZ @@ -238,7 +241,7 @@ EXPORTS ?markChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z ?markChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z ?markChildren@ScopeChainNode@JSC@@UAEXAAVMarkStack@2@@Z - ?materializePropertyMap@Structure@JSC@@AAEXXZ + ?materializePropertyMap@Structure@JSC@@AAEXAAVJSGlobalData@2@@Z ?monthFromDayInYear@WTF@@YAHH_N@Z ?msToYear@WTF@@YAHN@Z ?name@InternalFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z @@ -266,6 +269,7 @@ EXPORTS ?put@StringObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z ?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVInternalFunction@2@I@Z ?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVJSFunction@2@I@Z + ?putDirectInternal@JSObject@JSC@@AAE_NAAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@PAVJSCell@2@@Z ?putWithAttributes@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z @@ -277,11 +281,11 @@ EXPORTS ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z ?regExpFlags@JSC@@YA?AW4RegExpFlags@1@ABVUString@1@@Z ?reifyString@StringBuilder@WTF@@AAEXXZ - ?reserveCapacity@StringBuilder@WTF@@QAEXI@Z ?releaseDecommitted@OSAllocator@WTF@@SAXPAXI@Z ?releaseStack@MarkStack@JSC@@CAXPAXI@Z ?reportExtraMemoryCostSlowCase@Heap@JSC@@AAEXI@Z ?reserveAndCommit@OSAllocator@WTF@@SAPAXIW4Usage@12@_N1@Z + ?reserveCapacity@StringBuilder@WTF@@QAEXI@Z ?reset@ParserArena@JSC@@QAEXXZ ?reset@TimeoutChecker@JSC@@QAEXXZ ?resetDateCache@JSGlobalData@JSC@@QAEXXZ @@ -300,6 +304,7 @@ EXPORTS ?setLoc@StatementNode@JSC@@QAEXHH@Z ?setMainThreadCallbacksPaused@WTF@@YAX_N@Z ?setOrderLowerFirst@Collator@WTF@@QAEX_N@Z + ?setPrototype@JSObject@JSC@@QAEXAAVJSGlobalData@2@VJSValue@2@@Z ?setSetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z ?setUndefined@PropertyDescriptor@JSC@@QAEXXZ ?setUpStaticFunctionSlot@JSC@@YAXPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@ABVIdentifier@1@AAVPropertySlot@1@@Z @@ -309,10 +314,8 @@ EXPORTS ?signal@ThreadCondition@WTF@@QAEXXZ ?size@Heap@JSC@@QBEIXZ ?slowAppend@MarkedArgumentBuffer@JSC@@AAEXVJSValue@2@@Z - ?startIgnoringLeaks@Structure@JSC@@SAXXZ ?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z ?startSampling@JSGlobalData@JSC@@QAEXXZ - ?stopIgnoringLeaks@Structure@JSC@@SAXXZ ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z ?stopSampling@JSGlobalData@JSC@@QAEXXZ ?strtod@WTF@@YANPBDPAPAD@Z diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index 30b014a..4d5da54 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -602,14 +602,6 @@ > </File> <File - RelativePath="..\..\runtime\ConservativeSet.cpp" - > - </File> - <File - RelativePath="..\..\runtime\ConservativeSet.h" - > - </File> - <File RelativePath="..\..\runtime\ConstructData.cpp" > </File> @@ -742,14 +734,6 @@ > </File> <File - RelativePath="..\..\runtime\Heap.cpp" - > - </File> - <File - RelativePath="..\..\runtime\Heap.h" - > - </File> - <File RelativePath="..\..\runtime\Identifier.cpp" > </File> @@ -838,14 +822,6 @@ > </File> <File - RelativePath="..\..\runtime\JSImmediate.cpp" - > - </File> - <File - RelativePath="..\..\runtime\JSImmediate.h" - > - </File> - <File RelativePath="..\..\runtime\JSLock.cpp" > </File> @@ -862,14 +838,6 @@ > </File> <File - RelativePath="..\..\runtime\JSNumberCell.cpp" - > - </File> - <File - RelativePath="..\..\runtime\JSNumberCell.h" - > - </File> - <File RelativePath="..\..\runtime\JSObject.cpp" > </File> @@ -934,6 +902,10 @@ > </File> <File + RelativePath="..\..\runtime\JSValueInlineMethods.h" + > + </File> + <File RelativePath="..\..\runtime\JSVariableObject.cpp" > </File> @@ -974,42 +946,6 @@ > </File> <File - RelativePath="..\..\runtime\MachineStackMarker.cpp" - > - </File> - <File - RelativePath="..\..\runtime\MachineStackMarker.h" - > - </File> - <File - RelativePath="..\..\runtime\MarkedBlock.cpp" - > - </File> - <File - RelativePath="..\..\runtime\MarkedBlock.h" - > - </File> - <File - RelativePath="..\..\runtime\MarkedSpace.cpp" - > - </File> - <File - RelativePath="..\..\runtime\MarkedSpace.h" - > - </File> - <File - RelativePath="..\..\runtime\MarkStack.cpp" - > - </File> - <File - RelativePath="..\..\runtime\MarkStack.h" - > - </File> - <File - RelativePath="..\..\runtime\MarkStackWin.cpp" - > - </File> - <File RelativePath="..\..\runtime\MathObject.cpp" > </File> @@ -1298,10 +1234,6 @@ > </File> <File - RelativePath="..\..\runtime\WeakGCPtr.h" - > - </File> - <File RelativePath="..\..\runtime\WeakRandom.h" > </File> @@ -1939,44 +1871,96 @@ </File> </Filter> <Filter - Name="collector" + Name="heap" > - <Filter - Name="handles" - > - <File - RelativePath="..\..\collector\handles\Global.h" - > - </File> - <File - RelativePath="..\..\collector\handles\Handle.h" - > - </File> - <File - RelativePath="..\..\collector\handles\HandleHeap.cpp" - > - </File> - <File - RelativePath="..\..\collector\handles\HandleHeap.h" - > - </File> - <File - RelativePath="..\..\collector\handles\HandleStack.cpp" - > - </File> - <File - RelativePath="..\..\collector\handles\HandleStack.h" - > - </File> - <File - RelativePath="..\..\collector\handles\Local.h" - > - </File> - <File - RelativePath="..\..\collector\handles\LocalScope.h" - > - </File> - </Filter> + <File + RelativePath="..\..\heap\ConservativeRoots.cpp" + > + </File> + <File + RelativePath="..\..\heap\ConservativeRoots.h" + > + </File> + <File + RelativePath="..\..\heap\MachineStackMarker.cpp" + > + </File> + <File + RelativePath="..\..\heap\MachineStackMarker.h" + > + </File> + <File + RelativePath="..\..\heap\MarkedBlock.cpp" + > + </File> + <File + RelativePath="..\..\heap\MarkedBlock.h" + > + </File> + <File + RelativePath="..\..\heap\MarkedSpace.cpp" + > + </File> + <File + RelativePath="..\..\heap\MarkedSpace.h" + > + </File> + <File + RelativePath="..\..\heap\MarkStack.cpp" + > + </File> + <File + RelativePath="..\..\heap\MarkStack.h" + > + </File> + <File + RelativePath="..\..\heap\MarkStackWin.cpp" + > + </File> + <File + RelativePath="..\..\heap\Heap.cpp" + > + </File> + <File + RelativePath="..\..\heap\Heap.h" + > + </File> + <File + RelativePath="..\..\heap\Strong.h" + > + </File> + <File + RelativePath="..\..\heap\Handle.h" + > + </File> + <File + RelativePath="..\..\heap\HandleHeap.cpp" + > + </File> + <File + RelativePath="..\..\heap\HandleHeap.h" + > + </File> + <File + RelativePath="..\..\heap\HandleStack.cpp" + > + </File> + <File + RelativePath="..\..\heap\HandleStack.h" + > + </File> + <File + RelativePath="..\..\heap\Local.h" + > + </File> + <File + RelativePath="..\..\heap\LocalScope.h" + > + </File> + <File + RelativePath="..\..\heap\Weak.h" + > + </File> </Filter> <File RelativePath="..\..\config.h" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops index cb7362d..204ec63 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops @@ -6,7 +6,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\";../../;../../API/;../../parser/;../../bytecompiler/;../../jit/;../../runtime/;../../bytecode/;../../interpreter/;../../wtf/;../../profiler;../../assembler/;../../debugger/;../../collector/handles/;"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private";"$(WebKitLibrariesDir)\include\pthreads"" + AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\";../../;../../API/;../../parser/;../../bytecompiler/;../../jit/;../../runtime/;../../bytecode/;../../interpreter/;../../wtf/;../../profiler;../../assembler/;../../debugger/;../../heap/;"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private";"$(WebKitLibrariesDir)\include\pthreads"" PreprocessorDefinitions="__STD_C" ForcedIncludeFiles="ICUVersion.h" /> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make index ba95c46..9a59841 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make @@ -1,62 +1,15 @@ all: touch "%ConfigurationBuildDir%\buildfailed" bash build-generated-files.sh "%ConfigurationBuildDir%" "$(WEBKITLIBRARIESDIR)" -!IF "$(PRODUCTION)"!="1" +!IF "$(OFFICIAL_BUILD)"!="1" bash -c "python react-to-vsprops-changes.py" !ENDIF - -mkdir 2>NUL "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\APICast.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\APIShims.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JavaScript.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSBase.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSContextRef.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSContextRefPrivate.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSObjectRef.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSObjectRefPrivate.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSStringRef.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSStringRefCF.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSStringRefBSTR.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSValueRef.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JavaScriptCore.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSRetainPtr.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSWeakObjectMapRefInternal.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSWeakObjectMapRefPrivate.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\JSRetainPtr.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\OpaqueJSString.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - xcopy /y /d "..\..\API\WebKitAvailability.h" "%ConfigurationBuildDir%\include\JavaScriptCore" - - -mkdir 2>NUL "%ConfigurationBuildDir%\include\private\JavaScriptCore" + copy-files.cmd - xcopy /y /d "..\..\wtf\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\text\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\unicode\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\unicode\icu\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\parser\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\runtime\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\bytecode\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\interpreter\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\assembler\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\jit\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\collector\handles\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\debugger\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\profiler\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\create_hash_table" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\text\AtomicString.cpp" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\text\StringBuilder.cpp" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\text\StringImpl.cpp" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\wtf\text\WTFString.cpp" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - xcopy /y /d "..\..\yarr\*.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore" - - - -mkdir 2>NUL "%ConfigurationBuildDir%\bin\JavaScriptCore.resources" - xcopy /y /d "..\JavaScriptCore.resources\*" "%ConfigurationBuildDir%\bin\JavaScriptCore.resources" - -del "%ConfigurationBuildDir%\include\private\JavaScriptCore\stdbool.h" "%ConfigurationBuildDir%\include\private\JavaScriptCore\stdint.h" -del "%ConfigurationBuildDir%\buildfailed" clean: -del "%ConfigurationBuildDir%\buildfailed" - -del /s /q "%ConfigurationBuildDir%\include\JavaScriptCore\JavaScriptCore" + copy-files.cmd clean -del /s /q "%ConfigurationBuildDir%\obj\JavaScriptCore\DerivedSources" - -del /s /q "%ConfigurationBuildDir%\include\private\JavaScriptCore" - -del /s /q "%ConfigurationBuildDir%\bin\JavaScriptCore.resources" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj index ebff713..59d1183 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj @@ -18,7 +18,7 @@ <Configuration Name="Debug|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedDebug.vsprops" > <Tool Name="VCNMakeTool" @@ -27,7 +27,7 @@ <Configuration Name="Debug_All|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedDebugAll.vsprops" > <Tool Name="VCNMakeTool" @@ -36,7 +36,7 @@ <Configuration Name="Release|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedRelease.vsprops" > <Tool Name="VCNMakeTool" @@ -45,7 +45,7 @@ <Configuration Name="Production|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedProduction.vsprops" > <Tool Name="VCNMakeTool" @@ -54,7 +54,7 @@ <Configuration Name="Release_Cairo_CFLite|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops" > <Tool Name="VCNMakeTool" @@ -63,7 +63,7 @@ <Configuration Name="Debug_Cairo_CFLite|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedDebugCairoCFLite.vsprops" > <Tool Name="VCNMakeTool" @@ -72,7 +72,7 @@ <Configuration Name="Release_PGO|Win32" ConfigurationType="0" - InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops" + InheritedPropertySheets=".\JavaScriptCoreGeneratedReleasePGO.vsprops" > <Tool Name="VCNMakeTool" @@ -87,6 +87,10 @@ > </File> <File + RelativePath=".\copy-files.cmd" + > + </File> + <File RelativePath="..\..\DerivedSources.make" > </File> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops index 248eb59..1b718df 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops @@ -4,12 +4,11 @@ Version="8.00" Name="JavaScriptCoreGeneratedCommon" OutputDirectory="$(ConfigurationBuildDir)\lib" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops" > <Tool Name="VCNMakeTool" - BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
nmake /nologo -f JavaScriptCoreGenerated.make" - ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
nmake /nologo -f JavaScriptCoreGenerated.make clean
nmake -f JavaScriptCoreGenerated.make" - CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
nmake /nologo -f JavaScriptCoreGenerated.make clean" + BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f JavaScriptCoreGenerated.make" + ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f JavaScriptCoreGenerated.make clean
nmake -f JavaScriptCoreGenerated.make" + CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f JavaScriptCoreGenerated.make clean" /> </VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebug.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebug.vsprops new file mode 100644 index 0000000..d8e1748 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebug.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedDebug" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugAll.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugAll.vsprops new file mode 100644 index 0000000..3347b74 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugAll.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedDebugAll" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugCairoCFLite.vsprops new file mode 100644 index 0000000..9620384 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugCairoCFLite.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedDebugCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedProduction.vsprops new file mode 100644 index 0000000..a02f833 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedProduction.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedProduction" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedRelease.vsprops new file mode 100644 index 0000000..833b674 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedRelease.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedRelease" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops new file mode 100644 index 0000000..3fdc37a --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedReleaseCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleasePGO.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleasePGO.vsprops new file mode 100644 index 0000000..096e42e --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleasePGO.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="JavaScriptCoreGeneratedReleasePGO" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; + .\JavaScriptCoreGeneratedCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops index 1d8e82d..77781cc 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\JavaScriptCoreCommon.vsprops; .\JavaScriptCoreCF.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops index e4612c3..5f31896 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\JavaScriptCoreCommon.vsprops; .\JavaScriptCoreCF.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops index 64699b5..1fc6aab 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; .\JavaScriptCoreCommon.vsprops; diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops index ada0b8e..2fd658a 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\JavaScriptCoreCommon.vsprops; .\JavaScriptCoreCF.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops index 3e207e7..907c9e5 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\JavaScriptCoreCommon.vsprops; .\JavaScriptCoreCF.vsprops; diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd new file mode 100755 index 0000000..e4075a4 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd @@ -0,0 +1,79 @@ +@echo off + +set PublicHeadersDirectory=%CONFIGURATIONBUILDDIR%\include\JavaScriptCore +set PrivateHeadersDirectory=%CONFIGURATIONBUILDDIR%\include\private\JavaScriptCore +set ResourcesDirectory=%CONFIGURATIONBUILDDIR%\bin\JavaScriptCore.resources + +if "%1" EQU "clean" goto :clean +if "%1" EQU "rebuild" call :clean + +echo Copying public headers... +mkdir "%PublicHeadersDirectory%" 2>NUL +for %%f in ( + APICast.h + APIShims.h + JSBase.h + JSContextRef.h + JSContextRefPrivate.h + JSObjectRef.h + JSObjectRefPrivate.h + JSRetainPtr.h + JSRetainPtr.h + JSStringRef.h + JSStringRefBSTR.h + JSStringRefCF.h + JSValueRef.h + JSWeakObjectMapRefInternal.h + JSWeakObjectMapRefPrivate.h + JavaScript.h + JavaScriptCore.h + OpaqueJSString.h + WebKitAvailability.h +) do ( + xcopy /y /d ..\..\API\%%f "%PublicHeadersDirectory%" >NUL +) + +echo Copying private headers... +mkdir "%PrivateHeadersDirectory%" 2>NUL +for %%d in ( + assembler + bytecode + heap + debugger + interpreter + jit + parser + profiler + runtime + wtf + wtf\text + wtf\unicode + wtf\unicode\icu + yarr +) do ( + xcopy /y /d ..\..\%%d\*.h "%PrivateHeadersDirectory%" >NUL +) + +echo Copying resources... +mkdir "%ResourcesDirectory%" 2>NUL +xcopy /y /d ..\JavaScriptCore.resources\* "%ResourcesDirectory%" >NUL + +echo Copying other files... +for %%f in ( + create_hash_table + wtf\text\AtomicString.cpp + wtf\text\StringBuilder.cpp + wtf\text\StringImpl.cpp + wtf\text\WTFString.cpp +) do ( + xcopy /y /d ..\..\%%f "%PrivateHeadersDirectory%" >NUL +) + +goto :EOF + +:clean + +echo Deleting copied files... +if exist "%PublicHeadersDirectory%" rmdir /s /q "%PublicHeadersDirectory%" >NUL +if exist "%PrivateHeadersDirectory%" rmdir /s /q "%PrivateHeadersDirectory%" >NUL +if exist "%ResourcesDirectory%" rmdir /s /q "%ResourcesDirectory%" >NUL diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py index aafe511..4552321 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py @@ -21,7 +21,7 @@ def main(): # Visual Studio isn't smart enough to figure out it needs to rebuild these file types when # .vsprops files change (even if we touch wtf/Platform.h below), so we delete them to force them # to be rebuilt. - for extension in ('manifest', 'pch', 'res'): + for extension in ('dep', 'manifest', 'pch', 'res'): for filepath in glob.iglob(os.path.join(obj_directory, '*', '*.%s' % extension)): delete_if_older_than(filepath, newest_vsprops_time) diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj index aa337b3..7c83339 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj @@ -509,6 +509,10 @@ </File> </Filter> <File + RelativePath="..\..\wtf\Alignment.h" + > + </File> + <File RelativePath="..\..\wtf\AlwaysInline.h" > </File> @@ -605,6 +609,14 @@ > </File> <File + RelativePath="..\..\wtf\DynamicAnnotations.cpp" + > + </File> + <File + RelativePath="..\..\wtf\DynamicAnnotations.h" + > + </File> + <File RelativePath="..\..\wtf\dtoa.cpp" > </File> diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFProduction.vsprops index 3de342c..842f6ea 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFProduction.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFProduction.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\WTFCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFRelease.vsprops index 3960f98..2050eec 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFRelease.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFRelease.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\WTFCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops index 3267d79..fc795a3 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; .\WTFCommon.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops index ac4f8a5..bc2aba9 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\WTFCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops index 604a66e..ac8a8fa 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops @@ -6,7 +6,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\";../../;"../../os-win32/";../../assembler/;../../API/;../../parser/;../../collector/handles/;../../runtime/;../../VM/;../../bytecode/;../../interpreter/;../../wtf/;../../debugger/;../../bytecompiler/;../../profiler;../../jit/;"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include"" + AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\";../../;"../../os-win32/";../../assembler/;../../API/;../../parser/;../../heap/;../../runtime/;../../VM/;../../bytecode/;../../interpreter/;../../wtf/;../../debugger/;../../bytecompiler/;../../profiler;../../jit/;"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include"" PreprocessorDefinitions="__STD_C" ForcedIncludeFiles="ICUVersion.h" ForcedUsingFiles="" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscProduction.vsprops index 408871b..26e9623 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscProduction.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscProduction.vsprops @@ -5,7 +5,7 @@ Name="jscProduction" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\jscCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscRelease.vsprops index ba9b288..493dd58 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscRelease.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscRelease.vsprops @@ -5,6 +5,7 @@ Name="jscRelease" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\jscCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops index 2104fe4..e4dd761 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops @@ -5,6 +5,7 @@ Name="jscReleaseCairoCFLite" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; .\jscCommon.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops index 78f3672..c610302 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops @@ -5,7 +5,7 @@ Name="jscReleasePGO" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\jscCommon.vsprops" > diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiProduction.vsprops index 03fceab..c79ee0c 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiProduction.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiProduction.vsprops @@ -5,7 +5,7 @@ Name="testapiProduction" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\testapiCommon.vsprops; ..\JavaScriptCore\JavaScriptCoreCF.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiRelease.vsprops index 1c041ff..42b1232 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiRelease.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiRelease.vsprops @@ -5,6 +5,7 @@ Name="testapiRelease" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\testapiCommon.vsprops; ..\JavaScriptCore\JavaScriptCoreCF.vsprops" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops index c025283..3036bf8 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops @@ -5,6 +5,7 @@ Name="testapiReleaseCairoCFLite" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; .\testapiCommon.vsprops; diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 44e108c..98c90e8 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -50,15 +50,10 @@ 0F29479C126E698C00B3ABF5 /* DecimalNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */; }; 1400067712A6F7830064D123 /* OSAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1400067612A6F7830064D123 /* OSAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */; }; - 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; 140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */; }; 140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */; }; 140566D6107EC271005DBC8D /* JSFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A85E0255597D01FF60F7 /* JSFunction.cpp */; }; 140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */; }; - 140CDC7C12DC09BF0013CFC5 /* MarkedSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 140CDC7612DBEA330013CFC5 /* MarkedSpace.cpp */; }; - 140CDE7012DE97A00013CFC5 /* Heap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 140CDE6C12DE977E0013CFC5 /* Heap.cpp */; }; - 140CDE7112DE97B10013CFC5 /* Heap.h in Headers */ = {isa = PBXBuildFile; fileRef = 140CDE6D12DE977E0013CFC5 /* Heap.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 140CDF0C12DECE5C0013CFC5 /* MarkedSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 140CDC7712DBEA330013CFC5 /* MarkedSpace.h */; settings = {ATTRIBUTES = (Private, ); }; }; 140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 141211310A48794D00480255 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; }; 141211340A48795800480255 /* minidom.c in Sources */ = {isa = PBXBuildFile; fileRef = 141211020A48780900480255 /* minidom.c */; }; @@ -74,7 +69,6 @@ 14280844107EC0930013E7B2 /* RegExpPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */; }; 14280850107EC0D70013E7B2 /* Operations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8770255597D01FF60F7 /* Operations.cpp */; }; 14280855107EC0E70013E7B2 /* GetterSetter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B80E184545000F9297 /* GetterSetter.cpp */; }; - 1428085D107EC0F80013E7B2 /* JSNumberCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B90E184580000F9297 /* JSNumberCell.cpp */; }; 14280863107EC11A0013E7B2 /* BooleanConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7952320E15EB5600A898AB /* BooleanConstructor.cpp */; }; 14280864107EC11A0013E7B2 /* BooleanObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8500255597D01FF60F7 /* BooleanObject.cpp */; }; 14280865107EC11A0013E7B2 /* BooleanPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */; }; @@ -90,6 +84,22 @@ 1429D92F0ED22D7000B89619 /* JIT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D92D0ED22D7000B89619 /* JIT.cpp */; }; 1429D9300ED22D7000B89619 /* JIT.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D92E0ED22D7000B89619 /* JIT.h */; }; 142D3939103E4560007DCB52 /* NumericStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D3938103E4560007DCB52 /* NumericStrings.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142D6F0813539A2800B02E86 /* MarkedBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142D6F0613539A2800B02E86 /* MarkedBlock.cpp */; }; + 142D6F0913539A2800B02E86 /* MarkedBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D6F0713539A2800B02E86 /* MarkedBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142D6F0C13539A2F00B02E86 /* MarkedSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142D6F0A13539A2F00B02E86 /* MarkedSpace.cpp */; }; + 142D6F0D13539A2F00B02E86 /* MarkedSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D6F0B13539A2F00B02E86 /* MarkedSpace.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142D6F1113539A4100B02E86 /* MarkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142D6F0E13539A4100B02E86 /* MarkStack.cpp */; }; + 142D6F1213539A4100B02E86 /* MarkStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D6F0F13539A4100B02E86 /* MarkStack.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142D6F1313539A4100B02E86 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142D6F1013539A4100B02E86 /* MarkStackPosix.cpp */; }; + 142E3134134FF0A600AFADB5 /* Handle.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E312B134FF0A600AFADB5 /* Handle.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142E3135134FF0A600AFADB5 /* HandleHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142E312C134FF0A600AFADB5 /* HandleHeap.cpp */; }; + 142E3136134FF0A600AFADB5 /* HandleHeap.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E312D134FF0A600AFADB5 /* HandleHeap.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142E3137134FF0A600AFADB5 /* HandleStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142E312E134FF0A600AFADB5 /* HandleStack.cpp */; }; + 142E3138134FF0A600AFADB5 /* HandleStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E312F134FF0A600AFADB5 /* HandleStack.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142E3139134FF0A600AFADB5 /* Local.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3130134FF0A600AFADB5 /* Local.h */; }; + 142E313A134FF0A600AFADB5 /* LocalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3131134FF0A600AFADB5 /* LocalScope.h */; }; + 142E313B134FF0A600AFADB5 /* Strong.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3132134FF0A600AFADB5 /* Strong.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 142E313C134FF0A600AFADB5 /* Weak.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3133134FF0A600AFADB5 /* Weak.h */; settings = {ATTRIBUTES = (Private, ); }; }; 143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; }; 1440057F0A5335640005F061 /* JSNode.c in Sources */ = {isa = PBXBuildFile; fileRef = 1440F6420A4F8B6A0005F061 /* JSNode.c */; }; 144005CB0A5338D10005F061 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F6410A4F8B6A0005F061 /* JSNode.h */; }; @@ -121,9 +131,9 @@ 14469DEC107EC7E700650446 /* StringObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C20E16EE3300B34460 /* StringObject.cpp */; }; 14469DED107EC7E700650446 /* StringPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */; }; 14469DEE107EC7E700650446 /* UString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* UString.cpp */; }; - 144836E7132DA7BE005BE785 /* ConservativeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 149DAAF212EB559D0083B12B /* ConservativeSet.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 144836E7132DA7BE005BE785 /* ConservativeRoots.h in Headers */ = {isa = PBXBuildFile; fileRef = 149DAAF212EB559D0083B12B /* ConservativeRoots.h */; settings = {ATTRIBUTES = (Private, ); }; }; 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; }; - 146B16D812EB5B59001BEC1B /* ConservativeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146B14DB12EB5B12001BEC1B /* ConservativeSet.cpp */; }; + 146B16D812EB5B59001BEC1B /* ConservativeRoots.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146B14DB12EB5B12001BEC1B /* ConservativeRoots.cpp */; }; 146FE51211A710430087AE66 /* JITCall32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146FE51111A710430087AE66 /* JITCall32_64.cpp */; }; 147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */; }; 147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -148,7 +158,6 @@ 147F39D0107EC37600427A48 /* JSArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */; }; 147F39D1107EC37600427A48 /* JSCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */; }; 147F39D2107EC37600427A48 /* JSGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */; }; - 147F39D3107EC37600427A48 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; }; 147F39D4107EC37600427A48 /* JSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC22A3980E16E14800AF21C8 /* JSObject.cpp */; }; 147F39D5107EC37600427A48 /* JSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B60E1842FA000F9297 /* JSString.cpp */; }; 147F39D6107EC37600427A48 /* JSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8870255597D01FF60F7 /* JSValue.cpp */; }; @@ -176,10 +185,11 @@ 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */; }; 14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A6581A0F4E36F4000150FD /* JITStubs.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 14C824AD12F7C785008F35E0 /* MarkedBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C824AC12F7C785008F35E0 /* MarkedBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */; }; 14F8BA3E107EC886009892DC /* FastMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */; }; 14F8BA43107EC88C009892DC /* TCSystemAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */; }; + 14FB986D135225410085A5DB /* Heap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FB986B135225410085A5DB /* Heap.cpp */; }; + 14FB986E135225410085A5DB /* Heap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FB986C135225410085A5DB /* Heap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FFF98C12BFFF7500795BB8 /* PageAllocationAligned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFF98A12BFFF7500795BB8 /* PageAllocationAligned.cpp */; }; 14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FFF98B12BFFF7500795BB8 /* PageAllocationAligned.h */; settings = {ATTRIBUTES = (Private, ); }; }; 180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 180B9AF00F16C569009BDBC5 /* CurrentTime.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -229,6 +239,7 @@ 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86438FC31265503E00E0DFCA /* StringBuilder.cpp */; }; 86565742115BE3DA00291F40 /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86565740115BE3DA00291F40 /* CString.cpp */; }; 86565743115BE3DA00291F40 /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = 86565741115BE3DA00291F40 /* CString.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 865A30F1135007E100CDB49E /* JSValueInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 865A30F0135007E100CDB49E /* JSValueInlineMethods.h */; settings = {ATTRIBUTES = (Private, ); }; }; 865F408810E7D56300947361 /* APIShims.h in Headers */ = {isa = PBXBuildFile; fileRef = 865F408710E7D56300947361 /* APIShims.h */; settings = {ATTRIBUTES = (Private, ); }; }; 86676D5211FED9BC004B6863 /* BumpPointerAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86704B4012DB8A8100A9FE7B /* YarrSyntaxChecker.cpp */; }; @@ -358,6 +369,7 @@ A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; }; A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A1D764521354448B00C5C7C0 /* Alignment.h in Headers */ = {isa = PBXBuildFile; fileRef = A1D764511354448B00C5C7C0 /* Alignment.h */; settings = {ATTRIBUTES = (Private, ); }; }; A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */; }; A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; }; A72701B90DADE94900E548D7 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; }; @@ -372,16 +384,10 @@ A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; }; A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74B3498102A5F8E0032AB98 /* MarkStack.cpp */; }; A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */; }; A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */; }; A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A76BE39F132EEA7C008F7F0B /* HandleStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A76BE1B7132DAC68008F7F0B /* HandleStack.cpp */; }; - A76BE3A0132EEA7C008F7F0B /* HandleStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A76BE1B8132DAC68008F7F0B /* HandleStack.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A76BE3A1132EEA7C008F7F0B /* Local.h in Headers */ = {isa = PBXBuildFile; fileRef = A76BE1B5132DABF5008F7F0B /* Local.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A76BE3A2132EEA7C008F7F0B /* LocalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = A76BE1B6132DAC24008F7F0B /* LocalScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A76C51741182748D00715B05 /* JSInterfaceJIT.h */; }; - A7795590101A74D500114E55 /* MarkStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A779558F101A74D500114E55 /* MarkStack.h */; settings = {ATTRIBUTES = (Private, ); }; }; A783A0D111A36DCA00563D20 /* JSObjectWithGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */; }; A784A26111D16622005776AC /* ASTBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */; }; @@ -392,21 +398,15 @@ A791EF290F11E07900AE1F68 /* JSByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A791EF270F11E07900AE1F68 /* JSByteArray.cpp */; }; A7A1F7AC0F252B3C00E184E2 /* ByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */; }; A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A7AC25BD1304D146003396DE /* MarkedBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14C824AA12F7C77E008F35E0 /* MarkedBlock.cpp */; }; A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; }; A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; }; A7C40C0A130B057D00D002A1 /* BlockStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C40C07130B057D00D002A1 /* BlockStack.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7C40C0B130B057D00D002A1 /* SentinelLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7C40C0C130B057D00D002A1 /* SinglyLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */; }; A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D649A91015224E009B2E1B /* PossiblyNull.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DCB77912E3D90500911940 /* WriteBarrier.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; }; A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */; }; - A7E4FC8F12F8E4CA00AF4CF4 /* Global.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E4FC8712F8E4CA00AF4CF4 /* Global.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A7E4FC9012F8E4CA00AF4CF4 /* Handle.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E4FC8812F8E4CA00AF4CF4 /* Handle.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A7E4FC9112F8E4CA00AF4CF4 /* HandleHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E4FC8912F8E4CA00AF4CF4 /* HandleHeap.cpp */; }; - A7E4FC9212F8E4CA00AF4CF4 /* HandleHeap.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E4FC8A12F8E4CA00AF4CF4 /* HandleHeap.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7F19ECE11DD490900931E70 /* FixedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F19ECD11DD490900931E70 /* FixedArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; }; A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; }; @@ -471,7 +471,6 @@ BC18C41F0E16F5CD00B34460 /* JSFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A85F0255597D01FF60F7 /* JSFunction.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4200E16F5CD00B34460 /* JSGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E3A560DF9278C00D90B34 /* JSGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894330CD0603F00367179 /* JSGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; - BC18C4220E16F5CD00B34460 /* JSImmediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1483B589099BC1950016E4F0 /* JSImmediate.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA4C9A092AF9E20093D800 /* JSLock.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC22A3990E16E14800AF21C8 /* JSObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B7E10A43076000517CFC /* JSObjectRef.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -559,7 +558,6 @@ BC5F7BC011823B590052C02C /* ThreadSafeRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */; }; - BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC87CDB810712ACA000614CF /* JSONObject.lut.h */; }; BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9041470EB9250900FE26FA /* StructureTransitionTable.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC95437D0EBA70FD0072B6D3 /* PropertyMapHashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -579,6 +577,7 @@ BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFD8C900EEB2EE700283848 /* JumpTable.cpp */; }; BCFD8C930EEB2EE700283848 /* JumpTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFD8C910EEB2EE700283848 /* JumpTable.h */; }; C0A272630E50A06300E96E15 /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = C0A2723F0E509F1E00E96E15 /* NotFound.h */; settings = {ATTRIBUTES = (Private, ); }; }; + D7A46A4F1338FFEA00ED695C /* DynamicAnnotations.h in Headers */ = {isa = PBXBuildFile; fileRef = D75AF59612F8CB9500FC0ADF /* DynamicAnnotations.h */; settings = {ATTRIBUTES = (Private, ); }; }; DD377CBC12072C18006A2517 /* Bitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = DD377CBB12072C18006A2517 /* Bitmap.h */; settings = {ATTRIBUTES = (Private, ); }; }; DDF7ABD411F60ED200108E36 /* GCActivityCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */; settings = {ATTRIBUTES = (Private, ); }; }; DDF7ABD511F60ED200108E36 /* GCActivityCallbackCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */; }; @@ -704,11 +703,6 @@ 0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecimalNumber.cpp; sourceTree = "<group>"; }; 1400067612A6F7830064D123 /* OSAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSAllocator.h; sourceTree = "<group>"; }; 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; }; - 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCPtr.h; sourceTree = "<group>"; }; - 140CDC7612DBEA330013CFC5 /* MarkedSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedSpace.cpp; sourceTree = "<group>"; }; - 140CDC7712DBEA330013CFC5 /* MarkedSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedSpace.h; sourceTree = "<group>"; }; - 140CDE6C12DE977E0013CFC5 /* Heap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Heap.cpp; sourceTree = "<group>"; }; - 140CDE6D12DE977E0013CFC5 /* Heap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Heap.h; sourceTree = "<group>"; }; 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasePrivate.h; sourceTree = "<group>"; }; 141211020A48780900480255 /* minidom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = minidom.c; path = tests/minidom.c; sourceTree = "<group>"; }; 1412110D0A48788700480255 /* minidom.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = minidom.js; path = tests/minidom.js; sourceTree = "<group>"; }; @@ -728,6 +722,22 @@ 1429D92D0ED22D7000B89619 /* JIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JIT.cpp; sourceTree = "<group>"; }; 1429D92E0ED22D7000B89619 /* JIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JIT.h; sourceTree = "<group>"; }; 142D3938103E4560007DCB52 /* NumericStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumericStrings.h; sourceTree = "<group>"; }; + 142D6F0613539A2800B02E86 /* MarkedBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedBlock.cpp; sourceTree = "<group>"; }; + 142D6F0713539A2800B02E86 /* MarkedBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedBlock.h; sourceTree = "<group>"; }; + 142D6F0A13539A2F00B02E86 /* MarkedSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedSpace.cpp; sourceTree = "<group>"; }; + 142D6F0B13539A2F00B02E86 /* MarkedSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedSpace.h; sourceTree = "<group>"; }; + 142D6F0E13539A4100B02E86 /* MarkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStack.cpp; sourceTree = "<group>"; }; + 142D6F0F13539A4100B02E86 /* MarkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStack.h; sourceTree = "<group>"; }; + 142D6F1013539A4100B02E86 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; }; + 142E312B134FF0A600AFADB5 /* Handle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Handle.h; sourceTree = "<group>"; }; + 142E312C134FF0A600AFADB5 /* HandleHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HandleHeap.cpp; sourceTree = "<group>"; }; + 142E312D134FF0A600AFADB5 /* HandleHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleHeap.h; sourceTree = "<group>"; }; + 142E312E134FF0A600AFADB5 /* HandleStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HandleStack.cpp; sourceTree = "<group>"; }; + 142E312F134FF0A600AFADB5 /* HandleStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleStack.h; sourceTree = "<group>"; }; + 142E3130134FF0A600AFADB5 /* Local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Local.h; sourceTree = "<group>"; }; + 142E3131134FF0A600AFADB5 /* LocalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalScope.h; sourceTree = "<group>"; }; + 142E3132134FF0A600AFADB5 /* Strong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strong.h; sourceTree = "<group>"; }; + 142E3133134FF0A600AFADB5 /* Weak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Weak.h; sourceTree = "<group>"; }; 1440051F0A531D3B0005F061 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node.h; path = tests/Node.h; sourceTree = "<group>"; }; 144005200A531D3B0005F061 /* Node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Node.c; path = tests/Node.c; sourceTree = "<group>"; }; 144007480A536CC20005F061 /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NodeList.h; path = tests/NodeList.h; sourceTree = "<group>"; }; @@ -746,9 +756,8 @@ 145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; }; 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; }; 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; }; - 146B14DB12EB5B12001BEC1B /* ConservativeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConservativeSet.cpp; sourceTree = "<group>"; }; + 146B14DB12EB5B12001BEC1B /* ConservativeRoots.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConservativeRoots.cpp; sourceTree = "<group>"; }; 146FE51111A710430087AE66 /* JITCall32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall32_64.cpp; sourceTree = "<group>"; }; - 14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; }; 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BatchedTransitionOptimizer.h; sourceTree = "<group>"; }; 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutPropertySlot.h; sourceTree = "<group>"; }; 1480DB9B0DDC227F003CFDF2 /* DebuggerCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerCallFrame.h; sourceTree = "<group>"; }; @@ -764,7 +773,7 @@ 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContextRefPrivate.h; sourceTree = "<group>"; }; 149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerCallFrame.cpp; sourceTree = "<group>"; }; 149B24FF0D8AF6D1009CB8C7 /* Register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Register.h; sourceTree = "<group>"; }; - 149DAAF212EB559D0083B12B /* ConservativeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConservativeSet.h; sourceTree = "<group>"; }; + 149DAAF212EB559D0083B12B /* ConservativeRoots.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConservativeRoots.h; sourceTree = "<group>"; }; 14A1563010966365006FA260 /* DateInstanceCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstanceCache.h; sourceTree = "<group>"; }; 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITStubs.cpp; sourceTree = "<group>"; }; 14A396A60CD2933100B5B4FF /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; }; @@ -786,14 +795,14 @@ 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSValueRef.cpp; sourceTree = "<group>"; }; 14BD5A2D0A3E91F600BAF59C /* testapi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testapi.c; path = API/tests/testapi.c; sourceTree = "<group>"; }; 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMap.h; sourceTree = "<group>"; }; - 14C824AA12F7C77E008F35E0 /* MarkedBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedBlock.cpp; sourceTree = "<group>"; }; - 14C824AC12F7C785008F35E0 /* MarkedBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedBlock.h; sourceTree = "<group>"; }; 14D792640DAA03FB001A9F05 /* RegisterFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterFile.h; sourceTree = "<group>"; }; 14D857740A4696C80032146C /* testapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = testapi.js; path = API/tests/testapi.js; sourceTree = "<group>"; }; 14DA818E0D99FD2000B0A4FB /* JSActivation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSActivation.h; sourceTree = "<group>"; }; 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSActivation.cpp; sourceTree = "<group>"; }; 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObject.cpp; sourceTree = "<group>"; }; 14F252560D08DD8D004ECFFF /* JSVariableObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVariableObject.h; sourceTree = "<group>"; }; + 14FB986B135225410085A5DB /* Heap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Heap.cpp; sourceTree = "<group>"; }; + 14FB986C135225410085A5DB /* Heap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Heap.h; sourceTree = "<group>"; }; 14FFF98A12BFFF7500795BB8 /* PageAllocationAligned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageAllocationAligned.cpp; sourceTree = "<group>"; }; 14FFF98B12BFFF7500795BB8 /* PageAllocationAligned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocationAligned.h; sourceTree = "<group>"; }; 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurrentTime.cpp; sourceTree = "<group>"; }; @@ -893,6 +902,7 @@ 86438FC31265503E00E0DFCA /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = text/StringBuilder.cpp; sourceTree = "<group>"; }; 86565740115BE3DA00291F40 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = text/CString.cpp; sourceTree = "<group>"; }; 86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = "<group>"; }; + 865A30F0135007E100CDB49E /* JSValueInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueInlineMethods.h; sourceTree = "<group>"; }; 865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = "<group>"; }; 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpPointerAllocator.h; sourceTree = "<group>"; }; 86704B4012DB8A8100A9FE7B /* YarrSyntaxChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YarrSyntaxChecker.cpp; path = yarr/YarrSyntaxChecker.cpp; sourceTree = "<group>"; }; @@ -1056,6 +1066,7 @@ A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; }; A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; }; A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; }; + A1D764511354448B00C5C7C0 /* Alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alignment.h; sourceTree = "<group>"; }; A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; }; A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; }; A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = create_regex_tables; sourceTree = "<group>"; }; @@ -1072,15 +1083,9 @@ A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; }; A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; }; A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefInternal.h; sourceTree = "<group>"; }; - A74B3498102A5F8E0032AB98 /* MarkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStack.cpp; sourceTree = "<group>"; }; A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMv7Assembler.cpp; sourceTree = "<group>"; }; A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITArithmetic32_64.cpp; sourceTree = "<group>"; }; - A76BE1B5132DABF5008F7F0B /* Local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Local.h; path = collector/handles/Local.h; sourceTree = "<group>"; }; - A76BE1B6132DAC24008F7F0B /* LocalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LocalScope.h; path = collector/handles/LocalScope.h; sourceTree = "<group>"; }; - A76BE1B7132DAC68008F7F0B /* HandleStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HandleStack.cpp; path = collector/handles/HandleStack.cpp; sourceTree = "<group>"; }; - A76BE1B8132DAC68008F7F0B /* HandleStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HandleStack.h; path = collector/handles/HandleStack.h; sourceTree = "<group>"; }; A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; }; - A779558F101A74D500114E55 /* MarkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStack.h; sourceTree = "<group>"; }; A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectWithGlobalObject.h; sourceTree = "<group>"; }; A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectWithGlobalObject.cpp; sourceTree = "<group>"; }; A791EF260F11E07900AE1F68 /* JSByteArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSByteArray.h; sourceTree = "<group>"; }; @@ -1098,17 +1103,12 @@ A7C40C07130B057D00D002A1 /* BlockStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockStack.h; sourceTree = "<group>"; }; A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentinelLinkedList.h; sourceTree = "<group>"; }; A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinglyLinkedList.h; sourceTree = "<group>"; }; - A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; }; A7D649A91015224E009B2E1B /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.h; sourceTree = "<group>"; }; A7DCB77912E3D90500911940 /* WriteBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WriteBarrier.h; sourceTree = "<group>"; }; A7E2EA690FB460CF00601F06 /* LiteralParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralParser.h; sourceTree = "<group>"; }; A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralParser.cpp; sourceTree = "<group>"; }; A7E42C180E3938830065A544 /* JSStaticScopeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStaticScopeObject.h; sourceTree = "<group>"; }; A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStaticScopeObject.cpp; sourceTree = "<group>"; }; - A7E4FC8712F8E4CA00AF4CF4 /* Global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Global.h; path = collector/handles/Global.h; sourceTree = "<group>"; }; - A7E4FC8812F8E4CA00AF4CF4 /* Handle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Handle.h; path = collector/handles/Handle.h; sourceTree = "<group>"; }; - A7E4FC8912F8E4CA00AF4CF4 /* HandleHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HandleHeap.cpp; path = collector/handles/HandleHeap.cpp; sourceTree = "<group>"; }; - A7E4FC8A12F8E4CA00AF4CF4 /* HandleHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HandleHeap.h; path = collector/handles/HandleHeap.h; sourceTree = "<group>"; }; A7F19ECD11DD490900931E70 /* FixedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixedArray.h; sourceTree = "<group>"; }; A7F8690E0F9584A100558697 /* CachedCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedCall.h; sourceTree = "<group>"; }; A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameClosure.h; sourceTree = "<group>"; }; @@ -1132,7 +1132,6 @@ BC02E98B0E183E38000F9297 /* ErrorInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorInstance.h; sourceTree = "<group>"; }; BC02E9B60E1842FA000F9297 /* JSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSString.cpp; sourceTree = "<group>"; }; BC02E9B80E184545000F9297 /* GetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetterSetter.cpp; sourceTree = "<group>"; }; - BC02E9B90E184580000F9297 /* JSNumberCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNumberCell.cpp; sourceTree = "<group>"; }; BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAPIValueWrapper.cpp; path = ../runtime/JSAPIValueWrapper.cpp; sourceTree = "<group>"; }; BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAPIValueWrapper.h; path = ../runtime/JSAPIValueWrapper.h; sourceTree = "<group>"; }; BC1166000E1997B1008066DD /* DateInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateInstance.cpp; sourceTree = "<group>"; }; @@ -1184,7 +1183,6 @@ BC7952330E15EB5600A898AB /* BooleanConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanConstructor.h; sourceTree = "<group>"; }; BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanPrototype.cpp; sourceTree = "<group>"; }; BC7952350E15EB5600A898AB /* BooleanPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanPrototype.h; sourceTree = "<group>"; }; - BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNumberCell.h; sourceTree = "<group>"; }; BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCell.cpp; sourceTree = "<group>"; }; BC8149AF12F89F53007B2C32 /* HeaderDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeaderDetection.h; sourceTree = "<group>"; }; BC87CDB810712ACA000614CF /* JSONObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.lut.h; sourceTree = "<group>"; }; @@ -1218,6 +1216,8 @@ C0A2723F0E509F1E00E96E15 /* NotFound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotFound.h; sourceTree = "<group>"; }; D21202280AD4310C00ED79B6 /* DateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DateConversion.cpp; sourceTree = "<group>"; }; D21202290AD4310C00ED79B6 /* DateConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateConversion.h; sourceTree = "<group>"; }; + D75AF59512F8CB9500FC0ADF /* DynamicAnnotations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicAnnotations.cpp; sourceTree = "<group>"; }; + D75AF59612F8CB9500FC0ADF /* DynamicAnnotations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicAnnotations.h; sourceTree = "<group>"; }; DD377CBB12072C18006A2517 /* Bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bitmap.h; sourceTree = "<group>"; }; DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCActivityCallback.h; sourceTree = "<group>"; }; DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GCActivityCallbackCF.cpp; sourceTree = "<group>"; }; @@ -1364,9 +1364,9 @@ 9688CB120ED12B4E001D649F /* assembler */, 969A078F0ED1D3AE00F1F681 /* bytecode */, 7E39D81D0EC38EFA003AF11A /* bytecompiler */, - A7E4FC8312F8E4A300AF4CF4 /* collector */, 1480DB9A0DDC2231003CFDF2 /* debugger */, 86EC9DB31328DF44002B2AD7 /* dfg */, + 142E312A134FF0A600AFADB5 /* heap */, 1429D77A0ED20D7300B89619 /* interpreter */, 1429D92C0ED22D7000B89619 /* jit */, 7E39D8370EC3A388003AF11A /* parser */, @@ -1455,6 +1455,35 @@ path = jit; sourceTree = "<group>"; }; + 142E312A134FF0A600AFADB5 /* heap */ = { + isa = PBXGroup; + children = ( + 146B14DB12EB5B12001BEC1B /* ConservativeRoots.cpp */, + 149DAAF212EB559D0083B12B /* ConservativeRoots.h */, + 142E312B134FF0A600AFADB5 /* Handle.h */, + 142E312C134FF0A600AFADB5 /* HandleHeap.cpp */, + 142E312D134FF0A600AFADB5 /* HandleHeap.h */, + 142E312E134FF0A600AFADB5 /* HandleStack.cpp */, + 142E312F134FF0A600AFADB5 /* HandleStack.h */, + 14FB986B135225410085A5DB /* Heap.cpp */, + 14FB986C135225410085A5DB /* Heap.h */, + 142E3130134FF0A600AFADB5 /* Local.h */, + 142E3131134FF0A600AFADB5 /* LocalScope.h */, + 14B7233F12D7D0DA003BD5ED /* MachineStackMarker.cpp */, + 14B7234012D7D0DA003BD5ED /* MachineStackMarker.h */, + 142D6F0613539A2800B02E86 /* MarkedBlock.cpp */, + 142D6F0713539A2800B02E86 /* MarkedBlock.h */, + 142D6F0A13539A2F00B02E86 /* MarkedSpace.cpp */, + 142D6F0B13539A2F00B02E86 /* MarkedSpace.h */, + 142D6F0E13539A4100B02E86 /* MarkStack.cpp */, + 142D6F0F13539A4100B02E86 /* MarkStack.h */, + 142D6F1013539A4100B02E86 /* MarkStackPosix.cpp */, + 142E3132134FF0A600AFADB5 /* Strong.h */, + 142E3133134FF0A600AFADB5 /* Weak.h */, + ); + path = heap; + sourceTree = "<group>"; + }; 1432EBD70A34CAD400717B9F /* API */ = { isa = PBXGroup; children = ( @@ -1573,6 +1602,7 @@ 65162EF108E6A21C007556CD /* wtf */ = { isa = PBXGroup; children = ( + A1D764511354448B00C5C7C0 /* Alignment.h */, A7C40C07130B057D00D002A1 /* BlockStack.h */, A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */, A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */, @@ -1603,6 +1633,8 @@ 14456A311314657800212CA3 /* DoublyLinkedList.h */, 651F6412039D5B5F0078395C /* dtoa.cpp */, 651F6413039D5B5F0078395C /* dtoa.h */, + D75AF59512F8CB9500FC0ADF /* DynamicAnnotations.cpp */, + D75AF59612F8CB9500FC0ADF /* DynamicAnnotations.h */, E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */, 65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */, 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */, @@ -1771,8 +1803,6 @@ 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */, 969A09220ED1E09C00F1F681 /* Completion.cpp */, F5BB2BC5030F772101FCFE1D /* Completion.h */, - 146B14DB12EB5B12001BEC1B /* ConservativeSet.cpp */, - 149DAAF212EB559D0083B12B /* ConservativeSet.h */, BCA62DFF0E2826310004F30D /* ConstructData.cpp */, BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */, BCD203450E17135E002C7E82 /* DateConstructor.cpp */, @@ -1804,8 +1834,6 @@ DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */, BC02E9B80E184545000F9297 /* GetterSetter.cpp */, BC337BDE0E1AF0B80076918A /* GetterSetter.h */, - 140CDE6C12DE977E0013CFC5 /* Heap.cpp */, - 140CDE6D12DE977E0013CFC5 /* Heap.h */, 933A349D038AE80F008635CE /* Identifier.cpp */, 933A349A038AE7C6008635CE /* Identifier.h */, E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */, @@ -1828,14 +1856,11 @@ A8E894330CD0603F00367179 /* JSGlobalObject.h */, BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */, BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */, - 14760863099C633800437128 /* JSImmediate.cpp */, 1483B589099BC1950016E4F0 /* JSImmediate.h */, 65EA4C99092AF9E20093D800 /* JSLock.cpp */, 65EA4C9A092AF9E20093D800 /* JSLock.h */, A72700780DAC605600E548D7 /* JSNotAnObject.cpp */, A72700770DAC605600E548D7 /* JSNotAnObject.h */, - BC02E9B90E184580000F9297 /* JSNumberCell.cpp */, - BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */, BC22A3980E16E14800AF21C8 /* JSObject.cpp */, BC22A3990E16E14800AF21C8 /* JSObject.h */, A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */, @@ -1853,6 +1878,7 @@ 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */, F692A8870255597D01FF60F7 /* JSValue.cpp */, 14ABB36E099C076400E2A24F /* JSValue.h */, + 865A30F0135007E100CDB49E /* JSValueInlineMethods.h */, BC22A39A0E16E14800AF21C8 /* JSVariableObject.cpp */, 14F252560D08DD8D004ECFFF /* JSVariableObject.h */, 65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */, @@ -1863,15 +1889,6 @@ A7E2EA690FB460CF00601F06 /* LiteralParser.h */, F692A8680255597D01FF60F7 /* Lookup.cpp */, F692A8690255597D01FF60F7 /* Lookup.h */, - 14B7233F12D7D0DA003BD5ED /* MachineStackMarker.cpp */, - 14B7234012D7D0DA003BD5ED /* MachineStackMarker.h */, - 14C824AA12F7C77E008F35E0 /* MarkedBlock.cpp */, - 14C824AC12F7C785008F35E0 /* MarkedBlock.h */, - 140CDC7612DBEA330013CFC5 /* MarkedSpace.cpp */, - 140CDC7712DBEA330013CFC5 /* MarkedSpace.h */, - A74B3498102A5F8E0032AB98 /* MarkStack.cpp */, - A779558F101A74D500114E55 /* MarkStack.h */, - A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */, F692A86A0255597D01FF60F7 /* MathObject.cpp */, F692A86B0255597D01FF60F7 /* MathObject.h */, 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */, @@ -1948,7 +1965,6 @@ 08DDA5BB12645F1D00751732 /* UStringBuilder.h */, 0896C29B1265AAF600B1CDD3 /* UStringConcatenate.h */, 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */, - 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */, 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */, A7DCB77912E3D90500911940 /* WriteBarrier.h */, ); @@ -2136,29 +2152,6 @@ name = api; sourceTree = "<group>"; }; - A7E4FC8312F8E4A300AF4CF4 /* collector */ = { - isa = PBXGroup; - children = ( - A7E4FC8512F8E4B100AF4CF4 /* handles */, - ); - name = collector; - sourceTree = "<group>"; - }; - A7E4FC8512F8E4B100AF4CF4 /* handles */ = { - isa = PBXGroup; - children = ( - A7E4FC8712F8E4CA00AF4CF4 /* Global.h */, - A7E4FC8812F8E4CA00AF4CF4 /* Handle.h */, - A7E4FC8912F8E4CA00AF4CF4 /* HandleHeap.cpp */, - A7E4FC8A12F8E4CA00AF4CF4 /* HandleHeap.h */, - A76BE1B7132DAC68008F7F0B /* HandleStack.cpp */, - A76BE1B8132DAC68008F7F0B /* HandleStack.h */, - A76BE1B5132DABF5008F7F0B /* Local.h */, - A76BE1B6132DAC24008F7F0B /* LocalScope.h */, - ); - name = handles; - sourceTree = "<group>"; - }; E195678D09E7CF1200B89D13 /* unicode */ = { isa = PBXGroup; children = ( @@ -2224,6 +2217,8 @@ BC18C3EB0E16F5CD00B34460 /* AVLTree.h in Headers */, 147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */, DD377CBC12072C18006A2517 /* Bitmap.h in Headers */, + A7C40C0A130B057D00D002A1 /* BlockStack.h in Headers */, + E4D8CEFB12FC439600BC9F5A /* BloomFilter.h in Headers */, BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */, 86676D5211FED9BC004B6863 /* BumpPointerAllocator.h in Headers */, A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */, @@ -2241,9 +2236,10 @@ BC18C3F40E16F5CD00B34460 /* Completion.h in Headers */, FDA15C1E12B0305C003A583A /* Complex.h in Headers */, BC18C3F50E16F5CD00B34460 /* config.h in Headers */, - 144836E7132DA7BE005BE785 /* ConservativeSet.h in Headers */, + 144836E7132DA7BE005BE785 /* ConservativeRoots.h in Headers */, BC18C3F60E16F5CD00B34460 /* ConstructData.h in Headers */, 0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */, + 97941A7F1302A098004A3447 /* CryptographicallyRandomNumber.h in Headers */, 86565743115BE3DA00291F40 /* CString.h in Headers */, 180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */, BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */, @@ -2259,9 +2255,24 @@ 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */, 5135FAF212D26ACE003C083B /* Decoder.h in Headers */, BC18C3FC0E16F5CD00B34460 /* Deque.h in Headers */, + 86ECA4F1132EAA6D002B2AD7 /* DFGAliasTracker.h in Headers */, + 86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */, + 86EC9DC61328DF82002B2AD7 /* DFGGenerationInfo.h in Headers */, + 86EC9DC81328DF82002B2AD7 /* DFGGraph.h in Headers */, + 86EC9DCA1328DF82002B2AD7 /* DFGJITCodeGenerator.h in Headers */, + 86EC9DCC1328DF82002B2AD7 /* DFGJITCompiler.h in Headers */, + 86ECA3EA132DEF1C002B2AD7 /* DFGNode.h in Headers */, + 86EC9DCE1328DF82002B2AD7 /* DFGNonSpeculativeJIT.h in Headers */, + 142E3136134FF0A600AFADB5 /* HandleHeap.h in Headers */, + 142E3138134FF0A600AFADB5 /* HandleStack.h in Headers */, + 86EC9DD01328DF82002B2AD7 /* DFGOperations.h in Headers */, + 86EC9DD11328DF82002B2AD7 /* DFGRegisterBank.h in Headers */, + 86ECA3FA132DF25A002B2AD7 /* DFGScoreBoard.h in Headers */, + 86EC9DD31328DF82002B2AD7 /* DFGSpeculativeJIT.h in Headers */, BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */, 14456A321314657800212CA3 /* DoublyLinkedList.h in Headers */, BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */, + D7A46A4F1338FFEA00ED695C /* DynamicAnnotations.h in Headers */, 5135FAF312D26AD1003C083B /* Encoder.h in Headers */, BC3046070E1F497F003232CF /* Error.h in Headers */, BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */, @@ -2285,8 +2296,8 @@ BC18C40B0E16F5CD00B34460 /* HashMap.h in Headers */, BC18C40C0E16F5CD00B34460 /* HashSet.h in Headers */, BC18C40D0E16F5CD00B34460 /* HashTable.h in Headers */, + 142E3134134FF0A600AFADB5 /* Handle.h in Headers */, BC18C40E0E16F5CD00B34460 /* HashTraits.h in Headers */, - 140CDE7112DE97B10013CFC5 /* Heap.h in Headers */, 7186A6EC13100BA5004479E1 /* HexNumber.h in Headers */, BC18C40F0E16F5CD00B34460 /* Identifier.h in Headers */, BC18C4100E16F5CD00B34460 /* InitializeThreading.h in Headers */, @@ -2319,10 +2330,8 @@ BC18C4200E16F5CD00B34460 /* JSGlobalData.h in Headers */, BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */, BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */, - BC18C4220E16F5CD00B34460 /* JSImmediate.h in Headers */, A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */, BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */, - BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */, BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */, BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */, A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */, @@ -2354,6 +2363,8 @@ BC18C4340E16F5CD00B34460 /* ListHashSet.h in Headers */, BC18C4350E16F5CD00B34460 /* ListRefPtr.h in Headers */, A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */, + 142E3139134FF0A600AFADB5 /* Local.h in Headers */, + 142E313A134FF0A600AFADB5 /* LocalScope.h in Headers */, BC18C4360E16F5CD00B34460 /* Locker.h in Headers */, BC18C4370E16F5CD00B34460 /* Lookup.h in Headers */, 14B723B812D7DA6F003BD5ED /* MachineStackMarker.h in Headers */, @@ -2367,8 +2378,6 @@ 860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */, BC18C4390E16F5CD00B34460 /* MainThread.h in Headers */, BC18C43A0E16F5CD00B34460 /* MallocZoneSupport.h in Headers */, - 140CDF0C12DECE5C0013CFC5 /* MarkedSpace.h in Headers */, - A7795590101A74D500114E55 /* MarkStack.h in Headers */, BC18C43B0E16F5CD00B34460 /* MathExtras.h in Headers */, BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */, BC18C52A0E16FCC200B34460 /* MathObject.lut.h in Headers */, @@ -2395,6 +2404,7 @@ 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */, BC18C4480E16F5CD00B34460 /* Operations.h in Headers */, 1400067712A6F7830064D123 /* OSAllocator.h in Headers */, + 97941A5A13029ACC004A3447 /* OSRandomSource.h in Headers */, BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */, 0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */, BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */, @@ -2447,10 +2457,14 @@ 1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */, BC18C4610E16F5CD00B34460 /* ScopeChain.h in Headers */, 969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */, + A7C40C0B130B057D00D002A1 /* SentinelLinkedList.h in Headers */, 76FB9F0F12E851860051A2EB /* SHA1.h in Headers */, + A7C40C0C130B057D00D002A1 /* SinglyLinkedList.h in Headers */, 933040040E6A749400786E6A /* SmallStrings.h in Headers */, BC18C4640E16F5CD00B34460 /* SourceCode.h in Headers */, BC18C4630E16F5CD00B34460 /* SourceProvider.h in Headers */, + E49DC16C12EF294E00184A1F /* SourceProviderCache.h in Headers */, + E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */, A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */, 86D87DDB12BCAF94008E73A1 /* StackBounds.h in Headers */, 868BFA60117D048200B908B1 /* StaticConstructors.h in Headers */, @@ -2469,6 +2483,7 @@ BC18C4690E16F5CD00B34460 /* StringObjectThatMasqueradesAsUndefined.h in Headers */, BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */, BC18C5260E16FCA700B34460 /* StringPrototype.lut.h in Headers */, + 142E313B134FF0A600AFADB5 /* Strong.h in Headers */, BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */, 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */, BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */, @@ -2505,48 +2520,27 @@ BC18C4780E16F5CD00B34460 /* Vector.h in Headers */, BC18C4790E16F5CD00B34460 /* VectorTraits.h in Headers */, 96DD73790F9DA3100027FBCC /* VMTags.h in Headers */, + 142E313C134FF0A600AFADB5 /* Weak.h in Headers */, 14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */, - 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */, 1420BE7B10AA6DDB00F455D2 /* WeakRandom.h in Headers */, BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */, + A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */, 868BFA18117CF19900B908B1 /* WTFString.h in Headers */, 86D08D5411793613006E5ED0 /* WTFThreadData.h in Headers */, 9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */, + 451539B912DC994500EF7AC4 /* Yarr.h in Headers */, 86704B8512DBA33700A9FE7B /* YarrInterpreter.h in Headers */, 86704B8712DBA33700A9FE7B /* YarrJIT.h in Headers */, 86704B8812DBA33700A9FE7B /* YarrParser.h in Headers */, 86704B8A12DBA33700A9FE7B /* YarrPattern.h in Headers */, 86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */, 5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */, - 451539B912DC994500EF7AC4 /* Yarr.h in Headers */, - A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */, - E49DC16C12EF294E00184A1F /* SourceProviderCache.h in Headers */, - E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */, - 14C824AD12F7C785008F35E0 /* MarkedBlock.h in Headers */, - E4D8CEFB12FC439600BC9F5A /* BloomFilter.h in Headers */, - 97941A5A13029ACC004A3447 /* OSRandomSource.h in Headers */, - 97941A7F1302A098004A3447 /* CryptographicallyRandomNumber.h in Headers */, - A7E4FC8F12F8E4CA00AF4CF4 /* Global.h in Headers */, - A7E4FC9012F8E4CA00AF4CF4 /* Handle.h in Headers */, - A7E4FC9212F8E4CA00AF4CF4 /* HandleHeap.h in Headers */, - A7C40C0A130B057D00D002A1 /* BlockStack.h in Headers */, - A7C40C0B130B057D00D002A1 /* SentinelLinkedList.h in Headers */, - A7C40C0C130B057D00D002A1 /* SinglyLinkedList.h in Headers */, - A76BE3A0132EEA7C008F7F0B /* HandleStack.h in Headers */, - A76BE3A1132EEA7C008F7F0B /* Local.h in Headers */, - A76BE3A2132EEA7C008F7F0B /* LocalScope.h in Headers */, - 86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */, - 86EC9DC61328DF82002B2AD7 /* DFGGenerationInfo.h in Headers */, - 86EC9DC81328DF82002B2AD7 /* DFGGraph.h in Headers */, - 86EC9DCA1328DF82002B2AD7 /* DFGJITCodeGenerator.h in Headers */, - 86EC9DCC1328DF82002B2AD7 /* DFGJITCompiler.h in Headers */, - 86EC9DCE1328DF82002B2AD7 /* DFGNonSpeculativeJIT.h in Headers */, - 86EC9DD01328DF82002B2AD7 /* DFGOperations.h in Headers */, - 86EC9DD11328DF82002B2AD7 /* DFGRegisterBank.h in Headers */, - 86EC9DD31328DF82002B2AD7 /* DFGSpeculativeJIT.h in Headers */, - 86ECA3EA132DEF1C002B2AD7 /* DFGNode.h in Headers */, - 86ECA3FA132DF25A002B2AD7 /* DFGScoreBoard.h in Headers */, - 86ECA4F1132EAA6D002B2AD7 /* DFGAliasTracker.h in Headers */, + 14FB986E135225410085A5DB /* Heap.h in Headers */, + 865A30F1135007E100CDB49E /* JSValueInlineMethods.h in Headers */, + 142D6F0913539A2800B02E86 /* MarkedBlock.h in Headers */, + 142D6F0D13539A2F00B02E86 /* MarkedSpace.h in Headers */, + 142D6F1213539A4100B02E86 /* MarkStack.h in Headers */, + A1D764521354448B00C5C7C0 /* Alignment.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2819,8 +2813,9 @@ E1A862A90D7EBB76001EC6AA /* CollatorICU.cpp in Sources */, 147F39C1107EC37600427A48 /* CommonIdentifiers.cpp in Sources */, 147F39C2107EC37600427A48 /* Completion.cpp in Sources */, - 146B16D812EB5B59001BEC1B /* ConservativeSet.cpp in Sources */, + 146B16D812EB5B59001BEC1B /* ConservativeRoots.cpp in Sources */, 1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */, + 97941A7E1302A098004A3447 /* CryptographicallyRandomNumber.cpp in Sources */, 86565742115BE3DA00291F40 /* CString.cpp in Sources */, 180B9BFE0F16E94D009BDBC5 /* CurrentTime.cpp in Sources */, 147F39C3107EC37600427A48 /* DateConstructor.cpp in Sources */, @@ -2832,6 +2827,13 @@ BC3135650F302FA3003DFD3A /* DebuggerActivation.cpp in Sources */, 149559EE0DDCDDF700648087 /* DebuggerCallFrame.cpp in Sources */, 0F29479C126E698C00B3ABF5 /* DecimalNumber.cpp in Sources */, + 86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */, + 86EC9DC71328DF82002B2AD7 /* DFGGraph.cpp in Sources */, + 86EC9DC91328DF82002B2AD7 /* DFGJITCodeGenerator.cpp in Sources */, + 86EC9DCB1328DF82002B2AD7 /* DFGJITCompiler.cpp in Sources */, + 86EC9DCD1328DF82002B2AD7 /* DFGNonSpeculativeJIT.cpp in Sources */, + 86EC9DCF1328DF82002B2AD7 /* DFGOperations.cpp in Sources */, + 86EC9DD21328DF82002B2AD7 /* DFGSpeculativeJIT.cpp in Sources */, 14469DD7107EC79E00650446 /* dtoa.cpp in Sources */, 147F39C7107EC37600427A48 /* Error.cpp in Sources */, 147F39C8107EC37600427A48 /* ErrorConstructor.cpp in Sources */, @@ -2846,8 +2848,9 @@ 147F39CC107EC37600427A48 /* FunctionPrototype.cpp in Sources */, DDF7ABD511F60ED200108E36 /* GCActivityCallbackCF.cpp in Sources */, 14280855107EC0E70013E7B2 /* GetterSetter.cpp in Sources */, + 142E3135134FF0A600AFADB5 /* HandleHeap.cpp in Sources */, + 142E3137134FF0A600AFADB5 /* HandleStack.cpp in Sources */, 65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */, - 140CDE7012DE97A00013CFC5 /* Heap.cpp in Sources */, 147F39CE107EC37600427A48 /* Identifier.cpp in Sources */, E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */, 147F39CF107EC37600427A48 /* InternalFunction.cpp in Sources */, @@ -2877,10 +2880,8 @@ E18E3A590DF9278C00D90B34 /* JSGlobalData.cpp in Sources */, 147F39D2107EC37600427A48 /* JSGlobalObject.cpp in Sources */, 14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */, - 147F39D3107EC37600427A48 /* JSImmediate.cpp in Sources */, 14280875107EC13E0013E7B2 /* JSLock.cpp in Sources */, A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */, - 1428085D107EC0F80013E7B2 /* JSNumberCell.cpp in Sources */, 147F39D4107EC37600427A48 /* JSObject.cpp in Sources */, 1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */, A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */, @@ -2906,9 +2907,6 @@ 86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */, 06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */, 06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */, - 140CDC7C12DC09BF0013CFC5 /* MarkedSpace.cpp in Sources */, - A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */, - A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */, 14469DDF107EC7E700650446 /* MathObject.cpp in Sources */, 511FC4C9117EE28700425272 /* MD5.cpp in Sources */, 90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */, @@ -2926,6 +2924,7 @@ 969A079A0ED1D3AE00F1F681 /* Opcode.cpp in Sources */, 14280850107EC0D70013E7B2 /* Operations.cpp in Sources */, 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */, + 97941A5713029AAB004A3447 /* OSRandomSource.cpp in Sources */, 14FFF98C12BFFF7500795BB8 /* PageAllocationAligned.cpp in Sources */, 14B3EF0612BC24DD00D29EFF /* PageBlock.cpp in Sources */, 9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */, @@ -2953,6 +2952,7 @@ 76FB9F1112E851960051A2EB /* SHA1.cpp in Sources */, 0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */, 9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */, + E49DC16B12EF293E00184A1F /* SourceProviderCache.cpp in Sources */, 86D87DAE12BCA7D1008E73A1 /* StackBounds.cpp in Sources */, A730B6131250068F009D25B1 /* StrictEvalActivation.cpp in Sources */, 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */, @@ -2981,19 +2981,11 @@ 86704B8612DBA33700A9FE7B /* YarrJIT.cpp in Sources */, 86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */, 86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */, - E49DC16B12EF293E00184A1F /* SourceProviderCache.cpp in Sources */, - 97941A5713029AAB004A3447 /* OSRandomSource.cpp in Sources */, - 97941A7E1302A098004A3447 /* CryptographicallyRandomNumber.cpp in Sources */, - A7E4FC9112F8E4CA00AF4CF4 /* HandleHeap.cpp in Sources */, - A7AC25BD1304D146003396DE /* MarkedBlock.cpp in Sources */, - A76BE39F132EEA7C008F7F0B /* HandleStack.cpp in Sources */, - 86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */, - 86EC9DC71328DF82002B2AD7 /* DFGGraph.cpp in Sources */, - 86EC9DC91328DF82002B2AD7 /* DFGJITCodeGenerator.cpp in Sources */, - 86EC9DCB1328DF82002B2AD7 /* DFGJITCompiler.cpp in Sources */, - 86EC9DCD1328DF82002B2AD7 /* DFGNonSpeculativeJIT.cpp in Sources */, - 86EC9DCF1328DF82002B2AD7 /* DFGOperations.cpp in Sources */, - 86EC9DD21328DF82002B2AD7 /* DFGSpeculativeJIT.cpp in Sources */, + 14FB986D135225410085A5DB /* Heap.cpp in Sources */, + 142D6F0813539A2800B02E86 /* MarkedBlock.cpp in Sources */, + 142D6F0C13539A2F00B02E86 /* MarkedSpace.cpp in Sources */, + 142D6F1113539A4100B02E86 /* MarkStack.cpp in Sources */, + 142D6F1313539A4100B02E86 /* MarkStackPosix.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3055,6 +3047,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = minidom; + SKIP_INSTALL = YES; }; name = Debug; }; @@ -3062,6 +3055,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = minidom; + SKIP_INSTALL = YES; }; name = Release; }; @@ -3069,6 +3063,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = minidom; + SKIP_INSTALL = YES; }; name = Production; }; @@ -3169,6 +3164,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = testapi; + SKIP_INSTALL = YES; }; name = Debug; }; @@ -3176,6 +3172,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = testapi; + SKIP_INSTALL = YES; }; name = Release; }; @@ -3183,6 +3180,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = testapi; + SKIP_INSTALL = YES; }; name = Production; }; @@ -3241,6 +3239,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = minidom; + SKIP_INSTALL = YES; }; name = Profiling; }; @@ -3248,6 +3247,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = testapi; + SKIP_INSTALL = YES; }; name = Profiling; }; diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.h b/Source/JavaScriptCore/assembler/ARMAssembler.h index a711d56..e553492 100644 --- a/Source/JavaScriptCore/assembler/ARMAssembler.h +++ b/Source/JavaScriptCore/assembler/ARMAssembler.h @@ -722,6 +722,10 @@ namespace JSC { void* executableCopy(ExecutablePool* allocator); +#ifndef NDEBUG + unsigned debugOffset() { return m_formatter.debugOffset(); } +#endif + // Patching helpers static ARMWord* getLdrImmAddress(ARMWord* insn) diff --git a/Source/JavaScriptCore/assembler/ARMv7Assembler.h b/Source/JavaScriptCore/assembler/ARMv7Assembler.h index f03e554..d9d4f5d 100644 --- a/Source/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/Source/JavaScriptCore/assembler/ARMv7Assembler.h @@ -2292,6 +2292,10 @@ private: void* data() const { return m_buffer.data(); } void* executableCopy(ExecutablePool* allocator) { return m_buffer.executableCopy(allocator); } +#ifndef NDEBUG + unsigned debugOffset() { return m_formatter.debugOffset(); } +#endif + private: AssemblerBuffer m_buffer; } m_formatter; diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h index 8e81784..8b6613d 100644 --- a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -503,10 +503,19 @@ public: { return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_jmp); } - + + // Temporary interface; likely to be removed, since may be hard to port to all architectures. +#if CPU(X86) || CPU(X86_64) + void rewindToLabel(Label rewindTo) { m_assembler.rewindToLabel(rewindTo.m_label); } +#endif + void beginUninterruptedSequence() { } void endUninterruptedSequence() { } +#ifndef NDEBUG + unsigned debugOffset() { return m_assembler.debugOffset(); } +#endif + protected: AssemblerType m_assembler; diff --git a/Source/JavaScriptCore/assembler/AssemblerBuffer.h b/Source/JavaScriptCore/assembler/AssemblerBuffer.h index a90efc6..802fa7f 100644 --- a/Source/JavaScriptCore/assembler/AssemblerBuffer.h +++ b/Source/JavaScriptCore/assembler/AssemblerBuffer.h @@ -154,6 +154,16 @@ namespace JSC { return memcpy(result, m_buffer, m_size); } + void rewindToOffset(int offset) + { + ASSERT(offset >= 0); + m_size = offset; + } + +#ifndef NDEBUG + unsigned debugOffset() { return m_size; } +#endif + protected: void append(const char* data, int size) { diff --git a/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h index 9a9618f..3cfc67b 100644 --- a/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h +++ b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h @@ -85,7 +85,14 @@ namespace JSC { template <int maxPoolSize, int barrierSize, int maxInstructionSize, class AssemblerType> class AssemblerBufferWithConstantPool: public AssemblerBuffer { typedef SegmentedVector<uint32_t, 512> LoadOffsets; + using AssemblerBuffer::putIntegral; + using AssemblerBuffer::putIntegralUnchecked; public: + typedef struct { + short high; + short low; + } TwoShorts; + enum { UniqueConst, ReusableConst, @@ -171,6 +178,19 @@ public: correctDeltas(8); } + void putIntegral(TwoShorts value) + { + if (m_size > m_capacity - sizeof(TwoShorts)) + grow(); + putIntegralUnchecked(value); + } + + void putIntegralUnchecked(TwoShorts value) + { + putIntegralUnchecked(value.high); + putIntegralUnchecked(value.low); + } + int size() { flushIfNoSpaceFor(maxInstructionSize, sizeof(uint64_t)); diff --git a/Source/JavaScriptCore/assembler/LinkBuffer.h b/Source/JavaScriptCore/assembler/LinkBuffer.h index c5a7d5b..7fa6a99 100644 --- a/Source/JavaScriptCore/assembler/LinkBuffer.h +++ b/Source/JavaScriptCore/assembler/LinkBuffer.h @@ -183,6 +183,13 @@ public: return CodePtr(MacroAssembler::AssemblerType_T::getRelocatedAddress(code(), applyOffset(label.m_label))); } +#ifndef NDEBUG + void* debugAddress() + { + return m_code; + } +#endif + private: template <typename T> T applyOffset(T src) { diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h index 6030680..4c17e40 100644 --- a/Source/JavaScriptCore/assembler/MIPSAssembler.h +++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h @@ -719,6 +719,10 @@ public: return result; } +#ifndef NDEBUG + unsigned debugOffset() { return m_formatter.debugOffset(); } +#endif + static unsigned getCallReturnOffset(JmpSrc call) { // The return address is after a call and a delay slot instruction diff --git a/Source/JavaScriptCore/assembler/MacroAssembler.h b/Source/JavaScriptCore/assembler/MacroAssembler.h index bb19a98..cffb41d 100644 --- a/Source/JavaScriptCore/assembler/MacroAssembler.h +++ b/Source/JavaScriptCore/assembler/MacroAssembler.h @@ -50,6 +50,12 @@ namespace JSC { typedef MacroAssemblerX86 MacroAssemblerBase; }; #include "MacroAssemblerX86_64.h" namespace JSC { typedef MacroAssemblerX86_64 MacroAssemblerBase; }; +#elif CPU(SH4) +#include "MacroAssemblerSH4.h" +namespace JSC { +typedef MacroAssemblerSH4 MacroAssemblerBase; +}; + #else #error "The MacroAssembler is not supported on this platform." #endif diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp new file mode 100644 index 0000000..f718845 --- /dev/null +++ b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 STMicroelectronics. All rights reserved. + * Copyright (C) 2008 Apple Inc. 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 APPLE INC. ``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 APPLE INC. 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) && CPU(SH4) + +#include "MacroAssemblerSH4.h" + +namespace JSC { +const Condition MacroAssemblerSH4::Equal = SH4Assembler::EQ; +const Condition MacroAssemblerSH4::NotEqual = SH4Assembler::NE; +const Condition MacroAssemblerSH4::GreaterThan = SH4Assembler::GT; +const Condition MacroAssemblerSH4::GreaterThanOrEqual = SH4Assembler::GE; +const Condition MacroAssemblerSH4::LessThan = SH4Assembler::LT; +const Condition MacroAssemblerSH4::LessThanOrEqual = SH4Assembler::LE; +const Condition MacroAssemblerSH4::UGreaterThan = SH4Assembler::HI; +const Condition MacroAssemblerSH4::UGreaterThanOrEqual = SH4Assembler::HS; +const Condition MacroAssemblerSH4::ULessThan = SH4Assembler::LI; +const Condition MacroAssemblerSH4::ULessThanOrEqual = SH4Assembler::LS; +const Condition MacroAssemblerSH4::Zero = SH4Assembler::EQ; +const Condition MacroAssemblerSH4::NonZero = SH4Assembler::NE; +const Condition MacroAssemblerSH4::Overflow = SH4Assembler::OF; +const Condition MacroAssemblerSH4::Above = SH4Assembler::HI; +const Condition MacroAssemblerSH4::AboveOrEqual = SH4Assembler::HS; +const Condition MacroAssemblerSH4::Below = SH4Assembler::LI; +const Condition MacroAssemblerSH4::BelowOrEqual = SH4Assembler::LS; +const Condition MacroAssemblerSH4::DoubleEqual = SH4Assembler::EQ; +const Condition MacroAssemblerSH4::DoubleNotEqual = SH4Assembler::NE; +const Condition MacroAssemblerSH4::DoubleGreaterThan = SH4Assembler::GT; +const Condition MacroAssemblerSH4::DoubleGreaterThanOrEqual = SH4Assembler::GE; +const Condition MacroAssemblerSH4::DoubleLessThan = SH4Assembler::LT; +const Condition MacroAssemblerSH4::DoubleLessThanOrEqual = SH4Assembler::LE; +const Condition MacroAssemblerSH4::DoubleEqualOrUnordered = SH4Assembler::EQU; +const Condition MacroAssemblerSH4::DoubleNotEqualOrUnordered = SH4Assembler::NEU; +const Condition MacroAssemblerSH4::DoubleGreaterThanOrUnordered = SH4Assembler::GTU; +const Condition MacroAssemblerSH4::DoubleGreaterThanOrEqualOrUnordered = SH4Assembler::GEU; +const Condition MacroAssemblerSH4::DoubleLessThanOrUnordered = SH4Assembler::LTU; +const Condition MacroAssemblerSH4::DoubleLessThanOrEqualOrUnordered = SH4Assembler::LEU; +const Condition MacroAssemblerSH4::Signed = SH4Assembler::SI; + +void MacroAssemblerSH4::linkCall(void* code, Call call, FunctionPtr function) +{ + SH4Assembler::linkCall(code, call.m_jmp, function.value()); +} + +void MacroAssemblerSH4::repatchCall(CodeLocationCall call, CodeLocationLabel destination) +{ + SH4Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); +} + +void MacroAssemblerSH4::repatchCall(CodeLocationCall call, FunctionPtr destination) +{ + SH4Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); +} + +} // namespace JSC + +#endif // ENABLE(ASSEMBLER) diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h new file mode 100644 index 0000000..7e15e6c --- /dev/null +++ b/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h @@ -0,0 +1,1751 @@ +/* + * Copyright (C) 2009-2011 STMicroelectronics. All rights reserved. + * Copyright (C) 2008 Apple Inc. 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 APPLE INC. ``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 APPLE INC. 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. +*/ + +#ifndef MacroAssemblerSH4_h +#define MacroAssemblerSH4_h + +#if ENABLE(ASSEMBLER) && CPU(SH4) + +#include "AbstractMacroAssembler.h" +#include "SH4Assembler.h" +#include <wtf/Assertions.h> + +namespace JSC { +typedef SH4Assembler::Condition Condition; + +class MacroAssemblerSH4 : public AbstractMacroAssembler<SH4Assembler> { +public: + typedef SH4Assembler::FPRegisterID FPRegisterID; + + static const Condition Equal; + static const Condition NotEqual; + static const Condition GreaterThan; + static const Condition GreaterThanOrEqual; + static const Condition LessThan; + static const Condition LessThanOrEqual; + static const Condition UGreaterThan; + static const Condition UGreaterThanOrEqual; + static const Condition ULessThan; + static const Condition ULessThanOrEqual; + static const Condition Zero; + static const Condition NonZero; + static const Condition Overflow; + static const Condition Above; + static const Condition AboveOrEqual; + static const Condition Below; + static const Condition BelowOrEqual; + static const Condition DoubleEqual; + static const Condition DoubleNotEqual; + static const Condition DoubleGreaterThan; + static const Condition DoubleGreaterThanOrEqual; + static const Condition DoubleLessThan; + static const Condition DoubleLessThanOrEqual; + static const Condition DoubleEqualOrUnordered; + static const Condition DoubleNotEqualOrUnordered; + static const Condition DoubleGreaterThanOrUnordered; + static const Condition DoubleGreaterThanOrEqualOrUnordered; + static const Condition DoubleLessThanOrUnordered; + static const Condition DoubleLessThanOrEqualOrUnordered; + static const Condition Signed; + static const Scale ScalePtr = TimesFour; + static const FPRegisterID fscratch = SH4Registers::fr10; + static const RegisterID stackPointerRegister = SH4Registers::sp; + static const RegisterID linkRegister = SH4Registers::pr; + static const RegisterID scratchReg3 = SH4Registers::r13; + + RegisterID claimScratch() + { + return m_assembler.claimScratch(); + } + + void releaseScratch(RegisterID reg) + { + m_assembler.releaseScratch(reg); + } + + // Integer arithmetic operations + + void add32(RegisterID src, RegisterID dest) + { + m_assembler.addlRegReg(src, dest); + } + + void add32(TrustedImm32 imm, RegisterID dest) + { + if (m_assembler.isImmediate(imm.m_value)) { + m_assembler.addlImm8r(imm.m_value, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm.m_value, scr); + m_assembler.addlRegReg(scr, dest); + releaseScratch(scr); + } + + void add32(TrustedImm32 imm, RegisterID src, RegisterID dest) + { + if (src != dest) + m_assembler.movlRegReg(src, dest); + add32(imm, dest); + } + + void add32(TrustedImm32 imm, Address address) + { + RegisterID scr = claimScratch(); + load32(address, scr); + add32(imm, scr); + store32(scr, address); + releaseScratch(scr); + } + + void add32(Address src, RegisterID dest) + { + RegisterID scr = claimScratch(); + load32(src, scr); + m_assembler.addlRegReg(scr, dest); + releaseScratch(scr); + } + + void and32(RegisterID src, RegisterID dest) + { + m_assembler.andlRegReg(src, dest); + } + + void and32(TrustedImm32 imm, RegisterID dest) + { + if ((imm.m_value <= 255) && (imm.m_value >= 0) && (dest == SH4Registers::r0)) { + m_assembler.andlImm8r(imm.m_value, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant((imm.m_value), scr); + m_assembler.andlRegReg(scr, dest); + releaseScratch(scr); + } + + void lshift32(RegisterID shiftamount, RegisterID dest) + { + m_assembler.shllRegReg(dest, shiftamount); + } + + void rshift32(int imm, RegisterID dest) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(-imm, scr); + m_assembler.shaRegReg(dest, scr); + releaseScratch(scr); + } + + void lshift32(TrustedImm32 imm, RegisterID dest) + { + if ((imm.m_value == 1) || (imm.m_value == 2) || (imm.m_value == 8) || (imm.m_value == 16)) { + m_assembler.shllImm8r(imm.m_value, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm.m_value, scr); + m_assembler.shllRegReg(dest, scr); + releaseScratch(scr); + } + + void mul32(RegisterID src, RegisterID dest) + { + m_assembler.imullRegReg(src, dest); + m_assembler.stsmacl(dest); + } + + void mul32(TrustedImm32 imm, RegisterID src, RegisterID dest) + { + RegisterID scr = claimScratch(); + move(imm, scr); + if (src != dest) + move(src, dest); + mul32(scr, dest); + releaseScratch(scr); + } + + void not32(RegisterID src, RegisterID dest) + { + m_assembler.notlReg(src, dest); + } + + void or32(RegisterID src, RegisterID dest) + { + m_assembler.orlRegReg(src, dest); + } + + void or32(TrustedImm32 imm, RegisterID dest) + { + if ((imm.m_value <= 255) && (imm.m_value >= 0) && (dest == SH4Registers::r0)) { + m_assembler.orlImm8r(imm.m_value, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm.m_value, scr); + m_assembler.orlRegReg(scr, dest); + releaseScratch(scr); + } + + void rshift32(RegisterID shiftamount, RegisterID dest) + { + compare32(32, shiftamount, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.neg(shiftamount, shiftamount); + m_assembler.shaRegReg(dest, shiftamount); + } + + void rshift32(TrustedImm32 imm, RegisterID dest) + { + if (imm.m_value & 0x1f) + rshift32(imm.m_value & 0x1f, dest); + } + + void sub32(RegisterID src, RegisterID dest) + { + m_assembler.sublRegReg(src, dest); + } + + void sub32(TrustedImm32 imm, AbsoluteAddress address, RegisterID scratchReg) + { + RegisterID result = claimScratch(); + + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg); + m_assembler.movlMemReg(scratchReg, result); + + if (m_assembler.isImmediate(-imm.m_value)) + m_assembler.addlImm8r(-imm.m_value, result); + else { + m_assembler.loadConstant(imm.m_value, scratchReg3); + m_assembler.sublRegReg(scratchReg3, result); + } + + store32(result, scratchReg); + releaseScratch(result); + } + + void sub32(TrustedImm32 imm, AbsoluteAddress address) + { + RegisterID result = claimScratch(); + RegisterID scratchReg = claimScratch(); + + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg); + m_assembler.movlMemReg(scratchReg, result); + + if (m_assembler.isImmediate(-imm.m_value)) + m_assembler.addlImm8r(-imm.m_value, result); + else { + m_assembler.loadConstant(imm.m_value, scratchReg3); + m_assembler.sublRegReg(scratchReg3, result); + } + + store32(result, scratchReg); + releaseScratch(result); + releaseScratch(scratchReg); + } + + void add32(TrustedImm32 imm, AbsoluteAddress address, RegisterID scratchReg) + { + RegisterID result = claimScratch(); + + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg); + m_assembler.movlMemReg(scratchReg, result); + + if (m_assembler.isImmediate(imm.m_value)) + m_assembler.addlImm8r(imm.m_value, result); + else { + m_assembler.loadConstant(imm.m_value, scratchReg3); + m_assembler.addlRegReg(scratchReg3, result); + } + + store32(result, scratchReg); + releaseScratch(result); + } + + void add32(TrustedImm32 imm, AbsoluteAddress address) + { + RegisterID result = claimScratch(); + RegisterID scratchReg = claimScratch(); + + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg); + m_assembler.movlMemReg(scratchReg, result); + + if (m_assembler.isImmediate(imm.m_value)) + m_assembler.addlImm8r(imm.m_value, result); + else { + m_assembler.loadConstant(imm.m_value, scratchReg3); + m_assembler.addlRegReg(scratchReg3, result); + } + + store32(result, scratchReg); + releaseScratch(result); + releaseScratch(scratchReg); + } + + void sub32(TrustedImm32 imm, RegisterID dest) + { + if (m_assembler.isImmediate(-imm.m_value)) { + m_assembler.addlImm8r(-imm.m_value, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm.m_value, scr); + m_assembler.sublRegReg(scr, dest); + releaseScratch(scr); + } + + void sub32(Address src, RegisterID dest) + { + RegisterID scr = claimScratch(); + load32(src, scr); + m_assembler.sublRegReg(scr, dest); + releaseScratch(scr); + } + + void xor32(RegisterID src, RegisterID dest) + { + m_assembler.xorlRegReg(src, dest); + } + + void xor32(TrustedImm32 imm, RegisterID srcDest) + { + if ((srcDest != SH4Registers::r0) || (imm.m_value > 255) || (imm.m_value < 0)) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant((imm.m_value), scr); + m_assembler.xorlRegReg(scr, srcDest); + releaseScratch(scr); + return; + } + + m_assembler.xorlImm8r(imm.m_value, srcDest); + } + + void compare32(int imm, RegisterID dst, Condition cond) + { + if (((cond == Equal) || (cond == NotEqual)) && (dst == SH4Registers::r0) && m_assembler.isImmediate(imm)) { + m_assembler.cmpEqImmR0(imm, dst, cond); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm, scr); + m_assembler.cmplRegReg(scr, dst, cond); + releaseScratch(scr); + } + + void compare32(int offset, RegisterID base, RegisterID left, Condition cond) + { + RegisterID scr = claimScratch(); + if (!offset) { + m_assembler.movlMemReg(base, scr); + m_assembler.cmplRegReg(scr, left, cond); + releaseScratch(scr); + return; + } + + if ((offset < 0) || (offset >= 64)) { + m_assembler.loadConstant(offset, scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movlMemReg(scr, scr); + m_assembler.cmplRegReg(scr, left, cond); + releaseScratch(scr); + return; + } + + m_assembler.movlMemReg(offset >> 2, base, scr); + m_assembler.cmplRegReg(scr, left, cond); + releaseScratch(scr); + } + + void testImm(int imm, int offset, RegisterID base) + { + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + + if ((offset < 0) || (offset >= 64)) { + m_assembler.loadConstant(offset, scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movlMemReg(scr, scr); + } else if (offset) + m_assembler.movlMemReg(offset >> 2, base, scr); + else + m_assembler.movlMemReg(base, scr); + if (m_assembler.isImmediate(imm)) + m_assembler.movImm8(imm, scr1); + else + m_assembler.loadConstant(imm, scr1); + + m_assembler.testlRegReg(scr, scr1); + releaseScratch(scr); + releaseScratch(scr1); + } + + void testlImm(int imm, RegisterID dst) + { + if ((dst == SH4Registers::r0) && (imm <= 255) && (imm >= 0)) { + m_assembler.testlImm8r(imm, dst); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm, scr); + m_assembler.testlRegReg(scr, dst); + releaseScratch(scr); + } + + void compare32(RegisterID right, int offset, RegisterID base, Condition cond) + { + if (!offset) { + RegisterID scr = claimScratch(); + m_assembler.movlMemReg(base, scr); + m_assembler.cmplRegReg(right, scr, cond); + releaseScratch(scr); + return; + } + + if ((offset < 0) || (offset >= 64)) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(offset, scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movlMemReg(scr, scr); + m_assembler.cmplRegReg(right, scr, cond); + releaseScratch(scr); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.movlMemReg(offset >> 2, base, scr); + m_assembler.cmplRegReg(right, scr, cond); + releaseScratch(scr); + } + + void compare32(int imm, int offset, RegisterID base, Condition cond) + { + if (!offset) { + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + m_assembler.movlMemReg(base, scr); + m_assembler.loadConstant(imm, scr1); + m_assembler.cmplRegReg(scr1, scr, cond); + releaseScratch(scr1); + releaseScratch(scr); + return; + } + + if ((offset < 0) || (offset >= 64)) { + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + m_assembler.loadConstant(offset, scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movlMemReg(scr, scr); + m_assembler.loadConstant(imm, scr1); + m_assembler.cmplRegReg(scr1, scr, cond); + releaseScratch(scr1); + releaseScratch(scr); + return; + } + + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + m_assembler.movlMemReg(offset >> 2, base, scr); + m_assembler.loadConstant(imm, scr1); + m_assembler.cmplRegReg(scr1, scr, cond); + releaseScratch(scr1); + releaseScratch(scr); + } + + // Memory access operation + + void load32(ImplicitAddress address, RegisterID dest) + { + load32(address.base, address.offset, dest); + } + + void load8(ImplicitAddress address, RegisterID dest) + { + load8(address.base, address.offset, dest); + } + + void load32(BaseIndex address, RegisterID dest) + { + RegisterID scr = claimScratch(); + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + load32(scr, address.offset, dest); + releaseScratch(scr); + } + + void load32(void* address, RegisterID dest) + { + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), dest); + m_assembler.movlMemReg(dest, dest); + } + + void load32(RegisterID base, int offset, RegisterID dest) + { + if (!offset) { + m_assembler.movlMemReg(base, dest); + return; + } + + if ((offset >= 0) && (offset < 64)) { + m_assembler.movlMemReg(offset >> 2, base, dest); + return; + } + + if ((dest == SH4Registers::r0) && (dest != base)) { + m_assembler.loadConstant((offset), dest); + m_assembler.movlR0mr(base, dest); + return; + } + + RegisterID scr; + if (dest == base) + scr = claimScratch(); + else + scr = dest; + m_assembler.loadConstant((offset), scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movlMemReg(scr, dest); + + if (dest == base) + releaseScratch(scr); + } + + void load8(RegisterID base, int offset, RegisterID dest) + { + if (!offset) { + m_assembler.movbMemReg(base, dest); + return; + } + + if ((offset > 0) && (offset < 64) && (dest == SH4Registers::r0)) { + m_assembler.movbMemReg(offset, base, dest); + return; + } + + if (base != dest) { + m_assembler.loadConstant((offset), dest); + m_assembler.addlRegReg(base, dest); + m_assembler.movbMemReg(dest, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant((offset), scr); + m_assembler.addlRegReg(base, scr); + m_assembler.movbMemReg(scr, dest); + releaseScratch(scr); + } + + void load32(RegisterID r0, RegisterID src, RegisterID dst) + { + ASSERT(r0 == SH4Registers::r0); + m_assembler.movlR0mr(src, dst); + } + + void load32(RegisterID src, RegisterID dst) + { + m_assembler.movlMemReg(src, dst); + } + + void load16(ImplicitAddress address, RegisterID dest) + { + if (!address.offset) { + m_assembler.movwMemReg(address.base, dest); + return; + } + + if ((address.offset > 0) && (address.offset < 64) && (dest == SH4Registers::r0)) { + m_assembler.movwMemReg(address.offset, address.base, dest); + return; + } + + if (address.base != dest) { + m_assembler.loadConstant((address.offset), dest); + m_assembler.addlRegReg(address.base, dest); + m_assembler.movwMemReg(dest, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant((address.offset), scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.movwMemReg(scr, dest); + releaseScratch(scr); + } + + void load16(RegisterID src, RegisterID dest) + { + m_assembler.movwMemReg(src, dest); + } + + void load16(RegisterID r0, RegisterID src, RegisterID dest) + { + ASSERT(r0 == SH4Registers::r0); + m_assembler.movwR0mr(src, dest); + } + + void load16(BaseIndex address, RegisterID dest) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + + if (address.offset) + add32(TrustedImm32(address.offset), scr); + if (scr == SH4Registers::r0) + m_assembler.movwR0mr(address.base, scr); + else { + add32(address.base, scr); + load16(scr, scr); + } + + extuw(scr, dest); + releaseScratch(scr); + } + + void store32(RegisterID src, ImplicitAddress address) + { + RegisterID scr = claimScratch(); + store32(src, address.offset, address.base, scr); + releaseScratch(scr); + } + + void store32(RegisterID src, int offset, RegisterID base, RegisterID scr) + { + if (!offset) { + m_assembler.movlRegMem(src, base); + return; + } + + if ((offset >=0) && (offset < 64)) { + m_assembler.movlRegMem(src, offset >> 2, base); + return; + } + + m_assembler.loadConstant((offset), scr); + if (scr == SH4Registers::r0) { + m_assembler.movlRegMemr0(src, base); + return; + } + + m_assembler.addlRegReg(base, scr); + m_assembler.movlRegMem(src, scr); + } + + void store32(RegisterID src, RegisterID offset, RegisterID base) + { + ASSERT(offset == SH4Registers::r0); + m_assembler.movlRegMemr0(src, base); + } + + void store32(RegisterID src, RegisterID dst) + { + m_assembler.movlRegMem(src, dst); + } + + void store32(TrustedImm32 imm, ImplicitAddress address) + { + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + m_assembler.loadConstant((imm.m_value), scr); + store32(scr, address.offset, address.base, scr1); + releaseScratch(scr); + releaseScratch(scr1); + } + + void store32(RegisterID src, BaseIndex address) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + store32(src, Address(scr, address.offset)); + + releaseScratch(scr); + } + + void store32(TrustedImm32 imm, void* address) + { + RegisterID scr = claimScratch(); + RegisterID scr1 = claimScratch(); + m_assembler.loadConstant((imm.m_value), scr); + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr1); + m_assembler.movlMemReg(scr, scr1); + releaseScratch(scr); + releaseScratch(scr1); + } + + void store32(RegisterID src, void* address) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr); + m_assembler.movlMemReg(src, scr); + releaseScratch(scr); + } + + DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) + { + RegisterID scr = claimScratch(); + DataLabel32 label(this); + m_assembler.loadConstantUnReusable(address.offset, scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.movlMemReg(scr, dest); + releaseScratch(scr); + return label; + } + + DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address) + { + RegisterID scr = claimScratch(); + DataLabel32 label(this); + m_assembler.loadConstantUnReusable(address.offset, scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.movlRegMem(src, scr); + releaseScratch(scr); + return label; + } + + // Floating-point operations + + bool supportsFloatingPoint() const { return true; } + bool supportsFloatingPointTruncate() const { return true; } + bool supportsFloatingPointSqrt() const { return true; } + + void loadDouble(ImplicitAddress address, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + + m_assembler.loadConstant(address.offset, scr); + if (address.base == SH4Registers::r0) { + m_assembler.fmovsReadr0r(scr, (FPRegisterID)(dest + 1)); + m_assembler.addlImm8r(4, scr); + m_assembler.fmovsReadr0r(scr, dest); + releaseScratch(scr); + return; + } + + m_assembler.addlRegReg(address.base, scr); + m_assembler.fmovsReadrminc(scr, (FPRegisterID)(dest + 1)); + m_assembler.fmovsReadrm(scr, dest); + releaseScratch(scr); + } + + void loadDouble(const void* address, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr); + m_assembler.fmovsReadrminc(scr, (FPRegisterID)(dest + 1)); + m_assembler.fmovsReadrm(scr, dest); + releaseScratch(scr); + } + + void storeDouble(FPRegisterID src, ImplicitAddress address) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(address.offset, scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.fmovsWriterm((FPRegisterID)(src + 1), scr); + m_assembler.addlImm8r(4, scr); + m_assembler.fmovsWriterm(src, scr); + releaseScratch(scr); + } + + void addDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.daddRegReg(src, dest); + } + + void addDouble(Address address, FPRegisterID dest) + { + loadDouble(address, fscratch); + addDouble(fscratch, dest); + } + + void subDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.dsubRegReg(src, dest); + } + + void subDouble(Address address, FPRegisterID dest) + { + loadDouble(address, fscratch); + subDouble(fscratch, dest); + } + + void mulDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.dmulRegReg(src, dest); + } + + void mulDouble(Address address, FPRegisterID dest) + { + loadDouble(address, fscratch); + mulDouble(fscratch, dest); + } + + void divDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.ddivRegReg(src, dest); + } + + void convertInt32ToDouble(RegisterID src, FPRegisterID dest) + { + m_assembler.ldsrmfpul(src); + m_assembler.floatfpulDreg(dest); + } + + void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(reinterpret_cast<uint32_t>(src.m_ptr), scr); + convertInt32ToDouble(scr, dest); + releaseScratch(scr); + } + + void convertInt32ToDouble(Address src, FPRegisterID dest) + { + RegisterID scr = claimScratch(); + load32(src, scr); + convertInt32ToDouble(scr, dest); + releaseScratch(scr); + } + + void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + + if (address.offset) + add32(TrustedImm32(address.offset), scr); + + RegisterID scr1 = claimScratch(); + load16(scr, scr1); + add32(TrustedImm32(2), scr); + load16(scr, dest); + move(TrustedImm32(16), scr); + m_assembler.shllRegReg(dest, scr); + or32(scr1, dest); + + releaseScratch(scr); + releaseScratch(scr1); + } + + Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, TrustedImm32 right) + { + RegisterID scr = scratchReg3; + load32WithUnalignedHalfWords(left, scr); + if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) + m_assembler.testlRegReg(scr, scr); + else + compare32(right.m_value, scr, cond); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch) + { + m_assembler.movImm8(0, scratchReg3); + convertInt32ToDouble(scratchReg3, scratch); + return branchDouble(DoubleNotEqual, reg, scratch); + } + + Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch) + { + m_assembler.movImm8(0, scratchReg3); + convertInt32ToDouble(scratchReg3, scratch); + return branchDouble(DoubleEqualOrUnordered, reg, scratch); + } + + Jump branchDouble(Condition cond, FPRegisterID left, FPRegisterID right) + { + if (cond == DoubleEqual) { + m_assembler.dcmppeq(right, left); + return branchTrue(); + } + + if (cond == DoubleNotEqual) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 8); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 4); + m_assembler.dcmppeq(right, left); + releaseScratch(scr); + return branchFalse(); + } + + if (cond == DoubleGreaterThan) { + m_assembler.dcmppgt(right, left); + return branchTrue(); + } + + if (cond == DoubleGreaterThanOrEqual) { + m_assembler.dcmppgt(left, right); + return branchFalse(); + } + + if (cond == DoubleLessThan) { + m_assembler.dcmppgt(left, right); + return branchTrue(); + } + + if (cond == DoubleLessThanOrEqual) { + m_assembler.dcmppgt(right, left); + return branchFalse(); + } + + if (cond == DoubleEqualOrUnordered) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppeq(left, right); + releaseScratch(scr); + return branchTrue(); + } + + if (cond == DoubleGreaterThanOrUnordered) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppgt(right, left); + releaseScratch(scr); + return branchTrue(); + } + + if (cond == DoubleGreaterThanOrEqualOrUnordered) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppgt(left, right); + releaseScratch(scr); + return branchFalse(); + } + + if (cond == DoubleLessThanOrUnordered) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppgt(left, right); + releaseScratch(scr); + return branchTrue(); + } + + if (cond == DoubleLessThanOrEqualOrUnordered) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppgt(right, left); + releaseScratch(scr); + return branchFalse(); + } + + ASSERT(cond == DoubleNotEqualOrUnordered); + RegisterID scr = claimScratch(); + m_assembler.loadConstant(0x7fbfffff, scratchReg3); + m_assembler.dcnvds(right); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 5); + m_assembler.dcnvds(left); + m_assembler.stsfpulReg(scr); + m_assembler.cmplRegReg(scratchReg3, scr, Equal); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.dcmppeq(right, left); + releaseScratch(scr); + return branchFalse(); + } + + Jump branchTrue() + { + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 6, sizeof(uint32_t)); + Jump m_jump = Jump(m_assembler.je()); + m_assembler.loadConstantUnReusable(0x0, scratchReg3); + m_assembler.nop(); + m_assembler.nop(); + return m_jump; + } + + Jump branchFalse() + { + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 6, sizeof(uint32_t)); + Jump m_jump = Jump(m_assembler.jne()); + m_assembler.loadConstantUnReusable(0x0, scratchReg3); + m_assembler.nop(); + m_assembler.nop(); + return m_jump; + } + + void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + set32Compare32(cond, left, right, dest); + } + + void set8Compare32(Condition cond, RegisterID left, TrustedImm32 right, RegisterID dest) + { + if (left != dest) { + m_assembler.loadConstant(right.m_value, dest); + set32Compare32(cond, left, dest, dest); + return; + } + + RegisterID scr = claimScratch(); + m_assembler.loadConstant(right.m_value, scr); + set32Compare32(cond, left, scr, dest); + releaseScratch(scr); + } + + Jump branch32(Condition cond, BaseIndex left, TrustedImm32 right) + { + RegisterID scr = claimScratch(); + move(left.index, scr); + lshift32(TrustedImm32(left.scale), scr); + add32(left.base, scr); + load32(scr, left.offset, scr); + compare32(right.m_value, scr, cond); + releaseScratch(scr); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + void sqrtDouble(FPRegisterID src, FPRegisterID dest) + { + if (dest != src) + m_assembler.dmovRegReg(src, dest); + m_assembler.dsqrt(dest); + } + + Jump branchTest8(Condition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) + { + RegisterID addressTempRegister = claimScratch(); + load8(address, addressTempRegister); + Jump jmp = branchTest32(cond, addressTempRegister, mask); + releaseScratch(addressTempRegister); + return jmp; + } + + void signExtend32ToPtr(RegisterID src, RegisterID dest) + { + if (src != dest) + move(src, dest); + } + + Jump branch8(Condition cond, Address left, TrustedImm32 right) + { + RegisterID addressTempRegister = claimScratch(); + load8(left, addressTempRegister); + Jump jmp = branch32(cond, addressTempRegister, right); + releaseScratch(addressTempRegister); + return jmp; + } + + Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest) + { + m_assembler.ftrcdrmfpul(src); + m_assembler.stsfpulReg(dest); + m_assembler.loadConstant(0x7fffffff, scratchReg3); + m_assembler.cmplRegReg(dest, scratchReg3, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 14, sizeof(uint32_t)); + m_assembler.branch(BT_OPCODE, 2); + m_assembler.addlImm8r(1, scratchReg3); + m_assembler.cmplRegReg(dest, scratchReg3, Equal); + return branchTrue(); + } + + // Stack manipulation operations + + void pop(RegisterID dest) + { + m_assembler.popReg(dest); + } + + void push(RegisterID src) + { + m_assembler.pushReg(src); + } + + void push(Address address) + { + if (!address.offset) { + push(address.base); + return; + } + + if ((address.offset < 0) || (address.offset >= 64)) { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(address.offset, scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.movlMemReg(scr, SH4Registers::sp); + m_assembler.addlImm8r(-4, SH4Registers::sp); + releaseScratch(scr); + return; + } + + m_assembler.movlMemReg(address.offset >> 2, address.base, SH4Registers::sp); + m_assembler.addlImm8r(-4, SH4Registers::sp); + } + + void push(TrustedImm32 imm) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(imm.m_value, scr); + push(scr); + releaseScratch(scr); + } + + // Register move operations + + void move(TrustedImm32 imm, RegisterID dest) + { + m_assembler.loadConstant(imm.m_value, dest); + } + + DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest) + { + DataLabelPtr dataLabel(this); + m_assembler.loadConstantUnReusable(reinterpret_cast<uint32_t>(initialValue.m_value), dest, true); + return dataLabel; + } + + void move(RegisterID src, RegisterID dest) + { + m_assembler.movlRegReg(src, dest); + } + + void move(TrustedImmPtr imm, RegisterID dest) + { + m_assembler.loadConstant(imm.asIntptr(), dest); + } + + void extuw(RegisterID src, RegisterID dst) + { + m_assembler.extuw(src, dst); + } + + void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + m_assembler.cmplRegReg(right, left, cond); + if (cond != NotEqual) { + m_assembler.movt(dest); + return; + } + + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4); + m_assembler.movImm8(0, dest); + m_assembler.branch(BT_OPCODE, 0); + m_assembler.movImm8(1, dest); + } + + void set32Compare32(Condition cond, RegisterID left, TrustedImm32 right, RegisterID dest) + { + if (left != dest) { + move(right, dest); + set32Compare32(cond, left, dest, dest); + return; + } + + RegisterID scr = claimScratch(); + move(right, scr); + set32Compare32(cond, left, scr, dest); + releaseScratch(scr); + } + + void set32Test8(Condition cond, Address address, TrustedImm32 mask, RegisterID dest) + { + ASSERT((cond == Zero) || (cond == NonZero)); + + load8(address, dest); + if (mask.m_value == -1) + compare32(0, dest, cond); + else + testlImm(mask.m_value, dest); + if (cond != NonZero) { + m_assembler.movt(dest); + return; + } + + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4); + m_assembler.movImm8(0, dest); + m_assembler.branch(BT_OPCODE, 0); + m_assembler.movImm8(1, dest); + } + + void loadPtrLinkReg(ImplicitAddress address) + { + RegisterID scr = claimScratch(); + load32(address, scr); + m_assembler.ldspr(scr); + releaseScratch(scr); + } + + Jump branch32(Condition cond, RegisterID left, RegisterID right) + { + m_assembler.cmplRegReg(right, left, cond); + /* BT label => BF off + nop LDR reg + nop braf @reg + nop nop + */ + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, RegisterID left, TrustedImm32 right) + { + if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) + m_assembler.testlRegReg(left, left); + else + compare32(right.m_value, left, cond); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, RegisterID left, Address right) + { + compare32(right.offset, right.base, left, cond); + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, Address left, RegisterID right) + { + compare32(right, left.offset, left.base, cond); + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, Address left, TrustedImm32 right) + { + compare32(right.m_value, left.offset, left.base, cond); + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right) + { + RegisterID scr = claimScratch(); + + move(TrustedImm32(reinterpret_cast<uint32_t>(left.m_ptr)), scr); + m_assembler.cmplRegReg(right, scr, cond); + releaseScratch(scr); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch32(Condition cond, AbsoluteAddress left, TrustedImm32 right) + { + RegisterID addressTempRegister = claimScratch(); + + m_assembler.loadConstant(reinterpret_cast<uint32_t>(left.m_ptr), addressTempRegister); + m_assembler.movlMemReg(addressTempRegister, addressTempRegister); + compare32(right.m_value, addressTempRegister, cond); + releaseScratch(addressTempRegister); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branch16(Condition cond, BaseIndex left, RegisterID right) + { + RegisterID scr = claimScratch(); + + move(left.index, scr); + lshift32(TrustedImm32(left.scale), scr); + + if (left.offset) + add32(TrustedImm32(left.offset), scr); + add32(left.base, scr); + load16(scr, scr); + extuw(scr, scr); + releaseScratch(scr); + + return branch32(cond, scr, right); + } + + Jump branch16(Condition cond, BaseIndex left, TrustedImm32 right) + { + RegisterID scr = claimScratch(); + + move(left.index, scr); + lshift32(TrustedImm32(left.scale), scr); + + if (left.offset) + add32(TrustedImm32(left.offset), scr); + add32(left.base, scr); + load16(scr, scr); + extuw(scr, scr); + RegisterID scr1 = claimScratch(); + m_assembler.loadConstant(right.m_value, scr1); + releaseScratch(scr); + releaseScratch(scr1); + + return branch32(cond, scr, scr1); + } + + Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask) + { + ASSERT((cond == Zero) || (cond == NonZero)); + + m_assembler.testlRegReg(reg, mask); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchTest32(Condition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1)) + { + ASSERT((cond == Zero) || (cond == NonZero)); + + if (mask.m_value == -1) + m_assembler.testlRegReg(reg, reg); + else + testlImm(mask.m_value, reg); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchTest32(Condition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) + { + ASSERT((cond == Zero) || (cond == NonZero)); + + if (mask.m_value == -1) + compare32(0, address.offset, address.base, cond); + else + testImm(mask.m_value, address.offset, address.base); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchTest32(Condition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) + { + RegisterID scr = claimScratch(); + + move(address.index, scr); + lshift32(TrustedImm32(address.scale), scr); + add32(address.base, scr); + load32(scr, address.offset, scr); + + if (mask.m_value == -1) + m_assembler.testlRegReg(scr, scr); + else + testlImm(mask.m_value, scr); + + releaseScratch(scr); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump jump() + { + return Jump(m_assembler.jmp()); + } + + void jump(RegisterID target) + { + m_assembler.jmpReg(target); + } + + void jump(Address address) + { + RegisterID scr = claimScratch(); + + if ((address.offset < 0) || (address.offset >= 64)) { + m_assembler.loadConstant(address.offset, scr); + m_assembler.addlRegReg(address.base, scr); + m_assembler.movlMemReg(scr, scr); + } else if (address.offset) + m_assembler.movlMemReg(address.offset >> 2, address.base, scr); + else + m_assembler.movlMemReg(address.base, scr); + m_assembler.jmpReg(scr); + + releaseScratch(scr); + } + + // Arithmetic control flow operations + + Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + if (cond == Overflow) { + m_assembler.addvlRegReg(src, dest); + return branchTrue(); + } + + if (cond == Signed) { + m_assembler.addlRegReg(src, dest); + // Check if dest is negative + m_assembler.cmppz(dest); + return branchFalse(); + } + + m_assembler.addlRegReg(src, dest); + compare32(0, dest, Equal); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchAdd32(Condition cond, TrustedImm32 imm, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + move(imm, scratchReg3); + return branchAdd32(cond, scratchReg3, dest); + } + + Jump branchMul32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + if (cond == Overflow) { + RegisterID scr1 = claimScratch(); + RegisterID scr = claimScratch(); + m_assembler.dmullRegReg(src, dest); + m_assembler.stsmacl(dest); + m_assembler.movImm8(-31, scr); + m_assembler.movlRegReg(dest, scr1); + m_assembler.shaRegReg(scr1, scr); + m_assembler.stsmach(scr); + m_assembler.cmplRegReg(scr, scr1, Zero); + releaseScratch(scr1); + releaseScratch(scr); + return branchFalse(); + } + + m_assembler.imullRegReg(src, dest); + m_assembler.stsmacl(dest); + if (cond == Signed) { + // Check if dest is negative + m_assembler.cmppz(dest); + return branchFalse(); + } + + compare32(0, dest, cond); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchMul32(Condition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + move(imm, scratchReg3); + if (src != dest) + move(src, dest); + + return branchMul32(cond, scratchReg3, dest); + } + + Jump branchSub32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + if (cond == Overflow) { + m_assembler.subvlRegReg(src, dest); + return branchTrue(); + } + + if (cond == Signed) { + // Check if dest is negative + m_assembler.sublRegReg(src, dest); + compare32(0, dest, LessThan); + return branchTrue(); + } + + sub32(src, dest); + compare32(0, dest, cond); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchSub32(Condition cond, TrustedImm32 imm, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); + + move(imm, scratchReg3); + return branchSub32(cond, scratchReg3, dest); + } + + Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); + + if (cond == Signed) { + or32(src, dest); + compare32(0, dest, LessThan); + return branchTrue(); + } + + or32(src, dest); + compare32(0, dest, cond); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) + { + m_assembler.ftrcdrmfpul(src); + m_assembler.stsfpulReg(dest); + convertInt32ToDouble(dest, fscratch); + failureCases.append(branchDouble(DoubleNotEqualOrUnordered, fscratch, src)); + + if (dest == SH4Registers::r0) + m_assembler.cmpEqImmR0(0, dest, Equal); + else { + m_assembler.movImm8(0, scratchReg3); + m_assembler.cmplRegReg(scratchReg3, dest, Equal); + } + failureCases.append(branchTrue()); + } + + void neg32(RegisterID dst) + { + m_assembler.neg(dst, dst); + } + + void not32(RegisterID dst) + { + m_assembler.notlReg(dst, dst); + } + + void urshift32(RegisterID shiftamount, RegisterID dest) + { + compare32(32, shiftamount, Equal); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4); + m_assembler.branch(BT_OPCODE, 1); + m_assembler.neg(shiftamount, shiftamount); + m_assembler.shllRegReg(dest, shiftamount); + } + + void urshift32(TrustedImm32 imm, RegisterID dest) + { + RegisterID scr = claimScratch(); + m_assembler.loadConstant(-(imm.m_value), scr); + m_assembler.shaRegReg(dest, scr); + releaseScratch(scr); + } + + Call call() + { + return Call(m_assembler.call(), Call::Linkable); + } + + Call nearCall() + { + return Call(m_assembler.call(), Call::LinkableNear); + } + + Call call(RegisterID target) + { + return Call(m_assembler.call(target), Call::None); + } + + void call(Address address, RegisterID target) + { + load32(address.base, address.offset, target); + m_assembler.ensureSpace(m_assembler.maxInstructionSize + 2); + m_assembler.branch(JSR_OPCODE, target); + m_assembler.nop(); + } + + void breakpoint() + { + m_assembler.bkpt(); + m_assembler.nop(); + } + + Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0)) + { + RegisterID dataTempRegister = claimScratch(); + + dataLabel = moveWithPatch(initialRightValue, dataTempRegister); + m_assembler.cmplRegReg(dataTempRegister, left, cond); + releaseScratch(dataTempRegister); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0)) + { + RegisterID scr = claimScratch(); + + m_assembler.loadConstant(left.offset, scr); + m_assembler.addlRegReg(left.base, scr); + m_assembler.movlMemReg(scr, scr); + RegisterID scr1 = claimScratch(); + dataLabel = moveWithPatch(initialRightValue, scr1); + m_assembler.cmplRegReg(scr1, scr, cond); + releaseScratch(scr); + releaseScratch(scr1); + + if (cond == NotEqual) + return branchFalse(); + return branchTrue(); + } + + void ret() + { + m_assembler.ret(); + m_assembler.nop(); + } + + DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address) + { + RegisterID scr = claimScratch(); + DataLabelPtr label = moveWithPatch(initialValue, scr); + store32(scr, address); + releaseScratch(scr); + return label; + } + + DataLabelPtr storePtrWithPatch(ImplicitAddress address) { return storePtrWithPatch(TrustedImmPtr(0), address); } + + int sizeOfConstantPool() + { + return m_assembler.sizeOfConstantPool(); + } + + Call tailRecursiveCall() + { + RegisterID scr = claimScratch(); + + m_assembler.loadConstantUnReusable(0x0, scr, true); + Jump m_jump = Jump(m_assembler.jmp(scr)); + releaseScratch(scr); + + return Call::fromTailJump(m_jump); + } + + Call makeTailRecursiveCall(Jump oldJump) + { + oldJump.link(this); + return tailRecursiveCall(); + } + +private: + friend class LinkBuffer; + friend class RepatchBuffer; + + static void linkCall(void*, Call, FunctionPtr); + static void repatchCall(CodeLocationCall, CodeLocationLabel); + static void repatchCall(CodeLocationCall, FunctionPtr); +}; + +} // namespace JSC + +#endif // ENABLE(ASSEMBLER) + +#endif // MacroAssemblerSH4_h diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h index f5829dd..027a4ce 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -1004,7 +1004,7 @@ public: return branchAdd32(cond, src1, dest); } - Jump branchAdd32(Condition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) + Jump branchAdd32(Condition cond, RegisterID src, TrustedImm32 imm, RegisterID dest) { move(src, dest); return branchAdd32(cond, imm, dest); @@ -1083,6 +1083,12 @@ public: return branchSub32(cond, src2, dest); } + Jump branchSub32(Condition cond, RegisterID src1, TrustedImm32 src2, RegisterID dest) + { + move(src1, dest); + return branchSub32(cond, src2, dest); + } + Jump branchNeg32(Condition cond, RegisterID srcDest) { ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h index bd417aa..30c717f 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -197,6 +197,24 @@ public: m_assembler.orq_ir(imm.m_value, dest); } + void orPtr(RegisterID op1, RegisterID op2, RegisterID dest) + { + if (op1 == op2) + move(op1, dest); + else if (op1 == dest) + orPtr(op2, dest); + else { + move(op2, dest); + orPtr(op1, dest); + } + } + + void orPtr(TrustedImm32 imm, RegisterID src, RegisterID dest) + { + move(src, dest); + orPtr(imm, dest); + } + void subPtr(RegisterID src, RegisterID dest) { m_assembler.subq_rr(src, dest); diff --git a/Source/JavaScriptCore/assembler/SH4Assembler.h b/Source/JavaScriptCore/assembler/SH4Assembler.h new file mode 100644 index 0000000..5726ae8 --- /dev/null +++ b/Source/JavaScriptCore/assembler/SH4Assembler.h @@ -0,0 +1,2067 @@ +/* + * Copyright (C) 2009-2011 STMicroelectronics. All rights reserved. + * Copyright (C) 2008 Apple Inc. 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 APPLE INC. ``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 APPLE INC. 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. + */ + +#ifndef SH4Assembler_h +#define SH4Assembler_h + +#if ENABLE(ASSEMBLER) && CPU(SH4) + +#include "AssemblerBuffer.h" +#include "AssemblerBufferWithConstantPool.h" +#include <stdarg.h> +#include <stdint.h> +#include <wtf/Assertions.h> +#include <wtf/Vector.h> + +#ifndef NDEBUG +#define SH4_ASSEMBLER_TRACING +#endif + +namespace JSC { +typedef uint16_t SH4Word; + +enum { + INVALID_OPCODE = 0xffff, + ADD_OPCODE = 0x300c, + ADDIMM_OPCODE = 0x7000, + ADDC_OPCODE = 0x300e, + ADDV_OPCODE = 0x300f, + AND_OPCODE = 0x2009, + ANDIMM_OPCODE = 0xc900, + DIV0_OPCODE = 0x2007, + DIV1_OPCODE = 0x3004, + BF_OPCODE = 0x8b00, + BFS_OPCODE = 0x8f00, + BRA_OPCODE = 0xa000, + BRAF_OPCODE = 0x0023, + NOP_OPCODE = 0x0009, + BSR_OPCODE = 0xb000, + RTS_OPCODE = 0x000b, + BT_OPCODE = 0x8900, + BTS_OPCODE = 0x8d00, + BSRF_OPCODE = 0x0003, + BRK_OPCODE = 0x003b, + FTRC_OPCODE = 0xf03d, + CMPEQ_OPCODE = 0x3000, + CMPEQIMM_OPCODE = 0x8800, + CMPGE_OPCODE = 0x3003, + CMPGT_OPCODE = 0x3007, + CMPHI_OPCODE = 0x3006, + CMPHS_OPCODE = 0x3002, + CMPPL_OPCODE = 0x4015, + CMPPZ_OPCODE = 0x4011, + CMPSTR_OPCODE = 0x200c, + DT_OPCODE = 0x4010, + FCMPEQ_OPCODE = 0xf004, + FCMPGT_OPCODE = 0xf005, + FMOV_OPCODE = 0xf00c, + FADD_OPCODE = 0xf000, + FMUL_OPCODE = 0xf002, + FSUB_OPCODE = 0xf001, + FDIV_OPCODE = 0xf003, + FNEG_OPCODE = 0xf04d, + JMP_OPCODE = 0x402b, + JSR_OPCODE = 0x400b, + LDSPR_OPCODE = 0x402a, + LDSLPR_OPCODE = 0x4026, + MOV_OPCODE = 0x6003, + MOVIMM_OPCODE = 0xe000, + MOVB_WRITE_RN_OPCODE = 0x2000, + MOVB_WRITE_RNDEC_OPCODE = 0x2004, + MOVB_WRITE_R0RN_OPCODE = 0x0004, + MOVB_WRITE_OFFGBR_OPCODE = 0xc000, + MOVB_WRITE_OFFRN_OPCODE = 0x8000, + MOVB_READ_RM_OPCODE = 0x6000, + MOVB_READ_RMINC_OPCODE = 0x6004, + MOVB_READ_R0RM_OPCODE = 0x000c, + MOVB_READ_OFFGBR_OPCODE = 0xc400, + MOVB_READ_OFFRM_OPCODE = 0x8400, + MOVL_WRITE_RN_OPCODE = 0x2002, + MOVL_WRITE_RNDEC_OPCODE = 0x2006, + MOVL_WRITE_R0RN_OPCODE = 0x0006, + MOVL_WRITE_OFFGBR_OPCODE = 0xc200, + MOVL_WRITE_OFFRN_OPCODE = 0x1000, + MOVL_READ_RM_OPCODE = 0x6002, + MOVL_READ_RMINC_OPCODE = 0x6006, + MOVL_READ_R0RM_OPCODE = 0x000e, + MOVL_READ_OFFGBR_OPCODE = 0xc600, + MOVL_READ_OFFPC_OPCODE = 0xd000, + MOVL_READ_OFFRM_OPCODE = 0x5000, + MOVW_WRITE_RN_OPCODE = 0x2001, + MOVW_READ_RM_OPCODE = 0x6001, + MOVW_READ_R0RM_OPCODE = 0x000d, + MOVW_READ_OFFRM_OPCODE = 0x8500, + MOVW_READ_OFFPC_OPCODE = 0x9000, + MOVA_READ_OFFPC_OPCODE = 0xc700, + MOVT_OPCODE = 0x0029, + MULL_OPCODE = 0x0007, + DMULL_L_OPCODE = 0x3005, + STSMACL_OPCODE = 0x001a, + STSMACH_OPCODE = 0x000a, + DMULSL_OPCODE = 0x300d, + NEG_OPCODE = 0x600b, + NEGC_OPCODE = 0x600a, + NOT_OPCODE = 0x6007, + OR_OPCODE = 0x200b, + ORIMM_OPCODE = 0xcb00, + ORBIMM_OPCODE = 0xcf00, + SETS_OPCODE = 0x0058, + SETT_OPCODE = 0x0018, + SHAD_OPCODE = 0x400c, + SHAL_OPCODE = 0x4020, + SHAR_OPCODE = 0x4021, + SHLD_OPCODE = 0x400d, + SHLL_OPCODE = 0x4000, + SHLL2_OPCODE = 0x4008, + SHLL8_OPCODE = 0x4018, + SHLL16_OPCODE = 0x4028, + SHLR_OPCODE = 0x4001, + SHLR2_OPCODE = 0x4009, + SHLR8_OPCODE = 0x4019, + SHLR16_OPCODE = 0x4029, + STSPR_OPCODE = 0x002a, + STSLPR_OPCODE = 0x4022, + FLOAT_OPCODE = 0xf02d, + SUB_OPCODE = 0x3008, + SUBC_OPCODE = 0x300a, + SUBV_OPCODE = 0x300b, + TST_OPCODE = 0x2008, + TSTIMM_OPCODE = 0xc800, + TSTB_OPCODE = 0xcc00, + EXTUW_OPCODE = 0x600d, + XOR_OPCODE = 0x200a, + XORIMM_OPCODE = 0xca00, + XORB_OPCODE = 0xce00, + FMOVS_READ_RM_INC_OPCODE = 0xf009, + FMOVS_READ_RM_OPCODE = 0xf008, + FMOVS_READ_R0RM_OPCODE = 0xf006, + FMOVS_WRITE_RN_OPCODE = 0xf00a, + FMOVS_WRITE_RN_DEC_OPCODE = 0xf00b, + FMOVS_WRITE_R0RN_OPCODE = 0xf007, + FCNVDS_DRM_FPUL_OPCODE = 0xf0bd, + LDS_RM_FPUL_OPCODE = 0x405a, + FLDS_FRM_FPUL_OPCODE = 0xf01d, + STS_FPUL_RN_OPCODE = 0x005a, + FSTS_FPUL_FRN_OPCODE = 0xF00d, + LDSFPSCR_OPCODE = 0x406a, + STSFPSCR_OPCODE = 0x006a, + LDSRMFPUL_OPCODE = 0x405a, + FSTSFPULFRN_OPCODE = 0xf00d, + FSQRT_OPCODE = 0xf06d, + FSCHG_OPCODE = 0xf3fd, + CLRT_OPCODE = 8, +}; + +namespace SH4Registers { +typedef enum { + r0, + r1, + r2, + r3, + r4, + r5, + r6, + r7, + r8, + r9, + r10, + r11, + r12, + r13, + r14, fp = r14, + r15, sp = r15, + pc, + pr, +} RegisterID; + +typedef enum { + fr0, dr0 = fr0, + fr1, + fr2, dr2 = fr2, + fr3, + fr4, dr4 = fr4, + fr5, + fr6, dr6 = fr6, + fr7, + fr8, dr8 = fr8, + fr9, + fr10, dr10 = fr10, + fr11, + fr12, dr12 = fr12, + fr13, + fr14, dr14 = fr14, + fr15, +} FPRegisterID; +} + +inline uint16_t getOpcodeGroup1(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0xf) << 8) | ((rn & 0xf) << 4)); +} + +inline uint16_t getOpcodeGroup2(uint16_t opc, int rm) +{ + return (opc | ((rm & 0xf) << 8)); +} + +inline uint16_t getOpcodeGroup3(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0xf) << 8) | (rn & 0xff)); +} + +inline uint16_t getOpcodeGroup4(uint16_t opc, int rm, int rn, int offset) +{ + return (opc | ((rm & 0xf) << 8) | ((rn & 0xf) << 4) | (offset & 0xf)); +} + +inline uint16_t getOpcodeGroup5(uint16_t opc, int rm) +{ + return (opc | (rm & 0xff)); +} + +inline uint16_t getOpcodeGroup6(uint16_t opc, int rm) +{ + return (opc | (rm & 0xfff)); +} + +inline uint16_t getOpcodeGroup7(uint16_t opc, int rm) +{ + return (opc | ((rm & 0x7) << 9)); +} + +inline uint16_t getOpcodeGroup8(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0x7) << 9) | ((rn & 0x7) << 5)); +} + +inline uint16_t getOpcodeGroup9(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0xf) << 8) | ((rn & 0x7) << 5)); +} + +inline uint16_t getOpcodeGroup10(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0x7) << 9) | ((rn & 0xf) << 4)); +} + +inline uint16_t getOpcodeGroup11(uint16_t opc, int rm, int rn) +{ + return (opc | ((rm & 0xf) << 4) | (rn & 0xf)); +} + +inline uint16_t getRn(uint16_t x) +{ + return ((x & 0xf00) >> 8); +} + +inline uint16_t getRm(uint16_t x) +{ + return ((x & 0xf0) >> 4); +} + +inline uint16_t getDisp(uint16_t x) +{ + return (x & 0xf); +} + +inline uint16_t getImm8(uint16_t x) +{ + return (x & 0xff); +} + +inline uint16_t getImm12(uint16_t x) +{ + return (x & 0xfff); +} + +inline uint16_t getDRn(uint16_t x) +{ + return ((x & 0xe00) >> 9); +} + +inline uint16_t getDRm(uint16_t x) +{ + return ((x & 0xe0) >> 5); +} + +class SH4Assembler { +public: + typedef SH4Registers::RegisterID RegisterID; + typedef SH4Registers::FPRegisterID FPRegisterID; + typedef AssemblerBufferWithConstantPool<512, 4, 2, SH4Assembler> SH4Buffer; + static const RegisterID scratchReg1 = SH4Registers::r3; + static const RegisterID scratchReg2 = SH4Registers::r11; + static const uint32_t maxInstructionSize = 16; + + enum { + padForAlign8 = 0x00, + padForAlign16 = 0x0009, + padForAlign32 = 0x00090009, + }; + + SH4Assembler() + { + m_claimscratchReg = 0x0; + } + + // SH4 condition codes + typedef enum { + EQ = 0x0, // Equal + NE = 0x1, // Not Equal + HS = 0x2, // Unsigend Greater Than equal + HI = 0x3, // Unsigend Greater Than + LS = 0x4, // Unsigend Lower or Same + LI = 0x5, // Unsigend Lower + GE = 0x6, // Greater or Equal + LT = 0x7, // Less Than + GT = 0x8, // Greater Than + LE = 0x9, // Less or Equal + OF = 0xa, // OverFlow + SI = 0xb, // Signed + EQU= 0xc, // Equal or unordered(NaN) + NEU= 0xd, + GTU= 0xe, + GEU= 0xf, + LTU= 0x10, + LEU= 0x11, + } Condition; + + // Opaque label types +public: + class JmpSrc { + friend class SH4Assembler; + public: + JmpSrc() + : m_offset(-1) + { + } + + private: + JmpSrc(int offset) + : m_offset(offset) + { + } + + int m_offset; + }; + + class JmpDst { + friend class SH4Assembler; + public: + JmpDst() + : m_offset(-1) + , m_used(false) + { + } + + bool isUsed() const { return m_used; } + bool isSet() const { return (m_offset != -1); } + void used() { m_used = true; } + + private: + JmpDst(int offset) + : m_offset(offset) + , m_used(false) + { + ASSERT(m_offset == offset); + } + + int m_offset : 31; + int m_used : 1; + }; + + bool isImmediate(int constant) + { + return ((constant <= 127) && (constant >= -128)); + } + + RegisterID claimScratch() + { + ASSERT((m_claimscratchReg != 0x3)); + + if (!(m_claimscratchReg & 0x1)) { + m_claimscratchReg = (m_claimscratchReg | 0x1); + return scratchReg1; + } + + m_claimscratchReg = (m_claimscratchReg | 0x2); + return scratchReg2; + } + + void releaseScratch(RegisterID scratchR) + { + if (scratchR == scratchReg1) + m_claimscratchReg = (m_claimscratchReg & 0x2); + else + m_claimscratchReg = (m_claimscratchReg & 0x1); + } + + // Stack operations + + void pushReg(RegisterID reg) + { + if (reg == SH4Registers::pr) { + oneShortOp(getOpcodeGroup2(STSLPR_OPCODE, SH4Registers::sp)); + return; + } + + oneShortOp(getOpcodeGroup1(MOVL_WRITE_RNDEC_OPCODE, SH4Registers::sp, reg)); + } + + void popReg(RegisterID reg) + { + if (reg == SH4Registers::pr) { + oneShortOp(getOpcodeGroup2(LDSLPR_OPCODE, SH4Registers::sp)); + return; + } + + oneShortOp(getOpcodeGroup1(MOVL_READ_RMINC_OPCODE, reg, SH4Registers::sp)); + } + + void movt(RegisterID dst) + { + uint16_t opc = getOpcodeGroup2(MOVT_OPCODE, dst); + oneShortOp(opc); + } + + // Arithmetic operations + + void addlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(ADD_OPCODE, dst, src); + oneShortOp(opc); + } + + void addclRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(ADDC_OPCODE, dst, src); + oneShortOp(opc); + } + + void addvlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(ADDV_OPCODE, dst, src); + oneShortOp(opc); + } + + void addlImm8r(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 127) && (imm8 >= -128)); + + uint16_t opc = getOpcodeGroup3(ADDIMM_OPCODE, dst, imm8); + oneShortOp(opc); + } + + void andlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(AND_OPCODE, dst, src); + oneShortOp(opc); + } + + void andlImm8r(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 255) && (imm8 >= 0)); + ASSERT(dst == SH4Registers::r0); + + uint16_t opc = getOpcodeGroup5(ANDIMM_OPCODE, imm8); + oneShortOp(opc); + } + + void div1lRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(DIV1_OPCODE, dst, src); + oneShortOp(opc); + } + + void div0lRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(DIV0_OPCODE, dst, src); + oneShortOp(opc); + } + + void notlReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(NOT_OPCODE, dst, src); + oneShortOp(opc); + } + + void orlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(OR_OPCODE, dst, src); + oneShortOp(opc); + } + + void orlImm8r(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 255) && (imm8 >= 0)); + ASSERT(dst == SH4Registers::r0); + + uint16_t opc = getOpcodeGroup5(ORIMM_OPCODE, imm8); + oneShortOp(opc); + } + + void sublRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(SUB_OPCODE, dst, src); + oneShortOp(opc); + } + + void subvlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(SUBV_OPCODE, dst, src); + oneShortOp(opc); + } + + void xorlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(XOR_OPCODE, dst, src); + oneShortOp(opc); + } + + void xorlImm8r(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 255) && (imm8 >= 0)); + ASSERT(dst == SH4Registers::r0); + + uint16_t opc = getOpcodeGroup5(XORIMM_OPCODE, imm8); + oneShortOp(opc); + } + + void shllImm8r(int imm, RegisterID dst) + { + switch (imm) { + case 1: + oneShortOp(getOpcodeGroup2(SHLL_OPCODE, dst)); + break; + case 2: + oneShortOp(getOpcodeGroup2(SHLL2_OPCODE, dst)); + break; + case 8: + oneShortOp(getOpcodeGroup2(SHLL8_OPCODE, dst)); + break; + case 16: + oneShortOp(getOpcodeGroup2(SHLL16_OPCODE, dst)); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + void neg(RegisterID dst, RegisterID src) + { + uint16_t opc = getOpcodeGroup1(NEG_OPCODE, dst, src); + oneShortOp(opc); + } + + void shllRegReg(RegisterID dst, RegisterID rShift) + { + uint16_t opc = getOpcodeGroup1(SHLD_OPCODE, dst, rShift); + oneShortOp(opc); + } + + void shlrRegReg(RegisterID dst, RegisterID rShift) + { + neg(rShift, rShift); + shllRegReg(dst, rShift); + } + + void sharRegReg(RegisterID dst, RegisterID rShift) + { + neg(rShift, rShift); + shaRegReg(dst, rShift); + } + + void shaRegReg(RegisterID dst, RegisterID rShift) + { + uint16_t opc = getOpcodeGroup1(SHAD_OPCODE, dst, rShift); + oneShortOp(opc); + } + + void shlrImm8r(int imm, RegisterID dst) + { + switch (imm) { + case 1: + oneShortOp(getOpcodeGroup2(SHLR_OPCODE, dst)); + break; + case 2: + oneShortOp(getOpcodeGroup2(SHLR2_OPCODE, dst)); + break; + case 8: + oneShortOp(getOpcodeGroup2(SHLR8_OPCODE, dst)); + break; + case 16: + oneShortOp(getOpcodeGroup2(SHLR16_OPCODE, dst)); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + void imullRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MULL_OPCODE, dst, src); + oneShortOp(opc); + } + + void dmullRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(DMULL_L_OPCODE, dst, src); + oneShortOp(opc); + } + + void dmulslRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(DMULSL_OPCODE, dst, src); + oneShortOp(opc); + } + + void stsmacl(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(STSMACL_OPCODE, reg); + oneShortOp(opc); + } + + void stsmach(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(STSMACH_OPCODE, reg); + oneShortOp(opc); + } + + // Comparisons + + void cmplRegReg(RegisterID left, RegisterID right, Condition cond) + { + switch (cond) { + case NE: + oneShortOp(getOpcodeGroup1(CMPEQ_OPCODE, right, left)); + break; + case GT: + oneShortOp(getOpcodeGroup1(CMPGT_OPCODE, right, left)); + break; + case EQ: + oneShortOp(getOpcodeGroup1(CMPEQ_OPCODE, right, left)); + break; + case GE: + oneShortOp(getOpcodeGroup1(CMPGE_OPCODE, right, left)); + break; + case HS: + oneShortOp(getOpcodeGroup1(CMPHS_OPCODE, right, left)); + break; + case HI: + oneShortOp(getOpcodeGroup1(CMPHI_OPCODE, right, left)); + break; + case LI: + oneShortOp(getOpcodeGroup1(CMPHI_OPCODE, left, right)); + break; + case LS: + oneShortOp(getOpcodeGroup1(CMPHS_OPCODE, left, right)); + break; + case LE: + oneShortOp(getOpcodeGroup1(CMPGE_OPCODE, left, right)); + break; + case LT: + oneShortOp(getOpcodeGroup1(CMPGT_OPCODE, left, right)); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + void cmppl(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(CMPPL_OPCODE, reg); + oneShortOp(opc); + } + + void cmppz(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(CMPPZ_OPCODE, reg); + oneShortOp(opc); + } + + void cmpEqImmR0(int imm, RegisterID dst, Condition cond) + { + uint16_t opc = getOpcodeGroup5(CMPEQIMM_OPCODE, imm); + oneShortOp(opc); + } + + void testlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(TST_OPCODE, dst, src); + oneShortOp(opc); + } + + void testlImm8r(int imm, RegisterID dst) + { + ASSERT((dst == SH4Registers::r0) && (imm <= 255) && (imm >= 0)); + + uint16_t opc = getOpcodeGroup5(TSTIMM_OPCODE, imm); + oneShortOp(opc); + } + + void nop() + { + oneShortOp(NOP_OPCODE, false); + } + + void sett() + { + oneShortOp(SETT_OPCODE); + } + + void clrt() + { + oneShortOp(CLRT_OPCODE); + } + + void fschg() + { + oneShortOp(FSCHG_OPCODE); + } + + void bkpt() + { + oneShortOp(BRK_OPCODE, false); + } + + void branch(uint16_t opc, int label) + { + switch (opc) { + case BT_OPCODE: + ASSERT((label <= 127) && (label >= -128)); + oneShortOp(getOpcodeGroup5(BT_OPCODE, label)); + break; + case BRA_OPCODE: + ASSERT((label <= 2047) && (label >= -2048)); + oneShortOp(getOpcodeGroup6(BRA_OPCODE, label)); + break; + case BF_OPCODE: + ASSERT((label <= 127) && (label >= -128)); + oneShortOp(getOpcodeGroup5(BF_OPCODE, label)); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + void branch(uint16_t opc, RegisterID reg) + { + switch (opc) { + case BRAF_OPCODE: + oneShortOp(getOpcodeGroup2(BRAF_OPCODE, reg)); + break; + case JMP_OPCODE: + oneShortOp(getOpcodeGroup2(JMP_OPCODE, reg)); + break; + case JSR_OPCODE: + oneShortOp(getOpcodeGroup2(JSR_OPCODE, reg)); + break; + case BSRF_OPCODE: + oneShortOp(getOpcodeGroup2(BSRF_OPCODE, reg)); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + void ldspr(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(LDSPR_OPCODE, reg); + oneShortOp(opc); + } + + void stspr(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(STSPR_OPCODE, reg); + oneShortOp(opc); + } + + void extuw(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(EXTUW_OPCODE, dst, src); + oneShortOp(opc); + } + + // float operations + + void ldsrmfpul(RegisterID src) + { + uint16_t opc = getOpcodeGroup2(LDS_RM_FPUL_OPCODE, src); + oneShortOp(opc); + } + + void fneg(FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup2(FNEG_OPCODE, dst); + oneShortOp(opc, true, false); + } + + void fsqrt(FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup2(FSQRT_OPCODE, dst); + oneShortOp(opc, true, false); + } + + void stsfpulReg(RegisterID src) + { + uint16_t opc = getOpcodeGroup2(STS_FPUL_RN_OPCODE, src); + oneShortOp(opc); + } + + void floatfpulfrn(RegisterID src) + { + uint16_t opc = getOpcodeGroup2(FLOAT_OPCODE, src); + oneShortOp(opc, true, false); + } + + void fmull(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMUL_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsReadrm(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_READ_RM_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsWriterm(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_RN_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsWriter0r(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_R0RN_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsReadr0r(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_READ_R0RM_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsReadrminc(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_READ_RM_INC_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void fmovsWriterndec(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_RN_DEC_OPCODE, dst, src); + oneShortOp(opc, true, false); + } + + void ftrcRegfpul(FPRegisterID src) + { + uint16_t opc = getOpcodeGroup2(FTRC_OPCODE, src); + oneShortOp(opc, true, false); + } + + void fldsfpul(RegisterID src) + { + uint16_t opc = getOpcodeGroup2(FLDS_FRM_FPUL_OPCODE, src); + oneShortOp(opc); + } + + void fstsfpul(RegisterID src) + { + uint16_t opc = getOpcodeGroup2(FSTS_FPUL_FRN_OPCODE, src); + oneShortOp(opc); + } + + void ldsfpscr(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(LDSFPSCR_OPCODE, reg); + oneShortOp(opc); + } + + void stsfpscr(RegisterID reg) + { + uint16_t opc = getOpcodeGroup2(STSFPSCR_OPCODE, reg); + oneShortOp(opc); + } + + // double operations + + void dcnvds(FPRegisterID src) + { + uint16_t opc = getOpcodeGroup7(FCNVDS_DRM_FPUL_OPCODE, src >> 1); + oneShortOp(opc); + } + + void dcmppeq(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FCMPEQ_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void dcmppgt(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FCMPGT_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void dmulRegReg(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FMUL_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void dsubRegReg(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FSUB_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void daddRegReg(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FADD_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void dmovRegReg(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FMOV_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void ddivRegReg(FPRegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup8(FDIV_OPCODE, dst >> 1, src >> 1); + oneShortOp(opc); + } + + void dsqrt(FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup7(FSQRT_OPCODE, dst >> 1); + oneShortOp(opc); + } + + void dneg(FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup7(FNEG_OPCODE, dst >> 1); + oneShortOp(opc); + } + + void fmovReadrm(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup10(FMOVS_READ_RM_OPCODE, dst >> 1, src); + oneShortOp(opc); + } + + void fmovWriterm(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_RN_OPCODE, dst, src >> 1); + oneShortOp(opc); + } + + void fmovWriter0r(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_R0RN_OPCODE, dst, src >> 1); + oneShortOp(opc); + } + + void fmovReadr0r(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup10(FMOVS_READ_R0RM_OPCODE, dst >> 1, src); + oneShortOp(opc); + } + + void fmovReadrminc(RegisterID src, FPRegisterID dst) + { + uint16_t opc = getOpcodeGroup10(FMOVS_READ_RM_INC_OPCODE, dst >> 1, src); + oneShortOp(opc); + } + + void fmovWriterndec(FPRegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_RN_DEC_OPCODE, dst, src >> 1); + oneShortOp(opc); + } + + void floatfpulDreg(FPRegisterID src) + { + uint16_t opc = getOpcodeGroup7(FLOAT_OPCODE, src >> 1); + oneShortOp(opc); + } + + void ftrcdrmfpul(FPRegisterID src) + { + uint16_t opc = getOpcodeGroup7(FTRC_OPCODE, src >> 1); + oneShortOp(opc); + } + + // Various move ops + + void movImm8(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 127) && (imm8 >= -128)); + + uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, imm8); + oneShortOp(opc); + } + + void movlRegReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOV_OPCODE, dst, src); + oneShortOp(opc); + } + + void movwRegMem(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVW_WRITE_RN_OPCODE, dst, src); + oneShortOp(opc); + } + + void movwMemReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVW_READ_RM_OPCODE, dst, src); + oneShortOp(opc); + } + + void movwPCReg(int offset, RegisterID base, RegisterID dst) + { + ASSERT(base == SH4Registers::pc); + ASSERT((offset <= 255) && (offset >= 0)); + + uint16_t opc = getOpcodeGroup3(MOVW_READ_OFFPC_OPCODE, dst, offset); + oneShortOp(opc); + } + + void movwMemReg(int offset, RegisterID base, RegisterID dst) + { + ASSERT(dst == SH4Registers::r0); + + uint16_t opc = getOpcodeGroup11(MOVW_READ_OFFRM_OPCODE, base, offset); + oneShortOp(opc); + } + + void movwR0mr(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVW_READ_R0RM_OPCODE, dst, src); + oneShortOp(opc); + } + + void movlRegMem(RegisterID src, int offset, RegisterID base) + { + ASSERT((offset <= 15) && (offset >= 0)); + + if (!offset) { + oneShortOp(getOpcodeGroup1(MOVL_WRITE_RN_OPCODE, base, src)); + return; + } + + oneShortOp(getOpcodeGroup4(MOVL_WRITE_OFFRN_OPCODE, base, src, offset)); + } + + void movlRegMem(RegisterID src, RegisterID base) + { + uint16_t opc = getOpcodeGroup1(MOVL_WRITE_RN_OPCODE, base, src); + oneShortOp(opc); + } + + void movlMemReg(int offset, RegisterID base, RegisterID dst) + { + if (base == SH4Registers::pc) { + ASSERT((offset <= 255) && (offset >= 0)); + oneShortOp(getOpcodeGroup3(MOVL_READ_OFFPC_OPCODE, dst, offset)); + return; + } + + ASSERT((offset <= 15) && (offset >= 0)); + if (!offset) { + oneShortOp(getOpcodeGroup1(MOVL_READ_RM_OPCODE, dst, base)); + return; + } + + oneShortOp(getOpcodeGroup4(MOVL_READ_OFFRM_OPCODE, dst, base, offset)); + } + + void movbMemReg(int offset, RegisterID base, RegisterID dst) + { + ASSERT(dst == SH4Registers::r0); + + uint16_t opc = getOpcodeGroup11(MOVB_READ_OFFRM_OPCODE, base, offset); + oneShortOp(opc); + } + + void movbR0mr(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVB_READ_R0RM_OPCODE, dst, src); + oneShortOp(opc); + } + + void movbMemReg(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVB_READ_RM_OPCODE, dst, src); + oneShortOp(opc); + } + + void movlMemReg(RegisterID base, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVL_READ_RM_OPCODE, dst, base); + oneShortOp(opc); + } + + void movlMemRegIn(RegisterID base, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVL_READ_RMINC_OPCODE, dst, base); + oneShortOp(opc); + } + + void movlR0mr(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVL_READ_R0RM_OPCODE, dst, src); + oneShortOp(opc); + } + + void movlRegMemr0(RegisterID src, RegisterID dst) + { + uint16_t opc = getOpcodeGroup1(MOVL_WRITE_R0RN_OPCODE, dst, src); + oneShortOp(opc); + } + + void movlImm8r(int imm8, RegisterID dst) + { + ASSERT((imm8 <= 127) && (imm8 >= -128)); + + uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, imm8); + oneShortOp(opc); + } + + void loadConstant(uint32_t constant, RegisterID dst) + { + if (((int)constant <= 0x7f) && ((int)constant >= -0x80)) { + movImm8(constant, dst); + return; + } + + uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, 0); + + m_buffer.ensureSpace(maxInstructionSize, sizeof(uint32_t)); + printInstr(getOpcodeGroup3(MOVIMM_OPCODE, dst, constant), m_buffer.uncheckedSize()); + m_buffer.putShortWithConstantInt(opc, constant, true); + } + + void loadConstantUnReusable(uint32_t constant, RegisterID dst, bool ensureSpace = false) + { + uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, 0); + + if (ensureSpace) + m_buffer.ensureSpace(maxInstructionSize, sizeof(uint32_t)); + + printInstr(getOpcodeGroup3(MOVIMM_OPCODE, dst, constant), m_buffer.uncheckedSize()); + m_buffer.putShortWithConstantInt(opc, constant); + } + + // Flow control + + JmpSrc call() + { + RegisterID scr = claimScratch(); + m_buffer.ensureSpace(maxInstructionSize + 4, sizeof(uint32_t)); + loadConstantUnReusable(0x0, scr); + branch(JSR_OPCODE, scr); + nop(); + releaseScratch(scr); + return JmpSrc(m_buffer.uncheckedSize()); + } + + JmpSrc call(RegisterID dst) + { + m_buffer.ensureSpace(maxInstructionSize + 2); + branch(JSR_OPCODE, dst); + nop(); + return JmpSrc(m_buffer.uncheckedSize()); + } + + JmpSrc jmp() + { + RegisterID scr = claimScratch(); + m_buffer.ensureSpace(maxInstructionSize + 4, sizeof(uint32_t)); + int m_size = m_buffer.uncheckedSize(); + loadConstantUnReusable(0x0, scr); + branch(BRAF_OPCODE, scr); + nop(); + releaseScratch(scr); + return JmpSrc(m_size); + } + + JmpSrc jmp(RegisterID dst) + { + jmpReg(dst); + return JmpSrc(m_buffer.uncheckedSize()); + } + + void jmpReg(RegisterID dst) + { + m_buffer.ensureSpace(maxInstructionSize + 2); + branch(JMP_OPCODE, dst); + nop(); + } + + JmpSrc jne() + { + int m_size = m_buffer.uncheckedSize(); + branch(BF_OPCODE, 0); + return JmpSrc(m_size); + } + + JmpSrc je() + { + int m_size = m_buffer.uncheckedSize(); + branch(BT_OPCODE, 0); + return JmpSrc(m_size); + } + + void ret() + { + m_buffer.ensureSpace(maxInstructionSize + 2); + oneShortOp(RTS_OPCODE, false); + } + + JmpDst label() + { + return JmpDst(m_buffer.size()); + } + + int sizeOfConstantPool() + { + return m_buffer.sizeOfConstantPool(); + } + + JmpDst align(int alignment) + { + m_buffer.ensureSpace(maxInstructionSize + 2); + while (!m_buffer.isAligned(alignment)) { + nop(); + m_buffer.ensureSpace(maxInstructionSize + 2); + } + return label(); + } + + static void changePCrelativeAddress(int offset, uint16_t* instructionPtr, uint32_t newAddress) + { + uint32_t address = (offset << 2) + ((reinterpret_cast<uint32_t>(instructionPtr) + 4) &(~0x3)); + *reinterpret_cast<uint32_t*>(address) = newAddress; + } + + static uint16_t* getInstructionPtr(void* code, int offset) + { + return reinterpret_cast<uint16_t*> (reinterpret_cast<uint32_t>(code) + offset); + } + + static void linkJump(void* code, JmpSrc from, void* to) + { + ASSERT(from.m_offset != -1); + + uint16_t* instructionPtr = getInstructionPtr(code, from.m_offset); + uint16_t instruction = *instructionPtr; + int offsetBits = (reinterpret_cast<uint32_t>(to) - reinterpret_cast<uint32_t>(code)) - from.m_offset; + + if (((instruction & 0xff00) == BT_OPCODE) || ((instruction & 0xff00) == BF_OPCODE)) { + /* BT label ==> BF 2 + nop LDR reg + nop braf @reg + nop nop + */ + offsetBits -= 8; + instruction ^= 0x0202; + *instructionPtr++ = instruction; + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits); + instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00)); + *instructionPtr = instruction; + printBlockInstr(instructionPtr - 2, from.m_offset, 3); + return; + } + + /* MOV #imm, reg => LDR reg + braf @reg braf @reg + nop nop + */ + ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE); + + offsetBits -= 4; + if (offsetBits >= -4096 && offsetBits <= 4094) { + *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1); + *(++instructionPtr) = NOP_OPCODE; + printBlockInstr(instructionPtr - 1, from.m_offset, 2); + return; + } + + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2); + printInstr(*instructionPtr, from.m_offset + 2); + } + + static void linkCall(void* code, JmpSrc from, void* to) + { + uint16_t* instructionPtr = getInstructionPtr(code, from.m_offset); + instructionPtr -= 3; + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(to)); + } + + static void linkPointer(void* code, JmpDst where, void* value) + { + uint16_t* instructionPtr = getInstructionPtr(code, where.m_offset); + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(value)); + } + + static unsigned getCallReturnOffset(JmpSrc call) + { + ASSERT(call.m_offset >= 0); + return call.m_offset; + } + + static uint32_t* getLdrImmAddressOnPool(SH4Word* insn, uint32_t* constPool) + { + return (constPool + (*insn & 0xff)); + } + + static SH4Word patchConstantPoolLoad(SH4Word load, int value) + { + return ((load & ~0xff) | value); + } + + static SH4Buffer::TwoShorts placeConstantPoolBarrier(int offset) + { + ASSERT(((offset >> 1) <=2047) && ((offset >> 1) >= -2048)); + + SH4Buffer::TwoShorts m_barrier; + m_barrier.high = (BRA_OPCODE | (offset >> 1)); + m_barrier.low = NOP_OPCODE; + printInstr(((BRA_OPCODE | (offset >> 1))), 0); + printInstr(NOP_OPCODE, 0); + return m_barrier; + } + + static void patchConstantPoolLoad(void* loadAddr, void* constPoolAddr) + { + SH4Word* instructionPtr = reinterpret_cast<SH4Word*>(loadAddr); + SH4Word instruction = *instructionPtr; + SH4Word index = instruction & 0xff; + + if ((instruction & 0xf000) != MOVIMM_OPCODE) + return; + + ASSERT((((reinterpret_cast<uint32_t>(constPoolAddr) - reinterpret_cast<uint32_t>(loadAddr)) + index * 4)) < 1024); + + int offset = reinterpret_cast<uint32_t>(constPoolAddr) + (index * 4) - ((reinterpret_cast<uint32_t>(instructionPtr) & ~0x03) + 4); + instruction &=0xf00; + instruction |= 0xd000; + offset &= 0x03ff; + instruction |= (offset >> 2); + *instructionPtr = instruction; + printInstr(instruction, reinterpret_cast<uint32_t>(loadAddr)); + } + + static void repatchPointer(void* where, void* value) + { + patchPointer(where, value); + } + + static void repatchInt32(void* where, int32_t value) + { + uint16_t* instructionPtr = reinterpret_cast<uint16_t*>(where); + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, value); + } + + static void relinkCall(void* from, void* to) + { + uint16_t* instructionPtr = reinterpret_cast<uint16_t*>(from); + instructionPtr -= 3; + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(to)); + } + + static void relinkJump(void* from, void* to) + { + uint16_t* instructionPtr = reinterpret_cast<uint16_t*> (from); + uint16_t instruction = *instructionPtr; + int32_t offsetBits = (reinterpret_cast<uint32_t>(to) - reinterpret_cast<uint32_t>(from)); + + if (((*instructionPtr & 0xff00) == BT_OPCODE) || ((*instructionPtr & 0xff00) == BF_OPCODE)) { + offsetBits -= 8; + instructionPtr++; + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits); + instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00)); + *instructionPtr = instruction; + printBlockInstr(instructionPtr, reinterpret_cast<uint32_t>(from) + 1, 3); + return; + } + + ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE); + offsetBits -= 4; + if (offsetBits >= -4096 && offsetBits <= 4094) { + *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1); + *(++instructionPtr) = NOP_OPCODE; + printBlockInstr(instructionPtr - 2, reinterpret_cast<uint32_t>(from), 2); + return; + } + + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2); + printInstr(*instructionPtr, reinterpret_cast<uint32_t>(from)); + } + + // Linking & patching + + void linkJump(JmpSrc from, JmpDst to) + { + ASSERT(to.m_offset != -1); + ASSERT(from.m_offset != -1); + + uint16_t* instructionPtr = getInstructionPtr(data(), from.m_offset); + uint16_t instruction = *instructionPtr; + int offsetBits; + + if (((instruction & 0xff00) == BT_OPCODE) || ((instruction & 0xff00) == BF_OPCODE)) { + /* BT label => BF 2 + nop LDR reg + nop braf @reg + nop nop + */ + offsetBits = (to.m_offset - from.m_offset) - 8; + instruction ^= 0x0202; + *instructionPtr++ = instruction; + if ((*instructionPtr & 0xf000) == 0xe000) { + uint32_t* addr = getLdrImmAddressOnPool(instructionPtr, m_buffer.poolAddress()); + *addr = offsetBits; + } else + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits); + instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00)); + *instructionPtr = instruction; + printBlockInstr(instructionPtr - 2, from.m_offset, 3); + return; + } + + /* MOV # imm, reg => LDR reg + braf @reg braf @reg + nop nop + */ + ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE); + offsetBits = (to.m_offset - from.m_offset) - 4; + if (offsetBits >= -4096 && offsetBits <= 4094) { + *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1); + *(++instructionPtr) = NOP_OPCODE; + printBlockInstr(instructionPtr - 1, from.m_offset, 2); + return; + } + + instruction = *instructionPtr; + if ((instruction & 0xf000) == 0xe000) { + uint32_t* addr = getLdrImmAddressOnPool(instructionPtr, m_buffer.poolAddress()); + *addr = offsetBits - 2; + printInstr(*instructionPtr, from.m_offset + 2); + return; + } + + changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2); + printInstr(*instructionPtr, from.m_offset + 2); + } + + static void* getRelocatedAddress(void* code, JmpSrc jump) + { + return reinterpret_cast<void*>(reinterpret_cast<uint32_t>(code) + jump.m_offset); + } + + static void* getRelocatedAddress(void* code, JmpDst destination) + { + ASSERT(destination.m_offset != -1); + return reinterpret_cast<void*>(reinterpret_cast<uint32_t>(code) + destination.m_offset); + } + + static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst) + { + return dst.m_offset - src.m_offset; + } + + static int getDifferenceBetweenLabels(JmpDst src, JmpSrc dst) + { + return dst.m_offset - src.m_offset; + } + + static int getDifferenceBetweenLabels(JmpSrc src, JmpDst dst) + { + return dst.m_offset - src.m_offset; + } + + static void patchPointer(void* code, JmpDst where, void* value) + { + patchPointer(reinterpret_cast<uint32_t*>(code) + where.m_offset, value); + } + + static void patchPointer(void* code, void* value) + { + patchInt32(code, reinterpret_cast<uint32_t>(value)); + } + + static void patchInt32(void* code, uint32_t value) + { + changePCrelativeAddress((*(reinterpret_cast<uint16_t*>(code)) & 0xff), reinterpret_cast<uint16_t*>(code), value); + } + + void* executableCopy(ExecutablePool* allocator) + { + void* copy = m_buffer.executableCopy(allocator); + ASSERT(copy); + return copy; + } + + void prefix(uint16_t pre) + { + m_buffer.putByte(pre); + } + + void oneShortOp(uint16_t opcode, bool checksize = true, bool isDouble = true) + { + printInstr(opcode, m_buffer.uncheckedSize(), isDouble); + if (checksize) + m_buffer.ensureSpace(maxInstructionSize); + m_buffer.putShortUnchecked(opcode); + } + + void ensureSpace(int space) + { + m_buffer.ensureSpace(space); + } + + void ensureSpace(int insnSpace, int constSpace) + { + m_buffer.ensureSpace(insnSpace, constSpace); + } + + // Administrative methods + + void* data() const { return m_buffer.data(); } + int size() + { + return m_buffer.size(); + } + +#ifdef SH4_ASSEMBLER_TRACING + static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true) + { + if (!getenv("JavaScriptCoreDumpJIT")) + return; + + const char *format = 0; + printfStdoutInstr("offset: 0x%8.8x\t", size); + switch (opc) { + case BRK_OPCODE: + format = " BRK\n"; + break; + case NOP_OPCODE: + format = " NOP\n"; + break; + case RTS_OPCODE: + format =" *RTS\n"; + break; + case SETS_OPCODE: + format = " SETS\n"; + break; + case SETT_OPCODE: + format = " SETT\n"; + break; + case CLRT_OPCODE: + format = " CLRT\n"; + break; + case FSCHG_OPCODE: + format = " FSCHG\n"; + break; + } + if (format) { + printfStdoutInstr(format); + return; + } + switch (opc & 0xf0ff) { + case BRAF_OPCODE: + format = " *BRAF R%d\n"; + break; + case DT_OPCODE: + format = " DT R%d\n"; + break; + case CMPPL_OPCODE: + format = " CMP/PL R%d\n"; + break; + case CMPPZ_OPCODE: + format = " CMP/PZ R%d\n"; + break; + case JMP_OPCODE: + format = " *JMP @R%d\n"; + break; + case JSR_OPCODE: + format = " *JSR @R%d\n"; + break; + case LDSPR_OPCODE: + format = " LDS R%d, PR\n"; + break; + case LDSLPR_OPCODE: + format = " LDS.L @R%d+, PR\n"; + break; + case MOVT_OPCODE: + format = " MOVT R%d\n"; + break; + case SHAL_OPCODE: + format = " SHAL R%d\n"; + break; + case SHAR_OPCODE: + format = " SHAR R%d\n"; + break; + case SHLL_OPCODE: + format = " SHLL R%d\n"; + break; + case SHLL2_OPCODE: + format = " SHLL2 R%d\n"; + break; + case SHLL8_OPCODE: + format = " SHLL8 R%d\n"; + break; + case SHLL16_OPCODE: + format = " SHLL16 R%d\n"; + break; + case SHLR_OPCODE: + format = " SHLR R%d\n"; + break; + case SHLR2_OPCODE: + format = " SHLR2 R%d\n"; + break; + case SHLR8_OPCODE: + format = " SHLR8 R%d\n"; + break; + case SHLR16_OPCODE: + format = " SHLR16 R%d\n"; + break; + case STSPR_OPCODE: + format = " STS PR, R%d\n"; + break; + case STSLPR_OPCODE: + format = " STS.L PR, @-R%d\n"; + break; + case LDS_RM_FPUL_OPCODE: + format = " LDS R%d, FPUL\n"; + break; + case STS_FPUL_RN_OPCODE: + format = " STS FPUL, R%d \n"; + break; + case FLDS_FRM_FPUL_OPCODE: + format = " FLDS FR%d, FPUL\n"; + break; + case FSTS_FPUL_FRN_OPCODE: + format = " FSTS FPUL, R%d \n"; + break; + case LDSFPSCR_OPCODE: + format = " LDS R%d, FPSCR \n"; + break; + case STSFPSCR_OPCODE: + format = " STS FPSCR, R%d \n"; + break; + case STSMACL_OPCODE: + format = " STS MACL, R%d \n"; + break; + case STSMACH_OPCODE: + format = " STS MACH, R%d \n"; + break; + case BSRF_OPCODE: + format = " *BSRF R%d"; + break; + case FTRC_OPCODE: + format = " FTRC FR%d, FPUL\n"; + break; + } + if (format) { + printfStdoutInstr(format, getRn(opc)); + return; + } + switch (opc & 0xf0ff) { + case FNEG_OPCODE: + format = " FNEG DR%d\n"; + break; + case FLOAT_OPCODE: + format = " FLOAT DR%d\n"; + break; + case FTRC_OPCODE: + format = " FTRC FR%d, FPUL\n"; + break; + case FSQRT_OPCODE: + format = " FSQRT FR%d\n"; + break; + case FCNVDS_DRM_FPUL_OPCODE: + format = " FCNVDS FR%d, FPUL\n"; + break; + } + if (format) { + if (isdoubleInst) + printfStdoutInstr(format, getDRn(opc) << 1); + else + printfStdoutInstr(format, getRn(opc)); + return; + } + switch (opc & 0xf00f) { + case ADD_OPCODE: + format = " ADD R%d, R%d\n"; + break; + case ADDC_OPCODE: + format = " ADDC R%d, R%d\n"; + break; + case ADDV_OPCODE: + format = " ADDV R%d, R%d\n"; + break; + case AND_OPCODE: + format = " AND R%d, R%d\n"; + break; + case DIV1_OPCODE: + format = " DIV1 R%d, R%d\n"; + break; + case CMPEQ_OPCODE: + format = " CMP/EQ R%d, R%d\n"; + break; + case CMPGE_OPCODE: + format = " CMP/GE R%d, R%d\n"; + break; + case CMPGT_OPCODE: + format = " CMP/GT R%d, R%d\n"; + break; + case CMPHI_OPCODE: + format = " CMP/HI R%d, R%d\n"; + break; + case CMPHS_OPCODE: + format = " CMP/HS R%d, R%d\n"; + break; + case MOV_OPCODE: + format = " MOV R%d, R%d\n"; + break; + case MOVB_WRITE_RN_OPCODE: + format = " MOV.B R%d, @R%d\n"; + break; + case MOVB_WRITE_RNDEC_OPCODE: + format = " MOV.B R%d, @-R%d\n"; + break; + case MOVB_WRITE_R0RN_OPCODE: + format = " MOV.B R%d, @(R0, R%d)\n"; + break; + case MOVB_READ_RM_OPCODE: + format = " MOV.B @R%d, R%d\n"; + break; + case MOVB_READ_RMINC_OPCODE: + format = " MOV.B @R%d+, R%d\n"; + break; + case MOVB_READ_R0RM_OPCODE: + format = " MOV.B @(R0, R%d), R%d\n"; + break; + case MOVL_WRITE_RN_OPCODE: + format = " MOV.L R%d, @R%d\n"; + break; + case MOVL_WRITE_RNDEC_OPCODE: + format = " MOV.L R%d, @-R%d\n"; + break; + case MOVL_WRITE_R0RN_OPCODE: + format = " MOV.L R%d, @(R0, R%d)\n"; + break; + case MOVL_READ_RM_OPCODE: + format = " MOV.L @R%d, R%d\n"; + break; + case MOVL_READ_RMINC_OPCODE: + format = " MOV.L @R%d+, R%d\n"; + break; + case MOVL_READ_R0RM_OPCODE: + format = " MOV.L @(R0, R%d), R%d\n"; + break; + case MULL_OPCODE: + format = " MUL.L R%d, R%d\n"; + break; + case DMULL_L_OPCODE: + format = " DMULU.L R%d, R%d\n"; + break; + case DMULSL_OPCODE: + format = " DMULS.L R%d, R%d\n"; + break; + case NEG_OPCODE: + format = " NEG R%d, R%d\n"; + break; + case NEGC_OPCODE: + format = " NEGC R%d, R%d\n"; + break; + case NOT_OPCODE: + format = " NOT R%d, R%d\n"; + break; + case OR_OPCODE: + format = " OR R%d, R%d\n"; + break; + case SHAD_OPCODE: + format = " SHAD R%d, R%d\n"; + break; + case SHLD_OPCODE: + format = " SHLD R%d, R%d\n"; + break; + case SUB_OPCODE: + format = " SUB R%d, R%d\n"; + break; + case SUBC_OPCODE: + format = " SUBC R%d, R%d\n"; + break; + case SUBV_OPCODE: + format = " SUBV R%d, R%d\n"; + break; + case TST_OPCODE: + format = " TST R%d, R%d\n"; + break; + case XOR_OPCODE: + format = " XOR R%d, R%d\n";break; + case MOVW_WRITE_RN_OPCODE: + format = " MOV.W R%d, @R%d\n"; + break; + case MOVW_READ_RM_OPCODE: + format = " MOV.W @R%d, R%d\n"; + break; + case MOVW_READ_R0RM_OPCODE: + format = " MOV.W @(R0, R%d), R%d\n"; + break; + case EXTUW_OPCODE: + format = " EXTU.W R%d, R%d\n"; + break; + } + if (format) { + printfStdoutInstr(format, getRm(opc), getRn(opc)); + return; + } + switch (opc & 0xf00f) { + case FSUB_OPCODE: + format = " FSUB FR%d, FR%d\n"; + break; + case FADD_OPCODE: + format = " FADD FR%d, FR%d\n"; + break; + case FDIV_OPCODE: + format = " FDIV FR%d, FR%d\n"; + break; + case FMUL_OPCODE: + format = " DMULL FR%d, FR%d\n"; + break; + case FMOV_OPCODE: + format = " FMOV FR%d, FR%d\n"; + break; + case FCMPEQ_OPCODE: + format = " FCMP/EQ FR%d, FR%d\n"; + break; + case FCMPGT_OPCODE: + format = " FCMP/GT FR%d, FR%d\n"; + break; + } + if (format) { + if (isdoubleInst) + printfStdoutInstr(format, getDRm(opc) << 1, getDRn(opc) << 1); + else + printfStdoutInstr(format, getRm(opc), getRn(opc)); + return; + } + switch (opc & 0xf00f) { + case FMOVS_WRITE_RN_DEC_OPCODE: + format = " %s FR%d, @-R%d\n"; + break; + case FMOVS_WRITE_RN_OPCODE: + format = " %s FR%d, @R%d\n"; + break; + case FMOVS_WRITE_R0RN_OPCODE: + format = " %s FR%d, @(R0, R%d)\n"; + break; + } + if (format) { + if (isdoubleInst) + printfStdoutInstr(format, "FMOV", getDRm(opc) << 1, getDRn(opc)); + else + printfStdoutInstr(format, "FMOV.S", getRm(opc), getRn(opc)); + return; + } + switch (opc & 0xf00f) { + case FMOVS_READ_RM_OPCODE: + format = " %s @R%d, FR%d\n"; + break; + case FMOVS_READ_RM_INC_OPCODE: + format = " %s @R%d+, FR%d\n"; + break; + case FMOVS_READ_R0RM_OPCODE: + format = " %s @(R0, R%d), FR%d\n"; + break; + } + if (format) { + if (isdoubleInst) + printfStdoutInstr(format, "FMOV", getDRm(opc), getDRn(opc) << 1); + else + printfStdoutInstr(format, "FMOV.S", getRm(opc), getRn(opc)); + return; + } + switch (opc & 0xff00) { + case BF_OPCODE: + format = " BF %d\n"; + break; + case BFS_OPCODE: + format = " *BF/S %d\n"; + break; + case ANDIMM_OPCODE: + format = " AND #%d, R0\n"; + break; + case BT_OPCODE: + format = " BT %d\n"; + break; + case BTS_OPCODE: + format = " *BT/S %d\n"; + break; + case CMPEQIMM_OPCODE: + format = " CMP/EQ #%d, R0\n"; + break; + case MOVB_WRITE_OFFGBR_OPCODE: + format = " MOV.B R0, @(%d, GBR)\n"; + break; + case MOVB_READ_OFFGBR_OPCODE: + format = " MOV.B @(%d, GBR), R0\n"; + break; + case MOVL_WRITE_OFFGBR_OPCODE: + format = " MOV.L R0, @(%d, GBR)\n"; + break; + case MOVL_READ_OFFGBR_OPCODE: + format = " MOV.L @(%d, GBR), R0\n"; + break; + case MOVA_READ_OFFPC_OPCODE: + format = " MOVA @(%d, PC), R0\n"; + break; + case ORIMM_OPCODE: + format = " OR #%d, R0\n"; + break; + case ORBIMM_OPCODE: + format = " OR.B #%d, @(R0, GBR)\n"; + break; + case TSTIMM_OPCODE: + format = " TST #%d, R0\n"; + break; + case TSTB_OPCODE: + format = " TST.B %d, @(R0, GBR)\n"; + break; + case XORIMM_OPCODE: + format = " XOR #%d, R0\n"; + break; + case XORB_OPCODE: + format = " XOR.B %d, @(R0, GBR)\n"; + break; + } + if (format) { + printfStdoutInstr(format, getImm8(opc)); + return; + } + switch (opc & 0xff00) { + case MOVB_WRITE_OFFRN_OPCODE: + format = " MOV.B R0, @(%d, R%d)\n"; + break; + case MOVB_READ_OFFRM_OPCODE: + format = " MOV.B @(%d, R%d), R0\n"; + break; + } + if (format) { + printfStdoutInstr(format, getDisp(opc), getRm(opc)); + return; + } + switch (opc & 0xf000) { + case BRA_OPCODE: + format = " *BRA %d\n"; + break; + case BSR_OPCODE: + format = " *BSR %d\n"; + break; + } + if (format) { + printfStdoutInstr(format, getImm12(opc)); + return; + } + switch (opc & 0xf000) { + case MOVL_READ_OFFPC_OPCODE: + format = " MOV.L @(%d, PC), R%d\n"; + break; + case ADDIMM_OPCODE: + format = " ADD #%d, R%d\n"; + break; + case MOVIMM_OPCODE: + format = " MOV #%d, R%d\n"; + break; + case MOVW_READ_OFFPC_OPCODE: + format = " MOV.W @(%d, PC), R%d\n"; + break; + } + if (format) { + printfStdoutInstr(format, getImm8(opc), getRn(opc)); + return; + } + switch (opc & 0xf000) { + case MOVL_WRITE_OFFRN_OPCODE: + format = " MOV.L R%d, @(%d, R%d)\n"; + printfStdoutInstr(format, getRm(opc), getDisp(opc), getRn(opc)); + break; + case MOVL_READ_OFFRM_OPCODE: + format = " MOV.L @(%d, R%d), R%d\n"; + printfStdoutInstr(format, getDisp(opc), getRm(opc), getRn(opc)); + break; + } + } + + static void printfStdoutInstr(const char* format, ...) + { + if (getenv("JavaScriptCoreDumpJIT")) { + va_list args; + va_start(args, format); + vprintfStdoutInstr(format, args); + va_end(args); + } + } + + static void vprintfStdoutInstr(const char* format, va_list args) + { + if (getenv("JavaScriptCoreDumpJIT")) + vfprintf(stdout, format, args); + } + + static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr) + { + printfStdoutInstr(">> repatch instructions after link\n"); + for (int i = 0; i <= nbInstr; i++) + printInstr(*(first + i), offset + i); + printfStdoutInstr(">> end repatch\n"); + } +#else + static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true) {}; + static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr) {}; +#endif + +private: + SH4Buffer m_buffer; + int m_claimscratchReg; +}; + +} // namespace JSC + +#endif // ENABLE(ASSEMBLER) && CPU(SH4) + +#endif // SH4Assembler_h diff --git a/Source/JavaScriptCore/assembler/X86Assembler.h b/Source/JavaScriptCore/assembler/X86Assembler.h index 4851c1e..1fcfc93 100644 --- a/Source/JavaScriptCore/assembler/X86Assembler.h +++ b/Source/JavaScriptCore/assembler/X86Assembler.h @@ -1637,6 +1637,12 @@ public: return copy; } + void rewindToLabel(JmpDst rewindTo) { m_formatter.rewindToLabel(rewindTo); } + +#ifndef NDEBUG + unsigned debugOffset() { return m_formatter.debugOffset(); } +#endif + private: static void setPointer(void* where, void* value) @@ -1936,6 +1942,12 @@ private: void* data() const { return m_buffer.data(); } void* executableCopy(ExecutablePool* allocator) { return m_buffer.executableCopy(allocator); } + void rewindToLabel(JmpDst rewindTo) { m_buffer.rewindToOffset(rewindTo.m_offset); } + +#ifndef NDEBUG + unsigned debugOffset() { return m_buffer.debugOffset(); } +#endif + private: // Internals; ModRm and REX formatters. diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 98bbb3c..0e648ba 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1390,31 +1390,9 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlo CodeBlock::~CodeBlock() { -#if ENABLE(INTERPRETER) - for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i) - derefStructures(&m_instructions[m_globalResolveInstructions[i]]); - - for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) - derefStructures(&m_instructions[m_propertyAccessInstructions[i]]); -#endif #if ENABLE(JIT) - for (size_t size = m_globalResolveInfos.size(), i = 0; i < size; ++i) { - if (m_globalResolveInfos[i].structure) - m_globalResolveInfos[i].structure->deref(); - } - for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i) m_structureStubInfos[i].deref(); - - for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) { - if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure) { - structure->deref(); - // Both members must be filled at the same time - ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure); - m_methodCallLinkInfos[i].cachedPrototypeStructure->deref(); - } - } - #endif // ENABLE(JIT) #if DUMP_CODE_BLOCK_STATISTICS @@ -1422,35 +1400,37 @@ CodeBlock::~CodeBlock() #endif } -void CodeBlock::derefStructures(Instruction* vPC) const +void CodeBlock::markStructures(MarkStack& markStack, Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self)) { - vPC[4].u.structure->deref(); + markStack.append(&vPC[4].u.structure); return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto)) { - vPC[4].u.structure->deref(); - vPC[5].u.structure->deref(); + markStack.append(&vPC[4].u.structure); + markStack.append(&vPC[5].u.structure); return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) { - vPC[4].u.structure->deref(); + markStack.append(&vPC[4].u.structure); + markStack.append(&vPC[5].u.structureChain); return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) { - vPC[4].u.structure->deref(); - vPC[5].u.structure->deref(); + markStack.append(&vPC[4].u.structure); + markStack.append(&vPC[5].u.structure); + markStack.append(&vPC[6].u.structureChain); return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) { - vPC[4].u.structure->deref(); + markStack.append(&vPC[4].u.structure); return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global) || vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global_dynamic)) { if (vPC[3].u.structure) - vPC[3].u.structure->deref(); + markStack.append(&vPC[3].u.structure); return; } if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) @@ -1460,7 +1440,7 @@ void CodeBlock::derefStructures(Instruction* vPC) const || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto_list)) || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self_list))) { PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures; - polymorphicStructures->derefStructures(vPC[5].u.operand); + polymorphicStructures->markAggregate(markStack, vPC[5].u.operand); delete polymorphicStructures; return; } @@ -1469,37 +1449,6 @@ void CodeBlock::derefStructures(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) || vPC[0].u.opcode == interpreter->getOpcode(op_get_array_length) || vPC[0].u.opcode == interpreter->getOpcode(op_get_string_length)); } -void CodeBlock::refStructures(Instruction* vPC) const -{ - Interpreter* interpreter = m_globalData->interpreter; - - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self)) { - vPC[4].u.structure->ref(); - return; - } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto)) { - vPC[4].u.structure->ref(); - vPC[5].u.structure->ref(); - return; - } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) { - vPC[4].u.structure->ref(); - return; - } - if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) { - vPC[4].u.structure->ref(); - vPC[5].u.structure->ref(); - return; - } - if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) { - vPC[4].u.structure->ref(); - return; - } - - // These instructions don't ref their Structures. - 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 EvalCodeCache::markAggregate(MarkStack& markStack) { EvalCacheMap::iterator end = m_cacheMap.end(); @@ -1524,18 +1473,26 @@ void CodeBlock::markAggregate(MarkStack& markStack) markStack.append(&callLinkInfo(i).callee); #endif #if ENABLE(INTERPRETER) - Interpreter* interpreter = m_globalData->interpreter; - for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) { - Instruction* vPC = &m_instructions[m_propertyAccessInstructions[i]]; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) - markStack.append(&vPC[5].u.structureChain); - else if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) - markStack.append(&vPC[6].u.structureChain); - } + for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) + markStructures(markStack, &m_instructions[m_propertyAccessInstructions[i]]); #endif #if ENABLE(JIT) + for (size_t size = m_globalResolveInfos.size(), i = 0; i < size; ++i) { + if (m_globalResolveInfos[i].structure) + markStack.append(&m_globalResolveInfos[i].structure); + } + for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i) m_structureStubInfos[i].markAggregate(markStack); + + for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) { + if (m_methodCallLinkInfos[i].cachedStructure) { + // Both members must be filled at the same time + markStack.append(&m_methodCallLinkInfos[i].cachedStructure); + ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure); + markStack.append(&m_methodCallLinkInfos[i].cachedPrototypeStructure); + } + } #endif } diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 25e65f4..af68eb5 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -122,8 +122,6 @@ namespace JSC { struct MethodCallLinkInfo { MethodCallLinkInfo() - : cachedStructure(0) - , cachedPrototypeStructure(0) { } @@ -142,24 +140,23 @@ namespace JSC { // - Once this transition has been taken once, cachedStructure is // null and cachedPrototypeStructure is set to a nun-null value. // - Once the call is linked both structures are set to non-null values. - cachedPrototypeStructure = (Structure*)1; + cachedPrototypeStructure.setWithoutWriteBarrier((Structure*)1); } CodeLocationCall callReturnLocation; CodeLocationDataLabelPtr structureLabel; - Structure* cachedStructure; - Structure* cachedPrototypeStructure; + WriteBarrier<Structure> cachedStructure; + WriteBarrier<Structure> cachedPrototypeStructure; }; struct GlobalResolveInfo { GlobalResolveInfo(unsigned bytecodeOffset) - : structure(0) - , offset(0) + : offset(0) , bytecodeOffset(bytecodeOffset) { } - Structure* structure; + WriteBarrier<Structure> structure; unsigned offset; unsigned bytecodeOffset; }; @@ -215,8 +212,6 @@ namespace JSC { virtual ~CodeBlock(); void markAggregate(MarkStack&); - void refStructures(Instruction* vPC) const; - void derefStructures(Instruction* vPC) const; static void dumpStatistics(); @@ -486,6 +481,7 @@ namespace JSC { void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; #endif + void markStructures(MarkStack&, Instruction* vPC) const; void createRareDataIfNecessary() { diff --git a/Source/JavaScriptCore/bytecode/Instruction.h b/Source/JavaScriptCore/bytecode/Instruction.h index da0821d..d9cbb11 100644 --- a/Source/JavaScriptCore/bytecode/Instruction.h +++ b/Source/JavaScriptCore/bytecode/Instruction.h @@ -33,6 +33,7 @@ #include "Opcode.h" #include "PropertySlot.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/VectorTraits.h> #define POLYMORPHIC_LIST_CACHE_SIZE 8 @@ -60,45 +61,45 @@ namespace JSC { struct PolymorphicStubInfo { bool isChain; PolymorphicAccessStructureListStubRoutineType stubRoutine; - Structure* base; + WriteBarrier<Structure> base; union { - Structure* proto; + WriteBarrierBase<Structure> proto; WriteBarrierBase<StructureChain> chain; } u; - void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base) + void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base) { stubRoutine = _stubRoutine; - base = _base; - u.proto = 0; + base.set(globalData, owner, _base); + u.proto.clear(); isChain = false; } - void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto) + void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto) { stubRoutine = _stubRoutine; - base = _base; - u.proto = _proto; + base.set(globalData, owner, _base); + u.proto.set(globalData, owner, _proto); isChain = false; } void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain) { stubRoutine = _stubRoutine; - base = _base; + base.set(globalData, owner, _base); u.chain.set(globalData, owner, _chain); isChain = true; } } list[POLYMORPHIC_LIST_CACHE_SIZE]; - PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase) + PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase) { - list[0].set(stubRoutine, firstBase); + list[0].set(globalData, owner, stubRoutine, firstBase); } - PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto) + PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto) { - list[0].set(stubRoutine, firstBase, firstProto); + list[0].set(globalData, owner, stubRoutine, firstBase, firstProto); } PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain) @@ -106,28 +107,16 @@ namespace JSC { list[0].set(globalData, owner, stubRoutine, firstBase, firstChain); } - void derefStructures(int count) - { - for (int i = 0; i < count; ++i) { - PolymorphicStubInfo& info = list[i]; - - ASSERT(info.base); - info.base->deref(); - - if (info.u.proto) { - if (!info.isChain) - info.u.proto->deref(); - } - } - } - void markAggregate(MarkStack& markStack, int count) { for (int i = 0; i < count; ++i) { PolymorphicStubInfo& info = list[i]; ASSERT(info.base); - if (info.u.proto && info.isChain) + markStack.append(&info.base); + if (info.u.proto && !info.isChain) + markStack.append(&info.u.proto); + if (info.u.chain && info.isChain) markStack.append(&info.u.chain); } } @@ -152,7 +141,11 @@ namespace JSC { u.operand = operand; } - Instruction(Structure* structure) { u.structure = structure; } + Instruction(JSGlobalData& globalData, JSCell* owner, Structure* structure) + { + u.structure.clear(); + u.structure.set(globalData, owner, structure); + } Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain) { u.structureChain.clear(); @@ -169,12 +162,16 @@ namespace JSC { union { Opcode opcode; int operand; - Structure* structure; + WriteBarrierBase<Structure> structure; WriteBarrierBase<StructureChain> structureChain; WriteBarrierBase<JSCell> jsCell; PolymorphicAccessStructureList* polymorphicStructures; PropertySlot::GetValueFunc getterFunc; } u; + + private: + Instruction(StructureChain*); + Instruction(Structure*); }; } // namespace JSC diff --git a/Source/JavaScriptCore/bytecode/SamplingTool.h b/Source/JavaScriptCore/bytecode/SamplingTool.h index a0696b1..74b4852 100644 --- a/Source/JavaScriptCore/bytecode/SamplingTool.h +++ b/Source/JavaScriptCore/bytecode/SamplingTool.h @@ -29,13 +29,13 @@ #ifndef SamplingTool_h #define SamplingTool_h +#include "Strong.h" +#include "Nodes.h" +#include "Opcode.h" #include <wtf/Assertions.h> #include <wtf/HashMap.h> #include <wtf/Threading.h> -#include "Nodes.h" -#include "Opcode.h" - namespace JSC { class ScriptExecutable; @@ -113,7 +113,7 @@ namespace JSC { void sample(CodeBlock*, Instruction*); - Global<ScriptExecutable> m_executable; + Strong<ScriptExecutable> m_executable; CodeBlock* m_codeBlock; int m_sampleCount; int m_opcodeSampleCount; diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp index 4d59ac1..be5760a 100644 --- a/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp +++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp @@ -35,42 +35,28 @@ namespace JSC { void StructureStubInfo::deref() { switch (accessType) { - case access_get_by_id_self: - u.getByIdSelf.baseObjectStructure->deref(); - return; - case access_get_by_id_proto: - u.getByIdProto.baseObjectStructure->deref(); - u.getByIdProto.prototypeStructure->deref(); - return; - case access_get_by_id_chain: - u.getByIdChain.baseObjectStructure->deref(); - return; case access_get_by_id_self_list: { PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; - polymorphicStructures->derefStructures(u.getByIdSelfList.listSize); delete polymorphicStructures; return; } case access_get_by_id_proto_list: { PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList; - polymorphicStructures->derefStructures(u.getByIdProtoList.listSize); delete polymorphicStructures; return; } + case access_get_by_id_self: + case access_get_by_id_proto: + case access_get_by_id_chain: case access_put_by_id_transition: - u.putByIdTransition.previousStructure->deref(); - u.putByIdTransition.structure->deref(); - return; case access_put_by_id_replace: - u.putByIdReplace.baseObjectStructure->deref(); - return; 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. + // These instructions don't have to release any allocated memory return; default: ASSERT_NOT_REACHED(); @@ -81,10 +67,15 @@ void StructureStubInfo::markAggregate(MarkStack& markStack) { switch (accessType) { case access_get_by_id_self: + markStack.append(&u.getByIdSelf.baseObjectStructure); return; case access_get_by_id_proto: + markStack.append(&u.getByIdProto.baseObjectStructure); + markStack.append(&u.getByIdProto.prototypeStructure); return; case access_get_by_id_chain: + markStack.append(&u.getByIdChain.baseObjectStructure); + markStack.append(&u.getByIdChain.chain); return; case access_get_by_id_self_list: { PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; @@ -97,8 +88,12 @@ void StructureStubInfo::markAggregate(MarkStack& markStack) return; } case access_put_by_id_transition: + markStack.append(&u.putByIdTransition.previousStructure); + markStack.append(&u.putByIdTransition.structure); + markStack.append(&u.putByIdTransition.chain); return; case access_put_by_id_replace: + markStack.append(&u.putByIdReplace.baseObjectStructure); return; case access_get_by_id: case access_put_by_id: @@ -106,7 +101,7 @@ void StructureStubInfo::markAggregate(MarkStack& markStack) case access_put_by_id_generic: case access_get_array_length: case access_get_string_length: - // These instructions don't ref their Structures. + // These instructions don't need to mark anything return; default: ASSERT_NOT_REACHED(); diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.h b/Source/JavaScriptCore/bytecode/StructureStubInfo.h index 28202f9..bfeeb1e 100644 --- a/Source/JavaScriptCore/bytecode/StructureStubInfo.h +++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.h @@ -58,33 +58,27 @@ namespace JSC { { } - void initGetByIdSelf(Structure* baseObjectStructure) + void initGetByIdSelf(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure) { accessType = access_get_by_id_self; - u.getByIdSelf.baseObjectStructure = baseObjectStructure; - baseObjectStructure->ref(); + u.getByIdSelf.baseObjectStructure.set(globalData, owner, baseObjectStructure); } - void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure) + void initGetByIdProto(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, Structure* prototypeStructure) { accessType = access_get_by_id_proto; - u.getByIdProto.baseObjectStructure = baseObjectStructure; - baseObjectStructure->ref(); - - u.getByIdProto.prototypeStructure = prototypeStructure; - prototypeStructure->ref(); + u.getByIdProto.baseObjectStructure.set(globalData, owner, baseObjectStructure); + u.getByIdProto.prototypeStructure.set(globalData, owner, prototypeStructure); } - void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain) + void initGetByIdChain(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, StructureChain* chain) { accessType = access_get_by_id_chain; - u.getByIdChain.baseObjectStructure = baseObjectStructure; - baseObjectStructure->ref(); - - u.getByIdChain.chain = chain; + u.getByIdChain.baseObjectStructure.set(globalData, owner, baseObjectStructure); + u.getByIdChain.chain.set(globalData, owner, chain); } void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize) @@ -105,25 +99,20 @@ namespace JSC { // PutById* - void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain) + void initPutByIdTransition(JSGlobalData& globalData, JSCell* owner, Structure* previousStructure, Structure* structure, StructureChain* chain) { accessType = access_put_by_id_transition; - u.putByIdTransition.previousStructure = previousStructure; - previousStructure->ref(); - - u.putByIdTransition.structure = structure; - structure->ref(); - - u.putByIdTransition.chain = chain; + u.putByIdTransition.previousStructure.set(globalData, owner, previousStructure); + u.putByIdTransition.structure.set(globalData, owner, structure); + u.putByIdTransition.chain.set(globalData, owner, chain); } - void initPutByIdReplace(Structure* baseObjectStructure) + void initPutByIdReplace(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure) { accessType = access_put_by_id_replace; - u.putByIdReplace.baseObjectStructure = baseObjectStructure; - baseObjectStructure->ref(); + u.putByIdReplace.baseObjectStructure.set(globalData, owner, baseObjectStructure); } void deref(); @@ -144,15 +133,15 @@ namespace JSC { union { struct { - Structure* baseObjectStructure; + WriteBarrierBase<Structure> baseObjectStructure; } getByIdSelf; struct { - Structure* baseObjectStructure; - Structure* prototypeStructure; + WriteBarrierBase<Structure> baseObjectStructure; + WriteBarrierBase<Structure> prototypeStructure; } getByIdProto; struct { - Structure* baseObjectStructure; - StructureChain* chain; + WriteBarrierBase<Structure> baseObjectStructure; + WriteBarrierBase<StructureChain> chain; } getByIdChain; struct { PolymorphicAccessStructureList* structureList; @@ -163,12 +152,12 @@ namespace JSC { int listSize; } getByIdProtoList; struct { - Structure* previousStructure; - Structure* structure; - StructureChain* chain; + WriteBarrierBase<Structure> previousStructure; + WriteBarrierBase<Structure> structure; + WriteBarrierBase<StructureChain> chain; } putByIdTransition; struct { - Structure* baseObjectStructure; + WriteBarrierBase<Structure> baseObjectStructure; } putByIdReplace; } u; diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 5af3420..83e4592 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -262,7 +262,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, ScopeChainNode* s Vector<std::pair<int, bool>, 16> functionInfo(functionStack.size()); for (size_t i = 0; i < functionStack.size(); ++i) { FunctionBodyNode* function = functionStack[i]; - globalObject->removeDirect(function->ident()); // Make sure our new function is not shadowed by an old property. + globalObject->removeDirect(*m_globalData, function->ident()); // Make sure our new function is not shadowed by an old property. SymbolTableEntry entry = symbolTable->inlineGet(function->ident().impl()); if (entry.isNull()) @@ -1103,7 +1103,7 @@ RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, bool b) RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, double number) { - // FIXME: Our hash tables won't hold infinity, so we make a new JSNumberCell each time. + // FIXME: Our hash tables won't hold infinity, so we make a new JSValue each time. // Later we can do the extra work to handle that like the other cases. They also don't // work correctly with NaN as a key. if (isnan(number) || number == HashTraits<double>::emptyValue() || HashTraits<double>::isDeletedValue(number)) diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 3a40390..05a955b 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -513,7 +513,7 @@ namespace JSC { bool m_shouldEmitProfileHooks; bool m_shouldEmitRichSourceInfo; - Global<ScopeChainNode> m_scopeChain; + Strong<ScopeChainNode> m_scopeChain; SymbolTable* m_symbolTable; ScopeNode* m_scopeNode; diff --git a/Source/JavaScriptCore/collector/handles/Global.h b/Source/JavaScriptCore/collector/handles/Global.h deleted file mode 100644 index 571fe31..0000000 --- a/Source/JavaScriptCore/collector/handles/Global.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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. - */ - -#ifndef Global_h -#define Global_h - -#include "Assertions.h" -#include "Handle.h" -#include "HandleHeap.h" -#include "JSGlobalData.h" - -namespace JSC { - -/* - A Global is a persistent handle whose lifetime is not limited to any given - scope. Use Globals for data members and global variables. -*/ - -template <typename T> class Global : public Handle<T> { -public: - typedef typename Handle<T>::ExternalType ExternalType; - Global(JSGlobalData& globalData, ExternalType ptr = ExternalType()) - : Handle<T>(globalData.allocateGlobalHandle()) - { - internalSet(ptr); - } - - Global(JSGlobalData& globalData, Handle<T> handle) - : Handle<T>(globalData.allocateGlobalHandle()) - { - internalSet(handle.get()); - } - - enum EmptyValueTag { EmptyValue }; - Global(EmptyValueTag) - : Handle<T>(0, HandleBase::DontNullCheckSlot) - { - } - - ~Global() - { - HandleSlot slot = this->slot(); - if (slot) - HandleHeap::heapFor(slot)->deallocate(slot); - } - - void set(JSGlobalData& globalData, ExternalType value) - { - if (!value) { - clear(); - return; - } - if (!this->slot()) - this->setSlot(globalData.allocateGlobalHandle()); - internalSet(value); - } - - template <typename U> Global& operator=(const Global<U>& handle) - { - if (handle.slot()) { - if (!this->slot()) - this->setSlot(HandleHeap::heapFor(handle.slot())->allocate()); - internalSet(handle.get()); - } else - clear(); - - return *this; - } - - Global& operator=(const Global& handle) - { - if (handle.slot()) { - if (!this->slot()) - this->setSlot(HandleHeap::heapFor(handle.slot())->allocate()); - internalSet(handle.get()); - } else - clear(); - - return *this; - } - - void clear() - { - if (this->slot()) - internalSet(ExternalType()); - } - - enum HashTableDeletedValueType { HashTableDeletedValue }; - const static intptr_t HashTableDeletedValueTag = 0x1; - Global(HashTableDeletedValueType) - : Handle<T>(reinterpret_cast<HandleSlot>(HashTableDeletedValueTag)) - { - } - bool isHashTableDeletedValue() const { return slot() == reinterpret_cast<HandleSlot>(HashTableDeletedValueTag); } - - template <typename U> Global(const Global<U>& other) - : Handle<T>(other.slot() ? HandleHeap::heapFor(other.slot())->allocate() : 0, Handle<T>::DontNullCheckSlot) - { - if (other.slot()) - internalSet(other.get()); - } - - Global(const Global& other) - : Handle<T>(other.slot() ? HandleHeap::heapFor(other.slot())->allocate() : 0, Handle<T>::DontNullCheckSlot) - { - if (other.slot()) - internalSet(other.get()); - } - -protected: - void internalSet(ExternalType value) - { - JSValue newValue(HandleTypes<T>::toJSValue(value)); - HandleSlot slot = this->slot(); - ASSERT(slot); - HandleHeap::heapFor(slot)->writeBarrier(slot, newValue); - *slot = newValue; - } - - using Handle<T>::slot; - -}; - -} - -namespace WTF { - -template<typename P> struct HashTraits<JSC::Global<P> > : GenericHashTraits<JSC::Global<P> > { - static const bool emptyValueIsZero = true; - static JSC::Global<P> emptyValue() { return JSC::Global<P>(JSC::Global<P>::EmptyValue); } - static void constructDeletedValue(JSC::Global<P>& slot) { new (&slot) JSC::Global<P>(JSC::Global<P>::HashTableDeletedValue); } - static bool isDeletedValue(const JSC::Global<P>& value) { return value.isHashTableDeletedValue(); } -}; - -} - -#endif // Global_h diff --git a/Source/JavaScriptCore/config.h b/Source/JavaScriptCore/config.h index ea10e77..394bba5 100644 --- a/Source/JavaScriptCore/config.h +++ b/Source/JavaScriptCore/config.h @@ -59,8 +59,8 @@ #define JS_EXPORTCLASS #endif -#define WTF_EXPORT_PRIVATE JS_EXPORTDATA -#define JS_EXPORT_PRIVATE JS_EXPORTDATA +#define WTF_EXPORT_PRIVATE +#define JS_EXPORT_PRIVATE #endif /* USE(EXPORT_MACROS) */ diff --git a/Source/JavaScriptCore/create_regex_tables b/Source/JavaScriptCore/create_regex_tables index c6ce995..bd799ba 100644 --- a/Source/JavaScriptCore/create_regex_tables +++ b/Source/JavaScriptCore/create_regex_tables @@ -35,6 +35,7 @@ types = { entriesPerLine = 50 arrays = ""; functions = ""; +emitTables = (len(sys.argv) < 2 or sys.argv[1] != "--no-tables") for name, classes in types.items(): ranges = []; @@ -56,7 +57,7 @@ for name, classes in types.items(): ranges.append((min,max)) ranges.sort(); - if classes["UseTable"] and (not "Inverse" in classes): + if emitTables and classes["UseTable"] and (not "Inverse" in classes): array = ("static const char _%sData[65536] = {\n" % name); i = 0 for (min,max) in ranges: @@ -87,7 +88,7 @@ for name, classes in types.items(): function = ""; function += ("CharacterClass* %sCreate()\n" % name) function += ("{\n") - if classes["UseTable"]: + if emitTables and classes["UseTable"]: if "Inverse" in classes: function += (" CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, true));\n" % (classes["Inverse"])) else: diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp index 50ba746..67a796a 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -31,7 +31,7 @@ namespace JSC { DebuggerActivation::DebuggerActivation(JSGlobalData& globalData, JSObject* activation) - : JSNonFinalObject(DebuggerActivation::createStructure(globalData, jsNull())) + : JSNonFinalObject(globalData, DebuggerActivation::createStructure(globalData, jsNull())) { ASSERT(activation); ASSERT(activation->isActivationObject()); diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.h b/Source/JavaScriptCore/debugger/DebuggerActivation.h index f22d2ff..bfb36db 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.h +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.h @@ -49,7 +49,7 @@ namespace JSC { virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index 03f5d4f..1d4c36a 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -34,6 +34,13 @@ namespace JSC { namespace DFG { +#if ENABLE(DFG_JIT_RESTRICTIONS) +// FIXME: Temporarily disable arithmetic, until we fix associated performance regressions. +#define ARITHMETIC_OP() m_parseFailed = true +#else +#define ARITHMETIC_OP() ((void)0) +#endif + // === ByteCodeParser === // // This class is used to compile the dataflow graph from a CodeBlock. @@ -44,93 +51,137 @@ public: , m_codeBlock(codeBlock) , m_graph(graph) , m_currentIndex(0) - , m_noArithmetic(true) + , m_parseFailed(false) , m_constantUndefined(UINT_MAX) + , m_constantNull(UINT_MAX) , m_constant1(UINT_MAX) + , m_constants(codeBlock->numberOfConstantRegisters()) + , m_arguments(codeBlock->m_numParameters) + , m_variables(codeBlock->m_numVars) + , m_temporaries(codeBlock->m_numCalleeRegisters - codeBlock->m_numVars) { - unsigned numberOfConstants = codeBlock->numberOfConstantRegisters(); - m_constantRecords.grow(numberOfConstants); - - unsigned numberOfParameters = codeBlock->m_numParameters; - m_arguments.grow(numberOfParameters); - for (unsigned i = 0; i < numberOfParameters; ++i) - m_arguments[i] = NoNode; - - unsigned numberOfRegisters = codeBlock->m_numCalleeRegisters; - m_calleeRegisters.grow(numberOfRegisters); - for (unsigned i = 0; i < numberOfRegisters; ++i) - m_calleeRegisters[i] = NoNode; + for (unsigned i = 0; i < m_temporaries.size(); ++i) + m_temporaries[i] = NoNode; } + // Parse a full CodeBlock of bytecode. bool parse(); private: + // Parse a single basic block of bytecode instructions. + bool parseBlock(unsigned limit); + // Get/Set the operands/result of a bytecode instruction. NodeIndex get(int operand) { // Is this a constant? if (operand >= FirstConstantRegisterIndex) { unsigned constant = operand - FirstConstantRegisterIndex; - ASSERT(constant < m_constantRecords.size()); + ASSERT(constant < m_constants.size()); return getJSConstant(constant); } // Is this an argument? - if (operand < 0) { - unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize; - ASSERT(argument < m_arguments.size()); - return getArgument(argument); - } - - // Must be a local or temporary. - ASSERT((unsigned)operand < m_calleeRegisters.size()); - return getRegister((unsigned)operand); + if (operand < 0) + return getArgument(operand); + + // Is this a variable? + unsigned numVariables = m_variables.size(); + if ((unsigned)operand < numVariables) + return getVariable((unsigned)operand); + + // Must be a temporary. + unsigned temporary = (unsigned)operand - numVariables; + ASSERT(temporary < m_temporaries.size()); + return getTemporary(temporary); } void set(int operand, NodeIndex value) { // Is this an argument? if (operand < 0) { - unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize; - ASSERT(argument < m_arguments.size()); - return setArgument(argument, value); + setArgument(operand, value); + return; + } + + // Is this a variable? + unsigned numVariables = m_variables.size(); + if ((unsigned)operand < numVariables) { + setVariable((unsigned)operand, value); + return; } + + // Must be a temporary. + unsigned temporary = (unsigned)operand - numVariables; + ASSERT(temporary < m_temporaries.size()); + setTemporary(temporary, value); + } - // Must be a local or temporary. - ASSERT((unsigned)operand < m_calleeRegisters.size()); - return setRegister((unsigned)operand, value); + // Used in implementing get/set, above, where the operand is a local variable. + NodeIndex getVariable(unsigned operand) + { + NodeIndex setNode = m_variables[operand].set; + if (setNode != NoNode) + return m_graph[setNode].child1; + + NodeIndex getNode = m_variables[operand].get; + if (getNode != NoNode) + return getNode; + + getNode = addToGraph(GetLocal, OpInfo(operand)); + m_variables[operand].get = getNode; + return getNode; + } + void setVariable(unsigned operand, NodeIndex value) + { + NodeIndex priorSet = m_variables[operand].set; + m_variables[operand].set = addToGraph(SetLocal, OpInfo(operand), value); + if (priorSet != NoNode) + m_graph.deref(priorSet); } - // Used in implementing get/set, above, where the operand is a local or temporary. - NodeIndex getRegister(unsigned operand) + // Used in implementing get/set, above, where the operand is a temporary. + NodeIndex getTemporary(unsigned operand) { - NodeIndex index = m_calleeRegisters[operand]; + NodeIndex index = m_temporaries[operand]; if (index != NoNode) return index; - // We have not yet seen a definition for this value in this block. - // For now, since we are only generating single block functions, - // this value must be undefined. - // For example: - // function f() { var x; return x; } + + // Detect a read of an temporary that is not a yet defined within this block (e.g. use of ?:). + m_parseFailed = true; return constantUndefined(); } - void setRegister(int operand, NodeIndex value) + void setTemporary(unsigned operand, NodeIndex value) { - m_calleeRegisters[operand] = value; + m_temporaries[operand] = value; } // Used in implementing get/set, above, where the operand is an argument. - NodeIndex getArgument(unsigned argument) + NodeIndex getArgument(unsigned operand) { - NodeIndex index = m_arguments[argument]; - if (index != NoNode) - return index; - NodeIndex resultIndex = (NodeIndex)m_graph.size(); - m_graph.append(Node(Argument, m_currentIndex, OpInfo(argument))); - return m_arguments[argument] = resultIndex; + unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize; + ASSERT(argument < m_arguments.size()); + + NodeIndex setNode = m_arguments[argument].set; + if (setNode != NoNode) + return m_graph[setNode].child1; + + NodeIndex getNode = m_arguments[argument].get; + if (getNode != NoNode) + return getNode; + + getNode = addToGraph(GetLocal, OpInfo(operand)); + m_arguments[argument].get = getNode; + return getNode; } void setArgument(int operand, NodeIndex value) { - m_arguments[operand] = value; + unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize; + ASSERT(argument < m_arguments.size()); + + NodeIndex priorSet = m_arguments[argument].set; + m_arguments[argument].set = addToGraph(SetLocal, OpInfo(operand), value); + if (priorSet != NoNode) + m_graph.deref(priorSet); } // Get an operand, and perform a ToInt32/ToNumber conversion on it. @@ -229,46 +280,43 @@ private: // Used in implementing get, above, where the operand is a constant. NodeIndex getInt32Constant(int32_t value, unsigned constant) { - NodeIndex index = m_constantRecords[constant].asInt32; + NodeIndex index = m_constants[constant].asInt32; if (index != NoNode) return index; - NodeIndex resultIndex = (NodeIndex)m_graph.size(); - m_graph.append(Node(Int32Constant, m_currentIndex, OpInfo(constant))); + NodeIndex resultIndex = addToGraph(Int32Constant, OpInfo(constant)); m_graph[resultIndex].setInt32Constant(value); - m_constantRecords[constant].asInt32 = resultIndex; + m_constants[constant].asInt32 = resultIndex; return resultIndex; } NodeIndex getDoubleConstant(double value, unsigned constant) { - NodeIndex index = m_constantRecords[constant].asNumeric; + NodeIndex index = m_constants[constant].asNumeric; if (index != NoNode) return index; - NodeIndex resultIndex = (NodeIndex)m_graph.size(); - m_graph.append(Node(DoubleConstant, m_currentIndex, OpInfo(constant))); + NodeIndex resultIndex = addToGraph(DoubleConstant, OpInfo(constant)); m_graph[resultIndex].setDoubleConstant(value); - m_constantRecords[constant].asNumeric = resultIndex; + m_constants[constant].asNumeric = resultIndex; return resultIndex; } NodeIndex getJSConstant(unsigned constant) { - NodeIndex index = m_constantRecords[constant].asJSValue; + NodeIndex index = m_constants[constant].asJSValue; if (index != NoNode) return index; - NodeIndex resultIndex = (NodeIndex)m_graph.size(); - m_graph.append(Node(JSConstant, m_currentIndex, OpInfo(constant))); - m_constantRecords[constant].asJSValue = resultIndex; + NodeIndex resultIndex = addToGraph(JSConstant, OpInfo(constant)); + m_constants[constant].asJSValue = resultIndex; return resultIndex; } // Helper functions to get/set the this value. NodeIndex getThis() { - return getArgument(0); + return getArgument(m_codeBlock->thisRegister()); } void setThis(NodeIndex value) { - setArgument(0, value); + setArgument(m_codeBlock->thisRegister(), value); } // Convenience methods for checking nodes for constants. @@ -315,11 +363,11 @@ private: return getJSConstant(m_constantUndefined); } - // Add undefined to the CodeBlock's constants, and add a corresponding slot in m_constantRecords. - ASSERT(m_constantRecords.size() == numberOfConstants); + // Add undefined to the CodeBlock's constants, and add a corresponding slot in m_constants. + ASSERT(m_constants.size() == numberOfConstants); m_codeBlock->addConstant(jsUndefined()); - m_constantRecords.append(ConstantRecord()); - ASSERT(m_constantRecords.size() == m_codeBlock->numberOfConstantRegisters()); + m_constants.append(ConstantRecord()); + ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters()); } // m_constantUndefined must refer to an entry in the CodeBlock's constant pool that has the value 'undefined'. @@ -327,6 +375,31 @@ private: return getJSConstant(m_constantUndefined); } + // This method returns a JSConstant with the value 'null'. + NodeIndex constantNull() + { + // Has m_constantNull been set up yet? + if (m_constantNull == UINT_MAX) { + // Search the constant pool for null, if we find it, we can just reuse this! + unsigned numberOfConstants = m_codeBlock->numberOfConstantRegisters(); + for (m_constantNull = 0; m_constantNull < numberOfConstants; ++m_constantNull) { + JSValue testMe = m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNull); + if (testMe.isNull()) + return getJSConstant(m_constantNull); + } + + // Add null to the CodeBlock's constants, and add a corresponding slot in m_constants. + ASSERT(m_constants.size() == numberOfConstants); + m_codeBlock->addConstant(jsNull()); + m_constants.append(ConstantRecord()); + ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters()); + } + + // m_constantNull must refer to an entry in the CodeBlock's constant pool that has the value 'null'. + ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNull).isNull()); + return getJSConstant(m_constantNull); + } + // This method returns a DoubleConstant with the value 1. NodeIndex one() { @@ -340,11 +413,11 @@ private: return getDoubleConstant(1, m_constant1); } - // Add the value 1 to the CodeBlock's constants, and add a corresponding slot in m_constantRecords. - ASSERT(m_constantRecords.size() == numberOfConstants); + // Add the value 1 to the CodeBlock's constants, and add a corresponding slot in m_constants. + ASSERT(m_constants.size() == numberOfConstants); m_codeBlock->addConstant(jsNumber(1)); - m_constantRecords.append(ConstantRecord()); - ASSERT(m_constantRecords.size() == m_codeBlock->numberOfConstantRegisters()); + m_constants.append(ConstantRecord()); + ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters()); } // m_constant1 must refer to an entry in the CodeBlock's constant pool that has the integer value 1. @@ -374,6 +447,15 @@ private: m_graph.ref(resultIndex); return resultIndex; } + NodeIndex addToGraph(NodeType op, OpInfo info1, OpInfo info2, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode) + { + NodeIndex resultIndex = (NodeIndex)m_graph.size(); + m_graph.append(Node(op, m_currentIndex, info1, info2, child1, child2, child3)); + + if (op & NodeMustGenerate) + m_graph.ref(resultIndex); + return resultIndex; + } JSGlobalData* m_globalData; CodeBlock* m_codeBlock; @@ -382,8 +464,8 @@ private: // The bytecode index of the current instruction being generated. unsigned m_currentIndex; - // FIXME: used to temporarily disable arithmetic, until we fix associated performance regressions. - bool m_noArithmetic; + // Record failures due to unimplemented functionality or regressions. + bool m_parseFailed; // We use these values during code generation, and to avoid the need for // special handling we make sure they are available as constants in the @@ -391,6 +473,7 @@ private: // UINT_MAX, and lazily updated to hold an index into the CodeBlock's // constant pool, as necessary. unsigned m_constantUndefined; + unsigned m_constantNull; unsigned m_constant1; // A constant in the constant pool may be represented by more than one @@ -407,12 +490,27 @@ private: NodeIndex asNumeric; NodeIndex asJSValue; }; - Vector <ConstantRecord, 32> m_constantRecords; + + // For every local variable we track any existing get or set of the value. + // We track the get so that these may be shared, and we track the set to + // retrieve the current value, and to reference the final definition. + struct VariableRecord { + VariableRecord() + : get(NoNode) + , set(NoNode) + { + } + + NodeIndex get; + NodeIndex set; + }; // Track the index of the node whose result is the current value for every // register value in the bytecode - argument, local, and temporary. - Vector <NodeIndex, 32> m_arguments; - Vector <NodeIndex, 32> m_calleeRegisters; + Vector <ConstantRecord, 32> m_constants; + Vector <VariableRecord, 32> m_arguments; + Vector <VariableRecord, 32> m_variables; + Vector <NodeIndex, 32> m_temporaries; // These maps are used to unique ToNumber and ToInt32 operations. typedef HashMap<NodeIndex, NodeIndex> UnaryOpMap; @@ -422,15 +520,37 @@ private: #define NEXT_OPCODE(name) \ m_currentIndex += OPCODE_LENGTH(name); \ - continue; + continue -bool ByteCodeParser::parse() +#define LAST_OPCODE(name) \ + m_currentIndex += OPCODE_LENGTH(name); \ + return !m_parseFailed + +bool ByteCodeParser::parseBlock(unsigned limit) { + // No need to reset state initially, since it has been set by the constructor. + if (m_currentIndex) { + for (unsigned i = 0; i < m_constants.size(); ++i) + m_constants[i] = ConstantRecord(); + for (unsigned i = 0; i < m_variables.size(); ++i) + m_variables[i] = VariableRecord(); + for (unsigned i = 0; i < m_arguments.size(); ++i) + m_arguments[i] = VariableRecord(); + for (unsigned i = 0; i < m_temporaries.size(); ++i) + m_temporaries[i] = NoNode; + } + AliasTracker aliases(m_graph); Interpreter* interpreter = m_globalData->interpreter; Instruction* instructionsBegin = m_codeBlock->instructions().begin(); while (true) { + // Don't extend over jump destinations. + if (m_currentIndex == limit) { + addToGraph(Jump, OpInfo(m_currentIndex)); + return !m_parseFailed; + } + // Switch on the current bytecode opcode. Instruction* currentInstruction = instructionsBegin + m_currentIndex; switch (interpreter->getOpcodeID(currentInstruction->u.opcode)) { @@ -438,8 +558,9 @@ bool ByteCodeParser::parse() // === Function entry opcodes === case op_enter: - // This is a no-op for now - may need to initialize locals, if - // DCE analysis cannot determine that the values are never read. + // Initialize all locals to undefined. + for (int i = 0; i < m_codeBlock->m_numVars; ++i) + set(i, constantUndefined()); NEXT_OPCODE(op_enter); case op_convert_this: { @@ -561,7 +682,7 @@ bool ByteCodeParser::parse() // === Arithmetic operations === case op_add: { - m_noArithmetic = false; + ARITHMETIC_OP(); NodeIndex op1 = get(currentInstruction[2].u.operand); NodeIndex op2 = get(currentInstruction[3].u.operand); // If both operands can statically be determined to the numbers, then this is an arithmetic add. @@ -574,7 +695,7 @@ bool ByteCodeParser::parse() } case op_sub: { - m_noArithmetic = false; + ARITHMETIC_OP(); NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, addToGraph(ArithSub, op1, op2)); @@ -582,7 +703,7 @@ bool ByteCodeParser::parse() } case op_mul: { - m_noArithmetic = false; + ARITHMETIC_OP(); NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, addToGraph(ArithMul, op1, op2)); @@ -590,7 +711,7 @@ bool ByteCodeParser::parse() } case op_mod: { - m_noArithmetic = false; + ARITHMETIC_OP(); NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, addToGraph(ArithMod, op1, op2)); @@ -598,7 +719,7 @@ bool ByteCodeParser::parse() } case op_div: { - m_noArithmetic = false; + ARITHMETIC_OP(); NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, addToGraph(ArithDiv, op1, op2)); @@ -613,6 +734,75 @@ bool ByteCodeParser::parse() NEXT_OPCODE(op_mov); } + case op_not: { + ARITHMETIC_OP(); + NodeIndex value = get(currentInstruction[2].u.operand); + set(currentInstruction[1].u.operand, addToGraph(LogicalNot, value)); + NEXT_OPCODE(op_not); + } + + case op_less: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(CompareLess, op1, op2)); + NEXT_OPCODE(op_less); + } + + case op_lesseq: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(CompareLessEq, op1, op2)); + NEXT_OPCODE(op_lesseq); + } + + case op_eq: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(CompareEq, op1, op2)); + NEXT_OPCODE(op_eq); + } + + case op_eq_null: { + ARITHMETIC_OP(); + NodeIndex value = get(currentInstruction[2].u.operand); + set(currentInstruction[1].u.operand, addToGraph(CompareEq, value, constantNull())); + NEXT_OPCODE(op_eq_null); + } + + case op_stricteq: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(CompareStrictEq, op1, op2)); + NEXT_OPCODE(op_stricteq); + } + + case op_neq: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEq, op1, op2))); + NEXT_OPCODE(op_neq); + } + + case op_neq_null: { + ARITHMETIC_OP(); + NodeIndex value = get(currentInstruction[2].u.operand); + set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEq, value, constantNull()))); + NEXT_OPCODE(op_neq_null); + } + + case op_nstricteq: { + ARITHMETIC_OP(); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); + set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareStrictEq, op1, op2))); + NEXT_OPCODE(op_nstricteq); + } + // === Property access operations === case op_get_by_val: { @@ -624,7 +814,7 @@ bool ByteCodeParser::parse() aliases.recordGetByVal(getByVal); NEXT_OPCODE(op_get_by_val); - }; + } case op_put_by_val: { NodeIndex base = get(currentInstruction[1].u.operand); @@ -636,7 +826,7 @@ bool ByteCodeParser::parse() aliases.recordPutByVal(putByVal); NEXT_OPCODE(op_put_by_val); - }; + } case op_get_by_id: { NodeIndex base = get(currentInstruction[2].u.operand); @@ -680,35 +870,169 @@ bool ByteCodeParser::parse() // === Block terminators. === + case op_jmp: { + unsigned relativeOffset = currentInstruction[1].u.operand; + addToGraph(Jump, OpInfo(m_currentIndex + relativeOffset)); + LAST_OPCODE(op_jmp); + } + + case op_loop: { + unsigned relativeOffset = currentInstruction[1].u.operand; + addToGraph(Jump, OpInfo(m_currentIndex + relativeOffset)); + LAST_OPCODE(op_loop); + } + + case op_jtrue: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex condition = get(currentInstruction[1].u.operand); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jtrue)), condition); + LAST_OPCODE(op_jtrue); + } + + case op_jfalse: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex condition = get(currentInstruction[1].u.operand); + addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jfalse)), OpInfo(m_currentIndex + relativeOffset), condition); + LAST_OPCODE(op_jfalse); + } + + case op_loop_if_true: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex condition = get(currentInstruction[1].u.operand); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_true)), condition); + LAST_OPCODE(op_loop_if_true); + } + + case op_loop_if_false: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex condition = get(currentInstruction[1].u.operand); + addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_false)), OpInfo(m_currentIndex + relativeOffset), condition); + LAST_OPCODE(op_loop_if_false); + } + + case op_jeq_null: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex value = get(currentInstruction[1].u.operand); + NodeIndex condition = addToGraph(CompareEq, value, constantNull()); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jeq_null)), condition); + LAST_OPCODE(op_jeq_null); + } + + case op_jneq_null: { + unsigned relativeOffset = currentInstruction[2].u.operand; + NodeIndex value = get(currentInstruction[1].u.operand); + NodeIndex condition = addToGraph(CompareEq, value, constantNull()); + addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jneq_null)), OpInfo(m_currentIndex + relativeOffset), condition); + LAST_OPCODE(op_jneq_null); + } + + case op_jnless: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLess, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jnless)), OpInfo(m_currentIndex + relativeOffset), condition); + LAST_OPCODE(op_jnless); + } + + case op_jnlesseq: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLessEq, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jnlesseq)), OpInfo(m_currentIndex + relativeOffset), condition); + LAST_OPCODE(op_jnlesseq); + } + + case op_jless: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLess, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jless)), condition); + LAST_OPCODE(op_jless); + } + + case op_jlesseq: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLessEq, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jlesseq)), condition); + LAST_OPCODE(op_jlesseq); + } + + case op_loop_if_less: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLess, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_less)), condition); + LAST_OPCODE(op_loop_if_less); + } + + case op_loop_if_lesseq: { + unsigned relativeOffset = currentInstruction[3].u.operand; + NodeIndex op1 = get(currentInstruction[1].u.operand); + NodeIndex op2 = get(currentInstruction[2].u.operand); + NodeIndex condition = addToGraph(CompareLessEq, op1, op2); + addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_lesseq)), condition); + LAST_OPCODE(op_loop_if_lesseq); + } + case op_ret: { addToGraph(Return, get(currentInstruction[1].u.operand)); - m_currentIndex += OPCODE_LENGTH(op_ret); -#if ENABLE(DFG_JIT_RESTRICTIONS) - // FIXME: temporarily disabling the DFG JIT for functions containing arithmetic. - return m_noArithmetic; -#else - return true; -#endif + + // FIXME: throw away terminal definitions of variables; + // should not be necessary once we have proper DCE! + for (unsigned i = 0; i < m_variables.size(); ++i) { + NodeIndex priorSet = m_variables[i].set; + if (priorSet != NoNode) + m_graph.deref(priorSet); + } + + LAST_OPCODE(op_ret); } default: - // parse failed! + // Parse failed! return false; } } } -bool parse(Graph& graph, JSGlobalData* globalData, CodeBlock* codeBlock) +bool ByteCodeParser::parse() { - // Call ByteCodeParser::parse to build the dataflow for the basic block at 'startIndex'. - ByteCodeParser state(globalData, codeBlock, graph); - if (!state.parse()) - return false; + // Set during construction. + ASSERT(!m_currentIndex); + + for (unsigned jumpTargetIndex = 0; jumpTargetIndex <= m_codeBlock->numberOfJumpTargets(); ++jumpTargetIndex) { + // The maximum bytecode offset to go into the current basicblock is either the next jump target, or the end of the instructions. + unsigned limit = jumpTargetIndex < m_codeBlock->numberOfJumpTargets() ? m_codeBlock->jumpTarget(jumpTargetIndex) : m_codeBlock->instructions().size(); + ASSERT(m_currentIndex < limit); + + // Loop until we reach the current limit (i.e. next jump target). + do { + unsigned bytecodeBegin = m_currentIndex; + NodeIndex begin = m_graph.size(); + + if (!parseBlock(limit)) + return false; + // We should not have gone beyond the limit. + ASSERT(m_currentIndex <= limit); + + NodeIndex end = m_graph.size(); + m_graph.m_blocks.append(BasicBlock(bytecodeBegin, begin, end)); + } while (m_currentIndex < limit); + } + + // Should have reached the end of the instructions. + ASSERT(m_currentIndex == m_codeBlock->instructions().size()); // Assign VirtualRegisters. - ScoreBoard scoreBoard(graph); - Node* nodes = graph.begin(); - size_t size = graph.size(); + ScoreBoard scoreBoard(m_graph, m_variables.size()); + Node* nodes = m_graph.begin(); + size_t size = m_graph.size(); for (size_t i = 0; i < size; ++i) { Node& node = nodes[i]; if (node.refCount) { @@ -730,15 +1054,29 @@ bool parse(Graph& graph, JSGlobalData* globalData, CodeBlock* codeBlock) // 'm_numCalleeRegisters' is the number of locals and temporaries allocated // for the function (and checked for on entry). Since we perform a new and // different allocation of temporaries, more registers may now be required. - if ((unsigned)codeBlock->m_numCalleeRegisters < scoreBoard.allocatedCount()) - codeBlock->m_numCalleeRegisters = scoreBoard.allocatedCount(); + unsigned calleeRegisters = scoreBoard.allocatedCount() + m_variables.size(); + if ((unsigned)m_codeBlock->m_numCalleeRegisters < calleeRegisters) + m_codeBlock->m_numCalleeRegisters = calleeRegisters; #if DFG_DEBUG_VERBOSE - graph.dump(codeBlock); + m_graph.dump(m_codeBlock); #endif + return true; } +bool parse(Graph& graph, JSGlobalData* globalData, CodeBlock* codeBlock) +{ +#if DFG_DEBUG_LOCAL_DISBALE + UNUSED_PARAM(graph); + UNUSED_PARAM(globalData); + UNUSED_PARAM(codeBlock); + return false; +#else + return ByteCodeParser(globalData, codeBlock, graph).parse(); +#endif +} + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/dfg/DFGGenerationInfo.h b/Source/JavaScriptCore/dfg/DFGGenerationInfo.h index b3aa0cd..1c72e09 100644 --- a/Source/JavaScriptCore/dfg/DFGGenerationInfo.h +++ b/Source/JavaScriptCore/dfg/DFGGenerationInfo.h @@ -69,16 +69,6 @@ public: { } - // Used to set the generation info according the the result - // of various operations. - void initArgument(NodeIndex nodeIndex, uint32_t useCount) - { - m_nodeIndex = nodeIndex; - m_useCount = useCount; - m_registerFormat = DataFormatNone; - m_spillFormat = DataFormatNone; - m_canFill = true; - } void initConstant(NodeIndex nodeIndex, uint32_t useCount) { m_nodeIndex = nodeIndex; @@ -168,12 +158,12 @@ public: { // This should only be called on values that are currently in a register. ASSERT(m_registerFormat != DataFormatNone); - // Constants and arguments do not need spilling, nor do values - // that have already been spilled to the RegisterFile. + // Constants do not need spilling, nor do values that have already been + // spilled to the RegisterFile. return !m_canFill; } - // Called when a VirtualRegister is being spilled †o the RegisterFile for the first time. + // Called when a VirtualRegister is being spilled to the RegisterFile for the first time. void spill(DataFormat spillFormat) { // We shouldn't be spill values that don't need spilling. @@ -190,9 +180,8 @@ public: m_canFill = true; } - // Called on values that don't need spilling (constants, arguments, - // values that have already been spilled), to mark them as no longer - // being in machine registers. + // Called on values that don't need spilling (constants and values that have + // already been spilled), to mark them as no longer being in machine registers. void setSpilled() { // Should only be called on values that don't need spilling, and are currently in registers. diff --git a/Source/JavaScriptCore/dfg/DFGGraph.cpp b/Source/JavaScriptCore/dfg/DFGGraph.cpp index be3beec..84e2d4d 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.cpp +++ b/Source/JavaScriptCore/dfg/DFGGraph.cpp @@ -33,88 +33,108 @@ namespace JSC { namespace DFG { #ifndef NDEBUG -void Graph::dump(CodeBlock* codeBlock) -{ - // Creates an array of stringized names. + +// Creates an array of stringized names. +static const char* dfgOpNames[] = { #define STRINGIZE_DFG_OP_ENUM(opcode, flags) #opcode , - const char* dfgOpNames[] = { - FOR_EACH_DFG_OP(STRINGIZE_DFG_OP_ENUM) - }; + FOR_EACH_DFG_OP(STRINGIZE_DFG_OP_ENUM) #undef STRINGIZE_DFG_OP_ENUM +}; + +void Graph::dump(NodeIndex nodeIndex, CodeBlock* codeBlock) +{ + Node& node = at(nodeIndex); + NodeType op = node.op; + + unsigned refCount = node.refCount; + if (!refCount) + return; + bool mustGenerate = node.mustGenerate(); + if (mustGenerate) + --refCount; + + // Example/explanation of dataflow dump output + // + // 14: <!2:7> GetByVal(@3, @13) + // ^1 ^2 ^3 ^4 ^5 + // + // (1) The nodeIndex of this operation. + // (2) The reference count. The number printed is the 'real' count, + // not including the 'mustGenerate' ref. If the node is + // 'mustGenerate' then the count it prefixed with '!'. + // (3) The virtual register slot assigned to this node. + // (4) The name of the operation. + // (5) The arguments to the operation. The may be of the form: + // @# - a NodeIndex referencing a prior node in the graph. + // arg# - an argument number. + // $# - the index in the CodeBlock of a constant { for numeric constants the value is displayed | for integers, in both decimal and hex }. + // id# - the index in the CodeBlock of an identifier { if codeBlock is passed to dump(), the string representation is displayed }. + // var# - the index of a var on the global object, used by GetGlobalVar/PutGlobalVar operations. + printf("% 4d:\t<%c%u:%u>\t%s(", (int)nodeIndex, mustGenerate ? '!' : ' ', refCount, node.virtualRegister, dfgOpNames[op & NodeIdMask]); + if (node.child1 != NoNode) + printf("@%u", node.child1); + if (node.child2 != NoNode) + printf(", @%u", node.child2); + if (node.child3 != NoNode) + printf(", @%u", node.child3); + bool hasPrinted = node.child1 != NoNode; + + if (node.hasVarNumber()) { + printf("%svar%u", hasPrinted ? ", " : "", node.varNumber()); + hasPrinted = true; + } + if (node.hasIdentifier()) { + if (codeBlock) + printf("%sid%u{%s}", hasPrinted ? ", " : "", node.identifierNumber(), codeBlock->identifier(node.identifierNumber()).ustring().utf8().data()); + else + printf("%sid%u", hasPrinted ? ", " : "", node.identifierNumber()); + hasPrinted = true; + } + if (node.hasLocal()) { + int local = node.local(); + if (local < 0) + printf("%sarg%u", hasPrinted ? ", " : "", local - codeBlock->thisRegister()); + else + printf("%sr%u", hasPrinted ? ", " : "", local); + hasPrinted = true; + } + if (op == Int32Constant) { + printf("%s$%u{%d|0x%08x}", hasPrinted ? ", " : "", node.constantNumber(), node.int32Constant(), node.int32Constant()); + hasPrinted = true; + } + if (op == DoubleConstant) { + printf("%s$%u{%f})", hasPrinted ? ", " : "", node.constantNumber(), node.numericConstant()); + hasPrinted = true; + } + if (op == JSConstant) { + printf("%s$%u", hasPrinted ? ", " : "", node.constantNumber()); + hasPrinted = true; + } + if (node.isBranch() || node.isJump()) { + printf("%sT:#%u", hasPrinted ? ", " : "", blockIndexForBytecodeOffset(node.takenBytecodeOffset())); + hasPrinted = true; + } + if (node.isBranch()) { + printf("%sF:#%u", hasPrinted ? ", " : "", blockIndexForBytecodeOffset(node.notTakenBytecodeOffset())); + hasPrinted = true; + } + + printf(")\n"); +} - Node* nodes = this->begin(); - - for (size_t i = 0; i < size(); ++i) { - Node& node = nodes[i]; - NodeType op = node.op; - - unsigned refCount = node.refCount; - if (!refCount) - continue; - bool mustGenerate = node.mustGenerate(); - if (mustGenerate) - --refCount; - - // Example/explanation of dataflow dump output - // - // 14: <!2:7> GetByVal(@3, @13) - // ^1 ^2 ^3 ^4 ^5 - // - // (1) The nodeIndex of this operation. - // (2) The reference count. The number printed is the 'real' count, - // not including the 'mustGenerate' ref. If the node is - // 'mustGenerate' then the count it prefixed with '!'. - // (3) The virtual register slot assigned to this node. - // (4) The name of the operation. - // (5) The arguments to the operation. The may be of the form: - // @# - a NodeIndex referencing a prior node in the graph. - // arg# - an argument number. - // $# - the index in the CodeBlock of a constant { for numeric constants the value is displayed | for integers, in both decimal and hex }. - // id# - the index in the CodeBlock of an identifier { if codeBlock is passed to dump(), the string representation is displayed }. - // var# - the index of a var on the global object, used by GetGlobalVar/PutGlobalVar operations. - printf("% 4d:\t<%c%u:%u>\t%s(", (int)i, mustGenerate ? '!' : ' ', refCount, node.virtualRegister, dfgOpNames[op & NodeIdMask]); - if (node.child1 != NoNode) - printf("@%u", node.child1); - if (node.child2 != NoNode) - printf(", @%u", node.child2); - if (node.child3 != NoNode) - printf(", @%u", node.child3); - bool hasPrinted = node.child1 != NoNode; - - if (node.hasVarNumber()) { - printf("%svar%u", hasPrinted ? ", " : "", node.varNumber()); - hasPrinted = true; - } - if (node.hasIdentifier()) { - if (codeBlock) - printf("%sid%u{%s}", hasPrinted ? ", " : "", node.identifierNumber(), codeBlock->identifier(node.identifierNumber()).ustring().utf8().data()); - else - printf("%sid%u", hasPrinted ? ", " : "", node.identifierNumber()); - hasPrinted = true; - } - if (node.isArgument()) { - printf("%sarg%u", hasPrinted ? ", " : "", node.argumentNumber()); - hasPrinted = true; - } - if (op == Int32Constant) { - printf("%s$%u{%d|0x%08x}", hasPrinted ? ", " : "", node.constantNumber(), node.int32Constant(), node.int32Constant()); - hasPrinted = true; - } - if (op == DoubleConstant) { - printf("%s$%u{%f})", hasPrinted ? ", " : "", node.constantNumber(), node.numericConstant()); - hasPrinted = true; - } - if (op == JSConstant) { - printf("%s$%u", hasPrinted ? ", " : "", node.constantNumber()); - hasPrinted = true; - } - - printf(")\n"); +void Graph::dump(CodeBlock* codeBlock) +{ + for (size_t b = 0; b < m_blocks.size(); ++b) { + printf("Block #%u:\n", (int)b); + BasicBlock& block = m_blocks[b]; + for (size_t i = block.begin; i < block.end; ++i) + dump(i, codeBlock); } } + #endif -// FIXME: Convert this method to be iterative, not recursive. +// FIXME: Convert these methods to be iterative, not recursive. void Graph::refChildren(NodeIndex op) { Node& node = at(op); @@ -135,6 +155,26 @@ void Graph::refChildren(NodeIndex op) return; ref(node.child3); } +void Graph::derefChildren(NodeIndex op) +{ + Node& node = at(op); + + if (node.child1 == NoNode) { + ASSERT(node.child2 == NoNode && node.child3 == NoNode); + return; + } + deref(node.child1); + + if (node.child2 == NoNode) { + ASSERT(node.child3 == NoNode); + return; + } + deref(node.child2); + + if (node.child3 == NoNode) + return; + deref(node.child3); +} } } // namespace JSC::DFG diff --git a/Source/JavaScriptCore/dfg/DFGGraph.h b/Source/JavaScriptCore/dfg/DFGGraph.h index c02110e..c6bc7df 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.h +++ b/Source/JavaScriptCore/dfg/DFGGraph.h @@ -30,6 +30,7 @@ #include <dfg/DFGNode.h> #include <wtf/Vector.h> +#include <wtf/StdLibExtras.h> namespace JSC { @@ -37,6 +38,26 @@ class CodeBlock; namespace DFG { +typedef uint32_t BlockIndex; + +struct BasicBlock { + BasicBlock(unsigned bytecodeBegin, NodeIndex begin, NodeIndex end) + : bytecodeBegin(bytecodeBegin) + , begin(begin) + , end(end) + { + } + + static inline BlockIndex getBytecodeBegin(BasicBlock* block) + { + return block->bytecodeBegin; + } + + unsigned bytecodeBegin; + NodeIndex begin; + NodeIndex end; +}; + // // === Graph === // @@ -48,19 +69,40 @@ public: // Mark a node as being referenced. void ref(NodeIndex nodeIndex) { - // If the value (before incrementing) was at reCount zero then we need to ref its children. - if (!at(nodeIndex).refCount++) + Node& node = at(nodeIndex); + // If the value (before incrementing) was at refCount zero then we need to ref its children. + if (!node.refCount++) refChildren(nodeIndex); } + void deref(NodeIndex nodeIndex) + { + Node& node = at(nodeIndex); + ASSERT(node.refCount); + // If the value (after decrementing) becomes refCount zero then we need to deref its children. + if (!--node.refCount) + derefChildren(nodeIndex); + } #ifndef NDEBUG // CodeBlock is optional, but may allow additional information to be dumped (e.g. Identifier names). void dump(CodeBlock* = 0); + void dump(NodeIndex, CodeBlock* = 0); #endif + Vector<BasicBlock> m_blocks; + + BlockIndex blockIndexForBytecodeOffset(unsigned bytecodeBegin) + { + BasicBlock* begin = m_blocks.begin(); + BasicBlock* block = binarySearch<BasicBlock, unsigned, BasicBlock::getBytecodeBegin>(begin, m_blocks.size(), bytecodeBegin); + ASSERT(block >= m_blocks.begin() && block < m_blocks.end()); + return static_cast<BlockIndex>(block - begin); + } + private: - // When a node's refCount goes from 0 to 1, it must (logically) recursively ref all of its children. + // When a node's refCount goes from 0 to 1, it must (logically) recursively ref all of its children, and vice versa. void refChildren(NodeIndex); + void derefChildren(NodeIndex); }; } } // namespace JSC::DFG diff --git a/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp b/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp index b945b5a..52e0abe 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp @@ -60,9 +60,6 @@ GPRReg JITCodeGenerator::fillInteger(NodeIndex nodeIndex, DataFormat& returnForm JSValue jsValue = valueOfJSConstant(nodeIndex); m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), reg); } - } else if (node.isArgument()) { - m_gprs.retain(gpr, virtualRegister, SpillOrderArgument); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); } else { ASSERT(info.spillFormat() == DataFormatJS || info.spillFormat() == DataFormatJSInteger); m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled); @@ -143,11 +140,6 @@ FPRReg JITCodeGenerator::fillDouble(NodeIndex nodeIndex) info.fillJSValue(gpr, DataFormatJS); unlock(gpr); } - } else if (node.isArgument()) { - m_gprs.retain(gpr, virtualRegister, SpillOrderArgument); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); - info.fillJSValue(gpr, DataFormatJS); - unlock(gpr); } else { DataFormat spillFormat = info.spillFormat(); ASSERT(spillFormat & DataFormatJS); @@ -267,10 +259,6 @@ GPRReg JITCodeGenerator::fillJSValue(NodeIndex nodeIndex) } m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); - } else if (node.isArgument()) { - m_gprs.retain(gpr, virtualRegister, SpillOrderArgument); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); - info.fillJSValue(gpr, DataFormatJS); } else { DataFormat spillFormat = info.spillFormat(); ASSERT(spillFormat & DataFormatJS); @@ -283,6 +271,13 @@ GPRReg JITCodeGenerator::fillJSValue(NodeIndex nodeIndex) case DataFormatInteger: { GPRReg gpr = info.gpr(); + // If the register has already been locked we need to take a copy. + // If not, we'll zero extend in place, so mark on the info that this is now type DataFormatInteger, not DataFormatJSInteger. + if (m_gprs.isLocked(gpr)) { + GPRReg result = allocate(); + m_jit.orPtr(JITCompiler::tagTypeNumberRegister, JITCompiler::gprToRegisterID(gpr), JITCompiler::gprToRegisterID(result)); + return result; + } m_gprs.lock(gpr); m_jit.orPtr(JITCompiler::tagTypeNumberRegister, JITCompiler::gprToRegisterID(gpr)); info.fillJSValue(gpr, DataFormatJSInteger); diff --git a/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h b/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h index a84cdc6..0abd3c7 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h +++ b/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h @@ -59,7 +59,6 @@ protected: SpillOrderNone, SpillOrderConstant = 1, // no spill, and cheap fill SpillOrderSpilled = 2, // no spill - SpillOrderArgument = 3, // no spill, but we may lose typeinfo SpillOrderJS = 4, // needs spill SpillOrderCell = 4, // needs spill SpillOrderInteger = 5, // needs spill and box @@ -152,6 +151,7 @@ protected: , m_isSpeculative(isSpeculative) , m_compileIndex(0) , m_generationInfo(m_jit.codeBlock()->m_numCalleeRegisters) + , m_blockHeads(jit.graph().m_blocks.size()) { } @@ -237,6 +237,7 @@ protected: } // Checks/accessors for constant values. + bool isConstant(NodeIndex nodeIndex) { return m_jit.isConstant(nodeIndex); } bool isInt32Constant(NodeIndex nodeIndex) { return m_jit.isInt32Constant(nodeIndex); } bool isDoubleConstant(NodeIndex nodeIndex) { return m_jit.isDoubleConstant(nodeIndex); } bool isJSConstant(NodeIndex nodeIndex) { return m_jit.isJSConstant(nodeIndex); } @@ -444,11 +445,6 @@ protected: Node& node = m_jit.graph()[nodeIndex]; m_generationInfo[node.virtualRegister].initConstant(nodeIndex, node.refCount); } - void initArgumentInfo(NodeIndex nodeIndex) - { - Node& node = m_jit.graph()[nodeIndex]; - m_generationInfo[node.virtualRegister].initArgument(nodeIndex, node.refCount); - } // These methods used to sort arguments into the correct registers. template<GPRReg destA, GPRReg destB> @@ -607,6 +603,26 @@ protected: appendCallWithExceptionCheck(operation); m_jit.move(JITCompiler::returnValueRegister, JITCompiler::gprToRegisterID(result)); } + void callOperation(Z_DFGOperation_EJ operation, GPRReg result, GPRReg arg1) + { + ASSERT(isFlushed()); + + m_jit.move(JITCompiler::gprToRegisterID(arg1), JITCompiler::argumentRegister1); + m_jit.move(JITCompiler::callFrameRegister, JITCompiler::argumentRegister0); + + appendCallWithExceptionCheck(operation); + m_jit.move(JITCompiler::returnValueRegister, JITCompiler::gprToRegisterID(result)); + } + void callOperation(Z_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2) + { + ASSERT(isFlushed()); + + setupStubArguments(arg1, arg2); + m_jit.move(JITCompiler::callFrameRegister, JITCompiler::argumentRegister0); + + appendCallWithExceptionCheck(operation); + m_jit.move(JITCompiler::returnValueRegister, JITCompiler::gprToRegisterID(result)); + } void callOperation(J_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2) { ASSERT(isFlushed()); @@ -655,6 +671,19 @@ protected: m_jit.appendCallWithExceptionCheck(function, m_jit.graph()[m_compileIndex].exceptionInfo); } + void addBranch(const MacroAssembler::Jump& jump, BlockIndex destination) + { + m_branches.append(BranchRecord(jump, destination)); + } + + void linkBranches() + { + for (size_t i = 0; i < m_branches.size(); ++i) { + BranchRecord& branch = m_branches[i]; + branch.jump.linkTo(m_blockHeads[branch.destination], &m_jit); + } + } + #ifndef NDEBUG void dump(const char* label = 0); #endif @@ -679,11 +708,25 @@ protected: // the value may have been boxed differently on the two paths. bool m_isSpeculative; // The current node being generated. + BlockIndex m_block; NodeIndex m_compileIndex; // Virtual and physical register maps. Vector<GenerationInfo, 32> m_generationInfo; RegisterBank<GPRReg, numberOfGPRs, SpillOrder, SpillOrderNone, SpillOrderMax> m_gprs; RegisterBank<FPRReg, numberOfFPRs, SpillOrder, SpillOrderNone, SpillOrderMax> m_fprs; + + Vector<MacroAssembler::Label> m_blockHeads; + struct BranchRecord { + BranchRecord(MacroAssembler::Jump jump, BlockIndex destination) + : jump(jump) + , destination(destination) + { + } + + MacroAssembler::Jump jump; + BlockIndex destination; + }; + Vector<BranchRecord, 8> m_branches; }; // === Operand types === diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp index 5c5d5fe..5cd044a 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp @@ -45,9 +45,6 @@ void JITCompiler::fillNumericToDouble(NodeIndex nodeIndex, FPRReg fpr, GPRReg te Node& node = graph()[nodeIndex]; MacroAssembler::RegisterID tempReg = gprToRegisterID(temporary); - // Arguments can't be know to be double, would need to have been a ValueToNumber node in the way! - ASSERT(!node.isArgument()); - if (node.isConstant()) { ASSERT(node.op == DoubleConstant); move(MacroAssembler::ImmPtr(reinterpret_cast<void*>(reinterpretDoubleToIntptr(valueOfDoubleConstant(nodeIndex)))), tempReg); @@ -70,9 +67,6 @@ void JITCompiler::fillInt32ToInteger(NodeIndex nodeIndex, GPRReg gpr) { Node& node = graph()[nodeIndex]; - // Arguments can't be know to be int32, would need to have been a ValueToInt32 node in the way! - ASSERT(!node.isArgument()); - if (node.isConstant()) { ASSERT(node.op == Int32Constant); move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gprToRegisterID(gpr)); @@ -91,11 +85,6 @@ void JITCompiler::fillToJS(NodeIndex nodeIndex, GPRReg gpr) { Node& node = graph()[nodeIndex]; - if (node.isArgument()) { - loadPtr(addressForArgument(node.argumentNumber()), gprToRegisterID(gpr)); - return; - } - if (node.isConstant()) { if (isInt32Constant(nodeIndex)) { JSValue jsValue = jsNumber(valueOfInt32Constant(nodeIndex)); @@ -198,8 +187,8 @@ void JITCompiler::jumpFromSpeculativeToNonSpeculative(const SpeculationCheck& ch void JITCompiler::linkSpeculationChecks(SpeculativeJIT& speculative, NonSpeculativeJIT& nonSpeculative) { // Iterators to walk over the set of bail outs & corresponding entry points. - SpeculativeJIT::SpeculationCheckVector::Iterator checksIter = speculative.speculationChecks().begin(); - SpeculativeJIT::SpeculationCheckVector::Iterator checksEnd = speculative.speculationChecks().end(); + SpeculationCheckVector::Iterator checksIter = speculative.speculationChecks().begin(); + SpeculationCheckVector::Iterator checksEnd = speculative.speculationChecks().end(); NonSpeculativeJIT::EntryLocationVector::Iterator entriesIter = nonSpeculative.entryLocations().begin(); NonSpeculativeJIT::EntryLocationVector::Iterator entriesEnd = nonSpeculative.entryLocations().end(); @@ -267,25 +256,36 @@ void JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi // register values around, rebox values, and ensure spilled, to match the // non-speculative path's requirements). -#if DFG_JIT_BREAK_ON_ENTRY +#if DFG_JIT_BREAK_ON_EVERY_FUNCTION // Handy debug tool! breakpoint(); #endif // First generate the speculative path. + Label speculativePathBegin = label(); SpeculativeJIT speculative(*this); - speculative.compile(); + bool compiledSpeculative = speculative.compile(); // Next, generate the non-speculative path. We pass this a SpeculationCheckIndexIterator // to allow it to check which nodes in the graph may bail out, and may need to reenter the // non-speculative path. - SpeculationCheckIndexIterator checkIterator(speculative); - NonSpeculativeJIT nonSpeculative(*this); - nonSpeculative.compile(checkIterator); - - // Link the bail-outs from the speculative path to the corresponding entry points into the non-speculative one. - linkSpeculationChecks(speculative, nonSpeculative); + if (compiledSpeculative) { + SpeculationCheckIndexIterator checkIterator(speculative.speculationChecks()); + NonSpeculativeJIT nonSpeculative(*this); + nonSpeculative.compile(checkIterator); + // Link the bail-outs from the speculative path to the corresponding entry points into the non-speculative one. + linkSpeculationChecks(speculative, nonSpeculative); + } else { + // If compilation through the SpeculativeJIT failed, throw away the code we generated. + m_calls.clear(); + rewindToLabel(speculativePathBegin); + + SpeculationCheckVector noChecks; + SpeculationCheckIndexIterator checkIterator(noChecks); + NonSpeculativeJIT nonSpeculative(*this); + nonSpeculative.compile(checkIterator); + } // === Stage 3 - Function footer code generation === // @@ -349,6 +349,10 @@ void JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi LinkBuffer linkBuffer(this, m_globalData->executableAllocator.poolForSize(m_assembler.size()), 0); +#if DFG_DEBUG_VERBOSE + fprintf(stderr, "JIT code start at %p\n", linkBuffer.debugAddress()); +#endif + // Link all calls out from the JIT code to their respective functions. for (unsigned i = 0; i < m_calls.size(); ++i) linkBuffer.link(m_calls[i].m_call, m_calls[i].m_function); diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.h b/Source/JavaScriptCore/dfg/DFGJITCompiler.h index 8b68434..03ae2b8 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.h +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.h @@ -248,6 +248,10 @@ public: } // Helper methods to check nodes for constants. + bool isConstant(NodeIndex nodeIndex) + { + return graph()[nodeIndex].isConstant(); + } bool isInt32Constant(NodeIndex nodeIndex) { return graph()[nodeIndex].op == Int32Constant; diff --git a/Source/JavaScriptCore/dfg/DFGNode.h b/Source/JavaScriptCore/dfg/DFGNode.h index 11dbf0d..2a5b6dd 100644 --- a/Source/JavaScriptCore/dfg/DFGNode.h +++ b/Source/JavaScriptCore/dfg/DFGNode.h @@ -26,10 +26,6 @@ #ifndef DFGNode_h #define DFGNode_h -#if ENABLE(DFG_JIT) - -#include <wtf/Vector.h> - // Emit various logging information for debugging, including dumping the dataflow graphs. #define DFG_DEBUG_VERBOSE 0 // Enable generation of dynamic checks into the instruction stream. @@ -37,9 +33,21 @@ // Consistency check contents compiler data structures. #define DFG_CONSISTENCY_CHECK 0 // Emit a breakpoint into the head of every generated function, to aid debugging in GDB. -#define DFG_JIT_BREAK_ON_ENTRY 0 +#define DFG_JIT_BREAK_ON_EVERY_FUNCTION 0 +// Emit a breakpoint into the head of every generated node, to aid debugging in GDB. +#define DFG_JIT_BREAK_ON_EVERY_BLOCK 0 +// Emit a breakpoint into the head of every generated node, to aid debugging in GDB. +#define DFG_JIT_BREAK_ON_EVERY_NODE 0 +// Disable the DFG JIT without having to touch Platform.h! +#define DFG_DEBUG_LOCAL_DISBALE 0 +// Generate stats on how successful we were in making use of the DFG jit, and remaining on the hot path. +#define DFG_SUCCESS_STATS 0 +#if ENABLE(DFG_JIT) + +#include <wtf/Vector.h> + namespace JSC { namespace DFG { // Type for a virtual register number (spill location). @@ -61,6 +69,8 @@ typedef uint32_t ExceptionInfo; #define NodeResultMask 0xF000 #define NodeMustGenerate 0x10000 // set on nodes that have side effects, and may not trivially be removed by DCE. #define NodeIsConstant 0x20000 +#define NodeIsJump 0x40000 +#define NodeIsBranch 0x80000 // These values record the result type of the node (as checked by NodeResultMask, above), 0 for no result. #define NodeResultJS 0x1000 @@ -73,9 +83,12 @@ typedef uint32_t ExceptionInfo; macro(JSConstant, NodeResultJS | NodeIsConstant) \ macro(Int32Constant, NodeResultJS | NodeIsConstant) \ macro(DoubleConstant, NodeResultJS | NodeIsConstant) \ - macro(Argument, NodeResultJS) \ macro(ConvertThis, NodeResultJS) \ \ + /* Nodes for local variable access. */\ + macro(GetLocal, NodeResultJS) \ + macro(SetLocal, NodeMustGenerate) \ + \ /* Nodes for bitwise operations. */\ macro(BitAnd, NodeResultInt32) \ macro(BitOr, NodeResultInt32) \ @@ -115,6 +128,18 @@ typedef uint32_t ExceptionInfo; macro(GetGlobalVar, NodeResultJS | NodeMustGenerate) \ macro(PutGlobalVar, NodeMustGenerate) \ \ + /* Nodes for comparison operations. */\ + macro(CompareLess, NodeResultJS | NodeMustGenerate) \ + macro(CompareLessEq, NodeResultJS | NodeMustGenerate) \ + macro(CompareEq, NodeResultJS | NodeMustGenerate) \ + macro(CompareStrictEq, NodeResultJS) \ + \ + /* Nodes for misc operations. */\ + macro(LogicalNot, NodeResultJS) \ + \ + /* Block terminals. */\ + macro(Jump, NodeMustGenerate | NodeIsJump) \ + macro(Branch, NodeMustGenerate | NodeIsBranch) \ macro(Return, NodeMustGenerate) // This enum generates a monotonically increasing id for all Node types, @@ -170,6 +195,20 @@ struct Node { { } + // Construct a node with up to 3 children and two immediate values. + Node(NodeType op, ExceptionInfo exceptionInfo, OpInfo imm1, OpInfo imm2, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode) + : op(op) + , exceptionInfo(exceptionInfo) + , child1(child1) + , child2(child2) + , child3(child3) + , virtualRegister(InvalidVirtualRegister) + , refCount(0) + , m_opInfo(imm1.m_value) + { + m_constantValue.opInfo2 = imm2.m_value; + } + bool mustGenerate() { return op & NodeMustGenerate; @@ -186,15 +225,15 @@ struct Node { return m_opInfo; } - bool isArgument() + bool hasLocal() { - return op == Argument; + return op == GetLocal || op == SetLocal; } - unsigned argumentNumber() + VirtualRegister local() { - ASSERT(isArgument()); - return m_opInfo; + ASSERT(hasLocal()); + return (VirtualRegister)m_opInfo; } bool hasIdentifier() @@ -266,6 +305,28 @@ struct Node { m_constantValue.asDouble = value; } + bool isJump() + { + return op & NodeIsJump; + } + + bool isBranch() + { + return op & NodeIsBranch; + } + + unsigned takenBytecodeOffset() + { + ASSERT(isBranch() || isJump()); + return m_opInfo; + } + + unsigned notTakenBytecodeOffset() + { + ASSERT(isBranch()); + return m_constantValue.opInfo2; + } + // This enum value describes the type of the node. NodeType op; // Used to look up exception handling information (currently implemented as a bytecode index). @@ -284,6 +345,7 @@ private: union { int32_t asInt32; double asDouble; + unsigned opInfo2; } m_constantValue; }; diff --git a/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp index 945c98a..87c4234 100644 --- a/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp @@ -78,7 +78,7 @@ void NonSpeculativeJIT::valueToNumber(JSValueOperand& operand, FPRReg fpr) // Next handle cells (& other JS immediates) nonNumeric.link(&m_jit); - silentSpillAllRegisters(jsValueGpr); + silentSpillAllRegisters(fpr, jsValueGpr); m_jit.move(jsValueReg, JITCompiler::argumentRegister1); m_jit.move(JITCompiler::callFrameRegister, JITCompiler::argumentRegister0); appendCallWithExceptionCheck(dfgConvertJSValueToNumber); @@ -105,7 +105,7 @@ void NonSpeculativeJIT::valueToInt32(JSValueOperand& operand, GPRReg result) JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, jsValueReg, JITCompiler::tagTypeNumberRegister); // First handle non-integers - silentSpillAllRegisters(jsValueGpr); + silentSpillAllRegisters(result, jsValueGpr); m_jit.move(jsValueReg, JITCompiler::argumentRegister1); m_jit.move(JITCompiler::callFrameRegister, JITCompiler::argumentRegister0); appendCallWithExceptionCheck(dfgConvertJSValueToInt32); @@ -126,7 +126,7 @@ void NonSpeculativeJIT::numberToInt32(FPRReg fpr, GPRReg gpr) JITCompiler::Jump truncatedToInteger = m_jit.branchTruncateDoubleToInt32(fpReg, reg, JITCompiler::BranchIfTruncateSuccessful); - silentSpillAllRegisters(gpr); // don't really care! + silentSpillAllRegisters(gpr); m_jit.moveDouble(fpReg, JITCompiler::fpArgumentRegister0); appendCallWithExceptionCheck(toInt32); @@ -137,6 +137,40 @@ void NonSpeculativeJIT::numberToInt32(FPRReg fpr, GPRReg gpr) truncatedToInteger.link(&m_jit); } +bool NonSpeculativeJIT::isKnownInteger(NodeIndex nodeIndex) +{ + GenerationInfo& info = m_generationInfo[m_jit.graph()[nodeIndex].virtualRegister]; + + DataFormat registerFormat = info.registerFormat(); + if (registerFormat != DataFormatNone) + return (registerFormat | DataFormatJS) == DataFormatJSInteger; + + DataFormat spillFormat = info.spillFormat(); + if (spillFormat != DataFormatNone) + return (spillFormat | DataFormatJS) == DataFormatJSInteger; + + ASSERT(isConstant(nodeIndex)); + return isInt32Constant(nodeIndex); +} + +bool NonSpeculativeJIT::isKnownNumeric(NodeIndex nodeIndex) +{ + GenerationInfo& info = m_generationInfo[m_jit.graph()[nodeIndex].virtualRegister]; + + DataFormat registerFormat = info.registerFormat(); + if (registerFormat != DataFormatNone) + return (registerFormat | DataFormatJS) == DataFormatJSInteger + || (registerFormat | DataFormatJS) == DataFormatJSDouble; + + DataFormat spillFormat = info.spillFormat(); + if (spillFormat != DataFormatNone) + return (spillFormat | DataFormatJS) == DataFormatJSInteger + || (spillFormat | DataFormatJS) == DataFormatJSDouble; + + ASSERT(isConstant(nodeIndex)); + return isInt32Constant(nodeIndex) || isDoubleConstant(nodeIndex); +} + void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, Node& node) { // ... @@ -144,7 +178,6 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No trackEntry(m_jit.label()); checkConsistency(); - NodeType op = node.op; switch (op) { @@ -164,10 +197,20 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No case JSConstant: initConstantInfo(m_compileIndex); break; - - case Argument: - initArgumentInfo(m_compileIndex); + + case GetLocal: { + GPRTemporary result(this); + m_jit.loadPtr(JITCompiler::addressFor(node.local()), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); break; + } + + case SetLocal: { + JSValueOperand value(this, node.child1); + m_jit.storePtr(value.registerID(), JITCompiler::addressFor(node.local())); + noResult(m_compileIndex); + break; + } case BitAnd: case BitOr: @@ -250,10 +293,8 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No case NumberToInt32: case ValueToInt32: { ASSERT(!isInt32Constant(node.child1)); - GenerationInfo& operandInfo = m_generationInfo[m_jit.graph()[node.child1].virtualRegister]; - switch (operandInfo.registerFormat()) { - case DataFormatInteger: { + if (isKnownInteger(node.child1)) { IntegerOperand op1(this, node.child1); GPRTemporary result(this, op1); m_jit.move(op1.registerID(), result.registerID()); @@ -261,7 +302,7 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No break; } - case DataFormatDouble: { + if (isKnownNumeric(node.child1)) { DoubleOperand op1(this, node.child1); GPRTemporary result(this); numberToInt32(op1.fpr(), result.gpr()); @@ -269,84 +310,29 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No break; } - default: { - JSValueOperand op1(this, node.child1); - GPRTemporary result(this, op1); - op1.gpr(); // force op1 to be filled! - result.gpr(); // force result to be allocated! - - switch (operandInfo.registerFormat()) { - case DataFormatNone: - case DataFormatInteger: - case DataFormatDouble: - // The operand has been filled as a JSValue; it cannot be in a !DataFormatJS state. - CRASH(); - - case DataFormatCell: - case DataFormatJS: - case DataFormatJSCell: { - if (op == NumberToInt32) { - FPRTemporary fpTemp(this); - FPRReg fpr = fpTemp.fpr(); - - JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, op1.registerID(), JITCompiler::tagTypeNumberRegister); - - m_jit.move(op1.registerID(), result.registerID()); - m_jit.addPtr(JITCompiler::tagTypeNumberRegister, result.registerID()); - m_jit.movePtrToDouble(result.registerID(), fpTemp.registerID()); - numberToInt32(fpr, result.gpr()); - JITCompiler::Jump wasDouble = m_jit.jump(); - - isInteger.link(&m_jit); - m_jit.zeroExtend32ToPtr(op1.registerID(), result.registerID()); - - wasDouble.link(&m_jit); - } else - valueToInt32(op1, result.gpr()); - integerResult(result.gpr(), m_compileIndex); - break; - } - - case DataFormatJSDouble: { - FPRTemporary fpTemp(this); - m_jit.move(op1.registerID(), result.registerID()); - m_jit.addPtr(JITCompiler::tagTypeNumberRegister, result.registerID()); - m_jit.movePtrToDouble(result.registerID(), fpTemp.registerID()); - numberToInt32(fpTemp.fpr(), result.gpr()); - integerResult(result.gpr(), m_compileIndex); - break; - } - - case DataFormatJSInteger: { - m_jit.move(op1.registerID(), result.registerID()); - jsValueResult(result.gpr(), m_compileIndex, DataFormatJSInteger); - break; - } - } - } + // We should have handled this via isKnownInteger, or isKnownNumeric! + ASSERT(op != NumberToInt32); - } + JSValueOperand op1(this, node.child1); + GPRTemporary result(this, op1); + valueToInt32(op1, result.gpr()); + integerResult(result.gpr(), m_compileIndex); break; } case ValueToNumber: { ASSERT(!isInt32Constant(node.child1)); ASSERT(!isDoubleConstant(node.child1)); - GenerationInfo& operandInfo = m_generationInfo[m_jit.graph()[node.child1].virtualRegister]; - switch (operandInfo.registerFormat()) { - case DataFormatNone: - case DataFormatCell: - case DataFormatJS: - case DataFormatJSCell: { - JSValueOperand op1(this, node.child1); + + if (isKnownInteger(node.child1)) { + IntegerOperand op1(this, node.child1); FPRTemporary result(this); - valueToNumber(op1, result.fpr()); + m_jit.convertInt32ToDouble(op1.registerID(), result.registerID()); doubleResult(result.fpr(), m_compileIndex); break; } - case DataFormatJSDouble: - case DataFormatDouble: { + if (isKnownNumeric(node.child1)) { DoubleOperand op1(this, node.child1); FPRTemporary result(this, op1); m_jit.moveDouble(op1.registerID(), result.registerID()); @@ -354,15 +340,10 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No break; } - case DataFormatJSInteger: - case DataFormatInteger: { - IntegerOperand op1(this, node.child1); - FPRTemporary result(this); - m_jit.convertInt32ToDouble(op1.registerID(), result.registerID()); - doubleResult(result.fpr(), m_compileIndex); - break; - } - } + JSValueOperand op1(this, node.child1); + FPRTemporary result(this); + valueToNumber(op1, result.fpr()); + doubleResult(result.fpr(), m_compileIndex); break; } @@ -446,6 +427,80 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No break; } + case LogicalNot: { + JSValueOperand arg1(this, node.child1); + GPRReg arg1GPR = arg1.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(dfgConvertJSValueToBoolean, result.gpr(), arg1GPR); + + // If we add a DataFormatBool, we should use it here. + m_jit.xor32(TrustedImm32(ValueTrue), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareLess: { + JSValueOperand arg1(this, node.child1); + JSValueOperand arg2(this, node.child2); + GPRReg arg1GPR = arg1.gpr(); + GPRReg arg2GPR = arg2.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(operationCompareLess, result.gpr(), arg1GPR, arg2GPR); + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareLessEq: { + JSValueOperand arg1(this, node.child1); + JSValueOperand arg2(this, node.child2); + GPRReg arg1GPR = arg1.gpr(); + GPRReg arg2GPR = arg2.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(operationCompareLessEq, result.gpr(), arg1GPR, arg2GPR); + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareEq: { + JSValueOperand arg1(this, node.child1); + JSValueOperand arg2(this, node.child2); + GPRReg arg1GPR = arg1.gpr(); + GPRReg arg2GPR = arg2.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(operationCompareEq, result.gpr(), arg1GPR, arg2GPR); + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareStrictEq: { + JSValueOperand arg1(this, node.child1); + JSValueOperand arg2(this, node.child2); + GPRReg arg1GPR = arg1.gpr(); + GPRReg arg2GPR = arg2.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(operationCompareStrictEq, result.gpr(), arg1GPR, arg2GPR); + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + + jsValueResult(result.gpr(), m_compileIndex); + break; + } + case GetByVal: { JSValueOperand arg1(this, node.child1); JSValueOperand arg2(this, node.child2); @@ -535,11 +590,43 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No break; } + case DFG::Jump: { + BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); + if (taken != (m_block + 1)) + addBranch(m_jit.jump(), taken); + noResult(m_compileIndex); + break; + } + + case Branch: { + JSValueOperand value(this, node.child1); + GPRReg valueGPR = value.gpr(); + flushRegisters(); + + GPRResult result(this); + callOperation(dfgConvertJSValueToBoolean, result.gpr(), valueGPR); + + BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); + BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()); + + addBranch(m_jit.branchTest8(MacroAssembler::NonZero, result.registerID()), taken); + if (notTaken != (m_block + 1)) + addBranch(m_jit.jump(), notTaken); + + noResult(m_compileIndex); + break; + } + case Return: { ASSERT(JITCompiler::callFrameRegister != JITCompiler::regT1); ASSERT(JITCompiler::regT1 != JITCompiler::returnValueRegister); ASSERT(JITCompiler::returnValueRegister != JITCompiler::callFrameRegister); +#if DFG_SUCCESS_STATS + static SamplingCounter counter("NonSpeculativeJIT"); + m_jit.emitCount(counter); +#endif + // Return the result in returnValueRegister. JSValueOperand op1(this, node.child1); m_jit.move(op1.registerID(), JITCompiler::returnValueRegister); @@ -563,23 +650,40 @@ void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, No checkConsistency(); } -void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator) +void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, BasicBlock& block) { - ASSERT(!m_compileIndex); - Node* nodes = m_jit.graph().begin(); + ASSERT(m_compileIndex == block.begin); + m_blockHeads[m_block] = m_jit.label(); - for (; m_compileIndex < m_jit.graph().size(); ++m_compileIndex) { -#if DFG_DEBUG_VERBOSE - fprintf(stderr, "index(%d)\n", (int)m_compileIndex); +#if DFG_JIT_BREAK_ON_EVERY_BLOCK + m_jit.breakpoint(); #endif - Node& node = nodes[m_compileIndex]; + for (; m_compileIndex < block.end; ++m_compileIndex) { + Node& node = m_jit.graph()[m_compileIndex]; if (!node.refCount) continue; + +#if DFG_DEBUG_VERBOSE + fprintf(stderr, "NonSpeculativeJIT generating Node @%d at code offset 0x%x\n", (int)m_compileIndex, m_jit.debugOffset()); +#endif +#if DFG_JIT_BREAK_ON_EVERY_NODE + m_jit.breakpoint(); +#endif + compile(checkIterator, node); } } +void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator) +{ + ASSERT(!m_compileIndex); + Vector<BasicBlock> blocks = m_jit.graph().m_blocks; + for (m_block = 0; m_block < blocks.size(); ++m_block) + compile(checkIterator, blocks[m_block]); + linkBranches(); +} + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h index e140e45..de4c04b 100644 --- a/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h @@ -80,92 +80,140 @@ public: private: void compile(SpeculationCheckIndexIterator&, Node&); + void compile(SpeculationCheckIndexIterator&, BasicBlock&); + + bool isKnownInteger(NodeIndex); + bool isKnownNumeric(NodeIndex); // These methods are used when generating 'unexpected' // calls out from JIT code to C++ helper routines - // they spill all live values to the appropriate // slots in the RegisterFile without changing any state // in the GenerationInfo. - void silentSpill(VirtualRegister spillMe, GPRReg canTrample) + void silentSpillGPR(VirtualRegister spillMe, GPRReg exclude = InvalidGPRReg) { GenerationInfo& info = m_generationInfo[spillMe]; - ASSERT(info.registerFormat() != DataFormatNone); - if (info.needsSpill()) { - DataFormat spillFormat = info.registerFormat(); - - if (spillFormat == DataFormatDouble) { - boxDouble(info.fpr(), canTrample); - m_jit.storePtr(JITCompiler::gprToRegisterID(canTrample), JITCompiler::addressFor(spillMe)); - } else { - JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); - - if (spillFormat == DataFormatInteger) { - m_jit.orPtr(JITCompiler::tagTypeNumberRegister, reg); - m_jit.storePtr(reg, JITCompiler::addressFor(spillMe)); - } else { - ASSERT(spillFormat & DataFormatJS || spillFormat == DataFormatCell); - m_jit.storePtr(reg, JITCompiler::addressFor(spillMe)); - } - } + ASSERT(info.registerFormat() != DataFormatNone && info.registerFormat() != DataFormatDouble); + + if (!info.needsSpill() || (info.gpr() == exclude)) + return; + + DataFormat registerFormat = info.registerFormat(); + JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); + + if (registerFormat == DataFormatInteger) { + m_jit.orPtr(JITCompiler::tagTypeNumberRegister, reg); + m_jit.storePtr(reg, JITCompiler::addressFor(spillMe)); + } else { + ASSERT(registerFormat & DataFormatJS || registerFormat == DataFormatCell); + m_jit.storePtr(reg, JITCompiler::addressFor(spillMe)); } } - void silentFill(VirtualRegister spillMe, GPRReg canTrample) + void silentSpillFPR(VirtualRegister spillMe, GPRReg canTrample, FPRReg exclude = InvalidFPRReg) + { + GenerationInfo& info = m_generationInfo[spillMe]; + ASSERT(info.registerFormat() == DataFormatDouble); + + if (!info.needsSpill() || (info.fpr() == exclude)) + return; + + boxDouble(info.fpr(), canTrample); + m_jit.storePtr(JITCompiler::gprToRegisterID(canTrample), JITCompiler::addressFor(spillMe)); + } + + void silentFillGPR(VirtualRegister spillMe, GPRReg exclude = InvalidGPRReg) { GenerationInfo& info = m_generationInfo[spillMe]; + if (info.gpr() == exclude) + return; + NodeIndex nodeIndex = info.nodeIndex(); Node& node = m_jit.graph()[nodeIndex]; - ASSERT(info.registerFormat() != DataFormatNone); - DataFormat spillFormat = info.registerFormat(); + ASSERT(info.registerFormat() != DataFormatNone && info.registerFormat() != DataFormatDouble); + DataFormat registerFormat = info.registerFormat(); + JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); + + if (registerFormat == DataFormatInteger) { + if (node.isConstant()) { + ASSERT(isInt32Constant(nodeIndex)); + m_jit.move(Imm32(valueOfInt32Constant(nodeIndex)), reg); + } else + m_jit.load32(JITCompiler::addressFor(spillMe), reg); + return; + } + + if (node.isConstant()) + m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), reg); + else { + ASSERT(registerFormat & DataFormatJS || registerFormat == DataFormatCell); + m_jit.loadPtr(JITCompiler::addressFor(spillMe), reg); + } + } + void silentFillFPR(VirtualRegister spillMe, GPRReg canTrample, FPRReg exclude = InvalidFPRReg) + { + GenerationInfo& info = m_generationInfo[spillMe]; + if (info.fpr() == exclude) + return; + + NodeIndex nodeIndex = info.nodeIndex(); + Node& node = m_jit.graph()[nodeIndex]; + ASSERT(info.registerFormat() == DataFormatDouble); if (node.isConstant()) { JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), reg); - } else if (node.isArgument()) { - JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); - } else if (spillFormat == DataFormatDouble) { + } else { m_jit.loadPtr(JITCompiler::addressFor(spillMe), JITCompiler::gprToRegisterID(canTrample)); unboxDouble(canTrample, info.fpr()); - } else if (spillFormat == DataFormatInteger) { - JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); - m_jit.load32(JITCompiler::addressFor(spillMe), reg); - } else { - ASSERT(spillFormat & DataFormatJS || spillFormat == DataFormatCell); - JITCompiler::RegisterID reg = JITCompiler::gprToRegisterID(info.gpr()); - m_jit.loadPtr(JITCompiler::addressFor(spillMe), reg); } } - void silentSpillAllRegisters(GPRReg dontTrample) + + void silentSpillAllRegisters(GPRReg exclude, GPRReg preserve = InvalidGPRReg) + { + GPRReg canTrample = (preserve == gpr0) ? gpr1 : gpr0; + + for (GPRReg gpr = gpr0; gpr < numberOfGPRs; next(gpr)) { + VirtualRegister name = m_gprs.name(gpr); + if (name != InvalidVirtualRegister) + silentSpillGPR(name, exclude); + } + for (FPRReg fpr = fpr0; fpr < numberOfFPRs; next(fpr)) { + VirtualRegister name = m_fprs.name(fpr); + if (name != InvalidVirtualRegister) + silentSpillFPR(name, canTrample); + } + } + void silentSpillAllRegisters(FPRReg exclude, GPRReg preserve = InvalidGPRReg) { - GPRReg canTrample = (dontTrample == gpr0) ? gpr1 : gpr0; + GPRReg canTrample = (preserve == gpr0) ? gpr1 : gpr0; for (GPRReg gpr = gpr0; gpr < numberOfGPRs; next(gpr)) { VirtualRegister name = m_gprs.name(gpr); if (name != InvalidVirtualRegister) - silentSpill(name, canTrample); + silentSpillGPR(name); } for (FPRReg fpr = fpr0; fpr < numberOfFPRs; next(fpr)) { VirtualRegister name = m_fprs.name(fpr); if (name != InvalidVirtualRegister) - silentSpill(name, canTrample); + silentSpillFPR(name, canTrample, exclude); } } - void silentFillAllRegisters(GPRReg dontTrample) + void silentFillAllRegisters(GPRReg exclude) { - GPRReg canTrample = (dontTrample == gpr0) ? gpr1 : gpr0; + GPRReg canTrample = (exclude == gpr0) ? gpr1 : gpr0; for (FPRReg fpr = fpr0; fpr < numberOfFPRs; next(fpr)) { VirtualRegister name = m_fprs.name(fpr); if (name != InvalidVirtualRegister) - silentFill(name, canTrample); + silentFillFPR(name, canTrample); } for (GPRReg gpr = gpr0; gpr < numberOfGPRs; next(gpr)) { VirtualRegister name = m_gprs.name(gpr); if (name != InvalidVirtualRegister) - silentFill(name, canTrample); + silentFillGPR(name, exclude); } } - void silentFillAllRegisters(FPRReg dontTrample) + void silentFillAllRegisters(FPRReg exclude) { GPRReg canTrample = gpr0; @@ -173,17 +221,17 @@ private: VirtualRegister name = m_fprs.name(fpr); if (name != InvalidVirtualRegister) { #ifndef NDEBUG - ASSERT(fpr != dontTrample); + ASSERT(fpr != exclude); #else - UNUSED_PARAM(dontTrample); + UNUSED_PARAM(exclude); #endif - silentFill(name, canTrample); + silentFillFPR(name, canTrample, exclude); } } for (GPRReg gpr = gpr0; gpr < numberOfGPRs; next(gpr)) { VirtualRegister name = m_gprs.name(gpr); if (name != InvalidVirtualRegister) - silentFill(name, canTrample); + silentFillGPR(name); } } diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index de14415..a310d22 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -192,6 +192,26 @@ void operationPutByIdDirectNonStrict(ExecState* exec, EncodedJSValue encodedValu JSValue::decode(encodedBase).putDirect(exec, *identifier, JSValue::decode(encodedValue), slot); } +bool operationCompareLess(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) +{ + return jsLess(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); +} + +bool operationCompareLessEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) +{ + return jsLessEq(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); +} + +bool operationCompareEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) +{ + return JSValue::equal(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); +} + +bool operationCompareStrictEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) +{ + return JSValue::strictEqual(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); +} + DFGHandler lookupExceptionHandler(ExecState* exec, ReturnAddressPtr faultLocation) { JSValue exceptionValue = exec->exception(); @@ -215,6 +235,11 @@ int32_t dfgConvertJSValueToInt32(ExecState* exec, EncodedJSValue value) return JSValue::decode(value).toInt32(exec); } +bool dfgConvertJSValueToBoolean(ExecState* exec, EncodedJSValue encodedOp) +{ + return JSValue::decode(encodedOp).toBoolean(exec); +} + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/dfg/DFGOperations.h b/Source/JavaScriptCore/dfg/DFGOperations.h index 18570e2..d4c7c0f 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.h +++ b/Source/JavaScriptCore/dfg/DFGOperations.h @@ -42,6 +42,8 @@ typedef EncodedJSValue (*J_DFGOperation_EJJ)(ExecState*, EncodedJSValue, Encoded typedef EncodedJSValue (*J_DFGOperation_EJ)(ExecState*, EncodedJSValue); typedef EncodedJSValue (*J_DFGOperation_EJP)(ExecState*, EncodedJSValue, void*); typedef EncodedJSValue (*J_DFGOperation_EJI)(ExecState*, EncodedJSValue, Identifier*); +typedef bool (*Z_DFGOperation_EJ)(ExecState*, EncodedJSValue); +typedef bool (*Z_DFGOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue); typedef void (*V_DFGOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue); typedef void (*V_DFGOperation_EJJP)(ExecState*, EncodedJSValue, EncodedJSValue, void*); typedef void (*V_DFGOperation_EJJI)(ExecState*, EncodedJSValue, EncodedJSValue, Identifier*); @@ -58,6 +60,10 @@ void operationPutByIdStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSVa void operationPutByIdNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*); void operationPutByIdDirectStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*); void operationPutByIdDirectNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*); +bool operationCompareLess(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2); +bool operationCompareLessEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2); +bool operationCompareEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2); +bool operationCompareStrictEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2); // This method is used to lookup an exception hander, keyed by faultLocation, which is // the return location from one of the calls out to one of the helper operations above. @@ -73,9 +79,10 @@ struct DFGHandler { }; DFGHandler lookupExceptionHandler(ExecState*, ReturnAddressPtr faultLocation); -// These operations implement the implicitly called ToInt32 and ToNumber conversions from ES5. +// These operations implement the implicitly called ToInt32, ToNumber, and ToBoolean conversions from ES5. double dfgConvertJSValueToNumber(ExecState*, EncodedJSValue); int32_t dfgConvertJSValueToInt32(ExecState*, EncodedJSValue); +bool dfgConvertJSValueToBoolean(ExecState*, EncodedJSValue); } } // namespace JSC::DFG diff --git a/Source/JavaScriptCore/dfg/DFGScoreBoard.h b/Source/JavaScriptCore/dfg/DFGScoreBoard.h index eefed9e..b9bf1fd 100644 --- a/Source/JavaScriptCore/dfg/DFGScoreBoard.h +++ b/Source/JavaScriptCore/dfg/DFGScoreBoard.h @@ -42,8 +42,9 @@ namespace JSC { namespace DFG { // another node. class ScoreBoard { public: - ScoreBoard(Graph& graph) + ScoreBoard(Graph& graph, uint32_t firstTemporary) : m_graph(graph) + , m_firstTemporary(firstTemporary) { } @@ -58,7 +59,7 @@ public: // * By setting m_used to a non-zero value after checking it, we are checking that all // entries in m_free are unique (otherwise the second test of m_used will fail). for (size_t i = 0; i < m_free.size(); ++i) { - VirtualRegister virtualRegister = m_free[i]; + uint32_t virtualRegister = m_free[i]; ASSERT(!m_used[virtualRegister]); m_used[virtualRegister] = 1; } @@ -70,17 +71,17 @@ public: // Do we have any VirtualRegsiters in the free list, that were used by // prior nodes, but are now available? if (!m_free.isEmpty()) { - VirtualRegister result = m_free.last(); + uint32_t index = m_free.last(); m_free.removeLast(); // Use count must have hit zero for it to have been added to the free list! - ASSERT(!m_used[result]); - return result; + ASSERT(!m_used[index]); + return (VirtualRegister)(m_firstTemporary + index); } // Allocate a new VirtualRegister, and add a corresponding entry to m_used. size_t next = allocatedCount(); m_used.append(0); - return (VirtualRegister)next; + return (VirtualRegister)(m_firstTemporary + next); } // Increment the usecount for the VirtualRegsiter associated with 'child', @@ -92,7 +93,7 @@ public: // Find the virtual register number for this child, increment its use count. Node& node = m_graph[child]; - VirtualRegister index = node.virtualRegister; + uint32_t index = node.virtualRegister - m_firstTemporary; if (node.refCount == ++m_used[index]) { // If the use count in the scoreboard reaches the use count for the node, // then this was its last use; the virtual register is now free. @@ -111,6 +112,9 @@ public: private: // The graph, so we can get refCounts for nodes, to determine when values are dead. Graph& m_graph; + // The first VirtualRegsiter to be used as a temporary. + uint32_t m_firstTemporary; + // For every virtual register that has been allocated (either currently alive, or in // the free list), we keep a count of the number of remaining uses until it is dead // (0, in the case of entries in the free list). Since there is an entry for every @@ -118,7 +122,7 @@ private: // next available VirtualRegister number. Vector<uint32_t, 64> m_used; // A free list of VirtualRegsiters no longer alive. - Vector<VirtualRegister, 64> m_free; + Vector<uint32_t, 64> m_free; }; } } // namespace JSC::DFG diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index 95472e1..7963184 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -51,9 +51,6 @@ GPRReg SpeculativeJIT::fillSpeculateIntInternal(NodeIndex nodeIndex, DataFormat& return gpr; } m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), reg); - } else if (node.isArgument()) { - m_gprs.retain(gpr, virtualRegister, SpillOrderArgument); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); } else { DataFormat spillFormat = info.spillFormat(); ASSERT(spillFormat & DataFormatJS); @@ -203,13 +200,6 @@ GPRReg SpeculativeJIT::fillSpeculateCell(NodeIndex nodeIndex) terminateSpeculativeExecution(); return gpr; } - if (node.isArgument()) { - m_gprs.retain(gpr, virtualRegister, SpillOrderArgument); - m_jit.loadPtr(m_jit.addressForArgument(m_jit.graph()[nodeIndex].argumentNumber()), reg); - speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, reg, JITCompiler::tagMaskRegister)); - info.fillJSValue(gpr, DataFormatJSCell); - return gpr; - } ASSERT(info.spillFormat() & DataFormatJS); m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled); m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), reg); @@ -252,7 +242,6 @@ GPRReg SpeculativeJIT::fillSpeculateCell(NodeIndex nodeIndex) bool SpeculativeJIT::compile(Node& node) { checkConsistency(); - NodeType op = node.op; switch (op) { @@ -261,10 +250,20 @@ bool SpeculativeJIT::compile(Node& node) case JSConstant: initConstantInfo(m_compileIndex); break; - - case Argument: - initArgumentInfo(m_compileIndex); + + case GetLocal: { + GPRTemporary result(this); + m_jit.loadPtr(JITCompiler::addressFor(node.local()), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case SetLocal: { + JSValueOperand value(this, node.child1); + m_jit.storePtr(value.registerID(), JITCompiler::addressFor(node.local())); + noResult(m_compileIndex); break; + } case BitAnd: case BitOr: @@ -347,6 +346,7 @@ bool SpeculativeJIT::compile(Node& node) integerResult(result.gpr(), m_compileIndex, op1.format()); break; } + case ValueToInt32: { SpeculateIntegerOperand op1(this, node.child1); GPRTemporary result(this, op1); @@ -365,6 +365,30 @@ bool SpeculativeJIT::compile(Node& node) case ValueAdd: case ArithAdd: { + int32_t imm1; + if (isDoubleConstantWithInt32Value(node.child1, imm1)) { + SpeculateIntegerOperand op2(this, node.child2); + GPRTemporary result(this); + + MacroAssembler::RegisterID reg = op2.registerID(); + speculationCheck(m_jit.branchAdd32(MacroAssembler::Overflow, reg, Imm32(imm1), result.registerID())); + + integerResult(result.gpr(), m_compileIndex); + break; + } + + int32_t imm2; + if (isDoubleConstantWithInt32Value(node.child2, imm2)) { + SpeculateIntegerOperand op1(this, node.child1); + GPRTemporary result(this); + + MacroAssembler::RegisterID reg = op1.registerID(); + speculationCheck(m_jit.branchAdd32(MacroAssembler::Overflow, reg, Imm32(imm2), result.registerID())); + + integerResult(result.gpr(), m_compileIndex); + break; + } + SpeculateIntegerOperand op1(this, node.child1); SpeculateIntegerOperand op2(this, node.child2); GPRTemporary result(this, op1, op2); @@ -386,6 +410,18 @@ bool SpeculativeJIT::compile(Node& node) } case ArithSub: { + int32_t imm2; + if (isDoubleConstantWithInt32Value(node.child2, imm2)) { + SpeculateIntegerOperand op1(this, node.child1); + GPRTemporary result(this); + + MacroAssembler::RegisterID reg = op1.registerID(); + speculationCheck(m_jit.branchSub32(MacroAssembler::Overflow, reg, Imm32(imm2), result.registerID())); + + integerResult(result.gpr(), m_compileIndex); + break; + } + SpeculateIntegerOperand op1(this, node.child1); SpeculateIntegerOperand op2(this, node.child2); GPRTemporary result(this); @@ -406,7 +442,11 @@ bool SpeculativeJIT::compile(Node& node) MacroAssembler::RegisterID reg1 = op1.registerID(); MacroAssembler::RegisterID reg2 = op2.registerID(); speculationCheck(m_jit.branchMul32(MacroAssembler::Overflow, reg1, reg2, result.registerID())); - speculationCheck(m_jit.branchTest32(MacroAssembler::Zero, result.registerID())); + + MacroAssembler::Jump resultNonZero = m_jit.branchTest32(MacroAssembler::NonZero, result.registerID()); + speculationCheck(m_jit.branch32(MacroAssembler::LessThan, reg1, TrustedImm32(0))); + speculationCheck(m_jit.branch32(MacroAssembler::LessThan, reg2, TrustedImm32(0))); + resultNonZero.link(&m_jit); integerResult(result.gpr(), m_compileIndex); break; @@ -434,6 +474,72 @@ bool SpeculativeJIT::compile(Node& node) break; } + case LogicalNot: { + JSValueOperand value(this, node.child1); + GPRTemporary result(this); // FIXME: We could reuse, but on speculation fail would need recovery to restore tag (akin to add). + + m_jit.move(value.registerID(), result.registerID()); + m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), result.registerID()); + speculationCheck(m_jit.branchTestPtr(JITCompiler::NonZero, result.registerID(), TrustedImm32(static_cast<int32_t>(~1)))); + m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueTrue)), result.registerID()); + + // If we add a DataFormatBool, we should use it here. + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareLess: { + SpeculateIntegerOperand op1(this, node.child1); + SpeculateIntegerOperand op2(this, node.child2); + GPRTemporary result(this, op1, op2); + + m_jit.set32Compare32(JITCompiler::LessThan, op1.registerID(), op2.registerID(), result.registerID()); + + // If we add a DataFormatBool, we should use it here. + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareLessEq: { + SpeculateIntegerOperand op1(this, node.child1); + SpeculateIntegerOperand op2(this, node.child2); + GPRTemporary result(this, op1, op2); + + m_jit.set32Compare32(JITCompiler::LessThanOrEqual, op1.registerID(), op2.registerID(), result.registerID()); + + // If we add a DataFormatBool, we should use it here. + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareEq: { + SpeculateIntegerOperand op1(this, node.child1); + SpeculateIntegerOperand op2(this, node.child2); + GPRTemporary result(this, op1, op2); + + m_jit.set32Compare32(JITCompiler::Equal, op1.registerID(), op2.registerID(), result.registerID()); + + // If we add a DataFormatBool, we should use it here. + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + + case CompareStrictEq: { + SpeculateIntegerOperand op1(this, node.child1); + SpeculateIntegerOperand op2(this, node.child2); + GPRTemporary result(this, op1, op2); + + m_jit.set32Compare32(JITCompiler::Equal, op1.registerID(), op2.registerID(), result.registerID()); + + // If we add a DataFormatBool, we should use it here. + m_jit.or32(TrustedImm32(ValueFalse), result.registerID()); + jsValueResult(result.gpr(), m_compileIndex); + break; + } + case GetByVal: { NodeIndex alias = node.child3; if (alias != NoNode) { @@ -472,73 +578,110 @@ bool SpeculativeJIT::compile(Node& node) break; } - case PutByVal: - case PutByValAlias: { + case PutByVal: { + SpeculateCellOperand base(this, node.child1); SpeculateStrictInt32Operand property(this, node.child2); + JSValueOperand value(this, node.child3); GPRTemporary storage(this); - MacroAssembler::RegisterID propertyReg; - MacroAssembler::RegisterID storageReg; + // Map base, property & value into registers, allocate a register for storage. + MacroAssembler::RegisterID baseReg = base.registerID(); + MacroAssembler::RegisterID propertyReg = property.registerID(); + MacroAssembler::RegisterID valueReg = value.registerID(); + MacroAssembler::RegisterID storageReg = storage.registerID(); - // This block also defines the scope for base, and all bails to the non-speculative path. - // At the end of this scope base will be release, and as such may be reused by for 'value'. - // - // If we've already read from this location on the speculative pass, then it cannot be beyond array bounds, or a hole. - if (op == PutByValAlias) { - SpeculateCellOperand base(this, node.child1); + // Check that base is an array, and that property is contained within m_vector (< m_vectorLength). + speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr))); + speculationCheck(m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset()))); - // Map base & property into registers, allocate a register for storage. - propertyReg = property.registerID(); - storageReg = storage.registerID(); - MacroAssembler::RegisterID baseReg = base.registerID(); + // Get the array storage. + m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); - // Get the array storage. - m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); - } else { - SpeculateCellOperand base(this, node.child1); + // Check if we're writing to a hole; if so increment m_numValuesInVector. + MacroAssembler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); + m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); - // Map base & property into registers, allocate a register for storage. - propertyReg = property.registerID(); - storageReg = storage.registerID(); - MacroAssembler::RegisterID baseReg = base.registerID(); + // If we're writing to a hole we might be growing the array; + MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length))); + m_jit.add32(TrustedImm32(1), propertyReg); + m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length))); + m_jit.sub32(TrustedImm32(1), propertyReg); - // Check that base is an array, and that property is contained within m_vector (< m_vectorLength). - speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr))); - speculationCheck(m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset()))); + lengthDoesNotNeedUpdate.link(&m_jit); + notHoleValue.link(&m_jit); - // Get the array storage. - m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); + // Store the value to the array. + m_jit.storePtr(valueReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); - // Check if we're writing to a hole; if so increment m_numValuesInVector. - MacroAssembler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); - m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); + noResult(m_compileIndex); + break; + } - // If we're writing to a hole we might be growing the array; - MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length))); - m_jit.add32(TrustedImm32(1), propertyReg); - m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length))); - m_jit.sub32(TrustedImm32(1), propertyReg); + case PutByValAlias: { + SpeculateCellOperand base(this, node.child1); + SpeculateStrictInt32Operand property(this, node.child2); + JSValueOperand value(this, node.child3); + GPRTemporary storage(this, base); // storage may overwrite base. - lengthDoesNotNeedUpdate.link(&m_jit); - notHoleValue.link(&m_jit); - } - // After this point base goes out of scope. This may free the register. - // As such, after this point we'd better not have any bails out to the non-speculative path! + // Get the array storage. + MacroAssembler::RegisterID storageReg = storage.registerID(); + m_jit.loadPtr(MacroAssembler::Address(base.registerID(), JSArray::storageOffset()), storageReg); - // Store the value to the array. - JSValueOperand value(this, node.child3); + // Map property & value into registers. + MacroAssembler::RegisterID propertyReg = property.registerID(); MacroAssembler::RegisterID valueReg = value.registerID(); + + // Store the value to the array. m_jit.storePtr(valueReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); noResult(m_compileIndex); break; } + case DFG::Jump: { + BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); + if (taken != (m_block + 1)) + addBranch(m_jit.jump(), taken); + noResult(m_compileIndex); + break; + } + + case Branch: { + JSValueOperand value(this, node.child1); + MacroAssembler::RegisterID valueReg = value.registerID(); + + BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); + BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()); + + // Integers + addBranch(m_jit.branchPtr(MacroAssembler::Equal, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsNumber(0)))), notTaken); + MacroAssembler::Jump isNonZeroInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, valueReg, JITCompiler::tagTypeNumberRegister); + + // Booleans + addBranch(m_jit.branchPtr(MacroAssembler::Equal, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsBoolean(false)))), notTaken); + speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsBoolean(true))))); + + if (taken == (m_block + 1)) + isNonZeroInteger.link(&m_jit); + else { + addBranch(isNonZeroInteger, taken); + addBranch(m_jit.jump(), taken); + } + + noResult(m_compileIndex); + break; + } + case Return: { ASSERT(JITCompiler::callFrameRegister != JITCompiler::regT1); ASSERT(JITCompiler::regT1 != JITCompiler::returnValueRegister); ASSERT(JITCompiler::returnValueRegister != JITCompiler::callFrameRegister); +#if DFG_SUCCESS_STATS + static SamplingCounter counter("SpeculativeJIT"); + m_jit.emitCount(counter); +#endif + // Return the result in returnValueRegister. JSValueOperand op1(this, node.child1); m_jit.move(op1.registerID(), JITCompiler::returnValueRegister); @@ -639,25 +782,43 @@ bool SpeculativeJIT::compile(Node& node) return true; } -bool SpeculativeJIT::compile() +bool SpeculativeJIT::compile(BasicBlock& block) { - ASSERT(!m_compileIndex); - Node* nodes = m_jit.graph().begin(); - - for (; m_compileIndex < m_jit.graph().size(); ++m_compileIndex) { -#if DFG_DEBUG_VERBOSE - fprintf(stderr, "index(%d)\n", (int)m_compileIndex); + ASSERT(m_compileIndex == block.begin); + m_blockHeads[m_block] = m_jit.label(); +#if DFG_JIT_BREAK_ON_EVERY_BLOCK + m_jit.breakpoint(); #endif - Node& node = nodes[m_compileIndex]; + for (; m_compileIndex < block.end; ++m_compileIndex) { + Node& node = m_jit.graph()[m_compileIndex]; if (!node.refCount) continue; + +#if DFG_DEBUG_VERBOSE + fprintf(stderr, "SpeculativeJIT generating Node @%d at JIT offset 0x%x\n", (int)m_compileIndex, m_jit.debugOffset()); +#endif +#if DFG_JIT_BREAK_ON_EVERY_NODE + m_jit.breakpoint(); +#endif if (!compile(node)) return false; } return true; } +bool SpeculativeJIT::compile() +{ + ASSERT(!m_compileIndex); + Vector<BasicBlock> blocks = m_jit.graph().m_blocks; + for (m_block = 0; m_block < blocks.size(); ++m_block) { + if (!compile(blocks[m_block])) + return false; + } + linkBranches(); + return true; +} + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 93983c6..965cdbe 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -88,6 +88,7 @@ struct SpeculationCheck { RegisterInfo m_gprInfo[numberOfGPRs]; NodeIndex m_fprInfo[numberOfFPRs]; }; +typedef SegmentedVector<SpeculationCheck, 16> SpeculationCheckVector; // === SpeculativeJIT === @@ -103,9 +104,6 @@ struct SpeculationCheck { class SpeculativeJIT : public JITCodeGenerator { friend struct SpeculationCheck; public: - // The speculation - typedef SegmentedVector<SpeculationCheck, 16> SpeculationCheckVector; - SpeculativeJIT(JITCompiler& jit) : JITCodeGenerator(jit, true) , m_didTerminate(false) @@ -135,6 +133,23 @@ public: private: bool compile(Node&); + bool compile(BasicBlock&); + + bool isDoubleConstantWithInt32Value(NodeIndex nodeIndex, int32_t& out) + { + if (!m_jit.isDoubleConstant(nodeIndex)) + return false; + double value = m_jit.valueOfDoubleConstant(nodeIndex); + + int32_t asInt32 = static_cast<int32_t>(value); + if (value != asInt32) + return false; + if (!asInt32 && signbit(value)) + return false; + + out = asInt32; + return true; + } // Add a speculation check without additional recovery. void speculationCheck(MacroAssembler::Jump jumpToFail) @@ -325,8 +340,8 @@ private: // nodes require entry points from the speculative path. class SpeculationCheckIndexIterator { public: - SpeculationCheckIndexIterator(SpeculativeJIT& speculativeJIT) - : m_speculationChecks(speculativeJIT.speculationChecks()) + SpeculationCheckIndexIterator(SpeculationCheckVector& speculationChecks) + : m_speculationChecks(speculationChecks) , m_iter(m_speculationChecks.begin()) , m_end(m_speculationChecks.end()) { @@ -344,11 +359,12 @@ public: } private: - SpeculativeJIT::SpeculationCheckVector& m_speculationChecks; - SpeculativeJIT::SpeculationCheckVector::Iterator m_iter; - SpeculativeJIT::SpeculationCheckVector::Iterator m_end; + SpeculationCheckVector& m_speculationChecks; + SpeculationCheckVector::Iterator m_iter; + SpeculationCheckVector::Iterator m_end; }; + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/gyp/gtk.gyp b/Source/JavaScriptCore/gyp/gtk.gyp new file mode 100644 index 0000000..33eaa17 --- /dev/null +++ b/Source/JavaScriptCore/gyp/gtk.gyp @@ -0,0 +1,18 @@ +{ # Just a stub file to allow Source/gyp/configure to run successfully for testing. + 'includes': [ + '../../gyp/common.gypi', + '../JavaScriptCore.gypi', + ], + 'targets': [ + { + 'target_name': 'JavaScriptCore', + 'type': 'static_library', + 'sources': [ + '<@(javascriptcore_files)', + '<@(javascriptcore_publicheader_files)', + '<@(javascriptcore_privateheader_files)', + '<@(javascriptcore_derived_source_files)', + ], + }, + ], # targets +} diff --git a/Source/JavaScriptCore/runtime/ConservativeSet.cpp b/Source/JavaScriptCore/heap/ConservativeRoots.cpp index 8872023..1aad779 100644 --- a/Source/JavaScriptCore/runtime/ConservativeSet.cpp +++ b/Source/JavaScriptCore/heap/ConservativeRoots.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "ConservativeSet.h" +#include "ConservativeRoots.h" namespace JSC { diff --git a/Source/JavaScriptCore/runtime/ConservativeSet.h b/Source/JavaScriptCore/heap/ConservativeRoots.h index d078606..d078606 100644 --- a/Source/JavaScriptCore/runtime/ConservativeSet.h +++ b/Source/JavaScriptCore/heap/ConservativeRoots.h diff --git a/Source/JavaScriptCore/collector/handles/Handle.h b/Source/JavaScriptCore/heap/Handle.h index d4e38c0..531d535 100644 --- a/Source/JavaScriptCore/collector/handles/Handle.h +++ b/Source/JavaScriptCore/heap/Handle.h @@ -27,7 +27,6 @@ #define Handle_h #include "WriteBarrier.h" - #include <wtf/Assertions.h> namespace JSC { @@ -45,43 +44,32 @@ template <class T> class Handle; // Creating a JSValue Handle is invalid template <> class Handle<JSValue>; +// Forward declare WeakGCMap +template<typename KeyType, typename MappedType, typename FinalizerCallback, typename HashArg, typename KeyTraitsArg> class WeakGCMap; + class HandleBase { friend class HandleHeap; + friend struct JSCallbackObjectData; + template <typename KeyType, typename MappedType, typename FinalizerCallback, typename HashArg, typename KeyTraitsArg> friend class WeakGCMap; public: - bool operator!() const { return isEmpty(); } + bool operator!() const { return !m_slot || !*m_slot; } // This conversion operator allows implicit conversion to bool but not to other integer types. typedef JSValue (HandleBase::*UnspecifiedBoolType); operator UnspecifiedBoolType*() const { return (m_slot && *m_slot) ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } - bool isEmpty() const { return !m_slot || !*m_slot; } - protected: HandleBase(HandleSlot slot) : m_slot(slot) { - ASSERT(slot); - } - - enum DontNullCheckSlotTag { DontNullCheckSlot }; - HandleBase(HandleSlot slot, DontNullCheckSlotTag) - : m_slot(slot) - { } - HandleSlot slot() const { return m_slot; } - void invalidate() - { - // It is unsafe to use a handle after invalidating it. - m_slot = 0; - } + void swap(HandleBase& other) { std::swap(m_slot, other.m_slot); } - // needed by Global<>::operator= and Global<>::set if it's an empty handle + HandleSlot slot() const { return m_slot; } void setSlot(HandleSlot slot) { - ASSERT(!m_slot); - ASSERT(slot); m_slot = slot; } @@ -104,10 +92,35 @@ template <> struct HandleTypes<Unknown> { }; template <typename Base, typename T> struct HandleConverter { - T* operator->() { return static_cast<Base*>(this)->get(); } - const T* operator->() const { return static_cast<const Base*>(this)->get(); } - T* operator*() { return static_cast<Base*>(this)->get(); } - const T* operator*() const { return static_cast<const Base*>(this)->get(); } + T* operator->() + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); +#endif + return static_cast<Base*>(this)->get(); + } + const T* operator->() const + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); +#endif + return static_cast<const Base*>(this)->get(); + } + + T* operator*() + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); +#endif + return static_cast<Base*>(this)->get(); + } + const T* operator*() const + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); +#endif + return static_cast<const Base*>(this)->get(); + } }; template <typename Base> struct HandleConverter<Base, Unknown> { @@ -118,7 +131,13 @@ template <typename Base> struct HandleConverter<Base, Unknown> { bool isUndefinedOrNull() const { return jsValue().isUndefinedOrNull(); } private: - JSValue jsValue() const { return static_cast<const Base*>(this)->get(); } + JSValue jsValue() const + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get().isZombie()); +#endif + return static_cast<const Base*>(this)->get(); + } }; template <typename T> class Handle : public HandleBase, public HandleConverter<Handle<T>, T> { @@ -128,21 +147,18 @@ public: template <typename U> Handle(Handle<U> o) { typename HandleTypes<T>::template validateUpcast<U>(); - m_slot = o.slot(); + setSlot(o.slot()); } + void swap(Handle& other) { HandleBase::swap(other); } + ExternalType get() const { return HandleTypes<T>::getFromSlot(this->slot()); } protected: - - Handle(HandleSlot slot) + Handle(HandleSlot slot = 0) : HandleBase(slot) { } - Handle(HandleSlot slot, HandleBase::DontNullCheckSlotTag) - : HandleBase(slot, HandleBase::DontNullCheckSlot) - { - } private: friend class HandleHeap; diff --git a/Source/JavaScriptCore/collector/handles/HandleHeap.cpp b/Source/JavaScriptCore/heap/HandleHeap.cpp index 1beb407..1a0051e 100644 --- a/Source/JavaScriptCore/collector/handles/HandleHeap.cpp +++ b/Source/JavaScriptCore/heap/HandleHeap.cpp @@ -24,19 +24,28 @@ */ #include "config.h" - #include "HandleHeap.h" #include "JSObject.h" namespace JSC { +WeakHandleOwner::~WeakHandleOwner() +{ +} + +bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle<Unknown>, void*, MarkStack&) +{ + return false; +} + +void WeakHandleOwner::finalize(Handle<Unknown>, void*) +{ +} + HandleHeap::HandleHeap(JSGlobalData* globalData) : m_globalData(globalData) , m_nextToFinalize(0) -#if !ASSERT_DISABLED - , m_handlingFinalizers(false) -#endif { grow(); } @@ -58,71 +67,73 @@ void HandleHeap::markStrongHandles(HeapRootMarker& heapRootMarker) heapRootMarker.mark(node->slot()); } -void HandleHeap::updateAfterMark() +void HandleHeap::markWeakHandles(HeapRootMarker& heapRootMarker) { - clearWeakPointers(); + MarkStack& markStack = heapRootMarker.markStack(); + + Node* end = m_weakList.end(); + for (Node* node = m_weakList.begin(); node != end; node = node->next()) { + ASSERT(isValidWeakNode(node)); + JSCell* cell = node->slot()->asCell(); + if (Heap::isMarked(cell)) + continue; + + WeakHandleOwner* weakOwner = node->weakOwner(); + if (!weakOwner) + continue; + + if (!weakOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext(), markStack)) + continue; + + heapRootMarker.mark(node->slot()); + } } -void HandleHeap::clearWeakPointers() +void HandleHeap::finalizeWeakHandles() { -#if !ASSERT_DISABLED - m_handlingFinalizers = true; -#endif Node* end = m_weakList.end(); - for (Node* node = m_weakList.begin(); node != end;) { - Node* current = node; - node = current->next(); - - JSValue value = *current->slot(); - if (!value || !value.isCell()) - continue; - - JSCell* cell = value.asCell(); - ASSERT(!cell || cell->structure()); - -#if ENABLE(JSC_ZOMBIES) - ASSERT(!cell->isZombie()); -#endif + for (Node* node = m_weakList.begin(); node != end; node = m_nextToFinalize) { + m_nextToFinalize = node->next(); + + ASSERT(isValidWeakNode(node)); + JSCell* cell = node->slot()->asCell(); if (Heap::isMarked(cell)) continue; - - if (Finalizer* finalizer = current->finalizer()) { - m_nextToFinalize = node; - finalizer->finalize(Handle<Unknown>::wrapSlot(current->slot()), current->finalizerContext()); - node = m_nextToFinalize; - m_nextToFinalize = 0; - } - - if (current->isSelfDestroying()) { - ASSERT(node != current); - ASSERT(current->next() == node); - deallocate(toHandle(current)); - } else if (current->next() == node) { // if current->next() != node, then current has been deallocated - SentinelLinkedList<Node>::remove(current); - *current->slot() = JSValue(); - m_immediateList.push(current); + + if (WeakHandleOwner* weakOwner = node->weakOwner()) { + weakOwner->finalize(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext()); + if (m_nextToFinalize != node->next()) // Owner deallocated node. + continue; } + + *node->slot() = JSValue(); + SentinelLinkedList<Node>::remove(node); + m_immediateList.push(node); } -#if !ASSERT_DISABLED - m_handlingFinalizers = false; -#endif + + m_nextToFinalize = 0; } void HandleHeap::writeBarrier(HandleSlot slot, const JSValue& value) { - ASSERT(!m_handlingFinalizers); - if (slot->isCell() == value.isCell() && !value == !*slot) + ASSERT(!m_nextToFinalize); // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants. + + if (!value == !*slot && slot->isCell() == value.isCell()) return; + Node* node = toNode(slot); SentinelLinkedList<Node>::remove(node); - if (!value.isCell() || !value) { + if (!value || !value.isCell()) { m_immediateList.push(node); return; } - if (node->isWeak()) + + if (node->isWeak()) { m_weakList.push(node); - else - m_strongList.push(node); + return; + } + + m_strongList.push(node); } unsigned HandleHeap::protectedGlobalObjectCount() @@ -137,4 +148,27 @@ unsigned HandleHeap::protectedGlobalObjectCount() return count; } +#if !ASSERT_DISABLED +bool HandleHeap::isValidWeakNode(Node* node) +{ + if (!node->isWeak()) + return false; + + JSValue value = *node->slot(); + if (!value || !value.isCell()) + return false; + + JSCell* cell = value.asCell(); + if (!cell || !cell->structure()) + return false; + +#if ENABLE(JSC_ZOMBIES) + if (cell->isZombie()) + return false; +#endif + + return true; } +#endif + +} // namespace JSC diff --git a/Source/JavaScriptCore/collector/handles/HandleHeap.h b/Source/JavaScriptCore/heap/HandleHeap.h index ed462d4..886c94a 100644 --- a/Source/JavaScriptCore/collector/handles/HandleHeap.h +++ b/Source/JavaScriptCore/heap/HandleHeap.h @@ -34,14 +34,17 @@ namespace JSC { class HandleHeap; +class HeapRootMarker; class JSGlobalData; class JSValue; -class HeapRootMarker; +class MarkStack; +class TypeCounter; -class Finalizer { +class WeakHandleOwner { public: - virtual void finalize(Handle<Unknown>, void*) = 0; - virtual ~Finalizer() {} + virtual ~WeakHandleOwner(); + virtual bool isReachableFromOpaqueRoots(Handle<Unknown>, void* context, MarkStack&); + virtual void finalize(Handle<Unknown>, void* context); }; class HandleHeap { @@ -49,33 +52,29 @@ public: static HandleHeap* heapFor(HandleSlot); HandleHeap(JSGlobalData*); + + JSGlobalData* globalData(); HandleSlot allocate(); void deallocate(HandleSlot); - - void makeWeak(HandleSlot, Finalizer*, void* context); - void makeSelfDestroying(HandleSlot, Finalizer*, void* context); + + void makeWeak(HandleSlot, WeakHandleOwner* = 0, void* context = 0); + HandleSlot copyWeak(HandleSlot); void markStrongHandles(HeapRootMarker&); - void updateAfterMark(); - - // Should only be called during teardown. - void clearWeakPointers(); + void markWeakHandles(HeapRootMarker&); + void finalizeWeakHandles(); void writeBarrier(HandleSlot, const JSValue&); #if !ASSERT_DISABLED - Finalizer* getFinalizer(HandleSlot handle) - { - return toNode(handle)->finalizer(); - } + bool hasWeakOwner(HandleSlot, WeakHandleOwner*); #endif unsigned protectedGlobalObjectCount(); - + void protectedObjectTypeCounts(TypeCounter&); + private: - typedef uintptr_t HandleHeapWithFlags; - enum { FlagsMask = 3, WeakFlag = 1, SelfDestroyingFlag = 2 }; class Node { public: Node(WTF::SentinelTag); @@ -84,9 +83,11 @@ private: HandleSlot slot(); HandleHeap* handleHeap(); - void setFinalizer(Finalizer*, void* context); - Finalizer* finalizer(); - void* finalizerContext(); + void makeWeak(WeakHandleOwner*, void* context); + bool isWeak(); + + WeakHandleOwner* weakOwner(); + void* weakOwnerContext(); void setPrev(Node*); Node* prev(); @@ -94,17 +95,13 @@ private: void setNext(Node*); Node* next(); - bool isWeak(); - void makeWeak(); - - bool isSelfDestroying(); - void makeSelfDestroying(); - private: + WeakHandleOwner* emptyWeakOwner(); + JSValue m_value; - HandleHeapWithFlags m_handleHeapWithFlags; - Finalizer* m_finalizer; - void* m_finalizerContext; + HandleHeap* m_handleHeap; + WeakHandleOwner* m_weakOwner; + void* m_weakOwnerContext; Node* m_prev; Node* m_next; }; @@ -113,6 +110,10 @@ private: static Node* toNode(HandleSlot); void grow(); + +#if !ASSERT_DISABLED + bool isValidWeakNode(Node*); +#endif JSGlobalData* m_globalData; BlockStack<Node> m_blockStack; @@ -122,10 +123,6 @@ private: SentinelLinkedList<Node> m_immediateList; SinglyLinkedList<Node> m_freeList; Node* m_nextToFinalize; - -#if !ASSERT_DISABLED - bool m_handlingFinalizers; -#endif }; inline HandleHeap* HandleHeap::heapFor(HandleSlot handle) @@ -133,6 +130,11 @@ inline HandleHeap* HandleHeap::heapFor(HandleSlot handle) return toNode(handle)->handleHeap(); } +inline JSGlobalData* HandleHeap::globalData() +{ + return m_globalData; +} + inline HandleSlot HandleHeap::toHandle(Node* node) { return reinterpret_cast<HandleSlot>(node); @@ -157,44 +159,56 @@ inline HandleSlot HandleHeap::allocate() inline void HandleHeap::deallocate(HandleSlot handle) { Node* node = toNode(handle); - if (m_nextToFinalize == node) { + if (node == m_nextToFinalize) { m_nextToFinalize = node->next(); ASSERT(m_nextToFinalize->next()); } + SentinelLinkedList<Node>::remove(node); m_freeList.push(node); } -inline void HandleHeap::makeWeak(HandleSlot handle, Finalizer* finalizer, void* context) +inline HandleSlot HandleHeap::copyWeak(HandleSlot other) +{ + Node* node = toNode(allocate()); + node->makeWeak(toNode(other)->weakOwner(), toNode(other)->weakOwnerContext()); + writeBarrier(node->slot(), *other); + *node->slot() = *other; + return toHandle(node); +} + +inline void HandleHeap::makeWeak(HandleSlot handle, WeakHandleOwner* weakOwner, void* context) { Node* node = toNode(handle); + node->makeWeak(weakOwner, context); + SentinelLinkedList<Node>::remove(node); - node->setFinalizer(finalizer, context); - node->makeWeak(); - if (handle->isCell() && *handle) - m_weakList.push(node); - else + if (!*handle || !handle->isCell()) { m_immediateList.push(node); + return; + } + + m_weakList.push(node); } -inline void HandleHeap::makeSelfDestroying(HandleSlot handle, Finalizer* finalizer, void* context) +#if !ASSERT_DISABLED +inline bool HandleHeap::hasWeakOwner(HandleSlot handle, WeakHandleOwner* weakOwner) { - makeWeak(handle, finalizer, context); - Node* node = toNode(handle); - node->makeSelfDestroying(); + return toNode(handle)->weakOwner() == weakOwner; } +#endif inline HandleHeap::Node::Node(HandleHeap* handleHeap) - : m_handleHeapWithFlags(reinterpret_cast<uintptr_t>(handleHeap)) - , m_finalizer(0) - , m_finalizerContext(0) + : m_handleHeap(handleHeap) + , m_weakOwner(0) + , m_weakOwnerContext(0) { } inline HandleHeap::Node::Node(WTF::SentinelTag) - : m_handleHeapWithFlags(0) - , m_finalizer(0) - , m_finalizerContext(0) + : m_handleHeap(0) + , m_weakOwner(0) + , m_weakOwnerContext(0) { } @@ -205,47 +219,29 @@ inline HandleSlot HandleHeap::Node::slot() inline HandleHeap* HandleHeap::Node::handleHeap() { - return reinterpret_cast<HandleHeap*>(m_handleHeapWithFlags & ~FlagsMask); + return m_handleHeap; } -inline void HandleHeap::Node::setFinalizer(Finalizer* finalizer, void* context) +inline void HandleHeap::Node::makeWeak(WeakHandleOwner* weakOwner, void* context) { - m_finalizer = finalizer; - m_finalizerContext = context; -} - -inline void HandleHeap::Node::makeWeak() -{ - ASSERT(!(m_handleHeapWithFlags & WeakFlag)); - m_handleHeapWithFlags |= WeakFlag; + m_weakOwner = weakOwner ? weakOwner : emptyWeakOwner(); + m_weakOwnerContext = context; } inline bool HandleHeap::Node::isWeak() { - return !!(m_handleHeapWithFlags & WeakFlag); -} - -inline void HandleHeap::Node::makeSelfDestroying() -{ - ASSERT(m_handleHeapWithFlags & WeakFlag); - ASSERT(!(m_handleHeapWithFlags & SelfDestroyingFlag)); - m_handleHeapWithFlags |= SelfDestroyingFlag; + return m_weakOwner; // True for emptyWeakOwner(). } -inline bool HandleHeap::Node::isSelfDestroying() +inline WeakHandleOwner* HandleHeap::Node::weakOwner() { - return !!(m_handleHeapWithFlags & SelfDestroyingFlag); + return m_weakOwner == emptyWeakOwner() ? 0 : m_weakOwner; // 0 for emptyWeakOwner(). } -inline Finalizer* HandleHeap::Node::finalizer() +inline void* HandleHeap::Node::weakOwnerContext() { - return m_finalizer; -} - -inline void* HandleHeap::Node::finalizerContext() -{ - ASSERT(m_finalizer); - return m_finalizerContext; + ASSERT(weakOwner()); + return m_weakOwnerContext; } inline void HandleHeap::Node::setPrev(Node* prev) @@ -268,6 +264,13 @@ inline HandleHeap::Node* HandleHeap::Node::next() return m_next; } +// Sentinel to indicate that a node is weak, but its owner has no meaningful +// callbacks. This allows us to optimize by skipping such nodes. +inline WeakHandleOwner* HandleHeap::Node::emptyWeakOwner() +{ + return reinterpret_cast<WeakHandleOwner*>(-1); +} + } #endif diff --git a/Source/JavaScriptCore/collector/handles/HandleStack.cpp b/Source/JavaScriptCore/heap/HandleStack.cpp index 1c151af..1c151af 100644 --- a/Source/JavaScriptCore/collector/handles/HandleStack.cpp +++ b/Source/JavaScriptCore/heap/HandleStack.cpp diff --git a/Source/JavaScriptCore/collector/handles/HandleStack.h b/Source/JavaScriptCore/heap/HandleStack.h index 54e6c60..54e6c60 100644 --- a/Source/JavaScriptCore/collector/handles/HandleStack.h +++ b/Source/JavaScriptCore/heap/HandleStack.h diff --git a/Source/JavaScriptCore/runtime/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp index e3ef8bb..11999b7 100644 --- a/Source/JavaScriptCore/runtime/Heap.cpp +++ b/Source/JavaScriptCore/heap/Heap.cpp @@ -22,7 +22,7 @@ #include "Heap.h" #include "CodeBlock.h" -#include "ConservativeSet.h" +#include "ConservativeRoots.h" #include "GCActivityCallback.h" #include "Interpreter.h" #include "JSGlobalData.h" @@ -82,7 +82,7 @@ void Heap::destroy() delete m_markListSet; m_markListSet = 0; m_markedSpace.clearMarks(); - m_handleHeap.clearWeakPointers(); + m_handleHeap.finalizeWeakHandles(); m_markedSpace.destroy(); m_globalData = 0; @@ -240,16 +240,28 @@ void Heap::markRoots() markStack.drain(); m_handleHeap.markStrongHandles(heapRootMarker); + markStack.drain(); + m_handleStack.mark(heapRootMarker); + markStack.drain(); - // Mark the small strings cache last, since it will clear itself if nothing - // else has marked it. + // Mark the small strings cache as late as possible, since it will clear + // itself if nothing else has marked it. + // FIXME: Change the small strings cache to use Weak<T>. m_globalData->smallStrings.markChildren(heapRootMarker); - markStack.drain(); - markStack.compact(); - m_handleHeap.updateAfterMark(); + // Weak handles must be marked last, because their owners use the set of + // opaque roots to determine reachability. + int lastOpaqueRootCount; + do { + lastOpaqueRootCount = markStack.opaqueRootCount(); + m_handleHeap.markWeakHandles(heapRootMarker); + markStack.drain(); + // If the set of opaque roots has grown, more weak handles may have become reachable. + } while (lastOpaqueRootCount != markStack.opaqueRootCount()); + + markStack.reset(); m_operationInProgress = NoOperation; } @@ -318,10 +330,11 @@ inline const char* TypeCounter::typeName(JSCell* cell) return "API wrapper"; if (cell->isPropertyNameIterator()) return "For-in iterator"; + if (const ClassInfo* info = cell->classInfo()) + return info->className; if (!cell->isObject()) return "[empty cell]"; - const ClassInfo* info = cell->classInfo(); - return info ? info->className : "Object"; + return "Object"; } inline void TypeCounter::operator()(JSCell* cell) @@ -341,10 +354,21 @@ PassOwnPtr<TypeCountSet> Heap::protectedObjectTypeCounts() ProtectCountSet::iterator end = m_protectedValues.end(); for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it) typeCounter(it->first); + m_handleHeap.protectedObjectTypeCounts(typeCounter); return typeCounter.take(); } +void HandleHeap::protectedObjectTypeCounts(TypeCounter& typeCounter) +{ + Node* end = m_strongList.end(); + for (Node* node = m_strongList.begin(); node != end; node = node->next()) { + JSValue value = *node->slot(); + if (value && value.isCell()) + typeCounter(value.asCell()); + } +} + PassOwnPtr<TypeCountSet> Heap::objectTypeCounts() { TypeCounter typeCounter; @@ -368,6 +392,7 @@ void Heap::reset(SweepToggle sweepToggle) JAVASCRIPTCORE_GC_BEGIN(); markRoots(); + m_handleHeap.finalizeWeakHandles(); JAVASCRIPTCORE_GC_MARKED(); diff --git a/Source/JavaScriptCore/runtime/Heap.h b/Source/JavaScriptCore/heap/Heap.h index c2d3bac..c2d3bac 100644 --- a/Source/JavaScriptCore/runtime/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h diff --git a/Source/JavaScriptCore/collector/handles/Local.h b/Source/JavaScriptCore/heap/Local.h index 035e9e9..ac7d136 100644 --- a/Source/JavaScriptCore/collector/handles/Local.h +++ b/Source/JavaScriptCore/heap/Local.h @@ -30,70 +30,48 @@ #include "JSGlobalData.h" /* - A Local is a temporary handle whose lifetime is tied to a given LocalScope. - Use Locals for local values on the stack. It is an error to create a Local - outside of any LocalScope. + A strongly referenced handle whose lifetime is temporary, limited to a given + LocalScope. Use Locals for local values on the stack. It is an error to + create a Local outside of any LocalScope. */ namespace JSC { -template <typename T> class Local; -} - -namespace WTF { - -template<typename T> struct VectorTraits<JSC::Local<T> > { - static const bool needsDestruction = false; - static const bool needsInitialization = true; - static const bool canInitializeWithMemset = false; - static const bool canMoveWithMemcpy = true; - static const bool canCopyWithMemcpy = false; - static const bool canFillWithMemset = false; - static const bool canCompareWithMemcmp = true; -}; - -} - -namespace JSC { template <typename T> class Local : public Handle<T> { friend class LocalScope; + using Handle<T>::slot; + public: typedef typename Handle<T>::ExternalType ExternalType; + Local(JSGlobalData&, ExternalType = ExternalType()); Local(JSGlobalData&, Handle<T>); Local(const Local<T>&); // Adopting constructor. Used to return a Local to a calling function. Local& operator=(ExternalType); Local& operator=(Handle<T>); - - using Handle<T>::slot; private: Local(HandleSlot, ExternalType); // Used by LocalScope::release() to move a Local to a containing scope. - void internalSet(ExternalType value) - { - JSValue newValue(HandleTypes<T>::toJSValue(value)); - HandleSlot slot = this->slot(); - *slot = newValue; - } + void set(ExternalType); }; template <typename T> inline Local<T>::Local(JSGlobalData& globalData, ExternalType value) : Handle<T>(globalData.allocateLocalHandle()) { - internalSet(value); + set(value); } -template <typename T> inline Local<T>::Local(JSGlobalData& globalData, Handle<T> handle) +template <typename T> inline Local<T>::Local(JSGlobalData& globalData, Handle<T> other) : Handle<T>(globalData.allocateLocalHandle()) { - internalSet(handle.get()); + set(other.get()); } -template <typename T> inline Local<T>::Local(const Local<T>& o) - : Handle<T>(o.slot()) +template <typename T> inline Local<T>::Local(const Local<T>& other) + : Handle<T>(other.slot()) { - const_cast<Local<T>&>(o).invalidate(); // Prevent accidental sharing. + const_cast<Local<T>&>(other).setSlot(0); // Prevent accidental sharing. } template <typename T> inline Local<T>::Local(HandleSlot slot, ExternalType value) @@ -103,16 +81,24 @@ template <typename T> inline Local<T>::Local(HandleSlot slot, ExternalType value template <typename T> inline Local<T>& Local<T>::operator=(ExternalType value) { - internalSet(value); + set(value); return *this; } -template <typename T> inline Local<T>& Local<T>::operator=(Handle<T> handle) +template <typename T> inline Local<T>& Local<T>::operator=(Handle<T> other) { - internalSet(handle.get()); + set(other.get()); return *this; } +template <typename T> inline void Local<T>::set(ExternalType externalType) +{ + ASSERT(slot()); + ASSERT(!HandleTypes<T>::toJSValue(externalType) || !HandleTypes<T>::toJSValue(externalType).isCell() || Heap::isMarked(HandleTypes<T>::toJSValue(externalType).asCell())); + *slot() = externalType; +} + + template <typename T, unsigned inlineCapacity = 0> class LocalStack { typedef typename Handle<T>::ExternalType ExternalType; public: @@ -154,4 +140,14 @@ private: } +namespace WTF { + +template<typename T> struct VectorTraits<JSC::Local<T> > : SimpleClassVectorTraits { + static const bool needsDestruction = false; + static const bool canInitializeWithMemset = false; + static const bool canCompareWithMemcmp = false; +}; + +} + #endif diff --git a/Source/JavaScriptCore/collector/handles/LocalScope.h b/Source/JavaScriptCore/heap/LocalScope.h index cd27b32..cd27b32 100644 --- a/Source/JavaScriptCore/collector/handles/LocalScope.h +++ b/Source/JavaScriptCore/heap/LocalScope.h diff --git a/Source/JavaScriptCore/runtime/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 3e205a1..1f4f3ce 100644 --- a/Source/JavaScriptCore/runtime/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -22,7 +22,7 @@ #include "config.h" #include "MachineStackMarker.h" -#include "ConservativeSet.h" +#include "ConservativeRoots.h" #include "Heap.h" #include "JSArray.h" #include "JSGlobalData.h" diff --git a/Source/JavaScriptCore/runtime/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index c814ac5..c814ac5 100644 --- a/Source/JavaScriptCore/runtime/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h diff --git a/Source/JavaScriptCore/runtime/MarkStack.cpp b/Source/JavaScriptCore/heap/MarkStack.cpp index e9d1b13..3fb1a98 100644 --- a/Source/JavaScriptCore/runtime/MarkStack.cpp +++ b/Source/JavaScriptCore/heap/MarkStack.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "MarkStack.h" -#include "ConservativeSet.h" +#include "ConservativeRoots.h" #include "Heap.h" #include "JSArray.h" #include "JSCell.h" @@ -38,11 +38,12 @@ namespace JSC { size_t MarkStack::s_pageSize = 0; -void MarkStack::compact() +void MarkStack::reset() { ASSERT(s_pageSize); m_values.shrinkAllocation(s_pageSize); m_markSets.shrinkAllocation(s_pageSize); + m_opaqueRoots.clear(); } void MarkStack::append(ConservativeRoots& conservativeRoots) @@ -56,7 +57,13 @@ void MarkStack::append(ConservativeRoots& conservativeRoots) inline void MarkStack::markChildren(JSCell* cell) { ASSERT(Heap::isMarked(cell)); + if (cell->structure()->typeInfo().type() < CompoundType) { + cell->JSCell::markChildren(*this); + return; + } + if (!cell->structure()->typeInfo().overridesMarkChildren()) { + ASSERT(cell->isObject()); #ifdef NDEBUG asObject(cell)->markChildrenDirect(*this); #else @@ -104,6 +111,7 @@ void MarkStack::drain() } if (cell->structure()->typeInfo().type() < CompoundType) { + cell->JSCell::markChildren(*this); if (current.m_values == end) { m_markSets.removeLast(); continue; diff --git a/Source/JavaScriptCore/runtime/MarkStack.h b/Source/JavaScriptCore/heap/MarkStack.h index 7131917..aba7647 100644 --- a/Source/JavaScriptCore/runtime/MarkStack.h +++ b/Source/JavaScriptCore/heap/MarkStack.h @@ -29,6 +29,7 @@ #include "JSValue.h" #include "Register.h" #include "WriteBarrier.h" +#include <wtf/HashSet.h> #include <wtf/Vector.h> #include <wtf/Noncopyable.h> #include <wtf/OSAllocator.h> @@ -59,18 +60,8 @@ namespace JSC { ASSERT(m_values.isEmpty()); } - void deprecatedAppend(JSValue*); void deprecatedAppend(JSCell**); - void deprecatedAppend(Register*); template <typename T> void append(WriteBarrierBase<T>*); - template <typename T> void append(DeprecatedPtr<T>*); - - ALWAYS_INLINE void deprecatedAppendValues(Register* registers, size_t count, MarkSetProperties properties = NoNullValues) - { - JSValue* values = reinterpret_cast<JSValue*>(registers); - if (count) - m_markSets.append(MarkSet(values, values + count, properties)); - } void appendValues(WriteBarrierBase<Unknown>* barriers, size_t count, MarkSetProperties properties = NoNullValues) { @@ -81,8 +72,12 @@ namespace JSC { void append(ConservativeRoots&); + bool addOpaqueRoot(void* root) { return m_opaqueRoots.add(root).second; } + bool containsOpaqueRoot(void* root) { return m_opaqueRoots.contains(root); } + int opaqueRootCount() { return m_opaqueRoots.size(); } + void drain(); - void compact(); + void reset(); private: friend class HeapRootMarker; // Allowed to mark a JSValue* or JSCell** directly. @@ -198,6 +193,7 @@ namespace JSC { MarkStackArray<MarkSet> m_markSets; MarkStackArray<JSCell*> m_values; static size_t s_pageSize; + HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector. #if !ASSERT_DISABLED public: @@ -212,11 +208,6 @@ namespace JSC { return; m_markSets.append(MarkSet(slot, slot + count, NoNullValues)); } - - template <typename T> inline void MarkStack::append(DeprecatedPtr<T>* slot) - { - internalAppend(*slot->slot()); - } template <typename T> inline void MarkStack::append(WriteBarrierBase<T>* slot) { @@ -229,12 +220,6 @@ namespace JSC { internalAppend(*value); } - ALWAYS_INLINE void MarkStack::deprecatedAppend(JSValue* value) - { - ASSERT(value); - internalAppend(*value); - } - ALWAYS_INLINE void MarkStack::append(JSValue* value) { ASSERT(value); @@ -247,12 +232,6 @@ namespace JSC { internalAppend(*value); } - ALWAYS_INLINE void MarkStack::deprecatedAppend(Register* value) - { - ASSERT(value); - internalAppend(value->jsValue()); - } - ALWAYS_INLINE void MarkStack::internalAppend(JSValue value) { ASSERT(value); @@ -274,6 +253,8 @@ namespace JSC { void mark(JSValue*, size_t); void mark(JSString**); void mark(JSCell**); + + MarkStack& markStack(); private: MarkStack& m_markStack; @@ -304,6 +285,11 @@ namespace JSC { m_markStack.append(slot); } + inline MarkStack& HeapRootMarker::markStack() + { + return m_markStack; + } + } // namespace JSC #endif diff --git a/Source/JavaScriptCore/runtime/MarkStackPosix.cpp b/Source/JavaScriptCore/heap/MarkStackPosix.cpp index 2a5b298..2a5b298 100644 --- a/Source/JavaScriptCore/runtime/MarkStackPosix.cpp +++ b/Source/JavaScriptCore/heap/MarkStackPosix.cpp diff --git a/Source/JavaScriptCore/runtime/MarkStackSymbian.cpp b/Source/JavaScriptCore/heap/MarkStackSymbian.cpp index a3893d7..a3893d7 100644 --- a/Source/JavaScriptCore/runtime/MarkStackSymbian.cpp +++ b/Source/JavaScriptCore/heap/MarkStackSymbian.cpp diff --git a/Source/JavaScriptCore/runtime/MarkStackWin.cpp b/Source/JavaScriptCore/heap/MarkStackWin.cpp index 2d2a1b3..2d2a1b3 100644 --- a/Source/JavaScriptCore/runtime/MarkStackWin.cpp +++ b/Source/JavaScriptCore/heap/MarkStackWin.cpp diff --git a/Source/JavaScriptCore/runtime/MarkedBlock.cpp b/Source/JavaScriptCore/heap/MarkedBlock.cpp index cae701f..a10a778 100644 --- a/Source/JavaScriptCore/runtime/MarkedBlock.cpp +++ b/Source/JavaScriptCore/heap/MarkedBlock.cpp @@ -60,14 +60,12 @@ MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, JSGlobalData* Structure* dummyMarkableCellStructure = globalData->dummyMarkableCellStructure.get(); for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) - new (&atoms()[i]) JSCell(dummyMarkableCellStructure); + new (&atoms()[i]) JSCell(*globalData, dummyMarkableCellStructure); } void MarkedBlock::sweep() { -#if !ENABLE(JSC_ZOMBIES) Structure* dummyMarkableCellStructure = m_heap->globalData()->dummyMarkableCellStructure.get(); -#endif for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) { if (m_marks.get(i)) @@ -75,15 +73,15 @@ void MarkedBlock::sweep() JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[i]); #if ENABLE(JSC_ZOMBIES) - if (!cell->isZombie()) { + if (cell->structure() && cell->structure() != dummyMarkableCellStructure && !cell->isZombie()) { const ClassInfo* info = cell->classInfo(); cell->~JSCell(); - new (cell) JSZombie(info, JSZombie::leakedZombieStructure()); + new (cell) JSZombie(*m_heap->globalData(), info, m_heap->globalData()->zombieStructure.get()); m_marks.set(i); } #else cell->~JSCell(); - new (cell) JSCell(dummyMarkableCellStructure); + new (cell) JSCell(*m_heap->globalData(), dummyMarkableCellStructure); #endif } } diff --git a/Source/JavaScriptCore/runtime/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index 0e2b59c..0e2b59c 100644 --- a/Source/JavaScriptCore/runtime/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h diff --git a/Source/JavaScriptCore/runtime/MarkedSpace.cpp b/Source/JavaScriptCore/heap/MarkedSpace.cpp index d9a1e42..d9a1e42 100644 --- a/Source/JavaScriptCore/runtime/MarkedSpace.cpp +++ b/Source/JavaScriptCore/heap/MarkedSpace.cpp diff --git a/Source/JavaScriptCore/runtime/MarkedSpace.h b/Source/JavaScriptCore/heap/MarkedSpace.h index 29a8cd0..29a8cd0 100644 --- a/Source/JavaScriptCore/runtime/MarkedSpace.h +++ b/Source/JavaScriptCore/heap/MarkedSpace.h diff --git a/Source/JavaScriptCore/heap/Strong.h b/Source/JavaScriptCore/heap/Strong.h new file mode 100644 index 0000000..9f2aa05 --- /dev/null +++ b/Source/JavaScriptCore/heap/Strong.h @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2011 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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. + */ + +#ifndef Strong_h +#define Strong_h + +#include "Assertions.h" +#include "Handle.h" +#include "HandleHeap.h" + +namespace JSC { + +class JSGlobalData; +HandleSlot allocateGlobalHandle(JSGlobalData&); + +// A strongly referenced handle that prevents the object it points to from being garbage collected. +template <typename T> class Strong : public Handle<T> { + using Handle<T>::slot; + using Handle<T>::setSlot; + +public: + typedef typename Handle<T>::ExternalType ExternalType; + + Strong() + : Handle<T>() + { + } + + Strong(JSGlobalData& globalData, ExternalType value = ExternalType()) + : Handle<T>(allocateGlobalHandle(globalData)) + { + set(value); + } + + Strong(JSGlobalData& globalData, Handle<T> handle) + : Handle<T>(allocateGlobalHandle(globalData)) + { + set(handle.get()); + } + + Strong(const Strong& other) + : Handle<T>() + { + if (!other.slot()) + return; + setSlot(HandleHeap::heapFor(other.slot())->allocate()); + set(other.get()); + } + + template <typename U> Strong(const Strong<U>& other) + : Handle<T>() + { + if (!other.slot()) + return; + setSlot(HandleHeap::heapFor(other.slot())->allocate()); + set(other.get()); + } + + enum HashTableDeletedValueTag { HashTableDeletedValue }; + bool isHashTableDeletedValue() const { return slot() == hashTableDeletedValue(); } + Strong(HashTableDeletedValueTag) + : Handle<T>(hashTableDeletedValue()) + { + } + + ~Strong() + { + clear(); + } + + void swap(Strong& other) + { + Handle<T>::swap(other); + } + + void set(JSGlobalData& globalData, ExternalType value) + { + if (!slot()) + setSlot(allocateGlobalHandle(globalData)); + set(value); + } + + template <typename U> Strong& operator=(const Strong<U>& other) + { + if (!other.slot()) { + clear(); + return *this; + } + + set(*HandleHeap::heapFor(other.slot())->globalData(), other.get()); + return *this; + } + + Strong& operator=(const Strong& other) + { + if (!other.slot()) { + clear(); + return *this; + } + + set(*HandleHeap::heapFor(other.slot())->globalData(), other.get()); + return *this; + } + + void clear() + { + if (!slot()) + return; + HandleHeap::heapFor(slot())->deallocate(slot()); + setSlot(0); + } + +private: + static HandleSlot hashTableDeletedValue() { return reinterpret_cast<HandleSlot>(-1); } + + void set(ExternalType externalType) + { + ASSERT(slot()); + JSValue value = HandleTypes<T>::toJSValue(externalType); + HandleHeap::heapFor(slot())->writeBarrier(slot(), value); + *slot() = value; + } +}; + +template<class T> inline void swap(Strong<T>& a, Strong<T>& b) +{ + a.swap(b); +} + +} // namespace JSC + +namespace WTF { + +template<typename T> struct VectorTraits<JSC::Strong<T> > : SimpleClassVectorTraits { + static const bool canCompareWithMemcmp = false; +}; + +template<typename P> struct HashTraits<JSC::Strong<P> > : SimpleClassHashTraits<JSC::Strong<P> > { }; + +} + +#endif // Strong_h diff --git a/Source/JavaScriptCore/heap/Weak.h b/Source/JavaScriptCore/heap/Weak.h new file mode 100644 index 0000000..62e2596 --- /dev/null +++ b/Source/JavaScriptCore/heap/Weak.h @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2009 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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. + */ + +#ifndef Weak_h +#define Weak_h + +#include "Assertions.h" +#include "Handle.h" +#include "HandleHeap.h" +#include "JSGlobalData.h" + +namespace JSC { + +// A weakly referenced handle that becomes 0 when the value it points to is garbage collected. +template <typename T> class Weak : public Handle<T> { + using Handle<T>::slot; + using Handle<T>::setSlot; + +public: + typedef typename Handle<T>::ExternalType ExternalType; + + Weak() + : Handle<T>() + { + } + + Weak(JSGlobalData& globalData, ExternalType value = ExternalType(), WeakHandleOwner* weakOwner = 0, void* context = 0) + : Handle<T>(globalData.allocateGlobalHandle()) + { + HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context); + set(value); + } + + Weak(const Weak& other) + : Handle<T>() + { + if (!other.slot()) + return; + setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot())); + } + + template <typename U> Weak(const Weak<U>& other) + : Handle<T>() + { + if (!other.slot()) + return; + setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot())); + } + + enum HashTableDeletedValueTag { HashTableDeletedValue }; + bool isHashTableDeletedValue() const { return slot() == hashTableDeletedValue(); } + Weak(HashTableDeletedValueTag) + : Handle<T>(hashTableDeletedValue()) + { + } + + ~Weak() + { + clear(); + } + + void swap(Weak& other) + { + Handle<T>::swap(other); + } + + ExternalType get() const { return HandleTypes<T>::getFromSlot(slot()); } + + void clear() + { + if (!slot()) + return; + HandleHeap::heapFor(slot())->deallocate(slot()); + setSlot(0); + } + + void set(JSGlobalData& globalData, ExternalType value, WeakHandleOwner* weakOwner = 0, void* context = 0) + { + if (!slot()) { + setSlot(globalData.allocateGlobalHandle()); + HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context); + } + ASSERT(HandleHeap::heapFor(slot())->hasWeakOwner(slot(), weakOwner)); + set(value); + } + + template <typename U> Weak& operator=(const Weak<U>& other) + { + clear(); + if (other.slot()) + setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot())); + return *this; + } + + Weak& operator=(const Weak& other) + { + clear(); + if (other.slot()) + setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot())); + return *this; + } + +private: + static HandleSlot hashTableDeletedValue() { return reinterpret_cast<HandleSlot>(-1); } + + void set(ExternalType externalType) + { + ASSERT(slot()); + JSValue value = HandleTypes<T>::toJSValue(externalType); + ASSERT(!value || !value.isCell() || Heap::isMarked(value.asCell())); + HandleHeap::heapFor(slot())->writeBarrier(slot(), value); + *slot() = value; + } +}; + +template<class T> inline void swap(Weak<T>& a, Weak<T>& b) +{ + a.swap(b); +} + +} // namespace JSC + +namespace WTF { + +template<typename T> struct VectorTraits<JSC::Weak<T> > : SimpleClassVectorTraits { + static const bool canCompareWithMemcmp = false; +}; + +template<typename P> struct HashTraits<JSC::Weak<P> > : SimpleClassHashTraits<JSC::Weak<P> > { }; + +} + +#endif // Weak_h diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 6021279..4a6ffb6 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -164,7 +164,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* JSGlobalObject* globalObject = codeBlock->globalObject(); ASSERT(globalObject->isGlobalObject()); int property = vPC[2].u.operand; - Structure* structure = vPC[3].u.structure; + Structure* structure = vPC[3].u.structure.get(); int offset = vPC[4].u.operand; if (structure == globalObject->structure()) { @@ -177,10 +177,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { - if (vPC[3].u.structure) - vPC[3].u.structure->deref(); - globalObject->structure()->ref(); - vPC[3] = globalObject->structure(); + vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure()); vPC[4] = slot.cachedOffset(); callFrame->uncheckedR(dst) = JSValue(result); return true; @@ -204,7 +201,7 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru JSGlobalObject* globalObject = codeBlock->globalObject(); ASSERT(globalObject->isGlobalObject()); int property = vPC[2].u.operand; - Structure* structure = vPC[3].u.structure; + Structure* structure = vPC[3].u.structure.get(); int offset = vPC[4].u.operand; int skip = vPC[5].u.operand; @@ -255,10 +252,7 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { - if (vPC[3].u.structure) - vPC[3].u.structure->deref(); - globalObject->structure()->ref(); - vPC[3] = globalObject->structure(); + vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure()); vPC[4] = slot.cachedOffset(); ASSERT(result); callFrame->uncheckedR(dst) = JSValue(result); @@ -620,7 +614,7 @@ static void appendSourceToError(CallFrame* callFrame, ErrorInstance* exception, return; JSGlobalData* globalData = &callFrame->globalData(); - JSValue jsMessage = exception->getDirect(globalData->propertyNames->message); + JSValue jsMessage = exception->getDirect(*globalData, globalData->propertyNames->message); if (!jsMessage || !jsMessage.isString()) return; @@ -994,9 +988,10 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionE } CallFrame* newCallFrame = CallFrame::create(oldEnd); + // We initialise |this| unnecessarily here for the sake of code clarity size_t dst = 0; for (int i = 0; i < argc; ++i) - newCallFrame->uncheckedR(++dst) = jsUndefined(); + newCallFrame->uncheckedR(dst++) = jsUndefined(); JSObject* error = FunctionExecutable->compileForCall(callFrame, scopeChain); if (error) { @@ -1225,11 +1220,11 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* } // Cache miss: record Structure to compare against next time. - Structure* lastStructure = vPC[4].u.structure; + Structure* lastStructure = vPC[4].u.structure.get(); if (structure != lastStructure) { // First miss: record Structure to compare against next time. if (!lastStructure) { - vPC[4] = structure; + vPC[4].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure); return; } @@ -1255,24 +1250,23 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* // put_by_id_transition checks the prototype chain for setters. normalizePrototypeChain(callFrame, baseCell); - + JSCell* owner = codeBlock->ownerExecutable(); + JSGlobalData& globalData = callFrame->globalData(); vPC[0] = getOpcode(op_put_by_id_transition); - vPC[4] = structure->previousID(); - vPC[5] = structure; - vPC[6] = structure->prototypeChain(callFrame); + vPC[4].u.structure.set(globalData, owner, structure->previousID()); + vPC[5].u.structure.set(globalData, owner, structure); + vPC[6].u.structureChain.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure->prototypeChain(callFrame)); + ASSERT(vPC[6].u.structureChain); vPC[7] = slot.cachedOffset(); - codeBlock->refStructures(vPC); return; } vPC[0] = getOpcode(op_put_by_id_replace); vPC[5] = slot.cachedOffset(); - codeBlock->refStructures(vPC); } -NEVER_INLINE void Interpreter::uncachePutByID(CodeBlock* codeBlock, Instruction* vPC) +NEVER_INLINE void Interpreter::uncachePutByID(CodeBlock*, Instruction* vPC) { - codeBlock->derefStructures(vPC); vPC[0] = getOpcode(op_put_by_id); vPC[4] = 0; } @@ -1314,11 +1308,11 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* } // Cache miss - Structure* lastStructure = vPC[4].u.structure; + Structure* lastStructure = vPC[4].u.structure.get(); if (structure != lastStructure) { // First miss: record Structure to compare against next time. if (!lastStructure) { - vPC[4] = structure; + vPC[4].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure); return; } @@ -1344,8 +1338,6 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* vPC[5] = slot.cachedOffset(); break; } - - codeBlock->refStructures(vPC); return; } @@ -1364,7 +1356,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* // should not be treated as a dictionary. if (baseObject->structure()->isDictionary()) { baseObject->flattenDictionaryObject(callFrame->globalData()); - offset = baseObject->structure()->get(propertyName); + offset = baseObject->structure()->get(callFrame->globalData(), propertyName); } ASSERT(!baseObject->structure()->isUncacheableDictionary()); @@ -1383,9 +1375,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* vPC[6] = offset; break; } - vPC[5] = baseObject->structure(); - - codeBlock->refStructures(vPC); + vPC[5].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), baseObject->structure()); return; } @@ -1411,15 +1401,13 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* vPC[7] = offset; break; } - vPC[4] = structure; - vPC[5] = structure->prototypeChain(callFrame); + vPC[4].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure); + vPC[5].u.structureChain.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure->prototypeChain(callFrame)); vPC[6] = count; - codeBlock->refStructures(vPC); } -NEVER_INLINE void Interpreter::uncacheGetByID(CodeBlock* codeBlock, Instruction* vPC) +NEVER_INLINE void Interpreter::uncacheGetByID(CodeBlock*, Instruction* vPC) { - codeBlock->derefStructures(vPC); vPC[0] = getOpcode(op_get_by_id); vPC[4] = 0; } @@ -2528,7 +2516,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(baseCell->isObject()); @@ -2559,12 +2547,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(structure->prototypeForLookup(callFrame).isObject()); JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); - Structure* prototypeStructure = vPC[5].u.structure; + Structure* prototypeStructure = vPC[5].u.structure.get(); if (LIKELY(protoObject->structure() == prototypeStructure)) { int dst = vPC[1].u.operand; @@ -2598,12 +2586,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(structure->prototypeForLookup(callFrame).isObject()); JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); - Structure* prototypeStructure = vPC[5].u.structure; + Structure* prototypeStructure = vPC[5].u.structure.get(); if (LIKELY(protoObject->structure() == prototypeStructure)) { int dst = vPC[1].u.operand; @@ -2643,12 +2631,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(structure->prototypeForLookup(callFrame).isObject()); JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); - Structure* prototypeStructure = vPC[5].u.structure; + Structure* prototypeStructure = vPC[5].u.structure.get(); if (LIKELY(protoObject->structure() == prototypeStructure)) { int dst = vPC[1].u.operand; @@ -2712,6 +2700,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi vPC += OPCODE_LENGTH(op_get_by_id_proto_list); NEXT_INSTRUCTION(); } +#if USE(GCC_COMPUTED_GOTO_WORKAROUND) + goto *(&&skip_get_by_id_chain); +#endif DEFINE_OPCODE(op_get_by_id_chain) { /* op_get_by_id_chain dst(r) base(r) property(id) structure(sID) structureChain(chain) count(n) offset(n) @@ -2724,12 +2715,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { - RefPtr<Structure>* it = vPC[5].u.structureChain->head(); + WriteBarrier<Structure>* it = vPC[5].u.structureChain->head(); size_t count = vPC[6].u.operand; - RefPtr<Structure>* end = it + count; + WriteBarrier<Structure>* end = it + count; while (true) { JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame)); @@ -2759,6 +2750,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi NEXT_INSTRUCTION(); } #if USE(GCC_COMPUTED_GOTO_WORKAROUND) + skip_get_by_id_chain: goto *(&&skip_id_getter_self); #endif DEFINE_OPCODE(op_get_by_id_getter_self) { @@ -2773,7 +2765,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(baseCell->isObject()); @@ -2816,7 +2808,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(baseCell->isObject()); @@ -2873,12 +2865,12 @@ skip_id_custom_self: if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { - RefPtr<Structure>* it = vPC[5].u.structureChain->head(); + WriteBarrier<Structure>* it = vPC[5].u.structureChain->head(); size_t count = vPC[6].u.operand; - RefPtr<Structure>* end = it + count; + WriteBarrier<Structure>* end = it + count; while (true) { JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame)); @@ -2928,12 +2920,12 @@ skip_id_custom_self: if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { - RefPtr<Structure>* it = vPC[5].u.structureChain->head(); + WriteBarrier<Structure>* it = vPC[5].u.structureChain->head(); size_t count = vPC[6].u.operand; - RefPtr<Structure>* end = it + count; + WriteBarrier<Structure>* end = it + count; while (true) { JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame)); @@ -2964,6 +2956,7 @@ skip_id_custom_self: } #if USE(GCC_COMPUTED_GOTO_WORKAROUND) skip_id_custom_chain: + goto *(&&skip_get_array_length); #endif DEFINE_OPCODE(op_get_array_length) { /* op_get_array_length dst(r) base(r) property(id) nop(sID) nop(n) nop(n) nop(n) @@ -2985,6 +2978,10 @@ skip_id_custom_self: uncacheGetByID(codeBlock, vPC); NEXT_INSTRUCTION(); } +#if USE(GCC_COMPUTED_GOTO_WORKAROUND) + skip_get_array_length: + goto *(&&skip_get_string_length); +#endif DEFINE_OPCODE(op_get_string_length) { /* op_get_string_length dst(r) base(r) property(id) nop(sID) nop(n) nop(n) nop(n) @@ -3005,6 +3002,10 @@ skip_id_custom_self: uncacheGetByID(codeBlock, vPC); NEXT_INSTRUCTION(); } +#if USE(GCC_COMPUTED_GOTO_WORKAROUND) + skip_get_string_length: + goto *(&&skip_put_by_id); +#endif DEFINE_OPCODE(op_put_by_id) { /* put_by_id base(r) property(id) value(r) nop(n) nop(n) nop(n) nop(n) direct(b) @@ -3038,6 +3039,9 @@ skip_id_custom_self: vPC += OPCODE_LENGTH(op_put_by_id); NEXT_INSTRUCTION(); } +#if USE(GCC_COMPUTED_GOTO_WORKAROUND) + skip_put_by_id: +#endif DEFINE_OPCODE(op_put_by_id_transition) { /* op_put_by_id_transition base(r) property(id) value(r) oldStructure(sID) newStructure(sID) structureChain(chain) offset(n) direct(b) @@ -3054,8 +3058,8 @@ skip_id_custom_self: if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* oldStructure = vPC[4].u.structure; - Structure* newStructure = vPC[5].u.structure; + Structure* oldStructure = vPC[4].u.structure.get(); + Structure* newStructure = vPC[5].u.structure.get(); if (LIKELY(baseCell->structure() == oldStructure)) { ASSERT(baseCell->isObject()); @@ -3063,7 +3067,7 @@ skip_id_custom_self: int direct = vPC[8].u.operand; if (!direct) { - RefPtr<Structure>* it = vPC[6].u.structureChain->head(); + WriteBarrier<Structure>* it = vPC[6].u.structureChain->head(); JSValue proto = baseObject->structure()->prototypeForLookup(callFrame); while (!proto.isNull()) { @@ -3075,11 +3079,11 @@ skip_id_custom_self: proto = asObject(proto)->structure()->prototypeForLookup(callFrame); } } - baseObject->transitionTo(newStructure); + baseObject->transitionTo(*globalData, newStructure); int value = vPC[3].u.operand; unsigned offset = vPC[7].u.operand; - ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset); + ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(*globalData, codeBlock->identifier(vPC[2].u.operand))) == offset); baseObject->putDirectOffset(callFrame->globalData(), offset, callFrame->r(value).jsValue()); vPC += OPCODE_LENGTH(op_put_by_id_transition); @@ -3106,7 +3110,7 @@ skip_id_custom_self: if (LIKELY(baseValue.isCell())) { JSCell* baseCell = baseValue.asCell(); - Structure* structure = vPC[4].u.structure; + Structure* structure = vPC[4].u.structure.get(); if (LIKELY(baseCell->structure() == structure)) { ASSERT(baseCell->isObject()); @@ -3114,7 +3118,7 @@ skip_id_custom_self: int value = vPC[3].u.operand; unsigned offset = vPC[5].u.operand; - ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset); + ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(*globalData, codeBlock->identifier(vPC[2].u.operand))) == offset); baseObject->putDirectOffset(callFrame->globalData(), offset, callFrame->r(value).jsValue()); vPC += OPCODE_LENGTH(op_put_by_id_replace); diff --git a/Source/JavaScriptCore/interpreter/RegisterFile.cpp b/Source/JavaScriptCore/interpreter/RegisterFile.cpp index b3a87e5..e3b34bb 100644 --- a/Source/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/Source/JavaScriptCore/interpreter/RegisterFile.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "RegisterFile.h" -#include "ConservativeSet.h" +#include "ConservativeRoots.h" #include "Interpreter.h" #include "JSGlobalData.h" #include "JSGlobalObject.h" @@ -72,24 +72,7 @@ void RegisterFile::releaseExcessCapacity() void RegisterFile::setGlobalObject(JSGlobalObject* globalObject) { - m_globalObject.set(globalObject->globalData(), globalObject, RegisterFile::globalObjectCollectedNotifier()); -} - -class GlobalObjectNotifier : public Finalizer { -public: - void finalize(Handle<Unknown> value, void*) - { - JSGlobalObject* globalObject = asGlobalObject(value.get()); - globalObject->globalData().interpreter->registerFile().setNumGlobals(0); - } -}; - -Finalizer* RegisterFile::globalObjectCollectedNotifier() -{ - // This will leak alas, but we only create one of them, and it doesn't - // take up any significant amount of space. - static GlobalObjectNotifier* notifier = new GlobalObjectNotifier; - return notifier; + m_globalObject.set(globalObject->globalData(), globalObject, &m_globalObjectOwner, this); } JSGlobalObject* RegisterFile::globalObject() diff --git a/Source/JavaScriptCore/interpreter/RegisterFile.h b/Source/JavaScriptCore/interpreter/RegisterFile.h index 4d04085..f59c13a 100644 --- a/Source/JavaScriptCore/interpreter/RegisterFile.h +++ b/Source/JavaScriptCore/interpreter/RegisterFile.h @@ -32,7 +32,7 @@ #include "Heap.h" #include "ExecutableAllocator.h" #include "Register.h" -#include "WeakGCPtr.h" +#include "Weak.h" #include <stdio.h> #include <wtf/Noncopyable.h> #include <wtf/PageReservation.h> @@ -135,8 +135,6 @@ namespace JSC { static size_t committedByteCount(); static void initializeThreading(); - static Finalizer* globalObjectCollectedNotifier(); - Register* const * addressOfEnd() const { return &m_end; @@ -154,7 +152,13 @@ namespace JSC { Register* m_commitEnd; PageReservation m_reservation; - WeakGCPtr<JSGlobalObject> m_globalObject; // The global object whose vars are currently stored in the register file. + Weak<JSGlobalObject> m_globalObject; // The global object whose vars are currently stored in the register file. + class GlobalObjectOwner : public WeakHandleOwner { + virtual void finalize(Handle<Unknown>, void* context) + { + static_cast<RegisterFile*>(context)->setNumGlobals(0); + } + } m_globalObjectOwner; }; inline RegisterFile::RegisterFile(JSGlobalData& globalData, size_t capacity, size_t maxGlobals) @@ -163,7 +167,7 @@ namespace JSC { , m_start(0) , m_end(0) , m_max(0) - , m_globalObject(globalData, RegisterFile::globalObjectCollectedNotifier()) + , m_globalObject(globalData, 0, &m_globalObjectOwner, this) { ASSERT(maxGlobals && isPageAligned(maxGlobals)); ASSERT(capacity && isPageAligned(capacity)); diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp index 063ae8c..b983427 100644 --- a/Source/JavaScriptCore/jit/JIT.cpp +++ b/Source/JavaScriptCore/jit/JIT.cpp @@ -44,6 +44,7 @@ JSC::MacroAssemblerX86Common::SSE2CheckState JSC::MacroAssemblerX86Common::s_sse #include "RepatchBuffer.h" #include "ResultType.h" #include "SamplingTool.h" +#include "dfg/DFGNode.h" // for DFG_SUCCESS_STATS using namespace std; @@ -471,6 +472,11 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck) Jump registerFileCheck; if (m_codeBlock->codeType() == FunctionCode) { +#if DFG_SUCCESS_STATS + static SamplingCounter counter("orignalJIT"); + emitCount(counter); +#endif + // In the case of a fast linked call, we do not set this up in the caller. emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock); diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h index 61bd2ab..6b8c6dd 100644 --- a/Source/JavaScriptCore/jit/JIT.h +++ b/Source/JavaScriptCore/jit/JIT.h @@ -235,7 +235,7 @@ namespace JSC { static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress); static void patchPutByIdReplace(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress, bool direct); - static void patchMethodCallProto(CodeBlock* codeblock, MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*, ReturnAddressPtr); + static void patchMethodCallProto(JSGlobalData&, CodeBlock* codeblock, MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*, ReturnAddressPtr); static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ReturnAddressPtr returnAddress) { @@ -311,7 +311,7 @@ namespace JSC { void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false); void emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32 = false); void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false); - void emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool = false); + void emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool = false); void emitStoreDouble(unsigned index, FPRegisterID value); bool isLabeled(unsigned bytecodeOffset); @@ -473,6 +473,48 @@ namespace JSC { static const int patchOffsetMethodCheckProtoStruct = 52; static const int patchOffsetMethodCheckPutFunction = 84; #endif +#elif CPU(SH4) + // These architecture specific value are used to enable patching - see comment on op_put_by_id. + static const int patchOffsetGetByIdStructure = 6; + static const int patchOffsetPutByIdPropertyMapOffset = 24; + static const int patchOffsetPutByIdStructure = 6; + // These architecture specific value are used to enable patching - see comment on op_get_by_id. + static const int patchOffsetGetByIdBranchToSlowCase = 10; + static const int patchOffsetGetByIdPropertyMapOffset = 24; + static const int patchOffsetGetByIdPutResult = 32; + + // sequenceOpCall + static const int sequenceOpCallInstructionSpace = 12; + static const int sequenceOpCallConstantSpace = 2; + // sequenceMethodCheck + static const int sequenceMethodCheckInstructionSpace = 40; + static const int sequenceMethodCheckConstantSpace = 6; + // sequenceGetByIdHotPath + static const int sequenceGetByIdHotPathInstructionSpace = 36; + static const int sequenceGetByIdHotPathConstantSpace = 5; + // sequenceGetByIdSlowCase + static const int sequenceGetByIdSlowCaseInstructionSpace = 26; + static const int sequenceGetByIdSlowCaseConstantSpace = 2; + // sequencePutById + static const int sequencePutByIdInstructionSpace = 36; + static const int sequencePutByIdConstantSpace = 5; + + static const int patchOffsetGetByIdPropertyMapOffset1 = 20; + static const int patchOffsetGetByIdPropertyMapOffset2 = 26; + + static const int patchOffsetPutByIdPropertyMapOffset1 = 20; + static const int patchOffsetPutByIdPropertyMapOffset2 = 26; + +#if ENABLE(OPCODE_SAMPLING) + static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE +#else + static const int patchOffsetGetByIdSlowCaseCall = 22; +#endif + static const int patchOffsetOpCallCompareToJump = 4; + + static const int patchOffsetMethodCheckProtoObj = 12; + static const int patchOffsetMethodCheckProtoStruct = 20; + static const int patchOffsetMethodCheckPutFunction = 32; #else #error "JSVALUE32_64 not supported on this platform." #endif @@ -665,14 +707,16 @@ namespace JSC { #if (defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL) #define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false) -#define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false) +#define END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, dst) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace, dst); } while (false) +#define END_UNINTERRUPTED_SEQUENCE(name) END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, 0) void beginUninterruptedSequence(int, int); - void endUninterruptedSequence(int, int); + void endUninterruptedSequence(int, int, int); #else #define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(); } while (false) #define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(); } while (false) +#define END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, dst) do { endUninterruptedSequence(); } while (false) #endif void emit_op_add(Instruction*); diff --git a/Source/JavaScriptCore/jit/JITArithmetic.cpp b/Source/JavaScriptCore/jit/JITArithmetic.cpp index edf2290..734cc1d 100644 --- a/Source/JavaScriptCore/jit/JITArithmetic.cpp +++ b/Source/JavaScriptCore/jit/JITArithmetic.cpp @@ -966,7 +966,7 @@ void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned, unsigned op1, unsign void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase) { // We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset. - COMPILE_ASSERT(((JSImmediate::TagTypeNumber + JSImmediate::DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0); + COMPILE_ASSERT(((TagTypeNumber + DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0); Jump notImm1; Jump notImm2; diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h index 16c2335..dabfdd2 100644 --- a/Source/JavaScriptCore/jit/JITInlineMethods.h +++ b/Source/JavaScriptCore/jit/JITInlineMethods.h @@ -123,6 +123,13 @@ ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace ensureSpace(insnSpace, constSpace); +#elif CPU(SH4) +#ifndef NDEBUG + insnSpace += sizeof(SH4Word); + constSpace += sizeof(uint64_t); +#endif + + m_assembler.ensureSpace(insnSpace + m_assembler.maxInstructionSize + 2, constSpace + 8); #endif #if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL @@ -133,8 +140,9 @@ ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace #endif } -ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) +ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace, int dst) { + UNUSED_PARAM(dst); #if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL /* There are several cases when the uninterrupted sequence is larger than * maximum required offset for pathing the same sequence. Eg.: if in a @@ -143,6 +151,15 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) * calculation of length of uninterrupted sequence. So, the insnSpace and * constSpace should be upper limit instead of hard limit. */ +#if CPU(SH4) + if ((dst > 15) || (dst < -16)) { + insnSpace += 8; + constSpace += 2; + } + + if (((dst >= -16) && (dst < 0)) || ((dst > 7) && (dst <= 15))) + insnSpace += 8; +#endif ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) <= insnSpace); ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin <= constSpace); #endif @@ -167,6 +184,22 @@ ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) { loadPtr(address, linkRegister); } +#elif CPU(SH4) + +ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) +{ + m_assembler.stspr(reg); +} + +ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) +{ + m_assembler.ldspr(reg); +} + +ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) +{ + loadPtrLinkReg(address); +} #elif CPU(MIPS) @@ -217,6 +250,8 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() addPtr(TrustedImm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister); #elif CPU(ARM) move(stackPointerRegister, firstArgumentRegister); +#elif CPU(SH4) + move(stackPointerRegister, firstArgumentRegister); #endif // In the trampoline on x86-64, the first argument register is not overwritten. } @@ -453,11 +488,11 @@ inline void JIT::emitStoreCell(unsigned index, RegisterID payload, bool indexIsC store32(TrustedImm32(JSValue::CellTag), tagFor(index, callFrameRegister)); } -inline void JIT::emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool) +inline void JIT::emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool) { + store32(payload, payloadFor(index, callFrameRegister)); if (!indexIsBool) - store32(TrustedImm32(0), payloadFor(index, callFrameRegister)); - store32(tag, tagFor(index, callFrameRegister)); + store32(TrustedImm32(JSValue::BooleanTag), tagFor(index, callFrameRegister)); } inline void JIT::emitStoreDouble(unsigned index, FPRegisterID value) @@ -674,7 +709,7 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfJSCell(RegisterID reg) #if USE(JSVALUE64) return branchTestPtr(Zero, reg, tagMaskRegister); #else - return branchTest32(Zero, reg, TrustedImm32(JSImmediate::TagMask)); + return branchTest32(Zero, reg, TrustedImm32(TagMask)); #endif } @@ -695,7 +730,7 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotJSCell(RegisterID reg) #if USE(JSVALUE64) return branchTestPtr(NonZero, reg, tagMaskRegister); #else - return branchTest32(NonZero, reg, TrustedImm32(JSImmediate::TagMask)); + return branchTest32(NonZero, reg, TrustedImm32(TagMask)); #endif } @@ -736,7 +771,7 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfImmediateInteger(RegisterID reg) #if USE(JSVALUE64) return branchPtr(AboveOrEqual, reg, tagTypeNumberRegister); #else - return branchTest32(NonZero, reg, TrustedImm32(JSImmediate::TagTypeNumber)); + return branchTest32(NonZero, reg, TrustedImm32(TagTypeNumber)); #endif } @@ -745,7 +780,7 @@ ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateInteger(RegisterID reg) #if USE(JSVALUE64) return branchPtr(Below, reg, tagTypeNumberRegister); #else - return branchTest32(Zero, reg, TrustedImm32(JSImmediate::TagTypeNumber)); + return branchTest32(Zero, reg, TrustedImm32(TagTypeNumber)); #endif } @@ -774,12 +809,12 @@ ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateNumber(RegisterID reg) #if USE(JSVALUE32_64) ALWAYS_INLINE void JIT::emitFastArithDeTagImmediate(RegisterID reg) { - subPtr(TrustedImm32(JSImmediate::TagTypeNumber), reg); + subPtr(TrustedImm32(TagTypeNumber), reg); } ALWAYS_INLINE JIT::Jump JIT::emitFastArithDeTagImmediateJumpIfZero(RegisterID reg) { - return branchSubPtr(Zero, TrustedImm32(JSImmediate::TagTypeNumber), reg); + return branchSubPtr(Zero, TrustedImm32(TagTypeNumber), reg); } #endif @@ -790,7 +825,7 @@ ALWAYS_INLINE void JIT::emitFastArithReTagImmediate(RegisterID src, RegisterID d #else if (src != dest) move(src, dest); - addPtr(TrustedImm32(JSImmediate::TagTypeNumber), dest); + addPtr(TrustedImm32(TagTypeNumber), dest); #endif } @@ -810,8 +845,7 @@ ALWAYS_INLINE void JIT::emitFastArithIntToImmNoCheck(RegisterID src, RegisterID ALWAYS_INLINE void JIT::emitTagAsBoolImmediate(RegisterID reg) { - lshift32(TrustedImm32(JSImmediate::ExtendedPayloadShift), reg); - or32(TrustedImm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), reg); + or32(TrustedImm32(static_cast<int32_t>(ValueFalse)), reg); } #endif // USE(JSVALUE32_64) diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp index daceea6..53bc1df 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp @@ -57,7 +57,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable // Checks out okay! - get the length from the Ustring. load32(Address(regT0, OBJECT_OFFSETOF(JSString, m_length)), regT0); - Jump string_failureCases3 = branch32(Above, regT0, TrustedImm32(JSImmediate::maxImmediateInt)); + Jump string_failureCases3 = branch32(LessThan, regT0, TrustedImm32(0)); // regT0 contains a 64 bit value (is positive, is zero extended) so we don't need sign extend here. emitFastArithIntToImmNoCheck(regT0, regT0); @@ -695,9 +695,14 @@ void JIT::emitSlow_op_resolve_global(Instruction* currentInstruction, Vector<Slo void JIT::emit_op_not(Instruction* currentInstruction) { emitGetVirtualRegister(currentInstruction[2].u.operand, regT0); - xorPtr(TrustedImm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), regT0); - addSlowCase(branchTestPtr(NonZero, regT0, TrustedImm32(static_cast<int32_t>(~JSImmediate::ExtendedPayloadBitBoolValue)))); - xorPtr(TrustedImm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool | JSImmediate::ExtendedPayloadBitBoolValue)), regT0); + + // Invert against JSValue(false); if the value was tagged as a boolean, then all bits will be + // clear other than the low bit (which will be 0 or 1 for false or true inputs respectively). + // Then invert against JSValue(true), which will add the tag back in, and flip the low bit. + xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), regT0); + addSlowCase(branchTestPtr(NonZero, regT0, TrustedImm32(static_cast<int32_t>(~1)))); + xorPtr(TrustedImm32(static_cast<int32_t>(ValueTrue)), regT0); + emitPutVirtualRegister(currentInstruction[1].u.operand); } @@ -731,7 +736,7 @@ void JIT::emit_op_jeq_null(Instruction* currentInstruction) // Now handle the immediate cases - undefined & null isImmediate.link(this); - andPtr(TrustedImm32(~JSImmediate::ExtendedTagBitUndefined), regT0); + andPtr(TrustedImm32(~TagBitUndefined), regT0); addJump(branchPtr(Equal, regT0, TrustedImmPtr(JSValue::encode(jsNull()))), target); wasNotImmediate.link(this); @@ -752,7 +757,7 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction) // Now handle the immediate cases - undefined & null isImmediate.link(this); - andPtr(TrustedImm32(~JSImmediate::ExtendedTagBitUndefined), regT0); + andPtr(TrustedImm32(~TagBitUndefined), regT0); addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsNull()))), target); wasNotImmediate.link(this); @@ -909,8 +914,8 @@ void JIT::emit_op_get_pnames(Instruction* currentInstruction) isNotObject.link(this); move(regT0, regT1); - and32(TrustedImm32(~JSImmediate::ExtendedTagBitUndefined), regT1); - addJump(branch32(Equal, regT1, TrustedImm32(JSImmediate::FullTagTypeNull)), breakTarget); + and32(TrustedImm32(~TagBitUndefined), regT1); + addJump(branch32(Equal, regT1, TrustedImm32(ValueNull)), breakTarget); JITStubCall toObjectStubCall(this, cti_to_object); toObjectStubCall.addArgument(regT0); @@ -1163,8 +1168,8 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) isImmediate.link(this); - andPtr(TrustedImm32(~JSImmediate::ExtendedTagBitUndefined), regT0); - setPtr(Equal, regT0, TrustedImm32(JSImmediate::FullTagTypeNull), regT0); + andPtr(TrustedImm32(~TagBitUndefined), regT0); + setPtr(Equal, regT0, TrustedImm32(ValueNull), regT0); wasNotImmediate.link(this); @@ -1188,8 +1193,8 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) isImmediate.link(this); - andPtr(TrustedImm32(~JSImmediate::ExtendedTagBitUndefined), regT0); - setPtr(NotEqual, regT0, TrustedImm32(JSImmediate::FullTagTypeNull), regT0); + andPtr(TrustedImm32(~TagBitUndefined), regT0); + setPtr(NotEqual, regT0, TrustedImm32(ValueNull), regT0); wasNotImmediate.link(this); @@ -1374,7 +1379,7 @@ void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCas void JIT::emitSlow_op_not(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) { linkSlowCase(iter); - xorPtr(TrustedImm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), regT0); + xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), regT0); JITStubCall stubCall(this, cti_op_not); stubCall.addArgument(regT0); stubCall.call(currentInstruction[1].u.operand); diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp index bc0b2cb..edce21c 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp @@ -245,7 +245,26 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon call(Address(regT2, executableOffsetToFunction)); restoreReturnAddressBeforeReturn(regT3); +#elif CPU(SH4) + // Load caller frame's scope chain into this callframe so that whatever we call can + // get to its global data. + emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2); + emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2); + emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain); + + preserveReturnAddressAfterCall(regT3); // Callee preserved + emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC); + + // Calling convention: f(r0 == regT4, r1 == regT5, ...); + // Host function signature: f(ExecState*); + move(callFrameRegister, regT4); + + emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5); + move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. + loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); + call(Address(regT2, executableOffsetToFunction), regT0); + restoreReturnAddressBeforeReturn(regT3); #elif CPU(MIPS) // Load caller frame's scope chain into this callframe so that whatever we call can // get to its global data. @@ -394,7 +413,28 @@ JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executa addPtr(TrustedImm32(16), stackPointerRegister); restoreReturnAddressBeforeReturn(regT3); +#elif CPU(SH4) + // Load caller frame's scope chain into this callframe so that whatever we call can + // get to its global data. + emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2); + emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2); + emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain); + preserveReturnAddressAfterCall(regT3); // Callee preserved + emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC); + + // Calling convention: f(r0 == regT4, r1 == regT5, ...); + // Host function signature: f(ExecState*); + move(callFrameRegister, regT4); + + emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5); + move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. + loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); + + // call the function + nativeCall = call(); + + restoreReturnAddressBeforeReturn(regT3); #elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL) #error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform." #else @@ -553,7 +593,7 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction) // Optimistically load the result true, and start looping. // Initially, regT1 still contains proto and regT2 still contains value. // As we loop regT2 will be updated with its prototype, recursively walking the prototype chain. - move(TrustedImm32(JSValue::TrueTag), regT0); + move(TrustedImm32(1), regT0); Label loop(this); // Load the prototype of the cell in regT2. If this is equal to regT1 - WIN! @@ -564,7 +604,7 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction) branchTest32(NonZero, regT2).linkTo(loop, this); // We get here either by dropping out of the loop, or if value was not an Object. Result is false. - move(TrustedImm32(JSValue::FalseTag), regT0); + move(TrustedImm32(0), regT0); // isInstance jumps right down to here, to skip setting the result to false (it has already set true). isInstance.link(this); @@ -829,9 +869,9 @@ void JIT::emit_op_not(Instruction* currentInstruction) emitLoadTag(src, regT0); - xor32(TrustedImm32(JSValue::FalseTag), regT0); - addSlowCase(branchTest32(NonZero, regT0, TrustedImm32(~1))); - xor32(TrustedImm32(JSValue::TrueTag), regT0); + emitLoad(src, regT1, regT0); + addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::BooleanTag))); + xor32(TrustedImm32(1), regT0); emitStoreBool(dst, regT0, (dst == src)); } @@ -855,25 +895,9 @@ void JIT::emit_op_jfalse(Instruction* currentInstruction) emitLoad(cond, regT1, regT0); - Jump isTrue = branch32(Equal, regT1, TrustedImm32(JSValue::TrueTag)); - addJump(branch32(Equal, regT1, TrustedImm32(JSValue::FalseTag)), target); - - Jump isNotInteger = branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)); - Jump isTrue2 = branch32(NotEqual, regT0, TrustedImm32(0)); - addJump(jump(), target); - - if (supportsFloatingPoint()) { - isNotInteger.link(this); - - addSlowCase(branch32(Above, regT1, TrustedImm32(JSValue::LowestTag))); - - emitLoadDouble(cond, fpRegT0); - addJump(branchDoubleZeroOrNaN(fpRegT0, fpRegT1), target); - } else - addSlowCase(isNotInteger); - - isTrue.link(this); - isTrue2.link(this); + ASSERT((JSValue::BooleanTag + 1 == JSValue::Int32Tag) && !(JSValue::Int32Tag + 1)); + addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::BooleanTag))); + addJump(branchTest32(Zero, regT0), target); } void JIT::emitSlow_op_jfalse(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) @@ -882,6 +906,18 @@ void JIT::emitSlow_op_jfalse(Instruction* currentInstruction, Vector<SlowCaseEnt unsigned target = currentInstruction[2].u.operand; linkSlowCase(iter); + + if (supportsFloatingPoint()) { + // regT1 contains the tag from the hot path. + Jump notNumber = branch32(Above, regT1, Imm32(JSValue::LowestTag)); + + emitLoadDouble(cond, fpRegT0); + emitJumpSlowToHot(branchDoubleZeroOrNaN(fpRegT0, fpRegT1), target); + emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jfalse)); + + notNumber.link(this); + } + JITStubCall stubCall(this, cti_op_jtrue); stubCall.addArgument(cond); stubCall.call(); @@ -895,25 +931,9 @@ void JIT::emit_op_jtrue(Instruction* currentInstruction) emitLoad(cond, regT1, regT0); - Jump isFalse = branch32(Equal, regT1, TrustedImm32(JSValue::FalseTag)); - addJump(branch32(Equal, regT1, TrustedImm32(JSValue::TrueTag)), target); - - Jump isNotInteger = branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)); - Jump isFalse2 = branch32(Equal, regT0, TrustedImm32(0)); - addJump(jump(), target); - - if (supportsFloatingPoint()) { - isNotInteger.link(this); - - addSlowCase(branch32(Above, regT1, TrustedImm32(JSValue::LowestTag))); - - emitLoadDouble(cond, fpRegT0); - addJump(branchDoubleNonZero(fpRegT0, fpRegT1), target); - } else - addSlowCase(isNotInteger); - - isFalse.link(this); - isFalse2.link(this); + ASSERT((JSValue::BooleanTag + 1 == JSValue::Int32Tag) && !(JSValue::Int32Tag + 1)); + addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::BooleanTag))); + addJump(branchTest32(NonZero, regT0), target); } void JIT::emitSlow_op_jtrue(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) @@ -922,6 +942,18 @@ void JIT::emitSlow_op_jtrue(Instruction* currentInstruction, Vector<SlowCaseEntr unsigned target = currentInstruction[2].u.operand; linkSlowCase(iter); + + if (supportsFloatingPoint()) { + // regT1 contains the tag from the hot path. + Jump notNumber = branch32(Above, regT1, Imm32(JSValue::LowestTag)); + + emitLoadDouble(cond, fpRegT0); + emitJumpSlowToHot(branchDoubleNonZero(fpRegT0, fpRegT1), target); + emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jtrue)); + + notNumber.link(this); + } + JITStubCall stubCall(this, cti_op_jtrue); stubCall.addArgument(cond); stubCall.call(); @@ -946,8 +978,9 @@ void JIT::emit_op_jeq_null(Instruction* currentInstruction) // Now handle the immediate cases - undefined & null isImmediate.link(this); - ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && !(JSValue::NullTag + 1)); - addJump(branch32(AboveOrEqual, regT1, TrustedImm32(JSValue::UndefinedTag)), target); + ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && (JSValue::NullTag & 0x1)); + or32(TrustedImm32(1), regT1); + addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), target); wasNotImmediate.link(this); } @@ -970,8 +1003,9 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction) // Now handle the immediate cases - undefined & null isImmediate.link(this); - ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && !(JSValue::NullTag + 1)); - addJump(branch32(Below, regT1, TrustedImm32(JSValue::UndefinedTag)), target); + ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && (JSValue::NullTag & 0x1)); + or32(TrustedImm32(1), regT1); + addJump(branch32(NotEqual, regT1, TrustedImm32(JSValue::NullTag)), target); wasNotImmediate.link(this); } @@ -1012,8 +1046,7 @@ void JIT::emit_op_eq(Instruction* currentInstruction) addSlowCase(branch32(Equal, regT1, TrustedImm32(JSValue::CellTag))); addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::LowestTag))); - set8Compare32(Equal, regT0, regT2, regT0); - or32(TrustedImm32(JSValue::FalseTag), regT0); + set32Compare32(Equal, regT0, regT2, regT0); emitStoreBool(dst, regT0); } @@ -1049,7 +1082,6 @@ void JIT::emitSlow_op_eq(Instruction* currentInstruction, Vector<SlowCaseEntry>: stubCallEq.call(regT0); storeResult.link(this); - or32(TrustedImm32(JSValue::FalseTag), regT0); emitStoreBool(dst, regT0); } @@ -1064,8 +1096,7 @@ void JIT::emit_op_neq(Instruction* currentInstruction) addSlowCase(branch32(Equal, regT1, TrustedImm32(JSValue::CellTag))); addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::LowestTag))); - set8Compare32(NotEqual, regT0, regT2, regT0); - or32(TrustedImm32(JSValue::FalseTag), regT0); + set32Compare32(NotEqual, regT0, regT2, regT0); emitStoreBool(dst, regT0); } @@ -1100,7 +1131,6 @@ void JIT::emitSlow_op_neq(Instruction* currentInstruction, Vector<SlowCaseEntry> storeResult.link(this); xor32(TrustedImm32(0x1), regT0); - or32(TrustedImm32(JSValue::FalseTag), regT0); emitStoreBool(dst, regT0); } @@ -1121,11 +1151,9 @@ void JIT::compileOpStrictEq(Instruction* currentInstruction, CompileOpStrictEqTy addSlowCase(branch32(AboveOrEqual, regT2, TrustedImm32(JSValue::CellTag))); if (type == OpStrictEq) - set8Compare32(Equal, regT0, regT1, regT0); + set32Compare32(Equal, regT0, regT1, regT0); else - set8Compare32(NotEqual, regT0, regT1, regT0); - - or32(TrustedImm32(JSValue::FalseTag), regT0); + set32Compare32(NotEqual, regT0, regT1, regT0); emitStoreBool(dst, regT0); } @@ -1185,14 +1213,12 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) isImmediate.link(this); - set8Compare32(Equal, regT1, TrustedImm32(JSValue::NullTag), regT2); - set8Compare32(Equal, regT1, TrustedImm32(JSValue::UndefinedTag), regT1); + set32Compare32(Equal, regT1, TrustedImm32(JSValue::NullTag), regT2); + set32Compare32(Equal, regT1, TrustedImm32(JSValue::UndefinedTag), regT1); or32(regT2, regT1); wasNotImmediate.link(this); - or32(TrustedImm32(JSValue::FalseTag), regT1); - emitStoreBool(dst, regT1); } @@ -1211,14 +1237,12 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) isImmediate.link(this); - set8Compare32(NotEqual, regT1, TrustedImm32(JSValue::NullTag), regT2); - set8Compare32(NotEqual, regT1, TrustedImm32(JSValue::UndefinedTag), regT1); + set32Compare32(NotEqual, regT1, TrustedImm32(JSValue::NullTag), regT2); + set32Compare32(NotEqual, regT1, TrustedImm32(JSValue::UndefinedTag), regT1); and32(regT2, regT1); wasNotImmediate.link(this); - or32(TrustedImm32(JSValue::FalseTag), regT1); - emitStoreBool(dst, regT1); } diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp index 68f8dda..a1f1fe6 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -581,7 +581,7 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure // ecx = baseObject->m_structure if (!direct) { - for (RefPtr<Structure>* it = chain->head(); *it; ++it) + for (WriteBarrier<Structure>* it = chain->head(); *it; ++it) testPrototype((*it)->storedPrototype(), failureCases); } @@ -606,11 +606,7 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure restoreReturnAddressBeforeReturn(regT3); } - // Assumes m_refCount can be decremented easily, refcount decrement is safe as - // codeblock should ensure oldStructure->m_refCount > 0 - sub32(TrustedImm32(1), AbsoluteAddress(oldStructure->addressOfCount())); - add32(TrustedImm32(1), AbsoluteAddress(newStructure->addressOfCount())); - storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset())); + storePtrWithWriteBarrier(TrustedImmPtr(newStructure), regT0, Address(regT0, JSCell::structureOffset())); // write the value compilePutDirectOffset(regT0, regT1, newStructure, cachedOffset); @@ -652,17 +648,15 @@ void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, St repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset), offset); } -void JIT::patchMethodCallProto(CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress) +void JIT::patchMethodCallProto(JSGlobalData& globalData, CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress) { RepatchBuffer repatchBuffer(codeBlock); ASSERT(!methodCallLinkInfo.cachedStructure); - methodCallLinkInfo.cachedStructure = structure; - structure->ref(); + methodCallLinkInfo.cachedStructure.set(globalData, codeBlock->ownerExecutable(), structure); Structure* prototypeStructure = proto->structure(); - methodCallLinkInfo.cachedPrototypeStructure = prototypeStructure; - prototypeStructure->ref(); + methodCallLinkInfo.cachedPrototypeStructure.set(globalData, codeBlock->ownerExecutable(), prototypeStructure); repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure); repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto); @@ -697,7 +691,7 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) // Checks out okay! - get the length from the storage loadPtr(Address(regT0, JSArray::storageOffset()), regT3); load32(Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2); - Jump failureCases2 = branch32(Above, regT2, TrustedImm32(JSImmediate::maxImmediateInt)); + Jump failureCases2 = branch32(LessThan, regT2, TrustedImm32(0)); emitFastArithIntToImmNoCheck(regT2, regT0); Jump success = jump(); @@ -735,7 +729,7 @@ void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* str Jump failureCases1 = checkStructure(regT0, structure); // Check the prototype object's Structure had not changed. - Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); + const void* prototypeStructureAddress = protoObject->addressOfStructure(); #if CPU(X86_64) move(TrustedImmPtr(prototypeStructure), regT3); Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); @@ -839,8 +833,7 @@ void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, Polymorphic CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); - structure->ref(); - polymorphicStructures->list[currentIndex].set(entryLabel, structure); + polymorphicStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), entryLabel, structure); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); @@ -858,7 +851,7 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi Jump failureCases1 = checkStructure(regT0, structure); // Check the prototype object's Structure had not changed. - Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); + const void* prototypeStructureAddress = protoObject->addressOfStructure(); #if CPU(X86_64) move(TrustedImmPtr(prototypeStructure), regT3); Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); @@ -907,10 +900,7 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult)); CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); - - structure->ref(); - prototypeStructure->ref(); - prototypeStructures->list[currentIndex].set(entryLabel, structure, prototypeStructure); + prototypeStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), entryLabel, structure, prototypeStructure); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); @@ -928,7 +918,7 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi bucketsOfFail.append(baseObjectCheck); Structure* currStructure = structure; - RefPtr<Structure>* it = chain->head(); + WriteBarrier<Structure>* it = chain->head(); JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i, ++it) { protoObject = asObject(currStructure->prototypeForLookup(callFrame)); @@ -978,7 +968,6 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); // Track the stub we have created so that it will be deleted later. - structure->ref(); prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain); // Finally patch the jump to slow case back in the hot path to jump here instead. @@ -997,7 +986,7 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str bucketsOfFail.append(checkStructure(regT0, structure)); Structure* currStructure = structure; - RefPtr<Structure>* it = chain->head(); + WriteBarrier<Structure>* it = chain->head(); JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i, ++it) { protoObject = asObject(currStructure->prototypeForLookup(callFrame)); diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp index 2a47e5c..d0c3688 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp @@ -475,7 +475,7 @@ void JIT::compileGetByIdSlowCase(int dst, int base, Identifier* ident, Vector<Sl stubCall.addArgument(TrustedImmPtr(ident)); Call call = stubCall.call(dst); - END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase); + END_UNINTERRUPTED_SEQUENCE_FOR_PUT(sequenceGetByIdSlowCase, dst); ASSERT_JIT_OFFSET(differenceBetween(coldPathBegin, call), patchOffsetGetByIdSlowCaseCall); @@ -597,7 +597,7 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure if (!direct) { // Verify that nothing in the prototype chain has a setter for this property. - for (RefPtr<Structure>* it = chain->head(); *it; ++it) + for (WriteBarrier<Structure>* it = chain->head(); *it; ++it) testPrototype((*it)->storedPrototype(), failureCases); } @@ -619,12 +619,10 @@ void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure restoreReturnAddressBeforeReturn(regT3); } + + storePtrWithWriteBarrier(TrustedImmPtr(newStructure), regT0, Address(regT0, JSCell::structureOffset())); - sub32(TrustedImm32(1), AbsoluteAddress(oldStructure->addressOfCount())); - add32(TrustedImm32(1), AbsoluteAddress(newStructure->addressOfCount())); - storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset())); - -#if CPU(MIPS) +#if CPU(MIPS) || CPU(SH4) // For MIPS, we don't add sizeof(void*) to the stack offset. load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3); load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT2); @@ -674,17 +672,14 @@ void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, St repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset2), offset + OBJECT_OFFSETOF(JSValue, u.asBits.tag)); // tag } -void JIT::patchMethodCallProto(CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress) +void JIT::patchMethodCallProto(JSGlobalData& globalData, CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress) { RepatchBuffer repatchBuffer(codeBlock); ASSERT(!methodCallLinkInfo.cachedStructure); - methodCallLinkInfo.cachedStructure = structure; - structure->ref(); - + methodCallLinkInfo.cachedStructure.set(globalData, codeBlock->ownerExecutable(), structure); Structure* prototypeStructure = proto->structure(); - methodCallLinkInfo.cachedPrototypeStructure = prototypeStructure; - prototypeStructure->ref(); + methodCallLinkInfo.cachedPrototypeStructure.set(globalData, codeBlock->ownerExecutable(), prototypeStructure); repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure); repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto); @@ -762,7 +757,7 @@ void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* str Jump failureCases1 = checkStructure(regT0, structure); // Check the prototype object's Structure had not changed. - Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); + const void* prototypeStructureAddress = protoObject->addressOfStructure(); #if CPU(X86_64) move(TrustedImmPtr(prototypeStructure), regT3); Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); @@ -867,9 +862,8 @@ void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, Polymorphic patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult)); CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); - - structure->ref(); - polymorphicStructures->list[currentIndex].set(entryLabel, structure); + + polymorphicStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), entryLabel, structure); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); @@ -889,7 +883,7 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi Jump failureCases1 = checkStructure(regT0, structure); // Check the prototype object's Structure had not changed. - Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); + const void* prototypeStructureAddress = protoObject->addressOfStructure(); #if CPU(X86_64) move(TrustedImmPtr(prototypeStructure), regT3); Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); @@ -935,10 +929,8 @@ void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, Polymorphi patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult)); CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); - - structure->ref(); - prototypeStructure->ref(); - prototypeStructures->list[currentIndex].set(entryLabel, structure, prototypeStructure); + + prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, prototypeStructure); // Finally patch the jump to slow case back in the hot path to jump here instead. CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); @@ -957,7 +949,7 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi bucketsOfFail.append(checkStructure(regT0, structure)); Structure* currStructure = structure; - RefPtr<Structure>* it = chain->head(); + WriteBarrier<Structure>* it = chain->head(); JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i, ++it) { protoObject = asObject(currStructure->prototypeForLookup(callFrame)); @@ -1006,7 +998,6 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); // Track the stub we have created so that it will be deleted later. - structure->ref(); prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain); // Finally patch the jump to slow case back in the hot path to jump here instead. @@ -1026,7 +1017,7 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str bucketsOfFail.append(checkStructure(regT0, structure)); Structure* currStructure = structure; - RefPtr<Structure>* it = chain->head(); + WriteBarrier<Structure>* it = chain->head(); JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i, ++it) { protoObject = asObject(currStructure->prototypeForLookup(callFrame)); diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index e52c7c8..953bd11 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -40,7 +40,7 @@ #include "Debugger.h" #include "ExceptionHelpers.h" #include "GetterSetter.h" -#include "Global.h" +#include "Strong.h" #include "JIT.h" #include "JSActivation.h" #include "JSArray.h" @@ -67,7 +67,7 @@ using namespace std; namespace JSC { -#if OS(DARWIN) || OS(WINDOWS) +#if OS(DARWIN) || (OS(WINDOWS) && CPU(X86)) #define SYMBOL_STRING(name) "_" #name #else #define SYMBOL_STRING(name) #name @@ -81,7 +81,7 @@ namespace JSC { #if (OS(LINUX) || OS(FREEBSD)) && CPU(X86_64) #define SYMBOL_STRING_RELOCATION(name) #name "@plt" -#elif OS(DARWIN) +#elif OS(DARWIN) || (CPU(X86_64) && COMPILER(MINGW) && !GCC_VERSION_AT_LEAST(4, 5, 0)) #define SYMBOL_STRING_RELOCATION(name) "_" #name #elif CPU(X86) && COMPILER(MINGW) #define SYMBOL_STRING_RELOCATION(name) "@" #name "@4" @@ -314,7 +314,79 @@ extern "C" { #define ENABLE_PROFILER_REFERENCE_OFFSET 96 #define GLOBAL_DATA_OFFSET 100 #define STACK_LENGTH 104 +#elif CPU(SH4) +#define SYMBOL_STRING(name) #name +/* code (r4), RegisterFile* (r5), CallFrame* (r6), JSValue* exception (r7), Profiler**(sp), JSGlobalData (sp)*/ +asm volatile ( +".text\n" +".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" +SYMBOL_STRING(ctiTrampoline) ":" "\n" + "mov.l r7, @-r15" "\n" + "mov.l r6, @-r15" "\n" + "mov.l r5, @-r15" "\n" + "mov.l r8, @-r15" "\n" + "mov #127, r8" "\n" + "mov.l r14, @-r15" "\n" + "sts.l pr, @-r15" "\n" + "mov.l r13, @-r15" "\n" + "mov.l r11, @-r15" "\n" + "mov.l r10, @-r15" "\n" + "add #-60, r15" "\n" + "mov r6, r14" "\n" + "jsr @r4" "\n" + "nop" "\n" + "add #60, r15" "\n" + "mov.l @r15+,r10" "\n" + "mov.l @r15+,r11" "\n" + "mov.l @r15+,r13" "\n" + "lds.l @r15+,pr" "\n" + "mov.l @r15+,r14" "\n" + "mov.l @r15+,r8" "\n" + "add #12, r15" "\n" + "rts" "\n" + "nop" "\n" +); + +asm volatile ( +".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" +SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" + "mov.l .L2"SYMBOL_STRING(cti_vm_throw)",r0" "\n" + "mov r15, r4" "\n" + "mov.l @(r0,r12),r11" "\n" + "jsr @r11" "\n" + "nop" "\n" + "add #60, r15" "\n" + "mov.l @r15+,r10" "\n" + "mov.l @r15+,r11" "\n" + "mov.l @r15+,r13" "\n" + "lds.l @r15+,pr" "\n" + "mov.l @r15+,r14" "\n" + "mov.l @r15+,r8" "\n" + "add #12, r15" "\n" + "rts" "\n" + "nop" "\n" + ".align 2" "\n" + ".L2"SYMBOL_STRING(cti_vm_throw)":.long " SYMBOL_STRING(cti_vm_throw)"@GOT \n" +); + +asm volatile ( +".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" +SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" + "add #60, r15" "\n" + "mov.l @r15+,r10" "\n" + "mov.l @r15+,r11" "\n" + "mov.l @r15+,r13" "\n" + "lds.l @r15+,pr" "\n" + "mov.l @r15+,r14" "\n" + "mov.l @r15+,r8" "\n" + "add #12, r15" "\n" + "rts" "\n" + "nop" "\n" +); #else #error "JIT not supported on this platform." #endif @@ -771,12 +843,12 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co normalizePrototypeChain(callFrame, baseCell); StructureChain* prototypeChain = structure->prototypeChain(callFrame); - stubInfo->initPutByIdTransition(structure->previousID(), structure, prototypeChain); + stubInfo->initPutByIdTransition(callFrame->globalData(), codeBlock->ownerExecutable(), structure->previousID(), structure, prototypeChain); JIT::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), prototypeChain, returnAddress, direct); return; } - stubInfo->initPutByIdReplace(structure); + stubInfo->initPutByIdReplace(callFrame->globalData(), codeBlock->ownerExecutable(), structure); JIT::patchPutByIdReplace(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress, direct); } @@ -824,7 +896,7 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co if (slot.slotBase() == baseValue) { // set this up, so derefStructures can do it's job. - stubInfo->initGetByIdSelf(structure); + stubInfo->initGetByIdSelf(callFrame->globalData(), codeBlock->ownerExecutable(), structure); if (slot.cachedPropertyType() != PropertySlot::Value) ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_self_fail)); else @@ -847,10 +919,10 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co // should not be treated as a dictionary. if (slotBaseObject->structure()->isDictionary()) { slotBaseObject->flattenDictionaryObject(callFrame->globalData()); - offset = slotBaseObject->structure()->get(propertyName); + offset = slotBaseObject->structure()->get(callFrame->globalData(), propertyName); } - stubInfo->initGetByIdProto(structure, slotBaseObject->structure()); + stubInfo->initGetByIdProto(callFrame->globalData(), codeBlock->ownerExecutable(), structure, slotBaseObject->structure()); ASSERT(!structure->isDictionary()); ASSERT(!slotBaseObject->structure()->isDictionary()); @@ -866,7 +938,7 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co } StructureChain* prototypeChain = structure->prototypeChain(callFrame); - stubInfo->initGetByIdChain(structure, prototypeChain); + stubInfo->initGetByIdChain(callFrame->globalData(), codeBlock->ownerExecutable(), structure, prototypeChain); JIT::compileGetByIdChain(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, prototypeChain, count, propertyName, slot, offset, returnAddress); } @@ -1156,6 +1228,29 @@ MSVC() MSVC_END( END) */ +#elif CPU(SH4) +#define DEFINE_STUB_FUNCTION(rtype, op) \ + extern "C" { \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \ + }; \ + asm volatile( \ + ".align 2" "\n" \ + ".globl " SYMBOL_STRING(cti_##op) "\n" \ + SYMBOL_STRING(cti_##op) ":" "\n" \ + "sts pr, r11" "\n" \ + "mov.l r11, @(0x38, r15)" "\n" \ + "mov.l .L2"SYMBOL_STRING(JITStubThunked_##op)",r0" "\n" \ + "mov.l @(r0,r12),r11" "\n" \ + "jsr @r11" "\n" \ + "nop" "\n" \ + "mov.l @(0x38, r15), r11 " "\n" \ + "lds r11, pr " "\n" \ + "rts" "\n" \ + "nop" "\n" \ + ".align 2" "\n" \ + ".L2"SYMBOL_STRING(JITStubThunked_##op)":.long " SYMBOL_STRING(JITStubThunked_##op)"@GOT \n" \ + ); \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) #else #define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION) #endif @@ -1465,7 +1560,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check) // Check to see if the function is on the object's prototype. Patch up the code to optimize. if (slot.slotBase() == structure->prototypeForLookup(callFrame)) { - JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, slotBaseObject, STUB_RETURN_ADDRESS); + JIT::patchMethodCallProto(callFrame->globalData(), codeBlock, methodCallLinkInfo, callee, structure, slotBaseObject, STUB_RETURN_ADDRESS); return JSValue::encode(result); } @@ -1476,7 +1571,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check) // for now. For now it performs a check on a special object on the global object only used for this // purpose. The object is in no way exposed, and as such the check will always pass. if (slot.slotBase() == baseValue) { - JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject->methodCallDummy(), STUB_RETURN_ADDRESS); + JIT::patchMethodCallProto(callFrame->globalData(), codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject->methodCallDummy(), STUB_RETURN_ADDRESS); return JSValue::encode(result); } } @@ -1535,7 +1630,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail) if (stubInfo->accessType == access_get_by_id_self) { ASSERT(!stubInfo->stubRoutine); - polymorphicStructureList = new PolymorphicAccessStructureList(CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure); + polymorphicStructureList = new PolymorphicAccessStructureList(callFrame->globalData(), codeBlock->ownerExecutable(), CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure.get()); stubInfo->initGetByIdSelfList(polymorphicStructureList, 1); } else { polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList; @@ -1560,12 +1655,12 @@ static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(JSG switch (stubInfo->accessType) { case access_get_by_id_proto: - prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure, stubInfo->u.getByIdProto.prototypeStructure); + prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure.get(), stubInfo->u.getByIdProto.prototypeStructure.get()); stubInfo->stubRoutine = CodeLocationLabel(); stubInfo->initGetByIdProtoList(prototypeStructureList, 2); break; case access_get_by_id_chain: - prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain); + prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure.get(), stubInfo->u.getByIdChain.chain.get()); stubInfo->stubRoutine = CodeLocationLabel(); stubInfo->initGetByIdProtoList(prototypeStructureList, 2); break; @@ -1649,7 +1744,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list) // should not be treated as a dictionary. if (slotBaseObject->structure()->isDictionary()) { slotBaseObject->flattenDictionaryObject(callFrame->globalData()); - offset = slotBaseObject->structure()->get(propertyName); + offset = slotBaseObject->structure()->get(callFrame->globalData(), propertyName); } int listIndex; @@ -2658,10 +2753,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global) JSValue result = slot.getValue(callFrame, ident); if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfo(globalResolveInfoIndex); - if (globalResolveInfo.structure) - globalResolveInfo.structure->deref(); - globalObject->structure()->ref(); - globalResolveInfo.structure = globalObject->structure(); + globalResolveInfo.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), globalObject->structure()); globalResolveInfo.offset = slot.cachedOffset(); return JSValue::encode(result); } @@ -3495,7 +3587,7 @@ MacroAssemblerCodePtr JITThunks::ctiStub(JSGlobalData* globalData, ThunkGenerato NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function) { - std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Global<NativeExecutable>(Global<NativeExecutable>::EmptyValue)); + std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Strong<NativeExecutable>()); if (entry.second) entry.first->second.set(*globalData, NativeExecutable::create(*globalData, JIT::compileCTINativeCall(globalData, m_executablePool, function), function, ctiNativeConstruct(), callHostFunctionAsConstructor)); return entry.first->second.get(); @@ -3503,7 +3595,7 @@ NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFu NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator) { - std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Global<NativeExecutable>(Global<NativeExecutable>::EmptyValue)); + std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Strong<NativeExecutable>()); if (entry.second) { MacroAssemblerCodePtr code = globalData->canUseJIT() ? generator(globalData, m_executablePool.get()) : MacroAssemblerCodePtr(); entry.first->second.set(*globalData, NativeExecutable::create(*globalData, code, function, ctiNativeConstruct(), callHostFunctionAsConstructor)); diff --git a/Source/JavaScriptCore/jit/JITStubs.h b/Source/JavaScriptCore/jit/JITStubs.h index af6e13f..7c67f6e 100644 --- a/Source/JavaScriptCore/jit/JITStubs.h +++ b/Source/JavaScriptCore/jit/JITStubs.h @@ -229,6 +229,27 @@ namespace JSC { ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } }; +#elif CPU(SH4) + struct JITStackFrame { + JITStubArg padding; // Unused + JITStubArg args[6]; + + ReturnAddressPtr thunkReturnAddress; + void* savedR10; + void* savedR11; + void* savedR13; + void* savedRPR; + void* savedR14; + void* savedTimeoutReg; + + RegisterFile* registerFile; + CallFrame* callFrame; + JSValue* exception; + Profiler** enabledProfilerReference; + JSGlobalData* globalData; + + ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } + }; #else #error "JITStackFrame not defined for this platform." #endif @@ -254,7 +275,7 @@ namespace JSC { extern "C" void ctiOpThrowNotCaught(); extern "C" EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*); - template <typename T> class Global; + template <typename T> class Strong; class JITThunks { public: @@ -283,7 +304,7 @@ namespace JSC { private: typedef HashMap<ThunkGenerator, MacroAssemblerCodePtr> CTIStubMap; CTIStubMap m_ctiStubMap; - typedef HashMap<NativeFunction, Global<NativeExecutable> > HostFunctionStubMap; + typedef HashMap<NativeFunction, Strong<NativeExecutable> > HostFunctionStubMap; OwnPtr<HostFunctionStubMap> m_hostFunctionStubMap; RefPtr<ExecutablePool> m_executablePool; diff --git a/Source/JavaScriptCore/jit/JSInterfaceJIT.h b/Source/JavaScriptCore/jit/JSInterfaceJIT.h index 5d3f239..e1d9353 100644 --- a/Source/JavaScriptCore/jit/JSInterfaceJIT.h +++ b/Source/JavaScriptCore/jit/JSInterfaceJIT.h @@ -28,7 +28,6 @@ #include "JITCode.h" #include "JITStubs.h" -#include "JSImmediate.h" #include "JSValue.h" #include "MacroAssembler.h" #include "RegisterFile.h" @@ -154,21 +153,51 @@ namespace JSC { static const FPRegisterID fpRegT1 = MIPSRegisters::f6; static const FPRegisterID fpRegT2 = MIPSRegisters::f8; static const FPRegisterID fpRegT3 = MIPSRegisters::f10; +#elif CPU(SH4) + static const RegisterID timeoutCheckRegister = SH4Registers::r8; + static const RegisterID callFrameRegister = SH4Registers::fp; + + static const RegisterID regT0 = SH4Registers::r0; + static const RegisterID regT1 = SH4Registers::r1; + static const RegisterID regT2 = SH4Registers::r2; + static const RegisterID regT3 = SH4Registers::r10; + static const RegisterID regT4 = SH4Registers::r4; + static const RegisterID regT5 = SH4Registers::r5; + static const RegisterID regT6 = SH4Registers::r6; + static const RegisterID regT7 = SH4Registers::r7; + static const RegisterID firstArgumentRegister =regT4; + + static const RegisterID returnValueRegister = SH4Registers::r0; + static const RegisterID cachedResultRegister = SH4Registers::r0; + + static const FPRegisterID fpRegT0 = SH4Registers::fr0; + static const FPRegisterID fpRegT1 = SH4Registers::fr2; + static const FPRegisterID fpRegT2 = SH4Registers::fr4; + static const FPRegisterID fpRegT3 = SH4Registers::fr6; + static const FPRegisterID fpRegT4 = SH4Registers::fr8; + static const FPRegisterID fpRegT5 = SH4Registers::fr10; + static const FPRegisterID fpRegT6 = SH4Registers::fr12; + static const FPRegisterID fpRegT7 = SH4Registers::fr14; #else #error "JIT not supported on this platform." #endif #if USE(JSVALUE32_64) // Can't just propogate JSValue::Int32Tag as visual studio doesn't like it - static const unsigned Int32Tag = 0xfffffffd; + static const unsigned Int32Tag = 0xffffffff; COMPILE_ASSERT(Int32Tag == JSValue::Int32Tag, Int32Tag_out_of_sync); #else - static const unsigned Int32Tag = JSImmediate::TagTypeNumber >> 32; + static const unsigned Int32Tag = TagTypeNumber >> 32; #endif inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload); inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst); inline Jump emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch); + inline void storePtrWithWriteBarrier(TrustedImmPtr ptr, RegisterID /* owner */, Address dest) + { + storePtr(ptr, dest); + } + #if USE(JSVALUE32_64) inline Jump emitJumpIfNotJSCell(unsigned virtualRegisterIndex); inline Address tagFor(int index, RegisterID base = callFrameRegister); diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 8ccb039..729dce9 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -366,6 +366,7 @@ int main(int argc, char** argv) static void cleanupGlobalData(JSGlobalData* globalData) { JSLock lock(SilenceAssertionsOnly); + globalData->clearBuiltinStructures(); globalData->heap.destroy(); globalData->deref(); } diff --git a/Source/JavaScriptCore/parser/JSParser.cpp b/Source/JavaScriptCore/parser/JSParser.cpp index 9245eb0..314691d 100644 --- a/Source/JavaScriptCore/parser/JSParser.cpp +++ b/Source/JavaScriptCore/parser/JSParser.cpp @@ -2168,5 +2168,7 @@ template <class TreeBuilder> TreeExpression JSParser::parseUnaryExpression(TreeB namespace WTF { - template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits { }; + template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits { + static const bool canInitializeWithMemset = false; // Not all Scope data members initialize to 0. + }; } diff --git a/Source/JavaScriptCore/parser/Lexer.h b/Source/JavaScriptCore/parser/Lexer.h index d4145c1..9dc553a 100644 --- a/Source/JavaScriptCore/parser/Lexer.h +++ b/Source/JavaScriptCore/parser/Lexer.h @@ -71,11 +71,12 @@ namespace JSC { { m_error = 0; m_code = m_codeStart + offset; - m_current = *m_code; m_buffer8.resize(0); m_buffer16.resize(0); - if (UNLIKELY(m_code == m_codeEnd)) - m_current = -1; + // Faster than an if-else sequence + m_current = -1; + if (LIKELY(m_code < m_codeEnd)) + m_current = *m_code; } void setLineNumber(int line) { diff --git a/Source/JavaScriptCore/runtime/Arguments.h b/Source/JavaScriptCore/runtime/Arguments.h index 950bb4e..b5aa46b 100644 --- a/Source/JavaScriptCore/runtime/Arguments.h +++ b/Source/JavaScriptCore/runtime/Arguments.h @@ -92,7 +92,7 @@ namespace JSC { d->registers = &activation->registerAt(0); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -143,7 +143,7 @@ namespace JSC { } inline Arguments::Arguments(CallFrame* callFrame) - : JSNonFinalObject(callFrame->lexicalGlobalObject()->argumentsStructure()) + : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure()) , d(adoptPtr(new ArgumentsData)) { ASSERT(inherits(&s_info)); @@ -185,7 +185,7 @@ namespace JSC { } inline Arguments::Arguments(CallFrame* callFrame, NoParametersType) - : JSNonFinalObject(callFrame->lexicalGlobalObject()->argumentsStructure()) + : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure()) , d(adoptPtr(new ArgumentsData)) { ASSERT(inherits(&s_info)); @@ -247,7 +247,7 @@ namespace JSC { int registerOffset = m_numParametersMinusThis + RegisterFile::CallFrameHeaderSize; size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize; - OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData, m_registers - registerOffset, registerArraySize); + OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData, m_registers - registerOffset, registerArraySize, m_numParametersMinusThis + 1); WriteBarrier<Unknown>* registers = registerArray.get() + registerOffset; setRegisters(registers, registerArray.release()); } diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp index e0f4b23..050e989 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -37,7 +37,7 @@ ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor); static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*); -ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* functionStructure) +ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype, Structure* functionStructure) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className)) { // ECMA 15.4.3.1 Array.prototype @@ -59,7 +59,7 @@ static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgLi uint32_t n = args.at(0).toUInt32(exec); if (n != args.at(0).toNumber(exec)) return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer.")); - return new (exec) JSArray(globalObject->arrayStructure(), n, CreateInitialized); + return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), n, CreateInitialized); } // otherwise the array is constructed with the arguments in it diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.h b/Source/JavaScriptCore/runtime/ArrayConstructor.h index 5e1408f..97b26c5 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.h +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class ArrayConstructor : public InternalFunction { public: - ArrayConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*); + ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*, Structure*); virtual ConstructType getConstructData(ConstructData&); virtual CallType getCallData(CallData&); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index fdbcd95..29caece 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -114,8 +114,8 @@ const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecStat */ // ECMA 15.4.4 -ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) - : JSArray(structure) +ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, Structure* structure) + : JSArray(globalObject->globalData(), structure) { ASSERT(inherits(&s_info)); putAnonymousValue(globalObject->globalData(), 0, globalObject); @@ -514,10 +514,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) // or quicksort, and much less swapping than bubblesort/insertionsort. for (unsigned i = 0; i < length - 1; ++i) { JSValue iObj = thisObj->get(exec, i); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); unsigned themin = i; JSValue minObj = iObj; for (unsigned j = i + 1; j < length; ++j) { JSValue jObj = thisObj->get(exec, j); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); double compareResult; if (jObj.isUndefined()) compareResult = 1; // don't check minObj because there's no need to differentiate == (0) from > (1) @@ -570,7 +574,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) deleteCount = static_cast<unsigned>(deleteDouble); } - JSArray* resObj = new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact); + JSArray* resObj = new (exec) JSArray(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact); JSValue result = resObj; JSGlobalData& globalData = exec->globalData(); for (unsigned k = 0; k < deleteCount; k++) @@ -682,20 +686,19 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) } for (; k < length && !exec->hadException(); ++k) { PropertySlot slot(thisObj); - if (!thisObj->getPropertySlot(exec, k, slot)) continue; - JSValue v = slot.getValue(exec, k); - MarkedArgumentBuffer eachArguments; + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + MarkedArgumentBuffer eachArguments; eachArguments.append(v); eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); - if (result.toBoolean(exec)) resultArray->put(exec, filterIndex++, v); } @@ -739,15 +742,19 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) PropertySlot slot(thisObj); if (!thisObj->getPropertySlot(exec, k, slot)) continue; - JSValue v = slot.getValue(exec, k); - MarkedArgumentBuffer eachArguments; + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + MarkedArgumentBuffer eachArguments; eachArguments.append(v); eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); resultArray->put(exec, k, result); } @@ -797,18 +804,18 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) } for (; k < length && !exec->hadException(); ++k) { PropertySlot slot(thisObj); - if (!thisObj->getPropertySlot(exec, k, slot)) continue; MarkedArgumentBuffer eachArguments; - eachArguments.append(slot.getValue(exec, k)); eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); - bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); if (!predicateResult) { result = jsBoolean(false); break; @@ -860,6 +867,9 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + call(exec, function, callType, callData, applyThis, eachArguments); } return JSValue::encode(jsUndefined()); @@ -910,8 +920,10 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); - bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); if (predicateResult) { result = jsBoolean(true); break; @@ -979,6 +991,8 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) for (; i < length && !exec->hadException(); ++i) { JSValue prop = getProperty(exec, thisObj, i); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); if (!prop) continue; @@ -1051,6 +1065,8 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) for (; i < length && !exec->hadException(); ++i) { unsigned idx = length - i - 1; JSValue prop = getProperty(exec, thisObj, idx); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); if (!prop) continue; diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.h b/Source/JavaScriptCore/runtime/ArrayPrototype.h index 96641bd..6dadf51 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.h +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.h @@ -28,14 +28,14 @@ namespace JSC { class ArrayPrototype : public JSArray { public: - explicit ArrayPrototype(JSGlobalObject*, NonNullPassRefPtr<Structure>); + explicit ArrayPrototype(JSGlobalObject*, Structure*); bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h index 0f6a646..df7b7f6 100644 --- a/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h +++ b/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h @@ -39,7 +39,7 @@ namespace JSC { , m_object(object) { if (!m_object->structure()->isDictionary()) - m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure())); + m_object->setStructure(globalData, Structure::toCacheableDictionaryTransition(globalData, m_object->structure())); } ~BatchedTransitionOptimizer() diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp index e5b0f3d..a1a4ed4 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -28,7 +28,7 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor); -BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype) +BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className)) { putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.h b/Source/JavaScriptCore/runtime/BooleanConstructor.h index 2550b3b..fa0d05e 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.h +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class BooleanConstructor : public InternalFunction { public: - BooleanConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, BooleanPrototype*); + BooleanConstructor(ExecState*, JSGlobalObject*, Structure*, BooleanPrototype*); private: virtual ConstructType getConstructData(ConstructData&); diff --git a/Source/JavaScriptCore/runtime/BooleanObject.cpp b/Source/JavaScriptCore/runtime/BooleanObject.cpp index 2945c0e..e24a30a 100644 --- a/Source/JavaScriptCore/runtime/BooleanObject.cpp +++ b/Source/JavaScriptCore/runtime/BooleanObject.cpp @@ -27,8 +27,8 @@ ASSERT_CLASS_FITS_IN_CELL(BooleanObject); const ClassInfo BooleanObject::s_info = { "Boolean", &JSWrapperObject::s_info, 0, 0 }; -BooleanObject::BooleanObject(JSGlobalData&, NonNullPassRefPtr<Structure> structure) - : JSWrapperObject(structure) +BooleanObject::BooleanObject(JSGlobalData& globalData, Structure* structure) + : JSWrapperObject(globalData, structure) { ASSERT(inherits(&s_info)); } diff --git a/Source/JavaScriptCore/runtime/BooleanObject.h b/Source/JavaScriptCore/runtime/BooleanObject.h index ef2d403..def44b4 100644 --- a/Source/JavaScriptCore/runtime/BooleanObject.h +++ b/Source/JavaScriptCore/runtime/BooleanObject.h @@ -27,11 +27,11 @@ namespace JSC { class BooleanObject : public JSWrapperObject { public: - explicit BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure>); + explicit BooleanObject(JSGlobalData&, Structure*); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp index d0a64af..20990e1 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp @@ -37,7 +37,7 @@ static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*); // ECMA 15.6.4 -BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure) +BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure) : BooleanObject(exec->globalData(), structure) { setInternalValue(exec->globalData(), jsBoolean(false)); diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.h b/Source/JavaScriptCore/runtime/BooleanPrototype.h index d6d3d9f..5ccbd2b 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.h +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.h @@ -27,7 +27,7 @@ namespace JSC { class BooleanPrototype : public BooleanObject { public: - BooleanPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure); + BooleanPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp index 0a06148..9bbb688 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.cpp +++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp @@ -57,7 +57,7 @@ static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*); static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*); static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*); -DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure, DatePrototype* datePrototype) +DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure, DatePrototype* datePrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className)) { putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly); diff --git a/Source/JavaScriptCore/runtime/DateConstructor.h b/Source/JavaScriptCore/runtime/DateConstructor.h index bd529f1..23a0311 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.h +++ b/Source/JavaScriptCore/runtime/DateConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class DateConstructor : public InternalFunction { public: - DateConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure, DatePrototype*); + DateConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure, DatePrototype*); private: virtual ConstructType getConstructData(ConstructData&); diff --git a/Source/JavaScriptCore/runtime/DateInstance.cpp b/Source/JavaScriptCore/runtime/DateInstance.cpp index 74adda4..d8ca072 100644 --- a/Source/JavaScriptCore/runtime/DateInstance.cpp +++ b/Source/JavaScriptCore/runtime/DateInstance.cpp @@ -34,15 +34,15 @@ namespace JSC { const ClassInfo DateInstance::s_info = {"Date", &JSWrapperObject::s_info, 0, 0}; -DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure) - : JSWrapperObject(structure) +DateInstance::DateInstance(ExecState* exec, Structure* structure) + : JSWrapperObject(exec->globalData(), structure) { ASSERT(inherits(&s_info)); setInternalValue(exec->globalData(), jsNaN()); } -DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time) - : JSWrapperObject(structure) +DateInstance::DateInstance(ExecState* exec, Structure* structure, double time) + : JSWrapperObject(exec->globalData(), structure) { ASSERT(inherits(&s_info)); setInternalValue(exec->globalData(), jsNumber(timeClip(time))); diff --git a/Source/JavaScriptCore/runtime/DateInstance.h b/Source/JavaScriptCore/runtime/DateInstance.h index d0dcf0b..6195c85 100644 --- a/Source/JavaScriptCore/runtime/DateInstance.h +++ b/Source/JavaScriptCore/runtime/DateInstance.h @@ -31,8 +31,8 @@ namespace JSC { class DateInstance : public JSWrapperObject { public: - DateInstance(ExecState*, NonNullPassRefPtr<Structure>, double); - explicit DateInstance(ExecState*, NonNullPassRefPtr<Structure>); + DateInstance(ExecState*, Structure*, double); + explicit DateInstance(ExecState*, Structure*); double internalNumber() const { return internalValue().uncheckedGetNumber(); } @@ -52,7 +52,7 @@ namespace JSC { return calculateGregorianDateTimeUTC(exec); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp index 314baa4..444fa98 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.cpp +++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp @@ -429,7 +429,7 @@ const ClassInfo DatePrototype::s_info = {"Date", &DateInstance::s_info, 0, ExecS // ECMA 15.9.4 -DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) +DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) : DateInstance(exec, structure) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/DatePrototype.h b/Source/JavaScriptCore/runtime/DatePrototype.h index 0ebbedc..2e1030d 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.h +++ b/Source/JavaScriptCore/runtime/DatePrototype.h @@ -29,14 +29,14 @@ namespace JSC { class DatePrototype : public DateInstance { public: - DatePrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>); + DatePrototype(ExecState*, JSGlobalObject*, Structure*); virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/Error.cpp b/Source/JavaScriptCore/runtime/Error.cpp index b84f5ea..7eda19f 100644 --- a/Source/JavaScriptCore/runtime/Error.cpp +++ b/Source/JavaScriptCore/runtime/Error.cpp @@ -167,7 +167,7 @@ JSObject* throwSyntaxError(ExecState* exec) class StrictModeTypeErrorFunction : public InternalFunction { public: - StrictModeTypeErrorFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const UString& message) + StrictModeTypeErrorFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) : InternalFunction(&exec->globalData(), globalObject, structure, exec->globalData().propertyNames->emptyIdentifier) , m_message(message) { diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp index 7f4f82c..df112dd 100644 --- a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp @@ -29,7 +29,7 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor); -ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype) +ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className)) { // ECMA 15.11.3.1 Error.prototype diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.h b/Source/JavaScriptCore/runtime/ErrorConstructor.h index 3d0d706..ceec005 100644 --- a/Source/JavaScriptCore/runtime/ErrorConstructor.h +++ b/Source/JavaScriptCore/runtime/ErrorConstructor.h @@ -30,7 +30,7 @@ namespace JSC { class ErrorConstructor : public InternalFunction { public: - ErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ErrorPrototype*); + ErrorConstructor(ExecState*, JSGlobalObject*, Structure*, ErrorPrototype*); private: virtual ConstructType getConstructData(ConstructData&); diff --git a/Source/JavaScriptCore/runtime/ErrorInstance.cpp b/Source/JavaScriptCore/runtime/ErrorInstance.cpp index 0db2af8..ed95ba4 100644 --- a/Source/JavaScriptCore/runtime/ErrorInstance.cpp +++ b/Source/JavaScriptCore/runtime/ErrorInstance.cpp @@ -25,28 +25,28 @@ namespace JSC { const ClassInfo ErrorInstance::s_info = { "Error", &JSNonFinalObject::s_info, 0, 0 }; -ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure) - : JSNonFinalObject(structure) +ErrorInstance::ErrorInstance(JSGlobalData* globalData, Structure* structure) + : JSNonFinalObject(*globalData, structure) , m_appendSourceToMessage(false) { ASSERT(inherits(&s_info)); putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, "")); } -ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message) - : JSNonFinalObject(structure) +ErrorInstance::ErrorInstance(JSGlobalData* globalData, Structure* structure, const UString& message) + : JSNonFinalObject(*globalData, structure) , m_appendSourceToMessage(false) { ASSERT(inherits(&s_info)); putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message)); } -ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message) +ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, Structure* structure, const UString& message) { return new (globalData) ErrorInstance(globalData, structure, message); } -ErrorInstance* ErrorInstance::create(ExecState* exec, NonNullPassRefPtr<Structure> structure, JSValue message) +ErrorInstance* ErrorInstance::create(ExecState* exec, Structure* structure, JSValue message) { if (message.isUndefined()) return new (exec) ErrorInstance(&exec->globalData(), structure); diff --git a/Source/JavaScriptCore/runtime/ErrorInstance.h b/Source/JavaScriptCore/runtime/ErrorInstance.h index 82dbf0f..afcf158 100644 --- a/Source/JavaScriptCore/runtime/ErrorInstance.h +++ b/Source/JavaScriptCore/runtime/ErrorInstance.h @@ -29,13 +29,13 @@ namespace JSC { public: static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } - static ErrorInstance* create(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&); - static ErrorInstance* create(ExecState* exec, NonNullPassRefPtr<Structure>, JSValue message); + static ErrorInstance* create(JSGlobalData*, Structure*, const UString&); + static ErrorInstance* create(ExecState*, Structure*, JSValue message); bool appendSourceToMessage() { return m_appendSourceToMessage; } @@ -45,8 +45,8 @@ namespace JSC { virtual bool isErrorInstance() const { return true; } protected: - explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr<Structure>); - explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&); + explicit ErrorInstance(JSGlobalData*, Structure*); + explicit ErrorInstance(JSGlobalData*, Structure*, const UString&); bool m_appendSourceToMessage; }; diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp index e13251c..a57e947 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp @@ -35,7 +35,7 @@ ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype); static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*); // ECMA 15.9.4 -ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure) +ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure) : ErrorInstance(&exec->globalData(), structure) { // The constructor will be added later in ErrorConstructor's constructor diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.h b/Source/JavaScriptCore/runtime/ErrorPrototype.h index 3c2fed3..9437d3a 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.h +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.h @@ -29,7 +29,7 @@ namespace JSC { class ErrorPrototype : public ErrorInstance { public: - ErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure); + ErrorPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp index d3c637e..1d74315 100644 --- a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -44,7 +44,7 @@ namespace JSC { class InterruptedExecutionError : public JSNonFinalObject { public: InterruptedExecutionError(JSGlobalData* globalData) - : JSNonFinalObject(globalData->interruptedExecutionErrorStructure) + : JSNonFinalObject(*globalData, globalData->interruptedExecutionErrorStructure.get()) { } @@ -61,7 +61,7 @@ JSObject* createInterruptedExecutionException(JSGlobalData* globalData) class TerminatedExecutionError : public JSNonFinalObject { public: TerminatedExecutionError(JSGlobalData* globalData) - : JSNonFinalObject(globalData->terminatedExecutionErrorStructure) + : JSNonFinalObject(*globalData, globalData->terminatedExecutionErrorStructure.get()) { } diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index a059ed2..fa14ad5 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -40,13 +40,15 @@ namespace JSC { +const ClassInfo ExecutableBase::s_info = { "Executable", 0, 0, 0 }; + +const ClassInfo NativeExecutable::s_info = { "NativeExecutable", &ExecutableBase::s_info, 0, 0 }; + NativeExecutable::~NativeExecutable() { } -VPtrHackExecutable::~VPtrHackExecutable() -{ -} +const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &ScriptExecutable::s_info, 0, 0 }; EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext) : ScriptExecutable(exec->globalData().evalExecutableStructure.get(), exec, source, inStrictContext) @@ -57,6 +59,8 @@ EvalExecutable::~EvalExecutable() { } +const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", &ScriptExecutable::s_info, 0, 0 }; + ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source) : ScriptExecutable(exec->globalData().programExecutableStructure.get(), exec, source, false) { @@ -66,6 +70,8 @@ ProgramExecutable::~ProgramExecutable() { } +const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, 0, 0 }; + FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine) : ScriptExecutable(globalData->functionExecutableStructure.get(), globalData, source, inStrictContext) , m_numCapturedVariables(0) diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index f15df07..fbe33cf 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -52,8 +52,8 @@ namespace JSC { static const int NUM_PARAMETERS_NOT_COMPILED = -1; public: - ExecutableBase(Structure* structure, int numParameters) - : JSCell(structure) + ExecutableBase(JSGlobalData& globalData, Structure* structure, int numParameters) + : JSCell(globalData, structure) , m_numParametersForCall(numParameters) , m_numParametersForConstruct(numParameters) { @@ -65,10 +65,11 @@ namespace JSC { return m_numParametersForCall == NUM_PARAMETERS_IS_HOST; } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = 0; + static const ClassInfo s_info; int m_numParametersForCall; int m_numParametersForConstruct; @@ -115,10 +116,12 @@ namespace JSC { NativeFunction function() { return m_function; } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(LeafType, StructureFlags), AnonymousSlotCount, &s_info); } + private: #if ENABLE(JIT) NativeExecutable(JSGlobalData& globalData, JITCode callThunk, NativeFunction function, JITCode constructThunk, NativeFunction constructor) - : ExecutableBase(globalData.executableStructure.get(), NUM_PARAMETERS_IS_HOST) + : ExecutableBase(globalData, globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST) , m_function(function) , m_constructor(constructor) { @@ -129,7 +132,7 @@ namespace JSC { } #else NativeExecutable(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor) - : ExecutableBase(globalData.executableStructure.get(), NUM_PARAMETERS_IS_HOST) + : ExecutableBase(globalData, globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST) , m_function(function) , m_constructor(constructor) { @@ -140,22 +143,13 @@ namespace JSC { // Probably should be a NativeConstructor, but this will currently require rewriting the JIT // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList. NativeFunction m_constructor; - }; - - class VPtrHackExecutable : public ExecutableBase { - public: - VPtrHackExecutable(Structure* structure) - : ExecutableBase(structure, NUM_PARAMETERS_IS_HOST) - { - } - - ~VPtrHackExecutable(); + static const ClassInfo s_info; }; class ScriptExecutable : public ExecutableBase { public: ScriptExecutable(Structure* structure, JSGlobalData* globalData, const SourceCode& source, bool isInStrictContext) - : ExecutableBase(structure, NUM_PARAMETERS_NOT_COMPILED) + : ExecutableBase(*globalData, structure, NUM_PARAMETERS_NOT_COMPILED) , m_source(source) , m_features(isInStrictContext ? StrictModeFeature : 0) { @@ -169,7 +163,7 @@ namespace JSC { } ScriptExecutable(Structure* structure, ExecState* exec, const SourceCode& source, bool isInStrictContext) - : ExecutableBase(structure, NUM_PARAMETERS_NOT_COMPILED) + : ExecutableBase(exec->globalData(), structure, NUM_PARAMETERS_NOT_COMPILED) , m_source(source) , m_features(isInStrictContext ? StrictModeFeature : 0) { @@ -238,10 +232,11 @@ namespace JSC { return generatedJITCodeForCall(); } #endif - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } private: static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags; + static const ClassInfo s_info; EvalExecutable(ExecState*, const SourceCode&, bool); JSObject* compileInternal(ExecState*, ScopeChainNode*); @@ -284,10 +279,11 @@ namespace JSC { } #endif - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } private: static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags; + static const ClassInfo s_info; ProgramExecutable(ExecState*, const SourceCode&); JSObject* compileInternal(ExecState*, ScopeChainNode*); @@ -376,7 +372,7 @@ namespace JSC { void discardCode(); void markChildren(MarkStack&); static FunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } private: FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine); @@ -386,6 +382,7 @@ namespace JSC { JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*); static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags; + static const ClassInfo s_info; unsigned m_numCapturedVariables : 31; bool m_forceUsesArguments : 1; diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp index a9f0a06..9e7d8d5 100644 --- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -37,7 +37,7 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor); -FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype) +FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, functionPrototype->classInfo()->className)) { putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.h b/Source/JavaScriptCore/runtime/FunctionConstructor.h index 7f21b20..31a04c9 100644 --- a/Source/JavaScriptCore/runtime/FunctionConstructor.h +++ b/Source/JavaScriptCore/runtime/FunctionConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class FunctionConstructor : public InternalFunction { public: - FunctionConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, FunctionPrototype*); + FunctionConstructor(ExecState*, JSGlobalObject*, Structure*, FunctionPrototype*); private: virtual ConstructType getConstructData(ConstructData&); diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp index c2d8ad3..e2a4941 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -37,7 +37,7 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); -FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) +FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier) { putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.h b/Source/JavaScriptCore/runtime/FunctionPrototype.h index 447f00b..ab708dd 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.h +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.h @@ -27,10 +27,10 @@ namespace JSC { class FunctionPrototype : public InternalFunction { public: - FunctionPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>); + FunctionPrototype(ExecState*, JSGlobalObject*, Structure*); void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/GetterSetter.h b/Source/JavaScriptCore/runtime/GetterSetter.h index 8241275..a222c7a 100644 --- a/Source/JavaScriptCore/runtime/GetterSetter.h +++ b/Source/JavaScriptCore/runtime/GetterSetter.h @@ -26,6 +26,7 @@ #include "JSCell.h" #include "CallFrame.h" +#include "Structure.h" namespace JSC { @@ -37,7 +38,7 @@ namespace JSC { friend class JIT; public: GetterSetter(ExecState* exec) - : JSCell(exec->globalData().getterSetterStructure.get()) + : JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get()) { } @@ -47,7 +48,7 @@ namespace JSC { void setGetter(JSGlobalData& globalData, JSObject* getter) { m_getter.set(globalData, this, getter); } JSObject* setter() const { return m_setter.get(); } void setSetter(JSGlobalData& globalData, JSObject* setter) { m_setter.set(globalData, this, setter); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesMarkChildren), AnonymousSlotCount, 0); } diff --git a/Source/JavaScriptCore/runtime/InitializeThreading.cpp b/Source/JavaScriptCore/runtime/InitializeThreading.cpp index aef60c8..27611b7 100644 --- a/Source/JavaScriptCore/runtime/InitializeThreading.cpp +++ b/Source/JavaScriptCore/runtime/InitializeThreading.cpp @@ -59,7 +59,6 @@ static void initializeThreadingOnce() s_dtoaP5Mutex = new Mutex; initializeDates(); RegisterFile::initializeThreading(); - Structure::initializeThreading(); #endif } diff --git a/Source/JavaScriptCore/runtime/InternalFunction.cpp b/Source/JavaScriptCore/runtime/InternalFunction.cpp index 27106a1..c3b07f8 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.cpp +++ b/Source/JavaScriptCore/runtime/InternalFunction.cpp @@ -36,13 +36,12 @@ ASSERT_CLASS_FITS_IN_CELL(InternalFunction); const ClassInfo InternalFunction::s_info = { "Function", &JSObjectWithGlobalObject::s_info, 0, 0 }; -InternalFunction::InternalFunction(NonNullPassRefPtr<Structure> structure) - : JSObjectWithGlobalObject(structure) +InternalFunction::InternalFunction(VPtrStealingHackType) + : JSObjectWithGlobalObject(VPtrStealingHack) { - ASSERT(inherits(&s_info)); } -InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const Identifier& name) +InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, Structure* structure, const Identifier& name) : JSObjectWithGlobalObject(globalObject, structure) { ASSERT(inherits(&s_info)); @@ -51,12 +50,12 @@ InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* glo const UString& InternalFunction::name(ExecState* exec) { - return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue(); + return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue(); } const UString InternalFunction::displayName(ExecState* exec) { - JSValue displayName = getDirect(exec->globalData().propertyNames->displayName); + JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName); if (displayName && isJSString(&exec->globalData(), displayName)) return asString(displayName)->tryGetValue(); diff --git a/Source/JavaScriptCore/runtime/InternalFunction.h b/Source/JavaScriptCore/runtime/InternalFunction.h index 08c98a5..28e260e 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.h +++ b/Source/JavaScriptCore/runtime/InternalFunction.h @@ -39,7 +39,7 @@ namespace JSC { const UString displayName(ExecState*); const UString calculatedDisplayName(ExecState*); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -48,9 +48,9 @@ namespace JSC { static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags; // Only used to allow us to determine the JSFunction vptr - InternalFunction(NonNullPassRefPtr<Structure> structure); + InternalFunction(VPtrStealingHackType); - InternalFunction(JSGlobalData*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const Identifier&); + InternalFunction(JSGlobalData*, JSGlobalObject*, Structure*, const Identifier&); private: virtual CallType getCallData(CallData&) = 0; diff --git a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h index 54fe909..0165488 100644 --- a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h +++ b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h @@ -25,6 +25,7 @@ #include "JSCell.h" #include "CallFrame.h" +#include "Structure.h" namespace JSC { @@ -35,7 +36,7 @@ namespace JSC { virtual bool isAPIValueWrapper() const { return true; } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount, 0); } @@ -43,7 +44,7 @@ namespace JSC { private: JSAPIValueWrapper(ExecState* exec, JSValue value) - : JSCell(exec->globalData().apiWrapperStructure.get()) + : JSCell(exec->globalData(), exec->globalData().apiWrapperStructure.get()) { m_value.set(exec->globalData(), this, value); ASSERT(!value.isCell()); diff --git a/Source/JavaScriptCore/runtime/JSActivation.cpp b/Source/JavaScriptCore/runtime/JSActivation.cpp index d0c50dd..4e36641 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.cpp +++ b/Source/JavaScriptCore/runtime/JSActivation.cpp @@ -40,7 +40,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSActivation); const ClassInfo JSActivation::s_info = { "JSActivation", &Base::s_info, 0, 0 }; JSActivation::JSActivation(CallFrame* callFrame, FunctionExecutable* functionExecutable) - : Base(callFrame->globalData().activationStructure, functionExecutable->symbolTable(), callFrame->registers()) + : Base(callFrame->globalData(), callFrame->globalData().activationStructure.get(), functionExecutable->symbolTable(), callFrame->registers()) , m_numParametersMinusThis(static_cast<int>(functionExecutable->parameterCount())) , m_numCapturedVars(functionExecutable->capturedVariableCount()) , m_requiresDynamicChecks(functionExecutable->usesEval()) @@ -142,7 +142,7 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert if (symbolTableGet(propertyName, slot)) return true; - if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) { + if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) { slot.setValue(location->get()); return true; } diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h index 7463f47..65642f1 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.h +++ b/Source/JavaScriptCore/runtime/JSActivation.h @@ -66,7 +66,7 @@ namespace JSC { static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags; diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp index 1d621fe..bf61097 100644 --- a/Source/JavaScriptCore/runtime/JSArray.cpp +++ b/Source/JavaScriptCore/runtime/JSArray.cpp @@ -127,26 +127,12 @@ inline void JSArray::checkConsistency(ConsistencyCheckType) #endif JSArray::JSArray(VPtrStealingHackType) - : JSNonFinalObject(Structure::create(Structure::VPtrStealingHack, &s_info)) + : JSNonFinalObject(VPtrStealingHack) { - ASSERT(inherits(&s_info)); - - unsigned initialCapacity = 0; - - m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity))); - m_storage->m_allocBase = m_storage; - m_indexBias = 0; - m_vectorLength = initialCapacity; - - checkConsistency(); - - // It's not safe to call Heap::heap(this) in order to report extra memory - // cost here, because the VPtrStealingHackType JSArray is not allocated on - // the heap. For the same reason, it's OK not to report extra cost. } -JSArray::JSArray(NonNullPassRefPtr<Structure> structure) - : JSNonFinalObject(structure) +JSArray::JSArray(JSGlobalData& globalData, Structure* structure) + : JSNonFinalObject(globalData, structure) { ASSERT(inherits(&s_info)); @@ -162,8 +148,8 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure) Heap::heap(this)->reportExtraMemoryCost(storageSize(0)); } -JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength, ArrayCreationMode creationMode) - : JSNonFinalObject(structure) +JSArray::JSArray(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode creationMode) + : JSNonFinalObject(globalData, structure) { ASSERT(inherits(&s_info)); @@ -204,8 +190,8 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength, Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity)); } -JSArray::JSArray(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure, const ArgList& list) - : JSNonFinalObject(structure) +JSArray::JSArray(JSGlobalData& globalData, Structure* structure, const ArgList& list) + : JSNonFinalObject(globalData, structure) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index 1a6eba8..8be8513 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -61,12 +61,11 @@ namespace JSC { friend class Walker; public: - enum VPtrStealingHackType { VPtrStealingHack }; JSArray(VPtrStealingHackType); - explicit JSArray(NonNullPassRefPtr<Structure>); - JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength, ArrayCreationMode); - JSArray(JSGlobalData&, NonNullPassRefPtr<Structure>, const ArgList& initialValues); + explicit JSArray(JSGlobalData&, Structure*); + JSArray(JSGlobalData&, Structure*, unsigned initialLength, ArrayCreationMode); + JSArray(JSGlobalData&, Structure*, const ArgList& initialValues); virtual ~JSArray(); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); @@ -124,7 +123,7 @@ namespace JSC { void fillArgList(ExecState*, MarkedArgumentBuffer&); void copyToRegisters(ExecState*, Register*, uint32_t); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/JSByteArray.cpp b/Source/JavaScriptCore/runtime/JSByteArray.cpp index fbaea1d..c2abaee 100644 --- a/Source/JavaScriptCore/runtime/JSByteArray.cpp +++ b/Source/JavaScriptCore/runtime/JSByteArray.cpp @@ -35,8 +35,8 @@ namespace JSC { const ClassInfo JSByteArray::s_defaultInfo = { "ByteArray", &Base::s_info, 0, 0 }; -JSByteArray::JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure> structure, ByteArray* storage) - : JSNonFinalObject(structure) +JSByteArray::JSByteArray(ExecState* exec, Structure* structure, ByteArray* storage) + : JSNonFinalObject(exec->globalData(), structure) , m_storage(storage) { putDirect(exec->globalData(), exec->globalData().propertyNames->length, jsNumber(m_storage->length()), ReadOnly | DontDelete); @@ -50,7 +50,7 @@ JSByteArray::~JSByteArray() #endif -PassRefPtr<Structure> JSByteArray::createStructure(JSGlobalData& globalData, JSValue prototype, const JSC::ClassInfo* classInfo) +Structure* JSByteArray::createStructure(JSGlobalData& globalData, JSValue prototype, const JSC::ClassInfo* classInfo) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, classInfo); } diff --git a/Source/JavaScriptCore/runtime/JSByteArray.h b/Source/JavaScriptCore/runtime/JSByteArray.h index e674958..c481bb4 100644 --- a/Source/JavaScriptCore/runtime/JSByteArray.h +++ b/Source/JavaScriptCore/runtime/JSByteArray.h @@ -75,8 +75,8 @@ namespace JSC { setIndex(i, byteValue); } - JSByteArray(ExecState*, NonNullPassRefPtr<Structure>, WTF::ByteArray* storage); - static PassRefPtr<Structure> createStructure(JSGlobalData&, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo); + JSByteArray(ExecState*, Structure*, WTF::ByteArray* storage); + static Structure* createStructure(JSGlobalData&, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); @@ -100,9 +100,8 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags; private: - enum VPtrStealingHackType { VPtrStealingHack }; JSByteArray(VPtrStealingHackType) - : JSNonFinalObject(Structure::create(Structure::VPtrStealingHack, &s_info)) + : JSNonFinalObject(VPtrStealingHack) { } diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp index ce7fe22..afd8450 100644 --- a/Source/JavaScriptCore/runtime/JSCell.cpp +++ b/Source/JavaScriptCore/runtime/JSCell.cpp @@ -209,4 +209,14 @@ JSObject* JSCell::toObject(ExecState*, JSGlobalObject*) const return 0; } +bool isZombie(const JSCell* cell) +{ +#if ENABLE(JSC_ZOMBIES) + return cell && cell->isZombie(); +#else + UNUSED_PARAM(cell); + return false; +#endif +} + } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index ab0e237..7ee871c 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -24,18 +24,18 @@ #define JSCell_h #include "CallData.h" +#include "CallFrame.h" #include "ConstructData.h" #include "Heap.h" -#include "JSImmediate.h" #include "JSLock.h" -#include "JSValue.h" +#include "JSValueInlineMethods.h" #include "MarkStack.h" -#include "Structure.h" #include <wtf/Noncopyable.h> namespace JSC { class JSGlobalObject; + class Structure; #if COMPILER(MSVC) // If WTF_MAKE_NONCOPYABLE is applied to JSCell we end up with a bunch of @@ -68,17 +68,19 @@ namespace JSC { friend class MarkedSpace; friend class MarkedBlock; friend class ScopeChainNode; + friend class Structure; friend class StructureChain; + protected: + enum VPtrStealingHackType { VPtrStealingHack }; + private: - explicit JSCell(Structure*); + explicit JSCell(VPtrStealingHackType) { } + JSCell(JSGlobalData&, Structure*); virtual ~JSCell(); public: - static PassRefPtr<Structure> createDummyStructure(JSGlobalData& globalData) - { - return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, 0); - } + static Structure* createDummyStructure(JSGlobalData&); // Querying the type. bool isString() const; @@ -122,7 +124,7 @@ namespace JSC { #endif // Object operations, with the toObject operation included. - const ClassInfo* classInfo() const { return m_structure->classInfo(); } + const ClassInfo* classInfo() const; virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual void put(ExecState*, unsigned propertyName, JSValue); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); @@ -144,7 +146,7 @@ namespace JSC { return OBJECT_OFFSETOF(JSCell, m_structure); } - Structure* const * addressOfStructure() const + const void* addressOfStructure() const { return &m_structure; } @@ -157,35 +159,28 @@ namespace JSC { virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); - Structure* m_structure; + WriteBarrier<Structure> m_structure; }; - inline JSCell::JSCell(Structure* structure) - : m_structure(structure) + inline JSCell::JSCell(JSGlobalData& globalData, Structure* structure) + : m_structure(globalData, this, structure) { + // Very first set of allocations won't have a real structure. + ASSERT(m_structure || !globalData.dummyMarkableCellStructure); } inline JSCell::~JSCell() { } - inline bool JSCell::isObject() const - { - return m_structure->typeInfo().type() == ObjectType; - } - - inline bool JSCell::isString() const - { - return m_structure->typeInfo().type() == StringType; - } - inline Structure* JSCell::structure() const { - return m_structure; + return m_structure.get(); } - inline void JSCell::markChildren(MarkStack&) + inline void JSCell::markChildren(MarkStack& markStack) { + markStack.append(&m_structure); } // --- JSValue inlines ---------------------------- @@ -254,14 +249,6 @@ namespace JSC { return false; } -#if USE(JSVALUE64) - ALWAYS_INLINE JSCell* JSValue::asCell() const - { - ASSERT(isCell()); - return m_ptr; - } -#endif // USE(JSVALUE64) - inline JSValue JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const { return isCell() ? asCell()->toPrimitive(exec, preferredType) : asValue(); @@ -321,13 +308,6 @@ namespace JSC { return isUndefined() ? nonInlineNaN() : 0; // null and false both convert to 0. } - inline bool JSValue::needsThisConversion() const - { - if (UNLIKELY(!isCell())) - return true; - return asCell()->structure()->typeInfo().needsThisConversion(); - } - inline JSValue JSValue::getJSNumber() { if (isInt32() || isDouble()) @@ -351,16 +331,6 @@ namespace JSC { { return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec); } - - ALWAYS_INLINE void MarkStack::internalAppend(JSCell* cell) - { - ASSERT(!m_isCheckingForDefaultMarkViolation); - ASSERT(cell); - if (Heap::testAndSetMarked(cell)) - return; - if (cell->structure()->typeInfo().type() >= CompoundType) - m_values.append(cell); - } inline Heap* Heap::heap(JSValue v) { @@ -377,7 +347,7 @@ namespace JSC { #if ENABLE(JSC_ZOMBIES) inline bool JSValue::isZombie() const { - return isCell() && asCell() && asCell()->isZombie(); + return isCell() && asCell() > (JSCell*)0x1ffffffffL && asCell()->isZombie(); } #endif diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp index dbfc606..a18e973 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSFunction.cpp @@ -56,14 +56,12 @@ bool JSFunction::isHostFunctionNonInline() const return isHostFunction(); } -JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure, VPtrHackExecutable* executable) - : Base(structure) +JSFunction::JSFunction(VPtrStealingHackType) + : Base(VPtrStealingHack) { - ASSERT(inherits(&s_info)); - m_executable.setWithoutWriteBarrier(executable); } -JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeExecutable* thunk) +JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& name, NativeExecutable* thunk) : Base(globalObject, structure) , m_executable(exec->globalData(), this, thunk) , m_scopeChain(exec->globalData(), this, globalObject->globalScopeChain()) @@ -73,7 +71,7 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPas putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } -JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) +JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& name, NativeFunction func) : Base(globalObject, structure) , m_scopeChain(exec->globalData(), this, globalObject->globalScopeChain()) { @@ -112,12 +110,12 @@ static void createDescriptorForThrowingProperty(ExecState* exec, PropertyDescrip const UString& JSFunction::name(ExecState* exec) { - return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue(); + return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue(); } const UString JSFunction::displayName(ExecState* exec) { - JSValue displayName = getDirect(exec->globalData().propertyNames->displayName); + JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName); if (displayName && isJSString(&exec->globalData(), displayName)) return asString(displayName)->tryGetValue(); @@ -186,13 +184,13 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN return Base::getOwnPropertySlot(exec, propertyName, slot); if (propertyName == exec->propertyNames().prototype) { - WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName); + WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName); if (!location) { JSObject* prototype = constructEmptyObject(exec, scope()->globalObject->emptyObjectStructure()); prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, this, DontEnum); putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum); - location = getDirectLocation(propertyName); + location = getDirectLocation(exec->globalData(), propertyName); } slot.setValue(this, location->get(), offsetForLocation(location)); diff --git a/Source/JavaScriptCore/runtime/JSFunction.h b/Source/JavaScriptCore/runtime/JSFunction.h index 505b9de..174cd38 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.h +++ b/Source/JavaScriptCore/runtime/JSFunction.h @@ -45,8 +45,8 @@ namespace JSC { typedef JSObjectWithGlobalObject Base; public: - JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction); - JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeExecutable*); + JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeFunction); + JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeExecutable*); JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*); virtual ~JSFunction(); @@ -73,7 +73,7 @@ namespace JSC { static JS_EXPORTDATA const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -87,7 +87,7 @@ namespace JSC { const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags; private: - JSFunction(NonNullPassRefPtr<Structure>, VPtrHackExecutable*); + explicit JSFunction(VPtrStealingHackType); bool isHostFunctionNonInline() const; diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index ee1829b..d9e5df0 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -45,6 +45,7 @@ #include "JSNotAnObject.h" #include "JSPropertyNameIterator.h" #include "JSStaticScopeObject.h" +#include "JSZombie.h" #include "Lexer.h" #include "Lookup.h" #include "Nodes.h" @@ -106,6 +107,15 @@ void* JSGlobalData::jsByteArrayVPtr; void* JSGlobalData::jsStringVPtr; void* JSGlobalData::jsFunctionVPtr; +#if COMPILER(GCC) +// Work around for gcc trying to coalesce our reads of the various cell vptrs +#define CLOBBER_MEMORY() do { \ + asm volatile ("" : : : "memory"); \ +} while (false) +#else +#define CLOBBER_MEMORY() do { } while (false) +#endif + void JSGlobalData::storeVPtrs() { // Enough storage to fit a JSArray, JSByteArray, JSString, or JSFunction. @@ -114,27 +124,23 @@ void JSGlobalData::storeVPtrs() COMPILE_ASSERT(sizeof(JSArray) <= sizeof(storage), sizeof_JSArray_must_be_less_than_storage); JSCell* jsArray = new (storage) JSArray(JSArray::VPtrStealingHack); + CLOBBER_MEMORY(); JSGlobalData::jsArrayVPtr = jsArray->vptr(); - jsArray->~JSCell(); COMPILE_ASSERT(sizeof(JSByteArray) <= sizeof(storage), sizeof_JSByteArray_must_be_less_than_storage); JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack); + CLOBBER_MEMORY(); JSGlobalData::jsByteArrayVPtr = jsByteArray->vptr(); - jsByteArray->~JSCell(); COMPILE_ASSERT(sizeof(JSString) <= sizeof(storage), sizeof_JSString_must_be_less_than_storage); JSCell* jsString = new (storage) JSString(JSString::VPtrStealingHack); + CLOBBER_MEMORY(); JSGlobalData::jsStringVPtr = jsString->vptr(); - jsString->~JSCell(); COMPILE_ASSERT(sizeof(JSFunction) <= sizeof(storage), sizeof_JSFunction_must_be_less_than_storage); - char executableStorage[sizeof(VPtrHackExecutable)]; - RefPtr<Structure> executableStructure = Structure::create(Structure::VPtrStealingHack, 0); - JSCell* executable = new (executableStorage) VPtrHackExecutable(executableStructure.get()); - JSCell* jsFunction = new (storage) JSFunction(Structure::create(Structure::VPtrStealingHack, &JSFunction::s_info), static_cast<VPtrHackExecutable*>(executable)); + JSCell* jsFunction = new (storage) JSFunction(JSCell::VPtrStealingHack); + CLOBBER_MEMORY(); JSGlobalData::jsFunctionVPtr = jsFunction->vptr(); - executable->~JSCell(); - jsFunction->~JSCell(); } JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType) @@ -168,28 +174,39 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread , exclusiveThread(0) #endif { - activationStructure = JSActivation::createStructure(*this, jsNull()); - interruptedExecutionErrorStructure = JSNonFinalObject::createStructure(*this, jsNull()); - terminatedExecutionErrorStructure = JSNonFinalObject::createStructure(*this, jsNull()); - staticScopeStructure = JSStaticScopeObject::createStructure(*this, jsNull()); - strictEvalActivationStructure = StrictEvalActivation::createStructure(*this, jsNull()); - stringStructure = JSString::createStructure(*this, jsNull()); - notAnObjectStructure = JSNotAnObject::createStructure(*this, jsNull()); - propertyNameIteratorStructure = JSPropertyNameIterator::createStructure(*this, jsNull()); - getterSetterStructure = GetterSetter::createStructure(*this, jsNull()); - apiWrapperStructure = JSAPIValueWrapper::createStructure(*this, jsNull()); - scopeChainNodeStructure = ScopeChainNode::createStructure(*this, jsNull()); - executableStructure = ExecutableBase::createStructure(*this, jsNull()); - evalExecutableStructure = EvalExecutable::createStructure(*this, jsNull()); - programExecutableStructure = ProgramExecutable::createStructure(*this, jsNull()); - functionExecutableStructure = FunctionExecutable::createStructure(*this, jsNull()); - dummyMarkableCellStructure = JSCell::createDummyStructure(*this); - structureChainStructure = StructureChain::createStructure(*this, jsNull()); - interpreter = new Interpreter(*this); if (globalDataType == Default) m_stack = wtfThreadData().stack(); + // Need to be careful to keep everything consistent here + IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); + JSLock lock(SilenceAssertionsOnly); + structureStructure.set(*this, Structure::createStructure(*this)); + activationStructure.set(*this, JSActivation::createStructure(*this, jsNull())); + interruptedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull())); + terminatedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull())); + staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, jsNull())); + strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, jsNull())); + stringStructure.set(*this, JSString::createStructure(*this, jsNull())); + notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, jsNull())); + propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, jsNull())); + getterSetterStructure.set(*this, GetterSetter::createStructure(*this, jsNull())); + apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, jsNull())); + scopeChainNodeStructure.set(*this, ScopeChainNode::createStructure(*this, jsNull())); + executableStructure.set(*this, ExecutableBase::createStructure(*this, jsNull())); + nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, jsNull())); + evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, jsNull())); + programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, jsNull())); + functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, jsNull())); + dummyMarkableCellStructure.set(*this, JSCell::createDummyStructure(*this)); + structureChainStructure.set(*this, StructureChain::createStructure(*this, jsNull())); + +#if ENABLE(JSC_ZOMBIES) + zombieStructure.set(*this, JSZombie::createStructure(*this, jsNull())); +#endif + + wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); + #if PLATFORM(MAC) startProfilerServerIfNeeded(); #endif @@ -221,6 +238,33 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread #endif } +void JSGlobalData::clearBuiltinStructures() +{ + structureStructure.clear(); + activationStructure.clear(); + interruptedExecutionErrorStructure.clear(); + terminatedExecutionErrorStructure.clear(); + staticScopeStructure.clear(); + strictEvalActivationStructure.clear(); + stringStructure.clear(); + notAnObjectStructure.clear(); + propertyNameIteratorStructure.clear(); + getterSetterStructure.clear(); + apiWrapperStructure.clear(); + scopeChainNodeStructure.clear(); + executableStructure.clear(); + nativeExecutableStructure.clear(); + evalExecutableStructure.clear(); + programExecutableStructure.clear(); + functionExecutableStructure.clear(); + dummyMarkableCellStructure.clear(); + structureChainStructure.clear(); + +#if ENABLE(JSC_ZOMBIES) + zombieStructure.clear(); +#endif +} + JSGlobalData::~JSGlobalData() { // By the time this is destroyed, heap.destroy() must already have been called. @@ -281,10 +325,7 @@ PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type) PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(ThreadStackType type) { - Structure::startIgnoringLeaks(); - RefPtr<JSGlobalData> data = create(type); - Structure::stopIgnoringLeaks(); - return data.release(); + return create(type); } bool JSGlobalData::sharedInstanceExists() diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index 34ea75d..f1085af 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -33,6 +33,7 @@ #include "Heap.h" #include "DateInstanceCache.h" #include "ExecutableAllocator.h" +#include "Strong.h" #include "JITStubs.h" #include "JSValue.h" #include "NumericStrings.h" @@ -145,23 +146,29 @@ namespace JSC { const HashTable* regExpConstructorTable; const HashTable* stringTable; - RefPtr<Structure> activationStructure; - RefPtr<Structure> interruptedExecutionErrorStructure; - RefPtr<Structure> terminatedExecutionErrorStructure; - RefPtr<Structure> staticScopeStructure; - RefPtr<Structure> strictEvalActivationStructure; - RefPtr<Structure> stringStructure; - RefPtr<Structure> notAnObjectStructure; - RefPtr<Structure> propertyNameIteratorStructure; - RefPtr<Structure> getterSetterStructure; - RefPtr<Structure> apiWrapperStructure; - RefPtr<Structure> scopeChainNodeStructure; - RefPtr<Structure> executableStructure; - RefPtr<Structure> evalExecutableStructure; - RefPtr<Structure> programExecutableStructure; - RefPtr<Structure> functionExecutableStructure; - RefPtr<Structure> dummyMarkableCellStructure; - RefPtr<Structure> structureChainStructure; + Strong<Structure> structureStructure; + Strong<Structure> activationStructure; + Strong<Structure> interruptedExecutionErrorStructure; + Strong<Structure> terminatedExecutionErrorStructure; + Strong<Structure> staticScopeStructure; + Strong<Structure> strictEvalActivationStructure; + Strong<Structure> stringStructure; + Strong<Structure> notAnObjectStructure; + Strong<Structure> propertyNameIteratorStructure; + Strong<Structure> getterSetterStructure; + Strong<Structure> apiWrapperStructure; + Strong<Structure> scopeChainNodeStructure; + Strong<Structure> executableStructure; + Strong<Structure> nativeExecutableStructure; + Strong<Structure> evalExecutableStructure; + Strong<Structure> programExecutableStructure; + Strong<Structure> functionExecutableStructure; + Strong<Structure> dummyMarkableCellStructure; + Strong<Structure> structureChainStructure; + +#if ENABLE(JSC_ZOMBIES) + Strong<Structure> zombieStructure; +#endif static void storeVPtrs(); static JS_EXPORTDATA void* jsArrayVPtr; @@ -260,6 +267,7 @@ namespace JSC { void dumpRegExpTrace(); HandleSlot allocateGlobalHandle() { return heap.allocateGlobalHandle(); } HandleSlot allocateLocalHandle() { return heap.allocateLocalHandle(); } + void clearBuiltinStructures(); private: JSGlobalData(GlobalDataType, ThreadStackType); @@ -271,6 +279,11 @@ namespace JSC { StackBounds m_stack; }; + inline HandleSlot allocateGlobalHandle(JSGlobalData& globalData) + { + return globalData.allocateGlobalHandle(); + } + } // namespace JSC #endif // JSGlobalData_h diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index a2bbfbd..b82949a 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -84,14 +84,6 @@ template <typename T> static inline void markIfNeeded(MarkStack& markStack, Writ markStack.append(v); } -static inline void markIfNeeded(MarkStack& markStack, const RefPtr<Structure>& s) -{ - if (s && s->storedPrototype()) - markStack.append(s->storedPrototypeSlot()); - if (s && *s->cachedPrototypeChainSlot()) - markStack.append(s->cachedPrototypeChainSlot()); -} - JSGlobalObject::~JSGlobalObject() { ASSERT(JSLock::currentThreadIsHoldingLock()); @@ -139,11 +131,11 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper if (symbolTablePutWithAttributes(exec->globalData(), propertyName, value, attributes)) return; - JSValue valueBefore = getDirect(propertyName); + JSValue valueBefore = getDirect(exec->globalData(), propertyName); PutPropertySlot slot; JSVariableObject::put(exec, propertyName, value, slot); if (!valueBefore) { - JSValue valueAfter = getDirect(propertyName); + JSValue valueAfter = getDirect(exec->globalData(), propertyName); if (valueAfter) JSObject::putWithAttributes(exec, propertyName, valueAfter, attributes); } @@ -178,46 +170,46 @@ void JSGlobalObject::reset(JSValue prototype) // Prototypes m_functionPrototype.set(exec->globalData(), this, new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created. - m_functionStructure = JSFunction::createStructure(exec->globalData(), m_functionPrototype.get()); - m_internalFunctionStructure = InternalFunction::createStructure(exec->globalData(), m_functionPrototype.get()); + m_functionStructure.set(exec->globalData(), this, JSFunction::createStructure(exec->globalData(), m_functionPrototype.get())); + m_internalFunctionStructure.set(exec->globalData(), this, InternalFunction::createStructure(exec->globalData(), m_functionPrototype.get())); JSFunction* callFunction = 0; JSFunction* applyFunction = 0; m_functionPrototype->addFunctionProperties(exec, this, m_functionStructure.get(), &callFunction, &applyFunction); m_callFunction.set(exec->globalData(), this, callFunction); m_applyFunction.set(exec->globalData(), this, applyFunction); m_objectPrototype.set(exec->globalData(), this, new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull()), m_functionStructure.get())); - m_functionPrototype->structure()->setPrototypeWithoutTransition(m_objectPrototype.get()); + m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); - m_emptyObjectStructure = m_objectPrototype->inheritorID(exec->globalData()); + m_emptyObjectStructure.set(exec->globalData(), this, m_objectPrototype->inheritorID(exec->globalData())); - m_callbackFunctionStructure = JSCallbackFunction::createStructure(exec->globalData(), m_functionPrototype.get()); - m_argumentsStructure = Arguments::createStructure(exec->globalData(), m_objectPrototype.get()); - m_callbackConstructorStructure = JSCallbackConstructor::createStructure(exec->globalData(), m_objectPrototype.get()); - m_callbackObjectStructure = JSCallbackObject<JSObjectWithGlobalObject>::createStructure(exec->globalData(), m_objectPrototype.get()); + m_callbackFunctionStructure.set(exec->globalData(), this, JSCallbackFunction::createStructure(exec->globalData(), m_functionPrototype.get())); + m_argumentsStructure.set(exec->globalData(), this, Arguments::createStructure(exec->globalData(), m_objectPrototype.get())); + m_callbackConstructorStructure.set(exec->globalData(), this, JSCallbackConstructor::createStructure(exec->globalData(), m_objectPrototype.get())); + m_callbackObjectStructure.set(exec->globalData(), this, JSCallbackObject<JSObjectWithGlobalObject>::createStructure(exec->globalData(), m_objectPrototype.get())); m_arrayPrototype.set(exec->globalData(), this, new (exec) ArrayPrototype(this, ArrayPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); - m_arrayStructure = JSArray::createStructure(exec->globalData(), m_arrayPrototype.get()); - m_regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(exec->globalData(), m_arrayPrototype.get()); + m_arrayStructure.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), m_arrayPrototype.get())); + m_regExpMatchesArrayStructure.set(exec->globalData(), this, RegExpMatchesArray::createStructure(exec->globalData(), m_arrayPrototype.get())); m_stringPrototype.set(exec->globalData(), this, new (exec) StringPrototype(exec, this, StringPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); - m_stringObjectStructure = StringObject::createStructure(exec->globalData(), m_stringPrototype.get()); + m_stringObjectStructure.set(exec->globalData(), this, StringObject::createStructure(exec->globalData(), m_stringPrototype.get())); m_booleanPrototype.set(exec->globalData(), this, new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get())); - m_booleanObjectStructure = BooleanObject::createStructure(exec->globalData(), m_booleanPrototype.get()); + m_booleanObjectStructure.set(exec->globalData(), this, BooleanObject::createStructure(exec->globalData(), m_booleanPrototype.get())); m_numberPrototype.set(exec->globalData(), this, new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get())); - m_numberObjectStructure = NumberObject::createStructure(exec->globalData(), m_numberPrototype.get()); + m_numberObjectStructure.set(exec->globalData(), this, NumberObject::createStructure(exec->globalData(), m_numberPrototype.get())); m_datePrototype.set(exec->globalData(), this, new (exec) DatePrototype(exec, this, DatePrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); - m_dateStructure = DateInstance::createStructure(exec->globalData(), m_datePrototype.get()); + m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get())); m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get())); - m_regExpStructure = RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get()); + m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get())); m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec)); ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()); - m_errorStructure = ErrorInstance::createStructure(exec->globalData(), errorPrototype); + m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), errorPrototype)); // Constructors @@ -233,8 +225,8 @@ void JSGlobalObject::reset(JSValue prototype) m_errorConstructor.set(exec->globalData(), this, new (exec) ErrorConstructor(exec, this, ErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), errorPrototype)); - RefPtr<Structure> nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), errorPrototype); - RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()); + Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), errorPrototype); + Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()); m_evalErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError")); m_rangeErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError")); m_referenceErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError")); @@ -301,18 +293,18 @@ void JSGlobalObject::reset(JSValue prototype) putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum); #endif - resetPrototype(prototype); + resetPrototype(exec->globalData(), prototype); } // Set prototype, and also insert the object prototype at the end of the chain. -void JSGlobalObject::resetPrototype(JSValue prototype) +void JSGlobalObject::resetPrototype(JSGlobalData& globalData, JSValue prototype) { - setPrototype(prototype); + setPrototype(globalData, prototype); JSObject* oldLastInPrototypeChain = lastInPrototypeChain(this); JSObject* objectPrototype = m_objectPrototype.get(); if (oldLastInPrototypeChain != objectPrototype) - oldLastInPrototypeChain->setPrototype(objectPrototype); + oldLastInPrototypeChain->setPrototype(globalData, objectPrototype); } void JSGlobalObject::markChildren(MarkStack& markStack) @@ -344,21 +336,21 @@ void JSGlobalObject::markChildren(MarkStack& markStack) markIfNeeded(markStack, &m_datePrototype); markIfNeeded(markStack, &m_regExpPrototype); - markIfNeeded(markStack, m_argumentsStructure); - markIfNeeded(markStack, m_arrayStructure); - markIfNeeded(markStack, m_booleanObjectStructure); - markIfNeeded(markStack, m_callbackConstructorStructure); - markIfNeeded(markStack, m_callbackFunctionStructure); - markIfNeeded(markStack, m_callbackObjectStructure); - markIfNeeded(markStack, m_dateStructure); - markIfNeeded(markStack, m_emptyObjectStructure); - markIfNeeded(markStack, m_errorStructure); - markIfNeeded(markStack, m_functionStructure); - markIfNeeded(markStack, m_numberObjectStructure); - markIfNeeded(markStack, m_regExpMatchesArrayStructure); - markIfNeeded(markStack, m_regExpStructure); - markIfNeeded(markStack, m_stringObjectStructure); - markIfNeeded(markStack, m_internalFunctionStructure); + markIfNeeded(markStack, &m_argumentsStructure); + markIfNeeded(markStack, &m_arrayStructure); + markIfNeeded(markStack, &m_booleanObjectStructure); + markIfNeeded(markStack, &m_callbackConstructorStructure); + markIfNeeded(markStack, &m_callbackFunctionStructure); + markIfNeeded(markStack, &m_callbackObjectStructure); + markIfNeeded(markStack, &m_dateStructure); + markIfNeeded(markStack, &m_emptyObjectStructure); + markIfNeeded(markStack, &m_errorStructure); + markIfNeeded(markStack, &m_functionStructure); + markIfNeeded(markStack, &m_numberObjectStructure); + markIfNeeded(markStack, &m_regExpMatchesArrayStructure); + markIfNeeded(markStack, &m_regExpStructure); + markIfNeeded(markStack, &m_stringObjectStructure); + markIfNeeded(markStack, &m_internalFunctionStructure); if (m_registerArray) { // Outside the execution of global code, when our variables are torn off, @@ -393,7 +385,7 @@ void JSGlobalObject::copyGlobalsFrom(RegisterFile& registerFile) return; } - OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData(), reinterpret_cast<WriteBarrier<Unknown>*>(registerFile.lastGlobal()), numGlobals); + OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData(), reinterpret_cast<WriteBarrier<Unknown>*>(registerFile.lastGlobal()), numGlobals, numGlobals); WriteBarrier<Unknown>* registers = registerArray.get() + numGlobals; setRegisters(registers, registerArray.release(), numGlobals); } diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index 04f63eb..0e36920 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -87,21 +87,21 @@ namespace JSC { WriteBarrier<DatePrototype> m_datePrototype; WriteBarrier<RegExpPrototype> m_regExpPrototype; - RefPtr<Structure> m_argumentsStructure; - RefPtr<Structure> m_arrayStructure; - RefPtr<Structure> m_booleanObjectStructure; - RefPtr<Structure> m_callbackConstructorStructure; - RefPtr<Structure> m_callbackFunctionStructure; - RefPtr<Structure> m_callbackObjectStructure; - RefPtr<Structure> m_dateStructure; - RefPtr<Structure> m_emptyObjectStructure; - RefPtr<Structure> m_errorStructure; - RefPtr<Structure> m_functionStructure; - RefPtr<Structure> m_numberObjectStructure; - RefPtr<Structure> m_regExpMatchesArrayStructure; - RefPtr<Structure> m_regExpStructure; - RefPtr<Structure> m_stringObjectStructure; - RefPtr<Structure> m_internalFunctionStructure; + WriteBarrier<Structure> m_argumentsStructure; + WriteBarrier<Structure> m_arrayStructure; + WriteBarrier<Structure> m_booleanObjectStructure; + WriteBarrier<Structure> m_callbackConstructorStructure; + WriteBarrier<Structure> m_callbackFunctionStructure; + WriteBarrier<Structure> m_callbackObjectStructure; + WriteBarrier<Structure> m_dateStructure; + WriteBarrier<Structure> m_emptyObjectStructure; + WriteBarrier<Structure> m_errorStructure; + WriteBarrier<Structure> m_functionStructure; + WriteBarrier<Structure> m_numberObjectStructure; + WriteBarrier<Structure> m_regExpMatchesArrayStructure; + WriteBarrier<Structure> m_regExpStructure; + WriteBarrier<Structure> m_stringObjectStructure; + WriteBarrier<Structure> m_internalFunctionStructure; unsigned m_profileGroup; Debugger* m_debugger; @@ -115,7 +115,7 @@ namespace JSC { void* operator new(size_t, JSGlobalData*); explicit JSGlobalObject(JSGlobalData& globalData) - : JSVariableObject(JSGlobalObject::createStructure(globalData, jsNull()), &m_symbolTable, 0) + : JSVariableObject(globalData, JSGlobalObject::createStructure(globalData, jsNull()), &m_symbolTable, 0) , m_registerArraySize(0) , m_globalScopeChain() , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) @@ -125,8 +125,8 @@ namespace JSC { init(this); } - explicit JSGlobalObject(NonNullPassRefPtr<Structure> structure) - : JSVariableObject(structure, &m_symbolTable, 0) + explicit JSGlobalObject(JSGlobalData& globalData, Structure* structure) + : JSVariableObject(globalData, structure, &m_symbolTable, 0) , m_registerArraySize(0) , m_globalScopeChain() , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) @@ -137,8 +137,8 @@ namespace JSC { } protected: - JSGlobalObject(NonNullPassRefPtr<Structure> structure, JSObject* thisValue) - : JSVariableObject(structure, &m_symbolTable, 0) + JSGlobalObject(JSGlobalData& globalData, Structure* structure, JSObject* thisValue) + : JSVariableObject(globalData, structure, &m_symbolTable, 0) , m_registerArraySize(0) , m_globalScopeChain() , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) @@ -235,11 +235,11 @@ namespace JSC { void copyGlobalsTo(RegisterFile&); void resizeRegisters(int oldSize, int newSize); - void resetPrototype(JSValue prototype); + void resetPrototype(JSGlobalData&, JSValue prototype); JSGlobalData& globalData() const { return *m_globalData.get(); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -363,7 +363,7 @@ namespace JSC { // We cache our prototype chain so our clients can share it. if (!isValid(exec, m_cachedPrototypeChain.get())) { JSValue prototype = prototypeForLookup(exec); - m_cachedPrototypeChain = StructureChain::create(exec->globalData(), prototype.isNull() ? 0 : asObject(prototype)->structure()); + m_cachedPrototypeChain.set(exec->globalData(), this, StructureChain::create(exec->globalData(), prototype.isNull() ? 0 : asObject(prototype)->structure())); } return m_cachedPrototypeChain.get(); } @@ -374,9 +374,9 @@ namespace JSC { return false; JSValue prototype = prototypeForLookup(exec); - RefPtr<Structure>* cachedStructure = cachedPrototypeChain->head(); + WriteBarrier<Structure>* cachedStructure = cachedPrototypeChain->head(); while(*cachedStructure && !prototype.isNull()) { - if (asObject(prototype)->structure() != *cachedStructure) + if (asObject(prototype)->structure() != cachedStructure->get()) return false; ++cachedStructure; prototype = asObject(prototype)->prototype(); @@ -407,17 +407,17 @@ namespace JSC { inline JSArray* constructEmptyArray(ExecState* exec) { - return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure()); + return new (exec) JSArray(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure()); } inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject) { - return new (exec) JSArray(globalObject->arrayStructure()); + return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure()); } inline JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength) { - return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength, CreateInitialized); + return new (exec) JSArray(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure(), initialLength, CreateInitialized); } inline JSArray* constructArray(ExecState* exec, JSValue singleItemValue) diff --git a/Source/JavaScriptCore/runtime/JSImmediate.cpp b/Source/JavaScriptCore/runtime/JSImmediate.cpp deleted file mode 100644 index 846238d..0000000 --- a/Source/JavaScriptCore/runtime/JSImmediate.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2003-2006, 2008 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "JSImmediate.h" - -namespace JSC { - -} // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSImmediate.h b/Source/JavaScriptCore/runtime/JSImmediate.h deleted file mode 100644 index 68ba75c..0000000 --- a/Source/JavaScriptCore/runtime/JSImmediate.h +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef JSImmediate_h -#define JSImmediate_h - -#if USE(JSVALUE64) - -#include <wtf/Assertions.h> -#include <wtf/AlwaysInline.h> -#include <wtf/MathExtras.h> -#include <wtf/StdLibExtras.h> -#include "JSValue.h" -#include <limits> -#include <limits.h> -#include <stdarg.h> -#include <stdint.h> -#include <stdlib.h> - -namespace JSC { - - class ExecState; - class JSCell; - class JSGlobalData; - class JSObject; - class UString; - - inline intptr_t reinterpretDoubleToIntptr(double value) - { - return WTF::bitwise_cast<intptr_t>(value); - } - - inline double reinterpretIntptrToDouble(intptr_t value) - { - return WTF::bitwise_cast<double>(value); - } - - /* - * A JSValue* is either a pointer to a cell (a heap-allocated object) or an immediate (a type-tagged - * value masquerading as a pointer). The low two bits in a JSValue* are available for type tagging - * because allocator alignment guarantees they will be 00 in cell pointers. - * - * For example, on a 32 bit system: - * - * JSCell*: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 00 - * [ high 30 bits: pointer address ] [ low 2 bits -- always 0 ] - * JSImmediate: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX TT - * [ high 30 bits: 'payload' ] [ low 2 bits -- tag ] - * - * Where the bottom two bits are non-zero they either indicate that the immediate is a 31 bit signed - * integer, or they mark the value as being an immediate of a type other than integer, with a secondary - * tag used to indicate the exact type. - * - * Where the lowest bit is set (TT is equal to 01 or 11) the high 31 bits form a 31 bit signed int value. - * Where TT is equal to 10 this indicates this is a type of immediate other than an integer, and the next - * two bits will form an extended tag. - * - * 31 bit signed int: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X1 - * [ high 30 bits of the value ] [ high bit part of value ] - * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY ZZ 10 - * [ extended 'payload' ] [ extended tag ] [ tag 'other' ] - * - * Where the first bit of the extended tag is set this flags the value as being a boolean, and the following - * bit would flag the value as undefined. If neither bits are set, the value is null. - * - * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY UB 10 - * [ extended 'payload' ] [ undefined | bool ] [ tag 'other' ] - * - * For boolean value the lowest bit in the payload holds the value of the bool, all remaining bits are zero. - * For undefined or null immediates the payload is zero. - * - * Boolean: 000000000000000000000000000V 01 10 - * [ boolean value ] [ bool ] [ tag 'other' ] - * Undefined: 0000000000000000000000000000 10 10 - * [ zero ] [ undefined ] [ tag 'other' ] - * Null: 0000000000000000000000000000 00 10 - * [ zero ] [ zero ] [ tag 'other' ] - */ - - /* - * On 64-bit platforms, we support an alternative encoding form for immediates, if - * USE(JSVALUE64) is defined. When this format is used, double precision - * floating point values may also be encoded as JSImmediates. - * - * The encoding makes use of unused NaN space in the IEEE754 representation. Any value - * with the top 13 bits set represents a QNaN (with the sign bit set). QNaN values - * can encode a 51-bit payload. Hardware produced and C-library payloads typically - * have a payload of zero. We assume that non-zero payloads are available to encode - * pointer and integer values. Since any 64-bit bit pattern where the top 15 bits are - * all set represents a NaN with a non-zero payload, we can use this space in the NaN - * ranges to encode other values (however there are also other ranges of NaN space that - * could have been selected). This range of NaN space is represented by 64-bit numbers - * begining with the 16-bit hex patterns 0xFFFE and 0xFFFF - we rely on the fact that no - * valid double-precision numbers will begin fall in these ranges. - * - * The scheme we have implemented encodes double precision values by adding 2^48 to the - * 64-bit integer representation of the number. After this manipulation, no encoded - * double-precision value will begin with the pattern 0x0000 or 0xFFFF. - * - * The top 16-bits denote the type of the encoded JSImmediate: - * - * Pointer: 0000:PPPP:PPPP:PPPP - * 0001:****:****:**** - * Double:{ ... - * FFFE:****:****:**** - * Integer: FFFF:0000:IIII:IIII - * - * 32-bit signed integers are marked with the 16-bit tag 0xFFFF. The tag 0x0000 - * denotes a pointer, or another form of tagged immediate. Boolean, null and undefined - * values are encoded in the same manner as the default format. - */ - - class JSImmediate { - private: - friend class JIT; - friend class JSValue; - friend class JSInterfaceJIT; - friend class SpecializedThunkJIT; - friend JSValue jsNumber(ExecState* exec, double d); - friend JSValue jsNumber(ExecState*, char i); - friend JSValue jsNumber(ExecState*, unsigned char i); - friend JSValue jsNumber(ExecState*, short i); - friend JSValue jsNumber(ExecState*, unsigned short i); - friend JSValue jsNumber(ExecState* exec, int i); - friend JSValue jsNumber(ExecState* exec, unsigned i); - friend JSValue jsNumber(ExecState* exec, long i); - friend JSValue jsNumber(ExecState* exec, unsigned long i); - friend JSValue jsNumber(ExecState* exec, long long i); - friend JSValue jsNumber(ExecState* exec, unsigned long long i); - friend JSValue jsNumber(JSGlobalData* globalData, double d); - friend JSValue jsNumber(JSGlobalData* globalData, short i); - friend JSValue jsNumber(JSGlobalData* globalData, unsigned short i); - friend JSValue jsNumber(JSGlobalData* globalData, int i); - friend JSValue jsNumber(JSGlobalData* globalData, unsigned i); - friend JSValue jsNumber(JSGlobalData* globalData, long i); - friend JSValue jsNumber(JSGlobalData* globalData, unsigned long i); - friend JSValue jsNumber(JSGlobalData* globalData, long long i); - friend JSValue jsNumber(JSGlobalData* globalData, unsigned long long i); - - // If all bits in the mask are set, this indicates an integer number, - // if any but not all are set this value is a double precision number. - static const intptr_t TagTypeNumber = 0xffff000000000000ll; - // This value is 2^48, used to encode doubles such that the encoded value will begin - // with a 16-bit pattern within the range 0x0001..0xFFFE. - static const intptr_t DoubleEncodeOffset = 0x1000000000000ll; - static const intptr_t TagBitTypeOther = 0x2; // second bit set indicates immediate other than an integer - static const intptr_t TagMask = TagTypeNumber | TagBitTypeOther; - - static const intptr_t ExtendedTagMask = 0xC; // extended tag holds a further two bits - static const intptr_t ExtendedTagBitBool = 0x4; - static const intptr_t ExtendedTagBitUndefined = 0x8; - - static const intptr_t FullTagTypeMask = TagMask | ExtendedTagMask; - static const intptr_t FullTagTypeBool = TagBitTypeOther | ExtendedTagBitBool; - static const intptr_t FullTagTypeUndefined = TagBitTypeOther | ExtendedTagBitUndefined; - static const intptr_t FullTagTypeNull = TagBitTypeOther; - - static const int32_t IntegerPayloadShift = 0; - static const int32_t ExtendedPayloadShift = 4; - - static const intptr_t ExtendedPayloadBitBoolValue = 1 << ExtendedPayloadShift; - - static const int32_t signBit = 0x80000000; - - static ALWAYS_INLINE bool isImmediate(JSValue v) - { - return rawValue(v) & TagMask; - } - - static ALWAYS_INLINE bool isNumber(JSValue v) - { - return rawValue(v) & TagTypeNumber; - } - - static ALWAYS_INLINE bool isIntegerNumber(JSValue v) - { - return (rawValue(v) & TagTypeNumber) == TagTypeNumber; - } - - static ALWAYS_INLINE bool isDouble(JSValue v) - { - return isNumber(v) && !isIntegerNumber(v); - } - - static ALWAYS_INLINE bool isPositiveIntegerNumber(JSValue v) - { - // A single mask to check for the sign bit and the number tag all at once. - return (rawValue(v) & (signBit | TagTypeNumber)) == TagTypeNumber; - } - - static ALWAYS_INLINE bool isBoolean(JSValue v) - { - return (rawValue(v) & FullTagTypeMask) == FullTagTypeBool; - } - - static ALWAYS_INLINE bool isUndefinedOrNull(JSValue v) - { - // Undefined and null share the same value, bar the 'undefined' bit in the extended tag. - return (rawValue(v) & ~ExtendedTagBitUndefined) == FullTagTypeNull; - } - - static JSValue from(char); - static JSValue from(signed char); - static JSValue from(unsigned char); - static JSValue from(short); - static JSValue from(unsigned short); - static JSValue from(int); - static JSValue from(unsigned); - static JSValue from(long); - static JSValue from(unsigned long); - static JSValue from(long long); - static JSValue from(unsigned long long); - static JSValue from(double); - - static ALWAYS_INLINE bool isEitherImmediate(JSValue v1, JSValue v2) - { - return (rawValue(v1) | rawValue(v2)) & TagMask; - } - - static ALWAYS_INLINE bool areBothImmediate(JSValue v1, JSValue v2) - { - return isImmediate(v1) & isImmediate(v2); - } - - static ALWAYS_INLINE bool areBothImmediateIntegerNumbers(JSValue v1, JSValue v2) - { - return (rawValue(v1) & rawValue(v2) & TagTypeNumber) == TagTypeNumber; - } - - static double toDouble(JSValue); - static bool toBoolean(JSValue); - - static bool getUInt32(JSValue, uint32_t&); - static bool getTruncatedInt32(JSValue, int32_t&); - static bool getTruncatedUInt32(JSValue, uint32_t&); - - static int32_t getTruncatedInt32(JSValue); - static uint32_t getTruncatedUInt32(JSValue); - - static JSValue trueImmediate(); - static JSValue falseImmediate(); - static JSValue undefinedImmediate(); - static JSValue nullImmediate(); - static JSValue zeroImmediate(); - static JSValue oneImmediate(); - - private: - static const int minImmediateInt = ((-INT_MAX) - 1); - static const int maxImmediateInt = INT_MAX; - static const unsigned maxImmediateUInt = maxImmediateInt; - - static ALWAYS_INLINE JSValue makeValue(intptr_t integer) - { - return JSValue::makeImmediate(integer); - } - - // With USE(JSVALUE64) we want the argument to be zero extended, so the - // integer doesn't interfere with the tag bits in the upper word. In the default encoding, - // if intptr_t id larger then int32_t we sign extend the value through the upper word. - static ALWAYS_INLINE JSValue makeInt(uint32_t value) - { - return makeValue((static_cast<intptr_t>(value) << IntegerPayloadShift) | TagTypeNumber); - } - - static ALWAYS_INLINE JSValue makeDouble(double value) - { - return makeValue(reinterpretDoubleToIntptr(value) + DoubleEncodeOffset); - } - - static ALWAYS_INLINE JSValue makeBool(bool b) - { - return makeValue((static_cast<intptr_t>(b) << ExtendedPayloadShift) | FullTagTypeBool); - } - - static ALWAYS_INLINE JSValue makeUndefined() - { - return makeValue(FullTagTypeUndefined); - } - - static ALWAYS_INLINE JSValue makeNull() - { - return makeValue(FullTagTypeNull); - } - - template<typename T> - static JSValue fromNumberOutsideIntegerRange(T); - - static ALWAYS_INLINE double doubleValue(JSValue v) - { - return reinterpretIntptrToDouble(rawValue(v) - DoubleEncodeOffset); - } - - static ALWAYS_INLINE int32_t intValue(JSValue v) - { - return static_cast<int32_t>(rawValue(v) >> IntegerPayloadShift); - } - - static ALWAYS_INLINE uint32_t uintValue(JSValue v) - { - return static_cast<uint32_t>(rawValue(v) >> IntegerPayloadShift); - } - - static ALWAYS_INLINE bool boolValue(JSValue v) - { - return rawValue(v) & ExtendedPayloadBitBoolValue; - } - - static ALWAYS_INLINE intptr_t rawValue(JSValue v) - { - return v.immediateValue(); - } - }; - - ALWAYS_INLINE JSValue JSImmediate::trueImmediate() { return makeBool(true); } - ALWAYS_INLINE JSValue JSImmediate::falseImmediate() { return makeBool(false); } - ALWAYS_INLINE JSValue JSImmediate::undefinedImmediate() { return makeUndefined(); } - ALWAYS_INLINE JSValue JSImmediate::nullImmediate() { return makeNull(); } - ALWAYS_INLINE JSValue JSImmediate::zeroImmediate() { return makeInt(0); } - ALWAYS_INLINE JSValue JSImmediate::oneImmediate() { return makeInt(1); } - - inline bool doubleToBoolean(double value) - { - return value < 0.0 || value > 0.0; - } - - ALWAYS_INLINE bool JSImmediate::toBoolean(JSValue v) - { - ASSERT(isImmediate(v)); - return isNumber(v) ? isIntegerNumber(v) ? v != zeroImmediate() - : doubleToBoolean(doubleValue(v)) : v == trueImmediate(); - } - - ALWAYS_INLINE uint32_t JSImmediate::getTruncatedUInt32(JSValue v) - { - // FIXME: should probably be asserting isPositiveIntegerNumber here. - ASSERT(isIntegerNumber(v)); - return intValue(v); - } - - template<typename T> - inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T value) - { - return makeDouble(static_cast<double>(value)); - } - - ALWAYS_INLINE JSValue JSImmediate::from(char i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(signed char i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(unsigned char i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(short i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(unsigned short i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(int i) - { - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(unsigned i) - { - if (i > maxImmediateUInt) - return fromNumberOutsideIntegerRange(i); - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(long i) - { - if ((i < minImmediateInt) | (i > maxImmediateInt)) - return fromNumberOutsideIntegerRange(i); - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(unsigned long i) - { - if (i > maxImmediateUInt) - return fromNumberOutsideIntegerRange(i); - return makeInt(i); - } - - ALWAYS_INLINE JSValue JSImmediate::from(long long i) - { - if ((i < minImmediateInt) | (i > maxImmediateInt)) - return JSValue(); - return makeInt(static_cast<intptr_t>(i)); - } - - ALWAYS_INLINE JSValue JSImmediate::from(unsigned long long i) - { - if (i > maxImmediateUInt) - return fromNumberOutsideIntegerRange(i); - return makeInt(static_cast<intptr_t>(i)); - } - - ALWAYS_INLINE JSValue JSImmediate::from(double d) - { - const int intVal = static_cast<int>(d); - - // Check for data loss from conversion to int. - if (intVal != d || (!intVal && signbit(d))) - return fromNumberOutsideIntegerRange(d); - - return from(intVal); - } - - ALWAYS_INLINE int32_t JSImmediate::getTruncatedInt32(JSValue v) - { - ASSERT(isIntegerNumber(v)); - return intValue(v); - } - - ALWAYS_INLINE double JSImmediate::toDouble(JSValue v) - { - ASSERT(isImmediate(v)); - - if (isIntegerNumber(v)) - return intValue(v); - - if (isNumber(v)) { - ASSERT(isDouble(v)); - return doubleValue(v); - } - - if (rawValue(v) == FullTagTypeUndefined) - return nonInlineNaN(); - - ASSERT(JSImmediate::isBoolean(v) || (v == JSImmediate::nullImmediate())); - return rawValue(v) >> ExtendedPayloadShift; - } - - ALWAYS_INLINE bool JSImmediate::getUInt32(JSValue v, uint32_t& i) - { - i = uintValue(v); - return isPositiveIntegerNumber(v); - } - - ALWAYS_INLINE bool JSImmediate::getTruncatedInt32(JSValue v, int32_t& i) - { - i = intValue(v); - return isIntegerNumber(v); - } - - ALWAYS_INLINE bool JSImmediate::getTruncatedUInt32(JSValue v, uint32_t& i) - { - return getUInt32(v, i); - } - - inline JSValue::JSValue(JSNullTag) - { - *this = JSImmediate::nullImmediate(); - } - - inline JSValue::JSValue(JSUndefinedTag) - { - *this = JSImmediate::undefinedImmediate(); - } - - inline JSValue::JSValue(JSTrueTag) - { - *this = JSImmediate::trueImmediate(); - } - - inline JSValue::JSValue(JSFalseTag) - { - *this = JSImmediate::falseImmediate(); - } - - inline bool JSValue::isUndefinedOrNull() const - { - return JSImmediate::isUndefinedOrNull(asValue()); - } - - inline bool JSValue::isBoolean() const - { - return JSImmediate::isBoolean(asValue()); - } - - inline bool JSValue::isTrue() const - { - return asValue() == JSImmediate::trueImmediate(); - } - - inline bool JSValue::isFalse() const - { - return asValue() == JSImmediate::falseImmediate(); - } - - inline bool JSValue::getBoolean(bool& v) const - { - if (JSImmediate::isBoolean(asValue())) { - v = JSImmediate::toBoolean(asValue()); - return true; - } - - return false; - } - - inline bool JSValue::getBoolean() const - { - return asValue() == jsBoolean(true); - } - - inline bool JSValue::isCell() const - { - return !JSImmediate::isImmediate(asValue()); - } - - inline bool JSValue::isInt32() const - { - return JSImmediate::isIntegerNumber(asValue()); - } - - inline int32_t JSValue::asInt32() const - { - ASSERT(isInt32()); - return JSImmediate::getTruncatedInt32(asValue()); - } - - inline bool JSValue::isUInt32() const - { - return JSImmediate::isPositiveIntegerNumber(asValue()); - } - - inline uint32_t JSValue::asUInt32() const - { - ASSERT(isUInt32()); - return JSImmediate::getTruncatedUInt32(asValue()); - } - -} // namespace JSC - -#endif // USE(JSVALUE64) - -#endif // JSImmediate_h diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.h b/Source/JavaScriptCore/runtime/JSNotAnObject.h index 75bca18..4c6806a 100644 --- a/Source/JavaScriptCore/runtime/JSNotAnObject.h +++ b/Source/JavaScriptCore/runtime/JSNotAnObject.h @@ -39,11 +39,11 @@ namespace JSC { class JSNotAnObject : public JSNonFinalObject { public: JSNotAnObject(ExecState* exec) - : JSNonFinalObject(exec->globalData().notAnObjectStructure) + : JSNonFinalObject(exec->globalData(), exec->globalData().notAnObjectStructure.get()) { } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/JSNumberCell.h b/Source/JavaScriptCore/runtime/JSNumberCell.h deleted file mode 100644 index 1ccdf50..0000000 --- a/Source/JavaScriptCore/runtime/JSNumberCell.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2004, 2005, 2007, 2008 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef JSNumberCell_h -#define JSNumberCell_h - -#include "CallFrame.h" -#include "JSCell.h" -#include "JSImmediate.h" -#include "Heap.h" -#include "UString.h" -#include <stddef.h> // for size_t - -namespace JSC { - - extern const double NaN; - extern const double Inf; - -#if USE(JSVALUE64) - ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) - { - *this = JSImmediate::fromNumberOutsideIntegerRange(d); - } - - inline JSValue::JSValue(double d) - { - JSValue v = JSImmediate::from(d); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(int i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(unsigned i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(long i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(unsigned long i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(long long i) - { - JSValue v = JSImmediate::from(static_cast<double>(i)); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(unsigned long long i) - { - JSValue v = JSImmediate::from(static_cast<double>(i)); - ASSERT(v); - *this = v; - } - - inline bool JSValue::isDouble() const - { - return JSImmediate::isDouble(asValue()); - } - - inline double JSValue::asDouble() const - { - return JSImmediate::doubleValue(asValue()); - } - - inline bool JSValue::isNumber() const - { - return JSImmediate::isNumber(asValue()); - } - - inline double JSValue::uncheckedGetNumber() const - { - ASSERT(isNumber()); - return JSImmediate::toDouble(asValue()); - } - -#endif // USE(JSVALUE64) - -#if USE(JSVALUE64) - - inline JSValue::JSValue(char i) - { - ASSERT(JSImmediate::from(i)); - *this = JSImmediate::from(i); - } - - inline JSValue::JSValue(unsigned char i) - { - ASSERT(JSImmediate::from(i)); - *this = JSImmediate::from(i); - } - - inline JSValue::JSValue(short i) - { - ASSERT(JSImmediate::from(i)); - *this = JSImmediate::from(i); - } - - inline JSValue::JSValue(unsigned short i) - { - ASSERT(JSImmediate::from(i)); - *this = JSImmediate::from(i); - } - - inline JSValue jsNaN() - { - return jsNumber(NaN); - } - - // --- JSValue inlines ---------------------------- - - ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const - { - return isNumber() ? asValue() : jsNumber(this->toNumber(exec)); - } - - inline bool JSValue::getNumber(double &result) const - { - if (isInt32()) - result = asInt32(); - else if (LIKELY(isDouble())) - result = asDouble(); - else { - ASSERT(!isNumber()); - return false; - } - return true; - } - -#endif // USE(JSVALUE64) - -} // namespace JSC - -#endif // JSNumberCell_h diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp index 8fc7ac9..27fc569 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.cpp +++ b/Source/JavaScriptCore/runtime/JSONObject.cpp @@ -53,7 +53,7 @@ static EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*); namespace JSC { -JSONObject::JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) +JSONObject::JSONObject(JSGlobalObject* globalObject, Structure* structure) : JSObjectWithGlobalObject(globalObject, structure) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/JSONObject.h b/Source/JavaScriptCore/runtime/JSONObject.h index a52c543..c87c641 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.h +++ b/Source/JavaScriptCore/runtime/JSONObject.h @@ -34,9 +34,9 @@ namespace JSC { class JSONObject : public JSObjectWithGlobalObject { public: - JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure); + JSONObject(JSGlobalObject*, Structure*); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index b307540..9677f23 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -109,7 +109,7 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla. if (!value.isObject() && !value.isNull()) return; - if (!setPrototypeWithCycleCheck(value)) + if (!setPrototypeWithCycleCheck(exec->globalData(), value)) throwError(exec, createError(exec, "cyclic __proto__ value")); return; } @@ -127,14 +127,14 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu unsigned attributes; JSCell* specificValue; - if ((m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) { + if ((m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) { if (slot.isStrictMode()) throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError)); return; } for (JSObject* obj = this; ; obj = asObject(prototype)) { - if (JSValue gs = obj->getDirect(propertyName)) { + if (JSValue gs = obj->getDirect(exec->globalData(), propertyName)) { if (gs.isGetterSetter()) { JSObject* setterFunc = asGetterSetter(gs)->setter(); if (!setterFunc) { @@ -218,10 +218,10 @@ bool JSObject::deleteProperty(ExecState* exec, const Identifier& propertyName) { unsigned attributes; JSCell* specificValue; - if (m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) { + if (m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) { if ((attributes & DontDelete)) return false; - removeDirect(propertyName); + removeDirect(exec->globalData(), propertyName); return true; } @@ -312,34 +312,33 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { - JSValue object = getDirect(propertyName); + JSValue object = getDirect(exec->globalData(), propertyName); if (object && object.isGetterSetter()) { ASSERT(m_structure->hasGetterSetterProperties()); asGetterSetter(object)->setGetter(exec->globalData(), getterFunction); return; } + JSGlobalData& globalData = exec->globalData(); PutPropertySlot slot; GetterSetter* getterSetter = new (exec) GetterSetter(exec); - putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Getter, true, slot); + putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot); // putDirect will change our Structure if we add a new property. For // getters and setters, though, we also need to change our Structure // if we override an existing non-getter or non-setter. if (slot.type() != PutPropertySlot::NewProperty) { - if (!m_structure->isDictionary()) { - RefPtr<Structure> structure = Structure::getterSetterTransition(m_structure); - setStructure(structure.release()); - } + if (!m_structure->isDictionary()) + setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, m_structure.get())); } m_structure->setHasGetterSetterProperties(true); - getterSetter->setGetter(exec->globalData(), getterFunction); + getterSetter->setGetter(globalData, getterFunction); } void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { - JSValue object = getDirect(propertyName); + JSValue object = getDirect(exec->globalData(), propertyName); if (object && object.isGetterSetter()) { ASSERT(m_structure->hasGetterSetterProperties()); asGetterSetter(object)->setSetter(exec->globalData(), setterFunction); @@ -354,21 +353,19 @@ void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSO // getters and setters, though, we also need to change our Structure // if we override an existing non-getter or non-setter. if (slot.type() != PutPropertySlot::NewProperty) { - if (!m_structure->isDictionary()) { - RefPtr<Structure> structure = Structure::getterSetterTransition(m_structure); - setStructure(structure.release()); - } + if (!m_structure->isDictionary()) + setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), m_structure.get())); } m_structure->setHasGetterSetterProperties(true); getterSetter->setSetter(exec->globalData(), setterFunction); } -JSValue JSObject::lookupGetter(ExecState*, const Identifier& propertyName) +JSValue JSObject::lookupGetter(ExecState* exec, const Identifier& propertyName) { JSObject* object = this; while (true) { - if (JSValue value = object->getDirect(propertyName)) { + if (JSValue value = object->getDirect(exec->globalData(), propertyName)) { if (!value.isGetterSetter()) return jsUndefined(); JSObject* functionObject = asGetterSetter(value)->getter(); @@ -383,11 +380,11 @@ JSValue JSObject::lookupGetter(ExecState*, const Identifier& propertyName) } } -JSValue JSObject::lookupSetter(ExecState*, const Identifier& propertyName) +JSValue JSObject::lookupSetter(ExecState* exec, const Identifier& propertyName) { JSObject* object = this; while (true) { - if (JSValue value = object->getDirect(propertyName)) { + if (JSValue value = object->getDirect(exec->globalData(), propertyName)) { if (!value.isGetterSetter()) return jsUndefined(); JSObject* functionObject = asGetterSetter(value)->setter(); @@ -428,10 +425,10 @@ bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyN return descriptor.enumerable(); } -bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyName, JSCell*& specificValue) const +bool JSObject::getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificValue) const { unsigned attributes; - if (m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) + if (m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) return true; // This could be a function within the static table? - should probably @@ -464,7 +461,7 @@ void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyName void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { - m_structure->getPropertyNames(propertyNames, mode); + m_structure->getPropertyNames(exec->globalData(), propertyNames, mode); getClassPropertyNames(exec, classInfo(), propertyNames, mode); } @@ -509,34 +506,33 @@ JSObject* JSObject::unwrappedObject() return this; } -void JSObject::seal() +void JSObject::seal(JSGlobalData& globalData) { - setStructure(Structure::sealTransition(m_structure)); + setStructure(globalData, Structure::sealTransition(globalData, m_structure.get())); } -void JSObject::freeze() +void JSObject::freeze(JSGlobalData& globalData) { - setStructure(Structure::freezeTransition(m_structure)); + setStructure(globalData, Structure::freezeTransition(globalData, m_structure.get())); } -void JSObject::preventExtensions() +void JSObject::preventExtensions(JSGlobalData& globalData) { if (isExtensible()) - setStructure(Structure::preventExtensionsTransition(m_structure)); + setStructure(globalData, Structure::preventExtensionsTransition(globalData, m_structure.get())); } -void JSObject::removeDirect(const Identifier& propertyName) +void JSObject::removeDirect(JSGlobalData& globalData, const Identifier& propertyName) { size_t offset; if (m_structure->isUncacheableDictionary()) { - offset = m_structure->removePropertyWithoutTransition(propertyName); + offset = m_structure->removePropertyWithoutTransition(globalData, propertyName); if (offset != WTF::notFound) putUndefinedAtDirectOffset(offset); return; } - RefPtr<Structure> structure = Structure::removePropertyTransition(m_structure, propertyName, offset); - setStructure(structure.release()); + setStructure(globalData, Structure::removePropertyTransition(globalData, m_structure.get(), propertyName, offset)); if (offset != WTF::notFound) putUndefinedAtDirectOffset(offset); } @@ -574,7 +570,8 @@ NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarr Structure* JSObject::createInheritorID(JSGlobalData& globalData) { - m_inheritorID = createEmptyObjectStructure(globalData, this); + m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, this)); + ASSERT(m_inheritorID->isEmpty()); return m_inheritorID.get(); } @@ -598,11 +595,11 @@ void JSObject::allocatePropertyStorage(size_t oldSize, size_t newSize) m_propertyStorage = newPropertyStorage; } -bool JSObject::getOwnPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { unsigned attributes = 0; JSCell* cell = 0; - size_t offset = m_structure->get(propertyName, attributes, cell); + size_t offset = m_structure->get(exec->globalData(), propertyName, attributes, cell); if (offset == WTF::notFound) return false; descriptor.setDescriptor(getDirectOffset(offset), attributes); @@ -754,7 +751,7 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName return false; } } - JSValue accessor = getDirect(propertyName); + JSValue accessor = getDirect(exec->globalData(), propertyName); if (!accessor) return false; GetterSetter* getterSetter = asGetterSetter(accessor); diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index 578b3cf..80735f8 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -29,7 +29,6 @@ #include "Completion.h" #include "CallFrame.h" #include "JSCell.h" -#include "JSNumberCell.h" #include "MarkStack.h" #include "PropertySlot.h" #include "PutPropertySlot.h" @@ -88,10 +87,10 @@ namespace JSC { virtual ~JSObject(); JSValue prototype() const; - void setPrototype(JSValue prototype); - bool setPrototypeWithCycleCheck(JSValue prototype); + void setPrototype(JSGlobalData&, JSValue prototype); + bool setPrototypeWithCycleCheck(JSGlobalData&, JSValue prototype); - void setStructure(NonNullPassRefPtr<Structure>); + void setStructure(JSGlobalData&, Structure*); Structure* inheritorID(JSGlobalData&); virtual UString className() const; @@ -147,22 +146,22 @@ namespace JSC { bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const; // This get function only looks at the property map. - JSValue getDirect(const Identifier& propertyName) const + JSValue getDirect(JSGlobalData& globalData, const Identifier& propertyName) const { - size_t offset = m_structure->get(propertyName); + size_t offset = m_structure->get(globalData, propertyName); return offset != WTF::notFound ? getDirectOffset(offset) : JSValue(); } - WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName) { - size_t offset = m_structure->get(propertyName); + size_t offset = m_structure->get(globalData, propertyName); return offset != WTF::notFound ? locationForOffset(offset) : 0; } - WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName, unsigned& attributes) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes) { JSCell* specificFunction; - size_t offset = m_structure->get(propertyName, attributes, specificFunction); + size_t offset = m_structure->get(globalData, propertyName, attributes, specificFunction); return offset != WTF::notFound ? locationForOffset(offset) : 0; } @@ -171,9 +170,9 @@ namespace JSC { return location - propertyStorage(); } - void transitionTo(Structure*); + void transitionTo(JSGlobalData&, Structure*); - void removeDirect(const Identifier& propertyName); + void removeDirect(JSGlobalData&, const Identifier& propertyName); bool hasCustomProperties() { return !m_structure->isEmpty(); } bool hasGetterSetterProperties() { return m_structure->hasGetterSetterProperties(); } @@ -210,17 +209,17 @@ namespace JSC { virtual bool isStrictModeFunction() const { return false; } virtual bool isErrorInstance() const { return false; } - void seal(); - void freeze(); - void preventExtensions(); - bool isSealed() { return m_structure->isSealed(); } - bool isFrozen() { return m_structure->isFrozen(); } + void seal(JSGlobalData&); + void freeze(JSGlobalData&); + void preventExtensions(JSGlobalData&); + bool isSealed(JSGlobalData& globalData) { return m_structure->isSealed(globalData); } + bool isFrozen(JSGlobalData& globalData) { return m_structure->isFrozen(globalData); } bool isExtensible() { return m_structure->isExtensible(); } virtual ComplType exceptionType() const { return Throw; } void allocatePropertyStorage(size_t oldSize, size_t newSize); - bool isUsingInlineStorage() const { return m_structure->isUsingInlineStorage(); } + bool isUsingInlineStorage() const { return static_cast<const void*>(m_propertyStorage) == static_cast<const void*>(this + 1); } static const unsigned baseExternalStorageCapacity = 16; @@ -250,7 +249,7 @@ namespace JSC { static JS_EXPORTDATA const ClassInfo s_info; protected: - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -264,7 +263,12 @@ namespace JSC { // To instantiate objects you likely want JSFinalObject, below. // To create derived types you likely want JSNonFinalObject, below. - JSObject(NonNullPassRefPtr<Structure>, PropertyStorage inlineStorage); + JSObject(JSGlobalData&, Structure*, PropertyStorage inlineStorage); + JSObject(VPtrStealingHackType, PropertyStorage inlineStorage) + : JSCell(VPtrStealingHack) + , m_propertyStorage(inlineStorage) + { + } private: // Nobody should ever ask any of these questions on something already known to be a JSObject. @@ -299,7 +303,7 @@ namespace JSC { Structure* createInheritorID(JSGlobalData&); PropertyStorage m_propertyStorage; - RefPtr<Structure> m_inheritorID; + WriteBarrier<Structure> m_inheritorID; }; @@ -320,14 +324,19 @@ COMPILE_ASSERT((JSFinalObject_inlineStorageCapacity >= JSNonFinalObject_inlineSt friend class JSObject; public: - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: - explicit JSNonFinalObject(NonNullPassRefPtr<Structure> structure) - : JSObject(structure, m_inlineStorage) + explicit JSNonFinalObject(VPtrStealingHackType) + : JSObject(VPtrStealingHack, m_inlineStorage) + { + } + + explicit JSNonFinalObject(JSGlobalData& globalData, Structure* structure) + : JSObject(globalData, structure, m_inlineStorage) { ASSERT(!(OBJECT_OFFSETOF(JSNonFinalObject, m_inlineStorage) % sizeof(double))); ASSERT(this->structure()->propertyStorageCapacity() == JSNonFinalObject_inlineStorageCapacity); @@ -343,19 +352,19 @@ COMPILE_ASSERT((JSFinalObject_inlineStorageCapacity >= JSNonFinalObject_inlineSt friend class JSObject; public: - static JSFinalObject* create(ExecState* exec, NonNullPassRefPtr<Structure> structure) + static JSFinalObject* create(ExecState* exec, Structure* structure) { - return new (exec) JSFinalObject(structure); + return new (exec) JSFinalObject(exec->globalData(), structure); } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } private: - explicit JSFinalObject(NonNullPassRefPtr<Structure> structure) - : JSObject(structure, m_inlineStorage) + explicit JSFinalObject(JSGlobalData& globalData, Structure* structure) + : JSObject(globalData, structure, m_inlineStorage) { ASSERT(OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage) % sizeof(double) == 0); ASSERT(this->structure()->propertyStorageCapacity() == JSFinalObject_inlineStorageCapacity); @@ -372,12 +381,12 @@ inline size_t JSObject::offsetOfInlineStorage() return OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage); } -inline JSObject* constructEmptyObject(ExecState* exec, NonNullPassRefPtr<Structure> structure) +inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure) { return JSFinalObject::create(exec, structure); } -inline PassRefPtr<Structure> createEmptyObjectStructure(JSGlobalData& globalData, JSValue prototype) +inline Structure* createEmptyObjectStructure(JSGlobalData& globalData, JSValue prototype) { return JSFinalObject::createStructure(globalData, prototype); } @@ -393,22 +402,22 @@ inline JSObject* asObject(JSValue value) return asObject(value.asCell()); } -inline JSObject::JSObject(NonNullPassRefPtr<Structure> structure, PropertyStorage inlineStorage) - : JSCell(structure.releaseRef()) // ~JSObject balances this ref() +inline JSObject::JSObject(JSGlobalData& globalData, Structure* structure, PropertyStorage inlineStorage) + : JSCell(globalData, structure) , m_propertyStorage(inlineStorage) { ASSERT(inherits(&s_info)); ASSERT(m_structure->propertyStorageCapacity() < baseExternalStorageCapacity); ASSERT(m_structure->isEmpty()); ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype())); + ASSERT(static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1)); + ASSERT(m_structure->typeInfo().type() == ObjectType); } inline JSObject::~JSObject() { - ASSERT(m_structure); if (!isUsingInlineStorage()) delete [] m_propertyStorage; - m_structure->deref(); } inline JSValue JSObject::prototype() const @@ -416,7 +425,7 @@ inline JSValue JSObject::prototype() const return m_structure->storedPrototype(); } -inline bool JSObject::setPrototypeWithCycleCheck(JSValue prototype) +inline bool JSObject::setPrototypeWithCycleCheck(JSGlobalData& globalData, JSValue prototype) { JSValue nextPrototypeValue = prototype; while (nextPrototypeValue && nextPrototypeValue.isObject()) { @@ -425,27 +434,27 @@ inline bool JSObject::setPrototypeWithCycleCheck(JSValue prototype) return false; nextPrototypeValue = nextPrototype->prototype(); } - setPrototype(prototype); + setPrototype(globalData, prototype); return true; } -inline void JSObject::setPrototype(JSValue prototype) +inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype) { ASSERT(prototype); - RefPtr<Structure> newStructure = Structure::changePrototypeTransition(m_structure, prototype); - setStructure(newStructure.release()); + setStructure(globalData, Structure::changePrototypeTransition(globalData, m_structure.get(), prototype)); } -inline void JSObject::setStructure(NonNullPassRefPtr<Structure> structure) +inline void JSObject::setStructure(JSGlobalData& globalData, Structure* structure) { - m_structure->deref(); - m_structure = structure.leakRef(); // ~JSObject balances this ref() + m_structure.set(globalData, this, structure); } inline Structure* JSObject::inheritorID(JSGlobalData& globalData) { - if (m_inheritorID) + if (m_inheritorID) { + ASSERT(m_inheritorID->isEmpty()); return m_inheritorID.get(); + } return createInheritorID(globalData); } @@ -471,7 +480,7 @@ inline bool JSValue::inherits(const ClassInfo* classInfo) const ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { - if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) { + if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) { if (m_structure->hasGetterSetterProperties() && location->isGetterSetter()) fillGetterPropertySlot(slot, location); else @@ -557,12 +566,12 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if (m_structure->isDictionary()) { unsigned currentAttributes; JSCell* currentSpecificFunction; - size_t offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction); + size_t offset = m_structure->get(globalData, propertyName, currentAttributes, currentSpecificFunction); if (offset != WTF::notFound) { // If there is currently a specific function, and there now either isn't, // or the new value is different, then despecify. if (currentSpecificFunction && (specificFunction != currentSpecificFunction)) - m_structure->despecifyDictionaryFunction(propertyName); + m_structure->despecifyDictionaryFunction(globalData, propertyName); if (checkReadOnly && currentAttributes & ReadOnly) return false; @@ -582,7 +591,7 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi return false; size_t currentCapacity = m_structure->propertyStorageCapacity(); - offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, specificFunction); + offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction); if (currentCapacity != m_structure->propertyStorageCapacity()) allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity()); @@ -596,12 +605,12 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi size_t offset; size_t currentCapacity = m_structure->propertyStorageCapacity(); - if (RefPtr<Structure> structure = Structure::addPropertyTransitionToExistingStructure(m_structure, propertyName, attributes, specificFunction, offset)) { + if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(m_structure.get(), propertyName, attributes, specificFunction, offset)) { if (currentCapacity != structure->propertyStorageCapacity()) allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity()); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(structure.release()); + setStructure(globalData, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -612,7 +621,7 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi unsigned currentAttributes; JSCell* currentSpecificFunction; - offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction); + offset = m_structure->get(globalData, propertyName, currentAttributes, currentSpecificFunction); if (offset != WTF::notFound) { if (checkReadOnly && currentAttributes & ReadOnly) return false; @@ -633,7 +642,7 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi return true; } // case (2) Despecify, fall through to (3). - setStructure(Structure::despecifyFunctionTransition(m_structure, propertyName)); + setStructure(globalData, Structure::despecifyFunctionTransition(globalData, m_structure.get(), propertyName)); } // case (3) set the slot, do the put, return. @@ -645,13 +654,13 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if (!isExtensible()) return false; - RefPtr<Structure> structure = Structure::addPropertyTransition(m_structure, propertyName, attributes, specificFunction, offset); + Structure* structure = Structure::addPropertyTransition(globalData, m_structure.get(), propertyName, attributes, specificFunction, offset); if (currentCapacity != structure->propertyStorageCapacity()) allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity()); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(structure.release()); + setStructure(globalData, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -707,7 +716,7 @@ inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifi inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) { size_t currentCapacity = m_structure->propertyStorageCapacity(); - size_t offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, 0); + size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, 0); if (currentCapacity != m_structure->propertyStorageCapacity()) allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity()); putDirectOffset(globalData, offset, value); @@ -716,17 +725,17 @@ inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const inline void JSObject::putDirectFunctionWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes) { size_t currentCapacity = m_structure->propertyStorageCapacity(); - size_t offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, value); + size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, value); if (currentCapacity != m_structure->propertyStorageCapacity()) allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity()); putDirectOffset(globalData, offset, value); } -inline void JSObject::transitionTo(Structure* newStructure) +inline void JSObject::transitionTo(JSGlobalData& globalData, Structure* newStructure) { if (m_structure->propertyStorageCapacity() != newStructure->propertyStorageCapacity()) allocatePropertyStorage(m_structure->propertyStorageCapacity(), newStructure->propertyStorageCapacity()); - setStructure(newStructure); + setStructure(globalData, newStructure); } inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const @@ -814,13 +823,12 @@ inline void JSValue::put(ExecState* exec, unsigned propertyName, JSValue value) ALWAYS_INLINE void JSObject::markChildrenDirect(MarkStack& markStack) { JSCell::markChildren(markStack); - - markStack.append(m_structure->storedPrototypeSlot()); - if (*m_structure->cachedPrototypeChainSlot()) - markStack.append(m_structure->cachedPrototypeChainSlot()); + PropertyStorage storage = propertyStorage(); size_t storageSize = m_structure->propertyStorageSize(); markStack.appendValues(storage, storageSize); + if (m_inheritorID) + markStack.append(&m_inheritorID); } // --- JSValue inlines ---------------------------- diff --git a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp index 9370139..2b489a2 100644 --- a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp @@ -30,8 +30,8 @@ namespace JSC { -JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) - : JSNonFinalObject(structure) +JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, Structure* structure) + : JSNonFinalObject(globalObject->globalData(), structure) { COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one); ASSERT(!globalObject || globalObject->isGlobalObject()); @@ -41,9 +41,15 @@ JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, putAnonymousValue(globalObject->globalData(), GlobalObjectSlot, globalObject); } -JSGlobalObject* JSObjectWithGlobalObject::globalObject() const +JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure) + : JSNonFinalObject(globalData, structure) { - return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell())); + COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one); + ASSERT(!globalObject || globalObject->isGlobalObject()); + if (!globalObject) + clearAnonymousValue(GlobalObjectSlot); + else + putAnonymousValue(globalData, GlobalObjectSlot, globalObject); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h index 8380514..844bcd8 100644 --- a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h @@ -26,7 +26,7 @@ #ifndef JSObjectWithGlobalObject_h #define JSObjectWithGlobalObject_h -#include "JSObject.h" +#include "JSGlobalObject.h" namespace JSC { @@ -34,18 +34,22 @@ class JSGlobalObject; class JSObjectWithGlobalObject : public JSNonFinalObject { public: - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } - JSGlobalObject* globalObject() const; + JSGlobalObject* globalObject() const + { + return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell())); + } protected: - JSObjectWithGlobalObject(JSGlobalObject*, NonNullPassRefPtr<Structure>); + JSObjectWithGlobalObject(JSGlobalObject*, Structure*); + JSObjectWithGlobalObject(JSGlobalData&, JSGlobalObject*, Structure*); - JSObjectWithGlobalObject(NonNullPassRefPtr<Structure> structure) - : JSNonFinalObject(structure) + JSObjectWithGlobalObject(VPtrStealingHackType) + : JSNonFinalObject(VPtrStealingHack) { // Should only be used by JSFunction when we aquire the JSFunction vptr. } diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp index 6f31f99..d5af044 100644 --- a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp +++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp @@ -35,9 +35,10 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(JSPropertyNameIterator); +const ClassInfo JSPropertyNameIterator::s_info = { "JSPropertyNameIterator", 0, 0, 0 }; + inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots) - : JSCell(exec->globalData().propertyNameIteratorStructure.get()) - , m_cachedStructure(0) + : JSCell(exec->globalData(), exec->globalData().propertyNameIteratorStructure.get()) , m_numCacheableSlots(numCacheableSlots) , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size()) , m_jsStrings(adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize])) @@ -71,14 +72,14 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject size_t count = normalizePrototypeChain(exec, o); StructureChain* structureChain = o->structure()->prototypeChain(exec); - RefPtr<Structure>* structure = structureChain->head(); + WriteBarrier<Structure>* structure = structureChain->head(); for (size_t i = 0; i < count; ++i) { if (structure[i]->typeInfo().overridesGetPropertyNames()) return jsPropertyNameIterator; } jsPropertyNameIterator->setCachedPrototypeChain(exec->globalData(), structureChain); - jsPropertyNameIterator->setCachedStructure(o->structure()); + jsPropertyNameIterator->setCachedStructure(exec->globalData(), o->structure()); o->structure()->setEnumerationCache(exec->globalData(), jsPropertyNameIterator); return jsPropertyNameIterator; } @@ -86,7 +87,7 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject JSValue JSPropertyNameIterator::get(ExecState* exec, JSObject* base, size_t i) { JSValue identifier = m_jsStrings[i].get(); - if (m_cachedStructure == base->structure() && m_cachedPrototypeChain.get() == base->structure()->prototypeChain(exec)) + if (m_cachedStructure.get() == base->structure() && m_cachedPrototypeChain.get() == base->structure()->prototypeChain(exec)) return identifier; if (!base->hasProperty(exec, Identifier(exec, asString(identifier)->value(exec)))) @@ -101,12 +102,4 @@ void JSPropertyNameIterator::markChildren(MarkStack& markStack) markStack.append(&m_cachedPrototypeChain); } -#if !ASSERT_DISABLED - -JSPropertyNameIterator::~JSPropertyNameIterator() -{ - ASSERT(!m_cachedStructure || m_cachedStructure->enumerationCache() != this); -} - -#endif } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h index 499396c..b857dc0 100644 --- a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h +++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h @@ -45,9 +45,9 @@ namespace JSC { public: static JSPropertyNameIterator* create(ExecState*, JSObject*); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { - return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount, 0); + return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount, &s_info); } virtual bool isPropertyNameIterator() const { return true; } @@ -65,11 +65,11 @@ namespace JSC { JSValue get(ExecState*, JSObject*, size_t i); size_t size() { return m_jsStringsSize; } - void setCachedStructure(Structure* structure) + void setCachedStructure(JSGlobalData& globalData, Structure* structure) { ASSERT(!m_cachedStructure); ASSERT(structure); - m_cachedStructure = structure; + m_cachedStructure.set(globalData, this, structure); } Structure* cachedStructure() { return m_cachedStructure.get(); } @@ -77,13 +77,10 @@ namespace JSC { StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } private: + static const ClassInfo s_info; JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot); - -#if !ASSERT_DISABLED - virtual ~JSPropertyNameIterator(); -#endif - RefPtr<Structure> m_cachedStructure; + WriteBarrier<Structure> m_cachedStructure; WriteBarrier<StructureChain> m_cachedPrototypeChain; uint32_t m_numCacheableSlots; uint32_t m_jsStringsSize; @@ -93,12 +90,7 @@ namespace JSC { inline void Structure::setEnumerationCache(JSGlobalData& globalData, JSPropertyNameIterator* enumerationCache) { ASSERT(!isDictionary()); - m_enumerationCache.set(globalData, enumerationCache, 0); - } - - inline void Structure::clearEnumerationCache() - { - m_enumerationCache.clear(); + m_enumerationCache.set(globalData, this, enumerationCache); } inline JSPropertyNameIterator* Structure::enumerationCache() diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h index 3e19bbc..8c3a249 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h @@ -33,7 +33,7 @@ namespace JSC{ class JSStaticScopeObject : public JSVariableObject { public: JSStaticScopeObject(ExecState* exec, const Identifier& ident, JSValue value, unsigned attributes) - : JSVariableObject(exec->globalData().staticScopeStructure, &m_symbolTable, reinterpret_cast<Register*>(&m_registerStore + 1)) + : JSVariableObject(exec->globalData(), exec->globalData().staticScopeStructure.get(), &m_symbolTable, reinterpret_cast<Register*>(&m_registerStore + 1)) { m_registerStore.set(exec->globalData(), this, value); symbolTable().add(ident.impl(), SymbolTableEntry(-1, attributes)); @@ -47,7 +47,7 @@ namespace JSC{ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags; diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h index 9113d4a..3422dad 100644 --- a/Source/JavaScriptCore/runtime/JSString.h +++ b/Source/JavaScriptCore/runtime/JSString.h @@ -26,10 +26,10 @@ #include "CallFrame.h" #include "CommonIdentifiers.h" #include "Identifier.h" -#include "JSNumberCell.h" #include "PropertyDescriptor.h" #include "PropertySlot.h" #include "RopeImpl.h" +#include "Structure.h" namespace JSC { @@ -185,7 +185,7 @@ namespace JSC { }; ALWAYS_INLINE JSString(JSGlobalData* globalData, const UString& value) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(value.length()) , m_value(value) , m_fiberCount(0) @@ -196,7 +196,7 @@ namespace JSC { enum HasOtherOwnerType { HasOtherOwner }; JSString(JSGlobalData* globalData, const UString& value, HasOtherOwnerType) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(value.length()) , m_value(value) , m_fiberCount(0) @@ -204,7 +204,7 @@ namespace JSC { ASSERT(!m_value.isNull()); } JSString(JSGlobalData* globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(value->length()) , m_value(value) , m_fiberCount(0) @@ -212,7 +212,7 @@ namespace JSC { ASSERT(!m_value.isNull()); } JSString(JSGlobalData* globalData, PassRefPtr<RopeImpl> rope) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(rope->length()) , m_fiberCount(1) { @@ -221,7 +221,7 @@ namespace JSC { // This constructor constructs a new string by concatenating s1 & s2. // This should only be called with fiberCount <= 3. JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, JSString* s2) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(s1->length() + s2->length()) , m_fiberCount(fiberCount) { @@ -234,7 +234,7 @@ namespace JSC { // This constructor constructs a new string by concatenating s1 & s2. // This should only be called with fiberCount <= 3. JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, const UString& u2) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(s1->length() + u2.length()) , m_fiberCount(fiberCount) { @@ -247,7 +247,7 @@ namespace JSC { // This constructor constructs a new string by concatenating s1 & s2. // This should only be called with fiberCount <= 3. JSString(JSGlobalData* globalData, unsigned fiberCount, const UString& u1, JSString* s2) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(u1.length() + s2->length()) , m_fiberCount(fiberCount) { @@ -262,7 +262,7 @@ namespace JSC { // value must require a fiberCount of at least one implies that the length // for each value must be exactly 1! JSString(ExecState* exec, JSValue v1, JSValue v2, JSValue v3) - : JSCell(exec->globalData().stringStructure.get()) + : JSCell(exec->globalData(), exec->globalData().stringStructure.get()) , m_length(0) , m_fiberCount(s_maxInternalRopeLength) { @@ -275,7 +275,7 @@ namespace JSC { // This constructor constructs a new string by concatenating u1 & u2. JSString(JSGlobalData* globalData, const UString& u1, const UString& u2) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(u1.length() + u2.length()) , m_fiberCount(2) { @@ -287,7 +287,7 @@ namespace JSC { // This constructor constructs a new string by concatenating u1, u2 & u3. JSString(JSGlobalData* globalData, const UString& u1, const UString& u2, const UString& u3) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(u1.length() + u2.length() + u3.length()) , m_fiberCount(s_maxInternalRopeLength) { @@ -299,7 +299,7 @@ namespace JSC { } JSString(JSGlobalData* globalData, const UString& value, JSStringFinalizerCallback finalizer, void* context) - : JSCell(globalData->stringStructure.get()) + : JSCell(*globalData, globalData->stringStructure.get()) , m_length(value.length()) , m_value(value) , m_fiberCount(0) @@ -349,12 +349,11 @@ namespace JSC { JSValue replaceCharacter(ExecState*, UChar, const UString& replacement); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount, 0); } private: - enum VPtrStealingHackType { VPtrStealingHack }; JSString(VPtrStealingHackType) - : JSCell(0) + : JSCell(VPtrStealingHack) , m_fiberCount(0) { } diff --git a/Source/JavaScriptCore/runtime/JSType.h b/Source/JavaScriptCore/runtime/JSType.h index 882b218..dba03f6 100644 --- a/Source/JavaScriptCore/runtime/JSType.h +++ b/Source/JavaScriptCore/runtime/JSType.h @@ -33,10 +33,11 @@ namespace JSC { NumberType = 3, NullType = 4, StringType = 5, + LeafType = 6, // The CompoundType value must come before any JSType that may have children - CompoundType = 6, - ObjectType = 7, - GetterSetterType = 8 + CompoundType = 7, + ObjectType = 8, + GetterSetterType = 9 }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSTypeInfo.h b/Source/JavaScriptCore/runtime/JSTypeInfo.h index 284d2b2..acde81f 100644 --- a/Source/JavaScriptCore/runtime/JSTypeInfo.h +++ b/Source/JavaScriptCore/runtime/JSTypeInfo.h @@ -54,6 +54,7 @@ namespace JSC { { ASSERT(flags <= 0x1FF); ASSERT(type <= 0xFF); + ASSERT(type >= CompoundType || !(flags & OverridesMarkChildren)); // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance) if ((m_flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance) m_flags |= ImplementsDefaultHasInstance; diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 098123e..de50011 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -30,15 +30,18 @@ #include <wtf/Assertions.h> #include <wtf/HashTraits.h> #include <wtf/MathExtras.h> +#include <wtf/StdLibExtras.h> namespace JSC { + extern const double NaN; + extern const double Inf; + class ExecState; class Identifier; class JSCell; class JSGlobalData; class JSGlobalObject; - class JSImmediate; class JSObject; class JSString; class PropertySlot; @@ -48,7 +51,6 @@ namespace JSC { struct ClassInfo; struct Instruction; - template <class T> class DeprecatedPtr; template <class T> class WriteBarrierBase; enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString }; @@ -61,7 +63,7 @@ namespace JSC { #endif union EncodedValueDescriptor { - EncodedJSValue asEncodedJSValue; + int64_t asInt64; #if USE(JSVALUE32_64) double asDouble; #elif USE(JSVALUE64) @@ -95,7 +97,6 @@ namespace JSC { } class JSValue { - friend class JSImmediate; friend struct EncodedJSValueHashTraits; friend class JIT; friend class JITStubs; @@ -104,14 +105,9 @@ namespace JSC { friend class SpecializedThunkJIT; public: - static EncodedJSValue encode(JSValue value); - static JSValue decode(EncodedJSValue ptr); -#if USE(JSVALUE64) - private: - static JSValue makeImmediate(intptr_t value); - intptr_t immediateValue(); - public: -#endif + static EncodedJSValue encode(JSValue); + static JSValue decode(EncodedJSValue); + enum JSNullTag { JSNull }; enum JSUndefinedTag { JSUndefined }; enum JSTrueTag { JSTrue }; @@ -239,7 +235,6 @@ namespace JSC { #endif private: - template <class T> JSValue(DeprecatedPtr<T>); template <class T> JSValue(WriteBarrierBase<T>); enum HashTableDeletedValueTag { HashTableDeletedValue }; @@ -253,24 +248,120 @@ namespace JSC { JSObject* synthesizeObject(ExecState*) const; #if USE(JSVALUE32_64) - enum { NullTag = 0xffffffff }; - enum { UndefinedTag = 0xfffffffe }; - enum { Int32Tag = 0xfffffffd }; - enum { CellTag = 0xfffffffc }; - enum { TrueTag = 0xfffffffb }; - enum { FalseTag = 0xfffffffa }; - enum { EmptyValueTag = 0xfffffff9 }; - enum { DeletedValueTag = 0xfffffff8 }; - + /* + * On 32-bit platforms USE(JSVALUE32_64) should be defined, and we use a NaN-encoded + * form for immediates. + * + * The encoding makes use of unused NaN space in the IEEE754 representation. Any value + * with the top 13 bits set represents a QNaN (with the sign bit set). QNaN values + * can encode a 51-bit payload. Hardware produced and C-library payloads typically + * have a payload of zero. We assume that non-zero payloads are available to encode + * pointer and integer values. Since any 64-bit bit pattern where the top 15 bits are + * all set represents a NaN with a non-zero payload, we can use this space in the NaN + * ranges to encode other values (however there are also other ranges of NaN space that + * could have been selected). + * + * For JSValues that do not contain a double value, the high 32 bits contain the tag + * values listed in the enums below, which all correspond to NaN-space. In the case of + * cell, integer and bool values the lower 32 bits (the 'payload') contain the pointer + * integer or boolean value; in the case of all other tags the payload is 0. + */ + enum { Int32Tag = 0xffffffff }; + enum { BooleanTag = 0xfffffffe }; + enum { NullTag = 0xfffffffd }; + enum { UndefinedTag = 0xfffffffc }; + enum { CellTag = 0xfffffffb }; + enum { EmptyValueTag = 0xfffffffa }; + enum { DeletedValueTag = 0xfffffff9 }; + enum { LowestTag = DeletedValueTag }; uint32_t tag() const; int32_t payload() const; - - EncodedValueDescriptor u; #elif USE(JSVALUE64) - JSCell* m_ptr; + /* + * On 64-bit platforms USE(JSVALUE64) should be defined, and we use a NaN-encoded + * form for immediates. + * + * The encoding makes use of unused NaN space in the IEEE754 representation. Any value + * with the top 13 bits set represents a QNaN (with the sign bit set). QNaN values + * can encode a 51-bit payload. Hardware produced and C-library payloads typically + * have a payload of zero. We assume that non-zero payloads are available to encode + * pointer and integer values. Since any 64-bit bit pattern where the top 15 bits are + * all set represents a NaN with a non-zero payload, we can use this space in the NaN + * ranges to encode other values (however there are also other ranges of NaN space that + * could have been selected). + * + * This range of NaN space is represented by 64-bit numbers begining with the 16-bit + * hex patterns 0xFFFE and 0xFFFF - we rely on the fact that no valid double-precision + * numbers will begin fall in these ranges. + * + * The top 16-bits denote the type of the encoded JSValue: + * + * Pointer { 0000:PPPP:PPPP:PPPP + * / 0001:****:****:**** + * Double { ... + * \ FFFE:****:****:**** + * Integer { FFFF:0000:IIII:IIII + * + * The scheme we have implemented encodes double precision values by performing a + * 64-bit integer addition of the value 2^48 to the number. After this manipulation + * no encoded double-precision value will begin with the pattern 0x0000 or 0xFFFF. + * Values must be decoded by reversing this operation before subsequent floating point + * operations my be peformed. + * + * 32-bit signed integers are marked with the 16-bit tag 0xFFFF. + * + * The tag 0x0000 denotes a pointer, or another form of tagged immediate. Boolean, + * null and undefined values are represented by specific, invalid pointer values: + * + * False: 0x06 + * True: 0x07 + * Undefined: 0x0a + * Null: 0x02 + * + * These values have the following properties: + * - Bit 1 (TagBitTypeOther) is set for all four values, allowing real pointers to be + * quickly distinguished from all immediate values, including these invalid pointers. + * - With bit 3 is masked out (TagBitUndefined) Undefined and Null share the + * same value, allowing null & undefined to be quickly detected. + * + * No valid JSValue will have the bit pattern 0x0, this is used to represent array + * holes, and as a C++ 'no value' result (e.g. JSValue() has an internal value of 0). + */ + + // These values are #defines since using static const integers here is a ~1% regression! + + // This value is 2^48, used to encode doubles such that the encoded value will begin + // with a 16-bit pattern within the range 0x0001..0xFFFE. + #define DoubleEncodeOffset 0x1000000000000ll + // If all bits in the mask are set, this indicates an integer number, + // if any but not all are set this value is a double precision number. + #define TagTypeNumber 0xffff000000000000ll + + // All non-numeric (bool, null, undefined) immediates have bit 2 set. + #define TagBitTypeOther 0x2ll + #define TagBitBool 0x4ll + #define TagBitUndefined 0x8ll + // Combined integer value for non-numeric immediates. + #define ValueFalse (TagBitTypeOther | TagBitBool | false) + #define ValueTrue (TagBitTypeOther | TagBitBool | true) + #define ValueUndefined (TagBitTypeOther | TagBitUndefined) + #define ValueNull (TagBitTypeOther) + + // TagMask is used to check for all types of immediate values (either number or 'other'). + #define TagMask (TagTypeNumber | TagBitTypeOther) + + // These special values are never visible to JavaScript code; Empty is used to represent + // Array holes, and for uninitialized JSValues. Deleted is used in hash table code. + // These values would map to cell types in the JSValue encoding, but not valid GC cell + // pointer should have either of these values (Empty is null, deleted is at an invalid + // alignment for a GC cell, and in the zero page). + #define ValueEmpty 0x0ll + #define ValueDeleted 0x4ll #endif + + EncodedValueDescriptor u; }; #if USE(JSVALUE32_64) @@ -373,409 +464,7 @@ namespace JSC { inline bool operator!=(const JSValue a, const JSCell* b) { return a != JSValue(b); } inline bool operator!=(const JSCell* a, const JSValue b) { return JSValue(a) != b; } - ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const - { - if (isInt32()) - return asInt32(); - return JSC::toInt32(toNumber(exec)); - } - - inline uint32_t JSValue::toUInt32(ExecState* exec) const - { - // See comment on JSC::toUInt32, above. - return toInt32(exec); - } - -#if USE(JSVALUE32_64) - inline JSValue jsNaN() - { - return JSValue(nonInlineNaN()); - } - - // JSValue member functions. - inline EncodedJSValue JSValue::encode(JSValue value) - { - return value.u.asEncodedJSValue; - } - - inline JSValue JSValue::decode(EncodedJSValue encodedJSValue) - { - JSValue v; - v.u.asEncodedJSValue = encodedJSValue; - return v; - } - - inline JSValue::JSValue() - { - u.asBits.tag = EmptyValueTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(JSNullTag) - { - u.asBits.tag = NullTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(JSUndefinedTag) - { - u.asBits.tag = UndefinedTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(JSTrueTag) - { - u.asBits.tag = TrueTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(JSFalseTag) - { - u.asBits.tag = FalseTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(HashTableDeletedValueTag) - { - u.asBits.tag = DeletedValueTag; - u.asBits.payload = 0; - } - - inline JSValue::JSValue(JSCell* ptr) - { - if (ptr) - u.asBits.tag = CellTag; - else - u.asBits.tag = EmptyValueTag; - u.asBits.payload = reinterpret_cast<int32_t>(ptr); -#if ENABLE(JSC_ZOMBIES) - ASSERT(!isZombie()); -#endif - } - - inline JSValue::JSValue(const JSCell* ptr) - { - if (ptr) - u.asBits.tag = CellTag; - else - u.asBits.tag = EmptyValueTag; - u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr)); -#if ENABLE(JSC_ZOMBIES) - ASSERT(!isZombie()); -#endif - } - - inline JSValue::operator bool() const - { - ASSERT(tag() != DeletedValueTag); - return tag() != EmptyValueTag; - } - - inline bool JSValue::operator==(const JSValue& other) const - { - return u.asEncodedJSValue == other.u.asEncodedJSValue; - } - - inline bool JSValue::operator!=(const JSValue& other) const - { - return u.asEncodedJSValue != other.u.asEncodedJSValue; - } - - inline bool JSValue::isUndefined() const - { - return tag() == UndefinedTag; - } - - inline bool JSValue::isNull() const - { - return tag() == NullTag; - } - - inline bool JSValue::isUndefinedOrNull() const - { - return isUndefined() || isNull(); - } - - inline bool JSValue::isCell() const - { - return tag() == CellTag; - } - - inline bool JSValue::isInt32() const - { - return tag() == Int32Tag; - } - - inline bool JSValue::isUInt32() const - { - return tag() == Int32Tag && asInt32() > -1; - } - - inline bool JSValue::isDouble() const - { - return tag() < LowestTag; - } - - inline bool JSValue::isTrue() const - { - return tag() == TrueTag; - } - - inline bool JSValue::isFalse() const - { - return tag() == FalseTag; - } - - inline uint32_t JSValue::tag() const - { - return u.asBits.tag; - } - - inline int32_t JSValue::payload() const - { - return u.asBits.payload; - } - - inline int32_t JSValue::asInt32() const - { - ASSERT(isInt32()); - return u.asBits.payload; - } - - inline uint32_t JSValue::asUInt32() const - { - ASSERT(isUInt32()); - return u.asBits.payload; - } - - inline double JSValue::asDouble() const - { - ASSERT(isDouble()); - return u.asDouble; - } - - ALWAYS_INLINE JSCell* JSValue::asCell() const - { - ASSERT(isCell()); - return reinterpret_cast<JSCell*>(u.asBits.payload); - } - - ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) - { - u.asDouble = d; - } - - inline JSValue::JSValue(double d) - { - const int32_t asInt32 = static_cast<int32_t>(d); - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 - u.asDouble = d; - return; - } - *this = JSValue(static_cast<int32_t>(d)); - } - - inline JSValue::JSValue(char i) - { - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(unsigned char i) - { - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(short i) - { - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(unsigned short i) - { - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(int i) - { - u.asBits.tag = Int32Tag; - u.asBits.payload = i; - } - - inline JSValue::JSValue(unsigned i) - { - if (static_cast<int32_t>(i) < 0) { - *this = JSValue(static_cast<double>(i)); - return; - } - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(long i) - { - if (static_cast<int32_t>(i) != i) { - *this = JSValue(static_cast<double>(i)); - return; - } - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(unsigned long i) - { - if (static_cast<uint32_t>(i) != i) { - *this = JSValue(static_cast<double>(i)); - return; - } - *this = JSValue(static_cast<uint32_t>(i)); - } - - inline JSValue::JSValue(long long i) - { - if (static_cast<int32_t>(i) != i) { - *this = JSValue(static_cast<double>(i)); - return; - } - *this = JSValue(static_cast<int32_t>(i)); - } - - inline JSValue::JSValue(unsigned long long i) - { - if (static_cast<uint32_t>(i) != i) { - *this = JSValue(static_cast<double>(i)); - return; - } - *this = JSValue(static_cast<uint32_t>(i)); - } - - inline bool JSValue::isNumber() const - { - return isInt32() || isDouble(); - } - - inline bool JSValue::isBoolean() const - { - return isTrue() || isFalse(); - } - - inline bool JSValue::getBoolean(bool& v) const - { - if (isTrue()) { - v = true; - return true; - } - if (isFalse()) { - v = false; - return true; - } - - return false; - } - - inline bool JSValue::getBoolean() const - { - ASSERT(isBoolean()); - return tag() == TrueTag; - } - - inline double JSValue::uncheckedGetNumber() const - { - ASSERT(isNumber()); - return isInt32() ? asInt32() : asDouble(); - } - - ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const - { - return isNumber() ? asValue() : jsNumber(this->toNumber(exec)); - } - - inline bool JSValue::getNumber(double& result) const - { - if (isInt32()) { - result = asInt32(); - return true; - } - if (isDouble()) { - result = asDouble(); - return true; - } - return false; - } - -#else // USE(JSVALUE32_64) - - // JSValue member functions. - inline EncodedJSValue JSValue::encode(JSValue value) - { - return reinterpret_cast<EncodedJSValue>(value.m_ptr); - } - - inline JSValue JSValue::decode(EncodedJSValue ptr) - { - return JSValue(reinterpret_cast<JSCell*>(ptr)); - } - - inline JSValue JSValue::makeImmediate(intptr_t value) - { - return JSValue(reinterpret_cast<JSCell*>(value)); - } - - inline intptr_t JSValue::immediateValue() - { - return reinterpret_cast<intptr_t>(m_ptr); - } - - // 0x0 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x0, which is in the (invalid) zero page. - inline JSValue::JSValue() - : m_ptr(0) - { - } - - // 0x4 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x4, which is in the (invalid) zero page. - inline JSValue::JSValue(HashTableDeletedValueTag) - : m_ptr(reinterpret_cast<JSCell*>(0x4)) - { - } - - inline JSValue::JSValue(JSCell* ptr) - : m_ptr(ptr) - { -#if ENABLE(JSC_ZOMBIES) - ASSERT(!isZombie()); -#endif - } - - inline JSValue::JSValue(const JSCell* ptr) - : m_ptr(const_cast<JSCell*>(ptr)) - { -#if ENABLE(JSC_ZOMBIES) - ASSERT(!isZombie()); -#endif - } - - inline JSValue::operator bool() const - { - return m_ptr; - } - - inline bool JSValue::operator==(const JSValue& other) const - { - return m_ptr == other.m_ptr; - } - - inline bool JSValue::operator!=(const JSValue& other) const - { - return m_ptr != other.m_ptr; - } - - inline bool JSValue::isUndefined() const - { - return asValue() == jsUndefined(); - } - - inline bool JSValue::isNull() const - { - return asValue() == jsNull(); - } -#endif // USE(JSVALUE32_64) + bool isZombie(const JSCell*); } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSValueInlineMethods.h b/Source/JavaScriptCore/runtime/JSValueInlineMethods.h new file mode 100644 index 0000000..b4f6f80 --- /dev/null +++ b/Source/JavaScriptCore/runtime/JSValueInlineMethods.h @@ -0,0 +1,532 @@ +/* + * Copyright (C) 2011 Apple Inc. 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 APPLE INC. ``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 APPLE INC. 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. + */ + +#ifndef JSValueInlineMethods_h +#define JSValueInlineMethods_h + +#include "JSValue.h" + +namespace JSC { + + ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const + { + if (isInt32()) + return asInt32(); + return JSC::toInt32(toNumber(exec)); + } + + inline uint32_t JSValue::toUInt32(ExecState* exec) const + { + // See comment on JSC::toUInt32, above. + return toInt32(exec); + } + + inline bool JSValue::isUInt32() const + { + return isInt32() && asInt32() >= 0; + } + + inline uint32_t JSValue::asUInt32() const + { + ASSERT(isUInt32()); + return asInt32(); + } + + inline double JSValue::uncheckedGetNumber() const + { + ASSERT(isNumber()); + return isInt32() ? asInt32() : asDouble(); + } + + ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const + { + return isNumber() ? asValue() : jsNumber(this->toNumber(exec)); + } + + inline JSValue jsNaN() + { + return JSValue(nonInlineNaN()); + } + + inline bool JSValue::getNumber(double& result) const + { + if (isInt32()) { + result = asInt32(); + return true; + } + if (isDouble()) { + result = asDouble(); + return true; + } + return false; + } + + inline bool JSValue::getBoolean(bool& v) const + { + if (isTrue()) { + v = true; + return true; + } + if (isFalse()) { + v = false; + return true; + } + + return false; + } + + inline JSValue::JSValue(char i) + { + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(unsigned char i) + { + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(short i) + { + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(unsigned short i) + { + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(unsigned i) + { + if (static_cast<int32_t>(i) < 0) { + *this = JSValue(EncodeAsDouble, static_cast<double>(i)); + return; + } + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(long i) + { + if (static_cast<int32_t>(i) != i) { + *this = JSValue(EncodeAsDouble, static_cast<double>(i)); + return; + } + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(unsigned long i) + { + if (static_cast<uint32_t>(i) != i) { + *this = JSValue(EncodeAsDouble, static_cast<double>(i)); + return; + } + *this = JSValue(static_cast<uint32_t>(i)); + } + + inline JSValue::JSValue(long long i) + { + if (static_cast<int32_t>(i) != i) { + *this = JSValue(EncodeAsDouble, static_cast<double>(i)); + return; + } + *this = JSValue(static_cast<int32_t>(i)); + } + + inline JSValue::JSValue(unsigned long long i) + { + if (static_cast<uint32_t>(i) != i) { + *this = JSValue(EncodeAsDouble, static_cast<double>(i)); + return; + } + *this = JSValue(static_cast<uint32_t>(i)); + } + + inline JSValue::JSValue(double d) + { + const int32_t asInt32 = static_cast<int32_t>(d); + if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 + *this = JSValue(EncodeAsDouble, d); + return; + } + *this = JSValue(static_cast<int32_t>(d)); + } + +#if USE(JSVALUE32_64) + inline EncodedJSValue JSValue::encode(JSValue value) + { + return value.u.asInt64; + } + + inline JSValue JSValue::decode(EncodedJSValue encodedJSValue) + { + JSValue v; + v.u.asInt64 = encodedJSValue; + return v; + } + + inline JSValue::JSValue() + { + u.asBits.tag = EmptyValueTag; + u.asBits.payload = 0; + } + + inline JSValue::JSValue(JSNullTag) + { + u.asBits.tag = NullTag; + u.asBits.payload = 0; + } + + inline JSValue::JSValue(JSUndefinedTag) + { + u.asBits.tag = UndefinedTag; + u.asBits.payload = 0; + } + + inline JSValue::JSValue(JSTrueTag) + { + u.asBits.tag = BooleanTag; + u.asBits.payload = 1; + } + + inline JSValue::JSValue(JSFalseTag) + { + u.asBits.tag = BooleanTag; + u.asBits.payload = 0; + } + + inline JSValue::JSValue(HashTableDeletedValueTag) + { + u.asBits.tag = DeletedValueTag; + u.asBits.payload = 0; + } + + inline JSValue::JSValue(JSCell* ptr) + { + if (ptr) + u.asBits.tag = CellTag; + else + u.asBits.tag = EmptyValueTag; + u.asBits.payload = reinterpret_cast<int32_t>(ptr); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie()); +#endif + } + + inline JSValue::JSValue(const JSCell* ptr) + { + if (ptr) + u.asBits.tag = CellTag; + else + u.asBits.tag = EmptyValueTag; + u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr)); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie()); +#endif + } + + inline JSValue::operator bool() const + { + ASSERT(tag() != DeletedValueTag); + return tag() != EmptyValueTag; + } + + inline bool JSValue::operator==(const JSValue& other) const + { + return u.asInt64 == other.u.asInt64; + } + + inline bool JSValue::operator!=(const JSValue& other) const + { + return u.asInt64 != other.u.asInt64; + } + + inline bool JSValue::isUndefined() const + { + return tag() == UndefinedTag; + } + + inline bool JSValue::isNull() const + { + return tag() == NullTag; + } + + inline bool JSValue::isUndefinedOrNull() const + { + return isUndefined() || isNull(); + } + + inline bool JSValue::isCell() const + { + return tag() == CellTag; + } + + inline bool JSValue::isInt32() const + { + return tag() == Int32Tag; + } + + inline bool JSValue::isDouble() const + { + return tag() < LowestTag; + } + + inline bool JSValue::isTrue() const + { + return tag() == BooleanTag && payload(); + } + + inline bool JSValue::isFalse() const + { + return tag() == BooleanTag && !payload(); + } + + inline uint32_t JSValue::tag() const + { + return u.asBits.tag; + } + + inline int32_t JSValue::payload() const + { + return u.asBits.payload; + } + + inline int32_t JSValue::asInt32() const + { + ASSERT(isInt32()); + return u.asBits.payload; + } + + inline double JSValue::asDouble() const + { + ASSERT(isDouble()); + return u.asDouble; + } + + ALWAYS_INLINE JSCell* JSValue::asCell() const + { + ASSERT(isCell()); + return reinterpret_cast<JSCell*>(u.asBits.payload); + } + + ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) + { + u.asDouble = d; + } + + inline JSValue::JSValue(int i) + { + u.asBits.tag = Int32Tag; + u.asBits.payload = i; + } + + inline bool JSValue::isNumber() const + { + return isInt32() || isDouble(); + } + + inline bool JSValue::isBoolean() const + { + return isTrue() || isFalse(); + } + + inline bool JSValue::getBoolean() const + { + ASSERT(isBoolean()); + return payload(); + } + +#else // USE(JSVALUE32_64) + + // JSValue member functions. + inline EncodedJSValue JSValue::encode(JSValue value) + { + return value.u.ptr; + } + + inline JSValue JSValue::decode(EncodedJSValue ptr) + { + return JSValue(reinterpret_cast<JSCell*>(ptr)); + } + + // 0x0 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x0, which is in the (invalid) zero page. + inline JSValue::JSValue() + { + u.asInt64 = ValueEmpty; + } + + // 0x4 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x4, which is in the (invalid) zero page. + inline JSValue::JSValue(HashTableDeletedValueTag) + { + u.asInt64 = ValueDeleted; + } + + inline JSValue::JSValue(JSCell* ptr) + { + u.ptr = ptr; +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie()); +#endif + } + + inline JSValue::JSValue(const JSCell* ptr) + { + u.ptr = const_cast<JSCell*>(ptr); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie()); +#endif + } + + inline JSValue::operator bool() const + { + return u.ptr; + } + + inline bool JSValue::operator==(const JSValue& other) const + { + return u.ptr == other.u.ptr; + } + + inline bool JSValue::operator!=(const JSValue& other) const + { + return u.ptr != other.u.ptr; + } + + inline bool JSValue::isUndefined() const + { + return asValue() == jsUndefined(); + } + + inline bool JSValue::isNull() const + { + return asValue() == jsNull(); + } + + inline bool JSValue::isTrue() const + { + return asValue() == JSValue(JSTrue); + } + + inline bool JSValue::isFalse() const + { + return asValue() == JSValue(JSFalse); + } + + inline bool JSValue::getBoolean() const + { + ASSERT(asValue() == jsBoolean(true) || asValue() == jsBoolean(false)); + return asValue() == jsBoolean(true); + } + + inline int32_t JSValue::asInt32() const + { + ASSERT(isInt32()); + return static_cast<int32_t>(u.asInt64); + } + + inline bool JSValue::isDouble() const + { + return isNumber() && !isInt32(); + } + + inline JSValue::JSValue(JSNullTag) + { + u.asInt64 = ValueNull; + } + + inline JSValue::JSValue(JSUndefinedTag) + { + u.asInt64 = ValueUndefined; + } + + inline JSValue::JSValue(JSTrueTag) + { + u.asInt64 = ValueTrue; + } + + inline JSValue::JSValue(JSFalseTag) + { + u.asInt64 = ValueFalse; + } + + inline bool JSValue::isUndefinedOrNull() const + { + // Undefined and null share the same value, bar the 'undefined' bit in the extended tag. + return (u.asInt64 & ~TagBitUndefined) == ValueNull; + } + + inline bool JSValue::isBoolean() const + { + return (u.asInt64 & ~1) == ValueFalse; + } + + inline bool JSValue::isCell() const + { + return !(u.asInt64 & TagMask); + } + + inline bool JSValue::isInt32() const + { + return (u.asInt64 & TagTypeNumber) == TagTypeNumber; + } + + inline intptr_t reinterpretDoubleToIntptr(double value) + { + return bitwise_cast<intptr_t>(value); + } + inline double reinterpretIntptrToDouble(intptr_t value) + { + return bitwise_cast<double>(value); + } + + ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) + { + u.asInt64 = reinterpretDoubleToIntptr(d) + DoubleEncodeOffset; + } + + inline JSValue::JSValue(int i) + { + u.asInt64 = TagTypeNumber | static_cast<uint32_t>(i); + } + + inline double JSValue::asDouble() const + { + return reinterpretIntptrToDouble(u.asInt64 - DoubleEncodeOffset); + } + + inline bool JSValue::isNumber() const + { + return u.asInt64 & TagTypeNumber; + } + + ALWAYS_INLINE JSCell* JSValue::asCell() const + { + ASSERT(isCell()); + return u.ptr; + } + +#endif // USE(JSVALUE64) + +} // namespace JSC + +#endif // JSValueInlineMethods_h diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h index 891ada8..89bb6b0 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.h +++ b/Source/JavaScriptCore/runtime/JSVariableObject.h @@ -58,7 +58,7 @@ namespace JSC { WriteBarrier<Unknown>* const * addressOfRegisters() const { return &m_registers; } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -66,8 +66,8 @@ namespace JSC { protected: static const unsigned StructureFlags = OverridesGetPropertyNames | JSObject::StructureFlags; - JSVariableObject(NonNullPassRefPtr<Structure> structure, SymbolTable* symbolTable, Register* registers) - : JSNonFinalObject(structure) + JSVariableObject(JSGlobalData& globalData, Structure* structure, SymbolTable* symbolTable, Register* registers) + : JSNonFinalObject(globalData, structure) , m_symbolTable(symbolTable) , m_registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers)) { @@ -75,7 +75,7 @@ namespace JSC { COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier); } - PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count); + PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts); void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray); bool symbolTableGet(const Identifier&, PropertySlot&); @@ -137,10 +137,12 @@ namespace JSC { return true; } - inline PassOwnArrayPtr<WriteBarrier<Unknown> > JSVariableObject::copyRegisterArray(JSGlobalData& globalData, WriteBarrier<Unknown>* src, size_t count) + inline PassOwnArrayPtr<WriteBarrier<Unknown> > JSVariableObject::copyRegisterArray(JSGlobalData& globalData, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts) { OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[count]); - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < callframeStarts; i++) + registerArray[i].set(globalData, this, src[i].get()); + for (size_t i = callframeStarts + RegisterFile::CallFrameHeaderSize; i < count; i++) registerArray[i].set(globalData, this, src[i].get()); return registerArray.release(); diff --git a/Source/JavaScriptCore/runtime/JSWrapperObject.h b/Source/JavaScriptCore/runtime/JSWrapperObject.h index 63833e9..a7dbe0d 100644 --- a/Source/JavaScriptCore/runtime/JSWrapperObject.h +++ b/Source/JavaScriptCore/runtime/JSWrapperObject.h @@ -30,13 +30,13 @@ namespace JSC { // Number, Boolean and Date which are wrappers for primitive types. class JSWrapperObject : public JSNonFinalObject { protected: - explicit JSWrapperObject(NonNullPassRefPtr<Structure>); + explicit JSWrapperObject(JSGlobalData&, Structure*); public: JSValue internalValue() const; void setInternalValue(JSGlobalData&, JSValue); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -50,8 +50,8 @@ namespace JSC { WriteBarrier<Unknown> m_internalValue; }; - inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure) - : JSNonFinalObject(structure) + inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, Structure* structure) + : JSNonFinalObject(globalData, structure) { } diff --git a/Source/JavaScriptCore/runtime/JSZombie.cpp b/Source/JavaScriptCore/runtime/JSZombie.cpp index 23cf135..efabc93 100644 --- a/Source/JavaScriptCore/runtime/JSZombie.cpp +++ b/Source/JavaScriptCore/runtime/JSZombie.cpp @@ -35,16 +35,6 @@ namespace JSC { const ClassInfo JSZombie::s_info = { "Zombie", 0, 0, 0 }; -Structure* JSZombie::leakedZombieStructure() { - static Structure* structure = 0; - if (!structure) { - Structure::startIgnoringLeaks(); - structure = Structure::create(jsNull(), TypeInfo(UnspecifiedType), 0, &s_info).leakRef(); - Structure::stopIgnoringLeaks(); - } - return structure; -} - } #endif // ENABLE(JSC_ZOMBIES) diff --git a/Source/JavaScriptCore/runtime/JSZombie.h b/Source/JavaScriptCore/runtime/JSZombie.h index 179ff53..0559b96 100644 --- a/Source/JavaScriptCore/runtime/JSZombie.h +++ b/Source/JavaScriptCore/runtime/JSZombie.h @@ -27,21 +27,21 @@ #define JSZombie_h #include "JSCell.h" +#include "Structure.h" #if ENABLE(JSC_ZOMBIES) namespace JSC { class JSZombie : public JSCell { public: - JSZombie(const ClassInfo* oldInfo, Structure* structure) - : JSCell(structure) + JSZombie(JSGlobalData& globalData, const ClassInfo* oldInfo, Structure* structure) + : JSCell(globalData, structure) , m_oldInfo(oldInfo) { ASSERT(inherits(&s_info)); } virtual bool isZombie() const { return true; } - static Structure* leakedZombieStructure(); virtual bool isGetterSetter() const { ASSERT_NOT_REACHED(); return false; } virtual bool isAPIValueWrapper() const { ASSERT_NOT_REACHED(); return false; } @@ -66,9 +66,9 @@ public: virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&) { ASSERT_NOT_REACHED(); return false; } virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&) { ASSERT_NOT_REACHED(); return false; } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { - return Structure::create(globalData, prototype, TypeInfo(ObjectType, 0), AnonymousSlotCount, &s_info); + return Structure::create(globalData, prototype, TypeInfo(LeafType, 0), AnonymousSlotCount, &s_info); } static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/Lookup.cpp b/Source/JavaScriptCore/runtime/Lookup.cpp index 307bceb..25b516e 100644 --- a/Source/JavaScriptCore/runtime/Lookup.cpp +++ b/Source/JavaScriptCore/runtime/Lookup.cpp @@ -73,7 +73,7 @@ void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* ASSERT(thisObj->structure()->anonymousSlotCount() > 0); ASSERT(thisObj->getAnonymousValue(0).isCell() && asObject(thisObj->getAnonymousValue(0).asCell())->isGlobalObject()); ASSERT(entry->attributes() & Function); - WriteBarrierBase<Unknown>* location = thisObj->getDirectLocation(propertyName); + WriteBarrierBase<Unknown>* location = thisObj->getDirectLocation(exec->globalData(), propertyName); if (!location) { JSFunction* function; @@ -86,7 +86,7 @@ void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* function = new (exec) JSFunction(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function()); thisObj->putDirectFunction(exec->globalData(), propertyName, function, entry->attributes()); - location = thisObj->getDirectLocation(propertyName); + location = thisObj->getDirectLocation(exec->globalData(), propertyName); } slot.setValue(thisObj, location->get(), thisObj->offsetForLocation(location)); diff --git a/Source/JavaScriptCore/runtime/MathObject.cpp b/Source/JavaScriptCore/runtime/MathObject.cpp index 7b856a1..52bd76a 100644 --- a/Source/JavaScriptCore/runtime/MathObject.cpp +++ b/Source/JavaScriptCore/runtime/MathObject.cpp @@ -86,7 +86,7 @@ const ClassInfo MathObject::s_info = { "Math", &JSObjectWithGlobalObject::s_info @end */ -MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) +MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) : JSObjectWithGlobalObject(globalObject, structure) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/MathObject.h b/Source/JavaScriptCore/runtime/MathObject.h index 26eaae0..75753be 100644 --- a/Source/JavaScriptCore/runtime/MathObject.h +++ b/Source/JavaScriptCore/runtime/MathObject.h @@ -27,14 +27,14 @@ namespace JSC { class MathObject : public JSObjectWithGlobalObject { public: - MathObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>); + MathObject(ExecState*, JSGlobalObject*, Structure*); virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp index d8fda69..9cd5dcb 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp +++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp @@ -32,7 +32,7 @@ ASSERT_CLASS_FITS_IN_CELL(NativeErrorConstructor); const ClassInfo NativeErrorConstructor::s_info = { "Function", &InternalFunction::s_info, 0, 0 }; -NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString& nameAndMessage) +NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& nameAndMessage) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage)) { ASSERT(inherits(&s_info)); @@ -41,13 +41,23 @@ NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum); - m_errorStructure = ErrorInstance::createStructure(exec->globalData(), prototype); + m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), prototype)); + ASSERT(m_errorStructure); + ASSERT(m_errorStructure->typeInfo().type() == ObjectType); +} + +void NativeErrorConstructor::markChildren(MarkStack& markStack) +{ + InternalFunction::markChildren(markStack); + if (m_errorStructure) + markStack.append(&m_errorStructure); } static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState* exec) { JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure(); + ASSERT(errorStructure); return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); } diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h index 23f798e..e96daf6 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h +++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h @@ -31,11 +31,11 @@ namespace JSC { class NativeErrorConstructor : public InternalFunction { public: - NativeErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString&); + NativeErrorConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* prototypeStructure, const UString&); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } @@ -43,10 +43,12 @@ namespace JSC { Structure* errorStructure() { return m_errorStructure.get(); } private: + static const unsigned StructureFlags = OverridesMarkChildren | InternalFunction::StructureFlags; virtual ConstructType getConstructData(ConstructData&); virtual CallType getCallData(CallData&); + virtual void markChildren(MarkStack&); - RefPtr<Structure> m_errorStructure; + WriteBarrier<Structure> m_errorStructure; }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp index 4e10268..de27d59 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp +++ b/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp @@ -31,7 +31,7 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype); -NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const UString& nameAndMessage, NativeErrorConstructor* constructor) +NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor) : JSObjectWithGlobalObject(globalObject, structure) { putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), 0); diff --git a/Source/JavaScriptCore/runtime/NativeErrorPrototype.h b/Source/JavaScriptCore/runtime/NativeErrorPrototype.h index 30690d5..e1b05ce 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorPrototype.h +++ b/Source/JavaScriptCore/runtime/NativeErrorPrototype.h @@ -28,7 +28,7 @@ namespace JSC { class NativeErrorPrototype : public JSObjectWithGlobalObject { public: - NativeErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const UString&, NativeErrorConstructor*); + NativeErrorPrototype(ExecState*, JSGlobalObject*, Structure*, const UString&, NativeErrorConstructor*); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.cpp b/Source/JavaScriptCore/runtime/NumberConstructor.cpp index aee143a..4193f79 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/Source/JavaScriptCore/runtime/NumberConstructor.cpp @@ -54,7 +54,7 @@ const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_i @end */ -NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype) +NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NumberPrototype* numberPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->s_info.className)) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.h b/Source/JavaScriptCore/runtime/NumberConstructor.h index ab4507e..69aa8a1 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.h +++ b/Source/JavaScriptCore/runtime/NumberConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class NumberConstructor : public InternalFunction { public: - NumberConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, NumberPrototype*); + NumberConstructor(ExecState*, JSGlobalObject*, Structure*, NumberPrototype*); virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); @@ -37,7 +37,7 @@ namespace JSC { static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/NumberObject.cpp b/Source/JavaScriptCore/runtime/NumberObject.cpp index 74b5e98..6ee103b 100644 --- a/Source/JavaScriptCore/runtime/NumberObject.cpp +++ b/Source/JavaScriptCore/runtime/NumberObject.cpp @@ -31,8 +31,8 @@ ASSERT_CLASS_FITS_IN_CELL(NumberObject); const ClassInfo NumberObject::s_info = { "Number", &JSWrapperObject::s_info, 0, 0 }; -NumberObject::NumberObject(JSGlobalData&, NonNullPassRefPtr<Structure> structure) - : JSWrapperObject(structure) +NumberObject::NumberObject(JSGlobalData& globalData, Structure* structure) + : JSWrapperObject(globalData, structure) { ASSERT(inherits(&s_info)); } diff --git a/Source/JavaScriptCore/runtime/NumberObject.h b/Source/JavaScriptCore/runtime/NumberObject.h index 90d0b26..cba65dd 100644 --- a/Source/JavaScriptCore/runtime/NumberObject.h +++ b/Source/JavaScriptCore/runtime/NumberObject.h @@ -27,11 +27,11 @@ namespace JSC { class NumberObject : public JSWrapperObject { public: - explicit NumberObject(JSGlobalData&, NonNullPassRefPtr<Structure>); + explicit NumberObject(JSGlobalData&, Structure*); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.cpp b/Source/JavaScriptCore/runtime/NumberPrototype.cpp index 6c027b3..24532dd 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/Source/JavaScriptCore/runtime/NumberPrototype.cpp @@ -45,7 +45,7 @@ static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*); // ECMA 15.7.4 -NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure) +NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure) : NumberObject(exec->globalData(), structure) { setInternalValue(exec->globalData(), jsNumber(0)); diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.h b/Source/JavaScriptCore/runtime/NumberPrototype.h index 191ab47..45bdfe7 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.h +++ b/Source/JavaScriptCore/runtime/NumberPrototype.h @@ -27,7 +27,7 @@ namespace JSC { class NumberPrototype : public NumberObject { public: - NumberPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure); + NumberPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp index c642a5b..aed5e24 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -75,7 +75,7 @@ const ClassInfo ObjectConstructor::s_info = { "Function", &InternalFunction::s_i @end */ -ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype) +ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object")) { // ECMA 15.2.3.1 @@ -342,7 +342,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec) if (!exec->argument(0).isObject() && !exec->argument(0).isNull()) return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null.")); JSObject* newObject = constructEmptyObject(exec); - newObject->setPrototype(exec->argument(0)); + newObject->setPrototype(exec->globalData(), exec->argument(0)); if (exec->argument(1).isUndefined()) return JSValue::encode(newObject); if (!exec->argument(1).isObject()) @@ -355,7 +355,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorSeal(ExecState* exec) JSValue obj = exec->argument(0); if (!obj.isObject()) return throwVMError(exec, createTypeError(exec, "Object.seal can only be called on Objects.")); - asObject(obj)->seal(); + asObject(obj)->seal(exec->globalData()); return JSValue::encode(obj); } @@ -364,7 +364,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorFreeze(ExecState* exec) JSValue obj = exec->argument(0); if (!obj.isObject()) return throwVMError(exec, createTypeError(exec, "Object.freeze can only be called on Objects.")); - asObject(obj)->freeze(); + asObject(obj)->freeze(exec->globalData()); return JSValue::encode(obj); } @@ -373,7 +373,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorPreventExtensions(ExecState* exec) JSValue obj = exec->argument(0); if (!obj.isObject()) return throwVMError(exec, createTypeError(exec, "Object.preventExtensions can only be called on Objects.")); - asObject(obj)->preventExtensions(); + asObject(obj)->preventExtensions(exec->globalData()); return JSValue::encode(obj); } @@ -382,7 +382,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorIsSealed(ExecState* exec) JSValue obj = exec->argument(0); if (!obj.isObject()) return throwVMError(exec, createTypeError(exec, "Object.isSealed can only be called on Objects.")); - return JSValue::encode(jsBoolean(asObject(obj)->isSealed())); + return JSValue::encode(jsBoolean(asObject(obj)->isSealed(exec->globalData()))); } EncodedJSValue JSC_HOST_CALL objectConstructorIsFrozen(ExecState* exec) @@ -390,7 +390,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorIsFrozen(ExecState* exec) JSValue obj = exec->argument(0); if (!obj.isObject()) return throwVMError(exec, createTypeError(exec, "Object.isFrozen can only be called on Objects.")); - return JSValue::encode(jsBoolean(asObject(obj)->isFrozen())); + return JSValue::encode(jsBoolean(asObject(obj)->isFrozen(exec->globalData()))); } EncodedJSValue JSC_HOST_CALL objectConstructorIsExtensible(ExecState* exec) diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h index b7bfc1d..6ebafcd 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.h +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h @@ -29,14 +29,14 @@ namespace JSC { class ObjectConstructor : public InternalFunction { public: - ObjectConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ObjectPrototype*); + ObjectConstructor(ExecState*, JSGlobalObject*, Structure*, ObjectPrototype*); virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); static const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp index 187456f..7469172 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -40,8 +40,8 @@ static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*); static EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*); static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*); -ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> stucture, Structure* functionStructure) - : JSNonFinalObject(stucture) +ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* stucture, Structure* functionStructure) + : JSNonFinalObject(exec->globalData(), stucture) , m_hasNoPropertiesWithUInt32Names(true) { putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum); diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.h b/Source/JavaScriptCore/runtime/ObjectPrototype.h index 61c8f57..9fb7fae 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.h +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.h @@ -27,7 +27,7 @@ namespace JSC { class ObjectPrototype : public JSNonFinalObject { public: - ObjectPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure); + ObjectPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure); private: virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); diff --git a/Source/JavaScriptCore/runtime/Operations.h b/Source/JavaScriptCore/runtime/Operations.h index 181f912..c102eeb 100644 --- a/Source/JavaScriptCore/runtime/Operations.h +++ b/Source/JavaScriptCore/runtime/Operations.h @@ -24,9 +24,8 @@ #include "ExceptionHelpers.h" #include "Interpreter.h" -#include "JSImmediate.h" -#include "JSNumberCell.h" #include "JSString.h" +#include "JSValueInlineMethods.h" namespace JSC { @@ -431,7 +430,7 @@ namespace JSC { if (cell->structure()->isDictionary()) { asObject(cell)->flattenDictionaryObject(callFrame->globalData()); if (slotBase == cell) - slotOffset = cell->structure()->get(propertyName); + slotOffset = cell->structure()->get(callFrame->globalData(), propertyName); } ++count; diff --git a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h index c000dc8..fc195cd 100644 --- a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h +++ b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h @@ -22,6 +22,7 @@ #define PropertyMapHashTable_h #include "UString.h" +#include "WriteBarrier.h" #include <wtf/HashTable.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -73,13 +74,13 @@ struct PropertyMapEntry { StringImpl* key; unsigned offset; unsigned attributes; - JSCell* specificValue; + WriteBarrier<JSCell> specificValue; - PropertyMapEntry(StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue) + PropertyMapEntry(JSGlobalData& globalData, JSCell* owner, StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue) : key(key) , offset(offset) , attributes(attributes) - , specificValue(specificValue) + , specificValue(globalData, owner, specificValue) { } }; @@ -141,9 +142,9 @@ public: typedef std::pair<ValueType*, unsigned> find_iterator; // Constructor is passed an initial capacity, a PropertyTable to copy, or both. - PropertyTable(unsigned initialCapacity); - PropertyTable(const PropertyTable&); - PropertyTable(unsigned initialCapacity, const PropertyTable&); + explicit PropertyTable(unsigned initialCapacity); + PropertyTable(JSGlobalData&, JSCell*, const PropertyTable&); + PropertyTable(JSGlobalData&, JSCell*, unsigned initialCapacity, const PropertyTable&); ~PropertyTable(); // Ordered iteration methods. @@ -176,7 +177,7 @@ public: void addDeletedOffset(unsigned offset); // Copy this PropertyTable, ensuring the copy has at least the capacity provided. - PassOwnPtr<PropertyTable> copy(unsigned newCapacity); + PassOwnPtr<PropertyTable> copy(JSGlobalData&, JSCell* owner, unsigned newCapacity); #ifndef NDEBUG size_t sizeInMemory(); @@ -184,6 +185,7 @@ public: #endif private: + PropertyTable(const PropertyTable&); // Used to insert a value known not to be in the table, and where we know capacity to be available. void reinsert(const ValueType& entry); @@ -243,7 +245,7 @@ inline PropertyTable::PropertyTable(unsigned initialCapacity) ASSERT(isPowerOf2(m_indexSize)); } -inline PropertyTable::PropertyTable(const PropertyTable& other) +inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, const PropertyTable& other) : m_indexSize(other.m_indexSize) , m_indexMask(other.m_indexMask) , m_index(static_cast<unsigned*>(fastMalloc(dataSize()))) @@ -255,8 +257,10 @@ inline PropertyTable::PropertyTable(const PropertyTable& other) memcpy(m_index, other.m_index, dataSize()); iterator end = this->end(); - for (iterator iter = begin(); iter != end; ++iter) + for (iterator iter = begin(); iter != end; ++iter) { iter->key->ref(); + writeBarrier(globalData, owner, iter->specificValue.get()); + } // Copy the m_deletedOffsets vector. Vector<unsigned>* otherDeletedOffsets = other.m_deletedOffsets.get(); @@ -264,7 +268,7 @@ inline PropertyTable::PropertyTable(const PropertyTable& other) m_deletedOffsets.set(new Vector<unsigned>(*otherDeletedOffsets)); } -inline PropertyTable::PropertyTable(unsigned initialCapacity, const PropertyTable& other) +inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, unsigned initialCapacity, const PropertyTable& other) : m_indexSize(sizeForCapacity(initialCapacity)) , m_indexMask(m_indexSize - 1) , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize()))) @@ -279,6 +283,7 @@ inline PropertyTable::PropertyTable(unsigned initialCapacity, const PropertyTabl ASSERT(canInsert()); reinsert(*iter); iter->key->ref(); + writeBarrier(globalData, owner, iter->specificValue.get()); } // Copy the m_deletedOffsets vector. @@ -443,15 +448,15 @@ inline void PropertyTable::addDeletedOffset(unsigned offset) m_deletedOffsets->append(offset); } -inline PassOwnPtr<PropertyTable> PropertyTable::copy(unsigned newCapacity) +inline PassOwnPtr<PropertyTable> PropertyTable::copy(JSGlobalData& globalData, JSCell* owner, unsigned newCapacity) { ASSERT(newCapacity >= m_keyCount); // Fast case; if the new table will be the same m_indexSize as this one, we can memcpy it, // save rehashing all keys. if (sizeForCapacity(newCapacity) == m_indexSize) - return new PropertyTable(*this); - return new PropertyTable(newCapacity, *this); + return new PropertyTable(globalData, owner, *this); + return new PropertyTable(globalData, owner, newCapacity, *this); } #ifndef NDEBUG diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp index 19b4b36..3da0198 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -95,7 +95,7 @@ const ClassInfo RegExpConstructor::s_info = { "Function", &InternalFunction::s_i @end */ -RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype) +RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp")) , d(adoptPtr(new RegExpConstructorPrivate)) { @@ -109,7 +109,7 @@ RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObje } RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data) - : JSArray(exec->lexicalGlobalObject()->regExpMatchesArrayStructure(), data->lastNumSubPatterns + 1, CreateInitialized) + : JSArray(exec->globalData(), exec->lexicalGlobalObject()->regExpMatchesArrayStructure(), data->lastNumSubPatterns + 1, CreateInitialized) { RegExpConstructorPrivate* d = new RegExpConstructorPrivate; d->input = data->lastInput; diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.h b/Source/JavaScriptCore/runtime/RegExpConstructor.h index 5e0b2b8..548664e 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.h +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.h @@ -57,9 +57,9 @@ namespace JSC { class RegExpConstructor : public InternalFunction { public: - RegExpConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, RegExpPrototype*); + RegExpConstructor(ExecState*, JSGlobalObject*, Structure*, RegExpPrototype*); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/RegExpObject.cpp b/Source/JavaScriptCore/runtime/RegExpObject.cpp index 4b5028b..d824ecd 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.cpp +++ b/Source/JavaScriptCore/runtime/RegExpObject.cpp @@ -61,7 +61,7 @@ const ClassInfo RegExpObject::s_info = { "RegExp", &JSObjectWithGlobalObject::s_ @end */ -RegExpObject::RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp) +RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, NonNullPassRefPtr<RegExp> regExp) : JSObjectWithGlobalObject(globalObject, structure) , d(adoptPtr(new RegExpObjectData(regExp))) { diff --git a/Source/JavaScriptCore/runtime/RegExpObject.h b/Source/JavaScriptCore/runtime/RegExpObject.h index fa2024d..4274fff 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.h +++ b/Source/JavaScriptCore/runtime/RegExpObject.h @@ -30,7 +30,7 @@ namespace JSC { public: typedef JSObjectWithGlobalObject Base; - RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>); + RegExpObject(JSGlobalObject*, Structure*, NonNullPassRefPtr<RegExp>); virtual ~RegExpObject(); void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; } @@ -58,7 +58,7 @@ namespace JSC { static JS_EXPORTDATA const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp index 61747b1..5bb8ad8 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -47,7 +47,7 @@ static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*); // ECMA 15.10.5 -RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure) +RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure) : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", NoFlags)) { putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.h b/Source/JavaScriptCore/runtime/RegExpPrototype.h index 70d77d9..2cc5405 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.h +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.h @@ -28,7 +28,7 @@ namespace JSC { class RegExpPrototype : public RegExpObject { public: - RegExpPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure); + RegExpPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ScopeChain.cpp b/Source/JavaScriptCore/runtime/ScopeChain.cpp index 4615f9a..026d729 100644 --- a/Source/JavaScriptCore/runtime/ScopeChain.cpp +++ b/Source/JavaScriptCore/runtime/ScopeChain.cpp @@ -51,6 +51,8 @@ void ScopeChainNode::print() #endif +const ClassInfo ScopeChainNode::s_info = { "ScopeChainNode", 0, 0, 0 }; + int ScopeChainNode::localDepth() { int scopeDepth = 0; diff --git a/Source/JavaScriptCore/runtime/ScopeChain.h b/Source/JavaScriptCore/runtime/ScopeChain.h index cb70a34..d0a2672 100644 --- a/Source/JavaScriptCore/runtime/ScopeChain.h +++ b/Source/JavaScriptCore/runtime/ScopeChain.h @@ -22,6 +22,7 @@ #define ScopeChain_h #include "JSCell.h" +#include "Structure.h" #include <wtf/FastAllocBase.h> namespace JSC { @@ -35,7 +36,7 @@ namespace JSC { class ScopeChainNode : public JSCell { public: ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) - : JSCell(globalData->scopeChainNodeStructure.get()) + : JSCell(*globalData, globalData->scopeChainNodeStructure.get()) , globalData(globalData) , next(*globalData, this, next) , object(*globalData, this, object) @@ -64,10 +65,11 @@ namespace JSC { void print(); #endif - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); } virtual void markChildren(MarkStack&); private: static const unsigned StructureFlags = OverridesMarkChildren; + static const ClassInfo s_info; }; inline ScopeChainNode* ScopeChainNode::push(JSObject* o) diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp index 24c501e..e666dee 100644 --- a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp +++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp @@ -29,7 +29,7 @@ namespace JSC { StrictEvalActivation::StrictEvalActivation(ExecState* exec) - : JSNonFinalObject(exec->globalData().strictEvalActivationStructure) + : JSNonFinalObject(exec->globalData(), exec->globalData().strictEvalActivationStructure.get()) { } diff --git a/Source/JavaScriptCore/runtime/StringConstructor.cpp b/Source/JavaScriptCore/runtime/StringConstructor.cpp index ed088e4..560202a 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.cpp +++ b/Source/JavaScriptCore/runtime/StringConstructor.cpp @@ -48,7 +48,7 @@ static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec) ASSERT_CLASS_FITS_IN_CELL(StringConstructor); -StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure, StringPrototype* stringPrototype) +StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure, StringPrototype* stringPrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className)) { // ECMA 15.5.3.1 String.prototype diff --git a/Source/JavaScriptCore/runtime/StringConstructor.h b/Source/JavaScriptCore/runtime/StringConstructor.h index 3a42c7e..117cce8 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.h +++ b/Source/JavaScriptCore/runtime/StringConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class StringConstructor : public InternalFunction { public: - StringConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* functionStructure, StringPrototype*); + StringConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure, StringPrototype*); virtual ConstructType getConstructData(ConstructData&); virtual CallType getCallData(CallData&); diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp index 47e5860..67dc291 100644 --- a/Source/JavaScriptCore/runtime/StringObject.cpp +++ b/Source/JavaScriptCore/runtime/StringObject.cpp @@ -29,22 +29,22 @@ ASSERT_CLASS_FITS_IN_CELL(StringObject); const ClassInfo StringObject::s_info = { "String", &JSWrapperObject::s_info, 0, 0 }; -StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure) - : JSWrapperObject(structure) +StringObject::StringObject(ExecState* exec, Structure* structure) + : JSWrapperObject(exec->globalData(), structure) { ASSERT(inherits(&s_info)); setInternalValue(exec->globalData(), jsEmptyString(exec)); } -StringObject::StringObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure, JSString* string) - : JSWrapperObject(structure) +StringObject::StringObject(JSGlobalData& globalData, Structure* structure, JSString* string) + : JSWrapperObject(globalData, structure) { ASSERT(inherits(&s_info)); setInternalValue(globalData, string); } -StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string) - : JSWrapperObject(structure) +StringObject::StringObject(ExecState* exec, Structure* structure, const UString& string) + : JSWrapperObject(exec->globalData(), structure) { ASSERT(inherits(&s_info)); setInternalValue(exec->globalData(), jsString(exec, string)); diff --git a/Source/JavaScriptCore/runtime/StringObject.h b/Source/JavaScriptCore/runtime/StringObject.h index ae3376d..4c16044 100644 --- a/Source/JavaScriptCore/runtime/StringObject.h +++ b/Source/JavaScriptCore/runtime/StringObject.h @@ -28,8 +28,8 @@ namespace JSC { class StringObject : public JSWrapperObject { public: - StringObject(ExecState*, NonNullPassRefPtr<Structure>); - StringObject(ExecState*, NonNullPassRefPtr<Structure>, const UString&); + StringObject(ExecState*, Structure*); + StringObject(ExecState*, Structure*, const UString&); static StringObject* create(ExecState*, JSGlobalObject*, JSString*); @@ -45,14 +45,14 @@ namespace JSC { JSString* internalValue() const { return asString(JSWrapperObject::internalValue());} - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSWrapperObject::StructureFlags; - StringObject(JSGlobalData&, NonNullPassRefPtr<Structure>, JSString*); + StringObject(JSGlobalData&, Structure*, JSString*); }; StringObject* asStringObject(JSValue); diff --git a/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h index e4c7061..3133944 100644 --- a/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h +++ b/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h @@ -37,12 +37,12 @@ namespace JSC { } private: - StringObjectThatMasqueradesAsUndefined(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string) + StringObjectThatMasqueradesAsUndefined(ExecState* exec, Structure* structure, const UString& string) : StringObject(exec, structure, string) { } - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/StringPrototype.cpp b/Source/JavaScriptCore/runtime/StringPrototype.cpp index a6bf4e6..91112a5 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.cpp +++ b/Source/JavaScriptCore/runtime/StringPrototype.cpp @@ -131,7 +131,7 @@ const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0, */ // ECMA 15.5.4 -StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) +StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) : StringObject(exec, structure) { ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/StringPrototype.h b/Source/JavaScriptCore/runtime/StringPrototype.h index 57def22..6c4b475 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.h +++ b/Source/JavaScriptCore/runtime/StringPrototype.h @@ -29,12 +29,12 @@ namespace JSC { class StringPrototype : public StringObject { public: - StringPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>); + StringPrototype(ExecState*, JSGlobalObject*, Structure*); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index 829e3db..dcc8e7c 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -61,21 +61,6 @@ int numRemoves; namespace JSC { -#ifndef NDEBUG -static WTF::RefCountedLeakCounter structureCounter("Structure"); - -#if ENABLE(JSC_MULTIPLE_THREADS) -static Mutex& ignoreSetMutex() -{ - DEFINE_STATIC_LOCAL(Mutex, mutex, ()); - return mutex; -} -#endif - -static bool shouldIgnoreLeaks; -static HashSet<Structure*>& ignoreSet = *(new HashSet<Structure*>); -#endif - #if DUMP_STRUCTURE_ID_STATISTICS static HashSet<Structure*>& liveStructureSet = *(new HashSet<Structure*>); #endif @@ -106,41 +91,41 @@ inline void StructureTransitionTable::remove(Structure* structure) // map mode). // As such, the passed structure *must* be the existing transition. ASSERT(singleTransition() == structure); - setSingleTransition(0); + clearSingleTransition(); } else { // Check whether a mapping exists for structure's key, and whether the // entry is structure (the latter check may fail if we initially had a // transition with a specific value, and this has been despecified). TransitionMap::iterator entry = map()->find(make_pair(structure->m_nameInPrevious, structure->m_attributesInPrevious)); - if (entry != map()->end() && structure == entry->second) + if (entry != map()->end() && structure == entry.get().second) map()->remove(entry); } } -inline void StructureTransitionTable::add(Structure* structure) +inline void StructureTransitionTable::add(JSGlobalData& globalData, Structure* structure) { if (isUsingSingleSlot()) { Structure* existingTransition = singleTransition(); // This handles the first transition being added. if (!existingTransition) { - setSingleTransition(structure); + setSingleTransition(globalData, structure); return; } // This handles the second transition being added // (or the first transition being despecified!) setMap(new TransitionMap()); - add(existingTransition); + add(globalData, existingTransition); } // Add the structure to the map. - std::pair<TransitionMap::iterator, bool> result = map()->add(make_pair(structure->m_nameInPrevious, structure->m_attributesInPrevious), structure); + std::pair<TransitionMap::iterator, bool> result = map()->add(globalData, make_pair(structure->m_nameInPrevious, structure->m_attributesInPrevious), structure); if (!result.second) { // There already is an entry! - we should only hit this when despecifying. - ASSERT(result.first->second->m_specificValueInPrevious); + ASSERT(result.first.get().second->m_specificValueInPrevious); ASSERT(!structure->m_specificValueInPrevious); - result.first->second = structure; + map()->set(result.first, structure); } } @@ -189,10 +174,10 @@ void Structure::dumpStatistics() #endif } -Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo) - : m_typeInfo(typeInfo) - , m_prototype(prototype) - , m_specificValueInPrevious(0) +Structure::Structure(JSGlobalData& globalData, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo) + : JSCell(globalData, globalData.structureStructure.get()) + , m_typeInfo(typeInfo) + , m_prototype(globalData, this, prototype) , m_classInfo(classInfo) , m_propertyStorageCapacity(typeInfo.isFinal() ? JSFinalObject_inlineStorageCapacity : JSNonFinalObject_inlineStorageCapacity) , m_offset(noOffset) @@ -206,27 +191,36 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anony , m_preventExtensions(false) { ASSERT(m_prototype); - ASSERT(m_prototype->isObject() || m_prototype->isNull()); + ASSERT(m_prototype.isObject() || m_prototype.isNull()); +} -#ifndef NDEBUG -#if ENABLE(JSC_MULTIPLE_THREADS) - MutexLocker protect(ignoreSetMutex()); -#endif - if (shouldIgnoreLeaks) - ignoreSet.add(this); - else - structureCounter.increment(); -#endif +const ClassInfo Structure::s_info = { "Structure", 0, 0, 0 }; -#if DUMP_STRUCTURE_ID_STATISTICS - liveStructureSet.add(this); -#endif +Structure::Structure(JSGlobalData& globalData) + : JSCell(globalData, this) + , m_typeInfo(CompoundType, OverridesMarkChildren) + , m_prototype(globalData, this, jsNull()) + , m_classInfo(&s_info) + , m_propertyStorageCapacity(0) + , m_offset(noOffset) + , m_dictionaryKind(NoneDictionaryKind) + , m_isPinnedPropertyTable(false) + , m_hasGetterSetterProperties(false) + , m_hasNonEnumerableProperties(false) + , m_attributesInPrevious(0) + , m_specificFunctionThrashCount(0) + , m_anonymousSlotCount(0) + , m_preventExtensions(false) +{ + ASSERT(m_prototype); + ASSERT(m_prototype.isNull()); + ASSERT(!globalData.structureStructure); } -Structure::Structure(const Structure* previous) - : m_typeInfo(previous->typeInfo()) - , m_prototype(previous->storedPrototype()) - , m_specificValueInPrevious(0) +Structure::Structure(JSGlobalData& globalData, const Structure* previous) + : JSCell(globalData, globalData.structureStructure.get()) + , m_typeInfo(previous->typeInfo()) + , m_prototype(globalData, this, previous->storedPrototype()) , m_classInfo(previous->m_classInfo) , m_propertyStorageCapacity(previous->m_propertyStorageCapacity) , m_offset(noOffset) @@ -240,61 +234,14 @@ Structure::Structure(const Structure* previous) , m_preventExtensions(previous->m_preventExtensions) { ASSERT(m_prototype); - ASSERT(m_prototype->isObject() || m_prototype->isNull()); - -#ifndef NDEBUG -#if ENABLE(JSC_MULTIPLE_THREADS) - MutexLocker protect(ignoreSetMutex()); -#endif - if (shouldIgnoreLeaks) - ignoreSet.add(this); - else - structureCounter.increment(); -#endif - -#if DUMP_STRUCTURE_ID_STATISTICS - liveStructureSet.add(this); -#endif + ASSERT(m_prototype.isObject() || m_prototype.isNull()); } Structure::~Structure() { - if (m_previous) { - ASSERT(m_nameInPrevious); - m_previous->m_transitionTable.remove(this); - } - -#ifndef NDEBUG -#if ENABLE(JSC_MULTIPLE_THREADS) - MutexLocker protect(ignoreSetMutex()); -#endif - HashSet<Structure*>::iterator it = ignoreSet.find(this); - if (it != ignoreSet.end()) - ignoreSet.remove(it); - else - structureCounter.decrement(); -#endif - -#if DUMP_STRUCTURE_ID_STATISTICS - liveStructureSet.remove(this); -#endif -} - -void Structure::startIgnoringLeaks() -{ -#ifndef NDEBUG - shouldIgnoreLeaks = true; -#endif } -void Structure::stopIgnoringLeaks() -{ -#ifndef NDEBUG - shouldIgnoreLeaks = false; -#endif -} - -void Structure::materializePropertyMap() +void Structure::materializePropertyMap(JSGlobalData& globalData) { ASSERT(!m_propertyTable); @@ -309,7 +256,7 @@ void Structure::materializePropertyMap() ASSERT(structure->m_propertyTable); ASSERT(!structure->m_previous); - m_propertyTable = structure->m_propertyTable->copy(m_offset + 1); + m_propertyTable = structure->m_propertyTable->copy(globalData, 0, m_offset + 1); break; } @@ -321,7 +268,7 @@ void Structure::materializePropertyMap() for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) { structure = structures[i]; - PropertyMapEntry entry(structure->m_nameInPrevious.get(), m_anonymousSlotCount + structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious); + PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), m_anonymousSlotCount + structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get()); m_propertyTable->add(entry); } } @@ -334,27 +281,27 @@ void Structure::growPropertyStorageCapacity() m_propertyStorageCapacity *= 2; } -void Structure::despecifyDictionaryFunction(const Identifier& propertyName) +void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Identifier& propertyName) { StringImpl* rep = propertyName.impl(); - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); ASSERT(isDictionary()); ASSERT(m_propertyTable); PropertyMapEntry* entry = m_propertyTable->find(rep).first; ASSERT(entry); - entry->specificValue = 0; + entry->specificValue.clear(); } -PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); if (Structure* existingTransition = structure->m_transitionTable.get(propertyName.impl(), attributes)) { - JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious; + JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious.get(); if (specificValueInPrevious && specificValueInPrevious != specificValue) return 0; ASSERT(existingTransition->m_offset != noOffset); @@ -367,7 +314,7 @@ PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Struct return 0; } -PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { // If we have a specific function, we may have got to this point if there is // already a transition with the correct property name and attributes, but @@ -387,37 +334,37 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con specificValue = 0; if (structure->transitionCount() > s_maxTransitionLength) { - RefPtr<Structure> transition = toCacheableDictionaryTransition(structure); + Structure* transition = toCacheableDictionaryTransition(globalData, structure); ASSERT(structure != transition); - offset = transition->put(propertyName, attributes, specificValue); + offset = transition->putSpecificValue(globalData, propertyName, attributes, specificValue); ASSERT(offset >= structure->m_anonymousSlotCount); ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) transition->growPropertyStorageCapacity(); - return transition.release(); + return transition; } - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); - transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain; - transition->m_previous = structure; + transition->m_cachedPrototypeChain.set(globalData, transition, structure->m_cachedPrototypeChain.get()); + transition->m_previous.set(globalData, transition, structure); transition->m_nameInPrevious = propertyName.impl(); transition->m_attributesInPrevious = attributes; - transition->m_specificValueInPrevious = specificValue; + transition->m_specificValueInPrevious.set(globalData, transition, specificValue); if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) - transition->m_propertyTable = structure->m_propertyTable->copy(structure->m_propertyTable->size() + 1); + transition->m_propertyTable = structure->m_propertyTable->copy(globalData, 0, structure->m_propertyTable->size() + 1); else transition->m_propertyTable = structure->m_propertyTable.release(); } else { if (structure->m_previous) - transition->materializePropertyMap(); + transition->materializePropertyMap(globalData); else transition->createPropertyMap(); } - offset = transition->put(propertyName, attributes, specificValue); + offset = transition->putSpecificValue(globalData, propertyName, attributes, specificValue); ASSERT(offset >= structure->m_anonymousSlotCount); ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) @@ -425,106 +372,106 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con transition->m_offset = offset - structure->m_anonymousSlotCount; ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - structure->m_transitionTable.add(transition.get()); - return transition.release(); + structure->m_transitionTable.add(globalData, transition); + return transition; } -PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset) +Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, size_t& offset) { ASSERT(!structure->isUncacheableDictionary()); - RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure); + Structure* transition = toUncacheableDictionaryTransition(globalData, structure); offset = transition->remove(propertyName); ASSERT(offset >= structure->m_anonymousSlotCount); ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); - return transition.release(); + return transition; } -PassRefPtr<Structure> Structure::changePrototypeTransition(Structure* structure, JSValue prototype) +Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Structure* structure, JSValue prototype) { - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); - transition->m_prototype = prototype; + transition->m_prototype.set(globalData, transition, prototype); // Don't set m_offset, as one can not transition to this. - structure->materializePropertyMapIfNecessary(); - transition->m_propertyTable = structure->copyPropertyTable(); + structure->materializePropertyMapIfNecessary(globalData); + transition->m_propertyTable = structure->copyPropertyTable(globalData, transition); transition->m_isPinnedPropertyTable = true; ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - return transition.release(); + return transition; } -PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction) +Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, const Identifier& replaceFunction) { ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); ++transition->m_specificFunctionThrashCount; // Don't set m_offset, as one can not transition to this. - structure->materializePropertyMapIfNecessary(); - transition->m_propertyTable = structure->copyPropertyTable(); + structure->materializePropertyMapIfNecessary(globalData); + transition->m_propertyTable = structure->copyPropertyTable(globalData, transition); transition->m_isPinnedPropertyTable = true; if (transition->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) - transition->despecifyAllFunctions(); + transition->despecifyAllFunctions(globalData); else { - bool removed = transition->despecifyFunction(replaceFunction); + bool removed = transition->despecifyFunction(globalData, replaceFunction); ASSERT_UNUSED(removed, removed); } ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - return transition.release(); + return transition; } -PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure) +Structure* Structure::getterSetterTransition(JSGlobalData& globalData, Structure* structure) { - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); // Don't set m_offset, as one can not transition to this. - structure->materializePropertyMapIfNecessary(); - transition->m_propertyTable = structure->copyPropertyTable(); + structure->materializePropertyMapIfNecessary(globalData); + transition->m_propertyTable = structure->copyPropertyTable(globalData, transition); transition->m_isPinnedPropertyTable = true; ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - return transition.release(); + return transition; } -PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind) +Structure* Structure::toDictionaryTransition(JSGlobalData& globalData, Structure* structure, DictionaryKind kind) { ASSERT(!structure->isUncacheableDictionary()); - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); - structure->materializePropertyMapIfNecessary(); - transition->m_propertyTable = structure->copyPropertyTable(); + structure->materializePropertyMapIfNecessary(globalData); + transition->m_propertyTable = structure->copyPropertyTable(globalData, transition); transition->m_isPinnedPropertyTable = true; transition->m_dictionaryKind = kind; ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - return transition.release(); + return transition; } -PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure) +Structure* Structure::toCacheableDictionaryTransition(JSGlobalData& globalData, Structure* structure) { - return toDictionaryTransition(structure, CachedDictionaryKind); + return toDictionaryTransition(globalData, structure, CachedDictionaryKind); } -PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure) +Structure* Structure::toUncacheableDictionaryTransition(JSGlobalData& globalData, Structure* structure) { - return toDictionaryTransition(structure, UncachedDictionaryKind); + return toDictionaryTransition(globalData, structure, UncachedDictionaryKind); } // In future we may want to cache this transition. -PassRefPtr<Structure> Structure::sealTransition(Structure* structure) +Structure* Structure::sealTransition(JSGlobalData& globalData, Structure* structure) { - RefPtr<Structure> transition = preventExtensionsTransition(structure); + Structure* transition = preventExtensionsTransition(globalData, structure); if (transition->m_propertyTable) { PropertyTable::iterator end = transition->m_propertyTable->end(); @@ -532,13 +479,13 @@ PassRefPtr<Structure> Structure::sealTransition(Structure* structure) iter->attributes |= DontDelete; } - return transition.release(); + return transition; } // In future we may want to cache this transition. -PassRefPtr<Structure> Structure::freezeTransition(Structure* structure) +Structure* Structure::freezeTransition(JSGlobalData& globalData, Structure* structure) { - RefPtr<Structure> transition = preventExtensionsTransition(structure); + Structure* transition = preventExtensionsTransition(globalData, structure); if (transition->m_propertyTable) { PropertyTable::iterator end = transition->m_propertyTable->end(); @@ -546,32 +493,32 @@ PassRefPtr<Structure> Structure::freezeTransition(Structure* structure) iter->attributes |= (DontDelete | ReadOnly); } - return transition.release(); + return transition; } // In future we may want to cache this transition. -PassRefPtr<Structure> Structure::preventExtensionsTransition(Structure* structure) +Structure* Structure::preventExtensionsTransition(JSGlobalData& globalData, Structure* structure) { - RefPtr<Structure> transition = create(structure); + Structure* transition = create(globalData, structure); // Don't set m_offset, as one can not transition to this. - structure->materializePropertyMapIfNecessary(); - transition->m_propertyTable = structure->copyPropertyTable(); + structure->materializePropertyMapIfNecessary(globalData); + transition->m_propertyTable = structure->copyPropertyTable(globalData, transition); transition->m_isPinnedPropertyTable = true; transition->m_preventExtensions = true; ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); - return transition.release(); + return transition; } // In future we may want to cache this property. -bool Structure::isSealed() +bool Structure::isSealed(JSGlobalData& globalData) { if (isExtensible()) return false; - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return true; @@ -584,12 +531,12 @@ bool Structure::isSealed() } // In future we may want to cache this property. -bool Structure::isFrozen() +bool Structure::isFrozen(JSGlobalData& globalData) { if (isExtensible()) return false; - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return true; @@ -601,7 +548,7 @@ bool Structure::isFrozen() return true; } -PassRefPtr<Structure> Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObject* object) +Structure* Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObject* object) { ASSERT(isDictionary()); if (isUncacheableDictionary()) { @@ -630,30 +577,30 @@ PassRefPtr<Structure> Structure::flattenDictionaryStructure(JSGlobalData& global return this; } -size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!m_enumerationCache); if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) specificValue = 0; - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); m_isPinnedPropertyTable = true; - size_t offset = put(propertyName, attributes, specificValue); + size_t offset = putSpecificValue(globalData, propertyName, attributes, specificValue); ASSERT(offset >= m_anonymousSlotCount); if (propertyStorageSize() > propertyStorageCapacity()) growPropertyStorageCapacity(); return offset; } -size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName) +size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName) { ASSERT(isUncacheableDictionary()); ASSERT(!m_enumerationCache); - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); m_isPinnedPropertyTable = true; size_t offset = remove(propertyName); @@ -688,14 +635,14 @@ inline void Structure::checkConsistency() #endif -PropertyTable* Structure::copyPropertyTable() +PropertyTable* Structure::copyPropertyTable(JSGlobalData& globalData, Structure* owner) { - return m_propertyTable ? new PropertyTable(*m_propertyTable) : 0; + return m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : 0; } -size_t Structure::get(StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue) +size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue) { - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return WTF::notFound; @@ -704,14 +651,14 @@ size_t Structure::get(StringImpl* propertyName, unsigned& attributes, JSCell*& s return WTF::notFound; attributes = entry->attributes; - specificValue = entry->specificValue; + specificValue = entry->specificValue.get(); ASSERT(entry->offset >= m_anonymousSlotCount); return entry->offset; } -bool Structure::despecifyFunction(const Identifier& propertyName) +bool Structure::despecifyFunction(JSGlobalData& globalData, const Identifier& propertyName) { - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return false; @@ -721,25 +668,25 @@ bool Structure::despecifyFunction(const Identifier& propertyName) return false; ASSERT(entry->specificValue); - entry->specificValue = 0; + entry->specificValue.clear(); return true; } -void Structure::despecifyAllFunctions() +void Structure::despecifyAllFunctions(JSGlobalData& globalData) { - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return; PropertyTable::iterator end = m_propertyTable->end(); for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) - iter->specificValue = 0; + iter->specificValue.clear(); } -size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!propertyName.isNull()); - ASSERT(get(propertyName) == notFound); + ASSERT(get(globalData, propertyName) == notFound); checkConsistency(); if (attributes & DontEnum) @@ -758,7 +705,7 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel newOffset = m_propertyTable->size() + m_anonymousSlotCount; ASSERT(newOffset >= m_anonymousSlotCount); - m_propertyTable->add(PropertyMapEntry(rep, newOffset, attributes, specificValue)); + m_propertyTable->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue)); checkConsistency(); return newOffset; @@ -798,9 +745,9 @@ void Structure::createPropertyMap(unsigned capacity) checkConsistency(); } -void Structure::getPropertyNames(PropertyNameArray& propertyNames, EnumerationMode mode) +void Structure::getPropertyNames(JSGlobalData& globalData, PropertyNameArray& propertyNames, EnumerationMode mode) { - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return; @@ -818,11 +765,26 @@ void Structure::getPropertyNames(PropertyNameArray& propertyNames, EnumerationMo } } -void Structure::initializeThreading() -{ -#if !defined(NDEBUG) && ENABLE(JSC_MULTIPLE_THREADS) - ignoreSetMutex(); -#endif +void Structure::markChildren(MarkStack& markStack) +{ + JSCell::markChildren(markStack); + if (m_prototype) + markStack.append(&m_prototype); + if (m_cachedPrototypeChain) + markStack.append(&m_cachedPrototypeChain); + if (m_previous) + markStack.append(&m_previous); + if (m_specificValueInPrevious) + markStack.append(&m_specificValueInPrevious); + if (m_enumerationCache) + markStack.append(&m_enumerationCache); + if (m_propertyTable) { + PropertyTable::iterator end = m_propertyTable->end(); + for (PropertyTable::iterator ptr = m_propertyTable->begin(); ptr != end; ++ptr) { + if (ptr->specificValue) + markStack.append(&ptr->specificValue); + } + } } #if DO_PROPERTYMAP_CONSTENCY_CHECK diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index c9f900a..fe9ce6b 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -27,6 +27,7 @@ #define Structure_h #include "Identifier.h" +#include "JSCell.h" #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" @@ -35,7 +36,7 @@ #include "StructureTransitionTable.h" #include "JSTypeInfo.h" #include "UString.h" -#include "WeakGCPtr.h" +#include "Weak.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -54,49 +55,41 @@ namespace JSC { IncludeDontEnumProperties }; - class Structure : public RefCounted<Structure> { + class Structure : public JSCell { public: friend class StructureTransitionTable; - static PassRefPtr<Structure> create(JSGlobalData&, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo) + static Structure* create(JSGlobalData& globalData, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo) { - return adoptRef(new Structure(prototype, typeInfo, anonymousSlotCount, classInfo)); + ASSERT(globalData.structureStructure); + return new (&globalData) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo); } - enum VPtrStealingHackType { VPtrStealingHack }; - static PassRefPtr<Structure> create(VPtrStealingHackType, const ClassInfo* classInfo) - { - return adoptRef(new Structure(jsNull(), TypeInfo(UnspecifiedType), 0, classInfo)); - } - - static void startIgnoringLeaks(); - static void stopIgnoringLeaks(); - static void dumpStatistics(); - static PassRefPtr<Structure> addPropertyTransition(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - static PassRefPtr<Structure> addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset); - static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue prototype); - static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&); - static PassRefPtr<Structure> getterSetterTransition(Structure*); - static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*); - static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*); - static PassRefPtr<Structure> sealTransition(Structure*); - static PassRefPtr<Structure> freezeTransition(Structure*); - static PassRefPtr<Structure> preventExtensionsTransition(Structure*); - - bool isSealed(); - bool isFrozen(); + static Structure* addPropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + static Structure* addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + static Structure* removePropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, size_t& offset); + static Structure* changePrototypeTransition(JSGlobalData&, Structure*, JSValue prototype); + static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, const Identifier&); + static Structure* getterSetterTransition(JSGlobalData&, Structure*); + static Structure* toCacheableDictionaryTransition(JSGlobalData&, Structure*); + static Structure* toUncacheableDictionaryTransition(JSGlobalData&, Structure*); + static Structure* sealTransition(JSGlobalData&, Structure*); + static Structure* freezeTransition(JSGlobalData&, Structure*); + static Structure* preventExtensionsTransition(JSGlobalData&, Structure*); + + bool isSealed(JSGlobalData&); + bool isFrozen(JSGlobalData&); bool isExtensible() const { return !m_preventExtensions; } - PassRefPtr<Structure> flattenDictionaryStructure(JSGlobalData&, JSObject*); + Structure* flattenDictionaryStructure(JSGlobalData&, JSObject*); ~Structure(); // These should be used with caution. - size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); - size_t removePropertyWithoutTransition(const Identifier& propertyName); - void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; } + size_t addPropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); + size_t removePropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName); + void setPrototypeWithoutTransition(JSGlobalData& globalData, JSValue prototype) { m_prototype.set(globalData, this, prototype); } bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; } @@ -104,10 +97,9 @@ namespace JSC { const TypeInfo& typeInfo() const { return m_typeInfo; } JSValue storedPrototype() const { return m_prototype.get(); } - DeprecatedPtr<Unknown>* storedPrototypeSlot() { return &m_prototype; } JSValue prototypeForLookup(ExecState*) const; StructureChain* prototypeChain(ExecState*) const; - DeprecatedPtr<StructureChain>* cachedPrototypeChainSlot() { return &m_cachedPrototypeChain; } + void markChildren(MarkStack&); Structure* previousID() const { return m_previous.get(); } @@ -116,12 +108,12 @@ namespace JSC { unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->propertyStorageSize() : static_cast<unsigned>(m_offset + 1)); } bool isUsingInlineStorage() const; - size_t get(const Identifier& propertyName); - size_t get(StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue); - size_t get(const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue) + size_t get(JSGlobalData&, const Identifier& propertyName); + size_t get(JSGlobalData&, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue); + size_t get(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue) { ASSERT(!propertyName.isNull()); - return get(propertyName.impl(), attributes, specificValue); + return get(globalData, propertyName.impl(), attributes, specificValue); } bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } @@ -134,18 +126,15 @@ namespace JSC { bool isEmpty() const { return m_propertyTable ? m_propertyTable->isEmpty() : m_offset == noOffset; } - void despecifyDictionaryFunction(const Identifier& propertyName); + void despecifyDictionaryFunction(JSGlobalData&, const Identifier& propertyName); void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; } void setEnumerationCache(JSGlobalData&, JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. - void clearEnumerationCache(); // Defined in JSPropertyNameIterator.h. JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h. - void getPropertyNames(PropertyNameArray&, EnumerationMode mode); + void getPropertyNames(JSGlobalData&, PropertyNameArray&, EnumerationMode mode); const ClassInfo* classInfo() const { return m_classInfo; } - static void initializeThreading(); - static ptrdiff_t prototypeOffset() { return OBJECT_OFFSETOF(Structure, m_prototype); @@ -161,37 +150,47 @@ namespace JSC { return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::typeOffset(); } + static Structure* createStructure(JSGlobalData& globalData) + { + ASSERT(!globalData.structureStructure); + return new (&globalData) Structure(globalData); + } + private: - Structure(JSValue prototype, const TypeInfo&, unsigned anonymousSlotCount, const ClassInfo*); - Structure(const Structure*); + Structure(JSGlobalData&, JSValue prototype, const TypeInfo&, unsigned anonymousSlotCount, const ClassInfo*); + Structure(JSGlobalData&); + Structure(JSGlobalData&, const Structure*); - static PassRefPtr<Structure> create(const Structure* structure) + static Structure* create(JSGlobalData& globalData, const Structure* structure) { - return adoptRef(new Structure(structure)); + ASSERT(globalData.structureStructure); + return new (&globalData) Structure(globalData, structure); } - + + static const ClassInfo s_info; + typedef enum { NoneDictionaryKind = 0, CachedDictionaryKind = 1, UncachedDictionaryKind = 2 } DictionaryKind; - static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind); + static Structure* toDictionaryTransition(JSGlobalData&, Structure*, DictionaryKind); - size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); + size_t putSpecificValue(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t remove(const Identifier& propertyName); void createPropertyMap(unsigned keyCount = 0); void checkConsistency(); - bool despecifyFunction(const Identifier&); - void despecifyAllFunctions(); + bool despecifyFunction(JSGlobalData&, const Identifier&); + void despecifyAllFunctions(JSGlobalData&); - PropertyTable* copyPropertyTable(); - void materializePropertyMap(); - void materializePropertyMapIfNecessary() + PropertyTable* copyPropertyTable(JSGlobalData&, Structure* owner); + void materializePropertyMap(JSGlobalData&); + void materializePropertyMapIfNecessary(JSGlobalData& globalData) { if (!m_propertyTable && m_previous) - materializePropertyMap(); + materializePropertyMap(globalData); } signed char transitionCount() const @@ -210,18 +209,18 @@ namespace JSC { TypeInfo m_typeInfo; - DeprecatedPtr<Unknown> m_prototype; - mutable DeprecatedPtr<StructureChain> m_cachedPrototypeChain; + WriteBarrier<Unknown> m_prototype; + mutable WriteBarrier<StructureChain> m_cachedPrototypeChain; - RefPtr<Structure> m_previous; + WriteBarrier<Structure> m_previous; RefPtr<StringImpl> m_nameInPrevious; - JSCell* m_specificValueInPrevious; + WriteBarrier<JSCell> m_specificValueInPrevious; const ClassInfo* m_classInfo; StructureTransitionTable m_transitionTable; - WeakGCPtr<JSPropertyNameIterator> m_enumerationCache; + WriteBarrier<JSPropertyNameIterator> m_enumerationCache; OwnPtr<PropertyTable> m_propertyTable; @@ -248,9 +247,9 @@ namespace JSC { // 4 free bits }; - inline size_t Structure::get(const Identifier& propertyName) + inline size_t Structure::get(JSGlobalData& globalData, const Identifier& propertyName) { - materializePropertyMapIfNecessary(); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return notFound; @@ -259,6 +258,48 @@ namespace JSC { return entry ? entry->offset : notFound; } + inline bool JSCell::isObject() const + { + return m_structure->typeInfo().type() == ObjectType; + } + + inline bool JSCell::isString() const + { + return m_structure->typeInfo().type() == StringType; + } + + inline const ClassInfo* JSCell::classInfo() const + { + return m_structure->classInfo(); + } + + inline Structure* JSCell::createDummyStructure(JSGlobalData& globalData) + { + return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, 0); + } + + inline bool JSValue::needsThisConversion() const + { + if (UNLIKELY(!isCell())) + return true; + return asCell()->structure()->typeInfo().needsThisConversion(); + } + + ALWAYS_INLINE void MarkStack::internalAppend(JSCell* cell) + { + ASSERT(!m_isCheckingForDefaultMarkViolation); + ASSERT(cell); + if (Heap::testAndSetMarked(cell)) + return; + if (cell->structure()->typeInfo().type() >= CompoundType) + m_values.append(cell); + } + + inline StructureTransitionTable::Hash::Key StructureTransitionTable::keyForWeakGCMapFinalizer(void*, Structure* structure) + { + return Hash::Key(structure->m_nameInPrevious.get(), structure->m_attributesInPrevious); + } + } // namespace JSC #endif // Structure_h diff --git a/Source/JavaScriptCore/runtime/StructureChain.cpp b/Source/JavaScriptCore/runtime/StructureChain.cpp index 4fa4a4b..ad6abff 100644 --- a/Source/JavaScriptCore/runtime/StructureChain.cpp +++ b/Source/JavaScriptCore/runtime/StructureChain.cpp @@ -31,20 +31,33 @@ #include <wtf/RefPtr.h> namespace JSC { + +ClassInfo StructureChain::s_info = { "StructureChain", 0, 0, 0 }; -StructureChain::StructureChain(NonNullPassRefPtr<Structure> structure, Structure* head) - : JSCell(structure.releaseRef()) +StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure, Structure* head) + : JSCell(globalData, structure) { size_t size = 0; for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure()) ++size; - m_vector = adoptArrayPtr(new RefPtr<Structure>[size + 1]); + m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]); size_t i = 0; for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure()) - m_vector[i++] = current; - m_vector[i] = 0; + m_vector[i++].set(globalData, this, current); + m_vector[i].clear(); +} + +StructureChain::~StructureChain() +{ +} + +void StructureChain::markChildren(MarkStack& markStack) +{ + size_t i = 0; + while (m_vector[i]) + markStack.append(&m_vector[i++]); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StructureChain.h b/Source/JavaScriptCore/runtime/StructureChain.h index 88592dc..b984be6 100644 --- a/Source/JavaScriptCore/runtime/StructureChain.h +++ b/Source/JavaScriptCore/runtime/StructureChain.h @@ -27,6 +27,7 @@ #define StructureChain_h #include "JSCell.h" +#include "Structure.h" #include <wtf/OwnArrayPtr.h> #include <wtf/PassRefPtr.h> @@ -41,14 +42,17 @@ namespace JSC { friend class JIT; public: - static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (&globalData) StructureChain(globalData.structureChainStructure, head); } - RefPtr<Structure>* head() { return m_vector.get(); } + static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (&globalData) StructureChain(globalData, globalData.structureChainStructure.get(), head); } + WriteBarrier<Structure>* head() { return m_vector.get(); } + void markChildren(MarkStack&); - static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, 0); } - private: - StructureChain(NonNullPassRefPtr<Structure>, Structure* head); + static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, &s_info); } - OwnArrayPtr<RefPtr<Structure> > m_vector; + private: + StructureChain(JSGlobalData&, Structure*, Structure* head); + ~StructureChain(); + OwnArrayPtr<WriteBarrier<Structure> > m_vector; + static ClassInfo s_info; }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/Source/JavaScriptCore/runtime/StructureTransitionTable.h index da78e1b..adebad2 100644 --- a/Source/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/Source/JavaScriptCore/runtime/StructureTransitionTable.h @@ -27,8 +27,8 @@ #define StructureTransitionTable_h #include "UString.h" +#include "WeakGCMap.h" #include <wtf/HashFunctions.h> -#include <wtf/HashMap.h> #include <wtf/HashTraits.h> #include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> @@ -69,7 +69,21 @@ class StructureTransitionTable { static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); } }; - typedef HashMap<Hash::Key, Structure*, Hash, HashTraits> TransitionMap; + struct WeakGCMapFinalizerCallback { + static void* finalizerContextFor(Hash::Key) + { + return 0; + } + + static inline Hash::Key keyForFinalizer(void* context, Structure* structure) + { + return keyForWeakGCMapFinalizer(context, structure); + } + }; + + typedef WeakGCMap<Hash::Key, Structure, WeakGCMapFinalizerCallback, Hash, HashTraits> TransitionMap; + + static Hash::Key keyForWeakGCMapFinalizer(void* context, Structure*); public: StructureTransitionTable() @@ -81,9 +95,11 @@ public: { if (!isUsingSingleSlot()) delete map(); + else + clearSingleTransition(); } - inline void add(Structure*); + inline void add(JSGlobalData&, Structure*); inline void remove(Structure*); inline bool contains(StringImpl* rep, unsigned attributes) const; inline Structure* get(StringImpl* rep, unsigned attributes) const; @@ -100,9 +116,18 @@ private: return reinterpret_cast<TransitionMap*>(m_data); } + HandleSlot slot() const + { + ASSERT(isUsingSingleSlot()); + return reinterpret_cast<HandleSlot>(m_data & ~UsingSingleSlotFlag); + } + void setMap(TransitionMap* map) { ASSERT(isUsingSingleSlot()); + + if (HandleSlot slot = this->slot()) + HandleHeap::heapFor(slot)->deallocate(slot); // This implicitly clears the flag that indicates we're using a single transition m_data = reinterpret_cast<intptr_t>(map); @@ -113,13 +138,31 @@ private: Structure* singleTransition() const { ASSERT(isUsingSingleSlot()); - return reinterpret_cast<Structure*>(m_data & ~UsingSingleSlotFlag); + if (HandleSlot slot = this->slot()) { + if (*slot) + return reinterpret_cast<Structure*>(slot->asCell()); + } + return 0; } - - void setSingleTransition(Structure* structure) + + void clearSingleTransition() { ASSERT(isUsingSingleSlot()); - m_data = reinterpret_cast<intptr_t>(structure) | UsingSingleSlotFlag; + if (HandleSlot slot = this->slot()) + HandleHeap::heapFor(slot)->deallocate(slot); + } + + void setSingleTransition(JSGlobalData& globalData, Structure* structure) + { + ASSERT(isUsingSingleSlot()); + HandleSlot slot = this->slot(); + if (!slot) { + slot = globalData.allocateGlobalHandle(); + HandleHeap::heapFor(slot)->makeWeak(slot, 0, 0); + m_data = reinterpret_cast<intptr_t>(slot) | UsingSingleSlotFlag; + } + HandleHeap::heapFor(slot)->writeBarrier(slot, reinterpret_cast<JSCell*>(structure)); + *slot = reinterpret_cast<JSCell*>(structure); } intptr_t m_data; diff --git a/Source/JavaScriptCore/runtime/UString.h b/Source/JavaScriptCore/runtime/UString.h index 8f6c083..b98e7b4 100644 --- a/Source/JavaScriptCore/runtime/UString.h +++ b/Source/JavaScriptCore/runtime/UString.h @@ -252,10 +252,7 @@ template<> struct DefaultHash<JSC::UString> { typedef JSC::UStringHash Hash; }; -template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits -{ - static const bool canInitializeWithMemset = true; -}; +template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits { }; } // namespace WTF diff --git a/Source/JavaScriptCore/runtime/WeakGCMap.h b/Source/JavaScriptCore/runtime/WeakGCMap.h index a40e684..5ad1c62 100644 --- a/Source/JavaScriptCore/runtime/WeakGCMap.h +++ b/Source/JavaScriptCore/runtime/WeakGCMap.h @@ -34,17 +34,31 @@ namespace JSC { // A HashMap for GC'd values that removes entries when the associated value // dies. -template<typename KeyType, typename MappedType> class WeakGCMap : private Finalizer { +template <typename KeyType, typename MappedType> struct DefaultWeakGCMapFinalizerCallback { + static void* finalizerContextFor(KeyType key) + { + return reinterpret_cast<void*>(key); + } + + static KeyType keyForFinalizer(void* context, typename HandleTypes<MappedType>::ExternalType) + { + return reinterpret_cast<KeyType>(context); + } +}; + +template<typename KeyType, typename MappedType, typename FinalizerCallback = DefaultWeakGCMapFinalizerCallback<KeyType, MappedType>, typename HashArg = typename DefaultHash<KeyType>::Hash, typename KeyTraitsArg = HashTraits<KeyType> > +class WeakGCMap : private WeakHandleOwner { WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(WeakGCMap); - typedef HashMap<KeyType, HandleSlot> MapType; + typedef HashMap<KeyType, HandleSlot, HashArg, KeyTraitsArg> MapType; typedef typename HandleTypes<MappedType>::ExternalType ExternalType; typedef typename MapType::iterator map_iterator; public: struct iterator { + friend class WeakGCMap; iterator(map_iterator iter) : m_iterator(iter) { @@ -62,7 +76,7 @@ public: bool operator!=(const iterator& other) const { return m_iterator != other.m_iterator; } private: - map_iterator m_iterator; + map_iterator m_iterator; }; WeakGCMap() @@ -78,6 +92,25 @@ public: m_map.clear(); } + bool contains(const KeyType& key) const + { + return m_map.contains(key); + } + + iterator find(const KeyType& key) + { + return m_map.find(key); + } + + void remove(iterator iter) + { + ASSERT(iter.m_iterator != m_map.end()); + HandleSlot slot = iter.m_iterator->second; + ASSERT(slot); + HandleHeap::heapFor(slot)->deallocate(slot); + m_map.remove(iter.m_iterator); + } + ExternalType get(const KeyType& key) const { return HandleTypes<MappedType>::getFromSlot(m_map.get(key)); @@ -88,14 +121,35 @@ public: return m_map.get(key); } + pair<iterator, bool> add(JSGlobalData& globalData, const KeyType& key, ExternalType value) + { + pair<typename MapType::iterator, bool> iter = m_map.add(key, 0); + if (iter.second) { + HandleSlot slot = globalData.allocateGlobalHandle(); + iter.first->second = slot; + HandleHeap::heapFor(slot)->makeWeak(slot, this, FinalizerCallback::finalizerContextFor(key)); + HandleHeap::heapFor(slot)->writeBarrier(slot, value); + *slot = value; + } + return iter; + } + + void set(iterator iter, ExternalType value) + { + HandleSlot slot = iter.m_iterator->second; + ASSERT(slot); + HandleHeap::heapFor(slot)->writeBarrier(slot, value); + *slot = value; + } + void set(JSGlobalData& globalData, const KeyType& key, ExternalType value) { pair<typename MapType::iterator, bool> iter = m_map.add(key, 0); HandleSlot slot = iter.first->second; if (iter.second) { slot = globalData.allocateGlobalHandle(); - iter.first->second = slot; HandleHeap::heapFor(slot)->makeWeak(slot, this, key); + iter.first->second = slot; } HandleHeap::heapFor(slot)->writeBarrier(slot, value); *slot = value; @@ -113,22 +167,6 @@ public: size_t size() { return m_map.size(); } - bool deprecatedRemove(const KeyType& key, ExternalType value) - { - // This only exists in order to allow some semblance of correctness to - // the JSWeakObjectMapClear API - typename MapType::iterator iter = m_map.find(key); - if (iter == m_map.end()) - return false; - HandleSlot slot = iter->second; - ExternalType inmap = HandleTypes<MappedType>::getFromSlot(slot); - if (inmap && inmap != value) - return false; - m_map.remove(iter); - HandleHeap::heapFor(slot)->deallocate(slot); - return true; - } - iterator begin() { return iterator(m_map.begin()); } iterator end() { return iterator(m_map.end()); } @@ -138,9 +176,9 @@ public: } private: - virtual void finalize(Handle<Unknown>, void* key) + virtual void finalize(Handle<Unknown> handle, void* context) { - HandleSlot slot = m_map.take(static_cast<KeyType>(key)); + HandleSlot slot = m_map.take(FinalizerCallback::keyForFinalizer(context, HandleTypes<MappedType>::getFromSlot(handle.slot()))); ASSERT(slot); HandleHeap::heapFor(slot)->deallocate(slot); } diff --git a/Source/JavaScriptCore/runtime/WeakGCPtr.h b/Source/JavaScriptCore/runtime/WeakGCPtr.h deleted file mode 100644 index 3f87b83..0000000 --- a/Source/JavaScriptCore/runtime/WeakGCPtr.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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. - */ - -#ifndef WeakGCPtr_h -#define WeakGCPtr_h - -#include "Global.h" -#include "Heap.h" - -namespace JSC { -// A smart pointer whose get() function returns 0 for cells that have died - -template <typename T> class WeakGCPtr : public HandleConverter<WeakGCPtr<T>, T> { - WTF_MAKE_NONCOPYABLE(WeakGCPtr); - -public: - typedef typename HandleTypes<T>::ExternalType ExternalType; - - WeakGCPtr() - : m_slot(0) - { - } - - WeakGCPtr(JSGlobalData& globalData, Finalizer* finalizer = 0, void* context = 0) - : m_slot(globalData.allocateGlobalHandle()) - { - HandleHeap::heapFor(m_slot)->makeWeak(m_slot, finalizer, context); - } - - WeakGCPtr(JSGlobalData& globalData, ExternalType value, Finalizer* finalizer = 0, void* context = 0) - : m_slot(globalData.allocateGlobalHandle()) - { - HandleHeap::heapFor(m_slot)->makeWeak(m_slot, finalizer, context); - internalSet(value); - } - - ExternalType get() const { return HandleTypes<T>::getFromSlot(m_slot); } - - void clear() - { - if (m_slot) - internalSet(ExternalType()); - } - - bool operator!() const { return !m_slot || !*m_slot; } - - // This conversion operator allows implicit conversion to bool but not to other integer types. - typedef ExternalType (WeakGCPtr::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const { return !*this ? 0 : reinterpret_cast<UnspecifiedBoolType*>(1); } - - ~WeakGCPtr() - { - if (!m_slot) - return; - HandleHeap::heapFor(m_slot)->deallocate(m_slot); - } - - void set(JSGlobalData& globalData, ExternalType value, Finalizer* finalizer) - { - if (!this->m_slot) { - this->m_slot = globalData.allocateGlobalHandle(); - HandleHeap::heapFor(this->m_slot)->makeWeak(this->m_slot, finalizer, 0); - } else - ASSERT(HandleHeap::heapFor(this->m_slot)->getFinalizer(this->m_slot) == finalizer); - this->internalSet(value); - } - -private: - void internalSet(ExternalType value) - { - ASSERT(m_slot); - JSValue newValue(HandleTypes<T>::toJSValue(value)); - HandleHeap::heapFor(m_slot)->writeBarrier(m_slot, newValue); - *m_slot = newValue; - } - - HandleSlot m_slot; -}; - -} // namespace JSC - -#endif // WeakGCPtr_h diff --git a/Source/JavaScriptCore/runtime/WriteBarrier.h b/Source/JavaScriptCore/runtime/WriteBarrier.h index af018a8..32cb968 100644 --- a/Source/JavaScriptCore/runtime/WriteBarrier.h +++ b/Source/JavaScriptCore/runtime/WriteBarrier.h @@ -32,54 +32,17 @@ namespace JSC { class JSCell; class JSGlobalData; -typedef enum { } Unknown; -typedef JSValue* HandleSlot; - -// FIXME: Remove all uses of this class. -template <class T> class DeprecatedPtr { -public: - DeprecatedPtr() : m_cell(0) { } - DeprecatedPtr(T* cell) : m_cell(reinterpret_cast<JSCell*>(cell)) { } - T* get() const { return reinterpret_cast<T*>(m_cell); } - T* operator*() const { return static_cast<T*>(m_cell); } - T* operator->() const { return static_cast<T*>(m_cell); } - - JSCell** slot() { return &m_cell; } - - typedef T* (DeprecatedPtr::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } - - bool operator!() const { return !m_cell; } - -protected: - JSCell* m_cell; -}; - -// FIXME: Remove all uses of this class. -template <> class DeprecatedPtr<Unknown> { -public: - DeprecatedPtr() { } - DeprecatedPtr(JSValue value) : m_value(value) { } - DeprecatedPtr(JSCell* value) : m_value(value) { } - const JSValue& get() const { return m_value; } - const JSValue* operator*() const { return &m_value; } - const JSValue* operator->() const { return &m_value; } - - JSValue* slot() { return &m_value; } - - typedef JSValue (DeprecatedPtr::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const { return m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } - bool operator!() const { return !m_value; } - -private: - JSValue m_value; -}; +inline void writeBarrier(JSGlobalData&, const JSCell*, JSValue) +{ +} -template <typename U, typename V> inline bool operator==(const DeprecatedPtr<U>& lhs, const DeprecatedPtr<V>& rhs) +inline void writeBarrier(JSGlobalData&, const JSCell*, JSCell*) { - return lhs.get() == rhs.get(); } +typedef enum { } Unknown; +typedef JSValue* HandleSlot; + template <typename T> struct JSValueChecker { static const bool IsJSValue = false; }; @@ -92,11 +55,36 @@ template <> struct JSValueChecker<JSValue> { template <typename T> class WriteBarrierBase { public: COMPILE_ASSERT(!JSValueChecker<T>::IsJSValue, WriteBarrier_JSValue_is_invalid__use_unknown); - void set(JSGlobalData&, const JSCell*, T* value) { this->m_cell = reinterpret_cast<JSCell*>(value); } + void set(JSGlobalData& globalData, const JSCell* owner, T* value) + { + this->m_cell = reinterpret_cast<JSCell*>(value); + writeBarrier(globalData, owner, this->m_cell); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie(owner)); + ASSERT(!isZombie(m_cell)); +#endif + } - T* get() const { return reinterpret_cast<T*>(m_cell); } - T* operator*() const { return static_cast<T*>(m_cell); } - T* operator->() const { return static_cast<T*>(m_cell); } + T* get() const + { + return reinterpret_cast<T*>(m_cell); + } + + T* operator*() const + { + ASSERT(m_cell); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie(m_cell)); +#endif + return static_cast<T*>(m_cell); + } + + T* operator->() const + { + ASSERT(m_cell); + return static_cast<T*>(m_cell); + } + void clear() { m_cell = 0; } JSCell** slot() { return &m_cell; } @@ -106,7 +94,13 @@ public: bool operator!() const { return !m_cell; } - void setWithoutWriteBarrier(T* value) { this->m_cell = reinterpret_cast<JSCell*>(value); } + void setWithoutWriteBarrier(T* value) + { + this->m_cell = reinterpret_cast<JSCell*>(value); +#if ENABLE(JSC_ZOMBIES) + ASSERT(!m_cell || !isZombie(m_cell)); +#endif + } private: JSCell* m_cell; @@ -114,12 +108,32 @@ private: template <> class WriteBarrierBase<Unknown> { public: - void set(JSGlobalData&, const JSCell*, JSValue value) { m_value = JSValue::encode(value); } - void setWithoutWriteBarrier(JSValue value) { m_value = JSValue::encode(value); } - JSValue get() const { return JSValue::decode(m_value); } + void set(JSGlobalData& globalData, const JSCell* owner, JSValue value) + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!isZombie(owner)); + ASSERT(!value.isZombie()); +#endif + m_value = JSValue::encode(value); + writeBarrier(globalData, owner, value); + } + void setWithoutWriteBarrier(JSValue value) + { +#if ENABLE(JSC_ZOMBIES) + ASSERT(!value.isZombie()); +#endif + m_value = JSValue::encode(value); + } + + JSValue get() const + { + return JSValue::decode(m_value); + } void clear() { m_value = JSValue::encode(JSValue()); } void setUndefined() { m_value = JSValue::encode(jsUndefined()); } bool isNumber() const { return get().isNumber(); } + bool isObject() const { return get().isObject(); } + bool isNull() const { return get().isNull(); } bool isGetterSetter() const { return get().isGetterSetter(); } JSValue* slot() diff --git a/Source/JavaScriptCore/wscript b/Source/JavaScriptCore/wscript index 214ef91..88d3b68 100644 --- a/Source/JavaScriptCore/wscript +++ b/Source/JavaScriptCore/wscript @@ -39,7 +39,7 @@ jscore_excludes.extend(get_excludes(jscore_dir, ['*None.cpp'])) if build_port == "wx": if building_on_win32: jscore_excludes += ['MarkStackPosix.cpp', 'OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp'] - sources += ['runtime/MarkStackWin.cpp'] + sources += ['heap/MarkStackWin.cpp'] else: jscore_excludes.append('JSStringRefBSTR.cpp') jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp'])) diff --git a/Source/JavaScriptCore/runtime/JSNumberCell.cpp b/Source/JavaScriptCore/wtf/Alignment.h index 79f2d2a..2541e01 100644 --- a/Source/JavaScriptCore/runtime/JSNumberCell.cpp +++ b/Source/JavaScriptCore/wtf/Alignment.h @@ -1,7 +1,5 @@ /* - * Copyright (C) 1999-2002 Harri Porten (porten@kde.org) - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,21 +18,19 @@ * */ -#include "config.h" -#include "JSNumberCell.h" -#include "JSObject.h" -#include "ScopeChain.h" +#ifndef WTF_Alignment_h +#define WTF_Alignment_h -// Keep our exported symbols lists happy. -namespace JSC { +#include <wtf/Platform.h> -JSValue jsNumberCell(ExecState*, double); - -JSValue jsNumberCell(ExecState*, double) -{ - ASSERT_NOT_REACHED(); - return JSValue(); -} - -} // namespace JSC +#if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW) + #define WTF_ALIGN_OF(type) __alignof__(type) + #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n))) +#elif COMPILER(MSVC) + #define WTF_ALIGN_OF(type) __alignof(type) + #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable +#else + #error WTF_ALIGN macros need alignment control. +#endif +#endif // WTF_Alignment_h diff --git a/Source/JavaScriptCore/wtf/Assertions.cpp b/Source/JavaScriptCore/wtf/Assertions.cpp index 77e30c1..930368c 100644 --- a/Source/JavaScriptCore/wtf/Assertions.cpp +++ b/Source/JavaScriptCore/wtf/Assertions.cpp @@ -215,7 +215,7 @@ void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f void WTFReportBacktrace() { -#if PLATFORM(MAC) && !defined(NDEBUG) +#if PLATFORM(MAC) static const int maxFrames = 32; void* samples[maxFrames]; int frames = backtrace(samples, maxFrames); diff --git a/Source/JavaScriptCore/wtf/Assertions.h b/Source/JavaScriptCore/wtf/Assertions.h index 1d108e4..72f8d36 100644 --- a/Source/JavaScriptCore/wtf/Assertions.h +++ b/Source/JavaScriptCore/wtf/Assertions.h @@ -73,6 +73,10 @@ #define HAVE_VARIADIC_MACRO 1 #endif +#ifndef BACKTRACE_DISABLED +#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT +#endif + #ifndef ASSERT_DISABLED #define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT #endif @@ -188,10 +192,17 @@ WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* fu Print a backtrace to the same location as ASSERT messages. */ -#ifndef BACKTRACE + +#if BACKTRACE_DISABLED + +#define BACKTRACE() ((void)0) + +#else + #define BACKTRACE() do { \ WTFReportBacktrace(); \ } while(false) + #endif /* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED diff --git a/Source/JavaScriptCore/wtf/CMakeLists.txt b/Source/JavaScriptCore/wtf/CMakeLists.txt index 304be73..97aad2d 100644 --- a/Source/JavaScriptCore/wtf/CMakeLists.txt +++ b/Source/JavaScriptCore/wtf/CMakeLists.txt @@ -1,6 +1,7 @@ SET(WTF_HEADERS ASCIICType.h AVLTree.h + Alignment.h AlwaysInline.h Assertions.h Atomics.h @@ -17,6 +18,7 @@ SET(WTF_HEADERS Deque.h DisallowCType.h DoublyLinkedList.h + DynamicAnnotations.h Encoder.h FastAllocBase.h FastMalloc.h @@ -111,6 +113,7 @@ SET(WTF_SOURCES CryptographicallyRandomNumber.cpp CurrentTime.cpp DecimalNumber.cpp + DynamicAnnotations.cpp FastMalloc.cpp HashTable.cpp MainThread.cpp diff --git a/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp b/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp new file mode 100644 index 0000000..b7d4b41 --- /dev/null +++ b/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 THE COPYRIGHT + * OWNER 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" + +#include "DynamicAnnotations.h" + +#if USE(DYNAMIC_ANNOTATIONS) +void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*) { } +void WTFAnnotateHappensBefore(const char*, int, const volatile void*) { } +void WTFAnnotateHappensAfter(const char*, int, const volatile void*) { } +#endif // USE(DYNAMIC_ANNOTATIONS) diff --git a/Source/JavaScriptCore/wtf/DynamicAnnotations.h b/Source/JavaScriptCore/wtf/DynamicAnnotations.h new file mode 100644 index 0000000..38acce3 --- /dev/null +++ b/Source/JavaScriptCore/wtf/DynamicAnnotations.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 THE COPYRIGHT + * OWNER 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. + */ + +#ifndef WTF_DynamicAnnotations_h +#define WTF_DynamicAnnotations_h + +/* This file defines dynamic annotations for use with dynamic analysis + * tool such as ThreadSanitizer, Valgrind, etc. + * + * Dynamic annotation is a source code annotation that affects + * the generated code (that is, the annotation is not a comment). + * Each such annotation is attached to a particular + * instruction and/or to a particular object (address) in the program. + * + * By using dynamic annotations a developer can give more details to the dynamic + * analysis tool to improve its precision. + * + * In C/C++ program the annotations are represented as C macros. + * With the default build flags, these macros are empty, hence don't affect + * performance of a compiled binary. + * If dynamic annotations are enabled, they just call no-op functions. + * The dynamic analysis tools can intercept these functions and replace them + * with their own implementations. + * + * See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations for more information. + */ + +#if USE(DYNAMIC_ANNOTATIONS) +/* Tell data race detector that we're not interested in reports on the given address range. */ +#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description) +#define WTF_ANNOTATE_BENIGN_RACE(pointer, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, sizeof(*(pointer)), description) + +/* Annotations for user-defined synchronization mechanisms. + * These annotations can be used to define happens-before arcs in user-defined + * synchronization mechanisms: the race detector will infer an arc from + * the former to the latter when they share the same argument pointer. + * + * The most common case requiring annotations is atomic reference counting: + * bool deref() { + * ANNOTATE_HAPPENS_BEFORE(&m_refCount); + * if (!atomicDecrement(&m_refCount)) { + * // m_refCount is now 0 + * ANNOTATE_HAPPENS_AFTER(&m_refCount); + * // "return true; happens-after each atomicDecrement of m_refCount" + * return true; + * } + * return false; + * } + */ +#define WTF_ANNOTATE_HAPPENS_BEFORE(address) WTFAnnotateHappensBefore(__FILE__, __LINE__, address) +#define WTF_ANNOTATE_HAPPENS_AFTER(address) WTFAnnotateHappensAfter(__FILE__, __LINE__, address) + +#ifdef __cplusplus +extern "C" { +#endif +/* Don't use these directly, use the above macros instead. */ +void WTFAnnotateBenignRaceSized(const char* file, int line, const volatile void* memory, long size, const char* description); +void WTFAnnotateHappensBefore(const char* file, int line, const volatile void* address); +void WTFAnnotateHappensAfter(const char* file, int line, const volatile void* address); +#ifdef __cplusplus +} // extern "C" +#endif + +#else // USE(DYNAMIC_ANNOTATIONS) +/* These macros are empty when dynamic annotations are not enabled so you can + * use them without affecting the performance of release binaries. */ +#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) +#define WTF_ANNOTATE_BENIGN_RACE(pointer, description) +#define WTF_ANNOTATE_HAPPENS_BEFORE(address) +#define WTF_ANNOTATE_HAPPENS_AFTER(address) +#endif // USE(DYNAMIC_ANNOTATIONS) + +#endif // WTF_DynamicAnnotations_h diff --git a/Source/JavaScriptCore/wtf/FastMalloc.cpp b/Source/JavaScriptCore/wtf/FastMalloc.cpp index 29e9a1a..95a9aff 100644 --- a/Source/JavaScriptCore/wtf/FastMalloc.cpp +++ b/Source/JavaScriptCore/wtf/FastMalloc.cpp @@ -245,7 +245,8 @@ void* fastMalloc(size_t n) #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) TryMallocReturnValue returnValue = tryFastMalloc(n); void* result; - returnValue.getValue(result); + if (!returnValue.getValue(result)) + CRASH(); #else void* result = malloc(n); #endif @@ -293,7 +294,8 @@ void* fastCalloc(size_t n_elements, size_t element_size) #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size); void* result; - returnValue.getValue(result); + if (!returnValue.getValue(result)) + CRASH(); #else void* result = calloc(n_elements, element_size); #endif @@ -362,7 +364,8 @@ void* fastRealloc(void* p, size_t n) #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) TryMallocReturnValue returnValue = tryFastRealloc(p, n); void* result; - returnValue.getValue(result); + if (!returnValue.getValue(result)) + CRASH(); #else void* result = realloc(p, n); #endif @@ -1615,10 +1618,10 @@ void TCMalloc_PageHeap::initializeScavenger() void* TCMalloc_PageHeap::runScavengerThread(void* context) { - static_cast<TCMalloc_PageHeap*>(context)->scavengerThread(); -#if COMPILER(MSVC) - // Without this, Visual Studio will complain that this method does not return a value. - return 0; + static_cast<TCMalloc_PageHeap*>(context)->scavengerThread(); +#if (COMPILER(MSVC) || COMPILER(SUNCC)) + // Without this, Visual Studio and Sun Studio will complain that this method does not return a value. + return 0; #endif } diff --git a/Source/JavaScriptCore/wtf/HashTable.h b/Source/JavaScriptCore/wtf/HashTable.h index 1c4ae6d..c2bc49b 100644 --- a/Source/JavaScriptCore/wtf/HashTable.h +++ b/Source/JavaScriptCore/wtf/HashTable.h @@ -259,19 +259,21 @@ namespace WTF { using std::swap; -#if !COMPILER(MSVC) - // Visual C++ has a swap for pairs defined. + // Work around MSVC's standard library, whose swap for pairs does not swap by component. + template<typename T> inline void hashTableSwap(T& a, T& b) + { + swap(a, b); + } - // swap pairs by component, in case of pair members that specialize swap - template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b) + // Swap pairs by component, in case of pair members that specialize swap. + template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b) { swap(a.first, b.first); swap(a.second, b.second); } -#endif template<typename T, bool useSwap> struct Mover; - template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } }; + template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { hashTableSwap(from, to); } }; template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } }; template<typename Key, typename Value, typename HashFunctions> class IdentityHashTranslator { diff --git a/Source/JavaScriptCore/wtf/HashTraits.h b/Source/JavaScriptCore/wtf/HashTraits.h index c8d40f7..fba5afe 100644 --- a/Source/JavaScriptCore/wtf/HashTraits.h +++ b/Source/JavaScriptCore/wtf/HashTraits.h @@ -81,12 +81,14 @@ namespace WTF { static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); } }; - template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > { + template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> { static const bool emptyValueIsZero = true; - static void constructDeletedValue(RefPtr<P>& slot) { new (&slot) RefPtr<P>(HashTableDeletedValue); } - static bool isDeletedValue(const RefPtr<P>& value) { return value.isHashTableDeletedValue(); } + static void constructDeletedValue(T& slot) { new (&slot) T(HashTableDeletedValue); } + static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); } }; + template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > { }; + // special traits for pairs, helpful for their use in HashMap implementation template<typename FirstTraitsArg, typename SecondTraitsArg> diff --git a/Source/JavaScriptCore/wtf/MathExtras.h b/Source/JavaScriptCore/wtf/MathExtras.h index 66e557f..fac187c 100644 --- a/Source/JavaScriptCore/wtf/MathExtras.h +++ b/Source/JavaScriptCore/wtf/MathExtras.h @@ -238,7 +238,7 @@ inline int clampToInteger(unsigned value) return static_cast<int>(std::min(value, static_cast<unsigned>(std::numeric_limits<int>::max()))); } -#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP))) && !OS(SOLARIS) +#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN) using std::isfinite; using std::isinf; using std::isnan; diff --git a/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h b/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h index 48a8464..eba5b03 100644 --- a/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h +++ b/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h @@ -30,7 +30,7 @@ #define PageAllocatorSymbian_h #include <e32std.h> -#include <wtf/BitMap.h> +#include <wtf/Bitmap.h> namespace WTF { diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h index aee03e6..43b234a 100644 --- a/Source/JavaScriptCore/wtf/Platform.h +++ b/Source/JavaScriptCore/wtf/Platform.h @@ -352,6 +352,10 @@ # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ +#if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON) +#define WTF_CPU_ARM_NEON 1 +#endif + #endif /* ARM */ #if CPU(ARM) || CPU(MIPS) @@ -535,18 +539,18 @@ /* Graphics engines */ -/* PLATFORM(CG) and PLATFORM(CI) */ +/* USE(CG) and PLATFORM(CI) */ #if PLATFORM(MAC) || PLATFORM(IOS) -#define WTF_PLATFORM_CG 1 +#define WTF_USE_CG 1 #endif -#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && PLATFORM(CG)) -#define WTF_PLATFORM_CA 1 +#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG)) +#define WTF_USE_CA 1 #endif /* USE(SKIA) for Win/Linux, CG for Mac */ #if PLATFORM(CHROMIUM) #if OS(DARWIN) -#define WTF_PLATFORM_CG 1 +#define WTF_USE_CG 1 #define WTF_USE_ATSUI 1 #define WTF_USE_CORE_TEXT 1 #define WTF_USE_ICCJPEG 1 @@ -561,7 +565,7 @@ #endif #if PLATFORM(GTK) -#define WTF_PLATFORM_CAIRO 1 +#define WTF_USE_CAIRO 1 #endif @@ -636,15 +640,10 @@ #define ENABLE_FULLSCREEN_API 1 #endif -#if PLATFORM(MAC) -#define WTF_USE_CARBON_SECURE_INPUT_MODE 1 -#endif - #if PLATFORM(CHROMIUM) && OS(DARWIN) #define WTF_USE_CF 1 #define WTF_USE_PTHREADS 1 #define HAVE_PTHREAD_RWLOCK 1 -#define WTF_USE_CARBON_SECURE_INPUT_MODE 1 #endif #if PLATFORM(BREWMP) @@ -786,6 +785,7 @@ #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMEB_H 1 +#define WTF_USE_ACCELERATE 1 #if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD) @@ -1046,6 +1046,14 @@ #error You have to have at least one execution model enabled to build JSC #endif +#if CPU(SH4) && PLATFORM(QT) +#define ENABLE_JIT 1 +#define ENABLE_YARR 1 +#define ENABLE_YARR_JIT 1 +#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 +#define ENABLE_ASSEMBLER 1 +#endif + /* Configure the JIT */ #if ENABLE(JIT) #if CPU(ARM) @@ -1210,4 +1218,8 @@ breakages one port at a time. */ #define WTF_USE_EXPORT_MACROS 0 +#if PLATFORM(QT) || PLATFORM(GTK) +#define WTF_USE_UNIX_DOMAIN_SOCKETS 1 +#endif + #endif /* WTF_Platform_h */ diff --git a/Source/JavaScriptCore/wtf/RetainPtr.h b/Source/JavaScriptCore/wtf/RetainPtr.h index 3a11589..a716390 100644 --- a/Source/JavaScriptCore/wtf/RetainPtr.h +++ b/Source/JavaScriptCore/wtf/RetainPtr.h @@ -234,11 +234,7 @@ namespace WTF { return a != b.get(); } - template<typename P> struct HashTraits<RetainPtr<P> > : GenericHashTraits<RetainPtr<P> > { - static const bool emptyValueIsZero = true; - static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(HashTableDeletedValue); } - static bool isDeletedValue(const RetainPtr<P>& value) { return value == reinterpret_cast<P*>(-1); } - }; + template<typename P> struct HashTraits<RetainPtr<P> > : SimpleClassHashTraits<RetainPtr<P> > { }; template<typename P> struct PtrHash<RetainPtr<P> > : PtrHash<P*> { using PtrHash<P*>::hash; diff --git a/Source/JavaScriptCore/wtf/StdLibExtras.h b/Source/JavaScriptCore/wtf/StdLibExtras.h index 0dacb91..a8582e9 100644 --- a/Source/JavaScriptCore/wtf/StdLibExtras.h +++ b/Source/JavaScriptCore/wtf/StdLibExtras.h @@ -162,5 +162,6 @@ inline ArrayType* binarySearch(ArrayType* array, size_t size, KeyType key) } // namespace WTF using WTF::binarySearch; +using WTF::bitwise_cast; #endif // WTF_StdLibExtras_h diff --git a/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h b/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h index c9beec4..ca11db3 100644 --- a/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h +++ b/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h @@ -62,6 +62,7 @@ #include "Platform.h" #include <wtf/Atomics.h> +#include <wtf/DynamicAnnotations.h> #include <wtf/ThreadingPrimitives.h> namespace WTF { @@ -103,8 +104,11 @@ protected: bool derefBase() { #if USE(LOCKFREE_THREADSAFEREFCOUNTED) - if (atomicDecrement(&m_refCount) <= 0) + WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount); + if (atomicDecrement(&m_refCount) <= 0) { + WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount); return true; + } #else int refCount; { diff --git a/Source/JavaScriptCore/wtf/Vector.h b/Source/JavaScriptCore/wtf/Vector.h index b26857c..03c03d5 100644 --- a/Source/JavaScriptCore/wtf/Vector.h +++ b/Source/JavaScriptCore/wtf/Vector.h @@ -29,6 +29,7 @@ #include "VectorTraits.h" #include <limits> #include <utility> +#include <wtf/Alignment.h> #if PLATFORM(QT) #include <QDataStream> @@ -39,17 +40,6 @@ namespace WTF { using std::min; using std::max; - // WTF_ALIGN_OF / WTF_ALIGNED - #if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW) || COMPILER(SUNCC) - #define WTF_ALIGN_OF(type) __alignof__(type) - #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n))) - #elif COMPILER(MSVC) - #define WTF_ALIGN_OF(type) __alignof(type) - #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable - #else - #error WTF_ALIGN macros need alignment control. - #endif - #if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) typedef char __attribute__((__may_alias__)) AlignedBufferChar; #else @@ -129,7 +119,11 @@ namespace WTF { { while (src != srcEnd) { new (dst) T(*src); +#if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590 + const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug. +#else src->~T(); +#endif ++dst; ++src; } diff --git a/Source/JavaScriptCore/wtf/VectorTraits.h b/Source/JavaScriptCore/wtf/VectorTraits.h index 3f33b29..6777c9e 100644 --- a/Source/JavaScriptCore/wtf/VectorTraits.h +++ b/Source/JavaScriptCore/wtf/VectorTraits.h @@ -61,14 +61,10 @@ namespace WTF { template<typename T> struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { }; - struct SimpleClassVectorTraits + struct SimpleClassVectorTraits : VectorTraitsBase<false, void> { - static const bool needsDestruction = true; - static const bool needsInitialization = true; static const bool canInitializeWithMemset = true; static const bool canMoveWithMemcpy = true; - static const bool canCopyWithMemcpy = false; - static const bool canFillWithMemset = false; static const bool canCompareWithMemcmp = true; }; diff --git a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h index 8061e8a..c7f7ac4 100644 --- a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h +++ b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h @@ -61,7 +61,7 @@ typedef struct _GSource GSource; typedef struct _GVariant GVariant; typedef union _GdkEvent GdkEvent; -#if PLATFORM(CAIRO) +#if USE(CAIRO) typedef struct _cairo_surface cairo_surface_t; #endif diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.cpp b/Source/JavaScriptCore/wtf/text/AtomicString.cpp index eb0dbbb..9dd655e 100644 --- a/Source/JavaScriptCore/wtf/text/AtomicString.cpp +++ b/Source/JavaScriptCore/wtf/text/AtomicString.cpp @@ -351,41 +351,14 @@ AtomicString AtomicString::lower() const return AtomicString(newImpl); } -AtomicString AtomicString::fromUTF8(const char* characters, size_t length) +AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd) { - if (!characters) - return AtomicString(); - - if (!length) - return emptyAtom; - - HashAndUTF8Characters buffer; - buffer.characters = characters; - buffer.length = length; - buffer.hash = calculateStringHashFromUTF8(characters, characters + length, buffer.utf16Length); - - if (!buffer.hash) - return AtomicString(); - - AtomicString atomicString; - atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer); - return atomicString; -} - -AtomicString AtomicString::fromUTF8(const char* characters) -{ - if (!characters) - return AtomicString(); - - if (!*characters) - return emptyAtom; - HashAndUTF8Characters buffer; - buffer.characters = characters; - buffer.hash = calculateStringHashAndLengthFromUTF8(characters, buffer.length, buffer.utf16Length); + buffer.characters = charactersStart; + buffer.hash = calculateStringHashAndLengthFromUTF8(charactersStart, charactersEnd, buffer.length, buffer.utf16Length); if (!buffer.hash) - return AtomicString(); + return nullAtom; AtomicString atomicString; atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer); diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.h b/Source/JavaScriptCore/wtf/text/AtomicString.h index 45a71e7..440700c 100644 --- a/Source/JavaScriptCore/wtf/text/AtomicString.h +++ b/Source/JavaScriptCore/wtf/text/AtomicString.h @@ -127,6 +127,7 @@ private: return addSlowCase(r); } static PassRefPtr<StringImpl> addSlowCase(StringImpl*); + static AtomicString fromUTF8Internal(const char*, const char*); }; inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); } @@ -154,20 +155,38 @@ inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return e // Define external global variables for the commonly used atomic strings. // These are only usable from the main thread. #ifndef ATOMICSTRING_HIDE_GLOBALS - extern const JS_EXPORTDATA AtomicString nullAtom; - extern const JS_EXPORTDATA AtomicString emptyAtom; - extern const JS_EXPORTDATA AtomicString textAtom; - extern const JS_EXPORTDATA AtomicString commentAtom; - extern const JS_EXPORTDATA AtomicString starAtom; - extern const JS_EXPORTDATA AtomicString xmlAtom; - extern const JS_EXPORTDATA AtomicString xmlnsAtom; +extern const JS_EXPORTDATA AtomicString nullAtom; +extern const JS_EXPORTDATA AtomicString emptyAtom; +extern const JS_EXPORTDATA AtomicString textAtom; +extern const JS_EXPORTDATA AtomicString commentAtom; +extern const JS_EXPORTDATA AtomicString starAtom; +extern const JS_EXPORTDATA AtomicString xmlAtom; +extern const JS_EXPORTDATA AtomicString xmlnsAtom; + +inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length) +{ + if (!characters) + return nullAtom; + if (!length) + return emptyAtom; + return fromUTF8Internal(characters, characters + length); +} + +inline AtomicString AtomicString::fromUTF8(const char* characters) +{ + if (!characters) + return nullAtom; + if (!*characters) + return emptyAtom; + return fromUTF8Internal(characters, 0); +} #endif - // AtomicStringHash is the default hash for AtomicString - template<typename T> struct DefaultHash; - template<> struct DefaultHash<AtomicString> { - typedef AtomicStringHash Hash; - }; +// AtomicStringHash is the default hash for AtomicString +template<typename T> struct DefaultHash; +template<> struct DefaultHash<AtomicString> { + typedef AtomicStringHash Hash; +}; } // namespace WTF diff --git a/Source/JavaScriptCore/wtf/text/StringConcatenate.h b/Source/JavaScriptCore/wtf/text/StringConcatenate.h index 7fa7d2c..8500200 100644 --- a/Source/JavaScriptCore/wtf/text/StringConcatenate.h +++ b/Source/JavaScriptCore/wtf/text/StringConcatenate.h @@ -204,7 +204,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2) sumWithOverflow(length, adapter2.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -213,7 +213,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2) result += adapter1.length(); adapter2.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3> @@ -230,7 +230,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter3.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -241,7 +241,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter2.length(); adapter3.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4> @@ -260,7 +260,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter4.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -273,7 +273,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter3.length(); adapter4.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5> @@ -294,7 +294,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter5.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -309,7 +309,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter4.length(); adapter5.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6> @@ -332,7 +332,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter6.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -349,7 +349,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter5.length(); adapter6.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7> @@ -374,7 +374,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter7.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -393,7 +393,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter6.length(); adapter7.writeTo(result); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8> @@ -420,7 +420,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S sumWithOverflow(length, adapter8.length(), overflow); if (overflow) return 0; - PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); if (!resultImpl) return 0; @@ -441,9 +441,62 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S result += adapter7.length(); adapter8.writeTo(result); - return resultImpl; + return resultImpl.release(); } +template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9> +PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9) +{ + StringTypeAdapter<StringType1> adapter1(string1); + StringTypeAdapter<StringType2> adapter2(string2); + StringTypeAdapter<StringType3> adapter3(string3); + StringTypeAdapter<StringType4> adapter4(string4); + StringTypeAdapter<StringType5> adapter5(string5); + StringTypeAdapter<StringType6> adapter6(string6); + StringTypeAdapter<StringType7> adapter7(string7); + StringTypeAdapter<StringType8> adapter8(string8); + StringTypeAdapter<StringType9> adapter9(string9); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + sumWithOverflow(length, adapter5.length(), overflow); + sumWithOverflow(length, adapter6.length(), overflow); + sumWithOverflow(length, adapter7.length(), overflow); + sumWithOverflow(length, adapter8.length(), overflow); + sumWithOverflow(length, adapter9.length(), overflow); + if (overflow) + return 0; + RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + result += adapter4.length(); + adapter5.writeTo(result); + result += adapter5.length(); + adapter6.writeTo(result); + result += adapter6.length(); + adapter7.writeTo(result); + result += adapter7.length(); + adapter8.writeTo(result); + result += adapter8.length(); + adapter9.writeTo(result); + + return resultImpl.release(); +} + + // Convenience only. template<typename StringType1> String makeString(StringType1 string1) @@ -454,64 +507,73 @@ String makeString(StringType1 string1) template<typename StringType1, typename StringType2> String makeString(StringType1 string1, StringType2 string2) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3> String makeString(StringType1 string1, StringType2 string2, StringType3 string3) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4> String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5> String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6> String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7> String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8> String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8) { - PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8); + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8); + if (!resultImpl) + CRASH(); + return resultImpl.release(); +} + +template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9> +String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9) +{ + RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8, string9); if (!resultImpl) CRASH(); - return resultImpl; + return resultImpl.release(); } } // namespace WTF diff --git a/Source/JavaScriptCore/wtf/text/StringHash.h b/Source/JavaScriptCore/wtf/text/StringHash.h index 80193a6..c47c1d8 100644 --- a/Source/JavaScriptCore/wtf/text/StringHash.h +++ b/Source/JavaScriptCore/wtf/text/StringHash.h @@ -179,11 +179,7 @@ namespace WTF { } }; - template<> struct HashTraits<String> : GenericHashTraits<String> { - static const bool emptyValueIsZero = true; - static void constructDeletedValue(String& slot) { new (&slot) String(HashTableDeletedValue); } - static bool isDeletedValue(const String& slot) { return slot.isHashTableDeletedValue(); } - }; + template<> struct HashTraits<String> : SimpleClassHashTraits<String> { }; } diff --git a/Source/JavaScriptCore/wtf/text/StringStatics.cpp b/Source/JavaScriptCore/wtf/text/StringStatics.cpp index 5654044..ce08728 100644 --- a/Source/JavaScriptCore/wtf/text/StringStatics.cpp +++ b/Source/JavaScriptCore/wtf/text/StringStatics.cpp @@ -30,6 +30,7 @@ #endif #include "AtomicString.h" +#include "DynamicAnnotations.h" #include "StaticConstructors.h" #include "StringImpl.h" @@ -46,6 +47,7 @@ StringImpl* StringImpl::empty() // PCRE goes away. static UChar emptyUCharData = 0; DEFINE_STATIC_LOCAL(StringImpl, emptyString, (&emptyUCharData, 0, ConstructStaticString)); + WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyString reference counter"); return &emptyString; } diff --git a/Source/JavaScriptCore/wtf/text/WTFString.h b/Source/JavaScriptCore/wtf/text/WTFString.h index 713a6c3..b593d20 100644 --- a/Source/JavaScriptCore/wtf/text/WTFString.h +++ b/Source/JavaScriptCore/wtf/text/WTFString.h @@ -499,10 +499,7 @@ template<> struct DefaultHash<String> { typedef StringHash Hash; }; -template <> struct VectorTraits<String> : SimpleClassVectorTraits -{ - static const bool canInitializeWithMemset = true; -}; +template <> struct VectorTraits<String> : SimpleClassVectorTraits { }; } diff --git a/Source/JavaScriptCore/wtf/unicode/CharacterNames.h b/Source/JavaScriptCore/wtf/unicode/CharacterNames.h index 3d093a6..10fdbf0 100644 --- a/Source/JavaScriptCore/wtf/unicode/CharacterNames.h +++ b/Source/JavaScriptCore/wtf/unicode/CharacterNames.h @@ -85,6 +85,7 @@ const UChar yenSign = 0x00A5; const UChar zeroWidthJoiner = 0x200D; const UChar zeroWidthNonJoiner = 0x200C; const UChar zeroWidthSpace = 0x200B; +const UChar zeroWidthNoBreakSpace = 0xFEFF; } // namespace Unicode } // namespace WTF @@ -138,5 +139,6 @@ using WTF::Unicode::yenSign; using WTF::Unicode::zeroWidthJoiner; using WTF::Unicode::zeroWidthNonJoiner; using WTF::Unicode::zeroWidthSpace; +using WTF::Unicode::zeroWidthNoBreakSpace; #endif // CharacterNames_h diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.cpp b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp index 6981fe4..3a88906 100644 --- a/Source/JavaScriptCore/wtf/unicode/UTF8.cpp +++ b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp @@ -314,7 +314,7 @@ ConversionResult convertUTF8ToUTF16( return result; } -static inline unsigned calculateStringHashAndLengthFromUTF8Internal(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length) +unsigned calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length) { if (!data) return 0; @@ -365,17 +365,6 @@ static inline unsigned calculateStringHashAndLengthFromUTF8Internal(const char* return stringHasher.hash(); } -unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length) -{ - unsigned dataLength; - return calculateStringHashAndLengthFromUTF8Internal(data, dataEnd, dataLength, utf16Length); -} - -unsigned calculateStringHashAndLengthFromUTF8(const char* data, unsigned& dataLength, unsigned& utf16Length) -{ - return calculateStringHashAndLengthFromUTF8Internal(data, 0, dataLength, utf16Length); -} - bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd) { while (b < bEnd) { diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.h b/Source/JavaScriptCore/wtf/unicode/UTF8.h index bbfaa84..7b7b75d 100644 --- a/Source/JavaScriptCore/wtf/unicode/UTF8.h +++ b/Source/JavaScriptCore/wtf/unicode/UTF8.h @@ -70,8 +70,7 @@ namespace Unicode { const UChar** sourceStart, const UChar* sourceEnd, char** targetStart, char* targetEnd, bool strict = true); - unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length); - unsigned calculateStringHashAndLengthFromUTF8(const char* data, unsigned& dataLength, unsigned& utf16Length); + unsigned calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length); bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd); diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp index bc61a6e..f74107b 100644 --- a/Source/JavaScriptCore/yarr/YarrJIT.cpp +++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp @@ -59,6 +59,16 @@ class YarrGenerator : private MacroAssembler { static const RegisterID regT1 = MIPSRegisters::t5; static const RegisterID returnRegister = MIPSRegisters::v0; +#elif CPU(SH4) + static const RegisterID input = SH4Registers::r4; + static const RegisterID index = SH4Registers::r5; + static const RegisterID length = SH4Registers::r6; + static const RegisterID output = SH4Registers::r7; + + static const RegisterID regT0 = SH4Registers::r0; + static const RegisterID regT1 = SH4Registers::r1; + + static const RegisterID returnRegister = SH4Registers::r0; #elif CPU(X86) static const RegisterID input = X86Registers::eax; static const RegisterID index = X86Registers::edx; @@ -2179,6 +2189,9 @@ class YarrGenerator : private MacroAssembler { push(ARMRegisters::r8); // scratch register #endif move(ARMRegisters::r3, output); +#elif CPU(SH4) + push(SH4Registers::r11); + push(SH4Registers::r13); #elif CPU(MIPS) // Do nothing. #endif @@ -2201,6 +2214,9 @@ class YarrGenerator : private MacroAssembler { pop(ARMRegisters::r6); pop(ARMRegisters::r5); pop(ARMRegisters::r4); +#elif CPU(SH4) + pop(SH4Registers::r13); + pop(SH4Registers::r11); #elif CPU(MIPS) // Do nothing #endif diff --git a/Source/JavaScriptCore/yarr/YarrParser.h b/Source/JavaScriptCore/yarr/YarrParser.h index c59310a..65fb41d 100644 --- a/Source/JavaScriptCore/yarr/YarrParser.h +++ b/Source/JavaScriptCore/yarr/YarrParser.h @@ -78,6 +78,7 @@ private: : m_delegate(delegate) , m_err(err) , m_state(Empty) + , m_character(0) { } |