Closed Bug 351496 Opened 18 years ago Closed 18 years ago

"let (y = 3)" in "case" expression decompiles as "let (3 = 3)"

Categories

(Core :: JavaScript Engine, defect, P2)

All
AIX
defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1

People

(Reporter: jruderman, Assigned: brendan)

Details

(Keywords: testcase, verified1.8.1)

Attachments

(1 file, 1 obsolete file)

js> function() { switch(0) { case let(y = 3) 6: } }

function () {
    switch (0) {
      case let (3 = 3) 6:
      default:;
    }
}
Attached patch fix (obsolete) — Splinter Review
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #237276 - Flags: review?(mrbkap)
Attachment #237276 - Flags: review?(mrbkap) → review+
Fixed on trunk.

/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment on attachment 237276 [details] [diff] [review]
fix

This is a safe fix for a failure to model the stack accurately.  It causes the model to have fewer items on it than expected, which could lead to bad memory conditions.  In the specific testcase given in this bug, the only result is a mis-decompilation.  But I would rather not take changes, and the fix correctly matches the code generator's stack model.

/be
Attachment #237276 - Flags: approval1.8.1?
Comment on attachment 237276 [details] [diff] [review]
fix

Something's bad, this patch leads to decompiler string stack overflow.

/be
Attachment #237276 - Attachment is obsolete: true
Attachment #237276 - Flags: review+
Attachment #237276 - Flags: approval1.8.1?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Attached patch fix, v2Splinter Review
Two bugs:
1.  EmitSwitch failed to link the SRC_PCDELTA of the last case to the implicit JSOP_DEFAULT it generated after all the cases.  This made switch(x){case y:z} decompile with default: labeling z along with case y: !

2.  Fixed DecompileSwitch to manage the stack model correctly for the case label / statements order in which it processes bytecode, which does not match the code genartion order (case labels before any case statements -- the JSOP_CASE stack balance of -1 for mismatch instead of -2 for match favors the code gen order, relieving it of the need to fiddle with cg->stackDepth -- the decompiler loses).

/be
Attachment #237297 - Flags: review?(mrbkap)
OS: Mac OS X 10.4 → AIX
Priority: -- → P2
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Attachment #237297 - Flags: review?(mrbkap) → review+
Fixed on trunk.

/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Comment on attachment 237297 [details] [diff] [review]
fix, v2

Straight-up fixes, local to their containing functions except for the good effects of the EmitSwitch fix on the decompilation of switch statements that use variables in case labels and have no explicit default case.

/be
Attachment #237297 - Flags: approval1.8.1?
Comment on attachment 237297 [details] [diff] [review]
fix, v2

a=schrep for drivers.
Attachment #237297 - Flags: approval1.8.1? → approval1.8.1+
Fixed on the 1.8 branch.

/be
Keywords: fixed1.8.1
Checking in regress-351496.js;
/cvsroot/mozilla/js/tests/js1_7/block/regress-351496.js,v  <--  regress-351496.js
initial revision: 1.1
done
Flags: in-testsuite+
verified fixed 1.8 1.9 20060909 windows/mac*/linux
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: