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

Unified Diff: src/parser.cc

Issue 389573006: Change ScriptCompiler::CompileOptions and add d8 --cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 2011ff754ddeeb8e028b1ef82e046c9502a7d0b2..7c6ee2d516046a6d2e58bffdb5a9efcdb7fa501c 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -254,11 +254,11 @@ int ParseData::FunctionsSize() {
void Parser::SetCachedData() {
- if (cached_data_mode() == NO_CACHED_DATA) {
+ if (compile_options() == ScriptCompiler::kNoCompileOptions) {
cached_parse_data_ = NULL;
} else {
ASSERT(info_->cached_data() != NULL);
- if (cached_data_mode() == CONSUME_CACHED_DATA) {
+ if (compile_options() == ScriptCompiler::kConsumeParserCache) {
cached_parse_data_ = new ParseData(*info_->cached_data());
}
}
@@ -740,9 +740,10 @@ FunctionLiteral* Parser::ParseProgram() {
// Initialize parser state.
CompleteParserRecorder recorder;
- if (cached_data_mode() == PRODUCE_CACHED_DATA) {
+
+ if (compile_options_ == ScriptCompiler::kProduceParserCache) {
log_ = &recorder;
- } else if (cached_data_mode() == CONSUME_CACHED_DATA) {
+ } else if (compile_options_ == ScriptCompiler::kConsumeParserCache) {
cached_parse_data_->Initialize();
}
@@ -775,7 +776,7 @@ FunctionLiteral* Parser::ParseProgram() {
}
PrintF(" - took %0.3f ms]\n", ms);
}
- if (cached_data_mode() == PRODUCE_CACHED_DATA) {
+ if (compile_options_ == ScriptCompiler::kConsumeParserCache) {
if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
log_ = NULL;
}
@@ -3540,7 +3541,7 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
int* expected_property_count,
bool* ok) {
int function_block_pos = position();
- if (cached_data_mode() == CONSUME_CACHED_DATA) {
+ if (compile_options_ == ScriptCompiler::kConsumeParserCache) {
// If we have cached data, we use it to skip parsing the function body. The
// data contains the information we need to construct the lazy function.
FunctionEntry entry =
@@ -3590,7 +3591,7 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
*materialized_literal_count = logger.literals();
*expected_property_count = logger.properties();
scope_->SetStrictMode(logger.strict_mode());
- if (cached_data_mode() == PRODUCE_CACHED_DATA) {
+ if (compile_options_ == ScriptCompiler::kProduceParserCache) {
ASSERT(log_);
// Position right after terminal '}'.
int body_end = scanner()->location().end_pos;

Powered by Google App Engine
This is Rietveld 408576698