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 4172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 int len = length(); | 4183 int len = length(); |
4184 if (len != other->length()) return false; | 4184 if (len != other->length()) return false; |
4185 if (len == 0) return true; | 4185 if (len == 0) return true; |
4186 | 4186 |
4187 // Fast check: if hash code is computed for both strings | 4187 // Fast check: if hash code is computed for both strings |
4188 // a fast negative check can be performed. | 4188 // a fast negative check can be performed. |
4189 if (HasHashCode() && other->HasHashCode()) { | 4189 if (HasHashCode() && other->HasHashCode()) { |
4190 if (Hash() != other->Hash()) return false; | 4190 if (Hash() != other->Hash()) return false; |
4191 } | 4191 } |
4192 | 4192 |
4193 if (StringShape(this).IsSequentialAscii() && StringShape(other).IsSequentialAs
cii()) { | 4193 if (StringShape(this).IsSequentialAscii() && |
| 4194 StringShape(other).IsSequentialAscii()) { |
4194 const char* str1 = SeqAsciiString::cast(this)->GetChars(); | 4195 const char* str1 = SeqAsciiString::cast(this)->GetChars(); |
4195 const char* str2 = SeqAsciiString::cast(other)->GetChars(); | 4196 const char* str2 = SeqAsciiString::cast(other)->GetChars(); |
4196 return CompareRawStringContents(Vector<const char>(str1, len), | 4197 return CompareRawStringContents(Vector<const char>(str1, len), |
4197 Vector<const char>(str2, len)); | 4198 Vector<const char>(str2, len)); |
4198 } | 4199 } |
4199 | 4200 |
4200 if (this->IsFlat()) { | 4201 if (this->IsFlat()) { |
4201 if (StringShape(this).IsAsciiRepresentation()) { | 4202 if (StringShape(this).IsAsciiRepresentation()) { |
4202 Vector<const char> vec1 = this->ToAsciiVector(); | 4203 Vector<const char> vec1 = this->ToAsciiVector(); |
4203 if (other->IsFlat()) { | 4204 if (other->IsFlat()) { |
(...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7363 // No break point. | 7364 // No break point. |
7364 if (break_point_objects()->IsUndefined()) return 0; | 7365 if (break_point_objects()->IsUndefined()) return 0; |
7365 // Single beak point. | 7366 // Single beak point. |
7366 if (!break_point_objects()->IsFixedArray()) return 1; | 7367 if (!break_point_objects()->IsFixedArray()) return 1; |
7367 // Multiple break points. | 7368 // Multiple break points. |
7368 return FixedArray::cast(break_point_objects())->length(); | 7369 return FixedArray::cast(break_point_objects())->length(); |
7369 } | 7370 } |
7370 | 7371 |
7371 | 7372 |
7372 } } // namespace v8::internal | 7373 } } // namespace v8::internal |
OLD | NEW |