Bug 1233863 - ARM64: Record the correct branch offset. r=sstangl

Don't depend on nextOffset() to get the address of the next inserted
instruction. Adding a single instruction could cause a constant pool to be
emitted first.

The b() method assembles a branch and returns its offset. Use this return value
when recording the location of a pending jump.

This fixes the MOZ_CRASH(Unrecognized jump instruction.) crashes.
This commit is contained in:
Jakob Stoklund Olesen 2015-12-21 10:11:07 -08:00
parent d9a7e9b459
commit 9dce194b45

View File

@ -1346,8 +1346,8 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
}
void branch(JitCode* target) {
syncStackPtr();
addPendingJump(nextOffset(), ImmPtr(target->raw()), Relocation::JITCODE);
b(-1); // The jump target will be patched by executableCopy().
BufferOffset loc = b(-1); // The jump target will be patched by executableCopy().
addPendingJump(loc, ImmPtr(target->raw()), Relocation::JITCODE);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {