Title: [99223] trunk/Source
Revision
99223
Author
[email protected]
Date
2011-11-03 11:20:08 -0700 (Thu, 03 Nov 2011)

Log Message

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

Reviewed by Sam Weinig.

Source/_javascript_Core:

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

* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::className):
* _javascript_Core.exp:
* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::className):
* debugger/DebuggerActivation.h:
* jsc.cpp:
(GlobalObject::createStructure):
* profiler/Profiler.cpp:
(JSC::Profiler::createCallIdentifier):
* runtime/ClassInfo.h:
* runtime/JSCell.cpp:
(JSC::JSCell::className):
* runtime/JSCell.h:
* runtime/JSObject.cpp:
(JSC::JSObject::className):
* runtime/JSObject.h:
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncToString):
* testRegExp.cpp:
(GlobalObject::createStructure):

Source/_javascript_Glue:

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

* JSUtils.cpp:
(KJSValueToCFTypeInternal):

Source/WebCore:

No new tests.

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

* bindings/js/JSDOMWindowShell.cpp:
(WebCore::JSDOMWindowShell::className):
* bindings/js/JSDOMWindowShell.h:
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::internalConstructorName):
* bridge/testqtbindings.cpp:
(Global::className):

Source/WebKit/efl:

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

* ewk/ewk_js.cpp:
(ewk_js_npobject_to_object):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSCallbackObject.h (99222 => 99223)


--- trunk/Source/_javascript_Core/API/JSCallbackObject.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -175,7 +175,7 @@
     static const unsigned StructureFlags = ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | Parent::StructureFlags;
 
 private:
-    virtual UString className() const;
+    static UString className(const JSObject*);
 
     static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
     virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);

Modified: trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h (99222 => 99223)


--- trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -114,13 +114,14 @@
 }
 
 template <class Parent>
-UString JSCallbackObject<Parent>::className() const
+UString JSCallbackObject<Parent>::className(const JSObject* object)
 {
-    UString thisClassName = classRef()->className();
+    const JSCallbackObject* thisObject = static_cast<const JSCallbackObject*>(object);
+    UString thisClassName = thisObject->classRef()->className();
     if (!thisClassName.isEmpty())
         return thisClassName;
     
-    return Parent::className();
+    return Parent::className(object);
 }
 
 template <class Parent>

Modified: trunk/Source/_javascript_Core/ChangeLog (99222 => 99223)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-03 18:20:08 UTC (rev 99223)
@@ -1,3 +1,38 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::className
+        https://bugs.webkit.org/show_bug.cgi?id=71428
+
+        Reviewed by Sam Weinig.
+
+        Added className to the MethodTable, changed all the virtual 
+        implementations of className to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * API/JSCallbackObject.h:
+        * API/JSCallbackObjectFunctions.h:
+        (JSC::::className):
+        * _javascript_Core.exp:
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+        * debugger/DebuggerActivation.cpp:
+        (JSC::DebuggerActivation::className):
+        * debugger/DebuggerActivation.h:
+        * jsc.cpp:
+        (GlobalObject::createStructure):
+        * profiler/Profiler.cpp:
+        (JSC::Profiler::createCallIdentifier):
+        * runtime/ClassInfo.h:
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::className):
+        * runtime/JSCell.h:
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::className):
+        * runtime/JSObject.h:
+        * runtime/ObjectPrototype.cpp:
+        (JSC::objectProtoFuncToString):
+        * testRegExp.cpp:
+        (GlobalObject::createStructure):
+
 2011-11-02  Jer Noble  <[email protected]>
 
         Add Clock class and platform-specific implementations.

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (99222 => 99223)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -330,6 +330,7 @@
 __ZN3JSC8JSObject25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE
 __ZN3JSC8JSObject3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
 __ZN3JSC8JSObject6s_infoE
+__ZN3JSC8JSObject9classNameEPKS0_
 __ZN3JSC8JSString6s_infoE
 __ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
 __ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
@@ -571,7 +572,6 @@
 __ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
 __ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE
 __ZNK3JSC8JSObject8toStringEPNS_9ExecStateE
-__ZNK3JSC8JSObject9classNameEv
 __ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
 __ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
 __ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (99222 => 99223)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-03 18:20:08 UTC (rev 99223)
@@ -86,7 +86,7 @@
     ?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVJSGlobalData@2@@Z
     ?checkSyntax@JSC@@YA_NPAVExecState@1@ABVSourceCode@1@PAVJSValue@1@@Z
     ?checksum@MD5@WTF@@QAEXAAV?$Vector@E$0BA@@2@@Z
-    ?className@JSObject@JSC@@UBE?AVUString@2@XZ
+    ?className@JSObject@JSC@@SA?AVUString@2@PBV12@@Z
     ?clear@SourceProviderCache@JSC@@QAEXXZ
     ?clearBuiltinStructures@JSGlobalData@JSC@@QAEXXZ
     ?clearRareData@JSGlobalObject@JSC@@CAXPAVJSCell@2@@Z

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -55,9 +55,10 @@
         visitor.append(&thisObject->m_activation);
 }
 
-UString DebuggerActivation::className() const
+UString DebuggerActivation::className(const JSObject* object)
 {
-    return m_activation->className();
+    const DebuggerActivation* thisObject = static_cast<const DebuggerActivation*>(object);
+    return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get());
 }
 
 bool DebuggerActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.h (99222 => 99223)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -42,7 +42,7 @@
         }
 
         static void visitChildren(JSCell*, SlotVisitor&);
-        virtual UString className() const;
+        static UString className(const JSObject*);
         static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
         static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
         virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);

Modified: trunk/Source/_javascript_Core/jsc.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/jsc.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/jsc.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -155,8 +155,14 @@
         object->finishCreation(globalData, arguments);
         return object;
     }
-    virtual UString className() const { return "global"; }
 
+    static const ClassInfo s_info;
+
+    static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+    {
+        return Structure::create(globalData, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
+    }
+
 protected:
     void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
     {
@@ -195,6 +201,8 @@
 COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
 ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
 
+const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(GlobalObject) };
+
 GlobalObject::GlobalObject(JSGlobalData& globalData, Structure* structure)
     : JSGlobalObject(globalData, structure)
 {

Modified: trunk/Source/_javascript_Core/profiler/Profiler.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/profiler/Profiler.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/profiler/Profiler.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -172,7 +172,7 @@
         return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
     if (asObject(functionValue)->inherits(&InternalFunction::s_info))
         return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
-    return CallIdentifier(makeUString("(", asObject(functionValue)->className(), " object)"), defaultSourceURL, defaultLineNumber);
+    return CallIdentifier(makeUString("(", asObject(functionValue)->methodTable()->className(asObject(functionValue)), " object)"), defaultSourceURL, defaultLineNumber);
 }
 
 CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSFunction* function)

Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -74,6 +74,9 @@
 
         typedef void (*GetOwnPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
         GetOwnPropertyNamesFunctionPtr getOwnPropertyNames;
+
+        typedef UString (*ClassNameFunctionPtr)(const JSObject*);
+        ClassNameFunctionPtr className;
     };
 
 #define CREATE_MEMBER_CHECKER(member) \
@@ -110,6 +113,7 @@
         &ClassName::defineSetter, \
         &ClassName::defaultValue, \
         &ClassName::getOwnPropertyNames, \
+        &ClassName::className, \
     }, \
     sizeof(ClassName)
 

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -179,4 +179,10 @@
     ASSERT_NOT_REACHED();
 }
 
+UString JSCell::className(const JSObject*)
+{
+    ASSERT_NOT_REACHED();
+    return UString();
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -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 UString className(const JSObject*);
 
     private:
         WriteBarrier<Structure> m_structure;

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -98,9 +98,9 @@
 #endif
 }
 
-UString JSObject::className() const
+UString JSObject::className(const JSObject* object)
 {
-    const ClassInfo* info = classInfo();
+    const ClassInfo* info = object->classInfo();
     ASSERT(info);
     return info->className;
 }

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -82,7 +82,7 @@
 
         static void visitChildren(JSCell*, SlotVisitor&);
 
-        virtual UString className() const;
+        static UString className(const JSObject*);
 
         static void finalize(JSCell*);
 

Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -214,7 +214,8 @@
     JSValue thisValue = exec->hostThisValue();
     if (thisValue.isUndefinedOrNull())
         return JSValue::encode(jsNontrivialString(exec, thisValue.isUndefined() ? "[object Undefined]" : "[object Null]"));
-    return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisValue.toObject(exec)->className(), "]"));
+    JSObject* thisObject = thisValue.toObject(exec);
+    return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable()->className(thisObject), "]"));
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/testRegExp.cpp (99222 => 99223)


--- trunk/Source/_javascript_Core/testRegExp.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Core/testRegExp.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -119,8 +119,14 @@
     {
         return new (allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure, arguments);
     }
-    virtual UString className() const { return "global"; }
 
