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