| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 // Don't cause a debug event as this case is forwarding a rejection | 260 // Don't cause a debug event as this case is forwarding a rejection |
| 261 %PromiseReject(promise, thenableValue, false); | 261 %PromiseReject(promise, thenableValue, false); |
| 262 PromiseSet(promise, kRejected, thenableValue); | 262 PromiseSet(promise, kRejected, thenableValue); |
| 263 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); | 263 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 if (IS_CALLABLE(then)) { | 268 if (IS_CALLABLE(then)) { |
| 269 // TODO(gsathya): Remove container for callbacks when this is | |
| 270 // moved to CPP/TF. | |
| 271 var callbacks = %create_resolving_functions(promise, false); | |
| 272 if (DEBUG_IS_ACTIVE && IsPromise(resolution)) { | 269 if (DEBUG_IS_ACTIVE && IsPromise(resolution)) { |
| 273 // Mark the dependency of the new promise on the resolution | 270 // Mark the dependency of the new promise on the resolution |
| 274 SET_PRIVATE(resolution, promiseHandledBySymbol, promise); | 271 SET_PRIVATE(resolution, promiseHandledBySymbol, promise); |
| 275 } | 272 } |
| 276 %EnqueuePromiseResolveThenableJob( | 273 %EnqueuePromiseResolveThenableJob(promise, resolution, then); |
| 277 resolution, then, callbacks[kResolveCallback], | |
| 278 callbacks[kRejectCallback]); | |
| 279 return; | 274 return; |
| 280 } | 275 } |
| 281 } | 276 } |
| 282 %PromiseFulfill(promise, kFulfilled, resolution, | 277 %PromiseFulfill(promise, kFulfilled, resolution, |
| 283 promiseFulfillReactionsSymbol); | 278 promiseFulfillReactionsSymbol); |
| 284 PromiseSet(promise, kFulfilled, resolution); | 279 PromiseSet(promise, kFulfilled, resolution); |
| 285 } | 280 } |
| 286 | 281 |
| 287 // Only used by async-await.js | 282 // Only used by async-await.js |
| 288 function RejectPromise(promise, reason, debugEvent) { | 283 function RejectPromise(promise, reason, debugEvent) { |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 to.PromiseThen = PromiseThen; | 641 to.PromiseThen = PromiseThen; |
| 647 | 642 |
| 648 to.GlobalPromise = GlobalPromise; | 643 to.GlobalPromise = GlobalPromise; |
| 649 to.NewPromiseCapability = NewPromiseCapability; | 644 to.NewPromiseCapability = NewPromiseCapability; |
| 650 to.PerformPromiseThen = PerformPromiseThen; | 645 to.PerformPromiseThen = PerformPromiseThen; |
| 651 to.ResolvePromise = ResolvePromise; | 646 to.ResolvePromise = ResolvePromise; |
| 652 to.RejectPromise = RejectPromise; | 647 to.RejectPromise = RejectPromise; |
| 653 }); | 648 }); |
| 654 | 649 |
| 655 }) | 650 }) |
| OLD | NEW |