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 12 matching lines...) Expand all Loading... |
23 var ResolvePromise; | 23 var ResolvePromise; |
24 | 24 |
25 utils.Import(function(from) { | 25 utils.Import(function(from) { |
26 AsyncFunctionNext = from.AsyncFunctionNext; | 26 AsyncFunctionNext = from.AsyncFunctionNext; |
27 AsyncFunctionThrow = from.AsyncFunctionThrow; | 27 AsyncFunctionThrow = from.AsyncFunctionThrow; |
28 GlobalPromise = from.GlobalPromise; | 28 GlobalPromise = from.GlobalPromise; |
29 IsPromise = from.IsPromise; | 29 IsPromise = from.IsPromise; |
30 NewPromiseCapability = from.NewPromiseCapability; | 30 NewPromiseCapability = from.NewPromiseCapability; |
31 PerformPromiseThen = from.PerformPromiseThen; | 31 PerformPromiseThen = from.PerformPromiseThen; |
32 PromiseCreate = from.PromiseCreate; | 32 PromiseCreate = from.PromiseCreate; |
33 PromiseNextMicrotaskID = from.PromiseNextMicrotaskID; | |
34 RejectPromise = from.RejectPromise; | 33 RejectPromise = from.RejectPromise; |
35 ResolvePromise = from.ResolvePromise; | 34 ResolvePromise = from.ResolvePromise; |
36 }); | 35 }); |
37 | 36 |
38 var promiseAsyncStackIDSymbol = | 37 var promiseAsyncStackIDSymbol = |
39 utils.ImportNow("promise_async_stack_id_symbol"); | 38 utils.ImportNow("promise_async_stack_id_symbol"); |
40 var promiseHandledBySymbol = | 39 var promiseHandledBySymbol = |
41 utils.ImportNow("promise_handled_by_symbol"); | 40 utils.ImportNow("promise_handled_by_symbol"); |
42 var promiseForwardingHandlerSymbol = | 41 var promiseForwardingHandlerSymbol = |
43 utils.ImportNow("promise_forwarding_handler_symbol"); | 42 utils.ImportNow("promise_forwarding_handler_symbol"); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 135 |
137 function AsyncFunctionPromiseCreate() { | 136 function AsyncFunctionPromiseCreate() { |
138 var promise = PromiseCreate(); | 137 var promise = PromiseCreate(); |
139 if (DEBUG_IS_ACTIVE) { | 138 if (DEBUG_IS_ACTIVE) { |
140 // Push the Promise under construction in an async function on | 139 // Push the Promise under construction in an async function on |
141 // the catch prediction stack to handle exceptions thrown before | 140 // the catch prediction stack to handle exceptions thrown before |
142 // the first await. | 141 // the first await. |
143 %DebugPushPromise(promise); | 142 %DebugPushPromise(promise); |
144 // Assign ID and create a recurring task to save stack for future | 143 // Assign ID and create a recurring task to save stack for future |
145 // resumptions from await. | 144 // resumptions from await. |
146 var id = PromiseNextMicrotaskID(); | 145 var id = %DebugNextMicrotaskId(); |
147 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); | 146 SET_PRIVATE(promise, promiseAsyncStackIDSymbol, id); |
148 %DebugAsyncTaskEvent("enqueueRecurring", id, "async function"); | 147 %DebugAsyncTaskEvent("enqueueRecurring", id, "async function"); |
149 } | 148 } |
150 return promise; | 149 return promise; |
151 } | 150 } |
152 | 151 |
153 function AsyncFunctionPromiseRelease(promise) { | 152 function AsyncFunctionPromiseRelease(promise) { |
154 if (DEBUG_IS_ACTIVE) { | 153 if (DEBUG_IS_ACTIVE) { |
155 // Cancel | 154 // Cancel |
156 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); | 155 var id = GET_PRIVATE(promise, promiseAsyncStackIDSymbol); |
(...skipping 11 matching lines...) Expand all Loading... |
168 | 167 |
169 %InstallToContext([ | 168 %InstallToContext([ |
170 "async_function_await_caught", AsyncFunctionAwaitCaught, | 169 "async_function_await_caught", AsyncFunctionAwaitCaught, |
171 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, | 170 "async_function_await_uncaught", AsyncFunctionAwaitUncaught, |
172 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, | 171 "reject_promise_no_debug_event", RejectPromiseNoDebugEvent, |
173 "async_function_promise_create", AsyncFunctionPromiseCreate, | 172 "async_function_promise_create", AsyncFunctionPromiseCreate, |
174 "async_function_promise_release", AsyncFunctionPromiseRelease, | 173 "async_function_promise_release", AsyncFunctionPromiseRelease, |
175 ]); | 174 ]); |
176 | 175 |
177 }) | 176 }) |
OLD | NEW |