Bug 636544 - Fix JavaScript "-m -j" mode (r=dmandelin)
authorBill McCloskey <wmccloskey@mozilla.com>
Fri, 11 Mar 2011 11:44:57 -0800
changeset 64280 e8a4bc81a4cb
parent 64279 f819bfaf8d20
child 64281 424eedce439f
push id19328
push usercleary@mozilla.com
push date2011-03-29 21:56 +0000
treeherdermozilla-central@3d0784802ce6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmandelin
bugs636544
milestone2.0b13pre
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 636544 - Fix JavaScript "-m -j" mode (r=dmandelin)
js/src/jstracer.cpp
js/src/methodjit/Compiler.cpp
js/src/tests/js1_8_1/jit/regress-458838.js
js/src/tests/js1_8_1/jit/regress-462459-01.js
js/src/tests/js1_8_1/jit/regress-462459-02.js
js/src/tests/js1_8_1/jit/regress-462459-03.js
js/src/tests/js1_8_1/jit/regress-462459-04.js
js/src/tests/js1_8_1/jit/regress-462459-05.js
js/src/tests/js1_8_1/jit/regress-462459-06.js
js/src/tests/js1_8_1/jit/regress-462459-07.js
js/src/tests/js1_8_1/jit/regress-462459-08.js
js/src/tests/js1_8_1/jit/regress-462459-09.js
js/src/tests/js1_8_1/jit/regress-462459-10.js
js/src/tests/js1_8_1/jit/regress-462459-11.js
js/src/tests/js1_8_1/jit/regress-462459-12.js
js/src/tests/js1_8_1/jit/regress-471635.js
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -499,22 +499,26 @@ jitstats_getProperty(JSContext *cx, JSOb
 
     if (JSID_IS_STRING(id)) {
         JSAtom* str = JSID_TO_ATOM(id);
         if (StringEqualsAscii(str, "HOTLOOP")) {
             *vp = INT_TO_JSVAL(HOTLOOP);
             return JS_TRUE;
         }
 
+        if (StringEqualsAscii(str, "adaptive")) {
 #ifdef JS_METHODJIT
-        if (StringEqualsAscii(str, "profiler")) {
-            *vp = BOOLEAN_TO_JSVAL(cx->profilingEnabled);
+            *vp = BOOLEAN_TO_JSVAL(cx->profilingEnabled ||
+                                   (cx->methodJitEnabled &&
+                                    !cx->hasRunOption(JSOPTION_METHODJIT_ALWAYS)));
+#else
+            *vp = BOOLEAN_TO_JSVAL(false);
+#endif
             return JS_TRUE;
         }
-#endif
     }
 
     if (JSID_IS_INT(id))
         index = JSID_TO_INT(id);
 
     uint64 result = 0;
     switch (index) {
 #define JITSTAT(x) case STAT ## x ## ID: result = jitstats.x; break;
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -634,20 +634,21 @@ mjit::Compiler::finishThisUp(JITScript *
         jitTraceICs[i].traceData = NULL;
 #ifdef DEBUG
         jitTraceICs[i].jumpTargetPC = traceICs[i].jumpTarget;
 #endif
         jitTraceICs[i].hasSlowTraceHint = traceICs[i].slowTraceHint.isSet();
         if (traceICs[i].slowTraceHint.isSet())
             jitTraceICs[i].slowTraceHint = stubCode.locationOf(traceICs[i].slowTraceHint.get());
 #ifdef JS_TRACER
-        jitTraceICs[i].loopCounterStart = GetHotloop(cx);
+        uint32 hotloop = GetHotloop(cx);
+        uint32 prevCount = cx->compartment->backEdgeCount(traceICs[i].jumpTarget);
+        jitTraceICs[i].loopCounterStart = hotloop;
+        jitTraceICs[i].loopCounter = hotloop < prevCount ? 1 : hotloop - prevCount;
 #endif
-        jitTraceICs[i].loopCounter = jitTraceICs[i].loopCounterStart
-            - cx->compartment->backEdgeCount(traceICs[i].jumpTarget);
         
         stubCode.patch(traceICs[i].addrLabel, &jitTraceICs[i]);
     }
 #endif /* JS_MONOIC */
 
     for (size_t i = 0; i < callPatches.length(); i++) {
         CallPatchInfo &patch = callPatches[i];
 
--- a/js/src/tests/js1_8_1/jit/regress-458838.js
+++ b/js/src/tests/js1_8_1/jit/regress-458838.js
@@ -69,17 +69,17 @@ function test()
   expect = 10;
   actual  = f();
 
   var recorderStarted;
   var recorderAborted;
   var traceCompleted;
   var skip = true;
   
-  if (this.tracemonkey && !this.tracemonkey.profiler)
+  if (this.tracemonkey && !this.tracemonkey.adaptive)
   {
     recorderStarted = this.tracemonkey.recorderStarted;
     recorderAborted = this.tracemonkey.recorderAborted;
     traceCompleted  = this.tracemonkey.traceCompleted;
     skip = false;
   }
 
   jit(false);
--- a/js/src/tests/js1_8_1/jit/regress-462459-01.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-01.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace Array()';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-02.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-02.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace Array(1)';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-03.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-03.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace Array(1, 2)';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-04.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-04.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace Array(1, 2, 3)'
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-05.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-05.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace new Array()';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-06.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-06.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace new Array(1)';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-07.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-07.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace new Array(1, 2)
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-08.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-08.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace new Array(1, 2,
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-09.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-09.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace []';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-10.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-10.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace [1]';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-11.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-11.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace [1, 2]';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-462459-12.js
+++ b/js/src/tests/js1_8_1/jit/regress-462459-12.js
@@ -41,17 +41,17 @@ var summary = 'TM: trace [1, 2, 3]';
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-if (!this.tracemonkey || this.tracemonkey.profiler)
+if (!this.tracemonkey || this.tracemonkey.adaptive)
 {
   jit(false);
   expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
   reportCompare(expect, actual, summary);
 }
 else
 {
   jit(true);
--- a/js/src/tests/js1_8_1/jit/regress-471635.js
+++ b/js/src/tests/js1_8_1/jit/regress-471635.js
@@ -59,17 +59,17 @@ function test()
     }
   })();
 
   var recorderStarted;
   var recorderAborted;
   var traceCompleted;
   var skip = true;
 
-  if (this.tracemonkey && !this.tracemonkey.profiler)
+  if (this.tracemonkey && !this.tracemonkey.adaptive)
   {
     recorderStarted = this.tracemonkey.recorderStarted;
     recorderAborted = this.tracemonkey.recorderAborted;
     traceCompleted  = this.tracemonkey.traceCompleted;
     skip = false;
   }
 
   jit(false);