Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1195)

Side by Side Diff: src/compiler/graph-visualizer.cc

Issue 2081323007: Reland of Include file names in trace_turbo output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/graph-visualizer.h" 5 #include "src/compiler/graph-visualizer.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 9
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 18 matching lines...) Expand all
29 CompilationInfo* info, const char* phase, const char* suffix) { 29 CompilationInfo* info, const char* phase, const char* suffix) {
30 EmbeddedVector<char, 256> filename(0); 30 EmbeddedVector<char, 256> filename(0);
31 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); 31 base::SmartArrayPointer<char> debug_name = info->GetDebugName();
32 if (strlen(debug_name.get()) > 0) { 32 if (strlen(debug_name.get()) > 0) {
33 SNPrintF(filename, "turbo-%s", debug_name.get()); 33 SNPrintF(filename, "turbo-%s", debug_name.get());
34 } else if (info->has_shared_info()) { 34 } else if (info->has_shared_info()) {
35 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); 35 SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
36 } else { 36 } else {
37 SNPrintF(filename, "turbo-none-%s", phase); 37 SNPrintF(filename, "turbo-none-%s", phase);
38 } 38 }
39 EmbeddedVector<char, 256> source_file(0);
40 bool source_available = false;
41 if (FLAG_trace_file_names && info->parse_info()) {
42 Object* source_name = info->script()->name();
43 if (source_name->IsString()) {
44 String* str = String::cast(source_name);
45 if (str->length() > 0) {
46 SNPrintF(source_file, "%s", str->ToCString().get());
47 std::replace(source_file.start(),
48 source_file.start() + source_file.length(), '/', '_');
49 source_available = true;
50 }
51 }
52 }
39 std::replace(filename.start(), filename.start() + filename.length(), ' ', 53 std::replace(filename.start(), filename.start() + filename.length(), ' ',
40 '_'); 54 '_');
41 55
42 EmbeddedVector<char, 256> full_filename; 56 EmbeddedVector<char, 256> full_filename;
43 if (phase == nullptr) { 57 if (phase == nullptr && !source_available) {
44 SNPrintF(full_filename, "%s.%s", filename.start(), suffix); 58 SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
59 } else if (phase != nullptr && !source_available) {
60 SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
61 } else if (phase == nullptr && source_available) {
62 SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file.start(),
63 suffix);
45 } else { 64 } else {
46 SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix); 65 SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(),
66 source_file.start(), phase, suffix);
47 } 67 }
48 68
49 char* buffer = new char[full_filename.length() + 1]; 69 char* buffer = new char[full_filename.length() + 1];
50 memcpy(buffer, full_filename.start(), full_filename.length()); 70 memcpy(buffer, full_filename.start(), full_filename.length());
51 buffer[full_filename.length()] = '\0'; 71 buffer[full_filename.length()] = '\0';
52 return base::SmartArrayPointer<const char>(buffer); 72 return base::SmartArrayPointer<const char>(buffer);
53 } 73 }
54 74
55 75
56 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); } 76 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); }
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 os << "]"; 689 os << "]";
670 } 690 }
671 os << std::endl; 691 os << std::endl;
672 } 692 }
673 } 693 }
674 return os; 694 return os;
675 } 695 }
676 } // namespace compiler 696 } // namespace compiler
677 } // namespace internal 697 } // namespace internal
678 } // namespace v8 698 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698