Bug 1542740: Convert InstanceOfIRGenerator to use AttachDecision r=mgaudet
authorIain Ireland <iireland@mozilla.com>
Fri, 26 Apr 2019 14:28:44 +0000
changeset 530327 1e1017253de570f2440de2dc2ccbfe2b6646ae60
parent 530326 448eb3cd7fdf864db3a331fc1dd405ba19d3f316
child 530328 f96d9bb8699791a332ab8e68af1137de39c38ff3
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 InstanceOfIRGenerator to use AttachDecision r=mgaudet Differential Revision: https://phabricator.services.mozilla.com/D27302
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
@@ -5475,19 +5475,19 @@ bool DoInstanceOfFallback(JSContext* cx,
     }
     return true;
   }
 
   // For functions, keep track of the |prototype| property in type information,
   // for use during Ion compilation.
   EnsureTrackPropertyTypes(cx, obj, NameToId(cx->names().prototype));
 
-  TryAttachStubOld<InstanceOfIRGenerator>("InstanceOf", cx, frame, stub,
-                                          BaselineCacheIRStubKind::Regular, lhs,
-                                          obj);
+  TryAttachStub<InstanceOfIRGenerator>("InstanceOf", cx, frame, stub,
+                                       BaselineCacheIRStubKind::Regular, lhs,
+                                       obj);
   return true;
 }
 
 bool FallbackICCodeCompiler::emit_InstanceOf() {
   EmitRestoreTailCallReg(masm);
 
   // Sync stack for the decompiler.
   masm.pushValue(R0);
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -4388,67 +4388,67 @@ bool SetPropIRGenerator::tryAttachAddSlo
 
 InstanceOfIRGenerator::InstanceOfIRGenerator(JSContext* cx, HandleScript script,
                                              jsbytecode* pc, ICState::Mode mode,
                                              HandleValue lhs, HandleObject rhs)
     : IRGenerator(cx, script, pc, CacheKind::InstanceOf, mode),
       lhsVal_(lhs),
       rhsObj_(rhs) {}
 
-bool InstanceOfIRGenerator::tryAttachStub() {
+AttachDecision InstanceOfIRGenerator::tryAttachStub() {
   MOZ_ASSERT(cacheKind_ == CacheKind::InstanceOf);
   AutoAssertNoPendingException aanpe(cx_);
 
   // Ensure RHS is a function -- could be a Proxy, which the IC isn't prepared
   // to handle.
   if (!rhsObj_->is<JSFunction>()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   HandleFunction fun = rhsObj_.as<JSFunction>();
 
   if (fun->isBoundFunction()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   // If the user has supplied their own @@hasInstance method we shouldn't
   // clobber it.
   if (!js::FunctionHasDefaultHasInstance(fun, cx_->wellKnownSymbols())) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   // Refuse to optimize any function whose [[Prototype]] isn't
   // Function.prototype.
   if (!fun->hasStaticPrototype() || fun->hasUncacheableProto()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   Value funProto = cx_->global()->getPrototype(JSProto_Function);
   if (!funProto.isObject() || fun->staticPrototype() != &funProto.toObject()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   // Ensure that the function's prototype slot is the same.
   Shape* shape = fun->lookupPure(cx_->names().prototype);
   if (!shape || !shape->isDataProperty()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   uint32_t slot = shape->slot();
 
   MOZ_ASSERT(fun->numFixedSlots() == 0, "Stub code relies on this");
   if (!fun->getSlot(slot).isObject()) {
     trackAttached(IRGenerator::NotAttached);
-    return false;
+    return AttachDecision::NoAction;
   }
 
   JSObject* prototypeObject = &fun->getSlot(slot).toObject();
 
   // Abstract Objects
   ValOperandId lhs(writer.setInputOperandId(0));
   ValOperandId rhs(writer.setInputOperandId(1));
 
@@ -4460,17 +4460,17 @@ bool InstanceOfIRGenerator::tryAttachStu
   // Ensure that rhs[slot] == prototypeObject.
   writer.guardFunctionPrototype(rhsId, slot, protoId);
 
   // Needn't guard LHS is object, because the actual stub can handle that
   // and correctly return false.
   writer.loadInstanceOfObjectResult(lhs, protoId, slot);
   writer.returnFromIC();
   trackAttached("InstanceOf");
-  return true;
+  return AttachDecision::Attach;
 }
 
 void InstanceOfIRGenerator::trackAttached(const char* name) {
 #ifdef JS_CACHEIR_SPEW
   if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
     sp.valueProperty("lhs", lhsVal_);
     sp.valueProperty("rhs", ObjectValue(*rhsObj_));
   }
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -2304,17 +2304,17 @@ class MOZ_RAII InstanceOfIRGenerator : p
   HandleObject rhsObj_;
 
   void trackAttached(const char* name);
 
  public:
   InstanceOfIRGenerator(JSContext*, HandleScript, jsbytecode*, ICState::Mode,
                         HandleValue, HandleObject);
 
-  bool tryAttachStub();
+  AttachDecision tryAttachStub();
 };
 
 class MOZ_RAII TypeOfIRGenerator : public IRGenerator {
   HandleValue val_;
 
   bool tryAttachPrimitive(ValOperandId valId);
   bool tryAttachObject(ValOperandId valId);
   void trackAttached(const char* name);
--- a/js/src/jit/IonIC.cpp
+++ b/js/src/jit/IonIC.cpp
@@ -494,18 +494,18 @@ bool IonInIC::update(JSContext* cx, Hand
   return OperatorIn(cx, key, obj, res);
 }
 /* static */
 bool IonInstanceOfIC::update(JSContext* cx, HandleScript outerScript,
                              IonInstanceOfIC* ic, HandleValue lhs,
                              HandleObject rhs, bool* res) {
   IonScript* ionScript = outerScript->ionScript();
 
-  TryAttachIonStubOld<InstanceOfIRGenerator, IonInstanceOfIC>(cx, ic, ionScript,
-                                                              lhs, rhs);
+  TryAttachIonStub<InstanceOfIRGenerator, IonInstanceOfIC>(cx, ic, ionScript,
+                                                           lhs, rhs);
 
   return HasInstance(cx, rhs, lhs, res);
 }
 
 /*  static */
 bool IonUnaryArithIC::update(JSContext* cx, HandleScript outerScript,
                              IonUnaryArithIC* ic, HandleValue val,
                              MutableHandleValue res) {