Please be aware that the internal field count is not the property
count. These internal fields are used by the VM internally and by for
example the Chromium V8 binding layer.
-Ivan
On Mon, Sep 8, 2008 at 12:29, CGamesPlay <[EMAIL PROTECTED]> wrote:
>
> After researching this experimentally myself, I found that adding an
> accessor to the template will cause the internal field to be
> allocated. I haven't tried it, but I assume you will get the same
> results by adding any field to the template.
>
> On Sep 8, 7:39 am, "Bryan White" <[EMAIL PROTECTED]> wrote:
>> This code:
>> ===================
>> v8::Local<v8::Object> TBDLib::V8New()
>> {
>> using namespace v8;
>> HandleScope handle_scope;
>>
>> static Persistent<ObjectTemplate> tmpl;
>> if(tmpl.IsEmpty())
>> { // create on demand
>> HandleScope tmplscope;
>> Handle<ObjectTemplate> localtmpl = ObjectTemplate::New();
>> localtmpl->SetInternalFieldCount(1);
>> tmpl =
>> Persistent<ObjectTemplate>::New(tmplscope.Close(localtmpl));
>> }
>>
>> // create object and embed 'this'
>> Handle<Object> result = tmpl->NewInstance();
>> result->SetInternalField(0, External::New(this));
>>
>> return handle_scope.Close(result);}
>>
>> ======================
>>
>> Fails on the SetInternalField call with the message:
>> #
>> # Fatal error in v8::Object::SetInternalField()
>> # Writing internal field out of bounds
>> #
>>
>> Indeed at that point, result->GetInternalFieldCount() returns 0. The
>> question is why.
>>
>> --
>> Bryan White
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---