`Script::cast(function->shared()->script()).id()` is your best bet for a straight-up unique ID for a script -- otherwise, you probably want to look at some combination of `String::cast(Script::cast(function->shared()->script()).source())` and line/column offset.
On Sun, Apr 28, 2019 at 4:52 PM psnyder via v8-dev <[email protected]> wrote: > > I'm looking to determine what the top level code unit is that created a > JSFunction object. > > Something like `Script::cast(function->shared()->script()).id()` returns > unexpectedly high values (I'm guessing for reasons related to partial and / > or streaming and / or eval parsing). > > Is there a way, given a `JSFunction` instance, to trace it back to a script > id for the complete originating script's id? > > The overall goal is to attribute every function call to a unique identifier > for every `<script>` (and similar) that defines it. So there'd be the same > number of script id's as sources of code in blink, etc. > > Any suggestions / pointers would be greatly appreciated. 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]. > For more options, visit https://groups.google.com/d/optout. -- -- 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]. For more options, visit https://groups.google.com/d/optout.
