Changeset 36726 in webkit


Ignore:
Timestamp:
Sep 20, 2008 7:29:12 PM (16 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2008-09-20 Darin Adler <Darin Adler>

Reviewed by Maciej Stachowiak.

This also includes some optimizations that make the change an overall
small speedup. Without those it was a bit of a slowdown.

  • API/JSCallbackConstructor.cpp: (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
  • API/JSCallbackConstructor.h: Ditto.
  • API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
  • API/JSCallbackObject.h: Take a structure.
  • API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject::JSCallbackObject): Ditto.
  • API/JSClassRef.cpp: (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype if there's a custom prototype involved.
  • API/JSObjectRef.cpp: (JSObjectMake): Ditto. (JSObjectMakeConstructor): Pass in a structure.
  • VM/Machine.cpp: (JSC::jsLess): Added a special case for when both arguments are strings. This avoids converting both strings to with UString::toDouble. (JSC::jsLessEq): Ditto. (JSC::Machine::privateExecute): Pass in a structure. (JSC::Machine::cti_op_construct_JSConstruct): Ditto. (JSC::Machine::cti_op_new_regexp): Ditto. (JSC::Machine::cti_op_is_string): Ditto.
  • VM/Machine.h: Made isJSString public so it can be used in the CTI.
  • kjs/Arguments.cpp: (JSC::Arguments::Arguments): Pass in a structure.
  • kjs/JSCell.h: Mark constructor explicit.
  • kjs/JSGlobalObject.cpp: (JSC::markIfNeeded): Added an overload for marking structures. (JSC::JSGlobalObject::reset): Eliminate code to set data members to zero. We now do that in the constructor, and we no longer use this anywhere except in the constructor. Added code to create structures. Pass structures rather than prototypes when creating objects. (JSC::JSGlobalObject::mark): Mark the structures.
  • kjs/JSGlobalObject.h: Removed unneeded class declarations. Added initializers for raw pointers in JSGlobalObjectData so everything starts with a 0. Added structure data and accessor functions.
  • kjs/JSImmediate.cpp: (JSC::JSImmediate::nonInlineNaN): Added.
  • kjs/JSImmediate.h: (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
  • kjs/JSNumberCell.cpp: (JSC::jsNumberCell): Made non-inline to avoid PIC branches in functions that call this one. (JSC::jsNaN): Ditto.
  • kjs/JSNumberCell.h: Ditto.
  • kjs/JSObject.h: Removed constructor that takes a prototype. All callers now pass structures.
  • kjs/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor): (JSC::constructArrayWithSizeQuirk):
  • kjs/ArrayConstructor.h:
  • kjs/ArrayPrototype.cpp: (JSC::ArrayPrototype::ArrayPrototype):
  • kjs/ArrayPrototype.h:
  • kjs/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor): (JSC::constructBoolean): (JSC::constructBooleanFromImmediateBoolean):
  • kjs/BooleanConstructor.h:
  • kjs/BooleanObject.cpp: (JSC::BooleanObject::BooleanObject):
  • kjs/BooleanObject.h:
  • kjs/BooleanPrototype.cpp: (JSC::BooleanPrototype::BooleanPrototype):
  • kjs/BooleanPrototype.h:
  • kjs/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor): (JSC::constructDate):
  • kjs/DateConstructor.h:
  • kjs/DateInstance.cpp: (JSC::DateInstance::DateInstance):
  • kjs/DateInstance.h:
  • kjs/DatePrototype.cpp: (JSC::DatePrototype::DatePrototype):
  • kjs/DatePrototype.h:
  • kjs/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor): (JSC::constructError):
  • kjs/ErrorConstructor.h:
  • kjs/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance):
  • kjs/ErrorInstance.h:
  • kjs/ErrorPrototype.cpp: (JSC::ErrorPrototype::ErrorPrototype):
  • kjs/ErrorPrototype.h:
  • kjs/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor):
  • kjs/FunctionConstructor.h:
  • kjs/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype): (JSC::FunctionPrototype::addFunctionProperties):
  • kjs/FunctionPrototype.h:
  • kjs/GlobalEvalFunction.cpp: (JSC::GlobalEvalFunction::GlobalEvalFunction):
  • kjs/GlobalEvalFunction.h:
  • kjs/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction):
  • kjs/InternalFunction.h: (JSC::InternalFunction::InternalFunction):
  • kjs/JSArray.cpp: (JSC::JSArray::JSArray): (JSC::constructEmptyArray): (JSC::constructArray):
  • kjs/JSArray.h:
  • kjs/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::construct):
  • kjs/JSObject.cpp: (JSC::constructEmptyObject):
  • kjs/JSString.cpp: (JSC::StringObject::create):
  • kjs/JSWrapperObject.h:
  • kjs/MathObject.cpp: (JSC::MathObject::MathObject):
  • kjs/MathObject.h:
  • kjs/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): (JSC::NativeErrorConstructor::construct):
  • kjs/NativeErrorConstructor.h:
  • kjs/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::NativeErrorPrototype):
  • kjs/NativeErrorPrototype.h:
  • kjs/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor): (JSC::constructWithNumberConstructor):
  • kjs/NumberConstructor.h:
  • kjs/NumberObject.cpp: (JSC::NumberObject::NumberObject): (JSC::constructNumber): (JSC::constructNumberFromImmediateNumber):
  • kjs/NumberObject.h:
  • kjs/NumberPrototype.cpp: (JSC::NumberPrototype::NumberPrototype):
  • kjs/NumberPrototype.h:
  • kjs/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor): (JSC::constructObject):
  • kjs/ObjectConstructor.h:
  • kjs/ObjectPrototype.cpp: (JSC::ObjectPrototype::ObjectPrototype):
  • kjs/ObjectPrototype.h:
  • kjs/PrototypeFunction.cpp: (JSC::PrototypeFunction::PrototypeFunction):
  • kjs/PrototypeFunction.h:
  • kjs/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): (JSC::RegExpMatchesArray::RegExpMatchesArray): (JSC::constructRegExp):
  • kjs/RegExpConstructor.h:
  • kjs/RegExpObject.cpp: (JSC::RegExpObject::RegExpObject):
  • kjs/RegExpObject.h:
  • kjs/RegExpPrototype.cpp: (JSC::RegExpPrototype::RegExpPrototype):
  • kjs/RegExpPrototype.h:
  • kjs/Shell.cpp: (GlobalObject::GlobalObject):
  • kjs/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): (JSC::constructWithStringConstructor):
  • kjs/StringConstructor.h:
  • kjs/StringObject.cpp: (JSC::StringObject::StringObject):
  • kjs/StringObject.h:
  • kjs/StringObjectThatMasqueradesAsUndefined.h: (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
  • kjs/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype):
  • kjs/StringPrototype.h: Take and pass structures.

WebCore:

2008-09-20 Darin Adler <Darin Adler>

