2008-03-20 Maciej Stachowiak <mjs@apple.com>
[WebKit.git] / JavaScriptCore / kjs / JSGlobalObject.h
index b421bcd6e83f484075603db3dbd18af0bc2b0698..de1e168edb3ef902936eb17d5ac5a80cc4ee58cb 100644 (file)
@@ -24,6 +24,7 @@
 #define KJS_GlobalObject_h
 
 #include "JSVariableObject.h"
+#include "Activation.h"
 
 namespace KJS {
 
@@ -263,6 +264,37 @@ namespace KJS {
         return checkTimeout();
     }
 
+    inline ActivationImp* JSGlobalObject::pushActivation(ExecState* exec)
+    {
+        if (d()->activationCount == activationStackNodeSize) {
+            ActivationStackNode* newNode = new ActivationStackNode;
+            newNode->prev = d()->activations;
+            d()->activations = newNode;
+            d()->activationCount = 0;
+        }
+        
+        StackActivation* stackEntry = &d()->activations->data[d()->activationCount++];
+        stackEntry->activationStorage.init(exec);
+        return &stackEntry->activationStorage;
+    }
+
+    inline void JSGlobalObject::checkActivationCount()
+    {
+        if (!d()->activationCount) {
+            ActivationStackNode* prev = d()->activations->prev;
+            ASSERT(prev);
+            delete d()->activations;
+            d()->activations = prev;
+            d()->activationCount = activationStackNodeSize;
+        }
+    }
+
+    inline void JSGlobalObject::popActivation()
+    {
+        checkActivationCount();
+        d()->activations->data[--d()->activationCount].activationDataStorage.localStorage.shrink(0);    
+    }
+
 } // namespace KJS
 
 #endif // KJS_GlobalObject_h