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

Side by Side Diff: runtime/vm/exceptions.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // We got an error while constructing the exception object. 528 // We got an error while constructing the exception object.
529 // Propagate the error instead of throwing the exception. 529 // Propagate the error instead of throwing the exception.
530 PropagateError(Error::Cast(result)); 530 PropagateError(Error::Cast(result));
531 } else { 531 } else {
532 ASSERT(result.IsInstance()); 532 ASSERT(result.IsInstance());
533 Throw(Instance::Cast(result)); 533 Throw(Instance::Cast(result));
534 } 534 }
535 } 535 }
536 536
537 537
538 void Exceptions::ThrowOOM() {
539 Isolate* isolate = Isolate::Current();
540 const Instance& oom = Instance::Handle(
541 isolate, isolate->object_store()->out_of_memory());
542 Throw(oom);
543 }
544
545
546 void Exceptions::ThrowStackOverflow() {
547 Isolate* isolate = Isolate::Current();
548 const Instance& stack_overflow = Instance::Handle(
549 isolate, isolate->object_store()->stack_overflow());
550 Throw(stack_overflow);
551 }
552
553
538 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { 554 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
539 Library& library = Library::Handle(); 555 Library& library = Library::Handle();
540 const String* class_name = NULL; 556 const String* class_name = NULL;
541 const String* constructor_name = &Symbols::Dot(); 557 const String* constructor_name = &Symbols::Dot();
542 switch (type) { 558 switch (type) {
543 case kNone: 559 case kNone:
544 UNREACHABLE(); 560 UNREACHABLE();
545 break; 561 break;
546 case kRange: 562 case kRange:
547 library = Library::CoreLibrary(); 563 library = Library::CoreLibrary();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 break; 606 break;
591 } 607 }
592 608
593 return DartLibraryCalls::ExceptionCreate(library, 609 return DartLibraryCalls::ExceptionCreate(library,
594 *class_name, 610 *class_name,
595 *constructor_name, 611 *constructor_name,
596 arguments); 612 arguments);
597 } 613 }
598 614
599 } // namespace dart 615 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698