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 CompilationJob; | 16 class CompilationJob; |
17 class RegisterConfiguration; | 17 class RegisterConfiguration; |
18 | 18 |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
21 class CallDescriptor; | 21 class CallDescriptor; |
22 class Graph; | 22 class Graph; |
23 class InstructionSequence; | 23 class InstructionSequence; |
24 class Linkage; | |
25 class PipelineData; | |
26 class Schedule; | 24 class Schedule; |
27 class SourcePositionTable; | 25 class SourcePositionTable; |
28 | 26 |
29 class Pipeline { | 27 class Pipeline : public AllStatic { |
30 public: | 28 public: |
31 // Returns a new compilation job for the given function. | 29 // Returns a new compilation job for the given function. |
32 static CompilationJob* NewCompilationJob(Handle<JSFunction> function); | 30 static CompilationJob* NewCompilationJob(Handle<JSFunction> function); |
33 | 31 |
34 // Returns a new compilation job for the WebAssembly compilation info. | 32 // Returns a new compilation job for the WebAssembly compilation info. |
35 static CompilationJob* NewWasmCompilationJob( | 33 static CompilationJob* NewWasmCompilationJob( |
36 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, | 34 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, |
37 SourcePositionTable* source_positions); | 35 SourcePositionTable* source_positions); |
38 | 36 |
39 // Run the pipeline on a machine graph and generate code. The {schedule} must | 37 // Run the pipeline on a machine graph and generate code. The {schedule} must |
(...skipping 20 matching lines...) Expand all Loading... |
60 bool run_verifier); | 58 bool run_verifier); |
61 | 59 |
62 // Run the pipeline on a machine graph and generate code. If {schedule} is | 60 // Run the pipeline on a machine graph and generate code. If {schedule} is |
63 // {nullptr}, then compute a new schedule for code generation. | 61 // {nullptr}, then compute a new schedule for code generation. |
64 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, | 62 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, |
65 CallDescriptor* call_descriptor, | 63 CallDescriptor* call_descriptor, |
66 Graph* graph, | 64 Graph* graph, |
67 Schedule* schedule = nullptr); | 65 Schedule* schedule = nullptr); |
68 | 66 |
69 private: | 67 private: |
70 friend class PipelineCompilationJob; | 68 DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline); |
71 friend class PipelineWasmCompilationJob; | |
72 | |
73 explicit Pipeline(PipelineData* data) : data_(data) {} | |
74 | |
75 // Helpers for executing pipeline phases. | |
76 template <typename Phase> | |
77 void Run(); | |
78 template <typename Phase, typename Arg0> | |
79 void Run(Arg0 arg_0); | |
80 template <typename Phase, typename Arg0, typename Arg1> | |
81 void Run(Arg0 arg_0, Arg1 arg_1); | |
82 | |
83 // Run the graph creation and initial optimization passes. | |
84 bool CreateGraph(); | |
85 | |
86 // Run the concurrent optimization passes. | |
87 bool OptimizeGraph(Linkage* linkage); | |
88 | |
89 // Perform the actual code generation and return handle to a code object. | |
90 Handle<Code> GenerateCode(Linkage* linkage); | |
91 | |
92 bool ScheduleAndSelectInstructions(Linkage* linkage); | |
93 void RunPrintAndVerify(const char* phase, bool untyped = false); | |
94 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor); | |
95 void AllocateRegisters(const RegisterConfiguration* config, | |
96 CallDescriptor* descriptor, bool run_verifier); | |
97 | |
98 CompilationInfo* info() const; | |
99 Isolate* isolate() const; | |
100 | |
101 PipelineData* const data_; | |
102 | |
103 DISALLOW_COPY_AND_ASSIGN(Pipeline); | |
104 }; | 69 }; |
105 | 70 |
106 } // namespace compiler | 71 } // namespace compiler |
107 } // namespace internal | 72 } // namespace internal |
108 } // namespace v8 | 73 } // namespace v8 |
109 | 74 |
110 #endif // V8_COMPILER_PIPELINE_H_ | 75 #endif // V8_COMPILER_PIPELINE_H_ |
OLD | NEW |