Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 03aea64736d818f456c748f76a31d583593dc664..fa6d3beb254c2ba15b5d94ba6709ff71970c27a7 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -6722,6 +6722,28 @@ uint32_t StringHasher::GetHashCore(uint32_t running_hash) { |
} |
+uint32_t StringHasher::ComputeRunningHash(uint32_t running_hash, |
+ const uc16* chars, int length) { |
+ DCHECK(chars && length > 0); |
Dmitry Lomov (no reviews)
2014/11/27 07:23:05
Style nit: chars != nullptr.
Why 'length > 0', no
caitp (gmail)
2014/11/27 14:44:49
Well there's no harm in it being an empty loop, bu
|
+ for (int i = 0; i < length; ++i) { |
+ running_hash = AddCharacterCore(running_hash, *chars++); |
+ } |
+ return running_hash; |
+} |
+ |
+ |
+uint32_t StringHasher::ComputeRunningHashOneByte(uint32_t running_hash, |
+ const char* chars, |
+ int length) { |
+ DCHECK(chars && length > 0); |
Dmitry Lomov (no reviews)
2014/11/27 07:23:05
Ditto
|
+ for (int i = 0; i < length; ++i) { |
+ uint16_t c = static_cast<uint16_t>(*chars++); |
+ running_hash = AddCharacterCore(running_hash, c); |
+ } |
+ return running_hash; |
+} |
+ |
+ |
void StringHasher::AddCharacter(uint16_t c) { |
// Use the Jenkins one-at-a-time hash function to update the hash |
// for the given character. |