| 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" |
| 11 #include "src/handles.h" | 11 #include "src/handles.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 class CompilationInfo; | 16 class CompilationInfo; |
| 17 class Isolate; | 17 class Isolate; |
| 18 class JSFunction; | 18 class JSFunction; |
| 19 class ParseInfo; | 19 class ParseInfo; |
| 20 class UnicodeCache; | 20 class UnicodeCache; |
| 21 class Utf16CharacterStream; |
| 21 class Zone; | 22 class Zone; |
| 22 | 23 |
| 23 enum class CompileJobStatus { | 24 enum class CompileJobStatus { |
| 24 kInitial, | 25 kInitial, |
| 25 kReadyToParse, | 26 kReadyToParse, |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 class CompilerDispatcherJob { | 29 class CompilerDispatcherJob { |
| 29 public: | 30 public: |
| 30 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function); | 31 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function); |
| 31 ~CompilerDispatcherJob(); | 32 ~CompilerDispatcherJob(); |
| 32 | 33 |
| 33 CompileJobStatus status() const { return status_; } | 34 CompileJobStatus status() const { return status_; } |
| 34 | 35 |
| 35 // Transition from kInitial to kReadyToParse. | 36 // Transition from kInitial to kReadyToParse. |
| 36 void PrepareToParseOnMainThread(); | 37 void PrepareToParseOnMainThread(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 CompileJobStatus status_ = CompileJobStatus::kInitial; | 40 CompileJobStatus status_ = CompileJobStatus::kInitial; |
| 40 Isolate* isolate_; | 41 Isolate* isolate_; |
| 41 Handle<JSFunction> function_; // Global handle. | 42 Handle<JSFunction> function_; // Global handle. |
| 42 | 43 |
| 43 // Members required for parsing. | 44 // Members required for parsing. |
| 44 std::unique_ptr<UnicodeCache> unicode_cache_; | 45 std::unique_ptr<UnicodeCache> unicode_cache_; |
| 45 std::unique_ptr<Zone> zone_; | 46 std::unique_ptr<Zone> zone_; |
| 47 std::unique_ptr<Utf16CharacterStream> character_stream_; |
| 46 std::unique_ptr<ParseInfo> parse_info_; | 48 std::unique_ptr<ParseInfo> parse_info_; |
| 47 | 49 |
| 50 bool can_parse_on_background_thread_; |
| 51 |
| 48 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); | 52 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace internal | 55 } // namespace internal |
| 52 } // namespace v8 | 56 } // namespace v8 |
| 53 | 57 |
| 54 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 58 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
| OLD | NEW |