Bug 1564125 - Part 2: Avoid negative zero bailouts for MStoreElementHole and MFallibleStoreElement. r=nbp
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 09 Jul 2019 13:11:05 +0000
changeset 482367 3e2d63c9f835f84809c1bdf7dfbe0013a4a4067b
parent 482366 b2044941257e5407aa18936f35ca1e1c21cce706
child 482368 9d4b4711856ae76154757d5fe74b5afe56e25906
push id36276
push usercbrindusan@mozilla.com
push dateThu, 11 Jul 2019 16:20:48 +0000
treeherdermozilla-central@8013e87c08ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1564125
milestone70.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 1564125 - Part 2: Avoid negative zero bailouts for MStoreElementHole and MFallibleStoreElement. r=nbp Use the correct index position for MStoreElementHold and MFallibleStoreElement to avoid possible negative zero bailouts for these operations. Depends on D37259 Differential Revision: https://phabricator.services.mozilla.com/D37260
js/src/jit/MIR.cpp
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -2656,18 +2656,16 @@ static inline bool NeedNegativeZeroCheck
         MDefinition* rhs = use_def->toSub()->rhs();
         if (rhs->id() < lhs->id() && CanProduceNegativeZero(lhs)) {
           return true;
         }
 
         MOZ_FALLTHROUGH;
       }
       case MDefinition::Opcode::StoreElement:
-      case MDefinition::Opcode::StoreElementHole:
-      case MDefinition::Opcode::FallibleStoreElement:
       case MDefinition::Opcode::LoadElement:
       case MDefinition::Opcode::LoadElementHole:
       case MDefinition::Opcode::LoadUnboxedScalar:
       case MDefinition::Opcode::LoadTypedArrayElementHole:
       case MDefinition::Opcode::CharCodeAt:
       case MDefinition::Opcode::Mod:
         // Only allowed to remove check when definition is the second operand
         if (use_def->getOperand(0) == def) {
@@ -2692,16 +2690,28 @@ static inline bool NeedNegativeZeroCheck
       case MDefinition::Opcode::Compare:
       case MDefinition::Opcode::BitAnd:
       case MDefinition::Opcode::BitOr:
       case MDefinition::Opcode::BitXor:
       case MDefinition::Opcode::Abs:
       case MDefinition::Opcode::TruncateToInt32:
         // Always allowed to remove check. No matter which operand.
         break;
+      case MDefinition::Opcode::StoreElementHole:
+      case MDefinition::Opcode::FallibleStoreElement:
+        // Only allowed to remove check when definition is the third operand.
+        for (size_t i = 0, e = use_def->numOperands(); i < e; i++) {
+          if (i == 2) {
+            continue;
+          }
+          if (use_def->getOperand(i) == def) {
+            return true;
+          }
+        }
+        break;
       default:
         return true;
     }
   }
   return false;
 }
 
 #ifdef JS_JITSPEW