Closed
Bug 869501
Opened 12 years ago
Closed 12 years ago
Missed opportunities to form CompareDAndBranch
Categories
(Core :: JavaScript Engine, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: sunfish, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
2.83 KB,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
In js/src/ion/Lowering.cpp, the optimization to form LCompareDAndBranch nodes instead of doing a separate comparison and branch checks for a compareType() of Compare_Double. This means it misses cases that use Compare_DoubleMaybeCoerceLHS and Compare_DoubleMaybeCoerceRHS. This causes it to sometimes generate code like this:
ucomisd %xmm1, %xmm0
seta %cl
movzbl %ecx, %ecx
[...]
testl %ecx, %ecx
jne [...]
for Javascript code like this (warning, contrived testcase):
var array = [ 0.1, undefined ];
for (var i = 0; i != array.length; ++i)
if (array[i] < 0)
print('hi');
Reporter | ||
Comment 1•12 years ago
|
||
This patch adds checks for the MaybeCoerce forms of Compare_Double, which is consistent with the code later on which forms LCompareD nodes. I'm still new to this code, so I don't know if there are reasons for not doing this.
Comment 2•12 years ago
|
||
Thanks! I've added Brain, since he introduced Compare_DoubleMaybeCoerceLHS recently. I don't know the real objective of that actually. But I saw it passing on tbpl.
If you think it is finished you can always request a review to the right people. Usually you can find this by using "hg annotate -u" on the changed file and see who changed that particular line before. In this case I would recommend bhackett ;)
And feel free to ask additional questions here or on the irc channel (#jsapi and/or #ionmonkey)
Comment 3•12 years ago
|
||
Good catch, looks like I only updated LIRGenerator::visitCompare for the new comparisons. The Compare_DoubleMaybeCoerce variants can be treated the same as Compare_Double in lowering and later phases, the coerce just indicates to the type analysis (which runs after the MIR is initially constructed) whether operands may be converted to doubles without bailing out.
Reporter | ||
Comment 4•12 years ago
|
||
Would it make sense to rewrite Compare_DoubleMaybeCoerce to Compare_Double once it is no longer needed?
Comment 5•12 years ago
|
||
Hmm, I think it would be a bit cleaner to have an IsDoubleComparison() static method or something, or remove the Coerce variants and add a couple bits of data to the type policy.
Reporter | ||
Comment 6•12 years ago
|
||
It wasn't clear to me how to add bytes to the type, so I created an isDoubleComparison() method and made both places use it.
Attachment #746460 -
Attachment is obsolete: true
Attachment #746782 -
Flags: review?(bhackett1024)
Comment 7•12 years ago
|
||
Comment on attachment 746782 [details] [diff] [review]
a revised patch, per feedback
Review of attachment 746782 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
Attachment #746782 -
Flags: review?(bhackett1024) → review+
Updated•12 years ago
|
Whiteboard: checkin-needed
Comment 8•12 years ago
|
||
Whiteboard: checkin-needed
Comment 9•12 years ago
|
||
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•