Bug 1246154: IonMonkey - Track jit optimization when using a shared stubs for JSOP_NEG, r=shu
authorHannes Verschore <hv1989@gmail.com>
Tue, 16 Feb 2016 04:51:34 -0500
changeset 331284 402d8fc72ed3805132bf4c439fd58ec5cb07297b
parent 331283 12ceb85f8795f668090c518979a5f359653f022c
child 331285 374422755fccfd9e8296195ad60b6f4b752238e6
push id10956
push userjolesen@mozilla.com
push dateTue, 16 Feb 2016 19:12:12 +0000
reviewersshu
bugs1246154
milestone47.0a1
Bug 1246154: IonMonkey - Track jit optimization when using a shared stubs for JSOP_NEG, r=shu
js/src/jit-test/tests/ion/bug1246154.js
js/src/jit/IonBuilder.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1246154.js
@@ -0,0 +1,5 @@
+setJitCompilerOption('ion.forceinlineCaches', 1);
+enableSPSProfiling();
+(function() {
+    -[];
+})();
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -4857,32 +4857,35 @@ IonBuilder::arithTrySharedStub(bool* emi
 
     if (JitOptions.disableSharedStubs)
         return true;
 
     // The actual jsop 'jsop_pos' is not supported yet.
     if (actualOp == JSOP_POS)
         return true;
 
+    // FIXME: The JSOP_BITNOT path doesn't track optimizations yet.
+    if (actualOp != JSOP_BITNOT)
+        trackOptimizationAttempt(TrackedStrategy::BinaryArith_SharedCache);
+
     MInstruction* stub = nullptr;
     switch (actualOp) {
       case JSOP_NEG:
       case JSOP_BITNOT:
         MOZ_ASSERT_IF(op == JSOP_MUL,
                       left->maybeConstantValue() && left->maybeConstantValue()->toInt32() == -1);
         MOZ_ASSERT_IF(op != JSOP_MUL, !left);
 
         stub = MUnarySharedStub::New(alloc(), right);
         break;
       case JSOP_ADD:
       case JSOP_SUB:
       case JSOP_MUL:
       case JSOP_DIV:
       case JSOP_MOD:
-        trackOptimizationAttempt(TrackedStrategy::BinaryArith_SharedCache);
         stub = MBinarySharedStub::New(alloc(), left, right);
         break;
       default:
         MOZ_CRASH("unsupported arith");
     }
 
     current->add(stub);
     current->push(stub);