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 "include/v8.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 Handle<SharedFunctionInfo> shared, | 53 Handle<SharedFunctionInfo> shared, |
54 FunctionLiteral* literal, | 54 FunctionLiteral* literal, |
55 std::shared_ptr<Zone> parse_zone, | 55 std::shared_ptr<Zone> parse_zone, |
56 std::shared_ptr<DeferredHandles> parse_handles, | 56 std::shared_ptr<DeferredHandles> parse_handles, |
57 std::shared_ptr<DeferredHandles> compile_handles, | 57 std::shared_ptr<DeferredHandles> compile_handles, |
58 size_t max_stack_size); | 58 size_t max_stack_size); |
59 ~CompilerDispatcherJob(); | 59 ~CompilerDispatcherJob(); |
60 | 60 |
61 CompileJobStatus status() const { return status_; } | 61 CompileJobStatus status() const { return status_; } |
62 | 62 |
| 63 Context* context() { return *context_; } |
| 64 |
63 // Returns true if this CompilerDispatcherJob was created for the given | 65 // Returns true if this CompilerDispatcherJob was created for the given |
64 // function. | 66 // function. |
65 bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const; | 67 bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const; |
66 | 68 |
67 // Transition from kInitial to kReadyToParse. | 69 // Transition from kInitial to kReadyToParse. |
68 void PrepareToParseOnMainThread(); | 70 void PrepareToParseOnMainThread(); |
69 | 71 |
70 // Transition from kReadyToParse to kParsed. | 72 // Transition from kReadyToParse to kParsed. |
71 void Parse(); | 73 void Parse(); |
72 | 74 |
(...skipping 25 matching lines...) Expand all Loading... |
98 // Even though the name does not imply this, ShortPrint() must only be invoked | 100 // Even though the name does not imply this, ShortPrint() must only be invoked |
99 // on the main thread. | 101 // on the main thread. |
100 void ShortPrint(); | 102 void ShortPrint(); |
101 | 103 |
102 private: | 104 private: |
103 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); | 105 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); |
104 | 106 |
105 CompileJobStatus status_; | 107 CompileJobStatus status_; |
106 Isolate* isolate_; | 108 Isolate* isolate_; |
107 CompilerDispatcherTracer* tracer_; | 109 CompilerDispatcherTracer* tracer_; |
| 110 Handle<Context> context_; // Global handle. |
108 Handle<SharedFunctionInfo> shared_; // Global handle. | 111 Handle<SharedFunctionInfo> shared_; // Global handle. |
109 Handle<String> source_; // Global handle. | 112 Handle<String> source_; // Global handle. |
110 Handle<String> wrapper_; // Global handle. | 113 Handle<String> wrapper_; // Global handle. |
111 std::unique_ptr<v8::String::ExternalStringResourceBase> source_wrapper_; | 114 std::unique_ptr<v8::String::ExternalStringResourceBase> source_wrapper_; |
112 size_t max_stack_size_; | 115 size_t max_stack_size_; |
113 | 116 |
114 // Members required for parsing. | 117 // Members required for parsing. |
115 std::unique_ptr<UnicodeCache> unicode_cache_; | 118 std::unique_ptr<UnicodeCache> unicode_cache_; |
116 std::unique_ptr<Utf16CharacterStream> character_stream_; | 119 std::unique_ptr<Utf16CharacterStream> character_stream_; |
117 std::unique_ptr<ParseInfo> parse_info_; | 120 std::unique_ptr<ParseInfo> parse_info_; |
118 std::unique_ptr<Parser> parser_; | 121 std::unique_ptr<Parser> parser_; |
119 | 122 |
120 // Members required for compiling a parsed function. | 123 // Members required for compiling a parsed function. |
121 std::shared_ptr<Zone> parse_zone_; | 124 std::shared_ptr<Zone> parse_zone_; |
122 | 125 |
123 // Members required for compiling. | 126 // Members required for compiling. |
124 std::unique_ptr<CompilationInfo> compile_info_; | 127 std::unique_ptr<CompilationInfo> compile_info_; |
125 std::unique_ptr<CompilationJob> compile_job_; | 128 std::unique_ptr<CompilationJob> compile_job_; |
126 | 129 |
127 bool trace_compiler_dispatcher_jobs_; | 130 bool trace_compiler_dispatcher_jobs_; |
128 | 131 |
129 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); | 132 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); |
130 }; | 133 }; |
131 | 134 |
132 } // namespace internal | 135 } // namespace internal |
133 } // namespace v8 | 136 } // namespace v8 |
134 | 137 |
135 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 138 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
OLD | NEW |