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/code-generator.h" | 9 #include "src/compiler/code-generator.h" |
10 #include "src/compiler/graph-replay.h" | 10 #include "src/compiler/graph-replay.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #else | 80 #else |
81 return FLAG_turbo_verify; | 81 return FLAG_turbo_verify; |
82 #endif | 82 #endif |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) { | 86 void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) { |
87 if (FLAG_trace_turbo) { | 87 if (FLAG_trace_turbo) { |
88 char buffer[256]; | 88 char buffer[256]; |
89 Vector<char> filename(buffer, sizeof(buffer)); | 89 Vector<char> filename(buffer, sizeof(buffer)); |
90 SmartArrayPointer<char> functionname = | 90 if (!info_->shared_info().is_null()) { |
91 info_->shared_info()->DebugName()->ToCString(); | 91 SmartArrayPointer<char> functionname = |
92 if (strlen(functionname.get()) > 0) { | 92 info_->shared_info()->DebugName()->ToCString(); |
93 SNPrintF(filename, "turbo-%s-%s.dot", functionname.get(), phase); | 93 if (strlen(functionname.get()) > 0) { |
| 94 SNPrintF(filename, "turbo-%s-%s.dot", functionname.get(), phase); |
| 95 } else { |
| 96 SNPrintF(filename, "turbo-%p-%s.dot", static_cast<void*>(info_), phase); |
| 97 } |
94 } else { | 98 } else { |
95 SNPrintF(filename, "turbo-%p-%s.dot", static_cast<void*>(info_), phase); | 99 SNPrintF(filename, "turbo-none-%s.dot", phase); |
96 } | 100 } |
97 std::replace(filename.start(), filename.start() + filename.length(), ' ', | 101 std::replace(filename.start(), filename.start() + filename.length(), ' ', |
98 '_'); | 102 '_'); |
99 FILE* file = base::OS::FOpen(filename.start(), "w+"); | 103 FILE* file = base::OS::FOpen(filename.start(), "w+"); |
100 OFStream of(file); | 104 OFStream of(file); |
101 of << AsDOT(*graph); | 105 of << AsDOT(*graph); |
102 fclose(file); | 106 fclose(file); |
103 | 107 |
104 OFStream os(stdout); | 108 OFStream os(stdout); |
105 os << "-- " << phase << " graph printed to file " << filename.start() | 109 os << "-- " << phase << " graph printed to file " << filename.start() |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 363 } |
360 | 364 |
361 | 365 |
362 void Pipeline::TearDown() { | 366 void Pipeline::TearDown() { |
363 InstructionOperand::TearDownCaches(); | 367 InstructionOperand::TearDownCaches(); |
364 } | 368 } |
365 | 369 |
366 } // namespace compiler | 370 } // namespace compiler |
367 } // namespace internal | 371 } // namespace internal |
368 } // namespace v8 | 372 } // namespace v8 |
OLD | NEW |