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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 729 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
730 Handle<JSTypedArray> array = | 730 Handle<JSTypedArray> array = |
731 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 731 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
732 int const element_size = static_cast<int>(array->element_size()); | 732 int const element_size = static_cast<int>(array->element_size()); |
733 | 733 |
734 Node* key = Parameter( | 734 Node* key = Parameter( |
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* context = UndefinedConstant(); | 740 Node* context = UndefinedConstant(); |
740 Node* effect = graph()->start(); | 741 Node* effect = graph()->start(); |
741 Node* control = graph()->start(); | 742 Node* control = graph()->start(); |
742 VectorSlotPair feedback; | 743 VectorSlotPair feedback; |
743 Node* node = | 744 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
744 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback), | 745 Node* node = graph()->NewNode(op, base, key, value, vector, context); |
745 base, key, value, context); | |
746 for (int i = 0; | 746 for (int i = 0; |
747 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 747 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
748 node->AppendInput(zone(), EmptyFrameState()); | 748 node->AppendInput(zone(), EmptyFrameState()); |
749 } | 749 } |
750 node->AppendInput(zone(), effect); | 750 node->AppendInput(zone(), effect); |
751 node->AppendInput(zone(), control); | 751 node->AppendInput(zone(), control); |
752 Reduction r = Reduce(node); | 752 Reduction r = Reduce(node); |
753 | 753 |
754 Matcher<Node*> offset_matcher = | 754 Matcher<Node*> offset_matcher = |
755 element_size == 1 | 755 element_size == 1 |
(...skipping 21 matching lines...) Expand all Loading... |
777 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 777 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
778 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 778 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
779 Handle<JSTypedArray> array = | 779 Handle<JSTypedArray> array = |
780 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 780 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
781 int const element_size = static_cast<int>(array->element_size()); | 781 int const element_size = static_cast<int>(array->element_size()); |
782 | 782 |
783 Node* key = Parameter( | 783 Node* key = Parameter( |
784 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 784 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
785 Node* base = HeapConstant(array); | 785 Node* base = HeapConstant(array); |
786 Node* value = Parameter(Type::Any()); | 786 Node* value = Parameter(Type::Any()); |
| 787 Node* vector = UndefinedConstant(); |
787 Node* context = UndefinedConstant(); | 788 Node* context = UndefinedConstant(); |
788 Node* effect = graph()->start(); | 789 Node* effect = graph()->start(); |
789 Node* control = graph()->start(); | 790 Node* control = graph()->start(); |
790 VectorSlotPair feedback; | 791 VectorSlotPair feedback; |
791 Node* node = | 792 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
792 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback), | 793 Node* node = graph()->NewNode(op, base, key, value, vector, context); |
793 base, key, value, context); | |
794 for (int i = 0; | 794 for (int i = 0; |
795 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 795 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
796 node->AppendInput(zone(), EmptyFrameState()); | 796 node->AppendInput(zone(), EmptyFrameState()); |
797 } | 797 } |
798 node->AppendInput(zone(), effect); | 798 node->AppendInput(zone(), effect); |
799 node->AppendInput(zone(), control); | 799 node->AppendInput(zone(), control); |
800 Reduction r = Reduce(node); | 800 Reduction r = Reduce(node); |
801 | 801 |
802 Matcher<Node*> offset_matcher = | 802 Matcher<Node*> offset_matcher = |
803 element_size == 1 | 803 element_size == 1 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 Handle<JSTypedArray> array = | 838 Handle<JSTypedArray> array = |
839 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 839 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
840 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); | 840 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); |
841 | 841 |
842 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); | 842 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); |
843 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 843 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
844 if (min > max) std::swap(min, max); | 844 if (min > max) std::swap(min, max); |
845 Node* key = Parameter(Type::Range(min, max, zone())); | 845 Node* key = Parameter(Type::Range(min, max, zone())); |
846 Node* base = HeapConstant(array); | 846 Node* base = HeapConstant(array); |
847 Node* value = Parameter(access.type); | 847 Node* value = Parameter(access.type); |
| 848 Node* vector = UndefinedConstant(); |
848 Node* context = UndefinedConstant(); | 849 Node* context = UndefinedConstant(); |
849 Node* effect = graph()->start(); | 850 Node* effect = graph()->start(); |
850 Node* control = graph()->start(); | 851 Node* control = graph()->start(); |
851 VectorSlotPair feedback; | 852 VectorSlotPair feedback; |
852 Node* node = | 853 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
853 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback), | 854 Node* node = graph()->NewNode(op, base, key, value, vector, context); |
854 base, key, value, context); | |
855 for (int i = 0; | 855 for (int i = 0; |
856 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { | 856 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
857 node->AppendInput(zone(), EmptyFrameState()); | 857 node->AppendInput(zone(), EmptyFrameState()); |
858 } | 858 } |
859 node->AppendInput(zone(), effect); | 859 node->AppendInput(zone(), effect); |
860 node->AppendInput(zone(), control); | 860 node->AppendInput(zone(), control); |
861 Reduction r = Reduce(node); | 861 Reduction r = Reduce(node); |
862 | 862 |
863 ASSERT_TRUE(r.Changed()); | 863 ASSERT_TRUE(r.Changed()); |
864 EXPECT_THAT( | 864 EXPECT_THAT( |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 EXPECT_THAT(r.replacement(), | 1093 EXPECT_THAT(r.replacement(), |
1094 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1094 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
1095 Context::MIN_CONTEXT_SLOTS)), | 1095 Context::MIN_CONTEXT_SLOTS)), |
1096 effect, control), | 1096 effect, control), |
1097 _)); | 1097 _)); |
1098 } | 1098 } |
1099 | 1099 |
1100 } // namespace compiler | 1100 } // namespace compiler |
1101 } // namespace internal | 1101 } // namespace internal |
1102 } // namespace v8 | 1102 } // namespace v8 |
OLD | NEW |