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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; | 244 hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; |
245 hash = hash ^ (hash >> 12); | 245 hash = hash ^ (hash >> 12); |
246 hash = hash + (hash << 2); | 246 hash = hash + (hash << 2); |
247 hash = hash ^ (hash >> 4); | 247 hash = hash ^ (hash >> 4); |
248 hash = hash * 2057; // hash = (hash + (hash << 3)) + (hash << 11); | 248 hash = hash * 2057; // hash = (hash + (hash << 3)) + (hash << 11); |
249 hash = hash ^ (hash >> 16); | 249 hash = hash ^ (hash >> 16); |
250 return hash; | 250 return hash; |
251 } | 251 } |
252 | 252 |
253 | 253 |
254 static inline uint32_t ComputePointerHash(void* ptr) { | |
mnaganov (inactive)
2011/04/29 14:20:28
As we intend to deal with Addresses, maybe it's a
Vitaly Repeshko
2011/04/29 15:50:40
Don't think so --- it'll require casting from ever
| |
255 return ComputeIntegerHash( | |
256 static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr))); | |
257 } | |
258 | |
259 | |
254 // ---------------------------------------------------------------------------- | 260 // ---------------------------------------------------------------------------- |
255 // Miscellaneous | 261 // Miscellaneous |
256 | 262 |
257 // A static resource holds a static instance that can be reserved in | 263 // A static resource holds a static instance that can be reserved in |
258 // a local scope using an instance of Access. Attempts to re-reserve | 264 // a local scope using an instance of Access. Attempts to re-reserve |
259 // the instance will cause an error. | 265 // the instance will cause an error. |
260 template <typename T> | 266 template <typename T> |
261 class StaticResource { | 267 class StaticResource { |
262 public: | 268 public: |
263 StaticResource() : is_reserved_(false) {} | 269 StaticResource() : is_reserved_(false) {} |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 INLINE(Dest BitCast(const Source& source)); | 793 INLINE(Dest BitCast(const Source& source)); |
788 | 794 |
789 template <class Dest, class Source> | 795 template <class Dest, class Source> |
790 inline Dest BitCast(const Source& source) { | 796 inline Dest BitCast(const Source& source) { |
791 return BitCastHelper<Dest, Source>::cast(source); | 797 return BitCastHelper<Dest, Source>::cast(source); |
792 } | 798 } |
793 | 799 |
794 } } // namespace v8::internal | 800 } } // namespace v8::internal |
795 | 801 |
796 #endif // V8_UTILS_H_ | 802 #endif // V8_UTILS_H_ |
OLD | NEW |