- class MarkStack;
-
- class MarkedArgumentBuffer : public Noncopyable {
- private:
- static const unsigned inlineCapacity = 8;
- typedef Vector<Register, inlineCapacity> VectorType;
- typedef HashSet<MarkedArgumentBuffer*> ListSet;
-
- public:
- typedef VectorType::iterator iterator;
- typedef VectorType::const_iterator const_iterator;
-
- // Constructor for a read-write list, to which you may append values.
- // FIXME: Remove all clients of this API, then remove this API.
- MarkedArgumentBuffer()
- : m_isUsingInlineBuffer(true)
- , m_markSet(0)
-#ifndef NDEBUG
- , m_isReadOnly(false)
-#endif
- {
- m_buffer = m_vector.data();
- m_size = 0;
- }
-
- // Constructor for a read-only list whose data has already been allocated elsewhere.
- MarkedArgumentBuffer(Register* buffer, size_t size)
- : m_buffer(buffer)
- , m_size(size)
- , m_isUsingInlineBuffer(true)
- , m_markSet(0)
-#ifndef NDEBUG
- , m_isReadOnly(true)
-#endif
- {
- }
-
- void initialize(Register* buffer, size_t size)
- {
- ASSERT(!m_markSet);
- ASSERT(isEmpty());
-
- m_buffer = buffer;
- m_size = size;
-#ifndef NDEBUG
- m_isReadOnly = true;
-#endif
- }
-
- ~MarkedArgumentBuffer()
- {
- if (m_markSet)
- m_markSet->remove(this);
- }
-
- size_t size() const { return m_size; }
- bool isEmpty() const { return !m_size; }
-
- JSValue at(size_t i) const
- {
- if (i < m_size)
- return m_buffer[i].jsValue();
+class SlotVisitor;
+
+class MarkedArgumentBuffer {
+ WTF_MAKE_NONCOPYABLE(MarkedArgumentBuffer);
+ friend class VM;
+ friend class ArgList;
+
+private:
+ static const size_t inlineCapacity = 8;
+ typedef HashSet<MarkedArgumentBuffer*> ListSet;
+
+public:
+ // Constructor for a read-write list, to which you may append values.
+ // FIXME: Remove all clients of this API, then remove this API.
+ MarkedArgumentBuffer()
+ : m_size(0)
+ , m_capacity(inlineCapacity)
+ , m_buffer(m_inlineBuffer)
+ , m_markSet(0)
+ {
+ }
+
+ ~MarkedArgumentBuffer()
+ {
+ if (m_markSet)
+ m_markSet->remove(this);
+
+ if (EncodedJSValue* base = mallocBase())
+ delete [] base;
+ }
+
+ size_t size() const { return m_size; }
+ bool isEmpty() const { return !m_size; }
+
+ JSValue at(int i) const
+ {
+ if (i >= m_size)