Revision: 24111
Author:   [email protected]
Date:     Mon Sep 22 09:50:12 2014 UTC
Log:      Merge RecordComment invocations into DeoptimizeIf calls.

This way the deoptimization reasons are actually threaded through to
the jump table. Tiny cleanup of related MIPS/MIPS64 code on the way.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Sep 22 09:50:12 2014 UTC
@@ -4978,26 +4978,22 @@
     __ bind(&check_false);
     __ LoadRoot(ip, Heap::kFalseValueRootIndex);
     __ cmp(scratch2, Operand(ip));
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(ne, instr);
+    DeoptimizeIf(ne, instr, "cannot truncate");
     __ mov(input_reg, Operand::Zero());
   } else {
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(ne, instr);
+    DeoptimizeIf(ne, instr, "not a heap number");

     __ sub(ip, scratch2, Operand(kHeapObjectTag));
     __ vldr(double_scratch2, ip, HeapNumber::kValueOffset);
     __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch);
-    __ RecordComment("Deferred TaggedToI: lost precision or NaN");
-    DeoptimizeIf(ne, instr);
+    DeoptimizeIf(ne, instr, "lost precision or NaN");

     if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
       __ cmp(input_reg, Operand::Zero());
       __ b(ne, &done);
       __ VmovHigh(scratch1, double_scratch2);
       __ tst(scratch1, Operand(HeapNumber::kSignMask));
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(ne, instr);
+      DeoptimizeIf(ne, instr, "minus zero");
     }
   }
   __ bind(&done);
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon Sep 22 09:50:12 2014 UTC
@@ -5631,22 +5631,20 @@
     Register output = ToRegister32(instr->result());
     DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2);

-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, instr);
+    DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, instr,
+                        "not a heap number");

     // A heap number: load value and convert to int32 using non-truncating
     // function. If the result is out of range, branch to deoptimize.
     __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset));
     __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2);
-    __ RecordComment("Deferred TaggedToI: lost precision or NaN");
-    DeoptimizeIf(ne, instr);
+    DeoptimizeIf(ne, instr, "lost precision or NaN");

     if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
       __ Cmp(output, 0);
       __ B(ne, &done);
       __ Fmov(scratch1, dbl_scratch1);
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIfNegative(scratch1, instr);
+      DeoptimizeIfNegative(scratch1, instr, "minus zero");
     }
   }
   __ Bind(&done);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Sep 22 09:50:12 2014 UTC
@@ -3708,8 +3708,7 @@
   __ cvttsd2si(output_reg, Operand(xmm_scratch));
   // Overflow is signalled with minint.
   __ cmp(output_reg, 0x1);
-  __ RecordComment("D2I conversion overflow");
-  DeoptimizeIf(overflow, instr);
+  DeoptimizeIf(overflow, instr, "conversion overflow");
   __ jmp(&done, dist);

   __ bind(&below_one_half);
@@ -3724,8 +3723,7 @@
   __ cvttsd2si(output_reg, Operand(input_temp));
// Catch minint due to overflow, and to prevent overflow when compensating.
   __ cmp(output_reg, 0x1);
-  __ RecordComment("D2I conversion overflow");
-  DeoptimizeIf(overflow, instr);
+  DeoptimizeIf(overflow, instr, "conversion overflow");

   __ Cvtsi2sd(xmm_scratch, output_reg);
   __ ucomisd(xmm_scratch, input_temp);
@@ -3741,8 +3739,7 @@
     // If the sign is positive, we return +0.
     __ movmskpd(output_reg, input_reg);
     __ test(output_reg, Immediate(1));
-    __ RecordComment("Minus zero");
-    DeoptimizeIf(not_zero, instr);
+    DeoptimizeIf(not_zero, instr, "minus zero");
   }
   __ Move(output_reg, Immediate(0));
   __ bind(&done);
