From bb62e3366b70c6f9ba93938c3c6e03bf94b5e638 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Mon, 5 Oct 2020 16:56:24 +0000 Subject: [PATCH] Bug 1661256 part 31 - Convert BigInt's callWithABI calls. r=iain Differential Revision: https://phabricator.services.mozilla.com/D91811 --- js/src/jit/ABIFunctionList-inl.h | 9 +++++ js/src/jit/CacheIRCompiler.cpp | 62 +++++++++++++++----------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/js/src/jit/ABIFunctionList-inl.h b/js/src/jit/ABIFunctionList-inl.h index e7754566a3a8..8d5da7eb37f3 100644 --- a/js/src/jit/ABIFunctionList-inl.h +++ b/js/src/jit/ABIFunctionList-inl.h @@ -103,6 +103,12 @@ namespace jit { _(js::jit::AssertValidValue) \ _(js::jit::AssumeUnreachable) \ _(js::jit::Bailout) \ + _(js::jit::BigIntNumberEqual) \ + _(js::jit::BigIntNumberEqual) \ + _(js::jit::BigIntNumberCompare) \ + _(js::jit::NumberBigIntCompare) \ + _(js::jit::NumberBigIntCompare) \ + _(js::jit::BigIntNumberCompare) \ _(js::jit::CreateMatchResultFallbackFunc) \ _(js::jit::FinishBailoutToBaseline) \ _(js::jit::GetDynamicNamePure) \ @@ -153,6 +159,9 @@ namespace jit { #define ABIFUNCTIONSIG_LIST(_) \ _(AtomicsCompareExchangeFn) \ _(AtomicsReadWriteModifyFn) \ + _(bool (*)(BigInt*, BigInt*)) \ + _(bool (*)(BigInt*, double)) \ + _(bool (*)(double, BigInt*)) \ _(float (*)(float)) \ _(JSJitGetterOp) \ _(JSJitMethodOp) \ diff --git a/js/src/jit/CacheIRCompiler.cpp b/js/src/jit/CacheIRCompiler.cpp index 47db008623b8..8588962e198f 100644 --- a/js/src/jit/CacheIRCompiler.cpp +++ b/js/src/jit/CacheIRCompiler.cpp @@ -6107,7 +6107,7 @@ bool CacheIRCompiler::emitCompareBigIntResult(JSOp op, BigIntOperandId lhsId, fn = jit::BigIntCompare; } - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, fn)); + masm.callWithABI(DynamicFunction(fn)); masm.storeCallBoolResult(scratch); LiveRegisterSet ignore; @@ -6293,45 +6293,43 @@ bool CacheIRCompiler::emitCompareBigIntNumberResult(JSOp op, using FnBigIntNumber = bool (*)(BigInt*, double); using FnNumberBigInt = bool (*)(double, BigInt*); - void* fun; switch (op) { case JSOp::Eq: { - FnBigIntNumber fn = jit::BigIntNumberEqual; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Ne: { - FnBigIntNumber fn = jit::BigIntNumberEqual; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Lt: { - FnBigIntNumber fn = jit::BigIntNumberCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Gt: { - FnNumberBigInt fn = jit::NumberBigIntCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Le: { - FnNumberBigInt fn = - jit::NumberBigIntCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI< + FnNumberBigInt, + jit::NumberBigIntCompare>(); break; } case JSOp::Ge: { - FnBigIntNumber fn = - jit::BigIntNumberCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI< + FnBigIntNumber, + jit::BigIntNumberCompare>(); break; } default: MOZ_CRASH("unhandled op"); } - masm.callWithABI(fun); masm.storeCallBoolResult(scratch); LiveRegisterSet ignore; @@ -6376,45 +6374,43 @@ bool CacheIRCompiler::emitCompareNumberBigIntResult(JSOp op, using FnBigIntNumber = bool (*)(BigInt*, double); using FnNumberBigInt = bool (*)(double, BigInt*); - void* fun; switch (op) { case JSOp::Eq: { - FnBigIntNumber fn = jit::BigIntNumberEqual; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Ne: { - FnBigIntNumber fn = jit::BigIntNumberEqual; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Lt: { - FnNumberBigInt fn = jit::NumberBigIntCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Gt: { - FnBigIntNumber fn = jit::BigIntNumberCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI>(); break; } case JSOp::Le: { - FnBigIntNumber fn = - jit::BigIntNumberCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI< + FnBigIntNumber, + jit::BigIntNumberCompare>(); break; } case JSOp::Ge: { - FnNumberBigInt fn = - jit::NumberBigIntCompare; - fun = JS_FUNC_TO_DATA_PTR(void*, fn); + masm.callWithABI< + FnNumberBigInt, + jit::NumberBigIntCompare>(); break; } default: MOZ_CRASH("unhandled op"); } - masm.callWithABI(fun); masm.storeCallBoolResult(scratch); LiveRegisterSet ignore;