v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
hash-seed-inl.h
Go to the documentation of this file.
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.
16namespace v8 {
17namespace internal {
18
19class Isolate;
20class LocalIsolate;
21class ReadOnlyRoots;
22
23inline uint64_t HashSeed(Isolate* isolate);
24inline uint64_t HashSeed(LocalIsolate* isolate);
25inline 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.
32#include "src/roots/roots-inl.h"
33
34namespace v8 {
35namespace internal {
36
37inline uint64_t HashSeed(Isolate* isolate) {
38 return HashSeed(ReadOnlyRoots(isolate));
39}
40
41inline uint64_t HashSeed(LocalIsolate* isolate) {
42 return HashSeed(ReadOnlyRoots(isolate));
43}
44
45inline uint64_t HashSeed(ReadOnlyRoots roots) {
46 uint64_t seed;
47 MemCopy(&seed, roots.hash_seed()->begin(), sizeof(seed));
48 return seed;
49}
50
51} // namespace internal
52} // namespace v8
53
54#endif // V8_NUMBERS_HASH_SEED_INL_H_
uint64_t HashSeed(Isolate *isolate)
void MemCopy(void *dest, const void *src, size_t size)
Definition memcopy.h:124