New v8 API functions

18 views
Skip to first unread message

Christian Plesner Hansen

unread,
Aug 17, 2009, 11:03:34 AM8/17/09
to v8-u...@googlegroups.com
Hiya!
A few new API functions have just been added to the v8 api. They are:

Script::New
The existing interface for compiling strings as javascript code,
Script::Compile, produces context-specific scripts objects. This
means that you have to recompile a string for every context where you
want to run it. The new interface, Script::New, produces
context-independent script objects that can be run in any number of
contexts. If you run the same code in many different contexts over
the lifetime of your program then you can improve performance by using
this new api to avoid recompilation -- though how big a performance
improvement you'll see of course depends on your application.

TryCatch::StackTrace
This function returns the stack trace for the exception caught by the
TryCatch. The stack trace is taken from the .stack property of the
thrown object which all built-in errors have and which can be added to
custom error objects using the Error.captureStackTrace function.

Debug::GetMirror
The v8 debugger allows objects to be inspected using the concept of
"mirrors". Mirrors can be used to give a list of all properties of an
object (both enumerable and non-enumerable), to tell the attributes of
properties (DontEnum, ReadOnly, etc.) as well as lots of other
information. The Debug::GetMirror function, which returns the mirror
for a given value, gives users of the v8 api access to this
functionality. The best reference for the mirror api is currently the
implementation, mirror-delay.js.

These functions are currently only available in the bleeding_edge
branch of v8. I will follow up when they become available in the
trunk version.


-- Christian

Stephan Beal

unread,
Aug 17, 2009, 11:27:22 AM8/17/09
to v8-u...@googlegroups.com
On Mon, Aug 17, 2009 at 5:03 PM, Christian Plesner Hansen <christian.pl...@gmail.com> wrote:
Hiya!
A few new API functions have just been added to the v8 api.  They are:

Hi, Christian!

i just wanted to say: thanks for that! i haven't yet seen much discussion of "what's coming up" on this list, and it's very interesting to see posts like this which which point us in the direction of the new toys. Please consider doing this on a regular basis (as changes/additions are made).

:)
 
--
----- stephan beal
http://wanderinghorse.net/home/stephan/

Christian Plesner Hansen

unread,
Aug 18, 2009, 2:20:07 PM8/18/09
to v8-u...@googlegroups.com
> i just wanted to say: thanks for that! i haven't yet seen much discussion of
> "what's coming up" on this list, and it's very interesting to see posts like
> this which which point us in the direction of the new toys. Please consider
> doing this on a regular basis (as changes/additions are made).

I'd like us to make more of an effort to announce interesting changes
on the mailing list as well and I expect we will be doing that.
Another place to get this information which may not be well known is
the ChangeLog file on trunk,
http://code.google.com/p/v8/source/browse/trunk/ChangeLog. It
contains a high-level description of all changes that may be relevant
to users or embedders and is updated for every new version of the
trunk.

Christian Plesner Hansen

unread,
Aug 24, 2009, 5:13:29 AM8/24/09
to v8-u...@googlegroups.com
These functions have pushed to the trunk in revision 2722.
Reply all
Reply to author
Forward
0 new messages