mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-02 22:08:40 +09:00
Issue #2308 & #1240 Follow-up - Replace JSOP_POS in ++/-- with JSOP_TONUMERIC. https://bugzilla.mozilla.org/show_bug.cgi?id=1519135
This commit is contained in:
parent
2b637c564f
commit
209d714434
28 changed files with 251 additions and 77 deletions
|
|
@ -3415,6 +3415,48 @@ CodeGenerator::visitLoadUnboxedExpando(LLoadUnboxedExpando* lir)
|
|||
masm.loadPtr(Address(obj, UnboxedPlainObject::offsetOfExpando()), result);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenerator::visitToNumeric(LToNumeric* lir)
|
||||
{
|
||||
ValueOperand operand = ToValue(lir, LToNumeric::Input);
|
||||
ValueOperand output = ToOutValue(lir);
|
||||
bool maybeInt32 = lir->mir()->mightBeType(MIRType::Int32);
|
||||
bool maybeDouble = lir->mir()->mightBeType(MIRType::Double);
|
||||
bool maybeNumber = maybeInt32 || maybeDouble;
|
||||
bool maybeBigInt = lir->mir()->mightBeType(MIRType::BigInt);
|
||||
int checks = int(maybeNumber) + int(maybeBigInt);
|
||||
|
||||
OutOfLineCode* ool = oolCallVM(ToNumericInfo, lir, ArgList(operand), StoreValueTo(output));
|
||||
|
||||
if (checks == 0) {
|
||||
masm.jump(ool->entry());
|
||||
} else {
|
||||
Label done;
|
||||
using Condition = Assembler::Condition;
|
||||
constexpr Condition Equal = Assembler::Equal;
|
||||
constexpr Condition NotEqual = Assembler::NotEqual;
|
||||
|
||||
if (maybeNumber) {
|
||||
checks--;
|
||||
Condition cond = checks ? Equal : NotEqual;
|
||||
Label* target = checks ? &done : ool->entry();
|
||||
masm.branchTestNumber(cond, operand, target);
|
||||
}
|
||||
if (maybeBigInt) {
|
||||
checks--;
|
||||
Condition cond = checks ? Equal : NotEqual;
|
||||
Label* target = checks ? &done : ool->entry();
|
||||
masm.branchTestBigInt(cond, operand, target);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(checks == 0);
|
||||
masm.bind(&done);
|
||||
masm.moveValue(operand, output);
|
||||
}
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenerator::visitTypeBarrierV(LTypeBarrierV* lir)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue