From efcb97d8662b1b876f5848836e67cb6656a9b18b Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sat, 29 Sep 2012 00:43:25 -0700 Subject: [PATCH] Bug 794286 - ReconstructPcStack, Keep hidden stack depth only when following gotos. r=luke --- js/src/jit-test/tests/basic/bug794286.js | 6 ++++++ js/src/jsopcode.cpp | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/basic/bug794286.js diff --git a/js/src/jit-test/tests/basic/bug794286.js b/js/src/jit-test/tests/basic/bug794286.js new file mode 100644 index 000000000000..a3c1a13cdd99 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug794286.js @@ -0,0 +1,6 @@ +// |jit-test| error: TypeError +for (var i = 0; i < 1; i++) { + let y + if (undefined) continue + undefined.e +} diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 3061c3f16378..1b262d7d26e1 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -6431,6 +6431,7 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, if (0 < jmpoff && pc + jmpoff <= target) { pc += jmpoff; oplen = 0; + /* Use the Hidden pc count if we follow the goto */ if (hpcdepth != unsigned(-1)) { pcdepth = hpcdepth; hpcdepth = unsigned(-1); @@ -6438,8 +6439,11 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, continue; } - if (!script->hasTrynotes()) + if (!script->hasTrynotes()) { + /* Use the normal pc count if continue after the goto */ + hpcdepth = unsigned(-1); continue; + } /* * If we do not follow a goto we look for another mean to continue