Commit 4dc80f78 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

ARM: Move the constant pool blocking for call instruction sequences

The constant pool blocking for call instruction sequences is hoisted to the begof the function generating the call sequence.
Review URL: http://codereview.chromium.org/6690009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7155 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e94a5f90
...@@ -113,6 +113,8 @@ int MacroAssembler::CallSize(Register target, Condition cond) { ...@@ -113,6 +113,8 @@ int MacroAssembler::CallSize(Register target, Condition cond) {
void MacroAssembler::Call(Register target, Condition cond) { void MacroAssembler::Call(Register target, Condition cond) {
// Block constant pool for the call instruction sequence.
BlockConstPoolScope block_const_pool(this);
#ifdef DEBUG #ifdef DEBUG
int pre_position = pc_offset(); int pre_position = pc_offset();
#endif #endif
...@@ -121,10 +123,8 @@ void MacroAssembler::Call(Register target, Condition cond) { ...@@ -121,10 +123,8 @@ void MacroAssembler::Call(Register target, Condition cond) {
blx(target, cond); blx(target, cond);
#else #else
// set lr for return at current pc + 8 // set lr for return at current pc + 8
{ BlockConstPoolScope block_const_pool(this); mov(lr, Operand(pc), LeaveCC, cond);
mov(lr, Operand(pc), LeaveCC, cond); mov(pc, Operand(target), LeaveCC, cond);
mov(pc, Operand(target), LeaveCC, cond);
}
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -147,6 +147,8 @@ int MacroAssembler::CallSize( ...@@ -147,6 +147,8 @@ int MacroAssembler::CallSize(
void MacroAssembler::Call( void MacroAssembler::Call(
intptr_t target, RelocInfo::Mode rmode, Condition cond) { intptr_t target, RelocInfo::Mode rmode, Condition cond) {
// Block constant pool for the call instruction sequence.
BlockConstPoolScope block_const_pool(this);
#ifdef DEBUG #ifdef DEBUG
int pre_position = pc_offset(); int pre_position = pc_offset();
#endif #endif
...@@ -156,28 +158,21 @@ void MacroAssembler::Call( ...@@ -156,28 +158,21 @@ void MacroAssembler::Call(
// ldr ip, [pc, #...] // ldr ip, [pc, #...]
// blx ip // blx ip
// The two instructions (ldr and blx) could be separated by a constant // Statement positions are expected to be recorded when the target
// pool and the code would still work. The issue comes from the // address is loaded. The mov method will automatically record
// patching code which expect the ldr to be just above the blx. // positions when pc is the target, since this is not the case here
{ BlockConstPoolScope block_const_pool(this); // we have to do it explicitly.
// Statement positions are expected to be recorded when the target positions_recorder()->WriteRecordedPositions();
// address is loaded. The mov method will automatically record
// positions when pc is the target, since this is not the case here
// we have to do it explicitly.
positions_recorder()->WriteRecordedPositions();
mov(ip, Operand(target, rmode), LeaveCC, cond); mov(ip, Operand(target, rmode), LeaveCC, cond);
blx(ip, cond); blx(ip, cond);
}
ASSERT(kCallTargetAddressOffset == 2 * kInstrSize); ASSERT(kCallTargetAddressOffset == 2 * kInstrSize);
#else #else
{ BlockConstPoolScope block_const_pool(this); // Set lr for return at current pc + 8.
// Set lr for return at current pc + 8. mov(lr, Operand(pc), LeaveCC, cond);
mov(lr, Operand(pc), LeaveCC, cond); // Emit a ldr<cond> pc, [pc + offset of target in constant pool].
// Emit a ldr<cond> pc, [pc + offset of target in constant pool]. mov(pc, Operand(target, rmode), LeaveCC, cond);
mov(pc, Operand(target, rmode), LeaveCC, cond);
}
ASSERT(kCallTargetAddressOffset == kInstrSize); ASSERT(kCallTargetAddressOffset == kInstrSize);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment