Changeset 31208 in webkit for trunk/JavaScriptCore
- Timestamp:
- Mar 21, 2008, 4:14:49 AM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r31205 r31208 1 2008-03-21 Alexey Proskuryakov <[email protected]> 2 3 Reviewed by Oliver Hunt. 4 5 Consolidate static identifier initializers within CommonIdentifiers. 6 7 No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%). 8 9 * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized 10 throughout the code. 11 12 * kjs/date_object.cpp: 13 (KJS::DateObjectImp::DateObjectImp): 14 * kjs/function_object.cpp: 15 (KJS::FunctionPrototype::FunctionPrototype): 16 * kjs/object_object.cpp: 17 (KJS::ObjectPrototype::ObjectPrototype): 18 * kjs/regexp_object.cpp: 19 (KJS::RegExpPrototype::RegExpPrototype): 20 Use the values from CommonIdentifiers. 21 22 * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it. 23 24 * kjs/value.h: 25 (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here. 26 27 * wtf/MathExtras.h: 28 (wtf_atan2): Having local variables for numeric_limits constants is good for readability, 29 but there is no reason to keep them static. 30 31 * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head. 32 1 33 2008-03-20 Oliver Hunt <[email protected]> 2 34 -
trunk/JavaScriptCore/JavaScriptCore.exp
r31167 r31208 113 113 __ZN3KJS14JSGlobalObject4markEv 114 114 __ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE 115 __ZN3KJS14JSGlobalObject6s_headE116 115 __ZN3KJS14JSGlobalObjectD2Ev 117 116 __ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE -
trunk/JavaScriptCore/kjs/CommonIdentifiers.h
r30871 r31208 28 28 // ways without repeating the list. 29 29 #define KJS_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \ 30 macro(__defineGetter__) \ 31 macro(__defineSetter__) \ 32 macro(__lookupGetter__) \ 33 macro(__lookupSetter__) \ 34 macro(apply) \ 30 35 macro(arguments) \ 36 macro(call) \ 31 37 macro(callee) \ 32 38 macro(caller) \ 39 macro(compile) \ 33 40 macro(constructor) \ 41 macro(eval) \ 42 macro(exec) \ 34 43 macro(fromCharCode) \ 35 44 macro(global) \ 45 macro(hasOwnProperty) \ 36 46 macro(ignoreCase) \ 37 47 macro(index) \ 38 48 macro(input) \ 49 macro(isPrototypeOf) \ 39 50 macro(length) \ 40 51 macro(message) \ 41 52 macro(multiline) \ 42 53 macro(name) \ 54 macro(parse) \ 55 macro(propertyIsEnumerable) \ 43 56 macro(prototype) \ 44 57 macro(source) \ 58 macro(test) \ 45 59 macro(toExponential) \ 46 60 macro(toFixed) \ … … 48 62 macro(toPrecision) \ 49 63 macro(toString) \ 50 macro( valueOf) \51 macro( eval)64 macro(UTC) \ 65 macro(valueOf) 52 66 53 67 namespace KJS { -
trunk/JavaScriptCore/kjs/date_object.cpp
r31057 r31208 453 453 : InternalFunctionImp(funcProto, dateProto->classInfo()->className) 454 454 { 455 static const Identifier* parsePropertyName = new Identifier("parse");456 static const Identifier* UTCPropertyName = new Identifier("UTC");457 458 455 putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly); 459 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, *parsePropertyName), DontEnum);460 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, *UTCPropertyName), DontEnum);456 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, CommonIdentifiers::shared()->parse), DontEnum); 457 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, CommonIdentifiers::shared()->UTC), DontEnum); 461 458 putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum); 462 459 } -
trunk/JavaScriptCore/kjs/function_object.cpp
r30942 r31208 45 45 FunctionPrototype::FunctionPrototype(ExecState* exec) 46 46 { 47 static const Identifier* applyPropertyName = new Identifier("apply");48 static const Identifier* callPropertyName = new Identifier("call");49 50 47 putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); 51 48 52 49 putDirectFunction(new PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 53 putDirectFunction(new PrototypeFunction(exec, this, 2, *applyPropertyName, functionProtoFuncApply), DontEnum);54 putDirectFunction(new PrototypeFunction(exec, this, 1, *callPropertyName, functionProtoFuncCall), DontEnum);50 putDirectFunction(new PrototypeFunction(exec, this, 2, CommonIdentifiers::shared()->apply, functionProtoFuncApply), DontEnum); 51 putDirectFunction(new PrototypeFunction(exec, this, 1, CommonIdentifiers::shared()->call, functionProtoFuncCall), DontEnum); 55 52 } 56 53 -
trunk/JavaScriptCore/kjs/lookup.h
r31147 r31208 285 285 JSObject* ClassPrototype::self(ExecState* exec) \ 286 286 { \ 287 static Identifier* prototypeIdentifier = new Identifier("[[" ClassName ".prototype]]"); \ 288 return KJS::cacheGlobalObject<ClassPrototype>(exec, *prototypeIdentifier); \ 287 return KJS::cacheGlobalObject<ClassPrototype>(exec, Identifier("[[" ClassName ".prototype]]")); \ 289 288 } \ 290 289 bool ClassPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) \ -
trunk/JavaScriptCore/kjs/object_object.cpp
r30158 r31208 44 44 : JSObject() // [[Prototype]] is null 45 45 { 46 static const Identifier* hasOwnPropertyPropertyName = new Identifier("hasOwnProperty");47 static const Identifier* propertyIsEnumerablePropertyName = new Identifier("propertyIsEnumerable");48 static const Identifier* isPrototypeOfPropertyName = new Identifier("isPrototypeOf");49 static const Identifier* defineGetterPropertyName = new Identifier("__defineGetter__");50 static const Identifier* defineSetterPropertyName = new Identifier("__defineSetter__");51 static const Identifier* lookupGetterPropertyName = new Identifier("__lookupGetter__");52 static const Identifier* lookupSetterPropertyName = new Identifier("__lookupSetter__");53 54 46 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum); 55 47 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum); 56 48 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum); 57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, *hasOwnPropertyPropertyName, objectProtoFuncHasOwnProperty), DontEnum);58 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, *propertyIsEnumerablePropertyName, objectProtoFuncPropertyIsEnumerable), DontEnum);59 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, *isPrototypeOfPropertyName, objectProtoFuncIsPrototypeOf), DontEnum);49 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum); 50 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum); 51 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum); 60 52 61 53 // Mozilla extensions 62 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, *defineGetterPropertyName, objectProtoFuncDefineGetter), DontEnum);63 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, *defineSetterPropertyName, objectProtoFuncDefineSetter), DontEnum);64 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, *lookupGetterPropertyName, objectProtoFuncLookupGetter), DontEnum);65 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, *lookupSetterPropertyName, objectProtoFuncLookupSetter), DontEnum);54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineGetter__, objectProtoFuncDefineGetter), DontEnum); 55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineSetter__, objectProtoFuncDefineSetter), DontEnum); 56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupGetter__, objectProtoFuncLookupGetter), DontEnum); 57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupSetter__, objectProtoFuncLookupSetter), DontEnum); 66 58 } 67 59 -
trunk/JavaScriptCore/kjs/regexp_object.cpp
r30534 r31208 52 52 : JSObject(objectPrototype) 53 53 { 54 static const Identifier* compilePropertyName = new Identifier("compile"); 55 static const Identifier* execPropertyName = new Identifier("exec"); 56 static const Identifier* testPropertyName = new Identifier("test"); 57 58 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, *compilePropertyName, regExpProtoFuncCompile), DontEnum); 59 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, *execPropertyName, regExpProtoFuncExec), DontEnum); 60 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, *testPropertyName, regExpProtoFuncTest), DontEnum); 54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->compile, regExpProtoFuncCompile), DontEnum); 55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->exec, regExpProtoFuncExec), DontEnum); 56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->test, regExpProtoFuncTest), DontEnum); 61 57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); 62 58 } -
trunk/JavaScriptCore/kjs/value.h
r28110 r31208 194 194 inline JSValue *jsNaN() 195 195 { 196 static const union { 197 uint64_t bits; 198 double d; 199 } nan = { 0x7ff80000ULL << 32 }; 200 return jsNumberCell(nan.d); 196 return jsNumberCell(NaN); 201 197 } 202 198 -
trunk/JavaScriptCore/wtf/MathExtras.h
r29663 r31208 96 96 inline double wtf_atan2(double x, double y) 97 97 { 98 staticdouble posInf = std::numeric_limits<double>::infinity();99 staticdouble negInf = -std::numeric_limits<double>::infinity();100 staticdouble nan = std::numeric_limits<double>::quiet_NaN();98 double posInf = std::numeric_limits<double>::infinity(); 99 double negInf = -std::numeric_limits<double>::infinity(); 100 double nan = std::numeric_limits<double>::quiet_NaN(); 101 101 102 102 double result = nan;
Note:
See TracChangeset
for help on using the changeset viewer.