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