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: #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>
  • Loading branch information
joyeecheung authored and marco-ippolito committed May 3, 2024
1 parent 7d1f304 commit 7e6d923
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 7e6d923

Please sign in to comment.