X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..HEAD:/heap/Local.h diff --git a/heap/Local.h b/heap/Local.h index ac7d136..14c4dee 100644 --- a/heap/Local.h +++ b/heap/Local.h @@ -27,7 +27,7 @@ #define Local_h #include "Handle.h" -#include "JSGlobalData.h" +#include "VM.h" /* A strongly referenced handle whose lifetime is temporary, limited to a given @@ -44,8 +44,8 @@ template class Local : public Handle { public: typedef typename Handle::ExternalType ExternalType; - Local(JSGlobalData&, ExternalType = ExternalType()); - Local(JSGlobalData&, Handle); + Local(VM&, ExternalType = ExternalType()); + Local(VM&, Handle); Local(const Local&); // Adopting constructor. Used to return a Local to a calling function. Local& operator=(ExternalType); @@ -56,14 +56,14 @@ private: void set(ExternalType); }; -template inline Local::Local(JSGlobalData& globalData, ExternalType value) - : Handle(globalData.allocateLocalHandle()) +template inline Local::Local(VM& vm, ExternalType value) + : Handle(vm.heap.handleStack()->push()) { set(value); } -template inline Local::Local(JSGlobalData& globalData, Handle other) - : Handle(globalData.allocateLocalHandle()) +template inline Local::Local(VM& vm, Handle other) + : Handle(vm.heap.handleStack()->push()) { set(other.get()); } @@ -94,7 +94,6 @@ template inline Local& Local::operator=(Handle other) template inline void Local::set(ExternalType externalType) { ASSERT(slot()); - ASSERT(!HandleTypes::toJSValue(externalType) || !HandleTypes::toJSValue(externalType).isCell() || Heap::isMarked(HandleTypes::toJSValue(externalType).asCell())); *slot() = externalType; } @@ -102,8 +101,8 @@ template inline void Local::set(ExternalType externalType) template class LocalStack { typedef typename Handle::ExternalType ExternalType; public: - LocalStack(JSGlobalData& globalData) - : m_globalData(&globalData) + LocalStack(VM& vm) + : m_vm(vm) , m_count(0) { } @@ -123,7 +122,7 @@ public: void push(ExternalType value) { if (m_count == m_stack.size()) - m_stack.append(Local(*m_globalData, value)); + m_stack.append(Local(m_vm, value)); else m_stack[m_count] = value; m_count++; @@ -133,7 +132,7 @@ public: unsigned size() const { return m_count; } private: - RefPtr m_globalData; + VM& m_vm; Vector, inlineCapacity> m_stack; unsigned m_count; }; @@ -142,7 +141,7 @@ private: namespace WTF { -template struct VectorTraits > : SimpleClassVectorTraits { +template struct VectorTraits> : SimpleClassVectorTraits { static const bool needsDestruction = false; static const bool canInitializeWithMemset = false; static const bool canCompareWithMemcmp = false;