OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 // Don't cause a debug event as this case is forwarding a rejection | 289 // Don't cause a debug event as this case is forwarding a rejection |
290 RejectPromise(promise, thenableValue, false); | 290 RejectPromise(promise, thenableValue, false); |
291 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); | 291 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); |
292 return; | 292 return; |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 if (IS_CALLABLE(then)) { | 296 if (IS_CALLABLE(then)) { |
297 var callbacks = CreateResolvingFunctions(promise, false); | 297 var callbacks = CreateResolvingFunctions(promise, false); |
298 var id, name, instrumenting = DEBUG_IS_ACTIVE; | 298 if (DEBUG_IS_ACTIVE && IsPromise(resolution)) { |
299 if (instrumenting) { | |
300 if (IsPromise(resolution)) { | |
301 // Mark the dependency of the new promise on the resolution | 299 // Mark the dependency of the new promise on the resolution |
302 SET_PRIVATE(resolution, promiseHandledBySymbol, promise); | 300 SET_PRIVATE(resolution, promiseHandledBySymbol, promise); |
303 } | |
304 id = %DebugNextMicrotaskId(); | |
305 name = "PromiseResolveThenableJob"; | |
306 %DebugAsyncTaskEvent("enqueue", id, name); | |
307 } | 301 } |
308 %EnqueuePromiseResolveThenableJob( | 302 %EnqueuePromiseResolveThenableJob( |
309 resolution, then, callbacks.resolve, callbacks.reject, id, name); | 303 resolution, then, callbacks.resolve, callbacks.reject); |
310 return; | 304 return; |
311 } | 305 } |
312 } | 306 } |
313 FulfillPromise(promise, kFulfilled, resolution, | 307 FulfillPromise(promise, kFulfilled, resolution, |
314 promiseFulfillReactionsSymbol); | 308 promiseFulfillReactionsSymbol); |
315 } | 309 } |
316 | 310 |
317 // ES#sec-rejectpromise | 311 // ES#sec-rejectpromise |
318 // RejectPromise ( promise, reason ) | 312 // RejectPromise ( promise, reason ) |
319 function RejectPromise(promise, reason, debugEvent) { | 313 function RejectPromise(promise, reason, debugEvent) { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 to.PromiseThen = PromiseThen; | 677 to.PromiseThen = PromiseThen; |
684 | 678 |
685 to.GlobalPromise = GlobalPromise; | 679 to.GlobalPromise = GlobalPromise; |
686 to.NewPromiseCapability = NewPromiseCapability; | 680 to.NewPromiseCapability = NewPromiseCapability; |
687 to.PerformPromiseThen = PerformPromiseThen; | 681 to.PerformPromiseThen = PerformPromiseThen; |
688 to.ResolvePromise = ResolvePromise; | 682 to.ResolvePromise = ResolvePromise; |
689 to.RejectPromise = RejectPromise; | 683 to.RejectPromise = RejectPromise; |
690 }); | 684 }); |
691 | 685 |
692 }) | 686 }) |
OLD | NEW |