Commit f5ab0692 authored by ggaren@apple.com's avatar ggaren@apple.com

JavaScriptCore:

        Reviewed by Sam Weinig.

        Next step in refactoring JSGlobalObject: Added JSVariableObject class,
        and factored symbol-table-related code into it. (JSGlobalObject doesn't
        use the symbol table code yet, though.)
        
        Layout and JS tests, and testapi, pass. SunSpider reports no regression.

WebCore:

        Reviewed by Sam Weinig.

        Added some namespace qualifications and a forwarding header, now that
        KJS::Node is sometimes #included in WebCore by JavaScriptCore headers.

        * ForwardingHeaders/wtf/ListRefPtr.h: Added.
        * bindings/js/JSXSLTProcessor.cpp:
        (KJS::JSXSLTProcessorPrototypeFunctionTransformToFragment::callAsFunction):
        * bindings/js/kjs_binding.cpp:
        (KJS::ScriptInterpreter::getDOMNodeForDocument):
        (KJS::ScriptInterpreter::forgetDOMNodeForDocument):
        (KJS::ScriptInterpreter::putDOMNodeForDocument):
        (KJS::ScriptInterpreter::markDOMNodesForDocument):
        (KJS::ScriptInterpreter::updateDOMNodeDocument):

WebKit/mac:

        Reviewed by Sam Weinig.
        
        Added a forwarding header, since we now #include nodes.h through some
        JavaScriptCore headers.

        * ForwardingHeaders/wtf/ListRefPtr.h: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ee5a5d14
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Next step in refactoring JSGlobalObject: Added JSVariableObject class,
and factored symbol-table-related code into it. (JSGlobalObject doesn't
use the symbol table code yet, though.)
Layout and JS tests, and testapi, pass. SunSpider reports no regression.
2007-12-07 Darin Adler <darin@apple.com>
Reviewed by Geoff.
......
......@@ -149,6 +149,8 @@ __ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
__ZN3KJS15JSWrapperObject4markEv
__ZN3KJS15SavedPropertiesC1Ev
__ZN3KJS15SavedPropertiesD1Ev
__ZN3KJS16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZN3KJS16RuntimeObjectImp4infoE
__ZN3KJS16RuntimeObjectImpC1EPNS_8Bindings8InstanceE
__ZN3KJS17PropertyNameArray3addERKNS_10IdentifierE
......@@ -223,6 +225,7 @@ __ZN3KJS9Collector4sizeEv
__ZN3KJS9Collector7collectEv
__ZN3KJS9Collector7protectEPNS_7JSValueE
__ZN3KJS9Collector9unprotectEPNS_7JSValueE
__ZN3KJS9ExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectEPNS_16FunctionBodyNodeENS_8CodeTypeEPS0_S8_PNS_11FunctionImpEPKNS_4ListE
__ZN3KJS9ExecStateD1Ev
__ZN3KJSeqERKNS_7UStringEPKc
__ZN3WTF10fastCallocEmm
......@@ -277,6 +280,7 @@ __ZNK3KJS9ExecState19lexicalGlobalObjectEv
__ZTVN3KJS14JSGlobalObjectE
__ZTVN3KJS14StringInstanceE
__ZTVN3KJS15JSWrapperObjectE
__ZTVN3KJS16JSVariableObjectE
__ZTVN3KJS19InternalFunctionImpE
__ZTVN3KJS8JSObjectE
_jscore_collector_introspection
......
......@@ -318,6 +318,14 @@
RelativePath="..\..\kjs\JSGlobalObject.cpp"
>
</File>
<File
RelativePath="..\..\kjs\JSVariableObject.cpp"
>
</File>
<File
RelativePath="..\..\kjs\JSVariableObject.h"
>
</File>
<File
RelativePath="..\..\kjs\JSImmediate.cpp"
>
......
......@@ -66,7 +66,7 @@
1482B7E30A43076000517CFC /* JSObjectRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B7E10A43076000517CFC /* JSObjectRef.h */; settings = {ATTRIBUTES = (Public, ); }; };
1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B7E20A43076000517CFC /* JSObjectRef.cpp */; };
1483B58A099BC1950016E4F0 /* JSImmediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1483B589099BC1950016E4F0 /* JSImmediate.h */; settings = {ATTRIBUTES = (Private, ); }; };
148A1627095D16BB00666D0D /* ListRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A1626095D16BB00666D0D /* ListRefPtr.h */; };
148A1627095D16BB00666D0D /* ListRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A1626095D16BB00666D0D /* ListRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
14A396A70CD2933100B5B4FF /* SymbolTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A396A60CD2933100B5B4FF /* SymbolTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
14ABB36F099C076400E2A24F /* value.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABB36E099C076400E2A24F /* value.h */; settings = {ATTRIBUTES = (Private, ); }; };
14ABB455099C2A0F00E2A24F /* JSType.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABB454099C2A0F00E2A24F /* JSType.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -81,6 +81,8 @@
14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */; };
14BD5A360A3E91F600BAF59C /* JavaScriptCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BD5A2F0A3E91F600BAF59C /* JavaScriptCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
14DE0D690D02431400AACCA2 /* JSGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */; };
14F252570D08DD8D004ECFFF /* JSVariableObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F252560D08DD8D004ECFFF /* JSVariableObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
14F252610D08DF2F004ECFFF /* JSVariableObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */; };
1CAF34890A6C421700ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34880A6C421700ABE06E /* WebScriptObject.h */; };
5186111E0CC824900081412B /* Deque.h in Headers */ = {isa = PBXBuildFile; fileRef = 5186111D0CC824830081412B /* Deque.h */; settings = {ATTRIBUTES = (Private, ); }; };
51F648D70BB4E2CA0033D760 /* RetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F648D60BB4E2CA0033D760 /* RetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -142,7 +144,7 @@
932F5B4B0822A1C700736975 /* lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8660255597D01FF60F7 /* lexer.h */; };
932F5B4D0822A1C700736975 /* lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8690255597D01FF60F7 /* lookup.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B4E0822A1C700736975 /* math_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86B0255597D01FF60F7 /* math_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B500822A1C700736975 /* nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* nodes.h */; };
932F5B500822A1C700736975 /* nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* nodes.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B510822A1C700736975 /* number_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8710255597D01FF60F7 /* number_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B530822A1C700736975 /* object_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8740255597D01FF60F7 /* object_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B540822A1C700736975 /* object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8760255597D01FF60F7 /* object.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -228,7 +230,7 @@
93E26BD408B1514100F85226 /* pcre_xclass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BD308B1514100F85226 /* pcre_xclass.cpp */; };
93E26BE608B1517100F85226 /* pcre_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BE508B1517100F85226 /* pcre_internal.h */; };
93E26BFE08B151D400F85226 /* ucpinternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BFC08B151D400F85226 /* ucpinternal.h */; };
93F0B3AC09BB4DC00068FCE3 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; };
93F0B3AC09BB4DC00068FCE3 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (Private, ); }; };
95C18D490C90E82600E72F73 /* JSRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8E894320CD0602400367179 /* JSCallbackObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */; };
A8E894340CD0603F00367179 /* JSGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894330CD0603F00367179 /* JSGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -439,6 +441,8 @@
14BD5A2F0A3E91F600BAF59C /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = "<group>"; };
14D857740A4696C80032146C /* testapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = testapi.js; sourceTree = "<group>"; };
14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObject.cpp; sourceTree = "<group>"; };
14F252560D08DD8D004ECFFF /* JSVariableObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVariableObject.h; sourceTree = "<group>"; };
14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVariableObject.cpp; sourceTree = "<group>"; };
1C9051420BA9E8A70081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = JavaScriptCore.xcconfig; sourceTree = "<group>"; };
1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
......@@ -952,6 +956,7 @@
65417200039E01BA0058BFEB /* kjs */ = {
isa = PBXGroup;
children = (
14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */,
659126BC0BDD1728001921FB /* AllInOneFile.cpp */,
93ADFCE60CCBD7AC00D30B08 /* array_instance.cpp */,
938772E5038BFE19008635CE /* array_instance.h */,
......@@ -1000,6 +1005,7 @@
65EA4C9A092AF9E20093D800 /* JSLock.h */,
14ABB454099C2A0F00E2A24F /* JSType.h */,
1482B6EA0A4300B300517CFC /* JSValueRef.h */,
14F252560D08DD8D004ECFFF /* JSVariableObject.h */,
65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */,
93F1981A08245AAE001E9ABC /* keywords.table */,
......@@ -1268,6 +1274,7 @@
E1EF79AB0CE97BA60088D500 /* UTF8.h in Headers */,
1419D32D0CEA7CDE00FF507A /* RefCounted.h in Headers */,
5DA479660CFBCF56009328A0 /* TCPackedCache.h in Headers */,
14F252570D08DD8D004ECFFF /* JSVariableObject.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1557,6 +1564,7 @@
932F5BC50822A1C700736975 /* runtime_root.cpp in Sources */,
E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
14DE0D690D02431400AACCA2 /* JSGlobalObject.cpp in Sources */,
14F252610D08DF2F004ECFFF /* JSVariableObject.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -75,6 +75,7 @@ Source files for JSCore.
kjs/internal.cpp
kjs/interpreter.cpp
kjs/JSGlobalObject.cpp
kjs/JSVariableObject.cpp
kjs/JSImmediate.cpp
kjs/JSLock.cpp
kjs/JSWrapperObject.cpp
......
......@@ -50,10 +50,10 @@ ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV,
// create and initialize activation object (ECMA 10.1.6)
if (type == FunctionCode) {
m_activation = new ActivationImp(this);
m_variable = m_activation;
m_variableObject = m_activation;
} else {
m_activation = 0;
m_variable = globalObject;
m_variableObject = globalObject;
}
// ECMA 10.2
......@@ -61,7 +61,7 @@ ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV,
case EvalCode:
if (m_callingExec) {
m_scopeChain = m_callingExec->scopeChain();
m_variable = m_callingExec->variableObject();
m_variableObject = m_callingExec->variableObject();
m_thisVal = m_callingExec->thisValue();
break;
} // else same as GlobalCode
......@@ -72,7 +72,7 @@ ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV,
case FunctionCode:
m_scopeChain = func->scope();
m_scopeChain.push(m_activation);
m_variable = m_activation; // TODO: DontDelete ? (ECMA 10.2.3)
m_variableObject = m_activation;
m_thisVal = thisV;
break;
}
......@@ -106,7 +106,7 @@ JSGlobalObject* ExecState::lexicalGlobalObject() const
void ExecState::updateLocalStorage()
{
m_localStorageBuffer = static_cast<ActivationImp*>(m_activation)->localStorage().data();
m_localStorageBuffer = m_activation->localStorage().data();
}
} // namespace KJS
......@@ -38,12 +38,14 @@ namespace KJS {
FunctionCode,
};
class JSGlobalObject;
class ScopeChain;
class Interpreter;
class ActivationImp;
class FunctionBodyNode;
class FunctionImp;
class GlobalFuncImp;
class FunctionBodyNode;
class Interpreter;
class JSGlobalObject;
class JSVariableObject;
class ScopeChain;
struct LocalStorageEntry;
/**
......@@ -73,14 +75,14 @@ namespace KJS {
const ScopeChain& scopeChain() const { return m_scopeChain; }
JSObject* variableObject() const { return m_variable; }
void setVariableObject(JSObject* v) { m_variable = v; }
JSVariableObject* variableObject() const { return m_variableObject; }
void setVariableObject(JSVariableObject* v) { m_variableObject = v; }
JSObject* thisValue() const { return m_thisVal; }
ExecState* callingExecState() { return m_callingExec; }
JSObject* activationObject() { return m_activation; }
ActivationImp* activationObject() { return m_activation; }
CodeType codeType() { return m_codeType; }
FunctionBodyNode* currentBody() { return m_currentBody; }
FunctionImp* function() const { return m_function; }
......@@ -128,11 +130,11 @@ namespace KJS {
FunctionImp* m_function;
const List* m_arguments;
JSObject* m_activation;
ActivationImp* m_activation;
LocalStorageEntry* m_localStorageBuffer;
ScopeChain m_scopeChain;
JSObject* m_variable;
JSVariableObject* m_variableObject;
JSObject* m_thisVal;
LabelStack ls;
......
......@@ -92,39 +92,39 @@ JSGlobalObject::~JSGlobalObject()
{
ASSERT(JSLock::currentThreadIsHoldingLock());
if (d->debugger)
d->debugger->detach(this);
if (d()->debugger)
d()->debugger->detach(this);
d->next->d->prev = d->prev;
d->prev->d->next = d->next;
s_head = d->next;
d()->next->d()->prev = d()->prev;
d()->prev->d()->next = d()->next;
s_head = d()->next;
if (s_head == this)
s_head = 0;
delete d();
}
void JSGlobalObject::init()
{
ASSERT(JSLock::currentThreadIsHoldingLock());
d.reset(new JSGlobalObjectData(this));
if (s_head) {
d->prev = s_head;
d->next = s_head->d->next;
s_head->d->next->d->prev = this;
s_head->d->next = this;
d()->prev = s_head;
d()->next = s_head->d()->next;
s_head->d()->next->d()->prev = this;
s_head->d()->next = this;
} else
s_head = d->next = d->prev = this;
s_head = d()->next = d()->prev = this;
d->compatMode = NativeMode;
d()->compatMode = NativeMode;
resetTimeoutCheck();
d->timeoutTime = 0;
d->timeoutCheckCount = 0;
d()->timeoutTime = 0;
d()->timeoutCheckCount = 0;
d->currentExec = 0;
d->recursion = 0;
d->debugger = 0;
d()->currentExec = 0;
d()->recursion = 0;
d()->debugger = 0;
reset(prototype());
}
......@@ -143,100 +143,100 @@ void JSGlobalObject::reset(JSValue* prototype)
// stale (wasteful) pointers during possible garbage collection while creating
// new objects below.
ExecState* exec = &d->globalExec;
ExecState* exec = &d()->globalExec;
// Prototypes
d->functionPrototype = 0;
d->objectPrototype = 0;
d->arrayPrototype = 0;
d->stringPrototype = 0;
d->booleanPrototype = 0;
d->numberPrototype = 0;
d->datePrototype = 0;
d->regExpPrototype = 0;
d->errorPrototype = 0;
d()->functionPrototype = 0;
d()->objectPrototype = 0;
d()->arrayPrototype = 0;
d()->stringPrototype = 0;
d()->booleanPrototype = 0;
d()->numberPrototype = 0;
d()->datePrototype = 0;
d()->regExpPrototype = 0;
d()->errorPrototype = 0;
d->evalErrorPrototype = 0;
d->rangeErrorPrototype = 0;
d->referenceErrorPrototype = 0;
d->syntaxErrorPrototype = 0;
d->typeErrorPrototype = 0;
d->URIErrorPrototype = 0;
d()->evalErrorPrototype = 0;
d()->rangeErrorPrototype = 0;
d()->referenceErrorPrototype = 0;
d()->syntaxErrorPrototype = 0;
d()->typeErrorPrototype = 0;
d()->URIErrorPrototype = 0;
// Constructors
d->objectConstructor = 0;
d->functionConstructor = 0;
d->arrayConstructor = 0;
d->stringConstructor = 0;
d->booleanConstructor = 0;
d->numberConstructor = 0;
d->dateConstructor = 0;
d->regExpConstructor = 0;
d->errorConstructor = 0;
d()->objectConstructor = 0;
d()->functionConstructor = 0;
d()->arrayConstructor = 0;
d()->stringConstructor = 0;
d()->booleanConstructor = 0;
d()->numberConstructor = 0;
d()->dateConstructor = 0;
d()->regExpConstructor = 0;
d()->errorConstructor = 0;
d->evalErrorConstructor = 0;
d->rangeErrorConstructor = 0;
d->referenceErrorConstructor = 0;
d->syntaxErrorConstructor = 0;
d->typeErrorConstructor = 0;
d->URIErrorConstructor = 0;
d()->evalErrorConstructor = 0;
d()->rangeErrorConstructor = 0;
d()->referenceErrorConstructor = 0;
d()->syntaxErrorConstructor = 0;
d()->typeErrorConstructor = 0;
d()->URIErrorConstructor = 0;
// Prototypes
d->functionPrototype = new FunctionPrototype(exec);
d->objectPrototype = new ObjectPrototype(exec, d->functionPrototype);
d->functionPrototype->setPrototype(d->objectPrototype);
d->arrayPrototype = new ArrayPrototype(exec, d->objectPrototype);
d->stringPrototype = new StringPrototype(exec, d->objectPrototype);
d->booleanPrototype = new BooleanPrototype(exec, d->objectPrototype, d->functionPrototype);
d->numberPrototype = new NumberPrototype(exec, d->objectPrototype, d->functionPrototype);
d->datePrototype = new DatePrototype(exec, d->objectPrototype);
d->regExpPrototype = new RegExpPrototype(exec, d->objectPrototype, d->functionPrototype);;
d->errorPrototype = new ErrorPrototype(exec, d->objectPrototype, d->functionPrototype);
d()->functionPrototype = new FunctionPrototype(exec);
d()->objectPrototype = new ObjectPrototype(exec, d()->functionPrototype);
d()->functionPrototype->setPrototype(d()->objectPrototype);
d()->arrayPrototype = new ArrayPrototype(exec, d()->objectPrototype);
d()->stringPrototype = new StringPrototype(exec, d()->objectPrototype);
d()->booleanPrototype = new BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
d()->numberPrototype = new NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
d()->datePrototype = new DatePrototype(exec, d()->objectPrototype);
d()->regExpPrototype = new RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);;
d()->errorPrototype = new ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
d->evalErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, EvalError, "EvalError", "EvalError");
d->rangeErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, RangeError, "RangeError", "RangeError");
d->referenceErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, ReferenceError, "ReferenceError", "ReferenceError");
d->syntaxErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, SyntaxError, "SyntaxError", "SyntaxError");
d->typeErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, TypeError, "TypeError", "TypeError");
d->URIErrorPrototype = new NativeErrorPrototype(exec, d->errorPrototype, URIError, "URIError", "URIError");
d()->evalErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, EvalError, "EvalError", "EvalError");
d()->rangeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, RangeError, "RangeError", "RangeError");
d()->referenceErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, ReferenceError, "ReferenceError", "ReferenceError");
d()->syntaxErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, SyntaxError, "SyntaxError", "SyntaxError");
d()->typeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, TypeError, "TypeError", "TypeError");
d()->URIErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, URIError, "URIError", "URIError");
// Constructors
d->objectConstructor = new ObjectObjectImp(exec, d->objectPrototype, d->functionPrototype);
d->functionConstructor = new FunctionObjectImp(exec, d->functionPrototype);
d->arrayConstructor = new ArrayObjectImp(exec, d->functionPrototype, d->arrayPrototype);
d->stringConstructor = new StringObjectImp(exec, d->functionPrototype, d->stringPrototype);
d->booleanConstructor = new BooleanObjectImp(exec, d->functionPrototype, d->booleanPrototype);
d->numberConstructor = new NumberObjectImp(exec, d->functionPrototype, d->numberPrototype);
d->dateConstructor = new DateObjectImp(exec, d->functionPrototype, d->datePrototype);
d->regExpConstructor = new RegExpObjectImp(exec, d->functionPrototype, d->regExpPrototype);
d->errorConstructor = new ErrorObjectImp(exec, d->functionPrototype, d->errorPrototype);
d()->objectConstructor = new ObjectObjectImp(exec, d()->objectPrototype, d()->functionPrototype);
d()->functionConstructor = new FunctionObjectImp(exec, d()->functionPrototype);
d()->arrayConstructor = new ArrayObjectImp(exec, d()->functionPrototype, d()->arrayPrototype);
d()->stringConstructor = new StringObjectImp(exec, d()->functionPrototype, d()->stringPrototype);
d()->booleanConstructor = new BooleanObjectImp(exec, d()->functionPrototype, d()->booleanPrototype);
d()->numberConstructor = new NumberObjectImp(exec, d()->functionPrototype, d()->numberPrototype);
d()->dateConstructor = new DateObjectImp(exec, d()->functionPrototype, d()->datePrototype);
d()->regExpConstructor = new RegExpObjectImp(exec, d()->functionPrototype, d()->regExpPrototype);
d()->errorConstructor = new ErrorObjectImp(exec, d()->functionPrototype, d()->errorPrototype);
d->evalErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->evalErrorPrototype);
d->rangeErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->rangeErrorPrototype);
d->referenceErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->referenceErrorPrototype);
d->syntaxErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->syntaxErrorPrototype);
d->typeErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->typeErrorPrototype);
d->URIErrorConstructor = new NativeErrorImp(exec, d->functionPrototype, d->URIErrorPrototype);
d()->evalErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->evalErrorPrototype);
d()->rangeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->rangeErrorPrototype);
d()->referenceErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->referenceErrorPrototype);
d()->syntaxErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
d()->typeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->typeErrorPrototype);
d()->URIErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->URIErrorPrototype);
d->functionPrototype->put(exec, exec->propertyNames().constructor, d->functionConstructor, DontEnum);
d->objectPrototype->put(exec, exec->propertyNames().constructor, d->objectConstructor, DontEnum | DontDelete | ReadOnly);
d->functionPrototype->put(exec, exec->propertyNames().constructor, d->functionConstructor, DontEnum | DontDelete | ReadOnly);
d->arrayPrototype->put(exec, exec->propertyNames().constructor, d->arrayConstructor, DontEnum | DontDelete | ReadOnly);
d->booleanPrototype->put(exec, exec->propertyNames().constructor, d->booleanConstructor, DontEnum | DontDelete | ReadOnly);
d->stringPrototype->put(exec, exec->propertyNames().constructor, d->stringConstructor, DontEnum | DontDelete | ReadOnly);
d->numberPrototype->put(exec, exec->propertyNames().constructor, d->numberConstructor, DontEnum | DontDelete | ReadOnly);
d->datePrototype->put(exec, exec->propertyNames().constructor, d->dateConstructor, DontEnum | DontDelete | ReadOnly);
d->regExpPrototype->put(exec, exec->propertyNames().constructor, d->regExpConstructor, DontEnum | DontDelete | ReadOnly);
d->errorPrototype->put(exec, exec->propertyNames().constructor, d->errorConstructor, DontEnum | DontDelete | ReadOnly);
d->evalErrorPrototype->put(exec, exec->propertyNames().constructor, d->evalErrorConstructor, DontEnum | DontDelete | ReadOnly);
d->rangeErrorPrototype->put(exec, exec->propertyNames().constructor, d->rangeErrorConstructor, DontEnum | DontDelete | ReadOnly);
d->referenceErrorPrototype->put(exec, exec->propertyNames().constructor, d->referenceErrorConstructor, DontEnum | DontDelete | ReadOnly);
d->syntaxErrorPrototype->put(exec, exec->propertyNames().constructor, d->syntaxErrorConstructor, DontEnum | DontDelete | ReadOnly);
d->typeErrorPrototype->put(exec, exec->propertyNames().constructor, d->typeErrorConstructor, DontEnum | DontDelete | ReadOnly);
d->URIErrorPrototype->put(exec, exec->propertyNames().constructor, d->URIErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->functionPrototype->put(exec, exec->propertyNames().constructor, d()->functionConstructor, DontEnum);
d()->objectPrototype->put(exec, exec->propertyNames().constructor, d()->objectConstructor, DontEnum | DontDelete | ReadOnly);
d()->functionPrototype->put(exec, exec->propertyNames().constructor, d()->functionConstructor, DontEnum | DontDelete | ReadOnly);
d()->arrayPrototype->put(exec, exec->propertyNames().constructor, d()->arrayConstructor, DontEnum | DontDelete | ReadOnly);
d()->booleanPrototype->put(exec, exec->propertyNames().constructor, d()->booleanConstructor, DontEnum | DontDelete | ReadOnly);
d()->stringPrototype->put(exec, exec->propertyNames().constructor, d()->stringConstructor, DontEnum | DontDelete | ReadOnly);
d()->numberPrototype->put(exec, exec->propertyNames().constructor, d()->numberConstructor, DontEnum | DontDelete | ReadOnly);
d()->datePrototype->put(exec, exec->propertyNames().constructor, d()->dateConstructor, DontEnum | DontDelete | ReadOnly);
d()->regExpPrototype->put(exec, exec->propertyNames().constructor, d()->regExpConstructor, DontEnum | DontDelete | ReadOnly);
d()->errorPrototype->put(exec, exec->propertyNames().constructor, d()->errorConstructor, DontEnum | DontDelete | ReadOnly);
d()->evalErrorPrototype->put(exec, exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->rangeErrorPrototype->put(exec, exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->referenceErrorPrototype->put(exec, exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->syntaxErrorPrototype->put(exec, exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->typeErrorPrototype->put(exec, exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum | DontDelete | ReadOnly);
d()->URIErrorPrototype->put(exec, exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum | DontDelete | ReadOnly);
// Set global constructors
......@@ -246,25 +246,25 @@ void JSGlobalObject::reset(JSValue* prototype)
// FIXME: These properties should be handled by a static hash table.
putDirect("Object", d->objectConstructor, DontEnum);
putDirect("Function", d->functionConstructor, DontEnum);
putDirect("Array", d->arrayConstructor, DontEnum);
putDirect("Boolean", d->booleanConstructor, DontEnum);
putDirect("String", d->stringConstructor, DontEnum);
putDirect("Number", d->numberConstructor, DontEnum);
putDirect("Date", d->dateConstructor, DontEnum);
putDirect("RegExp", d->regExpConstructor, DontEnum);
putDirect("Error", d->errorConstructor, DontEnum);
putDirect("EvalError", d->evalErrorConstructor, Internal);
putDirect("RangeError", d->rangeErrorConstructor, Internal);
putDirect("ReferenceError", d->referenceErrorConstructor, Internal);
putDirect("SyntaxError", d->syntaxErrorConstructor, Internal);
putDirect("TypeError", d->typeErrorConstructor, Internal);
putDirect("URIError", d->URIErrorConstructor, Internal);
putDirect("Object", d()->objectConstructor, DontEnum);
putDirect("Function", d()->functionConstructor, DontEnum);
putDirect("Array", d()->arrayConstructor, DontEnum);
putDirect("Boolean", d()->booleanConstructor, DontEnum);
putDirect("String", d()->stringConstructor, DontEnum);
putDirect("Number", d()->numberConstructor, DontEnum);
putDirect("Date", d()->dateConstructor, DontEnum);
putDirect("RegExp", d()->regExpConstructor, DontEnum);
putDirect("Error", d()->errorConstructor, DontEnum);
putDirect("EvalError", d()->evalErrorConstructor, Internal);
putDirect("RangeError", d()->rangeErrorConstructor, Internal);
putDirect("ReferenceError", d()->referenceErrorConstructor, Internal);
putDirect("SyntaxError", d()->syntaxErrorConstructor, Internal);
putDirect("TypeError", d()->typeErrorConstructor, Internal);
putDirect("URIError", d()->URIErrorConstructor, Internal);
// Set global values.
putDirect("Math", new MathObjectImp(exec, d->objectPrototype), DontEnum);
putDirect("Math", new MathObjectImp(exec, d()->objectPrototype), DontEnum);
putDirect("NaN", jsNaN(), DontEnum | DontDelete);
putDirect("Infinity", jsNumber(Inf), DontEnum | DontDelete);
......@@ -272,78 +272,78 @@ void JSGlobalObject::reset(JSValue* prototype)
// Set global functions.
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::Eval, 1, "eval"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::ParseInt, 2, "parseInt"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::ParseFloat, 1, "parseFloat"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::IsNaN, 1, "isNaN"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::IsFinite, 1, "isFinite"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::Escape, 1, "escape"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::UnEscape, 1, "unescape"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::DecodeURI, 1, "decodeURI"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::DecodeURIComponent, 1, "decodeURIComponent"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::EncodeURI, 1, "encodeURI"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::EncodeURIComponent, 1, "encodeURIComponent"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::Eval, 1, "eval"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::ParseInt, 2, "parseInt"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::ParseFloat, 1, "parseFloat"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::IsNaN, 1, "isNaN"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::IsFinite, 1, "isFinite"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::Escape, 1, "escape"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::UnEscape, 1, "unescape"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::DecodeURI, 1, "decodeURI"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::DecodeURIComponent, 1, "decodeURIComponent"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::EncodeURI, 1, "encodeURI"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::EncodeURIComponent, 1, "encodeURIComponent"), DontEnum);
#ifndef NDEBUG
putDirectFunction(new GlobalFuncImp(exec, d->functionPrototype, GlobalFuncImp::KJSPrint, 1, "kjsprint"), DontEnum);
putDirectFunction(new GlobalFuncImp(exec, d()->functionPrototype, GlobalFuncImp::KJSPrint, 1, "kjsprint"), DontEnum);