Bug 1636916 part 2 - Add branchTestGCThing to the MacroAssembler. r=jonco

Depends on D74647

Differential Revision: https://phabricator.services.mozilla.com/D74648
This commit is contained in:
Jan de Mooij 2020-05-11 17:24:27 +00:00
Родитель 020463c39c
Коммит 5d0033b51b
7 изменённых файлов: 42 добавлений и 0 удалений

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

@ -1571,6 +1571,9 @@ class MacroAssembler : public MacroAssemblerSpecific {
Label* label) PER_SHARED_ARCH;
inline void branchTestGCThing(Condition cond, const BaseIndex& address,
Label* label) PER_SHARED_ARCH;
inline void branchTestGCThing(Condition cond, const ValueOperand& value,
Label* label)
DEFINED_ON(arm, arm64, x86_shared);
inline void branchTestPrimitive(Condition cond, const ValueOperand& value,
Label* label)

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

@ -1815,6 +1815,12 @@ void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
branchTestGCThingImpl(cond, address, label);
}
void MacroAssembler::branchTestGCThing(Condition cond,
const ValueOperand& value,
Label* label) {
branchTestGCThingImpl(cond, value, label);
}
template <typename T>
void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t,
Label* label) {

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

@ -2446,6 +2446,11 @@ Assembler::Condition MacroAssemblerARMCompat::testPrimitive(
return testPrimitive(cond, value.typeReg());
}
Assembler::Condition MacroAssemblerARMCompat::testGCThing(
Assembler::Condition cond, const ValueOperand& value) {
return testGCThing(cond, value.typeReg());
}
// Register-based tests.
Assembler::Condition MacroAssemblerARMCompat::testInt32(
Assembler::Condition cond, Register tag) {
@ -2517,6 +2522,13 @@ Assembler::Condition MacroAssemblerARMCompat::testPrimitive(
return cond == Equal ? Below : AboveOrEqual;
}
Assembler::Condition MacroAssemblerARMCompat::testGCThing(
Assembler::Condition cond, Register tag) {
MOZ_ASSERT(cond == Equal || cond == NotEqual);
ma_cmp(tag, ImmTag(JS::detail::ValueLowerInclGCThingTag));
return cond == Equal ? AboveOrEqual : Below;
}
Assembler::Condition MacroAssemblerARMCompat::testGCThing(
Assembler::Condition cond, const Address& address) {
MOZ_ASSERT(cond == Equal || cond == NotEqual);

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

@ -774,6 +774,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM {
Condition testMagic(Condition cond, const ValueOperand& value);
Condition testPrimitive(Condition cond, const ValueOperand& value);
Condition testGCThing(Condition cond, const ValueOperand& value);
// Register-based tests.
Condition testInt32(Condition cond, Register tag);
@ -788,6 +789,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM {
Condition testNumber(Condition cond, Register tag);
Condition testMagic(Condition cond, Register tag);
Condition testPrimitive(Condition cond, Register tag);
Condition testGCThing(Condition cond, Register tag);
Condition testGCThing(Condition cond, const Address& address);
Condition testMagic(Condition cond, const Address& address);

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

@ -1529,6 +1529,12 @@ void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
branchTestGCThingImpl(cond, address, label);
}
void MacroAssembler::branchTestGCThing(Condition cond,
const ValueOperand& value,
Label* label) {
branchTestGCThingImpl(cond, value, label);
}
template <typename T>
void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& src,
Label* label) {

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

@ -1638,6 +1638,13 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
splitSignExtTag(value, scratch);
return testMagic(cond, scratch);
}
Condition testGCThing(Condition cond, const ValueOperand& value) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
MOZ_ASSERT(value.valueReg() != scratch);
splitSignExtTag(value, scratch);
return testGCThing(cond, scratch);
}
Condition testError(Condition cond, const ValueOperand& value) {
return testMagic(cond, value);
}

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

@ -908,6 +908,12 @@ void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
branchTestGCThingImpl(cond, address, label);
}
void MacroAssembler::branchTestGCThing(Condition cond,
const ValueOperand& value,
Label* label) {
branchTestGCThingImpl(cond, value, label);
}
template <typename T>
void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t,
Label* label) {