| 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 | 157 |
| 162 // Don't send invalid events when catch prediction is turned on in | 158 // Don't send invalid events when catch prediction is turned on in |
| 163 // the middle of some async operation. | 159 // the middle of some async operation. |
| 164 if (!IS_UNDEFINED(id)) { | 160 if (!IS_UNDEFINED(id)) { |
| 165 %DebugAsyncTaskEvent({ | 161 %DebugAsyncTaskEvent("cancel", id, "async function"); |
| 166 type: "cancel", | |
| 167 id: id, | |
| 168 name: "async function", | |
| 169 }); | |
| 170 } | 162 } |
| 171 // Pop the Promise under construction in an async function on | 163 // Pop the Promise under construction in an async function on |
| 172 // from catch prediction stack. | 164 // from catch prediction stack. |
| 173 %DebugPopPromise(); | 165 %DebugPopPromise(); |
| 174 } | 166 } |
| 175 } | 167 } |
| 176 | 168 |
| 177 %InstallToContext([ | 169 %InstallToContext([ |
| 178 "async_function_await_caught", AsyncFunctionAwaitCaught, | 170 "async_function_await_caught", AsyncFunctionAwaitCaught, |
| 179 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, | 171 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, |
| 180 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, | 172 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, |
| 181 "async_function_promise_create", AsyncFunctionPromiseCreate, | 173 "async_function_promise_create", AsyncFunctionPromiseCreate, |
| 182 "async_function_promise_release", AsyncFunctionPromiseRelease, | 174 "async_function_promise_release", AsyncFunctionPromiseRelease, |
| 183 ]); | 175 ]); |
| 184 | 176 |
| 185 }) | 177 }) |
| OLD | NEW |