Updates:
        Cc: [email protected] [email protected]
        Labels: -Priority-Medium Priority-High

Comment #2 on issue 339 by [email protected]: Make  
JSObject::GetHiddenProperties GC safe in the presence of interceptors
http://code.google.com/p/v8/issues/detail?id=339

Adding the code below to test-api.cc causes a seg fault which is exactly as  
expected after code inspection. I will
add this regression test once I have made a fix.

static v8::Handle<Value> InterceptorForHiddenProperties(
     Local<String> name, const AccessorInfo& info) {
   // Make sure objects move.
   bool saved_always_compact = i::FLAG_always_compact;
   if (!i::FLAG_never_compact) {
     i::FLAG_always_compact = true;
   }
   // The whole goal of this interceptor is to cause a GC during local  
property
   // lookup.
   i::Heap::CollectAllGarbage();
   i::FLAG_always_compact = saved_always_compact;
   return v8::Handle<Value>();
}


THREADED_TEST(HiddenPropertiesWithInterceptors) {
   v8::HandleScope scope;
   LocalContext context;

   v8::Local<v8::String> key = v8_str("api-test::hidden-key");

   // Associate an interceptor with an object and start setting hidden  
values.
   Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
   Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
   instance_templ->SetNamedPropertyHandler(InterceptorForHiddenProperties);
   Local<v8::Function> function = fun_templ->GetFunction();
   Local<v8::Object> obj = function->NewInstance();
   CHECK(obj->SetHiddenValue(key, v8::Integer::New(2302)));
   CHECK_EQ(2303, obj->GetHiddenValue(key)->Int32Value());
}


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to