| Index: src/arm64/lithium-codegen-arm64.cc
|
| diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc
|
| index 06706e5c83a0e1e438df0cba28572bde4e23df5d..0873c959ac5a2d0bd4d9121aa9ec93a463577c48 100644
|
| --- a/src/arm64/lithium-codegen-arm64.cc
|
| +++ b/src/arm64/lithium-codegen-arm64.cc
|
| @@ -997,9 +997,9 @@ void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
|
|
|
|
|
| void LCodeGen::DeoptimizeBranch(
|
| - LEnvironment* environment,
|
| - BranchType branch_type, Register reg, int bit,
|
| + LInstruction* instr, BranchType branch_type, Register reg, int bit,
|
| Deoptimizer::BailoutType* override_bailout_type) {
|
| + LEnvironment* environment = instr->environment();
|
| RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
| Deoptimizer::BailoutType bailout_type =
|
| info()->IsStub() ? Deoptimizer::LAZY : Deoptimizer::EAGER;
|
| @@ -1072,78 +1072,71 @@ void LCodeGen::DeoptimizeBranch(
|
| }
|
|
|
|
|
| -void LCodeGen::Deoptimize(LEnvironment* environment,
|
| +void LCodeGen::Deoptimize(LInstruction* instr,
|
| Deoptimizer::BailoutType* override_bailout_type) {
|
| - DeoptimizeBranch(environment, always, NoReg, -1, override_bailout_type);
|
| + DeoptimizeBranch(instr, always, NoReg, -1, override_bailout_type);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIf(Condition cond, LEnvironment* environment) {
|
| - DeoptimizeBranch(environment, static_cast<BranchType>(cond));
|
| +void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr) {
|
| + DeoptimizeBranch(instr, static_cast<BranchType>(cond));
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfZero(Register rt, LEnvironment* environment) {
|
| - DeoptimizeBranch(environment, reg_zero, rt);
|
| +void LCodeGen::DeoptimizeIfZero(Register rt, LInstruction* instr) {
|
| + DeoptimizeBranch(instr, reg_zero, rt);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfNotZero(Register rt, LEnvironment* environment) {
|
| - DeoptimizeBranch(environment, reg_not_zero, rt);
|
| +void LCodeGen::DeoptimizeIfNotZero(Register rt, LInstruction* instr) {
|
| + DeoptimizeBranch(instr, reg_not_zero, rt);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfNegative(Register rt, LEnvironment* environment) {
|
| +void LCodeGen::DeoptimizeIfNegative(Register rt, LInstruction* instr) {
|
| int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit;
|
| - DeoptimizeIfBitSet(rt, sign_bit, environment);
|
| + DeoptimizeIfBitSet(rt, sign_bit, instr);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfSmi(Register rt,
|
| - LEnvironment* environment) {
|
| - DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), environment);
|
| +void LCodeGen::DeoptimizeIfSmi(Register rt, LInstruction* instr) {
|
| + DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), instr);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfNotSmi(Register rt, LEnvironment* environment) {
|
| - DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), environment);
|
| +void LCodeGen::DeoptimizeIfNotSmi(Register rt, LInstruction* instr) {
|
| + DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), instr);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfRoot(Register rt,
|
| - Heap::RootListIndex index,
|
| - LEnvironment* environment) {
|
| +void LCodeGen::DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
|
| + LInstruction* instr) {
|
| __ CompareRoot(rt, index);
|
| - DeoptimizeIf(eq, environment);
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfNotRoot(Register rt,
|
| - Heap::RootListIndex index,
|
| - LEnvironment* environment) {
|
| +void LCodeGen::DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
|
| + LInstruction* instr) {
|
| __ CompareRoot(rt, index);
|
| - DeoptimizeIf(ne, environment);
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
|
|
| void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input,
|
| - LEnvironment* environment) {
|
| + LInstruction* instr) {
|
| __ TestForMinusZero(input);
|
| - DeoptimizeIf(vs, environment);
|
| + DeoptimizeIf(vs, instr);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfBitSet(Register rt,
|
| - int bit,
|
| - LEnvironment* environment) {
|
| - DeoptimizeBranch(environment, reg_bit_set, rt, bit);
|
| +void LCodeGen::DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr) {
|
| + DeoptimizeBranch(instr, reg_bit_set, rt, bit);
|
| }
|
|
|
|
|
| -void LCodeGen::DeoptimizeIfBitClear(Register rt,
|
| - int bit,
|
| - LEnvironment* environment) {
|
| - DeoptimizeBranch(environment, reg_bit_clear, rt, bit);
|
| +void LCodeGen::DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr) {
|
| + DeoptimizeBranch(instr, reg_bit_clear, rt, bit);
|
| }
|
|
|
|
|
| @@ -1517,7 +1510,7 @@ void LCodeGen::DoAddI(LAddI* instr) {
|
|
|
| if (can_overflow) {
|
| __ Adds(result, left, right);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Add(result, left, right);
|
| }
|
| @@ -1531,7 +1524,7 @@ void LCodeGen::DoAddS(LAddS* instr) {
|
| Operand right = ToOperand(instr->right());
|
| if (can_overflow) {
|
| __ Adds(result, left, right);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Add(result, left, right);
|
| }
|
| @@ -1657,7 +1650,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
|
| // adaptor frame below it.
|
| const uint32_t kArgumentsLimit = 1 * KB;
|
| __ Cmp(length, kArgumentsLimit);
|
| - DeoptimizeIf(hi, instr->environment());
|
| + DeoptimizeIf(hi, instr);
|
|
|
| // Push the receiver and use the register to keep the original
|
| // number of arguments.
|
| @@ -1839,7 +1832,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) {
|
| if (FLAG_debug_code && instr->hydrogen()->skip_check()) {
|
| __ Assert(NegateCondition(cond), kEliminatedBoundsCheckFailed);
|
| } else {
|
| - DeoptimizeIf(cond, instr->environment());
|
| + DeoptimizeIf(cond, instr);
|
| }
|
| }
|
|
|
| @@ -1918,7 +1911,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| __ JumpIfSmi(value, true_label);
|
| } else if (expected.NeedsMap()) {
|
| // If we need a map later and have a smi, deopt.
|
| - DeoptimizeIfSmi(value, instr->environment());
|
| + DeoptimizeIfSmi(value, instr);
|
| }
|
|
|
| Register map = NoReg;
|
| @@ -1979,7 +1972,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.
|
| - Deoptimize(instr->environment());
|
| + Deoptimize(instr);
|
| }
|
| }
|
| }
|
| @@ -2164,7 +2157,7 @@ void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
|
| instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
|
| __ StoreToSafepointRegisterSlot(x0, temp);
|
| }
|
| - DeoptimizeIfSmi(temp, instr->environment());
|
| + DeoptimizeIfSmi(temp, instr);
|
| }
|
|
|
|
|
| @@ -2219,7 +2212,7 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
|
| if (instr->hydrogen()->HasMigrationTarget()) {
|
| __ B(ne, deferred->entry());
|
| } else {
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
| __ Bind(&success);
|
| @@ -2228,7 +2221,7 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
|
|
|
| void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
|
| if (!instr->hydrogen()->value()->type().IsHeapObject()) {
|
| - DeoptimizeIfSmi(ToRegister(instr->value()), instr->environment());
|
| + DeoptimizeIfSmi(ToRegister(instr->value()), instr);
|
| }
|
| }
|
|
|
| @@ -2236,7 +2229,7 @@ void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
|
| void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
|
| Register value = ToRegister(instr->value());
|
| DCHECK(!instr->result() || ToRegister(instr->result()).Is(value));
|
| - DeoptimizeIfNotSmi(value, instr->environment());
|
| + DeoptimizeIfNotSmi(value, instr);
|
| }
|
|
|
|
|
| @@ -2254,15 +2247,15 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
|
| __ Cmp(scratch, first);
|
| if (first == last) {
|
| // If there is only one type in the interval check for equality.
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| } else if (last == LAST_TYPE) {
|
| // We don't need to compare with the higher bound of the interval.
|
| - DeoptimizeIf(lo, instr->environment());
|
| + DeoptimizeIf(lo, instr);
|
| } else {
|
| // If we are below the lower bound, set the C flag and clear the Z flag
|
| // to force a deopt.
|
| __ Ccmp(scratch, last, CFlag, hs);
|
| - DeoptimizeIf(hi, instr->environment());
|
| + DeoptimizeIf(hi, instr);
|
| }
|
| } else {
|
| uint8_t mask;
|
| @@ -2272,9 +2265,9 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
|
| if (base::bits::IsPowerOfTwo32(mask)) {
|
| DCHECK((tag == 0) || (tag == mask));
|
| if (tag == 0) {
|
| - DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr->environment());
|
| + DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr);
|
| } else {
|
| - DeoptimizeIfBitClear(scratch, MaskToBit(mask), instr->environment());
|
| + DeoptimizeIfBitClear(scratch, MaskToBit(mask), instr);
|
| }
|
| } else {
|
| if (tag == 0) {
|
| @@ -2283,7 +2276,7 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
|
| __ And(scratch, scratch, mask);
|
| __ Cmp(scratch, tag);
|
| }
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
| }
|
| }
|
| @@ -2324,8 +2317,7 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
|
| __ JumpIfRoot(scratch, Heap::kHeapNumberMapRootIndex, &is_heap_number);
|
|
|
| // Check for undefined. Undefined is coverted to zero for clamping conversion.
|
| - DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, instr);
|
| __ Mov(result, 0);
|
| __ B(&done);
|
|
|
| @@ -2631,7 +2623,7 @@ void LCodeGen::DoCheckValue(LCheckValue* instr) {
|
| } else {
|
| __ Cmp(reg, Operand(object));
|
| }
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
|
|
| @@ -2655,9 +2647,9 @@ void LCodeGen::DoDateField(LDateField* instr) {
|
| DCHECK(object.is(result) && object.Is(x0));
|
| DCHECK(instr->IsMarkedAsCall());
|
|
|
| - DeoptimizeIfSmi(object, instr->environment());
|
| + DeoptimizeIfSmi(object, instr);
|
| __ CompareObjectType(object, temp1, temp1, JS_DATE_TYPE);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
|
|
| if (index->value() == 0) {
|
| __ Ldr(result, FieldMemOperand(object, JSDate::kValueOffset));
|
| @@ -2694,7 +2686,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
| }
|
|
|
| Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
| - Deoptimize(instr->environment(), &type);
|
| + Deoptimize(instr, &type);
|
| }
|
|
|
|
|
| @@ -2708,21 +2700,21 @@ void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) {
|
| // Check for (0 / -x) that will produce negative zero.
|
| HDiv* hdiv = instr->hydrogen();
|
| if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) {
|
| - DeoptimizeIfZero(dividend, instr->environment());
|
| + DeoptimizeIfZero(dividend, instr);
|
| }
|
| // Check for (kMinInt / -1).
|
| if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) {
|
| // Test dividend for kMinInt by subtracting one (cmp) and checking for
|
| // overflow.
|
| __ Cmp(dividend, 1);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, 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);
|
| __ Tst(dividend, mask);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
| if (divisor == -1) { // Nice shortcut, not needed for correctness.
|
| @@ -2750,14 +2742,14 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) {
|
| DCHECK(!AreAliased(dividend, result));
|
|
|
| if (divisor == 0) {
|
| - Deoptimize(instr->environment());
|
| + Deoptimize(instr);
|
| return;
|
| }
|
|
|
| // Check for (0 / -x) that will produce negative zero.
|
| HDiv* hdiv = instr->hydrogen();
|
| if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) {
|
| - DeoptimizeIfZero(dividend, instr->environment());
|
| + DeoptimizeIfZero(dividend, instr);
|
| }
|
|
|
| __ TruncatingDiv(result, dividend, Abs(divisor));
|
| @@ -2769,7 +2761,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) {
|
| __ Sxtw(dividend.X(), dividend);
|
| __ Mov(temp, divisor);
|
| __ Smsubl(temp.X(), result, temp, dividend.X());
|
| - DeoptimizeIfNotZero(temp, instr->environment());
|
| + DeoptimizeIfNotZero(temp, instr);
|
| }
|
| }
|
|
|
| @@ -2792,7 +2784,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
|
|
| // Check for x / 0.
|
| if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) {
|
| - DeoptimizeIfZero(divisor, instr->environment());
|
| + DeoptimizeIfZero(divisor, instr);
|
| }
|
|
|
| // Check for (0 / -x) as that will produce negative zero.
|
| @@ -2804,7 +2796,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| // If the divisor >= 0 (pl, the opposite of mi) set the flags to
|
| // condition ne, so we don't deopt, ie. positive divisor doesn't deopt.
|
| __ Ccmp(dividend, 0, NoFlag, mi);
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
| // Check for (kMinInt / -1).
|
| @@ -2816,13 +2808,13 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| // -1. If overflow is clear, set the flags for condition ne, as the
|
| // dividend isn't -1, and thus we shouldn't deopt.
|
| __ Ccmp(divisor, -1, NoFlag, vs);
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
| // Compute remainder and deopt if it's not zero.
|
| Register remainder = ToRegister32(instr->temp());
|
| __ Msub(remainder, result, divisor, dividend);
|
| - DeoptimizeIfNotZero(remainder, instr->environment());
|
| + DeoptimizeIfNotZero(remainder, instr);
|
| }
|
|
|
|
|
| @@ -2831,11 +2823,11 @@ void LCodeGen::DoDoubleToIntOrSmi(LDoubleToIntOrSmi* instr) {
|
| Register result = ToRegister32(instr->result());
|
|
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| - DeoptimizeIfMinusZero(input, instr->environment());
|
| + DeoptimizeIfMinusZero(input, instr);
|
| }
|
|
|
| __ TryRepresentDoubleAsInt32(result, input, double_scratch());
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
|
|
| if (instr->tag_result()) {
|
| __ SmiTag(result.X());
|
| @@ -2896,7 +2888,7 @@ void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
|
| __ LoadInstanceDescriptors(map, result);
|
| __ Ldr(result, FieldMemOperand(result, DescriptorArray::kEnumCacheOffset));
|
| __ Ldr(result, FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
|
| - DeoptimizeIfZero(result, instr->environment());
|
| + DeoptimizeIfZero(result, instr);
|
|
|
| __ Bind(&done);
|
| }
|
| @@ -2909,18 +2901,17 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
| DCHECK(instr->IsMarkedAsCall());
|
| DCHECK(object.Is(x0));
|
|
|
| - DeoptimizeIfRoot(object, Heap::kUndefinedValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfRoot(object, Heap::kUndefinedValueRootIndex, instr);
|
|
|
| __ LoadRoot(null_value, Heap::kNullValueRootIndex);
|
| __ Cmp(object, null_value);
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
|
|
| - DeoptimizeIfSmi(object, instr->environment());
|
| + DeoptimizeIfSmi(object, instr);
|
|
|
| STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
|
| __ CompareObjectType(object, x1, x1, LAST_JS_PROXY_TYPE);
|
| - DeoptimizeIf(le, instr->environment());
|
| + DeoptimizeIf(le, instr);
|
|
|
| Label use_cache, call_runtime;
|
| __ CheckEnumCache(object, null_value, x1, x2, x3, x4, &call_runtime);
|
| @@ -2934,7 +2925,7 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
| CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
|
|
|
| __ Ldr(x1, FieldMemOperand(object, HeapObject::kMapOffset));
|
| - DeoptimizeIfNotRoot(x1, Heap::kMetaMapRootIndex, instr->environment());
|
| + DeoptimizeIfNotRoot(x1, Heap::kMetaMapRootIndex, instr);
|
|
|
| __ Bind(&use_cache);
|
| }
|
| @@ -3327,8 +3318,7 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
|
| __ Ldr(result, ContextMemOperand(context, instr->slot_index()));
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| if (instr->hydrogen()->DeoptimizesOnHole()) {
|
| - DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr);
|
| } else {
|
| Label not_the_hole;
|
| __ JumpIfNotRoot(result, Heap::kTheHoleValueRootIndex, ¬_the_hole);
|
| @@ -3349,8 +3339,7 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
|
| JSFunction::kPrototypeOrInitialMapOffset));
|
|
|
| // Check that the function has a prototype or an initial map.
|
| - DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr);
|
|
|
| // If the function does not have an initial map, we're done.
|
| Label done;
|
| @@ -3370,8 +3359,7 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
| __ Mov(result, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
|
| __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset));
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| - DeoptimizeIfRoot(
|
| - result, Heap::kTheHoleValueRootIndex, instr->environment());
|
| + DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr);
|
| }
|
| }
|
|
|
| @@ -3502,7 +3490,7 @@ void LCodeGen::DoLoadKeyedExternal(LLoadKeyedExternal* instr) {
|
| if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
| // Deopt if value > 0x80000000.
|
| __ Tst(result, 0xFFFFFFFF80000000);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
| break;
|
| case FLOAT32_ELEMENTS:
|
| @@ -3599,7 +3587,7 @@ void LCodeGen::DoLoadKeyedFixedDouble(LLoadKeyedFixedDouble* instr) {
|
| STATIC_ASSERT(kHoleNanInt64 == 0x7fffffffffffffff);
|
| __ Ldr(scratch, mem_op);
|
| __ Cmn(scratch, 1);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| }
|
| }
|
|
|
| @@ -3637,10 +3625,9 @@ void LCodeGen::DoLoadKeyedFixed(LLoadKeyedFixed* instr) {
|
|
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
|
| - DeoptimizeIfNotSmi(result, instr->environment());
|
| + DeoptimizeIfNotSmi(result, instr);
|
| } else {
|
| - DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr);
|
| }
|
| }
|
| }
|
| @@ -3742,7 +3729,7 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
|
| Register result = r.IsSmi() ? ToRegister(instr->result())
|
| : ToRegister32(instr->result());
|
| __ Abs(result, input);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| }
|
| }
|
|
|
| @@ -3771,8 +3758,7 @@ void LCodeGen::DoDeferredMathAbsTagged(LMathAbsTagged* instr,
|
|
|
| // Deoptimize if the input is not a HeapNumber.
|
| __ Ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
|
| - DeoptimizeIfNotRoot(temp1, Heap::kHeapNumberMapRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(temp1, Heap::kHeapNumberMapRootIndex, instr);
|
|
|
| // If the argument is positive, we can return it as-is, without any need to
|
| // allocate a new HeapNumber for the result. We have to do this in integer
|
| @@ -3896,7 +3882,7 @@ void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
|
| Register result = ToRegister(instr->result());
|
|
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| - DeoptimizeIfMinusZero(input, instr->environment());
|
| + DeoptimizeIfMinusZero(input, instr);
|
| }
|
|
|
| __ Fcvtms(result, input);
|
| @@ -3906,7 +3892,7 @@ void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
|
| __ Cmp(result, Operand(result, SXTW));
|
| // - The input was not NaN.
|
| __ Fccmp(input, input, NoFlag, eq);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
|
|
| @@ -3932,13 +3918,13 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
|
| // If the divisor is negative, we have to negate and handle edge cases.
|
| __ Negs(result, dividend);
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
| // Dividing by -1 is basically negation, unless we overflow.
|
| if (divisor == -1) {
|
| if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| }
|
| return;
|
| }
|
| @@ -3961,14 +3947,14 @@ void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
|
| DCHECK(!AreAliased(dividend, result));
|
|
|
| if (divisor == 0) {
|
| - Deoptimize(instr->environment());
|
| + Deoptimize(instr);
|
| return;
|
| }
|
|
|
| // Check for (0 / -x) that will produce negative zero.
|
| HMathFloorOfDiv* hdiv = instr->hydrogen();
|
| if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) {
|
| - DeoptimizeIfZero(dividend, instr->environment());
|
| + DeoptimizeIfZero(dividend, instr);
|
| }
|
|
|
| // Easy case: We need no dynamic check for the dividend and the flooring
|
| @@ -4011,14 +3997,14 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
|
| __ Sdiv(result, dividend, divisor);
|
|
|
| // Check for x / 0.
|
| - DeoptimizeIfZero(divisor, instr->environment());
|
| + DeoptimizeIfZero(divisor, instr);
|
|
|
| // Check for (kMinInt / -1).
|
| if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
|
| // The V flag will be set iff dividend == kMinInt.
|
| __ Cmp(dividend, 1);
|
| __ Ccmp(divisor, -1, NoFlag, vs);
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
| // Check for (0 / -x) that will produce negative zero.
|
| @@ -4028,7 +4014,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
|
| // "divisor" can't be null because the code would have already been
|
| // deoptimized. The Z flag is set only if (divisor < 0) and (dividend == 0).
|
| // In this case we need to deoptimize to produce a -0.
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
|
|
| Label done;
|
| @@ -4108,8 +4094,7 @@ void LCodeGen::DoPower(LPower* instr) {
|
| __ JumpIfSmi(tagged_exponent, &no_deopt);
|
| DCHECK(!x0.is(tagged_exponent));
|
| __ Ldr(x0, FieldMemOperand(tagged_exponent, HeapObject::kMapOffset));
|
| - DeoptimizeIfNotRoot(x0, Heap::kHeapNumberMapRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(x0, Heap::kHeapNumberMapRootIndex, instr);
|
| __ Bind(&no_deopt);
|
| MathPowStub stub(isolate(), MathPowStub::TAGGED);
|
| __ CallStub(&stub);
|
| @@ -4190,18 +4175,18 @@ void LCodeGen::DoMathRoundI(LMathRoundI* instr) {
|
|
|
| // Deoptimize if the result > 1, as it must be larger than 32 bits.
|
| __ Cmp(result, 1);
|
| - DeoptimizeIf(hi, instr->environment());
|
| + DeoptimizeIf(hi, instr);
|
|
|
| // Deoptimize for negative inputs, which at this point are only numbers in
|
| // the range [-0.5, -0.0]
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| __ Fmov(result, input);
|
| - DeoptimizeIfNegative(result, instr->environment());
|
| + DeoptimizeIfNegative(result, instr);
|
| }
|
|
|
| // Deoptimize if the input was NaN.
|
| __ Fcmp(input, dot_five);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
|
|
| // Now, the only unhandled inputs are in the range [0.0, 1.5[ (or [-0.5, 1.5[
|
| // if we didn't generate a -0.0 bailout). If input >= 0.5 then return 1,
|
| @@ -4279,7 +4264,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) {
|
| __ And(dividend, dividend, mask);
|
| __ Negs(dividend, dividend);
|
| if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| }
|
| __ B(&done);
|
| }
|
| @@ -4298,7 +4283,7 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) {
|
| DCHECK(!AreAliased(dividend, result, temp));
|
|
|
| if (divisor == 0) {
|
| - Deoptimize(instr->environment());
|
| + Deoptimize(instr);
|
| return;
|
| }
|
|
|
| @@ -4312,7 +4297,7 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) {
|
| if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| Label remainder_not_zero;
|
| __ Cbnz(result, &remainder_not_zero);
|
| - DeoptimizeIfNegative(dividend, instr->environment());
|
| + DeoptimizeIfNegative(dividend, instr);
|
| __ bind(&remainder_not_zero);
|
| }
|
| }
|
| @@ -4327,12 +4312,12 @@ void LCodeGen::DoModI(LModI* instr) {
|
| // modulo = dividend - quotient * divisor
|
| __ Sdiv(result, dividend, divisor);
|
| if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
|
| - DeoptimizeIfZero(divisor, instr->environment());
|
| + DeoptimizeIfZero(divisor, instr);
|
| }
|
| __ Msub(result, result, divisor, dividend);
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| __ Cbnz(result, &done);
|
| - DeoptimizeIfNegative(dividend, instr->environment());
|
| + DeoptimizeIfNegative(dividend, instr);
|
| }
|
| __ Bind(&done);
|
| }
|
| @@ -4355,10 +4340,10 @@ void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
|
| if (bailout_on_minus_zero) {
|
| if (right < 0) {
|
| // The result is -0 if right is negative and left is zero.
|
| - DeoptimizeIfZero(left, instr->environment());
|
| + DeoptimizeIfZero(left, instr);
|
| } else if (right == 0) {
|
| // The result is -0 if the right is zero and the left is negative.
|
| - DeoptimizeIfNegative(left, instr->environment());
|
| + DeoptimizeIfNegative(left, instr);
|
| }
|
| }
|
|
|
| @@ -4368,7 +4353,7 @@ void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
|
| if (can_overflow) {
|
| // Only 0x80000000 can overflow here.
|
| __ Negs(result, left);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Neg(result, left);
|
| }
|
| @@ -4384,7 +4369,7 @@ void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
|
| case 2:
|
| if (can_overflow) {
|
| __ Adds(result, left, left);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Add(result, left, left);
|
| }
|
| @@ -4403,7 +4388,7 @@ void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
|
| DCHECK(!AreAliased(scratch, left));
|
| __ Cls(scratch, left);
|
| __ Cmp(scratch, right_log2);
|
| - DeoptimizeIf(lt, instr->environment());
|
| + DeoptimizeIf(lt, instr);
|
| }
|
|
|
| if (right >= 0) {
|
| @@ -4413,7 +4398,7 @@ void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
|
| // result = -left << log2(-right)
|
| if (can_overflow) {
|
| __ Negs(result, Operand(left, LSL, right_log2));
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Neg(result, Operand(left, LSL, right_log2));
|
| }
|
| @@ -4471,13 +4456,13 @@ void LCodeGen::DoMulI(LMulI* instr) {
|
| // - If so (eq), set N (mi) if left + right is negative.
|
| // - Otherwise, clear N.
|
| __ Ccmn(left, right, NoFlag, eq);
|
| - DeoptimizeIf(mi, instr->environment());
|
| + DeoptimizeIf(mi, instr);
|
| }
|
|
|
| if (can_overflow) {
|
| __ Smull(result.X(), left, right);
|
| __ Cmp(result.X(), Operand(result, SXTW));
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| } else {
|
| __ Mul(result, left, right);
|
| }
|
| @@ -4501,7 +4486,7 @@ void LCodeGen::DoMulS(LMulS* instr) {
|
| // - If so (eq), set N (mi) if left + right is negative.
|
| // - Otherwise, clear N.
|
| __ Ccmn(left, right, NoFlag, eq);
|
| - DeoptimizeIf(mi, instr->environment());
|
| + DeoptimizeIf(mi, instr);
|
| }
|
|
|
| STATIC_ASSERT((kSmiShift == 32) && (kSmiTag == 0));
|
| @@ -4509,7 +4494,7 @@ void LCodeGen::DoMulS(LMulS* instr) {
|
| __ Smulh(result, left, right);
|
| __ Cmp(result, Operand(result.W(), SXTW));
|
| __ SmiTag(result);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| } else {
|
| if (AreAliased(result, left, right)) {
|
| // All three registers are the same: half untag the input and then
|
| @@ -4681,21 +4666,19 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
|
| __ JumpIfNotRoot(scratch, Heap::kHeapNumberMapRootIndex,
|
| &convert_undefined);
|
| } else {
|
| - DeoptimizeIfNotRoot(scratch, Heap::kHeapNumberMapRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(scratch, Heap::kHeapNumberMapRootIndex, instr);
|
| }
|
|
|
| // Load heap number.
|
| __ Ldr(result, FieldMemOperand(input, HeapNumber::kValueOffset));
|
| if (instr->hydrogen()->deoptimize_on_minus_zero()) {
|
| - DeoptimizeIfMinusZero(result, instr->environment());
|
| + DeoptimizeIfMinusZero(result, instr);
|
| }
|
| __ B(&done);
|
|
|
| if (can_convert_undefined_to_nan) {
|
| __ Bind(&convert_undefined);
|
| - DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, instr);
|
|
|
| __ LoadRoot(scratch, Heap::kNanValueRootIndex);
|
| __ Ldr(result, FieldMemOperand(scratch, HeapNumber::kValueOffset));
|
| @@ -4888,7 +4871,7 @@ void LCodeGen::DoSmiTag(LSmiTag* instr) {
|
| Register output = ToRegister(instr->result());
|
| if (hchange->CheckFlag(HValue::kCanOverflow) &&
|
| hchange->value()->CheckFlag(HValue::kUint32)) {
|
| - DeoptimizeIfNegative(input.W(), instr->environment());
|
| + DeoptimizeIfNegative(input.W(), instr);
|
| }
|
| __ SmiTag(output, input);
|
| }
|
| @@ -4900,7 +4883,7 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
|
| Label done, untag;
|
|
|
| if (instr->needs_check()) {
|
| - DeoptimizeIfNotSmi(input, instr->environment());
|
| + DeoptimizeIfNotSmi(input, instr);
|
| }
|
|
|
| __ Bind(&untag);
|
| @@ -4925,7 +4908,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) {
|
| if (instr->can_deopt()) {
|
| // If `left >>> right` >= 0x80000000, the result is not representable
|
| // in a signed 32-bit smi.
|
| - DeoptimizeIfNegative(result, instr->environment());
|
| + DeoptimizeIfNegative(result, instr);
|
| }
|
| break;
|
| default: UNREACHABLE();
|
| @@ -4935,7 +4918,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) {
|
| int shift_count = JSShiftAmountFromLConstant(right_op);
|
| if (shift_count == 0) {
|
| if ((instr->op() == Token::SHR) && instr->can_deopt()) {
|
| - DeoptimizeIfNegative(left, instr->environment());
|
| + DeoptimizeIfNegative(left, instr);
|
| }
|
| __ Mov(result, left, kDiscardForSameWReg);
|
| } else {
|
| @@ -4988,7 +4971,7 @@ void LCodeGen::DoShiftS(LShiftS* instr) {
|
| if (instr->can_deopt()) {
|
| // If `left >>> right` >= 0x80000000, the result is not representable
|
| // in a signed 32-bit smi.
|
| - DeoptimizeIfNegative(result, instr->environment());
|
| + DeoptimizeIfNegative(result, instr);
|
| }
|
| break;
|
| default: UNREACHABLE();
|
| @@ -4998,7 +4981,7 @@ void LCodeGen::DoShiftS(LShiftS* instr) {
|
| int shift_count = JSShiftAmountFromLConstant(right_op);
|
| if (shift_count == 0) {
|
| if ((instr->op() == Token::SHR) && instr->can_deopt()) {
|
| - DeoptimizeIfNegative(left, instr->environment());
|
| + DeoptimizeIfNegative(left, instr);
|
| }
|
| __ Mov(result, left);
|
| } else {
|
| @@ -5127,8 +5110,7 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| __ Ldr(scratch, target);
|
| if (instr->hydrogen()->DeoptimizesOnHole()) {
|
| - DeoptimizeIfRoot(scratch, Heap::kTheHoleValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfRoot(scratch, Heap::kTheHoleValueRootIndex, instr);
|
| } else {
|
| __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, &skip_assignment);
|
| }
|
| @@ -5166,8 +5148,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| Register payload = ToRegister(instr->temp2());
|
| __ Ldr(payload, FieldMemOperand(cell, Cell::kValueOffset));
|
| - DeoptimizeIfRoot(
|
| - payload, Heap::kTheHoleValueRootIndex, instr->environment());
|
| + DeoptimizeIfRoot(payload, Heap::kTheHoleValueRootIndex, instr);
|
| }
|
|
|
| // Store the value.
|
| @@ -5584,7 +5565,7 @@ void LCodeGen::DoSubI(LSubI* instr) {
|
|
|
| if (can_overflow) {
|
| __ Subs(result, left, right);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Sub(result, left, right);
|
| }
|
| @@ -5598,7 +5579,7 @@ void LCodeGen::DoSubS(LSubS* instr) {
|
| Operand right = ToOperand(instr->right());
|
| if (can_overflow) {
|
| __ Subs(result, left, right);
|
| - DeoptimizeIf(vs, instr->environment());
|
| + DeoptimizeIf(vs, instr);
|
| } else {
|
| __ Sub(result, left, right);
|
| }
|
| @@ -5641,29 +5622,27 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
|
|
|
| // Output contains zero, undefined is converted to zero for truncating
|
| // conversions.
|
| - DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, instr);
|
| } else {
|
| Register output = ToRegister32(instr->result());
|
| DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2);
|
|
|
| __ RecordComment("Deferred TaggedToI: not a heap number");
|
| - DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex,
|
| - instr->environment());
|
| + DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, instr);
|
|
|
| // 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->environment());
|
| + DeoptimizeIf(ne, instr);
|
|
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| __ Cmp(output, 0);
|
| __ B(ne, &done);
|
| __ Fmov(scratch1, dbl_scratch1);
|
| __ RecordComment("Deferred TaggedToI: minus zero");
|
| - DeoptimizeIfNegative(scratch1, instr->environment());
|
| + DeoptimizeIfNegative(scratch1, instr);
|
| }
|
| }
|
| __ Bind(&done);
|
| @@ -5804,7 +5783,7 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
|
|
|
| Label no_memento_found;
|
| __ TestJSArrayForAllocationMemento(object, temp1, temp2, &no_memento_found);
|
| - DeoptimizeIf(eq, instr->environment());
|
| + DeoptimizeIf(eq, instr);
|
| __ Bind(&no_memento_found);
|
| }
|
|
|
| @@ -5920,7 +5899,7 @@ void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
|
| Register temp = ToRegister(instr->temp());
|
| __ Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset));
|
| __ Cmp(map, temp);
|
| - DeoptimizeIf(ne, instr->environment());
|
| + DeoptimizeIf(ne, instr);
|
| }
|
|
|
|
|
| @@ -5954,10 +5933,10 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| __ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex, &global_object);
|
|
|
| // Deoptimize if the receiver is not a JS object.
|
| - DeoptimizeIfSmi(receiver, instr->environment());
|
| + DeoptimizeIfSmi(receiver, instr);
|
| __ CompareObjectType(receiver, result, result, FIRST_SPEC_OBJECT_TYPE);
|
| __ B(ge, ©_receiver);
|
| - Deoptimize(instr->environment());
|
| + Deoptimize(instr);
|
|
|
| __ Bind(&global_object);
|
| __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset));
|
|
|