| 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 InstructionSequence; |
| 21 class Linkage; | 22 class Linkage; |
| 22 class PipelineData; | 23 class PipelineData; |
| 24 class RegisterConfiguration; |
| 23 class Schedule; | 25 class Schedule; |
| 24 | 26 |
| 25 class Pipeline { | 27 class Pipeline { |
| 26 public: | 28 public: |
| 27 explicit Pipeline(CompilationInfo* info) : info_(info) {} | 29 explicit Pipeline(CompilationInfo* info) : info_(info) {} |
| 28 | 30 |
| 29 // Run the entire pipeline and generate a handle to a code object. | 31 // Run the entire pipeline and generate a handle to a code object. |
| 30 Handle<Code> GenerateCode(); | 32 Handle<Code> GenerateCode(); |
| 31 | 33 |
| 32 // Run the pipeline on a machine graph and generate code. If {schedule} | 34 // Run the pipeline on a machine graph and generate code. If {schedule} |
| 33 // is {NULL}, then compute a new schedule for code generation. | 35 // is {NULL}, then compute a new schedule for code generation. |
| 34 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, | 36 Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph, |
| 35 Schedule* schedule = NULL); | 37 Schedule* schedule = NULL); |
| 36 | 38 |
| 39 static bool AllocateRegisters(const RegisterConfiguration* config, |
| 40 InstructionSequence* sequence, |
| 41 bool run_verifier); |
| 42 |
| 37 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } | 43 static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; } |
| 38 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } | 44 static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; } |
| 39 | 45 |
| 40 static void SetUp(); | 46 static void SetUp(); |
| 41 static void TearDown(); | 47 static void TearDown(); |
| 42 | 48 |
| 43 private: | 49 private: |
| 44 CompilationInfo* info_; | 50 CompilationInfo* info_; |
| 45 PipelineData* data_; | 51 PipelineData* data_; |
| 46 | 52 |
| 47 // Helpers for executing pipeline phases. | 53 // Helpers for executing pipeline phases. |
| 48 template <typename Phase> | 54 template <typename Phase> |
| 49 void Run(); | 55 void Run(); |
| 50 template <typename Phase, typename Arg0> | 56 template <typename Phase, typename Arg0> |
| 51 void Run(Arg0 arg_0); | 57 void Run(Arg0 arg_0); |
| 52 template <typename Phase, typename Arg0, typename Arg1> | |
| 53 void Run(Arg0 arg_0, Arg1 arg_1); | |
| 54 | 58 |
| 55 CompilationInfo* info() const { return info_; } | 59 CompilationInfo* info() const { return info_; } |
| 56 Isolate* isolate() { return info_->isolate(); } | 60 Isolate* isolate() { return info_->isolate(); } |
| 57 | 61 |
| 62 void BeginPhaseKind(const char* phase_kind); |
| 58 void RunPrintAndVerify(const char* phase, bool untyped = false); | 63 void RunPrintAndVerify(const char* phase, bool untyped = false); |
| 59 void GenerateCode(Linkage* linkage); | 64 void GenerateCode(Linkage* linkage); |
| 65 void AllocateRegisters(const RegisterConfiguration* config, |
| 66 bool run_verifier); |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 } // namespace compiler | 69 } // namespace compiler |
| 63 } // namespace internal | 70 } // namespace internal |
| 64 } // namespace v8 | 71 } // namespace v8 |
| 65 | 72 |
| 66 #endif // V8_COMPILER_PIPELINE_H_ | 73 #endif // V8_COMPILER_PIPELINE_H_ |
| OLD | NEW |