- class BatchedTransitionOptimizer : Noncopyable {
- public:
- BatchedTransitionOptimizer(JSObject* object)
- : m_object(object)
- {
- if (!m_object->structure()->isDictionary())
- m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure()));
- }
-
- ~BatchedTransitionOptimizer()
- {
- m_object->flattenDictionaryObject();
- }
-
- private:
- JSObject* m_object;
- };
+class BatchedTransitionOptimizer {
+ WTF_MAKE_NONCOPYABLE(BatchedTransitionOptimizer);
+public:
+ BatchedTransitionOptimizer(VM& vm, JSObject* object)
+ : m_vm(&vm)
+ , m_object(object)
+ {
+ if (!m_object->structure(vm)->isDictionary())
+ m_object->convertToDictionary(vm);
+ }
+
+ ~BatchedTransitionOptimizer()
+ {
+ if (m_object->structure()->isDictionary())
+ m_object->flattenDictionaryObject(*m_vm);
+ }
+
+private:
+ VM* m_vm;
+ JSObject* m_object;
+};