mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 05:25:19 +00:00
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: https://github.com/nodejs/node/pull/57417 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
e86adad759
commit
6e60ab744e
@ -125,11 +125,6 @@ bool BaseObject::IsWeakOrDetached() const {
|
||||
return pd->wants_weak_jsobj || pd->is_detached;
|
||||
}
|
||||
|
||||
v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
|
||||
return IsWeakOrDetached() ? v8::EmbedderGraph::Node::Detachedness::kDetached
|
||||
: v8::EmbedderGraph::Node::Detachedness::kUnknown;
|
||||
}
|
||||
|
||||
template <int Field>
|
||||
void BaseObject::InternalFieldGet(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
|
@ -161,10 +161,6 @@ Local<Object> BaseObject::WrappedObject() const {
|
||||
return object();
|
||||
}
|
||||
|
||||
bool BaseObject::IsRootNode() const {
|
||||
return !persistent_handle_.IsWeak();
|
||||
}
|
||||
|
||||
bool BaseObject::IsNotIndicativeOfMemoryLeakAtExit() const {
|
||||
return IsWeakOrDetached();
|
||||
}
|
||||
|
@ -105,8 +105,6 @@ class BaseObject : public MemoryRetainer {
|
||||
// to it anymore.
|
||||
inline bool IsWeakOrDetached() const;
|
||||
|
||||
inline v8::EmbedderGraph::Node::Detachedness GetDetachedness() const override;
|
||||
|
||||
// Utility to create a FunctionTemplate with one internal field (used for
|
||||
// the `BaseObject*` pointer) and a constructor that initializes that field
|
||||
// to `nullptr`.
|
||||
@ -192,7 +190,6 @@ class BaseObject : public MemoryRetainer {
|
||||
|
||||
private:
|
||||
v8::Local<v8::Object> WrappedObject() const override;
|
||||
bool IsRootNode() const override;
|
||||
void DeleteMe();
|
||||
|
||||
// persistent_handle_ needs to be at a fixed offset from the start of the
|
||||
|
Loading…
Reference in New Issue
Block a user