v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
weak-code-registry.h
Go to the documentation of this file.
1
// Copyright 2021 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_PROFILER_WEAK_CODE_REGISTRY_H_
6
#define V8_PROFILER_WEAK_CODE_REGISTRY_H_
7
8
#include <vector>
9
10
#include "
src/execution/isolate.h
"
11
#include "
src/objects/objects.h
"
12
#include "
src/profiler/profile-generator.h
"
13
14
namespace
v8
{
15
namespace
internal
{
16
17
class
V8_EXPORT_PRIVATE
WeakCodeRegistry
{
18
public
:
19
struct
Listener
{
20
virtual
void
OnHeapObjectDeletion
(
CodeEntry
* entry) = 0;
21
};
22
23
explicit
WeakCodeRegistry
(
Isolate
* isolate) :
isolate_
(isolate) {}
24
~WeakCodeRegistry
() { Clear(); }
25
26
void
Track(
CodeEntry
* entry,
DirectHandle<AbstractCode>
code);
27
28
// Removes all dead code objects from the registry, invoking the provided
29
// listener for each new CodeEntry that is no longer referenced on the heap
30
// (if set).
31
void
Sweep(Listener* listener);
32
33
// Removes all heap object tracking from stored CodeEntries.
34
void
Clear();
35
36
private
:
37
Isolate
*
const
isolate_
;
38
// Invariant: Entries will always be removed here before the
39
// InstructionStreamMap is destroyed. CodeEntries should not be freed while
40
// their heap objects exist.
41
std::vector<CodeEntry*>
entries_
;
42
};
43
44
}
// namespace internal
45
}
// namespace v8
46
47
#endif
// V8_PROFILER_WEAK_CODE_REGISTRY_H_
isolate_
Isolate * isolate_
Definition
api-natives.cc:37
v8::internal::CodeEntry
Definition
profile-generator.h:63
v8::internal::DirectHandle
Definition
handles.h:659
v8::internal::Isolate
Definition
isolate.h:586
v8::internal::WeakCodeRegistry
Definition
weak-code-registry.h:17
v8::internal::WeakCodeRegistry::isolate_
Isolate *const isolate_
Definition
weak-code-registry.h:37
v8::internal::WeakCodeRegistry::~WeakCodeRegistry
~WeakCodeRegistry()
Definition
weak-code-registry.h:24
v8::internal::WeakCodeRegistry::WeakCodeRegistry
WeakCodeRegistry(Isolate *isolate)
Definition
weak-code-registry.h:23
v8::internal::WeakCodeRegistry::entries_
std::vector< CodeEntry * > entries_
Definition
weak-code-registry.h:41
isolate.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
objects.h
profile-generator.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
v8::internal::WeakCodeRegistry::Listener
Definition
weak-code-registry.h:19
v8::internal::WeakCodeRegistry::Listener::OnHeapObjectDeletion
virtual void OnHeapObjectDeletion(CodeEntry *entry)=0
src
profiler
weak-code-registry.h
Generated on Sun Apr 6 2025 21:08:56 for v8 by
1.12.0