Bug 1661256 part 12 - Convert calls to JS_MASM_VERBOSE functions called with callWithABI. r=lth

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

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

@ -58,10 +58,13 @@ namespace jit {
_(js::irregexp::CaseInsensitiveCompareNonUnicode) \ _(js::irregexp::CaseInsensitiveCompareNonUnicode) \
_(js::irregexp::CaseInsensitiveCompareUnicode) \ _(js::irregexp::CaseInsensitiveCompareUnicode) \
_(js::irregexp::GrowBacktrackStack) \ _(js::irregexp::GrowBacktrackStack) \
_(js::jit::AssumeUnreachable) \
_(js::jit::Bailout) \ _(js::jit::Bailout) \
_(js::jit::FinishBailoutToBaseline) \ _(js::jit::FinishBailoutToBaseline) \
_(js::jit::InitBaselineFrameForOsr) \ _(js::jit::InitBaselineFrameForOsr) \
_(js::jit::InvalidationBailout) \ _(js::jit::InvalidationBailout) \
_(js::jit::Printf0) \
_(js::jit::Printf1) \
_(js::NumberMod) \ _(js::NumberMod) \
_(js::powi) \ _(js::powi) \
_(js::RegExpInstanceOptimizableRaw) \ _(js::RegExpInstanceOptimizableRaw) \

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

@ -17,6 +17,7 @@
#include "builtin/TypedObject.h" #include "builtin/TypedObject.h"
#include "gc/GCProbes.h" #include "gc/GCProbes.h"
#include "jit/ABIFunctions.h"
#include "jit/AtomicOp.h" #include "jit/AtomicOp.h"
#include "jit/AtomicOperations.h" #include "jit/AtomicOperations.h"
#include "jit/Bailouts.h" #include "jit/Bailouts.h"
@ -30,7 +31,6 @@
#include "jit/SharedICHelpers.h" #include "jit/SharedICHelpers.h"
#include "jit/Simulator.h" #include "jit/Simulator.h"
#include "js/Conversions.h" #include "js/Conversions.h"
#include "js/Printf.h"
#include "js/ScalarType.h" // js::Scalar::Type #include "js/ScalarType.h" // js::Scalar::Type
#include "vm/ArgumentsObject.h" #include "vm/ArgumentsObject.h"
#include "vm/ArrayBufferViewObject.h" #include "vm/ArrayBufferViewObject.h"
@ -39,6 +39,7 @@
#include "vm/TypedArrayObject.h" #include "vm/TypedArrayObject.h"
#include "gc/Nursery-inl.h" #include "gc/Nursery-inl.h"
#include "jit/ABIFunctionList-inl.h"
#include "jit/shared/Lowering-shared-inl.h" #include "jit/shared/Lowering-shared-inl.h"
#include "jit/TemplateObject-inl.h" #include "jit/TemplateObject-inl.h"
#include "vm/Interpreter-inl.h" #include "vm/Interpreter-inl.h"
@ -2162,12 +2163,6 @@ void MacroAssembler::handleFailure() {
jump(excTail); jump(excTail);
} }
#ifdef JS_MASM_VERBOSE
static void AssumeUnreachable_(const char* output) {
MOZ_ReportAssertionFailure(output, __FILE__, __LINE__);
}
#endif
void MacroAssembler::assumeUnreachable(const char* output) { void MacroAssembler::assumeUnreachable(const char* output) {
#ifdef JS_MASM_VERBOSE #ifdef JS_MASM_VERBOSE
if (!IsCompilingWasm()) { if (!IsCompilingWasm()) {
@ -2176,11 +2171,12 @@ void MacroAssembler::assumeUnreachable(const char* output) {
PushRegsInMask(save); PushRegsInMask(save);
Register temp = regs.takeAnyGeneral(); Register temp = regs.takeAnyGeneral();
using Fn = void (*)(const char* output);
setupUnalignedABICall(temp); setupUnalignedABICall(temp);
movePtr(ImmPtr(output), temp); movePtr(ImmPtr(output), temp);
passABIArg(temp); passABIArg(temp);
callWithABI(JS_FUNC_TO_DATA_PTR(void*, AssumeUnreachable_), MoveOp::GENERAL, callWithABI<Fn, AssumeUnreachable>(MoveOp::GENERAL,
CheckUnsafeCallWithABI::DontCheckOther); CheckUnsafeCallWithABI::DontCheckOther);
PopRegsInMask(save); PopRegsInMask(save);
} }
@ -2203,17 +2199,6 @@ void MacroAssembler::assertTestInt32(Condition cond, const T& value,
template void MacroAssembler::assertTestInt32(Condition, const Address&, template void MacroAssembler::assertTestInt32(Condition, const Address&,
const char*); const char*);
#ifdef JS_MASM_VERBOSE
static void Printf0_(const char* output) {
AutoUnsafeCallWithABI unsafe;
// Use stderr instead of stdout because this is only used for debug
// output. stderr is less likely to interfere with the program's normal
// output, and it's always unbuffered.
fprintf(stderr, "%s", output);
}
#endif
void MacroAssembler::printf(const char* output) { void MacroAssembler::printf(const char* output) {
#ifdef JS_MASM_VERBOSE #ifdef JS_MASM_VERBOSE
AllocatableRegisterSet regs(RegisterSet::Volatile()); AllocatableRegisterSet regs(RegisterSet::Volatile());
@ -2222,27 +2207,16 @@ void MacroAssembler::printf(const char* output) {
Register temp = regs.takeAnyGeneral(); Register temp = regs.takeAnyGeneral();
using Fn = void (*)(const char* output);
setupUnalignedABICall(temp); setupUnalignedABICall(temp);
movePtr(ImmPtr(output), temp); movePtr(ImmPtr(output), temp);
passABIArg(temp); passABIArg(temp);
callWithABI(JS_FUNC_TO_DATA_PTR(void*, Printf0_)); callWithABI<Fn, Printf0>();
PopRegsInMask(save); PopRegsInMask(save);
#endif #endif
} }
#ifdef JS_MASM_VERBOSE
static void Printf1_(const char* output, uintptr_t value) {
AutoUnsafeCallWithABI unsafe;
AutoEnterOOMUnsafeRegion oomUnsafe;
js::UniqueChars line = JS_sprintf_append(nullptr, output, value);
if (!line) {
oomUnsafe.crash("OOM at masm.printf");
}
fprintf(stderr, "%s", line.get());
}
#endif
void MacroAssembler::printf(const char* output, Register value) { void MacroAssembler::printf(const char* output, Register value) {
#ifdef JS_MASM_VERBOSE #ifdef JS_MASM_VERBOSE
AllocatableRegisterSet regs(RegisterSet::Volatile()); AllocatableRegisterSet regs(RegisterSet::Volatile());
@ -2253,11 +2227,12 @@ void MacroAssembler::printf(const char* output, Register value) {
Register temp = regs.takeAnyGeneral(); Register temp = regs.takeAnyGeneral();
using Fn = void (*)(const char* output, uintptr_t value);
setupUnalignedABICall(temp); setupUnalignedABICall(temp);
movePtr(ImmPtr(output), temp); movePtr(ImmPtr(output), temp);
passABIArg(temp); passABIArg(temp);
passABIArg(value); passABIArg(value);
callWithABI(JS_FUNC_TO_DATA_PTR(void*, Printf1_)); callWithABI<Fn, Printf1>();
PopRegsInMask(save); PopRegsInMask(save);
#endif #endif

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

@ -20,6 +20,7 @@
#include "jit/mips64/Simulator-mips64.h" #include "jit/mips64/Simulator-mips64.h"
#include "js/friend/StackLimits.h" // js::CheckRecursionLimitWithExtra #include "js/friend/StackLimits.h" // js::CheckRecursionLimitWithExtra
#include "js/friend/WindowProxy.h" // js::IsWindow #include "js/friend/WindowProxy.h" // js::IsWindow
#include "js/Printf.h"
#include "vm/ArrayObject.h" #include "vm/ArrayObject.h"
#include "vm/EqualityOperations.h" // js::StrictlyEqual #include "vm/EqualityOperations.h" // js::StrictlyEqual
#include "vm/Interpreter.h" #include "vm/Interpreter.h"
@ -2414,5 +2415,28 @@ AtomicsReadWriteModifyFn AtomicsXor(Scalar::Type elementType) {
} }
} }
void AssumeUnreachable(const char* output) {
MOZ_ReportAssertionFailure(output, __FILE__, __LINE__);
}
void Printf0(const char* output) {
AutoUnsafeCallWithABI unsafe;
// Use stderr instead of stdout because this is only used for debug
// output. stderr is less likely to interfere with the program's normal
// output, and it's always unbuffered.
fprintf(stderr, "%s", output);
}
void Printf1(const char* output, uintptr_t value) {
AutoUnsafeCallWithABI unsafe;
AutoEnterOOMUnsafeRegion oomUnsafe;
js::UniqueChars line = JS_sprintf_append(nullptr, output, value);
if (!line) {
oomUnsafe.crash("OOM at masm.printf");
}
fprintf(stderr, "%s", line.get());
}
} // namespace jit } // namespace jit
} // namespace js } // namespace js

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

@ -1180,6 +1180,11 @@ AtomicsReadWriteModifyFn AtomicsAnd(Scalar::Type elementType);
AtomicsReadWriteModifyFn AtomicsOr(Scalar::Type elementType); AtomicsReadWriteModifyFn AtomicsOr(Scalar::Type elementType);
AtomicsReadWriteModifyFn AtomicsXor(Scalar::Type elementType); AtomicsReadWriteModifyFn AtomicsXor(Scalar::Type elementType);
// Functions used when JS_MASM_VERBOSE is enabled.
void AssumeUnreachable(const char* output);
void Printf0(const char* output);
void Printf1(const char* output, uintptr_t value);
enum class TailCallVMFunctionId; enum class TailCallVMFunctionId;
enum class VMFunctionId; enum class VMFunctionId;