| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 var promise = PromiseCreate(); | 122 var promise = PromiseCreate(); |
| 123 if (DEBUG_IS_ACTIVE) { | 123 if (DEBUG_IS_ACTIVE) { |
| 124 // Push the Promise under construction in an async function on | 124 // Push the Promise under construction in an async function on |
| 125 // the catch prediction stack to handle exceptions thrown before | 125 // the catch prediction stack to handle exceptions thrown before |
| 126 // the first await. | 126 // the first await. |
| 127 %DebugPushPromise(promise); | 127 %DebugPushPromise(promise); |
| 128 // Assign ID and create a recurring task to save stack for future | 128 // Assign ID and create a recurring task to save stack for future |
| 129 // resumptions from await. | 129 // resumptions from await. |
| 130 var id = %DebugNextMicrotaskId(); | 130 var id = %DebugNextMicrotaskId(); |
| 131 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); | 131 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); |
| 132 %DebugAsyncTaskEvent("enqueueRecurring", id, "async function"); | 132 %DebugAsyncTaskEvent(kEnqueueRecurring, id, kAsyncFunction); |
| 133 } | 133 } |
| 134 return promise; | 134 return promise; |
| 135 } | 135 } |
| 136 | 136 |
| 137 function AsyncFunctionPromiseRelease(promise) { | 137 function AsyncFunctionPromiseRelease(promise) { |
| 138 if (DEBUG_IS_ACTIVE) { | 138 if (DEBUG_IS_ACTIVE) { |
| 139 // Cancel | 139 // Cancel |
| 140 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); | 140 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); |
| 141 | 141 |
| 142 // Don't send invalid events when catch prediction is turned on in | 142 // Don't send invalid events when catch prediction is turned on in |
| 143 // the middle of some async operation. | 143 // the middle of some async operation. |
| 144 if (!IS_UNDEFINED(id)) { | 144 if (!IS_UNDEFINED(id)) { |
| 145 %DebugAsyncTaskEvent("cancel", id, "async function"); | 145 %DebugAsyncTaskEvent(kCancel, id, kAsyncFunction); |
| 146 } | 146 } |
| 147 // Pop the Promise under construction in an async function on | 147 // Pop the Promise under construction in an async function on |
| 148 // from catch prediction stack. | 148 // from catch prediction stack. |
| 149 %DebugPopPromise(); | 149 %DebugPopPromise(); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 %InstallToContext([ | 153 %InstallToContext([ |
| 154 "async_function_await_caught", AsyncFunctionAwaitCaught, | 154 "async_function_await_caught", AsyncFunctionAwaitCaught, |
| 155 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, | 155 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, |
| 156 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, | 156 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, |
| 157 "async_function_promise_create", AsyncFunctionPromiseCreate, | 157 "async_function_promise_create", AsyncFunctionPromiseCreate, |
| 158 "async_function_promise_release", AsyncFunctionPromiseRelease, | 158 "async_function_promise_release", AsyncFunctionPromiseRelease, |
| 159 ]); | 159 ]); |
| 160 | 160 |
| 161 }) | 161 }) |
| OLD | NEW |