| Index: src/compiler/pipeline.cc
|
| diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
|
| index 7da2fb543c9d32c77bad75e558ac262d942b20ce..81a0ec55737e8c88a9b72d00d753679fbf0e1ace 100644
|
| --- a/src/compiler/pipeline.cc
|
| +++ b/src/compiler/pipeline.cc
|
| @@ -90,13 +90,28 @@ static inline bool VerifyGraphs() {
|
| }
|
|
|
|
|
| +void Pipeline::PrintCompilationStart() {
|
| + std::ofstream turbo_cfg_stream;
|
| + OpenTurboCfgFile(&turbo_cfg_stream);
|
| + turbo_cfg_stream << AsC1VCompilation(info());
|
| +}
|
| +
|
| +
|
| +void Pipeline::OpenTurboCfgFile(std::ofstream* stream) {
|
| + char buffer[512];
|
| + Vector<char> filename(buffer, sizeof(buffer));
|
| + isolate()->GetTurboCfgFileName(filename);
|
| + stream->open(filename.start(), std::fstream::out | std::fstream::app);
|
| +}
|
| +
|
| +
|
| void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) {
|
| if (FLAG_trace_turbo) {
|
| char buffer[256];
|
| Vector<char> filename(buffer, sizeof(buffer));
|
| + SmartArrayPointer<char> functionname;
|
| if (!info_->shared_info().is_null()) {
|
| - SmartArrayPointer<char> functionname =
|
| - info_->shared_info()->DebugName()->ToCString();
|
| + functionname = info_->shared_info()->DebugName()->ToCString();
|
| if (strlen(functionname.get()) > 0) {
|
| SNPrintF(filename, "turbo-%s-%s", functionname.get(), phase);
|
| } else {
|
| @@ -132,6 +147,24 @@ void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) {
|
| }
|
|
|
|
|
| +void Pipeline::PrintScheduleAndInstructions(
|
| + const char* phase, const Schedule* schedule,
|
| + const SourcePositionTable* positions,
|
| + const InstructionSequence* instructions) {
|
| + std::ofstream turbo_cfg_stream;
|
| + OpenTurboCfgFile(&turbo_cfg_stream);
|
| + turbo_cfg_stream << AsC1V(phase, schedule, positions, instructions);
|
| +}
|
| +
|
| +
|
| +void Pipeline::PrintAllocator(const char* phase,
|
| + const RegisterAllocator* allocator) {
|
| + std::ofstream turbo_cfg_stream;
|
| + OpenTurboCfgFile(&turbo_cfg_stream);
|
| + turbo_cfg_stream << AsC1VAllocator(phase, allocator);
|
| +}
|
| +
|
| +
|
| class AstGraphBuilderWithPositions : public AstGraphBuilder {
|
| public:
|
| explicit AstGraphBuilderWithPositions(CompilationInfo* info, JSGraph* jsgraph,
|
| @@ -188,6 +221,7 @@ Handle<Code> Pipeline::GenerateCode() {
|
| << "Begin compiling method "
|
| << info()->function()->debug_name()->ToCString().get()
|
| << " using Turbofan" << std::endl;
|
| + PrintCompilationStart();
|
| }
|
|
|
| // Build the graph.
|
| @@ -405,6 +439,8 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
|
| OFStream os(stdout);
|
| os << "----- Instruction sequence before register allocation -----\n"
|
| << sequence;
|
| + PrintScheduleAndInstructions("CodeGen", schedule, source_positions,
|
| + &sequence);
|
| }
|
|
|
| // Allocate registers.
|
| @@ -419,6 +455,9 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
|
| linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
|
| return Handle<Code>::null();
|
| }
|
| + if (FLAG_trace_turbo) {
|
| + PrintAllocator("CodeGen", &allocator);
|
| + }
|
| }
|
|
|
| if (FLAG_trace_turbo) {
|
|
|