Title: [99256] trunk/Source
Revision
99256
Author
[email protected]
Date
2011-11-03 18:32:18 -0700 (Thu, 03 Nov 2011)

Log Message

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

Reviewed by Darin Adler.

Source/_javascript_Core: 

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

* API/JSObjectRef.cpp:
(JSObjectCopyPropertyNames):
* _javascript_Core.exp:
* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::getOwnPropertyNames):
* runtime/ClassInfo.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getPropertyNames):
* runtime/JSCell.h:
* runtime/JSObject.cpp:
(JSC::JSObject::getPropertyNames):
(JSC::JSObject::getOwnPropertyNames):
* runtime/JSObject.h:
* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::create):
* runtime/ScopeChain.cpp:
(JSC::ScopeChainNode::print):
* runtime/Structure.cpp:
(JSC::Structure::getPropertyNamesFromStructure):
* runtime/Structure.h:

Source/_javascript_Glue: 

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

* JSUtils.cpp:
(KJSValueToCFTypeInternal):
* JSValueWrapper.cpp:
(JSValueWrapper::JSObjectCopyPropertyNames):

Source/WebCore: 

No new tests.

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

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getPropertyNames):
* bindings/js/JSDOMWindowShell.cpp:
(WebCore::JSDOMWindowShell::getPropertyNames):
* bindings/js/JSDOMWindowShell.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
* bridge/NP_jsobject.cpp:
(_NPN_Enumerate):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::convertValueToQVariantMap):

Source/WebKit/mac: 

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

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::enumerate):

Source/WebKit2: 

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

* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::enumerate):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSObjectRef.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -506,7 +506,7 @@
 
     JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalData);
     PropertyNameArray array(globalData);
-    jsObject->getPropertyNames(exec, array);
+    jsObject->methodTable()->getPropertyNames(jsObject, exec, array, ExcludeDontEnumProperties);
 
     size_t size = array.size();
     propertyNames->array.reserveInitialCapacity(size);

Modified: trunk/Source/_javascript_Core/ChangeLog (99255 => 99256)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1,3 +1,36 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::getPropertyNames
+        https://bugs.webkit.org/show_bug.cgi?id=71306
+
+        Reviewed by Darin Adler.
+
+        Added getPropertyNames to the MethodTable, changed all the virtual 
+        implementations of getPropertyNames to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * API/JSObjectRef.cpp:
+        (JSObjectCopyPropertyNames):
+        * _javascript_Core.exp:
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+        * debugger/DebuggerActivation.cpp:
+        (JSC::DebuggerActivation::getOwnPropertyNames):
+        * runtime/ClassInfo.h:
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::getPropertyNames):
+        * runtime/JSCell.h:
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::getPropertyNames):
+        (JSC::JSObject::getOwnPropertyNames):
+        * runtime/JSObject.h:
+        * runtime/JSPropertyNameIterator.cpp:
+        (JSC::JSPropertyNameIterator::create):
+        * runtime/ScopeChain.cpp:
+        (JSC::ScopeChainNode::print):
+        * runtime/Structure.cpp:
+        (JSC::Structure::getPropertyNamesFromStructure):
+        * runtime/Structure.h:
+
 2011-11-03  Darin Adler  <[email protected]>
 
         Change remaining callers of releaseRef to call leakRef

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (99255 => 99256)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -312,7 +312,7 @@
 __ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE
 __ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
 __ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC8JSObject16getPropertyNamesEPS0_PNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
 __ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
 __ZN3JSC8JSObject17preventExtensionsERNS_12JSGlobalDataE
 __ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (99255 => 99256)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-04 01:32:18 UTC (rev 99256)
@@ -203,7 +203,7 @@
     ?getOwnPropertySlotByIndex@JSByteArray@JSC@@SA_NPAVJSCell@2@PAVExecState@2@IAAVPropertySlot@2@@Z
     ?getOwnPropertySlotByIndex@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@IAAVPropertySlot@2@@Z
     ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
-    ?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
+    ?getPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
     ?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
     ?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
     ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -87,7 +87,7 @@
 void DebuggerActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
     DebuggerActivation* thisObject = static_cast<DebuggerActivation*>(object);
