| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3661 result += (result << 3); | 3661 result += (result << 3); |
| 3662 result ^= (result >> 11); | 3662 result ^= (result >> 11); |
| 3663 result += (result << 15); | 3663 result += (result << 15); |
| 3664 if (result == 0) { | 3664 if (result == 0) { |
| 3665 result = 27; | 3665 result = 27; |
| 3666 } | 3666 } |
| 3667 return result; | 3667 return result; |
| 3668 } | 3668 } |
| 3669 | 3669 |
| 3670 | 3670 |
| 3671 template <typename schar> |
| 3672 uint32_t HashSequentialString(const schar* chars, int length) { |
| 3673 StringHasher hasher(length); |
| 3674 if (!hasher.has_trivial_hash()) { |
| 3675 int i; |
| 3676 for (i = 0; hasher.is_array_index() && (i < length); i++) { |
| 3677 hasher.AddCharacter(chars[i]); |
| 3678 } |
| 3679 for (; i < length; i++) { |
| 3680 hasher.AddCharacterNoIndex(chars[i]); |
| 3681 } |
| 3682 } |
| 3683 return hasher.GetHashField(); |
| 3684 } |
| 3685 |
| 3686 |
| 3671 bool String::AsArrayIndex(uint32_t* index) { | 3687 bool String::AsArrayIndex(uint32_t* index) { |
| 3672 uint32_t field = hash_field(); | 3688 uint32_t field = hash_field(); |
| 3673 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { | 3689 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { |
| 3674 return false; | 3690 return false; |
| 3675 } | 3691 } |
| 3676 return SlowAsArrayIndex(index); | 3692 return SlowAsArrayIndex(index); |
| 3677 } | 3693 } |
| 3678 | 3694 |
| 3679 | 3695 |
| 3680 Object* JSObject::GetPrototype() { | 3696 Object* JSObject::GetPrototype() { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3920 #undef WRITE_INT_FIELD | 3936 #undef WRITE_INT_FIELD |
| 3921 #undef READ_SHORT_FIELD | 3937 #undef READ_SHORT_FIELD |
| 3922 #undef WRITE_SHORT_FIELD | 3938 #undef WRITE_SHORT_FIELD |
| 3923 #undef READ_BYTE_FIELD | 3939 #undef READ_BYTE_FIELD |
| 3924 #undef WRITE_BYTE_FIELD | 3940 #undef WRITE_BYTE_FIELD |
| 3925 | 3941 |
| 3926 | 3942 |
| 3927 } } // namespace v8::internal | 3943 } } // namespace v8::internal |
| 3928 | 3944 |
| 3929 #endif // V8_OBJECTS_INL_H_ | 3945 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |