Bug 1483189 - Comment Compare IC attachment logic r=tcampbell
authorMatthew Gaudet <mgaudet@mozilla.com>
Tue, 14 Aug 2018 15:27:54 -0400
changeset 486792 4d191bd81bbea9db56246856e9b09b11e2a6b4be
parent 486791 fde17a23425676f852797e25d93ca736d36f4291
child 486793 22c19ba1a3955746f361f8d9d9431e180616a1e4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1483189
milestone63.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 1483189 - Comment Compare IC attachment logic r=tcampbell Also fix one missed cleanup nit from original landing
js/src/jit/CacheIR.cpp
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -5019,38 +5019,48 @@ CompareIRGenerator::tryAttachStub()
     AutoAssertNoPendingException aanpe(cx_);
 
     constexpr uint8_t lhsIndex = 0;
     constexpr uint8_t rhsIndex = 1;
 
     static_assert(lhsIndex == 0 && rhsIndex == 1,
         "Indexes relied upon by baseline inspector");
 
-    ValOperandId lhsId(writer.setInputOperandId(0));
-    ValOperandId rhsId(writer.setInputOperandId(1));
-
+    ValOperandId lhsId(writer.setInputOperandId(lhsIndex));
+    ValOperandId rhsId(writer.setInputOperandId(rhsIndex));
+
+    // For sloppy equality ops, there are cases this IC does not handle:
+    // - {Symbol} x {Null, Undefined, String, Bool, Number}.
+    // - {String} x {Null, Undefined, Symbol, Bool, Number}. Bug 1467907 will add support
+    //   for {String} x {Int32}.
+    // - {Bool} x {Double}.
+    // - {Object} x {String, Symbol, Bool, Number}.
     if (IsEqualityOp(op_)) {
         if (tryAttachString(lhsId, rhsId))
             return true;
         if (tryAttachObject(lhsId, rhsId))
             return true;
         if (tryAttachSymbol(lhsId, rhsId))
             return true;
+
+        // Handle the special case of Object compared to null/undefined.
+        // This is special due to the IsHTMLDDA internal slot semantic,
         if (tryAttachObjectUndefined(lhsId, rhsId))
             return true;
+
+        // This covers -strict- equality/inequality using a type tag check, so catches all
+        // different type pairs outside of Numbers, which cannot be checked on tags alone.
         if (tryAttachStrictDifferentTypes(lhsId, rhsId))
             return true;
 
         // These checks should come after tryAttachStrictDifferentTypes since it handles
         // strict inequality with a more generic IC.
         if (tryAttachPrimitiveUndefined(lhsId, rhsId))
             return true;
 
-        // This should come after strictDifferent types to
-        // allow it to only handle sloppy equality.
         if (tryAttachNullUndefined(lhsId, rhsId))
             return true;
     }
 
     // This should preceed the Int32/Number cases to allow
     // them to not concern themselves with handling undefined
     // or null.
     if (tryAttachNumberUndefined(lhsId, rhsId))