Bug 1661256 part 13 - Convert HandleException callWithABI calls and make them explicit. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D91793
This commit is contained in:
Nicolas B. Pierron 2020-10-05 16:55:37 +00:00
Родитель 324ad1fd7b
Коммит f91e2f9be9
22 изменённых файлов: 47 добавлений и 43 удалений

Просмотреть файл

@ -23,6 +23,7 @@
#include "jit/Bailouts.h" // js::jit::FinishBailoutToBaseline, js::jit::Bailout,
// js::jit::InvalidationBailout
#include "jit/JitFrames.h" // HandleException
#include "jit/VMFunctions.h" // Rest of js::jit::* functions.
#include "js/Conversions.h" // JS::ToInt32
@ -61,6 +62,7 @@ namespace jit {
_(js::jit::AssumeUnreachable) \
_(js::jit::Bailout) \
_(js::jit::FinishBailoutToBaseline) \
_(js::jit::HandleException) \
_(js::jit::InitBaselineFrameForOsr) \
_(js::jit::InvalidationBailout) \
_(js::jit::Printf0) \

Просмотреть файл

@ -221,8 +221,7 @@ bool JitRuntime::generateTrampolines(JSContext* cx) {
generateProfilerExitFrameTailStub(masm, &profilerExitTail);
JitSpew(JitSpew_Codegen, "# Emitting exception tail stub");
void* handler = JS_FUNC_TO_DATA_PTR(void*, jit::HandleException);
generateExceptionTailStub(masm, handler, &profilerExitTail);
generateExceptionTailStub(masm, &profilerExitTail);
Linker linker(masm);
trampolineCode_ = linker.newCode(cx, CodeKind::Other);

Просмотреть файл

@ -258,8 +258,7 @@ class JitRuntime {
void generateDoubleToInt32ValueStub(MacroAssembler& masm);
void generateProfilerExitFrameTailStub(MacroAssembler& masm,
Label* profilerExitTail);
void generateExceptionTailStub(MacroAssembler& masm, void* handler,
Label* profilerExitTail);
void generateExceptionTailStub(MacroAssembler& masm, Label* profilerExitTail);
void generateBailoutTailStub(MacroAssembler& masm, Label* bailoutTail);
void generateEnterJIT(JSContext* cx, MacroAssembler& masm);
void generateArgumentsRectifier(MacroAssembler& masm,

Просмотреть файл

@ -3300,7 +3300,7 @@ void MacroAssemblerARMCompat::checkStackAlignment() {
}
void MacroAssemblerARMCompat::handleFailureWithHandlerTail(
void* handler, Label* profilerExitTail) {
Label* profilerExitTail) {
// Reserve space for exception information.
int size = (sizeof(ResumeFromException) + 7) & ~7;
@ -3309,10 +3309,11 @@ void MacroAssemblerARMCompat::handleFailureWithHandlerTail(
ma_mov(sp, r0);
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(r1);
asMasm().passABIArg(r0);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -1114,7 +1114,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM {
void storeTypeTag(ImmTag tag, const Address& dest);
void storeTypeTag(ImmTag tag, const BaseIndex& dest);
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
/////////////////////////////////////////////////////////////////
// Common interface.

Просмотреть файл

@ -979,12 +979,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,

Просмотреть файл

@ -143,7 +143,7 @@ void MacroAssemblerCompat::loadPrivate(const Address& src, Register dest) {
}
void MacroAssemblerCompat::handleFailureWithHandlerTail(
void* handler, Label* profilerExitTail) {
Label* profilerExitTail) {
// Reserve space for exception information.
int64_t size = (sizeof(ResumeFromException) + 7) & ~7;
Sub(GetStackPointer64(), GetStackPointer64(), Operand(size));
@ -154,10 +154,11 @@ void MacroAssemblerCompat::handleFailureWithHandlerTail(
Mov(x0, GetStackPointer64());
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(r1);
asMasm().passABIArg(r0);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -2002,7 +2002,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
}
public:
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
void profilerEnterFrame(Register framePtr, Register scratch);
void profilerEnterFrame(RegisterOrSP framePtr, Register scratch);

Просмотреть файл

@ -815,12 +815,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,

Просмотреть файл

@ -1747,7 +1747,7 @@ void MacroAssemblerMIPSCompat::restoreStackPointer() {
}
void MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(
void* handler, Label* profilerExitTail) {
Label* profilerExitTail) {
// Reserve space for exception information.
int size = (sizeof(ResumeFromException) + ABIStackAlignment) &
~(ABIStackAlignment - 1);
@ -1755,10 +1755,11 @@ void MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(
ma_move(a0, StackPointer); // Use a0 since it is a first function argument
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(a1);
asMasm().passABIArg(a0);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -568,7 +568,7 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS {
void storeTypeTag(ImmTag tag, Address dest);
void storeTypeTag(ImmTag tag, const BaseIndex& dest);
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
template <typename T>
void wasmAtomicStore64(const wasm::MemoryAccessDesc& access, const T& mem,

Просмотреть файл

@ -967,12 +967,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,

Просмотреть файл

@ -1608,7 +1608,7 @@ void MacroAssemblerMIPS64Compat::checkStackAlignment() {
}
void MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(
void* handler, Label* profilerExitTail) {
Label* profilerExitTail) {
// Reserve space for exception information.
int size = (sizeof(ResumeFromException) + ABIStackAlignment) &
~(ABIStackAlignment - 1);
@ -1616,10 +1616,11 @@ void MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(
ma_move(a0, StackPointer); // Use a0 since it is a first function argument
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(a1);
asMasm().passABIArg(a0);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -592,7 +592,7 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 {
}
void pushValue(const Address& addr);
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
/////////////////////////////////////////////////////////////////
// Common interface.

Просмотреть файл

@ -919,12 +919,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,

Просмотреть файл

@ -587,7 +587,7 @@ class MacroAssemblerNone : public Assembler {
void convertUInt32ToFloat32(Register, FloatRegister) { MOZ_CRASH(); }
void incrementInt32Value(Address) { MOZ_CRASH(); }
void ensureDouble(ValueOperand, FloatRegister, Label*) { MOZ_CRASH(); }
void handleFailureWithHandlerTail(void*) { MOZ_CRASH(); }
void handleFailureWithHandlerTail(Label*) { MOZ_CRASH(); }
void buildFakeExitFrame(Register, uint32_t*) { MOZ_CRASH(); }
bool buildOOLFakeExitFrame(void*) { MOZ_CRASH(); }

Просмотреть файл

@ -144,17 +144,17 @@ void MacroAssemblerX64::boxValue(JSValueType type, Register src,
orq(src, dest);
}
void MacroAssemblerX64::handleFailureWithHandlerTail(void* handler,
Label* profilerExitTail) {
void MacroAssemblerX64::handleFailureWithHandlerTail(Label* profilerExitTail) {
// Reserve space for exception information.
subq(Imm32(sizeof(ResumeFromException)), rsp);
movq(rsp, rax);
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(rcx);
asMasm().passABIArg(rax);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -1024,7 +1024,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared {
Label* failure);
public:
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
// Instrumentation for entering and leaving the profiler.
void profilerEnterFrame(Register framePtr, Register scratch);

Просмотреть файл

@ -853,12 +853,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,

Просмотреть файл

@ -134,17 +134,17 @@ void MacroAssemblerX86::finish() {
}
}
void MacroAssemblerX86::handleFailureWithHandlerTail(void* handler,
Label* profilerExitTail) {
void MacroAssemblerX86::handleFailureWithHandlerTail(Label* profilerExitTail) {
// Reserve space for exception information.
subl(Imm32(sizeof(ResumeFromException)), esp);
movl(esp, eax);
// Call the handler.
using Fn = void (*)(ResumeFromException * rfe);
asMasm().setupUnalignedABICall(ecx);
asMasm().passABIArg(eax);
asMasm().callWithABI(handler, MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckHasExitFrame);
asMasm().callWithABI<Fn, HandleException>(
MoveOp::GENERAL, CheckUnsafeCallWithABI::DontCheckHasExitFrame);
Label entryFrame;
Label catch_;

Просмотреть файл

@ -941,7 +941,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared {
public:
// Used from within an Exit frame to handle a pending exception.
void handleFailureWithHandlerTail(void* handler, Label* profilerExitTail);
void handleFailureWithHandlerTail(Label* profilerExitTail);
// Instrumentation for entering and leaving the profiler.
void profilerEnterFrame(Register framePtr, Register scratch);

Просмотреть файл

@ -871,12 +871,12 @@ uint32_t JitRuntime::generatePreBarrier(JSContext* cx, MacroAssembler& masm,
return offset;
}
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm, void* handler,
void JitRuntime::generateExceptionTailStub(MacroAssembler& masm,
Label* profilerExitTail) {
exceptionTailOffset_ = startTrampolineCode(masm);
masm.bind(masm.failureLabel());
masm.handleFailureWithHandlerTail(handler, profilerExitTail);
masm.handleFailureWithHandlerTail(profilerExitTail);
}
void JitRuntime::generateBailoutTailStub(MacroAssembler& masm,