1 // Copyright 2019 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_NUMBERS_HASH_SEED_INL_H_ 6 #define V8_NUMBERS_HASH_SEED_INL_H_ 7 8 #include <stdint.h> 9 10 // The #includes below currently lead to cyclic transitive includes, so 11 // HashSeed() ends up being required before it is defined, so we have to 12 // declare it here. This is a workaround; if we needed this permanently then 13 // we should put that line into a "hash-seed.h" header; but we won't need 14 // it for long. 15 // TODO(jkummerow): Get rid of this by breaking circular include dependencies. 16 namespace v8 { 17 namespace internal { 18 19 class Isolate; 20 class LocalIsolate; 21 class ReadOnlyRoots; 22 23 inline uint64_t HashSeed(Isolate* isolate); 24 inline uint64_t HashSeed(LocalIsolate* isolate); 25 inline uint64_t HashSeed(ReadOnlyRoots roots); 26 27 } // namespace internal 28 } // namespace v8 29 30 // See comment above for why this isn't at the top of the file. 31 #include "src/objects/fixed-array-inl.h" 32 #include "src/roots/roots-inl.h" 33 34 namespace v8 { 35 namespace internal { 36 HashSeed(Isolate * isolate)37inline uint64_t HashSeed(Isolate* isolate) { 38 return HashSeed(ReadOnlyRoots(isolate)); 39 } 40 HashSeed(LocalIsolate * isolate)41inline uint64_t HashSeed(LocalIsolate* isolate) { 42 return HashSeed(ReadOnlyRoots(isolate)); 43 } 44 HashSeed(ReadOnlyRoots roots)45inline uint64_t HashSeed(ReadOnlyRoots roots) { 46 uint64_t seed; 47 roots.hash_seed().copy_out(0, reinterpret_cast<byte*>(&seed), kInt64Size); 48 return seed; 49 } 50 51 } // namespace internal 52 } // namespace v8 53 54 #endif // V8_NUMBERS_HASH_SEED_INL_H_ 55