Reviewed by Maciej Stachowiak.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::nameGetter): Pass in a structure ID. Note that this makes a new structure every time -- we could optimize this slightly be caching and reusing a single one.
  • bridge/runtime_method.cpp: (JSC::RuntimeMethod::RuntimeMethod): Create a unique structure using getDOMStructure.
  • bridge/runtime_method.h: (JSC::RuntimeMethod::createPrototype): Added createPrototype so getDOMStructure will work.
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::JSDOMWindowShell): Initialize m_window to 0; needed in case garbage collection happens while creating the JSDOMWindow.
Location:
trunk
Files:
93 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSCallbackConstructor.cpp

    r36263 r36726  
    3737const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
    3838
    39 JSCallbackConstructor::JSCallbackConstructor(ExecState* exec, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
    40     : JSObject(exec->lexicalGlobalObject()->objectPrototype())
     39JSCallbackConstructor::JSCallbackConstructor(PassRefPtr<StructureID> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
     40    : JSObject(structure)
    4141    , m_class(jsClass)
    4242    , m_callback(callback)
  • trunk/JavaScriptCore/API/JSCallbackConstructor.h

    r36263 r36726  
    3434class JSCallbackConstructor : public JSObject {
    3535public:
    36     JSCallbackConstructor(ExecState*, JSClassRef, JSObjectCallAsConstructorCallback);
     36    JSCallbackConstructor(PassRefPtr<StructureID>, JSClassRef, JSObjectCallAsConstructorCallback);
    3737    virtual ~JSCallbackConstructor();
    3838    JSClassRef classRef() const { return m_class; }
  • trunk/JavaScriptCore/API/JSCallbackFunction.cpp

    r36263 r36726  
    4242
    4343JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name)
    44     : InternalFunction(exec, exec->lexicalGlobalObject()->functionPrototype(), name)
     44    : InternalFunction(exec, exec->lexicalGlobalObject()->callbackFunctionStructure(), name)
    4545    , m_callback(callback)
    4646{
  • trunk/JavaScriptCore/API/JSCallbackObject.h

    r36417 r36726  
    3737class JSCallbackObject : public Base {
    3838public:
    39     JSCallbackObject(ExecState*, JSClassRef, JSObject* prototype, void* data);
     39    JSCallbackObject(ExecState*, PassRefPtr<StructureID>, JSClassRef, void* data);
    4040    JSCallbackObject(JSGlobalData*, JSClassRef);
    4141    virtual ~JSCallbackObject();
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r36417 r36726  
    4141
    4242template <class Base>
    43 JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSClassRef jsClass, JSObject* prototype, void* data)
    44     : Base(prototype)
     43JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, PassRefPtr<StructureID> structure, JSClassRef jsClass, void* data)
     44    : Base(structure)
    4545    , m_callbackObjectData(new JSCallbackObjectData(data, jsClass))
    4646{
  • trunk/JavaScriptCore/API/JSClassRef.cpp

    r36263 r36726  
    236236    if (!jsClassData.cachedPrototype) {
    237237        // Recursive, but should be good enough for our purposes
    238         JSObject* parentPrototype = 0;
    239         if (parentClass)
    240             parentPrototype = parentClass->prototype(exec); // can be null
    241         if (!parentPrototype)
    242             parentPrototype = exec->dynamicGlobalObject()->objectPrototype();
    243         jsClassData.cachedPrototype = new (exec) JSCallbackObject<JSObject>(exec, prototypeClass, parentPrototype, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
     238        jsClassData.cachedPrototype = new (exec) JSCallbackObject<JSObject>(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
     239        if (parentClass) {
     240            if (JSObject* prototype = parentClass->prototype(exec))
     241                jsClassData.cachedPrototype->setPrototype(prototype);
     242        }
    244243    }
    245244    return jsClassData.cachedPrototype;
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r36263 r36726  
    7373
    7474    if (!jsClass)
    75         return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient
    76 
    77     JSObject* jsPrototype = jsClass->prototype(exec);
    78     if (!jsPrototype)
    79         jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
    80 
    81     return toRef(new (exec) JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data));
     75        return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient
     76
     77    JSCallbackObject<JSObject>* object = new (exec) JSCallbackObject<JSObject>(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
     78    if (JSObject* prototype = jsClass->prototype(exec))
     79        object->setPrototype(prototype);
     80
     81    return toRef(object);
    8282}
    8383
     
    103103        : exec->dynamicGlobalObject()->objectPrototype();
    104104   
    105     JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec, jsClass, callAsConstructor);
     105    JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
    106106    constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
    107107    return toRef(constructor);
  • trunk/JavaScriptCore/ChangeLog

    r36705 r36726  
     12008-09-20  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        - finish https://bugs.webkit.org/show_bug.cgi?id=20858
     6          make each distinct C++ class get a distinct JSC::Structure
     7
     8        This also includes some optimizations that make the change an overall
     9        small speedup. Without those it was a bit of a slowdown.
     10
     11        * API/JSCallbackConstructor.cpp:
     12        (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
     13        * API/JSCallbackConstructor.h: Ditto.
     14        * API/JSCallbackFunction.cpp:
     15        (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
     16        * API/JSCallbackObject.h: Take a structure.
     17        * API/JSCallbackObjectFunctions.h:
     18        (JSC::JSCallbackObject::JSCallbackObject): Ditto.
     19
     20        * API/JSClassRef.cpp:
     21        (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
     22        if there's a custom prototype involved.
     23        * API/JSObjectRef.cpp:
     24        (JSObjectMake): Ditto.
     25        (JSObjectMakeConstructor): Pass in a structure.
     26
     27        * JavaScriptCore.exp: Updated.
     28
     29        * VM/Machine.cpp:
     30        (JSC::jsLess): Added a special case for when both arguments are strings.
     31        This avoids converting both strings to with UString::toDouble.
     32        (JSC::jsLessEq): Ditto.
     33        (JSC::Machine::privateExecute): Pass in a structure.
     34        (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
     35        (JSC::Machine::cti_op_new_regexp): Ditto.
     36        (JSC::Machine::cti_op_is_string): Ditto.
     37        * VM/Machine.h: Made isJSString public so it can be used in the CTI.
     38
     39        * kjs/Arguments.cpp:
     40        (JSC::Arguments::Arguments): Pass in a structure.
     41
     42        * kjs/JSCell.h: Mark constructor explicit.
     43
     44        * kjs/JSGlobalObject.cpp:
     45        (JSC::markIfNeeded): Added an overload for marking structures.
     46        (JSC::JSGlobalObject::reset): Eliminate code to set data members to
     47        zero. We now do that in the constructor, and we no longer use this
     48        anywhere except in the constructor. Added code to create structures.
     49        Pass structures rather than prototypes when creating objects.
     50        (JSC::JSGlobalObject::mark): Mark the structures.
     51
     52        * kjs/JSGlobalObject.h: Removed unneeded class declarations.
     53        Added initializers for raw pointers in JSGlobalObjectData so
     54        everything starts with a 0. Added structure data and accessor
     55        functions.
     56
     57        * kjs/JSImmediate.cpp:
     58        (JSC::JSImmediate::nonInlineNaN): Added.
     59        * kjs/JSImmediate.h:
     60        (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
     61
     62        * kjs/JSNumberCell.cpp:
     63        (JSC::jsNumberCell): Made non-inline to avoid PIC branches
     64        in functions that call this one.
     65        (JSC::jsNaN): Ditto.
     66        * kjs/JSNumberCell.h: Ditto.
     67
     68        * kjs/JSObject.h: Removed constructor that takes a prototype.
     69        All callers now pass structures.
     70
     71        * kjs/ArrayConstructor.cpp:
     72        (JSC::ArrayConstructor::ArrayConstructor):
     73        (JSC::constructArrayWithSizeQuirk):
     74        * kjs/ArrayConstructor.h:
     75        * kjs/ArrayPrototype.cpp:
     76        (JSC::ArrayPrototype::ArrayPrototype):
     77        * kjs/ArrayPrototype.h:
     78        * kjs/BooleanConstructor.cpp:
     79        (JSC::BooleanConstructor::BooleanConstructor):
     80        (JSC::constructBoolean):
     81        (JSC::constructBooleanFromImmediateBoolean):
     82        * kjs/BooleanConstructor.h:
     83        * kjs/BooleanObject.cpp:
     84        (JSC::BooleanObject::BooleanObject):
     85        * kjs/BooleanObject.h:
     86        * kjs/BooleanPrototype.cpp:
     87        (JSC::BooleanPrototype::BooleanPrototype):
     88        * kjs/BooleanPrototype.h:
     89        * kjs/DateConstructor.cpp:
     90        (JSC::DateConstructor::DateConstructor):
     91        (JSC::constructDate):
     92        * kjs/DateConstructor.h:
     93        * kjs/DateInstance.cpp:
     94        (JSC::DateInstance::DateInstance):
     95        * kjs/DateInstance.h:
     96        * kjs/DatePrototype.cpp:
     97        (JSC::DatePrototype::DatePrototype):
     98        * kjs/DatePrototype.h:
     99        * kjs/ErrorConstructor.cpp:
     100        (JSC::ErrorConstructor::ErrorConstructor):
     101        (JSC::constructError):
     102        * kjs/ErrorConstructor.h:
     103        * kjs/ErrorInstance.cpp:
     104        (JSC::ErrorInstance::ErrorInstance):
     105        * kjs/ErrorInstance.h:
     106        * kjs/ErrorPrototype.cpp:
     107        (JSC::ErrorPrototype::ErrorPrototype):
     108        * kjs/ErrorPrototype.h:
     109        * kjs/FunctionConstructor.cpp:
     110        (JSC::FunctionConstructor::FunctionConstructor):
     111        * kjs/FunctionConstructor.h:
     112        * kjs/FunctionPrototype.cpp:
     113        (JSC::FunctionPrototype::FunctionPrototype):
     114        (JSC::FunctionPrototype::addFunctionProperties):
     115        * kjs/FunctionPrototype.h:
     116        * kjs/GlobalEvalFunction.cpp:
     117        (JSC::GlobalEvalFunction::GlobalEvalFunction):
     118        * kjs/GlobalEvalFunction.h:
     119        * kjs/InternalFunction.cpp:
     120        (JSC::InternalFunction::InternalFunction):
     121        * kjs/InternalFunction.h:
     122        (JSC::InternalFunction::InternalFunction):
     123        * kjs/JSArray.cpp:
     124        (JSC::JSArray::JSArray):
     125        (JSC::constructEmptyArray):
     126        (JSC::constructArray):
     127        * kjs/JSArray.h:
     128        * kjs/JSFunction.cpp:
     129        (JSC::JSFunction::JSFunction):
     130        (JSC::JSFunction::construct):
     131        * kjs/JSObject.cpp:
     132        (JSC::constructEmptyObject):
     133        * kjs/JSString.cpp:
     134        (JSC::StringObject::create):
     135        * kjs/JSWrapperObject.h:
     136        * kjs/MathObject.cpp:
     137        (JSC::MathObject::MathObject):
     138        * kjs/MathObject.h:
     139        * kjs/NativeErrorConstructor.cpp:
     140        (JSC::NativeErrorConstructor::NativeErrorConstructor):
     141        (JSC::NativeErrorConstructor::construct):
     142        * kjs/NativeErrorConstructor.h:
     143        * kjs/NativeErrorPrototype.cpp:
     144        (JSC::NativeErrorPrototype::NativeErrorPrototype):
     145        * kjs/NativeErrorPrototype.h:
     146        * kjs/NumberConstructor.cpp:
     147        (JSC::NumberConstructor::NumberConstructor):
     148        (JSC::constructWithNumberConstructor):
     149        * kjs/NumberConstructor.h:
     150        * kjs/NumberObject.cpp:
     151        (JSC::NumberObject::NumberObject):
     152        (JSC::constructNumber):
     153        (JSC::constructNumberFromImmediateNumber):
     154        * kjs/NumberObject.h:
     155        * kjs/NumberPrototype.cpp:
     156        (JSC::NumberPrototype::NumberPrototype):
     157        * kjs/NumberPrototype.h:
     158        * kjs/ObjectConstructor.cpp:
     159        (JSC::ObjectConstructor::ObjectConstructor):
     160        (JSC::constructObject):
     161        * kjs/ObjectConstructor.h:
     162        * kjs/ObjectPrototype.cpp:
     163        (JSC::ObjectPrototype::ObjectPrototype):
     164        * kjs/ObjectPrototype.h:
     165        * kjs/PrototypeFunction.cpp:
     166        (JSC::PrototypeFunction::PrototypeFunction):
     167        * kjs/PrototypeFunction.h:
     168        * kjs/RegExpConstructor.cpp:
     169        (JSC::RegExpConstructor::RegExpConstructor):
     170        (JSC::RegExpMatchesArray::RegExpMatchesArray):
     171        (JSC::constructRegExp):
     172        * kjs/RegExpConstructor.h:
     173        * kjs/RegExpObject.cpp:
     174        (JSC::RegExpObject::RegExpObject):
     175        * kjs/RegExpObject.h:
     176        * kjs/RegExpPrototype.cpp:
     177        (JSC::RegExpPrototype::RegExpPrototype):
     178        * kjs/RegExpPrototype.h:
     179        * kjs/Shell.cpp:
     180        (GlobalObject::GlobalObject):
     181        * kjs/StringConstructor.cpp:
     182        (JSC::StringConstructor::StringConstructor):
     183        (JSC::constructWithStringConstructor):
     184        * kjs/StringConstructor.h:
     185        * kjs/StringObject.cpp:
     186        (JSC::StringObject::StringObject):
     187        * kjs/StringObject.h:
     188        * kjs/StringObjectThatMasqueradesAsUndefined.h:
     189        (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
     190        * kjs/StringPrototype.cpp:
     191        (JSC::StringPrototype::StringPrototype):
     192        * kjs/StringPrototype.h:
     193        Take and pass structures.
     194
    11952008-09-19  Alp Toker  <alp@nuanti.com>
    2196
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r36701 r36726  
    9999__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_7UStringEiN3WTF10PassRefPtrINS_14SourceProviderEEEPNS_7JSValueE
    100100__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_7UStringEiS7_PNS_7JSValueE
     101__ZN3JSC11JSImmediate12nonInlineNaNEv
    101102__ZN3JSC11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE
    102103__ZN3JSC11JSImmediate8toStringEPKNS_7JSValueE
     
    128129__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
    129130__ZN3JSC12StringObject4infoE
    130 __ZN3JSC12StringObjectC2EPNS_9ExecStateEPNS_8JSObjectERKNS_7UStringE
     131__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_7UStringE
     132__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
    131133__ZN3JSC13CodeGenerator21setDumpsGeneratedCodeEb
    132134__ZN3JSC13StatementNode6setLocEii
     
    147149__ZN3JSC15JSWrapperObject4markEv
    148150__ZN3JSC16InternalFunction4infoE
    149 __ZN3JSC16InternalFunctionC2EPNS_9ExecStateEPNS_17FunctionPrototypeERKNS_10IdentifierE
     151__ZN3JSC16InternalFunctionC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_10IdentifierE
    150152__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    151153__ZN3JSC16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
     
    154156__ZN3JSC16ParserRefCounted5derefEv
    155157__ZN3JSC17PropertyNameArray3addEPNS_7UString3RepE
    156 __ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectES9_RKNS_7ArgListEE
     158__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectESB_RKNS_7ArgListEE
    157159__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectES7_RKNS_7ArgListEE
    158160__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
  • trunk/JavaScriptCore/VM/Machine.cpp

    r36695 r36726  
    151151        return n1 < n2;
    152152
     153    Machine* machine = exec->machine();
     154    if (machine->isJSString(v1) && machine->isJSString(v2))
     155        return static_cast<const JSString*>(v1)->value() < static_cast<const JSString*>(v2)->value();
     156
    153157    JSValue* p1;
    154158    JSValue* p2;
     
    171175    if (fastIsNumber(v1, n1) && fastIsNumber(v2, n2))
    172176        return n1 <= n2;
     177
     178    Machine* machine = exec->machine();
     179    if (machine->isJSString(v1) && machine->isJSString(v2))
     180        return !(static_cast<const JSString*>(v2)->value() < static_cast<const JSString*>(v1)->value());
    173181
    174182    JSValue* p1;
     
    15051513        int dst = (++vPC)->u.operand;
    15061514        int regExp = (++vPC)->u.operand;
    1507         r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpPrototype(), codeBlock->regexps[regExp]);
     1515        r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpStructure(), codeBlock->regexps[regExp]);
    15081516
    15091517        ++vPC;
     
    33863394                (*enabledProfilerReference)->willExecute(exec, constructor);
    33873395
    3388             JSObject* prototype;
    3389             JSValue* p = r[constrProto].jsValue(exec);
    3390             if (p->isObject())
    3391                 prototype = static_cast<JSObject*>(p);
     3396            StructureID* structure;
     3397            JSValue* prototype = r[constrProto].jsValue(exec);
     3398            if (prototype->isObject())
     3399                structure = static_cast<JSObject*>(prototype)->inheritorID();
    33923400            else
    3393                 prototype = scopeChain->globalObject()->objectPrototype();
    3394             JSObject* newObject = new (exec) JSObject(prototype);
     3401                structure = scopeChain->globalObject()->emptyObjectStructure();
     3402            JSObject* newObject = new (exec) JSObject(structure);
    33953403
    33963404            ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
     
    45404548        (*ARG_profilerReference)->willExecute(exec, constructor);
    45414549
    4542     JSObject* prototype;
    4543     JSValue* p = constrProtoVal;
    4544     if (p->isObject())
    4545         prototype = static_cast<JSObject*>(p);
     4550    StructureID* structure;
     4551    if (constrProtoVal->isObject())
     4552        structure = static_cast<JSObject*>(constrProtoVal)->inheritorID();
    45464553    else
    4547         prototype = scopeChain->globalObject()->objectPrototype();
    4548     JSObject* newObject = new (exec) JSObject(prototype);
     4554        structure = scopeChain->globalObject()->emptyObjectStructure();
     4555    JSObject* newObject = new (exec) JSObject(structure);
    45494556
    45504557    ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
     
    51455152JSValue* Machine::cti_op_new_regexp(CTI_ARGS)
    51465153{
    5147     return new (ARG_exec) RegExpObject(ARG_scopeChain->globalObject()->regExpPrototype(), ARG_regexp1);
     5154    return new (ARG_exec) RegExpObject(ARG_scopeChain->globalObject()->regExpStructure(), ARG_regexp1);
    51485155}
    51495156
     
    52755282JSValue* Machine::cti_op_is_string(CTI_ARGS)
    52765283{
    5277     return jsBoolean(ARG_src1->isString());
     5284    return jsBoolean(ARG_exec->machine()->isJSString(ARG_src1));
    52785285}
    52795286
  • trunk/JavaScriptCore/VM/Machine.h

    r36604 r36726  
    233233        static const int initialTickCountThreshold = 1024;
    234234
     235        bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; }
     236        bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; }
     237       
    235238    private:
    236239        enum ExecutionFlag { Normal, InitializeAndReturn };
     
    257260        void resetTimeoutCheck();
    258261
    259         bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; }
    260         bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; }
    261        
    262262        void tryCacheGetByID(ExecState*, CodeBlock*, Instruction* vPC, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&);
    263263        void uncacheGetByID(CodeBlock*, Instruction* vPC);
  • trunk/JavaScriptCore/kjs/Arguments.cpp

    r36263 r36726  
    3939// ECMA 10.1.8
    4040Arguments::Arguments(ExecState* exec, JSFunction* function, const ArgList& args, JSActivation* activation)
    41     : JSObject(exec->lexicalGlobalObject()->objectPrototype())
     41    : JSObject(exec->lexicalGlobalObject()->argumentsStructure())
    4242    , d(new ArgumentsData(activation, function, args))
    4343{
  • trunk/JavaScriptCore/kjs/ArrayConstructor.cpp

    r36263 r36726  
    2626
    2727#include "ArrayPrototype.h"
    28 #include "FunctionPrototype.h"
    2928#include "JSArray.h"
    3029#include "lookup.h"
     
    3433ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
    3534
    36 ArrayConstructor::ArrayConstructor(ExecState* exec, FunctionPrototype* functionPrototype, ArrayPrototype* arrayPrototype)
    37     : InternalFunction(exec, functionPrototype, Identifier(exec, arrayPrototype->classInfo()->className))
     35ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<StructureID> structure, ArrayPrototype* arrayPrototype)
     36    : InternalFunction(exec, structure, Identifier(exec, arrayPrototype->classInfo()->className))
    3837{
    3938    // ECMA 15.4.3.1 Array.prototype
     
    5150        if (n != args.at(exec, 0)->toNumber(exec))
    5251            return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
    53         return new (exec) JSArray(exec->lexicalGlobalObject()->arrayPrototype(), n);
     52        return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n);
    5453    }
    5554
    5655    // otherwise the array is constructed with the arguments in it
    57     return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayPrototype(), args);
     56    return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayStructure(), args);
    5857}
    5958
  • trunk/JavaScriptCore/kjs/ArrayConstructor.h

    r36263 r36726  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2727
    2828    class ArrayPrototype;
    29     class FunctionPrototype;
    3029
    3130    class ArrayConstructor : public InternalFunction {
    3231    public:
    33         ArrayConstructor(ExecState*, FunctionPrototype*, ArrayPrototype*);
     32        ArrayConstructor(ExecState*, PassRefPtr<StructureID>, ArrayPrototype*);
    3433
    3534        virtual ConstructType getConstructData(ConstructData&);
  • trunk/JavaScriptCore/kjs/ArrayPrototype.cpp

    r36263 r36726  
    9292
    9393// ECMA 15.4.4
    94 ArrayPrototype::ArrayPrototype(ExecState*, ObjectPrototype* objectPrototype)
    95     : JSArray(objectPrototype, 0)
     94ArrayPrototype::ArrayPrototype(PassRefPtr<StructureID> structure)
     95    : JSArray(structure)
    9696{
    9797}
  • trunk/JavaScriptCore/kjs/ArrayPrototype.h

    r36263 r36726  
    2929    class ArrayPrototype : public JSArray {
    3030    public:
    31         ArrayPrototype(ExecState*, ObjectPrototype*);
     31        explicit ArrayPrototype(PassRefPtr<StructureID>);
    3232
    3333        bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
  • trunk/JavaScriptCore/kjs/BooleanConstructor.cpp

    r36263 r36726  
    2929ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
    3030
    31 BooleanConstructor::BooleanConstructor(ExecState* exec, FunctionPrototype* functionPrototype, BooleanPrototype* booleanPrototype)
    32     : InternalFunction(exec, functionPrototype, Identifier(exec, booleanPrototype->classInfo()->className))
     31BooleanConstructor::BooleanConstructor(ExecState* exec, PassRefPtr<StructureID> structure, BooleanPrototype* booleanPrototype)
     32    : InternalFunction(exec, structure, Identifier(exec, booleanPrototype->classInfo()->className))
    3333{
    3434    putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
     
    4141JSObject* constructBoolean(ExecState* exec, const ArgList& args)
    4242{
    43     BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanPrototype());
     43    BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
    4444    obj->setInternalValue(jsBoolean(args.at(exec, 0)->toBoolean(exec)));
    4545    return obj;
     
    7171JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValue* immediateBooleanValue)
    7272{
    73     BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanPrototype());
     73    BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
    7474    obj->setInternalValue(immediateBooleanValue);
    7575    return obj;
  • trunk/JavaScriptCore/kjs/BooleanConstructor.h

    r36263 r36726  
    2727
    2828    class BooleanPrototype;
    29     class FunctionPrototype;
    3029
    3130    class BooleanConstructor : public InternalFunction {
    3231    public:
    33         BooleanConstructor(ExecState*, FunctionPrototype*, BooleanPrototype*);
     32        BooleanConstructor(ExecState*, PassRefPtr<StructureID>, BooleanPrototype*);
    3433
    3534    private:
  • trunk/JavaScriptCore/kjs/BooleanObject.cpp

    r36263 r36726  
    2828const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
    2929
    30 BooleanObject::BooleanObject(JSObject* prototype)
    31     : JSWrapperObject(prototype)
     30BooleanObject::BooleanObject(PassRefPtr<StructureID> structure)
     31    : JSWrapperObject(structure)
    3232{
    3333}
  • trunk/JavaScriptCore/kjs/BooleanObject.h

    r36263 r36726  
    2828    class BooleanObject : public JSWrapperObject {
    2929    public:
    30         BooleanObject(JSObject* prototype);
     30        explicit BooleanObject(PassRefPtr<StructureID>);
    3131
    3232        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/JavaScriptCore/kjs/BooleanPrototype.cpp

    r36263 r36726  
    2323
    2424#include "Error.h"
    25 #include "FunctionPrototype.h"
    2625#include "JSString.h"
    2726#include "ObjectPrototype.h"
     
    3837// ECMA 15.6.4
    3938
    40 BooleanPrototype::BooleanPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
    41     : BooleanObject(objectPrototype)
     39BooleanPrototype::BooleanPrototype(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure)
     40    : BooleanObject(structure)
    4241{
    4342    setInternalValue(jsBoolean(false));
    4443
    45     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
    46     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
     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);
    4746}
    4847
  • trunk/JavaScriptCore/kjs/BooleanPrototype.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    29     class ObjectPrototype;
    30 
    3128    class BooleanPrototype : public BooleanObject {
    3229    public:
    33         BooleanPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     30        BooleanPrototype(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure);
    3431    };
    3532
  • trunk/JavaScriptCore/kjs/DateConstructor.cpp

    r36263 r36726  
    5252static JSValue* dateUTC(ExecState*, JSObject*, JSValue*, const ArgList&);
    5353
    54 DateConstructor::DateConstructor(ExecState* exec, FunctionPrototype* functionPrototype, DatePrototype* datePrototype)
    55     : InternalFunction(exec, functionPrototype, Identifier(exec, datePrototype->classInfo()->className))
     54DateConstructor::DateConstructor(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure, DatePrototype* datePrototype)
     55    : InternalFunction(exec, structure, Identifier(exec, datePrototype->classInfo()->className))
    5656{
    5757      putDirect(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
    5858
    59       putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().parse, dateParse), DontEnum);
    60       putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
    61       putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().now, dateNow), DontEnum);
     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);
    6262
    6363      putDirect(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete);
     
    107107    }
    108108
    109     DateInstance* ret = new (exec) DateInstance(exec->lexicalGlobalObject()->datePrototype());
    110     ret->setInternalValue(jsNumber(exec, timeClip(value)));
    111     return ret;
     109    DateInstance* result = new (exec) DateInstance(exec->lexicalGlobalObject()->dateStructure());
     110    result->setInternalValue(jsNumber(exec, timeClip(value)));
     111    return result;
    112112}
    113113
  • trunk/JavaScriptCore/kjs/DateConstructor.h

    r36263 r36726  
    2727
    2828    class DatePrototype;
    29     class FunctionPrototype;
    3029
    3130    class DateConstructor : public InternalFunction {
    3231    public:
    33         DateConstructor(ExecState*, FunctionPrototype*, DatePrototype*);
     32        DateConstructor(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure, DatePrototype*);
    3433
    3534    private:
  • trunk/JavaScriptCore/kjs/DateInstance.cpp

    r36263 r36726  
    3838const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
    3939
    40 DateInstance::DateInstance(JSObject* prototype)
    41     : JSWrapperObject(prototype)
     40DateInstance::DateInstance(PassRefPtr<StructureID> structure)
     41    : JSWrapperObject(structure)
    4242    , m_cache(0)
    4343{
  • trunk/JavaScriptCore/kjs/DateInstance.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    29     class ObjectPrototype;
    3028    struct GregorianDateTime;
    3129
    3230    class DateInstance : public JSWrapperObject {
    3331    public:
    34         DateInstance(JSObject* prototype);
     32        explicit DateInstance(PassRefPtr<StructureID>);
    3533        virtual ~DateInstance();
    3634
  • trunk/JavaScriptCore/kjs/DatePrototype.cpp

    r36263 r36726  
    346346// ECMA 15.9.4
    347347
    348 DatePrototype::DatePrototype(ExecState* exec, ObjectPrototype* objectPrototype)
    349     : DateInstance(objectPrototype)
     348DatePrototype::DatePrototype(ExecState* exec, PassRefPtr<StructureID> structure)
     349    : DateInstance(structure)
    350350{
    351351    setInternalValue(jsNaN(exec));
  • trunk/JavaScriptCore/kjs/DatePrototype.h

    r36263 r36726  
    3030    class DatePrototype : public DateInstance {
    3131    public:
    32         DatePrototype(ExecState*, ObjectPrototype*);
     32        DatePrototype(ExecState*, PassRefPtr<StructureID>);
    3333
    3434        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
  • trunk/JavaScriptCore/kjs/ErrorConstructor.cpp

    r36263 r36726  
    2424#include "ErrorInstance.h"
    2525#include "ErrorPrototype.h"
    26 #include "FunctionPrototype.h"
    2726#include "JSGlobalObject.h"
    2827#include "JSString.h"
     
    3231ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
    3332
    34 ErrorConstructor::ErrorConstructor(ExecState* exec, FunctionPrototype* functionPrototype, ErrorPrototype* errorPrototype)
    35     : InternalFunction(exec, functionPrototype, Identifier(exec, errorPrototype->classInfo()->className))
     33ErrorConstructor::ErrorConstructor(ExecState* exec, PassRefPtr<StructureID> structure, ErrorPrototype* errorPrototype)
     34    : InternalFunction(exec, structure, Identifier(exec, errorPrototype->classInfo()->className))
    3635{
    3736    // ECMA 15.11.3.1 Error.prototype
     
    4342static ErrorInstance* constructError(ExecState* exec, const ArgList& args)
    4443{
    45     ErrorInstance* obj = new (exec) ErrorInstance(exec->lexicalGlobalObject()->errorPrototype());
     44    ErrorInstance* obj = new (exec) ErrorInstance(exec->lexicalGlobalObject()->errorStructure());
    4645    if (!args.at(exec, 0)->isUndefined())
    4746        obj->putDirect(exec->propertyNames().message, jsString(exec, args.at(exec, 0)->toString(exec)));
  • trunk/JavaScriptCore/kjs/ErrorConstructor.h

    r36263 r36726  
    2727
    2828    class ErrorPrototype;
    29     class FunctionPrototype;
    3029
    3130    class ErrorConstructor : public InternalFunction {
    3231    public:
    33         ErrorConstructor(ExecState*, FunctionPrototype*, ErrorPrototype*);
     32        ErrorConstructor(ExecState*, PassRefPtr<StructureID>, ErrorPrototype*);
    3433
    3534    private:
  • trunk/JavaScriptCore/kjs/ErrorInstance.cpp

    r36263 r36726  
    2626const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 };
    2727
    28 ErrorInstance::ErrorInstance(JSObject* prototype)
    29     : JSObject(prototype)
     28ErrorInstance::ErrorInstance(PassRefPtr<StructureID> structure)
     29    : JSObject(structure)
    3030{
    3131}
  • trunk/JavaScriptCore/kjs/ErrorInstance.h

    r36263 r36726  
    2828    class ErrorInstance : public JSObject {
    2929    public:
    30         ErrorInstance(JSObject* prototype);
     30        explicit ErrorInstance(PassRefPtr<StructureID>);
    3131
    3232        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/JavaScriptCore/kjs/ErrorPrototype.cpp

    r36263 r36726  
    2222#include "ErrorPrototype.h"
    2323
    24 #include "FunctionPrototype.h"
    2524#include "JSString.h"
    2625#include "ObjectPrototype.h"
     
    3534
    3635// ECMA 15.9.4
    37 ErrorPrototype::ErrorPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
    38     : ErrorInstance(objectPrototype)
     36ErrorPrototype::ErrorPrototype(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure)
     37    : ErrorInstance(structure)
    3938{
    4039    // The constructor will be added later in ErrorConstructor's constructor
     
    4342    putDirect(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
    4443
    45     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
     44    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
    4645}
    4746
  • trunk/JavaScriptCore/kjs/ErrorPrototype.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    2928    class ObjectPrototype;
    3029
    3130    class ErrorPrototype : public ErrorInstance {
    3231    public:
    33         ErrorPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     32        ErrorPrototype(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure);
    3433    };
    3534
  • trunk/JavaScriptCore/kjs/FunctionConstructor.cpp

    r36263 r36726  
    3535ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
    3636
    37 FunctionConstructor::FunctionConstructor(ExecState* exec, FunctionPrototype* functionPrototype)
    38     : InternalFunction(exec, functionPrototype, Identifier(exec, functionPrototype->classInfo()->className))
     37FunctionConstructor::FunctionConstructor(ExecState* exec, PassRefPtr<StructureID> structure, FunctionPrototype* functionPrototype)
     38    : InternalFunction(exec, structure, Identifier(exec, functionPrototype->classInfo()->className))
    3939{
    4040    putDirect(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
  • trunk/JavaScriptCore/kjs/FunctionConstructor.h

    r36263 r36726  
    11/*
    2  *  This file is part of the KDE libraries
    32 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    4  *  Copyright (C) 2006 Apple Computer, Inc.
     3 *  Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    54 *
    65 *  This library is free software; you can redistribute it and/or
     
    3130    class FunctionConstructor : public InternalFunction {
    3231    public:
    33         FunctionConstructor(ExecState*, FunctionPrototype*);
     32        FunctionConstructor(ExecState*, PassRefPtr<StructureID>, FunctionPrototype*);
    3433
    3534    private:
  • trunk/JavaScriptCore/kjs/FunctionPrototype.cpp

    r36263 r36726  
    4040{
    4141    putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
     42}
    4243
    43     putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
    44     putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
    45     putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
     44void FunctionPrototype::addFunctionProperties(ExecState* exec, StructureID* prototypeFunctionStructure)
     45{
     46    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
     47    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
     48    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
    4649}
    4750
  • trunk/JavaScriptCore/kjs/FunctionPrototype.h

    r36263 r36726  
    11/*
    2  *  This file is part of the KDE libraries
    32 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    4  *  Copyright (C) 2006 Apple Computer, Inc.
     3 *  Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    54 *
    65 *  This library is free software; you can redistribute it and/or
     
    3029    public:
    3130        FunctionPrototype(ExecState*);
     31        void addFunctionProperties(ExecState*, StructureID* prototypeFunctionStructure);
    3232
    3333    private:
  • trunk/JavaScriptCore/kjs/GlobalEvalFunction.cpp

    r36263 r36726  
    2626#include "GlobalEvalFunction.h"
    2727
    28 #include "FunctionPrototype.h"
    2928#include "JSGlobalObject.h"
    3029#include <wtf/Assertions.h>
     
    3433ASSERT_CLASS_FITS_IN_CELL(GlobalEvalFunction);
    3534
    36 GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
    37     : PrototypeFunction(exec, functionPrototype, len, name, function)
     35GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, PassRefPtr<StructureID> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
     36    : PrototypeFunction(exec, structure, len, name, function)
    3837    , m_cachedGlobalObject(cachedGlobalObject)
    3938{
  • trunk/JavaScriptCore/kjs/GlobalEvalFunction.h

    r36263 r36726  
    2929namespace JSC {
    3030
    31     class ExecState;
    32     class FunctionPrototype;
    3331    class JSGlobalObject;
    3432
    3533    class GlobalEvalFunction : public PrototypeFunction {
    3634    public:
    37         GlobalEvalFunction(ExecState*, FunctionPrototype*, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
     35        GlobalEvalFunction(ExecState*, PassRefPtr<StructureID>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
    3836        JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; }
    3937
  • trunk/JavaScriptCore/kjs/InternalFunction.cpp

    r36263 r36726  
    3939}
    4040
    41 InternalFunction::InternalFunction(ExecState* exec, FunctionPrototype* prototype, const Identifier& name)
    42     : JSObject(prototype)
     41InternalFunction::InternalFunction(ExecState* exec, PassRefPtr<StructureID> structure, const Identifier& name)
     42    : JSObject(structure)
    4343{
    4444    putDirect(exec->propertyNames().name, jsString(exec, name.ustring()), DontDelete | ReadOnly | DontEnum);
  • trunk/JavaScriptCore/kjs/InternalFunction.h

    r36263 r36726  
    4040
    4141    protected:
    42         InternalFunction(PassRefPtr<JSC::StructureID> st) : JSObject(st){}
     42        InternalFunction(PassRefPtr<StructureID> structure) : JSObject(structure) { }
    4343        InternalFunction(ExecState*);
    44         InternalFunction(ExecState*, FunctionPrototype*, const Identifier&);
     44        InternalFunction(ExecState*, PassRefPtr<StructureID>, const Identifier&);
    4545
    4646    private:
  • trunk/JavaScriptCore/kjs/JSArray.cpp

    r36263 r36726  
    139139}
    140140
    141 JSArray::JSArray(JSObject* prototype, unsigned initialLength)
    142     : JSObject(prototype)
     141JSArray::JSArray(PassRefPtr<StructureID> structure, unsigned initialLength)
     142    : JSObject(structure)
    143143{
    144144    unsigned initialCapacity = min(initialLength, MIN_SPARSE_ARRAY_INDEX);
     
    154154}
    155155
    156 JSArray::JSArray(ExecState* exec, JSObject* prototype, const ArgList& list)
    157     : JSObject(prototype)
     156JSArray::JSArray(ExecState* exec, PassRefPtr<StructureID> structure, const ArgList& list)
     157    : JSObject(structure)
    158158{
    159159    unsigned length = list.size();
     
    888888JSArray* constructEmptyArray(ExecState* exec)
    889889{
    890     return new (exec) JSArray(exec->lexicalGlobalObject()->arrayPrototype(), 0);
     890    return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure());
    891891}
    892892
    893893JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)
    894894{
    895     return new (exec) JSArray(exec->lexicalGlobalObject()->arrayPrototype(), initialLength);
     895    return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength);
    896896}
    897897
     
    900900    ArgList values;
    901901    values.append(singleItemValue);
    902     return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayPrototype(), values);
     902    return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayStructure(), values);
    903903}
    904904
    905905JSArray* constructArray(ExecState* exec, const ArgList& values)
    906906{
    907     return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayPrototype(), values);
     907    return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayStructure(), values);
    908908}
    909909
  • trunk/JavaScriptCore/kjs/JSArray.h

    r36263 r36726  
    4141
    4242    public:
    43         JSArray(PassRefPtr<StructureID>);
    44         JSArray(JSObject* prototype, unsigned initialLength);
    45         JSArray(ExecState* exec, JSObject* prototype, const ArgList& initialValues);
     43        explicit JSArray(PassRefPtr<StructureID>);
     44        JSArray(PassRefPtr<StructureID>, unsigned initialLength);
     45        JSArray(ExecState*, PassRefPtr<StructureID>, const ArgList& initialValues);
    4646        virtual ~JSArray();
    4747
  • trunk/JavaScriptCore/kjs/JSCell.h

    r36475 r36726  
    4141        friend class CTI;
    4242    private:
    43         JSCell(StructureID*);
     43        explicit JSCell(StructureID*);
    4444        virtual ~JSCell();
    4545
  • trunk/JavaScriptCore/kjs/JSFunction.cpp

    r36263 r36726  
    4646
    4747JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode)
    48     : Base(exec, exec->lexicalGlobalObject()->functionPrototype(), name)
     48    : Base(exec, exec->lexicalGlobalObject()->functionStructure(), name)
    4949    , m_body(body)
    5050    , m_scopeChain(scopeChainNode)
     
    159159JSObject* JSFunction::construct(ExecState* exec, const ArgList& args)
    160160{
    161     JSObject* proto;
    162     JSValue* p = get(exec, exec->propertyNames().prototype);
    163     if (p->isObject())
    164         proto = static_cast<JSObject*>(p);
     161    StructureID* structure;
     162    JSValue* prototype = get(exec, exec->propertyNames().prototype);
     163    if (prototype->isObject())
     164        structure = static_cast<JSObject*>(prototype)->inheritorID();
    165165    else
    166         proto = exec->lexicalGlobalObject()->objectPrototype();
    167 
    168     JSObject* thisObj = new (exec) JSObject(proto);
     166        structure = exec->lexicalGlobalObject()->emptyObjectStructure();
     167    JSObject* thisObj = new (exec) JSObject(structure);
    169168
    170169    JSValue* result = exec->machine()->execute(m_body.get(), exec, this, thisObj, args, m_scopeChain.node(), exec->exceptionSlot());
  • trunk/JavaScriptCore/kjs/JSGlobalObject.cpp

    r36263 r36726  
    7878}
    7979
     80static inline void markIfNeeded(const RefPtr<StructureID>& s)
     81{
     82    if (s)
     83        s->mark();
     84}
     85
    8086JSGlobalObject::~JSGlobalObject()
    8187{
     
    192198    setRegisterArray(0, 0);
    193199
     200    ExecState* exec = d()->globalExec.get();
     201
    194202    // Prototypes
    195     d()->functionPrototype = 0;
    196     d()->objectPrototype = 0;
    197 
    198     d()->arrayPrototype = 0;
    199     d()->stringPrototype = 0;
    200     d()->booleanPrototype = 0;
    201     d()->numberPrototype = 0;
    202     d()->datePrototype = 0;
    203     d()->regExpPrototype = 0;
    204     d()->errorPrototype = 0;
    205    
    206     d()->evalErrorPrototype = 0;
    207     d()->rangeErrorPrototype = 0;
    208     d()->referenceErrorPrototype = 0;
    209     d()->syntaxErrorPrototype = 0;
    210     d()->typeErrorPrototype = 0;
    211     d()->URIErrorPrototype = 0;
     203
     204    d()->functionPrototype = new (exec) FunctionPrototype(exec);
     205    d()->functionStructure = StructureID::create(d()->functionPrototype);
     206    d()->callbackFunctionStructure = StructureID::create(d()->functionPrototype);
     207    d()->prototypeFunctionStructure = StructureID::create(d()->functionPrototype);
     208    d()->callbackFunctionStructure = StructureID::create(d()->functionPrototype);
     209    d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get());
     210    d()->objectPrototype = new (exec) ObjectPrototype(exec, d()->prototypeFunctionStructure.get());
     211    d()->emptyObjectStructure = d()->objectPrototype->inheritorID();
     212    d()->functionPrototype->setPrototype(d()->objectPrototype);
     213    d()->argumentsStructure = StructureID::create(d()->objectPrototype);
     214    d()->callbackConstructorStructure = StructureID::create(d()->objectPrototype);
     215    d()->callbackObjectStructure = StructureID::create(d()->objectPrototype);
     216    d()->arrayPrototype = new (exec) ArrayPrototype(StructureID::create(d()->objectPrototype));
     217    d()->arrayStructure = StructureID::create(d()->arrayPrototype);
     218    d()->regExpMatchesArrayStructure = StructureID::create(d()->arrayPrototype);
     219    d()->stringPrototype = new (exec) StringPrototype(exec, StructureID::create(d()->objectPrototype));
     220    d()->stringObjectStructure = StructureID::create(d()->stringPrototype);
     221    d()->booleanPrototype = new (exec) BooleanPrototype(exec, StructureID::create(d()->objectPrototype), d()->prototypeFunctionStructure.get());
     222    d()->booleanObjectStructure = StructureID::create(d()->booleanPrototype);
     223    d()->numberPrototype = new (exec) NumberPrototype(exec, StructureID::create(d()->objectPrototype), d()->prototypeFunctionStructure.get());
     224    d()->numberObjectStructure = StructureID::create(d()->numberPrototype);
     225    d()->datePrototype = new (exec) DatePrototype(exec, StructureID::create(d()->objectPrototype));
     226    d()->dateStructure = StructureID::create(d()->datePrototype);
     227    d()->regExpPrototype = new (exec) RegExpPrototype(exec, StructureID::create(d()->objectPrototype), d()->prototypeFunctionStructure.get());
     228    d()->regExpStructure = StructureID::create(d()->regExpPrototype);
     229    ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, StructureID::create(d()->objectPrototype), d()->prototypeFunctionStructure.get());
     230    d()->errorStructure = StructureID::create(errorPrototype);
     231
     232    RefPtr<StructureID> nativeErrorPrototypeStructure = StructureID::create(errorPrototype);
     233
     234    NativeErrorPrototype* evalErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "EvalError", "EvalError");
     235    NativeErrorPrototype* rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "RangeError", "RangeError");
     236    NativeErrorPrototype* referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "ReferenceError", "ReferenceError");
     237    NativeErrorPrototype* syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "SyntaxError", "SyntaxError");
     238    NativeErrorPrototype* typeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "TypeError", "TypeError");
     239    NativeErrorPrototype* URIErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "URIError", "URIError");
    212240
    213241    // Constructors
    214     d()->regExpConstructor = 0;
    215     d()->errorConstructor = 0;
    216    
    217     d()->evalErrorConstructor = 0;
    218     d()->rangeErrorConstructor = 0;
    219     d()->referenceErrorConstructor = 0;
    220     d()->syntaxErrorConstructor = 0;
    221     d()->typeErrorConstructor = 0;
    222     d()->URIErrorConstructor = 0;
    223 
    224     d()->evalFunction = 0;
    225 
    226     ExecState* exec = d()->globalExec.get();
    227 
    228     // Prototypes
    229 
    230     d()->functionPrototype = new (exec) FunctionPrototype(exec);
    231     d()->objectPrototype = new (exec) ObjectPrototype(exec, d()->functionPrototype);
    232     d()->functionPrototype->setPrototype(d()->objectPrototype);
    233 
    234     d()->arrayPrototype = new (exec) ArrayPrototype(exec, d()->objectPrototype);
    235     d()->stringPrototype = new (exec) StringPrototype(exec, d()->objectPrototype);
    236     d()->booleanPrototype = new (exec) BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
    237     d()->numberPrototype = new (exec) NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
    238     d()->datePrototype = new (exec) DatePrototype(exec, d()->objectPrototype);
    239     d()->regExpPrototype = new (exec) RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);
    240     d()->errorPrototype = new (exec) ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
    241    
    242     d()->evalErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "EvalError", "EvalError");
    243     d()->rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "RangeError", "RangeError");
    244     d()->referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "ReferenceError", "ReferenceError");
    245     d()->syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "SyntaxError", "SyntaxError");
    246     d()->typeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "TypeError", "TypeError");
    247     d()->URIErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "URIError", "URIError");
    248 
    249     // Constructors
    250 
    251     JSValue* objectConstructor = new (exec) ObjectConstructor(exec, d()->objectPrototype, d()->functionPrototype);
    252     JSValue* functionConstructor = new (exec) FunctionConstructor(exec, d()->functionPrototype);
    253     JSValue* arrayConstructor = new (exec) ArrayConstructor(exec, d()->functionPrototype, d()->arrayPrototype);
    254     JSValue* stringConstructor = new (exec) StringConstructor(exec, d()->functionPrototype, d()->stringPrototype);
    255     JSValue* booleanConstructor = new (exec) BooleanConstructor(exec, d()->functionPrototype, d()->booleanPrototype);
    256     JSValue* numberConstructor = new (exec) NumberConstructor(exec, d()->functionPrototype, d()->numberPrototype);
    257     JSValue* dateConstructor = new (exec) DateConstructor(exec, d()->functionPrototype, d()->datePrototype);
    258 
    259     d()->regExpConstructor = new (exec) RegExpConstructor(exec, d()->functionPrototype, d()->regExpPrototype);
    260 
    261     d()->errorConstructor = new (exec) ErrorConstructor(exec, d()->functionPrototype, d()->errorPrototype);
    262    
    263     d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->evalErrorPrototype);
    264     d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->rangeErrorPrototype);
    265     d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->referenceErrorPrototype);
    266     d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
    267     d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->typeErrorPrototype);
    268     d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->URIErrorPrototype);
     242
     243    JSValue* objectConstructor = new (exec) ObjectConstructor(exec, StructureID::create(d()->functionPrototype), d()->objectPrototype);
     244    JSValue* functionConstructor = new (exec) FunctionConstructor(exec, StructureID::create(d()->functionPrototype), d()->functionPrototype);
     245    JSValue* arrayConstructor = new (exec) ArrayConstructor(exec, StructureID::create(d()->functionPrototype), d()->arrayPrototype);
     246    JSValue* stringConstructor = new (exec) StringConstructor(exec, StructureID::create(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
     247    JSValue* booleanConstructor = new (exec) BooleanConstructor(exec, StructureID::create(d()->functionPrototype), d()->booleanPrototype);
     248    JSValue* numberConstructor = new (exec) NumberConstructor(exec, StructureID::create(d()->functionPrototype), d()->numberPrototype);
     249    JSValue* dateConstructor = new (exec) DateConstructor(exec, StructureID::create(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->datePrototype);
     250
     251    d()->regExpConstructor = new (exec) RegExpConstructor(exec, StructureID::create(d()->functionPrototype), d()->regExpPrototype);
     252
     253    d()->errorConstructor = new (exec) ErrorConstructor(exec, StructureID::create(d()->functionPrototype), errorPrototype);
     254
     255    RefPtr<StructureID> nativeErrorStructure = StructureID::create(d()->functionPrototype);
     256
     257    d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype);
     258    d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype);
     259    d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, referenceErrorPrototype);
     260    d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, syntaxErrorPrototype);
     261    d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, typeErrorPrototype);
     262    d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, URIErrorPrototype);
    269263   
    270264    d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);
     
    278272    d()->datePrototype->putDirect(exec->propertyNames().constructor, dateConstructor, DontEnum);
    279273    d()->regExpPrototype->putDirect(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
    280     d()->errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
    281     d()->evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
    282     d()->rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
    283     d()->referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
    284     d()->syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
    285     d()->typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
    286     d()->URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum);
     274    errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
     275    evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
     276    rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
     277    referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
     278    syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
     279    typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
     280    URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum);
    287281
    288282    // Set global constructors
     
    308302    // Set global values.
    309303    GlobalPropertyInfo staticGlobals[] = {
    310         GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, d()->objectPrototype), DontEnum | DontDelete),
     304        GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, StructureID::create(d()->objectPrototype)), DontEnum | DontDelete),
    311305        GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete),
    312306        GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete),
     
    318312    // Set global functions.
    319313
    320     d()->evalFunction = new (exec) GlobalEvalFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
     314    d()->evalFunction = new (exec) GlobalEvalFunction(exec, StructureID::create(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
    321315    putDirectFunction(exec, d()->evalFunction, DontEnum);
    322     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
    323     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
    324     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
    325     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
    326     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
    327     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
    328     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
    329     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
    330     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
    331     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), 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);
    332326#ifndef NDEBUG
    333     putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
     327    putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
    334328#endif
    335329
     
    381375    markIfNeeded(d()->typeErrorConstructor);
    382376    markIfNeeded(d()->URIErrorConstructor);
    383    
     377
    384378    markIfNeeded(d()->evalFunction);
    385    
     379
    386380    markIfNeeded(d()->objectPrototype);
    387381    markIfNeeded(d()->functionPrototype);
    388     markIfNeeded(d()->arrayPrototype);
    389382    markIfNeeded(d()->booleanPrototype);
    390383    markIfNeeded(d()->stringPrototype);
     
    392385    markIfNeeded(d()->datePrototype);
    393386    markIfNeeded(d()->regExpPrototype);
    394     markIfNeeded(d()->errorPrototype);
    395     markIfNeeded(d()->evalErrorPrototype);
    396     markIfNeeded(d()->rangeErrorPrototype);
    397     markIfNeeded(d()->referenceErrorPrototype);
    398     markIfNeeded(d()->syntaxErrorPrototype);
    399     markIfNeeded(d()->typeErrorPrototype);
    400     markIfNeeded(d()->URIErrorPrototype);
     387
     388    markIfNeeded(d()->errorStructure);
     389
     390    // No need to mark the other structures, because their prototypes are all
     391    // guaranteed to be referenced elsewhere.
    401392}
    402393
  • trunk/JavaScriptCore/kjs/JSGlobalObject.h

    r36675 r36726  
    3737    class Debugger;
    3838    class ErrorConstructor;
    39     class ErrorPrototype;
    40     class EvalError;
    41     class EvalErrorPrototype;
    4239    class FunctionPrototype;
    4340    class GlobalEvalFunction;
    44     class JSGlobalObject;
    4541    class NativeErrorConstructor;
    46     class NativeErrorPrototype;
    47     class NumberPrototype;
    48     class ObjectPrototype;
    4942    class ProgramCodeBlock;
    50     class RangeError;
    51     class RangeErrorPrototype;
    52     class ReferenceError;
    53     class ReferenceError;
    54     class ReferenceErrorPrototype;
    5543    class RegExpConstructor;
    5644    class RegExpPrototype;
    5745    class RegisterFile;
    58     class RuntimeMethod;
    59     class ScopeChain;
    60     class StringPrototype;
    61     class SyntaxErrorPrototype;
    62     class TypeError;
    63     class TypeErrorPrototype;
    64     class UriError;
    65     class UriErrorPrototype;
    6646
    6747    struct ActivationStackNode;
     
    7858                : JSVariableObjectData(&symbolTable, 0)
    7959                , globalScopeChain(globalObject, thisValue)
     60                , regExpConstructor(0)
     61                , errorConstructor(0)
     62                , evalErrorConstructor(0)
     63                , rangeErrorConstructor(0)
     64                , referenceErrorConstructor(0)
     65                , syntaxErrorConstructor(0)
     66                , typeErrorConstructor(0)
     67                , URIErrorConstructor(0)
     68                , evalFunction(0)
     69                , objectPrototype(0)
     70                , functionPrototype(0)
     71                , arrayPrototype(0)
     72                , booleanPrototype(0)
     73                , stringPrototype(0)
     74                , numberPrototype(0)
     75                , datePrototype(0)
     76                , regExpPrototype(0)
    8077            {
    8178            }
     
    114111            DatePrototype* datePrototype;
    115112            RegExpPrototype* regExpPrototype;
    116             ErrorPrototype* errorPrototype;
    117             NativeErrorPrototype* evalErrorPrototype;
    118             NativeErrorPrototype* rangeErrorPrototype;
    119             NativeErrorPrototype* referenceErrorPrototype;
    120             NativeErrorPrototype* syntaxErrorPrototype;
    121             NativeErrorPrototype* typeErrorPrototype;
    122             NativeErrorPrototype* URIErrorPrototype;
    123            
     113
     114            RefPtr<StructureID> argumentsStructure;
     115            RefPtr<StructureID> arrayStructure;
     116            RefPtr<StructureID> booleanObjectStructure;
     117            RefPtr<StructureID> callbackConstructorStructure;
     118            RefPtr<StructureID> callbackFunctionStructure;
     119            RefPtr<StructureID> callbackObjectStructure;
     120            RefPtr<StructureID> dateStructure;
     121            RefPtr<StructureID> emptyObjectStructure;
     122            RefPtr<StructureID> errorStructure;
     123            RefPtr<StructureID> functionStructure;
     124            RefPtr<StructureID> numberObjectStructure;
     125            RefPtr<StructureID> prototypeFunctionStructure;
     126            RefPtr<StructureID> regExpMatchesArrayStructure;
     127            RefPtr<StructureID> regExpStructure;
     128            RefPtr<StructureID> stringObjectStructure;
     129
    124130            SymbolTable symbolTable;
    125131            unsigned profileGroup;
     
    186192        DatePrototype* datePrototype() const { return d()->datePrototype; }
    187193        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
    188         ErrorPrototype* errorPrototype() const { return d()->errorPrototype; }
    189         NativeErrorPrototype* evalErrorPrototype() const { return d()->evalErrorPrototype; }
    190         NativeErrorPrototype* rangeErrorPrototype() const { return d()->rangeErrorPrototype; }
    191         NativeErrorPrototype* referenceErrorPrototype() const { return d()->referenceErrorPrototype; }
    192         NativeErrorPrototype* syntaxErrorPrototype() const { return d()->syntaxErrorPrototype; }
    193         NativeErrorPrototype* typeErrorPrototype() const { return d()->typeErrorPrototype; }
    194         NativeErrorPrototype* URIErrorPrototype() const { return d()->URIErrorPrototype; }
     194
     195        StructureID* argumentsStructure() const { return d()->argumentsStructure.get(); }
     196        StructureID* arrayStructure() const { return d()->arrayStructure.get(); }
     197        StructureID* booleanObjectStructure() const { return d()->booleanObjectStructure.get(); }
     198        StructureID* callbackConstructorStructure() const { return d()->callbackConstructorStructure.get(); }
     199        StructureID* callbackFunctionStructure() const { return d()->callbackFunctionStructure.get(); }
     200        StructureID* callbackObjectStructure() const { return d()->callbackObjectStructure.get(); }
     201        StructureID* dateStructure() const { return d()->dateStructure.get(); }
     202        StructureID* emptyObjectStructure() const { return d()->emptyObjectStructure.get(); }
     203        StructureID* errorStructure() const { return d()->errorStructure.get(); }
     204        StructureID* functionStructure() const { return d()->functionStructure.get(); }
     205        StructureID* numberObjectStructure() const { return d()->numberObjectStructure.get(); }
     206        StructureID* prototypeFunctionStructure() const { return d()->prototypeFunctionStructure.get(); }
     207        StructureID* regExpMatchesArrayStructure() const { return d()->regExpMatchesArrayStructure.get(); }
     208        StructureID* regExpStructure() const { return d()->regExpStructure.get(); }
     209        StructureID* stringObjectStructure() const { return d()->stringObjectStructure.get(); }
    195210
    196211        void setProfileGroup(unsigned value) { d()->profileGroup = value; }
  • trunk/JavaScriptCore/kjs/JSImmediate.cpp

    r36263 r36726  
    7474}
    7575
     76NEVER_INLINE double JSImmediate::nonInlineNaN()
     77{
     78    return std::numeric_limits<double>::quiet_NaN();
     79}
     80
    7681} // namespace JSC
  • trunk/JavaScriptCore/kjs/JSImmediate.h

    r36483 r36726  
    289289            return reinterpret_cast<uintptr_t>(v);
    290290        }
     291
     292        static double nonInlineNaN();
    291293    };
    292294
     
    406408    {
    407409        ASSERT(isImmediate(v));
     410        int i;
    408411        if (isNumber(v))
    409             return intValue(v);
    410         if (rawValue(v) == (FullTagTypeBool | ExtendedPayloadBitBoolValue))
    411             return 1.0;
    412         if (rawValue(v) != FullTagTypeUndefined)
    413             return 0.0;
    414         return std::numeric_limits<double>::quiet_NaN();
     412            i = intValue(v);
     413        else if (rawValue(v) == FullTagTypeUndefined)
     414            return nonInlineNaN();
     415        else
     416            i = rawValue(v) >> ExtendedPayloadShift;
     417        return i;
    415418    }
    416419
  • trunk/JavaScriptCore/kjs/JSNumberCell.cpp

    r36263 r36726  
    102102}
    103103
     104NEVER_INLINE JSValue* jsNumberCell(ExecState* exec, double d)
     105{
     106    return new (exec) JSNumberCell(exec, d);
     107}
     108
     109NEVER_INLINE JSValue* jsNaN(ExecState* exec)
     110{
     111    return new (exec) JSNumberCell(exec, NaN);
     112}
     113
    104114} // namespace JSC
  • trunk/JavaScriptCore/kjs/JSNumberCell.h

    r36316 r36726  
    4444    class JSNumberCell : public JSCell {
    4545        friend JSValue* jsNumberCell(ExecState*, double);
     46        friend JSValue* jsNaN(ExecState*);
    4647    public:
    4748        double value() const { return m_value; }
     
    8788    extern const double Inf;
    8889
    89     // Beware marking this function ALWAYS_INLINE: It takes a PIC branch, so
    90     // inlining it may not always be a win.
    91     inline JSValue* jsNumberCell(ExecState* exec, double d)
    92     {
    93         return new (exec) JSNumberCell(exec, d);
    94     }
    95 
    96     inline JSValue* jsNaN(ExecState* exec)
    97     {
    98         return jsNumberCell(exec, NaN);
    99     }
     90    JSValue* jsNumberCell(ExecState*, double);
     91    JSValue* jsNaN(ExecState*);
    10092
    10193    ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, double d)
  • trunk/JavaScriptCore/kjs/JSObject.cpp

    r36701 r36726  
    518518JSObject* constructEmptyObject(ExecState* exec)
    519519{
    520     return new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype());
     520    return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
    521521}
    522522
  • trunk/JavaScriptCore/kjs/JSObject.h

    r36436 r36726  
    5858
    5959    public:
    60         JSObject(PassRefPtr<StructureID>);
    61         JSObject(JSObject* prototype);
     60        explicit JSObject(PassRefPtr<StructureID>);
    6261
    6362        virtual void mark();
     
    198197  JSObject* constructEmptyObject(ExecState*);
    199198
    200 inline JSObject::JSObject(JSObject* prototype)
    201     : JSCell(prototype->inheritorID())
    202     , m_propertyStorage(m_inlineStorage)
    203 {
    204     ASSERT(m_structureID);
    205     ASSERT(this->prototype());
    206     ASSERT(this->prototype()->isNull() || Heap::heap(this) == Heap::heap(this->prototype()));
    207     m_structureID->ref(); // ~JSObject balances this ref()
    208 }
    209 
    210199inline JSObject::JSObject(PassRefPtr<StructureID> structureID)
    211200    : JSCell(structureID.releaseRef()) // ~JSObject balances this ref()
     
    213202{
    214203    ASSERT(m_structureID);
     204    ASSERT(prototype()->isNull() || Heap::heap(this) == Heap::heap(prototype()));
    215205}
    216206
  • trunk/JavaScriptCore/kjs/JSString.cpp

    r36368 r36726  
    7070inline StringObject* StringObject::create(ExecState* exec, JSString* string)
    7171{
    72     return new (exec) StringObject(exec->lexicalGlobalObject()->stringPrototype(), string);
     72    return new (exec) StringObject(exec->lexicalGlobalObject()->stringObjectStructure(), string);
    7373}
    7474
  • trunk/JavaScriptCore/kjs/JSWrapperObject.h

    r36475 r36726  
    2727namespace JSC {
    2828   
    29     /**
    30        This class is used as a base for classes such as String,
    31        Number, Boolean and Date which which are wrappers for primitive
    32        types. These classes stores the internal value, which is the
    33        actual value represented by the wrapper objects.
    34     */
     29    // This class is used as a base for classes such as String,
     30    // Number, Boolean and Date which are wrappers for primitive types.
    3531    class JSWrapperObject : public JSObject {
    3632    public:
    37         JSWrapperObject(JSObject* prototype);
     33        explicit JSWrapperObject(PassRefPtr<StructureID>);
    3834       
    39         JSValue* internalValue() const;
     35        JSValue* internalValue() const { return m_internalValue; }
    4036        void setInternalValue(JSValue*);
    4137       
     
    4642    };
    4743   
    48     inline JSWrapperObject::JSWrapperObject(JSObject* prototype)
    49         : JSObject(prototype)
     44    inline JSWrapperObject::JSWrapperObject(PassRefPtr<StructureID> structure)
     45        : JSObject(structure)
    5046        , m_internalValue(0)
    5147    {
    52     }
    53    
    54     inline JSValue* JSWrapperObject::internalValue() const
    55     {
    56         return m_internalValue;
    5748    }
    5849   
     
    6051    {
    6152        ASSERT(value);
     53        ASSERT(!value->isObject());
    6254        m_internalValue = value;
    6355    }
  • trunk/JavaScriptCore/kjs/MathObject.cpp

    r36286 r36726  
    8484*/
    8585
    86 MathObject::MathObject(ExecState* exec, ObjectPrototype* objectPrototype)
    87     : JSObject(objectPrototype)
     86MathObject::MathObject(ExecState* exec, PassRefPtr<StructureID> structure)
     87    : JSObject(structure)
    8888{
    8989    putDirect(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
  • trunk/JavaScriptCore/kjs/MathObject.h

    r36263 r36726  
    2222
    2323#include "JSObject.h"
    24 #include "lookup.h"
    2524
    2625namespace JSC {
     
    2827    class MathObject : public JSObject {
    2928    public:
    30         MathObject(ExecState*, ObjectPrototype*);
     29        MathObject(ExecState*, PassRefPtr<StructureID>);
    3130
    32         bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     31        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    3332
    3433        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/JavaScriptCore/kjs/NativeErrorConstructor.cpp

    r36263 r36726  
    2323
    2424#include "ErrorInstance.h"
    25 #include "FunctionPrototype.h"
    2625#include "JSFunction.h"
    2726#include "NativeErrorPrototype.h"
     
    3332const ClassInfo NativeErrorConstructor::info = { "Function", &InternalFunction::info, 0, 0 };
    3433
    35 NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, FunctionPrototype* functionPrototype, NativeErrorPrototype* nativeErrorPrototype)
    36     : InternalFunction(exec, functionPrototype, Identifier(exec, nativeErrorPrototype->getDirect(exec->propertyNames().name)->getString()))
    37     , m_proto(nativeErrorPrototype)
     34NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, PassRefPtr<StructureID> structure, NativeErrorPrototype* nativeErrorPrototype)
     35    : InternalFunction(exec, structure, Identifier(exec, nativeErrorPrototype->getDirect(exec->propertyNames().name)->getString()))
     36    , m_errorStructure(StructureID::create(nativeErrorPrototype))
    3837{
    3938    putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
    40     putDirect(exec->propertyNames().prototype, m_proto, DontDelete | ReadOnly | DontEnum);
     39    putDirect(exec->propertyNames().prototype, nativeErrorPrototype, DontDelete | ReadOnly | DontEnum);
    4140}
    4241
    4342ErrorInstance* NativeErrorConstructor::construct(ExecState* exec, const ArgList& args)
    4443{
    45     ErrorInstance* object = new (exec) ErrorInstance(m_proto);
     44    ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure);
    4645    if (!args.at(exec, 0)->isUndefined())
    4746        object->putDirect(exec->propertyNames().message, jsString(exec, args.at(exec, 0)->toString(exec)));
     
    7170}
    7271
    73 void NativeErrorConstructor::mark()
    74 {
    75     JSObject::mark();
    76     if (m_proto && !m_proto->marked())
    77         m_proto->mark();
    78 }
    79 
    8072} // namespace JSC
  • trunk/JavaScriptCore/kjs/NativeErrorConstructor.h

    r36263 r36726  
    3232    class NativeErrorConstructor : public InternalFunction {
    3333    public:
    34         NativeErrorConstructor(ExecState*, FunctionPrototype*, NativeErrorPrototype*);
    35 
    36         virtual void mark();
     34        NativeErrorConstructor(ExecState*, PassRefPtr<StructureID>, NativeErrorPrototype*);
    3735
    3836        static const ClassInfo info;
     
    4644        virtual const ClassInfo* classInfo() const { return &info; }
    4745
    48         NativeErrorPrototype* m_proto;
     46        RefPtr<StructureID> m_errorStructure;
    4947    };
    5048
  • trunk/JavaScriptCore/kjs/NativeErrorPrototype.cpp

    r36263 r36726  
    3030ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
    3131
    32 NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* errorPrototype, const UString& name, const UString& message)
    33     : JSObject(errorPrototype)
     32NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, PassRefPtr<StructureID> structure, const UString& name, const UString& message)
     33    : JSObject(structure)
    3434{
    3535    putDirect(exec->propertyNames().name, jsString(exec, name), 0);
  • trunk/JavaScriptCore/kjs/NativeErrorPrototype.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class ErrorPrototype;
    29     class UString;
    30 
    3128    class NativeErrorPrototype : public JSObject {
    3229    public:
    33         NativeErrorPrototype(ExecState*, ErrorPrototype*, const UString& name, const UString& message);
     30        NativeErrorPrototype(ExecState*, PassRefPtr<StructureID>, const UString& name, const UString& message);
    3431    };
    3532
  • trunk/JavaScriptCore/kjs/NumberConstructor.cpp

    r36263 r36726  
    4242@end
    4343*/
    44 NumberConstructor::NumberConstructor(ExecState* exec, FunctionPrototype* functionPrototype, NumberPrototype* numberPrototype)
    45     : InternalFunction(exec, functionPrototype, Identifier(exec, numberPrototype->info.className))
     44NumberConstructor::NumberConstructor(ExecState* exec, PassRefPtr<StructureID> structure, NumberPrototype* numberPrototype)
     45    : InternalFunction(exec, structure, Identifier(exec, numberPrototype->info.className))
    4646{
    4747    // Number.Prototype
     
    7979static JSObject* constructWithNumberConstructor(ExecState* exec, JSObject*, const ArgList& args)
    8080{
    81     NumberObject* obj = new (exec) NumberObject(exec->lexicalGlobalObject()->numberPrototype());
     81    NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
    8282    double n = args.isEmpty() ? 0 : args.at(exec, 0)->toNumber(exec);
    83     obj->setInternalValue(jsNumber(exec, n));
    84     return obj;
     83    object->setInternalValue(jsNumber(exec, n));
     84    return object;
    8585}
    8686
  • trunk/JavaScriptCore/kjs/NumberConstructor.h

    r36263 r36726  
    11/*
    2  *  This file is part of the KDE libraries
    32 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
     3 *  Copyright (C) 2008 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    2928    class NumberPrototype;
    3029
    3130    class NumberConstructor : public InternalFunction {
    3231    public:
    33         NumberConstructor(ExecState*, FunctionPrototype*, NumberPrototype*);
     32        NumberConstructor(ExecState*, PassRefPtr<StructureID>, NumberPrototype*);
    3433
    3534        bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
  • trunk/JavaScriptCore/kjs/NumberObject.cpp

    r36263 r36726  
    3232const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
    3333
    34 NumberObject::NumberObject(JSObject* prototype)
    35     : JSWrapperObject(prototype)
     34NumberObject::NumberObject(PassRefPtr<StructureID> structure)
     35    : JSWrapperObject(structure)
    3636{
    3737}
     
    4444NumberObject* constructNumber(ExecState* exec, JSNumberCell* number)
    4545{
    46     NumberObject* obj = new (exec) NumberObject(exec->lexicalGlobalObject()->numberPrototype());
    47     obj->setInternalValue(number);
    48     return obj;
     46    NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
     47    object->setInternalValue(number);
     48    return object;
    4949}
    5050
    5151NumberObject* constructNumberFromImmediateNumber(ExecState* exec, JSValue* value)
    5252{
    53     NumberObject* obj = new (exec) NumberObject(exec->lexicalGlobalObject()->numberPrototype());
    54     obj->setInternalValue(value);
    55     return obj;
     53    NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
     54    object->setInternalValue(value);
     55    return object;
    5656}
    5757
  • trunk/JavaScriptCore/kjs/NumberObject.h

    r36263 r36726  
    3030    class NumberObject : public JSWrapperObject {
    3131    public:
    32         NumberObject(JSObject* prototype);
     32        explicit NumberObject(PassRefPtr<StructureID>);
    3333
    3434        static const ClassInfo info;
  • trunk/JavaScriptCore/kjs/NumberPrototype.cpp

    r36263 r36726  
    2424
    2525#include "Error.h"
    26 #include "FunctionPrototype.h"
    2726#include "JSString.h"
    28 #include "ObjectPrototype.h"
    2927#include "PrototypeFunction.h"
    3028#include "dtoa.h"
     
    4745// ECMA 15.7.4
    4846
    49 NumberPrototype::NumberPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
    50     : NumberObject(objectPrototype)
     47NumberPrototype::NumberPrototype(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure)
     48    : NumberObject(structure)
    5149{
    5250    setInternalValue(jsNumber(exec, 0));
     
    5452    // The constructor will be added later, after NumberConstructor has been constructed
    5553
    56     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
    57     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
    58     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
    59     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
    60     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
    61     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
     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);
    6260}
    6361
  • trunk/JavaScriptCore/kjs/NumberPrototype.h

    r36263 r36726  
    11/*
    2  *  This file is part of the KDE libraries
    32 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
     3 *  Copyright (C) 2008 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    29     class ObjectPrototype;
    30 
    3128    class NumberPrototype : public NumberObject {
    3229    public:
    33         NumberPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     30        NumberPrototype(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure);
    3431    };
    3532
  • trunk/JavaScriptCore/kjs/ObjectConstructor.cpp

    r36263 r36726  
    2222#include "ObjectConstructor.h"
    2323
    24 #include "FunctionPrototype.h"
    2524#include "JSGlobalObject.h"
    2625#include "ObjectPrototype.h"
     
    3029ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
    3130
    32 ObjectConstructor::ObjectConstructor(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
    33     : InternalFunction(exec, functionPrototype, Identifier(exec, "Object"))
     31ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<StructureID> structure, ObjectPrototype* objectPrototype)
     32    : InternalFunction(exec, structure, Identifier(exec, "Object"))
    3433{
    3534    // ECMA 15.2.3.1
     
    4544    JSValue* arg = args.at(exec, 0);
    4645    if (arg->isUndefinedOrNull())
    47         return new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype());
     46        return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
    4847    return arg->toObject(exec);
    4948}
  • trunk/JavaScriptCore/kjs/ObjectConstructor.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    2928    class ObjectPrototype;
    3029
    3130    class ObjectConstructor : public InternalFunction {
    3231    public:
    33         ObjectConstructor(ExecState*, ObjectPrototype*, FunctionPrototype*);
     32        ObjectConstructor(ExecState*, PassRefPtr<StructureID>, ObjectPrototype*);
    3433
    3534    private:
  • trunk/JavaScriptCore/kjs/ObjectPrototype.cpp

    r36263 r36726  
    2323
    2424#include "Error.h"
    25 #include "FunctionPrototype.h"
    2625#include "JSString.h"
    2726#include "PrototypeFunction.h"
     
    4140static JSValue* objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue*, const ArgList&);
    4241
    43 ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* functionPrototype)
     42ObjectPrototype::ObjectPrototype(ExecState* exec, StructureID* prototypeFunctionStructure)
    4443    : JSObject(exec->globalData().nullProtoStructureID)
    4544{
    46     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
    47     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
    48     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
    49     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
    50     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
    51     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
     45    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
     46    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
     47    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
     48    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
     49    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
     50    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
    5251
    5352    // Mozilla extensions
    54     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
    55     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
    56     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
    57     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
     53    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
     54    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
     55    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
     56    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
    5857}
    59 
    6058
    6159// ------------------------------ Functions --------------------------------
  • trunk/JavaScriptCore/kjs/ObjectPrototype.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    29 
    30     /**
    31      * @internal
    32      *
    33      * The initial value of Object.prototype (and thus all objects created
    34      * with the Object constructor
    35      */
    3628    class ObjectPrototype : public JSObject {
    3729    public:
    38         ObjectPrototype(ExecState*, FunctionPrototype*);
     30        ObjectPrototype(ExecState*, StructureID* prototypeFunctionStructure);
    3931    };
    4032
  • trunk/JavaScriptCore/kjs/PrototypeFunction.cpp

    r36263 r36726  
    2626#include "PrototypeFunction.h"
    2727
    28 #include "FunctionPrototype.h"
    2928#include "JSGlobalObject.h"
    3029#include <wtf/Assertions.h>
     
    3534
    3635PrototypeFunction::PrototypeFunction(ExecState* exec, int length, const Identifier& name, NativeFunction function)
    37     : InternalFunction(exec, exec->lexicalGlobalObject()->functionPrototype(), name)
     36    : InternalFunction(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), name)
    3837    , m_function(function)
    3938{
     
    4241}
    4342
    44 PrototypeFunction::PrototypeFunction(ExecState* exec, FunctionPrototype* functionPrototype, int length, const Identifier& name, NativeFunction function)
    45     : InternalFunction(exec, functionPrototype, name)
     43PrototypeFunction::PrototypeFunction(ExecState* exec, PassRefPtr<StructureID> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
     44    : InternalFunction(exec, prototypeFunctionStructure, name)
    4645    , m_function(function)
    4746{
     
    4948    putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
    5049}
    51 
     50   
    5251CallType PrototypeFunction::getCallData(CallData& callData)
    5352{
  • trunk/JavaScriptCore/kjs/PrototypeFunction.h

    r36263 r36726  
    3333    public:
    3434        PrototypeFunction(ExecState*, int length, const Identifier&, NativeFunction);
    35         PrototypeFunction(ExecState*, FunctionPrototype*, int length, const Identifier&, NativeFunction);
     35        PrototypeFunction(ExecState*, PassRefPtr<StructureID>, int length, const Identifier&, NativeFunction);
    3636
    3737    private:
  • trunk/JavaScriptCore/kjs/RegExpConstructor.cpp

    r36263 r36726  
    7979};
    8080
    81 RegExpConstructor::RegExpConstructor(ExecState* exec, FunctionPrototype* functionPrototype, RegExpPrototype* regExpPrototype)
    82     : InternalFunction(exec, functionPrototype, Identifier(exec, "RegExp"))
     81RegExpConstructor::RegExpConstructor(ExecState* exec, PassRefPtr<StructureID> structure, RegExpPrototype* regExpPrototype)
     82    : InternalFunction(exec, structure, Identifier(exec, "RegExp"))
    8383    , d(new RegExpConstructorPrivate)
    8484{
     
    133133
    134134RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data)
    135     : JSArray(exec->lexicalGlobalObject()->arrayPrototype(), data->lastNumSubPatterns + 1)
     135    : JSArray(exec->lexicalGlobalObject()->regExpMatchesArrayStructure(), data->lastNumSubPatterns + 1)
    136136{
    137137    RegExpConstructorPrivate* d = new RegExpConstructorPrivate;
     
    296296    if (!regExp->isValid())
    297297        return throwError(exec, SyntaxError, UString("Invalid regular expression: ").append(regExp->errorMessage()));
    298     return new (exec) RegExpObject(exec->lexicalGlobalObject()->regExpPrototype(), regExp.release());
     298    return new (exec) RegExpObject(exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
    299299}
    300300
  • trunk/JavaScriptCore/kjs/RegExpConstructor.h

    r36263 r36726  
    2727namespace JSC {
    2828
    29     class FunctionPrototype;
    3029    class RegExp;
    3130    class RegExpPrototype;
     
    5251        };
    5352
    54         RegExpConstructor(ExecState*, FunctionPrototype*, RegExpPrototype*);
     53        RegExpConstructor(ExecState*, PassRefPtr<StructureID>, RegExpPrototype*);
    5554
    5655        virtual void put(ExecState*, const Identifier& propertyName, JSValue*, PutPropertySlot&);
  • trunk/JavaScriptCore/kjs/RegExpObject.cpp

    r36263 r36726  
    4545*/
    4646
    47 RegExpObject::RegExpObject(RegExpPrototype* regExpPrototype, PassRefPtr<RegExp> regExp)
    48     : JSObject(regExpPrototype)
     47RegExpObject::RegExpObject(PassRefPtr<StructureID> structure, PassRefPtr<RegExp> regExp)
     48    : JSObject(structure)
    4949    , d(new RegExpObjectData(regExp, 0))
    5050{
  • trunk/JavaScriptCore/kjs/RegExpObject.h

    r36263 r36726  
    2727namespace JSC {
    2828
    29     class RegExpPrototype;
    30 
    3129    class RegExpObject : public JSObject {
    3230    public:
    3331        enum { Global, IgnoreCase, Multiline, Source, LastIndex };
    3432
    35         RegExpObject(RegExpPrototype*, PassRefPtr<RegExp>);
     33        RegExpObject(PassRefPtr<StructureID>, PassRefPtr<RegExp>);
    3634        virtual ~RegExpObject();
    3735
  • trunk/JavaScriptCore/kjs/RegExpPrototype.cpp

    r36263 r36726  
    2323
    2424#include "ArrayPrototype.h"
    25 #include "FunctionPrototype.h"
    2625#include "JSArray.h"
    2726#include "JSObject.h"
     
    4645const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
    4746
    48 RegExpPrototype::RegExpPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
    49     : JSObject(objectPrototype)
     47RegExpPrototype::RegExpPrototype(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure)
     48    : JSObject(structure)
    5049{
    51     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
    52     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
    53     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
    54     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
     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);
    5554}
    5655
  • trunk/JavaScriptCore/kjs/RegExpPrototype.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    29     class ObjectPrototype;
    30 
    3128    class RegExpPrototype : public JSObject {
    3229    public:
    33         RegExpPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     30        RegExpPrototype(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure);
    3431
    3532        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/JavaScriptCore/kjs/Shell.cpp

    r36263 r36726  
    172172    : JSGlobalObject(globalData)
    173173{
    174     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "debug"), functionDebug));
    175     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "print"), functionPrint));
    176     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "quit"), functionQuit));
    177     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "gc"), functionGC));
    178     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "version"), functionVersion));
    179     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "run"), functionRun));
    180     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "load"), functionLoad));
    181     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "readline"), functionReadline));
     174    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
     175    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
     176    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
     177    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
     178    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
     179    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
     180    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
     181    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
    182182
    183183    JSObject* array = constructEmptyArray(globalExec());
  • trunk/JavaScriptCore/kjs/StringConstructor.cpp

    r36263 r36726  
    2222#include "StringConstructor.h"
    2323
    24 #include "FunctionPrototype.h"
    2524#include "JSGlobalObject.h"
    2625#include "PrototypeFunction.h"
     
    4847ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
    4948
    50 StringConstructor::StringConstructor(ExecState* exec, FunctionPrototype* functionPrototype, StringPrototype* stringPrototype)
    51     : InternalFunction(exec, functionPrototype, Identifier(exec, stringPrototype->classInfo()->className))
     49StringConstructor::StringConstructor(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure, StringPrototype* stringPrototype)
     50    : InternalFunction(exec, structure, Identifier(exec, stringPrototype->classInfo()->className))
    5251{
    5352    // ECMA 15.5.3.1 String.prototype
     
    5554
    5655    // ECMA 15.5.3.2 fromCharCode()
    57     putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
     56    putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
    5857
    5958    // no. of arguments for constructor
     
    6463static JSObject* constructWithStringConstructor(ExecState* exec, JSObject*, const ArgList& args)
    6564{
    66     JSObject* prototype = exec->lexicalGlobalObject()->stringPrototype();
    6765    if (args.isEmpty())
    68         return new (exec) StringObject(exec, prototype);
    69     return new (exec) StringObject(exec, prototype, args.at(exec, 0)->toString(exec));
     66        return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure());
     67    return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), args.at(exec, 0)->toString(exec));
    7068}
    7169
  • trunk/JavaScriptCore/kjs/StringConstructor.h

    r36263 r36726  
    2626namespace JSC {
    2727
    28     class FunctionPrototype;
    2928    class StringPrototype;
    3029
    3130    class StringConstructor : public InternalFunction {
    3231    public:
    33         StringConstructor(ExecState*, FunctionPrototype*, StringPrototype*);
     32        StringConstructor(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure, StringPrototype*);
    3433
    3534        virtual ConstructType getConstructData(ConstructData&);
  • trunk/JavaScriptCore/kjs/StringObject.cpp

    r36263 r36726  
    3030const ClassInfo StringObject::info = { "String", 0, 0, 0 };
    3131
    32 StringObject::StringObject(ExecState* exec, JSObject* prototype)
    33     : JSWrapperObject(prototype)
     32StringObject::StringObject(ExecState* exec, PassRefPtr<StructureID> structure)
     33    : JSWrapperObject(structure)
    3434{
    3535    setInternalValue(jsEmptyString(exec));
    3636}
    3737
    38 StringObject::StringObject(JSObject* prototype, JSString* string)
    39     : JSWrapperObject(prototype)
     38StringObject::StringObject(PassRefPtr<StructureID> structure, JSString* string)
     39    : JSWrapperObject(structure)
    4040{
    4141    setInternalValue(string);
    4242}
    4343
    44 StringObject::StringObject(ExecState* exec, JSObject* prototype, const UString& string)
    45     : JSWrapperObject(prototype)
     44StringObject::StringObject(ExecState* exec, PassRefPtr<StructureID> structure, const UString& string)
     45    : JSWrapperObject(structure)
    4646{
    4747    setInternalValue(jsString(exec, string));
  • trunk/JavaScriptCore/kjs/StringObject.h

    r36475 r36726  
    2929    class StringObject : public JSWrapperObject {
    3030    public:
    31         StringObject(ExecState*, JSObject* prototype);
    32         StringObject(ExecState*, JSObject* prototype, const UString&);
     31        StringObject(ExecState*, PassRefPtr<StructureID>);
     32        StringObject(ExecState*, PassRefPtr<StructureID>, const UString&);
    3333
    3434        static StringObject* create(ExecState*, JSString*);
     
    4747
    4848    protected:
    49         StringObject(JSObject* prototype, JSString*);
     49        StringObject(PassRefPtr<StructureID>, JSString*);
    5050
    5151    private:
  • trunk/JavaScriptCore/kjs/StringObjectThatMasqueradesAsUndefined.h

    r36475 r36726  
    3030    class StringObjectThatMasqueradesAsUndefined : public StringObject {
    3131    public:
    32         StringObjectThatMasqueradesAsUndefined(ExecState* exec, JSObject* prototype, const UString& string)
    33             : StringObject(exec, prototype, string)
     32        StringObjectThatMasqueradesAsUndefined(ExecState* exec, PassRefPtr<StructureID> structure, const UString& string)
     33            : StringObject(exec, structure, string)
    3434        {
    3535        }
  • trunk/JavaScriptCore/kjs/StringPrototype.cpp

    r36263 r36726  
    117117
    118118// ECMA 15.5.4
    119 StringPrototype::StringPrototype(ExecState* exec, ObjectPrototype* objectPrototype)
    120     : StringObject(exec, objectPrototype)
     119StringPrototype::StringPrototype(ExecState* exec, PassRefPtr<StructureID> structure)
     120    : StringObject(exec, structure)
    121121{
    122122    // The constructor will be added later, after StringConstructor has been built
  • trunk/JavaScriptCore/kjs/StringPrototype.h

    r36263 r36726  
    3030    class StringPrototype : public StringObject {
    3131    public:
    32         StringPrototype(ExecState*, ObjectPrototype*);
     32        StringPrototype(ExecState*, PassRefPtr<StructureID>);
    3333
    3434        virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
  • trunk/WebCore/ChangeLog

    r36725 r36726  
     12008-09-20  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        - finish https://bugs.webkit.org/show_bug.cgi?id=20858
     6          make each distinct C++ class get a distinct JSC::Structure
     7
     8        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
     9        (WebCore::JSCSSStyleDeclaration::nameGetter): Pass in a structure
     10        ID. Note that this makes a new structure every time -- we could
     11        optimize this slightly be caching and reusing a single one.
     12
     13        * bridge/runtime_method.cpp:
     14        (JSC::RuntimeMethod::RuntimeMethod): Create a unique structure using
     15        getDOMStructure.
     16        * bridge/runtime_method.h:
     17        (JSC::RuntimeMethod::createPrototype): Added createPrototype so
     18        getDOMStructure will work.
     19
     20        * bindings/js/JSDOMWindowShell.cpp:
     21        (WebCore::JSDOMWindowShell::JSDOMWindowShell): Initialize m_window to
     22        0; needed in case garbage collection happens while creating the
     23        JSDOMWindow.
     24
    1252008-09-20  Dan Bernstein  <mitz@apple.com>
    226
     
    131155        BackButtonPart was split into Start and End Part
    132156        ForwardButtonPart was split into Start and End Part
    133 
    134157
    135158        * platform/qt/ScrollbarThemeQt.cpp:
  • trunk/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

    r36662 r36726  
    151151    // Make the SVG 'filter' attribute undetectable, to avoid confusion with the IE 'filter' attribute.
    152152    if (propertyName == "filter")
    153         return new (exec) StringObjectThatMasqueradesAsUndefined(exec, exec->lexicalGlobalObject()->stringPrototype(),
     153        return new (exec) StringObjectThatMasqueradesAsUndefined(exec,
     154            StructureID::create(exec->lexicalGlobalObject()->stringPrototype()),
    154155            thisObj->impl()->getPropertyValue(prop));
    155156
  • trunk/WebCore/bindings/js/JSDOMWindowShell.cpp

    r36675 r36726  
    4646JSDOMWindowShell::JSDOMWindowShell(PassRefPtr<DOMWindow> window)
    4747    : Base(StructureID::create(jsNull()))
     48    , m_window(0)
    4849{
    4950    setWindow(window);
  • trunk/WebCore/bridge/runtime_method.cpp

    r36263 r36726  
    2727#include "runtime_method.h"
    2828
     29#include "JSDOMBinding.h"
    2930#include "runtime_object.h"
    3031#include <kjs/Error.h>
    31 #include <kjs/JSGlobalObject.h>
     32#include <kjs/FunctionPrototype.h>
     33
     34using namespace WebCore;
    3235
    3336namespace JSC {
     
    3740ASSERT_CLASS_FITS_IN_CELL(RuntimeMethod);
    3841
    39 RuntimeMethod::RuntimeMethod(ExecState *exec, const Identifier &ident, Bindings::MethodList &m)
    40     : InternalFunction(exec, exec->lexicalGlobalObject()->functionPrototype(), ident)
     42const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", 0, 0, 0 };
     43
     44RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m)
     45    : InternalFunction(exec, getDOMStructure<RuntimeMethod>(exec), ident)
    4146    , _methodList(new MethodList(m))
    4247{
  • trunk/WebCore/bridge/runtime_method.h

    r36263 r36726  
    2929#include "runtime.h"
    3030#include <kjs/InternalFunction.h>
     31#include <kjs/JSGlobalObject.h>
    3132#include <wtf/OwnPtr.h>
    3233
     
    3738    RuntimeMethod(ExecState*, const Identifier& name, Bindings::MethodList&);
    3839    Bindings::MethodList* methods() const { return _methodList.get(); }
     40
     41    static const ClassInfo s_info;
     42
     43    static FunctionPrototype* createPrototype(ExecState* exec)
     44    {
     45        return exec->lexicalGlobalObject()->functionPrototype();
     46    }
    3947
    4048private:
Note: See TracChangeset for help on using the changeset viewer.