Closed Bug 539819 Opened 15 years ago Closed 6 years ago

The statement "0/0;" is not always compiled out

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 632020

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: regression, testcase)

On the TM branch, jsfunfuzz discovered that whether "0/0;" is compiled out depends on whether the function as a whole is parenthesized.  This makes jsfunfuzz complain a lot, so I'll probably have to turn off its round-trip checking until this bug is fixed.

Maybe this is related to constant-folding and caused by bug 537673?

With parens:

js> (function() { (function b() {0 / 0;})(); })
(function () {(function b() {0 / 0;}());})

Without parens:

js> function () {(function b() {0 / 0;}());}
function () {(function b() {}());}
Hmm, yeah, we should be hopping down a level or two, not skipping it entirely at that point.
Waldo, ping? We're missing a lot of jsfunfuzz coverage because of this bug.
The js shell errors out now if the function isn't enclosed in parentheses. Is there another way to test this or is this no longer valid?

Not sure if this is really equivalent, but when I use print(), I get the following:
js> print((function () {(function b() {0 / 0;}());}))
function () {
    (function b() {}());
}
js> print(function () {(function b() {0 / 0;}());})
function () {
    (function b() {}());
OS: Mac OS X → All
Hardware: x86 → All
I can still reproduce the bug, like this:

js> print(function() { (function b() {0 / 0;})(); })
function () {
    (function b() {0 / 0;}());
}

js> print((function () {(function b() {0 / 0;}());}))
function () {
    (function b() {}());
}
With the decompiler gone, this bug no longer bites jsfunfuzz.  But it's still present, as can be seen with:

dis("-r", function() { (function b() {0 / 0;})(); })
dis("-r", (function () {(function b() {0 / 0;}());}))
Assignee: general → nobody
I just noticed this bug in a bug list.

This also applies to things like a["x"] => a.x folding and so it's an interesting perf issue I want to track down.
Flags: needinfo?(jdemooij)
Probably the same issue as in bug 632020.
(In reply to André Bargull [:anba] from comment #7)
> Probably the same issue as in bug 632020.

Yes, thanks :)
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(jdemooij)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.