Merge mozilla-central to autoland a=merge on a CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-08-07 12:35:00 +03:00
commit b043933d2f
20 changed files with 50 additions and 185 deletions

View File

@ -8057,9 +8057,7 @@ void CodeGenerator::visitWasmCall(LWasmCall* lir) {
MOZ_ASSERT(!lir->safepoint()->isWasmTrap());
if (reloadRegs) {
masm.loadPtr(Address(masm.getStackPointer(),
wasm::FrameWithTls::callerTLSABIOffset()),
WasmTlsReg);
masm.loadWasmTlsRegFromFrame();
masm.loadWasmPinnedRegsFromTls();
if (switchRealm) {
masm.switchToWasmTlsRealm(ABINonArgReturnReg0, ABINonArgReturnReg1);
@ -14530,7 +14528,7 @@ void CodeGenerator::emitIonToWasmCallBase(LIonToWasmCallBase<NumDefs>* lir) {
const wasm::FuncExport& funcExport = lir->mir()->funcExport();
const wasm::FuncType& sig = funcExport.funcType();
WasmABIArgGenerator abi;
ABIArgGenerator abi;
for (size_t i = 0; i < lir->numOperands(); i++) {
MIRType argMir;
switch (sig.args()[i].kind()) {

View File

@ -3554,9 +3554,6 @@ std::pair<CodeOffset, uint32_t> MacroAssembler::wasmReserveStackChecked(
CodeOffset MacroAssembler::wasmCallImport(const wasm::CallSiteDesc& desc,
const wasm::CalleeDesc& callee) {
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::callerTLSABIOffset()));
// Load the callee, before the caller's registers are clobbered.
uint32_t globalDataOffset = callee.importGlobalDataOffset();
loadWasmGlobalPtr(globalDataOffset + offsetof(wasm::FuncImportTls, code),
@ -3575,8 +3572,6 @@ CodeOffset MacroAssembler::wasmCallImport(const wasm::CallSiteDesc& desc,
// Switch to the callee's TLS and pinned registers and make the call.
loadWasmGlobalPtr(globalDataOffset + offsetof(wasm::FuncImportTls, tls),
WasmTlsReg);
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::calleeTLSABIOffset()));
loadWasmPinnedRegsFromTls();
return call(desc, ABINonArgReg0);
@ -3587,10 +3582,6 @@ CodeOffset MacroAssembler::wasmCallBuiltinInstanceMethod(
wasm::SymbolicAddress builtin, wasm::FailureMode failureMode) {
MOZ_ASSERT(instanceArg != ABIArg());
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::callerTLSABIOffset()));
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::calleeTLSABIOffset()));
if (instanceArg.kind() == ABIArg::GPR) {
loadPtr(Address(WasmTlsReg, offsetof(wasm::TlsData, instance)),
instanceArg.gpr());
@ -3697,11 +3688,7 @@ CodeOffset MacroAssembler::wasmCallIndirect(const wasm::CallSiteDesc& desc,
addPtr(index, scratch);
}
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::callerTLSABIOffset()));
loadPtr(Address(scratch, offsetof(wasm::FunctionTableElem, tls)), WasmTlsReg);
storePtr(WasmTlsReg, Address(getStackPointer(),
wasm::FrameWithTls::calleeTLSABIOffset()));
Label nonNull;
branchTest32(Assembler::NonZero, WasmTlsReg, WasmTlsReg, &nonNull);

View File

@ -4146,9 +4146,9 @@ static inline MIRType ToMIRType(ABIArgType argType) {
MOZ_CRASH("unexpected argType");
}
template <class VecT, class ABIArgGeneratorT>
class ABIArgIterBase {
ABIArgGeneratorT gen_;
template <class VecT>
class ABIArgIter {
ABIArgGenerator gen_;
const VecT& types_;
unsigned i_;
@ -4157,9 +4157,7 @@ class ABIArgIterBase {
}
public:
explicit ABIArgIterBase(const VecT& types) : types_(types), i_(0) {
settle();
}
explicit ABIArgIter(const VecT& types) : types_(types), i_(0) { settle(); }
void operator++(int) {
MOZ_ASSERT(!done());
i_++;
@ -4189,29 +4187,6 @@ class ABIArgIterBase {
}
};
// This is not an alias because we want to allow class template argument
// deduction.
template <class VecT>
class ABIArgIter : public ABIArgIterBase<VecT, ABIArgGenerator> {
public:
explicit ABIArgIter(const VecT& types)
: ABIArgIterBase<VecT, ABIArgGenerator>(types) {}
};
class WasmABIArgGenerator : public ABIArgGenerator {
public:
WasmABIArgGenerator() {
increaseStackOffset(wasm::FrameWithTls::sizeWithoutFrame());
}
};
template <class VecT>
class WasmABIArgIter : public ABIArgIterBase<VecT, WasmABIArgGenerator> {
public:
explicit WasmABIArgIter(const VecT& types)
: ABIArgIterBase<VecT, WasmABIArgGenerator>(types) {}
};
} // namespace jit
} // namespace js

View File

@ -147,7 +147,6 @@ class ABIArgGenerator {
ABIArg next(MIRType argType);
ABIArg& current() { return current_; }
uint32_t stackBytesConsumedSoFar() const { return stackOffset_; }
void increaseStackOffset(uint32_t bytes) { stackOffset_ += bytes; }
};
bool IsUnaligned(const wasm::MemoryAccessDesc& access);

View File

@ -415,7 +415,6 @@ class ABIArgGenerator {
ABIArg next(MIRType argType);
ABIArg& current() { return current_; }
uint32_t stackBytesConsumedSoFar() const { return stackOffset_; }
void increaseStackOffset(uint32_t bytes) { stackOffset_ += bytes; }
protected:
unsigned intRegIndex_;

View File

@ -43,8 +43,6 @@ class ABIArgGenerator {
return usedArgSlots_ * sizeof(intptr_t);
}
void increaseStackOffset(uint32_t bytes) { MOZ_CRASH("NYI"); }
};
// These registers may be volatile or nonvolatile.

View File

@ -38,7 +38,6 @@ class ABIArgGenerator {
return (usedArgSlots_ - 8) * sizeof(int64_t);
}
void increaseStackOffset(uint32_t bytes) { MOZ_CRASH("NYI"); }
};
// These registers may be volatile or nonvolatile.

View File

@ -617,7 +617,6 @@ class ABIArgGenerator {
ABIArg next(MIRType) { MOZ_CRASH(); }
ABIArg& current() { MOZ_CRASH(); }
uint32_t stackBytesConsumedSoFar() const { MOZ_CRASH(); }
void increaseStackOffset(uint32_t) { MOZ_CRASH(); }
};
static inline bool GetTempRegForIntArg(uint32_t, uint32_t, Register*) {

View File

@ -192,7 +192,6 @@ class ABIArgGenerator {
ABIArg next(MIRType argType);
ABIArg& current() { return current_; }
uint32_t stackBytesConsumedSoFar() const { return stackOffset_; }
void increaseStackOffset(uint32_t bytes) { stackOffset_ += bytes; }
};
// These registers may be volatile or nonvolatile.

View File

@ -88,7 +88,6 @@ class ABIArgGenerator {
ABIArg next(MIRType argType);
ABIArg& current() { return current_; }
uint32_t stackBytesConsumedSoFar() const { return stackOffset_; }
void increaseStackOffset(uint32_t bytes) { stackOffset_ += bytes; }
};
// These registers may be volatile or nonvolatile.

View File

@ -5151,7 +5151,7 @@ class BaseCompiler final : public BaseCompilerInterface {
}
// Identify GC-managed pointers passed on the stack.
for (WasmABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter i(args); !i.done(); i++) {
ABIArg argLoc = *i;
if (argLoc.kind() == ABIArg::Stack &&
args[i.index()] == MIRType::RefOrNull) {
@ -5236,7 +5236,7 @@ class BaseCompiler final : public BaseCompilerInterface {
}
// Copy arguments from registers to stack.
for (WasmABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter i(args); !i.done(); i++) {
if (args.isSyntheticStackResultPointerArg(i.index())) {
// If there are stack results and the pointer to stack results
// was passed in a register, store it to the stack.
@ -5501,7 +5501,7 @@ class BaseCompiler final : public BaseCompilerInterface {
}
uint32_t lineOrBytecode;
WasmABIArgGenerator abi;
ABIArgGenerator abi;
bool isInterModule;
bool usesSystemAbi;
#ifdef JS_CODEGEN_ARM

View File

@ -42,7 +42,7 @@ class BaseLocalIter {
const ValTypeVector& locals_;
const ArgTypeVector& args_;
jit::WasmABIArgIter<ArgTypeVector> argsIter_;
jit::ABIArgIter<ArgTypeVector> argsIter_;
size_t index_;
int32_t frameSize_;
int32_t nextFrameSize_;

View File

@ -918,34 +918,6 @@ static bool isSignatureCheckFail(uint32_t offsetInCode,
(offsetInCode - codeRange->funcCheckedCallEntry()) > SetFP;
}
TlsData* js::wasm::GetNearestEffectiveTls(Frame* fp) {
while (true) {
if (fp->callerIsExitOrJitEntryFP()) {
// It is a direct call from JIT.
MOZ_ASSERT(!LookupCode(fp->returnAddress()));
return FrameWithTls::from(fp)->calleeTls();
}
uint8_t* returnAddress = fp->returnAddress();
const CodeRange* codeRange = nullptr;
const Code* code = LookupCode(returnAddress, &codeRange);
MOZ_ASSERT(codeRange);
if (codeRange->isEntry()) {
return FrameWithTls::from(fp)->calleeTls();
}
MOZ_ASSERT(codeRange->kind() == CodeRange::Function);
MOZ_ASSERT(code);
const CallSite* callsite = code->lookupCallSite(returnAddress);
if (callsite->mightBeCrossInstance()) {
return FrameWithTls::from(fp)->calleeTls();
}
fp = fp->wasmCaller();
}
}
bool js::wasm::StartUnwinding(const RegisterState& registers,
UnwindState* unwindState, bool* unwoundCaller) {
// Shorthands.

View File

@ -233,10 +233,6 @@ void GenerateFunctionPrologue(jit::MacroAssembler& masm,
void GenerateFunctionEpilogue(jit::MacroAssembler& masm, unsigned framePushed,
FuncOffsets* offsets);
// Iterates through frames for either possible cross-instance call or an entry
// stub to obtain tls that corresponds to the passed fp.
TlsData* GetNearestEffectiveTls(Frame* fp);
// Describes register state and associated code at a given call frame.
struct UnwindState {

View File

@ -128,7 +128,7 @@ bool CreateStackMapForFunctionEntryTrap(const wasm::ArgTypeVector& argTypes,
return false;
}
for (WasmABIArgIter i(argTypes); !i.done(); i++) {
for (ABIArgIter i(argTypes); !i.done(); i++) {
ABIArg argLoc = *i;
if (argLoc.kind() == ABIArg::Stack &&
argTypes[i.index()] == MIRType::RefOrNull) {
@ -183,7 +183,7 @@ bool GenerateStackmapEntriesForTrapExit(const ArgTypeVector& args,
return false;
}
for (WasmABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter i(args); !i.done(); i++) {
if (!i->argInRegister() || i.mirType() != MIRType::RefOrNull) {
continue;
}

View File

@ -252,7 +252,7 @@ class StackMaps {
// the complete native-ABI-level call signature.
template <class T>
static inline size_t StackArgAreaSizeUnaligned(const T& argTypes) {
WasmABIArgIter<const T> i(argTypes);
ABIArgIter<const T> i(argTypes);
while (!i.done()) {
i++;
}
@ -261,7 +261,7 @@ static inline size_t StackArgAreaSizeUnaligned(const T& argTypes) {
static inline size_t StackArgAreaSizeUnaligned(
const SymbolicAddressSignature& saSig) {
// WasmABIArgIter::ABIArgIter wants the items to be iterated over to be
// ABIArgIter::ABIArgIter wants the items to be iterated over to be
// presented in some type that has methods length() and operator[]. So we
// have to wrap up |saSig|'s array of types in this API-matching class.
class MOZ_STACK_CLASS ItemsAndLength {

View File

@ -64,7 +64,7 @@ class FunctionCompiler;
class CallCompileState {
// A generator object that is passed each argument as it is compiled.
WasmABIArgGenerator abi_;
ABIArgGenerator abi_;
// Accumulates the register arguments while compiling arguments.
MWasmCall::Args regArgs_;
@ -161,7 +161,7 @@ class FunctionCompiler {
return false;
}
for (WasmABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter i(args); !i.done(); i++) {
MWasmParameter* ins = MWasmParameter::New(alloc(), *i, i.mirType());
curBlock_->add(ins);
if (args.isSyntheticStackResultPointerArg(i.index())) {

View File

@ -707,9 +707,7 @@ static MOZ_MUST_USE bool HandleTrap(CONTEXT* context,
// due to this trap occurring in the indirect call prologue, while fp points
// to the caller's Frame which can be in a different Module. In any case,
// though, the containing JSContext is the same.
auto* frame = reinterpret_cast<Frame*>(ContextToFP(context));
Instance* instance = GetNearestEffectiveTls(frame)->instance;
Instance* instance = ((Frame*)ContextToFP(context))->instance();
MOZ_RELEASE_ASSERT(&instance->code() == &segment.code() ||
trap == Trap::IndirectCallBadSig);

View File

@ -292,28 +292,18 @@ static void AssertStackAlignment(MacroAssembler& masm, uint32_t alignment,
masm.assertStackAlignment(alignment, addBeforeAssert);
}
template <class VectorT, template <class VecT> class ABIArgIterT>
static unsigned StackArgBytesHelper(const VectorT& args) {
ABIArgIterT<VectorT> iter(args);
template <class VectorT>
static unsigned StackArgBytes(const VectorT& args) {
ABIArgIter<VectorT> iter(args);
while (!iter.done()) {
iter++;
}
return iter.stackBytesConsumedSoFar();
}
template <class VectorT>
static unsigned StackArgBytesForNativeABI(const VectorT& args) {
return StackArgBytesHelper<VectorT, ABIArgIter>(args);
}
template <class VectorT>
static unsigned StackArgBytesForWasmABI(const VectorT& args) {
return StackArgBytesHelper<VectorT, WasmABIArgIter>(args);
}
static unsigned StackArgBytesForWasmABI(const FuncType& funcType) {
static unsigned StackArgBytes(const FuncType& funcType) {
ArgTypeVector args(funcType);
return StackArgBytesForWasmABI(args);
return StackArgBytes(args);
}
static void Move64(MacroAssembler& masm, const Address& src,
@ -333,12 +323,12 @@ static void Move64(MacroAssembler& masm, const Address& src,
static void SetupABIArguments(MacroAssembler& masm, const FuncExport& fe,
Register argv, Register scratch) {
// Copy parameters out of argv and into the registers/stack-slots specified by
// the wasm ABI.
// the system ABI.
//
// SetupABIArguments are only used for C++ -> wasm calls through callExport(),
// and V128 and Ref types (other than anyref) are not currently allowed.
ArgTypeVector args(fe.funcType());
for (WasmABIArgIter iter(args); !iter.done(); iter++) {
for (ABIArgIter iter(args); !iter.done(); iter++) {
unsigned argOffset = iter.index() * sizeof(ExportArg);
Address src(argv, argOffset);
MIRType type = iter.mirType();
@ -770,10 +760,9 @@ static bool GenerateInterpEntry(MacroAssembler& masm, const FuncExport& fe,
masm.Push(scratch);
#endif
// Reserve stack space for the wasm call.
unsigned argDecrement =
StackDecrementForCall(WasmStackAlignment, masm.framePushed(),
StackArgBytesForWasmABI(fe.funcType()));
// Reserve stack space for the call.
unsigned argDecrement = StackDecrementForCall(
WasmStackAlignment, masm.framePushed(), StackArgBytes(fe.funcType()));
masm.reserveStack(argDecrement);
// Copy parameters out of argv and into the wasm ABI registers/stack-slots.
@ -784,9 +773,6 @@ static bool GenerateInterpEntry(MacroAssembler& masm, const FuncExport& fe,
masm.movePtr(ImmWord(0), FramePointer);
masm.loadWasmPinnedRegsFromTls();
masm.storePtr(WasmTlsReg, Address(masm.getStackPointer(),
FrameWithTls::calleeTLSABIOffset()));
// Call into the real function. Note that, due to the throw stub, fp, tls
// and pinned registers may be clobbered.
masm.assertStackAlignment(WasmStackAlignment);
@ -969,13 +955,13 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex,
// left):
// <-- retAddr | descriptor | callee | argc | this | arg1..N
unsigned normalBytesNeeded = StackArgBytesForWasmABI(fe.funcType());
unsigned normalBytesNeeded = StackArgBytes(fe.funcType());
MIRTypeVector coerceArgTypes;
MOZ_ALWAYS_TRUE(coerceArgTypes.append(MIRType::Int32));
MOZ_ALWAYS_TRUE(coerceArgTypes.append(MIRType::Pointer));
MOZ_ALWAYS_TRUE(coerceArgTypes.append(MIRType::Pointer));
unsigned oolBytesNeeded = StackArgBytesForNativeABI(coerceArgTypes);
unsigned oolBytesNeeded = StackArgBytes(coerceArgTypes);
unsigned bytesNeeded = std::max(normalBytesNeeded, oolBytesNeeded);
@ -1166,7 +1152,7 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex,
// Convert all the expected values to unboxed values on the stack.
ArgTypeVector args(fe.funcType());
for (WasmABIArgIter iter(args); !iter.done(); iter++) {
for (ABIArgIter iter(args); !iter.done(); iter++) {
unsigned jitArgOffset =
frameSize + JitFrameLayout::offsetOfActualArg(iter.index());
Address argv(sp, jitArgOffset);
@ -1244,9 +1230,6 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex,
// Setup wasm register state.
masm.loadWasmPinnedRegsFromTls();
masm.storePtr(WasmTlsReg, Address(masm.getStackPointer(),
FrameWithTls::calleeTLSABIOffset()));
// Call into the real function. Note that, due to the throw stub, fp, tls
// and pinned registers may be clobbered.
masm.assertStackAlignment(WasmStackAlignment);
@ -1428,7 +1411,7 @@ void wasm::GenerateDirectCallFromJit(MacroAssembler& masm, const FuncExport& fe,
masm.orPtr(Imm32(ExitOrJitEntryFPTag), FramePointer);
// Move stack arguments to their final locations.
unsigned bytesNeeded = StackArgBytesForWasmABI(fe.funcType());
unsigned bytesNeeded = StackArgBytes(fe.funcType());
bytesNeeded = StackDecrementForCall(WasmStackAlignment, masm.framePushed(),
bytesNeeded);
if (bytesNeeded) {
@ -1439,7 +1422,7 @@ void wasm::GenerateDirectCallFromJit(MacroAssembler& masm, const FuncExport& fe,
fe.funcIndex());
ArgTypeVector args(fe.funcType());
for (WasmABIArgIter iter(args); !iter.done(); iter++) {
for (ABIArgIter iter(args); !iter.done(); iter++) {
MOZ_ASSERT_IF(iter->kind() == ABIArg::GPR, iter->gpr() != scratch);
MOZ_ASSERT_IF(iter->kind() == ABIArg::GPR, iter->gpr() != FramePointer);
if (iter->kind() != ABIArg::Stack) {
@ -1548,8 +1531,6 @@ void wasm::GenerateDirectCallFromJit(MacroAssembler& masm, const FuncExport& fe,
// Load tls; from now on, WasmTlsReg is live.
masm.movePtr(ImmPtr(inst.tlsData()), WasmTlsReg);
masm.storePtr(WasmTlsReg, Address(masm.getStackPointer(),
FrameWithTls::calleeTLSABIOffset()));
masm.loadWasmPinnedRegsFromTls();
// Actual call.
@ -1896,10 +1877,10 @@ static bool GenerateImportFunction(jit::MacroAssembler& masm,
MOZ_ASSERT(masm.framePushed() == 0);
const unsigned sizeOfTlsSlot = sizeof(void*);
unsigned framePushed = StackDecrementForCall(
WasmStackAlignment,
sizeof(Frame), // pushed by prologue
StackArgBytesForWasmABI(fi.funcType()) + sizeOfTlsSlot);
unsigned framePushed =
StackDecrementForCall(WasmStackAlignment,
sizeof(Frame), // pushed by prologue
StackArgBytes(fi.funcType()) + sizeOfTlsSlot);
masm.wasmReserveStackChecked(framePushed, BytecodeOffset(0));
MOZ_ASSERT(masm.framePushed() == framePushed);
@ -1913,7 +1894,7 @@ static bool GenerateImportFunction(jit::MacroAssembler& masm,
// Copy our frame's stack arguments to the callee frame's stack argument.
unsigned offsetFromFPToCallerStackArgs = sizeof(Frame);
ArgTypeVector args(fi.funcType());
for (WasmABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter i(args); !i.done(); i++) {
if (i->kind() != ABIArg::Stack) {
continue;
}
@ -1998,7 +1979,7 @@ static bool GenerateImportInterpExit(MacroAssembler& masm, const FuncImport& fi,
// The padding between stack args and argv ensures that argv is aligned. The
// padding between argv and retaddr ensures that sp is aligned.
unsigned argOffset =
AlignBytes(StackArgBytesForNativeABI(invokeArgTypes), sizeof(double));
AlignBytes(StackArgBytes(invokeArgTypes), sizeof(double));
// The abiArgCount includes a stack result pointer argument if needed.
unsigned abiArgCount = ArgTypeVector(fi.funcType()).lengthWithStackResults();
unsigned argBytes = std::max<size_t>(1, abiArgCount) * sizeof(Value);
@ -2011,7 +1992,7 @@ static bool GenerateImportInterpExit(MacroAssembler& masm, const FuncImport& fi,
offsets);
// Fill the argument array.
unsigned offsetFromFPToCallerStackArgs = sizeof(FrameWithTls);
unsigned offsetFromFPToCallerStackArgs = sizeof(Frame);
Register scratch = ABINonArgReturnReg0;
Register scratch2 = ABINonArgReturnReg1;
// The scratch3 reg does not need to be non-volatile, but has to be
@ -2232,7 +2213,7 @@ static bool GenerateImportJitExit(MacroAssembler& masm, const FuncImport& fi,
argOffset += sizeof(Value);
// 5. Fill the arguments.
const uint32_t offsetFromFPToCallerStackArgs = sizeof(FrameWithTls);
const uint32_t offsetFromFPToCallerStackArgs = sizeof(Frame);
Register scratch = ABINonArgReturnReg1; // Repeatedly clobbered
Register scratch2 = ABINonArgReturnReg0; // Reused as callee below
// The scratch3 reg does not need to be non-volatile, but has to be
@ -2410,7 +2391,7 @@ static bool GenerateImportJitExit(MacroAssembler& masm, const FuncImport& fi,
MIRTypeVector coerceArgTypes;
MOZ_ALWAYS_TRUE(coerceArgTypes.append(MIRType::Pointer));
unsigned offsetToCoerceArgv =
AlignBytes(StackArgBytesForWasmABI(coerceArgTypes), sizeof(Value));
AlignBytes(StackArgBytes(coerceArgTypes), sizeof(Value));
MOZ_ASSERT(nativeFramePushed >= offsetToCoerceArgv + sizeof(Value));
AssertStackAlignment(masm, ABIStackAlignment);
@ -2541,14 +2522,14 @@ bool wasm::GenerateBuiltinThunk(MacroAssembler& masm, ABIFunctionType abiType,
uint32_t framePushed =
StackDecrementForCall(ABIStackAlignment,
sizeof(Frame), // pushed by prologue
StackArgBytesForNativeABI(args));
StackArgBytes(args));
GenerateExitPrologue(masm, framePushed, exitReason, offsets);
// Copy out and convert caller arguments, if needed.
unsigned offsetFromFPToCallerStackArgs = sizeof(FrameWithTls);
unsigned offsetFromFPToCallerStackArgs = sizeof(Frame);
Register scratch = ABINonArgReturnReg0;
for (ABIArgIter i(args); !i.done(); i++) {
for (ABIArgIter<ABIFunctionArgs> i(args); !i.done(); i++) {
if (i->argInRegister()) {
#ifdef JS_CODEGEN_ARM
// Non hard-fp passes the args values in GPRs.

View File

@ -50,8 +50,8 @@ namespace js {
namespace jit {
class JitScript;
enum class RoundingMode;
template <class VecT, class ABIArgGeneratorT>
class ABIArgIterBase;
template <class VecT>
class ABIArgIter;
} // namespace jit
// This is a widespread header, so lets keep out the core wasm impl types.
@ -1276,13 +1276,13 @@ class ArgTypeVector {
const ValTypeVector& args_;
bool hasStackResults_;
// To allow ABIArgIterBase<VecT, ABIArgGeneratorT>, we define a private
// length() method. To prevent accidental errors, other users need to be
// To allow ABIArgIter<ArgTypeVector>, we define a private length()
// method. To prevent accidental errors, other users need to be
// explicit and call lengthWithStackResults() or
// lengthWithoutStackResults().
size_t length() const { return args_.length() + size_t(hasStackResults_); }
template <class VecT, class ABIArgGeneratorT>
friend class jit::ABIArgIterBase;
friend jit::ABIArgIter<ArgTypeVector>;
friend jit::ABIArgIter<const ArgTypeVector>;
public:
ArgTypeVector(const ValTypeVector& args, StackResults stackResults)
@ -2552,7 +2552,6 @@ class CallSiteDesc {
}
uint32_t lineOrBytecode() const { return lineOrBytecode_; }
Kind kind() const { return Kind(kind_); }
bool mightBeCrossInstance() const { return kind() == CallSiteDesc::Dynamic; }
};
class CallSite : public CallSiteDesc {
@ -3286,39 +3285,6 @@ class Frame {
static_assert(!std::is_polymorphic_v<Frame>, "Frame doesn't need a vtable.");
class FrameWithTls : public Frame {
TlsData* calleeTls_;
TlsData* callerTls_;
public:
static FrameWithTls* from(Frame* fp) {
return reinterpret_cast<FrameWithTls*>(fp);
}
TlsData* calleeTls() { return calleeTls_; }
TlsData* callerTls() { return callerTls_; }
constexpr static uint32_t sizeWithoutFrame() {
return sizeof(wasm::FrameWithTls) - sizeof(wasm::Frame);
}
constexpr static uint32_t calleeTLSABIOffset() {
return offsetof(FrameWithTls, calleeTls_) - sizeof(wasm::Frame);
}
constexpr static uint32_t callerTLSABIOffset() {
return offsetof(FrameWithTls, callerTls_) - sizeof(wasm::Frame);
}
};
static_assert(FrameWithTls::calleeTLSABIOffset() == 0u,
"Callee tls stored right above the return address.");
static_assert(FrameWithTls::callerTLSABIOffset() == sizeof(void*),
"Caller tls stored right above the callee tls.");
static_assert(FrameWithTls::sizeWithoutFrame() == 2 * sizeof(void*),
"There are only two additional slots");
#if defined(JS_CODEGEN_ARM64)
static_assert(sizeof(Frame) % 16 == 0, "frame is aligned");
#endif