]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/BatchedTransitionOptimizer.h
JavaScriptCore-1097.3.tar.gz
[apple/javascriptcore.git] / runtime / BatchedTransitionOptimizer.h
index 8a954af1dbfafc4b01317635c35208868631a2bc..610b8d16cb8a89cdb874cb39972663df63f3d0a8 100644 (file)
 #ifndef BatchedTransitionOptimizer_h
 #define BatchedTransitionOptimizer_h
 
-#include <wtf/Noncopyable.h>
 #include "JSObject.h"
 
 namespace JSC {
 
-    class BatchedTransitionOptimizer : Noncopyable {
+    class BatchedTransitionOptimizer {
+        WTF_MAKE_NONCOPYABLE(BatchedTransitionOptimizer);
     public:
-        BatchedTransitionOptimizer(JSObject* object)
-            : m_object(object)
+        BatchedTransitionOptimizer(JSGlobalData& globalData, JSObject* object)
+            : m_globalData(&globalData)
+            , m_object(object)
         {
-            if (!m_object->structure()->isDictionary())
-                m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure()));
         }
 
         ~BatchedTransitionOptimizer()
         {
-            m_object->flattenDictionaryObject();
+            if (m_object->structure()->isDictionary())
+                m_object->flattenDictionaryObject(*m_globalData);
         }
 
     private:
+        JSGlobalData* m_globalData;
         JSObject* m_object;
     };