Bug 1542740: Convert ToBoolIRGenerator to use AttachDecision r=mgaudet
authorIain Ireland <iireland@mozilla.com>
Fri, 26 Apr 2019 14:29:28 +0000
changeset 530331 cd4e0264ddea5ccb318aa68f00538ede3c31b145
parent 530330 ffd868dfa8b16483a6f19394254c7de02aeedf68
child 530332 f5d29f94302779f233480b630223715a12480f2b
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 ToBoolIRGenerator to use AttachDecision r=mgaudet Differential Revision: https://phabricator.services.mozilla.com/D27306
js/src/jit/BaselineIC.cpp
js/src/jit/CacheIR.cpp
js/src/jit/CacheIR.h
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -2018,18 +2018,18 @@ bool ICTypeUpdate_AnyValue::Compiler::ge
 bool DoToBoolFallback(JSContext* cx, BaselineFrame* frame,
                       ICToBool_Fallback* stub, HandleValue arg,
                       MutableHandleValue ret) {
   stub->incrementEnteredCount();
   FallbackICSpew(cx, stub, "ToBool");
 
   MOZ_ASSERT(!arg.isBoolean());
 
-  TryAttachStubOld<ToBoolIRGenerator>("ToBool", cx, frame, stub,
-                                      BaselineCacheIRStubKind::Regular, arg);
+  TryAttachStub<ToBoolIRGenerator>("ToBool", cx, frame, stub,
+                                   BaselineCacheIRStubKind::Regular, arg);
 
   bool cond = ToBoolean(arg);
   ret.setBoolean(cond);
 
   return true;
 }
 
 bool FallbackICCodeCompiler::emit_ToBool() {
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -6024,118 +6024,106 @@ ToBoolIRGenerator::ToBoolIRGenerator(JSC
 void ToBoolIRGenerator::trackAttached(const char* name) {
 #ifdef JS_CACHEIR_SPEW
   if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
     sp.valueProperty("val", val_);
   }
 #endif
 }
 
-bool ToBoolIRGenerator::tryAttachStub() {
+AttachDecision ToBoolIRGenerator::tryAttachStub() {
   AutoAssertNoPendingException aanpe(cx_);
 
-  if (tryAttachInt32()) {
-    return true;
-  }
-  if (tryAttachDouble()) {
-    return true;
-  }
-  if (tryAttachString()) {
-    return true;
-  }
-  if (tryAttachNullOrUndefined()) {
-    return true;
-  }
-  if (tryAttachObject()) {
-    return true;
-  }
-  if (tryAttachSymbol()) {
-    return true;
-  }
+  TRY_ATTACH(tryAttachInt32());
+  TRY_ATTACH(tryAttachDouble());
+  TRY_ATTACH(tryAttachString());
+  TRY_ATTACH(tryAttachNullOrUndefined());
+  TRY_ATTACH(tryAttachObject());
+  TRY_ATTACH(tryAttachSymbol());
 
   trackAttached(IRGenerator::NotAttached);
-  return false;
-}
-
-bool ToBoolIRGenerator::tryAttachInt32() {
+  return AttachDecision::NoAction;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachInt32() {
   if (!val_.isInt32()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   writer.guardType(valId, ValueType::Int32);
   writer.loadInt32TruthyResult(valId);
   writer.returnFromIC();
   trackAttached("ToBoolInt32");
-  return true;
-}
-
-bool ToBoolIRGenerator::tryAttachDouble() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachDouble() {
   if (!val_.isDouble()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   writer.guardType(valId, ValueType::Double);
   writer.loadDoubleTruthyResult(valId);
   writer.returnFromIC();
   trackAttached("ToBoolDouble");
-  return true;
-}
-
-bool ToBoolIRGenerator::tryAttachSymbol() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachSymbol() {
   if (!val_.isSymbol()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   writer.guardType(valId, ValueType::Symbol);
   writer.loadBooleanResult(true);
   writer.returnFromIC();
   trackAttached("ToBoolSymbol");
-  return true;
-}
-
-bool ToBoolIRGenerator::tryAttachString() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachString() {
   if (!val_.isString()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   StringOperandId strId = writer.guardIsString(valId);
   writer.loadStringTruthyResult(strId);
   writer.returnFromIC();
   trackAttached("ToBoolString");
-  return true;
-}
-
-bool ToBoolIRGenerator::tryAttachNullOrUndefined() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachNullOrUndefined() {
   if (!val_.isNullOrUndefined()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   writer.guardIsNullOrUndefined(valId);
   writer.loadBooleanResult(false);
   writer.returnFromIC();
   trackAttached("ToBoolNullOrUndefined");
-  return true;
-}
-
-bool ToBoolIRGenerator::tryAttachObject() {
+  return AttachDecision::Attach;
+}
+
+AttachDecision ToBoolIRGenerator::tryAttachObject() {
   if (!val_.isObject()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   ObjOperandId objId = writer.guardIsObject(valId);
   writer.loadObjectTruthyResult(objId);
   writer.returnFromIC();
   trackAttached("ToBoolObject");
-  return true;
+  return AttachDecision::Attach;
 }
 
 GetIntrinsicIRGenerator::GetIntrinsicIRGenerator(JSContext* cx,
                                                  HandleScript script,
                                                  jsbytecode* pc,
                                                  ICState::Mode mode,
                                                  HandleValue val)
     : IRGenerator(cx, script, pc, CacheKind::GetIntrinsic, mode), val_(val) {}
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -2422,30 +2422,30 @@ class MOZ_RAII CompareIRGenerator : publ
                      HandleValue rhsVal);
 
   AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII ToBoolIRGenerator : public IRGenerator {
   HandleValue val_;
 
-  bool tryAttachInt32();
-  bool tryAttachDouble();
-  bool tryAttachString();
-  bool tryAttachSymbol();
-  bool tryAttachNullOrUndefined();
-  bool tryAttachObject();
+  AttachDecision tryAttachInt32();
+  AttachDecision tryAttachDouble();
+  AttachDecision tryAttachString();
+  AttachDecision tryAttachSymbol();
+  AttachDecision tryAttachNullOrUndefined();
+  AttachDecision tryAttachObject();
 
   void trackAttached(const char* name);
 
  public:
   ToBoolIRGenerator(JSContext* cx, HandleScript, jsbytecode* pc,
                     ICState::Mode mode, HandleValue val);
 
-  bool tryAttachStub();
+  AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII GetIntrinsicIRGenerator : public IRGenerator {
   HandleValue val_;
 
   void trackAttached(const char* name);
 
  public: