try to build an extended version of node to log every undefined property visiting #46960
Replies: 1 comment 3 replies
-
I've converted this to a discussion because it's not the kind of feature request that's likely to get adopted.
If you search the v8-dev and v8-users mailing lists, you can find threads where people ask the same question. Unfortunately, it is a rather complicated task because V8 is a JIT compiler. That C++ code you found is not the common path. V8 normally emits machine code at runtime that loads values directly. You may have seen *.tq files in deps/v8/src. Torque is V8's homegrown C++ lookalike for writing that machine code at a slightly higher level of abstraction than raw assembly (of which there is plenty inside V8 too, by the way.) |
Beta Was this translation helpful? Give feedback.
-
What is the problem this feature will solve?
Hi there!
I am trying to build an extended version of node to print every undefined property visiting in the javascript code. For example, given the javascript code:
and when I run the expended node on this file, like
./node_detect_undefined test.js
, I am expected to see that the property nameb
has been printed out.What is the feature you are proposing to solve the problem?
To achieve this feature, I tired to add the following code in the
node-18.14.0/deps/v8/src/runtime/runtime-object.cc::Runtime::GetObjectProperty
where looks like the place that the object's properties has been looked up.However, it doesn't work and outputs the following content:
And then, I tried to modify the test.js code to get more undefined properties involved:
but the output seems doesn't change:
I'm starting to question whether I should add the code somewhere else, or if the code I've written is unable to determine whether it's undefined or not.
What alternatives have you considered?
Can someone with more familiarity with Node.js and V8 provide me with some ideas on how to implement this feature? It doesn't seem like a very complicated task, so any suggestions or advice would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions