Revision: 24103
Author:   [email protected]
Date:     Mon Sep 22 06:36:57 2014 UTC
Log:      Introduce a class to carry around a deoptimization reason.

As discussed in https://codereview.chromium.org/582743002/, here a
mechanical refactoring...

[email protected]

Review URL: https://codereview.chromium.org/587623002
https://code.google.com/p/v8/source/detail?r=24103

Modified:
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.h
 /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc
 /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.h
 /branches/bleeding_edge/src/deoptimizer.h
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h
 /branches/bleeding_edge/src/lithium-codegen.cc
 /branches/bleeding_edge/src/lithium-codegen.h
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.h
 /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc
 /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.h
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.h
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.h

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Sep 22 06:36:57 2014 UTC
@@ -342,7 +342,7 @@
       int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
       DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
-      DeoptComment(table_entry->mnemonic, table_entry->reason);
+      DeoptComment(table_entry->reason);

// Second-level deopt table entries are contiguous and small, so instead // of loading the full, absolute address of each one, load an immediate
@@ -846,7 +846,7 @@


 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
-                            const char* reason,
+                            const char* detail,
                             Deoptimizer::BailoutType bailout_type) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
@@ -899,12 +899,13 @@
     __ stop("trap_on_deopt", condition);
   }

+  Deoptimizer::Reason reason(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.
   if (condition == al && frame_is_built_ &&
       !info()->saves_caller_doubles()) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ Call(entry, RelocInfo::RUNTIME_ENTRY);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -913,8 +914,8 @@
         (deopt_jump_table_.last().address != entry) ||
         (deopt_jump_table_.last().bailout_type != bailout_type) ||
         (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       deopt_jump_table_.Add(table_entry, zone());
     }
     __ b(condition, &deopt_jump_table_.last().label);
@@ -923,11 +924,11 @@


 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(condition, instr, reason, bailout_type);
+  DeoptimizeIf(condition, instr, detail, bailout_type);
 }


=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Mon Sep 22 06:36:57 2014 UTC
@@ -235,9 +235,9 @@
   void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
                                             Safepoint::DeoptMode mode);
   void DeoptimizeIf(Condition condition, LInstruction* instr,
- const char* reason, Deoptimizer::BailoutType bailout_type); + const char* detail, Deoptimizer::BailoutType bailout_type);
   void DeoptimizeIf(Condition condition, LInstruction* instr,
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   void AddToTranslation(LEnvironment* environment,
                         Translation* translation,
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon Sep 22 06:36:57 2014 UTC
@@ -844,7 +844,7 @@
       int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
       DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
-      DeoptComment(table_entry->mnemonic, table_entry->reason);
+      DeoptComment(table_entry->reason);

// Second-level deopt table entries are contiguous and small, so instead
       // of loading the full, absolute address of each one, load the base
@@ -993,7 +993,7 @@


 void LCodeGen::DeoptimizeBranch(
-    LInstruction* instr, const char* reason, BranchType branch_type,
+    LInstruction* instr, const char* detail, BranchType branch_type,
Register reg, int bit, Deoptimizer::BailoutType* override_bailout_type) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
@@ -1044,11 +1044,12 @@
     __ Bind(&dont_trap);
   }

+  Deoptimizer::Reason reason(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 &&
       frame_is_built_ && !info()->saves_caller_doubles()) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ Call(entry, RelocInfo::RUNTIME_ENTRY);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -1057,8 +1058,8 @@
         (jump_table_.last()->bailout_type != bailout_type) ||
         (jump_table_.last()->needs_frame != !frame_is_built_)) {
       Deoptimizer::JumpTableEntry* table_entry =
-          new (zone()) Deoptimizer::JumpTableEntry(
- entry, instr->Mnemonic(), reason, bailout_type, !frame_is_built_); + new (zone()) Deoptimizer::JumpTableEntry(entry, reason, bailout_type,
+                                                   !frame_is_built_);
       jump_table_.Add(table_entry, zone());
     }
     __ B(&jump_table_.last()->label, branch_type, reg, bit);
