Skip to content

Commit

Permalink
5403888: [api] support v8::Data in v8::TracedReference and v8::Embedd…
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed May 16, 2024
1 parent 5426d22 commit 2030447
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ deprecate_vector_v8_local_in_v8.patch
fix_remove_deprecated_errno_constants.patch
build_enable_perfetto.patch
fix_add_source_location_for_v8_task_runner.patch
fix_accommodate_v8_5403888.patch
32 changes: 32 additions & 0 deletions patches/node/fix_accommodate_v8_5403888.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Rose <nornagon@nornagon.net>
Date: Thu, 16 May 2024 10:59:28 -0700
Subject: fix: accommodate v8#5403888

This fixes Node to accommodate a change in V8. It should be upstreamed (or
discarded when Node handles this itself).

Removal OK if Node builds without this :)

diff --git a/src/memory_tracker-inl.h b/src/memory_tracker-inl.h
index 0e4f2870a5aae5e469f14c5fdacdd6ea2855703d..abc18e96bdb73a30d1137472c14a2dfd1599d226 100644
--- a/src/memory_tracker-inl.h
+++ b/src/memory_tracker-inl.h
@@ -27,7 +27,7 @@ class MemoryRetainerNode : public v8::EmbedderGraph::Node {
: retainer_(retainer) {
CHECK_NOT_NULL(retainer_);
v8::HandleScope handle_scope(tracker->isolate());
- v8::Local<v8::Object> obj = retainer_->WrappedObject();
+ v8::Local<v8::Value> obj = retainer_->WrappedObject().As<v8::Value>();
if (!obj.IsEmpty()) wrapper_node_ = tracker->graph()->V8Node(obj);

name_ = retainer_->MemoryInfoName();
@@ -230,7 +230,7 @@ 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>

0 comments on commit 2030447

Please sign in to comment.