Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (98888 => 98889)
--- trunk/Source/_javascript_Core/ChangeLog 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-10-31 22:24:20 UTC (rev 98889)
@@ -1,3 +1,36 @@
+2011-10-31 Mark Hahnenberg <mhahnenb...@apple.com>
+
+ De-virtualize JSObject::defineGetter
+ https://bugs.webkit.org/show_bug.cgi?id=71134
+
+ Reviewed by Darin Adler.
+
+ Added defineGetter to the MethodTable. Replaced all virtual versions of defineGetter
+ with static versions. Replaced all call sites with lookups in the MethodTable.
+
+ * _javascript_Core.exp:
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+ * debugger/DebuggerActivation.cpp:
+ (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):
+
2011-10-31 Michael Saboff <msab...@apple.com>
Towards 8-bit Strings: Move Lexer and Parser Objects out of JSGlobalData
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (98888 => 98889)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -161,7 +161,7 @@
__ZN3JSC13SamplingFlags7s_flagsE
__ZN3JSC13StatementNode6setLocEii
__ZN3JSC14JSGlobalObject10globalExecEv
-__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC14JSGlobalObject12defineGetterEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierES2_j
__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
__ZN3JSC14JSGlobalObject13clearRareDataEPNS_6JSCellE
__ZN3JSC14JSGlobalObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
@@ -301,7 +301,7 @@
__ZN3JSC8DebuggerD2Ev
__ZN3JSC8JSObject10putByIndexEPNS_6JSCellEPNS_9ExecStateEjNS_7JSValueE
__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_
-__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZN3JSC8JSObject12defineGetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j
__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (98888 => 98889)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-31 22:24:20 UTC (rev 98889)
@@ -134,9 +134,9 @@
?decrement@RefCountedLeakCounter@WTF@@QAEXXZ
?defaultAttributes@PropertyDescriptor@JSC@@0IA
?defaultValue@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
- ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
- ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
?defineOwnProperty@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z
+ ?defineGetter@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@0I@Z
+ ?defineGetter@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@0I@Z
?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z
Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -93,9 +93,10 @@
return m_activation->getOwnPropertyDescriptor(exec, propertyName, descriptor);
}
-void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void DebuggerActivation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
- m_activation->defineGetter(exec, propertyName, getterFunction, attributes);
+ DebuggerActivation* thisObject = static_cast<DebuggerActivation*>(object);
+ thisObject->m_activation->methodTable()->defineGetter(thisObject->m_activation.get(), exec, propertyName, getterFunction, attributes);
}
void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.h (98888 => 98889)
--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -49,7 +49,7 @@
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
+ static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes);
virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -4989,7 +4989,7 @@
JSObject* baseObj = asObject(callFrame->r(base).jsValue());
Identifier& ident = codeBlock->identifier(property);
ASSERT(callFrame->r(function).jsValue().isObject());
- baseObj->defineGetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
+ baseObj->methodTable()->defineGetter(baseObj, callFrame, ident, asObject(callFrame->r(function).jsValue()));
vPC += OPCODE_LENGTH(op_put_getter);
NEXT_INSTRUCTION();
Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/jit/JITStubs.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -3747,7 +3747,7 @@
ASSERT(stackFrame.args[0].jsValue().isObject());
JSObject* baseObj = asObject(stackFrame.args[0].jsValue());
ASSERT(stackFrame.args[2].jsValue().isObject());
- baseObj->defineGetter(callFrame, stackFrame.args[1].identifier(), asObject(stackFrame.args[2].jsValue()));
+ baseObj->methodTable()->defineGetter(baseObj, callFrame, stackFrame.args[1].identifier(), asObject(stackFrame.args[2].jsValue()), 0);
}
DEFINE_STUB_FUNCTION(void, op_put_setter)
Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/ClassInfo.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -61,6 +61,9 @@
typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*);
ToThisObjectFunctionPtr toThisObject;
+
+ typedef void (*DefineGetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned);
+ DefineGetterFunctionPtr defineGetter;
};
#define CREATE_MEMBER_CHECKER(member) \
@@ -93,6 +96,7 @@
&ClassName::getOwnPropertySlot, \
&ClassName::getOwnPropertySlotByIndex, \
&ClassName::toThisObject, \
+ &ClassName::defineGetter, \
}, \
sizeof(ClassName)
Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSCell.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -158,4 +158,9 @@
ASSERT_GC_OBJECT_LOOKS_VALID(cell);
}
+void JSCell::defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned)
+{
+ ASSERT_NOT_REACHED();
+}
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -132,6 +132,9 @@
// Base implementation; for non-object classes implements getPropertySlot.
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
+
+ // Dummy implementations of override-able static functions for classes to put in their MethodTable
+ static NO_RETURN_DUE_TO_ASSERT void defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned);
private:
WriteBarrier<Structure> m_structure;
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -163,11 +163,12 @@
}
}
-void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
+void JSGlobalObject::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
{
+ JSGlobalObject* thisObject = static_cast<JSGlobalObject*>(object);
PropertySlot slot;
- if (!symbolTableGet(propertyName, slot))
- JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes);
+ if (!thisObject->symbolTableGet(propertyName, slot))
+ JSVariableObject::defineGetter(thisObject, exec, propertyName, getterFunc, attributes);
}
void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -189,7 +189,7 @@
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes);
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes);
+ static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes);
virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes);
// We use this in the code generator as we perform symbol table
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -348,16 +348,16 @@
return 0;
}
-void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void JSObject::defineGetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
if (propertyName == exec->propertyNames().underscoreProto) {
// Defining a getter for __proto__ is silently ignored.
return;
}
- JSValue object = getDirect(exec->globalData(), propertyName);
+ JSValue object = thisObject->getDirect(exec->globalData(), propertyName);
if (object && object.isGetterSetter()) {
- ASSERT(structure()->hasGetterSetterProperties());
+ ASSERT(thisObject->structure()->hasGetterSetterProperties());
asGetterSetter(object)->setGetter(exec->globalData(), getterFunction);
return;
}
@@ -365,17 +365,17 @@
JSGlobalData& globalData = exec->globalData();
PutPropertySlot slot;
GetterSetter* getterSetter = GetterSetter::create(exec);
- putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0);
+ thisObject->putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0);
// putDirect will change our Structure if we add a new property. For
// getters and setters, though, we also need to change our Structure
// if we override an existing non-getter or non-setter.
if (slot.type() != PutPropertySlot::NewProperty) {
- if (!structure()->isDictionary())
- setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, structure()));
+ if (!thisObject->structure()->isDictionary())
+ thisObject->setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, thisObject->structure()));
}
- structure()->setHasGetterSetterProperties(true);
+ thisObject->structure()->setHasGetterSetterProperties(true);
getterSetter->setGetter(globalData, getterFunction);
}
@@ -729,7 +729,7 @@
}
attributes &= ~ReadOnly;
if (descriptor.getter() && descriptor.getter().isObject())
- target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes);
+ target->methodTable()->defineGetter(target, exec, propertyName, asObject(descriptor.getter()), attributes);
if (exec->hadException())
return false;
if (descriptor.setter() && descriptor.setter().isObject())
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -185,7 +185,7 @@
void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location);
void initializeGetterSetterProperty(ExecState*, const Identifier&, GetterSetter*, unsigned attributes);
- virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
+ static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (98888 => 98889)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -147,7 +147,7 @@
CallData callData;
if (getCallData(exec->argument(1), callData) == CallTypeNone)
return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));
- thisObject->defineGetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
+ thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)), 0);
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/WebCore/ChangeLog (98888 => 98889)
--- trunk/Source/WebCore/ChangeLog 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/ChangeLog 2011-10-31 22:24:20 UTC (rev 98889)
@@ -1,3 +1,26 @@
+2011-10-31 Mark Hahnenberg <mhahnenb...@apple.com>
+
+ De-virtualize JSObject::defineGetter
+ https://bugs.webkit.org/show_bug.cgi?id=71134
+
+ Reviewed by Darin Adler.
+
+ 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):
+
2011-10-31 Arko Saha <a...@motorola.com>
Microdata: Support for itemid attribute.
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (98888 => 98889)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -384,17 +384,18 @@
Base::getOwnPropertyNames(exec, propertyNames, mode);
}
-void JSDOMWindow::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void JSDOMWindow::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
+ JSDOMWindow* thisObject = static_cast<JSDOMWindow*>(object);
// Only allow defining getters by frames in the same origin.
- if (!allowsAccessFrom(exec))
+ if (!thisObject->allowsAccessFrom(exec))
return;
// Don't allow shadowing location using defineGetter.
if (propertyName == "location")
return;
- Base::defineGetter(exec, propertyName, getterFunction, attributes);
+ Base::defineGetter(thisObject, exec, propertyName, getterFunction, attributes);
}
void JSDOMWindow::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp (98888 => 98889)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -143,9 +143,10 @@
m_window->getOwnPropertyNames(exec, propertyNames, mode);
}
-void JSDOMWindowShell::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void JSDOMWindowShell::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
- m_window->defineGetter(exec, propertyName, getterFunction, attributes);
+ JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(object);
+ thisObject->m_window->methodTable()->defineGetter(thisObject->m_window.get(), exec, propertyName, getterFunction, attributes);
}
void JSDOMWindowShell::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (98888 => 98889)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-31 22:24:20 UTC (rev 98889)
@@ -87,7 +87,7 @@
static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName);
virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);
virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);
- virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);
+ static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);
virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);
virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);
virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);
Modified: trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp (98888 => 98889)
--- trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -169,11 +169,11 @@
Base::getOwnPropertyNames(exec, propertyNames, mode);
}
-void JSLocation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void JSLocation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)
return;
- Base::defineGetter(exec, propertyName, getterFunction, attributes);
+ Base::defineGetter(object, exec, propertyName, getterFunction, attributes);
}
void JSLocation::setHref(ExecState* exec, JSValue value)
@@ -280,11 +280,11 @@
return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf);
}
-void JSLocationPrototype::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+void JSLocationPrototype::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
{
if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)
return;
- Base::defineGetter(exec, propertyName, getterFunction, attributes);
+ Base::defineGetter(object, exec, propertyName, getterFunction, attributes);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (98888 => 98889)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-31 22:24:20 UTC (rev 98889)
@@ -842,7 +842,7 @@
}
# Custom defineGetter function
- push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"};
+ push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"};
# Custom defineSetter function
push(@headerContent, " virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"};
@@ -1060,7 +1060,7 @@
}
# Custom defineGetter function
- push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"};
+ push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"};
push(@headerContent, "\nprivate:\n");
push(@headerContent, " ${className}Prototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { }\n");
Modified: trunk/Source/WebKit/qt/Api/qwebframe.cpp (98888 => 98889)
--- trunk/Source/WebKit/qt/Api/qwebframe.cpp 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebKit/qt/Api/qwebframe.cpp 2011-10-31 22:24:20 UTC (rev 98889)
@@ -513,7 +513,7 @@
JSObjectRef function = JSObjectMakeFunctionWithCallback(context, propertyName.get(), qtSenderCallback);
// JSC public API doesn't support setting a Getter for a property of a given object, https://bugs.webkit.org/show_bug.cgi?id=61374.
- window->defineGetter(exec, propertyName.get()->identifier(&exec->globalData()), ::toJS(function),
+ window->methodTable()->defineGetter(window, exec, propertyName.get()->identifier(&exec->globalData()), ::toJS(function),
JSC::ReadOnly | JSC::DontEnum | JSC::DontDelete);
}
#endif
Modified: trunk/Source/WebKit/qt/ChangeLog (98888 => 98889)
--- trunk/Source/WebKit/qt/ChangeLog 2011-10-31 22:22:50 UTC (rev 98888)
+++ trunk/Source/WebKit/qt/ChangeLog 2011-10-31 22:24:20 UTC (rev 98889)
@@ -1,3 +1,16 @@
+2011-10-31 Mark Hahnenberg <mhahnenb...@apple.com>
+
+ De-virtualize JSObject::defineGetter
+ https://bugs.webkit.org/show_bug.cgi?id=71134
+
+ Reviewed by Darin Adler.
+
+ 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):
+
2011-10-28 Jochen Eisinger <joc...@chromium.org>
Rename a number of methods mentioning _javascript_ to just Script instead