v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-layout.cc
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
9
10namespace v8::internal {
11
12// TODO(333906585): Due to cyclic dependency, we cannot pull in marking-inl.h
13// here. Fix it and make the call inlined.
14//
15// static
17 Tagged<HeapObject> object) {
18 CHECK(v8_flags.sticky_mark_bits.value());
19 return !chunk->IsOnlyOldOrMajorMarkingOn() &&
20 !MarkingBitmap::MarkBitFromAddress(object.address())
21 .template Get<AccessMode::ATOMIC>();
22}
23
24// static
26 // Young generation objects should only be found in to space when the GC is
27 // not currently running.
28
29 // If the object is in the young generation, then it is safe to get to the
30 // containing Heap.
31#ifdef DEBUG
32 const MemoryChunkMetadata* metadata = chunk->Metadata();
33 SLOW_DCHECK(metadata->IsWritable());
34 Heap* heap = metadata->heap();
35 SLOW_DCHECK(heap != nullptr);
36 DCHECK_IMPLIES(heap->gc_state() == Heap::NOT_IN_GC,
38#endif // DEBUG
39}
40
41// static
45
46// static
48 PtrComprCageBase cage_base) {
49 return IsSelfForwarded(object, object->map_word(cage_base, kRelaxedLoad));
50}
51
52// static
54 return map_word == MapWord::FromForwardingAddress(object, object);
55}
56
57} // namespace v8::internal
#define SLOW_DCHECK(condition)
Definition checks.h:21
static V8_EXPORT bool InYoungGenerationForStickyMarkbits(const MemoryChunk *chunk, Tagged< HeapObject > object)
static V8_EXPORT void CheckYoungGenerationConsistency(const MemoryChunk *chunk)
static bool IsSelfForwarded(Tagged< HeapObject > object)
static MapWord FromForwardingAddress(Tagged< HeapObject > map_word_host, Tagged< HeapObject > object)
static V8_INLINE MarkBit MarkBitFromAddress(Address address)
bool IsOnlyOldOrMajorMarkingOn() const
V8_INLINE bool IsFlagSet(Flag flag) const
V8_INLINE MemoryChunkMetadata * Metadata()
bool MarkBit::Get< AccessMode::ATOMIC >() const
Definition marking.h:81
V8_INLINE PtrComprCageBase GetPtrComprCageBase()
V8_EXPORT_PRIVATE FlagValues v8_flags
static constexpr RelaxedLoadTag kRelaxedLoad
Definition globals.h:2909
#define CHECK(condition)
Definition logging.h:124
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493