@@ -4762,31 +4759,26 @@

     __ bind(&check_false);
     __ cmp(input_reg, factory()->false_value());
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "cannot truncate");
     __ Move(input_reg, Immediate(0));
   } else {
     XMMRegister scratch = ToDoubleRegister(instr->temp());
     DCHECK(!scratch.is(xmm0));
     __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
            isolate()->factory()->heap_number_map());
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "not a heap number");
     __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
     __ cvttsd2si(input_reg, Operand(xmm0));
     __ Cvtsi2sd(scratch, Operand(input_reg));
     __ ucomisd(xmm0, scratch);
-    __ RecordComment("Deferred TaggedToI: lost precision");
-    DeoptimizeIf(not_equal, instr);
-    __ RecordComment("Deferred TaggedToI: NaN");
-    DeoptimizeIf(parity_even, instr);
+    DeoptimizeIf(not_equal, instr, "lost precision");
+    DeoptimizeIf(parity_even, instr, "NaN");
     if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) {
       __ test(input_reg, Operand(input_reg));
       __ j(not_zero, done);
       __ movmskpd(input_reg, xmm0);
       __ and_(input_reg, 1);
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(not_zero, instr);
+      DeoptimizeIf(not_zero, instr, "minus zero");
     }
   }
 }
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Sep 22 09:50:12 2014 UTC
@@ -334,21 +334,23 @@

     int length = deopt_jump_table_.length();
     for (int i = 0; i < length; i++) {
-      __ bind(&deopt_jump_table_[i].label);
+      Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i];
+      __ bind(&table_entry->label);

-      Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
+      Deoptimizer::BailoutType type = table_entry->bailout_type;
       DCHECK(type == deopt_jump_table_[0].bailout_type);
-      Address entry = deopt_jump_table_[i].address;
+      Address entry = table_entry->address;
       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->reason);

// Second-level deopt table entries are contiguous and small, so instead // of loading the full, absolute address of each one, load an immediate
       // offset which will be added to the base address later.
       __ li(entry_offset, Operand(entry - base));

-      if (deopt_jump_table_[i].needs_frame) {
+      if (table_entry->needs_frame) {
         DCHECK(!info()->saves_caller_doubles());
         if (needs_frame.is_bound()) {
           __ Branch(&needs_frame);
@@ -4926,13 +4928,11 @@

     __ bind(&check_false);
     __ LoadRoot(at, Heap::kFalseValueRootIndex);
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(ne, instr, scratch2, Operand(at));
+    DeoptimizeIf(ne, instr, scratch2, Operand(at), "cannot truncate");
     __ Branch(USE_DELAY_SLOT, &done);
     __ mov(input_reg, zero_reg);  // In delay slot.
   } else {
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(ne, instr, scratch1, Operand(at));
+    DeoptimizeIf(ne, instr, scratch1, Operand(at), "not a heap number");

     // Load the double value.
     __ ldc1(double_scratch,
@@ -4947,16 +4947,15 @@
                        except_flag,
                        kCheckForInexactConversion);

-    __ RecordComment("Deferred TaggedToI: lost precision or NaN");
-    DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg));
+    DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg),
+                 "lost precision or NaN");

     if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
       __ Branch(&done, ne, input_reg, Operand(zero_reg));

       __ Mfhc1(scratch1, double_scratch);
       __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask));
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg));
+      DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg), "minus zero");
     }
   }
   __ bind(&done);
=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Mon Sep 22 09:50:12 2014 UTC
@@ -308,14 +308,16 @@
   __ bind(&table_start);
   Label needs_frame;
   for (int i = 0; i < deopt_jump_table_.length(); i++) {
-    __ bind(&deopt_jump_table_[i].label);
-    Address entry = deopt_jump_table_[i].address;
-    Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
+    Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i];
+    __ bind(&table_entry->label);
+    Address entry = table_entry->address;
+    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->reason);
     __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry)));
-    if (deopt_jump_table_[i].needs_frame) {
+    if (table_entry->needs_frame) {
       DCHECK(!info()->saves_caller_doubles());
       if (needs_frame.is_bound()) {
         __ Branch(&needs_frame);
@@ -4958,13 +4960,11 @@

     __ bind(&check_false);
     __ LoadRoot(at, Heap::kFalseValueRootIndex);
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(ne, instr, scratch2, Operand(at));
+    DeoptimizeIf(ne, instr, scratch2, Operand(at), "cannot truncate");
     __ Branch(USE_DELAY_SLOT, &done);
     __ mov(input_reg, zero_reg);  // In delay slot.
   } else {
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(ne, instr, scratch1, Operand(at));
+    DeoptimizeIf(ne, instr, scratch1, Operand(at), "not a heap number");

     // Load the double value.
     __ ldc1(double_scratch,
@@ -4979,16 +4979,15 @@
                        except_flag,
                        kCheckForInexactConversion);

-    __ RecordComment("Deferred TaggedToI: lost precision or NaN");
-    DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg));
+    DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg),
+                 "lost precision or NaN");

     if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
       __ Branch(&done, ne, input_reg, Operand(zero_reg));

       __ mfhc1(scratch1, double_scratch);  // Get exponent/sign bits.
       __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask));
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg));
+      DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg), "minus zero");
     }
   }
   __ bind(&done);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Sep 22 09:50:12 2014 UTC
@@ -3798,8 +3798,7 @@
   __ cvttsd2si(output_reg, xmm_scratch);
   // Overflow is signalled with minint.
   __ cmpl(output_reg, Immediate(0x1));
-  __ RecordComment("D2I conversion overflow");
-  DeoptimizeIf(overflow, instr);
+  DeoptimizeIf(overflow, instr, "conversion overflow");
   __ jmp(&done, dist);

   __ bind(&below_one_half);
@@ -3815,8 +3814,7 @@
   __ cvttsd2si(output_reg, input_temp);
// Catch minint due to overflow, and to prevent overflow when compensating.
   __ cmpl(output_reg, Immediate(0x1));
-  __ RecordComment("D2I conversion overflow");
-  DeoptimizeIf(overflow, instr);
+  DeoptimizeIf(overflow, instr, "conversion overflow");

   __ Cvtlsi2sd(xmm_scratch, output_reg);
   __ ucomisd(xmm_scratch, input_temp);
@@ -3831,8 +3829,7 @@
   if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
     __ movq(output_reg, input_reg);
     __ testq(output_reg, output_reg);
-    __ RecordComment("Minus zero");
-    DeoptimizeIf(negative, instr);
+    DeoptimizeIf(negative, instr, "minus zero");
   }
   __ Set(output_reg, 0);
   __ bind(&done);
@@ -4962,31 +4959,26 @@

     __ bind(&check_false);
     __ CompareRoot(input_reg, Heap::kFalseValueRootIndex);
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "cannot truncate");
     __ Set(input_reg, 0);
   } else {
     XMMRegister scratch = ToDoubleRegister(instr->temp());
     DCHECK(!scratch.is(xmm0));
     __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
                    Heap::kHeapNumberMapRootIndex);
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "not a heap number");
     __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
     __ cvttsd2si(input_reg, xmm0);
     __ Cvtlsi2sd(scratch, input_reg);
     __ ucomisd(xmm0, scratch);
-    __ RecordComment("Deferred TaggedToI: lost precision");
-    DeoptimizeIf(not_equal, instr);
-    __ RecordComment("Deferred TaggedToI: NaN");
-    DeoptimizeIf(parity_even, instr);
+    DeoptimizeIf(not_equal, instr, "lost precision");
+    DeoptimizeIf(parity_even, instr, "NaN");
     if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) {
       __ testl(input_reg, input_reg);
       __ j(not_zero, done);
       __ movmskpd(input_reg, xmm0);
       __ andl(input_reg, Immediate(1));
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(not_zero, instr);
+      DeoptimizeIf(not_zero, instr, "minus zero");
     }
   }
 }
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Mon Sep 22 09:05:22 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Mon Sep 22 09:50:12 2014 UTC
@@ -3975,9 +3975,8 @@
   __ fistp_s(MemOperand(esp, 0));
   // Check overflow.
   __ X87CheckIA();
