OLD | NEW |
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-dispatcher/compiler-dispatcher-tracer.h" | 9 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 FunctionLiteral* literal, | 90 FunctionLiteral* literal, |
91 size_t max_stack_size) | 91 size_t max_stack_size) |
92 : status_(CompileJobStatus::kAnalyzed), | 92 : status_(CompileJobStatus::kAnalyzed), |
93 isolate_(isolate), | 93 isolate_(isolate), |
94 tracer_(tracer), | 94 tracer_(tracer), |
95 shared_(Handle<SharedFunctionInfo>::cast( | 95 shared_(Handle<SharedFunctionInfo>::cast( |
96 isolate_->global_handles()->Create(*shared))), | 96 isolate_->global_handles()->Create(*shared))), |
97 max_stack_size_(max_stack_size), | 97 max_stack_size_(max_stack_size), |
98 parse_info_( | 98 parse_info_( |
99 new ParseInfo(Handle<Script>(Script::cast(shared->script())))), | 99 new ParseInfo(Handle<Script>(Script::cast(shared->script())))), |
100 compile_info_( | 100 compile_info_(new CompilationInfo(parse_info_->zone(), parse_info_.get(), |
101 new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null())), | 101 Handle<JSFunction>::null())), |
102 trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) { | 102 trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) { |
103 parse_info_->set_literal(literal); | 103 parse_info_->set_literal(literal); |
104 parse_info_->set_shared_info(shared); | 104 parse_info_->set_shared_info(shared); |
105 parse_info_->set_function_literal_id(shared->function_literal_id()); | 105 parse_info_->set_function_literal_id(shared->function_literal_id()); |
106 parse_info_->set_language_mode(literal->scope()->language_mode()); | 106 parse_info_->set_language_mode(literal->scope()->language_mode()); |
107 if (trace_compiler_dispatcher_jobs_) { | 107 if (trace_compiler_dispatcher_jobs_) { |
108 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); | 108 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); |
109 shared_->ShortPrint(); | 109 shared_->ShortPrint(); |
110 PrintF(" in Analyzed state.\n"); | 110 PrintF(" in Analyzed state.\n"); |
111 } | 111 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 311 } |
312 | 312 |
313 bool CompilerDispatcherJob::AnalyzeOnMainThread() { | 313 bool CompilerDispatcherJob::AnalyzeOnMainThread() { |
314 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 314 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
315 DCHECK(status() == CompileJobStatus::kReadyToAnalyze); | 315 DCHECK(status() == CompileJobStatus::kReadyToAnalyze); |
316 COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kAnalyze); | 316 COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kAnalyze); |
317 if (trace_compiler_dispatcher_jobs_) { | 317 if (trace_compiler_dispatcher_jobs_) { |
318 PrintF("CompilerDispatcherJob[%p]: Analyzing\n", static_cast<void*>(this)); | 318 PrintF("CompilerDispatcherJob[%p]: Analyzing\n", static_cast<void*>(this)); |
319 } | 319 } |
320 | 320 |
321 compile_info_.reset( | 321 compile_info_.reset(new CompilationInfo( |
322 new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null())); | 322 parse_info_->zone(), parse_info_.get(), Handle<JSFunction>::null())); |
323 | 323 |
324 DeferredHandleScope scope(isolate_); | 324 DeferredHandleScope scope(isolate_); |
325 { | 325 { |
326 if (Compiler::Analyze(parse_info_.get())) { | 326 if (Compiler::Analyze(parse_info_.get())) { |
327 status_ = CompileJobStatus::kAnalyzed; | 327 status_ = CompileJobStatus::kAnalyzed; |
328 } else { | 328 } else { |
329 status_ = CompileJobStatus::kFailed; | 329 status_ = CompileJobStatus::kFailed; |
330 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); | 330 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); |
331 } | 331 } |
332 } | 332 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 return 0.0; | 461 return 0.0; |
462 } | 462 } |
463 | 463 |
464 void CompilerDispatcherJob::ShortPrint() { | 464 void CompilerDispatcherJob::ShortPrint() { |
465 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 465 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
466 shared_->ShortPrint(); | 466 shared_->ShortPrint(); |
467 } | 467 } |
468 | 468 |
469 } // namespace internal | 469 } // namespace internal |
470 } // namespace v8 | 470 } // namespace v8 |
OLD | NEW |