v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
evacuation-verifier-inl.h
Go to the documentation of this file.
1// Copyright 2022 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_EVACUATION_VERIFIER_INL_H_
6#define V8_HEAP_EVACUATION_VERIFIER_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include "src/heap/heap-inl.h"
14
15namespace v8 {
16namespace internal {
17
18#ifdef VERIFY_HEAP
19
20void EvacuationVerifier::VerifyHeapObjectImpl(Tagged<HeapObject> heap_object) {
21 if (!ShouldVerifyObject(heap_object)) return;
23 !v8_flags.sticky_mark_bits && HeapLayout::InYoungGeneration(heap_object),
24 Heap::InToPage(heap_object));
26}
27
28bool EvacuationVerifier::ShouldVerifyObject(Tagged<HeapObject> heap_object) {
29 const bool in_shared_heap = HeapLayout::InWritableSharedSpace(heap_object);
30 return heap_->isolate()->is_shared_space_isolate() ? in_shared_heap
31 : !in_shared_heap;
32}
33
34template <typename TSlot>
35void EvacuationVerifier::VerifyPointersImpl(TSlot start, TSlot end) {
36 for (TSlot current = start; current < end; ++current) {
37 typename TSlot::TObject object = current.load(cage_base());
38#ifdef V8_ENABLE_DIRECT_HANDLE
39 if (object.ptr() == kTaggedNullAddress) continue;
40#endif
41 Tagged<HeapObject> heap_object;
42 if (object.GetHeapObjectIfStrong(&heap_object)) {
43 VerifyHeapObjectImpl(heap_object);
44 }
45 }
46}
47
48#endif // VERIFY_HEAP
49
50} // namespace internal
51} // namespace v8
52
53#endif // V8_HEAP_EVACUATION_VERIFIER_INL_H_
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
static V8_INLINE bool InWritableSharedSpace(Tagged< HeapObject > object)
Isolate * isolate() const
Definition heap-inl.h:61
bool is_shared_space_isolate() const
Definition isolate.h:2292
static bool IsOnEvacuationCandidate(Tagged< MaybeObject > obj)
int start
int end
LineAndColumn current
constexpr Address kTaggedNullAddress
Definition handles.h:53
kInterpreterTrampolineOffset Tagged< HeapObject >
V8_EXPORT_PRIVATE FlagValues v8_flags
#define CHECK_IMPLIES(lhs, rhs)
#define CHECK(condition)
Definition logging.h:124
Heap * heap_