Bug 1425580 part 20 - Clean up wasm call LIR instructions a bit. r=bbouvier
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 10 Mar 2018 12:34:34 +0100
changeset 462533 9c1efa8fb87afff35a88c02419fabd22125de310
parent 462532 292900fd9665f28c748b2b517b7de4432d7dab2f
child 462534 d7b8250f6b17be2c8de2a6a0ef5080c054286943
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1425580
milestone60.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
Bug 1425580 part 20 - Clean up wasm call LIR instructions a bit. r=bbouvier
js/src/jit/shared/LIR-shared.h
--- a/js/src/jit/shared/LIR-shared.h
+++ b/js/src/jit/shared/LIR-shared.h
@@ -9856,28 +9856,37 @@ class LWasmStackArgI64 : public LInstruc
     MWasmStackArg* mir() const {
         return mirRaw()->toWasmStackArg();
     }
     const LInt64Allocation arg() {
         return getInt64Operand(0);
     }
 };
 
+inline bool
+IsWasmCall(LNode::Opcode op)
+{
+    return (op == LNode::LOp_WasmCall ||
+            op == LNode::LOp_WasmCallVoid ||
+            op == LNode::LOp_WasmCallI64);
+}
+
 template <size_t Defs>
 class LWasmCallBase : public LVariadicInstruction<Defs, 0>
 {
     using Base = LVariadicInstruction<Defs, 0>;
 
     bool needsBoundsCheck_;
 
   public:
     LWasmCallBase(LNode::Opcode opcode, uint32_t numOperands, bool needsBoundsCheck)
       : Base(opcode, numOperands),
         needsBoundsCheck_(needsBoundsCheck)
     {
+        MOZ_ASSERT(IsWasmCall(opcode));
         this->setIsCall();
     }
 
     MWasmCall* mir() const {
         return this->mir_->toWasmCall();
     }
 
     static bool isCallPreserved(AnyRegister reg) {
@@ -9925,24 +9934,19 @@ class LWasmCallI64 : public LWasmCallBas
       : LWasmCallBase(classOpcode, numOperands, needsBoundsCheck)
     {
     }
 };
 
 inline bool
 LNode::isCallPreserved(AnyRegister reg) const
 {
-    switch (op()) {
-      case LOp_WasmCall:
-      case LOp_WasmCallVoid:
-      case LOp_WasmCallI64:
+    if (IsWasmCall(op()))
         return LWasmCallBase<0>::isCallPreserved(reg);
-      default:
-        return false;
-    }
+    return false;
 }
 
 class LAssertRangeI : public LInstructionHelper<0, 1, 0>
 {
   public:
     LIR_HEADER(AssertRangeI)
 
     explicit LAssertRangeI(const LAllocation& input)