@@ -1068,78 +1069,78 @@

 void LCodeGen::Deoptimize(LInstruction* instr,
                           Deoptimizer::BailoutType* override_bailout_type,
-                          const char* reason) {
- DeoptimizeBranch(instr, reason, always, NoReg, -1, override_bailout_type);
+                          const char* detail) {
+ DeoptimizeBranch(instr, detail, always, NoReg, -1, override_bailout_type);
 }


 void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr,
-                            const char* reason) {
-  DeoptimizeBranch(instr, reason, static_cast<BranchType>(cond));
+                            const char* detail) {
+  DeoptimizeBranch(instr, detail, static_cast<BranchType>(cond));
 }


 void LCodeGen::DeoptimizeIfZero(Register rt, LInstruction* instr,
-                                const char* reason) {
-  DeoptimizeBranch(instr, reason, reg_zero, rt);
+                                const char* detail) {
+  DeoptimizeBranch(instr, detail, reg_zero, rt);
 }


 void LCodeGen::DeoptimizeIfNotZero(Register rt, LInstruction* instr,
-                                   const char* reason) {
-  DeoptimizeBranch(instr, reason, reg_not_zero, rt);
+                                   const char* detail) {
+  DeoptimizeBranch(instr, detail, reg_not_zero, rt);
 }


 void LCodeGen::DeoptimizeIfNegative(Register rt, LInstruction* instr,
-                                    const char* reason) {
+                                    const char* detail) {
   int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit;
-  DeoptimizeIfBitSet(rt, sign_bit, instr, reason);
+  DeoptimizeIfBitSet(rt, sign_bit, instr, detail);
 }


 void LCodeGen::DeoptimizeIfSmi(Register rt, LInstruction* instr,
-                               const char* reason) {
-  DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), instr, reason);
+                               const char* detail) {
+  DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), instr, detail);
 }


 void LCodeGen::DeoptimizeIfNotSmi(Register rt, LInstruction* instr,
-                                  const char* reason) {
-  DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), instr, reason);
+                                  const char* detail) {
+  DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), instr, detail);
 }


 void LCodeGen::DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
-                                LInstruction* instr, const char* reason) {
+                                LInstruction* instr, const char* detail) {
   __ CompareRoot(rt, index);
-  DeoptimizeIf(eq, instr, reason);
+  DeoptimizeIf(eq, instr, detail);
 }


 void LCodeGen::DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
- LInstruction* instr, const char* reason) { + LInstruction* instr, const char* detail) {
   __ CompareRoot(rt, index);
-  DeoptimizeIf(ne, instr, reason);
+  DeoptimizeIf(ne, instr, detail);
 }


void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input, LInstruction* instr,
-                                     const char* reason) {
+                                     const char* detail) {
   __ TestForMinusZero(input);
-  DeoptimizeIf(vs, instr, reason);
+  DeoptimizeIf(vs, instr, detail);
 }


void LCodeGen::DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr,
-                                  const char* reason) {
-  DeoptimizeBranch(instr, reason, reg_bit_set, rt, bit);
+                                  const char* detail) {
+  DeoptimizeBranch(instr, detail, reg_bit_set, rt, bit);
 }


void LCodeGen::DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr,
-                                    const char* reason) {
-  DeoptimizeBranch(instr, reason, reg_bit_clear, rt, bit);
+                                    const char* detail) {
+  DeoptimizeBranch(instr, detail, reg_bit_clear, rt, bit);
 }


=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.h Fri Sep 19 06:27:06 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.h Mon Sep 22 06:36:57 2014 UTC
@@ -213,35 +213,35 @@
                                    Register temp,
                                    LOperand* index,
                                    String::Encoding encoding);
-  void DeoptimizeBranch(LInstruction* instr, const char* reason,
+  void DeoptimizeBranch(LInstruction* instr, const char* detail,
                         BranchType branch_type, Register reg = NoReg,
                         int bit = -1,
Deoptimizer::BailoutType* override_bailout_type = NULL);
   void Deoptimize(LInstruction* instr,
                   Deoptimizer::BailoutType* override_bailout_type = NULL,
-                  const char* reason = NULL);
+                  const char* detail = NULL);
   void DeoptimizeIf(Condition cond, LInstruction* instr,
-                    const char* reason = NULL);
+                    const char* detail = NULL);
   void DeoptimizeIfZero(Register rt, LInstruction* instr,
-                        const char* reason = NULL);
+                        const char* detail = NULL);
   void DeoptimizeIfNotZero(Register rt, LInstruction* instr,
-                           const char* reason = NULL);
+                           const char* detail = NULL);
   void DeoptimizeIfNegative(Register rt, LInstruction* instr,
-                            const char* reason = NULL);
+                            const char* detail = NULL);
   void DeoptimizeIfSmi(Register rt, LInstruction* instr,
-                       const char* reason = NULL);
+                       const char* detail = NULL);
   void DeoptimizeIfNotSmi(Register rt, LInstruction* instr,
-                          const char* reason = NULL);
+                          const char* detail = NULL);
   void DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
-                        LInstruction* instr, const char* reason = NULL);
+                        LInstruction* instr, const char* detail = NULL);
   void DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
-                           LInstruction* instr, const char* reason = NULL);
+                           LInstruction* instr, const char* detail = NULL);
   void DeoptimizeIfMinusZero(DoubleRegister input, LInstruction* instr,
-                             const char* reason = NULL);
+                             const char* detail = NULL);
   void DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr,
-                          const char* reason = NULL);
+                          const char* detail = NULL);
   void DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr,
-                            const char* reason = NULL);
+                            const char* detail = NULL);

   MemOperand PrepareKeyedExternalArrayOperand(Register key,
                                               Register base,
=======================================
--- /branches/bleeding_edge/src/deoptimizer.h   Fri Sep 19 06:27:06 2014 UTC
+++ /branches/bleeding_edge/src/deoptimizer.h   Mon Sep 22 06:36:57 2014 UTC
@@ -101,20 +101,23 @@

   static const int kBailoutTypesWithCodeEntry = SOFT + 1;

+  struct Reason {
+    Reason(const char* m, const char* d) : mnemonic(m), detail(d) {}
+    const char* mnemonic;
+    const char* detail;
+  };
+
   struct JumpTableEntry : public ZoneObject {
-    inline JumpTableEntry(Address entry, const char* the_mnemonic,
- const char* the_reason, Deoptimizer::BailoutType type,
-                          bool frame)
+    inline JumpTableEntry(Address entry, const Reason& the_reason,
+                          Deoptimizer::BailoutType type, bool frame)
         : label(),
           address(entry),
-          mnemonic(the_mnemonic),
           reason(the_reason),
           bailout_type(type),
           needs_frame(frame) {}
     Label label;
     Address address;
-    const char* mnemonic;
-    const char* reason;
+    Reason reason;
     Deoptimizer::BailoutType bailout_type;
     bool needs_frame;
   };
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Sep 22 06:36:57 2014 UTC
@@ -390,7 +390,7 @@
     int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
     DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
     Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
-    DeoptComment(table_entry->mnemonic, table_entry->reason);
+    DeoptComment(table_entry->reason);
     if (table_entry->needs_frame) {
       DCHECK(!info()->saves_caller_doubles());
       __ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
@@ -825,7 +825,7 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason,
+                            const char* detail,
                             Deoptimizer::BailoutType bailout_type) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
@@ -867,9 +867,10 @@
     __ bind(&done);
   }

+  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   if (cc == no_condition && frame_is_built_) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ call(entry, RelocInfo::RUNTIME_ENTRY);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -878,8 +879,8 @@
         jump_table_.last().address != entry ||
         jump_table_.last().needs_frame != !frame_is_built_ ||
         jump_table_.last().bailout_type != bailout_type) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       jump_table_.Add(table_entry, zone());
     }
     if (cc == no_condition) {
@@ -892,11 +893,11 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(cc, instr, reason, bailout_type);
+  DeoptimizeIf(cc, instr, detail, bailout_type);
 }


=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Fri Sep 19 06:27:06 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Mon Sep 22 06:36:57 2014 UTC
@@ -209,10 +209,10 @@

   void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
                                             Safepoint::DeoptMode mode);
