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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool can_parse_on_background_thread() const { | 43 bool can_parse_on_background_thread() const { |
44 return can_parse_on_background_thread_; | 44 return can_parse_on_background_thread_; |
45 } | 45 } |
46 | 46 |
47 // Transition from kInitial to kReadyToParse. | 47 // Transition from kInitial to kReadyToParse. |
48 void PrepareToParseOnMainThread(); | 48 void PrepareToParseOnMainThread(); |
49 | 49 |
50 // Transition from kReadyToParse to kParsed. | 50 // Transition from kReadyToParse to kParsed. |
51 void Parse(); | 51 void Parse(); |
52 | 52 |
53 // Transition from kParsed to kReadyToCompile (or kFailed). | 53 // Transition from kParsed to kReadyToCompile (or kFailed). Returns false |
54 void FinalizeParsingOnMainThread(); | 54 // when transitioning to kFailed. In that case, an exception is pending. |
55 | 55 bool FinalizeParsingOnMainThread(); |
56 // Transition from kFailed to kDone. | |
57 void ReportErrorsOnMainThread(); | |
58 | 56 |
59 // Transition from any state to kInitial and free all resources. | 57 // Transition from any state to kInitial and free all resources. |
60 void ResetOnMainThread(); | 58 void ResetOnMainThread(); |
61 | 59 |
62 private: | 60 private: |
63 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); | 61 FRIEND_TEST(CompilerDispatcherJobTest, ScopeChain); |
64 | 62 |
65 void InternalizeParsingResult(); | |
66 | |
67 CompileJobStatus status_ = CompileJobStatus::kInitial; | 63 CompileJobStatus status_ = CompileJobStatus::kInitial; |
68 Isolate* isolate_; | 64 Isolate* isolate_; |
69 Handle<JSFunction> function_; // Global handle. | 65 Handle<JSFunction> function_; // Global handle. |
70 Handle<String> source_; // Global handle. | 66 Handle<String> source_; // Global handle. |
71 size_t max_stack_size_; | 67 size_t max_stack_size_; |
72 | 68 |
73 // Members required for parsing. | 69 // Members required for parsing. |
74 std::unique_ptr<UnicodeCache> unicode_cache_; | 70 std::unique_ptr<UnicodeCache> unicode_cache_; |
75 std::unique_ptr<Zone> zone_; | 71 std::unique_ptr<Zone> zone_; |
76 std::unique_ptr<Utf16CharacterStream> character_stream_; | 72 std::unique_ptr<Utf16CharacterStream> character_stream_; |
77 std::unique_ptr<ParseInfo> parse_info_; | 73 std::unique_ptr<ParseInfo> parse_info_; |
78 std::unique_ptr<Parser> parser_; | 74 std::unique_ptr<Parser> parser_; |
| 75 std::unique_ptr<DeferredHandles> handles_from_parsing_; |
79 | 76 |
80 bool can_parse_on_background_thread_; | 77 bool can_parse_on_background_thread_; |
81 | 78 |
82 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); | 79 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); |
83 }; | 80 }; |
84 | 81 |
85 } // namespace internal | 82 } // namespace internal |
86 } // namespace v8 | 83 } // namespace v8 |
87 | 84 |
88 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ | 85 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ |
OLD | NEW |