Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/builtins/builtins-promise.h" | 5 #include "src/builtins/builtins-promise.h" |
| 6 #include "src/builtins/builtins-constructor.h" | 6 #include "src/builtins/builtins-constructor.h" |
| 7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
| 8 #include "src/builtins/builtins.h" | 8 #include "src/builtins/builtins.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 Label reject(this); | 739 Label reject(this); |
| 740 Node* const has_handler = PromiseHasHandler(result); | 740 Node* const has_handler = PromiseHasHandler(result); |
| 741 | 741 |
| 742 // Promise has already been rejected, but had no handler. | 742 // Promise has already been rejected, but had no handler. |
| 743 // Revoke previously triggered reject event. | 743 // Revoke previously triggered reject event. |
| 744 GotoIf(has_handler, &reject); | 744 GotoIf(has_handler, &reject); |
| 745 CallRuntime(Runtime::kPromiseRevokeReject, context, result); | 745 CallRuntime(Runtime::kPromiseRevokeReject, context, result); |
| 746 Goto(&reject); | 746 Goto(&reject); |
| 747 | 747 |
| 748 Bind(&reject); | 748 Bind(&reject); |
| 749 // Don't cause a debug event as this case is forwarding a rejection | 749 // Don't cause a debug event as this case is forwarding a rejection. |
| 750 InternalPromiseReject(context, promise, thenable_value, false); | 750 InternalPromiseReject(context, promise, thenable_value, false); |
| 751 PromiseSetHasHandler(result); | 751 PromiseSetHasHandler(result); |
| 752 Goto(&out); | 752 Goto(&out); |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 | 756 |
| 757 Bind(&if_notnativepromise); | 757 Bind(&if_notnativepromise); |
| 758 { | 758 { |
| 759 // 8. Let then be Get(resolution, "then"). | 759 // 8. Let then be Get(resolution, "then"). |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 CallRuntime(Runtime::kNewTypeError, context, message_id, result); | 822 CallRuntime(Runtime::kNewTypeError, context, message_id, result); |
| 823 var_reason.Bind(error); | 823 var_reason.Bind(error); |
| 824 | 824 |
| 825 // 6.b Return RejectPromise(promise, selfResolutionError). | 825 // 6.b Return RejectPromise(promise, selfResolutionError). |
| 826 Goto(&if_rejectpromise); | 826 Goto(&if_rejectpromise); |
| 827 } | 827 } |
| 828 | 828 |
| 829 // 9.a Return RejectPromise(promise, then.[[Value]]). | 829 // 9.a Return RejectPromise(promise, then.[[Value]]). |
| 830 Bind(&if_rejectpromise); | 830 Bind(&if_rejectpromise); |
| 831 { | 831 { |
| 832 InternalPromiseReject(context, promise, var_reason.value(), true); | 832 // Don't cause a debug event as this case is forwarding a rejection. |
| 833 InternalPromiseReject(context, promise, var_reason.value(), false); | |
|
Yang
2017/03/06 11:45:02
In the test case we break twice, once in the gette
| |
| 833 Goto(&out); | 834 Goto(&out); |
| 834 } | 835 } |
| 835 | 836 |
| 836 Bind(&out); | 837 Bind(&out); |
| 837 } | 838 } |
| 838 | 839 |
| 839 void PromiseBuiltinsAssembler::PromiseFulfill( | 840 void PromiseBuiltinsAssembler::PromiseFulfill( |
| 840 Node* context, Node* promise, Node* result, | 841 Node* context, Node* promise, Node* result, |
| 841 v8::Promise::PromiseState status) { | 842 v8::Promise::PromiseState status) { |
| 842 Label do_promisereset(this), debug_async_event_enqueue_recurring(this); | 843 Label do_promisereset(this), debug_async_event_enqueue_recurring(this); |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 // 5. Return ? Invoke(promise, "then", « thenFinally, catchFinally »). | 1774 // 5. Return ? Invoke(promise, "then", « thenFinally, catchFinally »). |
| 1774 Node* const result = | 1775 Node* const result = |
| 1775 CallJS(call_callable, context, then, promise, var_then_finally.value(), | 1776 CallJS(call_callable, context, then, promise, var_then_finally.value(), |
| 1776 var_catch_finally.value()); | 1777 var_catch_finally.value()); |
| 1777 Return(result); | 1778 Return(result); |
| 1778 } | 1779 } |
| 1779 } | 1780 } |
| 1780 | 1781 |
| 1781 } // namespace internal | 1782 } // namespace internal |
| 1782 } // namespace v8 | 1783 } // namespace v8 |
| OLD | NEW |