зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1279248 - Part 22: Implement the 64bit variant of AsmJSCall on x86, r=nbp
This commit is contained in:
Родитель
c9746ae01e
Коммит
2abc9da483
|
@ -4201,7 +4201,12 @@ LIRGenerator::visitAsmJSCall(MAsmJSCall* ins)
|
|||
useFixed(ins->callee().dynamicPtr(), WasmTableCallPtrReg);
|
||||
}
|
||||
|
||||
LInstruction* lir = new(alloc()) LAsmJSCall(args, ins->numOperands());
|
||||
LInstruction* lir;
|
||||
if (ins->type() == MIRType::Int64)
|
||||
lir = new(alloc()) LAsmJSCallI64(args, ins->numOperands());
|
||||
else
|
||||
lir = new(alloc()) LAsmJSCall(args, ins->numOperands());
|
||||
|
||||
if (ins->type() == MIRType::None)
|
||||
add(lir, ins);
|
||||
else
|
||||
|
|
|
@ -2095,12 +2095,12 @@ CodeGeneratorARM::visitAsmReinterpret(LAsmReinterpret* lir)
|
|||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM::visitAsmJSCall(LAsmJSCall* ins)
|
||||
CodeGeneratorARM::emitAsmJSCall(LAsmJSCallBase* ins)
|
||||
{
|
||||
MAsmJSCall* mir = ins->mir();
|
||||
|
||||
if (UseHardFpABI() || mir->callee().which() != MAsmJSCall::Callee::Builtin) {
|
||||
emitAsmJSCall(ins);
|
||||
emitAsmJSCallBase(ins);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2124,7 +2124,7 @@ CodeGeneratorARM::visitAsmJSCall(LAsmJSCall* ins)
|
|||
}
|
||||
}
|
||||
|
||||
emitAsmJSCall(ins);
|
||||
emitAsmJSCallBase(ins);
|
||||
|
||||
switch (mir->type()) {
|
||||
case MIRType::Double:
|
||||
|
@ -2138,6 +2138,18 @@ CodeGeneratorARM::visitAsmJSCall(LAsmJSCall* ins)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM::visitAsmJSCall(LAsmJSCall* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM::visitAsmJSCallI64(LAsmJSCallI64* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM::visitAsmJSLoadHeap(LAsmJSLoadHeap* ins)
|
||||
{
|
||||
|
|
|
@ -202,7 +202,9 @@ class CodeGeneratorARM : public CodeGeneratorShared
|
|||
void visitAtomicExchangeTypedArrayElement(LAtomicExchangeTypedArrayElement* lir);
|
||||
void visitAsmSelect(LAsmSelect* ins);
|
||||
void visitAsmReinterpret(LAsmReinterpret* ins);
|
||||
void emitAsmJSCall(LAsmJSCallBase* ins);
|
||||
void visitAsmJSCall(LAsmJSCall* ins);
|
||||
void visitAsmJSCallI64(LAsmJSCallI64* ins);
|
||||
void visitWasmBoundsCheck(LWasmBoundsCheck* ins);
|
||||
void visitWasmLoad(LWasmLoad* ins);
|
||||
void visitWasmStore(LWasmStore* ins);
|
||||
|
|
|
@ -640,7 +640,13 @@ CodeGeneratorARM64::visitStoreTypedArrayElementStatic(LStoreTypedArrayElementSta
|
|||
void
|
||||
CodeGeneratorARM64::visitAsmJSCall(LAsmJSCall* ins)
|
||||
{
|
||||
MOZ_CRASH("visitAsmJSCall");
|
||||
MOZ_CRASH("vistAsmJSCall");
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM64::visitAsmJSCallI64(LAsmJSCallI64* ins)
|
||||
{
|
||||
MOZ_CRASH("vistAsmJSCallI64");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -199,6 +199,7 @@ class CodeGeneratorARM64 : public CodeGeneratorShared
|
|||
void visitCompareExchangeTypedArrayElement(LCompareExchangeTypedArrayElement* lir);
|
||||
void visitAtomicExchangeTypedArrayElement(LAtomicExchangeTypedArrayElement* lir);
|
||||
void visitAsmJSCall(LAsmJSCall* ins);
|
||||
void visitAsmJSCallI64(LAsmJSCallI64* ins);
|
||||
void visitAsmJSLoadHeap(LAsmJSLoadHeap* ins);
|
||||
void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins);
|
||||
void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins);
|
||||
|
|
|
@ -1651,7 +1651,13 @@ CodeGeneratorMIPSShared::visitStoreTypedArrayElementStatic(LStoreTypedArrayEleme
|
|||
void
|
||||
CodeGeneratorMIPSShared::visitAsmJSCall(LAsmJSCall* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
emitAsmJSCallBase(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorMIPSShared::visitAsmJSCallI64(LAsmJSCallI64* ins)
|
||||
{
|
||||
emitAsmJSCallBase(ins);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -195,6 +195,7 @@ class CodeGeneratorMIPSShared : public CodeGeneratorShared
|
|||
void visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic* ins);
|
||||
void visitStoreTypedArrayElementStatic(LStoreTypedArrayElementStatic* ins);
|
||||
void visitAsmJSCall(LAsmJSCall* ins);
|
||||
void visitAsmJSCallI64(LAsmJSCallI64* ins);
|
||||
void visitWasmBoundsCheck(LWasmBoundsCheck* ins);
|
||||
void visitWasmLoad(LWasmLoad* ins);
|
||||
void visitWasmStore(LWasmStore* ins);
|
||||
|
|
|
@ -1489,7 +1489,7 @@ CodeGeneratorShared::omitOverRecursedCheck() const
|
|||
}
|
||||
|
||||
void
|
||||
CodeGeneratorShared::emitAsmJSCall(LAsmJSCall* ins)
|
||||
CodeGeneratorShared::emitAsmJSCallBase(LAsmJSCallBase* ins)
|
||||
{
|
||||
MAsmJSCall* mir = ins->mir();
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ class CodeGeneratorShared : public LElementVisitor
|
|||
void emitTruncateDouble(FloatRegister src, Register dest, MInstruction* mir);
|
||||
void emitTruncateFloat32(FloatRegister src, Register dest, MInstruction* mir);
|
||||
|
||||
void emitAsmJSCall(LAsmJSCall* ins);
|
||||
void emitAsmJSCallBase(LAsmJSCallBase* ins);
|
||||
|
||||
void emitPreBarrier(Register base, const LAllocation* index, int32_t offsetAdjustment);
|
||||
void emitPreBarrier(Address address);
|
||||
|
|
|
@ -8235,19 +8235,16 @@ class LAsmJSPassStackArgI64 : public LInstructionHelper<0, INT64_PIECES, 0>
|
|||
}
|
||||
};
|
||||
|
||||
class LAsmJSCall final : public LInstruction
|
||||
class LAsmJSCallBase : public LInstruction
|
||||
{
|
||||
LAllocation* operands_;
|
||||
uint32_t numOperands_;
|
||||
LDefinition def_;
|
||||
|
||||
public:
|
||||
LIR_HEADER(AsmJSCall);
|
||||
|
||||
LAsmJSCall(LAllocation* operands, uint32_t numOperands)
|
||||
LAsmJSCallBase(LAllocation* operands, uint32_t numOperands)
|
||||
: operands_(operands),
|
||||
numOperands_(numOperands),
|
||||
def_(LDefinition::BogusTemp())
|
||||
numOperands_(numOperands)
|
||||
{}
|
||||
|
||||
MAsmJSCall* mir() const {
|
||||
|
@ -8258,26 +8255,7 @@ class LAsmJSCall final : public LInstruction
|
|||
return true;
|
||||
}
|
||||
|
||||
bool isCallPreserved(AnyRegister reg) const {
|
||||
// WebAssembly functions preserve the TLS pointer register.
|
||||
if (reg.isFloat() || reg.gpr() != WasmTlsReg)
|
||||
return false;
|
||||
return mir()->preservesTlsReg();
|
||||
}
|
||||
|
||||
// LInstruction interface
|
||||
size_t numDefs() const {
|
||||
return def_.isBogusTemp() ? 0 : 1;
|
||||
}
|
||||
LDefinition* getDef(size_t index) {
|
||||
MOZ_ASSERT(numDefs() == 1);
|
||||
MOZ_ASSERT(index == 0);
|
||||
return &def_;
|
||||
}
|
||||
void setDef(size_t index, const LDefinition& def) {
|
||||
MOZ_ASSERT(index == 0);
|
||||
def_ = def;
|
||||
}
|
||||
size_t numOperands() const {
|
||||
return numOperands_;
|
||||
}
|
||||
|
@ -8309,6 +8287,69 @@ class LAsmJSCall final : public LInstruction
|
|||
}
|
||||
};
|
||||
|
||||
class LAsmJSCall : public LAsmJSCallBase
|
||||
{
|
||||
LDefinition def_;
|
||||
|
||||
public:
|
||||
LIR_HEADER(AsmJSCall);
|
||||
|
||||
LAsmJSCall(LAllocation* operands, uint32_t numOperands)
|
||||
: LAsmJSCallBase(operands, numOperands),
|
||||
def_(LDefinition::BogusTemp())
|
||||
{}
|
||||
|
||||
bool isCallPreserved(AnyRegister reg) const {
|
||||
// WebAssembly functions preserve the TLS pointer register.
|
||||
if (reg.isFloat() || reg.gpr() != WasmTlsReg)
|
||||
return false;
|
||||
return mir()->preservesTlsReg();
|
||||
}
|
||||
|
||||
// LInstruction interface
|
||||
size_t numDefs() const {
|
||||
return def_.isBogusTemp() ? 0 : 1;
|
||||
}
|
||||
LDefinition* getDef(size_t index) {
|
||||
MOZ_ASSERT(numDefs() == 1);
|
||||
MOZ_ASSERT(index == 0);
|
||||
return &def_;
|
||||
}
|
||||
void setDef(size_t index, const LDefinition& def) {
|
||||
MOZ_ASSERT(index == 0);
|
||||
def_ = def;
|
||||
}
|
||||
};
|
||||
|
||||
class LAsmJSCallI64 : public LAsmJSCallBase
|
||||
{
|
||||
LDefinition defs_[INT64_PIECES];
|
||||
|
||||
public:
|
||||
LIR_HEADER(AsmJSCallI64);
|
||||
|
||||
LAsmJSCallI64(LAllocation* operands, uint32_t numOperands)
|
||||
: LAsmJSCallBase(operands, numOperands)
|
||||
{
|
||||
for (size_t i = 0; i < numDefs(); i++) {
|
||||
defs_[i] = LDefinition::BogusTemp();
|
||||
}
|
||||
}
|
||||
|
||||
// LInstruction interface
|
||||
size_t numDefs() const {
|
||||
return INT64_PIECES;
|
||||
}
|
||||
LDefinition* getDef(size_t index) {
|
||||
MOZ_ASSERT(index < numDefs());
|
||||
return &defs_[index];
|
||||
}
|
||||
void setDef(size_t index, const LDefinition& def) {
|
||||
MOZ_ASSERT(index < numDefs());
|
||||
defs_[index] = def;
|
||||
}
|
||||
};
|
||||
|
||||
class LAssertRangeI : public LInstructionHelper<0, 1, 0>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -405,6 +405,7 @@
|
|||
_(AsmJSPassStackArg) \
|
||||
_(AsmJSPassStackArgI64) \
|
||||
_(AsmJSCall) \
|
||||
_(AsmJSCallI64) \
|
||||
_(AsmJSCompareExchangeHeap) \
|
||||
_(AsmJSAtomicExchangeHeap) \
|
||||
_(AsmJSAtomicBinopHeap) \
|
||||
|
|
|
@ -396,7 +396,13 @@ CodeGeneratorX64::visitStoreTypedArrayElementStatic(LStoreTypedArrayElementStati
|
|||
void
|
||||
CodeGeneratorX64::visitAsmJSCall(LAsmJSCall* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
emitAsmJSCallBase(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorX64::visitAsmJSCallI64(LAsmJSCallI64* ins)
|
||||
{
|
||||
emitAsmJSCallBase(ins);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -74,6 +74,7 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared
|
|||
void visitWasmStoreGlobalVarI64(LWasmStoreGlobalVarI64* ins);
|
||||
void visitAsmSelectI64(LAsmSelectI64* ins);
|
||||
void visitAsmJSCall(LAsmJSCall* ins);
|
||||
void visitAsmJSCallI64(LAsmJSCallI64* ins);
|
||||
void visitAsmJSLoadHeap(LAsmJSLoadHeap* ins);
|
||||
void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins);
|
||||
void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins);
|
||||
|
|
|
@ -315,13 +315,15 @@ CodeGeneratorX86::visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic*
|
|||
}
|
||||
|
||||
void
|
||||
CodeGeneratorX86::visitAsmJSCall(LAsmJSCall* ins)
|
||||
CodeGeneratorX86::emitAsmJSCall(LAsmJSCallBase* ins)
|
||||
{
|
||||
MAsmJSCall* mir = ins->mir();
|
||||
|
||||
emitAsmJSCall(ins);
|
||||
emitAsmJSCallBase(ins);
|
||||
|
||||
if (IsFloatingPointType(mir->type()) && mir->callee().which() == MAsmJSCall::Callee::Builtin) {
|
||||
if (IsFloatingPointType(mir->type()) &&
|
||||
mir->callee().which() == MAsmJSCall::Callee::Builtin)
|
||||
{
|
||||
if (mir->type() == MIRType::Float32) {
|
||||
masm.reserveStack(sizeof(float));
|
||||
Operand op(esp, 0);
|
||||
|
@ -339,6 +341,18 @@ CodeGeneratorX86::visitAsmJSCall(LAsmJSCall* ins)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorX86::visitAsmJSCall(LAsmJSCall* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorX86::visitAsmJSCallI64(LAsmJSCallI64* ins)
|
||||
{
|
||||
emitAsmJSCall(ins);
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorX86::memoryBarrier(MemoryBarrierBits barrier)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,9 @@ class CodeGeneratorX86 : public CodeGeneratorX86Shared
|
|||
void visitTruncateFToInt32(LTruncateFToInt32* ins);
|
||||
void visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic* ins);
|
||||
void visitStoreTypedArrayElementStatic(LStoreTypedArrayElementStatic* ins);
|
||||
void emitAsmJSCall(LAsmJSCallBase* ins);
|
||||
void visitAsmJSCall(LAsmJSCall* ins);
|
||||
void visitAsmJSCallI64(LAsmJSCallI64* ins);
|
||||
void visitWasmLoad(LWasmLoad* ins);
|
||||
void visitWasmStore(LWasmStore* ins);
|
||||
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
|
||||
|
|
Загрузка…
Ссылка в новой задаче