Skip to content

Commit

Permalink
src: cast to v8::Value before using v8::EmbedderGraph::V8Node
Browse files Browse the repository at this point in the history
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: nodejs#52638
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
  • Loading branch information
joyeecheung authored Apr 25, 2024
1 parent 2231be6 commit 7b2e3b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/memory_tracker-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 7b2e3b8

Please sign in to comment.