That's a surprisingly tricky thing to do, despite sounding simple. You
could add a new runtime function (e.g. LogComparison) which you call at the
beginning of CodeStubAssembler::Equal, passing it the LHS and RHS. A bigger
cannon that you could use on this mosquito is to enable ignition tracing
(v8_enable_trace_ignition = true in gn args) and run your code with
`--no-opt --trace-ignition`, which will print a line for every bytecode
executed that you can then grep through.

On Mon, Mar 4, 2019 at 4:52 PM <examm...@gmail.com> wrote:

> Thanks
>
> in fact what i want to do is to log all comparisons at excecution. What is
> the best way to do that ?
>
> Le lundi 4 mars 2019 13:15:53 UTC+1, Leszek Swirski a écrit :
>>
>> --force-slow-path is a bit confusing, and maybe not well named, I believe
>> it only affects some builtins (regex etc.)
>>
>> For some more detail, a lot of functionality in V8 is implemented
>> multiple times -- common, simpler fast paths (e.g. comparing numbers as you
>> are) are implemented in "assembly" (which used to be actual machine code,
>> now it's mostly CSA <https://v8.dev/docs/csa-builtins> or Torque
>> <https://v8.dev/docs/torque-builtins> code), less common "slow" paths
>> (e.g. comparing BigInts) will go to the "runtime" (i.e. into the C++ code).
>> These runtime functions also have fast and slow paths (which are really
>> more like medium speed and extra slow), and the flag you mentioned is for
>> forcing those slow paths.
>>
>> For specifically comparison, you probably want to hook into
>> CodeStubAssembler::Equal
>> <https://cs.chromium.org/chromium/src/v8/src/code-stub-assembler.cc?type=cs&q=CodeStubAssembler::Equal&sq=package:chromium&g=0&l=11680>,
>> though keep in mind that the linked code is *generating* the comparison
>> code, not *calculating* or executing it. You'll also want to disable
>> optimisation (--no-opt) to make sure you don't enter optimized code (which
>> inlines the comparison).
>>
>> - Leszek
>>
>> On Mon, Mar 4, 2019 at 9:49 AM <exam...@gmail.com> wrote:
>>
>>> I have tried to add --force-slow-path argument and it does not change
>>> anything
>>>
>>> Le lundi 4 mars 2019 08:56:09 UTC+1, exam...@gmail.com a écrit :
>>>>
>>>> Thanks
>>>>
>>>> What do you mean by 'slow path' ?
>>>> Where should i put some code in order to hook comparisons operators ?
>>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> v8-...@googlegroups.com
>>> 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 v8-dev+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> --
> v8-dev mailing list
> v8-dev@googlegroups.com
> 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 v8-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to