Closed
Bug 855514
Opened 12 years ago
Closed 12 years ago
IonMonkey: add fastpath for JSOP_TOID of a double that fits in an int32
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: h4writer, Assigned: h4writer)
References
Details
Attachments
(1 file, 2 obsolete files)
3.76 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
We hit this in jpeg2000 a lot. The input to JSOP_TOID is typed to be int/float. Therefore we don't do the fastpath of int, but the slow vmcall. But actually the type is a double that fits nicely in an int.
I'll add a LDoubleToIdV that tries to fit the double in an int and upon fail does the vmcall in an ool path.
This increases our score from 4.6s to 2.5s.
That makes us faster than JM+TI (3.5s) and V8 (2.8s).
Assignee | ||
Updated•12 years ago
|
Assignee: general → hv1989
Assignee | ||
Comment 1•12 years ago
|
||
Adds a fastpath if input is double that fits into an int.
Attachment #733838 -
Flags: review?(jdemooij)
Comment 2•12 years ago
|
||
Comment on attachment 733838 [details] [diff] [review]
Add fastpath for double inputs to ToId
Review of attachment 733838 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/ion/CodeGenerator.cpp
@@ +5245,5 @@
> +}
> +bool
> +CodeGenerator::visitToIdV(LToIdV *lir)
> +{
> + Label done, vm;
Unused.
@@ +5251,5 @@
> + FloatRegister temp = ToFloatRegister(lir->tempFloat());
> + const ValueOperand out = ToOutValue(lir);
> +
> + OutOfLineToIdV *ool = new OutOfLineToIdV(lir);
> + if (!addOutOfLineCode(ool))
Could this use oolCallVM?
@@ +5255,5 @@
> + if (!addOutOfLineCode(ool))
> + return false;
> +
> + ValueOperand index = ToValue(lir, LToIdV::Index);
> + Register tag = masm.splitTagForTest(index);
You don't need to split if you only use the tag once.
Assignee | ||
Comment 3•12 years ago
|
||
Addressed the comments of evilpie, thanks :D. I had no clue oolCallVM existed. Decreases the code touched a lot :D
Attachment #733838 -
Attachment is obsolete: true
Attachment #733838 -
Flags: review?(jdemooij)
Attachment #733844 -
Flags: review?(jdemooij)
Updated•12 years ago
|
Attachment #733844 -
Attachment is patch: true
Comment 4•12 years ago
|
||
Comment on attachment 733844 [details] [diff] [review]
Add fastpath for double inputs to ToId
Review of attachment 733844 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, but could use a jit-test. r=me with that and the comments below addressed.
::: js/src/ion/CodeGenerator.cpp
@@ +5213,5 @@
> + ImmGCPtr(current->mir()->info().script()),
> + ImmWord(lir->mir()->resumePoint()->pc()),
> + ToValue(lir, LToIdV::Object),
> + ToValue(lir, LToIdV::Index)),
> + StoreValueTo(out));
Nit: indentation is off here (tabs?).
@@ +5215,5 @@
> + ToValue(lir, LToIdV::Object),
> + ToValue(lir, LToIdV::Index)),
> + StoreValueTo(out));
> +
> + masm.branchTestDouble(Assembler::NotEqual, index, ool->entry());
The int32 case is probably also common (if the index is either int32-or-double) and easy to support. Can you add something like this here:
Label notInt32;
masm.branchTestInt32(Assembler::NotEqual, index, ¬Int32);
masm.moveValue(index, out);
masm.jump(ool->rejoin());
masm.bind(¬Int32);
Attachment #733844 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 5•12 years ago
|
||
I'll have to ask another review round. I did the Int32 moveValue, but there is an issue. moveValue fails for 32bit when input is (a:b) and output (b:a).
(a:b) is notation for the (type:payload) register.
Therefore I used tagValue in that case. I also had to adjust tagValue, as it also didn't like this behaviour, but by rearranging how the mov's happen, fixed that.
Attachment #733844 -
Attachment is obsolete: true
Attachment #734175 -
Flags: review?(jdemooij)
Assignee | ||
Updated•12 years ago
|
Attachment #733844 -
Attachment is obsolete: false
Assignee | ||
Comment 6•12 years ago
|
||
Comment on attachment 734175 [details] [diff] [review]
Add fastpath for double inputs to ToId
Following a small conversation on IRC, we went for the previous version and changed useBoxAtStart to useBox. That solves the issues too.
https://hg.mozilla.org/integration/mozilla-inbound/rev/11f52a74cac4
Attachment #734175 -
Attachment is obsolete: true
Attachment #734175 -
Flags: review?(jdemooij)
Comment 7•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•