| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // prediction indicates that there is a locally surrounding catch block | 101 // prediction indicates that there is a locally surrounding catch block |
| 102 function AsyncFunctionAwaitCaught(generator, awaited, outerPromise) { | 102 function AsyncFunctionAwaitCaught(generator, awaited, outerPromise) { |
| 103 if (DEBUG_IS_ACTIVE && %is_promise(awaited)) { | 103 if (DEBUG_IS_ACTIVE && %is_promise(awaited)) { |
| 104 %PromiseMarkHandledHint(awaited); | 104 %PromiseMarkHandledHint(awaited); |
| 105 } | 105 } |
| 106 AsyncFunctionAwait(generator, awaited, outerPromise); | 106 AsyncFunctionAwait(generator, awaited, outerPromise); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // How the parser rejects promises from async/await desugaring | 109 // How the parser rejects promises from async/await desugaring |
| 110 function RejectPromiseNoDebugEvent(promise, reason) { | 110 function RejectPromiseNoDebugEvent(promise, reason) { |
| 111 return %PromiseReject(promise, reason, false); | 111 return %promise_internal_reject(promise, reason, false); |
| 112 } | 112 } |
| 113 | 113 |
| 114 function AsyncFunctionPromiseCreate() { | 114 function AsyncFunctionPromiseCreate() { |
| 115 var promise = %promise_internal_constructor(UNDEFINED); | 115 var promise = %promise_internal_constructor(UNDEFINED); |
| 116 if (DEBUG_IS_ACTIVE) { | 116 if (DEBUG_IS_ACTIVE) { |
| 117 // Push the Promise under construction in an async function on | 117 // Push the Promise under construction in an async function on |
| 118 // the catch prediction stack to handle exceptions thrown before | 118 // the catch prediction stack to handle exceptions thrown before |
| 119 // the first await. | 119 // the first await. |
| 120 // Assign ID and create a recurring task to save stack for future | 120 // Assign ID and create a recurring task to save stack for future |
| 121 // resumptions from await. | 121 // resumptions from await. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 | 134 |
| 135 %InstallToContext([ | 135 %InstallToContext([ |
| 136 "async_function_await_caught", AsyncFunctionAwaitCaught, | 136 "async_function_await_caught", AsyncFunctionAwaitCaught, |
| 137 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, | 137 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, |
| 138 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, | 138 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, |
| 139 "async_function_promise_create", AsyncFunctionPromiseCreate, | 139 "async_function_promise_create", AsyncFunctionPromiseCreate, |
| 140 "async_function_promise_release", AsyncFunctionPromiseRelease, | 140 "async_function_promise_release", AsyncFunctionPromiseRelease, |
| 141 ]); | 141 ]); |
| 142 | 142 |
| 143 }) | 143 }) |
| OLD | NEW |