Ignore:
Timestamp:
Oct 28, 2011, 12:08:24 PM (14 years ago)
Author:
[email protected]
Message:

De-virtualize isGlobalObject, isVariableObject, isActivationObject, and isErrorInstance in JSObject
https://bugs.webkit.org/show_bug.cgi?id=70968

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • API/JSCallbackObject.cpp: Added two specializations for createStructure that use different JSTypes in their

TypeInfo. Had to also create a specialization for JSNonFinalObject, even JSGlobalObject was the only that
needed it because Windows wouldn't build without it.
(JSC::::createStructure):

  • API/JSCallbackObject.h:
  • JavaScriptCore.exp:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • runtime/ErrorInstance.h: Removed virtual function and changed JSType provided to TypeInfo in createStructure.

(JSC::ErrorInstance::createStructure):

  • runtime/ErrorPrototype.h: Ditto

(JSC::ErrorPrototype::createStructure):

  • runtime/JSActivation.h: Ditto

(JSC::JSActivation::createStructure):

  • runtime/JSGlobalObject.h: Ditto

(JSC::JSGlobalObject::createStructure):

  • runtime/JSObject.h: De-virtualized functions. They now check the JSType of the object for the corresponding type.

(JSC::JSObject::isGlobalObject):
(JSC::JSObject::isVariableObject):
(JSC::JSObject::isActivationObject):
(JSC::JSObject::isErrorInstance):

  • runtime/JSType.h: Added new types for GlobalObject, VariableObject, ActivationObject, and ErrorInstance.
  • runtime/JSVariableObject.cpp: Removed virtual function.
  • runtime/JSVariableObject.h: Changed JSType provided to TypeInfo in createStructure.

(JSC::JSVariableObject::createStructure):

Source/WebCore:

No new tests.

  • bindings/js/JSDOMGlobalObject.h: Changed JSType provided to TypeInfo in createStructure since this

class inherits from JSGlobalObject.
(WebCore::JSDOMGlobalObject::createStructure):

  • bindings/js/JSDOMWindowBase.h: Ditto

(WebCore::JSDOMWindowBase::createStructure):

  • bindings/js/JSWorkerContextBase.h: Ditto

(WebCore::JSWorkerContextBase::createStructure):

  • bindings/scripts/CodeGeneratorJS.pm: Added extra check to make sure subclasses of JSGlobalObject,

namely JSDOMWindow and JSWorkerContext, get their special JSType in their createStructure function.
(GenerateHeader):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.cpp

    r95936 r98747  
    4040template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) };
    4141
     42template <>
     43Structure* JSCallbackObject<JSNonFinalObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto)
     44{
     45    return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info);
     46}
     47   
     48template <>
     49Structure* JSCallbackObject<JSGlobalObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto)
     50{
     51    return Structure::create(globalData, globalObject, proto, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
     52}
     53
    4254void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context)
    4355{
Note: See TracChangeset for help on using the changeset viewer.