Backed out changeset 3d9f675232a0 (bug 1245112)

This commit is contained in:
Tooru Fujisawa 2016-02-16 00:23:52 +09:00
Родитель 56fa7909f5
Коммит 55fec6a1c2
21 изменённых файлов: 319 добавлений и 435 удалений

Просмотреть файл

@ -798,26 +798,6 @@ class MacroAssembler : public MacroAssemblerSpecific
// ===============================================================
// Branch functions
inline void branch32(Condition cond, Register lhs, Register rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, Register lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
inline void branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
inline void branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label)
DEFINED_ON(x86_shared);
inline void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
inline void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label)
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
inline void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) PER_SHARED_ARCH;
inline void branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
inline void branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label) PER_SHARED_ARCH;

Просмотреть файл

@ -393,98 +393,6 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
// ===============================================================
// Branch functions
void
MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label)
{
ma_cmp(lhs, rhs);
ma_b(label, cond);
}
void
MacroAssembler::branch32(Condition cond, Register lhs, Imm32 rhs, Label* label)
{
ma_cmp(lhs, rhs);
ma_b(label, cond);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label)
{
ScratchRegisterScope scratch(*this);
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label)
{
// branch32 will use ScratchRegister.
AutoRegisterScope scratch(*this, secondScratchReg_);
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{
AutoRegisterScope scratch2(*this, secondScratchReg_);
loadPtr(lhs, scratch2); // ma_cmp will use the scratch register.
ma_cmp(scratch2, rhs);
ma_b(label, cond);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
{
AutoRegisterScope scratch2(*this, secondScratchReg_);
loadPtr(lhs, scratch2); // ma_cmp will use the scratch register.
ma_cmp(scratch2, rhs);
ma_b(label, cond);
}
void
MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label)
{
// branch32 will use ScratchRegister.
AutoRegisterScope scratch2(*this, secondScratchReg_);
load32(lhs, scratch2);
branch32(cond, scratch2, rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label)
{
if (lhs.getTag() == Operand::OP2) {
branch32(cond, lhs.toReg(), rhs, label);
} else {
ScratchRegisterScope scratch(*this);
ma_ldr(lhs.toAddress(), scratch);
branch32(cond, scratch, rhs, label);
}
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label)
{
if (lhs.getTag() == Operand::OP2) {
branch32(cond, lhs.toReg(), rhs, label);
} else {
// branch32 will use ScratchRegister.
AutoRegisterScope scratch(*this, secondScratchReg_);
ma_ldr(lhs.toAddress(), scratch);
branch32(cond, scratch, rhs, label);
}
}
void
MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label)
{
ScratchRegisterScope scratch(*this);
loadPtr(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -3589,13 +3589,11 @@ MacroAssemblerARMCompat::handleFailureWithHandlerTail(void* handler)
Label bailout;
ma_ldr(Address(sp, offsetof(ResumeFromException, kind)), r0);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME),
&entryFrame);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN),
&return_);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.
@ -3646,8 +3644,7 @@ MacroAssemblerARMCompat::handleFailureWithHandlerTail(void* handler)
Label skipProfilingInstrumentation;
// Test if profiler enabled.
AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled());
asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0),
&skipProfilingInstrumentation);
branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
profilerExitFrame();
bind(&skipProfilingInstrumentation);
}
@ -4122,8 +4119,8 @@ MacroAssemblerARMCompat::branchPtrInNurseryRange(Condition cond, Register ptr, R
ma_mov(Imm32(startChunk), scratch2);
as_rsb(scratch2, scratch2, lsr(ptr, Nursery::ChunkShift));
asMasm().branch32(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
scratch2, Imm32(nursery.numChunks()), label);
branch32(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
scratch2, Imm32(nursery.numChunks()), label);
}
void

Просмотреть файл

