Bug 1468750 - add 'trackAttached' method to 'GetIteratorIRGenerator' class. draft
authorPetru Gurita <petru.gurita1@gmail.com>
Thu, 28 Jun 2018 23:56:17 +0300
changeset 812853 f4e2f23cd8a8
parent 812148 be80278dafb1
child 815400 45a60e99546f
push id114693
push userbmo:petru.gurita1@gmail.com
push dateSat, 30 Jun 2018 19:11:51 +0000
bugs1468750
milestone63.0a1
Bug 1468750 - add 'trackAttached' method to 'GetIteratorIRGenerator' class. Added method 'trackAttached' to the class 'GetIteratorIRGenerator' and implemented it accordingly. MozReview-Commit-ID: CRLXFaOfgZD
js/src/jit/CacheIR.cpp
js/src/jit/CacheIR.h
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -4348,19 +4348,22 @@ GetIteratorIRGenerator::tryAttachStub()
 
     ValOperandId valId(writer.setInputOperandId(0));
     if (!val_.isObject())
         return false;
 
     RootedObject obj(cx_, &val_.toObject());
 
     ObjOperandId objId = writer.guardIsObject(valId);
-    if (tryAttachNativeIterator(objId, obj))
-        return true;
-
+    if (tryAttachNativeIterator(objId, obj)) {
+      trackAttached("GetIterator");
+      return true;
+    }
+
+    trackAttached(IRGenerator::NotAttached);
     return false;
 }
 
 bool
 GetIteratorIRGenerator::tryAttachNativeIterator(ObjOperandId objId, HandleObject obj)
 {
     MOZ_ASSERT(JSOp(*pc_) == JSOP_ITER);
 
@@ -4386,16 +4389,26 @@ GetIteratorIRGenerator::tryAttachNativeI
     ObjOperandId iterId =
         writer.guardAndGetIterator(objId, iterobj, &ObjectRealm::get(obj).enumerators);
     writer.loadObjectResult(iterId);
     writer.returnFromIC();
 
     return true;
 }
 
+void
+GetIteratorIRGenerator::trackAttached(const char* name)
+{
+#ifdef JS_CACHEIR_SPEW
+    if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
+        sp.valueProperty("val", val_);
+    }
+#endif
+}
+
 CallIRGenerator::CallIRGenerator(JSContext* cx, HandleScript script, jsbytecode* pc, JSOp op,
                                  ICState::Mode mode, uint32_t argc,
                                  HandleValue callee, HandleValue thisval, HandleValueArray args)
   : IRGenerator(cx, script, pc, CacheKind::Call, mode),
     op_(op),
     argc_(argc),
     callee_(callee),
     thisval_(thisval),
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -1659,16 +1659,18 @@ class MOZ_RAII GetIteratorIRGenerator : 
 
     bool tryAttachNativeIterator(ObjOperandId objId, HandleObject obj);
 
   public:
     GetIteratorIRGenerator(JSContext* cx, HandleScript, jsbytecode* pc, ICState::Mode mode,
                            HandleValue value);
 
     bool tryAttachStub();
+
+    void trackAttached(const char *name);
 };
 
 class MOZ_RAII CallIRGenerator : public IRGenerator
 {
   private:
     JSOp op_;
     uint32_t argc_;
     HandleValue callee_;