[INFER] Fix more assertions, bug 673705. r=bhackett
authorShu-yu Guo <shu@rfrn.org>
Tue, 26 Jul 2011 14:16:59 -0700
changeset 77388 058032661e2f2a7755e7b63fc7bbab0231992540
parent 77387 bd40ad1be9d889e3323adda04bb74f6d31bcedb3
child 77389 c7a7d9ff99da33f98d56bff5b673df3d97116de3
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs673705
milestone8.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
[INFER] Fix more assertions, bug 673705. r=bhackett
js/src/jit-test/tests/basic/bug673705-1.js
js/src/jit-test/tests/basic/bug673705-2.js
js/src/jit-test/tests/basic/bug673705.js
js/src/jsanalyze.cpp
rename from js/src/jit-test/tests/basic/bug673705.js
rename to js/src/jit-test/tests/basic/bug673705-1.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug673705-2.js
@@ -0,0 +1,12 @@
+function bug673705() {
+  var x;
+  try {
+    try {
+    } catch (e) {
+    }
+  } finally {
+  }
+  print(x);
+  return x;
+}
+assertEq(bug673705(), undefined);
--- a/js/src/jsanalyze.cpp
+++ b/js/src/jsanalyze.cpp
@@ -1242,17 +1242,27 @@ ScriptAnalysis::extendVariable(JSContext
         }
     }
 }
 
 inline void
 ScriptAnalysis::ensureVariable(LifetimeVariable &var, unsigned until)
 {
     JS_ASSERT(var.lifetime);
-    JS_ASSERT(until <= var.lifetime->start);
+
+    /*
+     * If we are already ensured, the current range we are trying to ensure
+     * should already be included.
+     */
+    if (var.ensured) {
+        JS_ASSERT(var.lifetime->start <= until);
+        return;
+    }
+
+    JS_ASSERT(until < var.lifetime->start);
     var.lifetime->start = until;
     var.ensured = true;
 }
 
 void
 ScriptAnalysis::clearAllocations()
 {
     /*