-  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
+  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* detail,
                     Deoptimizer::BailoutType bailout_type);
   void DeoptimizeIf(Condition cc, LInstruction* instr,
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   bool DeoptEveryNTimes() {
     return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
=======================================
--- /branches/bleeding_edge/src/lithium-codegen.cc Fri Sep 19 06:27:06 2014 UTC +++ /branches/bleeding_edge/src/lithium-codegen.cc Mon Sep 22 06:36:57 2014 UTC
@@ -147,9 +147,9 @@
 }


-void LCodeGenBase::DeoptComment(const char* mnemonic, const char* reason) {
-  Comment(";;; deoptimize %s: %s", mnemonic,
-          reason == NULL ? "unknown reason" : reason);
+void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) {
+  Comment(";;; deoptimize %s: %s", reason.mnemonic,
+          reason.detail == NULL ? "unknown reason" : reason.detail);
 }


=======================================
--- /branches/bleeding_edge/src/lithium-codegen.h Fri Sep 19 06:27:06 2014 UTC +++ /branches/bleeding_edge/src/lithium-codegen.h Mon Sep 22 06:36:57 2014 UTC
@@ -8,6 +8,7 @@
 #include "src/v8.h"

 #include "src/compiler.h"
+#include "src/deoptimizer.h"

 namespace v8 {
 namespace internal {
@@ -33,7 +34,7 @@
   HGraph* graph() const;

   void FPRINTF_CHECKING Comment(const char* format, ...);
-  void DeoptComment(const char* mnemonic, const char* reason);
+  void DeoptComment(const Deoptimizer::Reason& reason);

   bool GenerateBody();
   virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Sep 22 06:36:57 2014 UTC
@@ -819,7 +819,7 @@
 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
                             Deoptimizer::BailoutType bailout_type,
                             Register src1, const Operand& src2,
-                            const char* reason) {
+                            const char* detail) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
   DCHECK(environment->HasBeenRegistered());
@@ -860,12 +860,13 @@
     __ bind(&skip);
   }

+  Deoptimizer::Reason reason(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.
   if (condition == al && frame_is_built_ &&
       !info()->saves_caller_doubles()) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -874,8 +875,8 @@
         (deopt_jump_table_.last().address != entry) ||
         (deopt_jump_table_.last().bailout_type != bailout_type) ||
         (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       deopt_jump_table_.Add(table_entry, zone());
     }
     __ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
@@ -885,11 +886,11 @@

 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
                             Register src1, const Operand& src2,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason);
+  DeoptimizeIf(condition, instr, bailout_type, src1, src2, detail);
 }


=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Mon Sep 22 06:36:57 2014 UTC
@@ -232,11 +232,11 @@
                     Deoptimizer::BailoutType bailout_type,
                     Register src1 = zero_reg,
                     const Operand& src2 = Operand(zero_reg),
-                    const char* reason = NULL);
+                    const char* detail = NULL);
   void DeoptimizeIf(Condition condition, LInstruction* instr,
                     Register src1 = zero_reg,
                     const Operand& src2 = Operand(zero_reg),
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   void AddToTranslation(LEnvironment* environment,
                         Translation* translation,
=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Mon Sep 22 06:36:57 2014 UTC
@@ -769,7 +769,7 @@
 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
                             Deoptimizer::BailoutType bailout_type,
                             Register src1, const Operand& src2,
-                            const char* reason) {
+                            const char* detail) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
   DCHECK(environment->HasBeenRegistered());
@@ -810,12 +810,13 @@
     __ bind(&skip);
   }

+  Deoptimizer::Reason reason(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.
   if (condition == al && frame_is_built_ &&
       !info()->saves_caller_doubles()) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -824,8 +825,8 @@
         (deopt_jump_table_.last().address != entry) ||
         (deopt_jump_table_.last().bailout_type != bailout_type) ||
         (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       deopt_jump_table_.Add(table_entry, zone());
     }
     __ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
@@ -835,11 +836,11 @@

 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
                             Register src1, const Operand& src2,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason);
+  DeoptimizeIf(condition, instr, bailout_type, src1, src2, detail);
 }


=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.h Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.h Mon Sep 22 06:36:57 2014 UTC
@@ -233,11 +233,11 @@
                     Deoptimizer::BailoutType bailout_type,
                     Register src1 = zero_reg,
                     const Operand& src2 = Operand(zero_reg),
