JavaScriptCore:
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Dec 2007 22:05:55 +0000 (22:05 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Dec 2007 22:05:55 +0000 (22:05 +0000)
        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: https://svn.webkit.org/repository/webkit/trunk@28527 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/JavaScriptCoreSources.bkl
JavaScriptCore/kjs/ExecState.cpp
JavaScriptCore/kjs/ExecState.h
JavaScriptCore/kjs/JSGlobalObject.cpp
JavaScriptCore/kjs/JSGlobalObject.h
JavaScriptCore/kjs/JSVariableObject.cpp [new file with mode: 0644]
JavaScriptCore/kjs/JSVariableObject.h [new file with mode: 0644]
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function.h
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/object.h
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/ListRefPtr.h [new file with mode: 0644]
WebCore/bindings/js/JSXSLTProcessor.cpp
WebCore/bindings/js/kjs_binding.cpp
WebKit/mac/ChangeLog
WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h [new file with mode: 0644]

index e06fdc8ab5db5c8aa22229a12e65ec3decfc8b43..1c575a72bd95b14cc0c10e6cda63a1349e62a8cd 100644 (file)
@@ -1,3 +1,13 @@
+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.
index 022e250091cabd30ac732c8289081d9f14b40f28..2e80aac59f25354977d72acfb4f363ea9f529856 100644 (file)
@@ -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
index e951fc6803faa3b830d7ed23510bcce6e3f3fc16..93790511d8d7444876b672c6f796cc8783a8ee5b 100644 (file)
                                RelativePath="..\..\kjs\JSGlobalObject.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\kjs\JSVariableObject.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\kjs\JSVariableObject.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\kjs\JSImmediate.cpp"\r
                                >\r
index ced6efae5d1d8e3ef41663a22c5229a7553d2db7..7aa7e34c8fed0dfc9876a0e3f506fa1eadc41b84 100644 (file)
@@ -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, ); }; };
                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, ); }; };
                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, ); }; };
                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>"; };
                65417200039E01BA0058BFEB /* kjs */ = {
                        isa = PBXGroup;
                        children = (
+                               14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */,
                                659126BC0BDD1728001921FB /* AllInOneFile.cpp */,
                                93ADFCE60CCBD7AC00D30B08 /* array_instance.cpp */,
                                938772E5038BFE19008635CE /* array_instance.h */,
                                65EA4C9A092AF9E20093D800 /* JSLock.h */,
                                14ABB454099C2A0F00E2A24F /* JSType.h */,
                                1482B6EA0A4300B300517CFC /* JSValueRef.h */,
+                               14F252560D08DD8D004ECFFF /* JSVariableObject.h */,
                                65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
                                65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */,
                                93F1981A08245AAE001E9ABC /* keywords.table */,
                                E1EF79AB0CE97BA60088D500 /* UTF8.h in Headers */,
                                1419D32D0CEA7CDE00FF507A /* RefCounted.h in Headers */,
                                5DA479660CFBCF56009328A0 /* TCPackedCache.h in Headers */,
+                               14F252570D08DD8D004ECFFF /* JSVariableObject.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                932F5BC50822A1C700736975 /* runtime_root.cpp in Sources */,
                                E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
                                14DE0D690D02431400AACCA2 /* JSGlobalObject.cpp in Sources */,
+                               14F252610D08DF2F004ECFFF /* JSVariableObject.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 602f74b6b22c80d85624c49fdaa926f32e454943..c1601156a83f260596ec38e12e0d5e068c7be115 100644 (file)
@@ -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
index e8e74bc09e771ff7743712523104fb19e296bf20..b682f276e0ca4d1ed51ae805daa24cb35ecc3936 100644 (file)
@@ -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
index 64be7ac7d7c384b8010c97899fc42a1403751ae5..9b22b372a10d20bb831723df0ffc432c8975fc29 100644 (file)
@@ -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;
index 15774cee9e9f7ba460d95e0b410f09f3bd5f6304..702dbd255a9678004811b240120910520675bb7e 100644 (file)
@@ -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);
 #endif
 
     // Set prototype, and also insert the object prototype at the end of the chain.
 
     setPrototype(prototype);
-    lastInPrototypeChain(this)->setPrototype(d->objectPrototype);
+    lastInPrototypeChain(this)->setPrototype(d()->objectPrototype);
 }
 
 void JSGlobalObject::startTimeoutCheck()
 {
-    if (!d->timeoutCheckCount)
+    if (!d()->timeoutCheckCount)
         resetTimeoutCheck();
     
-    ++d->timeoutCheckCount;
+    ++d()->timeoutCheckCount;
 }
 
 void JSGlobalObject::stopTimeoutCheck()
 {
-    --d->timeoutCheckCount;
+    --d()->timeoutCheckCount;
 }
 
 void JSGlobalObject::resetTimeoutCheck()
 {
-    d->tickCount = 0;
-    d->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
-    d->timeAtLastCheckTimeout = 0;
-    d->timeExecuting = 0;
+    d()->tickCount = 0;
+    d()->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
+    d()->timeAtLastCheckTimeout = 0;
+    d()->timeExecuting = 0;
 }
 
 bool JSGlobalObject::checkTimeout()
 {    
-    d->tickCount = 0;
+    d()->tickCount = 0;
     
     unsigned currentTime = getCurrentTime();
 
-    if (!d->timeAtLastCheckTimeout) {
+    if (!d()->timeAtLastCheckTimeout) {
         // Suspicious amount of looping in a script -- start timing it
-        d->timeAtLastCheckTimeout = currentTime;
+        d()->timeAtLastCheckTimeout = currentTime;
         return false;
     }
 
-    unsigned timeDiff = currentTime - d->timeAtLastCheckTimeout;
+    unsigned timeDiff = currentTime - d()->timeAtLastCheckTimeout;
 
     if (timeDiff == 0)
         timeDiff = 1;
     
-    d->timeExecuting += timeDiff;
-    d->timeAtLastCheckTimeout = currentTime;
+    d()->timeExecuting += timeDiff;
+    d()->timeAtLastCheckTimeout = currentTime;
     
     // Adjust the tick threshold so we get the next checkTimeout call in the interval specified in 
     // preferredScriptCheckTimeInterval
-    d->ticksUntilNextTimeoutCheck = (unsigned)((float)preferredScriptCheckTimeInterval / timeDiff) * d->ticksUntilNextTimeoutCheck;
+    d()->ticksUntilNextTimeoutCheck = (unsigned)((float)preferredScriptCheckTimeInterval / timeDiff) * d()->ticksUntilNextTimeoutCheck;
 
     // If the new threshold is 0 reset it to the default threshold. This can happen if the timeDiff is higher than the
     // preferred script check time interval.
-    if (d->ticksUntilNextTimeoutCheck == 0)
-        d->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
+    if (d()->ticksUntilNextTimeoutCheck == 0)
+        d()->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
 
-    if (d->timeoutTime && d->timeExecuting > d->timeoutTime) {
+    if (d()->timeoutTime && d()->timeExecuting > d()->timeoutTime) {
         if (shouldInterruptScript())
             return true;
         
@@ -358,37 +358,37 @@ void JSGlobalObject::saveBuiltins(SavedBuiltins& builtins) const
     if (!builtins._internal)
         builtins._internal = new SavedBuiltinsInternal;
 
-    builtins._internal->objectConstructor = d->objectConstructor;
-    builtins._internal->functionConstructor = d->functionConstructor;
-    builtins._internal->arrayConstructor = d->arrayConstructor;
-    builtins._internal->booleanConstructor = d->booleanConstructor;
-    builtins._internal->stringConstructor = d->stringConstructor;
-    builtins._internal->numberConstructor = d->numberConstructor;
-    builtins._internal->dateConstructor = d->dateConstructor;
-    builtins._internal->regExpConstructor = d->regExpConstructor;
-    builtins._internal->errorConstructor = d->errorConstructor;
-    builtins._internal->evalErrorConstructor = d->evalErrorConstructor;
-    builtins._internal->rangeErrorConstructor = d->rangeErrorConstructor;
-    builtins._internal->referenceErrorConstructor = d->referenceErrorConstructor;
-    builtins._internal->syntaxErrorConstructor = d->syntaxErrorConstructor;
-    builtins._internal->typeErrorConstructor = d->typeErrorConstructor;
-    builtins._internal->URIErrorConstructor = d->URIErrorConstructor;
+    builtins._internal->objectConstructor = d()->objectConstructor;
+    builtins._internal->functionConstructor = d()->functionConstructor;
+    builtins._internal->arrayConstructor = d()->arrayConstructor;
+    builtins._internal->booleanConstructor = d()->booleanConstructor;
+    builtins._internal->stringConstructor = d()->stringConstructor;
+    builtins._internal->numberConstructor = d()->numberConstructor;
+    builtins._internal->dateConstructor = d()->dateConstructor;
+    builtins._internal->regExpConstructor = d()->regExpConstructor;
+    builtins._internal->errorConstructor = d()->errorConstructor;
+    builtins._internal->evalErrorConstructor = d()->evalErrorConstructor;
+    builtins._internal->rangeErrorConstructor = d()->rangeErrorConstructor;
+    builtins._internal->referenceErrorConstructor = d()->referenceErrorConstructor;
+    builtins._internal->syntaxErrorConstructor = d()->syntaxErrorConstructor;
+    builtins._internal->typeErrorConstructor = d()->typeErrorConstructor;
+    builtins._internal->URIErrorConstructor = d()->URIErrorConstructor;
     
-    builtins._internal->objectPrototype = d->objectPrototype;
-    builtins._internal->functionPrototype = d->functionPrototype;
-    builtins._internal->arrayPrototype = d->arrayPrototype;
-    builtins._internal->booleanPrototype = d->booleanPrototype;
-    builtins._internal->stringPrototype = d->stringPrototype;
-    builtins._internal->numberPrototype = d->numberPrototype;
-    builtins._internal->datePrototype = d->datePrototype;
-    builtins._internal->regExpPrototype = d->regExpPrototype;
-    builtins._internal->errorPrototype = d->errorPrototype;
-    builtins._internal->evalErrorPrototype = d->evalErrorPrototype;
-    builtins._internal->rangeErrorPrototype = d->rangeErrorPrototype;
-    builtins._internal->referenceErrorPrototype = d->referenceErrorPrototype;
-    builtins._internal->syntaxErrorPrototype = d->syntaxErrorPrototype;
-    builtins._internal->typeErrorPrototype = d->typeErrorPrototype;
-    builtins._internal->URIErrorPrototype = d->URIErrorPrototype;
+    builtins._internal->objectPrototype = d()->objectPrototype;
+    builtins._internal->functionPrototype = d()->functionPrototype;
+    builtins._internal->arrayPrototype = d()->arrayPrototype;
+    builtins._internal->booleanPrototype = d()->booleanPrototype;
+    builtins._internal->stringPrototype = d()->stringPrototype;
+    builtins._internal->numberPrototype = d()->numberPrototype;
+    builtins._internal->datePrototype = d()->datePrototype;
+    builtins._internal->regExpPrototype = d()->regExpPrototype;
+    builtins._internal->errorPrototype = d()->errorPrototype;
+    builtins._internal->evalErrorPrototype = d()->evalErrorPrototype;
+    builtins._internal->rangeErrorPrototype = d()->rangeErrorPrototype;
+    builtins._internal->referenceErrorPrototype = d()->referenceErrorPrototype;
+    builtins._internal->syntaxErrorPrototype = d()->syntaxErrorPrototype;
+    builtins._internal->typeErrorPrototype = d()->typeErrorPrototype;
+    builtins._internal->URIErrorPrototype = d()->URIErrorPrototype;
 }
 
 void JSGlobalObject::restoreBuiltins(const SavedBuiltins& builtins)
@@ -396,84 +396,84 @@ void JSGlobalObject::restoreBuiltins(const SavedBuiltins& builtins)
     if (!builtins._internal)
         return;
 
-    d->objectConstructor = builtins._internal->objectConstructor;
-    d->functionConstructor = builtins._internal->functionConstructor;
-    d->arrayConstructor = builtins._internal->arrayConstructor;
-    d->booleanConstructor = builtins._internal->booleanConstructor;
-    d->stringConstructor = builtins._internal->stringConstructor;
-    d->numberConstructor = builtins._internal->numberConstructor;
-    d->dateConstructor = builtins._internal->dateConstructor;
-    d->regExpConstructor = builtins._internal->regExpConstructor;
-    d->errorConstructor = builtins._internal->errorConstructor;
-    d->evalErrorConstructor = builtins._internal->evalErrorConstructor;
-    d->rangeErrorConstructor = builtins._internal->rangeErrorConstructor;
-    d->referenceErrorConstructor = builtins._internal->referenceErrorConstructor;
-    d->syntaxErrorConstructor = builtins._internal->syntaxErrorConstructor;
-    d->typeErrorConstructor = builtins._internal->typeErrorConstructor;
-    d->URIErrorConstructor = builtins._internal->URIErrorConstructor;
-
-    d->objectPrototype = builtins._internal->objectPrototype;
-    d->functionPrototype = builtins._internal->functionPrototype;
-    d->arrayPrototype = builtins._internal->arrayPrototype;
-    d->booleanPrototype = builtins._internal->booleanPrototype;
-    d->stringPrototype = builtins._internal->stringPrototype;
-    d->numberPrototype = builtins._internal->numberPrototype;
-    d->datePrototype = builtins._internal->datePrototype;
-    d->regExpPrototype = builtins._internal->regExpPrototype;
-    d->errorPrototype = builtins._internal->errorPrototype;
-    d->evalErrorPrototype = builtins._internal->evalErrorPrototype;
-    d->rangeErrorPrototype = builtins._internal->rangeErrorPrototype;
-    d->referenceErrorPrototype = builtins._internal->referenceErrorPrototype;
-    d->syntaxErrorPrototype = builtins._internal->syntaxErrorPrototype;
-    d->typeErrorPrototype = builtins._internal->typeErrorPrototype;
-    d->URIErrorPrototype = builtins._internal->URIErrorPrototype;
+    d()->objectConstructor = builtins._internal->objectConstructor;
+    d()->functionConstructor = builtins._internal->functionConstructor;
+    d()->arrayConstructor = builtins._internal->arrayConstructor;
+    d()->booleanConstructor = builtins._internal->booleanConstructor;
+    d()->stringConstructor = builtins._internal->stringConstructor;
+    d()->numberConstructor = builtins._internal->numberConstructor;
+    d()->dateConstructor = builtins._internal->dateConstructor;
+    d()->regExpConstructor = builtins._internal->regExpConstructor;
+    d()->errorConstructor = builtins._internal->errorConstructor;
+    d()->evalErrorConstructor = builtins._internal->evalErrorConstructor;
+    d()->rangeErrorConstructor = builtins._internal->rangeErrorConstructor;
+    d()->referenceErrorConstructor = builtins._internal->referenceErrorConstructor;
+    d()->syntaxErrorConstructor = builtins._internal->syntaxErrorConstructor;
+    d()->typeErrorConstructor = builtins._internal->typeErrorConstructor;
+    d()->URIErrorConstructor = builtins._internal->URIErrorConstructor;
+
+    d()->objectPrototype = builtins._internal->objectPrototype;
+    d()->functionPrototype = builtins._internal->functionPrototype;
+    d()->arrayPrototype = builtins._internal->arrayPrototype;
+    d()->booleanPrototype = builtins._internal->booleanPrototype;
+    d()->stringPrototype = builtins._internal->stringPrototype;
+    d()->numberPrototype = builtins._internal->numberPrototype;
+    d()->datePrototype = builtins._internal->datePrototype;
+    d()->regExpPrototype = builtins._internal->regExpPrototype;
+    d()->errorPrototype = builtins._internal->errorPrototype;
+    d()->evalErrorPrototype = builtins._internal->evalErrorPrototype;
+    d()->rangeErrorPrototype = builtins._internal->rangeErrorPrototype;
+    d()->referenceErrorPrototype = builtins._internal->referenceErrorPrototype;
+    d()->syntaxErrorPrototype = builtins._internal->syntaxErrorPrototype;
+    d()->typeErrorPrototype = builtins._internal->typeErrorPrototype;
+    d()->URIErrorPrototype = builtins._internal->URIErrorPrototype;
 }
 
 void JSGlobalObject::mark()
 {
-    JSObject::mark();
-
-    if (d->currentExec)
-        d->currentExec->mark();
-
-    markIfNeeded(d->globalExec.exception());
-
-    markIfNeeded(d->objectConstructor);
-    markIfNeeded(d->functionConstructor);
-    markIfNeeded(d->arrayConstructor);
-    markIfNeeded(d->booleanConstructor);
-    markIfNeeded(d->stringConstructor);
-    markIfNeeded(d->numberConstructor);
-    markIfNeeded(d->dateConstructor);
-    markIfNeeded(d->regExpConstructor);
-    markIfNeeded(d->errorConstructor);
-    markIfNeeded(d->evalErrorConstructor);
-    markIfNeeded(d->rangeErrorConstructor);
-    markIfNeeded(d->referenceErrorConstructor);
-    markIfNeeded(d->syntaxErrorConstructor);
-    markIfNeeded(d->typeErrorConstructor);
-    markIfNeeded(d->URIErrorConstructor);
+    JSVariableObject::mark();
+
+    if (d()->currentExec)
+        d()->currentExec->mark();
+
+    markIfNeeded(d()->globalExec.exception());
+
+    markIfNeeded(d()->objectConstructor);
+    markIfNeeded(d()->functionConstructor);
+    markIfNeeded(d()->arrayConstructor);
+    markIfNeeded(d()->booleanConstructor);
+    markIfNeeded(d()->stringConstructor);
+    markIfNeeded(d()->numberConstructor);
+    markIfNeeded(d()->dateConstructor);
+    markIfNeeded(d()->regExpConstructor);
+    markIfNeeded(d()->errorConstructor);
+    markIfNeeded(d()->evalErrorConstructor);
+    markIfNeeded(d()->rangeErrorConstructor);
+    markIfNeeded(d()->referenceErrorConstructor);
+    markIfNeeded(d()->syntaxErrorConstructor);
+    markIfNeeded(d()->typeErrorConstructor);
+    markIfNeeded(d()->URIErrorConstructor);
     
-    markIfNeeded(d->objectPrototype);
-    markIfNeeded(d->functionPrototype);
-    markIfNeeded(d->arrayPrototype);
-    markIfNeeded(d->booleanPrototype);
-    markIfNeeded(d->stringPrototype);
-    markIfNeeded(d->numberPrototype);
-    markIfNeeded(d->datePrototype);
-    markIfNeeded(d->regExpPrototype);
-    markIfNeeded(d->errorPrototype);
-    markIfNeeded(d->evalErrorPrototype);
-    markIfNeeded(d->rangeErrorPrototype);
-    markIfNeeded(d->referenceErrorPrototype);
-    markIfNeeded(d->syntaxErrorPrototype);
-    markIfNeeded(d->typeErrorPrototype);
-    markIfNeeded(d->URIErrorPrototype);
+    markIfNeeded(d()->objectPrototype);
+    markIfNeeded(d()->functionPrototype);
+    markIfNeeded(d()->arrayPrototype);
+    markIfNeeded(d()->booleanPrototype);
+    markIfNeeded(d()->stringPrototype);
+    markIfNeeded(d()->numberPrototype);
+    markIfNeeded(d()->datePrototype);
+    markIfNeeded(d()->regExpPrototype);
+    markIfNeeded(d()->errorPrototype);
+    markIfNeeded(d()->evalErrorPrototype);
+    markIfNeeded(d()->rangeErrorPrototype);
+    markIfNeeded(d()->referenceErrorPrototype);
+    markIfNeeded(d()->syntaxErrorPrototype);
+    markIfNeeded(d()->typeErrorPrototype);
+    markIfNeeded(d()->URIErrorPrototype);
 }
 
 ExecState* JSGlobalObject::globalExec()
 {
-    return &d->globalExec;
+    return &d()->globalExec;
 }
 
 } // namespace KJS
index 8f14b85b2acc4b527cfc27e9739e4e7fe1211a16..0ffedebddcd900edd0c56c99684b5a4bd020beae 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef KJS_GlobalObject_h
 #define KJS_GlobalObject_h
 
-#include "object.h"
+#include "JSVariableObject.h"
 
 namespace KJS {
 
@@ -67,11 +67,14 @@ namespace KJS {
 
     enum CompatMode { NativeMode, IECompat, NetscapeCompat };
 
-    class JSGlobalObject : public JSObject {
+    class JSGlobalObject : public JSVariableObject {
     protected:
-        struct JSGlobalObjectData {
+        using JSVariableObject::JSVariableObjectData;
+
+        struct JSGlobalObjectData : public JSVariableObjectData {
             JSGlobalObjectData(JSGlobalObject* globalObject)
-                : globalExec(globalObject, globalObject, 0)
+                : JSVariableObjectData(&inlineSymbolTable)
+                , globalExec(globalObject, globalObject, 0)
             {
             }
 
@@ -80,7 +83,7 @@ namespace KJS {
 
             Debugger* debugger;
             CompatMode compatMode;
-
+            
             ExecState globalExec;
             ExecState* currentExec;
             int recursion;
@@ -123,17 +126,20 @@ namespace KJS {
             NativeErrorPrototype* syntaxErrorPrototype;
             NativeErrorPrototype* typeErrorPrototype;
             NativeErrorPrototype* URIErrorPrototype;
+
+            SymbolTable inlineSymbolTable;
         };
 
     public:
         JSGlobalObject()
+            : JSVariableObject(new JSGlobalObjectData(this))
         {
             init();
         }
 
     protected:
         JSGlobalObject(JSValue* proto)
-            : JSObject(proto)
+            : JSVariableObject(proto, new JSGlobalObjectData(this))
         {
             init();
         }
@@ -143,7 +149,7 @@ namespace KJS {
 
         // Linked list of all global objects.
         static JSGlobalObject* head() { return s_head; }
-        JSGlobalObject* next() { return d->next; }
+        JSGlobalObject* next() { return d()->next; }
 
         // Resets the global object to contain only built-in properties, sets
         // the global object's prototype to "prototype," then adds the 
@@ -154,59 +160,59 @@ namespace KJS {
         // The following accessors return pristine values, even if a script 
         // replaces the global object's associated property.
 
-        ObjectObjectImp* objectConstructor() const { return d->objectConstructor; }
-        FunctionObjectImp* functionConstructor() const { return d->functionConstructor; }
-        ArrayObjectImp* arrayConstructor() const { return d->arrayConstructor; }
-        BooleanObjectImp* booleanConstructor() const { return d->booleanConstructor; }
-        StringObjectImp* stringConstructor() const{ return d->stringConstructor; }
-        NumberObjectImp* numberConstructor() const{ return d->numberConstructor; }
-        DateObjectImp* dateConstructor() const{ return d->dateConstructor; }
-        RegExpObjectImp* regExpConstructor() const { return d->regExpConstructor; }
-        ErrorObjectImp* errorConstructor() const { return d->errorConstructor; }
-        NativeErrorImp* evalErrorConstructor() const { return d->evalErrorConstructor; }
-        NativeErrorImp* rangeErrorConstructor() const { return d->rangeErrorConstructor; }
-        NativeErrorImp* referenceErrorConstructor() const { return d->referenceErrorConstructor; }
-        NativeErrorImp* syntaxErrorConstructor() const { return d->syntaxErrorConstructor; }
-        NativeErrorImp* typeErrorConstructor() const { return d->typeErrorConstructor; }
-        NativeErrorImp* URIErrorConstructor() const { return d->URIErrorConstructor; }
-
-        ObjectPrototype* objectPrototype() const { return d->objectPrototype; }
-        FunctionPrototype* functionPrototype() const { return d->functionPrototype; }
-        ArrayPrototype* arrayPrototype() const { return d->arrayPrototype; }
-        BooleanPrototype* booleanPrototype() const { return d->booleanPrototype; }
-        StringPrototype* stringPrototype() const { return d->stringPrototype; }
-        NumberPrototype* numberPrototype() const { return d->numberPrototype; }
-        DatePrototype* datePrototype() const { return d->datePrototype; }
-        RegExpPrototype* regExpPrototype() const { return d->regExpPrototype; }
-        ErrorPrototype* errorPrototype() const { return d->errorPrototype; }
-        NativeErrorPrototype* evalErrorPrototype() const { return d->evalErrorPrototype; }
-        NativeErrorPrototype* rangeErrorPrototype() const { return d->rangeErrorPrototype; }
-        NativeErrorPrototype* referenceErrorPrototype() const { return d->referenceErrorPrototype; }
-        NativeErrorPrototype* syntaxErrorPrototype() const { return d->syntaxErrorPrototype; }
-        NativeErrorPrototype* typeErrorPrototype() const { return d->typeErrorPrototype; }
-        NativeErrorPrototype* URIErrorPrototype() const { return d->URIErrorPrototype; }
+        ObjectObjectImp* objectConstructor() const { return d()->objectConstructor; }
+        FunctionObjectImp* functionConstructor() const { return d()->functionConstructor; }
+        ArrayObjectImp* arrayConstructor() const { return d()->arrayConstructor; }
+        BooleanObjectImp* booleanConstructor() const { return d()->booleanConstructor; }
+        StringObjectImp* stringConstructor() const{ return d()->stringConstructor; }
+        NumberObjectImp* numberConstructor() const{ return d()->numberConstructor; }
+        DateObjectImp* dateConstructor() const{ return d()->dateConstructor; }
+        RegExpObjectImp* regExpConstructor() const { return d()->regExpConstructor; }
+        ErrorObjectImp* errorConstructor() const { return d()->errorConstructor; }
+        NativeErrorImp* evalErrorConstructor() const { return d()->evalErrorConstructor; }
+        NativeErrorImp* rangeErrorConstructor() const { return d()->rangeErrorConstructor; }
+        NativeErrorImp* referenceErrorConstructor() const { return d()->referenceErrorConstructor; }
+        NativeErrorImp* syntaxErrorConstructor() const { return d()->syntaxErrorConstructor; }
+        NativeErrorImp* typeErrorConstructor() const { return d()->typeErrorConstructor; }
+        NativeErrorImp* URIErrorConstructor() const { return d()->URIErrorConstructor; }
+
+        ObjectPrototype* objectPrototype() const { return d()->objectPrototype; }
+        FunctionPrototype* functionPrototype() const { return d()->functionPrototype; }
+        ArrayPrototype* arrayPrototype() const { return d()->arrayPrototype; }
+        BooleanPrototype* booleanPrototype() const { return d()->booleanPrototype; }
+        StringPrototype* stringPrototype() const { return d()->stringPrototype; }
+        NumberPrototype* numberPrototype() const { return d()->numberPrototype; }
+        DatePrototype* datePrototype() const { return d()->datePrototype; }
+        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
+        ErrorPrototype* errorPrototype() const { return d()->errorPrototype; }
+        NativeErrorPrototype* evalErrorPrototype() const { return d()->evalErrorPrototype; }
+        NativeErrorPrototype* rangeErrorPrototype() const { return d()->rangeErrorPrototype; }
+        NativeErrorPrototype* referenceErrorPrototype() const { return d()->referenceErrorPrototype; }
+        NativeErrorPrototype* syntaxErrorPrototype() const { return d()->syntaxErrorPrototype; }
+        NativeErrorPrototype* typeErrorPrototype() const { return d()->typeErrorPrototype; }
+        NativeErrorPrototype* URIErrorPrototype() const { return d()->URIErrorPrototype; }
 
         void saveBuiltins(SavedBuiltins&) const;
         void restoreBuiltins(const SavedBuiltins&);
 
-        void setTimeoutTime(unsigned timeoutTime) { d->timeoutTime = timeoutTime; }
+        void setTimeoutTime(unsigned timeoutTime) { d()->timeoutTime = timeoutTime; }
         void startTimeoutCheck();
         void stopTimeoutCheck();
         bool timedOut();
 
-        Debugger* debugger() const { return d->debugger; }
-        void setDebugger(Debugger* debugger) { d->debugger = debugger; }
+        Debugger* debugger() const { return d()->debugger; }
+        void setDebugger(Debugger* debugger) { d()->debugger = debugger; }
 
-        void setCurrentExec(ExecState* exec) { d->currentExec = exec; }
-        ExecState* currentExec() const { return d->currentExec; }
+        void setCurrentExec(ExecState* exec) { d()->currentExec = exec; }
+        ExecState* currentExec() const { return d()->currentExec; }
 
         // FIXME: Let's just pick one compatible behavior and go with it.
-        void setCompatMode(CompatMode mode) { d->compatMode = mode; }
-        CompatMode compatMode() const { return d->compatMode; }
+        void setCompatMode(CompatMode mode) { d()->compatMode = mode; }
+        CompatMode compatMode() const { return d()->compatMode; }
         
-        int recursion() { return d->recursion; }
-        void incRecursion() { ++d->recursion; }
-        void decRecursion() { --d->recursion; }
+        int recursion() { return d()->recursion; }
+        void incRecursion() { ++d()->recursion; }
+        void decRecursion() { --d()->recursion; }
 
         virtual void mark();
 
@@ -218,11 +224,10 @@ namespace KJS {
 
         virtual bool isSafeScript(const JSGlobalObject*) const { return true; }
 
-    protected:
-        std::auto_ptr<JSGlobalObjectData> d;
-
     private:
         void init();
+        
+        JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
 
         bool checkTimeout();
         void resetTimeoutCheck();
@@ -232,9 +237,9 @@ namespace KJS {
 
     inline bool JSGlobalObject::timedOut()
     {
-        d->tickCount++;
+        d()->tickCount++;
 
-        if (d->tickCount != d->ticksUntilNextTimeoutCheck)
+        if (d()->tickCount != d()->ticksUntilNextTimeoutCheck)
             return false;
 
         return checkTimeout();
diff --git a/JavaScriptCore/kjs/JSVariableObject.cpp b/JavaScriptCore/kjs/JSVariableObject.cpp
new file mode 100644 (file)
index 0000000..f951a06
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSVariableObject.h"
+
+#include "PropertyNameArray.h"
+
+namespace KJS {
+
+bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+    if (symbolTable().contains(propertyName.ustring().rep()))
+        return false;
+
+    return JSObject::deleteProperty(exec, propertyName);
+}
+
+void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+{
+    SymbolTable::const_iterator::Keys end = symbolTable().end().keys();
+    for (SymbolTable::const_iterator::Keys it = symbolTable().begin().keys(); it != end; ++it)
+        propertyNames.add(Identifier(*it));
+
+    JSObject::getPropertyNames(exec, propertyNames);
+}
+
+void JSVariableObject::mark()
+{
+    JSObject::mark();
+
+    size_t size = d->localStorage.size();
+    for (size_t i = 0; i < size; ++i) {
+        JSValue* value = d->localStorage[i].value;
+        if (!value->marked())
+            value->mark();
+    }
+}
+
+} // namespace KJS
diff --git a/JavaScriptCore/kjs/JSVariableObject.h b/JavaScriptCore/kjs/JSVariableObject.h
new file mode 100644 (file)
index 0000000..1a41e26
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSVariableObject_h
+#define JSVariableObject_h
+
+#include "LocalStorage.h"
+#include "SymbolTable.h"
+#include "object.h"
+
+namespace KJS {
+
+    class JSVariableObject : public JSObject {
+    public:
+        SymbolTable& symbolTable() { return *d->symbolTable; }
+        LocalStorage& localStorage() { return d->localStorage; }
+
+        virtual bool deleteProperty(ExecState*, const Identifier&);
+        virtual void getPropertyNames(ExecState*, PropertyNameArray&);
+        
+        virtual void mark();
+
+    protected:
+        // Subclasses of JSVariableObject can subclass this struct to add data
+        // without increasing their own size (since there's a hard limit on the
+        // size of a JSCell).
+        struct JSVariableObjectData {
+            JSVariableObjectData(SymbolTable* s)
+                : symbolTable(s) // Subclass owns this pointer.
+            {
+            }
+
+            LocalStorage localStorage;
+            SymbolTable* symbolTable;
+        };
+
+        JSVariableObject(JSVariableObjectData* data)
+            : d(data) // Subclass owns this pointer.
+        {
+        }
+
+        JSVariableObject(JSValue* proto, JSVariableObjectData* data)
+            : JSObject(proto)
+            , d(data) // Subclass owns this pointer.
+        {
+        }
+
+        bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
+        {
+            size_t index = symbolTable().get(propertyName.ustring().rep());
+            if (index != missingSymbolMarker()) {
+                slot.setValueSlot(this, &d->localStorage[index].value);
+                return true;
+            }
+
+            return false;
+        }
+
+        bool JSVariableObject::symbolTablePut(const Identifier& propertyName, JSValue* value, int attr)
+        {
+            size_t index = symbolTable().get(propertyName.ustring().rep());
+            if (index != missingSymbolMarker()) {
+                LocalStorageEntry& entry = d->localStorage[index];
+                entry.value = value;
+                entry.attributes = attr;
+                return true;
+            }
+
+            return false;
+        }
+
+        JSVariableObjectData* d;
+    };
+
+} // namespace KJS
+
+#endif // JSVariableObject_h
index 61b9647d2a48d74de879e5130c034a7e9ac65b38..b5663cfb5024313840faa0c0aece8c5173ac7737 100644 (file)
@@ -96,7 +96,7 @@ JSValue* FunctionImp::argumentsGetter(ExecState* exec, JSObject*, const Identifi
   ExecState* e = exec;
   while (e) {
     if (e->function() == thisObj)
-      return static_cast<ActivationImp*>(e->activationObject())->get(exec, propertyName);
+      return e->activationObject()->get(exec, propertyName);
     e = e->callingExecState();
   }
   return jsNull();
@@ -358,21 +358,14 @@ bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
 
 const ClassInfo ActivationImp::info = { "Activation", 0, 0 };
 
-ActivationImp::ActivationImp(ExecState* exec)
-    : d(new ActivationImpPrivate(exec))
-    , m_symbolTable(&exec->function()->body->symbolTable())
-{
-}
-
 JSValue* ActivationImp::argumentsGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
 {
   ActivationImp* thisObj = static_cast<ActivationImp*>(slot.slotBase());
-  ActivationImpPrivate* d = thisObj->d.get();
   
-  if (!d->argumentsObject)
+  if (!thisObj->d()->argumentsObject)
     thisObj->createArgumentsObject(exec);
   
-  return d->argumentsObject;
+  return thisObj->d()->argumentsObject;
 }
 
 PropertySlot::GetValueFunc ActivationImp::getArgumentsGetter()
@@ -382,19 +375,8 @@ PropertySlot::GetValueFunc ActivationImp::getArgumentsGetter()
 
 bool ActivationImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
-    // We don't call through to JSObject because there's no way to give an 
-    // activation object getter/setter properties, and __proto__ is a 
-    // non-standard extension that other implementations do not expose in the 
-    // activation object.
-    ASSERT(!_prop.hasGetterSetterProperties());
-
-    // it's more efficient to just get and check for a special empty
-    // value than to do a separate contains check
-    size_t index = m_symbolTable->get(propertyName.ustring().rep());
-    if (index != missingSymbolMarker()) {
-        slot.setValueSlot(this, &d->localStorage[index].value);
+    if (symbolTableGet(propertyName, slot))
         return true;
-    }
 
     if (JSValue** location = getDirectLocation(propertyName)) {
         slot.setValueSlot(this, location);
@@ -407,6 +389,10 @@ bool ActivationImp::getOwnPropertySlot(ExecState* exec, const Identifier& proper
         return true;
     }
 
+    // We don't call through to JSObject because there's no way to give an 
+    // activation object getter properties or a prototype.
+    ASSERT(!_prop.hasGetterSetterProperties());
+    ASSERT(prototype() == jsNull());
     return false;
 }
 
@@ -415,57 +401,27 @@ bool ActivationImp::deleteProperty(ExecState* exec, const Identifier& propertyNa
     if (propertyName == exec->propertyNames().arguments)
         return false;
 
-    if (m_symbolTable->contains(propertyName.ustring().rep()))
-        return false;
-
-    return JSObject::deleteProperty(exec, propertyName);
-}
-
-void ActivationImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
-{
-    SymbolTable::const_iterator::Keys end = m_symbolTable->end().keys();
-    for (SymbolTable::const_iterator::Keys it = m_symbolTable->begin().keys(); it != end; ++it)
-        propertyNames.add(Identifier(*it));
-
-    JSObject::getPropertyNames(exec, propertyNames);
+    return JSVariableObject::deleteProperty(exec, propertyName);
 }
 
 void ActivationImp::put(ExecState*, const Identifier& propertyName, JSValue* value, int attr)
 {
-  // There's no way that an activation object can have a prototype or getter/setter properties.
-  ASSERT(!_prop.hasGetterSetterProperties());
-  ASSERT(prototype() == jsNull());
-
-  // it's more efficient to just get and check for a special empty
-  // value than to do a separate contains check
-  size_t index = m_symbolTable->get(propertyName.ustring().rep());
-  if (index != missingSymbolMarker()) {
-    LocalStorageEntry& entry = d->localStorage[index];
-    entry.value = value;
-    entry.attributes = attr;
-    return;
-  }
+    if (symbolTablePut(propertyName, value, attr))
+        return;
 
-  _prop.put(propertyName, value, attr, (attr == None || attr == DontDelete));
+    // We don't call through to JSObject because __proto__ and getter/setter 
+    // properties are non-standard extensions that other implementations do not
+    // expose in the activation object.
+    ASSERT(!_prop.hasGetterSetterProperties());
+    _prop.put(propertyName, value, attr, (attr == None || attr == DontDelete));
 }
 
 void ActivationImp::mark()
 {
-    JSObject::mark();
-
-    size_t size = d->localStorage.size();
-    for (size_t i = 0; i < size; ++i) {
-        JSValue* value = d->localStorage[i].value;
-        if (!value->marked())
-            value->mark();
-    }
-    
-    ASSERT(d->function);
-    if (!d->function->marked())
-        d->function->mark();
+    JSVariableObject::mark();
 
-    if (d->argumentsObject && !d->argumentsObject->marked())
-        d->argumentsObject->mark();
+    if (d()->argumentsObject && !d()->argumentsObject->marked())
+        d()->argumentsObject->mark();
 }
 
 void ActivationImp::createArgumentsObject(ExecState* exec)
@@ -473,7 +429,7 @@ void ActivationImp::createArgumentsObject(ExecState* exec)
     // Since "arguments" is only accessible while a function is being called,
     // we can retrieve our argument list from the ExecState for our function 
     // call instead of storing the list ourselves.
-    d->argumentsObject = new Arguments(exec, d->function, *d->exec->arguments(), this);
+    d()->argumentsObject = new Arguments(exec, d()->exec->function(), *d()->exec->arguments(), this);
 }
 
 // ------------------------------ GlobalFunc -----------------------------------
@@ -763,7 +719,7 @@ JSValue* GlobalFuncImp::callAsFunction(ExecState* exec, JSObject* thisObj, const
           
         if (switchGlobal) {
             newExec.pushScope(thisObj);
-            newExec.setVariableObject(thisObj);
+            newExec.setVariableObject(static_cast<JSGlobalObject*>(thisObj));
         }
         
         Completion c = progNode->execute(&newExec);
index 5657b1e71bf5861ea343368238bd6b44bc20d72c..6970cff9d8d841263c44ba6a5043edb963afaec9 100644 (file)
 #ifndef KJS_FUNCTION_H
 #define KJS_FUNCTION_H
 
+#include "JSVariableObject.h"
 #include "LocalStorage.h"
 #include "SymbolTable.h"
+#include "nodes.h"
 #include "object.h"
-#include <wtf/OwnPtr.h>
 
 namespace KJS {
 
@@ -137,47 +138,49 @@ namespace KJS {
     mutable IndexToNameMap indexToNameMap;
   };
 
-  class ActivationImp : public JSObject {
+  class ActivationImp : public JSVariableObject {
   private:
-    struct ActivationImpPrivate {
-        ActivationImpPrivate(ExecState* e)
-            : exec(e)
-            , function(e->function())
+    using JSVariableObject::JSVariableObjectData;
+
+    struct ActivationImpData : public JSVariableObjectData {
+        ActivationImpData(ExecState* e)
+            : JSVariableObjectData(&e->function()->body->symbolTable())
+            , exec(e)
             , argumentsObject(0)
         {
         }
-        
-        LocalStorage localStorage;
+
         ExecState* exec;
-        FunctionImp* function;
         Arguments* argumentsObject;
     };
 
   public:
-    ActivationImp(ExecState*);
+    ActivationImp::ActivationImp(ExecState* exec)
+        : JSVariableObject(new ActivationImpData(exec))
+    {
+    }
+
+    virtual ~ActivationImp()
+    {
+        delete d();
+    }
 
     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
     virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
-    virtual void getPropertyNames(ExecState*, PropertyNameArray&);
 
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
 
     virtual void mark();
 
-    bool isActivation() { return true; }
-
-    LocalStorage& localStorage() { return d->localStorage; }
-    SymbolTable& symbolTable() { return *m_symbolTable; }
+    virtual bool isActivationObject() { return true; }
 
   private:
     static PropertySlot::GetValueFunc getArgumentsGetter();
     static JSValue* argumentsGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot);
     void createArgumentsObject(ExecState*);
-    
-    OwnPtr<ActivationImpPrivate> d;
-    SymbolTable* m_symbolTable;
+    ActivationImpData* d() { return static_cast<ActivationImpData*>(JSVariableObject::d); }
   };
 
   class GlobalFuncImp : public InternalFunctionImp {
index b1d6ed354ebbda94e2bef85e7d5b437c430bcaf9..1c89c3a7bbd5230ff6e7f2b0eedcc8fc597a16e3 100644 (file)
@@ -93,10 +93,8 @@ static inline bool canSkipLookup(ExecState* exec, const Identifier& ident)
     if (exec->variableObject() != exec->scopeChain().top())
         return false;
 
-    ASSERT(exec->variableObject()->isActivation()); // Because this is function code.
-
     // Static lookup is impossible if the symbol isn't statically declared.
-    if (!static_cast<ActivationImp*>(exec->variableObject())->symbolTable().contains(ident.ustring().rep()))
+    if (!exec->variableObject()->symbolTable().contains(ident.ustring().rep()))
         return false;
         
     return true;
@@ -572,8 +570,7 @@ void ResolveNode::optimizeVariableAccess(FunctionBodyNode* functionBody, Declara
 
 JSValue* LocalVarAccessNode::inlineEvaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     return exec->localStorage()[index].value;
 }
 
@@ -1000,7 +997,7 @@ JSValue* FunctionCallResolveNode::inlineEvaluate(ExecState* exec)
       // that the section does not apply to interal functions, but for simplicity
       // of implementation we use the global object anyway here. This guarantees
       // that in host objects you always get a valid object for this.
-      if (thisObj->isActivation())
+      if (thisObj->isActivationObject())
         thisObj = exec->dynamicGlobalObject();
 
       return func->call(exec, thisObj, argList);
@@ -1046,8 +1043,7 @@ uint32_t FunctionCallResolveNode::evaluateToUInt32(ExecState* exec)
 
 JSValue* LocalVarFunctionCallNode::inlineEvaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
 
     JSValue* v = exec->localStorage()[index].value;
 
@@ -1150,7 +1146,7 @@ JSValue *FunctionCallBracketNode::evaluate(ExecState *exec)
   JSObject *thisObj = baseObj;
   ASSERT(thisObj);
   ASSERT(thisObj->isObject());
-  ASSERT(!thisObj->isActivation());
+  ASSERT(!thisObj->isActivationObject());
 
   return func->call(exec, thisObj, argList);
 }
@@ -1199,7 +1195,7 @@ JSValue* FunctionCallDotNode::inlineEvaluate(ExecState* exec)
   JSObject *thisObj = baseObj;
   ASSERT(thisObj);
   ASSERT(thisObj->isObject());
-  ASSERT(!thisObj->isActivation());
+  ASSERT(!thisObj->isActivationObject());
 
   return func->call(exec, thisObj, argList);
 }
@@ -1284,8 +1280,7 @@ void PostIncResolveNode::optimizeForUnnecessaryResult()
     
 JSValue* PostIncLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
 
     JSValue** slot = &exec->localStorage()[m_index].value;
     JSValue* v = (*slot)->toJSNumber(exec);
@@ -1342,8 +1337,7 @@ void PostDecResolveNode::optimizeForUnnecessaryResult()
     
 JSValue* PostDecLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
 
     JSValue** slot = &exec->localStorage()[m_index].value;
     JSValue* v = (*slot)->toJSNumber(exec);
@@ -1353,8 +1347,7 @@ JSValue* PostDecLocalVarNode::evaluate(ExecState* exec)
 
 double PostDecLocalVarNode::inlineEvaluateToNumber(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     
     JSValue** slot = &exec->localStorage()[m_index].value;
     double n = (*slot)->toNumber(exec);
@@ -1664,8 +1657,7 @@ void TypeOfResolveNode::optimizeVariableAccess(FunctionBodyNode* functionBody, D
 
 JSValue* LocalVarTypeOfNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
 
     return typeStringForValue(exec->localStorage()[m_index].value);
 }
@@ -1717,8 +1709,7 @@ void PreIncResolveNode::optimizeVariableAccess(FunctionBodyNode* functionBody, D
 
 JSValue* PreIncLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     JSValue** slot = &exec->localStorage()[m_index].value;
 
     double n = (*slot)->toNumber(exec);
@@ -1765,8 +1756,7 @@ void PreDecResolveNode::optimizeVariableAccess(FunctionBodyNode* functionBody, D
 
 JSValue* PreDecLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     JSValue** slot = &exec->localStorage()[m_index].value;
 
     double n = (*slot)->toNumber(exec);
@@ -3178,8 +3168,7 @@ void AssignResolveNode::optimizeVariableAccess(FunctionBodyNode* functionBody, D
 
 JSValue* ReadModifyLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     JSValue** slot = &exec->localStorage()[m_index].value;
 
     ASSERT(m_oper != OpEqual);
@@ -3193,8 +3182,7 @@ JSValue* ReadModifyLocalVarNode::evaluate(ExecState* exec)
 
 JSValue* AssignLocalVarNode::evaluate(ExecState* exec)
 {
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation());
-    ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top());
+    ASSERT(exec->variableObject() == exec->scopeChain().top());
     JSValue* v = m_right->evaluate(exec);
 
     KJS_CHECKEXCEPTIONVALUE
@@ -4503,8 +4491,7 @@ void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec)
     if (!m_optimizedResolveNodes)
         optimizeVariableAccess();
 
-    ASSERT(exec->variableObject()->isActivation());
-    LocalStorage& localStorage = static_cast<ActivationImp*>(exec->variableObject())->localStorage();
+    LocalStorage& localStorage = exec->variableObject()->localStorage();
     localStorage.reserveCapacity(m_varStack.size() + m_parameters.size() + m_functionStack.size());
     
     int minAttributes = Internal | DontDelete;
index 0ae67cae550fcf08517a33afdc07b9765545b0b2..ccf2e9b6cd8dd29baf1ec9efbf4f4a63206f468e 100644 (file)
@@ -453,7 +453,7 @@ namespace KJS {
     void saveProperties(SavedProperties &p) const { _prop.save(p); }
     void restoreProperties(const SavedProperties &p) { _prop.restore(p); }
 
-    virtual bool isActivation() { return false; }
+    virtual bool isActivationObject() { return false; }
     virtual bool isGlobalObject() const { return false; }
   protected:
     PropertyMap _prop;
index 460822bcef530b07b38f8556bf52eb8d210d8363..2af1e21129b83c5f5ecbc2b033093622fe71d400 100644 (file)
@@ -1,3 +1,20 @@
+2007-12-07  Geoffrey Garen  <ggaren@apple.com>
+
+        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):
+
 2007-12-07  Adam Roben  <aroben@apple.com>
 
         Add SoftLinking.h for Windows and use it in a few places
diff --git a/WebCore/ForwardingHeaders/wtf/ListRefPtr.h b/WebCore/ForwardingHeaders/wtf/ListRefPtr.h
new file mode 100644 (file)
index 0000000..b766736
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/ListRefPtr.h>
index 60d67ded04e1828975eab42cd27102cf4849d7f7..5fb37a2868e0c102a5bb41e60e86d3e817166f84 100644 (file)
@@ -93,7 +93,7 @@ JSValue* JSXSLTProcessorPrototypeFunctionTransformToFragment::callAsFunction(Exe
     JSValue *nodeVal = args[0];
     JSValue *docVal = args[1];
     if (nodeVal->isObject(&JSNode::info) && docVal->isObject(&JSDocument::info)) {
-        Node* node = static_cast<JSNode*>(nodeVal)->impl();
+        WebCore::Node* node = static_cast<JSNode*>(nodeVal)->impl();
         Document* doc = static_cast<Document*>(static_cast<JSDocument *>(docVal)->impl());
         return toJS(exec, processor.transformToFragment(node, doc).get());
     }
index dd814eb6b21c72a02839383347620c528ca20248..6602c2c2d6add0f75d39d6e492ce3e232a16d0b1 100644 (file)
@@ -38,7 +38,7 @@ using namespace HTMLNames;
 namespace KJS {
 
 typedef HashMap<void*, DOMObject*> DOMObjectMap;
-typedef HashMap<Node*, JSNode*> NodeMap;
+typedef HashMap<WebCore::Node*, JSNode*> NodeMap;
 typedef HashMap<Document*, NodeMap*> NodePerDocMap;
 
 // For debugging, keep a set of wrappers currently registered, and check that
@@ -133,7 +133,7 @@ void ScriptInterpreter::forgetDOMObject(void* objectHandle)
     removeWrapper(domObjects().take(objectHandle));
 }
 
-JSNode* ScriptInterpreter::getDOMNodeForDocument(Document* document, Node* node)
+JSNode* ScriptInterpreter::getDOMNodeForDocument(Document* document, WebCore::Node* node)
 {
     if (!document)
         return static_cast<JSNode*>(domObjects().get(node));
@@ -143,7 +143,7 @@ JSNode* ScriptInterpreter::getDOMNodeForDocument(Document* document, Node* node)
     return NULL;
 }
 
-void ScriptInterpreter::forgetDOMNodeForDocument(Document* document, Node* node)
+void ScriptInterpreter::forgetDOMNodeForDocument(Document* document, WebCore::Node* node)
 {
     if (!document) {
         removeWrapper(domObjects().take(node));
@@ -154,7 +154,7 @@ void ScriptInterpreter::forgetDOMNodeForDocument(Document* document, Node* node)
         removeWrapper(documentDict->take(node));
 }
 
-void ScriptInterpreter::putDOMNodeForDocument(Document* document, Node* node, JSNode* wrapper)
+void ScriptInterpreter::putDOMNodeForDocument(Document* document, WebCore::Node* node, JSNode* wrapper)
 {
     addWrapper(wrapper);
     if (!document) {
@@ -187,7 +187,7 @@ void ScriptInterpreter::markDOMNodesForDocument(Document* doc)
         NodeMap::iterator nodeEnd = nodeDict->end();
         for (NodeMap::iterator nodeIt = nodeDict->begin(); nodeIt != nodeEnd; ++nodeIt) {
             JSNode* jsNode = nodeIt->second;
-            Node* node = jsNode->impl();
+            WebCore::Node* node = jsNode->impl();
             
             // don't mark wrappers for nodes that are no longer in the
             // document - they should not be saved if the node is not
@@ -201,7 +201,7 @@ void ScriptInterpreter::markDOMNodesForDocument(Document* doc)
     }
 }
 
-void ScriptInterpreter::updateDOMNodeDocument(Node* node, Document* oldDoc, Document* newDoc)
+void ScriptInterpreter::updateDOMNodeDocument(WebCore::Node* node, Document* oldDoc, Document* newDoc)
 {
     ASSERT(oldDoc != newDoc);
     JSNode* wrapper = getDOMNodeForDocument(oldDoc, node);
index 80b43d2c1b0751e1584c2ae41e26216c15f36c0d..92423c1a99e866fc0eeeb5909a8a942f40afe7b2 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-07  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Sam Weinig.
+        
+        Added a forwarding header, since we now #include nodes.h through some
+        JavaScriptCore headers.
+
+        * ForwardingHeaders/wtf/ListRefPtr.h: Added.
+
 2007-12-06  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Oliver's rubber stamp
diff --git a/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h b/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h
new file mode 100644 (file)
index 0000000..2aa2311
--- /dev/null
@@ -0,0 +1 @@
+#import <JavaScriptCore/ListRefPtr.h>