-    thisObject->m_activation->getPropertyNames(exec, propertyNames, mode);
+    thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode);
 }
 
 bool DebuggerActivation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)

Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-11-04 01:32:18 UTC (rev 99256)
@@ -75,6 +75,9 @@
         typedef void (*GetOwnPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
         GetOwnPropertyNamesFunctionPtr getOwnPropertyNames;
 
+        typedef void (*GetPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+        GetPropertyNamesFunctionPtr getPropertyNames;
+
         typedef UString (*ClassNameFunctionPtr)(const JSObject*);
         ClassNameFunctionPtr className;
 
@@ -116,6 +119,7 @@
         &ClassName::defineSetter, \
         &ClassName::defaultValue, \
         &ClassName::getOwnPropertyNames, \
+        &ClassName::getPropertyNames, \
         &ClassName::className, \
         &ClassName::hasInstance, \
     }, \

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -191,4 +191,9 @@
     return false;
 }
 
+void JSCell::getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode)
+{
+    ASSERT_NOT_REACHED();
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2011-11-04 01:32:18 UTC (rev 99256)
@@ -144,6 +144,7 @@
         static NO_RETURN_DUE_TO_ASSERT void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
         static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
         static NO_RETURN_DUE_TO_ASSERT void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+        static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
         static UString className(const JSObject*);
         static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue prototypeProperty);
 

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -495,17 +495,17 @@
     return false;
 }
 
-void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+void JSObject::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
-    methodTable()->getOwnPropertyNames(this, exec, propertyNames, mode);
+    object->methodTable()->getOwnPropertyNames(object, exec, propertyNames, mode);
 
-    if (prototype().isNull())
+    if (object->prototype().isNull())
         return;
 
-    JSObject* prototype = asObject(this->prototype());
+    JSObject* prototype = asObject(object->prototype());
     while(1) {
         if (prototype->structure()->typeInfo().overridesGetPropertyNames()) {
-            prototype->getPropertyNames(exec, propertyNames, mode);
+            prototype->methodTable()->getPropertyNames(prototype, exec, propertyNames, mode);
             break;
         }
         prototype->methodTable()->getOwnPropertyNames(prototype, exec, propertyNames, mode);
@@ -518,7 +518,7 @@
 
 void JSObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
-    object->structure()->getPropertyNames(exec->globalData(), propertyNames, mode);
+    object->structure()->getPropertyNamesFromStructure(exec->globalData(), propertyNames, mode);
     if (!object->staticFunctionsReified())
         getClassPropertyNames(exec, object->classInfo(), propertyNames, mode);
 }

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2011-11-04 01:32:18 UTC (rev 99256)
@@ -126,8 +126,8 @@
 
         static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue prototypeProperty);
 
-        virtual void getPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
         static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+        static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
 
         JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
         bool toBoolean(ExecState*) const;

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -52,7 +52,7 @@
             o->structure()->enumerationCache()->cachedPrototypeChain() != o->structure()->prototypeChain(exec));
 
     PropertyNameArray propertyNames(exec);
-    o->getPropertyNames(exec, propertyNames);
+    o->methodTable()->getPropertyNames(o, exec, propertyNames, ExcludeDontEnumProperties);
     size_t numCacheableSlots = 0;
     if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasGetterSetterProperties()
         && !o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames())

Modified: trunk/Source/_javascript_Core/runtime/ScopeChain.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/ScopeChain.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/ScopeChain.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -41,7 +41,7 @@
     for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
         JSObject* o = scopeIter->get();
         PropertyNameArray propertyNames(globalObject->globalExec());
-        o->getPropertyNames(globalObject->globalExec(), propertyNames);
+        o->methodTable()->getPropertyNames(o, globalObject->globalExec(), propertyNames, ExcludeDontEnumProperties);
         PropertyNameArray::const_iterator propEnd = propertyNames.end();
 
         fprintf(stderr, "----- [scope %p] -----\n", o);

Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/Structure.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -720,7 +720,7 @@
     checkConsistency();
 }
 
-void Structure::getPropertyNames(JSGlobalData& globalData, PropertyNameArray& propertyNames, EnumerationMode mode)
+void Structure::getPropertyNamesFromStructure(JSGlobalData& globalData, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
     materializePropertyMapIfNecessary(globalData);
     if (!m_propertyTable)

Modified: trunk/Source/_javascript_Core/runtime/Structure.h (99255 => 99256)


--- trunk/Source/_javascript_Core/runtime/Structure.h	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Core/runtime/Structure.h	2011-11-04 01:32:18 UTC (rev 99256)
@@ -156,7 +156,7 @@
 
         void setEnumerationCache(JSGlobalData&, JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
         JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h.
-        void getPropertyNames(JSGlobalData&, PropertyNameArray&, EnumerationMode mode);
+        void getPropertyNamesFromStructure(JSGlobalData&, PropertyNameArray&, EnumerationMode);
 
         bool staticFunctionsReified()
         {

Modified: trunk/Source/_javascript_Glue/ChangeLog (99255 => 99256)


--- trunk/Source/_javascript_Glue/ChangeLog	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Glue/ChangeLog	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1,5 +1,21 @@
 2011-11-03  Mark Hahnenberg  <[email protected]>
 
+        De-virtualize JSObject::getPropertyNames
+        https://bugs.webkit.org/show_bug.cgi?id=71306
+
+        Reviewed by Darin Adler.
+
+        Added getPropertyNames to the MethodTable, changed all the virtual 
+        implementations of getPropertyNames to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * JSUtils.cpp:
+        (KJSValueToCFTypeInternal):
+        * JSValueWrapper.cpp:
+        (JSValueWrapper::JSObjectCopyPropertyNames):
+
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
         De-virtualize JSObject::className
         https://bugs.webkit.org/show_bug.cgi?id=71428
 

Modified: trunk/Source/_javascript_Glue/JSUtils.cpp (99255 => 99256)


--- trunk/Source/_javascript_Glue/JSUtils.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Glue/JSUtils.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -277,7 +277,7 @@
                         JSGlueGlobalObject* globalObject = static_cast<JSGlueGlobalObject*>(exec->dynamicGlobalObject());
                         if (globalObject && (globalObject->Flags() & kJSFlagConvertAssociativeArray)) {
                             PropertyNameArray propNames(exec);
-                            object->getPropertyNames(exec, propNames);
+                            object->methodTable()->getPropertyNames(object, exec, propNames, ExcludeDontEnumProperties);
                             PropertyNameArray::const_iterator iter = propNames.begin();
                             PropertyNameArray::const_iterator end = propNames.end();
                             while(iter != end && isArray)
@@ -316,7 +316,7 @@
                     {
                         // Not an array, just treat it like a dictionary which contains (property name, property value) pairs
                         PropertyNameArray propNames(exec);
-                        object->getPropertyNames(exec, propNames);
+                        object->methodTable()->getPropertyNames(object, exec, propNames, ExcludeDontEnumProperties);
                         {
                             result = CFDictionaryCreateMutable(0,
                                                                0,

Modified: trunk/Source/_javascript_Glue/JSValueWrapper.cpp (99255 => 99256)


--- trunk/Source/_javascript_Glue/JSValueWrapper.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/_javascript_Glue/JSValueWrapper.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -77,7 +77,7 @@
         ExecState* exec = getThreadGlobalExecState();
         JSObject* object = ptr->GetValue().toObject(exec);
         PropertyNameArray propNames(exec);
-        object->getPropertyNames(exec, propNames);
+        object->methodTable()->getPropertyNames(object, exec, propNames, ExcludeDontEnumProperties);
         PropertyNameArray::const_iterator iterator = propNames.begin();
 
         while (iterator != propNames.end()) {

Modified: trunk/Source/WebCore/ChangeLog (99255 => 99256)


--- trunk/Source/WebCore/ChangeLog	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/ChangeLog	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1,3 +1,28 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::getPropertyNames
+        https://bugs.webkit.org/show_bug.cgi?id=71306
+
+        Reviewed by Darin Adler.
+
+        No new tests.
+
+        Added getPropertyNames to the MethodTable, changed all the virtual 
+        implementations of getPropertyNames to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::getPropertyNames):
+        * bindings/js/JSDOMWindowShell.cpp:
+        (WebCore::JSDOMWindowShell::getPropertyNames):
+        * bindings/js/JSDOMWindowShell.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        * bridge/NP_jsobject.cpp:
+        (_NPN_Enumerate):
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::convertValueToQVariantMap):
+
 2011-11-02  Xiaomei Ji  <[email protected]>
 
         Enable ctrl-arrow move cursor by word in visual order in cr-win by command line flag.

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (99255 => 99256)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -368,12 +368,13 @@
     return Base::deleteProperty(thisObject, exec, propertyName);
 }
 
-void JSDOMWindow::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+void JSDOMWindow::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
+    JSDOMWindow* thisObject = static_cast<JSDOMWindow*>(object);
     // Only allow the window to enumerated by frames in the same origin.
-    if (!allowsAccessFrom(exec))
+    if (!thisObject->allowsAccessFrom(exec))
         return;
-    Base::getPropertyNames(exec, propertyNames, mode);
+    Base::getPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
 void JSDOMWindow::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp (99255 => 99256)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -123,9 +123,10 @@
     return thisObject->window()->methodTable()->deleteProperty(thisObject->window(), exec, propertyName);
 }
 
-void JSDOMWindowShell::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+void JSDOMWindowShell::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
-    window()->getPropertyNames(exec, propertyNames, mode);
+    JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(object);
+    thisObject->window()->methodTable()->getPropertyNames(thisObject->window(), exec, propertyNames, mode);
 }
 
 void JSDOMWindowShell::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (99255 => 99256)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h	2011-11-04 01:32:18 UTC (rev 99256)
@@ -84,8 +84,8 @@
         static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
         virtual void putWithAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, unsigned attributes);
         static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName);
-        virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);
         static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode);
+        static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode);
         static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);
         static void defineSetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);
         virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (99255 => 99256)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-11-04 01:32:18 UTC (rev 99256)
@@ -828,7 +828,7 @@
 
     # Custom getPropertyNames function exists on DOMWindow
     if ($interfaceName eq "DOMWindow") {
-        push(@headerContent, "    virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n");
+        push(@headerContent, "    static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n");
         $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
     }
 

Modified: trunk/Source/WebCore/bridge/NP_jsobject.cpp (99255 => 99256)


--- trunk/Source/WebCore/bridge/NP_jsobject.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bridge/NP_jsobject.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -460,7 +460,7 @@
         JSLock lock(SilenceAssertionsOnly);
         PropertyNameArray propertyNames(exec);
 
-        obj->imp->getPropertyNames(exec, propertyNames);
+        obj->imp->methodTable()->getPropertyNames(obj->imp, exec, propertyNames, ExcludeDontEnumProperties);
         unsigned size = static_cast<unsigned>(propertyNames.size());
         // FIXME: This should really call NPN_MemAlloc but that's in WebKit
         NPIdentifier* identifiers = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier) * size));

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (99255 => 99256)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -189,7 +189,7 @@
     Q_ASSERT(!exec->hadException());
 
     PropertyNameArray properties(exec);
-    object->getPropertyNames(exec, properties);
+    object->methodTable()->getPropertyNames(object, exec, properties, ExcludeDontEnumProperties);
     PropertyNameArray::const_iterator it = properties.begin();
     QVariantMap result;
     int objdist = 0;

Modified: trunk/Source/WebKit/mac/ChangeLog (99255 => 99256)


--- trunk/Source/WebKit/mac/ChangeLog	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1,3 +1,17 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::getPropertyNames
+        https://bugs.webkit.org/show_bug.cgi?id=71306
+
+        Reviewed by Darin Adler.
+
+        Added getPropertyNames to the MethodTable, changed all the virtual 
+        implementations of getPropertyNames to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::enumerate):
+
 2011-11-02  Darin Adler  <[email protected]>
 
         Change remaining callers of releaseRef to call leakRef

Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (99255 => 99256)


--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1230,7 +1230,7 @@
     JSLock lock(SilenceAssertionsOnly);
  
     PropertyNameArray propertyNames(exec);
-    object->getPropertyNames(exec, propertyNames);
+    object->methodTable()->getPropertyNames(object, exec, propertyNames, ExcludeDontEnumProperties);
 
     RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
     for (unsigned i = 0; i < propertyNames.size(); i++) {

Modified: trunk/Source/WebKit2/ChangeLog (99255 => 99256)


--- trunk/Source/WebKit2/ChangeLog	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-04 01:32:18 UTC (rev 99256)
@@ -1,3 +1,17 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::getPropertyNames
+        https://bugs.webkit.org/show_bug.cgi?id=71306
+
+        Reviewed by Darin Adler.
+
+        Added getPropertyNames to the MethodTable, changed all the virtual 
+        implementations of getPropertyNames to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * WebProcess/Plugins/Netscape/NPJSObject.cpp:
+        (WebKit::NPJSObject::enumerate):
+
 2011-11-03  Anders Carlsson  <[email protected]>
 
         Get rid of NetscapePlugin::m_clipRectInWindowCoordinates

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp (99255 => 99256)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp	2011-11-04 01:18:16 UTC (rev 99255)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp	2011-11-04 01:32:18 UTC (rev 99256)
@@ -236,7 +236,7 @@
     JSLock lock(SilenceAssertionsOnly);
 
     PropertyNameArray propertyNames(exec);
-    m_jsObject->getPropertyNames(exec, propertyNames);
+    m_jsObject->methodTable()->getPropertyNames(m_jsObject.get(), exec, propertyNames, ExcludeDontEnumProperties);
 
     NPIdentifier* nameIdentifiers = npnMemNewArray<NPIdentifier>(propertyNames.size());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to