Bug 1636916 part 1 - Rename unboxGCThingForPreBarrierTrampoline to unboxGCThingForGCBarrier. r=jonco

Also add ValueOperand overloads on 64-bit platforms.

A later patch will also call this for the post barrier.

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

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

@ -3353,7 +3353,7 @@ void MacroAssembler::emitPreBarrierFastPath(JSRuntime* rt, MIRType type,
// Load the GC thing in temp1.
if (type == MIRType::Value) {
unboxGCThingForPreBarrierTrampoline(Address(PreBarrierReg, 0), temp1);
unboxGCThingForGCBarrier(Address(PreBarrierReg, 0), temp1);
} else {
MOZ_ASSERT(type == MIRType::Object || type == MIRType::String ||
type == MIRType::Shape || type == MIRType::ObjectGroup);

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

@ -876,7 +876,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM {
void unboxValue(const ValueOperand& src, AnyRegister dest, JSValueType type);
// See comment in MacroAssembler-x64.h.
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
load32(ToPayload(src), dest);
}

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

@ -1392,11 +1392,15 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
}
// See comment in MacroAssembler-x64.h.
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
loadPtr(src, dest);
And(ARMRegister(dest, 64), ARMRegister(dest, 64),
Operand(JS::detail::ValueGCThingPayloadMask));
}
void unboxGCThingForGCBarrier(const ValueOperand& src, Register dest) {
And(ARMRegister(dest, 64), ARMRegister(src.valueReg(), 64),
Operand(JS::detail::ValueGCThingPayloadMask));
}
inline void unboxValue(const ValueOperand& src, AnyRegister dest,
JSValueType type);

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

@ -352,7 +352,7 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS {
void unboxObjectOrNull(const Address& src, Register dest);
void unboxValue(const ValueOperand& src, AnyRegister dest, JSValueType);
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
unboxObject(src, dest);
}

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

@ -379,7 +379,7 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 {
ma_dins(dest, zero, Imm32(JSVAL_TAG_SHIFT + 3), Imm32(1));
}
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
loadPtr(src, dest);
ma_dext(dest, dest, Imm32(0), Imm32(JSVAL_TAG_SHIFT));
}

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

@ -495,7 +495,8 @@ class MacroAssemblerNone : public Assembler {
MOZ_CRASH();
}
void unboxNonDouble(const Address&, Register, JSValueType) { MOZ_CRASH(); }
void unboxGCThingForPreBarrierTrampoline(const Address&, Register) {
template <typename T>
void unboxGCThingForGCBarrier(const T&, Register) {
MOZ_CRASH();
}
template <typename T>

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

@ -843,14 +843,19 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared {
andq(scratch, dest);
}
// This should only be used for the pre-barrier trampoline, to unbox a
// string/symbol/object Value. It's fine there because we don't depend on
// the actual Value type. In almost all other cases, this would be
// This should only be used for GC barrier code, to unbox a GC thing Value.
// It's fine there because we don't depend on the actual Value type (all Cells
// are treated the same way). In almost all other cases this would be
// Spectre-unsafe - use unboxNonDouble and friends instead.
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
movq(ImmWord(JS::detail::ValueGCThingPayloadMask), dest);
andq(Operand(src), dest);
}
void unboxGCThingForGCBarrier(const ValueOperand& src, Register dest) {
MOZ_ASSERT(src.valueReg() != dest);
movq(ImmWord(JS::detail::ValueGCThingPayloadMask), dest);
andq(src.valueReg(), dest);
}
// Extended unboxing API. If the payload is already in a register, returns
// that register. Otherwise, provides a move to the given scratch register,

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

@ -808,7 +808,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared {
JSValueType type);
// See comment in MacroAssembler-x64.h.
void unboxGCThingForPreBarrierTrampoline(const Address& src, Register dest) {
void unboxGCThingForGCBarrier(const Address& src, Register dest) {
movl(payloadOf(src), dest);
}