Index: src/arm/macro-assembler-arm.cc |
=================================================================== |
--- src/arm/macro-assembler-arm.cc (revision 12285) |
+++ src/arm/macro-assembler-arm.cc (working copy) |
@@ -137,13 +137,25 @@ |
int size = 2 * kInstrSize; |
Instr mov_instr = cond | MOV | LeaveCC; |
intptr_t immediate = reinterpret_cast<intptr_t>(target); |
- if (!Operand(immediate, rmode).is_single_instruction(mov_instr)) { |
+ if (!Operand(immediate, rmode).is_single_instruction(this, mov_instr)) { |
size += kInstrSize; |
} |
return size; |
} |
+int MacroAssembler::CallSizeNotPredictableSize( |
+ Address target, RelocInfo::Mode rmode, Condition cond) { |
+ int size = 2 * kInstrSize; |
+ Instr mov_instr = cond | MOV | LeaveCC; |
+ intptr_t immediate = reinterpret_cast<intptr_t>(target); |
+ if (!Operand(immediate, rmode).is_single_instruction(NULL, mov_instr)) { |
+ size += kInstrSize; |
+ } |
+ return size; |
+} |
+ |
+ |
void MacroAssembler::Call(Address target, |
RelocInfo::Mode rmode, |
Condition cond) { |
@@ -276,12 +288,12 @@ |
void MacroAssembler::And(Register dst, Register src1, const Operand& src2, |
Condition cond) { |
if (!src2.is_reg() && |
- !src2.must_use_constant_pool() && |
+ !src2.must_use_constant_pool(this) && |
src2.immediate() == 0) { |
mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); |
- } else if (!src2.is_single_instruction() && |
- !src2.must_use_constant_pool() && |
+ } else if (!src2.is_single_instruction(this) && |
+ !src2.must_use_constant_pool(this) && |
CpuFeatures::IsSupported(ARMv7) && |
IsPowerOf2(src2.immediate() + 1)) { |
ubfx(dst, src1, 0, |
@@ -296,7 +308,7 @@ |
void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width, |
Condition cond) { |
ASSERT(lsb < 32); |
- if (!CpuFeatures::IsSupported(ARMv7)) { |
+ if (!CpuFeatures::IsSupported(ARMv7) || predictable_code_size()) { |
int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
and_(dst, src1, Operand(mask), LeaveCC, cond); |
if (lsb != 0) { |
@@ -311,7 +323,7 @@ |
void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width, |
Condition cond) { |
ASSERT(lsb < 32); |
- if (!CpuFeatures::IsSupported(ARMv7)) { |
+ if (!CpuFeatures::IsSupported(ARMv7) || predictable_code_size()) { |
int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
and_(dst, src1, Operand(mask), LeaveCC, cond); |
int shift_up = 32 - lsb - width; |
@@ -339,7 +351,7 @@ |
ASSERT(lsb + width < 32); |
ASSERT(!scratch.is(dst)); |
if (width == 0) return; |
- if (!CpuFeatures::IsSupported(ARMv7)) { |
+ if (!CpuFeatures::IsSupported(ARMv7) || predictable_code_size()) { |
int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
bic(dst, dst, Operand(mask)); |
and_(scratch, src, Operand((1 << width) - 1)); |
@@ -353,7 +365,7 @@ |
void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) { |
ASSERT(lsb < 32); |
- if (!CpuFeatures::IsSupported(ARMv7)) { |
+ if (!CpuFeatures::IsSupported(ARMv7) || predictable_code_size()) { |
int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
bic(dst, dst, Operand(mask)); |
} else { |
@@ -364,7 +376,7 @@ |
void MacroAssembler::Usat(Register dst, int satpos, const Operand& src, |
Condition cond) { |
- if (!CpuFeatures::IsSupported(ARMv7)) { |
+ if (!CpuFeatures::IsSupported(ARMv7) || predictable_code_size()) { |
ASSERT(!dst.is(pc) && !src.rm().is(pc)); |
ASSERT((satpos >= 0) && (satpos <= 31)); |
@@ -672,7 +684,7 @@ |
ASSERT((src.am() != PreIndex) && (src.am() != NegPreIndex)); |
// Generate two ldr instructions if ldrd is not available. |
- if (CpuFeatures::IsSupported(ARMv7)) { |
+ if (CpuFeatures::IsSupported(ARMv7) && !predictable_code_size()) { |
CpuFeatures::Scope scope(ARMv7); |
ldrd(dst1, dst2, src, cond); |
} else { |
@@ -714,7 +726,7 @@ |
ASSERT((dst.am() != PreIndex) && (dst.am() != NegPreIndex)); |
// Generate two str instructions if strd is not available. |
- if (CpuFeatures::IsSupported(ARMv7)) { |
+ if (CpuFeatures::IsSupported(ARMv7) && !predictable_code_size()) { |
CpuFeatures::Scope scope(ARMv7); |
strd(src1, src2, dst, cond); |
} else { |
@@ -2586,7 +2598,7 @@ |
void MacroAssembler::GetLeastBitsFromSmi(Register dst, |
Register src, |
int num_least_bits) { |
- if (CpuFeatures::IsSupported(ARMv7)) { |
+ if (CpuFeatures::IsSupported(ARMv7) && !predictable_code_size()) { |
ubfx(dst, src, kSmiTagSize, num_least_bits); |
} else { |
mov(dst, Operand(src, ASR, kSmiTagSize)); |