Backed out 2 changesets (bug 1286517) for SM(arm) bustage CLOSED TREE

Backed out changeset f4f17f746d10 (bug 1286517)
Backed out changeset aa1eab6436ba (bug 1286517)
This commit is contained in:
Wes Kocher 2016-07-20 12:28:22 -07:00
parent d95537ea88
commit 39bf9cdc6e
25 changed files with 131 additions and 141 deletions

View File

@ -2062,7 +2062,7 @@ class BaseCompiler
{
ScratchI32 scratch(*this);
CodeOffset label = masm.loadRipRelativeInt64(scratch);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
masm.loadPtr(Operand(scratch, ptrReg, ScalePointer, 0), ptrReg);
}
#elif defined(JS_CODEGEN_X86)
@ -2070,7 +2070,7 @@ class BaseCompiler
{
ScratchI32 scratch(*this);
CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), scratch);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
masm.loadPtr(Operand(scratch, ptrReg, ScalePointer), ptrReg);
}
#else
@ -2089,11 +2089,11 @@ class BaseCompiler
#if defined(JS_CODEGEN_X64)
// CodeGeneratorX64::visitAsmJSLoadFFIFunc()
CodeOffset label = masm.loadRipRelativeInt64(ptrReg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
// CodeGeneratorX86::visitAsmJSLoadFFIFunc()
CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), ptrReg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: ffiCall");
#endif
@ -2665,10 +2665,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.loadRipRelativeInt32(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: loadGlobalVarI32");
#endif
@ -2678,7 +2678,7 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.loadRipRelativeInt64(r.reg.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: loadGlobalVarI64");
#endif
@ -2688,10 +2688,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.loadRipRelativeFloat32(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.vmovssWithPatch(PatchedAbsoluteAddress(), r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: loadGlobalVarF32");
#endif
@ -2701,10 +2701,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.loadRipRelativeDouble(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.vmovsdWithPatch(PatchedAbsoluteAddress(), r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: loadGlobalVarF32");
#endif
@ -2716,10 +2716,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.storeRipRelativeInt32(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.movlWithPatch(r.reg, PatchedAbsoluteAddress());
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: storeGlobalVarI32");
#endif
@ -2729,7 +2729,7 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.storeRipRelativeInt64(r.reg.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: storeGlobalVarI64");
#endif
@ -2739,10 +2739,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.storeRipRelativeFloat32(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.vmovssWithPatch(r.reg, PatchedAbsoluteAddress());
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: storeGlobalVarF32");
#endif
@ -2752,10 +2752,10 @@ class BaseCompiler
{
#if defined(JS_CODEGEN_X64)
CodeOffset label = masm.storeRipRelativeDouble(r.reg);
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffset label = masm.vmovsdWithPatch(r.reg, PatchedAbsoluteAddress());
masm.append(GlobalAccess(label, globalDataOffset));
masm.append(AsmJSGlobalAccess(label, globalDataOffset));
#else
MOZ_CRASH("BaseCompiler platform hook: storeGlobalVarF64");
#endif

View File

@ -517,7 +517,8 @@ ModuleGenerator::finishLinkData(Bytes& code)
// Global data accesses in x86 need to be patched with the absolute
// address of the global. Globals are allocated sequentially after the
// code section so we can just use an InternalLink.
for (GlobalAccess a : masm_.globalAccesses()) {
for (size_t i = 0; i < masm_.numAsmJSGlobalAccesses(); i++) {
AsmJSGlobalAccess a = masm_.asmJSGlobalAccess(i);
LinkData::InternalLink inLink(LinkData::InternalLink::RawPointer);
inLink.patchAtOffset = masm_.labelToPatchOffset(a.patchAt);
inLink.targetOffset = code.length() + a.globalDataOffset;
@ -527,14 +528,15 @@ ModuleGenerator::finishLinkData(Bytes& code)
#elif defined(JS_CODEGEN_X64)
// Global data accesses on x64 use rip-relative addressing and thus we can
// patch here, now that we know the final codeLength.
for (GlobalAccess a : masm_.globalAccesses()) {
for (size_t i = 0; i < masm_.numAsmJSGlobalAccesses(); i++) {
AsmJSGlobalAccess a = masm_.asmJSGlobalAccess(i);
void* from = code.begin() + a.patchAt.offset();
void* to = code.end() + a.globalDataOffset;
X86Encoding::SetRel32(from, to);
}
#else
// Global access is performed using the GlobalReg and requires no patching.
MOZ_ASSERT(masm_.globalAccesses().length() == 0);
MOZ_ASSERT(masm_.numAsmJSGlobalAccesses() == 0);
#endif
return true;

View File

@ -696,7 +696,7 @@ class FunctionCompiler
if (inDeadCode())
return nullptr;
auto* load = MWasmLoadGlobalVar::New(alloc(), type, globalDataOffset, isConst);
auto* load = MAsmJSLoadGlobalVar::New(alloc(), type, globalDataOffset, isConst);
curBlock_->add(load);
return load;
}
@ -705,7 +705,7 @@ class FunctionCompiler
{
if (inDeadCode())
return;
curBlock_->add(MWasmStoreGlobalVar::New(alloc(), globalDataOffset, v));
curBlock_->add(MAsmJSStoreGlobalVar::New(alloc(), globalDataOffset, v));
}
void addInterruptCheck()

View File

@ -564,9 +564,9 @@ wasm::GenerateJitExit(MacroAssembler& masm, const FuncImport& fi, bool usesHeap)
// 2.1. Get ExitDatum
uint32_t globalDataOffset = fi.exitGlobalDataOffset();
#if defined(JS_CODEGEN_X64)
masm.append(GlobalAccess(masm.leaRipRelative(callee), globalDataOffset));
masm.append(AsmJSGlobalAccess(masm.leaRipRelative(callee), globalDataOffset));
#elif defined(JS_CODEGEN_X86)
masm.append(GlobalAccess(masm.movlWithPatch(Imm32(0), callee), globalDataOffset));
masm.append(AsmJSGlobalAccess(masm.movlWithPatch(Imm32(0), callee), globalDataOffset));
#elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
masm.computeEffectiveAddress(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), callee);

View File

@ -146,8 +146,8 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_WasmStore:
case MDefinition::Op_AsmJSCompareExchangeHeap:
case MDefinition::Op_AsmJSAtomicBinopHeap:
case MDefinition::Op_WasmLoadGlobalVar:
case MDefinition::Op_WasmStoreGlobalVar:
case MDefinition::Op_AsmJSLoadGlobalVar:
case MDefinition::Op_AsmJSStoreGlobalVar:
case MDefinition::Op_ArrayJoin:
return nullptr;
default:

View File

@ -4081,15 +4081,15 @@ LIRGenerator::visitHasClass(MHasClass* ins)
}
void
LIRGenerator::visitWasmLoadGlobalVar(MWasmLoadGlobalVar* ins)
LIRGenerator::visitAsmJSLoadGlobalVar(MAsmJSLoadGlobalVar* ins)
{
define(new(alloc()) LWasmLoadGlobalVar, ins);
define(new(alloc()) LAsmJSLoadGlobalVar, ins);
}
void
LIRGenerator::visitWasmStoreGlobalVar(MWasmStoreGlobalVar* ins)
LIRGenerator::visitAsmJSStoreGlobalVar(MAsmJSStoreGlobalVar* ins)
{
add(new(alloc()) LWasmStoreGlobalVar(useRegisterAtStart(ins->value())), ins);
add(new(alloc()) LAsmJSStoreGlobalVar(useRegisterAtStart(ins->value())), ins);
}
void

View File

@ -281,8 +281,8 @@ class LIRGenerator : public LIRGeneratorSpecific
void visitIsConstructor(MIsConstructor* ins);
void visitIsObject(MIsObject* ins);
void visitHasClass(MHasClass* ins);
void visitWasmLoadGlobalVar(MWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(MWasmStoreGlobalVar* ins);
void visitAsmJSLoadGlobalVar(MAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(MAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(MAsmJSLoadFFIFunc* ins);
void visitAsmJSParameter(MAsmJSParameter* ins);

View File

@ -4899,11 +4899,10 @@ MAsmJSLoadHeap::congruentTo(const MDefinition* ins) const
}
MDefinition::AliasType
MWasmLoadGlobalVar::mightAlias(const MDefinition* def) const
MAsmJSLoadGlobalVar::mightAlias(const MDefinition* def) const
{
if (def->isWasmStoreGlobalVar()) {
const MWasmStoreGlobalVar* store = def->toWasmStoreGlobalVar();
// Global variables can't alias each other or be type-reinterpreted.
if (def->isAsmJSStoreGlobalVar()) {
const MAsmJSStoreGlobalVar* store = def->toAsmJSStoreGlobalVar();
return (store->globalDataOffset() == globalDataOffset_) ? AliasType::MayAlias :
AliasType::NoAlias;
}
@ -4911,7 +4910,7 @@ MWasmLoadGlobalVar::mightAlias(const MDefinition* def) const
}
HashNumber
MWasmLoadGlobalVar::valueHash() const
MAsmJSLoadGlobalVar::valueHash() const
{
HashNumber hash = MDefinition::valueHash();
hash = addU32ToHash(hash, globalDataOffset_);
@ -4919,20 +4918,22 @@ MWasmLoadGlobalVar::valueHash() const
}
bool
MWasmLoadGlobalVar::congruentTo(const MDefinition* ins) const
MAsmJSLoadGlobalVar::congruentTo(const MDefinition* ins) const
{
if (ins->isWasmLoadGlobalVar())
return globalDataOffset_ == ins->toWasmLoadGlobalVar()->globalDataOffset_;
if (ins->isAsmJSLoadGlobalVar()) {
const MAsmJSLoadGlobalVar* load = ins->toAsmJSLoadGlobalVar();
return globalDataOffset_ == load->globalDataOffset_;
}
return false;
}
MDefinition*
MWasmLoadGlobalVar::foldsTo(TempAllocator& alloc)
MAsmJSLoadGlobalVar::foldsTo(TempAllocator& alloc)
{
if (!dependency() || !dependency()->isWasmStoreGlobalVar())
if (!dependency() || !dependency()->isAsmJSStoreGlobalVar())
return this;
MWasmStoreGlobalVar* store = dependency()->toWasmStoreGlobalVar();
MAsmJSStoreGlobalVar* store = dependency()->toAsmJSStoreGlobalVar();
if (!store->block()->dominates(block()))
return this;

View File

@ -13281,9 +13281,9 @@ class MAsmJSAtomicBinopHeap
}
};
class MWasmLoadGlobalVar : public MNullaryInstruction
class MAsmJSLoadGlobalVar : public MNullaryInstruction
{
MWasmLoadGlobalVar(MIRType type, unsigned globalDataOffset, bool isConstant)
MAsmJSLoadGlobalVar(MIRType type, unsigned globalDataOffset, bool isConstant)
: globalDataOffset_(globalDataOffset), isConstant_(isConstant)
{
MOZ_ASSERT(IsNumberType(type) || IsSimdType(type));
@ -13295,7 +13295,7 @@ class MWasmLoadGlobalVar : public MNullaryInstruction
bool isConstant_;
public:
INSTRUCTION_HEADER(WasmLoadGlobalVar)
INSTRUCTION_HEADER(AsmJSLoadGlobalVar)
TRIVIAL_NEW_WRAPPERS
unsigned globalDataOffset() const { return globalDataOffset_; }
@ -13311,18 +13311,18 @@ class MWasmLoadGlobalVar : public MNullaryInstruction
AliasType mightAlias(const MDefinition* def) const override;
};
class MWasmStoreGlobalVar
class MAsmJSStoreGlobalVar
: public MUnaryInstruction,
public NoTypePolicy::Data
{
MWasmStoreGlobalVar(unsigned globalDataOffset, MDefinition* v)
MAsmJSStoreGlobalVar(unsigned globalDataOffset, MDefinition* v)
: MUnaryInstruction(v), globalDataOffset_(globalDataOffset)
{}
unsigned globalDataOffset_;
public:
INSTRUCTION_HEADER(WasmStoreGlobalVar)
INSTRUCTION_HEADER(AsmJSStoreGlobalVar)
TRIVIAL_NEW_WRAPPERS
unsigned globalDataOffset() const { return globalDataOffset_; }

View File

@ -278,8 +278,8 @@ namespace jit {
_(AsmJSUnsignedToFloat32) \
_(AsmJSLoadHeap) \
_(AsmJSStoreHeap) \
_(WasmLoadGlobalVar) \
_(WasmStoreGlobalVar) \
_(AsmJSLoadGlobalVar) \
_(AsmJSStoreGlobalVar) \
_(AsmJSLoadFuncPtr) \
_(AsmJSLoadFFIFunc) \
_(AsmJSReturn) \

View File

@ -2695,9 +2695,9 @@ CodeGeneratorARM::visitEffectiveAddress(LEffectiveAddress* ins)
}
void
CodeGeneratorARM::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
CodeGeneratorARM::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins)
{
const MWasmLoadGlobalVar* mir = ins->mir();
const MAsmJSLoadGlobalVar* mir = ins->mir();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->type() == MIRType::Int32) {
masm.ma_dtr(IsLoad, GlobalReg, Imm32(addr), ToRegister(ins->output()));
@ -2705,16 +2705,17 @@ CodeGeneratorARM::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
VFPRegister vd(ToFloatRegister(ins->output()));
masm.ma_vldr(Address(GlobalReg, addr), vd.singleOverlay());
} else {
MOZ_ASSERT(mir->type() == MIRType::Double);
masm.ma_vldr(Address(GlobalReg, addr), ToFloatRegister(ins->output()));
}
}
void
CodeGeneratorARM::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
CodeGeneratorARM::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins)
{
const MWasmStoreGlobalVar* mir = ins->mir();
const MAsmJSStoreGlobalVar* mir = ins->mir();
MIRType type = mir->value()->type();
MOZ_ASSERT(IsNumberType(type));
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (type == MIRType::Int32) {
@ -2723,7 +2724,6 @@ CodeGeneratorARM::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
VFPRegister vd(ToFloatRegister(ins->value()));
masm.ma_vstr(vd.singleOverlay(), Address(GlobalReg, addr));
} else {
MOZ_ASSERT(type == MIRType::Double);
masm.ma_vstr(ToFloatRegister(ins->value()), Address(GlobalReg, addr));
}
}

View File

@ -206,8 +206,6 @@ class CodeGeneratorARM : public CodeGeneratorShared
void visitWasmBoundsCheck(LWasmBoundsCheck* ins);
void visitWasmLoad(LWasmLoad* ins);
void visitWasmStore(LWasmStore* ins);
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins);
void visitAsmJSLoadHeap(LAsmJSLoadHeap* ins);
void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins);
void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins);
@ -217,6 +215,8 @@ class CodeGeneratorARM : public CodeGeneratorShared
void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins);
void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins);
void visitAsmJSAtomicBinopCallout(LAsmJSAtomicBinopCallout* ins);
void visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins);
void visitAsmJSPassStackArg(LAsmJSPassStackArg* ins);

View File

@ -692,15 +692,15 @@ CodeGeneratorARM64::visitEffectiveAddress(LEffectiveAddress* ins)
}
void
CodeGeneratorARM64::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
CodeGeneratorARM64::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins)
{
MOZ_CRASH("visitWasmLoadGlobalVar");
MOZ_CRASH("visitAsmJSLoadGlobalVar");
}
void
CodeGeneratorARM64::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
CodeGeneratorARM64::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins)
{
MOZ_CRASH("visitWasmStoreGlobalVar");
MOZ_CRASH("visitAsmJSStoreGlobalVar");
}
void

View File

@ -203,13 +203,12 @@ class CodeGeneratorARM64 : public CodeGeneratorShared
void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins);
void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins);
void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins);
void visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins);
void visitAsmJSPassStackArg(LAsmJSPassStackArg* ins);
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins);
void generateInvalidateEpilogue();
void setReturnDoubleRegs(LiveRegisterSet* regs);

