| 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 // Clients of this interface shouldn't depend on lots of compiler internals. | 8 // Clients of this interface shouldn't depend on lots of compiler internals. |
| 9 // Do not include anything from src/compiler here! | 9 // Do not include anything from src/compiler here! |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class RegisterConfiguration; | 21 class RegisterConfiguration; |
| 22 class Schedule; | 22 class Schedule; |
| 23 | 23 |
| 24 class Pipeline { | 24 class Pipeline { |
| 25 public: | 25 public: |
| 26 explicit Pipeline(CompilationInfo* info) : info_(info) {} | 26 explicit Pipeline(CompilationInfo* info) : info_(info) {} |
| 27 | 27 |
| 28 // Run the entire pipeline and generate a handle to a code object. | 28 // Run the entire pipeline and generate a handle to a code object. |
| 29 Handle<Code> GenerateCode(); | 29 Handle<Code> GenerateCode(); |
| 30 | 30 |
| 31 // Run the pipeline on an interpreter bytecode handler machine graph and |
| 32 // generate code. |
| 33 static Handle<Code> GenerateCodeForInterpreter( |
| 34 Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, |
| 35 Schedule* schedule, interpreter::Bytecode bytecode); |
| 36 |
| 31 // Run the pipeline on a machine graph and generate code. If {schedule} is | 37 // Run the pipeline on a machine graph and generate code. If {schedule} is |
| 32 // {nullptr}, then compute a new schedule for code generation. | 38 // {nullptr}, then compute a new schedule for code generation. |
| 33 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, | 39 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, |
| 34 Graph* graph, | 40 Graph* graph, |
| 35 Schedule* schedule = nullptr); | 41 Schedule* schedule = nullptr); |
| 36 | 42 |
| 37 // Run the pipeline on a machine graph and generate code. If {schedule} is | 43 // Run the pipeline on a machine graph and generate code. If {schedule} is |
| 38 // {nullptr}, then compute a new schedule for code generation. | 44 // {nullptr}, then compute a new schedule for code generation. |
| 39 static Handle<Code> GenerateCodeForTesting(Isolate* isolate, | 45 static Handle<Code> GenerateCodeForTesting(Isolate* isolate, |
| 40 CallDescriptor* call_descriptor, | 46 CallDescriptor* call_descriptor, |
| 41 Graph* graph, | 47 Graph* graph, |
| 42 Schedule* schedule = nullptr); | 48 Schedule* schedule = nullptr); |
| 43 | 49 |
| 50 |
| 44 // Run just the register allocator phases. | 51 // Run just the register allocator phases. |
| 45 static bool AllocateRegistersForTesting(const RegisterConfiguration* config, | 52 static bool AllocateRegistersForTesting(const RegisterConfiguration* config, |
| 46 InstructionSequence* sequence, | 53 InstructionSequence* sequence, |
| 47 bool run_verifier); | 54 bool run_verifier); |
| 48 | 55 |
| 49 private: | 56 private: |
| 50 static Handle<Code> GenerateCodeForTesting(CompilationInfo* info, | 57 static Handle<Code> GenerateCodeFromMachineGraph( |
| 51 CallDescriptor* call_descriptor, | 58 CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph, |
| 52 Graph* graph, Schedule* schedule); | 59 Schedule* schedule); |
| 53 | 60 |
| 54 CompilationInfo* info_; | 61 CompilationInfo* info_; |
| 55 PipelineData* data_; | 62 PipelineData* data_; |
| 56 | 63 |
| 57 // Helpers for executing pipeline phases. | 64 // Helpers for executing pipeline phases. |
| 58 template <typename Phase> | 65 template <typename Phase> |
| 59 void Run(); | 66 void Run(); |
| 60 template <typename Phase, typename Arg0> | 67 template <typename Phase, typename Arg0> |
| 61 void Run(Arg0 arg_0); | 68 void Run(Arg0 arg_0); |
| 62 | 69 |
| 63 CompilationInfo* info() const { return info_; } | 70 CompilationInfo* info() const { return info_; } |
| 64 Isolate* isolate() { return info_->isolate(); } | 71 Isolate* isolate() { return info_->isolate(); } |
| 65 | 72 |
| 66 void BeginPhaseKind(const char* phase_kind); | 73 void BeginPhaseKind(const char* phase_kind); |
| 67 void RunPrintAndVerify(const char* phase, bool untyped = false); | 74 void RunPrintAndVerify(const char* phase, bool untyped = false); |
| 68 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor); | 75 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor); |
| 69 void AllocateRegisters(const RegisterConfiguration* config, | 76 void AllocateRegisters(const RegisterConfiguration* config, |
| 70 CallDescriptor* descriptor, bool run_verifier); | 77 CallDescriptor* descriptor, bool run_verifier); |
| 71 }; | 78 }; |
| 72 | 79 |
| 73 } // namespace compiler | 80 } // namespace compiler |
| 74 } // namespace internal | 81 } // namespace internal |
| 75 } // namespace v8 | 82 } // namespace v8 |
| 76 | 83 |
| 77 #endif // V8_COMPILER_PIPELINE_H_ | 84 #endif // V8_COMPILER_PIPELINE_H_ |
| OLD | NEW |