From dcb00e1ea75d4f18ff2855a51d77a8c02edfc00d Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 28 Sep 2012 15:56:28 -0700 Subject: [PATCH] Bug 787309 - Fallback on try notes after continuing on a goto. r=luke --- js/src/jit-test/tests/basic/bug787309.js | 6 ++++++ js/src/jsopcode.cpp | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 js/src/jit-test/tests/basic/bug787309.js diff --git a/js/src/jit-test/tests/basic/bug787309.js b/js/src/jit-test/tests/basic/bug787309.js new file mode 100644 index 000000000000..c1f622307005 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug787309.js @@ -0,0 +1,6 @@ +try { + h +} catch (x +if gc()) {} finally { + this.z.z +} diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index aca683deb644..da6b9c5da7b0 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -6437,6 +6437,27 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, } continue; } + + if (!script->hasTrynotes()) + continue; + + // If we do not follow a goto we look for another mean to continue + // at the next PC. + JSTryNote *tn = script->trynotes()->vector; + JSTryNote *tnEnd = tn + script->trynotes()->length; + for (; tn != tnEnd; tn++) { + jsbytecode *start = script->main() + tn->start; + jsbytecode *end = start + tn->length; + if (start < pc && pc <= end && end <= target) + break; + } + if (tn != tnEnd) { + pcdepth = tn->stackDepth; + hpcdepth = unsigned(-1); + oplen = 0; + pc = script->main() + tn->start + tn->length; + } + continue; } /*