Reviewers: jarin,

Description:
Emit source positions in deopt comments, too.

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+23, -11 lines):
  M src/arm/lithium-codegen-arm.cc
  M src/arm64/lithium-codegen-arm64.cc
  M src/deoptimizer.h
  M src/hydrogen-instructions.h
  M src/ia32/lithium-codegen-ia32.cc
  M src/lithium-codegen.cc
  M src/mips/lithium-codegen-mips.cc
  M src/mips64/lithium-codegen-mips64.cc
  M src/x64/lithium-codegen-x64.cc
  M src/x87/lithium-codegen-x87.cc


Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 300572a740d0665d23beead0f0193825c54891c9..0357cc304ae731ad5eb85db5a3dab84aa8295649 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -899,7 +899,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
     __ stop("trap_on_deopt", condition);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   // Go through jump table if we need to handle condition, build frame, or
   // restore caller doubles.
Index: src/arm64/lithium-codegen-arm64.cc
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 75d3c7bd306767ca63a0fd8beab47eaa6e1631de..20cc44d3535402373f3793953f01eac167d1f88f 100644
--- a/src/arm64/lithium-codegen-arm64.cc
+++ b/src/arm64/lithium-codegen-arm64.cc
@@ -1044,7 +1044,8 @@ void LCodeGen::DeoptimizeBranch(
     __ Bind(&dont_trap);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to build frame, or restore caller doubles.
   if (branch_type == always &&
Index: src/deoptimizer.h
diff --git a/src/deoptimizer.h b/src/deoptimizer.h
index 281751cbf17a88d79db553945a58b82af505b255..3cf0a3e6e3aeb52c87873ea432d7497fbf176dcb 100644
--- a/src/deoptimizer.h
+++ b/src/deoptimizer.h
@@ -102,7 +102,9 @@ class Deoptimizer : public Malloced {
   static const int kBailoutTypesWithCodeEntry = SOFT + 1;

   struct Reason {
-    Reason(const char* m, const char* d) : mnemonic(m), detail(d) {}
+    Reason(int r, const char* m, const char* d)
+        : raw_position(r), mnemonic(m), detail(d) {}
+    int raw_position;
     const char* mnemonic;
     const char* detail;
   };
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index ab571470a934c1992eb9659d82e5a2feb77db9cc..695c629a7049dc051fdc33a06751ef7ecadce622 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -455,10 +455,10 @@ class HSourcePosition {
   // Offset from the start of the inlined function.
   typedef BitField<int, 9, 23> PositionField;

-  // On HPositionInfo can use this constructor.
   explicit HSourcePosition(int value) : value_(value) { }

   friend class HPositionInfo;
+  friend class LCodeGenBase;

// If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField
   // and PositionField.
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index eeb2472f85fb8b4ec46fef2c8ae05d2d0eb42056..f1a587f1103b2533e23947817e2252c901ebc7bb 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -867,7 +867,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
     __ bind(&done);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   if (cc == no_condition && frame_is_built_) {
     DeoptComment(reason);
Index: src/lithium-codegen.cc
diff --git a/src/lithium-codegen.cc b/src/lithium-codegen.cc
index bc73bb938fa94f08d1937f7fe746e249692d4115..0207188bd09b18f94471706bd3b41d1c1b58d350 100644
--- a/src/lithium-codegen.cc
+++ b/src/lithium-codegen.cc
@@ -148,8 +148,11 @@ void LCodeGenBase::Comment(const char* format, ...) {


 void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) {
-  Comment(";;; deoptimize %s: %s", reason.mnemonic,
-          reason.detail == NULL ? "unknown reason" : reason.detail);
+  OStringStream os;
+  os << ";;; deoptimize at " << HSourcePosition(reason.raw_position) << " "
+     << reason.mnemonic;
+  if (reason.detail != NULL) os << ": " << reason.detail;
+  Comment("%s", os.c_str());
 }


Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 24aed86bb4e3285fa332a02e32b7d13c10e9dcab..5ea68b2e46b14d46eb35fc996c1a3580dd69d173 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -860,7 +860,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
     __ bind(&skip);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   // Go through jump table if we need to handle condition, build frame, or
   // restore caller doubles.
Index: src/mips64/lithium-codegen-mips64.cc
diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index 859ccd254656c2b012a834c2bc962a30418d8be2..7cc23dcf11c6b39176c22067a42905bc78325e88 100644
--- a/src/mips64/lithium-codegen-mips64.cc
+++ b/src/mips64/lithium-codegen-mips64.cc
@@ -810,7 +810,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
     __ bind(&skip);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   // Go through jump table if we need to handle condition, build frame, or
   // restore caller doubles.
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 4ce57e679a530bde961507bef342eeedd3801e8c..3e342d8382c0cc197f3315e66ce1a939c6bad233 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -774,7 +774,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
     __ bind(&done);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   // Go through jump table if we need to handle condition, build frame, or
   // restore caller doubles.
Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index 690ebcce477bfe54fe103dfd6c17239e1087c7d6..ed4755b995cc319fb57958c6c9f1e30ffb6010bc 100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -1148,7 +1148,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
     __ bind(&done);
   }

-  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
+  Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
+                             instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   if (cc == no_condition && frame_is_built_) {
     DeoptComment(reason);


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