зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485162 - Baldr: remove confusing StackDecrementForCall() overloads (r=bbouvier)
--HG-- extra : rebase_source : 6f95f9dde4a55b5484d8becf4e569a3592805dbf
This commit is contained in:
Родитель
08e1df1673
Коммит
7d61d0f147
|
@ -1012,7 +1012,7 @@ BaseLocalIter::BaseLocalIter(const ValTypeVector& locals, size_t argsLength, boo
|
|||
index_(0),
|
||||
localSize_(debugEnabled ? DebugFrame::offsetOfFrame() : 0),
|
||||
reservedSize_(localSize_),
|
||||
frameOffset_(0),
|
||||
frameOffset_(UINT32_MAX),
|
||||
mirType_(MIRType::Undefined),
|
||||
done_(false)
|
||||
{
|
||||
|
|
|
@ -53,12 +53,6 @@ AssertStackAlignment(MacroAssembler& masm, uint32_t alignment, uint32_t addBefor
|
|||
masm.assertStackAlignment(alignment, addBeforeAssert);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
StackDecrementForCall(MacroAssembler& masm, uint32_t alignment, unsigned bytesToPush)
|
||||
{
|
||||
return StackDecrementForCall(alignment, sizeof(Frame) + masm.framePushed(), bytesToPush);
|
||||
}
|
||||
|
||||
template <class VectorT>
|
||||
static unsigned
|
||||
StackArgBytes(const VectorT& args)
|
||||
|
@ -69,14 +63,6 @@ StackArgBytes(const VectorT& args)
|
|||
return iter.stackBytesConsumedSoFar();
|
||||
}
|
||||
|
||||
template <class VectorT>
|
||||
static unsigned
|
||||
StackDecrementForCall(MacroAssembler& masm, uint32_t alignment, const VectorT& args,
|
||||
unsigned extraBytes = 0)
|
||||
{
|
||||
return StackDecrementForCall(masm, alignment, StackArgBytes(args) + extraBytes);
|
||||
}
|
||||
|
||||
static void
|
||||
SetupABIArguments(MacroAssembler& masm, const FuncExport& fe, Register argv, Register scratch)
|
||||
{
|
||||
|
@ -563,7 +549,9 @@ GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex, const FuncExport&
|
|||
|
||||
// Note the jit caller ensures the stack is aligned *after* the call
|
||||
// instruction.
|
||||
unsigned frameSize = StackDecrementForCall(WasmStackAlignment, 0, bytesNeeded);
|
||||
unsigned frameSize = StackDecrementForCall(WasmStackAlignment,
|
||||
masm.framePushed(),
|
||||
bytesNeeded);
|
||||
|
||||
#ifdef ENABLE_WASM_GC
|
||||
unsigned savedTlsOffset = frameSize - sizeof(void*);
|
||||
|
@ -998,7 +986,10 @@ GenerateImportFunction(jit::MacroAssembler& masm, const FuncImport& fi, FuncType
|
|||
|
||||
GenerateFunctionPrologue(masm, funcTypeId, Nothing(), offsets);
|
||||
|
||||
unsigned framePushed = StackDecrementForCall(masm, WasmStackAlignment, fi.funcType().args());
|
||||
MOZ_ASSERT(masm.framePushed() == 0);
|
||||
unsigned framePushed = StackDecrementForCall(WasmStackAlignment,
|
||||
sizeof(Frame), // pushed by prologue
|
||||
StackArgBytes(fi.funcType().args()));
|
||||
masm.wasmReserveStackChecked(framePushed, BytecodeOffset(0));
|
||||
MOZ_ASSERT(masm.framePushed() == framePushed);
|
||||
|
||||
|
@ -1085,7 +1076,9 @@ GenerateImportInterpExit(MacroAssembler& masm, const FuncImport& fi, uint32_t fu
|
|||
// padding between argv and retaddr ensures that sp is aligned.
|
||||
unsigned argOffset = AlignBytes(StackArgBytes(invokeArgTypes), sizeof(double));
|
||||
unsigned argBytes = Max<size_t>(1, fi.funcType().args().length()) * sizeof(Value);
|
||||
unsigned framePushed = StackDecrementForCall(masm, ABIStackAlignment, argOffset + argBytes);
|
||||
unsigned framePushed = StackDecrementForCall(ABIStackAlignment,
|
||||
sizeof(Frame), // pushed by prologue
|
||||
argOffset + argBytes);
|
||||
|
||||
GenerateExitPrologue(masm, framePushed, ExitReason::Fixed::ImportInterp, offsets);
|
||||
|
||||
|
@ -1195,17 +1188,17 @@ GenerateImportJitExit(MacroAssembler& masm, const FuncImport& fi, Label* throwLa
|
|||
masm.setFramePushed(0);
|
||||
|
||||
// JIT calls use the following stack layout (sp grows to the left):
|
||||
// | retaddr | descriptor | callee | argc | this | arg1..N |
|
||||
// After the JIT frame, the global register (if present) is saved since the
|
||||
// JIT's ABI does not preserve non-volatile regs. Also, unlike most ABIs,
|
||||
// the JIT ABI requires that sp be JitStackAlignment-aligned *after* pushing
|
||||
// the return address.
|
||||
// | WasmToJSJitFrameLayout | this | arg1..N |
|
||||
// Unlike most ABIs, the JIT ABI requires that sp be JitStackAlignment-
|
||||
// aligned *after* pushing the return address.
|
||||
static_assert(WasmStackAlignment >= JitStackAlignment, "subsumes");
|
||||
const unsigned sizeOfRetAddr = sizeof(void*);
|
||||
const unsigned sizeOfPreFrame = WasmToJSJitFrameLayout::Size() - sizeOfRetAddr;
|
||||
const unsigned sizeOfThisAndArgs = (1 + fi.funcType().args().length()) * sizeof(Value);
|
||||
const unsigned totalJitFrameBytes = sizeOfRetAddr + sizeOfPreFrame + sizeOfThisAndArgs;
|
||||
const unsigned jitFramePushed = StackDecrementForCall(masm, JitStackAlignment, totalJitFrameBytes) -
|
||||
const unsigned jitFramePushed = StackDecrementForCall(JitStackAlignment,
|
||||
sizeof(Frame), // pushed by prologue
|
||||
totalJitFrameBytes) -
|
||||
sizeOfRetAddr;
|
||||
const unsigned sizeOfThisAndArgsAndPadding = jitFramePushed - sizeOfPreFrame;
|
||||
|
||||
|
@ -1460,7 +1453,9 @@ wasm::GenerateBuiltinThunk(MacroAssembler& masm, ABIFunctionType abiType, ExitRe
|
|||
masm.setFramePushed(0);
|
||||
|
||||
ABIFunctionArgs args(abiType);
|
||||
uint32_t framePushed = StackDecrementForCall(masm, ABIStackAlignment, args);
|
||||
uint32_t framePushed = StackDecrementForCall(ABIStackAlignment,
|
||||
sizeof(Frame), // pushed by prologue
|
||||
StackArgBytes(args));
|
||||
|
||||
GenerateExitPrologue(masm, framePushed, exitReason, offsets);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче