| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } else { | 241 } else { |
| 242 maybeResolveCallbacks.push(onResolve, deferred); | 242 maybeResolveCallbacks.push(onResolve, deferred); |
| 243 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); | 243 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 function PromiseIdResolveHandler(x) { return x; } | 247 function PromiseIdResolveHandler(x) { return x; } |
| 248 function PromiseIdRejectHandler(r) { %_ReThrow(r); } | 248 function PromiseIdRejectHandler(r) { %_ReThrow(r); } |
| 249 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true); | 249 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true); |
| 250 | 250 |
| 251 function PromiseNopResolver() {} | |
| 252 | |
| 253 // ------------------------------------------------------------------- | 251 // ------------------------------------------------------------------- |
| 254 // Define exported functions. | 252 // Define exported functions. |
| 255 | 253 |
| 256 // For bootstrapper. | 254 // For bootstrapper. |
| 257 | 255 |
| 258 // ES#sec-ispromise IsPromise ( x ) | 256 // ES#sec-ispromise IsPromise ( x ) |
| 259 function IsPromise(x) { | 257 function IsPromise(x) { |
| 260 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol); | 258 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol); |
| 261 } | 259 } |
| 262 | 260 |
| 263 function PromiseCreate() { | 261 function PromiseCreate() { |
| 264 return new GlobalPromise(PromiseNopResolver); | 262 return PromiseInit(new GlobalPromise(promiseRawSymbol)); |
| 265 } | 263 } |
| 266 | 264 |
| 267 // ES#sec-promise-resolve-functions | 265 // ES#sec-promise-resolve-functions |
| 268 // Promise Resolve Functions, steps 6-13 | 266 // Promise Resolve Functions, steps 6-13 |
| 269 function ResolvePromise(promise, resolution) { | 267 function ResolvePromise(promise, resolution) { |
| 270 if (resolution === promise) { | 268 if (resolution === promise) { |
| 271 return RejectPromise(promise, | 269 return RejectPromise(promise, |
| 272 %make_type_error(kPromiseCyclic, resolution), | 270 %make_type_error(kPromiseCyclic, resolution), |
| 273 true); | 271 true); |
| 274 } | 272 } |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID; | 696 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID; |
| 699 | 697 |
| 700 to.GlobalPromise = GlobalPromise; | 698 to.GlobalPromise = GlobalPromise; |
| 701 to.NewPromiseCapability = NewPromiseCapability; | 699 to.NewPromiseCapability = NewPromiseCapability; |
| 702 to.PerformPromiseThen = PerformPromiseThen; | 700 to.PerformPromiseThen = PerformPromiseThen; |
| 703 to.ResolvePromise = ResolvePromise; | 701 to.ResolvePromise = ResolvePromise; |
| 704 to.RejectPromise = RejectPromise; | 702 to.RejectPromise = RejectPromise; |
| 705 }); | 703 }); |
| 706 | 704 |
| 707 }) | 705 }) |
| OLD | NEW |