Ignore:
Timestamp:
Mar 21, 2008, 4:14:49 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Oliver Hunt.

Consolidate static identifier initializers within CommonIdentifiers.

No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).

  • kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized throughout the code.
  • kjs/date_object.cpp: (KJS::DateObjectImp::DateObjectImp):
  • kjs/function_object.cpp: (KJS::FunctionPrototype::FunctionPrototype):
  • kjs/object_object.cpp: (KJS::ObjectPrototype::ObjectPrototype):
  • kjs/regexp_object.cpp: (KJS::RegExpPrototype::RegExpPrototype): Use the values from CommonIdentifiers.
  • kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
  • kjs/value.h: (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
  • wtf/MathExtras.h: (wtf_atan2): Having local variables for numeric_limits constants is good for readability, but there is no reason to keep them static.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp_object.cpp

    r30534 r31208  
    5252    : JSObject(objectPrototype)
    5353{
    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);
    6157    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
    6258}
Note: See TracChangeset for help on using the changeset viewer.