On 2011-05-21, at 8:06 AM, Stephan Beal wrote:
> On Fri, May 20, 2011 at 3:34 AM, Laurie Harper <[email protected]> wrote:
> Assertion failed: (handle->InternalFieldCount() > 0), function Wrap, file 
> /Users/laurie/.nvm/v0.4.5/include/node/node_object_wrap.h, line 61.
> 
> When you subclass a native class from JS then the native 'this' pointer 
> (which is stored in an internal field) cannot, without extra tooling to make 
> it work, be found. The problem is that the JS 'this' is a subclass with no 
> internal field count. This can be worked around on the C++ side, so that such 
> lookups will (with a bit of extra effort) be able to find their proper native 
> "this" object.
> 
> i have an example which does this type of lookup here:
> 
> http://code.google.com/p/v8-juice/source/browse/convert/include/v8/convert/ClassCreator.hpp#330
> 
> in the function FindHolder(). That function is used internally by my API to 
> do the "this" lookup when a C++/JS-bound class is subclassed from JS. Because 
> this requires a significant performance overhead for the lookup, it is a 
> compile-time (template-defined) option (in my lib, anyway - feel free to 
> implement yours how you like).


Thanks for the link; unfortunately I don't think it solves this problem; with 
the code I posted, the internal field count seems to be 0 on every object in 
the prototype chain, so that could would never find/return a suitable object.
-- 
Laurie Harper
http://laurie.holoweb.net/

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

Reply via email to