зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1303122: Handle stack in codegen of LCompareAndBranchI on x64; r=luke
MozReview-Commit-ID: EV5JUmcNYeh --HG-- extra : rebase_source : 85b3d15920ad2dc85bff70d4f94b9569c393ef47
This commit is contained in:
Родитель
e183b1ce5d
Коммит
8bcffcf0f7
|
@ -0,0 +1,30 @@
|
|||
// |jit-test| test-also-wasm-baseline
|
||||
load(libdir + "wasm.js");
|
||||
|
||||
// Register allocation issue with LCompareI64AndBranch.
|
||||
let params = '';
|
||||
let locals = '';
|
||||
let tests = '';
|
||||
|
||||
for (let i = 15; i --> 0;) {
|
||||
params += `\n(param i64)`;
|
||||
locals += `\n(local i64)`;
|
||||
tests = `
|
||||
(if
|
||||
(i64.eq
|
||||
(get_local ${i + 8})
|
||||
(get_local ${i})
|
||||
)
|
||||
(get_local ${i + 8})
|
||||
${tests}
|
||||
)`;
|
||||
}
|
||||
|
||||
let code = `(module
|
||||
(func $i64
|
||||
${params} ${locals}
|
||||
${tests}
|
||||
)
|
||||
)`
|
||||
|
||||
evalText(code);
|
|
@ -44,6 +44,16 @@ CodeGeneratorX64::ToTempValue(LInstruction* ins, size_t pos)
|
|||
return ValueOperand(ToRegister(ins->getTemp(pos)));
|
||||
}
|
||||
|
||||
Operand
|
||||
CodeGeneratorX64::ToOperand64(const LInt64Allocation& a64)
|
||||
{
|
||||
const LAllocation& a = a64.value();
|
||||
MOZ_ASSERT(!a.isFloatReg());
|
||||
if (a.isGeneralReg())
|
||||
return Operand(a.toGeneralReg()->reg());
|
||||
return Operand(masm.getStackPointer(), ToStackOffset(a));
|
||||
}
|
||||
|
||||
FrameSizeClass
|
||||
FrameSizeClass::FromDepth(uint32_t frameDepth)
|
||||
{
|
||||
|
@ -246,17 +256,14 @@ CodeGeneratorX64::visitCompareI64AndBranch(LCompareI64AndBranch* lir)
|
|||
MOZ_ASSERT(mir->compareType() == MCompare::Compare_Int64 ||
|
||||
mir->compareType() == MCompare::Compare_UInt64);
|
||||
|
||||
const LInt64Allocation lhs = lir->getInt64Operand(LCompareI64::Lhs);
|
||||
const LInt64Allocation rhs = lir->getInt64Operand(LCompareI64::Rhs);
|
||||
LInt64Allocation lhs = lir->getInt64Operand(LCompareI64::Lhs);
|
||||
LInt64Allocation rhs = lir->getInt64Operand(LCompareI64::Rhs);
|
||||
Register lhsReg = ToRegister64(lhs).reg;
|
||||
|
||||
if (IsConstant(rhs)) {
|
||||
ImmWord imm = ImmWord(ToInt64(rhs));
|
||||
masm.cmpPtr(lhsReg, imm);
|
||||
} else {
|
||||
Register rhsReg = ToRegister64(rhs).reg;
|
||||
masm.cmpPtr(lhsReg, Operand(rhsReg));
|
||||
}
|
||||
if (IsConstant(rhs))
|
||||
masm.cmpPtr(lhsReg, ImmWord(ToInt64(rhs)));
|
||||
else
|
||||
masm.cmpPtr(lhsReg, ToOperand64(rhs));
|
||||
|
||||
bool isSigned = mir->compareType() == MCompare::Compare_Int64;
|
||||
emitBranch(JSOpToCondition(lir->jsop(), isSigned), lir->ifTrue(), lir->ifFalse());
|
||||
|
|
|
@ -19,6 +19,7 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared
|
|||
}
|
||||
|
||||
protected:
|
||||
Operand ToOperand64(const LInt64Allocation& a);
|
||||
ValueOperand ToValue(LInstruction* ins, size_t pos);
|
||||
ValueOperand ToOutValue(LInstruction* ins);
|
||||
ValueOperand ToTempValue(LInstruction* ins, size_t pos);
|
||||
|
|
Загрузка…
Ссылка в новой задаче