How to retain or reacquire v8::ScriptCompiler::Source object?

19 views
Skip to first unread message

Zac Hansen

unread,
Oct 11, 2016, 6:49:11 PM10/11/16
to v8-users
I'd like to keep around the data in a v8::ScriptCompiler::Source object, but I see it has v8::Local objects in it, which means I can't just make a Global out of it (right?).

Is there some way to reacquire that object later or to keep it around indefinitely (outside of a handle scope)?

Thank you.

--Zac

Jochen Eisinger

unread,
Oct 12, 2016, 3:17:20 AM10/12/16
to v8-users
you can get the ScriptOrigin from a v8::Function via GetScriptOrigin. You can also ToString a function to get the source, but you could as well create a global to the source.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zac Hansen

unread,
Oct 12, 2016, 4:38:20 AM10/12/16
to v8-users
the stringification of a function doesn't get me back the entire source though.   That's what I need to send to chrome for debugging.

Jochen Eisinger

unread,
Oct 18, 2016, 5:42:17 AM10/18/16
to v8-users
You'll need to keep a reference to the source yourself - either pass the string as an external string resource to v8 in the first place, or keep a persistent handle to the string.
Reply all
Reply to author
Forward
0 new messages