Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-job.h

Issue 2193813002: Add parser finalization step (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler-dispatcher/compiler-dispatcher-job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 Parser; 20 class Parser;
21 class String;
21 class UnicodeCache; 22 class UnicodeCache;
22 class Utf16CharacterStream; 23 class Utf16CharacterStream;
23 class Zone; 24 class Zone;
24 25
25 enum class CompileJobStatus { 26 enum class CompileJobStatus {
26 kInitial, 27 kInitial,
27 kReadyToParse, 28 kReadyToParse,
28 kParsed, 29 kParsed,
30 kReadyToCompile,
31 kFailed,
32 kDone,
29 }; 33 };
30 34
31 class CompilerDispatcherJob { 35 class CompilerDispatcherJob {
32 public: 36 public:
33 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function, 37 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function,
34 size_t max_stack_size); 38 size_t max_stack_size);
35 ~CompilerDispatcherJob(); 39 ~CompilerDispatcherJob();
36 40
37 CompileJobStatus status() const { return status_; } 41 CompileJobStatus status() const { return status_; }
38 bool can_parse_on_background_thread() const { 42 bool can_parse_on_background_thread() const {
39 return can_parse_on_background_thread_; 43 return can_parse_on_background_thread_;
40 } 44 }
41 45
42 // Transition from kInitial to kReadyToParse. 46 // Transition from kInitial to kReadyToParse.
43 void PrepareToParseOnMainThread(); 47 void PrepareToParseOnMainThread();
44 48
45 // Transition from kReadyToParse to kParsed. 49 // Transition from kReadyToParse to kParsed.
46 void Parse(); 50 void Parse();
47 51
52 // Transition from kParsed to kReadyToCompile (or kFailed).
53 void FinalizeParsingOnMainThread();
54
55 // Transition from kFailed to kDone.
56 void ReportErrorsOnMainThread();
57
58 // Transition from any state to kInitial and free all resources.
59 void ResetOnMainThread();
60
48 private: 61 private:
62 void InternalizeParsingResult();
63
49 CompileJobStatus status_ = CompileJobStatus::kInitial; 64 CompileJobStatus status_ = CompileJobStatus::kInitial;
50 Isolate* isolate_; 65 Isolate* isolate_;
51 Handle<JSFunction> function_; // Global handle. 66 Handle<JSFunction> function_; // Global handle.
67 Handle<String> source_; // Global handle.
52 size_t max_stack_size_; 68 size_t max_stack_size_;
53 69
54 // Members required for parsing. 70 // Members required for parsing.
55 std::unique_ptr<UnicodeCache> unicode_cache_; 71 std::unique_ptr<UnicodeCache> unicode_cache_;
56 std::unique_ptr<Zone> zone_; 72 std::unique_ptr<Zone> zone_;
57 std::unique_ptr<Utf16CharacterStream> character_stream_; 73 std::unique_ptr<Utf16CharacterStream> character_stream_;
58 std::unique_ptr<ParseInfo> parse_info_; 74 std::unique_ptr<ParseInfo> parse_info_;
59 std::unique_ptr<Parser> parser_; 75 std::unique_ptr<Parser> parser_;
60 76
61 bool can_parse_on_background_thread_; 77 bool can_parse_on_background_thread_;
62 78
63 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); 79 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob);
64 }; 80 };
65 81
66 } // namespace internal 82 } // namespace internal
67 } // namespace v8 83 } // namespace v8
68 84
69 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ 85 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler-dispatcher/compiler-dispatcher-job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698