Commit 21f44e8f authored by kasperl@chromium.org's avatar kasperl@chromium.org

Make sure we don't crash if NewProxy returns an empty handle (only

happens when out of memory).
Review URL: http://codereview.chromium.org/155685

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3c6c3993
......@@ -2480,7 +2480,7 @@ void* v8::Object::GetPointerFromInternalField(int index) {
return NULL;
}
// Unaligned native pointer
// Unaligned native pointer.
return reinterpret_cast<void*>(i::Proxy::cast(pointer)->proxy());
}
......@@ -2492,12 +2492,12 @@ void v8::Object::SetPointerInInternalField(int index, void* value) {
// Aligned pointer, store as is.
obj->SetInternalField(index, as_object);
} else {
// Currently internal fields are used by DOM wrappers which
// only get GCed by the mark-sweep collector,
// so let's put proxy into old space.
i::Proxy* proxy = *i::Factory::NewProxy(reinterpret_cast<i::Address>(value),
i::TENURED);
obj->SetInternalField(index, proxy);
// Currently internal fields are used by DOM wrappers which only
// get garbage collected by the mark-sweep collector, so we
// pretenure the proxy.
i::Handle<i::Proxy> proxy =
i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
if (!proxy.is_null()) obj->SetInternalField(index, *proxy);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment