Changeset 94701 in webkit for trunk/Source/JavaScriptCore/API


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

Remove JSObjectWithGlobalObject
https://bugs.webkit.org/show_bug.cgi?id=67689

Reviewed by Geoff Garen.

../../../../Volumes/Data/git/WebKit/OpenSource/Source/JavaScriptCore:

Remove JSObjectWithGlobalObject, and update code to stop using anonymous
storage to access the global object that a JSObject comes from. Largely
mechanical change to remove the use of anonymous storage and JSObjectWithGlobalObject.

  • API/JSCallbackConstructor.cpp:

(JSC::JSCallbackConstructor::JSCallbackConstructor):
(JSC::JSCallbackConstructor::finishCreation):

  • API/JSCallbackConstructor.h:
  • API/JSCallbackObject.cpp:
  • API/JSCallbackObject.h:

(JSC::JSCallbackObject::create):

  • API/JSCallbackObjectFunctions.h:

(JSC::::JSCallbackObject):
(JSC::::finishCreation):
(JSC::::staticFunctionGetter):

  • API/JSClassRef.cpp:

(OpaqueJSClass::prototype):

  • API/JSObjectRef.cpp:

(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):

  • API/JSValueRef.cpp:

(JSValueIsObjectOfClass):

(JSC::DFG::dfgRepatchGetMethodFast):
(JSC::DFG::tryCacheGetMethod):

  • jit/JIT.h:
  • jit/JITInlineMethods.h:

(JSC::JIT::emitAllocateJSFunction):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::patchMethodCallProto):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/DatePrototype.cpp:
  • runtime/InternalFunction.cpp:

(JSC::InternalFunction::InternalFunction):
(JSC::InternalFunction::finishCreation):

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

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::finishCreation):

  • runtime/JSFunction.h:

(JSC::JSFunction::create):
(JSC::JSFunction::createStructure):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):

  • runtime/JSONObject.cpp:

(JSC::JSONObject::JSONObject):
(JSC::JSONObject::finishCreation):

  • runtime/JSONObject.h:
  • runtime/JSObject.h:

(JSC::JSObject::globalObject):

  • runtime/JSObjectWithGlobalObject.cpp: Removed.
  • runtime/JSObjectWithGlobalObject.h: Removed.
  • runtime/JSValue.cpp:

(JSC::JSValue::isValidCallee):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/Lookup.h:
  • runtime/MathObject.cpp:

(JSC::MathObject::MathObject):
(JSC::MathObject::finishCreation):

  • runtime/MathObject.h:
  • runtime/NumberPrototype.cpp:
  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::RegExpObject):
(JSC::RegExpObject::finishCreation):

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

(JSC::Structure::Structure):

  • runtime/Structure.h:

(JSC::Structure::create):
(JSC::Structure::globalObject):

../../../../Volumes/Data/git/WebKit/OpenSource/Source/WebCore:

Remove use of anonymous storage and JSObjectWithGlobalObject for
accessing a JSObject's global object now that they're available
on the object's structure.

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::setWindow):

  • bindings/js/JSDOMWrapper.h:

(WebCore::JSDOMWrapper::globalObject):
(WebCore::JSDOMWrapper::JSDOMWrapper):

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::initScript):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):

  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:

(JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
(JSC::Bindings::ObjcFallbackObjectImp::finishCreation):

  • bridge/runtime_object.cpp:

(JSC::Bindings::RuntimeObject::RuntimeObject):
(JSC::Bindings::RuntimeObject::finishCreation):

  • bridge/runtime_object.h:

../../../../Volumes/Data/git/WebKit/OpenSource/Source/WebKit2:

Remove JSObjectWithGlobalObject usage.

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::JSNPObject::JSNPObject):
(WebKit::JSNPObject::finishCreation):

  • WebProcess/Plugins/Netscape/JSNPObject.h:
Location:
trunk/Source/JavaScriptCore/API
Files:
9 edited

