Commit c58d54d7 authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

De-virtualize destructors

https://bugs.webkit.org/show_bug.cgi?id=74331

Reviewed by Geoffrey Garen.

.: 

* Source/autotools/symbols.filter: Removed symbol no longer present.

Source/JavaScriptCore: 

This is a megapatch which frees us from the chains of virtual destructors.

In order to remove the virtual destructors, which are the last of the virtual 
functions, from the JSCell hierarchy, we need to add the ClassInfo pointer to 
the cell rather than to the structure because in order to be able to lazily call 
the static destroy() functions that will replace the virtual destructors, we 
need to be able to access the ClassInfo without the danger of the object's 
Structure being collected before the object itself.

After adding the ClassInfo to the cell, we can then begin to remove our use 
of vptrs for optimizations within the JIT and the GC.  When we have removed 
all of the stored vptrs from JSGlobalData, we can then also remove all of 
the related VPtrStealingHack code.

The replacement for virtual destructors will be to add a static destroy function 
pointer to the MethodTable stored in ClassInfo.  Any subclass of JSCell that has 
a non-trivial destructor will require its own static destroy function to static 
call its corresponding destructor, which will now be non-virtual.  In future 
patches we will slowly move away from destructors altogether as we make more and 
more objects backed by GC memory rather than malloc-ed memory.  The GC will now 
call the static destroy method rather than the virtual destructor.

As we go through the hierarchy and add static destroy functions to classes, 
we will also add a new assert, ASSERT_HAS_TRIVIAL_DESTRUCTOR, to those classes 
to which it applies.  The future goal is to eventually have every class have that assert.

* API/JSCallbackConstructor.cpp:
(JSC::JSCallbackConstructor::destroy): Add a destroy function to statically call 
~JSCallbackConstructor because it has some extra destruction logic.
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.cpp: Add trivial destructor assert for JSCallbackFunction.
* API/JSCallbackObject.cpp: Add a destroy function to statically call ~JSCallbackObject 
because it has a member OwnPtr that needs destruction.
(JSC::::destroy):
* API/JSCallbackObject.h:
* JavaScriptCore.exp: Add/remove necessary symbols for JSC.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Same for Windows symbols.
* debugger/DebuggerActivation.cpp: DebuggerActivation, for some strange reason, didn't 
have its own ClassInfo despite the fact that it overrides a number of MethodTable 
methods.  Added the ClassInfo, along with an assertion that its destructor is trivial.
* debugger/DebuggerActivation.h:
* dfg/DFGOperations.cpp: Remove global data first argument to isJSArray, isJSByteArray, 
isJSString, as it is no longer necessary.
(JSC::DFG::putByVal):
* dfg/DFGRepatch.cpp:  Ditto.  Also remove uses of jsArrayVPtr in favor of using the 
JSArray ClassInfo pointer.
(JSC::DFG::tryCacheGetByID):
* dfg/DFGSpeculativeJIT.cpp:  Replace uses of the old vptrs with new ClassInfo 
comparisons since we don't have vptrs anymore.
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::compilePutByValForByteArray):
(JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
(JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
(JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compare):
(JSC::DFG::SpeculativeJIT::compileStrictEq):
(JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
* dfg/DFGSpeculativeJIT.h: Ditto.
(JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject):
* dfg/DFGSpeculativeJIT32_64.cpp: Ditto.
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp: Ditto.
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
* heap/Heap.cpp: Remove all uses of vptrs in GC optimizations and replace them with 
ClassInfo comparisons.
(JSC::Heap::Heap):
* heap/MarkStack.cpp: Ditto.
(JSC::MarkStackThreadSharedData::markingThreadMain):
(JSC::visitChildren):
(JSC::SlotVisitor::drain):
* heap/MarkStack.h: Ditto.
(JSC::MarkStack::MarkStack):
* heap/MarkedBlock.cpp: Ditto.
(JSC::MarkedBlock::callDestructor):
(JSC::MarkedBlock::specializedSweep):
* heap/MarkedBlock.h: Ditto.
* heap/SlotVisitor.h: Ditto.
(JSC::SlotVisitor::SlotVisitor):
* heap/VTableSpectrum.cpp: Now that we don't have vptrs, we can't count them.  
We'll have to rename this class and make it use ClassInfo ptrs in a future patch.
(JSC::VTableSpectrum::count):
* interpreter/Interpreter.cpp: Remove all global data arguments from isJSArray, 
etc. functions.
(JSC::loadVarargs):
(JSC::Interpreter::tryCacheGetByID):
(JSC::Interpreter::privateExecute):
* jit/JIT.h: Remove vptr argument from emitAllocateBasicJSObject 
* jit/JITInlineMethods.h: Remove vptr planting, and add ClassInfo planting, 
remove all vtable related code.
(JSC::JIT::emitLoadCharacterString):
(JSC::JIT::emitAllocateBasicJSObject):
(JSC::JIT::emitAllocateJSFinalObject):
(JSC::JIT::emitAllocateJSFunction):
* jit/JITOpcodes.cpp: Replace vptr related branch code with corresponding ClassInfo.
(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emit_op_convert_this):
* jit/JITOpcodes32_64.cpp: Ditto.
(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emit_op_convert_this):
* jit/JITPropertyAccess.cpp: Ditto.
(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::privateCompilePutByIdTransition):
(JSC::JIT::privateCompilePatchGetArrayLength):
* jit/JITPropertyAccess32_64.cpp: Ditto.
(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::privateCompilePatchGetArrayLength):
* jit/JITStubs.cpp: Remove global data argument from isJSString, etc.
(JSC::JITThunks::tryCacheGetByID):
(JSC::DEFINE_STUB_FUNCTION):
* jit/SpecializedThunkJIT.h: Replace vptr related stuff with ClassInfo stuff.
(JSC::SpecializedThunkJIT::loadJSStringArgument):
* runtime/ArrayConstructor.cpp: Add trivial destructor assert.
* runtime/ArrayPrototype.cpp: Remove global data argument from isJSArray.
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
* runtime/BooleanConstructor.cpp: Add trivial destructor assert.
* runtime/BooleanObject.cpp: Ditto.
* runtime/BooleanPrototype.cpp: Ditto.
* runtime/ClassInfo.h: Add destroy function pointer to MethodTable.
* runtime/DateConstructor.cpp: Add trivial destructor assert.
* runtime/DateInstance.cpp: Add destroy function for DateInstance because it has a RefPtr 
that needs destruction.
(JSC::DateInstance::destroy):
* runtime/DateInstance.h:
* runtime/Error.cpp: Ditto (because of UString member).
(JSC::StrictModeTypeErrorFunction::destroy):
* runtime/Error.h:
* runtime/ErrorConstructor.cpp: Add trivial destructor assert.
* runtime/ErrorInstance.cpp: Ditto.
* runtime/ExceptionHelpers.cpp: Ditto.
* runtime/Executable.cpp: Add destroy functions for ExecutableBase and subclasses.
(JSC::ExecutableBase::destroy):
(JSC::NativeExecutable::destroy):
(JSC::ScriptExecutable::destroy):
(JSC::EvalExecutable::destroy):
(JSC::ProgramExecutable::destroy):
(JSC::FunctionExecutable::destroy):
* runtime/Executable.h:
* runtime/FunctionConstructor.cpp: Add trivial destructor assert.
* runtime/FunctionPrototype.cpp: Ditto. Also remove global data first arg from isJSArray.
(JSC::functionProtoFuncApply):
* runtime/GetterSetter.cpp: Ditto.
* runtime/InitializeThreading.cpp: Remove call to JSGlobalData::storeVPtrs since it no 
longer exists.
(JSC::initializeThreadingOnce):
* runtime/InternalFunction.cpp: Remove vtableAnchor function, add trivial destructor assert, 
remove first arg from isJSString.
(JSC::InternalFunction::displayName):
* runtime/InternalFunction.h: Remove VPtrStealingHack.
* runtime/JSAPIValueWrapper.cpp: Add trivial destructor assert.
* runtime/JSArray.cpp: Add static destroy to call ~JSArray.  Replace vptr checks in 
destructor with ClassInfo checks.
(JSC::JSArray::~JSArray):
(JSC::JSArray::destroy):
* runtime/JSArray.h: Remove VPtrStealingHack.  Remove globalData argument from isJSArray 
and change them to check the ClassInfo rather than the vptrs.
(JSC::isJSArray):
* runtime/JSBoundFunction.cpp: Add trival destructor assert. Remove first arg from isJSArray.
(JSC::boundFunctionCall):
(JSC::boundFunctionConstruct):
* runtime/JSByteArray.cpp: Add static destroy function, replace vptr checks with ClassInfo checks.
(JSC::JSByteArray::~JSByteArray):
(JSC::JSByteArray::destroy):
* runtime/JSByteArray.h: Remove VPtrStealingHack code.
(JSC::isJSByteArray):
* runtime/JSCell.cpp: Add trivial destructor assert.  Add static destroy function.
(JSC::JSCell::destroy):
* runtime/JSCell.h: Remove VPtrStealingHack code.  Add function for returning the offset 
of the ClassInfo pointer in the object for use by the JIT.  Add the ClassInfo pointer to 
the JSCell itself, and grab it from the Structure.  Remove the vptr and setVPtr functions, 
as they are no longer used.  Add a validatedClassInfo function to JSCell for any clients 
that want to verify, while in Debug mode, that the ClassInfo contained in the cell is the 
same one as that contained in the Structure.  This isn't used too often, because most of 
the places where we compare the ClassInfo to things can be called during destruction.  
Since the Structure is unreliable during the phase when destructors are being called, 
we can't call validatedClassInfo.
(JSC::JSCell::classInfoOffset):
(JSC::JSCell::structure):
(JSC::JSCell::classInfo):
* runtime/JSFunction.cpp: Remove VPtrStealingHack code.  Add static destroy, remove vtableAnchor, 
remove first arg from call to isJSString.
(JSC::JSFunction::destroy):
(JSC::JSFunction::displayName):
* runtime/JSFunction.h: 
* runtime/JSGlobalData.cpp: Remove all VPtr stealing code and storage, including storeVPtrs, 
as these vptrs are no longer needed in the codebase.
* runtime/JSGlobalData.h:
(JSC::TypedArrayDescriptor::TypedArrayDescriptor): Changed the TypedArrayDescriptor to use 
ClassInfo rather than the vptr.
* runtime/JSGlobalObject.cpp: Add static destroy function.
(JSC::JSGlobalObject::destroy):
* runtime/JSGlobalObject.h:
* runtime/JSGlobalThis.cpp: Add trivial destructor assert.
* runtime/JSNotAnObject.cpp: Ditto.
* runtime/JSONObject.cpp: Ditto. Remove first arg from isJSArray calls.
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::Walker::walk):
* runtime/JSObject.cpp: 
(JSC::JSFinalObject::destroy):
(JSC::JSNonFinalObject::destroy):
(JSC::JSObject::destroy):
* runtime/JSObject.h: Add trivial destructor assert for JSObject, remove vtableAnchor 
from JSNonFinalObject and JSFinalObject, add static destroy for JSFinalObject and 
JSNonFinalObject, add isJSFinalObject utility function similar to isJSArray, remove all VPtrStealingHack code.
(JSC::JSObject::finishCreation):
(JSC::JSNonFinalObject::finishCreation):
(JSC::JSFinalObject::finishCreation):
(JSC::isJSFinalObject):
* runtime/JSPropertyNameIterator.cpp: Add static destroy.
(JSC::JSPropertyNameIterator::destroy):
* runtime/JSPropertyNameIterator.h:
* runtime/JSStaticScopeObject.cpp: Ditto.
(JSC::JSStaticScopeObject::destroy):
* runtime/JSStaticScopeObject.h: Ditto. 
* runtime/JSString.cpp:
(JSC::JSString::destroy):
* runtime/JSString.h: Ditto. Remove VPtrStealingHack code. Also remove fixupVPtr code, 
since we no longer need to fixup vptrs.
(JSC::jsSingleCharacterString):
(JSC::jsSingleCharacterSubstring):
(JSC::jsNontrivialString):
(JSC::jsString):
(JSC::jsSubstring8):
(JSC::jsSubstring):
(JSC::jsOwnedString):
(JSC::jsStringBuilder):
(JSC::isJSString):
* runtime/JSVariableObject.cpp: 
(JSC::JSVariableObject::destroy):
* runtime/JSVariableObject.h: Ditto.
* runtime/JSWrapperObject.cpp:
* runtime/JSWrapperObject.h: Add trivial destructor assert.
* runtime/MathObject.cpp: Ditto.
* runtime/NativeErrorConstructor.cpp: Ditto.
* runtime/NumberConstructor.cpp: Ditto.
* runtime/NumberObject.cpp: Ditto.
* runtime/NumberPrototype.cpp: Ditto.
* runtime/ObjectConstructor.cpp: Ditto.
* runtime/ObjectPrototype.cpp: Ditto.
* runtime/Operations.h: Remove calls to fixupVPtr, remove first arg to isJSString.
(JSC::jsString):
(JSC::jsLess):
(JSC::jsLessEq):
* runtime/RegExp.cpp: Add static destroy.
(JSC::RegExp::destroy):
* runtime/RegExp.h:
* runtime/RegExpConstructor.cpp: Add static destroy for RegExpConstructor and RegExpMatchesArray.
(JSC::RegExpConstructor::destroy):
(JSC::RegExpMatchesArray::destroy):
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
* runtime/RegExpObject.cpp: Add static destroy.
(JSC::RegExpObject::destroy):
* runtime/RegExpObject.h:
* runtime/ScopeChain.cpp: Add trivial destructor assert.
* runtime/ScopeChain.h:
* runtime/StrictEvalActivation.cpp: Ditto.
* runtime/StringConstructor.cpp:
* runtime/StringObject.cpp: Ditto. Remove vtableAnchor.
* runtime/StringObject.h:
* runtime/StringPrototype.cpp: Ditto.
* runtime/Structure.cpp: Add static destroy.
(JSC::Structure::destroy):
* runtime/Structure.h: Move JSCell::finishCreation and JSCell constructor into Structure.h 
because they need to have the full Structure type to access the ClassInfo to store in the JSCell.
(JSC::JSCell::setStructure):
(JSC::JSCell::validatedClassInfo):
(JSC::JSCell::JSCell):
(JSC::JSCell::finishCreation):
* runtime/StructureChain.cpp: Add static destroy.
(JSC::StructureChain::destroy):
* runtime/StructureChain.h:
* wtf/Assertions.h: Add new assertion ASSERT_HAS_TRIVIAL_DESTRUCTOR, which uses clangs 
ability to tell us when a class has a trivial destructor. We will use this assert 
more in future patches as we move toward having all JSC objects backed by GC memory, 
which means moving away from using destructors/finalizers.

Source/JavaScriptGlue: 

* UserObjectImp.cpp: Add static destroy function.
(UserObjectImp::destroy):
* UserObjectImp.h:

Source/WebCore: 

No new tests.

Doing everything here that was done to the JSCell hierarchy in JavaScriptCore. 
See the ChangeLog for this commit for a more in-depth description.

* WebCore.exp.in: Add/remove symbols.
* bindings/js/JSCanvasRenderingContext2DCustom.cpp: Remove first arg from isJSArray call.
(WebCore::JSCanvasRenderingContext2D::setWebkitLineDash):
* bindings/js/JSDOMBinding.cpp: Add trival destructor assert for DOMConstructorObject 
and DOMConstructorWithDocument.
* bindings/js/JSDOMGlobalObject.cpp: Add static destroy.  Add implementation for 
scriptExecutionContext that dispatches to different functions in subclasses 
depending on our current ClassInfo.  We do this so that we can get rid of the 
virtual-ness of scriptExecutionContext, because any virtual functions will throw 
off the layout of the object and we'll crash at runtime.
(WebCore::JSDOMGlobalObject::destroy):
(WebCore::JSDOMGlobalObject::scriptExecutionContext):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowBase.cpp: Add static destroy.
(WebCore::JSDOMWindowBase::destroy):
* bindings/js/JSDOMWindowBase.h: De-virtualize scriptExecutionContext.
* bindings/js/JSDOMWindowShell.cpp: Add static destroy.
(WebCore::JSDOMWindowShell::destroy):
* bindings/js/JSDOMWindowShell.h:
* bindings/js/JSDOMWrapper.cpp: Add trivial destructor assert.
* bindings/js/JSDOMWrapper.h: Add a ClassInfo to JSDOMWrapper since it now overrides 
a MethodTable function. Remove vtableAnchor virtual function.
* bindings/js/JSImageConstructor.cpp: Add trivial destructor assert.
* bindings/js/JSNodeCustom.cpp: Change implementation of pushEventHandlerScope so that 
it dispatches to the correct function depending on the 
identity of the class as specified by the ClassInfo.  
See JSDOMGlobalObject::scriptExecutionContext for explanation.
(WebCore::JSNode::pushEventHandlerScope):
* bindings/js/JSWebSocketCustom.cpp: Remove first arg to isJSArray call.
(WebCore::JSWebSocketConstructor::constructJSWebSocket):
* bindings/js/JSWorkerContextBase.cpp: Add static destroy.
(WebCore::JSWorkerContextBase::destroy):
* bindings/js/JSWorkerContextBase.h: 
* bindings/js/ScriptValue.cpp: Remove first arg to isJSArray call.
(WebCore::jsToInspectorValue): 
* bindings/js/SerializedScriptValue.cpp: Ditto.
(WebCore::CloneSerializer::isArray):
(WebCore::CloneSerializer::getSparseIndex):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader): Remove virtual-ness of any custom pushEventHandlerScope (see 
JSNodeCustom::pushEventHandlerScope for explanation).  Remove virtual toBoolean 
for anybody who masquerades as undefined, since our JSObject implementation handles 
this based on the TypeInfo in the Structure. Add trivial destructor assert for any 
class other than DOMWindow or WorkerContexts.
(GenerateImplementation): Change ClassInfo definitions to use Base::s_info, since 
typing the parent class more than once is duplication of information and increases 
the likelihood of mistakes.  Pass ClassInfo to TypeArrayDescriptors instead of vptr. 
(GenerateConstructorDefinition): Add trivial destructor assert for all generated constructors.
* bridge/c/CRuntimeObject.cpp: Remove empty virtual destructor.
* bridge/c/CRuntimeObject.h: 
* bridge/jni/jsc/JavaRuntimeObject.cpp: Ditto.
* bridge/jni/jsc/JavaRuntimeObject.h: 
* bridge/objc/ObjCRuntimeObject.h: Ditto.
* bridge/objc/ObjCRuntimeObject.mm:
* bridge/objc/objc_runtime.h: Add static destroy for ObjcFallbackObjectImp. De-virtualize 
toBoolean in the short term.  Need longer term fix.
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::destroy):
* bridge/qt/qt_runtime.cpp: Add static destroy to QtRuntimeMethod.
(JSC::Bindings::QtRuntimeMethod::destroy):
* bridge/qt/qt_runtime.h: De-virtualize ~QtRuntimeMethod.
* bridge/runtime_array.cpp: De-virtualize destructor. Add static destroy.
(JSC::RuntimeArray::destroy):
* bridge/runtime_array.h:
* bridge/runtime_method.cpp: Remove vtableAnchor. Add static destroy.
(JSC::RuntimeMethod::destroy):
* bridge/runtime_method.h:
* bridge/runtime_object.cpp: Add static destroy.
(JSC::Bindings::RuntimeObject::destroy):
* bridge/runtime_object.h:

Source/WebKit/mac: 

* Plugins/Hosted/ProxyRuntimeObject.h: Remove empty virtual destructor.
* Plugins/Hosted/ProxyRuntimeObject.mm:

Source/WebKit2: 

* WebProcess/Plugins/Netscape/JSNPMethod.cpp: Add trivial destructor assert.
* WebProcess/Plugins/Netscape/JSNPObject.cpp: Add static destroy.
(WebKit::JSNPObject::destroy):
* WebProcess/Plugins/Netscape/JSNPObject.h:
* win/WebKit2.def: Add/remove necessary symbols.
* win/WebKit2CFLite.def: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 308a791f
2011-12-16 Mark Hahnenberg <mhahnenberg@apple.com>
De-virtualize destructors
https://bugs.webkit.org/show_bug.cgi?id=74331
Reviewed by Geoffrey Garen.
* Source/autotools/symbols.filter: Removed symbol no longer present.
2011-12-16 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Update NEWS and configure.ac for 1.7.3 release
......
......@@ -59,6 +59,11 @@ JSCallbackConstructor::~JSCallbackConstructor()
JSClassRelease(m_class);
}
void JSCallbackConstructor::destroy(JSCell* cell)
{
jsCast<JSCallbackConstructor*>(cell)->JSCallbackConstructor::~JSCallbackConstructor();
}
static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
{
JSObject* constructor = exec->callee();
......
......@@ -42,7 +42,8 @@ public:
return constructor;
}
virtual ~JSCallbackConstructor();
~JSCallbackConstructor();
static void destroy(JSCell*);
JSClassRef classRef() const { return m_class; }
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
static const ClassInfo s_info;
......
......@@ -40,6 +40,7 @@
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction);
ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSCallbackFunction);
const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackFunction) };
......
......@@ -51,6 +51,12 @@ Structure* JSCallbackObject<JSGlobalObject>::createStructure(JSGlobalData& globa
return Structure::create(globalData, globalObject, proto, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
}
template <class Parent>
void JSCallbackObject<Parent>::destroy(JSCell* cell)
{
jsCast<JSCallbackObject*>(cell)->JSCallbackObject::~JSCallbackObject();
}
void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context)
{
JSClassRef jsClass = static_cast<JSClassRef>(context);
......
......@@ -177,6 +177,8 @@ protected:
private:
static UString className(const JSObject*);
static void destroy(JSCell*);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
......
This diff is collapsed.
......@@ -125,6 +125,7 @@ __ZN3JSC11JSByteArray24getOwnPropertyDescriptorEPNS_8JSObjectEPNS_9ExecStateERKN
__ZN3JSC11JSByteArray25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC11JSByteArray3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC11JSByteArray6s_infoE
__ZN3JSC11JSByteArray7destroyEPNS_6JSCellE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE
__ZN3JSC11ParserArena5resetEv
__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeEPNS_7JSValueE
......@@ -134,13 +135,10 @@ __ZN3JSC12DateInstance14finishCreationERNS_12JSGlobalDataEd
__ZN3JSC12DateInstance6s_infoE
__ZN3JSC12DateInstanceC1EPNS_9ExecStateEPNS_9StructureE
__ZN3JSC12JSGlobalData10ClientDataD2Ev
__ZN3JSC12JSGlobalData11jsArrayVPtrE
__ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeENS_8HeapSizeE
__ZN3JSC12JSGlobalData12jsStringVPtrE
__ZN3JSC12JSGlobalData12stopSamplingEv
__ZN3JSC12JSGlobalData13startSamplingEv
__ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE
__ZN3JSC12JSGlobalData14jsFunctionVPtrE
__ZN3JSC12JSGlobalData14resetDateCacheEv
__ZN3JSC12JSGlobalData14sharedInstanceEv
__ZN3JSC12JSGlobalData15dumpRegExpTraceEv
......@@ -178,6 +176,7 @@ __ZN3JSC14JSGlobalObject25s_globalObjectMethodTableE
__ZN3JSC14JSGlobalObject3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
__ZN3JSC14JSGlobalObject6s_infoE
__ZN3JSC14JSGlobalObject7destroyEPNS_6JSCellE
__ZN3JSC14JSGlobalObjectD2Ev
__ZN3JSC14MachineThreads16addCurrentThreadEv
__ZN3JSC14MarkStackArray6expandEv
......@@ -194,14 +193,15 @@ __ZN3JSC15WeakHandleOwner26isReachableFromOpaqueRootsENS_6HandleINS_7UnknownEEEP
__ZN3JSC15WeakHandleOwner8finalizeENS_6HandleINS_7UnknownEEEPv
__ZN3JSC15WeakHandleOwnerD2Ev
__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC16InternalFunction12vtableAnchorEv
__ZN3JSC16InternalFunction14finishCreationERNS_12JSGlobalDataERKNS_10IdentifierE
__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
__ZN3JSC16InternalFunction6s_infoE
__ZN3JSC16InternalFunctionC2EPNS_14JSGlobalObjectEPNS_9StructureE
__ZN3JSC16JSNonFinalObject7destroyEPNS_6JSCellE
__ZN3JSC16JSVariableObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_8JSObjectEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC16JSVariableObject7destroyEPNS_6JSCellE
__ZN3JSC16createRangeErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC16slowValidateCellEPNS_14JSGlobalObjectE
__ZN3JSC16slowValidateCellEPNS_6JSCellE
......@@ -211,6 +211,7 @@ __ZN3JSC17JSAPIValueWrapper6s_infoE
__ZN3JSC17PropertyNameArray3addEPN3WTF10StringImplE
__ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC18DebuggerActivation14finishCreationERNS_12JSGlobalDataEPNS_8JSObjectE
__ZN3JSC18DebuggerActivation6s_infoE
__ZN3JSC18DebuggerActivationC1ERNS_12JSGlobalDataE
__ZN3JSC18PropertyDescriptor11setWritableEb
__ZN3JSC18PropertyDescriptor12setUndefinedEv
......@@ -265,6 +266,7 @@ __ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi
__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
__ZN3JSC6JSCell11getCallDataEPS0_RNS_8CallDataE
__ZN3JSC6JSCell16getConstructDataEPS0_RNS_13ConstructDataE
__ZN3JSC6JSCell7destroyEPS0_
__ZN3JSC6JSCell9getObjectEv
__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
......@@ -276,13 +278,13 @@ __ZN3JSC6JSLock9lockCountEv
__ZN3JSC6JSLockC1EPNS_9ExecStateE
__ZN3JSC6RegExp5matchERNS_12JSGlobalDataERKNS_7UStringEiPN3WTF6VectorIiLm32EEE
__ZN3JSC6RegExp6createERNS_12JSGlobalDataERKNS_7UStringENS_11RegExpFlagsE
__ZN3JSC6RegExpD1Ev
__ZN3JSC7JSArray13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
__ZN3JSC7JSArray14finishCreationERNS_12JSGlobalDataE
__ZN3JSC7JSArray14finishCreationERNS_12JSGlobalDataERKNS_7ArgListE
__ZN3JSC7JSArray15setSubclassDataEPv
__ZN3JSC7JSArray25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC7JSArray6s_infoE
__ZN3JSC7JSArray7destroyEPNS_6JSCellE
__ZN3JSC7JSArray9setLengthEj
__ZN3JSC7JSArrayC1ERNS_12JSGlobalDataEPNS_9StructureE
__ZN3JSC7JSArrayC2ERNS_12JSGlobalDataEPNS_9StructureE
......@@ -313,7 +315,6 @@ __ZN3JSC8JSObject12defineSetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j
__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE
__ZN3JSC8JSObject12vtableAnchorEv
__ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
__ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject16getPropertyNamesEPS0_PNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
......@@ -330,6 +331,7 @@ __ZN3JSC8JSObject24getOwnPropertyDescriptorEPS0_PNS_9ExecStateERKNS_10Identifier
__ZN3JSC8JSObject25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC8JSObject3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC8JSObject6s_infoE
__ZN3JSC8JSObject7destroyEPNS_6JSCellE
__ZN3JSC8JSObject9classNameEPKS0_
__ZN3JSC8JSString6s_infoE
__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
......@@ -350,7 +352,6 @@ __ZN3JSC9Structure3getERNS_12JSGlobalDataEPN3WTF10StringImplERjRPNS_6JSCellE
__ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
__ZN3JSC9Structure6s_infoE
__ZN3JSC9StructureC1ERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueERKNS_8TypeInfoEPKNS_9ClassInfoE
__ZN3JSC9StructureD1Ev
__ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
__ZN3JSCeqERKNS_7UStringEPKc
__ZN3JSCgtERKNS_7UStringES2_
......@@ -619,16 +620,7 @@ __ZNK3WTF6String8toIntPtrEPb
__ZNK3WTF6String8toUInt64EPb
__ZNK3WTF6String9substringEjj
__ZNK3WTF8Collator7collateEPKtmS2_m
__ZTVN3JSC12StringObjectE
__ZTVN3JSC13JSFinalObjectE
__ZTVN3JSC14JSGlobalObjectE
__ZTVN3JSC14ScopeChainNodeE
__ZTVN3JSC15JSWrapperObjectE
__ZTVN3JSC15WeakHandleOwnerE
__ZTVN3JSC16InternalFunctionE
__ZTVN3JSC16JSVariableObjectE
__ZTVN3JSC8DebuggerE
__ZTVN3JSC8JSObjectE
__ZTVN3JSC8JSStringE
_jscore_fastmalloc_introspection
_kJSClassDefinitionEmpty
......@@ -33,11 +33,9 @@ EXPORTS
??1Debugger@JSC@@UAE@XZ
??1DropAllLocks@JSLock@JSC@@QAE@XZ
??1JSGlobalData@JSC@@QAE@XZ
??1JSGlobalObject@JSC@@UAE@XZ
??1JSVariableObject@JSC@@UAE@XZ
??1JSGlobalObject@JSC@@QAE@XZ
??1Mutex@WTF@@QAE@XZ
??1RefCountedLeakCounter@WTF@@QAE@XZ
??1ScopeChainNode@JSC@@EAE@XZ
??1SourceProviderCache@JSC@@QAE@XZ
??1ThreadCondition@WTF@@QAE@XZ
??1WTFThreadData@WTF@@QAE@XZ
......@@ -158,6 +156,9 @@ EXPORTS
?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z
?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@@Z
?destroy@Heap@JSC@@QAEXXZ
?destroy@JSByteArray@JSC@@SAXPAVJSCell@2@@Z
?destroy@JSGlobalObject@JSC@@SAXPAVJSCell@2@@Z
?destroy@JSNonFinalObject@JSC@@SAXPAVJSCell@2@@Z
?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
?detachThread@WTF@@YAXI@Z
?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
......@@ -363,9 +364,6 @@ EXPORTS
?visitChildren@JSGlobalObject@JSC@@SAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?visitChildren@JSGlobalThis@JSC@@KAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?visitChildren@JSObject@JSC@@SAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?vtableAnchor@InternalFunction@JSC@@EAEXXZ
?vtableAnchor@JSFinalObject@JSC@@EAEXXZ
?vtableAnchor@JSObject@JSC@@UAEXXZ
?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
?waitForThreadCompletion@WTF@@YAHIPAPAX@Z
?writable@PropertyDescriptor@JSC@@QBE_NXZ
......
......@@ -30,6 +30,10 @@
namespace JSC {
ASSERT_HAS_TRIVIAL_DESTRUCTOR(DebuggerActivation);
const ClassInfo DebuggerActivation::s_info = { "DebuggerActivation", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(DebuggerActivation) };
DebuggerActivation::DebuggerActivation(JSGlobalData& globalData)
: JSNonFinalObject(globalData, globalData.debuggerActivationStructure.get())
{
......
......@@ -52,6 +52,8 @@ namespace JSC {
static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes);
static const ClassInfo s_info;
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
......
......@@ -144,7 +144,7 @@ static inline void putByVal(ExecState* exec, JSValue baseValue, uint32_t index,
{
JSGlobalData* globalData = &exec->globalData();
if (isJSArray(globalData, baseValue)) {
if (isJSArray(baseValue)) {
JSArray* array = asArray(baseValue);
if (array->canSetIndex(index)) {
array->setIndex(*globalData, index, value);
......@@ -155,7 +155,7 @@ static inline void putByVal(ExecState* exec, JSValue baseValue, uint32_t index,
return;
}
if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(index)) {
if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(index)) {
JSByteArray* byteArray = asByteArray(baseValue);
// FIXME: the JITstub used to relink this to an optimized form!
if (value.isInt32()) {
......@@ -269,18 +269,16 @@ EncodedJSValue DFG_OPERATION operationValueAddNotNumber(ExecState* exec, Encoded
static inline EncodedJSValue getByVal(ExecState* exec, JSCell* base, uint32_t index)
{
JSGlobalData* globalData = &exec->globalData();
// FIXME: the JIT used to handle these in compiled code!
if (isJSArray(globalData, base) && asArray(base)->canGetIndex(index))
if (isJSArray(base) && asArray(base)->canGetIndex(index))
return JSValue::encode(asArray(base)->getIndex(index));
// FIXME: the JITstub used to relink this to an optimized form!
if (isJSString(globalData, base) && asString(base)->canGetIndex(index))
if (isJSString(base) && asString(base)->canGetIndex(index))
return JSValue::encode(asString(base)->getIndex(exec, index));
// FIXME: the JITstub used to relink this to an optimized form!
if (isJSByteArray(globalData, base) && asByteArray(base)->canAccessIndex(index))
if (isJSByteArray(base) && asByteArray(base)->canAccessIndex(index))
return JSValue::encode(asByteArray(base)->getIndex(exec, index));
return JSValue::encode(JSValue(base).get(exec, index));
......
......@@ -164,7 +164,7 @@ static bool tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier
CodeBlock* codeBlock = exec->codeBlock();
JSGlobalData* globalData = &exec->globalData();
if (isJSArray(globalData, baseValue) && propertyName == exec->propertyNames().length) {
if (isJSArray(baseValue) && propertyName == exec->propertyNames().length) {
GPRReg baseGPR = static_cast<GPRReg>(stubInfo.baseGPR);
#if USE(JSVALUE32_64)
GPRReg resultTagGPR = static_cast<GPRReg>(stubInfo.valueTagGPR);
......@@ -183,7 +183,7 @@ static bool tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier
MacroAssembler::JumpList failureCases;
failureCases.append(stubJit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(globalData->jsArrayVPtr)));
failureCases.append(stubJit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSArray::s_info)));
stubJit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), scratchGPR);
stubJit.load32(MacroAssembler::Address(scratchGPR, OBJECT_OFFSETOF(ArrayStorage, m_length)), scratchGPR);
......
......@@ -1950,12 +1950,12 @@ private:
bool compilePeepHoleBranch(Node&, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_DFGOperation_EJJ);
void compilePeepHoleIntegerBranch(Node&, NodeIndex branchNodeIndex, JITCompiler::RelationalCondition);
void compilePeepHoleDoubleBranch(Node&, NodeIndex branchNodeIndex, JITCompiler::DoubleCondition);
void compilePeepHoleObjectEquality(Node&, NodeIndex branchNodeIndex, void* vptr, PredictionChecker);
void compileObjectEquality(Node&, void* vptr, PredictionChecker);
void compilePeepHoleObjectEquality(Node&, NodeIndex branchNodeIndex, const ClassInfo*, PredictionChecker);
void compileObjectEquality(Node&, const ClassInfo*, PredictionChecker);
void compileValueAdd(Node&);
void compileObjectOrOtherLogicalNot(NodeIndex value, void* vptr, bool needSpeculationCheck);
void compileObjectOrOtherLogicalNot(NodeIndex value, const ClassInfo*, bool needSpeculationCheck);
void compileLogicalNot(Node&);
void emitObjectOrOtherBranch(NodeIndex value, BlockIndex taken, BlockIndex notTaken, void *vptr, bool needSpeculationCheck);
void emitObjectOrOtherBranch(NodeIndex value, BlockIndex taken, BlockIndex notTaken, const ClassInfo*, bool needSpeculationCheck);
void emitBranch(Node&);
void compileIntegerCompare(Node&, MacroAssembler::RelationalCondition);
......@@ -2011,8 +2011,8 @@ private:
m_jit.loadPtr(MacroAssembler::Address(resultGPR), scratchGPR);
m_jit.storePtr(scratchGPR, &sizeClass->firstFreeCell);
// Initialize the object's vtable
m_jit.storePtr(MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsFinalObjectVPtr), MacroAssembler::Address(resultGPR));
// Initialize the object's classInfo pointer
m_jit.storePtr(MacroAssembler::TrustedImmPtr(&JSFinalObject::s_info), MacroAssembler::Address(resultGPR, JSCell::classInfoOffset()));
// Initialize the object's inheritorID.
m_jit.storePtr(MacroAssembler::TrustedImmPtr(0), MacroAssembler::Address(resultGPR, JSObject::offsetOfInheritorID()));
......
......@@ -319,7 +319,7 @@ Heap::Heap(JSGlobalData* globalData, HeapSize heapSize)
, m_activityCallback(DefaultGCActivityCallback::create(this))
, m_machineThreads(this)
, m_sharedData(globalData)
, m_slotVisitor(m_sharedData, globalData->jsArrayVPtr, globalData->jsFinalObjectVPtr, globalData->jsStringVPtr)
, m_slotVisitor(m_sharedData)
, m_handleHeap(globalData)
, m_isSafeToCollect(false)
, m_globalData(globalData)
......
......@@ -219,7 +219,7 @@ void MarkStackArray::stealSomeCellsFrom(MarkStackArray& other)
void MarkStackThreadSharedData::markingThreadMain()
{
WTF::registerGCThread();
SlotVisitor slotVisitor(*this, m_globalData->jsArrayVPtr, m_globalData->jsFinalObjectVPtr, m_globalData->jsStringVPtr);
SlotVisitor slotVisitor(*this);
ParallelModeEnabler enabler(slotVisitor);
slotVisitor.drainFromShared(SlotVisitor::SlaveDrain);
}
......@@ -294,7 +294,7 @@ void MarkStack::append(ConservativeRoots& conservativeRoots)
internalAppend(roots[i]);
}
ALWAYS_INLINE static void visitChildren(SlotVisitor& visitor, const JSCell* cell, void* jsFinalObjectVPtr, void* jsArrayVPtr, void* jsStringVPtr)
ALWAYS_INLINE static void visitChildren(SlotVisitor& visitor, const JSCell* cell)
{
#if ENABLE(SIMPLE_HEAP_PROFILING)
m_visitedTypeCounts.count(cell);
......@@ -302,17 +302,17 @@ ALWAYS_INLINE static void visitChildren(SlotVisitor& visitor, const JSCell* cell
ASSERT(Heap::isMarked(cell));
if (cell->vptr() == jsStringVPtr) {
if (isJSString(cell)) {
JSString::visitChildren(const_cast<JSCell*>(cell), visitor);
return;
}
if (cell->vptr() == jsFinalObjectVPtr) {
if (isJSFinalObject(cell)) {
JSObject::visitChildren(const_cast<JSCell*>(cell), visitor);
return;
}
if (cell->vptr() == jsArrayVPtr) {
if (isJSArray(cell)) {
JSArray::visitChildren(const_cast<JSCell*>(cell), visitor);
return;
}
......@@ -338,16 +338,12 @@ void SlotVisitor::drain()
{
ASSERT(m_isInParallelMode);
void* jsFinalObjectVPtr = m_jsFinalObjectVPtr;
void* jsArrayVPtr = m_jsArrayVPtr;
void* jsStringVPtr = m_jsStringVPtr;
#if ENABLE(PARALLEL_GC)
if (Options::numberOfGCMarkers > 1) {
while (!m_stack.isEmpty()) {
m_stack.refill();
for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance; m_stack.canRemoveLast() && countdown--;)
visitChildren(*this, m_stack.removeLast(), jsFinalObjectVPtr, jsArrayVPtr, jsStringVPtr);
visitChildren(*this, m_stack.removeLast());
donateKnownParallel();
}
......@@ -359,7 +355,7 @@ void SlotVisitor::drain()
while (!m_stack.isEmpty()) {
m_stack.refill();
while (m_stack.canRemoveLast())
visitChildren(*this, m_stack.removeLast(), jsFinalObjectVPtr, jsArrayVPtr, jsStringVPtr);
visitChildren(*this, m_stack.removeLast());
}
}
......
......@@ -204,7 +204,7 @@ namespace JSC {
friend class HeapRootVisitor; // Allowed to mark a JSValue* or JSCell** directly.
public:
MarkStack(MarkStackThreadSharedData&, void* jsArrayVPtr, void* jsFinalObjectVPtr, void* jsStringVPtr);
MarkStack(MarkStackThreadSharedData&);
~MarkStack();
void append(ConservativeRoots&);
......@@ -267,9 +267,6 @@ namespace JSC {
}
MarkStackArray m_stack;
void* m_jsArrayVPtr;
void* m_jsFinalObjectVPtr;
void* m_jsStringVPtr;
HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector.
#if !ASSERT_DISABLED
......@@ -286,11 +283,8 @@ namespace JSC {
MarkStackThreadSharedData& m_shared;
};
inline MarkStack::MarkStack(MarkStackThreadSharedData& shared, void* jsArrayVPtr, void* jsFinalObjectVPtr, void* jsStringVPtr)
inline MarkStack::MarkStack(MarkStackThreadSharedData& shared)
: m_stack(shared.m_segmentAllocator)
, m_jsArrayVPtr(jsArrayVPtr)
, m_jsFinalObjectVPtr(jsFinalObjectVPtr)
, m_jsStringVPtr(jsStringVPtr)
#if !ASSERT_DISABLED
, m_isCheckingForDefaultMarkViolation(false)
, m_isDraining(false)
......
......@@ -60,18 +60,17 @@ MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, Heap* heap, si
HEAP_LOG_BLOCK_STATE_TRANSITION(this);
}
inline void MarkedBlock::callDestructor(JSCell* cell, void* jsFinalObjectVPtr)
inline void MarkedBlock::callDestructor(JSCell* cell)
{
// A previous eager sweep may already have run cell's destructor.
if (cell->isZapped())
return;
void* vptr = cell->vptr();
#if ENABLE(SIMPLE_HEAP_PROFILING)
m_heap->m_destroyedTypeCounts.countVPtr(vptr);
#endif
if (vptr != jsFinalObjectVPtr)
cell->~JSCell();
if (cell->classInfo() != &JSFinalObject::s_info)
cell->methodTable()->destroy(cell);
cell->zap();
}
......@@ -85,7 +84,6 @@ MarkedBlock::FreeCell* MarkedBlock::specializedSweep()
// This is fine, since the allocation code makes no assumptions about the
// order of the free list.
FreeCell* head = 0;
void* jsFinalObjectVPtr = m_heap->globalData()->jsFinalObjectVPtr;
for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) {
if (blockState == Marked && m_marks.get(i))
continue;
......@@ -95,7 +93,7 @@ MarkedBlock::FreeCell* MarkedBlock::specializedSweep()
continue;
if (blockState != New)
callDestructor(cell, jsFinalObjectVPtr);
callDestructor(cell);
if (sweepMode == SweepToFreeList) {
FreeCell* freeCell = reinterpret_cast<FreeCell*>(cell);
......
......@@ -165,7 +165,7 @@ namespace JSC {
MarkedBlock(const PageAllocationAligned&, Heap*, size_t cellSize);
Atom* atoms();
size_t atomNumber(const void*);
void callDestructor(JSCell*, void* jsFinalObjectVPtr);
void callDestructor(JSCell*);
template<BlockState, SweepMode> FreeCell* specializedSweep();
#if ENABLE(GGC)
......
......@@ -35,7 +35,7 @@ class Heap;
class SlotVisitor : public MarkStack {
friend class HeapRootVisitor;
public:
SlotVisitor(MarkStackThreadSharedData&, void* jsArrayVPtr, void* jsFinalObjectVPtr, void* jsStringVPtr);
SlotVisitor(MarkStackThreadSharedData&);
void donate()
{
......@@ -71,8 +71,8 @@ private:
}
};
inline SlotVisitor::SlotVisitor(MarkStackThreadSharedData& shared, void* jsArrayVPtr, void* jsFinalObjectVPtr, void* jsStringVPtr)
: MarkStack(shared, jsArrayVPtr, jsFinalObjectVPtr, jsStringVPtr)
inline SlotVisitor::SlotVisitor(MarkStackThreadSharedData& shared)
: MarkStack(shared)
{
}
......
......@@ -54,7 +54,8 @@ void VTableSpectrum::countVPtr(void* vTablePointer)
void VTableSpectrum::count(JSCell* cell)
{
countVPtr(cell->vptr());
// FIXME: we need to change this class to count ClassInfos rather than vptrs
UNUSED_PARAM(cell);
}
void VTableSpectrum::dump(FILE* output, const char* comment)
......
......@@ -506,7 +506,7 @@ CallFrame* loadVarargs(CallFrame* callFrame, RegisterFile* registerFile, JSValue
return newCallFrame;
}
if (isJSArray(&callFrame->globalData(), arguments)) {
if (isJSArray(arguments)) {
JSArray* array = asArray(arguments);
unsigned argCount = array->length();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister + CallFrame::offsetFor(argCount + 1));
......@@ -1508,13 +1508,12 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock*
return;
}
JSGlobalData* globalData = &callFrame->globalData();
if (isJSArray(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
if (isJSArray(baseValue) && propertyName == callFrame->propertyNames().length) {
vPC[0] = getOpcode(op_get_array_length);
return;
}
if (isJSString(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
if (isJSString(baseValue) && propertyName == callFrame->propertyNames().length) {
vPC[0] = getOpcode(op_get_string_length);
return;
}
......@@ -3218,7 +3217,7 @@ skip_id_custom_self:
int base = vPC[2].u.operand;
JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(isJSArray(globalData, baseValue))) {
if (LIKELY(isJSArray(baseValue))) {
int dst = vPC[1].u.operand;
callFrame->uncheckedR(dst) = jsNumber(asArray(baseValue)->length());
vPC += OPCODE_LENGTH(op_get_array_length);
......@@ -3242,7 +3241,7 @@ skip_id_custom_self:
int base = vPC[2].u.operand;
JSValue baseValue = callFrame->r(base).jsValue();
if (LIKELY(isJSString(globalData, baseValue))) {
if (LIKELY(isJSString(baseValue))) {
int dst = vPC[1].u.operand;
callFrame->uncheckedR(dst) = jsNumber(asString(baseValue)->length());
vPC += OPCODE_LENGTH(op_get_string_length);
......@@ -3511,15 +3510,15 @@ skip_id_custom_self:
if (LIKELY(subscript.isUInt32())) {
uint32_t i = subscript.asUInt32();
if (isJSArray(globalData, baseValue)) {
if (isJSArray(baseValue)) {
JSArray* jsArray = asArray(baseValue);
if (jsArray->canGetIndex(i))
result = jsArray->getIndex(i);
else
result = jsArray->JSArray::get(callFrame, i);
} else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i))
} else if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i))
result = asString(baseValue)->getIndex(callFrame, i);
else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i))
else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i))
result = asByteArray(baseValue)->getIndex(