Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index f7605d8d21b346e85a78c557aca0b74d78cb624c..5bd2b69815b71f2e6d961e98d61e749fde2b1c32 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -810,6 +810,15 @@ Object* Isolate::TerminateExecution() { |
| } |
| +bool Isolate::IsExecutionTerminating() { |
| + if (!IsInitialized()) return false; |
| + if (has_scheduled_exception()) { |
| + return scheduled_exception() == heap()->termination_exception(); |
| + } |
| + return false; |
| +} |
| + |
| + |
| void Isolate::CancelTerminateExecution() { |
| if (try_catch_handler()) { |
| try_catch_handler()->has_terminated_ = false; |
| @@ -2281,9 +2290,15 @@ void Isolate::RunMicrotasks() { |
| for (int i = 0; i < num_tasks; i++) { |
| HandleScope scope(this); |
| Handle<JSFunction> microtask(JSFunction::cast(queue->get(i)), this); |
| - // TODO(adamk): This should ignore/clear exceptions instead of Checking. |
| - Execution::Call(this, microtask, factory()->undefined_value(), |
| - 0, NULL).Check(); |
| + MaybeHandle<Object> result = Execution::Call( |
| + this, microtask, factory()->undefined_value(), 0, NULL); |
| + if (result.is_null()) { |
| + // Microtasks should not throw unless the embedder has asked us to |
| + // TerminateExecution. |
| + ASSERT(IsExecutionTerminating()); |
| + handle_scope_implementer()->DecrementCallDepth(); |
|
jochen (gone - plz use gerrit)
2014/05/22 07:45:38
why not just break?
adamk
2014/05/22 08:02:16
We're inside a while and a for loop. I would have
|
| + return; |
| + } |
| } |
| } |