Legend:

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

    r94644 r94701  
    3737namespace JSC {
    3838
    39 const ClassInfo JSCallbackConstructor::s_info = { "CallbackConstructor", &JSObjectWithGlobalObject::s_info, 0, 0 };
     39const ClassInfo JSCallbackConstructor::s_info = { "CallbackConstructor", &JSNonFinalObject::s_info, 0, 0 };
    4040
    4141JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
    42     : JSObjectWithGlobalObject(globalObject, structure)
     42    : JSNonFinalObject(globalObject->globalData(), structure)
    4343    , m_class(jsClass)
    4444    , m_callback(callback)
     
    4949void JSCallbackConstructor::finishCreation(JSGlobalObject* globalObject, JSClassRef jsClass)
    5050{
    51     Base::finishCreation(globalObject->globalData(), globalObject);
     51    Base::finishCreation(globalObject->globalData());
    5252    ASSERT(inherits(&s_info));
    5353    if (m_class)
  • trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h

    r94644 r94701  
    2828
    2929#include "JSObjectRef.h"
    30 #include <runtime/JSObjectWithGlobalObject.h>
     30#include <runtime/JSObject.h>
    3131
    3232namespace JSC {
    3333
    34 class JSCallbackConstructor : public JSObjectWithGlobalObject {
     34class JSCallbackConstructor : public JSNonFinalObject {
    3535public:
    36     typedef JSObjectWithGlobalObject Base;
     36    typedef JSNonFinalObject Base;
    3737
    3838    static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback)
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.cpp

    r83661 r94701  
    3333namespace JSC {
    3434
    35 ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSObjectWithGlobalObject>);
     35ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSNonFinalObject>);
    3636ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>);
    3737
    3838// Define the two types of JSCallbackObjects we support.
    39 template <> const ClassInfo JSCallbackObject<JSObjectWithGlobalObject>::s_info = { "CallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
     39template <> const ClassInfo JSCallbackObject<JSNonFinalObject>::s_info = { "CallbackObject", &JSNonFinalObject::s_info, 0, 0 };
    4040template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0 };
    4141
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.h

    r94599 r94701  
    118118class JSCallbackObject : public Parent {
    119119protected:
    120     JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data);
     120    JSCallbackObject(ExecState*, Structure*, JSClassRef, void* data);
    121121    JSCallbackObject(JSGlobalData&, JSClassRef, Structure*);
    122122    // We'd like to use the placement version of operator new defined in JSCell, but
     
    125125    void* operator new(size_t, void* ptr) { return ptr; }
    126126
    127     void finishCreation(ExecState*, JSGlobalObject*);
     127    void finishCreation(ExecState*);
    128128    void finishCreation();
    129129
     
    133133    static JSCallbackObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, void* data)
    134134    {
    135         JSCallbackObject* callbackObject = new (allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, globalObject, structure, classRef, data);
     135        ASSERT(!structure->globalObject() || structure->globalObject() == globalObject);
     136        JSCallbackObject* callbackObject = new (allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, structure, classRef, data);
    136137        return callbackObject;
    137138    }
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r94364 r94701  
    5151
    5252template <class Parent>
    53 JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
    54     : Parent(globalObject, structure)
     53JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure, JSClassRef jsClass, void* data)
     54    : Parent(exec->globalData(), structure)
    5555    , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
    5656{
    57     finishCreation(exec, globalObject);
     57    finishCreation(exec);
    5858}
    5959
     
    6969
    7070template <class Parent>
    71 void JSCallbackObject<Parent>::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
    72 {
    73     Base::finishCreation(globalObject->globalData(), globalObject);
     71void JSCallbackObject<Parent>::finishCreation(ExecState* exec)
     72{
     73    Base::finishCreation(exec->globalData());
    7474    ASSERT(Parent::inherits(&s_info));
    7575    init(exec);
     
    575575                if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
    576576                   
    577                     JSObject* o = JSCallbackFunction::create(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);
     577                    JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName);
    578578                    thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes);
    579579                    return o;
  • trunk/Source/JavaScriptCore/API/JSClassRef.cpp

    r91194 r94701  
    252252    if (!jsClassData.cachedPrototype) {
    253253        // Recursive, but should be good enough for our purposes
    254         jsClassData.cachedPrototype.set(exec->globalData(), JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction
     254        jsClassData.cachedPrototype.set(exec->globalData(), JSCallbackObject<JSNonFinalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction
    255255        if (parentClass) {
    256256            if (JSObject* prototype = parentClass->prototype(exec))
  • trunk/Source/JavaScriptCore/API/JSObjectRef.cpp

    r91194 r94701  
    8282        return toRef(constructEmptyObject(exec));
    8383
    84     JSCallbackObject<JSObjectWithGlobalObject>* object = JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
     84    JSCallbackObject<JSNonFinalObject>* object = JSCallbackObject<JSNonFinalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
    8585    if (JSObject* prototype = jsClass->prototype(exec))
    8686        object->setPrototype(exec->globalData(), prototype);
     
    343343    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
    344344        return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
    345     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info))
    346         return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivate();
     345    if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
     346        return static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivate();
    347347   
    348348    return 0;
     
    357357        return true;
    358358    }
    359     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    360         static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivate(data);
     359    if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
     360        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivate(data);
    361361        return true;
    362362    }
     
    374374    if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
    375375        result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
    376     else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info))
    377         result = static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivateProperty(name);
     376    else if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
     377        result = static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivateProperty(name);
    378378    return toRef(exec, result);
    379379}
     
    390390        return true;
    391391    }
    392     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    393         static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
     392    if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
     393        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
    394394        return true;
    395395    }
     
    407407        return true;
    408408    }
    409     if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
    410         static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->deletePrivateProperty(name);
     409    if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
     410        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->deletePrivateProperty(name);
    411411        return true;
    412412    }
  • trunk/Source/JavaScriptCore/API/JSValueRef.cpp

    r89219 r94701  
    132132        if (o->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
    133133            return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
    134         if (o->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info))
    135             return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(o)->inherits(jsClass);
     134        if (o->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
     135            return static_cast<JSCallbackObject<JSNonFinalObject>*>(o)->inherits(jsClass);
    136136    }
    137137    return false;
  • trunk/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp

    r85117 r94701  
    5858    if (!obj)
    5959        return;
    60     ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::s_info) || obj->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info));
     60    ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::s_info) || obj->inherits(&JSCallbackObject<JSNonFinalObject>::s_info));
    6161    map->map().set(exec->globalData(), key, obj);
    6262}
Note: See TracChangeset for help on using the changeset viewer.