Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: vm/object.cc

Issue 9030013: Fix issue 1023: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/exceptions.cc ('k') | vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 2927)
+++ vm/object.cc (working copy)
@@ -16,6 +16,7 @@
#include "vm/class_finalizer.h"
#include "vm/dart.h"
#include "vm/debuginfo.h"
+#include "vm/exceptions.h"
#include "vm/growable_array.h"
#include "vm/heap.h"
#include "vm/ic_data.h"
@@ -721,6 +722,14 @@
// TODO(iposva): Get a proper halt instruction from the assembler.
uword address = heap->Allocate(size, space);
+ if (address == 0) {
+ // Use the preallocated out of memory exception to avoid calling
+ // into dart code or allocating any code.
+ const Instance& exception =
+ Instance::Handle(isolate->object_store()->out_of_memory());
+ Exceptions::Throw(exception);
+ UNREACHABLE();
+ }
NoGCScope no_gc;
InitializeObject(address, size);
RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
« no previous file with comments | « vm/exceptions.cc ('k') | vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698