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

Unified Diff: src/compiler/pipeline.cc

Issue 886313006: [turbofan]: Small visualizer cleanup and fix for string handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index cf1007873b9902e121668d79193b35123687fbdc..c914d8d655230f990e38e4eb74fbb74a2d49f18c 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -691,35 +691,6 @@ struct GenerateCodePhase {
};
-namespace {
-
-FILE* OpenLogFile(CompilationInfo* info, const char* phase, const char* suffix,
- const char* mode) {
- EmbeddedVector<char, 256> filename;
- SmartArrayPointer<char> function_name;
- if (!info->shared_info().is_null()) {
- function_name = info->shared_info()->DebugName()->ToCString();
- if (strlen(function_name.get()) > 0) {
- SNPrintF(filename, "turbo-%s", function_name.get());
- } else {
- SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
- }
- } else {
- SNPrintF(filename, "turbo-none-%s", phase);
- }
- std::replace(filename.start(), filename.start() + filename.length(), ' ',
- '_');
-
- EmbeddedVector<char, 256> full_filename;
- if (phase == NULL) {
- SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
- } else {
- SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
- }
- return base::OS::FOpen(full_filename.start(), mode);
-}
-}
-
struct PrintGraphPhase {
static const char* phase_name() { return nullptr; }
@@ -728,7 +699,7 @@ struct PrintGraphPhase {
Graph* graph = data->graph();
{ // Print dot.
- FILE* dot_file = OpenLogFile(info, phase, "dot", "w+");
+ FILE* dot_file = OpenVisualizerLogFile(info, phase, "dot", "w+");
if (dot_file == nullptr) return;
OFStream dot_of(dot_file);
dot_of << AsDOT(*graph);
@@ -736,7 +707,7 @@ struct PrintGraphPhase {
}
{ // Print JSON.
- FILE* json_file = OpenLogFile(info, NULL, "json", "a+");
+ FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+");
if (json_file == nullptr) return;
OFStream json_of(json_file);
json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":"
@@ -808,7 +779,7 @@ Handle<Code> Pipeline::GenerateCode() {
}
if (FLAG_trace_turbo) {
- FILE* json_file = OpenLogFile(info(), NULL, "json", "w+");
+ FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "w+");
if (json_file != nullptr) {
OFStream json_of(json_file);
Handle<Script> script = info()->script();
@@ -947,7 +918,7 @@ Handle<Code> Pipeline::GenerateCode() {
v8::internal::CodeGenerator::PrintCode(code, info());
if (FLAG_trace_turbo) {
- FILE* json_file = OpenLogFile(info(), NULL, "json", "a+");
+ FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "a+");
if (json_file != nullptr) {
OFStream json_of(json_file);
json_of
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698