Line data Source code
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_HASH_SEED_INL_H_
6 : #define V8_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 :
21 : inline uint64_t HashSeed(Isolate* isolate);
22 :
23 : } // namespace internal
24 : } // namespace v8
25 :
26 : // See comment above for why this isn't at the top of the file.
27 : #include "src/objects/fixed-array-inl.h"
28 : #include "src/roots-inl.h"
29 :
30 : namespace v8 {
31 : namespace internal {
32 :
33 261684361 : inline uint64_t HashSeed(Isolate* isolate) {
34 : uint64_t seed;
35 : ReadOnlyRoots(isolate).hash_seed()->copy_out(
36 : 0, reinterpret_cast<byte*>(&seed), kInt64Size);
37 : DCHECK(FLAG_randomize_hashes || seed == 0);
38 261684322 : return seed;
39 : }
40 :
41 : } // namespace internal
42 : } // namespace v8
43 :
44 : #endif // V8_HASH_SEED_INL_H_
|