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) { ...@@ -2480,7 +2480,7 @@ void* v8::Object::GetPointerFromInternalField(int index) {
return NULL; return NULL;
} }
// Unaligned native pointer // Unaligned native pointer.
return reinterpret_cast<void*>(i::Proxy::cast(pointer)->proxy()); return reinterpret_cast<void*>(i::Proxy::cast(pointer)->proxy());
} }
...@@ -2492,12 +2492,12 @@ void v8::Object::SetPointerInInternalField(int index, void* value) { ...@@ -2492,12 +2492,12 @@ void v8::Object::SetPointerInInternalField(int index, void* value) {
// Aligned pointer, store as is. // Aligned pointer, store as is.
obj->SetInternalField(index, as_object); obj->SetInternalField(index, as_object);
} else { } else {
// Currently internal fields are used by DOM wrappers which // Currently internal fields are used by DOM wrappers which only
// only get GCed by the mark-sweep collector, // get garbage collected by the mark-sweep collector, so we
// so let's put proxy into old space. // pretenure the proxy.
i::Proxy* proxy = *i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::Handle<i::Proxy> proxy =
i::TENURED); i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
obj->SetInternalField(index, proxy); 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