Closed Bug 610618 Opened 14 years ago Closed 14 years ago

JM produces incorrect result for NaN, prefix increment

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: jandem, Assigned: dvander)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

This test case: --- function a1() { var a8 = NaN; var a9 = ++a8; var a10 = ++a8; print(a8); print(a9); print(a10); } a1(); --- Gives the following output: JM : NaN, undefined, NaN TM/V8 : NaN, NaN, NaN
blocking2.0: --- → ?
Summary: JM produces incorrect result with NaN, prefix increment → JM produces incorrect result for NaN, prefix increment
Assignee: general → dvander
Status: NEW → ASSIGNED
blocking2.0: ? → final+
Great test case. Our implementation of localinc is a huge hack that tries to work around some early FrameState problems. Everything goes wrong at "a10 = ++a8". 1. a8 is backed by [t=EDI, d=EDX], a9 is unsynced, backed by a8. 2. Guard: EDI is an int32 ----------> slow path 3. Copy EDX -> ESI 4. Add 1 to ESI 5. a8 is "uncopied", a9 becomes backed by [t=mem, d=EDX], and is unsynced. 6. a8 becomes backed by [t=int32, d=ESI] 7. <-------- slow path rejoins here The bug is that when the slow path rejoins, it sees that a9 should be reloaded into ESI. But that's not correct. a9 was never synced, so it reloads its old value (in this case, undefined).
Attached patch fixSplinter Review
No noticeable perf loss on sunspider or v8. The generated code isn't as efficient, but this is something we should fix in ADD/SUB instead as we aim to remove op fusing.
Attachment #493766 - Flags: review?(dmandelin)
Attachment #493766 - Flags: review?(dmandelin) → review+
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: