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 #include <fstream> // NOLINT(readability/streams) |
| 9 |
8 #include "src/v8.h" | 10 #include "src/v8.h" |
9 | 11 |
10 #include "src/compiler.h" | 12 #include "src/compiler.h" |
11 | 13 |
12 // Note: TODO(turbofan) implies a performance improvement opportunity, | 14 // Note: TODO(turbofan) implies a performance improvement opportunity, |
13 // and TODO(name) implies an incomplete implementation | 15 // and TODO(name) implies an incomplete implementation |
14 | 16 |
15 namespace v8 { | 17 namespace v8 { |
16 namespace internal { | 18 namespace internal { |
17 namespace compiler { | 19 namespace compiler { |
18 | 20 |
19 // Clients of this interface shouldn't depend on lots of compiler internals. | 21 // Clients of this interface shouldn't depend on lots of compiler internals. |
20 class Graph; | 22 class Graph; |
| 23 class InstructionSequence; |
| 24 class Linkage; |
| 25 class RegisterAllocator; |
21 class Schedule; | 26 class Schedule; |
22 class SourcePositionTable; | 27 class SourcePositionTable; |
23 class Linkage; | |
24 | 28 |
25 class Pipeline { | 29 class Pipeline { |
26 public: | 30 public: |
27 explicit Pipeline(CompilationInfo* info) : info_(info) {} | 31 explicit Pipeline(CompilationInfo* info) : info_(info) {} |
28 | 32 |
29 // Run the entire pipeline and generate a handle to a code object. | 33 // Run the entire pipeline and generate a handle to a code object. |
30 Handle<Code> GenerateCode(); | 34 Handle<Code> GenerateCode(); |
31 | 35 |
32 // Run the pipeline on a machine graph and generate code. If {schedule} | 36 // Run the pipeline on a machine graph and generate code. If {schedule} |
33 // is {NULL}, then compute a new schedule for code generation. | 37 // is {NULL}, then compute a new schedule for code generation. |
34 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, | 38 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, |
35 Schedule* schedule = NULL); | 39 Schedule* schedule = NULL); |
36 | 40 |
37 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } | 41 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } |
38 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } | 42 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } |
39 | 43 |
40 static void SetUp(); | 44 static void SetUp(); |
41 static void TearDown(); | 45 static void TearDown(); |
42 | 46 |
43 private: | 47 private: |
44 CompilationInfo* info_; | 48 CompilationInfo* info_; |
45 | 49 |
46 CompilationInfo* info() const { return info_; } | 50 CompilationInfo* info() const { return info_; } |
47 Isolate* isolate() { return info_->isolate(); } | 51 Isolate* isolate() { return info_->isolate(); } |
48 Zone* zone() { return info_->zone(); } | 52 Zone* zone() { return info_->zone(); } |
49 | 53 |
50 Schedule* ComputeSchedule(Graph* graph); | 54 Schedule* ComputeSchedule(Graph* graph); |
| 55 void OpenTurboCfgFile(std::ofstream* stream); |
| 56 void PrintCompilationStart(); |
| 57 void PrintScheduleAndInstructions(const char* phase, const Schedule* schedule, |
| 58 const SourcePositionTable* positions, |
| 59 const InstructionSequence* instructions); |
| 60 void PrintAllocator(const char* phase, const RegisterAllocator* allocator); |
51 void VerifyAndPrintGraph(Graph* graph, const char* phase); | 61 void VerifyAndPrintGraph(Graph* graph, const char* phase); |
52 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, | 62 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, |
53 SourcePositionTable* source_positions); | 63 SourcePositionTable* source_positions); |
54 }; | 64 }; |
55 } | 65 } |
56 } | 66 } |
57 } // namespace v8::internal::compiler | 67 } // namespace v8::internal::compiler |
58 | 68 |
59 #endif // V8_COMPILER_PIPELINE_H_ | 69 #endif // V8_COMPILER_PIPELINE_H_ |
OLD | NEW |