v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
runtime-weak-refs.cc
Go to the documentation of this file.
1
// Copyright 2020 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
#include "
src/execution/arguments-inl.h
"
6
#include "
src/objects/js-weak-refs-inl.h
"
7
#include "
src/runtime/runtime-utils.h
"
8
9
namespace
v8
{
10
namespace
internal
{
11
12
RUNTIME_FUNCTION
(
13
Runtime_JSFinalizationRegistryRegisterWeakCellWithUnregisterToken) {
14
HandleScope
scope(isolate);
15
DCHECK_EQ
(2,
args
.length());
16
DirectHandle<JSFinalizationRegistry>
finalization_registry =
17
args
.at<
JSFinalizationRegistry
>(0);
18
DirectHandle<WeakCell>
weak_cell =
args
.at<
WeakCell
>(1);
19
20
JSFinalizationRegistry::RegisterWeakCellWithUnregisterToken
(
21
finalization_registry, weak_cell, isolate);
22
23
return
ReadOnlyRoots
(isolate).undefined_value();
24
}
25
26
RUNTIME_FUNCTION
(Runtime_JSWeakRefAddToKeptObjects) {
27
HandleScope
scope(isolate);
28
DCHECK_EQ
(1,
args
.length());
29
DirectHandle<HeapObject>
object
=
args
.at<
HeapObject
>(0);
30
DCHECK
(
Object::CanBeHeldWeakly
(*
object
));
31
32
isolate->heap()->KeepDuringJob(
object
);
33
34
return
ReadOnlyRoots
(isolate).undefined_value();
35
}
36
37
}
// namespace internal
38
}
// namespace v8
v8::internal::DirectHandle
Definition
handles.h:659
v8::internal::HandleScope
Definition
handles.h:262
v8::internal::HeapObject
Definition
heap-object.h:146
v8::internal::JSFinalizationRegistry
Definition
js-weak-refs.h:26
v8::internal::JSFinalizationRegistry::RegisterWeakCellWithUnregisterToken
static void RegisterWeakCellWithUnregisterToken(DirectHandle< JSFinalizationRegistry > finalization_registry, DirectHandle< WeakCell > weak_cell, Isolate *isolate)
v8::internal::Object::CanBeHeldWeakly
static bool CanBeHeldWeakly(Tagged< Object > obj)
Definition
objects-inl.h:1943
v8::internal::ReadOnlyRoots
Definition
roots.h:709
v8::internal::WeakCell
Definition
js-weak-refs.h:85
arguments-inl.h
RUNTIME_FUNCTION
#define RUNTIME_FUNCTION(Name)
Definition
arguments.h:162
args
base::Vector< const DirectHandle< Object > > args
Definition
execution.cc:74
js-weak-refs-inl.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
runtime-utils.h
DCHECK
#define DCHECK(condition)
Definition
logging.h:482
DCHECK_EQ
#define DCHECK_EQ(v1, v2)
Definition
logging.h:485
src
runtime
runtime-weak-refs.cc
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0