View File

@ -2105,9 +2105,9 @@ CodeGeneratorMIPSShared::visitEffectiveAddress(LEffectiveAddress* ins)
}
void
CodeGeneratorMIPSShared::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
CodeGeneratorMIPSShared::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins)
{
const MWasmLoadGlobalVar* mir = ins->mir();
const MAsmJSLoadGlobalVar* mir = ins->mir();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->type() == MIRType::Int32)
masm.load32(Address(GlobalReg, addr), ToRegister(ins->output()));
@ -2118,9 +2118,9 @@ CodeGeneratorMIPSShared::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
}
void
CodeGeneratorMIPSShared::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
CodeGeneratorMIPSShared::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins)
{
const MWasmStoreGlobalVar* mir = ins->mir();
const MAsmJSStoreGlobalVar* mir = ins->mir();
MOZ_ASSERT(IsNumberType(mir->value()->type()));
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;

View File

@ -165,8 +165,6 @@ class CodeGeneratorMIPSShared : public CodeGeneratorShared
virtual void visitTruncateFToInt32(LTruncateFToInt32* ins);
void visitWasmTruncateToInt32(LWasmTruncateToInt32* lir);
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins);
// Out of line visitors.
virtual void visitOutOfLineBailout(OutOfLineBailout* ool) = 0;
@ -201,6 +199,8 @@ class CodeGeneratorMIPSShared : public CodeGeneratorShared
void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins);
void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins);
void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins);
void visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins);

