author | André Bargull <andre.bargull@gmail.com> |
Tue, 07 Apr 2020 08:35:07 +0000 | |
changeset 522630 | b801d8007636e2a979eb1c93dcb82e20fe468ba2 |
parent 522629 | 43db59ebd874bf2dcbddd9d6feb0319ccf1a9e70 |
child 522631 | bd3e77b5b2e935b1a371f363e159187cf0fd5c1c |
push id | 37293 |
push user | apavel@mozilla.com |
push date | Tue, 07 Apr 2020 21:44:02 +0000 |
treeherder | mozilla-central@de63e64b9090 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jandem |
bugs | 1627618 |
milestone | 77.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/MIR.h | file | annotate | diff | comparison | revisions | |
js/src/wasm/WasmIonCompile.cpp | file | annotate | diff | comparison | revisions |
--- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -5351,38 +5351,42 @@ class MMathFunction : public MUnaryInstr }; class MAdd : public MBinaryArithInstruction { MAdd(MDefinition* left, MDefinition* right) : MBinaryArithInstruction(classOpcode, left, right) { setResultType(MIRType::Value); } - MAdd(MDefinition* left, MDefinition* right, MIRType type, - TruncateKind truncateKind = Truncate) + MAdd(MDefinition* left, MDefinition* right, MIRType type) : MAdd(left, right) { specialization_ = type; setResultType(type); - if (type == MIRType::Int32) { - setTruncateKind(truncateKind); - setCommutative(); - } + } MAdd(MDefinition* left, MDefinition* right, TruncateKind truncateKind) - : MAdd(left, right) { - specialization_ = MIRType::Int32; - setResultType(MIRType::Int32); + : MAdd(left, right, MIRType::Int32) { setTruncateKind(truncateKind); setCommutative(); } public: INSTRUCTION_HEADER(Add) TRIVIAL_NEW_WRAPPERS + static MAdd* NewWasm(TempAllocator& alloc, MDefinition* left, + MDefinition* right, MIRType type) { + auto* ret = new (alloc) MAdd(left, right, type); + if (type == MIRType::Int32) { + ret->setTruncateKind(Truncate); + ret->setCommutative(); + } + return ret; + } + bool isFloat32Commutative() const override { return true; } double getIdentity() override { return 0; } bool fallible() const; void computeRange(TempAllocator& alloc) override; bool needTruncation(TruncateKind kind) override; void truncate() override;
--- a/js/src/wasm/WasmIonCompile.cpp +++ b/js/src/wasm/WasmIonCompile.cpp @@ -335,16 +335,25 @@ class FunctionCompiler { if (inDeadCode()) { return nullptr; } T* ins = T::New(alloc(), lhs, rhs, type); curBlock_->add(ins); return ins; } + MDefinition* add(MDefinition* lhs, MDefinition* rhs, MIRType type) { + if (inDeadCode()) { + return nullptr; + } + auto* ins = MAdd::NewWasm(alloc(), lhs, rhs, type); + curBlock_->add(ins); + return ins; + } + bool mustPreserveNaN(MIRType type) { return IsFloatingPointType(type) && !env().isAsmJS(); } MDefinition* sub(MDefinition* lhs, MDefinition* rhs, MIRType type) { if (inDeadCode()) { return nullptr; } @@ -2518,17 +2527,17 @@ static bool EmitReinterpret(FunctionComp static bool EmitAdd(FunctionCompiler& f, ValType type, MIRType mirType) { MDefinition* lhs; MDefinition* rhs; if (!f.iter().readBinary(type, &lhs, &rhs)) { return false; } - f.iter().setResult(f.binary<MAdd>(lhs, rhs, mirType)); + f.iter().setResult(f.add(lhs, rhs, mirType)); return true; } static bool EmitSub(FunctionCompiler& f, ValType type, MIRType mirType) { MDefinition* lhs; MDefinition* rhs; if (!f.iter().readBinary(type, &lhs, &rhs)) { return false;