author | Lars T Hansen <lhansen@mozilla.com> |
Wed, 07 Nov 2018 15:12:56 +0100 | |
changeset 501587 | f9108997903c74814e3f3b4d8d9548bcbf9e7149 |
parent 501586 | 5ece74940a5f39b5c2840400ed05112ebf1eaa15 |
child 501588 | 072bf0d7270d25d4892967402c0a1c5eebe0bf9b |
push id | 10290 |
push user | ffxbld-merge |
push date | Mon, 03 Dec 2018 16:23:23 +0000 |
treeherder | mozilla-beta@700bed2445e6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bbouvier |
bugs | 1488515 |
milestone | 65.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/jit-test/tests/wasm/regress/baseline-builtin-abi.js | file | annotate | diff | comparison | revisions | |
js/src/wasm/WasmBaselineCompile.cpp | file | annotate | diff | comparison | revisions |
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/baseline-builtin-abi.js @@ -0,0 +1,20 @@ +// Bug 1488515 - ABI issues on Android because both the baseline compiler and +// the builtin thunks converted between hardFP and softFP. + +var prog = wasmEvalText( + `(module + (func $f64div (export "test") (param $a f64) (param $b f64) (result f64) + (local $dummy0 i32) + (local $dummy1 i32) + (local $dummy2 i32) + (local $dummy3 i32) + (local $dummy4 i32) + (local $x f64) + (local $y f64) + (local $z f64) + (set_local $x (get_local $a)) + (set_local $y (get_local $b)) + (set_local $z (f64.floor (f64.div (get_local $x) (get_local $y)))) + (get_local $z)))`); + +assertEq(prog.exports.test(16096, 32), 503);
--- a/js/src/wasm/WasmBaselineCompile.cpp +++ b/js/src/wasm/WasmBaselineCompile.cpp @@ -162,32 +162,38 @@ using IsKnownNotZero = bool; using IsUnsigned = bool; using NeedsBoundsCheck = bool; using PopStack = bool; using WantResult = bool; using ZeroOnOverflow = bool; class BaseStackFrame; +// Two flags, useABI and interModule, control how calls are made. +// // UseABI::Wasm implies that the Tls/Heap/Global registers are nonvolatile, // except when InterModule::True is also set, when they are volatile. // +// UseABI::Builtin implies that the Tls/Heap/Global registers are volatile. +// In this case, we require InterModule::False. The calling convention +// is otherwise like UseABI::Wasm. +// // UseABI::System implies that the Tls/Heap/Global registers are volatile. // Additionally, the parameter passing mechanism may be slightly different from // the UseABI::Wasm convention. // // When the Tls/Heap/Global registers are not volatile, the baseline compiler // will restore the Tls register from its save slot before the call, since the // baseline compiler uses the Tls register for other things. // // When those registers are volatile, the baseline compiler will reload them // after the call (it will restore the Tls register from the save slot and load // the other two from the Tls data). -enum class UseABI { Wasm, System }; +enum class UseABI { Wasm, Builtin, System }; enum class InterModule { False = false, True = true }; #if defined(JS_CODEGEN_NONE) # define RABALDR_SCRATCH_I32 # define RABALDR_SCRATCH_F32 # define RABALDR_SCRATCH_F64 static const Register RabaldrScratchI32 = Register::Invalid(); @@ -3637,33 +3643,34 @@ class BaseCompiler final : public BaseCo bool hardFP; #endif size_t frameAlignAdjustment; size_t stackArgAreaSize; }; void beginCall(FunctionCall& call, UseABI useABI, InterModule interModule) { + MOZ_ASSERT_IF(useABI == UseABI::Builtin, interModule == InterModule::False); + call.isInterModule = interModule == InterModule::True; call.usesSystemAbi = useABI == UseABI::System; if (call.usesSystemAbi) { // Call-outs need to use the appropriate system ABI. #if defined(JS_CODEGEN_ARM) -# if defined(JS_SIMULATOR_ARM) call.hardFP = UseHardFpABI(); -# elif defined(JS_CODEGEN_ARM_HARDFP) - call.hardFP = true; -# else - call.hardFP = false; -# endif call.abi.setUseHardFp(call.hardFP); #elif defined(JS_CODEGEN_MIPS32) call.abi.enforceO32ABI(); #endif + } else { +#if defined(JS_CODEGEN_ARM) + MOZ_ASSERT(call.hardFP, + "All private ABIs pass FP arguments in registers"); +#endif } // Use masm.framePushed() because the value we want here does not depend // on the height of the frame's stack area, but the actual size of the // allocated frame. call.frameAlignAdjustment = ComputeByteAlignment(masm.framePushed() + sizeof(Frame), JitStackAlignment); } @@ -8256,17 +8263,17 @@ BaseCompiler::emitUnaryMathBuiltinCall(S sync(); ValTypeVector& signature = operandType == ValType::F32 ? SigF_ : SigD_; ExprType retType = operandType == ValType::F32 ? ExprType::F32 : ExprType::F64; uint32_t numArgs = signature.length(); size_t stackSpace = stackConsumed(numArgs); FunctionCall baselineCall(lineOrBytecode); - beginCall(baselineCall, UseABI::System, InterModule::False); + beginCall(baselineCall, UseABI::Builtin, InterModule::False); if (!emitCallArgs(signature, &baselineCall)) { return false; } builtinCall(callee, baselineCall); endCall(baselineCall, stackSpace);