Closed Bug 747554 Opened 12 years ago Closed 12 years ago

"Assertion failure: script->varIsAliased(i),"

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: gkw, Assigned: luke)

References

Details

(Keywords: assertion, regression, testcase, Whiteboard: js-triage-needed)

Attachments

(2 files)

Attached file stack
(function() {
    switch ({
        z
    } = gc) {
    case n:
        function e() {}
        var z
    }
})()

asserts js debug shell on m-c changeset 17af008937e3 without any CLI arguments at Assertion failure: script->varIsAliased(i),

autoBisect shows this is probably related to the following changeset:

The first bad revision is:
changeset:   91357:4c298ca28fa6
user:        Luke Wagner
date:        Fri Mar 16 12:02:37 2012 -0700
summary:     Bug 740259 - Assert that dynamic binding access is expected (r=bhackett)
Attached patch fix and testSplinter Review
Ah, the root of this evil is destructuring short-hand: when we parse the 'x' in '{x} = blah', we parse 'x' as a property name.  That means we don't use Parser::identifierName (like all other names) which means we never link the use to def which means we emit a dynamic name lookup for 'x' which triggers the "I thought this wasn't aliased" assertion added for ALIASEDVAR.

The fix is to do the def-use linking in CheckDestructuring by sharing code with identifierName.
Assignee: general → luke
Status: NEW → ASSIGNED
Attachment #617156 - Flags: review?(jwalden+bmo)
Comment on attachment 617156 [details] [diff] [review]
fix and test

Review of attachment 617156 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/frontend/Parser.cpp
@@ +6684,5 @@
>  #endif
>                 ) && !(tc->flags & TCF_DECL_DESTRUCTURING))
>      {
> +        if (!NoteNameUse(node, tc))
> +            return false;

NULL, you warning-introducer you.
Attachment #617156 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/be0709aa4730
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
A testcase for this bug was automatically identified at js/src/jit-test/tests/basic/testBug747554.js.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: