Revision: 24821
Author: [email protected]
Date: Thu Oct 23 07:36:39 2014 UTC
Log: Revert "Simplify TurboFan's c1visualizer file handling."
This reverts r24819, it broke the build on Mac due to header
incompatibilities.
[email protected]
Review URL: https://codereview.chromium.org/672873002
https://code.google.com/p/v8/source/detail?r=24821
Modified:
/branches/bleeding_edge/src/compiler/pipeline.cc
/branches/bleeding_edge/src/compiler/pipeline.h
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
=======================================
--- /branches/bleeding_edge/src/compiler/pipeline.cc Thu Oct 23 07:26:13
2014 UTC
+++ /branches/bleeding_edge/src/compiler/pipeline.cc Thu Oct 23 07:36:39
2014 UTC
@@ -4,7 +4,6 @@
#include "src/compiler/pipeline.h"
-#include <fstream> // NOLINT(readability/streams)
#include <sstream>
#include "src/base/platform/elapsed-timer.h"
@@ -98,10 +97,19 @@
}
-struct TurboCfgFile : public std::ofstream {
- explicit TurboCfgFile(Isolate* isolate)
- : std::ofstream(isolate->GetTurboCfgFileName(), std::ios_base::app)
{}
-};
+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(
@@ -148,6 +156,24 @@
FLAG_turbo_types && !untyped ? Verifier::TYPED :
Verifier::UNTYPED);
}
}
+
+
+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 {
@@ -208,7 +234,7 @@
<< "Begin compiling method "
<< info()->function()->debug_name()->ToCString().get()
<< " using Turbofan" << std::endl;
- TurboCfgFile(isolate()) << AsC1VCompilation(info());
+ PrintCompilationStart();
}
ZonePool zone_pool(isolate());
@@ -461,8 +487,8 @@
OFStream os(stdout);
os << "----- Instruction sequence before register allocation -----\n"
<< sequence;
- TurboCfgFile(isolate())
- << AsC1V("CodeGen", schedule, source_positions, &sequence);
+ PrintScheduleAndInstructions("CodeGen", schedule, source_positions,
+ &sequence);
}
// Allocate registers.
@@ -481,7 +507,7 @@
return Handle<Code>::null();
}
if (FLAG_trace_turbo) {
- TurboCfgFile(isolate()) << AsC1VAllocator("CodeGen", &allocator);
+ PrintAllocator("CodeGen", &allocator);
}
}
=======================================
--- /branches/bleeding_edge/src/compiler/pipeline.h Thu Oct 23 07:26:13
2014 UTC
+++ /branches/bleeding_edge/src/compiler/pipeline.h Thu Oct 23 07:36:39
2014 UTC
@@ -5,6 +5,8 @@
#ifndef V8_COMPILER_PIPELINE_H_
#define V8_COMPILER_PIPELINE_H_
+#include <fstream> // NOLINT(readability/streams)
+
#include "src/v8.h"
#include "src/compiler.h"
@@ -51,6 +53,12 @@
Zone* zone() { return info_->zone(); }
Schedule* ComputeSchedule(ZonePool* zone_pool, Graph* graph);
+ void OpenTurboCfgFile(std::ofstream* stream);
+ void PrintCompilationStart();
+ void PrintScheduleAndInstructions(const char* phase, const Schedule*
schedule,
+ const SourcePositionTable* positions,
+ const InstructionSequence*
instructions);
+ void PrintAllocator(const char* phase, const RegisterAllocator*
allocator);
void VerifyAndPrintGraph(Graph* graph, const char* phase,
bool untyped = false);
Handle<Code> GenerateCode(ZonePool* zone_pool, Linkage* linkage, Graph*
graph,
=======================================
--- /branches/bleeding_edge/src/isolate.cc Thu Oct 23 07:26:13 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc Thu Oct 23 07:36:39 2014 UTC
@@ -1951,8 +1951,12 @@
if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value());
if (FLAG_trace_turbo) {
- // Create an empty file.
- std::ofstream(GetTurboCfgFileName(), std::ios_base::trunc);
+ // Erase the file.
+ char buffer[512];
+ Vector<char> filename(buffer, sizeof(buffer));
+ GetTurboCfgFileName(filename);
+ std::ofstream turbo_cfg_stream(filename.start(),
+ std::fstream::out |
std::fstream::trunc);
}
// If we are deserializing, log non-function code objects and compiled
@@ -2368,11 +2372,13 @@
}
-std::string Isolate::GetTurboCfgFileName() {
- return FLAG_trace_turbo_cfg_file == NULL
- ? "turbo-" + std::to_string(base::OS::GetCurrentProcessId()) +
- "-" + std::to_string(id()) + ".cfg"
- : FLAG_trace_turbo_cfg_file;
+void Isolate::GetTurboCfgFileName(Vector<char> filename) {
+ if (FLAG_trace_turbo_cfg_file == NULL) {
+ SNPrintF(filename, "turbo-%d-%d.cfg", base::OS::GetCurrentProcessId(),
+ id());
+ } else {
+ StrNCpy(filename, FLAG_trace_turbo_cfg_file, filename.length());
+ }
}
=======================================
--- /branches/bleeding_edge/src/isolate.h Thu Oct 23 07:26:13 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h Thu Oct 23 07:36:39 2014 UTC
@@ -1098,7 +1098,7 @@
static Isolate* NewForTesting() { return new Isolate(false); }
- std::string GetTurboCfgFileName();
+ void GetTurboCfgFileName(Vector<char> buffer);
private:
explicit Isolate(bool enable_serializer);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.