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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 StoreObjectFieldNoWriteBarrier( | 657 StoreObjectFieldNoWriteBarrier( |
658 info, PromiseResolveThenableJobInfo::kThenOffset, then); | 658 info, PromiseResolveThenableJobInfo::kThenOffset, then); |
659 StoreObjectFieldNoWriteBarrier( | 659 StoreObjectFieldNoWriteBarrier( |
660 info, PromiseResolveThenableJobInfo::kResolveOffset, resolve); | 660 info, PromiseResolveThenableJobInfo::kResolveOffset, resolve); |
661 StoreObjectFieldNoWriteBarrier( | 661 StoreObjectFieldNoWriteBarrier( |
662 info, PromiseResolveThenableJobInfo::kRejectOffset, reject); | 662 info, PromiseResolveThenableJobInfo::kRejectOffset, reject); |
663 StoreObjectFieldNoWriteBarrier(info, | 663 StoreObjectFieldNoWriteBarrier(info, |
664 PromiseResolveThenableJobInfo::kDebugIdOffset, | 664 PromiseResolveThenableJobInfo::kDebugIdOffset, |
665 SmiConstant(kDebugPromiseNoID)); | 665 SmiConstant(kDebugPromiseNoID)); |
666 StoreObjectFieldNoWriteBarrier( | 666 StoreObjectFieldNoWriteBarrier( |
667 info, PromiseResolveThenableJobInfo::kDebugNameOffset, | |
668 SmiConstant(kDebugNotActive)); | |
669 StoreObjectFieldNoWriteBarrier( | |
670 info, PromiseResolveThenableJobInfo::kContextOffset, context); | 667 info, PromiseResolveThenableJobInfo::kContextOffset, context); |
671 return info; | 668 return info; |
672 } | 669 } |
673 | 670 |
674 void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context, | 671 void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context, |
675 Node* promise, | 672 Node* promise, |
676 Node* result) { | 673 Node* result) { |
677 Isolate* isolate = this->isolate(); | 674 Isolate* isolate = this->isolate(); |
678 | 675 |
679 Variable var_reason(this, MachineRepresentation::kTagged), | 676 Variable var_reason(this, MachineRepresentation::kTagged), |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 promise, FalseConstant(), native_context); | 786 promise, FalseConstant(), native_context); |
790 | 787 |
791 Node* const info = AllocatePromiseResolveThenableJobInfo( | 788 Node* const info = AllocatePromiseResolveThenableJobInfo( |
792 result, var_then.value(), resolve, reject, context); | 789 result, var_then.value(), resolve, reject, context); |
793 | 790 |
794 Label enqueue(this); | 791 Label enqueue(this); |
795 GotoUnless(IsDebugActive(), &enqueue); | 792 GotoUnless(IsDebugActive(), &enqueue); |
796 | 793 |
797 Node* const debug_id = | 794 Node* const debug_id = |
798 CallRuntime(Runtime::kDebugNextAsyncTaskId, context, promise); | 795 CallRuntime(Runtime::kDebugNextAsyncTaskId, context, promise); |
799 Node* const debug_name = SmiConstant(kDebugPromiseResolveThenableJob); | |
800 | |
801 StoreObjectField(info, PromiseResolveThenableJobInfo::kDebugIdOffset, | 796 StoreObjectField(info, PromiseResolveThenableJobInfo::kDebugIdOffset, |
802 debug_id); | 797 debug_id); |
803 StoreObjectField(info, PromiseResolveThenableJobInfo::kDebugNameOffset, | |
804 debug_name); | |
805 | 798 |
806 GotoIf(TaggedIsSmi(result), &enqueue); | 799 GotoIf(TaggedIsSmi(result), &enqueue); |
807 GotoUnless(HasInstanceType(result, JS_PROMISE_TYPE), &enqueue); | 800 GotoUnless(HasInstanceType(result, JS_PROMISE_TYPE), &enqueue); |
808 | 801 |
809 // Mark the dependency of the new promise on the resolution | 802 // Mark the dependency of the new promise on the resolution |
810 Node* const key = | 803 Node* const key = |
811 HeapConstant(isolate->factory()->promise_handled_by_symbol()); | 804 HeapConstant(isolate->factory()->promise_handled_by_symbol()); |
812 CallRuntime(Runtime::kSetProperty, context, result, key, promise, | 805 CallRuntime(Runtime::kSetProperty, context, result, key, promise, |
813 SmiConstant(STRICT)); | 806 SmiConstant(STRICT)); |
814 Goto(&enqueue); | 807 Goto(&enqueue); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 | 1499 |
1507 // 5. Return promiseCapability.[[Promise]]. | 1500 // 5. Return promiseCapability.[[Promise]]. |
1508 Node* const promise = | 1501 Node* const promise = |
1509 LoadObjectField(capability, JSPromiseCapability::kPromiseOffset); | 1502 LoadObjectField(capability, JSPromiseCapability::kPromiseOffset); |
1510 Return(promise); | 1503 Return(promise); |
1511 } | 1504 } |
1512 } | 1505 } |
1513 | 1506 |
1514 } // namespace internal | 1507 } // namespace internal |
1515 } // namespace v8 | 1508 } // namespace v8 |
OLD | NEW |