On Fri, Dec 10, 2010 at 8:26 PM, Ondřej Žára <[email protected]> wrote:

> As far as I recall, all C++ JS callbacks (from which FunctionTemplates
> are created) are automatically wrapped in a HandleScope by V8. This -
> in practice - eliminates most needs for HandleScopes, which
> corresponds with your experience.
>

Ondrej makes an interesting point which made me realize why i generally do
not need them and also makes me realize why you might benefit from them:

My code (by a fluke of evolution) always binds "normal" C++ class to JS so
that they can be used from script code. Contrast that calling into v8 from
"normal" (non-JS-bound) classes. The difference is that access to my classes
tends to only come from v8, whereas your classes might be an entry point
into v8 (if that makes any sense). If a non-JS-bound C++ class is calling
into v8 (without itself having been called from v8), then a HandleScope
might (might!) be useful to help GC. Since, in my classes, it's always v8
doing the calling (via my client script code), the scopes are implicitly
there.

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

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to