| 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/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| 11 #include "src/compiler/operator-properties.h" |
| 11 #include "test/unittests/compiler/compiler-test-utils.h" | 12 #include "test/unittests/compiler/compiler-test-utils.h" |
| 12 #include "test/unittests/compiler/graph-unittest.h" | 13 #include "test/unittests/compiler/graph-unittest.h" |
| 13 #include "test/unittests/compiler/node-test-utils.h" | 14 #include "test/unittests/compiler/node-test-utils.h" |
| 14 #include "testing/gmock-support.h" | 15 #include "testing/gmock-support.h" |
| 15 | 16 |
| 16 using testing::BitEq; | 17 using testing::BitEq; |
| 17 using testing::IsNaN; | 18 using testing::IsNaN; |
| 18 | 19 |
| 19 | 20 |
| 20 namespace v8 { | 21 namespace v8 { |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Node* key = Parameter( | 685 Node* key = Parameter( |
| 685 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 686 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 686 Node* base = HeapConstant(array); | 687 Node* base = HeapConstant(array); |
| 687 Node* value = | 688 Node* value = |
| 688 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); | 689 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); |
| 689 Node* context = UndefinedConstant(); | 690 Node* context = UndefinedConstant(); |
| 690 Node* effect = graph()->start(); | 691 Node* effect = graph()->start(); |
| 691 Node* control = graph()->start(); | 692 Node* control = graph()->start(); |
| 692 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), | 693 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), |
| 693 base, key, value, context); | 694 base, key, value, context); |
| 694 if (FLAG_turbo_deoptimization) { | 695 for (int i = 0; |
| 695 node->AppendInput(zone(), UndefinedConstant()); | 696 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
| 697 node->AppendInput(zone(), EmptyFrameState()); |
| 696 } | 698 } |
| 697 node->AppendInput(zone(), effect); | 699 node->AppendInput(zone(), effect); |
| 698 node->AppendInput(zone(), control); | 700 node->AppendInput(zone(), control); |
| 699 Reduction r = Reduce(node); | 701 Reduction r = Reduce(node); |
| 700 | 702 |
| 701 Matcher<Node*> offset_matcher = | 703 Matcher<Node*> offset_matcher = |
| 702 element_size == 1 | 704 element_size == 1 |
| 703 ? key | 705 ? key |
| 704 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 706 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
| 705 | 707 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 729 | 731 |
| 730 Node* key = Parameter( | 732 Node* key = Parameter( |
| 731 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 733 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 732 Node* base = HeapConstant(array); | 734 Node* base = HeapConstant(array); |
| 733 Node* value = Parameter(Type::Any()); | 735 Node* value = Parameter(Type::Any()); |
| 734 Node* context = UndefinedConstant(); | 736 Node* context = UndefinedConstant(); |
| 735 Node* effect = graph()->start(); | 737 Node* effect = graph()->start(); |
| 736 Node* control = graph()->start(); | 738 Node* control = graph()->start(); |
| 737 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), | 739 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), |
| 738 base, key, value, context); | 740 base, key, value, context); |
| 739 if (FLAG_turbo_deoptimization) { | 741 for (int i = 0; |
| 740 node->AppendInput(zone(), UndefinedConstant()); | 742 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
| 743 node->AppendInput(zone(), EmptyFrameState()); |
| 741 } | 744 } |
| 742 node->AppendInput(zone(), effect); | 745 node->AppendInput(zone(), effect); |
| 743 node->AppendInput(zone(), control); | 746 node->AppendInput(zone(), control); |
| 744 Reduction r = Reduce(node); | 747 Reduction r = Reduce(node); |
| 745 | 748 |
| 746 Matcher<Node*> offset_matcher = | 749 Matcher<Node*> offset_matcher = |
| 747 element_size == 1 | 750 element_size == 1 |
| 748 ? key | 751 ? key |
| 749 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 752 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
| 750 | 753 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 790 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 788 if (min > max) std::swap(min, max); | 791 if (min > max) std::swap(min, max); |
| 789 Node* key = Parameter(Type::Range(min, max, zone())); | 792 Node* key = Parameter(Type::Range(min, max, zone())); |
| 790 Node* base = HeapConstant(array); | 793 Node* base = HeapConstant(array); |
| 791 Node* value = Parameter(access.type); | 794 Node* value = Parameter(access.type); |
| 792 Node* context = UndefinedConstant(); | 795 Node* context = UndefinedConstant(); |
| 793 Node* effect = graph()->start(); | 796 Node* effect = graph()->start(); |
| 794 Node* control = graph()->start(); | 797 Node* control = graph()->start(); |
| 795 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), | 798 Node* node = graph()->NewNode(javascript()->StoreProperty(language_mode), |
| 796 base, key, value, context); | 799 base, key, value, context); |
| 797 if (FLAG_turbo_deoptimization) { | 800 for (int i = 0; |
| 798 node->AppendInput(zone(), UndefinedConstant()); | 801 i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) { |
| 802 node->AppendInput(zone(), EmptyFrameState()); |
| 799 } | 803 } |
| 800 node->AppendInput(zone(), effect); | 804 node->AppendInput(zone(), effect); |
| 801 node->AppendInput(zone(), control); | 805 node->AppendInput(zone(), control); |
| 802 Reduction r = Reduce(node); | 806 Reduction r = Reduce(node); |
| 803 | 807 |
| 804 ASSERT_TRUE(r.Changed()); | 808 ASSERT_TRUE(r.Changed()); |
| 805 EXPECT_THAT( | 809 EXPECT_THAT( |
| 806 r.replacement(), | 810 r.replacement(), |
| 807 IsStoreElement( | 811 IsStoreElement( |
| 808 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 812 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 809 key, value, effect, control)); | 813 key, value, effect, control)); |
| 810 } | 814 } |
| 811 } | 815 } |
| 812 } | 816 } |
| 813 | 817 |
| 814 } // namespace compiler | 818 } // namespace compiler |
| 815 } // namespace internal | 819 } // namespace internal |
| 816 } // namespace v8 | 820 } // namespace v8 |
| OLD | NEW |