@ -774,6 +774,50 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
Condition c = testBoolean(cond, t);
ma_b(label, c);
}
void branch32(Condition cond, Register lhs, Register rhs, Label* label) {
ma_cmp(lhs, rhs);
ma_b(label, cond);
}
void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) {
ma_cmp(lhs, imm);
ma_b(label, cond);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {
if (lhs.getTag() == Operand::OP2) {
branch32(cond, lhs.toReg(), rhs, label);
} else {
ScratchRegisterScope scratch(asMasm());
ma_ldr(lhs.toAddress(), scratch);
branch32(cond, scratch, rhs, label);
}
}
void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) {
if (lhs.getTag() == Operand::OP2) {
branch32(cond, lhs.toReg(), rhs, label);
} else {
// branch32 will use ScratchRegister.
AutoRegisterScope scratch(asMasm(), secondScratchReg_);
ma_ldr(lhs.toAddress(), scratch);
branch32(cond, scratch, rhs, label);
}
}
void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) {
ScratchRegisterScope scratch(asMasm());
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) {
// branch32 will use ScratchRegister.
AutoRegisterScope scratch(asMasm(), secondScratchReg_);
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) {
// branch32 will use ScratchRegister.
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
load32(lhs, scratch2);
branch32(cond, scratch2, rhs, label);
}
template<typename T>
void branchTestDouble(Condition cond, const T & t, Label* label) {
@ -898,6 +942,24 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
ma_cmp(scratch2, ptr);
return jumpWithPatch(label, cond);
}
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
loadPtr(lhs, scratch2); // ma_cmp will use the scratch register.
ma_cmp(scratch2, rhs);
ma_b(label, cond);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
loadPtr(lhs, scratch2); // ma_cmp will use the scratch register.
ma_cmp(scratch2, rhs);
ma_b(label, cond);
}
void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) {
ScratchRegisterScope scratch(asMasm());
loadPtr(addr, scratch);
ma_cmp(scratch, imm);
ma_b(label, cond);
}
void loadUnboxedValue(Address address, MIRType type, AnyRegister dest) {
if (dest.isFloat())

Просмотреть файл

@ -438,96 +438,6 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
// ===============================================================
// Branch functions
void
MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label)
{
cmp32(lhs, rhs);
B(label, cond);
}
void
MacroAssembler::branch32(Condition cond, Register lhs, Imm32 imm, Label* label)
{
cmp32(lhs, imm);
B(label, cond);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
MOZ_ASSERT(scratch != lhs.base);
MOZ_ASSERT(scratch != rhs);
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
MOZ_ASSERT(scratch != lhs.base);
load32(lhs, scratch);
branch32(cond, scratch, imm, label);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const ARMRegister scratch32 = temps.AcquireW();
MOZ_ASSERT(scratch32.asUnsized() != lhs.base);
MOZ_ASSERT(scratch32.asUnsized() != lhs.index);
doBaseIndex(scratch32, lhs, vixl::LDR_w);
branch32(cond, scratch32.asUnsized(), rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label)
{
// since rhs is an operand, do the compare backwards
Cmp(ARMRegister(rhs, 32), lhs);
B(label, Assembler::InvertCmpCondition(cond));
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label)
{
ARMRegister l = lhs.reg();
Cmp(l, Operand(rhs.value));
B(label, cond);
}
void
MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label)
{
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(lhs, scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -156,13 +156,11 @@ MacroAssemblerCompat::handleFailureWithHandlerTail(void* handler)
MOZ_ASSERT(GetStackPointer64().Is(x28)); // Lets the code below be a little cleaner.
loadPtr(Address(r28, offsetof(ResumeFromException, kind)), r0);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME),
&entryFrame);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN),
&return_);
asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.

Просмотреть файл

