Index: runtime/vm/exceptions.cc |
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc |
index 37a99f25dcae5330f9ae9ccad548e67247c7825b..d8cd5d6cefeb96501befd813ecc6cd6225bc08f6 100644 |
--- a/runtime/vm/exceptions.cc |
+++ b/runtime/vm/exceptions.cc |
@@ -11,6 +11,7 @@ |
#include "vm/debugger.h" |
#include "vm/flags.h" |
#include "vm/log.h" |
+#include "vm/longjump.h" |
#include "vm/object.h" |
#include "vm/object_store.h" |
#include "vm/stack_frame.h" |
@@ -146,7 +147,7 @@ static bool FindExceptionHandler(Thread* thread, |
bool* needs_stacktrace) { |
StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
StackFrame* frame = frames.NextFrame(); |
- ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
+ if (frame == NULL) return false; // No Dart frame. |
bool handler_pc_set = false; |
*needs_stacktrace = false; |
bool is_catch_all = false; |
@@ -327,6 +328,16 @@ static void ThrowExceptionHelper(Thread* thread, |
&handler_sp, |
&handler_fp, |
&handler_needs_stacktrace); |
+ if (handler_pc == 0) { |
+ // No Dart frame. |
+ ASSERT(!thread->IsMutatorThread()); |
+ ASSERT(incoming_exception.raw() == |
+ isolate->object_store()->out_of_memory()); |
+ const UnhandledException& error = UnhandledException::Handle( |
+ zone, isolate->object_store()->preallocated_unhandled_exception()); |
+ thread->long_jump_base()->Jump(1, error); |
+ UNREACHABLE(); |
+ } |
if (handler_needs_stacktrace) { |
BuildStackTrace(&frame_builder); |
} |