OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1744 // await, the function which has this exception event has not yet | 1744 // await, the function which has this exception event has not yet |
1745 // returned, so the generated Promise has not yet been marked | 1745 // returned, so the generated Promise has not yet been marked |
1746 // by AsyncFunctionAwaitCaught with promiseHandledHintSymbol. | 1746 // by AsyncFunctionAwaitCaught with promiseHandledHintSymbol. |
1747 Handle<Symbol> key = factory()->promise_handled_hint_symbol(); | 1747 Handle<Symbol> key = factory()->promise_handled_hint_symbol(); |
1748 JSObject::SetProperty(Handle<JSObject>::cast(retval), key, | 1748 JSObject::SetProperty(Handle<JSObject>::cast(retval), key, |
1749 factory()->true_value(), STRICT) | 1749 factory()->true_value(), STRICT) |
1750 .Assert(); | 1750 .Assert(); |
1751 } | 1751 } |
1752 return retval; | 1752 return retval; |
1753 case HandlerTable::PROMISE: | 1753 case HandlerTable::PROMISE: |
1754 return promise_on_stack->promise(); | 1754 return promise_on_stack |
1755 ? Handle<Object>::cast(promise_on_stack->promise()) | |
1756 : undefined; | |
1755 case HandlerTable::ASYNC_AWAIT: { | 1757 case HandlerTable::ASYNC_AWAIT: { |
1756 // If in the initial portion of async/await, continue the loop to pop up | 1758 // If in the initial portion of async/await, continue the loop to pop up |
1757 // successive async/await stack frames until an asynchronous one with | 1759 // successive async/await stack frames until an asynchronous one with |
1758 // dependents is found, or a non-async stack frame is encountered, in | 1760 // dependents is found, or a non-async stack frame is encountered, in |
1759 // order to handle the synchronous async/await catch prediction case: | 1761 // order to handle the synchronous async/await catch prediction case: |
1760 // assume that async function calls are awaited. | 1762 // assume that async function calls are awaited. |
1761 retval = promise_on_stack->promise(); | 1763 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
| |
1762 if (PromiseHasUserDefinedRejectHandler(retval)) { | 1764 if (PromiseHasUserDefinedRejectHandler(retval)) { |
1763 return retval; | 1765 return retval; |
1764 } | 1766 } |
1765 promise_on_stack = promise_on_stack->prev(); | 1767 if (promise_on_stack) promise_on_stack = promise_on_stack->prev(); |
1766 continue; | 1768 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
| |
1767 } | 1769 } |
1768 } | 1770 } |
1769 } | 1771 } |
1770 return retval; | 1772 return retval; |
1771 } | 1773 } |
1772 | 1774 |
1773 | 1775 |
1774 void Isolate::SetCaptureStackTraceForUncaughtExceptions( | 1776 void Isolate::SetCaptureStackTraceForUncaughtExceptions( |
1775 bool capture, | 1777 bool capture, |
1776 int frame_limit, | 1778 int frame_limit, |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3281 // Then check whether this scope intercepts. | 3283 // Then check whether this scope intercepts. |
3282 if ((flag & intercept_mask_)) { | 3284 if ((flag & intercept_mask_)) { |
3283 intercepted_flags_ |= flag; | 3285 intercepted_flags_ |= flag; |
3284 return true; | 3286 return true; |
3285 } | 3287 } |
3286 return false; | 3288 return false; |
3287 } | 3289 } |
3288 | 3290 |
3289 } // namespace internal | 3291 } // namespace internal |
3290 } // namespace v8 | 3292 } // namespace v8 |
OLD | NEW |