Bug 1330363: IonMonkey - Temporarily disable optimization tracking of creating array/object through a call, r=shu
authorHannes Verschore <hv1989@gmail.com>
Wed, 18 Jan 2017 10:36:46 +0100
changeset 377202 0a7d9f3e25ab212e5305fb936fcc4b517155a0f6
parent 377081 5b544b8ab06b0d75bb3abb4095cceefeeebec525
child 377203 0e01a86cb52a38246ab95975e2939b82496f76f2
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1330363
milestone53.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 1330363: IonMonkey - Temporarily disable optimization tracking of creating array/object through a call, r=shu
js/src/jit/IonBuilder.cpp
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -5707,57 +5707,71 @@ IonBuilder::compareTrySharedStub(bool* e
     current->add(unbox);
     current->push(unbox);
 
     trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
+static bool
+IsCallOpcode(JSOp op)
+{
+    // TODO: Support tracking optimizations for inlining a call and regular
+    // optimization tracking at the same time.
+    return op == JSOP_CALL || op == JSOP_CALLITER || op == JSOP_NEW || op == JSOP_SUPERCALL ||
+           op == JSOP_EVAL || op == JSOP_STRICTEVAL;
+}
+
 AbortReasonOr<Ok>
 IonBuilder::newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, uint32_t length)
 {
     MOZ_ASSERT(*emitted == false);
 
-    trackOptimizationAttempt(TrackedStrategy::NewArray_TemplateObject);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewArray_TemplateObject);
 
     if (!templateObject) {
-        trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
+        if (!IsCallOpcode(JSOp(*pc)))
+            trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
         return Ok();
     }
 
     if (templateObject->is<UnboxedArrayObject>()) {
         MOZ_ASSERT(templateObject->as<UnboxedArrayObject>().capacity() >= length);
         if (!templateObject->as<UnboxedArrayObject>().hasInlineElements()) {
-            trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsUnboxedWithoutInlineElements);
+            if (!IsCallOpcode(JSOp(*pc)))
+                trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsUnboxedWithoutInlineElements);
             return Ok();
         }
     }
 
     MOZ_ASSERT(length <= NativeObject::MAX_DENSE_ELEMENTS_COUNT);
 
     size_t arraySlots =
         gc::GetGCKindSlots(templateObject->asTenured().getAllocKind()) - ObjectElements::VALUES_PER_HEADER;
 
     if (length > arraySlots) {
-        trackOptimizationOutcome(TrackedOutcome::LengthTooBig);
+        if (!IsCallOpcode(JSOp(*pc)))
+            trackOptimizationOutcome(TrackedOutcome::LengthTooBig);
         return Ok();
     }
 
     // Emit fastpath.
 
     gc::InitialHeap heap = templateObject->group()->initialHeap(constraints());
     MConstant* templateConst = MConstant::NewConstraintlessObject(alloc(), templateObject);
     current->add(templateConst);
 
     MNewArray* ins = MNewArray::New(alloc(), constraints(), length, templateConst, heap, pc);
     current->add(ins);
     current->push(ins);
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::newArrayTrySharedStub(bool* emitted)
 {
     MOZ_ASSERT(*emitted == false);
@@ -5765,57 +5779,61 @@ IonBuilder::newArrayTrySharedStub(bool* 
     // Try to emit a shared stub cache.
 
     if (JitOptions.disableSharedStubs)
         return Ok();
 
     if (*pc != JSOP_NEWINIT && *pc != JSOP_NEWARRAY)
         return Ok();
 
-    trackOptimizationAttempt(TrackedStrategy::NewArray_SharedCache);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewArray_SharedCache);
 
     MInstruction* stub = MNullarySharedStub::New(alloc());
     current->add(stub);
     current->push(stub);
 
     MOZ_TRY(resumeAfter(stub));
 
     MUnbox* unbox = MUnbox::New(alloc(), current->pop(), MIRType::Object, MUnbox::Infallible);
     current->add(unbox);
     current->push(unbox);
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
 
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::newArrayTryVM(bool* emitted, JSObject* templateObject, uint32_t length)
 {
     MOZ_ASSERT(*emitted == false);
 
     // Emit a VM call.
-    trackOptimizationAttempt(TrackedStrategy::NewArray_Call);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewArray_Call);
 
     gc::InitialHeap heap = gc::DefaultHeap;
     MConstant* templateConst = MConstant::New(alloc(), NullValue());
 
     if (templateObject) {
         heap = templateObject->group()->initialHeap(constraints());
         templateConst = MConstant::NewConstraintlessObject(alloc(), templateObject);
     }
 
     current->add(templateConst);
 
     MNewArray* ins = MNewArray::NewVM(alloc(), constraints(), length, templateConst, heap, pc);
     current->add(ins);
     current->push(ins);
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::jsop_newarray(uint32_t length)
 {
     JSObject* templateObject = inspector->getTemplateObject(pc);
@@ -5830,17 +5848,18 @@ IonBuilder::jsop_newarray(uint32_t lengt
 
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::jsop_newarray(JSObject* templateObject, uint32_t length)
 {
     bool emitted = false;
-    startTrackingOptimizations();
+    if (!IsCallOpcode(JSOp(*pc)))
+        startTrackingOptimizations();
 
     if (!forceInlineCaches()) {
         MOZ_TRY(newArrayTryTemplateObject(&emitted, templateObject, length));
         if (emitted)
             return Ok();
     }
 
     MOZ_TRY(newArrayTrySharedStub(&emitted));
@@ -5876,24 +5895,27 @@ IonBuilder::jsop_newarray_copyonwrite()
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::newObjectTryTemplateObject(bool* emitted, JSObject* templateObject)
 {
     MOZ_ASSERT(*emitted == false);
 
-    trackOptimizationAttempt(TrackedStrategy::NewObject_TemplateObject);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewObject_TemplateObject);
     if (!templateObject) {
-        trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
+        if (!IsCallOpcode(JSOp(*pc)))
+            trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
         return Ok();
     }
 
     if (templateObject->is<PlainObject>() && templateObject->as<PlainObject>().hasDynamicSlots()) {
-        trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsPlainObjectWithDynamicSlots);
+        if (!IsCallOpcode(JSOp(*pc)))
+            trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsPlainObjectWithDynamicSlots);
         return Ok();
     }
 
     // Emit fastpath.
 
     MNewObject::Mode mode;
     if (JSOp(*pc) == JSOP_NEWOBJECT || JSOp(*pc) == JSOP_NEWINIT)
         mode = MNewObject::ObjectLiteral;
@@ -5905,55 +5927,59 @@ IonBuilder::newObjectTryTemplateObject(b
     current->add(templateConst);
 
     MNewObject* ins = MNewObject::New(alloc(), constraints(), templateConst, heap, mode);
     current->add(ins);
     current->push(ins);
 
     MOZ_TRY(resumeAfter(ins));
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::newObjectTrySharedStub(bool* emitted)
 {
     MOZ_ASSERT(*emitted == false);
 
     // Try to emit a shared stub cache.
 
     if (JitOptions.disableSharedStubs)
         return Ok();
 
-    trackOptimizationAttempt(TrackedStrategy::NewObject_SharedCache);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewObject_SharedCache);
 
     MInstruction* stub = MNullarySharedStub::New(alloc());
     current->add(stub);
     current->push(stub);
 
     MOZ_TRY(resumeAfter(stub));
 
     MUnbox* unbox = MUnbox::New(alloc(), current->pop(), MIRType::Object, MUnbox::Infallible);
     current->add(unbox);
     current->push(unbox);
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::newObjectTryVM(bool* emitted, JSObject* templateObject)
 {
     // Emit a VM call.
     MOZ_ASSERT(JSOp(*pc) == JSOP_NEWOBJECT || JSOp(*pc) == JSOP_NEWINIT);
 
-    trackOptimizationAttempt(TrackedStrategy::NewObject_Call);
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationAttempt(TrackedStrategy::NewObject_Call);
 
     gc::InitialHeap heap = gc::DefaultHeap;
     MConstant* templateConst = MConstant::New(alloc(), NullValue());
 
     if (templateObject) {
         heap = templateObject->group()->initialHeap(constraints());
         templateConst = MConstant::NewConstraintlessObject(alloc(), templateObject);
     }
@@ -5962,17 +5988,18 @@ IonBuilder::newObjectTryVM(bool* emitted
 
     MNewObject* ins = MNewObject::NewVM(alloc(), constraints(), templateConst, heap,
                                         MNewObject::ObjectLiteral);
     current->add(ins);
     current->push(ins);
 
     MOZ_TRY(resumeAfter(ins));
 
-    trackOptimizationSuccess();
+    if (!IsCallOpcode(JSOp(*pc)))
+        trackOptimizationSuccess();
     *emitted = true;
     return Ok();
 }
 
 AbortReasonOr<Ok>
 IonBuilder::jsop_newobject()
 {
     bool emitted = false;