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

Unified Diff: runtime/vm/snapshot.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/snapshot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 21956)
+++ runtime/vm/snapshot.cc (working copy)
@@ -860,8 +860,7 @@
class_table_(Isolate::Current()->class_table()),
forward_list_(),
exception_type_(Exceptions::kNone),
- exception_msg_(NULL),
- error_(LanguageError::Handle()) {
+ exception_msg_(NULL) {
}
@@ -1036,9 +1035,6 @@
LongJump* base = isolate->long_jump_base();
LongJump jump;
isolate->set_long_jump_base(&jump);
- // TODO(6726): Allocate these constant strings once in the VM isolate.
- *ErrorHandle() = LanguageError::New(
- String::Handle(String::New("Error while writing full snapshot")));
if (setjmp(*jump.Set()) == 0) {
NoGCScope no_gc;
@@ -1334,9 +1330,10 @@
void SnapshotWriter::SetWriteException(Exceptions::ExceptionType type,
const char* msg) {
set_exception_type(type);
- // TODO(6726): Allocate these constant strings once in the VM isolate.
set_exception_msg(msg);
- Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle());
+ // The more specific error is set up in SnapshotWriter::ThrowException().
+ Isolate::Current()->long_jump_base()->
+ Jump(1, Object::snapshot_writer_error());
}
@@ -1400,10 +1397,14 @@
const char* msg) {
Isolate::Current()->object_store()->clear_sticky_error();
UnmarkAll();
- const String& msg_obj = String::Handle(String::New(msg));
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, msg_obj);
- Exceptions::ThrowByType(type, args);
+ if (msg != NULL) {
+ const String& msg_obj = String::Handle(String::New(msg));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, msg_obj);
+ Exceptions::ThrowByType(type, args);
+ } else {
+ Exceptions::ThrowByType(type, Object::empty_array());
+ }
UNREACHABLE();
}
@@ -1419,8 +1420,6 @@
LongJump* base = isolate->long_jump_base();
LongJump jump;
isolate->set_long_jump_base(&jump);
- *ErrorHandle() = LanguageError::New(
- String::Handle(String::New("Error while writing script snapshot")));
if (setjmp(*jump.Set()) == 0) {
// Write out the library object.
NoGCScope no_gc;
@@ -1458,8 +1457,6 @@
LongJump* base = isolate->long_jump_base();
LongJump jump;
isolate->set_long_jump_base(&jump);
- *ErrorHandle() = LanguageError::New(
- String::Handle(String::New("Error while writing message")));
if (setjmp(*jump.Set()) == 0) {
NoGCScope no_gc;
WriteObject(obj.raw());
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698