src: cast to v8::Value before using v8::EmbedderGraph::V8Node

This is required to disambiguate the call site for an upstream
patch to support v8::Data in traced references and pass the
Node.js integration in the V8 CI. When that lands in the upstream
we can implement V8Node(const v8::Local<v8::Data>) in a
follow-up.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5403888
PR-URL: https://github.com/nodejs/node/pull/52638
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
This commit is contained in:
Joyee Cheung
2024-04-25 18:52:01 +02:00
committed by GitHub
parent 2231be6948
commit 7b2e3b8cfa

View File

@@ -28,7 +28,8 @@ class MemoryRetainerNode : public v8::EmbedderGraph::Node {
CHECK_NOT_NULL(retainer_);
v8::HandleScope handle_scope(tracker->isolate());
v8::Local<v8::Object> obj = retainer_->WrappedObject();
if (!obj.IsEmpty()) wrapper_node_ = tracker->graph()->V8Node(obj);
if (!obj.IsEmpty())
wrapper_node_ = tracker->graph()->V8Node(obj.As<v8::Value>());
name_ = retainer_->MemoryInfoName();
size_ = retainer_->SelfSize();
@@ -230,7 +231,9 @@ void MemoryTracker::TrackField(const char* edge_name,
const v8::Local<T>& value,
const char* node_name) {
if (!value.IsEmpty())
graph_->AddEdge(CurrentNode(), graph_->V8Node(value), edge_name);
graph_->AddEdge(CurrentNode(),
graph_->V8Node(value.template As<v8::Value>()),
edge_name);
}
template <typename T>