Bug 1542740: Convert UnaryArithIRGenerator to use AttachDecision r=mgaudet
authorIain Ireland <iireland@mozilla.com>
Fri, 26 Apr 2019 14:29:43 +0000
changeset 530333 94bdb9f0377ae71e261b3e25760e9f3c3020bcee
parent 530332 f5d29f94302779f233480b630223715a12480f2b
child 530334 c9e126b6fe3d2383bed37ff0a355f5a31600ac09
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1542740
milestone68.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 1542740: Convert UnaryArithIRGenerator to use AttachDecision r=mgaudet Differential Revision: https://phabricator.services.mozilla.com/D27308
js/src/jit/BaselineIC.cpp
js/src/jit/CacheIR.cpp
js/src/jit/CacheIR.h
js/src/jit/IonIC.cpp
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -5667,19 +5667,19 @@ bool DoUnaryArithFallback(JSContext* cx,
     default:
       MOZ_CRASH("Unexpected op");
   }
 
   if (res.isDouble()) {
     stub->setSawDoubleResult();
   }
 
-  TryAttachStubOld<UnaryArithIRGenerator>("UniaryArith", cx, frame, stub,
-                                          BaselineCacheIRStubKind::Regular, op,
-                                          val, res);
+  TryAttachStub<UnaryArithIRGenerator>("UniryArith", cx, frame, stub,
+                                       BaselineCacheIRStubKind::Regular, op,
+                                       val, res);
   return true;
 }
 
 bool FallbackICCodeCompiler::emit_UnaryArith() {
   MOZ_ASSERT(R0 == JSReturnOperand);
 
   // Restore the tail call register.
   EmitRestoreTailCallReg(masm);
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -6157,32 +6157,28 @@ void UnaryArithIRGenerator::trackAttache
 #ifdef JS_CACHEIR_SPEW
   if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
     sp.valueProperty("val", val_);
     sp.valueProperty("res", res_);
   }
 #endif
 }
 
-bool UnaryArithIRGenerator::tryAttachStub() {
+AttachDecision UnaryArithIRGenerator::tryAttachStub() {
   AutoAssertNoPendingException aanpe(cx_);
-  if (tryAttachInt32()) {
-    return true;
-  }
-  if (tryAttachNumber()) {
-    return true;
-  }
+  TRY_ATTACH(tryAttachInt32());
+  TRY_ATTACH(tryAttachNumber());
 
   trackAttached(IRGenerator::NotAttached);
-  return false;
-}
-
-bool UnaryArithIRGenerator::tryAttachInt32() {
+  return AttachDecision::NoAction;
+}
+
+AttachDecision UnaryArithIRGenerator::tryAttachInt32() {
   if (!val_.isInt32() || !res_.isInt32()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
 
   Int32OperandId intId = writer.guardIsInt32(valId);
   switch (op_) {
     case JSOP_BITNOT:
       writer.int32NotResult(intId);
@@ -6200,22 +6196,22 @@ bool UnaryArithIRGenerator::tryAttachInt
       writer.int32DecResult(intId);
       trackAttached("UnaryArith.Int32Dec");
       break;
     default:
       MOZ_CRASH("unexpected OP");
   }
 
   writer.returnFromIC();
-  return true;
-}
-
-bool UnaryArithIRGenerator::tryAttachNumber() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision UnaryArithIRGenerator::tryAttachNumber() {
   if (!val_.isNumber() || !res_.isNumber()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   writer.guardIsNumber(valId);
   Int32OperandId truncatedId;
   switch (op_) {
     case JSOP_BITNOT:
       truncatedId = writer.truncateDoubleToUInt32(valId);
@@ -6234,17 +6230,17 @@ bool UnaryArithIRGenerator::tryAttachNum
       writer.doubleDecResult(valId);
       trackAttached("UnaryArith.DoubleDec");
       break;
     default:
       MOZ_CRASH("Unexpected OP");
   }
 
   writer.returnFromIC();
-  return true;
+  return AttachDecision::Attach;
 }
 
 BinaryArithIRGenerator::BinaryArithIRGenerator(
     JSContext* cx, HandleScript script, jsbytecode* pc, ICState::Mode mode,
     JSOp op, HandleValue lhs, HandleValue rhs, HandleValue res)
     : IRGenerator(cx, script, pc, CacheKind::BinaryArith, mode),
       op_(op),
       lhs_(lhs),
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -2455,27 +2455,27 @@ class MOZ_RAII GetIntrinsicIRGenerator :
   AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII UnaryArithIRGenerator : public IRGenerator {
   JSOp op_;
   HandleValue val_;
   HandleValue res_;
 
-  bool tryAttachInt32();
-  bool tryAttachNumber();
+  AttachDecision tryAttachInt32();
+  AttachDecision tryAttachNumber();
 
   void trackAttached(const char* name);
 
  public:
   UnaryArithIRGenerator(JSContext* cx, HandleScript, jsbytecode* pc,
                         ICState::Mode mode, JSOp op, HandleValue val,
                         HandleValue res);
 
-  bool tryAttachStub();
+  AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII BinaryArithIRGenerator : public IRGenerator {
   JSOp op_;
   HandleValue lhs_;
   HandleValue rhs_;
   HandleValue res_;
 
--- a/js/src/jit/IonIC.cpp
+++ b/js/src/jit/IonIC.cpp
@@ -541,18 +541,18 @@ bool IonUnaryArithIC::update(JSContext* 
         return false;
       }
       break;
     }
     default:
       MOZ_CRASH("Unexpected op");
   }
 
-  TryAttachIonStubOld<UnaryArithIRGenerator, IonUnaryArithIC>(cx, ic, ionScript,
-                                                              op, val, res);
+  TryAttachIonStub<UnaryArithIRGenerator, IonUnaryArithIC>(cx, ic, ionScript,
+                                                           op, val, res);
 
   return true;
 }
 
 /* static */
 bool IonBinaryArithIC::update(JSContext* cx, HandleScript outerScript,
                               IonBinaryArithIC* ic, HandleValue lhs,
                               HandleValue rhs, MutableHandleValue ret) {