Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index 01d9b0df1d7ae8ba6a5425955b0092cc3723ad9a..d25cf6112a80cc2ad9ff5a8cfb45956a140ac6e4 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -1751,18 +1751,20 @@ Handle<Object> Isolate::GetPromiseOnStackOnThrow() { |
| } |
| return retval; |
| case HandlerTable::PROMISE: |
| - return promise_on_stack->promise(); |
| + return promise_on_stack |
| + ? Handle<Object>::cast(promise_on_stack->promise()) |
| + : undefined; |
| case HandlerTable::ASYNC_AWAIT: { |
| // If in the initial portion of async/await, continue the loop to pop up |
| // successive async/await stack frames until an asynchronous one with |
| // dependents is found, or a non-async stack frame is encountered, in |
| // order to handle the synchronous async/await catch prediction case: |
| // assume that async function calls are awaited. |
| - retval = promise_on_stack->promise(); |
| + if (promise_on_stack) retval = promise_on_stack->promise(); |
|
gsathya
2016/09/24 01:14:09
Can you not return early if you hit an undefined?
Dan Ehrenberg
2016/09/24 03:08:20
You're right, that's a cleaner way to do it. Fixed
|
| if (PromiseHasUserDefinedRejectHandler(retval)) { |
| return retval; |
| } |
| - promise_on_stack = promise_on_stack->prev(); |
| + if (promise_on_stack) promise_on_stack = promise_on_stack->prev(); |
| continue; |
|
gsathya
2016/09/24 01:14:09
Do you need this continue?
Dan Ehrenberg
2016/09/24 03:08:20
In this switch statement, each case ends with eith
|
| } |
| } |