Reviewers: Benedikt Meurer,

Description:
Silence --trace-turbo a bit and behave graceful in sandbox.

[email protected]

Please review this at https://codereview.chromium.org/786763002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+9, -5 lines):
  M src/compiler/pipeline.cc
  M src/ostreams.cc


Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index bc4c045f6fea9e689d9c64c6caf954d606ae283b..c8ce77e00f5df4c6ada56254a687b4a4b6d31f3b 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -251,7 +251,7 @@ struct TurboCfgFile : public std::ofstream {


 static void TraceSchedule(Schedule* schedule) {
-  if (!FLAG_trace_turbo) return;
+  if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return;
   OFStream os(stdout);
os << "-- Schedule --------------------------------------\n" << *schedule;
 }
@@ -646,6 +646,7 @@ struct PrintGraphPhase {
       Vector<char> dot_filename(dot_buffer, sizeof(dot_buffer));
       SNPrintF(dot_filename, "%s.dot", filename.start());
       FILE* dot_file = base::OS::FOpen(dot_filename.start(), "w+");
+      if (dot_file == nullptr) return;
       OFStream dot_of(dot_file);
       dot_of << AsDOT(*graph);
       fclose(dot_file);
@@ -656,6 +657,7 @@ struct PrintGraphPhase {
       Vector<char> json_filename(json_buffer, sizeof(json_buffer));
       SNPrintF(json_filename, "%s.json", filename.start());
       FILE* json_file = base::OS::FOpen(json_filename.start(), "w+");
+      if (json_file == nullptr) return;
       OFStream json_of(json_file);
       json_of << AsJSON(*graph);
       fclose(json_file);
@@ -818,7 +820,7 @@ Handle<Code> Pipeline::GenerateCode() {

   if (FLAG_trace_turbo) {
     OFStream os(stdout);
-    os << "--------------------------------------------------\n"
+    os << "---------------------------------------------------\n"
        << "Finished compiling method " << GetDebugName(info()).get()
        << " using Turbofan" << std::endl;
   }
@@ -982,7 +984,7 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
   Run<MeetRegisterConstraintsPhase>();
   Run<ResolvePhisPhase>();
   Run<BuildLiveRangesPhase>();
-  if (FLAG_trace_turbo) {
+  if (FLAG_trace_turbo_graph) {
     OFStream os(stdout);
     PrintableInstructionSequence printable = {config, data->sequence()};
     os << "----- Instruction sequence before register allocation -----\n"
@@ -1007,7 +1009,7 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
   Run<ResolveControlFlowPhase>();
   Run<OptimizeMovesPhase>();

-  if (FLAG_trace_turbo) {
+  if (FLAG_trace_turbo_graph) {
     OFStream os(stdout);
     PrintableInstructionSequence printable = {config, data->sequence()};
     os << "----- Instruction sequence after register allocation -----\n"
Index: src/ostreams.cc
diff --git a/src/ostreams.cc b/src/ostreams.cc
index 416da55e5918432f4584366161440db8112305e8..ee0474d2c0882db2ffe81e9e293401fa3c45fed3 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -28,7 +28,9 @@ OFStreamBase::int_type OFStreamBase::overflow(int_type c) {
 }


-OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {}
+OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {
+  DCHECK_NOT_NULL(f);
+}


 OFStream::~OFStream() {}


--
--
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.

Reply via email to