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

src: add rudimentary Promise support #272

Closed
wants to merge 1 commit into from

Conversation

mmarchini
Copy link
Contributor

This patch allows llnode to list Promise objects with findjsobjects,
findjsinstances and findrefs. We can investigate more fancy Promise
features in the future (such as listing handlers, Promise status, etc.).

@mmarchini
Copy link
Contributor Author

The metadata landed in v8/v8@8aaa186ed42, it will be available in Node.js v12. We can backport if we want this in Node.js v10.

@cjihrig
Copy link
Contributor

cjihrig commented Feb 25, 2019

@mmarchini can you also update https://github.com/nodejs/node/blob/master/test/v8-updates/test-postmortem-metadata.js (or just ping me and I can do it).

This patch allows llnode to list Promise objects with findjsobjects,
findjsinstances and findrefs. We can investigate more fancy Promise
features in the future (such as listing handlers, Promise status, etc.).

For Node.js v10.x, since we don't have the JS_PROMISE type as postmortem
metadata, we assume JS_PROMISE is the next type after
JS_MESSAGE_OBJECT_TYPE. This is a safe assumption for Node.js v10.x,
v12.x has the JS_PROMISE type, and v8.x is not supported anymore.

```console
$ git log v10.0.0..v10.17.0 -L :InstanceType:deps/v8/src/objects.h | grep -C2 "JS_PROMISE"
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
   JS_REGEXP_STRING_ITERATOR_TYPE,
--
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
+  JS_REGEXP_STRING_ITERATOR_TYPE,
```
@mmarchini mmarchini marked this pull request as ready for review January 14, 2020 16:29
mmarchini added a commit to mmarchini/node that referenced this pull request Jan 14, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.
@mmarchini
Copy link
Contributor Author

mmarchini commented Jan 14, 2020

@cjihrig done nodejs/node#31357

I also updated the pull request with a presumably safe default for kPromiseType, now it should work on any v10.x version (tested on v10.0.0 and v10.17.0).

mmarchini added a commit to nodejs/node that referenced this pull request Jan 16, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.

PR-URL: #31357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this pull request Feb 17, 2020
type_JSPromise__JS_PROMISE_TYPE and
type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE will be used on llnode to
identify Promises in memory and core dumps:
nodejs/llnode#272. Add these to our postmortem
test so we're aware of any changes to this metadata.

PR-URL: #31357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
mmarchini added a commit that referenced this pull request Mar 25, 2020
This patch allows llnode to list Promise objects with findjsobjects,
findjsinstances and findrefs. We can investigate more fancy Promise
features in the future (such as listing handlers, Promise status, etc.).

For Node.js v10.x, since we don't have the JS_PROMISE type as postmortem
metadata, we assume JS_PROMISE is the next type after
JS_MESSAGE_OBJECT_TYPE. This is a safe assumption for Node.js v10.x,
v12.x has the JS_PROMISE type, and v8.x is not supported anymore.

```console
$ git log v10.0.0..v10.17.0 -L :InstanceType:deps/v8/src/objects.h \
    | grep -C2 "JS_PROMISE"
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
   JS_REGEXP_STRING_ITERATOR_TYPE,
--
   JS_MAP_VALUE_ITERATOR_TYPE,
   JS_MESSAGE_OBJECT_TYPE,
   JS_PROMISE_TYPE,
   JS_REGEXP_TYPE,
+  JS_REGEXP_STRING_ITERATOR_TYPE,
```

PR-URL: #272
@mmarchini
Copy link
Contributor Author

Landed in 991c731

@mmarchini mmarchini closed this Mar 25, 2020
@coveralls
Copy link

coveralls commented Feb 6, 2024

Pull Request Test Coverage Report for Build 2b5721172516eef0643525467a6365e913a191d3-PR-272

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+4.4%) to 79.481%

Totals Coverage Status
Change from base Build ecb8d0e34236b631885f0a7217fbdbe53f24546d: 4.4%
Covered Lines: 3618
Relevant Lines: 4543

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants