Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index d5b67a7a1ba65078c8eec836adc8967404dd6f05..53461c7d0d463ba71501cd74bec3cfc27c6fe859 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -138,7 +138,7 @@ bool LCodeGen::GeneratePrologue() { |
// function calls. |
if (!info_->is_classic_mode() || info_->is_native()) { |
Label ok; |
- __ cmp(r5, Operand(0)); |
+ __ cmp(r5, Operand::Zero()); |
__ b(eq, &ok); |
int receiver_offset = scope()->num_parameters() * kPointerSize; |
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
@@ -424,11 +424,11 @@ Operand LCodeGen::ToOperand(LOperand* op) { |
return Operand(ToRegister(op)); |
} else if (op->IsDoubleRegister()) { |
Abort("ToOperand IsDoubleRegister unimplemented"); |
- return Operand(0); |
+ return Operand::Zero(); |
} |
// Stack slots not implemented, use ToMemOperand instead. |
UNREACHABLE(); |
- return Operand(0); |
+ return Operand::Zero(); |
} |
@@ -960,14 +960,14 @@ void LCodeGen::DoModI(LModI* instr) { |
if (divisor < 0) divisor = -divisor; |
Label positive_dividend, done; |
- __ cmp(dividend, Operand(0)); |
+ __ cmp(dividend, Operand::Zero()); |
__ b(pl, &positive_dividend); |
- __ rsb(result, dividend, Operand(0)); |
+ __ rsb(result, dividend, Operand::Zero()); |
__ and_(result, result, Operand(divisor - 1), SetCC); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
DeoptimizeIf(eq, instr->environment()); |
} |
- __ rsb(result, result, Operand(0)); |
+ __ rsb(result, result, Operand::Zero()); |
__ b(&done); |
__ bind(&positive_dividend); |
__ and_(result, dividend, Operand(divisor - 1)); |
@@ -985,7 +985,7 @@ void LCodeGen::DoModI(LModI* instr) { |
CpuFeatures::Scope scope(SUDIV); |
// Check for x % 0. |
if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { |
- __ cmp(right, Operand(0)); |
+ __ cmp(right, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
} |
@@ -995,11 +995,11 @@ void LCodeGen::DoModI(LModI* instr) { |
__ sdiv(result, left, right); |
__ mls(result, result, right, left); |
- __ cmp(result, Operand(0)); |
+ __ cmp(result, Operand::Zero()); |
__ b(ne, &done); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
DeoptimizeIf(lt, instr->environment()); |
} |
} else { |
@@ -1020,14 +1020,14 @@ void LCodeGen::DoModI(LModI* instr) { |
// Check for x % 0. |
if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { |
- __ cmp(right, Operand(0)); |
+ __ cmp(right, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
} |
__ Move(result, left); |
// (0 % x) must yield 0 (if x is finite, which is the case here). |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
__ b(eq, &done); |
// Preload right in a vfp register. |
__ vmov(divisor.low(), right); |
@@ -1047,7 +1047,7 @@ void LCodeGen::DoModI(LModI* instr) { |
__ bind(&right_negative); |
// Negate right. The sign of the divisor does not matter. |
- __ rsb(right, right, Operand(0)); |
+ __ rsb(right, right, Operand::Zero()); |
__ bind(&both_positive); |
const int kUnfolds = 3; |
@@ -1098,7 +1098,7 @@ void LCodeGen::DoModI(LModI* instr) { |
// Check for -0. |
__ sub(scratch2, left, scratch, SetCC); |
__ b(ne, &ok); |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
DeoptimizeIf(mi, instr->environment()); |
__ bind(&ok); |
// Load the result and we are done. |
@@ -1133,11 +1133,11 @@ void LCodeGen::EmitSignedIntegerDivisionByConstant( |
if (divisor > 0) { |
__ Move(result, dividend); |
} else { |
- __ rsb(result, dividend, Operand(0), SetCC); |
+ __ rsb(result, dividend, Operand::Zero(), SetCC); |
DeoptimizeIf(vs, environment); |
} |
// Compute the remainder. |
- __ mov(remainder, Operand(0)); |
+ __ mov(remainder, Operand::Zero()); |
return; |
default: |
@@ -1155,7 +1155,7 @@ void LCodeGen::EmitSignedIntegerDivisionByConstant( |
// handled separately. |
if (divisor < 0) { |
ASSERT(divisor != -1); |
- __ rsb(result, result, Operand(0)); |
+ __ rsb(result, result, Operand::Zero()); |
} |
// Compute the remainder. |
if (divisor > 0) { |
@@ -1191,7 +1191,7 @@ void LCodeGen::EmitSignedIntegerDivisionByConstant( |
__ mov(scratch, Operand(scratch, ASR, s)); |
} |
__ add(result, scratch, Operand(dividend, LSR, 31)); |
- if (divisor < 0) __ rsb(result, result, Operand(0)); |
+ if (divisor < 0) __ rsb(result, result, Operand::Zero()); |
// Compute the remainder. |
__ mov(ip, Operand(divisor)); |
// This sequence could be replaced with 'mls' when |
@@ -1226,16 +1226,16 @@ void LCodeGen::DoDivI(LDivI* instr) { |
// Check for x / 0. |
if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { |
- __ cmp(right, Operand(0)); |
+ __ cmp(right, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
} |
// Check for (0 / -x) that will produce negative zero. |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
Label left_not_zero; |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
__ b(ne, &left_not_zero); |
- __ cmp(right, Operand(0)); |
+ __ cmp(right, Operand::Zero()); |
DeoptimizeIf(mi, instr->environment()); |
__ bind(&left_not_zero); |
} |
@@ -1299,7 +1299,7 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { |
ASSERT(instr->right()->IsConstantOperand()); |
int32_t divisor = ToInteger32(LConstantOperand::cast(instr->right())); |
if (divisor < 0) { |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
} |
EmitSignedIntegerDivisionByConstant(result, |
@@ -1309,7 +1309,7 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { |
scratch, |
instr->environment()); |
// We operated a truncating division. Correct the result if necessary. |
- __ cmp(remainder, Operand(0)); |
+ __ cmp(remainder, Operand::Zero()); |
__ teq(remainder, Operand(divisor), ne); |
__ sub(result, result, Operand(1), LeaveCC, mi); |
} |
@@ -1365,22 +1365,22 @@ void LCodeGen::DoMulI(LMulI* instr) { |
if (bailout_on_minus_zero && (constant < 0)) { |
// The case of a null constant will be handled separately. |
// If constant is negative and left is null, the result should be -0. |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
} |
switch (constant) { |
case -1: |
- __ rsb(result, left, Operand(0)); |
+ __ rsb(result, left, Operand::Zero()); |
break; |
case 0: |
if (bailout_on_minus_zero) { |
// If left is strictly negative and the constant is null, the |
// result is -0. Deoptimize if required, otherwise return 0. |
- __ cmp(left, Operand(0)); |
+ __ cmp(left, Operand::Zero()); |
DeoptimizeIf(mi, instr->environment()); |
} |
- __ mov(result, Operand(0)); |
+ __ mov(result, Operand::Zero()); |
break; |
case 1: |
__ Move(result, left); |
@@ -1407,7 +1407,7 @@ void LCodeGen::DoMulI(LMulI* instr) { |
} |
// Correct the sign of the result is the constant is negative. |
- if (constant < 0) __ rsb(result, result, Operand(0)); |
+ if (constant < 0) __ rsb(result, result, Operand::Zero()); |
} else { |
// Generate standard code. |
@@ -1434,9 +1434,9 @@ void LCodeGen::DoMulI(LMulI* instr) { |
if (bailout_on_minus_zero) { |
// Bail out if the result is supposed to be negative zero. |
Label done; |
- __ cmp(result, Operand(0)); |
+ __ cmp(result, Operand::Zero()); |
__ b(ne, &done); |
- __ cmp(ToRegister(instr->temp()), Operand(0)); |
+ __ cmp(ToRegister(instr->temp()), Operand::Zero()); |
DeoptimizeIf(mi, instr->environment()); |
__ bind(&done); |
} |
@@ -1873,7 +1873,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
Representation r = instr->hydrogen()->value()->representation(); |
if (r.IsInteger32()) { |
Register reg = ToRegister(instr->value()); |
- __ cmp(reg, Operand(0)); |
+ __ cmp(reg, Operand::Zero()); |
EmitBranch(true_block, false_block, ne); |
} else if (r.IsDouble()) { |
DoubleRegister reg = ToDoubleRegister(instr->value()); |
@@ -1891,7 +1891,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
__ CompareRoot(reg, Heap::kTrueValueRootIndex); |
EmitBranch(true_block, false_block, eq); |
} else if (type.IsSmi()) { |
- __ cmp(reg, Operand(0)); |
+ __ cmp(reg, Operand::Zero()); |
EmitBranch(true_block, false_block, ne); |
} else { |
Label* true_label = chunk_->GetAssemblyLabel(true_block); |
@@ -1921,7 +1921,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
if (expected.Contains(ToBooleanStub::SMI)) { |
// Smis: 0 -> false, all other -> true. |
- __ cmp(reg, Operand(0)); |
+ __ cmp(reg, Operand::Zero()); |
__ b(eq, false_label); |
__ JumpIfSmi(reg, true_label); |
} else if (expected.NeedsMap()) { |
@@ -1954,7 +1954,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
__ CompareInstanceType(map, ip, FIRST_NONSTRING_TYPE); |
__ b(ge, ¬_string); |
__ ldr(ip, FieldMemOperand(reg, String::kLengthOffset)); |
- __ cmp(ip, Operand(0)); |
+ __ cmp(ip, Operand::Zero()); |
__ b(ne, true_label); |
__ b(false_label); |
__ bind(¬_string); |
@@ -2247,7 +2247,9 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
Handle<Code> ic = CompareIC::GetUninitialized(op); |
CallCode(ic, RelocInfo::CODE_TARGET, instr); |
- __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined. |
+ |
+ // This instruction also signals no smi code inlined. |
+ __ cmp(r0, Operand::Zero()); |
Condition condition = ComputeCompareCondition(op); |
@@ -2421,7 +2423,7 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) { |
InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
- __ cmp(r0, Operand(0)); |
+ __ cmp(r0, Operand::Zero()); |
__ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); |
__ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); |
} |
@@ -2561,7 +2563,9 @@ void LCodeGen::DoCmpT(LCmpT* instr) { |
Handle<Code> ic = CompareIC::GetUninitialized(op); |
CallCode(ic, RelocInfo::CODE_TARGET, instr); |
- __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined. |
+ |
+ // This instruction also signals no smi code inlined. |
+ __ cmp(r0, Operand::Zero()); |
Condition condition = ComputeCompareCondition(op); |
__ LoadRoot(ToRegister(instr->result()), |
@@ -3240,7 +3244,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
// stack. |
Label invoke, loop; |
// length is a small non-negative integer, due to the test above. |
- __ cmp(length, Operand(0)); |
+ __ cmp(length, Operand::Zero()); |
__ b(eq, &invoke); |
__ bind(&loop); |
__ ldr(scratch, MemOperand(elements, length, LSL, 2)); |
@@ -3444,12 +3448,12 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { |
Register input = ToRegister(instr->value()); |
Register result = ToRegister(instr->result()); |
- __ cmp(input, Operand(0)); |
+ __ cmp(input, Operand::Zero()); |
__ Move(result, input, pl); |
// We can make rsb conditional because the previous cmp instruction |
// will clear the V (overflow) flag and rsb won't set this flag |
// if input is positive. |
- __ rsb(result, input, Operand(0), SetCC, mi); |
+ __ rsb(result, input, Operand::Zero(), SetCC, mi); |
// Deoptimize on overflow. |
DeoptimizeIf(vs, instr->environment()); |
} |
@@ -3506,7 +3510,7 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
// Test for -0. |
Label done; |
- __ cmp(result, Operand(0)); |
+ __ cmp(result, Operand::Zero()); |
__ b(ne, &done); |
__ vmov(scratch, input.high()); |
__ tst(scratch, Operand(HeapNumber::kSignMask)); |
@@ -3532,7 +3536,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { |
// If the number is in ]-0.5, +0.5[, the result is +/- 0. |
__ cmp(scratch, Operand(HeapNumber::kExponentBias - 2)); |
- __ mov(result, Operand(0), LeaveCC, le); |
+ __ mov(result, Operand::Zero(), LeaveCC, le); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
__ b(le, &check_sign_on_zero); |
} else { |
@@ -3557,7 +3561,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
DeoptimizeIf(mi, instr->environment()); |
} else { |
- __ mov(result, Operand(0), LeaveCC, mi); |
+ __ mov(result, Operand::Zero(), LeaveCC, mi); |
__ b(mi, &done); |
} |
@@ -3570,7 +3574,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
// Test for -0. |
- __ cmp(result, Operand(0)); |
+ __ cmp(result, Operand::Zero()); |
__ b(ne, &done); |
__ bind(&check_sign_on_zero); |
__ vmov(scratch, input.high()); |
@@ -3670,7 +3674,7 @@ void LCodeGen::DoRandom(LRandom* instr) { |
// Load state[0]. |
__ ldr(r1, FieldMemOperand(r2, ByteArray::kHeaderSize)); |
- __ cmp(r1, Operand(0)); |
+ __ cmp(r1, Operand::Zero()); |
__ b(eq, deferred->entry()); |
// Load state[1]. |
__ ldr(r0, FieldMemOperand(r2, ByteArray::kHeaderSize + kSeedSize)); |
@@ -3705,7 +3709,7 @@ void LCodeGen::DoRandom(LRandom* instr) { |
// Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
__ vmov(d7, r0, r1); |
// Move 0x4130000000000000 to VFP. |
- __ mov(r0, Operand(0, RelocInfo::NONE)); |
+ __ mov(r0, Operand::Zero()); |
__ vmov(d8, r0, r1); |
// Subtract and store the result in the heap number. |
__ vsub(d7, d7, d8); |
@@ -4253,7 +4257,7 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) { |
// TODO(3095996): Get rid of this. For now, we need to make the |
// result register contain a valid pointer because it is already |
// contained in the register pointer map. |
- __ mov(result, Operand(0)); |
+ __ mov(result, Operand::Zero()); |
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
__ push(string); |
@@ -4313,7 +4317,7 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { |
// TODO(3095996): Get rid of this. For now, we need to make the |
// result register contain a valid pointer because it is already |
// contained in the register pointer map. |
- __ mov(result, Operand(0)); |
+ __ mov(result, Operand::Zero()); |
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
__ SmiTag(char_code); |
@@ -4450,7 +4454,7 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
// TODO(3095996): Put a valid pointer value in the stack slot where the result |
// register is stored, as this register is in the pointer map, but contains an |
// integer value. |
- __ mov(ip, Operand(0)); |
+ __ mov(ip, Operand::Zero()); |
__ StoreToSafepointRegisterSlot(ip, dst); |
CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
__ Move(dst, r0); |
@@ -4503,7 +4507,7 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
// result register contain a valid pointer because it is already |
// contained in the register pointer map. |
Register reg = ToRegister(instr->result()); |
- __ mov(reg, Operand(0)); |
+ __ mov(reg, Operand::Zero()); |
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
@@ -4573,7 +4577,7 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
__ vldr(result_reg, ip, HeapNumber::kValueOffset); |
if (deoptimize_on_minus_zero) { |
__ vmov(ip, result_reg.low()); |
- __ cmp(ip, Operand(0)); |
+ __ cmp(ip, Operand::Zero()); |
__ b(ne, &done); |
__ vmov(ip, result_reg.high()); |
__ cmp(ip, Operand(HeapNumber::kSignMask)); |
@@ -4628,7 +4632,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
__ cmp(input_reg, Operand(ip)); |
DeoptimizeIf(ne, instr->environment()); |
- __ mov(input_reg, Operand(0)); |
+ __ mov(input_reg, Operand::Zero()); |
__ b(&done); |
__ bind(&heap_number); |
@@ -4658,7 +4662,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
DeoptimizeIf(ne, instr->environment()); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- __ cmp(input_reg, Operand(0)); |
+ __ cmp(input_reg, Operand::Zero()); |
__ b(ne, &done); |
__ vmov(scratch1, double_scratch.high()); |
__ tst(scratch1, Operand(HeapNumber::kSignMask)); |
@@ -4887,7 +4891,7 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
// conversions. |
__ cmp(input_reg, Operand(factory()->undefined_value())); |
DeoptimizeIf(ne, instr->environment()); |
- __ mov(result_reg, Operand(0)); |
+ __ mov(result_reg, Operand::Zero()); |
__ jmp(&done); |
// Heap number |
@@ -5007,7 +5011,7 @@ void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
// TODO(3095996): Get rid of this. For now, we need to make the |
// result register contain a valid pointer because it is already |
// contained in the register pointer map. |
- __ mov(result, Operand(0)); |
+ __ mov(result, Operand::Zero()); |
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
__ mov(r0, Operand(Smi::FromInt(instance_size))); |
@@ -5635,7 +5639,7 @@ void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
FieldMemOperand(result, DescriptorArray::kEnumCacheOffset)); |
__ ldr(result, |
FieldMemOperand(result, FixedArray::SizeFor(instr->idx()))); |
- __ cmp(result, Operand(0)); |
+ __ cmp(result, Operand::Zero()); |
DeoptimizeIf(eq, instr->environment()); |
__ bind(&done); |
@@ -5658,7 +5662,7 @@ void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
Register scratch = scratch0(); |
Label out_of_object, done; |
- __ cmp(index, Operand(0)); |
+ __ cmp(index, Operand::Zero()); |
__ b(lt, &out_of_object); |
STATIC_ASSERT(kPointerSizeLog2 > kSmiTagSize); |