-
Notifications
You must be signed in to change notification settings - Fork 100
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: fix context inspection for V8 6.8 #201
Conversation
There's still one problem though: since We could either:
|
Maybe we can do (b by default and add an option for (a? |
Ok, I've been reading further on why the closure field was removed (v8/v8:7066) and turns out it was a memory leak vector, especially in IIFE. With the changes on V8 the closure might be garbage collected, thus I don't think we should try to guess it or add new post-mortem metadata to V8 to inspect it. IMO we should just replace the closure with scope_info in the inspect for V6.8+. The caller can be easily spotted with |
Before 6.8, inspecting functions look like this:
After 6.8 it would look like this:
|
@joyeecheung any thoughts on #201 (comment)? |
@mmarchini Displaying scope info is better than nothing, but does that mean now we have no way of knowing where (in the souce code) the context is coming from if we are simply inspecting a context? |
Looks like there are still |
@joyeecheung yeah, we can get the function name from a ScopeInfo, but not the Script. I'm working on this, #211 and #195, and so far this is the most detailed output I could get with 6.8 when inspecting a function:
I think I'll move forward with this approach and we can try to improve the situation later, maybe using some heuristic to try to find the script for the ScopeInfo. |
I created a POC to inspect Context objects, and I think this would be enough to cover the current use case (we wouldn't know the script and line where the closure was defined, but this information can be inferred from the name + script of the current function). Here's what we would do today to inspect the current function and the closure: https://asciinema.org/a/BPvhOsMdv3aMRv1E5nYXWOdjp Here is the proposed solution (instead of inspecting the closure, inspect the previous context to find out which variables can be accessed in the current function): https://asciinema.org/a/pvS0iL81vtbjhZUijMMUpqW1j Am I missing any use cases? If this solution is acceptable I'll update our tests to fit it and add some more tests. |
V8 6.8 replaces Closure inside Context with ScopeInfo. Those are minimal changes to adopt llnode to the new behavior. Ref: https://chromium-review.googlesource.com/#/c/785151/ Fixes: nodejs#193
This patch teaches llnode how to inspect Context objects. This is useful to inspect context variables. Fix: nodejs#211
CI is happy with the latest changes 😄 P.S.: The last commit also fixes #211 |
Ping @joyeecheung |
V8 6.8 replaces Closure inside Context with ScopeInfo. Those are minimal changes to adopt llnode to the new behavior. Ref: https://chromium-review.googlesource.com/#/c/785151/ Fixes: #193 PR-URL: #201 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Landed in d348eff...d5e0ada. Thanks for the feedback! |
V8 6.8 replaces Closure inside Context with ScopeInfo. Those are minimal changes to adopt llnode to the new behavior. Ref: https://chromium-review.googlesource.com/#/c/785151/ Fixes: nodejs#193 PR-URL: nodejs#201 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This patch teaches llnode how to inspect Context objects. This is useful to inspect context variables. PR-URL: nodejs#201 Fixes: nodejs#211 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
V8 6.8 replaces Closure inside Context with ScopeInfo. Those are minimal changes to adopt llnode to the new behavior. Ref: https://chromium-review.googlesource.com/#/c/785151/ Fixes: nodejs#193 PR-URL: nodejs#201 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This patch teaches llnode how to inspect Context objects. This is useful to inspect context variables. PR-URL: nodejs#201 Fixes: nodejs#211 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
ETA: July 24th (after V8 6.8 lands on nodejs/node)
V8 6.8 replaces Closure inside Context with ScopeInfo. Those are minimal
changes to adopt llnode to the new behavior.
Ref: chromium-review.googlesource.com/#/c/785151
Fixes: #193