OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6203 | 6203 |
6204 bool is_valid() { return is_valid_; } | 6204 bool is_valid() { return is_valid_; } |
6205 | 6205 |
6206 void invalidate() { is_valid_ = false; } | 6206 void invalidate() { is_valid_ = false; } |
6207 | 6207 |
6208 // Calculated hash value for a string consisting of 1 to | 6208 // Calculated hash value for a string consisting of 1 to |
6209 // String::kMaxArrayIndexSize digits with no leading zeros (except "0"). | 6209 // String::kMaxArrayIndexSize digits with no leading zeros (except "0"). |
6210 // value is represented decimal value. | 6210 // value is represented decimal value. |
6211 static uint32_t MakeArrayIndexHash(uint32_t value, int length); | 6211 static uint32_t MakeArrayIndexHash(uint32_t value, int length); |
6212 | 6212 |
| 6213 // No string is allowed to have a hash of zero. That value is reserved |
| 6214 // for internal properties. If the hash calculation yields zero then we |
| 6215 // use 27 instead. |
| 6216 static const int kZeroHash = 27; |
| 6217 |
6213 private: | 6218 private: |
6214 uint32_t array_index() { | 6219 uint32_t array_index() { |
6215 ASSERT(is_array_index()); | 6220 ASSERT(is_array_index()); |
6216 return array_index_; | 6221 return array_index_; |
6217 } | 6222 } |
6218 | 6223 |
6219 inline uint32_t GetHash(); | 6224 inline uint32_t GetHash(); |
6220 | 6225 |
6221 int length_; | 6226 int length_; |
6222 uint32_t raw_running_hash_; | 6227 uint32_t raw_running_hash_; |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8077 } else { | 8082 } else { |
8078 value &= ~(1 << bit_position); | 8083 value &= ~(1 << bit_position); |
8079 } | 8084 } |
8080 return value; | 8085 return value; |
8081 } | 8086 } |
8082 }; | 8087 }; |
8083 | 8088 |
8084 } } // namespace v8::internal | 8089 } } // namespace v8::internal |
8085 | 8090 |
8086 #endif // V8_OBJECTS_H_ | 8091 #endif // V8_OBJECTS_H_ |
OLD | NEW |