Ignore:
Timestamp:
Nov 1, 2011, 5:36:20 PM (14 years ago)
Author:
[email protected]
Message:

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

Reviewed by Darin Adler.

Source/JavaScriptCore:

Added defineSetter to the MethodTable, changed all the virtual
implementations of defineSetter to static ones, and replaced
all call sites with corresponding lookups in the MethodTable.

(JSC::DebuggerActivation::defineSetter):

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

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

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

(JSC::JSCell::defineSetter):

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

(JSC::JSGlobalObject::defineSetter):

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

(JSC::JSObject::defineSetter):
(JSC::putDescriptor):

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

(JSC::objectProtoFuncDefineSetter):

Source/WebCore:

No new tests.

Added defineSetter to the MethodTable, changed all the virtual
implementations of defineSetter to static ones, and replaced
all call sites with corresponding lookups in the MethodTable.

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::defineSetter):

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::defineSetter):

  • bindings/js/JSDOMWindowShell.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):

File:
1 edited

Legend:

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

    r98932 r99018  
    403403}
    404404
    405 void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
     405void JSObject::defineSetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
    406406{
    407407    if (propertyName == exec->propertyNames().underscoreProto) {
     
    410410    }
    411411
    412     JSValue object = getDirect(exec->globalData(), propertyName);
     412    JSValue object = thisObject->getDirect(exec->globalData(), propertyName);
    413413    if (object && object.isGetterSetter()) {
    414         ASSERT(structure()->hasGetterSetterProperties());
     414        ASSERT(thisObject->structure()->hasGetterSetterProperties());
    415415        asGetterSetter(object)->setSetter(exec->globalData(), setterFunction);
    416416        return;
     
    419419    PutPropertySlot slot;
    420420    GetterSetter* getterSetter = GetterSetter::create(exec);
    421     putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot, 0);
     421    thisObject->putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot, 0);
    422422
    423423    // putDirect will change our Structure if we add a new property. For
     
    425425    // if we override an existing non-getter or non-setter.
    426426    if (slot.type() != PutPropertySlot::NewProperty) {
    427         if (!structure()->isDictionary())
    428             setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), structure()));
    429     }
    430 
    431     structure()->setHasGetterSetterProperties(true);
     427        if (!thisObject->structure()->isDictionary())
     428            thisObject->setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), thisObject->structure()));
     429    }
     430
     431    thisObject->structure()->setHasGetterSetterProperties(true);
    432432    getterSetter->setSetter(exec->globalData(), setterFunction);
    433433}
     
    737737        return false;
    738738    if (descriptor.setter() && descriptor.setter().isObject())
    739         target->defineSetter(exec, propertyName, asObject(descriptor.setter()), attributes);
     739        target->methodTable()->defineSetter(target, exec, propertyName, asObject(descriptor.setter()), attributes);
    740740    return !exec->hadException();
    741741}
Note: See TracChangeset for help on using the changeset viewer.