Index: src/x87/lithium-codegen-x87.cc |
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc |
index 30e1c03c4011529a0b03d9622f5c5c6530519e5a..67f8a7857b809dc9b56b0e13a9d5d741384e126b 100644 |
--- a/src/x87/lithium-codegen-x87.cc |
+++ b/src/x87/lithium-codegen-x87.cc |
@@ -1007,9 +1007,9 @@ void LCodeGen::RegisterEnvironmentForDeoptimization( |
} |
-void LCodeGen::DeoptimizeIf(Condition cc, |
- LEnvironment* environment, |
+void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, |
Deoptimizer::BailoutType bailout_type) { |
+ LEnvironment* environment = instr->environment(); |
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
DCHECK(environment->HasBeenRegistered()); |
int id = environment->deoptimization_index(); |
@@ -1084,12 +1084,11 @@ void LCodeGen::DeoptimizeIf(Condition cc, |
} |
-void LCodeGen::DeoptimizeIf(Condition cc, |
- LEnvironment* environment) { |
+void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr) { |
Deoptimizer::BailoutType bailout_type = info()->IsStub() |
? Deoptimizer::LAZY |
: Deoptimizer::EAGER; |
- DeoptimizeIf(cc, environment, bailout_type); |
+ DeoptimizeIf(cc, instr, bailout_type); |
} |
@@ -1318,7 +1317,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) { |
__ and_(dividend, mask); |
__ neg(dividend); |
if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
__ jmp(&done, Label::kNear); |
} |
@@ -1335,7 +1334,7 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) { |
DCHECK(ToRegister(instr->result()).is(eax)); |
if (divisor == 0) { |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
return; |
} |
@@ -1350,7 +1349,7 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) { |
Label remainder_not_zero; |
__ j(not_zero, &remainder_not_zero, Label::kNear); |
__ cmp(dividend, Immediate(0)); |
- DeoptimizeIf(less, instr->environment()); |
+ DeoptimizeIf(less, instr); |
__ bind(&remainder_not_zero); |
} |
} |
@@ -1372,7 +1371,7 @@ void LCodeGen::DoModI(LModI* instr) { |
// deopt in this case because we can't return a NaN. |
if (hmod->CheckFlag(HValue::kCanBeDivByZero)) { |
__ test(right_reg, Operand(right_reg)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Check for kMinInt % -1, idiv would signal a divide error. We |
@@ -1383,7 +1382,7 @@ void LCodeGen::DoModI(LModI* instr) { |
__ j(not_equal, &no_overflow_possible, Label::kNear); |
__ cmp(right_reg, -1); |
if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} else { |
__ j(not_equal, &no_overflow_possible, Label::kNear); |
__ Move(result_reg, Immediate(0)); |
@@ -1402,7 +1401,7 @@ void LCodeGen::DoModI(LModI* instr) { |
__ j(not_sign, &positive_left, Label::kNear); |
__ idiv(right_reg); |
__ test(result_reg, Operand(result_reg)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
__ jmp(&done, Label::kNear); |
__ bind(&positive_left); |
} |
@@ -1422,19 +1421,19 @@ void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { |
HDiv* hdiv = instr->hydrogen(); |
if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Check for (kMinInt / -1). |
if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { |
__ cmp(dividend, kMinInt); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Deoptimize if remainder will not be 0. |
if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) && |
divisor != 1 && divisor != -1) { |
int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); |
__ test(dividend, Immediate(mask)); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} |
__ Move(result, dividend); |
int32_t shift = WhichPowerOf2Abs(divisor); |
@@ -1455,7 +1454,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) { |
DCHECK(ToRegister(instr->result()).is(edx)); |
if (divisor == 0) { |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
return; |
} |
@@ -1463,7 +1462,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) { |
HDiv* hdiv = instr->hydrogen(); |
if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
__ TruncatingDiv(dividend, Abs(divisor)); |
@@ -1473,7 +1472,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) { |
__ mov(eax, edx); |
__ imul(eax, eax, divisor); |
__ sub(eax, dividend); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} |
} |
@@ -1493,7 +1492,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
// Check for x / 0. |
if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) { |
__ test(divisor, divisor); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Check for (0 / -x) that will produce negative zero. |
@@ -1502,7 +1501,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
__ test(dividend, dividend); |
__ j(not_zero, ÷nd_not_zero, Label::kNear); |
__ test(divisor, divisor); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
__ bind(÷nd_not_zero); |
} |
@@ -1512,7 +1511,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
__ cmp(dividend, kMinInt); |
__ j(not_zero, ÷nd_not_min_int, Label::kNear); |
__ cmp(divisor, -1); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
__ bind(÷nd_not_min_int); |
} |
@@ -1523,7 +1522,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
if (!hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { |
// Deoptimize if remainder is not 0. |
__ test(remainder, remainder); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} |
} |
@@ -1545,13 +1544,13 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
// If the divisor is negative, we have to negate and handle edge cases. |
__ neg(dividend); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Dividing by -1 is basically negation, unless we overflow. |
if (divisor == -1) { |
if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
return; |
} |
@@ -1578,7 +1577,7 @@ void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { |
DCHECK(ToRegister(instr->result()).is(edx)); |
if (divisor == 0) { |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
return; |
} |
@@ -1586,7 +1585,7 @@ void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { |
HMathFloorOfDiv* hdiv = instr->hydrogen(); |
if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Easy case: We need no dynamic check for the dividend and the flooring |
@@ -1633,7 +1632,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
// Check for x / 0. |
if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) { |
__ test(divisor, divisor); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
// Check for (0 / -x) that will produce negative zero. |
@@ -1642,7 +1641,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
__ test(dividend, dividend); |
__ j(not_zero, ÷nd_not_zero, Label::kNear); |
__ test(divisor, divisor); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
__ bind(÷nd_not_zero); |
} |
@@ -1652,7 +1651,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
__ cmp(dividend, kMinInt); |
__ j(not_zero, ÷nd_not_min_int, Label::kNear); |
__ cmp(divisor, -1); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
__ bind(÷nd_not_min_int); |
} |
@@ -1730,7 +1729,7 @@ void LCodeGen::DoMulI(LMulI* instr) { |
} |
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
@@ -1740,15 +1739,15 @@ void LCodeGen::DoMulI(LMulI* instr) { |
__ j(not_zero, &done, Label::kNear); |
if (right->IsConstantOperand()) { |
if (ToInteger32(LConstantOperand::cast(right)) < 0) { |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
} else if (ToInteger32(LConstantOperand::cast(right)) == 0) { |
__ cmp(ToRegister(instr->temp()), Immediate(0)); |
- DeoptimizeIf(less, instr->environment()); |
+ DeoptimizeIf(less, instr); |
} |
} else { |
// Test the non-zero operand for negative sign. |
__ or_(ToRegister(instr->temp()), ToOperand(right)); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
} |
__ bind(&done); |
} |
@@ -1815,7 +1814,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
__ ror_cl(ToRegister(left)); |
if (instr->can_deopt()) { |
__ test(ToRegister(left), ToRegister(left)); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
} |
break; |
case Token::SAR: |
@@ -1825,7 +1824,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
__ shr_cl(ToRegister(left)); |
if (instr->can_deopt()) { |
__ test(ToRegister(left), ToRegister(left)); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
} |
break; |
case Token::SHL: |
@@ -1842,7 +1841,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
case Token::ROR: |
if (shift_count == 0 && instr->can_deopt()) { |
__ test(ToRegister(left), ToRegister(left)); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
} else { |
__ ror(ToRegister(left), shift_count); |
} |
@@ -1857,7 +1856,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
__ shr(ToRegister(left), shift_count); |
} else if (instr->can_deopt()) { |
__ test(ToRegister(left), ToRegister(left)); |
- DeoptimizeIf(sign, instr->environment()); |
+ DeoptimizeIf(sign, instr); |
} |
break; |
case Token::SHL: |
@@ -1868,7 +1867,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
__ shl(ToRegister(left), shift_count - 1); |
} |
__ SmiTag(ToRegister(left)); |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} else { |
__ shl(ToRegister(left), shift_count); |
} |
@@ -1894,7 +1893,7 @@ void LCodeGen::DoSubI(LSubI* instr) { |
__ sub(ToRegister(left), ToOperand(right)); |
} |
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
} |
@@ -1954,9 +1953,9 @@ void LCodeGen::DoDateField(LDateField* instr) { |
DCHECK(object.is(eax)); |
__ test(object, Immediate(kSmiTagMask)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
__ CmpObjectType(object, JS_DATE_TYPE, scratch); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
if (index->value() == 0) { |
__ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
@@ -2086,7 +2085,7 @@ void LCodeGen::DoAddI(LAddI* instr) { |
__ add(ToRegister(left), ToOperand(right)); |
} |
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
} |
} |
@@ -2270,7 +2269,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
} else if (expected.NeedsMap()) { |
// If we need a map later and have a Smi -> deopt. |
__ test(reg, Immediate(kSmiTagMask)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
Register map = no_reg; // Keep the compiler happy. |
@@ -2327,7 +2326,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
if (!expected.IsGeneric()) { |
// We've seen something for the first time -> deopt. |
// This can only happen if we are not generic already. |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
} |
} |
} |
@@ -2963,7 +2962,7 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
__ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle())); |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ cmp(result, factory()->the_hole_value()); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} |
} |
@@ -3007,7 +3006,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
// it as no longer deleted. We deoptimize in that case. |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} |
// Store the value. |
@@ -3024,7 +3023,7 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ cmp(result, factory()->the_hole_value()); |
if (instr->hydrogen()->DeoptimizesOnHole()) { |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} else { |
Label is_not_hole; |
__ j(not_equal, &is_not_hole, Label::kNear); |
@@ -3045,7 +3044,7 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ cmp(target, factory()->the_hole_value()); |
if (instr->hydrogen()->DeoptimizesOnHole()) { |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} else { |
__ j(not_equal, &skip_assignment, Label::kNear); |
} |
@@ -3142,7 +3141,7 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
// Check that the function has a prototype or an initial map. |
__ cmp(Operand(result), Immediate(factory()->the_hole_value())); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
// If the function does not have an initial map, we're done. |
Label done; |
@@ -3233,7 +3232,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { |
__ mov(result, operand); |
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
__ test(result, Operand(result)); |
- DeoptimizeIf(negative, instr->environment()); |
+ DeoptimizeIf(negative, instr); |
} |
break; |
case EXTERNAL_FLOAT32_ELEMENTS: |
@@ -3263,7 +3262,7 @@ void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { |
FAST_DOUBLE_ELEMENTS, |
instr->base_offset() + sizeof(kHoleNanLower32)); |
__ cmp(hole_check_operand, Immediate(kHoleNanUpper32)); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} |
Operand double_load_operand = BuildFastArrayOperand( |
@@ -3289,10 +3288,10 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
if (instr->hydrogen()->RequiresHoleCheck()) { |
if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { |
__ test(result, Immediate(kSmiTagMask)); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} else { |
__ cmp(result, factory()->the_hole_value()); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} |
} |
} |
@@ -3439,9 +3438,9 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { |
// The receiver should be a JS object. |
__ test(receiver, Immediate(kSmiTagMask)); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
__ CmpObjectType(receiver, FIRST_SPEC_OBJECT_TYPE, scratch); |
- DeoptimizeIf(below, instr->environment()); |
+ DeoptimizeIf(below, instr); |
__ jmp(&receiver_ok, Label::kNear); |
__ bind(&global_object); |
@@ -3467,7 +3466,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
// adaptor frame below it. |
const uint32_t kArgumentsLimit = 1 * KB; |
__ cmp(length, kArgumentsLimit); |
- DeoptimizeIf(above, instr->environment()); |
+ DeoptimizeIf(above, instr); |
__ push(receiver); |
__ mov(receiver, length); |
@@ -3660,7 +3659,7 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
Register input_reg = ToRegister(instr->value()); |
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
factory()->heap_number_map()); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
Label slow, allocated, done; |
Register tmp = input_reg.is(eax) ? ecx : eax; |
@@ -3707,7 +3706,7 @@ void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) { |
Label is_positive; |
__ j(not_sign, &is_positive, Label::kNear); |
__ neg(input_reg); // Sets flags. |
- DeoptimizeIf(negative, instr->environment()); |
+ DeoptimizeIf(negative, instr); |
__ bind(&is_positive); |
} |
@@ -4033,7 +4032,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
__ int3(); |
__ bind(&done); |
} else { |
- DeoptimizeIf(cc, instr->environment()); |
+ DeoptimizeIf(cc, instr); |
} |
} |
@@ -4230,7 +4229,7 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
Register temp = ToRegister(instr->temp()); |
Label no_memento_found; |
__ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
__ bind(&no_memento_found); |
} |
@@ -4599,12 +4598,12 @@ void LCodeGen::DoSmiTag(LSmiTag* instr) { |
if (hchange->CheckFlag(HValue::kCanOverflow) && |
hchange->value()->CheckFlag(HValue::kUint32)) { |
__ test(input, Immediate(0xc0000000)); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} |
__ SmiTag(input); |
if (hchange->CheckFlag(HValue::kCanOverflow) && |
!hchange->value()->CheckFlag(HValue::kUint32)) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
} |
@@ -4615,7 +4614,7 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
DCHECK(input->IsRegister() && input->Equals(instr->result())); |
if (instr->needs_check()) { |
__ test(result, Immediate(kSmiTagMask)); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} else { |
__ AssertSmi(result); |
} |
@@ -4623,13 +4622,13 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
} |
-void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, |
- Register temp_reg, |
- X87Register res_reg, |
- bool can_convert_undefined_to_nan, |
- bool deoptimize_on_minus_zero, |
- LEnvironment* env, |
+void LCodeGen::EmitNumberUntagDNoSSE2(LNumberUntagD* instr, Register input_reg, |
+ Register temp_reg, X87Register res_reg, |
NumberUntagDMode mode) { |
+ bool can_convert_undefined_to_nan = |
+ instr->hydrogen()->can_convert_undefined_to_nan(); |
+ bool deoptimize_on_minus_zero = instr->hydrogen()->deoptimize_on_minus_zero(); |
+ |
Label load_smi, done; |
X87PrepareToWrite(res_reg); |
@@ -4641,14 +4640,14 @@ void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, |
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
factory()->heap_number_map()); |
if (!can_convert_undefined_to_nan) { |
- DeoptimizeIf(not_equal, env); |
+ DeoptimizeIf(not_equal, instr); |
} else { |
Label heap_number, convert; |
__ j(equal, &heap_number, Label::kNear); |
// Convert undefined (or hole) to NaN. |
__ cmp(input_reg, factory()->undefined_value()); |
- DeoptimizeIf(not_equal, env); |
+ DeoptimizeIf(not_equal, instr); |
__ bind(&convert); |
ExternalReference nan = |
@@ -4673,7 +4672,7 @@ void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, |
// Pop FPU stack before deoptimizing. |
__ fstp(0); |
- DeoptimizeIf(not_zero, env); |
+ DeoptimizeIf(not_zero, instr); |
} |
__ jmp(&done, Label::kNear); |
} else { |
@@ -4727,7 +4726,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
__ bind(&check_false); |
__ cmp(input_reg, factory()->false_value()); |
__ RecordComment("Deferred TaggedToI: cannot truncate"); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
__ Move(input_reg, Immediate(0)); |
} else { |
// TODO(olivf) Converting a number on the fpu is actually quite slow. We |
@@ -4735,7 +4734,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
isolate()->factory()->heap_number_map()); |
__ RecordComment("Deferred TaggedToI: not a heap number"); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
__ sub(esp, Immediate(kPointerSize)); |
__ fld_d(FieldOperand(input_reg, HeapNumber::kValueOffset)); |
@@ -4752,13 +4751,13 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
__ j(equal, &no_precision_lost, Label::kNear); |
__ fstp(0); |
__ RecordComment("Deferred TaggedToI: lost precision"); |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
__ bind(&no_precision_lost); |
__ j(parity_odd, ¬_nan); |
__ fstp(0); |
__ RecordComment("Deferred TaggedToI: NaN"); |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
__ bind(¬_nan); |
__ test(input_reg, Operand(input_reg)); |
@@ -4774,16 +4773,16 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
__ pop(input_reg); |
__ test(input_reg, Operand(input_reg)); |
__ RecordComment("Deferred TaggedToI: minus zero"); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} else { |
__ fist_s(MemOperand(esp, 0)); |
__ fild_s(MemOperand(esp, 0)); |
__ FCmp(); |
__ pop(input_reg); |
__ RecordComment("Deferred TaggedToI: lost precision"); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
__ RecordComment("Deferred TaggedToI: NaN"); |
- DeoptimizeIf(parity_even, instr->environment()); |
+ DeoptimizeIf(parity_even, instr); |
} |
} |
} |
@@ -4835,20 +4834,13 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
DCHECK(result->IsDoubleRegister()); |
Register input_reg = ToRegister(input); |
- bool deoptimize_on_minus_zero = |
- instr->hydrogen()->deoptimize_on_minus_zero(); |
Register temp_reg = ToRegister(temp); |
HValue* value = instr->hydrogen()->value(); |
NumberUntagDMode mode = value->representation().IsSmi() |
? NUMBER_CANDIDATE_IS_SMI : NUMBER_CANDIDATE_IS_ANY_TAGGED; |
- EmitNumberUntagDNoSSE2(input_reg, |
- temp_reg, |
- ToX87Register(result), |
- instr->hydrogen()->can_convert_undefined_to_nan(), |
- deoptimize_on_minus_zero, |
- instr->environment(), |
+ EmitNumberUntagDNoSSE2(instr, input_reg, temp_reg, ToX87Register(result), |
mode); |
} |
@@ -4872,7 +4864,7 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
&bailout, Label::kNear); |
__ jmp(&done, Label::kNear); |
__ bind(&bailout); |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
__ bind(&done); |
} |
} |
@@ -4892,18 +4884,18 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
&bailout, Label::kNear); |
__ jmp(&done, Label::kNear); |
__ bind(&bailout); |
- DeoptimizeIf(no_condition, instr->environment()); |
+ DeoptimizeIf(no_condition, instr); |
__ bind(&done); |
__ SmiTag(result_reg); |
- DeoptimizeIf(overflow, instr->environment()); |
+ DeoptimizeIf(overflow, instr); |
} |
void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
LOperand* input = instr->value(); |
__ test(ToOperand(input), Immediate(kSmiTagMask)); |
- DeoptimizeIf(not_zero, instr->environment()); |
+ DeoptimizeIf(not_zero, instr); |
} |
@@ -4911,7 +4903,7 @@ void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
LOperand* input = instr->value(); |
__ test(ToOperand(input), Immediate(kSmiTagMask)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
} |
@@ -4932,14 +4924,14 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
// If there is only one type in the interval check for equality. |
if (first == last) { |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} else { |
- DeoptimizeIf(below, instr->environment()); |
+ DeoptimizeIf(below, instr); |
// Omit check for the last type. |
if (last != LAST_TYPE) { |
__ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
static_cast<int8_t>(last)); |
- DeoptimizeIf(above, instr->environment()); |
+ DeoptimizeIf(above, instr); |
} |
} |
} else { |
@@ -4950,12 +4942,12 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
if (base::bits::IsPowerOfTwo32(mask)) { |
DCHECK(tag == 0 || base::bits::IsPowerOfTwo32(tag)); |
__ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); |
- DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
+ DeoptimizeIf(tag == 0 ? not_zero : zero, instr); |
} else { |
__ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); |
__ and_(temp, mask); |
__ cmp(temp, tag); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} |
} |
} |
@@ -4971,7 +4963,7 @@ void LCodeGen::DoCheckValue(LCheckValue* instr) { |
Operand operand = ToOperand(instr->value()); |
__ cmp(operand, object); |
} |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} |
@@ -4986,7 +4978,7 @@ void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
__ test(eax, Immediate(kSmiTagMask)); |
} |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
} |
@@ -5042,7 +5034,7 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
if (instr->hydrogen()->HasMigrationTarget()) { |
__ j(not_equal, deferred->entry()); |
} else { |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} |
__ bind(&success); |
@@ -5080,7 +5072,7 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) { |
// Check for undefined. Undefined is converted to zero for clamping |
// conversions. |
__ cmp(input_reg, factory()->undefined_value()); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
__ jmp(&zero_result, Label::kNear); |
// Heap number |
@@ -5537,7 +5529,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
type = Deoptimizer::LAZY; |
} |
Comment(";;; deoptimize: %s", instr->hydrogen()->reason()); |
- DeoptimizeIf(no_condition, instr->environment(), type); |
+ DeoptimizeIf(no_condition, instr, type); |
} |
@@ -5634,17 +5626,17 @@ void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
DCHECK(ToRegister(instr->context()).is(esi)); |
__ cmp(eax, isolate()->factory()->undefined_value()); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
__ cmp(eax, isolate()->factory()->null_value()); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
__ test(eax, Immediate(kSmiTagMask)); |
- DeoptimizeIf(zero, instr->environment()); |
+ DeoptimizeIf(zero, instr); |
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
__ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); |
- DeoptimizeIf(below_equal, instr->environment()); |
+ DeoptimizeIf(below_equal, instr); |
Label use_cache, call_runtime; |
__ CheckEnumCache(&call_runtime); |
@@ -5659,7 +5651,7 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
__ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
isolate()->factory()->meta_map()); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
__ bind(&use_cache); |
} |
@@ -5682,7 +5674,7 @@ void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
FieldOperand(result, FixedArray::SizeFor(instr->idx()))); |
__ bind(&done); |
__ test(result, result); |
- DeoptimizeIf(equal, instr->environment()); |
+ DeoptimizeIf(equal, instr); |
} |
@@ -5690,7 +5682,7 @@ void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
Register object = ToRegister(instr->value()); |
__ cmp(ToRegister(instr->map()), |
FieldOperand(object, HeapObject::kMapOffset)); |
- DeoptimizeIf(not_equal, instr->environment()); |
+ DeoptimizeIf(not_equal, instr); |
} |