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)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: h4writer, Assigned: h4writer)

References

Details

Attachments

(1 file, 2 obsolete files)

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).
Blocks: 847389
Assignee: general → hv1989
Adds a fastpath if input is double that fits into an int.
Attachment #733838 - Flags: review?(jdemooij)
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.
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)
Attachment #733844 - Attachment is patch: true
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, &notInt32); masm.moveValue(index, out); masm.jump(ool->rejoin()); masm.bind(&notInt32);
Attachment #733844 - Flags: review?(jdemooij) → review+
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)
Attachment #733844 - Attachment is obsolete: false
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)
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.

Attachment

General

Created:
Updated:
Size: