]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - parser/ParserArena.cpp
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / parser / ParserArena.cpp
index 9c96de7625b00aa89e4036fcd7b8a766826216d5..a276887708c409644db81bcced8ae71b5c04e9a8 100644 (file)
 #include "ParserArena.h"
 
 #include "Nodes.h"
-#include <wtf/PassOwnPtr.h>
+#include "JSCInlines.h"
 
 namespace JSC {
 
 ParserArena::ParserArena()
     : m_freeableMemory(0)
     , m_freeablePoolEnd(0)
-    , m_identifierArena(adoptPtr(new IdentifierArena))
 {
 }
 
@@ -46,19 +45,16 @@ inline void* ParserArena::freeablePool()
 
 inline void ParserArena::deallocateObjects()
 {
+    size_t size = m_deletableObjects.size();
+    for (size_t i = 0; i < size; ++i)
+        m_deletableObjects[i]->~ParserArenaDeletable();
+
     if (m_freeablePoolEnd)
         fastFree(freeablePool());
 
-    size_t size = m_freeablePools.size();
+    size = m_freeablePools.size();
     for (size_t i = 0; i < size; ++i)
         fastFree(m_freeablePools[i]);
-
-    size = m_deletableObjects.size();
-    for (size_t i = 0; i < size; ++i) {
-        ParserArenaDeletable* object = m_deletableObjects[i];
-        object->~ParserArenaDeletable();
-        fastFree(object);
-    }
 }
 
 ParserArena::~ParserArena()
@@ -66,37 +62,6 @@ ParserArena::~ParserArena()
     deallocateObjects();
 }
 
-bool ParserArena::contains(ParserArenaRefCounted* object) const
-{
-    return m_refCountedObjects.find(object) != notFound;
-}
-
-ParserArenaRefCounted* ParserArena::last() const
-{
-    return m_refCountedObjects.last().get();
-}
-
-void ParserArena::removeLast()
-{
-    m_refCountedObjects.removeLast();
-}
-
-void ParserArena::reset()
-{
-    // Since this code path is used only when parsing fails, it's not bothering to reuse
-    // any of the memory the arena allocated. We could improve that later if we want to
-    // efficiently reuse the same arena.
-
-    deallocateObjects();
-
-    m_freeableMemory = 0;
-    m_freeablePoolEnd = 0;
-    m_identifierArena->clear();
-    m_freeablePools.clear();
-    m_deletableObjects.clear();
-    m_refCountedObjects.clear();
-}
-
 void ParserArena::allocateFreeablePool()
 {
     if (m_freeablePoolEnd)
@@ -108,18 +73,4 @@ void ParserArena::allocateFreeablePool()
     ASSERT(freeablePool() == pool);
 }
 
-bool ParserArena::isEmpty() const
-{
-    return !m_freeablePoolEnd
-        && m_identifierArena->isEmpty()
-        && m_freeablePools.isEmpty()
-        && m_deletableObjects.isEmpty()
-        && m_refCountedObjects.isEmpty();
-}
-
-void ParserArena::derefWithArena(PassRefPtr<ParserArenaRefCounted> object)
-{
-    m_refCountedObjects.append(object);
-}
-
 }