Commit 8281d838 authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

2008-09-20  Darin Adler  <darin@apple.com>

        Reviewed by Maciej Stachowiak.

        - finish https://bugs.webkit.org/show_bug.cgi?id=20858
          make each distinct C++ class get a distinct JSC::Structure

        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.

        * JavaScriptCore.exp: Updated.

        * 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@apple.com>

        Reviewed by Maciej Stachowiak.

        - finish https://bugs.webkit.org/show_bug.cgi?id=20858
          make each distinct C++ class get a distinct JSC::Structure

        * 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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a6f8ce7d
......@@ -36,8 +36,8 @@ namespace JSC {
const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
JSCallbackConstructor::JSCallbackConstructor(ExecState* exec, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
: JSObject(exec->lexicalGlobalObject()->objectPrototype())
JSCallbackConstructor::JSCallbackConstructor(PassRefPtr<StructureID> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
: JSObject(structure)
, m_class(jsClass)
, m_callback(callback)
{
......
......@@ -33,7 +33,7 @@ namespace JSC {
class JSCallbackConstructor : public JSObject {
public:
JSCallbackConstructor(ExecState*, JSClassRef, JSObjectCallAsConstructorCallback);
JSCallbackConstructor(PassRefPtr<StructureID>, JSClassRef, JSObjectCallAsConstructorCallback);
virtual ~JSCallbackConstructor();
JSClassRef classRef() const { return m_class; }
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
......
......@@ -41,7 +41,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction);
const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunction::info, 0, 0 };
JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name)
: InternalFunction(exec, exec->lexicalGlobalObject()->functionPrototype(), name)
: InternalFunction(exec, exec->lexicalGlobalObject()->callbackFunctionStructure(), name)
, m_callback(callback)
{
}
......
......@@ -36,7 +36,7 @@ namespace JSC {
template <class Base>
class JSCallbackObject : public Base {
public:
JSCallbackObject(ExecState*, JSClassRef, JSObject* prototype, void* data);
JSCallbackObject(ExecState*, PassRefPtr<StructureID>, JSClassRef, void* data);
JSCallbackObject(JSGlobalData*, JSClassRef);
virtual ~JSCallbackObject();
......
......@@ -40,8 +40,8 @@
namespace JSC {
template <class Base>
JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSClassRef jsClass, JSObject* prototype, void* data)
: Base(prototype)
JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, PassRefPtr<StructureID> structure, JSClassRef jsClass, void* data)
: Base(structure)
, m_callbackObjectData(new JSCallbackObjectData(data, jsClass))
{
init(exec);
......
......@@ -235,12 +235,11 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec)
if (!jsClassData.cachedPrototype) {
// Recursive, but should be good enough for our purposes
JSObject* parentPrototype = 0;
if (parentClass)
parentPrototype = parentClass->prototype(exec); // can be null
if (!parentPrototype)
parentPrototype = exec->dynamicGlobalObject()->objectPrototype();
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
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
if (parentClass) {
if (JSObject* prototype = parentClass->prototype(exec))
jsClassData.cachedPrototype->setPrototype(prototype);
}
}
return jsClassData.cachedPrototype;
}
......@@ -72,13 +72,13 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
JSLock lock(exec);
if (!jsClass)
return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient
return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient
JSObject* jsPrototype = jsClass->prototype(exec);
if (!jsPrototype)
jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
JSCallbackObject<JSObject>* object = new (exec) JSCallbackObject<JSObject>(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
if (JSObject* prototype = jsClass->prototype(exec))
object->setPrototype(prototype);
return toRef(new (exec) JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data));
return toRef(object);
}
JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction)
......@@ -102,7 +102,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje
? jsClass->prototype(exec)
: exec->dynamicGlobalObject()->objectPrototype();
JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec, jsClass, callAsConstructor);
JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
return toRef(constructor);
}
......
2008-09-20 Darin Adler <darin@apple.com>
Reviewed by Maciej Stachowiak.
- finish https://bugs.webkit.org/show_bug.cgi?id=20858
make each distinct C++ class get a distinct JSC::Structure
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.
* JavaScriptCore.exp: Updated.
* 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.
2008-09-19 Alp Toker <alp@nuanti.com>
Build fix for the 'gold' linker and recent binutils. New behaviour
......
......@@ -98,6 +98,7 @@ __ZN3JSC11Interpreter21shouldPrintExceptionsEv
__ZN3JSC11Interpreter24setShouldPrintExceptionsEb
__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_7UStringEiN3WTF10PassRefPtrINS_14SourceProviderEEEPNS_7JSValueE
__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_7UStringEiS7_PNS_7JSValueE
__ZN3JSC11JSImmediate12nonInlineNaNEv
__ZN3JSC11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE
__ZN3JSC11JSImmediate8toStringEPKNS_7JSValueE
__ZN3JSC11JSImmediate9prototypeEPKNS_7JSValueEPNS_9ExecStateE
......@@ -127,7 +128,8 @@ __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_
__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC12StringObject4infoE
__ZN3JSC12StringObjectC2EPNS_9ExecStateEPNS_8JSObjectERKNS_7UStringE
__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_7UStringE
__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
__ZN3JSC13CodeGenerator21setDumpsGeneratedCodeEb
__ZN3JSC13StatementNode6setLocEii
__ZN3JSC13jsOwnedStringEPNS_9ExecStateERKNS_7UStringE
......@@ -146,14 +148,14 @@ __ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
__ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE
__ZN3JSC15JSWrapperObject4markEv
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunctionC2EPNS_9ExecStateEPNS_17FunctionPrototypeERKNS_10IdentifierE
__ZN3JSC16InternalFunctionC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3JSC16JSVariableObject16setRegisterArrayEPNS_8RegisterEm
__ZN3JSC16ParserRefCounted3refEv
__ZN3JSC16ParserRefCounted5derefEv
__ZN3JSC17PropertyNameArray3addEPNS_7UString3RepE
__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectES9_RKNS_7ArgListEE
__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectESB_RKNS_7ArgListEE
__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectES7_RKNS_7ArgListEE
__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
__ZN3JSC19constructEmptyArrayEPNS_9ExecStateE
......
......@@ -150,6 +150,10 @@ static inline bool jsLess(ExecState* exec, JSValue* v1, JSValue* v2)
if (fastIsNumber(v1, n1) && fastIsNumber(v2, n2))
return n1 < n2;
Machine* machine = exec->machine();
if (machine->isJSString(v1) && machine->isJSString(v2))
return static_cast<const JSString*>(v1)->value() < static_cast<const JSString*>(v2)->value();
JSValue* p1;
JSValue* p2;
bool wasNotString1 = v1->getPrimitiveNumber(exec, n1, p1);
......@@ -171,6 +175,10 @@ static inline bool jsLessEq(ExecState* exec, JSValue* v1, JSValue* v2)
if (fastIsNumber(v1, n1) && fastIsNumber(v2, n2))
return n1 <= n2;
Machine* machine = exec->machine();
if (machine->isJSString(v1) && machine->isJSString(v2))
return !(static_cast<const JSString*>(v2)->value() < static_cast<const JSString*>(v1)->value());
JSValue* p1;
JSValue* p2;
bool wasNotString1 = v1->getPrimitiveNumber(exec, n1, p1);
......@@ -1504,7 +1512,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
*/
int dst = (++vPC)->u.operand;
int regExp = (++vPC)->u.operand;
r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpPrototype(), codeBlock->regexps[regExp]);
r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpStructure(), codeBlock->regexps[regExp]);
++vPC;
NEXT_OPCODE;
......@@ -3385,13 +3393,13 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
if (*enabledProfilerReference)
(*enabledProfilerReference)->willExecute(exec, constructor);
JSObject* prototype;
JSValue* p = r[constrProto].jsValue(exec);
if (p->isObject())
prototype = static_cast<JSObject*>(p);
StructureID* structure;
JSValue* prototype = r[constrProto].jsValue(exec);
if (prototype->isObject())
structure = static_cast<JSObject*>(prototype)->inheritorID();
else
prototype = scopeChain->globalObject()->objectPrototype();
JSObject* newObject = new (exec) JSObject(prototype);
structure = scopeChain->globalObject()->emptyObjectStructure();
JSObject* newObject = new (exec) JSObject(structure);
ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
......@@ -4539,13 +4547,12 @@ void* Machine::cti_op_construct_JSConstruct(CTI_ARGS)
if (*ARG_profilerReference)
(*ARG_profilerReference)->willExecute(exec, constructor);
JSObject* prototype;
JSValue* p = constrProtoVal;
if (p->isObject())
prototype = static_cast<JSObject*>(p);
StructureID* structure;
if (constrProtoVal->isObject())
structure = static_cast<JSObject*>(constrProtoVal)->inheritorID();
else
prototype = scopeChain->globalObject()->objectPrototype();
JSObject* newObject = new (exec) JSObject(prototype);
structure = scopeChain->globalObject()->emptyObjectStructure();
JSObject* newObject = new (exec) JSObject(structure);
ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
......@@ -5144,7 +5151,7 @@ JSValue* Machine::cti_op_bitxor(CTI_ARGS)
JSValue* Machine::cti_op_new_regexp(CTI_ARGS)
{
return new (ARG_exec) RegExpObject(ARG_scopeChain->globalObject()->regExpPrototype(), ARG_regexp1);
return new (ARG_exec) RegExpObject(ARG_scopeChain->globalObject()->regExpStructure(), ARG_regexp1);
}
JSValue* Machine::cti_op_bitor(CTI_ARGS)
......@@ -5274,7 +5281,7 @@ JSValue* Machine::cti_op_is_number(CTI_ARGS)
JSValue* Machine::cti_op_is_string(CTI_ARGS)
{
return jsBoolean(ARG_src1->isString());
return jsBoolean(ARG_exec->machine()->isJSString(ARG_src1));
}
JSValue* Machine::cti_op_is_object(CTI_ARGS)
......
......@@ -232,6 +232,9 @@ namespace JSC {
// Default number of ticks before a timeout check should be done.
static const int initialTickCountThreshold = 1024;
bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; }
bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; }
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
......@@ -256,9 +259,6 @@ namespace JSC {
JSValue* checkTimeout(JSGlobalObject*);
void resetTimeoutCheck();
bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; }
bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; }
void tryCacheGetByID(ExecState*, CodeBlock*, Instruction* vPC, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&);
void uncacheGetByID(CodeBlock*, Instruction* vPC);
void tryCachePutByID(ExecState* exec, CodeBlock*, Instruction* vPC, JSValue* baseValue, const PutPropertySlot&);
......
......@@ -38,7 +38,7 @@ const ClassInfo Arguments::info = { "Arguments", 0, 0, 0 };
// ECMA 10.1.8
Arguments::Arguments(ExecState* exec, JSFunction* function, const ArgList& args, JSActivation* activation)
: JSObject(exec->lexicalGlobalObject()->objectPrototype())
: JSObject(exec->lexicalGlobalObject()->argumentsStructure())
, d(new ArgumentsData(activation, function, args))
{
ASSERT(activation);
......
......@@ -25,7 +25,6 @@
#include "ArrayConstructor.h"
#include "ArrayPrototype.h"
#include "FunctionPrototype.h"
#include "JSArray.h"
#include "lookup.h"
......@@ -33,8 +32,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
ArrayConstructor::ArrayConstructor(ExecState* exec, FunctionPrototype* functionPrototype, ArrayPrototype* arrayPrototype)
: InternalFunction(exec, functionPrototype, Identifier(exec, arrayPrototype->classInfo()->className))
ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<StructureID> structure, ArrayPrototype* arrayPrototype)
: InternalFunction(exec, structure, Identifier(exec, arrayPrototype->classInfo()->className))
{
// ECMA 15.4.3.1 Array.prototype
putDirect(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
......@@ -50,11 +49,11 @@ static JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& arg
uint32_t n = args.at(exec, 0)->toUInt32(exec);
if (n != args.at(exec, 0)->toNumber(exec))
return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
return new (exec) JSArray(exec->lexicalGlobalObject()->arrayPrototype(), n);
return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n);
}
// otherwise the array is constructed with the arguments in it
return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayPrototype(), args);
return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayStructure(), args);
}
static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args)
......
/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -26,11 +26,10 @@
namespace JSC {
class ArrayPrototype;
class FunctionPrototype;
class ArrayConstructor : public InternalFunction {
public:
ArrayConstructor(ExecState*, FunctionPrototype*, ArrayPrototype*);
ArrayConstructor(ExecState*, PassRefPtr<StructureID>, ArrayPrototype*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
......
......@@ -91,8 +91,8 @@ const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::a
*/
// ECMA 15.4.4
ArrayPrototype::ArrayPrototype(ExecState*, ObjectPrototype* objectPrototype)
: JSArray(objectPrototype, 0)
ArrayPrototype::ArrayPrototype(PassRefPtr<StructureID> structure)
: JSArray(structure)
{
}
......
......@@ -28,7 +28,7 @@ namespace JSC {
class ArrayPrototype : public JSArray {
public:
ArrayPrototype(ExecState*, ObjectPrototype*);
explicit ArrayPrototype(PassRefPtr<StructureID>);
bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
......
......@@ -28,8 +28,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
BooleanConstructor::BooleanConstructor(ExecState* exec, FunctionPrototype* functionPrototype, BooleanPrototype* booleanPrototype)
: InternalFunction(exec, functionPrototype, Identifier(exec, booleanPrototype->classInfo()->className))
BooleanConstructor::BooleanConstructor(ExecState* exec, PassRefPtr<StructureID> structure, BooleanPrototype* booleanPrototype)
: InternalFunction(exec, structure, Identifier(exec, booleanPrototype->classInfo()->className))
{
putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
......@@ -40,7 +40,7 @@ BooleanConstructor::BooleanConstructor(ExecState* exec, FunctionPrototype* funct
// ECMA 15.6.2
JSObject* constructBoolean(ExecState* exec, const ArgList& args)
{
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanPrototype());
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
obj->setInternalValue(jsBoolean(args.at(exec, 0)->toBoolean(exec)));
return obj;
}
......@@ -70,7 +70,7 @@ CallType BooleanConstructor::getCallData(CallData& callData)
JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValue* immediateBooleanValue)
{
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanPrototype());
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
obj->setInternalValue(immediateBooleanValue);
return obj;
}
......
......@@ -26,11 +26,10 @@
namespace JSC {
class BooleanPrototype;
class FunctionPrototype;
class BooleanConstructor : public InternalFunction {
public:
BooleanConstructor(ExecState*, FunctionPrototype*, BooleanPrototype*);
BooleanConstructor(ExecState*, PassRefPtr<StructureID>, BooleanPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
......
......@@ -27,8 +27,8 @@ ASSERT_CLASS_FITS_IN_CELL(BooleanObject);
const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
BooleanObject::BooleanObject(JSObject* prototype)
: JSWrapperObject(prototype)
BooleanObject::BooleanObject(PassRefPtr<StructureID> structure)
: JSWrapperObject(structure)
{
}
......
......@@ -27,7 +27,7 @@ namespace JSC {
class BooleanObject : public JSWrapperObject {
public:
BooleanObject(JSObject* prototype);
explicit BooleanObject(PassRefPtr<StructureID>);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -22,7 +22,6 @@
#include "BooleanPrototype.h"
#include "Error.h"
#include "FunctionPrototype.h"
#include "JSString.h"
#include "ObjectPrototype.h"
#include "PrototypeFunction.h"
......@@ -37,13 +36,13 @@ static JSValue* booleanProtoFuncValueOf(ExecState*, JSObject*, JSValue*, const A
// ECMA 15.6.4
BooleanPrototype::BooleanPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
: BooleanObject(objectPrototype)
BooleanPrototype::BooleanPrototype(ExecState* exec, PassRefPtr<StructureID> structure, StructureID* prototypeFunctionStructure)
: BooleanObject(structure)
{
setInternalValue(jsBoolean(false));
putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
putDirectFunction(exec, new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
putDirectFunction(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
}
......
......@@ -25,12 +25,9 @@
namespace JSC {
class FunctionPrototype;
class ObjectPrototype;
class BooleanPrototype : public BooleanObject {
public:
BooleanPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
BooleanPrototype(ExecState*, PassRefPtr<StructureID>, StructureID* prototypeFunctionStructure);