Skip to content

Commit b6b78f6

Browse files
joyeecheungaduh95
authored andcommitted
src: annotate BaseObjects in the heap snapshots correctly
This fixes two issues in the BaseObject views in the heap snapshots: 1. BaseObjects are not conceptually roots when the environment and the realms are also showing up in the heap snapshot. Rather, they should be considered being held alive by the BaseObjectList in the realms, which are in turn held alive by Environment. The actual root from the containment view should be the Environment instead. 2. The concept of DOM detaching does not really apply to Node.js wrappers, and it's confusing to connect that with the weakness or detachment (native weakness) of BaseObjects. To avoid the confusion, just restore to the default detachedness for them. PR-URL: #57417 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 4a1d2e4 commit b6b78f6

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

src/base_object-inl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ bool BaseObject::IsWeakOrDetached() const {
125125
return pd->wants_weak_jsobj || pd->is_detached;
126126
}
127127

128-
v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
129-
return IsWeakOrDetached() ? v8::EmbedderGraph::Node::Detachedness::kDetached
130-
: v8::EmbedderGraph::Node::Detachedness::kUnknown;
131-
}
132-
133128
template <int Field>
134129
void BaseObject::InternalFieldGet(
135130
const v8::FunctionCallbackInfo<v8::Value>& args) {

src/base_object.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ Local<Object> BaseObject::WrappedObject() const {
163163
return object();
164164
}
165165

166-
bool BaseObject::IsRootNode() const {
167-
return !persistent_handle_.IsWeak();
168-
}
169-
170166
bool BaseObject::IsNotIndicativeOfMemoryLeakAtExit() const {
171167
return IsWeakOrDetached();
172168
}

src/base_object.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class BaseObject : public MemoryRetainer {
9999
// to it anymore.
100100
inline bool IsWeakOrDetached() const;
101101

102-
inline v8::EmbedderGraph::Node::Detachedness GetDetachedness() const override;
103-
104102
// Utility to create a FunctionTemplate with one internal field (used for
105103
// the `BaseObject*` pointer) and a constructor that initializes that field
106104
// to `nullptr`.
@@ -186,7 +184,6 @@ class BaseObject : public MemoryRetainer {
186184

187185
private:
188186
v8::Local<v8::Object> WrappedObject() const override;
189-
bool IsRootNode() const override;
190187
static void DeleteMe(void* data);
191188

192189
// persistent_handle_ needs to be at a fixed offset from the start of the

0 commit comments

Comments
 (0)