@ -1357,6 +1357,66 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
addPendingJump(loc, ImmPtr(target->raw()), Relocation::JITCODE);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {
// since rhs is an operand, do the compare backwards
Cmp(ARMRegister(rhs, 32), lhs);
B(label, Assembler::InvertCmpCondition(cond));
}
void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) {
ARMRegister l = lhs.reg();
Cmp(l, Operand(rhs.value));
B(label, cond);
}
void branch32(Condition cond, Register lhs, Register rhs, Label* label) {
cmp32(lhs, rhs);
B(label, cond);
}
void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) {
cmp32(lhs, imm);
B(label, cond);
}
void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
MOZ_ASSERT(scratch != lhs.base);
MOZ_ASSERT(scratch != rhs);
load32(lhs, scratch);
branch32(cond, scratch, rhs, label);
}
void branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
MOZ_ASSERT(scratch != lhs.base);
load32(lhs, scratch);
branch32(cond, scratch, imm, label);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
movePtr(lhs, scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void branch32(Condition cond, BaseIndex lhs, Imm32 rhs, Label* label) {
vixl::UseScratchRegisterScope temps(this);
const ARMRegister scratch32 = temps.AcquireW();
MOZ_ASSERT(scratch32.asUnsized() != lhs.base);
MOZ_ASSERT(scratch32.asUnsized() != lhs.index);
doBaseIndex(scratch32, lhs, vixl::LDR_w);
branch32(cond, scratch32.asUnsized(), rhs, label);
}
template <class L>
void branchTest32(Condition cond, Register lhs, Register rhs, L label) {
MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned);

Просмотреть файл

@ -194,78 +194,6 @@ MacroAssembler::negateDouble(FloatRegister reg)
// ===============================================================
// Branch functions
void
MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label)
{
ma_b(lhs, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, Register lhs, Imm32 imm, Label* label)
{
ma_b(lhs, imm, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label)
{
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label)
{
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
{
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label)
{
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label)
{
if (lhs.getTag() == Operand::REG)
ma_b(lhs.toReg(), rhs, label, cond);
else
branch32(cond, lhs.toAddress(), rhs, label);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label)
{
if (lhs.getTag() == Operand::REG)
ma_b(lhs.toReg(), rhs, label, cond);
else
branch32(cond, lhs.toAddress(), rhs, label);
}
void
MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label)
{
load32(addr, SecondScratchReg);
ma_b(SecondScratchReg, imm, label, cond);
}
void
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -1088,7 +1088,7 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
Label outOfRange;
branchTruncateDouble(input, output, &outOfRange);
asMasm().branch32(Assembler::Above, output, Imm32(255), &outOfRange);
branch32(Assembler::Above, output, Imm32(255), &outOfRange);
{
// Check if we had a tie.
convertInt32ToDouble(output, ScratchDoubleReg);
@ -2178,13 +2178,11 @@ MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(void* handler)
// Already clobbered a0, so use it...
load32(Address(StackPointer, offsetof(ResumeFromException, kind)), a0);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME),
&entryFrame);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN),
&return_);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.
@ -2238,8 +2236,7 @@ MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(void* handler)
Label skipProfilingInstrumentation;
// Test if profiler enabled.
AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled());
asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0),
&skipProfilingInstrumentation);
branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
profilerExitFrame();
bind(&skipProfilingInstrumentation);
}

Просмотреть файл

