Ignore:
Timestamp:
Feb 19, 2011, 1:55:44 PM (14 years ago)
Author:
[email protected]
Message:

Bug 54786 - Devirtualize JSCell::classInfo()

Reviewed by Sam Weinig.

Instead of making a virtual function call, add a pointer to the ClassInfo
onto Structure.

This removes a virtual function call, and paves the way towards removing all
the createStructure methods, and StructureFlags/AnonymousSlotCount properties
(these should be able to move onto ClassInfo).

Calls to Structure::create must now pass a pointer to the ClassInfo for the
structure. All objects now have a ClassInfo pointer, non-object cell types
still do not.

Changes are most mechanical, involving three steps:

  • Remove virtual classInfo() methods.
  • Add &s_info parameter to calls to Structure::create.
  • Rename ClassInfo static members on classes from 'info' to 's_info', for consistency.

Source/JavaScriptCore:

  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackConstructor.h:
  • API/JSCallbackFunction.cpp:
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.cpp:
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:
  • API/JSObjectRef.cpp:
  • API/JSValueRef.cpp:
  • API/JSWeakObjectMapRefPrivate.cpp:
  • JavaScriptCore.exp:
  • debugger/Debugger.cpp:
  • debugger/DebuggerActivation.h:
  • debugger/DebuggerCallFrame.cpp:
  • interpreter/Interpreter.cpp:
  • jit/JITCall32_64.cpp:
  • jit/JITOpcodes.cpp:
  • jit/JITStubs.cpp:
  • profiler/Profiler.cpp:
  • runtime/Arguments.cpp:
  • runtime/Arguments.h:
  • runtime/ArrayConstructor.cpp:
  • runtime/ArrayPrototype.cpp:
  • runtime/ArrayPrototype.h:
  • runtime/BooleanObject.cpp:
  • runtime/BooleanObject.h:
  • runtime/BooleanPrototype.cpp:
  • runtime/DateConstructor.cpp:
  • runtime/DateInstance.cpp:
  • runtime/DateInstance.h:
  • runtime/DatePrototype.cpp:
  • runtime/DatePrototype.h:
  • runtime/ErrorInstance.cpp:
  • runtime/ErrorInstance.h:
  • runtime/ErrorPrototype.cpp:
  • runtime/FunctionPrototype.cpp:
  • runtime/FunctionPrototype.h:
  • runtime/GetterSetter.h:
  • runtime/GlobalEvalFunction.h:
  • runtime/InternalFunction.cpp:
  • runtime/InternalFunction.h:
  • runtime/JSAPIValueWrapper.h:
  • runtime/JSActivation.cpp:
  • runtime/JSActivation.h:
  • runtime/JSArray.cpp:
  • runtime/JSArray.h:
  • runtime/JSByteArray.cpp:
  • runtime/JSByteArray.h:
  • runtime/JSCell.cpp:
  • runtime/JSCell.h:
  • runtime/JSFunction.cpp:
  • runtime/JSFunction.h:
  • runtime/JSGlobalData.cpp:
  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h:
  • runtime/JSNotAnObject.h:
  • runtime/JSONObject.cpp:
  • runtime/JSONObject.h:
  • runtime/JSObject.cpp:
  • runtime/JSObject.h:
  • runtime/JSObjectWithGlobalObject.h:
  • runtime/JSPropertyNameIterator.h:
  • runtime/JSStaticScopeObject.h:
  • runtime/JSString.h:
  • runtime/JSVariableObject.h:
  • runtime/JSWrapperObject.h:
  • runtime/JSZombie.cpp:
  • runtime/JSZombie.h:
  • runtime/Lookup.cpp:
  • runtime/MathObject.cpp:
  • runtime/MathObject.h:
  • runtime/NativeErrorConstructor.cpp:
  • runtime/NativeErrorConstructor.h:
  • runtime/NumberConstructor.cpp:
  • runtime/NumberConstructor.h:
  • runtime/NumberObject.cpp:
  • runtime/NumberObject.h:
  • runtime/NumberPrototype.cpp:
  • runtime/ObjectConstructor.cpp:
  • runtime/ObjectPrototype.cpp:
  • runtime/RegExpConstructor.cpp:
  • runtime/RegExpConstructor.h:
  • runtime/RegExpObject.cpp:
  • runtime/RegExpObject.h:
  • runtime/RegExpPrototype.cpp:
  • runtime/ScopeChain.cpp:
  • runtime/StringConstructor.cpp:
  • runtime/StringObject.cpp:
  • runtime/StringObject.h:
  • runtime/StringObjectThatMasqueradesAsUndefined.h:
  • runtime/StringPrototype.cpp:
  • runtime/StringPrototype.h:
  • runtime/Structure.cpp:
  • runtime/Structure.h:

