v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-layout-inl.h
Go to the documentation of this file.
1// Copyright 2024 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_HEAP_HEAP_LAYOUT_INL_H_
6#define V8_HEAP_HEAP_LAYOUT_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include "src/flags/flags.h"
13#include "src/objects/casting.h"
14#include "src/objects/objects.h"
16
17namespace v8::internal {
18
19// static
23
24// static
26 Tagged<HeapObject> object) {
27 if constexpr (v8_flags.single_generation.value()) {
28 return false;
29 }
30 if constexpr (v8_flags.sticky_mark_bits.value()) {
31 return InYoungGenerationForStickyMarkbits(chunk, object);
32 }
33 const bool in_young_generation = chunk->InYoungGeneration();
34#ifdef DEBUG
35 if (in_young_generation) {
37 }
38#endif // DEBUG
39 return in_young_generation;
40}
41
42// static
44 if (object.IsSmi()) {
45 return false;
46 }
47 return InYoungGeneration(Cast<HeapObject>(object));
48}
49
50// static
52 Tagged<HeapObject> heap_object;
53 return object.GetHeapObject(&heap_object) && InYoungGeneration(heap_object);
54}
55
56// static
60
61// static
65
66// static
70
71// static
73 if (HeapLayout::InReadOnlySpace(object)) {
74 return true;
75 }
77}
78
79// static
83
84// static
88
94
95// static
99
100} // namespace v8::internal
101
102#endif // V8_HEAP_HEAP_LAYOUT_INL_H_
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
static V8_EXPORT bool InYoungGenerationForStickyMarkbits(const MemoryChunk *chunk, Tagged< HeapObject > object)
static V8_INLINE bool InWritableSharedSpace(Tagged< HeapObject > object)
static V8_INLINE bool IsOwnedByAnyHeap(Tagged< HeapObject > object)
static V8_EXPORT void CheckYoungGenerationConsistency(const MemoryChunk *chunk)
static V8_INLINE bool InTrustedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InReadOnlySpace(Tagged< HeapObject > object)
static V8_INLINE bool InBlackAllocatedPage(Tagged< HeapObject > object)
static V8_INLINE bool InAnySharedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InCodeSpace(Tagged< HeapObject > object)
V8_INLINE bool InTrustedSpace() const
V8_INLINE bool InWritableSharedSpace() const
V8_INLINE Heap * GetHeap()
V8_INLINE bool InYoungGeneration() const
V8_INLINE bool InCodeSpace() const
static V8_INLINE MemoryChunk * FromHeapObject(Tagged< HeapObject > object)
V8_INLINE bool InReadOnlySpace() const
V8_INLINE MainThreadFlags GetFlags() const
bool GetHeapObject(Tagged< HeapObject > *result) const
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
Definition objects.h:665
V8_EXPORT_PRIVATE FlagValues v8_flags
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DCHECK(condition)
Definition logging.h:482