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/object_object.cpp

    r30158 r31208  
    4444    : JSObject() // [[Prototype]] is null
    4545{
    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 
    5446    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
    5547    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
    5648    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);
    6052
    6153    // 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);
    6658}
    6759
Note: See TracChangeset for help on using the changeset viewer.