Index: src/parser.h |
diff --git a/src/parser.h b/src/parser.h |
index 0c9857a2731d97715d17209f2c916445dfa7576a..072658e740fbf09f0b46f9905417d34c7f40d331 100644 |
--- a/src/parser.h |
+++ b/src/parser.h |
@@ -30,12 +30,15 @@ |
#include "allocation.h" |
#include "ast.h" |
+#include "compiler.h" // For CachedDataMode |
#include "preparse-data-format.h" |
#include "preparse-data.h" |
#include "scopes.h" |
#include "preparser.h" |
namespace v8 { |
+class ScriptCompiler; |
+ |
namespace internal { |
class CompilationInfo; |
@@ -117,6 +120,7 @@ class ScriptDataImpl : public ScriptData { |
unsigned version() { return store_[PreparseDataConstants::kVersionOffset]; } |
private: |
+ friend class v8::ScriptCompiler; |
Vector<unsigned> store_; |
unsigned char* symbol_data_; |
unsigned char* symbol_data_end_; |
@@ -649,14 +653,22 @@ class Parser : public ParserBase<ParserTraits> { |
// Report syntax error |
void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
- void set_pre_parse_data(ScriptDataImpl *data) { |
- pre_parse_data_ = data; |
- symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); |
+ void SetCachedData(ScriptDataImpl** data, |
+ CachedDataMode cached_data_mode) { |
+ cached_data_mode_ = cached_data_mode; |
+ if (cached_data_mode == NO_CACHED_DATA) { |
+ cached_data_ = NULL; |
+ } else { |
+ ASSERT(data != NULL); |
+ cached_data_ = data; |
+ symbol_cache_.Initialize(*data ? (*data)->symbol_count() : 0, zone()); |
+ } |
} |
bool inside_with() const { return scope_->inside_with(); } |
Mode mode() const { return mode_; } |
- ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } |
+ ScriptDataImpl** cached_data() const { return cached_data_; } |
+ CachedDataMode cached_data_mode() const { return cached_data_mode_; } |
Scope* DeclarationScope(VariableMode mode) { |
return IsLexicalVariableMode(mode) |
? scope_ : scope_->DeclarationScope(); |
@@ -770,8 +782,6 @@ class Parser : public ParserBase<ParserTraits> { |
Scope* NewScope(Scope* parent, ScopeType type); |
- Handle<String> LookupSymbol(int symbol_id); |
- |
Handle<String> LookupCachedSymbol(int symbol_id); |
// Generate AST node that throw a ReferenceError with the given type. |
@@ -804,7 +814,8 @@ class Parser : public ParserBase<ParserTraits> { |
PreParser* reusable_preparser_; |
Scope* original_scope_; // for ES5 function declarations in sloppy eval |
Target* target_stack_; // for break, continue statements |
- ScriptDataImpl* pre_parse_data_; |
+ ScriptDataImpl** cached_data_; |
+ CachedDataMode cached_data_mode_; |
Mode mode_; |