Bug 1542740: Convert GetIteratorIRGenerator to use AttachDecision r=mgaudet
authorIain Ireland <iireland@mozilla.com>
Fri, 26 Apr 2019 14:29:06 +0000
changeset 530329 ec38ecf241e2974a594e4ed362632dc3ccde03ac
parent 530328 f96d9bb8699791a332ab8e68af1137de39c38ff3
child 530330 ffd868dfa8b16483a6f19394254c7de02aeedf68
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 GetIteratorIRGenerator to use AttachDecision r=mgaudet Differential Revision: https://phabricator.services.mozilla.com/D27304
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
@@ -5411,17 +5411,17 @@ bool ICCall_ScriptedFunCall::Compiler::g
 //
 
 bool DoGetIteratorFallback(JSContext* cx, BaselineFrame* frame,
                            ICGetIterator_Fallback* stub, HandleValue value,
                            MutableHandleValue res) {
   stub->incrementEnteredCount();
   FallbackICSpew(cx, stub, "GetIterator");
 
-  TryAttachStubOld<GetIteratorIRGenerator>(
+  TryAttachStub<GetIteratorIRGenerator>(
       "GetIterator", cx, frame, stub, BaselineCacheIRStubKind::Regular, value);
 
   JSObject* iterobj = ValueToIterator(cx, value);
   if (!iterobj) {
     return false;
   }
 
   res.setObject(*iterobj);
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -4535,49 +4535,46 @@ AttachDecision TypeOfIRGenerator::tryAtt
 
 GetIteratorIRGenerator::GetIteratorIRGenerator(JSContext* cx,
                                                HandleScript script,
                                                jsbytecode* pc,
                                                ICState::Mode mode,
                                                HandleValue value)
     : IRGenerator(cx, script, pc, CacheKind::GetIterator, mode), val_(value) {}
 
-bool GetIteratorIRGenerator::tryAttachStub() {
+AttachDecision GetIteratorIRGenerator::tryAttachStub() {
   MOZ_ASSERT(cacheKind_ == CacheKind::GetIterator);
 
   AutoAssertNoPendingException aanpe(cx_);
 
   if (mode_ == ICState::Mode::Megamorphic) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   ValOperandId valId(writer.setInputOperandId(0));
   if (!val_.isObject()) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   RootedObject obj(cx_, &val_.toObject());
 
   ObjOperandId objId = writer.guardIsObject(valId);
-  if (tryAttachNativeIterator(objId, obj)) {
-    trackAttached("GetIterator");
-    return true;
-  }
+  TRY_ATTACH(tryAttachNativeIterator(objId, obj));
 
   trackAttached(IRGenerator::NotAttached);
-  return false;
-}
-
-bool GetIteratorIRGenerator::tryAttachNativeIterator(ObjOperandId objId,
-                                                     HandleObject obj) {
+  return AttachDecision::NoAction;
+}
+
+AttachDecision GetIteratorIRGenerator::tryAttachNativeIterator(
+    ObjOperandId objId, HandleObject obj) {
   MOZ_ASSERT(JSOp(*pc_) == JSOP_ITER);
 
   PropertyIteratorObject* iterobj = LookupInIteratorCache(cx_, obj);
   if (!iterobj) {
-    return false;
+    return AttachDecision::NoAction;
   }
 
   MOZ_ASSERT(obj->isNative());
 
   // Guard on the receiver's shape.
   TestMatchingNativeReceiver(writer, &obj->as<NativeObject>(), objId);
 
   // Ensure the receiver has no dense elements.
@@ -4587,17 +4584,18 @@ bool GetIteratorIRGenerator::tryAttachNa
   GeneratePrototypeHoleGuards(writer, obj, objId,
                               /* alwaysGuardFirstProto = */ false);
 
   ObjOperandId iterId = writer.guardAndGetIterator(
       objId, iterobj, &ObjectRealm::get(obj).enumerators);
   writer.loadObjectResult(iterId);
   writer.returnFromIC();
 
-  return true;
+  trackAttached("GetIterator");
+  return AttachDecision::Attach;
 }
 
 void GetIteratorIRGenerator::trackAttached(const char* name) {
 #ifdef JS_CACHEIR_SPEW
   if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
     sp.valueProperty("val", val_);
   }
 #endif
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -2324,23 +2324,23 @@ class MOZ_RAII TypeOfIRGenerator : publi
                     ICState::Mode mode, HandleValue value);
 
   AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII GetIteratorIRGenerator : public IRGenerator {
   HandleValue val_;
 
-  bool tryAttachNativeIterator(ObjOperandId objId, HandleObject obj);
+  AttachDecision tryAttachNativeIterator(ObjOperandId objId, HandleObject obj);
 
  public:
   GetIteratorIRGenerator(JSContext* cx, HandleScript, jsbytecode* pc,
                          ICState::Mode mode, HandleValue value);
 
-  bool tryAttachStub();
+  AttachDecision tryAttachStub();
 
   void trackAttached(const char* name);
 };
 
 class MOZ_RAII CallIRGenerator : public IRGenerator {
  private:
   JSOp op_;
   uint32_t argc_;
--- a/js/src/jit/IonIC.cpp
+++ b/js/src/jit/IonIC.cpp
@@ -453,18 +453,18 @@ JSObject* IonBindNameIC::update(JSContex
   return holder;
 }
 
 /* static */
 JSObject* IonGetIteratorIC::update(JSContext* cx, HandleScript outerScript,
                                    IonGetIteratorIC* ic, HandleValue value) {
   IonScript* ionScript = outerScript->ionScript();
 
-  TryAttachIonStubOld<GetIteratorIRGenerator, IonGetIteratorIC>(
-      cx, ic, ionScript, value);
+  TryAttachIonStub<GetIteratorIRGenerator, IonGetIteratorIC>(cx, ic, ionScript,
+                                                             value);
 
   return ValueToIterator(cx, value);
 }
 
 /* static */
 bool IonHasOwnIC::update(JSContext* cx, HandleScript outerScript,
                          IonHasOwnIC* ic, HandleValue val, HandleValue idVal,
                          int32_t* res) {