Title: [98593] trunk/Source
Revision
98593
Author
mhahnenb...@apple.com
Date
2011-10-27 10:01:38 -0700 (Thu, 27 Oct 2011)

Log Message

De-virtualize JSCell::toThisObject
https://bugs.webkit.org/show_bug.cgi?id=70958

Reviewed by Geoffrey Garen.

Source/_javascript_Core:

Converted all instances of toThisObject to static functions,
added toThisObject to the MethodTable, and replaced all call sites
with a corresponding lookup in the MethodTable.

* API/JSContextRef.cpp:
* _javascript_Core.exp:
* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
* runtime/ClassInfo.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::toThisObject):
* runtime/JSActivation.h:
* runtime/JSCell.cpp:
(JSC::JSCell::toThisObject):
* runtime/JSCell.h:
* runtime/JSObject.cpp:
(JSC::JSObject::put):
(JSC::JSObject::toThisObject):
* runtime/JSObject.h:
(JSC::JSValue::toThisObject):
* runtime/JSStaticScopeObject.cpp:
(JSC::JSStaticScopeObject::toThisObject):
* runtime/JSStaticScopeObject.h:
* runtime/JSString.cpp:
(JSC::JSString::toThisObject):
* runtime/JSString.h:
* runtime/StrictEvalActivation.cpp:
(JSC::StrictEvalActivation::toThisObject):
* runtime/StrictEvalActivation.h:

Source/WebCore:

No new tests.

Converted all instances of toThisObject to static functions,
added toThisObject to the MethodTable, and replaced all call sites
with a corresponding lookup in the MethodTable.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::toThisObject):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bridge/NP_jsobject.cpp:
(_NPN_Invoke):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeConnectionMethod::call):

Source/WebKit/mac:

Converted all instances of toThisObject to static functions,
added toThisObject to the MethodTable, and replaced all call sites
with a corresponding lookup in the MethodTable.

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::invoke):
(WebKit::NetscapePluginInstanceProxy::invokeDefault):

Source/WebKit2:

Converted all instances of toThisObject to static functions,
added toThisObject to the MethodTable, and replaced all call sites
with a corresponding lookup in the MethodTable.

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSContextRef.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/API/JSContextRef.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/API/JSContextRef.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -163,7 +163,7 @@
     APIEntryShim entryShim(exec);
 
     // It is necessary to call toThisObject to get the wrapper object when used with WebCore.
-    return toRef(exec->lexicalGlobalObject()->toThisObject(exec));
+    return toRef(exec->lexicalGlobalObject()->methodTable()->toThisObject(exec->lexicalGlobalObject(), exec));
 }
 
 JSContextGroupRef JSContextGetGroup(JSContextRef ctx)

Modified: trunk/Source/_javascript_Core/ChangeLog (98592 => 98593)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-27 17:01:38 UTC (rev 98593)
@@ -1,3 +1,39 @@
+2011-10-27  Mark Hahnenberg  <mhahnenb...@apple.com>
+
+        De-virtualize JSCell::toThisObject
+        https://bugs.webkit.org/show_bug.cgi?id=70958
+
+        Reviewed by Geoffrey Garen.
+
+        Converted all instances of toThisObject to static functions, 
+        added toThisObject to the MethodTable, and replaced all call sites
+        with a corresponding lookup in the MethodTable.
+
+        * API/JSContextRef.cpp:
+        * _javascript_Core.exp:
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+        * runtime/ClassInfo.h:
+        * runtime/JSActivation.cpp:
+        (JSC::JSActivation::toThisObject):
+        * runtime/JSActivation.h:
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::toThisObject):
+        * runtime/JSCell.h:
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::put):
+        (JSC::JSObject::toThisObject):
+        * runtime/JSObject.h:
+        (JSC::JSValue::toThisObject):
+        * runtime/JSStaticScopeObject.cpp:
+        (JSC::JSStaticScopeObject::toThisObject):
+        * runtime/JSStaticScopeObject.h:
+        * runtime/JSString.cpp:
+        (JSC::JSString::toThisObject):
+        * runtime/JSString.h:
+        * runtime/StrictEvalActivation.cpp:
+        (JSC::StrictEvalActivation::toThisObject):
+        * runtime/StrictEvalActivation.h:
+
 2011-10-27  Yuqiang Xian  <yuqiang.x...@intel.com>
 
         Fix a small bug in callOperation after r98431

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (98592 => 98593)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -305,6 +305,7 @@
 __ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
 __ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE
 __ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE
 __ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3JSC8JSObject15unwrappedObjectEv
@@ -550,7 +551,6 @@
 __ZNK3JSC18PropertyDescriptor8writableEv
 __ZNK3JSC19SourceProviderCache8byteSizeEv
 __ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
 __ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE
 __ZNK3JSC6JSCell8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE
 __ZNK3JSC6JSCell8toStringEPNS_9ExecStateE
@@ -569,7 +569,6 @@
 __ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
 __ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
 __ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE
 __ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE
 __ZNK3JSC8JSObject8toStringEPNS_9ExecStateE
 __ZNK3JSC8JSObject9classNameEv

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (98592 => 98593)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-10-27 17:01:38 UTC (rev 98593)
@@ -342,9 +342,6 @@
     ?toString@JSObject@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
     ?toStringDecimal@DecimalNumber@WTF@@QBEIPA_WI@Z
     ?toStringExponential@DecimalNumber@WTF@@QBEIPA_WI@Z
-    ?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
-    ?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
-    ?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
     ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
     ?toUInt32@Identifier@JSC@@SAIABVUString@2@AA_N@Z
     ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z

Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -58,6 +58,9 @@
 
         typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSCell*, ExecState*, unsigned, PropertySlot&);
         GetOwnPropertySlotByIndexFunctionPtr getOwnPropertySlotByIndex;
+
+        typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*);
+        ToThisObjectFunctionPtr toThisObject;
     };
 
 #define CREATE_METHOD_TABLE(ClassName) { \
@@ -70,6 +73,7 @@
         &ClassName::deletePropertyByIndex, \
         &ClassName::getOwnPropertySlot, \
         &ClassName::getOwnPropertySlotByIndex, \
+        &ClassName::toThisObject, \
     }, \
     sizeof(ClassName)
 

Modified: trunk/Source/_javascript_Core/runtime/JSActivation.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSActivation.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -203,7 +203,7 @@
     return Base::deleteProperty(cell, exec, propertyName);
 }
 
-JSObject* JSActivation::toThisObject(ExecState* exec) const
+JSObject* JSActivation::toThisObject(JSCell*, ExecState* exec)
 {
     return exec->globalThisValue();
 }

Modified: trunk/Source/_javascript_Core/runtime/JSActivation.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSActivation.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -69,7 +69,7 @@
         virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
         static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
 
-        virtual JSObject* toThisObject(ExecState*) const;
+        static JSObject* toThisObject(JSCell*, ExecState*);
 
         void copyRegisters(JSGlobalData&);
         

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -112,9 +112,9 @@
     return thisObject->methodTable()->deletePropertyByIndex(thisObject, exec, identifier);
 }
 
-JSObject* JSCell::toThisObject(ExecState* exec) const
+JSObject* JSCell::toThisObject(JSCell* cell, ExecState* exec)
 {
-    return toObject(exec, exec->lexicalGlobalObject());
+    return cell->toObject(exec, exec->lexicalGlobalObject());
 }
 
 JSValue JSCell::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -96,7 +96,7 @@
         static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
         static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
 
-        virtual JSObject* toThisObject(ExecState*) const;
+        static JSObject* toThisObject(JSCell*, ExecState*);
 
         void* vptr() const { ASSERT(!isZapped()); return *reinterpret_cast<void* const*>(this); }
         void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; ASSERT(!isZapped()); }
@@ -295,11 +295,6 @@
         return isCell() ? asCell()->toObject(exec, globalObject) : toObjectSlowCase(exec, globalObject);
     }
 
-    inline JSObject* JSValue::toThisObject(ExecState* exec) const
-    {
-        return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec);
-    }
-
     template <typename T> void* allocateCell(Heap& heap)
     {
 #if ENABLE(GC_VALIDATION)

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -173,7 +173,7 @@
                 args.append(value);
 
                 // If this is WebCore's global object then we need to substitute the shell.
-                call(exec, setterFunc, callType, callData, thisObject->toThisObject(exec), args);
+                call(exec, setterFunc, callType, callData, thisObject->methodTable()->toThisObject(thisObject, exec), args);
                 return;
             }
 
@@ -557,9 +557,9 @@
     return primitive.toString(exec);
 }
 
-JSObject* JSObject::toThisObject(ExecState*) const
+JSObject* JSObject::toThisObject(JSCell* cell, ExecState*)
 {
-    return const_cast<JSObject*>(this);
+    return static_cast<JSObject*>(cell);
 }
 
 JSObject* JSObject::unwrappedObject()

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -135,7 +135,7 @@
         double toNumber(ExecState*) const;
         UString toString(ExecState*) const;
 
-        virtual JSObject* toThisObject(ExecState*) const;
+        static JSObject* toThisObject(JSCell*, ExecState*);
         virtual JSObject* unwrappedObject();
 
         bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const;
@@ -499,6 +499,11 @@
     return isCell() && asCell()->inherits(classInfo);
 }
 
+inline JSObject* JSValue::toThisObject(ExecState* exec) const
+{
+    return isCell() ? asCell()->methodTable()->toThisObject(asCell(), exec) : toThisObjectSlowCase(exec);
+}
+
 ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
     if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) {

Modified: trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -44,7 +44,7 @@
     visitor.append(&thisObject->m_registerStore);
 }
 
-JSObject* JSStaticScopeObject::toThisObject(ExecState* exec) const
+JSObject* JSStaticScopeObject::toThisObject(JSCell*, ExecState* exec)
 {
     return exec->globalThisValue();
 }

Modified: trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -43,7 +43,7 @@
 
         static void visitChildren(JSCell*, SlotVisitor&);
         bool isDynamicScope(bool& requiresDynamicChecks) const;
-        virtual JSObject* toThisObject(ExecState*) const;
+        static JSObject* toThisObject(JSCell*, ExecState*);
         static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
         static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&);
 

Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSString.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -196,9 +196,9 @@
     return StringObject::create(exec, globalObject, const_cast<JSString*>(this));
 }
 
-JSObject* JSString::toThisObject(ExecState* exec) const
+JSObject* JSString::toThisObject(JSCell* cell, ExecState* exec)
 {
-    return StringObject::create(exec, exec->lexicalGlobalObject(), const_cast<JSString*>(this));
+    return StringObject::create(exec, exec->lexicalGlobalObject(), static_cast<JSString*>(cell));
 }
 
 bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -247,7 +247,7 @@
         void resolveRopeSlowCase(ExecState*, UChar*) const;
         void outOfMemory(ExecState*) const;
 
-        virtual JSObject* toThisObject(ExecState*) const;
+        static JSObject* toThisObject(JSCell*, ExecState*);
 
         // Actually getPropertySlot, not getOwnPropertySlot (see JSCell).
         static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);

Modified: trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -40,7 +40,7 @@
     return false;
 }
 
-JSObject* StrictEvalActivation::toThisObject(ExecState* exec) const
+JSObject* StrictEvalActivation::toThisObject(JSCell*, ExecState* exec)
 {
     return exec->globalThisValue();
 }

Modified: trunk/Source/_javascript_Core/runtime/StrictEvalActivation.h (98592 => 98593)


--- trunk/Source/_javascript_Core/runtime/StrictEvalActivation.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/_javascript_Core/runtime/StrictEvalActivation.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -42,7 +42,7 @@
     }
 
     static bool deleteProperty(JSCell*, ExecState*, const Identifier&);
-    virtual JSObject* toThisObject(ExecState*) const;
+    static JSObject* toThisObject(JSCell*, ExecState*);
 
     static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
     {

Modified: trunk/Source/WebCore/ChangeLog (98592 => 98593)


--- trunk/Source/WebCore/ChangeLog	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/ChangeLog	2011-10-27 17:01:38 UTC (rev 98593)
@@ -1,3 +1,26 @@
+2011-10-27  Mark Hahnenberg  <mhahnenb...@apple.com>
+
+        De-virtualize JSCell::toThisObject
+        https://bugs.webkit.org/show_bug.cgi?id=70958
+
+        Reviewed by Geoffrey Garen.
+
+        No new tests.
+
+        Converted all instances of toThisObject to static functions, 
+        added toThisObject to the MethodTable, and replaced all call sites
+        with a corresponding lookup in the MethodTable.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::toThisObject):
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/JSErrorHandler.cpp:
+        (WebCore::JSErrorHandler::handleEvent):
+        * bridge/NP_jsobject.cpp:
+        (_NPN_Invoke):
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtRuntimeConnectionMethod::call):
+
 2011-10-27  Adam Roben  <aro...@apple.com>
 
         Windows build fix after r98512

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (98592 => 98593)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -145,9 +145,9 @@
     setCurrentEvent(0);
 }
 
-JSObject* JSDOMWindowBase::toThisObject(ExecState*) const
+JSObject* JSDOMWindowBase::toThisObject(JSCell* cell, ExecState*)
 {
-    return shell();
+    return static_cast<JSDOMWindowBase*>(cell)->shell();
 }
 
 JSDOMWindowShell* JSDOMWindowBase::shell() const

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (98592 => 98593)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2011-10-27 17:01:38 UTC (rev 98593)
@@ -68,7 +68,7 @@
         // Don't call this version of allowsAccessFrom -- it's a slightly incorrect implementation used only by WebScriptObject
         virtual bool allowsAccessFrom(const JSC::JSGlobalObject*) const;
         
-        virtual JSC::JSObject* toThisObject(JSC::ExecState*) const;
+        static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*);
         JSDOMWindowShell* shell() const;
 
         static JSC::JSGlobalData* commonJSGlobalData();

Modified: trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp (98592 => 98593)


--- trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -91,7 +91,7 @@
         JSGlobalData& globalData = globalObject->globalData();
         DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
 
-        JSValue thisValue = globalObject->toThisObject(exec);
+        JSValue thisValue = globalObject->methodTable()->toThisObject(globalObject, exec);
 
         globalData.timeoutChecker.start();
         JSValue returnValue = JSC::call(exec, jsFunction, callType, callData, thisValue, args);

Modified: trunk/Source/WebCore/bridge/NP_jsobject.cpp (98592 => 98593)


--- trunk/Source/WebCore/bridge/NP_jsobject.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/bridge/NP_jsobject.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -241,7 +241,7 @@
         getListFromVariantArgs(exec, args, argCount, rootObject, argList);
         RefPtr<JSGlobalData> globalData(&exec->globalData());
         globalData->timeoutChecker.start();
-        JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp->toThisObject(exec), argList);
+        JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp->methodTable()->toThisObject(obj->imp, exec), argList);
         globalData->timeoutChecker.stop();
 
         // Convert and return the result of the function call.

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (98592 => 98593)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -1605,7 +1605,7 @@
 
     if (sender) {
 
-        JSObject* thisObject = exec->lexicalGlobalObject()->toThisObject(exec);
+        JSObject* thisObject = exec->lexicalGlobalObject()->methodTable()->toThisObject(exec->lexicalGlobalObject(), exec);
         JSObject* funcObject = 0;
 
         // QtScript checks signalness first, arguments second

Modified: trunk/Source/WebKit/mac/ChangeLog (98592 => 98593)


--- trunk/Source/WebKit/mac/ChangeLog	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-10-27 17:01:38 UTC (rev 98593)
@@ -1,3 +1,18 @@
+2011-10-27  Mark Hahnenberg  <mhahnenb...@apple.com>
+
+        De-virtualize JSCell::toThisObject
+        https://bugs.webkit.org/show_bug.cgi?id=70958
+
+        Reviewed by Geoffrey Garen.
+
+        Converted all instances of toThisObject to static functions, 
+        added toThisObject to the MethodTable, and replaced all call sites
+        with a corresponding lookup in the MethodTable.
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::invoke):
+        (WebKit::NetscapePluginInstanceProxy::invokeDefault):
+
 2011-10-25  Mark Hahnenberg  <mhahnenb...@apple.com>
 
         Remove deletePropertyVirtual

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


--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm	2011-10-27 17:01:38 UTC (rev 98593)
@@ -916,7 +916,7 @@
 
     RefPtr<JSGlobalData> globalData = pluginWorld()->globalData();
     globalData->timeoutChecker.start();
-    JSValue value = call(exec, function, callType, callData, object->toThisObject(exec), argList);
+    JSValue value = call(exec, function, callType, callData, object->methodTable()->toThisObject(object, exec), argList);
     globalData->timeoutChecker.stop();
         
     marshalValue(exec, value, resultData, resultLength);
@@ -951,7 +951,7 @@
 
     RefPtr<JSGlobalData> globalData = pluginWorld()->globalData();
     globalData->timeoutChecker.start();
-    JSValue value = call(exec, object, callType, callData, object->toThisObject(exec), argList);
+    JSValue value = call(exec, object, callType, callData, object->methodTable()->toThisObject(object, exec), argList);
     globalData->timeoutChecker.stop();
     
     marshalValue(exec, value, resultData, resultLength);

Modified: trunk/Source/WebKit2/ChangeLog (98592 => 98593)


--- trunk/Source/WebKit2/ChangeLog	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-27 17:01:38 UTC (rev 98593)
@@ -1,3 +1,17 @@
+2011-10-27  Mark Hahnenberg  <mhahnenb...@apple.com>
+
+        De-virtualize JSCell::toThisObject
+        https://bugs.webkit.org/show_bug.cgi?id=70958
+
+        Reviewed by Geoffrey Garen.
+
+        Converted all instances of toThisObject to static functions, 
+        added toThisObject to the MethodTable, and replaced all call sites
+        with a corresponding lookup in the MethodTable.
+
+        * WebProcess/Plugins/Netscape/NPJSObject.cpp:
+        (WebKit::NPJSObject::invoke):
+
 2011-10-27  Adam Roben  <aro...@apple.com>
 
         Add WKBundlePageGetBackingScaleFactor

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


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp	2011-10-27 16:41:50 UTC (rev 98592)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp	2011-10-27 17:01:38 UTC (rev 98593)
@@ -291,7 +291,7 @@
         argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, globalObject, arguments[i]));
 
     exec->globalData().timeoutChecker.start();
-    JSValue value = JSC::call(exec, function, callType, callData, m_jsObject->toThisObject(exec), argumentList);
+    JSValue value = JSC::call(exec, function, callType, callData, m_jsObject->methodTable()->toThisObject(m_jsObject.get(), exec), argumentList);
     exec->globalData().timeoutChecker.stop();
 
     // Convert and return the result of the function call.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to