Changeset 96143 in webkit
- Timestamp:
- Sep 27, 2011 12:53:49 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r96131 r96143 1 2011-09-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::getPrimitiveNumber 4 https://bugs.webkit.org/show_bug.cgi?id=68851 5 6 Reviewed by Darin Adler. 7 8 * JavaScriptCore.exp: 9 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 10 11 Changed JSCell::getPrimitiveNumber to manually handle the dispatch for 12 JSCells (JSObject and JSString in this case). 13 * runtime/JSCell.cpp: 14 (JSC::JSCell::getPrimitiveNumber): 15 * runtime/JSCell.h: 16 17 Removed JSNotAnObject::getPrimitiveNumber since its return value doesn't 18 matter and it already implements defaultValue, so JSObject::getPrimitiveNumber 19 can cover the case for JSNotAnObject. 20 * runtime/JSNotAnObject.cpp: 21 * runtime/JSNotAnObject.h: 22 23 De-virtualized JSObject::getPrimitiveNumber and JSString::getPrimitiveNumber 24 and changed them to be const. Also made JSString::getPrimitiveNumber public 25 because it needs to be called from JSCell::getPrimitiveNumber and also since it's 26 no longer virtual, we want people who have a more specific pointer (JSString* 27 instead of JSCell*) to not have to pay the cost of a virtual method call. 28 * runtime/JSObject.cpp: 29 (JSC::JSObject::getPrimitiveNumber): 30 * runtime/JSObject.h: 31 * runtime/JSString.cpp: 32 (JSC::JSString::getPrimitiveNumber): 33 * runtime/JSString.h: 34 1 35 2011-09-27 Juan Carlos Montemayor Elosua <j.mont@me.com> 2 36 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r96131 r96143 260 260 __ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE 261 261 __ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE 262 __ZN3JSC6JSCell18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE263 262 __ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE 264 263 __ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_7JSValueE … … 323 322 __ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj 324 323 __ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE 325 __ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE326 324 __ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE 327 325 __ZN3JSC8JSObject20visitChildrenVirtualERNS_11SlotVisitorE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r96131 r96143 206 206 ?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z 207 207 ?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z 208 ?getPrimitiveNumber@JSCell@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z209 ?getPrimitiveNumber@JSObject@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z210 ?getPrimitiveNumber@JSString@JSC@@EAE_NPAVExecState@2@AANAAVJSValue@2@@Z211 208 ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z 212 209 ?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r96045 r96143 128 128 } 129 129 130 bool JSCell::getPrimitiveNumber(ExecState* , double&, JSValue&)130 bool JSCell::getPrimitiveNumber(ExecState* exec, double& number, JSValue& value) const 131 131 { 132 ASSERT_NOT_REACHED(); 133 return false; 132 if (isString()) 133 return static_cast<const JSString*>(this)->getPrimitiveNumber(exec, number, value); 134 return static_cast<const JSObject*>(this)->getPrimitiveNumber(exec, number, value); 134 135 } 135 136 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r96045 r96143 79 79 // Basic conversions. 80 80 JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 81 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);81 bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const; 82 82 bool toBoolean(ExecState*) const; 83 83 virtual double toNumber(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
r96045 r96143 42 42 ASSERT_UNUSED(exec, exec->hadException()); 43 43 return jsNumber(0); 44 }45 46 bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue&)47 {48 ASSERT_UNUSED(exec, exec->hadException());49 return false;50 44 } 51 45 -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r96045 r96143 65 65 // JSValue methods 66 66 virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; 67 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);68 67 virtual double toNumber(ExecState*) const; 69 68 virtual UString toString(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r95936 r96143 289 289 } 290 290 291 bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) 291 bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const 292 292 { 293 293 result = defaultValue(exec, PreferNumber); -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r96045 r96143 134 134 135 135 JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; 136 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);137 136 bool toBoolean(ExecState*) const; 137 bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const; 138 138 virtual double toNumber(ExecState*) const; 139 139 virtual UString toString(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r95936 r96143 275 275 } 276 276 277 bool JSString::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) 277 bool JSString::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const 278 278 { 279 279 result = this; -
trunk/Source/JavaScriptCore/runtime/JSString.h
r96045 r96143 429 429 JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 430 430 bool toBoolean(ExecState*) const; 431 bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const; 431 432 432 433 bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); … … 496 497 } 497 498 498 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);499 499 virtual double toNumber(ExecState*) const; 500 500 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
Note: See TracChangeset
for help on using the changeset viewer.