Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: src/parser.cc

Issue 3416010: Make preparsing data reusable. (Closed)
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 856c474066191acc0691432f9eecabf67a19e499..a29339b46669f3e4ed888e4a16ce8d03301c069f 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1001,7 +1001,7 @@ class CompleteParserRecorder: public PartialParserRecorder {
Vector<Vector<const char> > symbol = symbol_entries_.AddBlock(1, literal);
entry->key = &symbol[0];
}
- symbol_store_.Add(id - 1);
+ WriteNumber(id - 1);
}
virtual Vector<unsigned> ExtractData() {
@@ -1503,6 +1503,8 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
source->TryFlatten();
scanner_.Initialize(source, JAVASCRIPT);
ASSERT(target_stack_ == NULL);
+ if (pre_data_ != NULL) pre_data_->Initialize();
+
Rico 2010/09/17 12:53:24 Delete extra blank line
// Compute the parsing mode.
mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
@@ -5492,7 +5494,9 @@ ScriptDataImpl* PartialPreParse(Handle<String> source,
void ScriptDataImpl::Initialize() {
+ // Resets pointers to initial value, if reusing a pre-used ScriptData.
Rico 2010/09/17 12:53:24 value->values
Lasse Reichstein 2010/09/17 12:55:13 Reworded to "Prepares script data for reading."
if (store_.length() >= kHeaderSize) {
+ function_index_ = kHeaderSize;
int symbol_data_offset = kHeaderSize + store_[kFunctionsSizeOffset];
if (store_.length() > symbol_data_offset) {
symbol_data_ = reinterpret_cast<byte*>(&store_[symbol_data_offset]);
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698