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

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

Issue 9113006: Fix the logic that should ensure that a string cannot have (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4363 matching lines...) Expand 10 before | Expand all | Expand 10 after
4374 } 4374 }
4375 4375
4376 4376
4377 uint32_t StringHasher::GetHash() { 4377 uint32_t StringHasher::GetHash() {
4378 // Get the calculated raw hash value and do some more bit ops to distribute 4378 // Get the calculated raw hash value and do some more bit ops to distribute
4379 // the hash further. Ensure that we never return zero as the hash value. 4379 // the hash further. Ensure that we never return zero as the hash value.
4380 uint32_t result = raw_running_hash_; 4380 uint32_t result = raw_running_hash_;
4381 result += (result << 3); 4381 result += (result << 3);
4382 result ^= (result >> 11); 4382 result ^= (result >> 11);
4383 result += (result << 15); 4383 result += (result << 15);
4384 if (result == 0) { 4384 if ((result & String::kHashBitMask) == 0) {
4385 result = 27; 4385 result = 27;
4386 } 4386 }
4387 return result; 4387 return result;
4388 } 4388 }
4389 4389
4390 4390
4391 template <typename schar> 4391 template <typename schar>
4392 uint32_t HashSequentialString(const schar* chars, int length, uint32_t seed) { 4392 uint32_t HashSequentialString(const schar* chars, int length, uint32_t seed) {
4393 StringHasher hasher(length, seed); 4393 StringHasher hasher(length, seed);
4394 if (!hasher.has_trivial_hash()) { 4394 if (!hasher.has_trivial_hash()) {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
4769 #undef WRITE_INT_FIELD 4769 #undef WRITE_INT_FIELD
4770 #undef READ_SHORT_FIELD 4770 #undef READ_SHORT_FIELD
4771 #undef WRITE_SHORT_FIELD 4771 #undef WRITE_SHORT_FIELD
4772 #undef READ_BYTE_FIELD 4772 #undef READ_BYTE_FIELD
4773 #undef WRITE_BYTE_FIELD 4773 #undef WRITE_BYTE_FIELD
4774 4774
4775 4775
4776 } } // namespace v8::internal 4776 } } // namespace v8::internal
4777 4777
4778 #endif // V8_OBJECTS_INL_H_ 4778 #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