OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 if (IsHashFieldComputed(field)) return field >> kHashShift; | 2979 if (IsHashFieldComputed(field)) return field >> kHashShift; |
2980 // Slow case: compute hash code and set it. | 2980 // Slow case: compute hash code and set it. |
2981 return ComputeAndSetHash(); | 2981 return ComputeAndSetHash(); |
2982 } | 2982 } |
2983 | 2983 |
2984 | 2984 |
2985 StringHasher::StringHasher(int length) | 2985 StringHasher::StringHasher(int length) |
2986 : length_(length), | 2986 : length_(length), |
2987 raw_running_hash_(0), | 2987 raw_running_hash_(0), |
2988 array_index_(0), | 2988 array_index_(0), |
2989 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), | 2989 is_array_index_(0 < length_ && |
| 2990 length_ <= String::kMaxCachedArrayIndexLength), |
2990 is_first_char_(true), | 2991 is_first_char_(true), |
2991 is_valid_(true) { } | 2992 is_valid_(true) { } |
2992 | 2993 |
2993 | 2994 |
2994 bool StringHasher::has_trivial_hash() { | 2995 bool StringHasher::has_trivial_hash() { |
2995 return length_ > String::kMaxHashCalcLength; | 2996 return length_ > String::kMaxHashCalcLength; |
2996 } | 2997 } |
2997 | 2998 |
2998 | 2999 |
2999 void StringHasher::AddCharacter(uc32 c) { | 3000 void StringHasher::AddCharacter(uc32 c) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3223 #undef WRITE_INT_FIELD | 3224 #undef WRITE_INT_FIELD |
3224 #undef READ_SHORT_FIELD | 3225 #undef READ_SHORT_FIELD |
3225 #undef WRITE_SHORT_FIELD | 3226 #undef WRITE_SHORT_FIELD |
3226 #undef READ_BYTE_FIELD | 3227 #undef READ_BYTE_FIELD |
3227 #undef WRITE_BYTE_FIELD | 3228 #undef WRITE_BYTE_FIELD |
3228 | 3229 |
3229 | 3230 |
3230 } } // namespace v8::internal | 3231 } } // namespace v8::internal |
3231 | 3232 |
3232 #endif // V8_OBJECTS_INL_H_ | 3233 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |