Changeset 95516 in webkit
- Timestamp:
- Sep 19, 2011 9:33:10 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95512 r95516 1 2011-09-19 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Remove toPrimitive from JSCell 4 https://bugs.webkit.org/show_bug.cgi?id=67875 5 6 Reviewed by Darin Adler. 7 8 Part of the refactoring process to un-virtualize JSCell. We move 9 all of the implicit functionality provided by the virtual toPrimitive method 10 in JSCell to be explicit in JSValue::toPrimitive and JSCell:toPrimitive while 11 also de-virtualizing JSCell::toPrimitive. 12 13 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 14 * runtime/JSCell.cpp: 15 (JSC::JSCell::toPrimitive): 16 * runtime/JSCell.h: 17 18 We replace JSNotAnObject::toPrimitive with defaultValue, which it overrides from 19 JSObject. This pushes the virtual method further down, enabling us to get rid 20 of the virtual call in JSCell. Eventually we'll probably have to deal with this 21 again, but we'll cross that bridge when we come to it. 22 * runtime/JSNotAnObject.cpp: 23 (JSC::JSNotAnObject::defaultValue): 24 * runtime/JSNotAnObject.h: 25 * runtime/JSObject.h: 26 * runtime/JSString.h: 27 1 28 2011-09-19 Geoffrey Garen <ggaren@apple.com> 2 29 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r95507 r95516 357 357 ?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@PAVJSGlobalObject@2@@Z 358 358 ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z 359 ?toPrimitive@JSCell@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z360 ?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z361 359 ?toStrictThisObject@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@@Z 362 360 ?toString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r95475 r95516 118 118 } 119 119 120 JSValue JSCell::toPrimitive(ExecState* , PreferredPrimitiveType) const120 JSValue JSCell::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const 121 121 { 122 ASSERT_NOT_REACHED(); 123 return JSValue(); 122 if (isString()) 123 return static_cast<const JSString*>(this)->toPrimitive(exec, preferredType); 124 return static_cast<const JSObject*>(this)->toPrimitive(exec, preferredType); 124 125 } 125 126 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r95503 r95516 78 78 79 79 // Basic conversions. 80 virtualJSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;80 JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 81 81 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&); 82 82 virtual bool toBoolean(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
r95475 r95516 38 38 39 39 // JSValue methods 40 JSValue JSNotAnObject:: toPrimitive(ExecState* exec, PreferredPrimitiveType) const40 JSValue JSNotAnObject::defaultValue(ExecState* exec, PreferredPrimitiveType) const 41 41 { 42 42 ASSERT_UNUSED(exec, exec->hadException()); -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r95475 r95516 64 64 65 65 // JSValue methods 66 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;66 virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; 67 67 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&); 68 68 virtual bool toBoolean(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r95503 r95516 132 132 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); 133 133 134 virtualJSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;134 JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; 135 135 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 136 136 virtual bool toBoolean(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSString.h
r95475 r95516 427 427 unsigned length() { return m_length; } 428 428 429 JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 429 430 bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); 430 431 bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); … … 493 494 } 494 495 495 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;496 496 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 497 497 virtual bool toBoolean(ExecState*) const;
Note: See TracChangeset
for help on using the changeset viewer.