Bug 1091757 - Fix ReportUninitializedLexical to not call frameIndex() for aliased locals. r=shu
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 31 Oct 2014 14:29:11 +0100
changeset 213399 ef9ed51f78e08881ae3dc2bd06145e97d3d74db5
parent 213398 0c31008f237b1e89ee11db93b30c68f90017b175
child 213400 3ce12a4c3afb37c07e63fec8dc25bf10bcb3e544
push id27748
push userryanvm@gmail.com
push dateFri, 31 Oct 2014 20:14:33 +0000
treeherdermozilla-central@12ac66e2c016 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1091757
milestone36.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
Bug 1091757 - Fix ReportUninitializedLexical to not call frameIndex() for aliased locals. r=shu
js/src/jit-test/tests/basic/bug1091757.js
js/src/vm/Interpreter.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug1091757.js
@@ -0,0 +1,11 @@
+try {
+    (function() {
+	let a = 3;
+	let XY = XY;
+	return function() { return a; };
+    })();
+    assertEq(0, 1);
+} catch(e) {
+    assertEq(e instanceof ReferenceError, true);
+    assertEq(e.message.contains("XY"), true);
+}
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -4066,17 +4066,17 @@ js::ReportUninitializedLexical(JSContext
 {
     RootedPropertyName name(cx);
 
     if (JSOp(*pc) == JSOP_CHECKLEXICAL) {
         uint32_t slot = GET_LOCALNO(pc);
 
         // First search for a name among body-level lets.
         for (BindingIter bi(script); bi; bi++) {
-            if (bi->kind() != Binding::ARGUMENT && bi.frameIndex() == slot) {
+            if (bi->kind() != Binding::ARGUMENT && !bi->aliased() && bi.frameIndex() == slot) {
                 name = bi->name();
                 break;
             }
         }
 
         // Failing that, it must be a block-local let.
         if (!name) {
             // Skip to the right scope.