Source/JavaScriptGlue:

  • JSUtils.cpp:

(KJSValueToJSObject):
(KJSValueToCFTypeInternal):

  • UserObjectImp.cpp:
  • UserObjectImp.h:

(UserObjectImp::createStructure):

Source/WebCore:

  • WebCore.exp.in:
  • bindings/js/JSAudioConstructor.cpp:
  • bindings/js/JSAudioConstructor.h:
  • bindings/js/JSDOMBinding.cpp:
  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMGlobalObject.cpp:
  • bindings/js/JSDOMGlobalObject.h:
  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSDOMWindowBase.h:
  • bindings/js/JSDOMWindowShell.cpp:
  • bindings/js/JSDOMWindowShell.h:
  • bindings/js/JSGeolocationCustom.cpp:
  • bindings/js/JSImageConstructor.cpp:
  • bindings/js/JSImageConstructor.h:
  • bindings/js/JSImageDataCustom.cpp:
  • bindings/js/JSOptionConstructor.cpp:
  • bindings/js/JSOptionConstructor.h:
  • bindings/js/JSWorkerContextBase.cpp:
  • bindings/js/JSWorkerContextBase.h:
  • bindings/js/SerializedScriptValue.cpp:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/c/CRuntimeObject.cpp:
  • bridge/c/CRuntimeObject.h:
  • bridge/c/c_instance.cpp:
  • bridge/jni/jsc/JNIUtilityPrivate.cpp:
  • bridge/jni/jsc/JavaInstanceJSC.cpp:
  • bridge/jni/jsc/JavaRuntimeObject.cpp:
  • bridge/jni/jsc/JavaRuntimeObject.h:
  • bridge/jsc/BridgeJSC.cpp:
  • bridge/objc/ObjCRuntimeObject.h:
  • bridge/objc/ObjCRuntimeObject.mm:
  • bridge/objc/objc_instance.mm:
  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:
  • bridge/runtime_array.cpp:
  • bridge/runtime_array.h:
  • bridge/runtime_method.cpp:
  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp:
  • bridge/runtime_object.h:

Source/WebKit/mac:

  • Plugins/Hosted/ProxyInstance.mm:

(WebKit::ProxyRuntimeMethod::ProxyRuntimeMethod):
(WebKit::ProxyRuntimeMethod::createStructure):

  • Plugins/Hosted/ProxyRuntimeObject.h:

(WebKit::ProxyRuntimeObject::createStructure):

  • Plugins/Hosted/ProxyRuntimeObject.mm:

(WebKit::ProxyRuntimeObject::ProxyRuntimeObject):

  • WebView/WebView.mm:

(aeDescFromJSValue):

Source/WebKit2:

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:

(WebKit::JSNPMethod::JSNPMethod):

  • WebProcess/Plugins/Netscape/JSNPMethod.h:

(WebKit::JSNPMethod::createStructure):

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::JSNPObject::JSNPObject):

  • WebProcess/Plugins/Netscape/JSNPObject.h:

(WebKit::JSNPObject::createStructure):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/profiler/Profiler.cpp

    r72351 r79132  
    151151    if (!functionValue.isObject())
    152152        return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
    153     if (asObject(functionValue)->inherits(&JSFunction::info)) {
     153    if (asObject(functionValue)->inherits(&JSFunction::s_info)) {
    154154        JSFunction* function = asFunction(functionValue);
    155155        if (!function->executable()->isHostFunction())
    156156            return createCallIdentifierFromFunctionImp(exec, function);
    157157    }
    158     if (asObject(functionValue)->inherits(&JSFunction::info))
     158    if (asObject(functionValue)->inherits(&JSFunction::s_info))
    159159        return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
    160     if (asObject(functionValue)->inherits(&InternalFunction::info))
     160    if (asObject(functionValue)->inherits(&InternalFunction::s_info))
    161161        return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
    162162    return CallIdentifier(makeUString("(", asObject(functionValue)->className(), " object)"), defaultSourceURL, defaultLineNumber);
Note: See TracChangeset for help on using the changeset viewer.