| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 var promise = PromiseCreate(); | 138 var promise = PromiseCreate(); |
| 139 if (DEBUG_IS_ACTIVE) { | 139 if (DEBUG_IS_ACTIVE) { |
| 140 // Push the Promise under construction in an async function on | 140 // Push the Promise under construction in an async function on |
| 141 // the catch prediction stack to handle exceptions thrown before | 141 // the catch prediction stack to handle exceptions thrown before |
| 142 // the first await. | 142 // the first await. |
| 143 %DebugPushPromise(promise); | 143 %DebugPushPromise(promise); |
| 144 // Assign ID and create a recurring task to save stack for future | 144 // Assign ID and create a recurring task to save stack for future |
| 145 // resumptions from await. | 145 // resumptions from await. |
| 146 var id = PromiseNextMicrotaskID(); | 146 var id = PromiseNextMicrotaskID(); |
| 147 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); | 147 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); |
| 148 %DebugAsyncTaskEvent({ | 148 %DebugAsyncTaskEvent("enqueueRecurring", id, "async function"); |
| 149 type: "enqueueRecurring", | |
| 150 id: id, | |
| 151 name: "async function", | |
| 152 }); | |
| 153 } | 149 } |
| 154 return promise; | 150 return promise; |
| 155 } | 151 } |
| 156 | 152 |
| 157 function AsyncFunctionPromiseRelease(promise) { | 153 function AsyncFunctionPromiseRelease(promise) { |
| 158 if (DEBUG_IS_ACTIVE) { | 154 if (DEBUG_IS_ACTIVE) { |
| 159 // Cancel | 155 // Cancel |
| 160 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); | 156 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); |
| 161 %DebugAsyncTaskEvent({ | 157 %DebugAsyncTaskEvent("cancel", id, "async function"); |
| 162 type: "cancel", | |
| 163 id: id, | |
| 164 name: "async function", | |
| 165 }); | |
| 166 // Pop the Promise under construction in an async function on | 158 // Pop the Promise under construction in an async function on |
| 167 // from catch prediction stack. | 159 // from catch prediction stack. |
| 168 %DebugPopPromise(); | 160 %DebugPopPromise(); |
| 169 } | 161 } |
| 170 } | 162 } |
| 171 | 163 |
| 172 %InstallToContext([ | 164 %InstallToContext([ |
| 173 "async_function_await_caught", AsyncFunctionAwaitCaught, | 165 "async_function_await_caught", AsyncFunctionAwaitCaught, |
| 174 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, | 166 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, |
| 175 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, | 167 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, |
| 176 "async_function_promise_create", AsyncFunctionPromiseCreate, | 168 "async_function_promise_create", AsyncFunctionPromiseCreate, |
| 177 "async_function_promise_release", AsyncFunctionPromiseRelease, | 169 "async_function_promise_release", AsyncFunctionPromiseRelease, |
| 178 ]); | 170 ]); |
| 179 | 171 |
| 180 }) | 172 }) |
| OLD | NEW |