Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/objects-inl.h

Issue 762773002: Don't use ConsStringIterator to compute string hashes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698