Closed
Bug 685695
Opened 14 years ago
Closed 14 years ago
IonMonkey: Implement JSOP_SUB
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: dvander, Assigned: dvander)
References
Details
Attachments
(1 file)
|
16.11 KB,
patch
|
sstangl
:
review+
|
Details | Diff | Splinter Review |
I need this to run a benchmark with subtraction in it.
| Assignee | ||
Comment 1•14 years ago
|
||
Attachment #559299 -
Flags: review?(sstangl)
Comment 2•14 years ago
|
||
Comment on attachment 559299 [details] [diff] [review]
patch
Review of attachment 559299 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/ion/LIR-Common.h
@@ +475,2 @@
> // Adds two integers, returning an integer value.
> +class LAddI : public LBinaryMath<0>
This might read more cleanly as "LBinaryMath<Temps(0)>" -- the current state requires readers to chase definitions.
::: js/src/ion/MIR.cpp
@@ +109,5 @@
> + case MDefinition::Op_Add:
> + ret.setNumber(lhs.toNumber() + rhs.toNumber());
> + break;
> + case MDefinition::Op_Sub:
> + ret.setNumber(lhs.toNumber() - rhs.toNumber());
I don't see any place where overflow is handled -- likewise for Add and Mul.
Attachment #559299 -
Flags: review?(sstangl) → review+
| Assignee | ||
Comment 3•14 years ago
|
||
> ::: js/src/ion/MIR.cpp
> @@ +109,5 @@
> > + case MDefinition::Op_Add:
> > + ret.setNumber(lhs.toNumber() + rhs.toNumber());
> > + break;
> > + case MDefinition::Op_Sub:
> > + ret.setNumber(lhs.toNumber() - rhs.toNumber());
>
> I don't see any place where overflow is handled -- likewise for Add and Mul.
Okay, I see how this actually works now - the result is a double so it won't overflow, setNumber may re-cast to int, but we don't allow the MIR type to change (by GVN, it's too late).
| Assignee | ||
Comment 4•14 years ago
|
||
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.
Description
•