+    static const ClassInfo s_info;
+
+    static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+    {
+        return Structure::create(globalData, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
+    }
+
 protected:
     void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
     {
@@ -132,6 +138,8 @@
 COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
 ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
 
+const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(GlobalObject) };
+
 GlobalObject::GlobalObject(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments)
     : JSGlobalObject(globalData, structure)
 {

Modified: trunk/Source/_javascript_Glue/ChangeLog (99222 => 99223)


--- trunk/Source/_javascript_Glue/ChangeLog	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Glue/ChangeLog	2011-11-03 18:20:08 UTC (rev 99223)
@@ -1,3 +1,17 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::className
+        https://bugs.webkit.org/show_bug.cgi?id=71428
+
+        Reviewed by Sam Weinig.
+
+        Added className to the MethodTable, changed all the virtual 
+        implementations of className to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * JSUtils.cpp:
+        (KJSValueToCFTypeInternal):
+
 2011-11-02  Mark Hahnenberg  <[email protected]>
 
         De-virtualize JSObject::getOwnPropertyNames

Modified: trunk/Source/_javascript_Glue/JSUtils.cpp (99222 => 99223)


--- trunk/Source/_javascript_Glue/JSUtils.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/_javascript_Glue/JSUtils.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -270,7 +270,7 @@
 #if 0
                     if (object->inherits(&ArrayInstanceImp::s_info))
 #else
-                    if (object->className() == "Array")
+                    if (object->methodTable()->className(object) == "Array")
 #endif
                     {
                         isArray = true;

Modified: trunk/Source/WebCore/ChangeLog (99222 => 99223)


--- trunk/Source/WebCore/ChangeLog	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebCore/ChangeLog	2011-11-03 18:20:08 UTC (rev 99223)
@@ -1,3 +1,24 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::className
+        https://bugs.webkit.org/show_bug.cgi?id=71428
+
+        Reviewed by Sam Weinig.
+
+        No new tests.
+
+        Added className to the MethodTable, changed all the virtual 
+        implementations of className to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * bindings/js/JSDOMWindowShell.cpp:
+        (WebCore::JSDOMWindowShell::className):
+        * bindings/js/JSDOMWindowShell.h:
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        (WebCore::JSInjectedScriptHost::internalConstructorName):
+        * bridge/testqtbindings.cpp:
+        (Global::className):
+
 2011-11-02  Jer Noble  <[email protected]>
 
         Add Clock class and platform-specific implementations.

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp (99222 => 99223)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -84,9 +84,10 @@
 // JSObject methods
 // ----
 
-UString JSDOMWindowShell::className() const
+UString JSDOMWindowShell::className(const JSObject* object)
 {
-    return window()->className();
+    const JSDOMWindowShell* thisObject = static_cast<const JSDOMWindowShell*>(object);
+    return thisObject->window()->methodTable()->className(thisObject->window());
 }
 
 bool JSDOMWindowShell::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (99222 => 99223)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h	2011-11-03 18:20:08 UTC (rev 99223)
@@ -78,7 +78,7 @@
         void* operator new(size_t);
         static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
 
-        virtual JSC::UString className() const;
+        static JSC::UString className(const JSC::JSObject*);
         static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
         virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
         static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);

Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp (99222 => 99223)


--- trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -115,7 +115,8 @@
     if (exec->argumentCount() < 1)
         return jsUndefined();
 
-    UString result = exec->argument(0).toThisObject(exec)->className();
+    JSObject* thisObject = exec->argument(0).toThisObject(exec);
+    UString result = thisObject->methodTable()->className(thisObject);
     return jsString(exec, result);
 }
 

Modified: trunk/Source/WebCore/bridge/testqtbindings.cpp (99222 => 99223)


--- trunk/Source/WebCore/bridge/testqtbindings.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebCore/bridge/testqtbindings.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -78,7 +78,7 @@
 public:
     typedef JSNonFinalObject Base;
 
-    virtual UString className() const { return "global"; }
+    static UString className(const JSObject*) { return "global"; }
 };
 
 static char code[] =

Modified: trunk/Source/WebKit/efl/ChangeLog (99222 => 99223)


--- trunk/Source/WebKit/efl/ChangeLog	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-11-03 18:20:08 UTC (rev 99223)
@@ -1,3 +1,17 @@
+2011-11-03  Mark Hahnenberg  <[email protected]>
+
+        De-virtualize JSObject::className
+        https://bugs.webkit.org/show_bug.cgi?id=71428
+
+        Reviewed by Sam Weinig.
+
+        Added className to the MethodTable, changed all the virtual 
+        implementations of className to static ones, and replaced 
+        all call sites with corresponding lookups in the MethodTable.
+
+        * ewk/ewk_js.cpp:
+        (ewk_js_npobject_to_object):
+
 2011-11-03  Fady Samuel  <[email protected]>
 
         Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport

Modified: trunk/Source/WebKit/efl/ewk/ewk_js.cpp (99222 => 99223)


--- trunk/Source/WebKit/efl/ewk/ewk_js.cpp	2011-11-03 18:05:15 UTC (rev 99222)
+++ trunk/Source/WebKit/efl/ewk/ewk_js.cpp	2011-11-03 18:20:08 UTC (rev 99223)
@@ -449,9 +449,9 @@
     object->view = 0;
 
     jso = reinterpret_cast<_javascript_Object*>(npObject);
-    if (!strcmp("Array", jso->imp->className().ascii().data()))
+    if (!strcmp("Array", jso->imp->methodTable()->className(jso->imp).ascii().data()))
         object->type = EWK_JS_OBJECT_ARRAY;
-    else if (!strcmp("Function", jso->imp->className().ascii().data()))
+    else if (!strcmp("Function", jso->imp->methodTable()->className(jso->imp).ascii().data()))
         object->type = EWK_JS_OBJECT_FUNCTION;
     else
         object->type = EWK_JS_OBJECT_OBJECT;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to