Closed Bug 630543 Opened 9 years ago Closed 9 years ago

Constant folding assumes `this` is truthy even in strict functions

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: fixed-in-tracemonkey)

function f() {
    "use strict";
    return !this;
}
assertEq(f.call(null), true);  // FAILS
Is that a valuable optimization to have, even when it's correct?
(In reply to comment #1)
> Is that a valuable optimization to have, even when it's correct?

It was a freebie in the pre-ES5-strict days, see Boolish. Easily fixed.

/be
http://hg.mozilla.org/tracemonkey/rev/41e2276b9b78

Jason, could you add comment 0's test? I'm sick at home here...

/be
Whiteboard: fixed-in-tracemonkey
Nice patch! I'll push the test tonight; I have a few things to push.
This should ridealong into b12. We could even put it into m-c today for b11.

/be
Blocks: es5strict
Backed the test out in http://hg.mozilla.org/tracemonkey/rev/819776ea6cce since it wasn't clear to me whether it was this or the other cset in the same push that caused make check to time out during jit-test/tests/basic/bug627609.js, but the tree was completely hosed.
And relanded the test in http://hg.mozilla.org/tracemonkey/rev/a1cba95edcf9, since Brendan said to point the orange-stained Finger of Blame at bug 627692 instead.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.