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