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

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

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:
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@98593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp
index 494a11d..11aec34 100644
--- a/Source/JavaScriptCore/runtime/JSCell.cpp
+++ b/Source/JavaScriptCore/runtime/JSCell.cpp
@@ -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