#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;
};