-                    const char* reason = NULL);
+                    const char* detail = NULL);
   void DeoptimizeIf(Condition condition, LInstruction* instr,
                     Register src1 = zero_reg,
                     const Operand& src2 = Operand(zero_reg),
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   void AddToTranslation(LEnvironment* environment,
                         Translation* translation,
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri Sep 19 11:06:59 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Sep 22 06:36:57 2014 UTC
@@ -310,7 +310,7 @@
     int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
     DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
     Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
-    DeoptComment(table_entry->mnemonic, table_entry->reason);
+    DeoptComment(table_entry->reason);
     if (table_entry->needs_frame) {
       DCHECK(!info()->saves_caller_doubles());
       __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
@@ -729,7 +729,7 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason,
+                            const char* detail,
                             Deoptimizer::BailoutType bailout_type) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
@@ -774,12 +774,13 @@
     __ bind(&done);
   }

+  Deoptimizer::Reason reason(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.
   if (cc == no_condition && frame_is_built_ &&
       !info()->saves_caller_doubles()) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ call(entry, RelocInfo::RUNTIME_ENTRY);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -788,8 +789,8 @@
         jump_table_.last().address != entry ||
         jump_table_.last().needs_frame != !frame_is_built_ ||
         jump_table_.last().bailout_type != bailout_type) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       jump_table_.Add(table_entry, zone());
     }
     if (cc == no_condition) {
@@ -802,11 +803,11 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(cc, instr, reason, bailout_type);
+  DeoptimizeIf(cc, instr, detail, bailout_type);
 }


=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.h Fri Sep 19 06:27:06 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.h Mon Sep 22 06:36:57 2014 UTC
@@ -206,10 +206,10 @@
                                     int argc);
   void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
                                             Safepoint::DeoptMode mode);
-  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
+  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* detail,
                     Deoptimizer::BailoutType bailout_type);
   void DeoptimizeIf(Condition cc, LInstruction* instr,
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   bool DeoptEveryNTimes() {
     return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Sat Sep 20 05:08:58 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Mon Sep 22 06:36:57 2014 UTC
@@ -386,8 +386,7 @@
     Deoptimizer::BailoutType type = table_entry->bailout_type;
     int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
     DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
-    Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
-    DeoptComment(table_entry->mnemonic, table_entry->reason);
+    DeoptComment(table_entry->reason);
     if (table_entry->needs_frame) {
       DCHECK(!info()->saves_caller_doubles());
       __ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
@@ -1086,7 +1085,7 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason,
+                            const char* detail,
                             Deoptimizer::BailoutType bailout_type) {
   LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
@@ -1149,9 +1148,10 @@
     __ bind(&done);
   }

+  Deoptimizer::Reason reason(instr->Mnemonic(), detail);
   DCHECK(info()->IsStub() || frame_is_built_);
   if (cc == no_condition && frame_is_built_) {
-    DeoptComment(instr->Mnemonic(), reason);
+    DeoptComment(reason);
     __ call(entry, RelocInfo::RUNTIME_ENTRY);
   } else {
     // We often have several deopts to the same entry, reuse the last
@@ -1160,8 +1160,8 @@
         jump_table_.last().address != entry ||
         jump_table_.last().needs_frame != !frame_is_built_ ||
         jump_table_.last().bailout_type != bailout_type) {
- Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, - bailout_type, !frame_is_built_);
+      Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
+                                              !frame_is_built_);
       jump_table_.Add(table_entry, zone());
     }
     if (cc == no_condition) {
@@ -1174,11 +1174,11 @@


 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
-                            const char* reason) {
+                            const char* detail) {
   Deoptimizer::BailoutType bailout_type = info()->IsStub()
       ? Deoptimizer::LAZY
       : Deoptimizer::EAGER;
-  DeoptimizeIf(cc, instr, reason, bailout_type);
+  DeoptimizeIf(cc, instr, detail, bailout_type);
 }


=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.h Sat Sep 20 05:08:58 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.h Mon Sep 22 06:36:57 2014 UTC
@@ -236,10 +236,10 @@

   void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
                                             Safepoint::DeoptMode mode);
-  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
+  void DeoptimizeIf(Condition cc, LInstruction* instr, const char* detail,
                     Deoptimizer::BailoutType bailout_type);
   void DeoptimizeIf(Condition cc, LInstruction* instr,
-                    const char* reason = NULL);
+                    const char* detail = NULL);

   bool DeoptEveryNTimes() {
     return FLAG_deopt_every_n_times != 0 && !info()->IsStub();

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