Commit ea3b1891 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

We have to be sure to generate a relocatable instruction when

handling external references before a heap serialization.
Review URL: http://codereview.chromium.org/151080

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2310 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 20165a64
......@@ -491,6 +491,20 @@ static bool fits_shifter(uint32_t imm32,
}
// We have to use the temporary register for things that can be relocated even
// if they can be encoded in the ARM's 12 bits of immediate-offset instruction
// space. There is no guarantee that the relocated location can be similarly
// encoded.
static bool MustUseIp(RelocInfo::Mode rmode) {
if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
return Serializer::enabled();
} else if (rmode == RelocInfo::NONE) {
return false;
}
return true;
}
void Assembler::addrmod1(Instr instr,
Register rn,
Register rd,
......@@ -501,8 +515,7 @@ void Assembler::addrmod1(Instr instr,
// immediate
uint32_t rotate_imm;
uint32_t immed_8;
if ((x.rmode_ != RelocInfo::NONE &&
x.rmode_ != RelocInfo::EXTERNAL_REFERENCE) ||
if (MustUseIp(x.rmode_) ||
!fits_shifter(x.imm32_, &rotate_imm, &immed_8, &instr)) {
// The immediate operand cannot be encoded as a shifter operand, so load
// it first to register ip and change the original instruction to use ip.
......@@ -904,8 +917,7 @@ void Assembler::msr(SRegisterFieldMask fields, const Operand& src,
// immediate
uint32_t rotate_imm;
uint32_t immed_8;
if ((src.rmode_ != RelocInfo::NONE &&
src.rmode_ != RelocInfo::EXTERNAL_REFERENCE)||
if (MustUseIp(src.rmode_) ||
!fits_shifter(src.imm32_, &rotate_imm, &immed_8, NULL)) {
// immediate operand cannot be encoded, load it first to register ip
RecordRelocInfo(src.rmode_, src.imm32_);
......
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