Closed
Bug 817515
Opened 12 years ago
Closed 12 years ago
BaselineCompiler: Compile NEG and BITNOT
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
2.77 KB,
patch
|
djvj
:
review+
|
Details | Diff | Splinter Review |
11.73 KB,
patch
|
djvj
:
review+
|
Details | Diff | Splinter Review |
Need these for SS, eg nsieve-bits.
Assignee | ||
Comment 1•12 years ago
|
||
Patch for m-c to move JSOP_NEG code into NegOperation.
Attachment #687689 -
Flags: review?(kvijayan)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #687706 -
Flags: review?(kvijayan)
Updated•12 years ago
|
Attachment #687689 -
Flags: review?(kvijayan) → review+
Assignee | ||
Comment 3•12 years ago
|
||
Whiteboard: [leave open]
Updated•12 years ago
|
Attachment #687706 -
Flags: review?(kvijayan) → review+
Assignee | ||
Comment 4•12 years ago
|
||
Whiteboard: [leave open]
Comment 5•12 years ago
|
||
Comment on attachment 687689 [details] [diff] [review]
Part 1: Add NegOperation
>- /*
>- * When the operand is int jsval, INT32_FITS_IN_JSVAL(i) implies
>- * INT32_FITS_IN_JSVAL(-i) unless i is 0 or INT32_MIN when the
>- * results, -0.0 or INT32_MAX + 1, are double values.
>- */
>- Value ref = regs.sp[-1];
>- int32_t i;
>- if (ref.isInt32() && (i = ref.toInt32()) != 0 && i != INT32_MIN) {
>- i = -i;
>- regs.sp[-1].setInt32(i);
>- } else {
>- double d;
>- if (!ToNumber(cx, regs.sp[-1], &d))
>- goto error;
>- d = -d;
>- if (!regs.sp[-1].setNumber(d) && !ref.isDouble())
>- TypeScript::MonitorOverflow(cx, script, regs.pc);
>- }
>+ RootedValue &val = rootValue0;
Why this ref to and use of rootValue0? There should be no need for a copy of the value to negate.
Check code-gen, did this really equate to the previous code (which should uave used a Value& ref but never mind)? I may well be picking on the previous version too!
/be
Comment 6•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Brendan Eich [:brendan] from comment #5)
>
> Why this ref to and use of rootValue0? There should be no need for a copy of
> the value to negate.
>
> Check code-gen, did this really equate to the previous code (which should
> uave used a Value& ref but never mind)? I may well be picking on the
> previous version too!
>
> /be
It couldn't use a reference, it has to keep the original value around after setting the result, to check if it's an int32 overflow:
if (!regs.sp[-1].setNumber(d) && !ref.isDouble())
ToNumber can trigger a GC, so this value has to be exactly rooted. Looking at other ops (e.g. SUB/MUL/DIV), the convention is to use rootValue0.
You need to log in
before you can comment on or make changes to this bug.
Description
•