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

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

Issue 2190333002: Teach compiler jobs how to actually parse (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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/atomic-utils.h"
10 #include "src/base/macros.h" 11 #include "src/base/macros.h"
11 #include "src/handles.h" 12 #include "src/handles.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 class CompilationInfo; 17 class CompilationInfo;
17 class Isolate; 18 class Isolate;
18 class JSFunction; 19 class JSFunction;
19 class ParseInfo; 20 class ParseInfo;
21 class Parser;
20 class UnicodeCache; 22 class UnicodeCache;
21 class Utf16CharacterStream; 23 class Utf16CharacterStream;
22 class Zone; 24 class Zone;
23 25
24 enum class CompileJobStatus { 26 enum class CompileJobStatus {
25 kInitial, 27 kInitial,
26 kReadyToParse, 28 kReadyToParse,
29 kParsed,
27 }; 30 };
28 31
29 class CompilerDispatcherJob { 32 class CompilerDispatcherJob {
30 public: 33 public:
31 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function); 34 CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function,
35 size_t max_stack_size);
32 ~CompilerDispatcherJob(); 36 ~CompilerDispatcherJob();
33 37
34 CompileJobStatus status() const { return status_; } 38 CompileJobStatus status() const { return status_.Value(); }
39 bool can_parse_on_background_thread() const {
40 return can_parse_on_background_thread_;
41 }
35 42
36 // Transition from kInitial to kReadyToParse. 43 // Transition from kInitial to kReadyToParse.
37 void PrepareToParseOnMainThread(); 44 void PrepareToParseOnMainThread();
38 45
46 // Transition from kReadyToParse to kParsed.
47 void Parse();
48
39 private: 49 private:
40 CompileJobStatus status_ = CompileJobStatus::kInitial; 50 base::AtomicValue<CompileJobStatus> status_ =
51 base::AtomicValue<CompileJobStatus>(CompileJobStatus::kInitial);
vogelheim 2016/07/29 10:19:56 Why initialize here, and not in constructor?
jochen (gone - plz use gerrit) 2016/07/29 10:27:45 so you see in the header that this is independend
41 Isolate* isolate_; 52 Isolate* isolate_;
42 Handle<JSFunction> function_; // Global handle. 53 Handle<JSFunction> function_; // Global handle.
54 size_t max_stack_size_;
43 55
44 // Members required for parsing. 56 // Members required for parsing.
45 std::unique_ptr<UnicodeCache> unicode_cache_; 57 std::unique_ptr<UnicodeCache> unicode_cache_;
46 std::unique_ptr<Zone> zone_; 58 std::unique_ptr<Zone> zone_;
47 std::unique_ptr<Utf16CharacterStream> character_stream_; 59 std::unique_ptr<Utf16CharacterStream> character_stream_;
48 std::unique_ptr<ParseInfo> parse_info_; 60 std::unique_ptr<ParseInfo> parse_info_;
61 std::unique_ptr<Parser> parser_;
49 62
50 bool can_parse_on_background_thread_; 63 bool can_parse_on_background_thread_;
51 64
52 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob); 65 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob);
53 }; 66 };
54 67
55 } // namespace internal 68 } // namespace internal
56 } // namespace v8 69 } // namespace v8
57 70
58 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_ 71 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698