-  __ RecordComment("D2I conversion overflow");
   __ pop(result);
-  DeoptimizeIf(equal, instr);
+  DeoptimizeIf(equal, instr, "conversion overflow");
   __ fnclex();
   // Restore round mode.
   __ X87SetRC(0x0000);
@@ -3994,8 +3993,7 @@
     // If the sign is positive, we return +0.
     __ fld(0);
     __ FXamSign();
-    __ RecordComment("Minus zero");
-    DeoptimizeIf(not_zero, instr);
+    DeoptimizeIf(not_zero, instr, "minus zero");
   }
   __ Move(result, Immediate(0));
   __ jmp(&done);
@@ -4011,9 +4009,8 @@
   __ fistp_s(MemOperand(esp, 0));
   // Check overflow.
   __ X87CheckIA();
-  __ RecordComment("D2I conversion overflow");
   __ pop(result);
-  DeoptimizeIf(equal, instr);
+  DeoptimizeIf(equal, instr, "conversion overflow");
   __ fnclex();
   // Restore round mode.
   __ X87SetRC(0x0000);
@@ -5186,16 +5183,14 @@

     __ bind(&check_false);
     __ cmp(input_reg, factory()->false_value());
-    __ RecordComment("Deferred TaggedToI: cannot truncate");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "cannot truncate");
     __ Move(input_reg, Immediate(0));
   } else {
// TODO(olivf) Converting a number on the fpu is actually quite slow. We // should first try a fast conversion and then bailout to this slow case.
     __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
            isolate()->factory()->heap_number_map());
-    __ RecordComment("Deferred TaggedToI: not a heap number");
-    DeoptimizeIf(not_equal, instr);
+    DeoptimizeIf(not_equal, instr, "not a heap number");

     __ sub(esp, Immediate(kPointerSize));
     __ fld_d(FieldOperand(input_reg, HeapNumber::kValueOffset));
@@ -5211,14 +5206,12 @@

       __ j(equal, &no_precision_lost, Label::kNear);
       __ fstp(0);
-      __ RecordComment("Deferred TaggedToI: lost precision");
-      DeoptimizeIf(no_condition, instr);
+      DeoptimizeIf(no_condition, instr, "lost precision");
       __ bind(&no_precision_lost);

       __ j(parity_odd, &not_nan);
       __ fstp(0);
-      __ RecordComment("Deferred TaggedToI: NaN");
-      DeoptimizeIf(no_condition, instr);
+      DeoptimizeIf(no_condition, instr, "NaN");
       __ bind(&not_nan);

       __ test(input_reg, Operand(input_reg));
@@ -5233,17 +5226,14 @@
       __ fstp_s(Operand(esp, 0));
       __ pop(input_reg);
       __ test(input_reg, Operand(input_reg));
-      __ RecordComment("Deferred TaggedToI: minus zero");
-      DeoptimizeIf(not_zero, instr);
+      DeoptimizeIf(not_zero, instr, "minus zero");
     } else {
       __ fist_s(MemOperand(esp, 0));
       __ fild_s(MemOperand(esp, 0));
       __ FCmp();
       __ pop(input_reg);
-      __ RecordComment("Deferred TaggedToI: lost precision");
-      DeoptimizeIf(not_equal, instr);
-      __ RecordComment("Deferred TaggedToI: NaN");
-      DeoptimizeIf(parity_even, instr);
+      DeoptimizeIf(not_equal, instr, "lost precision");
+      DeoptimizeIf(parity_even, instr, "NaN");
     }
   }
 }

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