mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Further fixes
Further fixes
This commit is contained in:
parent
f57bf9f4d5
commit
54a59df1d0
6 changed files with 81 additions and 11 deletions
|
|
@ -31,6 +31,24 @@
|
|||
using namespace js;
|
||||
using namespace js::jit;
|
||||
|
||||
template <typename T>
|
||||
void branchTestStringHelper(MacroAssembler& masm, Assembler::Condition cond, const T& src, Label* label) {
|
||||
if constexpr (std::is_same_v<T, ValueOperand>) {
|
||||
masm.branchTestString(cond, src, label);
|
||||
} else {
|
||||
// Address/BaseIndex must be wrapped in Operand for the x64 brancher
|
||||
masm.branchTestString(cond, Operand(src), label);
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
void UnboxStringHelper(MacroAssembler* masm, const T& src, Register dest) {
|
||||
if constexpr (std::is_same_v<T, ValueOperand>) {
|
||||
masm->unboxString(src, dest);
|
||||
} else {
|
||||
masm->unboxString(Operand(src), dest);
|
||||
}
|
||||
}
|
||||
|
||||
using JS::GenericNaN;
|
||||
using JS::ToInt32;
|
||||
|
||||
|
|
|
|||
|
|
@ -205,6 +205,30 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
return this;
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
void branchTestStringHelper(Assembler::Condition cond, const T& src, Label* label) {
|
||||
if constexpr (std::is_same_v<T, ValueOperand>) {
|
||||
this->branchTestString(cond, src, label);
|
||||
} else if constexpr (std::is_same_v<T, Address>) {
|
||||
// Use the Address-specific path instead of wrapping in Operand
|
||||
// This avoids the C2665 "cannot convert Operand" error
|
||||
this->branchTest32(cond, src, Imm32(JSString::TYPE_FLAGS_MASK), label);
|
||||
} else {
|
||||
// Fallback for other types (like Register)
|
||||
this->branchTestString(cond, src, label);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void UnboxStringHelper(const T& src, Register dest) {
|
||||
if constexpr (std::is_same_v<T, ValueOperand>) {
|
||||
this->unboxString(src, dest);
|
||||
} else {
|
||||
this->unboxString(Operand(src), dest);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
class AutoRooter : public JS::AutoGCRooter
|
||||
{
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ MacroAssembler::branchValueIsNurseryCellImpl(Condition cond, const T& value, Reg
|
|||
branchTestObject(Assembler::Equal, tag, &checkObjectAddress);
|
||||
branchTestString(Assembler::NotEqual, tag, cond == Assembler::Equal ? &done : label);
|
||||
|
||||
unboxString(value, temp);
|
||||
UnboxStringHelper(value, temp);
|
||||
jump(&checkAddress);
|
||||
|
||||
bind(&checkObjectAddress);
|
||||
|
|
|
|||
|
|
@ -436,6 +436,15 @@ MacroAssembler::callWithABINoProfiler(const Address& fun, MoveOp::Type result)
|
|||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::loadStoreBuffer(Register ptr, Register buffer)
|
||||
{
|
||||
if (ptr != buffer)
|
||||
movePtr(ptr, buffer);
|
||||
orPtr(Imm32(gc::ChunkMask), buffer);
|
||||
loadPtr(Address(buffer, gc::ChunkStoreBufferOffsetFromLastByte), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtrInNurseryChunk(Condition cond, Register ptr, Register temp,
|
||||
Label* label)
|
||||
|
|
@ -465,20 +474,6 @@ MacroAssembler::branchPtrInNurseryChunkImpl(Condition cond, Register ptr, Label*
|
|||
Imm32(int32_t(gc::ChunkLocation::Nursery)), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchValueIsNurseryObject(Condition cond, const Address& address, Register temp,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
|
||||
|
||||
Label done;
|
||||
|
||||
branchTestObject(Assembler::NotEqual, address, cond == Assembler::Equal ? &done : label);
|
||||
branchPtrInNurseryChunk(cond, address, temp, label);
|
||||
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
|
||||
Label* label)
|
||||
|
|
@ -493,6 +488,40 @@ MacroAssembler::branchValueIsNurseryObject(Condition cond, ValueOperand value, R
|
|||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchValueIsNurseryCell(Condition cond, const Address& address, Register temp,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
|
||||
Label done, checkAddress;
|
||||
|
||||
Register tag = extractTag(address, temp);
|
||||
MOZ_ASSERT(tag == temp);
|
||||
branchTestObject(Assembler::Equal, tag, &checkAddress);
|
||||
branchTestString(Assembler::NotEqual, tag, cond == Assembler::Equal ? &done : label);
|
||||
|
||||
bind(&checkAddress);
|
||||
branchPtrInNurseryChunk(cond, ToPayload(address), temp, label);
|
||||
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchValueIsNurseryCell(Condition cond, ValueOperand value, Register temp,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual);
|
||||
Label done, checkAddress;
|
||||
|
||||
branchTestObject(Assembler::Equal, value, &checkAddress);
|
||||
branchTestString(Assembler::NotEqual, value, cond == Assembler::Equal ? &done : label);
|
||||
|
||||
bind(&checkAddress);
|
||||
branchPtrInNurseryChunk(cond, value.payloadReg(), temp, label);
|
||||
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestValue(Condition cond, const ValueOperand& lhs,
|
||||
const Value& rhs, Label* label)
|
||||
|
|
|
|||
|
|
@ -488,7 +488,6 @@ JSRope::flattenInternal(ExclusiveContext* maybecx)
|
|||
}
|
||||
str->setNonInlineChars(wholeChars);
|
||||
pos = wholeChars + left.d.u1.length;
|
||||
JS_STATIC_ASSERT(!(EXTENSIBLE_FLAGS & DEPENDENT_FLAGS));
|
||||
left.d.u1.flags ^= (EXTENSIBLE_FLAGS | DEPENDENT_FLAGS);
|
||||
left.d.s.u3.base = (JSLinearString*)this; /* will be true on exit */
|
||||
BarrierMethods<JSString*>::postBarrier((JSString**)&left.d.s.u3.base, nullptr, this);
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ UnboxedLayout::makeConstructorCode(JSContext* cx, HandleObjectGroup group)
|
|||
} else {
|
||||
MOZ_ASSERT(property.type == JSVAL_TYPE_STRING);
|
||||
Label notString;
|
||||
masm.branchTestString(Assembler::NotEqual, valueAddress, ¬String);
|
||||
masm.unboxString(valueAddress, scratch1);
|
||||
masm.branchTestStringHelper(Assembler::NotEqual, valueAddress, ¬String);
|
||||
masm.UnboxStringHelper(valueAddress, scratch1);
|
||||
masm.branchPtrInNurseryChunk(Assembler::Equal, scratch1, scratch2, &postBarrier);
|
||||
masm.bind(¬String);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue