| 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 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3761 result += (result << 3); | 3761 result += (result << 3); |
| 3762 result ^= (result >> 11); | 3762 result ^= (result >> 11); |
| 3763 result += (result << 15); | 3763 result += (result << 15); |
| 3764 if (result == 0) { | 3764 if (result == 0) { |
| 3765 result = 27; | 3765 result = 27; |
| 3766 } | 3766 } |
| 3767 return result; | 3767 return result; |
| 3768 } | 3768 } |
| 3769 | 3769 |
| 3770 | 3770 |
| 3771 template <typename schar> |
| 3772 uint32_t HashSequentialString(const schar* chars, int length) { |
| 3773 StringHasher hasher(length); |
| 3774 if (!hasher.has_trivial_hash()) { |
| 3775 int i; |
| 3776 for (i = 0; hasher.is_array_index() && (i < length); i++) { |
| 3777 hasher.AddCharacter(chars[i]); |
| 3778 } |
| 3779 for (; i < length; i++) { |
| 3780 hasher.AddCharacterNoIndex(chars[i]); |
| 3781 } |
| 3782 } |
| 3783 return hasher.GetHashField(); |
| 3784 } |
| 3785 |
| 3786 |
| 3771 bool String::AsArrayIndex(uint32_t* index) { | 3787 bool String::AsArrayIndex(uint32_t* index) { |
| 3772 uint32_t field = hash_field(); | 3788 uint32_t field = hash_field(); |
| 3773 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { | 3789 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { |
| 3774 return false; | 3790 return false; |
| 3775 } | 3791 } |
| 3776 return SlowAsArrayIndex(index); | 3792 return SlowAsArrayIndex(index); |
| 3777 } | 3793 } |
| 3778 | 3794 |
| 3779 | 3795 |
| 3780 Object* JSObject::GetPrototype() { | 3796 Object* JSObject::GetPrototype() { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 #undef WRITE_INT_FIELD | 4096 #undef WRITE_INT_FIELD |
| 4081 #undef READ_SHORT_FIELD | 4097 #undef READ_SHORT_FIELD |
| 4082 #undef WRITE_SHORT_FIELD | 4098 #undef WRITE_SHORT_FIELD |
| 4083 #undef READ_BYTE_FIELD | 4099 #undef READ_BYTE_FIELD |
| 4084 #undef WRITE_BYTE_FIELD | 4100 #undef WRITE_BYTE_FIELD |
| 4085 | 4101 |
| 4086 | 4102 |
| 4087 } } // namespace v8::internal | 4103 } } // namespace v8::internal |
| 4088 | 4104 |
| 4089 #endif // V8_OBJECTS_INL_H_ | 4105 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |