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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 } else { | 217 } else { |
218 maybeResolveCallbacks.push(onResolve, deferred); | 218 maybeResolveCallbacks.push(onResolve, deferred); |
219 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); | 219 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 function PromiseIdResolveHandler(x) { return x; } | 223 function PromiseIdResolveHandler(x) { return x; } |
224 function PromiseIdRejectHandler(r) { %_ReThrow(r); } | 224 function PromiseIdRejectHandler(r) { %_ReThrow(r); } |
225 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true); | 225 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true); |
226 | 226 |
227 function PromiseNopResolver() {} | 227 function PromiseNopResolver() {} |
adamk
2016/09/27 18:10:09
Can this now be deleted?
| |
228 | 228 |
229 // ------------------------------------------------------------------- | 229 // ------------------------------------------------------------------- |
230 // Define exported functions. | 230 // Define exported functions. |
231 | 231 |
232 // For bootstrapper. | 232 // For bootstrapper. |
233 | 233 |
234 // ES#sec-ispromise IsPromise ( x ) | 234 // ES#sec-ispromise IsPromise ( x ) |
235 function IsPromise(x) { | 235 function IsPromise(x) { |
236 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol); | 236 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol); |
237 } | 237 } |
238 | 238 |
239 function PromiseCreate() { | 239 function PromiseCreate() { |
240 return new GlobalPromise(PromiseNopResolver); | 240 return PromiseInit(new GlobalPromise(promiseRawSymbol)); |
241 } | 241 } |
242 | 242 |
243 // ES#sec-promise-resolve-functions | 243 // ES#sec-promise-resolve-functions |
244 // Promise Resolve Functions, steps 6-13 | 244 // Promise Resolve Functions, steps 6-13 |
245 function ResolvePromise(promise, resolution) { | 245 function ResolvePromise(promise, resolution) { |
246 if (resolution === promise) { | 246 if (resolution === promise) { |
247 return RejectPromise(promise, | 247 return RejectPromise(promise, |
248 %make_type_error(kPromiseCyclic, resolution), | 248 %make_type_error(kPromiseCyclic, resolution), |
249 true); | 249 true); |
250 } | 250 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 to.PromiseThen = PromiseThen; | 673 to.PromiseThen = PromiseThen; |
674 | 674 |
675 to.GlobalPromise = GlobalPromise; | 675 to.GlobalPromise = GlobalPromise; |
676 to.NewPromiseCapability = NewPromiseCapability; | 676 to.NewPromiseCapability = NewPromiseCapability; |
677 to.PerformPromiseThen = PerformPromiseThen; | 677 to.PerformPromiseThen = PerformPromiseThen; |
678 to.ResolvePromise = ResolvePromise; | 678 to.ResolvePromise = ResolvePromise; |
679 to.RejectPromise = RejectPromise; | 679 to.RejectPromise = RejectPromise; |
680 }); | 680 }); |
681 | 681 |
682 }) | 682 }) |
OLD | NEW |