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 #ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 5 #ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
6 #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 6 #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 kParsed, | 33 kParsed, |
34 kReadyToAnalyse, | 34 kReadyToAnalyse, |
35 kReadyToCompile, | 35 kReadyToCompile, |
36 kCompiled, | 36 kCompiled, |
37 kFailed, | 37 kFailed, |
38 kDone, | 38 kDone, |
39 }; | 39 }; |
40 | 40 |
41 class V8_EXPORT_PRIVATE CompilerDispatcherJob { | 41 class V8_EXPORT_PRIVATE CompilerDispatcherJob { |
42 public: | 42 public: |
| 43 // Creates a CompilerDispatcherJob in the initial state. |
43 CompilerDispatcherJob(Isolate* isolate, CompilerDispatcherTracer* tracer, | 44 CompilerDispatcherJob(Isolate* isolate, CompilerDispatcherTracer* tracer, |
44 Handle<SharedFunctionInfo> shared, | 45 Handle<SharedFunctionInfo> shared, |
45 size_t max_stack_size); | 46 size_t max_stack_size); |
| 47 // Creates a CompilerDispatcherJob in the ReadyToCompiler state. |
| 48 // Takes ownership of |zone|, |parse_info|, |compile_info| and |job|. |
| 49 CompilerDispatcherJob(Isolate* isolate, CompilerDispatcherTracer* tracer, |
| 50 Zone* zone, ParseInfo* parse_info, |
| 51 CompilationInfo* compile_info, CompilationJob* job, |
| 52 size_t max_stack_size); |
46 ~CompilerDispatcherJob(); | 53 ~CompilerDispatcherJob(); |
47 | 54 |
48 CompileJobStatus status() const { return status_; } | 55 CompileJobStatus status() const { return status_; } |
49 bool can_parse_on_background_thread() const { | 56 bool can_parse_on_background_thread() const { |
50 return can_parse_on_background_thread_; | 57 return can_parse_on_background_thread_; |
51 } | 58 } |
52 // Should only be called after kReadyToCompile. | 59 // Should only be called after kReadyToCompile. |
53 bool can_compile_on_background_thread() const { | 60 bool can_compile_on_background_thread() const { |
54 DCHECK(compile_job_.get()); | 61 DCHECK(compile_job_.get()); |
55 return can_compile_on_background_thread_; | 62 return can_compile_on_background_thread_; |
(...skipping 30 matching lines...) Expand all Loading... |
86 // Estimate how long the next step will take using the tracer. | 93 // Estimate how long the next step will take using the tracer. |
87 double EstimateRuntimeOfNextStepInMs() const; | 94 double EstimateRuntimeOfNextStepInMs() const; |
88 | 95 |
89 // Even though the name does not imply this, ShortPrint() must only be invoked | 96 // Even though the name does not imply this, ShortPrint() must only be invoked |
90 // on the main thread. | 97 // on the main thread. |
91 void ShortPrint(); | 98 void ShortPrint(); |
92 | 99 |
93 private: | 100 private: |
94 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); | 101 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); |
95 | 102 |
96 CompileJobStatus status_ = CompileJobStatus::kInitial; | 103 CompileJobStatus status_; |
97 Isolate* isolate_; | 104 Isolate* isolate_; |
98 CompilerDispatcherTracer* tracer_; | 105 CompilerDispatcherTracer* tracer_; |
99 Handle<SharedFunctionInfo> shared_; // Global handle. | 106 Handle<SharedFunctionInfo> shared_; // Global handle. |
100 Handle<String> source_; // Global handle. | 107 Handle<String> source_; // Global handle. |
101 size_t max_stack_size_; | 108 size_t max_stack_size_; |
102 | 109 |
103 // Members required for parsing. | 110 // Members required for parsing. |
104 std::unique_ptr<UnicodeCache> unicode_cache_; | 111 std::unique_ptr<UnicodeCache> unicode_cache_; |
105 std::unique_ptr<Zone> zone_; | 112 std::unique_ptr<Zone> zone_; |
106 std::unique_ptr<Utf16CharacterStream> character_stream_; | 113 std::unique_ptr<Utf16CharacterStream> character_stream_; |
(...skipping 10 matching lines...) Expand all Loading... |
117 | 124 |
118 bool trace_compiler_dispatcher_jobs_; | 125 bool trace_compiler_dispatcher_jobs_; |
119 | 126 |
120 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); | 127 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); |
121 }; | 128 }; |
122 | 129 |
123 } // namespace internal | 130 } // namespace internal |
124 } // namespace v8 | 131 } // namespace v8 |
125 | 132 |
126 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 133 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
OLD | NEW |