Changeset 37747 in webkit


Ignore:
Timestamp:
Oct 20, 2008 2:27:44 PM (15 years ago)
Author:
weinig@apple.com
Message:

2008-10-16 Sam Weinig <sam@webkit.org>

Reviewed by Cameron Zwarich.

Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
Don't create intermediate StructureIDs for builtin objects

Second stage in reduce number of StructureIDs created when initializing the
JSGlobalObject.

  • Use putDirectWithoutTransition for the remaining singleton objects to reduce the number of StructureIDs create for about:blank from 132 to 73.
  • kjs/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor):
  • kjs/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor):
  • kjs/BooleanPrototype.cpp: (JSC::BooleanPrototype::BooleanPrototype):
  • kjs/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor):
  • kjs/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor):
  • kjs/ErrorPrototype.cpp: (JSC::ErrorPrototype::ErrorPrototype):
  • kjs/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor):
  • kjs/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype): (JSC::FunctionPrototype::addFunctionProperties):
  • kjs/FunctionPrototype.h: (JSC::FunctionPrototype::createStructureID):
  • kjs/InternalFunction.cpp:
  • kjs/InternalFunction.h: (JSC::InternalFunction::InternalFunction):
  • kjs/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset):
  • kjs/JSObject.h:
  • kjs/MathObject.cpp: (JSC::MathObject::MathObject):
  • kjs/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor):
  • kjs/NumberPrototype.cpp: (JSC::NumberPrototype::NumberPrototype):
  • kjs/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor):
  • kjs/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor):
  • kjs/RegExpPrototype.cpp: (JSC::RegExpPrototype::RegExpPrototype):
  • kjs/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor):
  • kjs/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype):
  • kjs/StructureID.cpp: (JSC::StructureID::dumpStatistics):
  • kjs/StructureID.h: (JSC::StructureID::setPrototypeWithoutTransition):
Location:
trunk/JavaScriptCore
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37744 r37747  
     12008-10-16  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
     6        Don't create intermediate StructureIDs for builtin objects
     7
     8        Second stage in reduce number of StructureIDs created when initializing the
     9        JSGlobalObject.
     10
     11        - Use putDirectWithoutTransition for the remaining singleton objects to reduce
     12          the number of StructureIDs create for about:blank from 132 to 73.
     13
     14        * kjs/ArrayConstructor.cpp:
     15        (JSC::ArrayConstructor::ArrayConstructor):
     16        * kjs/BooleanConstructor.cpp:
     17        (JSC::BooleanConstructor::BooleanConstructor):
     18        * kjs/BooleanPrototype.cpp:
     19        (JSC::BooleanPrototype::BooleanPrototype):
     20        * kjs/DateConstructor.cpp:
     21        (JSC::DateConstructor::DateConstructor):
     22        * kjs/ErrorConstructor.cpp:
     23        (JSC::ErrorConstructor::ErrorConstructor):
     24        * kjs/ErrorPrototype.cpp:
     25        (JSC::ErrorPrototype::ErrorPrototype):
     26        * kjs/FunctionConstructor.cpp:
     27        (JSC::FunctionConstructor::FunctionConstructor):
     28        * kjs/FunctionPrototype.cpp:
     29        (JSC::FunctionPrototype::FunctionPrototype):
     30        (JSC::FunctionPrototype::addFunctionProperties):
     31        * kjs/FunctionPrototype.h:
     32        (JSC::FunctionPrototype::createStructureID):
     33        * kjs/InternalFunction.cpp:
     34        * kjs/InternalFunction.h:
     35        (JSC::InternalFunction::InternalFunction):
     36        * kjs/JSGlobalObject.cpp:
     37        (JSC::JSGlobalObject::reset):
     38        * kjs/JSObject.h:
     39        * kjs/MathObject.cpp:
     40        (JSC::MathObject::MathObject):
     41        * kjs/NumberConstructor.cpp:
     42        (JSC::NumberConstructor::NumberConstructor):
     43        * kjs/NumberPrototype.cpp:
     44        (JSC::NumberPrototype::NumberPrototype):
     45        * kjs/ObjectConstructor.cpp:
     46        (JSC::ObjectConstructor::ObjectConstructor):
     47        * kjs/RegExpConstructor.cpp:
     48        (JSC::RegExpConstructor::RegExpConstructor):
     49        * kjs/RegExpPrototype.cpp:
     50        (JSC::RegExpPrototype::RegExpPrototype):
     51        * kjs/StringConstructor.cpp:
     52        (JSC::StringConstructor::StringConstructor):
     53        * kjs/StringPrototype.cpp:
     54        (JSC::StringPrototype::StringPrototype):
     55        * kjs/StructureID.cpp:
     56        (JSC::StructureID::dumpStatistics):
     57        * kjs/StructureID.h:
     58        (JSC::StructureID::setPrototypeWithoutTransition):
     59
    1602008-10-20  Alp Toker  <alp@nuanti.com>
    261
  • trunk/JavaScriptCore/kjs/ArrayConstructor.cpp

    r37684 r37747  
    3737{
    3838    // ECMA 15.4.3.1 Array.prototype
    39     putDirect(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
     39    putDirectWithoutTransition(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
    4040
    4141    // no. of arguments for constructor
    42     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
     42    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
    4343}
    4444
  • trunk/JavaScriptCore/kjs/BooleanConstructor.cpp

    r37684 r37747  
    3232    : InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className))
    3333{
    34     putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
     34    putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
    3535
    3636    // no. of arguments for constructor
    37     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
     37    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
    3838}
    3939
  • trunk/JavaScriptCore/kjs/BooleanPrototype.cpp

    r37684 r37747  
    4242    setInternalValue(jsBoolean(false));
    4343
    44     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
    45     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
     44    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
     45    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
    4646}
    4747
  • trunk/JavaScriptCore/kjs/DateConstructor.cpp

    r37684 r37747  
    5555    : InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className))
    5656{
    57       putDirect(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
     57      putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
    5858
    59       putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
    60       putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
    61       putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
     59      putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
     60      putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
     61      putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
    6262
    63       putDirect(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete);
     63      putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete);
    6464}
    6565
  • trunk/JavaScriptCore/kjs/ErrorConstructor.cpp

    r37684 r37747  
    3434{
    3535    // ECMA 15.11.3.1 Error.prototype
    36     putDirect(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
    37     putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum);
     36    putDirectWithoutTransition(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
     37    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum);
    3838}
    3939
  • trunk/JavaScriptCore/kjs/ErrorPrototype.cpp

    r37684 r37747  
    3939    // The constructor will be added later in ErrorConstructor's constructor
    4040
    41     putDirect(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
    42     putDirect(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
     41    putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
     42    putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
    4343
    44     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
     44    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
    4545}
    4646
  • trunk/JavaScriptCore/kjs/FunctionConstructor.cpp

    r37684 r37747  
    3838    : InternalFunction(&exec->globalData(), structure, Identifier(exec, functionPrototype->classInfo()->className))
    3939{
    40     putDirect(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
     40    putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
    4141
    4242    // Number of arguments for constructor
    43     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
     43    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
    4444}
    4545
  • trunk/JavaScriptCore/kjs/FunctionPrototype.cpp

    r37684 r37747  
    3737static JSValuePtr functionProtoFuncCall(ExecState*, JSObject*, JSValuePtr, const ArgList&);
    3838
    39 FunctionPrototype::FunctionPrototype(ExecState* exec)
    40     : InternalFunction(&exec->globalData())
     39FunctionPrototype::FunctionPrototype(ExecState* exec, PassRefPtr<StructureID> structure)
     40    : InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
    4141{
    42     putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
     42    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
    4343}
    4444
    4545void FunctionPrototype::addFunctionProperties(ExecState* exec, StructureID* prototypeFunctionStructure)
    4646{
    47     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
    48     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
    49     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
     47    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
     48    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
     49    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
    5050}
    5151
  • trunk/JavaScriptCore/kjs/FunctionPrototype.h

    r36726 r37747  
    2828    class FunctionPrototype : public InternalFunction {
    2929    public:
    30         FunctionPrototype(ExecState*);
     30        FunctionPrototype(ExecState*, PassRefPtr<StructureID>);
    3131        void addFunctionProperties(ExecState*, StructureID* prototypeFunctionStructure);
     32
     33        static PassRefPtr<StructureID> createStructureID(JSValuePtr proto)
     34        {
     35            return StructureID::create(proto, TypeInfo(ObjectType));
     36        }
    3237
    3338    private:
  • trunk/JavaScriptCore/kjs/InternalFunction.cpp

    r37681 r37747  
    3838}
    3939
    40 InternalFunction::InternalFunction(JSGlobalData* globalData)
    41     : JSObject(globalData->nullProtoStructureID)
    42 {
    43     putDirect(globalData->propertyNames->name, jsString(globalData, globalData->propertyNames->nullIdentifier.ustring()), DontDelete | ReadOnly | DontEnum);
    44 }
    45 
    4640InternalFunction::InternalFunction(JSGlobalData* globalData, PassRefPtr<StructureID> structure, const Identifier& name)
    4741    : JSObject(structure)
  • trunk/JavaScriptCore/kjs/InternalFunction.h

    r37684 r37747  
    4646    protected:
    4747        InternalFunction(PassRefPtr<StructureID> structure) : JSObject(structure) { }
    48         InternalFunction(JSGlobalData*);
    4948        InternalFunction(JSGlobalData*, PassRefPtr<StructureID>, const Identifier&);
    5049
  • trunk/JavaScriptCore/kjs/JSGlobalObject.cpp

    r37684 r37747  
    201201    // Prototypes
    202202
    203     d()->functionPrototype = new (exec) FunctionPrototype(exec);
     203    d()->functionPrototype = new (exec) FunctionPrototype(exec, FunctionPrototype::createStructureID(jsNull())); // The real prototype will be set once ObjectPrototype is created.
     204    d()->prototypeFunctionStructure = PrototypeFunction::createStructureID(d()->functionPrototype);
     205    d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get());
     206    d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructureID(jsNull()), d()->prototypeFunctionStructure.get());
     207    d()->functionPrototype->structureID()->setPrototypeWithoutTransition(d()->objectPrototype);
     208
     209    d()->emptyObjectStructure = d()->objectPrototype->inheritorID();
     210
    204211    d()->functionStructure = JSFunction::createStructureID(d()->functionPrototype);
    205212    d()->callbackFunctionStructure = JSCallbackFunction::createStructureID(d()->functionPrototype);
    206     d()->prototypeFunctionStructure = PrototypeFunction::createStructureID(d()->functionPrototype);
    207     d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get());
    208 
    209     d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructureID(jsNull()), d()->prototypeFunctionStructure.get());
    210     d()->emptyObjectStructure = d()->objectPrototype->inheritorID();
    211     d()->functionPrototype->setPrototype(d()->objectPrototype);
    212213    d()->argumentsStructure = Arguments::createStructureID(d()->objectPrototype);
    213214    d()->callbackConstructorStructure = JSCallbackConstructor::createStructureID(d()->objectPrototype);
    214215    d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructureID(d()->objectPrototype);
     216
    215217    d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructureID(d()->objectPrototype));
    216218    d()->arrayStructure = JSArray::createStructureID(d()->arrayPrototype);
    217219    d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructureID(d()->arrayPrototype);
     220
    218221    d()->stringPrototype = new (exec) StringPrototype(exec, StringPrototype::createStructureID(d()->objectPrototype));
    219222    d()->stringObjectStructure = StringObject::createStructureID(d()->stringPrototype);
     223
    220224    d()->booleanPrototype = new (exec) BooleanPrototype(exec, BooleanPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get());
    221225    d()->booleanObjectStructure = BooleanObject::createStructureID(d()->booleanPrototype);
     226
    222227    d()->numberPrototype = new (exec) NumberPrototype(exec, NumberPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get());
    223228    d()->numberObjectStructure = NumberObject::createStructureID(d()->numberPrototype);
     229
    224230    d()->datePrototype = new (exec) DatePrototype(exec, DatePrototype::createStructureID(d()->objectPrototype));
    225231    d()->dateStructure = DateInstance::createStructureID(d()->datePrototype);
     232
    226233    d()->regExpPrototype = new (exec) RegExpPrototype(exec, RegExpPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get());
    227234    d()->regExpStructure = RegExpObject::createStructureID(d()->regExpPrototype);
     235
    228236    ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, ErrorPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get());
    229237    d()->errorStructure = ErrorInstance::createStructureID(errorPrototype);
     
    261269    d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, URIErrorPrototype);
    262270
    263     d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);
    264 
    265271    d()->objectPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, objectConstructor, DontEnum);
    266 
    267     d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);
    268     d()->arrayPrototype->putDirect(exec->propertyNames().constructor, arrayConstructor, DontEnum);
    269     d()->booleanPrototype->putDirect(exec->propertyNames().constructor, booleanConstructor, DontEnum);
    270     d()->stringPrototype->putDirect(exec->propertyNames().constructor, stringConstructor, DontEnum);
    271     d()->numberPrototype->putDirect(exec->propertyNames().constructor, numberConstructor, DontEnum);
    272     d()->datePrototype->putDirect(exec->propertyNames().constructor, dateConstructor, DontEnum);
    273     d()->regExpPrototype->putDirect(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
    274     errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
     272    d()->functionPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, functionConstructor, DontEnum);
     273    d()->arrayPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, arrayConstructor, DontEnum);
     274    d()->booleanPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, booleanConstructor, DontEnum);
     275    d()->stringPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, stringConstructor, DontEnum);
     276    d()->numberPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, numberConstructor, DontEnum);
     277    d()->datePrototype->putDirectWithoutTransition(exec->propertyNames().constructor, dateConstructor, DontEnum);
     278    d()->regExpPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
     279    errorPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
     280
    275281    evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
    276282    rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
     
    284290    // FIXME: These properties could be handled by a static hash table.
    285291
    286     putDirect(Identifier(exec, "Object"), objectConstructor, DontEnum);
    287     putDirect(Identifier(exec, "Function"), functionConstructor, DontEnum);
    288     putDirect(Identifier(exec, "Array"), arrayConstructor, DontEnum);
    289     putDirect(Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
    290     putDirect(Identifier(exec, "String"), stringConstructor, DontEnum);
    291     putDirect(Identifier(exec, "Number"), numberConstructor, DontEnum);
    292     putDirect(Identifier(exec, "Date"), dateConstructor, DontEnum);
    293     putDirect(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);
    294     putDirect(Identifier(exec, "Error"), d()->errorConstructor, DontEnum);
    295     putDirect(Identifier(exec, "EvalError"), d()->evalErrorConstructor);
    296     putDirect(Identifier(exec, "RangeError"), d()->rangeErrorConstructor);
    297     putDirect(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);
    298     putDirect(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);
    299     putDirect(Identifier(exec, "TypeError"), d()->typeErrorConstructor);
    300     putDirect(Identifier(exec, "URIError"), d()->URIErrorConstructor);
     292    putDirectWithoutTransition(Identifier(exec, "Object"), objectConstructor, DontEnum);
     293    putDirectWithoutTransition(Identifier(exec, "Function"), functionConstructor, DontEnum);
     294    putDirectWithoutTransition(Identifier(exec, "Array"), arrayConstructor, DontEnum);
     295    putDirectWithoutTransition(Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
     296    putDirectWithoutTransition(Identifier(exec, "String"), stringConstructor, DontEnum);
     297    putDirectWithoutTransition(Identifier(exec, "Number"), numberConstructor, DontEnum);
     298    putDirectWithoutTransition(Identifier(exec, "Date"), dateConstructor, DontEnum);
     299    putDirectWithoutTransition(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);
     300    putDirectWithoutTransition(Identifier(exec, "Error"), d()->errorConstructor, DontEnum);
     301    putDirectWithoutTransition(Identifier(exec, "EvalError"), d()->evalErrorConstructor);
     302    putDirectWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor);
     303    putDirectWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);
     304    putDirectWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);
     305    putDirectWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor);
     306    putDirectWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor);
    301307
    302308    // Set global values.
     
    313319
    314320    d()->evalFunction = new (exec) GlobalEvalFunction(exec, GlobalEvalFunction::createStructureID(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
    315     putDirectFunction(exec, d()->evalFunction, DontEnum);
    316     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
    317     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
    318     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
    319     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
    320     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
    321     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
    322     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
    323     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
    324     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
    325     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
     321    putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum);
     322    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
     323    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
     324    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
     325    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
     326    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
     327    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
     328    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
     329    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
     330    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
     331    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
    326332#ifndef NDEBUG
    327     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
     333    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
    328334#endif
    329335
  • trunk/JavaScriptCore/kjs/JSObject.h

    r37684 r37747  
    158158        void putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
    159159        void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
    160         void putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attr);
    161         void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr);
     160        void putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attr = 0);
     161        void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);
    162162
    163163        // Fast access to known property offsets.
  • trunk/JavaScriptCore/kjs/MathObject.cpp

    r37684 r37747  
    8787    : JSObject(structure)
    8888{
    89     putDirect(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
    90     putDirect(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);
    91     putDirect(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly);
    92     putDirect(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
    93     putDirect(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);
    94     putDirect(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly);
    95     putDirect(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
    96     putDirect(Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
     89    putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
     90    putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);
     91    putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly);
     92    putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
     93    putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);
     94    putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly);
     95    putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
     96    putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
    9797}
    9898
  • trunk/JavaScriptCore/kjs/NumberConstructor.cpp

    r37684 r37747  
    5858{
    5959    // Number.Prototype
    60     putDirect(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
     60    putDirectWithoutTransition(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
    6161
    6262    // no. of arguments for constructor
    63     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
     63    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
    6464}
    6565
  • trunk/JavaScriptCore/kjs/NumberPrototype.cpp

    r37684 r37747  
    5252    // The constructor will be added later, after NumberConstructor has been constructed
    5353
    54     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
    55     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
    56     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
    57     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
    58     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
    59     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
     54    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
     55    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
     56    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
     57    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
     58    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
     59    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
    6060}
    6161
  • trunk/JavaScriptCore/kjs/ObjectConstructor.cpp

    r37684 r37747  
    3333{
    3434    // ECMA 15.2.3.1
    35     putDirect(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
     35    putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
    3636
    3737    // no. of arguments for constructor
    38     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
     38    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
    3939}
    4040
  • trunk/JavaScriptCore/kjs/RegExpConstructor.cpp

    r37684 r37747  
    109109{
    110110    // ECMA 15.10.5.1 RegExp.prototype
    111     putDirect(exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
     111    putDirectWithoutTransition(exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
    112112
    113113    // no. of arguments for constructor
    114     putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum);
     114    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum);
    115115}
    116116
  • trunk/JavaScriptCore/kjs/RegExpPrototype.cpp

    r37684 r37747  
    4848    : JSObject(structure)
    4949{
    50     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
    51     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
    52     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
    53     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
     50    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
     51    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
     52    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
     53    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
    5454}
    5555
  • trunk/JavaScriptCore/kjs/StringConstructor.cpp

    r37684 r37747  
    5151{
    5252    // ECMA 15.5.3.1 String.prototype
    53     putDirect(exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
     53    putDirectWithoutTransition(exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
    5454
    5555    // ECMA 15.5.3.2 fromCharCode()
    56     putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
     56    putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
    5757
    5858    // no. of arguments for constructor
    59     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
     59    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
    6060}
    6161
  • trunk/JavaScriptCore/kjs/StringPrototype.cpp

    r37684 r37747  
    122122{
    123123    // The constructor will be added later, after StringConstructor has been built
    124     putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
     124    putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
    125125}
    126126
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37684 r37747  
    5858void StructureID::dumpStatistics()
    5959{
     60    unsigned numberLeaf = 0;
    6061    unsigned numberUsingSingleSlot = 0;
     62    unsigned numberSingletons = 0;
    6163
    6264    HashSet<StructureID*>::const_iterator end = liveStructureIDSet.end();
    6365    for (HashSet<StructureID*>::const_iterator it = liveStructureIDSet.begin(); it != end; ++it) {
    6466        StructureID* structureID = *it;
    65         if (structureID->m_usingSingleTransitionSlot)
    66             ++numberUsingSingleSlot;
     67        if (structureID->m_usingSingleTransitionSlot) {
     68            if (!structureID->m_transitions.singleTransition)
     69                ++numberLeaf;
     70            else
     71                ++numberUsingSingleSlot;
     72
     73           if (!structureID->m_previous && !structureID->m_transitions.singleTransition)
     74                ++numberSingletons;
     75        }
    6776    }
    6877
    6978    printf("Number of live StructureIDs: %d\n", liveStructureIDSet.size());
    7079    printf("Number of StructureIDs using the single item optimization for transition map: %d\n", numberUsingSingleSlot);
     80    printf("Number of StructureIDs that are leaf nodes: %d\n", numberLeaf);
     81    printf("Number of StructureIDs that singletons: %d\n", numberSingletons);
    7182}
    7283#endif
  • trunk/JavaScriptCore/kjs/StructureID.h

    r37706 r37747  
    105105        }
    106106
     107        // These should be used with caution. 
    107108        size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes);
     109        void setPrototypeWithoutTransition(JSValuePtr prototype) { m_prototype = prototype; }
    108110
    109111        bool isDictionary() const { return m_isDictionary; }
Note: See TracChangeset for help on using the changeset viewer.