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

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

Issue 11228004: Fix two-char hash to use correct fallback for zero hashes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months 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 | Annotate | Revision Log
« 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 // 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 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4948 running_hash ^= (running_hash >> 6); 4948 running_hash ^= (running_hash >> 6);
4949 return running_hash; 4949 return running_hash;
4950 } 4950 }
4951 4951
4952 4952
4953 uint32_t StringHasher::GetHashCore(uint32_t running_hash) { 4953 uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
4954 running_hash += (running_hash << 3); 4954 running_hash += (running_hash << 3);
4955 running_hash ^= (running_hash >> 11); 4955 running_hash ^= (running_hash >> 11);
4956 running_hash += (running_hash << 15); 4956 running_hash += (running_hash << 15);
4957 if ((running_hash & String::kHashBitMask) == 0) { 4957 if ((running_hash & String::kHashBitMask) == 0) {
4958 return 27; 4958 return kZeroHash;
4959 } 4959 }
4960 return running_hash; 4960 return running_hash;
4961 } 4961 }
4962 4962
4963 4963
4964 void StringHasher::AddCharacter(uint32_t c) { 4964 void StringHasher::AddCharacter(uint32_t c) {
4965 if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) { 4965 if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) {
4966 AddSurrogatePair(c); // Not inlined. 4966 AddSurrogatePair(c); // Not inlined.
4967 return; 4967 return;
4968 } 4968 }
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
5540 #undef WRITE_UINT32_FIELD 5540 #undef WRITE_UINT32_FIELD
5541 #undef READ_SHORT_FIELD 5541 #undef READ_SHORT_FIELD
5542 #undef WRITE_SHORT_FIELD 5542 #undef WRITE_SHORT_FIELD
5543 #undef READ_BYTE_FIELD 5543 #undef READ_BYTE_FIELD
5544 #undef WRITE_BYTE_FIELD 5544 #undef WRITE_BYTE_FIELD
5545 5545
5546 5546
5547 } } // namespace v8::internal 5547 } } // namespace v8::internal
5548 5548
5549 #endif // V8_OBJECTS_INL_H_ 5549 #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