Closed Bug 584605 Opened 14 years ago Closed 14 years ago

JM computes >> incorrectly

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: alangpierce)

References

Details

(Keywords: testcase)

Attachments

(1 file, 1 obsolete file)

(function(){ print(8>>1); })();

./js       4
./js -m    0
Attached patch Patch (obsolete) (deleted) — Splinter Review
Easy one-character fix.
Assignee: general → apierce
Status: NEW → ASSIGNED
Attachment #463073 - Flags: review?(dvander)
Comment on attachment 463073 [details] [diff] [review]
Patch

r=me but we should really just be calling JSOpBinaryTryConstantFold() here, as per bug 578517 comment #13
Attachment #463073 - Flags: review?(dvander) → review+
And by "here" I mean at the top of the function.
Blocks: 578517
My mistake, thanks for picking up the patch, Alan. I'm learning that I need to write more tests than just a few sanity checks for my ops.
Attached patch Patch, v2 (deleted) — Splinter Review
Added a few test cases and made it call JSOpBinaryTryConstantFold instead. We need to go through ValueToECMAInt32 for shifts, so I reworked JSOpBinaryTryConstantFold a bit.
Attachment #463073 - Attachment is obsolete: true
Attachment #463084 - Flags: review?(dvander)
(In reply to comment #4)

No worries - can't catch everything, this is what the fuzzer is for ;)
Comment on attachment 463084 [details] [diff] [review]
Patch, v2

Sorry Alan, forgot that the folder needed changes. Thanks for taking.
Attachment #463084 - Flags: review?(dvander) → review+
Comment on attachment 463084 [details] [diff] [review]
Patch, v2


>+    /* TODO: Check for conversion failure. */

Conversion failure isn't possible on a primitive, IIRC.
Indeed, primitives convert infallibly (may result in NaN -> 0, -0 -> 0, e.g.).

The L and R locals stand out much better, even though prevailing style avoids capitalizing local and member names. Maybe that would help in general, although it starts to get shout-y. "l" is obviously a bad local name because it looks like a 1 in too many fonts.

/be
http://hg.mozilla.org/users/danderson_mozilla.com/moo/rev/c649f828e197
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

Creator:
Created:
Updated:
Size: