Ignore:
Timestamp:
Oct 31, 2011, 3:24:20 PM (14 years ago)
Author:
[email protected]
Message:

De-virtualize JSObject::defineGetter
https://bugs.webkit.org/show_bug.cgi?id=71134

Reviewed by Darin Adler.

Source/JavaScriptCore:

Added defineGetter to the MethodTable. Replaced all virtual versions of defineGetter
with static versions. Replaced all call sites with lookups in the MethodTable.

(JSC::DebuggerActivation::defineGetter):

  • debugger/DebuggerActivation.h:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/ClassInfo.h:
  • runtime/JSCell.cpp:

(JSC::JSCell::defineGetter):

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

(JSC::JSGlobalObject::defineGetter):

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

(JSC::JSObject::defineGetter):
(JSC::putDescriptor):

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

(JSC::objectProtoFuncDefineGetter):

Source/WebCore:

No new tests.

Added defineGetter to the MethodTable. Replaced all virtual versions of defineGetter
with static versions. Replaced all call sites with lookups in the MethodTable.

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::defineGetter):

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::defineGetter):

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

(WebCore::JSLocation::defineGetter):
(WebCore::JSLocationPrototype::defineGetter):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):

Source/WebKit/qt:

Added defineGetter to the MethodTable. Replaced all virtual versions of defineGetter
with static versions. Replaced all call sites with lookups in the MethodTable.

  • Api/qwebframe.cpp:

(QWebFramePrivate::addQtSenderToGlobalObject):

File:
1 edited

Legend:

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

    r98593 r98889  
    349349}
    350350
    351 void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
     351void JSObject::defineGetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
    352352{
    353353    if (propertyName == exec->propertyNames().underscoreProto) {
     
    356356    }
    357357
    358     JSValue object = getDirect(exec->globalData(), propertyName);
     358    JSValue object = thisObject->getDirect(exec->globalData(), propertyName);
    359359    if (object && object.isGetterSetter()) {
    360         ASSERT(structure()->hasGetterSetterProperties());
     360        ASSERT(thisObject->structure()->hasGetterSetterProperties());
    361361        asGetterSetter(object)->setGetter(exec->globalData(), getterFunction);
    362362        return;
     
    366366    PutPropertySlot slot;
    367367    GetterSetter* getterSetter = GetterSetter::create(exec);
    368     putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0);
     368    thisObject->putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0);
    369369
    370370    // putDirect will change our Structure if we add a new property. For
     
    372372    // if we override an existing non-getter or non-setter.
    373373    if (slot.type() != PutPropertySlot::NewProperty) {
    374         if (!structure()->isDictionary())
    375             setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, structure()));
    376     }
    377 
    378     structure()->setHasGetterSetterProperties(true);
     374        if (!thisObject->structure()->isDictionary())
     375            thisObject->setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, thisObject->structure()));
     376    }
     377
     378    thisObject->structure()->setHasGetterSetterProperties(true);
    379379    getterSetter->setGetter(globalData, getterFunction);
    380380}
     
    730730    attributes &= ~ReadOnly;
    731731    if (descriptor.getter() && descriptor.getter().isObject())
    732         target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes);
     732        target->methodTable()->defineGetter(target, exec, propertyName, asObject(descriptor.getter()), attributes);
    733733    if (exec->hadException())
    734734        return false;
Note: See TracChangeset for help on using the changeset viewer.