Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v10.x] backport EmbededderGraph related changes to v10.x #23295

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/internal/test/heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function createJSHeapDump() {
const fromNode = nodes[fromNodeIndex];
const edge = {
type,
toNode,
fromNode,
to: toNode,
from: fromNode,
name: typeof name_or_index === 'string' ? name_or_index : null
};
toNode.incomingEdges.push(edge);
Expand Down
12 changes: 6 additions & 6 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ struct AsyncWrapObject : public AsyncWrap {
inline AsyncWrapObject(Environment* env, Local<Object> object,
ProviderType type) : AsyncWrap(env, object, type) {}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(AsyncWrapObject)
SET_SELF_SIZE(AsyncWrapObject)
};


Expand Down Expand Up @@ -180,9 +180,9 @@ class PromiseWrap : public AsyncWrap {
MakeWeak();
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(PromiseWrap)
SET_SELF_SIZE(PromiseWrap)

static constexpr int kPromiseField = 1;
static constexpr int kIsChainedPromiseField = 2;
Expand Down
5 changes: 0 additions & 5 deletions src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ namespace node {

class Environment;

#define ADD_MEMORY_INFO_NAME(name) \
std::string MemoryInfoName() const override { \
return #name; \
}

class BaseObject : public MemoryRetainer {
public:
// Associates this object with `object`. It uses the 0th internal field for
Expand Down
133 changes: 52 additions & 81 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ struct node_ares_task : public MemoryRetainer {
ares_socket_t sock;
uv_poll_t poll_watcher;

void MemoryInfo(MemoryTracker* tracker) const override;
ADD_MEMORY_INFO_NAME(node_ares_task)
inline void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(node_ares_task)
SET_SELF_SIZE(node_ares_task)
};

struct TaskHash {
Expand Down Expand Up @@ -172,13 +173,13 @@ class ChannelWrap : public AsyncWrap {
inline node_ares_task_list* task_list() { return &task_list_; }

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
if (timer_handle_ != nullptr)
tracker->TrackFieldWithSize("timer handle", sizeof(*timer_handle_));
tracker->TrackField("node_ares_task_list", task_list_);
tracker->TrackField("timer_handle", *timer_handle_);
tracker->TrackField("task_list", task_list_, "node_ares_task_list");
}

ADD_MEMORY_INFO_NAME(ChannelWrap)
SET_MEMORY_INFO_NAME(ChannelWrap)
SET_SELF_SIZE(ChannelWrap)

static void AresTimeout(uv_timer_t* handle);

Expand All @@ -192,11 +193,6 @@ class ChannelWrap : public AsyncWrap {
node_ares_task_list task_list_;
};

void node_ares_task::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackThis(this);
tracker->TrackField("channel", channel);
}

ChannelWrap::ChannelWrap(Environment* env,
Local<Object> object)
: AsyncWrap(env, object, PROVIDER_DNSCHANNEL),
Expand Down Expand Up @@ -225,11 +221,9 @@ class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> {
Local<Object> req_wrap_obj,
bool verbatim);

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(GetAddrInfoReqWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(GetAddrInfoReqWrap)
SET_SELF_SIZE(GetAddrInfoReqWrap)

bool verbatim() const { return verbatim_; }

Expand All @@ -249,11 +243,9 @@ class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> {
public:
GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj);

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(GetNameInfoReqWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(GetNameInfoReqWrap)
SET_SELF_SIZE(GetNameInfoReqWrap)
};

GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env,
Expand Down Expand Up @@ -298,6 +290,9 @@ void ares_poll_close_cb(uv_poll_t* watcher) {
delete task;
}

void node_ares_task::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("channel", channel);
}

/* Allocates and returns a new node_ares_task */
node_ares_task* ares_task_create(ChannelWrap* channel, ares_socket_t sock) {
Expand Down Expand Up @@ -1195,11 +1190,9 @@ class QueryAnyWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryAnyWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryAnyWrap)
SET_SELF_SIZE(QueryAnyWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1376,11 +1369,9 @@ class QueryAWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryAWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryAWrap)
SET_SELF_SIZE(QueryAWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1424,11 +1415,9 @@ class QueryAaaaWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryAaaaWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryAaaaWrap)
SET_SELF_SIZE(QueryAaaaWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1472,11 +1461,9 @@ class QueryCnameWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryCnameWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryCnameWrap)
SET_SELF_SIZE(QueryCnameWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1507,11 +1494,9 @@ class QueryMxWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryMxWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryMxWrap)
SET_SELF_SIZE(QueryMxWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1542,11 +1527,9 @@ class QueryNsWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryNsWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryNsWrap)
SET_SELF_SIZE(QueryNsWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1577,11 +1560,9 @@ class QueryTxtWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryTxtWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryTxtWrap)
SET_SELF_SIZE(QueryTxtWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1611,11 +1592,9 @@ class QuerySrvWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QuerySrvWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QuerySrvWrap)
SET_SELF_SIZE(QuerySrvWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1644,11 +1623,9 @@ class QueryPtrWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryPtrWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryPtrWrap)
SET_SELF_SIZE(QueryPtrWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1679,11 +1656,9 @@ class QueryNaptrWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QueryNaptrWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QueryNaptrWrap)
SET_SELF_SIZE(QueryNaptrWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1713,11 +1688,9 @@ class QuerySoaWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(QuerySoaWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(QuerySoaWrap)
SET_SELF_SIZE(QuerySoaWrap)

protected:
void Parse(unsigned char* buf, int len) override {
Expand Down Expand Up @@ -1801,11 +1774,9 @@ class GetHostByAddrWrap: public QueryWrap {
return 0;
}

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(GetHostByAddrWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(GetHostByAddrWrap)
SET_SELF_SIZE(GetHostByAddrWrap)

protected:
void Parse(struct hostent* host) override {
Expand Down
8 changes: 3 additions & 5 deletions src/connect_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ class ConnectWrap : public ReqWrap<uv_connect_t> {
v8::Local<v8::Object> req_wrap_obj,
AsyncWrap::ProviderType provider);

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(ConnectWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(ConnectWrap)
SET_SELF_SIZE(ConnectWrap)
};

} // namespace node
Expand Down
8 changes: 3 additions & 5 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ class FSEventWrap: public HandleWrap {
static void Start(const FunctionCallbackInfo<Value>& args);
static void GetInitialized(const FunctionCallbackInfo<Value>& args);

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackThis(this);
}

ADD_MEMORY_INFO_NAME(FSEventWrap)
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(FSEventWrap)
SET_SELF_SIZE(FSEventWrap)

private:
static const encoding kDefaultEncoding = UTF8;
Expand Down
Loading