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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 function FulfillPromise(promise, status, value, promiseQueue) { | 144 function FulfillPromise(promise, status, value, promiseQueue) { |
145 if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { | 145 if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { |
146 var tasks = GET_PRIVATE(promise, promiseQueue); | 146 var tasks = GET_PRIVATE(promise, promiseQueue); |
147 if (!IS_UNDEFINED(tasks)) { | 147 if (!IS_UNDEFINED(tasks)) { |
148 var tasks = GET_PRIVATE(promise, promiseQueue); | 148 var tasks = GET_PRIVATE(promise, promiseQueue); |
149 var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); | 149 var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); |
150 PromiseEnqueue(value, tasks, deferreds, status); | 150 PromiseEnqueue(value, tasks, deferreds, status); |
151 } | 151 } |
152 SET_PRIVATE(promise, promiseStateSymbol, status); | 152 PromiseSet(promise, status, value); |
153 SET_PRIVATE(promise, promiseResultSymbol, value); | |
154 } | 153 } |
155 } | 154 } |
156 | 155 |
157 function PromiseHandle(value, handler, deferred) { | 156 function PromiseHandle(value, handler, deferred) { |
158 var debug_is_active = DEBUG_IS_ACTIVE; | 157 var debug_is_active = DEBUG_IS_ACTIVE; |
159 try { | 158 try { |
160 if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle); | 159 if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle); |
161 var result = handler(value); | 160 var result = handler(value); |
162 deferred.resolve(result); | 161 deferred.resolve(result); |
163 } catch (exception) { | 162 } catch (exception) { |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 to.PromiseChain = PromiseChain; | 583 to.PromiseChain = PromiseChain; |
585 to.PromiseDefer = PromiseDefer; | 584 to.PromiseDefer = PromiseDefer; |
586 to.PromiseAccept = PromiseAccept; | 585 to.PromiseAccept = PromiseAccept; |
587 | 586 |
588 to.PromiseCreateRejected = PromiseCreateRejected; | 587 to.PromiseCreateRejected = PromiseCreateRejected; |
589 to.PromiseCreateResolved = PromiseCreateResolved; | 588 to.PromiseCreateResolved = PromiseCreateResolved; |
590 to.PromiseThen = PromiseThen; | 589 to.PromiseThen = PromiseThen; |
591 }); | 590 }); |
592 | 591 |
593 }) | 592 }) |
OLD | NEW |