@ -383,6 +383,38 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
void branchTestBoolean(Condition cond, const Address& address, Label* label);
void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label);
void branch32(Condition cond, Register lhs, Register rhs, Label* label) {
ma_b(lhs, rhs, label, cond);
}
void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) {
ma_b(lhs, imm, label, cond);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {
if (lhs.getTag() == Operand::REG) {
ma_b(lhs.toReg(), rhs, label, cond);
} else {
branch32(cond, lhs.toAddress(), rhs, label);
}
}
void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) {
if (lhs.getTag() == Operand::REG) {
ma_b(lhs.toReg(), rhs, label, cond);
} else {
branch32(cond, lhs.toAddress(), rhs, label);
}
}
void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branchTestDouble(Condition cond, const ValueOperand& value, Label* label);
void branchTestDouble(Condition cond, Register tag, Label* label);
@ -519,6 +551,18 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
bind(&skipJump);
return off;
}
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) {
load32(addr, SecondScratchReg);
ma_b(SecondScratchReg, imm, label, cond);
}
void loadUnboxedValue(Address address, MIRType type, AnyRegister dest) {
if (dest.isFloat())

Просмотреть файл

@ -1228,7 +1228,7 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
Label outOfRange;
branchTruncateDouble(input, output, &outOfRange);
asMasm().branch32(Assembler::Above, output, Imm32(255), &outOfRange);
branch32(Assembler::Above, output, Imm32(255), &outOfRange);
{
// Check if we had a tie.
convertInt32ToDouble(output, ScratchDoubleReg);
@ -2335,13 +2335,11 @@ MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(void* handler)
// Already clobbered a0, so use it...
load32(Address(StackPointer, offsetof(ResumeFromException, kind)), a0);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME),
&entryFrame);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN),
&return_);
asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.
@ -2395,8 +2393,7 @@ MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(void* handler)
Label skipProfilingInstrumentation;
// Test if profiler enabled.
AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled());
asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0),
&skipProfilingInstrumentation);
branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
profilerExitFrame();
bind(&skipProfilingInstrumentation);
}

Просмотреть файл

@ -424,6 +424,38 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
void branchTestBoolean(Condition cond, const Address& address, Label* label);
void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label);
void branch32(Condition cond, Register lhs, Register rhs, Label* label) {
ma_b(lhs, rhs, label, cond);
}
void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) {
ma_b(lhs, imm, label, cond);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {
if (lhs.getTag() == Operand::REG) {
ma_b(lhs.toReg(), rhs, label, cond);
} else {
branch32(cond, lhs.toAddress(), rhs, label);
}
}
void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) {
if (lhs.getTag() == Operand::REG) {
ma_b(lhs.toReg(), rhs, label, cond);
} else {
branch32(cond, lhs.toAddress(), rhs, label);
}
}
void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branchTestDouble(Condition cond, const ValueOperand& value, Label* label);
void branchTestDouble(Condition cond, Register tag, Label* label);
@ -552,6 +584,18 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
bind(&skipJump);
return off;
}
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
load32(lhs, SecondScratchReg);
ma_b(SecondScratchReg, rhs, label, cond);
}
void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) {
load32(addr, SecondScratchReg);
ma_b(SecondScratchReg, imm, label, cond);
}
template <typename T>
void loadUnboxedValue(const T& address, MIRType type, AnyRegister dest) {

Просмотреть файл

@ -244,6 +244,7 @@ class MacroAssemblerNone : public Assembler
template <typename T, typename S> void cmpPtrSet(Condition, T, S, Register) { MOZ_CRASH(); }
template <typename T, typename S> void cmp32Set(Condition, T, S, Register) { MOZ_CRASH(); }
template <typename T, typename S> void branch32(Condition, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S, typename L> void branchTest32(Condition, T, S, L) { MOZ_CRASH(); }
template <typename T, typename S> void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); }
template <typename T, typename S> void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); }

Просмотреть файл

@ -222,37 +222,6 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
// ===============================================================
// Branch functions
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
branch32(cond, Operand(lhs), rhs, label);
} else {
ScratchRegisterScope scratch(*this);
mov(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
{
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
branch32(cond, Operand(lhs), rhs, label);
} else {
ScratchRegisterScope scratch(*this);
mov(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
}
void
MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label)
{
ScratchRegisterScope scratch(*this);
mov(lhs, scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -159,11 +159,11 @@ MacroAssemblerX64::handleFailureWithHandlerTail(void* handler)
Label bailout;
loadPtr(Address(rsp, offsetof(ResumeFromException, kind)), rax);
asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.
@ -210,7 +210,7 @@ MacroAssemblerX64::handleFailureWithHandlerTail(void* handler)
{
Label skipProfilingInstrumentation;
AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled());
asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
profilerExitFrame();
bind(&skipProfilingInstrumentation);
}

Просмотреть файл

@ -42,6 +42,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
void bindOffsets(const MacroAssemblerX86Shared::UsesVector&);
public:
using MacroAssemblerX86Shared::branch32;
using MacroAssemblerX86Shared::branchTest32;
using MacroAssemblerX86Shared::load32;
using MacroAssemblerX86Shared::store32;
@ -527,6 +528,29 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
// Common interface.
/////////////////////////////////////////////////////////////////
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
branch32(cond, Operand(lhs), rhs, label);
} else {
ScratchRegisterScope scratch(asMasm());
mov(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
}
void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) {
ScratchRegisterScope scratch(asMasm());
mov(lhs, scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
branch32(cond, Operand(lhs), rhs, label);
} else {
ScratchRegisterScope scratch(asMasm());
mov(ImmPtr(lhs.addr), scratch);
branch32(cond, Address(scratch, 0), rhs, label);
}
}
void branchTest32(Condition cond, AbsoluteAddress address, Imm32 imm, Label* label) {
if (X86Encoding::IsAddressImmediate(address.addr)) {
test32(Operand(address), imm);

Просмотреть файл

@ -183,62 +183,6 @@ MacroAssembler::negateDouble(FloatRegister reg)
// ===============================================================
// Branch instructions
void
MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label)
{
cmp32(lhs, rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, Register lhs, Imm32 rhs, Label* label)
{
cmp32(lhs, rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label)
{
cmp32(lhs, rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label)
{
cmp32(lhs, rhs);
j(cond, label);
}
void
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -568,6 +568,38 @@ class MacroAssemblerX86Shared : public Assembler
cmpw(rhs, lhs);
j(cond, label);
}
void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) {
cmp32(lhs, rhs);
j(cond, label);
}
void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) {
cmp32(lhs, rhs);
j(cond, label);
}
void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) {
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label) {
cmp32(Operand(lhs), imm);
j(cond, label);
}
void branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label) {
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void branch32(Condition cond, const BaseIndex& lhs, Imm32 imm, Label* label) {
cmp32(Operand(lhs), imm);
j(cond, label);
}
void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) {
cmp32(lhs, imm);
j(cond, label);
}
void branch32(Condition cond, Register lhs, Register rhs, Label* label) {
cmp32(lhs, rhs);
j(cond, label);
}
void branchTest16(Condition cond, Register lhs, Register rhs, Label* label) {
testw(rhs, lhs);
j(cond, label);

Просмотреть файл

@ -258,27 +258,6 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
// ===============================================================
// Branch functions
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label)
{
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void
MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label)
{
cmpl(rhs, lhs);
j(cond, label);
}
void
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
{

Просмотреть файл

@ -203,13 +203,11 @@ MacroAssemblerX86::handleFailureWithHandlerTail(void* handler)
Label bailout;
loadPtr(Address(esp, offsetof(ResumeFromException, kind)), eax);
asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME),
&entryFrame);
asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FORCED_RETURN),
&return_);
asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame);
branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_CATCH), &catch_);
branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FINALLY), &finally);
branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_);
branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout);
breakpoint(); // Invalid kind.
@ -257,8 +255,7 @@ MacroAssemblerX86::handleFailureWithHandlerTail(void* handler)
Label skipProfilingInstrumentation;
// Test if profiler enabled.
AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled());
asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0),
&skipProfilingInstrumentation);
branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
profilerExitFrame();
bind(&skipProfilingInstrumentation);
}

Просмотреть файл

@ -50,6 +50,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
void setupABICall(uint32_t args);
public:
using MacroAssemblerX86Shared::branch32;
using MacroAssemblerX86Shared::branchTest32;
using MacroAssemblerX86Shared::load32;
using MacroAssemblerX86Shared::store32;
@ -551,6 +552,18 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
// Common interface.
/////////////////////////////////////////////////////////////////
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) {
cmpl(rhs, lhs);
j(cond, label);
}
void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
cmp32(Operand(lhs), rhs);
j(cond, label);
}
void branchTest32(Condition cond, AbsoluteAddress address, Imm32 imm, Label* label) {
test32(Operand(address), imm);
j(cond, label);