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

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2318653002: [Interpreter] Localize the CanonicalHandleScope to parsing and renumbering. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« src/ast/ast-numbering.cc ('K') | « src/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/compiler-dispatcher/compiler-dispatcher-job.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h"
6 6
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/global-handles.h" 10 #include "src/global-handles.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 if (parse_info_->literal() == nullptr) { 136 if (parse_info_->literal() == nullptr) {
137 status_ = CompileJobStatus::kFailed; 137 status_ = CompileJobStatus::kFailed;
138 } else { 138 } else {
139 status_ = CompileJobStatus::kReadyToAnalyse; 139 status_ = CompileJobStatus::kReadyToAnalyse;
140 } 140 }
141 141
142 DeferredHandleScope scope(isolate_); 142 DeferredHandleScope scope(isolate_);
143 { 143 {
144 // Create a canonical handle scope before internalizing parsed values if
145 // compiling bytecode. This is required for off-thread bytecode generation.
146 std::unique_ptr<CanonicalHandleScope> canonical;
147 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_));
148
149 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); 144 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
150 Handle<Script> script(Script::cast(shared->script()), isolate_); 145 Handle<Script> script(Script::cast(shared->script()), isolate_);
151 146
152 parse_info_->set_script(script); 147 parse_info_->set_script(script);
153 parse_info_->set_context(handle(function_->context(), isolate_)); 148 parse_info_->set_context(handle(function_->context(), isolate_));
154 parse_info_->set_shared_info(handle(function_->shared(), isolate_)); 149 parse_info_->set_shared_info(handle(function_->shared(), isolate_));
155 150
156 // Do the parsing tasks which need to be done on the main thread. This will 151 // Do the parsing tasks which need to be done on the main thread. This will
157 // also handle parse errors. 152 // also handle parse errors.
158 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); 153 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr);
(...skipping 10 matching lines...) Expand all
169 return status_ != CompileJobStatus::kFailed; 164 return status_ != CompileJobStatus::kFailed;
170 } 165 }
171 166
172 bool CompilerDispatcherJob::PrepareToCompileOnMainThread() { 167 bool CompilerDispatcherJob::PrepareToCompileOnMainThread() {
173 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); 168 DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
174 DCHECK(status() == CompileJobStatus::kReadyToAnalyse); 169 DCHECK(status() == CompileJobStatus::kReadyToAnalyse);
175 170
176 compile_info_.reset(new CompilationInfo(parse_info_.get(), function_)); 171 compile_info_.reset(new CompilationInfo(parse_info_.get(), function_));
177 172
178 DeferredHandleScope scope(isolate_); 173 DeferredHandleScope scope(isolate_);
179 { 174 if (Compiler::Analyze(parse_info_.get())) {
180 // Create a canonical handle scope before ast numbering if compiling 175 compile_job_.reset(
181 // bytecode. This is required for off-thread bytecode generation. 176 Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get()));
182 std::unique_ptr<CanonicalHandleScope> canonical;
183 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_));
184
185 if (Compiler::Analyze(parse_info_.get())) {
186 compile_job_.reset(
187 Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get()));
188 }
189 } 177 }
190 compile_info_->set_deferred_handles(scope.Detach()); 178 compile_info_->set_deferred_handles(scope.Detach());
191 179
192 if (!compile_job_.get()) { 180 if (!compile_job_.get()) {
193 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); 181 if (!isolate_->has_pending_exception()) isolate_->StackOverflow();
194 status_ = CompileJobStatus::kFailed; 182 status_ = CompileJobStatus::kFailed;
195 return false; 183 return false;
196 } 184 }
197 185
198 can_compile_on_background_thread_ = 186 can_compile_on_background_thread_ =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (!source_.is_null()) { 245 if (!source_.is_null()) {
258 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); 246 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location());
259 source_ = Handle<String>::null(); 247 source_ = Handle<String>::null();
260 } 248 }
261 249
262 status_ = CompileJobStatus::kInitial; 250 status_ = CompileJobStatus::kInitial;
263 } 251 }
264 252
265 } // namespace internal 253 } // namespace internal
266 } // namespace v8 254 } // namespace v8
OLDNEW
« src/ast/ast-numbering.cc ('K') | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698