OLD | NEW |
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 OS::Print("type error.\n"); | 578 OS::Print("type error.\n"); |
579 } | 579 } |
580 } | 580 } |
581 // Throw TypeError or CastError instance. | 581 // Throw TypeError or CastError instance. |
582 Exceptions::ThrowByType(exception_type, args); | 582 Exceptions::ThrowByType(exception_type, args); |
583 UNREACHABLE(); | 583 UNREACHABLE(); |
584 } | 584 } |
585 | 585 |
586 | 586 |
587 void Exceptions::Throw(Isolate* isolate, const Instance& exception) { | 587 void Exceptions::Throw(Isolate* isolate, const Instance& exception) { |
588 isolate->debugger()->SignalExceptionThrown(exception); | 588 // Do not notify debugger on stack overflow and out of memory exceptions. |
| 589 // The VM would crash when the debugger calls back into the VM to |
| 590 // get values of variables. |
| 591 if (exception.raw() != isolate->object_store()->out_of_memory() && |
| 592 exception.raw() != isolate->object_store()->stack_overflow()) { |
| 593 isolate->debugger()->SignalExceptionThrown(exception); |
| 594 } |
589 // Null object is a valid exception object. | 595 // Null object is a valid exception object. |
590 ThrowExceptionHelper(isolate, exception, Instance::Handle(isolate), false); | 596 ThrowExceptionHelper(isolate, exception, Instance::Handle(isolate), false); |
591 } | 597 } |
592 | 598 |
593 | 599 |
594 void Exceptions::ReThrow(Isolate* isolate, | 600 void Exceptions::ReThrow(Isolate* isolate, |
595 const Instance& exception, | 601 const Instance& exception, |
596 const Instance& stacktrace) { | 602 const Instance& stacktrace) { |
597 // Null object is a valid exception object. | 603 // Null object is a valid exception object. |
598 ThrowExceptionHelper(isolate, exception, stacktrace, true); | 604 ThrowExceptionHelper(isolate, exception, stacktrace, true); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 762 |
757 // Throw JavascriptCompatibilityError exception. | 763 // Throw JavascriptCompatibilityError exception. |
758 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 764 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
759 const Array& exc_args = Array::Handle(Array::New(1)); | 765 const Array& exc_args = Array::Handle(Array::New(1)); |
760 const String& msg_str = String::Handle(String::New(msg)); | 766 const String& msg_str = String::Handle(String::New(msg)); |
761 exc_args.SetAt(0, msg_str); | 767 exc_args.SetAt(0, msg_str); |
762 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 768 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
763 } | 769 } |
764 | 770 |
765 } // namespace dart | 771 } // namespace dart |
OLD | NEW |