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

Unified Diff: runtime/vm/object.cc

Issue 14273021: Report OOM errors instead of asserting on allocation failures when sending (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « runtime/vm/object.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 21956)
+++ runtime/vm/object.cc (working copy)
@@ -72,6 +72,7 @@
Instance* Object::transition_sentinel_ = NULL;
Bool* Object::bool_true_ = NULL;
Bool* Object::bool_false_ = NULL;
+LanguageError* Object::snapshot_writer_error_ = NULL;
RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL);
RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
@@ -321,6 +322,7 @@
transition_sentinel_ = Instance::ReadOnlyHandle(isolate);
bool_true_ = Bool::ReadOnlyHandle(isolate);
bool_false_ = Bool::ReadOnlyHandle(isolate);
+ snapshot_writer_error_ = LanguageError::ReadOnlyHandle(isolate);
// Allocate and initialize the null instance.
// 'null_' must be the first object allocated as it is used in allocation to
@@ -511,6 +513,10 @@
isolate->object_store()->set_bool_class(cls);
*bool_true_ = Bool::New(true);
*bool_false_ = Bool::New(false);
+
+ *snapshot_writer_error_ =
+ LanguageError::New(String::Handle(String::New("SnapshotWriter Error")));
+
ASSERT(!empty_array_->IsSmi());
ASSERT(empty_array_->IsArray());
ASSERT(!sentinel_->IsSmi());
@@ -521,6 +527,8 @@
ASSERT(bool_true_->IsBool());
ASSERT(!bool_false_->IsSmi());
ASSERT(bool_false_->IsBool());
+ ASSERT(!snapshot_writer_error_->IsSmi());
+ ASSERT(snapshot_writer_error_->IsLanguageError());
}
@@ -8807,9 +8815,14 @@
const char* UnhandledException::ToErrorCString() const {
Isolate* isolate = Isolate::Current();
+ if (exception() == isolate->object_store()->out_of_memory()) {
+ return "Unhandled exception:\nOut of memory";
+ }
+ if (exception() == isolate->object_store()->stack_overflow()) {
+ return "Unhandled exception:\nStack overflow";
+ }
HANDLESCOPE(isolate);
Object& strtmp = Object::Handle();
-
const Instance& exc = Instance::Handle(exception());
strtmp = DartLibraryCalls::ToString(exc);
const char* exc_str =
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698