OLD | NEW |
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 4310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4321 } | 4321 } |
4322 | 4322 |
4323 | 4323 |
4324 StringHasher::StringHasher(int length, uint32_t seed) | 4324 StringHasher::StringHasher(int length, uint32_t seed) |
4325 : length_(length), | 4325 : length_(length), |
4326 raw_running_hash_(seed), | 4326 raw_running_hash_(seed), |
4327 array_index_(0), | 4327 array_index_(0), |
4328 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), | 4328 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), |
4329 is_first_char_(true), | 4329 is_first_char_(true), |
4330 is_valid_(true) { | 4330 is_valid_(true) { |
4331 ASSERT(FLAG_randomize_string_hashes || raw_running_hash_ == 0); | 4331 ASSERT(FLAG_randomize_hashes || raw_running_hash_ == 0); |
4332 } | 4332 } |
4333 | 4333 |
4334 | 4334 |
4335 bool StringHasher::has_trivial_hash() { | 4335 bool StringHasher::has_trivial_hash() { |
4336 return length_ > String::kMaxHashCalcLength; | 4336 return length_ > String::kMaxHashCalcLength; |
4337 } | 4337 } |
4338 | 4338 |
4339 | 4339 |
4340 void StringHasher::AddCharacter(uc32 c) { | 4340 void StringHasher::AddCharacter(uc32 c) { |
4341 // Use the Jenkins one-at-a-time hash function to update the hash | 4341 // Use the Jenkins one-at-a-time hash function to update the hash |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4782 #undef WRITE_INT_FIELD | 4782 #undef WRITE_INT_FIELD |
4783 #undef READ_SHORT_FIELD | 4783 #undef READ_SHORT_FIELD |
4784 #undef WRITE_SHORT_FIELD | 4784 #undef WRITE_SHORT_FIELD |
4785 #undef READ_BYTE_FIELD | 4785 #undef READ_BYTE_FIELD |
4786 #undef WRITE_BYTE_FIELD | 4786 #undef WRITE_BYTE_FIELD |
4787 | 4787 |
4788 | 4788 |
4789 } } // namespace v8::internal | 4789 } } // namespace v8::internal |
4790 | 4790 |
4791 #endif // V8_OBJECTS_INL_H_ | 4791 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |