OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7601 BuildCheckHeapObject(string); | 7601 BuildCheckHeapObject(string); |
7602 HValue* checkstring = | 7602 HValue* checkstring = |
7603 AddInstruction(HCheckInstanceType::NewIsString(string, zone())); | 7603 AddInstruction(HCheckInstanceType::NewIsString(string, zone())); |
7604 HInstruction* length = BuildLoadStringLength(string, checkstring); | 7604 HInstruction* length = BuildLoadStringLength(string, checkstring); |
7605 AddInstruction(length); | 7605 AddInstruction(length); |
7606 HInstruction* checked_index = Add<HBoundsCheck>(index, length); | 7606 HInstruction* checked_index = Add<HBoundsCheck>(index, length); |
7607 return New<HStringCharCodeAt>(string, checked_index); | 7607 return New<HStringCharCodeAt>(string, checked_index); |
7608 } | 7608 } |
7609 | 7609 |
7610 | 7610 |
7611 // Checks if the given shift amounts have form: (sa) and (32 - sa). | 7611 // Checks if the given shift amounts have following forms: |
| 7612 // (N1) and (N2) with N1 + N2 = 32; (sa) and (32 - sa). |
7612 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa, | 7613 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa, |
7613 HValue* const32_minus_sa) { | 7614 HValue* const32_minus_sa) { |
| 7615 if (sa->IsConstant() && const32_minus_sa->IsConstant()) { |
| 7616 const HConstant* c1 = HConstant::cast(sa); |
| 7617 const HConstant* c2 = HConstant::cast(const32_minus_sa); |
| 7618 return c1->HasInteger32Value() && c2->HasInteger32Value() && |
| 7619 (c1->Integer32Value() + c2->Integer32Value() == 32); |
| 7620 } |
7614 if (!const32_minus_sa->IsSub()) return false; | 7621 if (!const32_minus_sa->IsSub()) return false; |
7615 HSub* sub = HSub::cast(const32_minus_sa); | 7622 HSub* sub = HSub::cast(const32_minus_sa); |
7616 if (sa != sub->right()) return false; | 7623 if (sa != sub->right()) return false; |
7617 HValue* const32 = sub->left(); | 7624 HValue* const32 = sub->left(); |
7618 if (!const32->IsConstant() || | 7625 if (!const32->IsConstant() || |
7619 HConstant::cast(const32)->Integer32Value() != 32) { | 7626 HConstant::cast(const32)->Integer32Value() != 32) { |
7620 return false; | 7627 return false; |
7621 } | 7628 } |
7622 return (sub->right() == sa); | 7629 return (sub->right() == sa); |
7623 } | 7630 } |
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9679 if (ShouldProduceTraceOutput()) { | 9686 if (ShouldProduceTraceOutput()) { |
9680 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9687 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9681 } | 9688 } |
9682 | 9689 |
9683 #ifdef DEBUG | 9690 #ifdef DEBUG |
9684 graph_->Verify(false); // No full verify. | 9691 graph_->Verify(false); // No full verify. |
9685 #endif | 9692 #endif |
9686 } | 9693 } |
9687 | 9694 |
9688 } } // namespace v8::internal | 9695 } } // namespace v8::internal |
OLD | NEW |