Bug 1642265 - [MIPS64] Add branchTestSymbol and fallibleUnboxPtr to MacroAssembler. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D77629
This commit is contained in:
Zhao Jiazhong 2020-06-02 00:56:29 +00:00
Родитель e133fbe2f5
Коммит a7d6d429cc
2 изменённых файлов: 36 добавлений и 0 удалений

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

@ -741,6 +741,13 @@ void MacroAssembler::branchTestSymbol(Condition cond, const BaseIndex& address,
branchTestSymbol(cond, tag, label);
}
void MacroAssembler::branchTestSymbol(Condition cond, const Address& address,
Label* label) {
SecondScratchRegisterScope scratch2(*this);
Register tag = extractTag(address, scratch2);
branchTestSymbol(cond, tag, label);
}
void MacroAssembler::branchTestBigInt(Condition cond, Register tag,
Label* label) {
MOZ_ASSERT(cond == Equal || cond == NotEqual);

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

@ -649,6 +649,35 @@ void MacroAssembler::branchTruncateFloat32MaybeModUint32(FloatRegister src,
as_sll(dest, dest, 0);
}
void MacroAssembler::fallibleUnboxPtr(const ValueOperand& src, Register dest,
JSValueType type, Label* fail) {
MOZ_ASSERT(type == JSVAL_TYPE_OBJECT || type == JSVAL_TYPE_STRING ||
type == JSVAL_TYPE_SYMBOL || type == JSVAL_TYPE_BIGINT);
// dest := src XOR mask
// scratch := dest >> JSVAL_TAG_SHIFT
// fail if scratch != 0
//
// Note: src and dest can be the same register
ScratchRegisterScope scratch(asMasm());
mov(ImmWord(JSVAL_TYPE_TO_SHIFTED_TAG(type)), scratch);
ma_xor(scratch, src.valueReg());
ma_move(dest, scratch);
ma_dsrl(scratch, scratch, Imm32(JSVAL_TAG_SHIFT));
ma_b(scratch, Imm32(0), fail, Assembler::NotEqual);
}
void MacroAssembler::fallibleUnboxPtr(const Address& src, Register dest,
JSValueType type, Label* fail) {
loadValue(src, ValueOperand(dest));
fallibleUnboxPtr(ValueOperand(dest), dest, type, fail);
}
void MacroAssembler::fallibleUnboxPtr(const BaseIndex& src, Register dest,
JSValueType type, Label* fail) {
loadValue(src, ValueOperand(dest));
fallibleUnboxPtr(ValueOperand(dest), dest, type, fail);
}
//}}} check_macroassembler_style
// ===============================================================