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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 | 298 |
299 inline uint32_t ComputeLongHash(uint64_t key) { | 299 inline uint32_t ComputeLongHash(uint64_t key) { |
300 uint64_t hash = key; | 300 uint64_t hash = key; |
301 hash = ~hash + (hash << 18); // hash = (hash << 18) - hash - 1; | 301 hash = ~hash + (hash << 18); // hash = (hash << 18) - hash - 1; |
302 hash = hash ^ (hash >> 31); | 302 hash = hash ^ (hash >> 31); |
303 hash = hash * 21; // hash = (hash + (hash << 2)) + (hash << 4); | 303 hash = hash * 21; // hash = (hash + (hash << 2)) + (hash << 4); |
304 hash = hash ^ (hash >> 11); | 304 hash = hash ^ (hash >> 11); |
305 hash = hash + (hash << 6); | 305 hash = hash + (hash << 6); |
306 hash = hash ^ (hash >> 22); | 306 hash = hash ^ (hash >> 22); |
307 return (uint32_t) hash; | 307 return static_cast<uint32_t>(hash); |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 inline uint32_t ComputePointerHash(void* ptr) { | 311 inline uint32_t ComputePointerHash(void* ptr) { |
312 return ComputeIntegerHash( | 312 return ComputeIntegerHash( |
313 static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr)), | 313 static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr)), |
314 v8::internal::kZeroHashSeed); | 314 v8::internal::kZeroHashSeed); |
315 } | 315 } |
316 | 316 |
317 | 317 |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1038 |
1039 // Every compiled stub starts with this id. | 1039 // Every compiled stub starts with this id. |
1040 static const int kStubEntryId = 5; | 1040 static const int kStubEntryId = 5; |
1041 | 1041 |
1042 int id_; | 1042 int id_; |
1043 }; | 1043 }; |
1044 | 1044 |
1045 } } // namespace v8::internal | 1045 } } // namespace v8::internal |
1046 | 1046 |
1047 #endif // V8_UTILS_H_ | 1047 #endif // V8_UTILS_H_ |
OLD | NEW |