Ignore:
Timestamp:
Sep 23, 2011, 12:40:09 PM (14 years ago)
Author:
[email protected]
Message:

Add static version of JSCell::visitChildren
https://bugs.webkit.org/show_bug.cgi?id=68404

Reviewed by Darin Adler.

.:

In this patch we just extract the bodies of the virtual visitChildren methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of visitChildren into our own custom vtable stored in
ClassInfo. We need to convert the methods to static methods in order to be
able to more easily store and refer to them in our custom vtable since normal
member methods store some implicit information in their types, making it
impossible to store them generically in ClassInfo.

  • Source/autotools/symbols.filter:

Source/JavaScriptCore:

In this patch we just extract the bodies of the virtual visitChildren methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of visitChildren into our own custom vtable stored in
ClassInfo. We need to convert the methods to static methods in order to be
able to more easily store and refer to them in our custom vtable since normal
member methods store some implicit information in their types, making it
impossible to store them generically in ClassInfo.

  • API/JSCallbackObject.h:

(JSC::JSCallbackObject::visitChildrenVirtual):
(JSC::JSCallbackObject::visitChildren):

(JSC::DebuggerActivation::visitChildrenVirtual):
(JSC::DebuggerActivation::visitChildren):

  • debugger/DebuggerActivation.h:
  • heap/MarkStack.cpp:

(JSC::SlotVisitor::visitChildren):
(JSC::SlotVisitor::drain):

  • runtime/Arguments.cpp:

(JSC::Arguments::visitChildrenVirtual):
(JSC::Arguments::visitChildren):

  • runtime/Arguments.h:
  • runtime/Executable.cpp:

(JSC::EvalExecutable::visitChildrenVirtual):
(JSC::EvalExecutable::visitChildren):
(JSC::ProgramExecutable::visitChildrenVirtual):
(JSC::ProgramExecutable::visitChildren):
(JSC::FunctionExecutable::visitChildrenVirtual):
(JSC::FunctionExecutable::visitChildren):

  • runtime/Executable.h:
  • runtime/GetterSetter.cpp:

(JSC::GetterSetter::visitChildrenVirtual):
(JSC::GetterSetter::visitChildren):

  • runtime/GetterSetter.h:
  • runtime/JSActivation.cpp:

(JSC::JSActivation::visitChildrenVirtual):
(JSC::JSActivation::visitChildren):

  • runtime/JSActivation.h:
  • runtime/JSArray.cpp:

(JSC::JSArray::visitChildrenVirtual):
(JSC::JSArray::visitChildren):

  • runtime/JSArray.h:
  • runtime/JSBoundFunction.cpp:

(JSC::JSBoundFunction::visitChildrenVirtual):
(JSC::JSBoundFunction::visitChildren):

  • runtime/JSBoundFunction.h:
  • runtime/JSCell.h:

(JSC::JSCell::visitChildrenVirtual):
(JSC::JSCell::visitChildren):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::visitChildrenVirtual):
(JSC::JSFunction::visitChildren):

  • runtime/JSFunction.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::visitChildrenVirtual):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:
  • runtime/JSObject.cpp:

(JSC::JSObject::visitChildrenVirtual):
(JSC::JSObject::visitChildren):

  • runtime/JSObject.h:

(JSC::JSObject::visitChildrenDirect):

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::visitChildrenVirtual):
(JSC::JSPropertyNameIterator::visitChildren):

  • runtime/JSPropertyNameIterator.h:
  • runtime/JSStaticScopeObject.cpp:

(JSC::JSStaticScopeObject::visitChildrenVirtual):
(JSC::JSStaticScopeObject::visitChildren):

  • runtime/JSStaticScopeObject.h:
  • runtime/JSWrapperObject.cpp:

(JSC::JSWrapperObject::visitChildrenVirtual):
(JSC::JSWrapperObject::visitChildren):

  • runtime/JSWrapperObject.h:
  • runtime/NativeErrorConstructor.cpp:

(JSC::NativeErrorConstructor::visitChildrenVirtual):
(JSC::NativeErrorConstructor::visitChildren):

  • runtime/NativeErrorConstructor.h:
  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::visitChildrenVirtual):
(JSC::RegExpObject::visitChildren):

  • runtime/RegExpObject.h:
  • runtime/ScopeChain.cpp:

(JSC::ScopeChainNode::visitChildrenVirtual):
(JSC::ScopeChainNode::visitChildren):

  • runtime/ScopeChain.h:
  • runtime/Structure.cpp:

(JSC::Structure::visitChildrenVirtual):
(JSC::Structure::visitChildren):

  • runtime/Structure.h:
  • runtime/StructureChain.cpp:

(JSC::StructureChain::visitChildrenVirtual):
(JSC::StructureChain::visitChildren):

  • runtime/StructureChain.h:

Source/JavaScriptGlue:

In this patch we just extract the bodies of the virtual visitChildren methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of visitChildren into our own custom vtable stored in
ClassInfo. We need to convert the methods to static methods in order to be
able to more easily store and refer to them in our custom vtable since normal
member methods store some implicit information in their types, making it
impossible to store them generically in ClassInfo.

  • UserObjectImp.cpp:

(UserObjectImp::visitChildrenVirtual):
(UserObjectImp::visitChildren):

  • UserObjectImp.h:

Source/WebCore:

No new tests.

In this patch we just extract the bodies of the virtual visitChildren methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of visitChildren into our own custom vtable stored in
ClassInfo. We need to convert the methods to static methods in order to be
able to more easily store and refer to them in our custom vtable since normal
member methods store some implicit information in their types, making it
impossible to store them generically in ClassInfo.

  • WebCore.exp.in:
  • bindings/js/JSAttrCustom.cpp:

(WebCore::JSAttr::visitChildrenVirtual):
(WebCore::JSAttr::visitChildren):

  • bindings/js/JSAudioContextCustom.cpp:

(WebCore::JSAudioContext::visitChildrenVirtual):
(WebCore::JSAudioContext::visitChildren):

  • bindings/js/JSCSSRuleCustom.cpp:

(WebCore::JSCSSRule::visitChildrenVirtual):
(WebCore::JSCSSRule::visitChildren):

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::visitChildrenVirtual):
(WebCore::JSCSSStyleDeclaration::visitChildren):

  • bindings/js/JSCanvasRenderingContextCustom.cpp:

(WebCore::JSCanvasRenderingContext::visitChildrenVirtual):
(WebCore::JSCanvasRenderingContext::visitChildren):

  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::JSDOMGlobalObject::visitChildrenVirtual):
(WebCore::JSDOMGlobalObject::visitChildren):

  • bindings/js/JSDOMGlobalObject.h:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::visitChildrenVirtual):
(WebCore::JSDOMWindow::visitChildren):

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::visitChildrenVirtual):
(WebCore::JSDOMWindowShell::visitChildren):

  • bindings/js/JSDOMWindowShell.h:
  • bindings/js/JSJavaScriptAudioNodeCustom.cpp:

(WebCore::JSJavaScriptAudioNode::visitChildrenVirtual):
(WebCore::JSJavaScriptAudioNode::visitChildren):

  • bindings/js/JSMessageChannelCustom.cpp:

(WebCore::JSMessageChannel::visitChildrenVirtual):
(WebCore::JSMessageChannel::visitChildren):

  • bindings/js/JSMessagePortCustom.cpp:

(WebCore::JSMessagePort::visitChildrenVirtual):
(WebCore::JSMessagePort::visitChildren):

  • bindings/js/JSNamedNodeMapCustom.cpp:

(WebCore::JSNamedNodeMap::visitChildrenVirtual):
(WebCore::JSNamedNodeMap::visitChildren):

  • bindings/js/JSNodeCustom.cpp:

(WebCore::JSNode::visitChildrenVirtual):
(WebCore::JSNode::visitChildren):

  • bindings/js/JSNodeFilterCustom.cpp:

(WebCore::JSNodeFilter::visitChildrenVirtual):
(WebCore::JSNodeFilter::visitChildren):

  • bindings/js/JSNodeIteratorCustom.cpp:

(WebCore::JSNodeIterator::visitChildrenVirtual):
(WebCore::JSNodeIterator::visitChildren):

  • bindings/js/JSSVGElementInstanceCustom.cpp:

(WebCore::JSSVGElementInstance::visitChildrenVirtual):
(WebCore::JSSVGElementInstance::visitChildren):

  • bindings/js/JSSharedWorkerCustom.cpp:

(WebCore::JSSharedWorker::visitChildrenVirtual):
(WebCore::JSSharedWorker::visitChildren):

  • bindings/js/JSStyleSheetCustom.cpp:

(WebCore::JSStyleSheet::visitChildrenVirtual):
(WebCore::JSStyleSheet::visitChildren):

  • bindings/js/JSTreeWalkerCustom.cpp:

(WebCore::JSTreeWalker::visitChildrenVirtual):
(WebCore::JSTreeWalker::visitChildren):

  • bindings/js/JSWebGLRenderingContextCustom.cpp:

(WebCore::JSWebGLRenderingContext::visitChildrenVirtual):
(WebCore::JSWebGLRenderingContext::visitChildren):

  • bindings/js/JSWorkerContextCustom.cpp:

(WebCore::JSWorkerContext::visitChildrenVirtual):
(WebCore::JSWorkerContext::visitChildren):

  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::visitChildrenVirtual):
(WebCore::JSXMLHttpRequest::visitChildren):

  • bindings/js/JSXPathResultCustom.cpp:

(WebCore::JSXPathResult::visitChildrenVirtual):
(WebCore::JSXPathResult::visitChildren):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObj::visitChildrenVirtual):
(WebCore::JSTestObj::visitChildren):

  • bindings/scripts/test/JS/JSTestObj.h:
  • bridge/qt/qt_instance.cpp:

(JSC::Bindings::QtRuntimeObject::visitChildrenVirtual):
(JSC::Bindings::QtRuntimeObject::visitChildren):

  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::QtRuntimeMetaMethod::visitChildrenVirtual):
(JSC::Bindings::QtRuntimeMetaMethod::visitChildren):

  • bridge/qt/qt_runtime.h:
  • workers/WorkerContext.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r95751 r95849  
    309309}
    310310
    311 void JSGlobalObject::visitChildren(SlotVisitor& visitor)
    312 {
    313     ASSERT_GC_OBJECT_INHERITS(this, &s_info);
     311void JSGlobalObject::visitChildrenVirtual(SlotVisitor& visitor)
     312{
     313    visitChildren(this, visitor);
     314}
     315
     316void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
     317{
     318    JSGlobalObject* thisObject = static_cast<JSGlobalObject*>(cell);
     319    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    314320    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    315     ASSERT(structure()->typeInfo().overridesVisitChildren());
    316     JSVariableObject::visitChildren(visitor);
    317 
    318     visitIfNeeded(visitor, &m_globalScopeChain);
    319     visitIfNeeded(visitor, &m_methodCallDummy);
    320 
    321     visitIfNeeded(visitor, &m_regExpConstructor);
    322     visitIfNeeded(visitor, &m_errorConstructor);
    323     visitIfNeeded(visitor, &m_evalErrorConstructor);
    324     visitIfNeeded(visitor, &m_rangeErrorConstructor);
    325     visitIfNeeded(visitor, &m_referenceErrorConstructor);
    326     visitIfNeeded(visitor, &m_syntaxErrorConstructor);
    327     visitIfNeeded(visitor, &m_typeErrorConstructor);
    328     visitIfNeeded(visitor, &m_URIErrorConstructor);
    329 
    330     visitIfNeeded(visitor, &m_evalFunction);
    331     visitIfNeeded(visitor, &m_callFunction);
    332     visitIfNeeded(visitor, &m_applyFunction);
    333 
    334     visitIfNeeded(visitor, &m_objectPrototype);
    335     visitIfNeeded(visitor, &m_functionPrototype);
    336     visitIfNeeded(visitor, &m_arrayPrototype);
    337     visitIfNeeded(visitor, &m_booleanPrototype);
    338     visitIfNeeded(visitor, &m_stringPrototype);
    339     visitIfNeeded(visitor, &m_numberPrototype);
    340     visitIfNeeded(visitor, &m_datePrototype);
    341     visitIfNeeded(visitor, &m_regExpPrototype);
    342 
    343     visitIfNeeded(visitor, &m_argumentsStructure);
    344     visitIfNeeded(visitor, &m_arrayStructure);
    345     visitIfNeeded(visitor, &m_booleanObjectStructure);
    346     visitIfNeeded(visitor, &m_callbackConstructorStructure);
    347     visitIfNeeded(visitor, &m_callbackFunctionStructure);
    348     visitIfNeeded(visitor, &m_callbackObjectStructure);
    349     visitIfNeeded(visitor, &m_dateStructure);
    350     visitIfNeeded(visitor, &m_emptyObjectStructure);
    351     visitIfNeeded(visitor, &m_nullPrototypeObjectStructure);
    352     visitIfNeeded(visitor, &m_errorStructure);
    353     visitIfNeeded(visitor, &m_functionStructure);
    354     visitIfNeeded(visitor, &m_boundFunctionStructure);
    355     visitIfNeeded(visitor, &m_namedFunctionStructure);
    356     visitIfNeeded(visitor, &m_numberObjectStructure);
    357     visitIfNeeded(visitor, &m_regExpMatchesArrayStructure);
    358     visitIfNeeded(visitor, &m_regExpStructure);
    359     visitIfNeeded(visitor, &m_stringObjectStructure);
    360     visitIfNeeded(visitor, &m_internalFunctionStructure);
    361 
    362     if (m_registerArray) {
     321    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
     322    JSVariableObject::visitChildren(thisObject, visitor);
     323
     324    visitIfNeeded(visitor, &thisObject->m_globalScopeChain);
     325    visitIfNeeded(visitor, &thisObject->m_methodCallDummy);
     326
     327    visitIfNeeded(visitor, &thisObject->m_regExpConstructor);
     328    visitIfNeeded(visitor, &thisObject->m_errorConstructor);
     329    visitIfNeeded(visitor, &thisObject->m_evalErrorConstructor);
     330    visitIfNeeded(visitor, &thisObject->m_rangeErrorConstructor);
     331    visitIfNeeded(visitor, &thisObject->m_referenceErrorConstructor);
     332    visitIfNeeded(visitor, &thisObject->m_syntaxErrorConstructor);
     333    visitIfNeeded(visitor, &thisObject->m_typeErrorConstructor);
     334    visitIfNeeded(visitor, &thisObject->m_URIErrorConstructor);
     335
     336    visitIfNeeded(visitor, &thisObject->m_evalFunction);
     337    visitIfNeeded(visitor, &thisObject->m_callFunction);
     338    visitIfNeeded(visitor, &thisObject->m_applyFunction);
     339
     340    visitIfNeeded(visitor, &thisObject->m_objectPrototype);
     341    visitIfNeeded(visitor, &thisObject->m_functionPrototype);
     342    visitIfNeeded(visitor, &thisObject->m_arrayPrototype);
     343    visitIfNeeded(visitor, &thisObject->m_booleanPrototype);
     344    visitIfNeeded(visitor, &thisObject->m_stringPrototype);
     345    visitIfNeeded(visitor, &thisObject->m_numberPrototype);
     346    visitIfNeeded(visitor, &thisObject->m_datePrototype);
     347    visitIfNeeded(visitor, &thisObject->m_regExpPrototype);
     348
     349    visitIfNeeded(visitor, &thisObject->m_argumentsStructure);
     350    visitIfNeeded(visitor, &thisObject->m_arrayStructure);
     351    visitIfNeeded(visitor, &thisObject->m_booleanObjectStructure);
     352    visitIfNeeded(visitor, &thisObject->m_callbackConstructorStructure);
     353    visitIfNeeded(visitor, &thisObject->m_callbackFunctionStructure);
     354    visitIfNeeded(visitor, &thisObject->m_callbackObjectStructure);
     355    visitIfNeeded(visitor, &thisObject->m_dateStructure);
     356    visitIfNeeded(visitor, &thisObject->m_emptyObjectStructure);
     357    visitIfNeeded(visitor, &thisObject->m_nullPrototypeObjectStructure);
     358    visitIfNeeded(visitor, &thisObject->m_errorStructure);
     359    visitIfNeeded(visitor, &thisObject->m_functionStructure);
     360    visitIfNeeded(visitor, &thisObject->m_boundFunctionStructure);
     361    visitIfNeeded(visitor, &thisObject->m_namedFunctionStructure);
     362    visitIfNeeded(visitor, &thisObject->m_numberObjectStructure);
     363    visitIfNeeded(visitor, &thisObject->m_regExpMatchesArrayStructure);
     364    visitIfNeeded(visitor, &thisObject->m_regExpStructure);
     365    visitIfNeeded(visitor, &thisObject->m_stringObjectStructure);
     366    visitIfNeeded(visitor, &thisObject->m_internalFunctionStructure);
     367
     368    if (thisObject->m_registerArray) {
    363369        // Outside the execution of global code, when our variables are torn off,
    364370        // we can mark the torn-off array.
    365         visitor.appendValues(m_registerArray.get(), m_registerArraySize);
    366     } else if (m_registers) {
     371        visitor.appendValues(thisObject->m_registerArray.get(), thisObject->m_registerArraySize);
     372    } else if (thisObject->m_registers) {
    367373        // During execution of global code, when our variables are in the register file,
    368374        // the symbol table tells us how many variables there are, and registers
    369375        // points to where they end, and the registers used for execution begin.
    370         visitor.appendValues(m_registers - symbolTable().size(), symbolTable().size());
     376        visitor.appendValues(thisObject->m_registers - thisObject->symbolTable().size(), thisObject->symbolTable().size());
    371377    }
    372378}
Note: See TracChangeset for help on using the changeset viewer.