View File

@ -680,6 +680,16 @@ struct AsmJSFrame
static_assert(sizeof(AsmJSFrame) == 2 * sizeof(void*), "?!");
static const uint32_t AsmJSFrameBytesAfterReturnAddress = sizeof(void*);
struct AsmJSGlobalAccess
{
CodeOffset patchAt;
unsigned globalDataOffset;
AsmJSGlobalAccess(CodeOffset patchAt, unsigned globalDataOffset)
: patchAt(patchAt), globalDataOffset(globalDataOffset)
{}
};
// Represents an instruction to be patched and the intended pointee. These
// links are accumulated in the MacroAssembler, but patching is done outside
// the MacroAssembler (in Module::staticallyLink).
@ -692,29 +702,6 @@ struct AsmJSAbsoluteAddress
wasm::SymbolicAddress target;
};
} // namespace jit
namespace wasm {
// Summarizes a global access for a mutable (in asm.js) or immutable value (in
// asm.js or the MVP) that needs to get patched later.
struct GlobalAccess
{
GlobalAccess(jit::CodeOffset patchAt, unsigned globalDataOffset)
: patchAt(patchAt), globalDataOffset(globalDataOffset)
{}
jit::CodeOffset patchAt;
unsigned globalDataOffset;
};
typedef Vector<GlobalAccess, 0, SystemAllocPolicy> GlobalAccessVector;
} // namespace wasm
namespace jit {
// The base class of all Assemblers for all archs.
class AssemblerShared
{
@ -722,7 +709,7 @@ class AssemblerShared
wasm::JumpSiteArray jumpsites_;
wasm::MemoryAccessVector memoryAccesses_;
wasm::BoundsCheckVector boundsChecks_;
wasm::GlobalAccessVector globalAccesses_;
Vector<AsmJSGlobalAccess, 0, SystemAllocPolicy> asmJSGlobalAccesses_;
Vector<AsmJSAbsoluteAddress, 0, SystemAllocPolicy> asmJSAbsoluteAddresses_;
protected:
@ -775,8 +762,9 @@ class AssemblerShared
void append(wasm::BoundsCheck check) { enoughMemory_ &= boundsChecks_.append(check); }
wasm::BoundsCheckVector&& extractBoundsChecks() { return Move(boundsChecks_); }
void append(wasm::GlobalAccess access) { enoughMemory_ &= globalAccesses_.append(access); }
const wasm::GlobalAccessVector& globalAccesses() const { return globalAccesses_; }
void append(AsmJSGlobalAccess access) { enoughMemory_ &= asmJSGlobalAccesses_.append(access); }
size_t numAsmJSGlobalAccesses() const { return asmJSGlobalAccesses_.length(); }
AsmJSGlobalAccess asmJSGlobalAccess(size_t i) const { return asmJSGlobalAccesses_[i]; }
void append(AsmJSAbsoluteAddress link) { enoughMemory_ &= asmJSAbsoluteAddresses_.append(link); }
size_t numAsmJSAbsoluteAddresses() const { return asmJSAbsoluteAddresses_.length(); }
@ -820,10 +808,10 @@ class AssemblerShared
for (; i < boundsChecks_.length(); i++)
boundsChecks_[i].offsetBy(delta);
i = globalAccesses_.length();
enoughMemory_ &= globalAccesses_.appendAll(other.globalAccesses_);
for (; i < globalAccesses_.length(); i++)
globalAccesses_[i].patchAt.offsetBy(delta);
i = asmJSGlobalAccesses_.length();
enoughMemory_ &= asmJSGlobalAccesses_.appendAll(other.asmJSGlobalAccesses_);
for (; i < asmJSGlobalAccesses_.length(); i++)
asmJSGlobalAccesses_[i].patchAt.offsetBy(delta);
i = asmJSAbsoluteAddresses_.length();
enoughMemory_ &= asmJSAbsoluteAddresses_.appendAll(other.asmJSAbsoluteAddresses_);

View File

@ -8046,24 +8046,24 @@ class LAsmJSAtomicBinopHeapForEffect : public LInstructionHelper<0, 2, 5>
}
};
class LWasmLoadGlobalVar : public LInstructionHelper<1, 0, 0>
class LAsmJSLoadGlobalVar : public LInstructionHelper<1, 0, 0>
{
public:
LIR_HEADER(WasmLoadGlobalVar);
MWasmLoadGlobalVar* mir() const {
return mir_->toWasmLoadGlobalVar();
LIR_HEADER(AsmJSLoadGlobalVar);
MAsmJSLoadGlobalVar* mir() const {
return mir_->toAsmJSLoadGlobalVar();
}
};
class LWasmStoreGlobalVar : public LInstructionHelper<0, 1, 0>
class LAsmJSStoreGlobalVar : public LInstructionHelper<0, 1, 0>
{
public:
LIR_HEADER(WasmStoreGlobalVar);
explicit LWasmStoreGlobalVar(const LAllocation& value) {
LIR_HEADER(AsmJSStoreGlobalVar);
explicit LAsmJSStoreGlobalVar(const LAllocation& value) {
setOperand(0, value);
}
MWasmStoreGlobalVar* mir() const {
return mir_->toWasmStoreGlobalVar();
MAsmJSStoreGlobalVar* mir() const {
return mir_->toAsmJSStoreGlobalVar();
}
const LAllocation* value() {
return getOperand(0);

View File

@ -389,11 +389,11 @@
_(WasmLoadI64) \
_(WasmStore) \
_(WasmBoundsCheck) \
_(WasmLoadGlobalVar) \
_(WasmStoreGlobalVar) \
_(AsmJSLoadHeap) \
_(AsmJSStoreHeap) \
_(AsmJSLoadFuncPtr) \
_(AsmJSLoadGlobalVar) \
_(AsmJSStoreGlobalVar) \
_(AsmJSLoadFFIFunc) \
_(AsmJSParameter) \
_(AsmJSReturn) \

View File

@ -827,11 +827,11 @@ class Assembler : public AssemblerX86Shared
void loadWasmActivation(Register dest) {
CodeOffset label = loadRipRelativeInt64(dest);
append(wasm::GlobalAccess(label, wasm::ActivationGlobalDataOffset));
append(AsmJSGlobalAccess(label, wasm::ActivationGlobalDataOffset));
}
void loadAsmJSHeapRegisterFromGlobalData() {
CodeOffset label = loadRipRelativeInt64(HeapReg);
append(wasm::GlobalAccess(label, wasm::HeapGlobalDataOffset));
append(AsmJSGlobalAccess(label, wasm::HeapGlobalDataOffset));
}
void cmpq(Register rhs, Register lhs) {

View File

@ -1173,9 +1173,9 @@ CodeGeneratorX64::visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEff
}
void
CodeGeneratorX64::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
CodeGeneratorX64::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins)
{
MWasmLoadGlobalVar* mir = ins->mir();
MAsmJSLoadGlobalVar* mir = ins->mir();
MIRType type = mir->type();
MOZ_ASSERT(IsNumberType(type) || IsSimdType(type));
@ -1205,16 +1205,16 @@ CodeGeneratorX64::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
label = masm.loadRipRelativeFloat32x4(ToFloatRegister(ins->output()));
break;
default:
MOZ_CRASH("unexpected type in visitWasmLoadGlobalVar");
MOZ_CRASH("unexpected type in visitAsmJSLoadGlobalVar");
}
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
void
CodeGeneratorX64::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
CodeGeneratorX64::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins)
{
MWasmStoreGlobalVar* mir = ins->mir();
MAsmJSStoreGlobalVar* mir = ins->mir();
MIRType type = mir->value()->type();
MOZ_ASSERT(IsNumberType(type) || IsSimdType(type));
@ -1240,10 +1240,10 @@ CodeGeneratorX64::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
label = masm.storeRipRelativeFloat32x4(ToFloatRegister(ins->value()));
break;
default:
MOZ_CRASH("unexpected type in visitWasmStoreGlobalVar");
MOZ_CRASH("unexpected type in visitAsmJSStoreGlobalVar");
}
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
void
@ -1260,7 +1260,7 @@ CodeGeneratorX64::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins)
}
CodeOffset label = masm.loadRipRelativeInt64(out);
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
masm.loadPtr(Operand(out, index, ScalePointer, 0), out);
}
@ -1271,7 +1271,7 @@ CodeGeneratorX64::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins)
MAsmJSLoadFFIFunc* mir = ins->mir();
CodeOffset label = masm.loadRipRelativeInt64(ToRegister(ins->output()));
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
void

View File

@ -75,8 +75,6 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared
void visitWasmLoad(LWasmLoad* ins);
void visitWasmLoadI64(LWasmLoadI64* ins);
void visitWasmStore(LWasmStore* ins);
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins);
void visitAsmSelectI64(LAsmSelectI64* ins);
void visitAsmJSCall(LAsmJSCall* ins);
void visitAsmJSLoadHeap(LAsmJSLoadHeap* ins);
@ -85,6 +83,8 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared
void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins);
void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins);
void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins);
void visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins);
void visitAsmJSUInt32ToDouble(LAsmJSUInt32ToDouble* lir);

View File

@ -922,7 +922,7 @@ class Assembler : public AssemblerX86Shared
void loadWasmActivation(Register dest) {
CodeOffset label = movlWithPatch(PatchedAbsoluteAddress(), dest);
append(wasm::GlobalAccess(label, wasm::ActivationGlobalDataOffset));
append(AsmJSGlobalAccess(label, wasm::ActivationGlobalDataOffset));
}
void loadAsmJSHeapRegisterFromGlobalData() {
// x86 doesn't have a pinned heap register.

View File

@ -831,9 +831,9 @@ CodeGeneratorX86::visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEff
}
void
CodeGeneratorX86::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
CodeGeneratorX86::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins)
{
MWasmLoadGlobalVar* mir = ins->mir();
MAsmJSLoadGlobalVar* mir = ins->mir();
MIRType type = mir->type();
MOZ_ASSERT(IsNumberType(type) || IsSimdType(type));
@ -862,15 +862,15 @@ CodeGeneratorX86::visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins)
label = masm.vmovapsWithPatch(PatchedAbsoluteAddress(), ToFloatRegister(ins->output()));
break;
default:
MOZ_CRASH("unexpected type in visitWasmLoadGlobalVar");
MOZ_CRASH("unexpected type in visitAsmJSLoadGlobalVar");
}
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
void
CodeGeneratorX86::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
CodeGeneratorX86::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins)
{
MWasmStoreGlobalVar* mir = ins->mir();
MAsmJSStoreGlobalVar* mir = ins->mir();
MIRType type = mir->value()->type();
MOZ_ASSERT(IsNumberType(type) || IsSimdType(type));
@ -896,9 +896,9 @@ CodeGeneratorX86::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
label = masm.vmovapsWithPatch(ToFloatRegister(ins->value()), PatchedAbsoluteAddress());
break;
default:
MOZ_CRASH("unexpected type in visitWasmStoreGlobalVar");
MOZ_CRASH("unexpected type in visitAsmJSStoreGlobalVar");
}
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
void
@ -915,7 +915,7 @@ CodeGeneratorX86::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins)
}
CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), out);
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
masm.loadPtr(Operand(out, index, ScalePointer), out);
}
@ -927,7 +927,7 @@ CodeGeneratorX86::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins)
Register out = ToRegister(ins->output());
CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), out);
masm.append(wasm::GlobalAccess(label, mir->globalDataOffset()));
masm.append(AsmJSGlobalAccess(label, mir->globalDataOffset()));
}
namespace js {

View File

@ -60,14 +60,14 @@ class CodeGeneratorX86 : public CodeGeneratorX86Shared
void visitAsmJSCall(LAsmJSCall* ins);
void visitWasmLoad(LWasmLoad* ins);
void visitWasmStore(LWasmStore* ins);
void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins);
void visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins);
void visitAsmJSLoadHeap(LAsmJSLoadHeap* ins);
void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins);
void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins);
void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins);
void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins);
void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins);
void visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar* ins);
void visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar* ins);
void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins);
void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins);
void visitWasmTruncateToInt32(LWasmTruncateToInt32* ins);