| 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 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 | 6 |
| 7 #include "src/base/platform/elapsed-timer.h" | 7 #include "src/base/platform/elapsed-timer.h" |
| 8 #include "src/compiler/ast-graph-builder.h" | 8 #include "src/compiler/ast-graph-builder.h" |
| 9 #include "src/compiler/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
| 10 #include "src/compiler/code-generator.h" | 10 #include "src/compiler/code-generator.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 | 89 |
| 90 void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) { | 90 void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) { |
| 91 if (FLAG_trace_turbo) { | 91 if (FLAG_trace_turbo) { |
| 92 char buffer[256]; | 92 char buffer[256]; |
| 93 Vector<char> filename(buffer, sizeof(buffer)); | 93 Vector<char> filename(buffer, sizeof(buffer)); |
| 94 if (!info_->shared_info().is_null()) { | 94 if (!info_->shared_info().is_null()) { |
| 95 SmartArrayPointer<char> functionname = | 95 SmartArrayPointer<char> functionname = |
| 96 info_->shared_info()->DebugName()->ToCString(); | 96 info_->shared_info()->DebugName()->ToCString(); |
| 97 if (strlen(functionname.get()) > 0) { | 97 if (strlen(functionname.get()) > 0) { |
| 98 SNPrintF(filename, "turbo-%s-%s.dot", functionname.get(), phase); | 98 SNPrintF(filename, "turbo-%s-%s", functionname.get(), phase); |
| 99 } else { | 99 } else { |
| 100 SNPrintF(filename, "turbo-%p-%s.dot", static_cast<void*>(info_), phase); | 100 SNPrintF(filename, "turbo-%p-%s", static_cast<void*>(info_), phase); |
| 101 } | 101 } |
| 102 } else { | 102 } else { |
| 103 SNPrintF(filename, "turbo-none-%s.dot", phase); | 103 SNPrintF(filename, "turbo-none-%s", phase); |
| 104 } | 104 } |
| 105 std::replace(filename.start(), filename.start() + filename.length(), ' ', | 105 std::replace(filename.start(), filename.start() + filename.length(), ' ', |
| 106 '_'); | 106 '_'); |
| 107 FILE* file = base::OS::FOpen(filename.start(), "w+"); | 107 |
| 108 OFStream of(file); | 108 char dot_buffer[256]; |
| 109 of << AsDOT(*graph); | 109 Vector<char> dot_filename(dot_buffer, sizeof(dot_buffer)); |
| 110 fclose(file); | 110 SNPrintF(dot_filename, "%s.dot", filename.start()); |
| 111 FILE* dot_file = base::OS::FOpen(dot_filename.start(), "w+"); |
| 112 OFStream dot_of(dot_file); |
| 113 dot_of << AsDOT(*graph); |
| 114 fclose(dot_file); |
| 115 |
| 116 char json_buffer[256]; |
| 117 Vector<char> json_filename(json_buffer, sizeof(json_buffer)); |
| 118 SNPrintF(json_filename, "%s.json", filename.start()); |
| 119 FILE* json_file = base::OS::FOpen(json_filename.start(), "w+"); |
| 120 OFStream json_of(json_file); |
| 121 json_of << AsJSON(*graph); |
| 122 fclose(json_file); |
| 111 | 123 |
| 112 OFStream os(stdout); | 124 OFStream os(stdout); |
| 113 os << "-- " << phase << " graph printed to file " << filename.start() | 125 os << "-- " << phase << " graph printed to file " << filename.start() |
| 114 << "\n"; | 126 << "\n"; |
| 115 } | 127 } |
| 116 if (VerifyGraphs()) Verifier::Run(graph); | 128 if (VerifyGraphs()) Verifier::Run(graph); |
| 117 } | 129 } |
| 118 | 130 |
| 119 | 131 |
| 120 class AstGraphBuilderWithPositions : public AstGraphBuilder { | 132 class AstGraphBuilderWithPositions : public AstGraphBuilder { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 425 } |
| 414 | 426 |
| 415 | 427 |
| 416 void Pipeline::TearDown() { | 428 void Pipeline::TearDown() { |
| 417 InstructionOperand::TearDownCaches(); | 429 InstructionOperand::TearDownCaches(); |
| 418 } | 430 } |
| 419 | 431 |
| 420 } // namespace compiler | 432 } // namespace compiler |
| 421 } // namespace internal | 433 } // namespace internal |
| 422 } // namespace v8 | 434 } // namespace v8 |
| OLD | NEW |