OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 735 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
736 Node* base = HeapConstant(array); | 736 Node* base = HeapConstant(array); |
737 Node* value = | 737 Node* value = |
738 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); | 738 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); |
739 Node* vector = UndefinedConstant(); | 739 Node* vector = UndefinedConstant(); |
740 Node* context = UndefinedConstant(); | 740 Node* context = UndefinedConstant(); |
741 Node* effect = graph()->start(); | 741 Node* effect = graph()->start(); |
742 Node* control = graph()->start(); | 742 Node* control = graph()->start(); |
743 VectorSlotPair feedback; | 743 VectorSlotPair feedback; |
744 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 744 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
745 Node* node = graph()->NewNode(op, base, key, value, vector, context); | 745 Node* node = graph()->NewNode(op, base, key, value, vector, context, |
746 for (int i = 0; | 746 EmptyFrameState(), EmptyFrameState(), |
747 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 747 effect, control); |
748 node->AppendInput(zone(), EmptyFrameState()); | |
749 } | |
750 node->AppendInput(zone(), effect); | |
751 node->AppendInput(zone(), control); | |
752 Reduction r = Reduce(node); | 748 Reduction r = Reduce(node); |
753 | 749 |
754 Matcher<Node*> offset_matcher = | 750 Matcher<Node*> offset_matcher = |
755 element_size == 1 | 751 element_size == 1 |
756 ? key | 752 ? key |
757 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 753 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
758 | 754 |
759 ASSERT_TRUE(r.Changed()); | 755 ASSERT_TRUE(r.Changed()); |
760 EXPECT_THAT( | 756 EXPECT_THAT( |
761 r.replacement(), | 757 r.replacement(), |
(...skipping 21 matching lines...) Expand all Loading... |
783 Node* key = Parameter( | 779 Node* key = Parameter( |
784 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 780 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
785 Node* base = HeapConstant(array); | 781 Node* base = HeapConstant(array); |
786 Node* value = Parameter(Type::Any()); | 782 Node* value = Parameter(Type::Any()); |
787 Node* vector = UndefinedConstant(); | 783 Node* vector = UndefinedConstant(); |
788 Node* context = UndefinedConstant(); | 784 Node* context = UndefinedConstant(); |
789 Node* effect = graph()->start(); | 785 Node* effect = graph()->start(); |
790 Node* control = graph()->start(); | 786 Node* control = graph()->start(); |
791 VectorSlotPair feedback; | 787 VectorSlotPair feedback; |
792 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 788 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
793 Node* node = graph()->NewNode(op, base, key, value, vector, context); | 789 Node* node = graph()->NewNode(op, base, key, value, vector, context, |
794 for (int i = 0; | 790 EmptyFrameState(), EmptyFrameState(), |
795 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 791 effect, control); |
796 node->AppendInput(zone(), EmptyFrameState()); | |
797 } | |
798 node->AppendInput(zone(), effect); | |
799 node->AppendInput(zone(), control); | |
800 Reduction r = Reduce(node); | 792 Reduction r = Reduce(node); |
801 | 793 |
802 Matcher<Node*> offset_matcher = | 794 Matcher<Node*> offset_matcher = |
803 element_size == 1 | 795 element_size == 1 |
804 ? key | 796 ? key |
805 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 797 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
806 | 798 |
807 Matcher<Node*> value_matcher = | 799 Matcher<Node*> value_matcher = |
808 IsToNumber(value, context, effect, control); | 800 IsToNumber(value, context, effect, control); |
809 Matcher<Node*> effect_matcher = value_matcher; | 801 Matcher<Node*> effect_matcher = value_matcher; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 if (min > max) std::swap(min, max); | 836 if (min > max) std::swap(min, max); |
845 Node* key = Parameter(Type::Range(min, max, zone())); | 837 Node* key = Parameter(Type::Range(min, max, zone())); |
846 Node* base = HeapConstant(array); | 838 Node* base = HeapConstant(array); |
847 Node* value = Parameter(access.type); | 839 Node* value = Parameter(access.type); |
848 Node* vector = UndefinedConstant(); | 840 Node* vector = UndefinedConstant(); |
849 Node* context = UndefinedConstant(); | 841 Node* context = UndefinedConstant(); |
850 Node* effect = graph()->start(); | 842 Node* effect = graph()->start(); |
851 Node* control = graph()->start(); | 843 Node* control = graph()->start(); |
852 VectorSlotPair feedback; | 844 VectorSlotPair feedback; |
853 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 845 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
854 Node* node = graph()->NewNode(op, base, key, value, vector, context); | 846 Node* node = graph()->NewNode(op, base, key, value, vector, context, |
855 for (int i = 0; | 847 EmptyFrameState(), EmptyFrameState(), |
856 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 848 effect, control); |
857 node->AppendInput(zone(), EmptyFrameState()); | |
858 } | |
859 node->AppendInput(zone(), effect); | |
860 node->AppendInput(zone(), control); | |
861 Reduction r = Reduce(node); | 849 Reduction r = Reduce(node); |
862 | 850 |
863 ASSERT_TRUE(r.Changed()); | 851 ASSERT_TRUE(r.Changed()); |
864 EXPECT_THAT( | 852 EXPECT_THAT( |
865 r.replacement(), | 853 r.replacement(), |
866 IsStoreElement( | 854 IsStoreElement( |
867 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 855 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
868 key, value, effect, control)); | 856 key, value, effect, control)); |
869 } | 857 } |
870 } | 858 } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 EXPECT_THAT(r.replacement(), | 1103 EXPECT_THAT(r.replacement(), |
1116 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1104 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
1117 Context::MIN_CONTEXT_SLOTS)), | 1105 Context::MIN_CONTEXT_SLOTS)), |
1118 effect, control), | 1106 effect, control), |
1119 _)); | 1107 _)); |
1120 } | 1108 } |
1121 | 1109 |
1122 } // namespace compiler | 1110 } // namespace compiler |
1123 } // namespace internal | 1111 } // namespace internal |
1124 } // namespace v8 | 1112 } // namespace v8 |
OLD | NEW |