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 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM | |
16 #ifndef _WIN64 | |
17 #define V8_TURBOFAN_TARGET 1 | |
18 #else | |
19 #define V8_TURBOFAN_TARGET 0 | |
20 #endif | |
21 #else | |
22 #define V8_TURBOFAN_TARGET 0 | |
23 #endif | |
24 | |
25 namespace v8 { | 15 namespace v8 { |
26 namespace internal { | 16 namespace internal { |
27 namespace compiler { | 17 namespace compiler { |
28 | 18 |
29 // 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. |
30 class CallDescriptor; | 20 class CallDescriptor; |
31 class Graph; | 21 class Graph; |
32 class Schedule; | 22 class Schedule; |
33 class SourcePositionTable; | 23 class SourcePositionTable; |
34 class Linkage; | 24 class Linkage; |
35 | 25 |
36 class Pipeline { | 26 class Pipeline { |
37 public: | 27 public: |
38 explicit Pipeline(CompilationInfo* info) : info_(info) {} | 28 explicit Pipeline(CompilationInfo* info) : info_(info) {} |
39 | 29 |
40 // Run the entire pipeline and generate a handle to a code object. | 30 // Run the entire pipeline and generate a handle to a code object. |
41 Handle<Code> GenerateCode(); | 31 Handle<Code> GenerateCode(); |
42 | 32 |
43 // Run the pipeline on a machine graph and generate code. If {schedule} | 33 // Run the pipeline on a machine graph and generate code. If {schedule} |
44 // is {NULL}, then compute a new schedule for code generation. | 34 // is {NULL}, then compute a new schedule for code generation. |
45 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, | 35 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, |
46 Schedule* schedule = NULL); | 36 Schedule* schedule = NULL); |
47 | 37 |
48 CompilationInfo* info() const { return info_; } | 38 CompilationInfo* info() const { return info_; } |
49 Zone* zone() { return info_->zone(); } | 39 Zone* zone() { return info_->zone(); } |
50 Isolate* isolate() { return info_->isolate(); } | 40 Isolate* isolate() { return info_->isolate(); } |
51 | 41 |
| 42 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } |
52 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } | 43 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } |
53 | 44 |
54 static inline bool VerifyGraphs() { | 45 static inline bool VerifyGraphs() { |
55 #ifdef DEBUG | 46 #ifdef DEBUG |
56 return true; | 47 return true; |
57 #else | 48 #else |
58 return FLAG_turbo_verify; | 49 return FLAG_turbo_verify; |
59 #endif | 50 #endif |
60 } | 51 } |
61 | 52 |
62 private: | 53 private: |
63 CompilationInfo* info_; | 54 CompilationInfo* info_; |
64 | 55 |
65 Schedule* ComputeSchedule(Graph* graph); | 56 Schedule* ComputeSchedule(Graph* graph); |
66 void VerifyAndPrintGraph(Graph* graph, const char* phase); | 57 void VerifyAndPrintGraph(Graph* graph, const char* phase); |
67 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, | 58 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, |
68 SourcePositionTable* source_positions); | 59 SourcePositionTable* source_positions); |
69 }; | 60 }; |
70 } | 61 } |
71 } | 62 } |
72 } // namespace v8::internal::compiler | 63 } // namespace v8::internal::compiler |
73 | 64 |
74 #endif // V8_COMPILER_PIPELINE_H_ | 65 #endif // V8_COMPILER_PIPELINE_H_ |
OLD | NEW |