Bug 1468750 - add 'trackAttached' method to 'GetIteratorIRGenerator' class.
Added method 'trackAttached' to the class 'GetIteratorIRGenerator' and implemented it accordingly.
MozReview-Commit-ID: CRLXFaOfgZD
--- 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_;