Closed
Bug 349493
Opened 18 years ago
Closed 18 years ago
Let expression in ternary decompiles incorrectly
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1
People
(Reporter: jruderman, Assigned: mrbkap)
References
Details
(Keywords: testcase, verified1.8.1, Whiteboard: [181approval pending])
Attachments
(1 file)
(deleted),
patch
|
brendan
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
> function (x) { return x ? 0 : let (a = 3) a; }
function (x) { return x ? 0 : let (3 = 3) a; }
"let (3 = 3)" doesn't make much sense, and causes "missing variable name" if you try to eval it.
Assignee | ||
Comment 1•18 years ago
|
||
This was an old bug in the stack-depth modeling in the code generator. If you try to run your function in a debug build, you'll note that it asserts because the stack is off by one.
OS: Mac OS X 10.4 → All
Priority: -- → P1
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Assignee | ||
Comment 2•18 years ago
|
||
We needed to adjust the stack depth *before* emitting the else clause.
Comment 3•18 years ago
|
||
Comment on attachment 234824 [details] [diff] [review]
Fix
Safe and simple fix to an old latent bug that formerly just over-budgeted stack space, but not with let (block scope) is more serious.
/be
Attachment #234824 -
Flags: review?(brendan)
Attachment #234824 -
Flags: review+
Attachment #234824 -
Flags: approval1.8.1?
Assignee | ||
Comment 4•18 years ago
|
||
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Flags: blocking1.8.1?
Comment 5•18 years ago
|
||
Checking in regress-349493.js;
/cvsroot/mozilla/js/tests/js1_7/block/regress-349493.js,v <-- regress-349493.js
initial revision: 1.1
Flags: in-testsuite+
Updated•18 years ago
|
Flags: blocking1.8.1? → blocking1.8.1+
Whiteboard: [181approval pending]
Comment 6•18 years ago
|
||
Comment on attachment 234824 [details] [diff] [review]
Fix
a=schrep for drivers - approving all [181approval pending] bugs now that tree is open.
Attachment #234824 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Comment 7•18 years ago
|
||
*** Bug 349653 has been marked as a duplicate of this bug. ***
Comment 9•18 years ago
|
||
verified fixed 1.8, 1.9 20060824 windows/mac*/linux
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1 → verified1.8.1
Comment 10•18 years ago
|
||
I presume the new behavior is correct?
FAILED!: [reported from test()] Decompilation of let expression in ternary
FAILED!: [reported from test()] Expected value 'function (x) {
FAILED!: [reported from test()] return x ? 0 : let (a = 3) a;
FAILED!: [reported from test()] }', Actual value 'function (x) {
FAILED!: [reported from test()] return x ? 0 : (let (a = 3) a);
FAILED!: [reported from test()] }'
FAILED!: [reported from test()]
updating test to reflect the "actual" value
Checking in regress-349493.js;
/cvsroot/mozilla/js/tests/js1_7/block/regress-349493.js,v <-- regress-349493.js
new revision: 1.2; previous revision: 1.1
done
Comment 11•18 years ago
|
||
(In reply to comment #10)
> I presume the new behavior is correct?
>
> FAILED!: [reported from test()] Decompilation of let expression in ternary
> FAILED!: [reported from test()] Expected value 'function (x) {
> FAILED!: [reported from test()] return x ? 0 : let (a = 3) a;
> FAILED!: [reported from test()] }', Actual value 'function (x) {
> FAILED!: [reported from test()] return x ? 0 : (let (a = 3) a);
> FAILED!: [reported from test()] }'
Nothing wrong with extra parens here, and they come about naturally due to the bytecode precedence of let expression vs. ?:. The test should change to match the decompiler, or else tolerate parens or no parens (but only that difference).
/be
You need to log in
before you can comment on or make changes to this bug.
Description
•