Changeset 96381 in webkit
- Timestamp:
- Sep 29, 2011 7:09:16 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r96379 r96381 1 2011-09-29 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::toObject 4 https://bugs.webkit.org/show_bug.cgi?id=68937 5 6 Reviewed by Darin Adler. 7 8 * JavaScriptCore.exp: 9 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 10 11 De-virtualized JSCell::toObject and changed its implementation to manually check the 12 cases for JSString and JSObject rather than leaving it up to the virtual method call. 13 * runtime/JSCell.cpp: 14 (JSC::JSCell::toObject): 15 * runtime/JSCell.h: 16 17 Removed JSNotAnObject::toObject because the case for JSObject works for it. 18 Also removed JSObject::toObject because it was essentially the identity function, 19 which is not necessary since toObject is no longer virtual. 20 * runtime/JSNotAnObject.cpp: 21 * runtime/JSNotAnObject.h: 22 * runtime/JSObject.cpp: 23 * runtime/JSObject.h: 24 25 De-virtualized JSObject::toObject and JSString::toObject. 26 * runtime/JSString.h: 27 1 28 2011-09-29 Gavin Barraclough <barraclough@apple.com> 2 29 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r96346 r96381 574 574 __ZNK3JSC8JSObject18toStrictThisObjectEPNS_9ExecStateE 575 575 __ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE 576 __ZNK3JSC8JSObject8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE577 576 __ZNK3JSC8JSObject8toStringEPNS_9ExecStateE 578 577 __ZNK3JSC8JSObject9classNameEv -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r96346 r96381 345 345 ?toNumber@JSString@JSC@@EBENPAVExecState@2@@Z 346 346 ?toNumberSlowCase@JSValue@JSC@@ABENPAVExecState@2@@Z 347 ?toObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z 348 ?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@PAVJSGlobalObject@2@@Z 347 ?toObject@JSCell@JSC@@QBEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z 349 348 ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z 350 349 ?toStrictThisObject@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@@Z -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r96164 r96381 152 152 } 153 153 154 JSObject* JSCell::toObject(ExecState* , JSGlobalObject*) const154 JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const 155 155 { 156 ASSERT_NOT_REACHED(); 157 return 0; 156 if (isString()) 157 return static_cast<const JSString*>(this)->toObject(exec, globalObject); 158 ASSERT(isObject()); 159 return static_cast<JSObject*>(const_cast<JSCell*>(this)); 158 160 } 159 161 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r96346 r96381 84 84 virtual double toNumber(ExecState*) const; 85 85 virtual UString toString(ExecState*) const; 86 virtualJSObject* toObject(ExecState*, JSGlobalObject*) const;86 JSObject* toObject(ExecState*, JSGlobalObject*) const; 87 87 88 88 static void visitChildren(JSCell*, SlotVisitor&); -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
r96143 r96381 56 56 } 57 57 58 JSObject* JSNotAnObject::toObject(ExecState* exec, JSGlobalObject*) const59 {60 ASSERT_UNUSED(exec, exec->hadException());61 return const_cast<JSNotAnObject*>(this);62 }63 64 58 // JSObject methods 65 59 bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&) -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r96143 r96381 67 67 virtual double toNumber(ExecState*) const; 68 68 virtual UString toString(ExecState*) const; 69 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;70 69 71 70 // JSObject methods -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r96346 r96381 511 511 return ""; 512 512 return primitive.toString(exec); 513 }514 515 JSObject* JSObject::toObject(ExecState*, JSGlobalObject*) const516 {517 return const_cast<JSObject*>(this);518 513 } 519 514 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r96346 r96381 137 137 virtual double toNumber(ExecState*) const; 138 138 virtual UString toString(ExecState*) const; 139 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;140 139 141 140 virtual JSObject* toThisObject(ExecState*) const; … … 272 271 using JSCell::isAPIValueWrapper; 273 272 using JSCell::isGetterSetter; 274 using JSCell::toObject;275 273 void getObject(); 276 274 void getString(ExecState* exec); -
trunk/Source/JavaScriptCore/runtime/JSString.h
r96143 r96381 430 430 bool toBoolean(ExecState*) const; 431 431 bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const; 432 JSObject* toObject(ExecState*, JSGlobalObject*) const; 432 433 433 434 bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); … … 498 499 499 500 virtual double toNumber(ExecState*) const; 500 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;501 501 virtual UString toString(ExecState*) const; 502 502
Note: See TracChangeset
for help on using the changeset viewer.