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" |
11 #include "src/flags.h" | 11 #include "src/flags.h" |
12 #include "src/global-handles.h" | 12 #include "src/global-handles.h" |
13 #include "src/isolate.h" | 13 #include "src/isolate.h" |
14 #include "src/objects-inl.h" | 14 #include "src/objects-inl.h" |
15 #include "src/parsing/parse-info.h" | 15 #include "src/parsing/parse-info.h" |
16 #include "src/parsing/parser.h" | 16 #include "src/parsing/parser.h" |
17 #include "src/parsing/scanner-character-streams.h" | 17 #include "src/parsing/scanner-character-streams.h" |
18 #include "src/unicode-cache.h" | 18 #include "src/unicode-cache.h" |
19 #include "src/utils.h" | 19 #include "src/utils.h" |
20 #include "src/zone/zone.h" | |
21 | 20 |
22 namespace v8 { | 21 namespace v8 { |
23 namespace internal { | 22 namespace internal { |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 class OneByteWrapper : public v8::String::ExternalOneByteStringResource { | 26 class OneByteWrapper : public v8::String::ExternalOneByteStringResource { |
28 public: | 27 public: |
29 OneByteWrapper(const void* data, int length) : data_(data), length_(length) {} | 28 OneByteWrapper(const void* data, int length) : data_(data), length_(length) {} |
30 ~OneByteWrapper() override = default; | 29 ~OneByteWrapper() override = default; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Handle<Script> script(Script::cast(shared_->script()), isolate_); | 77 Handle<Script> script(Script::cast(shared_->script()), isolate_); |
79 Handle<String> source(String::cast(script->source()), isolate_); | 78 Handle<String> source(String::cast(script->source()), isolate_); |
80 if (trace_compiler_dispatcher_jobs_) { | 79 if (trace_compiler_dispatcher_jobs_) { |
81 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); | 80 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); |
82 shared_->ShortPrint(); | 81 shared_->ShortPrint(); |
83 PrintF(" in initial state.\n"); | 82 PrintF(" in initial state.\n"); |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 CompilerDispatcherJob::CompilerDispatcherJob( | 86 CompilerDispatcherJob::CompilerDispatcherJob( |
88 Isolate* isolate, CompilerDispatcherTracer* tracer, | 87 Isolate* isolate, CompilerDispatcherTracer* tracer, Handle<Script> script, |
89 Handle<SharedFunctionInfo> shared, FunctionLiteral* literal, | 88 Handle<SharedFunctionInfo> shared, FunctionLiteral* literal, |
90 std::shared_ptr<Zone> parse_zone, | 89 std::shared_ptr<Zone> parse_zone, |
91 std::shared_ptr<DeferredHandles> parse_handles, | 90 std::shared_ptr<DeferredHandles> parse_handles, |
92 std::shared_ptr<DeferredHandles> compile_handles, size_t max_stack_size) | 91 std::shared_ptr<DeferredHandles> compile_handles, size_t max_stack_size) |
93 : status_(CompileJobStatus::kAnalyzed), | 92 : status_(CompileJobStatus::kAnalyzed), |
94 isolate_(isolate), | 93 isolate_(isolate), |
95 tracer_(tracer), | 94 tracer_(tracer), |
96 shared_(Handle<SharedFunctionInfo>::cast( | 95 shared_(Handle<SharedFunctionInfo>::cast( |
97 isolate_->global_handles()->Create(*shared))), | 96 isolate_->global_handles()->Create(*shared))), |
98 max_stack_size_(max_stack_size), | 97 max_stack_size_(max_stack_size), |
99 parse_info_(new ParseInfo(shared_)), | 98 parse_info_(new ParseInfo(shared_)), |
100 parse_zone_(parse_zone), | 99 parse_zone_(parse_zone), |
101 compile_info_(new CompilationInfo(parse_info_->zone(), parse_info_.get(), | 100 compile_info_(new CompilationInfo(parse_info_->zone(), parse_info_.get(), |
102 Handle<JSFunction>::null())), | 101 Handle<JSFunction>::null())), |
103 trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) { | 102 trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) { |
104 parse_info_->set_literal(literal); | 103 parse_info_->set_literal(literal); |
| 104 parse_info_->set_script(script); |
105 parse_info_->set_deferred_handles(parse_handles); | 105 parse_info_->set_deferred_handles(parse_handles); |
106 compile_info_->set_deferred_handles(compile_handles); | 106 compile_info_->set_deferred_handles(compile_handles); |
107 | 107 |
108 if (trace_compiler_dispatcher_jobs_) { | 108 if (trace_compiler_dispatcher_jobs_) { |
109 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); | 109 PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this)); |
110 shared_->ShortPrint(); | 110 shared_->ShortPrint(); |
111 PrintF(" in Analyzed state.\n"); | 111 PrintF(" in Analyzed state.\n"); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return 0.0; | 463 return 0.0; |
464 } | 464 } |
465 | 465 |
466 void CompilerDispatcherJob::ShortPrint() { | 466 void CompilerDispatcherJob::ShortPrint() { |
467 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 467 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
468 shared_->ShortPrint(); | 468 shared_->ShortPrint(); |
469 } | 469 } |
470 | 470 |
471 } // namespace internal | 471 } // namespace internal |
472 } // namespace v8 | 472 } // namespace v8 |
OLD | NEW |