OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PIPELINE_H_ | 5 #ifndef V8_COMPILER_PIPELINE_H_ |
6 #define V8_COMPILER_PIPELINE_H_ | 6 #define V8_COMPILER_PIPELINE_H_ |
7 | 7 |
8 // Clients of this interface shouldn't depend on lots of compiler internals. | 8 // Clients of this interface shouldn't depend on lots of compiler internals. |
9 // Do not include anything from src/compiler here! | 9 // Do not include anything from src/compiler here! |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class CompilationInfo; | 15 class CompilationInfo; |
| 16 class OptimizedCompileJob; |
16 class RegisterConfiguration; | 17 class RegisterConfiguration; |
17 | 18 |
18 namespace compiler { | 19 namespace compiler { |
19 | 20 |
20 class CallDescriptor; | 21 class CallDescriptor; |
21 class Graph; | 22 class Graph; |
22 class InstructionSequence; | 23 class InstructionSequence; |
23 class Linkage; | 24 class Linkage; |
24 class PipelineData; | 25 class PipelineData; |
25 class Schedule; | 26 class Schedule; |
26 | 27 |
27 class Pipeline { | 28 class Pipeline { |
28 public: | 29 public: |
29 explicit Pipeline(CompilationInfo* info) : info_(info) {} | 30 explicit Pipeline(CompilationInfo* info) : info_(info), data_(nullptr) {} |
30 | 31 |
31 // Run the entire pipeline and generate a handle to a code object. | 32 // Run the entire pipeline and generate a handle to a code object. |
32 Handle<Code> GenerateCode(); | 33 Handle<Code> GenerateCode(); |
33 | 34 |
34 // Run the pipeline on a machine graph and generate code. The {schedule} must | 35 // Run the pipeline on a machine graph and generate code. The {schedule} must |
35 // be valid, hence the given {graph} does not need to be schedulable. | 36 // be valid, hence the given {graph} does not need to be schedulable. |
36 static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate, | 37 static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate, |
37 CallDescriptor* call_descriptor, | 38 CallDescriptor* call_descriptor, |
38 Graph* graph, Schedule* schedule, | 39 Graph* graph, Schedule* schedule, |
39 Code::Flags flags, | 40 Code::Flags flags, |
(...skipping 10 matching lines...) Expand all Loading... |
50 InstructionSequence* sequence, | 51 InstructionSequence* sequence, |
51 bool run_verifier); | 52 bool run_verifier); |
52 | 53 |
53 // Run the pipeline on a machine graph and generate code. If {schedule} is | 54 // Run the pipeline on a machine graph and generate code. If {schedule} is |
54 // {nullptr}, then compute a new schedule for code generation. | 55 // {nullptr}, then compute a new schedule for code generation. |
55 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, | 56 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, |
56 CallDescriptor* call_descriptor, | 57 CallDescriptor* call_descriptor, |
57 Graph* graph, | 58 Graph* graph, |
58 Schedule* schedule = nullptr); | 59 Schedule* schedule = nullptr); |
59 | 60 |
| 61 // Returns a new compilation job for the given compilation info. |
| 62 static OptimizedCompileJob* NewCompilationJob(CompilationInfo* info); |
| 63 |
60 private: | 64 private: |
61 // Helpers for executing pipeline phases. | 65 // Helpers for executing pipeline phases. |
62 template <typename Phase> | 66 template <typename Phase> |
63 void Run(); | 67 void Run(); |
64 template <typename Phase, typename Arg0> | 68 template <typename Phase, typename Arg0> |
65 void Run(Arg0 arg_0); | 69 void Run(Arg0 arg_0); |
66 template <typename Phase, typename Arg0, typename Arg1> | 70 template <typename Phase, typename Arg0, typename Arg1> |
67 void Run(Arg0 arg_0, Arg1 arg_1); | 71 void Run(Arg0 arg_0, Arg1 arg_1); |
68 | 72 |
69 void BeginPhaseKind(const char* phase_kind); | 73 void BeginPhaseKind(const char* phase_kind); |
70 void RunPrintAndVerify(const char* phase, bool untyped = false); | 74 void RunPrintAndVerify(const char* phase, bool untyped = false); |
71 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor); | 75 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor); |
72 void AllocateRegisters(const RegisterConfiguration* config, | 76 void AllocateRegisters(const RegisterConfiguration* config, |
73 CallDescriptor* descriptor, bool run_verifier); | 77 CallDescriptor* descriptor, bool run_verifier); |
74 | 78 |
75 CompilationInfo* info() const { return info_; } | 79 CompilationInfo* info() const { return info_; } |
76 Isolate* isolate() const; | 80 Isolate* isolate() const; |
77 | 81 |
78 CompilationInfo* const info_; | 82 CompilationInfo* const info_; |
79 PipelineData* data_; | 83 PipelineData* data_; |
80 | 84 |
81 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 85 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
82 }; | 86 }; |
83 | 87 |
84 } // namespace compiler | 88 } // namespace compiler |
85 } // namespace internal | 89 } // namespace internal |
86 } // namespace v8 | 90 } // namespace v8 |
87 | 91 |
88 #endif // V8_COMPILER_PIPELINE_H_ | 92 #endif // V8_COMPILER_PIPELINE_H_ |
OLD | NEW |