These are "code comments". You'll need to enable both the GN arg
v8_code_comments
= true and the command-line flag --code-comments; since CSA is used only in
mksnapshot you need to either:
- pass the latter flag to a manual invocation of mksnapshot,
- or enable it by default in flag-definitions.h and recompile normally,
- or, most conveniently, set the GN arg v8_enable_snapshot_code_comments =
true (which implies the other GN arg and the command-line flag).
You can then see these comments when disassembling builtins (with the jco
GDB macro). You may also want to use --nodebug-code to skip a large number
of generated checks that tend to be confusing when reading code.

Code comments cannot be used for tracing control flow at runtime, they're
only helpful for making sense of the disassembly of generated code. Control
flow can be traced with the various Print(...) overloads in CSA, which will
print to stdout.


On Mon, Sep 23, 2024 at 5:23 PM 18楼梦想改造家 <[email protected]> wrote:

> Hi, anyone.
>
> In v8 CSA subsystem, there are some code like this:
>
> ``` c++
> void AccessorAssembler::GenericPropertyLoad(
>     TNode<HeapObject> lookup_start_object, TNode<Map>
> lookup_start_object_map,
>     TNode<Int32T> lookup_start_object_instance_type, const
> LoadICParameters* p,
>     Label* slow, UseStubCache use_stub_cache) {
>   DCHECK_EQ(lookup_start_object, p->lookup_start_object());
>   ExitPoint direct_exit(this);
>
>   Comment("key is unique name");   // [+] @a
>   Label if_found_on_lookup_start_object(this),
> if_property_dictionary(this),
>       lookup_prototype_chain(this), special_receiver(this);
> }
> ```
>
> At @a, we have a comment , I want to use it to trace the flow. But I don't
> know how to use it? So I have 2 question.
>
> 1. How to enable the Comment, is it worked in release version?
> 2. If we enable it, where the comment will Print to?
>
> Thanks!
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3Tz0GEmHxCBGRZz5pt_vJoN9mWZ3vG%3DQaEd_MYG%2BP8aTg%40mail.gmail.com.

Reply via email to