X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9bcd318d5fa2a38139c9651d263a06c797529333..ba379fdc102753d6be2c4d937058fe40257329fe:/parser/Parser.h diff --git a/parser/Parser.h b/parser/Parser.h index 6191ccb..6f4c2b7 100644 --- a/parser/Parser.h +++ b/parser/Parser.h @@ -23,9 +23,9 @@ #ifndef Parser_h #define Parser_h -#include "SourceProvider.h" #include "Debugger.h" #include "Nodes.h" +#include "SourceProvider.h" #include #include #include @@ -37,15 +37,7 @@ namespace JSC { class ProgramNode; class UString; - template - struct ParserRefCountedData : ParserRefCounted { - ParserRefCountedData(JSGlobalData* globalData) - : ParserRefCounted(globalData) - { - } - - T data; - }; + template struct ParserArenaData : ParserArenaDeletable { T data; }; class Parser : Noncopyable { public: @@ -53,16 +45,19 @@ namespace JSC { template PassRefPtr reparse(JSGlobalData*, ParsedNode*); void reparseInPlace(JSGlobalData*, FunctionBodyNode*); - void didFinishParsing(SourceElements*, ParserRefCountedData*, - ParserRefCountedData*, CodeFeatures features, int lastLine, int numConstants); + void didFinishParsing(SourceElements*, ParserArenaData*, + ParserArenaData*, CodeFeatures features, int lastLine, int numConstants); + + ParserArena& arena() { return m_arena; } private: void parse(JSGlobalData*, int* errLine, UString* errMsg); + ParserArena m_arena; const SourceCode* m_source; - RefPtr m_sourceElements; - RefPtr > m_varDeclarations; - RefPtr > m_funcDeclarations; + SourceElements* m_sourceElements; + ParserArenaData* m_varDeclarations; + ParserArenaData* m_funcDeclarations; CodeFeatures m_features; int m_lastLine; int m_numConstants; @@ -75,7 +70,7 @@ namespace JSC { RefPtr result; if (m_sourceElements) { result = ParsedNode::create(&exec->globalData(), - m_sourceElements.get(), + m_sourceElements, m_varDeclarations ? &m_varDeclarations->data : 0, m_funcDeclarations ? &m_funcDeclarations->data : 0, *m_source, @@ -84,8 +79,9 @@ namespace JSC { result->setLoc(m_source->firstLine(), m_lastLine); } + m_arena.reset(); + m_source = 0; - m_sourceElements = 0; m_varDeclarations = 0; m_funcDeclarations = 0; @@ -101,7 +97,7 @@ namespace JSC { RefPtr result; if (m_sourceElements) { result = ParsedNode::create(globalData, - m_sourceElements.get(), + m_sourceElements, m_varDeclarations ? &m_varDeclarations->data : 0, m_funcDeclarations ? &m_funcDeclarations->data : 0, *m_source, @@ -110,8 +106,9 @@ namespace JSC { result->setLoc(m_source->firstLine(), m_lastLine); } + m_arena.reset(); + m_source = 0; - m_sourceElements = 0; m_varDeclarations = 0; m_funcDeclarations = 0;