Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 974b56959fd5237621f1090158c228e11a681e28..e8e72b54c08e96f92d7eff4636c8ad6a20fb1a00 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -91,7 +91,6 @@ void MacroAssembler::Call(Register target, Condition cond) { |
Label start; |
bind(&start); |
blx(target, cond); |
- ASSERT_EQ(CallSize(target, cond), SizeOfCodeGeneratedSince(&start)); |
} |
@@ -153,7 +152,6 @@ void MacroAssembler::Call(Address target, |
mov(ip, Operand(reinterpret_cast<int32_t>(target), rmode)); |
blx(ip, cond); |
- ASSERT_EQ(CallSize(target, rmode, cond), SizeOfCodeGeneratedSince(&start)); |
if (mode == NEVER_INLINE_TARGET_ADDRESS) { |
set_predictable_code_size(old_predictable_code_size); |
} |
@@ -383,6 +381,9 @@ void MacroAssembler::LoadRoot(Register destination, |
mov(destination, Operand(root), LeaveCC, cond); |
return; |
} |
+ if (is_thumb_mode()) { |
+ emit_it(cond); |
+ } |
ldr(destination, MemOperand(kRootRegister, index << kPointerSizeLog2), cond); |
} |
@@ -1153,6 +1154,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
if (!definitely_matches) { |
if (!code_constant.is_null()) { |
mov(r3, Operand(code_constant)); |
+ CheckModeBit(r3); |
add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
} |
@@ -3492,22 +3494,39 @@ void MacroAssembler::CallCFunctionHelper(Register function, |
void MacroAssembler::GetRelocatedValueLocation(Register ldr_location, |
- Register result) { |
+ Register result) { |
const uint32_t kLdrOffsetMask = (1 << 12) - 1; |
const int32_t kPCRegOffset = 2 * kPointerSize; |
+ const int32_t kThumbPCRegOffset = kPointerSize; |
+ Label ldr_pc_arm, ldr_pc_thumb; |
ldr(result, MemOperand(ldr_location)); |
- if (emit_debug_code()) { |
+ if (FLAG_enable_thumb2_crankshaft || emit_debug_code()) { |
// Check that the instruction is a ldr reg, [pc + offset] . |
- and_(result, result, Operand(kLdrPCPattern)); |
- cmp(result, Operand(kLdrPCPattern)); |
- Check(eq, kTheInstructionToPatchShouldBeALoadFromPc); |
+ mov(ip, Operand(kLdrPCPattern)); |
+ and_(result, result, Operand(ip)); |
+ cmp(result, ip); |
+ b(eq, &ldr_pc_arm); |
// Result was clobbered. Restore it. |
- ldr(result, MemOperand(ldr_location)); |
- } |
+ ldr(result, MemOperand(ldr_location, -3)); |
+ mov(ip, Operand(kThumbLdrPCPattern)); |
+ and_(result, result, Operand(ip)); |
+ cmp(result, ip); |
+ Check(eq, kTheInstructionToPatchShouldBeALoadFromPc); |
+ ldr(result, MemOperand(ldr_location, 1)); |
+ and_(result, result, Operand(kLdrOffsetMask)); |
+ bic(ip, ldr_location, Operand(3)); |
+ add(result, ip, Operand(result)); |
+ add(result, result, Operand(kThumbPCRegOffset)); |
+ b(&ldr_pc_thumb); |
+ } |
+ bind(&ldr_pc_arm); |
+ ldr(result, MemOperand(ldr_location)); |
+ |
// Get the address of the constant. |
and_(result, result, Operand(kLdrOffsetMask)); |
add(result, ldr_location, Operand(result)); |
add(result, result, Operand(kPCRegOffset)); |
+ bind(&ldr_pc_thumb); |
} |
@@ -3824,6 +3843,13 @@ void MacroAssembler::TestJSArrayForAllocationMemento( |
} |
+void MacroAssembler::CheckModeBit(Register code) { |
+ ldr(ip, FieldMemOperand(code, Code::kFlagsOffset)); |
+ tst(ip, Operand(0x1000)); |
+ add(code, code, Operand(1), LeaveCC, ne); |
+} |
+ |
+ |
#ifdef DEBUG |
bool AreAliased(Register reg1, |
Register reg2, |
@@ -3864,7 +3890,6 @@ CodePatcher::~CodePatcher() { |
CPU::FlushICache(address_, size_); |
// Check that the code was patched as expected. |
- ASSERT(masm_.pc_ == address_ + size_); |
ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
} |