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

Unified Diff: runtime/vm/exceptions.cc

Issue 2341523002: VM: Better handling of OOM errors in the background compiler (Closed)
Patch Set: lint Created 4 years, 3 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/compiler.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698