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 "include/v8.h" |
10 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
11 #include "src/globals.h" | 12 #include "src/globals.h" |
12 #include "src/handles.h" | 13 #include "src/handles.h" |
13 #include "testing/gtest/include/gtest/gtest_prod.h" | 14 #include "testing/gtest/include/gtest/gtest_prod.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 class CompilerDispatcherTracer; | 19 class CompilerDispatcherTracer; |
19 class CompilationInfo; | 20 class CompilationInfo; |
(...skipping 19 matching lines...) Expand all Loading... |
39 }; | 40 }; |
40 | 41 |
41 class V8_EXPORT_PRIVATE CompilerDispatcherJob { | 42 class V8_EXPORT_PRIVATE CompilerDispatcherJob { |
42 public: | 43 public: |
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); |
46 ~CompilerDispatcherJob(); | 47 ~CompilerDispatcherJob(); |
47 | 48 |
48 CompileJobStatus status() const { return status_; } | 49 CompileJobStatus status() const { return status_; } |
49 bool can_parse_on_background_thread() const { | |
50 return can_parse_on_background_thread_; | |
51 } | |
52 // Should only be called after kReadyToCompile. | |
53 bool can_compile_on_background_thread() const { | |
54 DCHECK(compile_job_.get()); | |
55 return can_compile_on_background_thread_; | |
56 } | |
57 | 50 |
58 // Returns true if this CompilerDispatcherJob was created for the given | 51 // Returns true if this CompilerDispatcherJob was created for the given |
59 // function. | 52 // function. |
60 bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const; | 53 bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const; |
61 | 54 |
62 // Transition from kInitial to kReadyToParse. | 55 // Transition from kInitial to kReadyToParse. |
63 void PrepareToParseOnMainThread(); | 56 void PrepareToParseOnMainThread(); |
64 | 57 |
65 // Transition from kReadyToParse to kParsed. | 58 // Transition from kReadyToParse to kParsed. |
66 void Parse(); | 59 void Parse(); |
(...skipping 24 matching lines...) Expand all Loading... |
91 void ShortPrint(); | 84 void ShortPrint(); |
92 | 85 |
93 private: | 86 private: |
94 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); | 87 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); |
95 | 88 |
96 CompileJobStatus status_ = CompileJobStatus::kInitial; | 89 CompileJobStatus status_ = CompileJobStatus::kInitial; |
97 Isolate* isolate_; | 90 Isolate* isolate_; |
98 CompilerDispatcherTracer* tracer_; | 91 CompilerDispatcherTracer* tracer_; |
99 Handle<SharedFunctionInfo> shared_; // Global handle. | 92 Handle<SharedFunctionInfo> shared_; // Global handle. |
100 Handle<String> source_; // Global handle. | 93 Handle<String> source_; // Global handle. |
| 94 Handle<String> wrapper_; // Global handle. |
| 95 std::unique_ptr<v8::String::ExternalStringResourceBase> source_wrapper_; |
101 size_t max_stack_size_; | 96 size_t max_stack_size_; |
102 | 97 |
103 // Members required for parsing. | 98 // Members required for parsing. |
104 std::unique_ptr<UnicodeCache> unicode_cache_; | 99 std::unique_ptr<UnicodeCache> unicode_cache_; |
105 std::unique_ptr<Zone> zone_; | 100 std::unique_ptr<Zone> zone_; |
106 std::unique_ptr<Utf16CharacterStream> character_stream_; | 101 std::unique_ptr<Utf16CharacterStream> character_stream_; |
107 std::unique_ptr<ParseInfo> parse_info_; | 102 std::unique_ptr<ParseInfo> parse_info_; |
108 std::unique_ptr<Parser> parser_; | 103 std::unique_ptr<Parser> parser_; |
109 std::unique_ptr<DeferredHandles> handles_from_parsing_; | 104 std::unique_ptr<DeferredHandles> handles_from_parsing_; |
110 | 105 |
111 // Members required for compiling. | 106 // Members required for compiling. |
112 std::unique_ptr<CompilationInfo> compile_info_; | 107 std::unique_ptr<CompilationInfo> compile_info_; |
113 std::unique_ptr<CompilationJob> compile_job_; | 108 std::unique_ptr<CompilationJob> compile_job_; |
114 | 109 |
115 bool can_parse_on_background_thread_; | |
116 bool can_compile_on_background_thread_; | |
117 | |
118 bool trace_compiler_dispatcher_jobs_; | 110 bool trace_compiler_dispatcher_jobs_; |
119 | 111 |
120 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); | 112 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); |
121 }; | 113 }; |
122 | 114 |
123 } // namespace internal | 115 } // namespace internal |
124 } // namespace v8 | 116 } // namespace v8 |
125 | 117 |
126 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 118 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
OLD | NEW |