[INFER] Fix more assertions, bug 673705. r=bhackett
authorShu-yu Guo <shu@rfrn.org>
Tue, 26 Jul 2011 14:16:59 -0700
changeset 76077 058032661e2f2a7755e7b63fc7bbab0231992540
parent 76076 bd40ad1be9d889e3323adda04bb74f6d31bcedb3
child 76078 c7a7d9ff99da33f98d56bff5b673df3d97116de3
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersbhackett
bugs673705
milestone8.0a1
[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()
 {
     /*