Hi Leszek,

Thank you for your reply.  However, I believe the code examples you gave 
are not correct, as the same script unit will result in multiple script ids 
(e.g. one for the ScriptContext, others for top level function literals, 
etc).

Is there some way of tying all the code compiled from a single script unit 
/ <script> to a single identifier?

Apologies if Im missing something here too

On Monday, May 6, 2019 at 1:58:22 AM UTC-7, Leszek Swirski wrote:
>
> `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 
> <v8-...@googlegroups.com <javascript:>> 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 
> > v8-...@googlegroups.com <javascript:> 
> > 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-...@googlegroups.com <javascript:>. 
> > 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