Don't get confused by unreachable opcodes before loop headers when picking chunk boundaries, bug 781859. r=jandem
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 23 Oct 2012 07:45:34 -0700
changeset 111282 0d60a2c574f4b585c56586cc59ef42b5c1fc883b
parent 111281 a8e578300d3ebb23f2c42a53ba99478fe6c7344c
child 111283 df63d31cb673d34e2026d54adf8f94af3c62c558
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjandem
bugs781859
milestone19.0a1
Don't get confused by unreachable opcodes before loop headers when picking chunk boundaries, bug 781859. r=jandem
js/src/jit-test/tests/jaeger/bug781859-1.js
js/src/jit-test/tests/jaeger/bug781859-2.js
js/src/jit-test/tests/jaeger/bug781859-3.js
js/src/methodjit/Compiler.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug781859-1.js
@@ -0,0 +1,25 @@
+// |jit-test| error:ReferenceError
+function e() {
+    try {} catch (e) {
+    return (actual = "FAIL");
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+      a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x
+    }
+    while (t) continue;
+}
+e();
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug781859-2.js
@@ -0,0 +1,9 @@
+mjitChunkLimit(42);
+Function("\
+    switch (/x/) {\
+        case 8:\
+        break;\
+        t(function(){})\
+    }\
+    while (false)(function(){})\
+")()
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug781859-3.js
@@ -0,0 +1,10 @@
+mjitChunkLimit(10);
+function e() {
+    try {
+        var t = undefined;
+    } catch (e) { }
+    while (t)
+        continue;
+}
+for (var i = 0; i < 20; i++)
+  e();
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -699,17 +699,17 @@ MakeJITScript(JSContext *cx, JSScript *s
 
             jsbytecode *pc = script->code + offset;
             JSOp op = JSOp(*pc);
 
             nextOffset = offset + GetBytecodeLength(pc);
 
             Bytecode *code = analysis->maybeCode(offset);
             if (!code)
-                continue;
+                op = JSOP_NOP; /* Ignore edges from unreachable opcodes. */
 
             /* Whether this should be the last opcode in the chunk. */
             bool finishChunk = false;
 
             /* Keep going, override finishChunk. */
             bool preserveChunk = false;
 
             /*