Bug 1627618 - Part 4: Replace calls to setInt32Specialization for MAdd. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 07 Apr 2020 08:35:58 +0000
changeset 522649 2ba73b4b8fd79244ecca495e4ea27013eb5b1be6
parent 522648 bd3e77b5b2e935b1a371f363e159187cf0fd5c1c
child 522650 fba058bb22041241369a9fbf8273c2a067bac7ab
push id112239
push userccoroiu@mozilla.com
push dateTue, 07 Apr 2020 15:04:11 +0000
treeherderautoland@5b653e25e757 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1627618
milestone77.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 1627618 - Part 4: Replace calls to setInt32Specialization for MAdd. r=jandem The new `MAdd` and `MSub` constructors with a `MIRType` argument can be used in these places to directly set the return type and the specialisation. That way we no longer have to call `setInt32Specialization()` manually. `MMul` already has a compatible constructor which the desired semantics, so we can remove the `setInt32Specialization()` call here, too. Differential Revision: https://phabricator.services.mozilla.com/D69781
js/src/jit/IonAnalysis.cpp
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -3952,59 +3952,54 @@ MDefinition* jit::ConvertLinearSum(TempA
                                    const LinearSum& sum, bool convertConstant) {
   MDefinition* def = nullptr;
 
   for (size_t i = 0; i < sum.numTerms(); i++) {
     LinearTerm term = sum.term(i);
     MOZ_ASSERT(!term.term->isConstant());
     if (term.scale == 1) {
       if (def) {
-        def = MAdd::New(alloc, def, term.term);
-        def->toAdd()->setInt32Specialization();
+        def = MAdd::New(alloc, def, term.term, MIRType::Int32);
         block->insertAtEnd(def->toInstruction());
         def->computeRange(alloc);
       } else {
         def = term.term;
       }
     } else if (term.scale == -1) {
       if (!def) {
         def = MConstant::New(alloc, Int32Value(0));
         block->insertAtEnd(def->toInstruction());
         def->computeRange(alloc);
       }
-      def = MSub::New(alloc, def, term.term);
-      def->toSub()->setInt32Specialization();
+      def = MSub::New(alloc, def, term.term, MIRType::Int32);
       block->insertAtEnd(def->toInstruction());
       def->computeRange(alloc);
     } else {
       MOZ_ASSERT(term.scale != 0);
       MConstant* factor = MConstant::New(alloc, Int32Value(term.scale));
       block->insertAtEnd(factor);
-      MMul* mul = MMul::New(alloc, term.term, factor);
-      mul->setInt32Specialization();
+      MMul* mul = MMul::New(alloc, term.term, factor, MIRType::Int32);
       block->insertAtEnd(mul);
       mul->computeRange(alloc);
       if (def) {
-        def = MAdd::New(alloc, def, mul);
-        def->toAdd()->setInt32Specialization();
+        def = MAdd::New(alloc, def, mul, MIRType::Int32);
         block->insertAtEnd(def->toInstruction());
         def->computeRange(alloc);
       } else {
         def = mul;
       }
     }
   }
 
   if (convertConstant && sum.constant()) {
     MConstant* constant = MConstant::New(alloc, Int32Value(sum.constant()));
     block->insertAtEnd(constant);
     constant->computeRange(alloc);
     if (def) {
-      def = MAdd::New(alloc, def, constant);
-      def->toAdd()->setInt32Specialization();
+      def = MAdd::New(alloc, def, constant, MIRType::Int32);
       block->insertAtEnd(def->toInstruction());
       def->computeRange(alloc);
     } else {
       def = constant;
     }
   }
 
   if (!def) {
@@ -4062,18 +4057,17 @@ MCompare* jit::ConvertLinearInequality(T
         rhsDef->computeRange(alloc);
         break;
       }
     }
 
     MDefinition* constant = MConstant::New(alloc, Int32Value(lhs.constant()));
     block->insertAtEnd(constant->toInstruction());
     constant->computeRange(alloc);
-    lhsDef = MAdd::New(alloc, lhsDef, constant);
-    lhsDef->toAdd()->setInt32Specialization();
+    lhsDef = MAdd::New(alloc, lhsDef, constant, MIRType::Int32);
     block->insertAtEnd(lhsDef->toInstruction());
     lhsDef->computeRange(alloc);
   } while (false);
 
   if (!rhsDef) {
     rhsDef = MConstant::New(alloc, Int32Value(0));
     block->insertAtEnd(rhsDef->toInstruction());
     rhsDef->computeRange(alloc);