Index: src/background-parsing-task.cc |
diff --git a/src/background-parsing-task.cc b/src/background-parsing-task.cc |
index cb31cc99827e8baafe3ce5ee20e70378c216ce2a..86780bf9c16ec0a51b708e04d5fc37cc0c8956b7 100644 |
--- a/src/background-parsing-task.cc |
+++ b/src/background-parsing-task.cc |
@@ -11,25 +11,34 @@ BackgroundParsingTask::BackgroundParsingTask( |
StreamedSource* source, ScriptCompiler::CompileOptions options, |
int stack_size, Isolate* isolate) |
: source_(source), options_(options), stack_size_(stack_size) { |
- // Prepare the data for the internalization phase and compilation phase, which |
- // will happen in the main thread after parsing. |
- source->info.Reset(new i::CompilationInfoWithZone(source->source_stream.get(), |
- source->encoding, isolate)); |
- source->info->MarkAsGlobal(); |
- // We don't set the context to the CompilationInfo yet, because the background |
- // thread cannot do anything with it anyway. We set it just before compilation |
- // on the foreground thread. |
DCHECK(options == ScriptCompiler::kProduceParserCache || |
options == ScriptCompiler::kProduceCodeCache || |
options == ScriptCompiler::kNoCompileOptions); |
- source->allow_lazy = |
- !i::Compiler::DebuggerWantsEagerCompilation(source->info.get()); |
- if (!source->allow_lazy && options_ == ScriptCompiler::kProduceParserCache) { |
+ // Prepare the data for the internalization phase and compilation phase, which |
+ // will happen in the main thread after parsing. |
+ Zone* zone = new Zone(); |
+ ParseInfo* info = new ParseInfo(zone); |
+ source->zone.Reset(zone); |
+ source->info.Reset(info); |
+ info->set_source_stream(source->source_stream.get()); |
marja
2015/03/04 09:24:40
Would it make sense to have a ctor of ParseInfo wh
titzer
2015/03/04 22:39:35
I tried that, and you end up with ctor hell with d
|
+ info->set_source_stream_encoding(source->encoding); |
+ info->set_hash_seed(isolate->heap()->HashSeed()); |
+ info->set_global(); |
+ info->set_unicode_cache(&source_->unicode_cache); |
+ |
+ bool disable_lazy = !Compiler::DebuggerWantsEagerCompilation(isolate); |
+ if (disable_lazy && options_ == ScriptCompiler::kProduceParserCache) { |
// Producing cached data while parsing eagerly is not supported. |
- options_ = ScriptCompiler::kNoCompileOptions; |
+ options = ScriptCompiler::kNoCompileOptions; |
marja
2015/03/04 09:24:40
Huh, the options & options_ modifying is a bit unc
titzer
2015/03/04 22:39:35
Ok, I've fixed this so the options are only stored
|
+ info->set_compile_options(ScriptCompiler::kNoCompileOptions); |
} |
+ |
+ options_ = ScriptCompiler::kNoCompileOptions; |
marja
2015/03/04 09:24:40
... why is this correct? Won't this just always ki
titzer
2015/03/04 22:39:35
Fixed.
|
+ info->set_compile_options(options); |
+ info->set_allow_lazy_parsing(!disable_lazy); |
+ source->allow_lazy = !disable_lazy; |
source->hash_seed = isolate->heap()->HashSeed(); |
} |
@@ -42,17 +51,18 @@ void BackgroundParsingTask::Run() { |
ScriptData* script_data = NULL; |
if (options_ == ScriptCompiler::kProduceParserCache || |
options_ == ScriptCompiler::kProduceCodeCache) { |
- source_->info->SetCachedData(&script_data, options_); |
+ source_->info->set_cached_data(&script_data); |
+ // TODO(titzer): this seems redundant to set the options again. |
+ source_->info->set_compile_options(options_); |
} |
uintptr_t stack_limit = |
reinterpret_cast<uintptr_t>(&stack_limit) - stack_size_ * KB; |
+ source_->info->set_stack_limit(stack_limit); |
// Parser needs to stay alive for finalizing the parsing on the main |
// thread. Passing &parse_info is OK because Parser doesn't store it. |
- source_->parser.Reset(new Parser(source_->info.get(), stack_limit, |
- source_->hash_seed, |
- &source_->unicode_cache)); |
+ source_->parser.Reset(new Parser(source_->info.get())); |
source_->parser->set_allow_lazy(source_->allow_lazy); |
source_->parser->ParseOnBackground(source_->info.get()); |