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/API/JSObjectRef.cpp

    r78732 r79132  
    341341    JSObject* jsObject = toJS(object);
    342342   
    343     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
     343    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
    344344        return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
    345     else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
     345    if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info))
    346346        return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivate();
    347347   
     
    353353    JSObject* jsObject = toJS(object);
    354354   
    355     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
     355    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
    356356        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
    357357        return true;
    358     } else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
     358    }
     359    if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    359360        static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivate(data);
    360361        return true;
     
    371372    JSValue result;
    372373    Identifier name(propertyName->identifier(&exec->globalData()));
    373     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
     374    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
    374375        result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
    375     else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
     376    else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info))
    376377        result = static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivateProperty(name);
    377378    return toRef(exec, result);
     
    385386    JSValue jsValue = value ? toJS(exec, value) : JSValue();
    386387    Identifier name(propertyName->identifier(&exec->globalData()));
    387     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
     388    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
    388389        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
    389390        return true;
    390391    }
    391     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
     392    if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    392393        static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
    393394        return true;
     
    402403    JSObject* jsObject = toJS(object);
    403404    Identifier name(propertyName->identifier(&exec->globalData()));
    404     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
     405    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
    405406        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
    406407        return true;
    407408    }
    408     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
     409    if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    409410        static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->deletePrivateProperty(name);
    410411        return true;
Note: See TracChangeset for help on using the changeset viewer.