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

Unified Diff: src/background-parsing-task.cc

Issue 974213002: Extract ParseInfo from CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/background-parsing-task.cc
diff --git a/src/background-parsing-task.cc b/src/background-parsing-task.cc
index cb31cc99827e8baafe3ce5ee20e70378c216ce2a..0f487d5ec3c5ab5faa7c40ff1fb9741f1c46df51 100644
--- a/src/background-parsing-task.cc
+++ b/src/background-parsing-task.cc
@@ -10,27 +10,31 @@ namespace internal {
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
marja 2015/03/09 09:18:07 This comment is probably still relevant; why was i
titzer 2015/03/09 13:03:09 Done.
- // thread cannot do anything with it anyway. We set it just before compilation
- // on the foreground thread.
+ : source_(source), stack_size_(stack_size) {
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();
marja 2015/03/09 09:18:07 Who deletes Zone? ParseInfo doesn't own it afaics.
titzer 2015/03/09 13:03:09 I've changed it back to a SmartPointer in Backgrou
+ ParseInfo* info = new ParseInfo(zone);
+ source->info.Reset(info);
+ info->set_isolate(isolate);
+ info->set_source_stream(source->source_stream.get());
+ 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;
}
- source->hash_seed = isolate->heap()->HashSeed();
+
+ info->set_compile_options(options);
+ info->set_allow_lazy_parsing(!disable_lazy);
}
@@ -40,20 +44,19 @@ void BackgroundParsingTask::Run() {
DisallowHandleDereference no_deref;
ScriptData* script_data = NULL;
- if (options_ == ScriptCompiler::kProduceParserCache ||
- options_ == ScriptCompiler::kProduceCodeCache) {
- source_->info->SetCachedData(&script_data, options_);
+ ScriptCompiler::CompileOptions options = source_->info->compile_options();
+ if (options == ScriptCompiler::kProduceParserCache ||
+ options == ScriptCompiler::kProduceCodeCache) {
+ source_->info->set_cached_data(&script_data);
}
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->set_allow_lazy(source_->allow_lazy);
+ source_->parser.Reset(new Parser(source_->info.get()));
source_->parser->ParseOnBackground(source_->info.get());
if (script_data != NULL) {
« no previous file with comments | « src/background-parsing-task.h ('k') | src/compiler.h » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698