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 Graph; | 20 class Graph; |
21 class Schedule; | 21 class Schedule; |
22 class SourcePositionTable; | 22 class SourcePositionTable; |
23 class Linkage; | 23 class Linkage; |
24 | 24 |
25 class Pipeline { | 25 class Pipeline { |
26 public: | 26 public: |
27 explicit Pipeline(CompilationInfo* info) | 27 explicit Pipeline(CompilationInfo* info) |
28 : info_(info), context_specialization_(FLAG_context_specialization) {} | 28 : info_(info), |
| 29 context_specialization_(FLAG_context_specialization), |
| 30 inlining_(FLAG_turbo_inlining) {} |
29 | 31 |
30 // 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. |
31 Handle<Code> GenerateCode(); | 33 Handle<Code> GenerateCode(); |
32 | 34 |
33 // Run the pipeline on a machine graph and generate code. If {schedule} | 35 // Run the pipeline on a machine graph and generate code. If {schedule} |
34 // is {NULL}, then compute a new schedule for code generation. | 36 // is {NULL}, then compute a new schedule for code generation. |
35 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, | 37 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, |
36 Schedule* schedule = NULL); | 38 Schedule* schedule = NULL); |
37 | 39 |
38 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } | 40 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } |
39 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } | 41 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } |
40 | 42 |
41 static void SetUp(); | 43 static void SetUp(); |
42 static void TearDown(); | 44 static void TearDown(); |
43 bool context_specialization() { return context_specialization_; } | 45 bool context_specialization() { return context_specialization_; } |
44 void set_context_specialization(bool context_specialization) { | 46 void set_context_specialization(bool context_specialization) { |
45 context_specialization_ = context_specialization; | 47 context_specialization_ = context_specialization; |
46 } | 48 } |
| 49 bool inlining() { return inlining_; } |
| 50 void set_inlining(bool inlining) { inlining_ = inlining; } |
47 | 51 |
48 private: | 52 private: |
49 CompilationInfo* info_; | 53 CompilationInfo* info_; |
50 bool context_specialization_; | 54 bool context_specialization_; |
| 55 bool inlining_; |
51 | 56 |
52 CompilationInfo* info() const { return info_; } | 57 CompilationInfo* info() const { return info_; } |
53 Isolate* isolate() { return info_->isolate(); } | 58 Isolate* isolate() { return info_->isolate(); } |
54 Zone* zone() { return info_->zone(); } | 59 Zone* zone() { return info_->zone(); } |
55 | 60 |
56 Schedule* ComputeSchedule(Graph* graph); | 61 Schedule* ComputeSchedule(Graph* graph); |
57 void VerifyAndPrintGraph(Graph* graph, const char* phase); | 62 void VerifyAndPrintGraph(Graph* graph, const char* phase); |
58 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, | 63 Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule, |
59 SourcePositionTable* source_positions); | 64 SourcePositionTable* source_positions); |
60 }; | 65 }; |
61 } | 66 } |
62 } | 67 } |
63 } // namespace v8::internal::compiler | 68 } // namespace v8::internal::compiler |
64 | 69 |
65 #endif // V8_COMPILER_PIPELINE_H_ | 70 #endif // V8_COMPILER_PIPELINE_H_ |
OLD | NEW |