Closed Bug 658240 Opened 13 years ago Closed 13 years ago

TI+JM: incorrect result with +=, parseFloat

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jandem, Unassigned)

References

Details

This test is reduced from the Mochitest-2 orange.
--
function f() {
    var x = 0;
    for(var i=0; i<5; i++) {
        (function() {
            x += parseFloat("2");
        })();
    }
    return x;
}
assertEq(f(), 10);
--
$ ./js -m -n -a test.js
test.js:10: Error: Assertion failed: got 2, expected 10

parseFloat has TypeHandlerFloat and returns an int32 value. Similar functions like (2).valueOf() also fail.
It's OK for natives to return ints when their handler is a float, we'll convert it to a float when merging back into the inline path.  The problem here was that when generating a PIC for the GETXPROP used in the '+=' we did not update the possible types pushed by the PIC, as we do for GETPROP and NAME ICs (grumble...)

http://hg.mozilla.org/projects/jaegermonkey/rev/aec367836312
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.