Changeset 95893 in webkit
- Timestamp:
- Sep 23, 2011 6:19:56 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95887 r95893 1 2011-09-23 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSCell::getJSNumber 4 https://bugs.webkit.org/show_bug.cgi?id=68651 5 6 Reviewed by Oliver Hunt. 7 8 Added a new JSType to check whether or not something is a 9 NumberObject (which includes NumberPrototype) in TypeInfo::isNumberObject because there's not 10 currently a better way to determine whether something is indeed a NumberObject. 11 Also de-virtualized JSCell::getJSNumber, having it check the TypeInfo 12 for whether the object is a NumberObject or not. This patch is part of 13 the larger process of de-virtualizing JSCell. 14 15 * JavaScriptCore.exp: 16 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 17 * runtime/JSCell.cpp: 18 (JSC::JSCell::getJSNumber): 19 * runtime/JSCell.h: 20 (JSC::JSValue::getJSNumber): 21 * runtime/JSType.h: 22 * runtime/JSTypeInfo.h: 23 (JSC::TypeInfo::isNumberObject): 24 * runtime/JSValue.h: 25 * runtime/NumberObject.cpp: 26 (JSC::NumberObject::getJSNumber): 27 * runtime/NumberObject.h: 28 (JSC::NumberObject::createStructure): 29 * runtime/NumberPrototype.h: 30 (JSC::NumberPrototype::createStructure): 31 1 32 2011-09-23 Filip Pizlo <fpizlo@apple.com> 2 33 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r95865 r95893 254 254 __ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE 255 255 __ZN3JSC6JSCell11getCallDataERNS_8CallDataE 256 __ZN3JSC6JSCell11getJSNumberEv257 256 __ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE 258 257 __ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateEj -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r95884 r95893 189 189 ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z 190 190 ?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z 191 ?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ192 191 ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ 193 192 ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r95516 r95893 27 27 #include "JSString.h" 28 28 #include "JSObject.h" 29 #include "NumberObject.h" 29 30 #include <wtf/MathExtras.h> 30 31 … … 113 114 } 114 115 115 JSValue JSCell::getJSNumber() 116 JSValue JSCell::getJSNumber() const 116 117 { 118 if (structure()->typeInfo().isNumberObject()) 119 return static_cast<const NumberObject*>(this)->getJSNumber(); 117 120 return JSValue(); 118 121 } -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r95849 r95893 96 96 97 97 virtual JSObject* toThisObject(ExecState*) const; 98 virtual JSValue getJSNumber();98 JSValue getJSNumber() const; 99 99 void* vptr() { return *reinterpret_cast<void**>(this); } 100 100 void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; } … … 315 315 } 316 316 317 inline JSValue JSValue::getJSNumber() 317 inline JSValue JSValue::getJSNumber() const 318 318 { 319 319 if (isInt32() || isDouble()) -
trunk/Source/JavaScriptCore/runtime/JSType.h
r95666 r95893 42 42 FinalObjectType = 11, 43 43 JSFunctionType = 12, 44 NumberObjectType = 13, 44 45 }; 45 46 -
trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h
r95340 r95893 65 65 bool isObject() const { return type() >= ObjectType; } 66 66 bool isFinalObject() const { return type() == FinalObjectType; } 67 bool isNumberObject() const { return type() == NumberObjectType; } 67 68 68 69 bool masqueradesAsUndefined() const { return isSetOnFlags1(MasqueradesAsUndefined); } -
trunk/Source/JavaScriptCore/runtime/JSValue.h
r95214 r95893 216 216 static bool strictEqualSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2); 217 217 218 JSValue getJSNumber() ; // JSValue() if this is not a JSNumber or number object218 JSValue getJSNumber() const; // JSValue() if this is not a JSNumber or number object 219 219 220 220 bool isCell() const; -
trunk/Source/JavaScriptCore/runtime/NumberObject.cpp
r94875 r95893 43 43 } 44 44 45 JSValue NumberObject::getJSNumber() 45 JSValue NumberObject::getJSNumber() const 46 46 { 47 47 return internalValue(); -
trunk/Source/JavaScriptCore/runtime/NumberObject.h
r94929 r95893 45 45 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 46 46 { 47 return Structure::create(globalData, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);47 return Structure::create(globalData, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), &s_info); 48 48 } 49 49 50 private: 51 virtual JSValue getJSNumber(); 50 JSValue getJSNumber() const; 52 51 }; 53 52 -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.h
r95108 r95893 41 41 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 42 42 { 43 return Structure::create(globalData, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);43 return Structure::create(globalData, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), &s_info); 44 44 } 45 45
Note: See TracChangeset
for help on using the changeset viewer.