| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 } | 3670 } |
| 3671 | 3671 |
| 3672 | 3672 |
| 3673 static StringInputBuffer string_compare_buffer_b; | 3673 static StringInputBuffer string_compare_buffer_b; |
| 3674 | 3674 |
| 3675 | 3675 |
| 3676 template <typename IteratorA> | 3676 template <typename IteratorA> |
| 3677 static inline bool CompareStringContentsPartial(IteratorA* ia, String* b) { | 3677 static inline bool CompareStringContentsPartial(IteratorA* ia, String* b) { |
| 3678 if (b->IsFlat()) { | 3678 if (b->IsFlat()) { |
| 3679 if (b->IsAsciiRepresentation()) { | 3679 if (b->IsAsciiRepresentation()) { |
| 3680 VectorIterator<const char> ib(b->ToAsciiVector()); | 3680 VectorIterator<char> ib(b->ToAsciiVector()); |
| 3681 return CompareStringContents(ia, &ib); | 3681 return CompareStringContents(ia, &ib); |
| 3682 } else { | 3682 } else { |
| 3683 VectorIterator<const uc16> ib(b->ToUC16Vector()); | 3683 VectorIterator<uc16> ib(b->ToUC16Vector()); |
| 3684 return CompareStringContents(ia, &ib); | 3684 return CompareStringContents(ia, &ib); |
| 3685 } | 3685 } |
| 3686 } else { | 3686 } else { |
| 3687 string_compare_buffer_b.Reset(0, b); | 3687 string_compare_buffer_b.Reset(0, b); |
| 3688 return CompareStringContents(ia, &string_compare_buffer_b); | 3688 return CompareStringContents(ia, &string_compare_buffer_b); |
| 3689 } | 3689 } |
| 3690 } | 3690 } |
| 3691 | 3691 |
| 3692 | 3692 |
| 3693 static StringInputBuffer string_compare_buffer_a; | 3693 static StringInputBuffer string_compare_buffer_a; |
| 3694 | 3694 |
| 3695 | 3695 |
| 3696 bool String::SlowEquals(String* other) { | 3696 bool String::SlowEquals(String* other) { |
| 3697 // Fast check: negative check with lengths. | 3697 // Fast check: negative check with lengths. |
| 3698 int len = length(); | 3698 int len = length(); |
| 3699 if (len != other->length()) return false; | 3699 if (len != other->length()) return false; |
| 3700 if (len == 0) return true; | 3700 if (len == 0) return true; |
| 3701 | 3701 |
| 3702 // Fast check: if hash code is computed for both strings | 3702 // Fast check: if hash code is computed for both strings |
| 3703 // a fast negative check can be performed. | 3703 // a fast negative check can be performed. |
| 3704 if (HasHashCode() && other->HasHashCode()) { | 3704 if (HasHashCode() && other->HasHashCode()) { |
| 3705 if (Hash() != other->Hash()) return false; | 3705 if (Hash() != other->Hash()) return false; |
| 3706 } | 3706 } |
| 3707 | 3707 |
| 3708 if (this->IsFlat()) { | 3708 if (this->IsFlat()) { |
| 3709 if (this->IsAsciiRepresentation()) { | 3709 if (this->IsAsciiRepresentation()) { |
| 3710 VectorIterator<const char> buf1(this->ToAsciiVector()); | 3710 VectorIterator<char> buf1(this->ToAsciiVector()); |
| 3711 return CompareStringContentsPartial(&buf1, other); | 3711 return CompareStringContentsPartial(&buf1, other); |
| 3712 } else { | 3712 } else { |
| 3713 VectorIterator<const uc16> buf1(this->ToUC16Vector()); | 3713 VectorIterator<uc16> buf1(this->ToUC16Vector()); |
| 3714 return CompareStringContentsPartial(&buf1, other); | 3714 return CompareStringContentsPartial(&buf1, other); |
| 3715 } | 3715 } |
| 3716 } else { | 3716 } else { |
| 3717 string_compare_buffer_a.Reset(0, this); | 3717 string_compare_buffer_a.Reset(0, this); |
| 3718 return CompareStringContentsPartial(&string_compare_buffer_a, other); | 3718 return CompareStringContentsPartial(&string_compare_buffer_a, other); |
| 3719 } | 3719 } |
| 3720 } | 3720 } |
| 3721 | 3721 |
| 3722 | 3722 |
| 3723 bool String::MarkAsUndetectable() { | 3723 bool String::MarkAsUndetectable() { |
| (...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6442 // No break point. | 6442 // No break point. |
| 6443 if (break_point_objects()->IsUndefined()) return 0; | 6443 if (break_point_objects()->IsUndefined()) return 0; |
| 6444 // Single beak point. | 6444 // Single beak point. |
| 6445 if (!break_point_objects()->IsFixedArray()) return 1; | 6445 if (!break_point_objects()->IsFixedArray()) return 1; |
| 6446 // Multiple break points. | 6446 // Multiple break points. |
| 6447 return FixedArray::cast(break_point_objects())->length(); | 6447 return FixedArray::cast(break_point_objects())->length(); |
| 6448 } | 6448 } |
| 6449 | 6449 |
| 6450 | 6450 |
| 6451 } } // namespace v8::internal | 6451 } } // namespace v8::internal |
| OLD | NEW |