Changeset 98593 in webkit
- Timestamp:
- Oct 27, 2011, 10:01:38 AM (14 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r95510 r98593 164 164 165 165 // It is necessary to call toThisObject to get the wrapper object when used with WebCore. 166 return toRef(exec->lexicalGlobalObject()-> toThisObject(exec));166 return toRef(exec->lexicalGlobalObject()->methodTable()->toThisObject(exec->lexicalGlobalObject(), exec)); 167 167 } 168 168 -
trunk/Source/JavaScriptCore/ChangeLog
r98574 r98593 1 2011-10-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::toThisObject 4 https://bugs.webkit.org/show_bug.cgi?id=70958 5 6 Reviewed by Geoffrey Garen. 7 8 Converted all instances of toThisObject to static functions, 9 added toThisObject to the MethodTable, and replaced all call sites 10 with a corresponding lookup in the MethodTable. 11 12 * API/JSContextRef.cpp: 13 * JavaScriptCore.exp: 14 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 15 * runtime/ClassInfo.h: 16 * runtime/JSActivation.cpp: 17 (JSC::JSActivation::toThisObject): 18 * runtime/JSActivation.h: 19 * runtime/JSCell.cpp: 20 (JSC::JSCell::toThisObject): 21 * runtime/JSCell.h: 22 * runtime/JSObject.cpp: 23 (JSC::JSObject::put): 24 (JSC::JSObject::toThisObject): 25 * runtime/JSObject.h: 26 (JSC::JSValue::toThisObject): 27 * runtime/JSStaticScopeObject.cpp: 28 (JSC::JSStaticScopeObject::toThisObject): 29 * runtime/JSStaticScopeObject.h: 30 * runtime/JSString.cpp: 31 (JSC::JSString::toThisObject): 32 * runtime/JSString.h: 33 * runtime/StrictEvalActivation.cpp: 34 (JSC::StrictEvalActivation::toThisObject): 35 * runtime/StrictEvalActivation.h: 36 1 37 2011-10-27 Yuqiang Xian <yuqiang.xian@intel.com> 2 38 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r98501 r98593 306 306 __ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE 307 307 __ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE 308 __ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE 308 309 __ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE 309 310 __ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE … … 551 552 __ZNK3JSC19SourceProviderCache8byteSizeEv 552 553 __ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE 553 __ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE554 554 __ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE 555 555 __ZNK3JSC6JSCell8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE … … 570 570 __ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj 571 571 __ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE 572 __ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE573 572 __ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE 574 573 __ZNK3JSC8JSObject8toStringEPNS_9ExecStateE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r98501 r98593 343 343 ?toStringDecimal@DecimalNumber@WTF@@QBEIPA_WI@Z 344 344 ?toStringExponential@DecimalNumber@WTF@@QBEIPA_WI@Z 345 ?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z346 ?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z347 ?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z348 345 ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z 349 346 ?toUInt32@Identifier@JSC@@SAIABVUString@2@AA_N@Z -
trunk/Source/JavaScriptCore/runtime/ClassInfo.h
r98367 r98593 59 59 typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSCell*, ExecState*, unsigned, PropertySlot&); 60 60 GetOwnPropertySlotByIndexFunctionPtr getOwnPropertySlotByIndex; 61 62 typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*); 63 ToThisObjectFunctionPtr toThisObject; 61 64 }; 62 65 … … 71 74 &ClassName::getOwnPropertySlot, \ 72 75 &ClassName::getOwnPropertySlotByIndex, \ 76 &ClassName::toThisObject, \ 73 77 }, \ 74 78 sizeof(ClassName) -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r98501 r98593 204 204 } 205 205 206 JSObject* JSActivation::toThisObject( ExecState* exec) const206 JSObject* JSActivation::toThisObject(JSCell*, ExecState* exec) 207 207 { 208 208 return exec->globalThisValue(); -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r98501 r98593 70 70 static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); 71 71 72 virtual JSObject* toThisObject(ExecState*) const;72 static JSObject* toThisObject(JSCell*, ExecState*); 73 73 74 74 void copyRegisters(JSGlobalData&); -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r98501 r98593 113 113 } 114 114 115 JSObject* JSCell::toThisObject( ExecState* exec) const115 JSObject* JSCell::toThisObject(JSCell* cell, ExecState* exec) 116 116 { 117 return toObject(exec, exec->lexicalGlobalObject());117 return cell->toObject(exec, exec->lexicalGlobalObject()); 118 118 } 119 119 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r98525 r98593 97 97 static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); 98 98 99 virtual JSObject* toThisObject(ExecState*) const;99 static JSObject* toThisObject(JSCell*, ExecState*); 100 100 101 101 void* vptr() const { ASSERT(!isZapped()); return *reinterpret_cast<void* const*>(this); } … … 296 296 } 297 297 298 inline JSObject* JSValue::toThisObject(ExecState* exec) const299 {300 return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec);301 }302 303 298 template <typename T> void* allocateCell(Heap& heap) 304 299 { -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r98501 r98593 174 174 175 175 // If this is WebCore's global object then we need to substitute the shell. 176 call(exec, setterFunc, callType, callData, thisObject-> toThisObject(exec), args);176 call(exec, setterFunc, callType, callData, thisObject->methodTable()->toThisObject(thisObject, exec), args); 177 177 return; 178 178 } … … 558 558 } 559 559 560 JSObject* JSObject::toThisObject( ExecState*) const561 { 562 return const_cast<JSObject*>(this);560 JSObject* JSObject::toThisObject(JSCell* cell, ExecState*) 561 { 562 return static_cast<JSObject*>(cell); 563 563 } 564 564 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r98501 r98593 136 136 UString toString(ExecState*) const; 137 137 138 virtual JSObject* toThisObject(ExecState*) const;138 static JSObject* toThisObject(JSCell*, ExecState*); 139 139 virtual JSObject* unwrappedObject(); 140 140 … … 498 498 { 499 499 return isCell() && asCell()->inherits(classInfo); 500 } 501 502 inline JSObject* JSValue::toThisObject(ExecState* exec) const 503 { 504 return isCell() ? asCell()->methodTable()->toThisObject(asCell(), exec) : toThisObjectSlowCase(exec); 500 505 } 501 506 -
trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
r98501 r98593 45 45 } 46 46 47 JSObject* JSStaticScopeObject::toThisObject( ExecState* exec) const47 JSObject* JSStaticScopeObject::toThisObject(JSCell*, ExecState* exec) 48 48 { 49 49 return exec->globalThisValue(); -
trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
r98501 r98593 44 44 static void visitChildren(JSCell*, SlotVisitor&); 45 45 bool isDynamicScope(bool& requiresDynamicChecks) const; 46 virtual JSObject* toThisObject(ExecState*) const;46 static JSObject* toThisObject(JSCell*, ExecState*); 47 47 static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); 48 48 static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r98501 r98593 197 197 } 198 198 199 JSObject* JSString::toThisObject( ExecState* exec) const200 { 201 return StringObject::create(exec, exec->lexicalGlobalObject(), const_cast<JSString*>(this));199 JSObject* JSString::toThisObject(JSCell* cell, ExecState* exec) 200 { 201 return StringObject::create(exec, exec->lexicalGlobalObject(), static_cast<JSString*>(cell)); 202 202 } 203 203 -
trunk/Source/JavaScriptCore/runtime/JSString.h
r98501 r98593 248 248 void outOfMemory(ExecState*) const; 249 249 250 virtual JSObject* toThisObject(ExecState*) const;250 static JSObject* toThisObject(JSCell*, ExecState*); 251 251 252 252 // Actually getPropertySlot, not getOwnPropertySlot (see JSCell). -
trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp
r98422 r98593 41 41 } 42 42 43 JSObject* StrictEvalActivation::toThisObject( ExecState* exec) const43 JSObject* StrictEvalActivation::toThisObject(JSCell*, ExecState* exec) 44 44 { 45 45 return exec->globalThisValue(); -
trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.h
r98422 r98593 43 43 44 44 static bool deleteProperty(JSCell*, ExecState*, const Identifier&); 45 virtual JSObject* toThisObject(ExecState*) const;45 static JSObject* toThisObject(JSCell*, ExecState*); 46 46 47 47 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) -
trunk/Source/WebCore/ChangeLog
r98592 r98593 1 2011-10-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::toThisObject 4 https://bugs.webkit.org/show_bug.cgi?id=70958 5 6 Reviewed by Geoffrey Garen. 7 8 No new tests. 9 10 Converted all instances of toThisObject to static functions, 11 added toThisObject to the MethodTable, and replaced all call sites 12 with a corresponding lookup in the MethodTable. 13 14 * bindings/js/JSDOMWindowBase.cpp: 15 (WebCore::JSDOMWindowBase::toThisObject): 16 * bindings/js/JSDOMWindowBase.h: 17 * bindings/js/JSErrorHandler.cpp: 18 (WebCore::JSErrorHandler::handleEvent): 19 * bridge/NP_jsobject.cpp: 20 (_NPN_Invoke): 21 * bridge/qt/qt_runtime.cpp: 22 (JSC::Bindings::QtRuntimeConnectionMethod::call): 23 1 24 2011-10-27 Adam Roben <aroben@apple.com> 2 25 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r96547 r98593 146 146 } 147 147 148 JSObject* JSDOMWindowBase::toThisObject( ExecState*) const149 { 150 return s hell();148 JSObject* JSDOMWindowBase::toThisObject(JSCell* cell, ExecState*) 149 { 150 return static_cast<JSDOMWindowBase*>(cell)->shell(); 151 151 } 152 152 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h
r96446 r98593 69 69 virtual bool allowsAccessFrom(const JSC::JSGlobalObject*) const; 70 70 71 virtual JSC::JSObject* toThisObject(JSC::ExecState*) const;71 static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*); 72 72 JSDOMWindowShell* shell() const; 73 73 -
trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp
r98164 r98593 92 92 DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject); 93 93 94 JSValue thisValue = globalObject-> toThisObject(exec);94 JSValue thisValue = globalObject->methodTable()->toThisObject(globalObject, exec); 95 95 96 96 globalData.timeoutChecker.start(); -
trunk/Source/WebCore/bridge/NP_jsobject.cpp
r98422 r98593 242 242 RefPtr<JSGlobalData> globalData(&exec->globalData()); 243 243 globalData->timeoutChecker.start(); 244 JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp-> toThisObject(exec), argList);244 JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp->methodTable()->toThisObject(obj->imp, exec), argList); 245 245 globalData->timeoutChecker.stop(); 246 246 -
trunk/Source/WebCore/bridge/qt/qt_runtime.cpp
r98501 r98593 1606 1606 if (sender) { 1607 1607 1608 JSObject* thisObject = exec->lexicalGlobalObject()-> toThisObject(exec);1608 JSObject* thisObject = exec->lexicalGlobalObject()->methodTable()->toThisObject(exec->lexicalGlobalObject(), exec); 1609 1609 JSObject* funcObject = 0; 1610 1610 -
trunk/Source/WebKit/mac/ChangeLog
r98422 r98593 1 2011-10-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::toThisObject 4 https://bugs.webkit.org/show_bug.cgi?id=70958 5 6 Reviewed by Geoffrey Garen. 7 8 Converted all instances of toThisObject to static functions, 9 added toThisObject to the MethodTable, and replaced all call sites 10 with a corresponding lookup in the MethodTable. 11 12 * Plugins/Hosted/NetscapePluginInstanceProxy.mm: 13 (WebKit::NetscapePluginInstanceProxy::invoke): 14 (WebKit::NetscapePluginInstanceProxy::invokeDefault): 15 1 16 2011-10-25 Mark Hahnenberg <mhahnenberg@apple.com> 2 17 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
r98422 r98593 917 917 RefPtr<JSGlobalData> globalData = pluginWorld()->globalData(); 918 918 globalData->timeoutChecker.start(); 919 JSValue value = call(exec, function, callType, callData, object-> toThisObject(exec), argList);919 JSValue value = call(exec, function, callType, callData, object->methodTable()->toThisObject(object, exec), argList); 920 920 globalData->timeoutChecker.stop(); 921 921 … … 952 952 RefPtr<JSGlobalData> globalData = pluginWorld()->globalData(); 953 953 globalData->timeoutChecker.start(); 954 JSValue value = call(exec, object, callType, callData, object-> toThisObject(exec), argList);954 JSValue value = call(exec, object, callType, callData, object->methodTable()->toThisObject(object, exec), argList); 955 955 globalData->timeoutChecker.stop(); 956 956 -
trunk/Source/WebKit2/ChangeLog
r98588 r98593 1 2011-10-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::toThisObject 4 https://bugs.webkit.org/show_bug.cgi?id=70958 5 6 Reviewed by Geoffrey Garen. 7 8 Converted all instances of toThisObject to static functions, 9 added toThisObject to the MethodTable, and replaced all call sites 10 with a corresponding lookup in the MethodTable. 11 12 * WebProcess/Plugins/Netscape/NPJSObject.cpp: 13 (WebKit::NPJSObject::invoke): 14 1 15 2011-10-27 Adam Roben <aroben@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
r98422 r98593 292 292 293 293 exec->globalData().timeoutChecker.start(); 294 JSValue value = JSC::call(exec, function, callType, callData, m_jsObject-> toThisObject(exec), argumentList);294 JSValue value = JSC::call(exec, function, callType, callData, m_jsObject->methodTable()->toThisObject(m_jsObject.get(), exec), argumentList); 295 295 exec->globalData().timeoutChecker.stop(); 296 296
Note:
See TracChangeset
for help on using the changeset viewer.