I'd like you to do a code review. To review this change, run gvn review --project https://v8.googlecode.com/svn [EMAIL PROTECTED]/[EMAIL PROTECTED]
Alternatively, to review the latest snapshot of this change branch, run gvn --project https://v8.googlecode.com/svn review [EMAIL PROTECTED]/internal-object-fields to review the following change: [EMAIL PROTECTED]/[EMAIL PROTECTED] | [EMAIL PROTECTED] | 2008-09-09 08:54:30 +-100 (Tue, 09 Sep 2008) Description: Fixed issue 54, under some circumstances internal field count set on object templates did not take effect. Affected Paths: M //branches/bleeding_edge/src/api.cc M //branches/bleeding_edge/test/cctest/test-api.cc This is a semiautomated message from "gvn mail". See <http://code.google.com/p/gvn/> to learn more. Index: src/api.cc =================================================================== --- src/api.cc (^/branches/bleeding_edge/src/[EMAIL PROTECTED]) +++ src/api.cc (^/changes/[EMAIL PROTECTED]/internal-object-fields/bleeding_edge/src/[EMAIL PROTECTED]) @@ -979,6 +979,12 @@ void ObjectTemplate::SetInternalFieldCount(int val "Invalid internal field count")) { return; } + if (value > 0) { + // The internal field count is set by the constructor function's + // construct code, so we ensure that there is a constructor + // function to do the setting. + EnsureConstructor(this); + } Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); } Index: test/cctest/test-api.cc =================================================================== --- test/cctest/test-api.cc (^/branches/bleeding_edge/test/cctest/[EMAIL PROTECTED]) +++ test/cctest/test-api.cc (^/changes/[EMAIL PROTECTED]/internal-object-fields/bleeding_edge/test/cctest/[EMAIL PROTECTED]) @@ -4825,3 +4825,21 @@ THREADED_TEST(DisposeEnteredContext) { inner->Exit(); } } + + +// Regression test for issue 54, object templates with internal fields +// but no accessors or interceptors did not get their internal field +// count set on instances. +THREADED_TEST(Regress54) { + v8::HandleScope outer; + LocalContext context; + static v8::Persistent<v8::ObjectTemplate> templ; + if (templ.IsEmpty()) { + v8::HandleScope inner; + v8::Handle<v8::ObjectTemplate> local = v8::ObjectTemplate::New(); + local->SetInternalFieldCount(1); + templ = v8::Persistent<v8::ObjectTemplate>::New(inner.Close(local)); + } + v8::Handle<v8::Object> result = templ->NewInstance(); + CHECK_EQ(1, result->InternalFieldCount()); +} --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
