| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Review notes: | 5 // Review notes: |
| 6 // | 6 // |
| 7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
| 8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
| 9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
| 10 // | 10 // |
| (...skipping 6769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6780 if (!hasher.has_trivial_hash()) hasher.AddCharacters(chars, length); | 6780 if (!hasher.has_trivial_hash()) hasher.AddCharacters(chars, length); |
| 6781 return hasher.GetHashField(); | 6781 return hasher.GetHashField(); |
| 6782 } | 6782 } |
| 6783 | 6783 |
| 6784 | 6784 |
| 6785 uint32_t IteratingStringHasher::Hash(String* string, uint32_t seed) { | 6785 uint32_t IteratingStringHasher::Hash(String* string, uint32_t seed) { |
| 6786 IteratingStringHasher hasher(string->length(), seed); | 6786 IteratingStringHasher hasher(string->length(), seed); |
| 6787 // Nothing to do. | 6787 // Nothing to do. |
| 6788 if (hasher.has_trivial_hash()) return hasher.GetHashField(); | 6788 if (hasher.has_trivial_hash()) return hasher.GetHashField(); |
| 6789 ConsString* cons_string = String::VisitFlat(&hasher, string); | 6789 ConsString* cons_string = String::VisitFlat(&hasher, string); |
| 6790 // The string was flat. | 6790 if (cons_string != nullptr) { |
| 6791 if (cons_string == NULL) return hasher.GetHashField(); | 6791 hasher.VisitConsString(cons_string); |
| 6792 // This is a ConsString, iterate across it. | |
| 6793 ConsStringIterator iter(cons_string); | |
| 6794 int offset; | |
| 6795 while (NULL != (string = iter.Next(&offset))) { | |
| 6796 String::VisitFlat(&hasher, string, offset); | |
| 6797 } | 6792 } |
| 6798 return hasher.GetHashField(); | 6793 return hasher.GetHashField(); |
| 6799 } | 6794 } |
| 6800 | 6795 |
| 6801 | 6796 |
| 6802 void IteratingStringHasher::VisitOneByteString(const uint8_t* chars, | 6797 void IteratingStringHasher::VisitOneByteString(const uint8_t* chars, |
| 6803 int length) { | 6798 int length) { |
| 6804 AddCharacters(chars, length); | 6799 AddCharacters(chars, length); |
| 6805 } | 6800 } |
| 6806 | 6801 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7479 #undef READ_SHORT_FIELD | 7474 #undef READ_SHORT_FIELD |
| 7480 #undef WRITE_SHORT_FIELD | 7475 #undef WRITE_SHORT_FIELD |
| 7481 #undef READ_BYTE_FIELD | 7476 #undef READ_BYTE_FIELD |
| 7482 #undef WRITE_BYTE_FIELD | 7477 #undef WRITE_BYTE_FIELD |
| 7483 #undef NOBARRIER_READ_BYTE_FIELD | 7478 #undef NOBARRIER_READ_BYTE_FIELD |
| 7484 #undef NOBARRIER_WRITE_BYTE_FIELD | 7479 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7485 | 7480 |
| 7486 } } // namespace v8::internal | 7481 } } // namespace v8::internal |
| 7487 | 7482 |
| 7488 #endif // V8_OBJECTS_INL_H_ | 7483 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |