Commit 1f80f66d authored by gsathya's avatar gsathya Committed by Commit bot

[promises] update deferred reactions symbol

The behavior was changed in https://codereview.chromium.org/2357423002

Review-Url: https://codereview.chromium.org/2403163002
Cr-Commit-Position: refs/heads/master@{#40142}
parent 6e95a8f0
...@@ -175,48 +175,48 @@ ...@@ -175,48 +175,48 @@
V(writable_string, "writable") \ V(writable_string, "writable") \
V(year_string, "year") V(year_string, "year")
#define PRIVATE_SYMBOL_LIST(V) \ #define PRIVATE_SYMBOL_LIST(V) \
V(array_iteration_kind_symbol) \ V(array_iteration_kind_symbol) \
V(array_iterator_next_symbol) \ V(array_iterator_next_symbol) \
V(array_iterator_object_symbol) \ V(array_iterator_object_symbol) \
V(call_site_frame_array_symbol) \ V(call_site_frame_array_symbol) \
V(call_site_frame_index_symbol) \ V(call_site_frame_index_symbol) \
V(class_end_position_symbol) \ V(class_end_position_symbol) \
V(class_start_position_symbol) \ V(class_start_position_symbol) \
V(detailed_stack_trace_symbol) \ V(detailed_stack_trace_symbol) \
V(elements_transition_symbol) \ V(elements_transition_symbol) \
V(error_end_pos_symbol) \ V(error_end_pos_symbol) \
V(error_script_symbol) \ V(error_script_symbol) \
V(error_start_pos_symbol) \ V(error_start_pos_symbol) \
V(frozen_symbol) \ V(frozen_symbol) \
V(hash_code_symbol) \ V(hash_code_symbol) \
V(home_object_symbol) \ V(home_object_symbol) \
V(intl_impl_object_symbol) \ V(intl_impl_object_symbol) \
V(intl_initialized_marker_symbol) \ V(intl_initialized_marker_symbol) \
V(intl_pattern_symbol) \ V(intl_pattern_symbol) \
V(intl_resolved_symbol) \ V(intl_resolved_symbol) \
V(megamorphic_symbol) \ V(megamorphic_symbol) \
V(native_context_index_symbol) \ V(native_context_index_symbol) \
V(nonexistent_symbol) \ V(nonexistent_symbol) \
V(nonextensible_symbol) \ V(nonextensible_symbol) \
V(normal_ic_symbol) \ V(normal_ic_symbol) \
V(not_mapped_symbol) \ V(not_mapped_symbol) \
V(premonomorphic_symbol) \ V(premonomorphic_symbol) \
V(promise_async_stack_id_symbol) \ V(promise_async_stack_id_symbol) \
V(promise_debug_marker_symbol) \ V(promise_debug_marker_symbol) \
V(promise_deferred_reactions_symbol) \ V(promise_deferred_reaction_symbol) \
V(promise_forwarding_handler_symbol) \ V(promise_forwarding_handler_symbol) \
V(promise_fulfill_reactions_symbol) \ V(promise_fulfill_reactions_symbol) \
V(promise_handled_by_symbol) \ V(promise_handled_by_symbol) \
V(promise_handled_hint_symbol) \ V(promise_handled_hint_symbol) \
V(promise_has_handler_symbol) \ V(promise_has_handler_symbol) \
V(promise_raw_symbol) \ V(promise_raw_symbol) \
V(promise_reject_reactions_symbol) \ V(promise_reject_reactions_symbol) \
V(promise_result_symbol) \ V(promise_result_symbol) \
V(promise_state_symbol) \ V(promise_state_symbol) \
V(sealed_symbol) \ V(sealed_symbol) \
V(stack_trace_symbol) \ V(stack_trace_symbol) \
V(strict_function_transition_symbol) \ V(strict_function_transition_symbol) \
V(uninitialized_symbol) V(uninitialized_symbol)
#define PUBLIC_SYMBOL_LIST(V) \ #define PUBLIC_SYMBOL_LIST(V) \
......
...@@ -24,8 +24,8 @@ var promiseRejectReactionsSymbol = ...@@ -24,8 +24,8 @@ var promiseRejectReactionsSymbol =
utils.ImportNow("promise_reject_reactions_symbol"); utils.ImportNow("promise_reject_reactions_symbol");
var promiseFulfillReactionsSymbol = var promiseFulfillReactionsSymbol =
utils.ImportNow("promise_fulfill_reactions_symbol"); utils.ImportNow("promise_fulfill_reactions_symbol");
var promiseDeferredReactionsSymbol = var promiseDeferredReactionSymbol =
utils.ImportNow("promise_deferred_reactions_symbol"); utils.ImportNow("promise_deferred_reaction_symbol");
var promiseHandledHintSymbol = var promiseHandledHintSymbol =
utils.ImportNow("promise_handled_hint_symbol"); utils.ImportNow("promise_handled_hint_symbol");
var promiseRawSymbol = utils.ImportNow("promise_raw_symbol"); var promiseRawSymbol = utils.ImportNow("promise_raw_symbol");
...@@ -128,16 +128,11 @@ function PromiseSet(promise, status, value) { ...@@ -128,16 +128,11 @@ function PromiseSet(promise, status, value) {
SET_PRIVATE(promise, promiseFulfillReactionsSymbol, UNDEFINED); SET_PRIVATE(promise, promiseFulfillReactionsSymbol, UNDEFINED);
SET_PRIVATE(promise, promiseRejectReactionsSymbol, UNDEFINED); SET_PRIVATE(promise, promiseRejectReactionsSymbol, UNDEFINED);
// There are 2 possible states for this symbol -- // This symbol is used only when one deferred needs to be attached. When more
// 1) UNDEFINED -- This is the zero state, no deferred object is // than one deferred need to be attached the promise, we attach them directly
// attached to this symbol. When we want to add a new deferred we // to the promiseFulfillReactionsSymbol and promiseRejectReactionsSymbol and
// directly attach it to this symbol. // reset this back to UNDEFINED.
// 2) symbol with attached deferred object -- New deferred objects SET_PRIVATE(promise, promiseDeferredReactionSymbol, UNDEFINED);
// are not attached to this symbol, but instead they are directly
// attached to the resolve, reject callback arrays. At this point,
// the deferred symbol's state is stale, and the deferreds should be
// read from the reject, resolve callbacks.
SET_PRIVATE(promise, promiseDeferredReactionsSymbol, UNDEFINED);
return promise; return promise;
} }
...@@ -157,8 +152,8 @@ function FulfillPromise(promise, status, value, promiseQueue) { ...@@ -157,8 +152,8 @@ function FulfillPromise(promise, status, value, promiseQueue) {
if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) {
var tasks = GET_PRIVATE(promise, promiseQueue); var tasks = GET_PRIVATE(promise, promiseQueue);
if (!IS_UNDEFINED(tasks)) { if (!IS_UNDEFINED(tasks)) {
var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); var deferred = GET_PRIVATE(promise, promiseDeferredReactionSymbol);
PromiseEnqueue(value, tasks, deferreds, status); PromiseEnqueue(value, tasks, deferred, status);
} }
PromiseSet(promise, status, value); PromiseSet(promise, status, value);
} }
...@@ -234,11 +229,11 @@ function PromiseAttachCallbacks(promise, deferred, onResolve, onReject) { ...@@ -234,11 +229,11 @@ function PromiseAttachCallbacks(promise, deferred, onResolve, onReject) {
if (IS_UNDEFINED(maybeResolveCallbacks)) { if (IS_UNDEFINED(maybeResolveCallbacks)) {
SET_PRIVATE(promise, promiseFulfillReactionsSymbol, onResolve); SET_PRIVATE(promise, promiseFulfillReactionsSymbol, onResolve);
SET_PRIVATE(promise, promiseRejectReactionsSymbol, onReject); SET_PRIVATE(promise, promiseRejectReactionsSymbol, onReject);
SET_PRIVATE(promise, promiseDeferredReactionsSymbol, deferred); SET_PRIVATE(promise, promiseDeferredReactionSymbol, deferred);
} else if (!IS_ARRAY(maybeResolveCallbacks)) { } else if (!IS_ARRAY(maybeResolveCallbacks)) {
var resolveCallbacks = new InternalArray(); var resolveCallbacks = new InternalArray();
var rejectCallbacks = new InternalArray(); var rejectCallbacks = new InternalArray();
var existingDeferred = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); var existingDeferred = GET_PRIVATE(promise, promiseDeferredReactionSymbol);
resolveCallbacks.push( resolveCallbacks.push(
maybeResolveCallbacks, existingDeferred, onResolve, deferred); maybeResolveCallbacks, existingDeferred, onResolve, deferred);
...@@ -249,7 +244,7 @@ function PromiseAttachCallbacks(promise, deferred, onResolve, onReject) { ...@@ -249,7 +244,7 @@ function PromiseAttachCallbacks(promise, deferred, onResolve, onReject) {
SET_PRIVATE(promise, promiseFulfillReactionsSymbol, resolveCallbacks); SET_PRIVATE(promise, promiseFulfillReactionsSymbol, resolveCallbacks);
SET_PRIVATE(promise, promiseRejectReactionsSymbol, rejectCallbacks); SET_PRIVATE(promise, promiseRejectReactionsSymbol, rejectCallbacks);
SET_PRIVATE(promise, promiseDeferredReactionsSymbol, UNDEFINED); SET_PRIVATE(promise, promiseDeferredReactionSymbol, UNDEFINED);
} else { } else {
maybeResolveCallbacks.push(onResolve, deferred); maybeResolveCallbacks.push(onResolve, deferred);
GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred);
...@@ -646,12 +641,12 @@ function PromiseHasUserDefinedRejectHandlerRecursive(promise) { ...@@ -646,12 +641,12 @@ function PromiseHasUserDefinedRejectHandlerRecursive(promise) {
} }
var queue = GET_PRIVATE(promise, promiseRejectReactionsSymbol); var queue = GET_PRIVATE(promise, promiseRejectReactionsSymbol);
var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); var deferred = GET_PRIVATE(promise, promiseDeferredReactionSymbol);
if (IS_UNDEFINED(queue)) return false; if (IS_UNDEFINED(queue)) return false;
if (!IS_ARRAY(queue)) { if (!IS_ARRAY(queue)) {
return PromiseHasUserDefinedRejectHandlerCheck(queue, deferreds); return PromiseHasUserDefinedRejectHandlerCheck(queue, deferred);
} }
for (var i = 0; i < queue.length; i += 2) { for (var i = 0; i < queue.length; i += 2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment