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

Side by Side Diff: src/background-parsing-task.cc

Issue 2683733002: Revert of Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « src/background-parsing-task.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/background-parsing-task.h" 5 #include "src/background-parsing-task.h"
6 6
7 #include "src/debug/debug.h" 7 #include "src/debug/debug.h"
8 #include "src/parsing/parser.h" 8 #include "src/parsing/parser.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 void StreamedSource::Release() { 13 void StreamedSource::Release() {
14 parser.reset(); 14 parser.reset();
15 info.reset(); 15 info.reset();
16 zone.reset();
16 } 17 }
17 18
18 BackgroundParsingTask::BackgroundParsingTask( 19 BackgroundParsingTask::BackgroundParsingTask(
19 StreamedSource* source, ScriptCompiler::CompileOptions options, 20 StreamedSource* source, ScriptCompiler::CompileOptions options,
20 int stack_size, Isolate* isolate) 21 int stack_size, Isolate* isolate)
21 : source_(source), stack_size_(stack_size), script_data_(nullptr) { 22 : source_(source), stack_size_(stack_size), script_data_(nullptr) {
22 // We don't set the context to the CompilationInfo yet, because the background 23 // We don't set the context to the CompilationInfo yet, because the background
23 // thread cannot do anything with it anyway. We set it just before compilation 24 // thread cannot do anything with it anyway. We set it just before compilation
24 // on the foreground thread. 25 // on the foreground thread.
25 DCHECK(options == ScriptCompiler::kProduceParserCache || 26 DCHECK(options == ScriptCompiler::kProduceParserCache ||
26 options == ScriptCompiler::kProduceCodeCache || 27 options == ScriptCompiler::kProduceCodeCache ||
27 options == ScriptCompiler::kNoCompileOptions); 28 options == ScriptCompiler::kNoCompileOptions);
28 29
29 // Prepare the data for the internalization phase and compilation phase, which 30 // Prepare the data for the internalization phase and compilation phase, which
30 // will happen in the main thread after parsing. 31 // will happen in the main thread after parsing.
31 ParseInfo* info = new ParseInfo(isolate->allocator()); 32 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME);
33 ParseInfo* info = new ParseInfo(zone);
32 info->set_toplevel(); 34 info->set_toplevel();
35 source->zone.reset(zone);
33 source->info.reset(info); 36 source->info.reset(info);
34 info->set_isolate(isolate); 37 info->set_isolate(isolate);
35 info->set_source_stream(source->source_stream.get()); 38 info->set_source_stream(source->source_stream.get());
36 info->set_source_stream_encoding(source->encoding); 39 info->set_source_stream_encoding(source->encoding);
37 info->set_hash_seed(isolate->heap()->HashSeed()); 40 info->set_hash_seed(isolate->heap()->HashSeed());
38 info->set_unicode_cache(&source_->unicode_cache); 41 info->set_unicode_cache(&source_->unicode_cache);
39 info->set_compile_options(options); 42 info->set_compile_options(options);
40 info->set_allow_lazy_parsing(); 43 info->set_allow_lazy_parsing();
41 44
42 source_->info->set_cached_data(&script_data_); 45 source_->info->set_cached_data(&script_data_);
(...skipping 27 matching lines...) Expand all
70 script_data_->data(), script_data_->length(), 73 script_data_->data(), script_data_->length(),
71 ScriptCompiler::CachedData::BufferOwned)); 74 ScriptCompiler::CachedData::BufferOwned));
72 script_data_->ReleaseDataOwnership(); 75 script_data_->ReleaseDataOwnership();
73 delete script_data_; 76 delete script_data_;
74 script_data_ = nullptr; 77 script_data_ = nullptr;
75 } 78 }
76 source_->info->set_isolate(isolate); 79 source_->info->set_isolate(isolate);
77 } 80 }
78 } // namespace internal 81 } // namespace internal
79 } // namespace v8 82 } // namespace v8
OLDNEW
« no previous file with comments | « src/background-parsing-task.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698