Closed
Bug 349596
Opened 18 years ago
Closed 18 years ago
Labeled "if(0)..." disappears but label remains
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1
People
(Reporter: jruderman, Assigned: brendan)
References
Details
(Keywords: testcase, verified1.8.1)
Attachments
(3 files)
2.76 KB,
patch
|
Details | Diff | Splinter Review | |
2.65 KB,
patch
|
mrbkap
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
2.65 KB,
patch
|
Details | Diff | Splinter Review |
Steps to reproduce: javascript:function() { L: if (0) return 5 } Result: function () { L: } Expected: (1) Decompile to what I had originally, or (2) Decompile to a simpler useless statement/block, such as "L: if (0) { }" or "L: null", or (3) Also remove the label, since it is useless given that nothing can break/continue to it. This is similar to bug 349489, which is already fixed.
Assignee | ||
Comment 1•18 years ago
|
||
This could be a problem in the constant folder, which runs right after the parse phase. It's therefore not like bug 349489, which was a bug in the useless expression eliminator, which runs from the code generator -- a later phase than the constant folding phase. But it is actually a bug in the decompiler: js> function f(){L:;} js> f function f() { L: } Old bug, taking. /be
Assignee: general → brendan
Flags: blocking1.8.1?
OS: Mac OS X 10.4 → All
Priority: -- → P1
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•18 years ago
|
||
Turns out that the easiest, and the singular, place to fix this is in the constant folder. There is no point elaborating the compiled code with a special "smoke signal" just for empty labeled statements, which are rare in JS (compared to C, where you sometimes need a goto target at the bottom of a loop, e.g.). By turning all empty labeled statements into labeled empty blocks, we save on code for special or redundant case logic, at the cost of an extra nop. This fixes both the verbatim L:; input case, and equivalent L:if(0)foo(); constant-folded cases. /be
Attachment #234883 -
Flags: review?(mrbkap)
Assignee | ||
Comment 3•18 years ago
|
||
This may be a bit more code, but on second thought I'd rather not mandate the constant folding phase. /be
Attachment #234887 -
Flags: review?(mrbkap)
Updated•18 years ago
|
Flags: blocking1.8.1? → blocking1.8.1+
Updated•18 years ago
|
Attachment #234887 -
Flags: review?(mrbkap) → review+
Assignee | ||
Updated•18 years ago
|
Attachment #234883 -
Flags: review?(mrbkap)
Assignee | ||
Comment 4•18 years ago
|
||
Comment on attachment 234887 [details] [diff] [review] alterna-fix that doesn't require the constant folding phase Checking in jsparse.c; /cvsroot/mozilla/js/src/jsparse.c,v <-- jsparse.c new revision: 3.206; previous revision: 3.205 done
Attachment #234887 -
Flags: approval1.8.1?
Assignee | ||
Comment 5•18 years ago
|
||
Fixed on trunk. /be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 6•18 years ago
|
||
Comment on attachment 234887 [details] [diff] [review] alterna-fix that doesn't require the constant folding phase a=schrep for drivers.
Attachment #234887 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Comment 8•18 years ago
|
||
Comment 9•18 years ago
|
||
Checking in regress-349596.js; /cvsroot/mozilla/js/tests/js1_5/Regress/regress-349596.js,v <-- regress-349596.js initial revision: 1.1
Flags: in-testsuite+
Comment 10•18 years ago
|
||
verified fixed 1.8, 1.9 20060824 windows/mac*/linux
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1 → verified1.8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•