| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 int const element_size = static_cast<int>(array->element_size()); | 654 int const element_size = static_cast<int>(array->element_size()); |
| 655 | 655 |
| 656 Node* key = Parameter( | 656 Node* key = Parameter( |
| 657 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); | 657 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 658 Node* base = HeapConstant(array); | 658 Node* base = HeapConstant(array); |
| 659 Node* vector = UndefinedConstant(); | 659 Node* vector = UndefinedConstant(); |
| 660 Node* context = UndefinedConstant(); | 660 Node* context = UndefinedConstant(); |
| 661 Node* effect = graph()->start(); | 661 Node* effect = graph()->start(); |
| 662 Node* control = graph()->start(); | 662 Node* control = graph()->start(); |
| 663 Reduction r = Reduce( | 663 Reduction r = Reduce( |
| 664 graph()->NewNode(javascript()->LoadProperty(feedback, language_mode), | 664 graph()->NewNode(javascript()->LoadProperty(language_mode, feedback), |
| 665 base, key, vector, context, EmptyFrameState(), | 665 base, key, vector, context, EmptyFrameState(), |
| 666 EmptyFrameState(), effect, control)); | 666 EmptyFrameState(), effect, control)); |
| 667 | 667 |
| 668 Matcher<Node*> offset_matcher = | 668 Matcher<Node*> offset_matcher = |
| 669 element_size == 1 | 669 element_size == 1 |
| 670 ? key | 670 ? key |
| 671 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 671 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
| 672 | 672 |
| 673 ASSERT_TRUE(r.Changed()); | 673 ASSERT_TRUE(r.Changed()); |
| 674 EXPECT_THAT( | 674 EXPECT_THAT( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 698 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); | 698 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 699 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 699 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 700 if (min > max) std::swap(min, max); | 700 if (min > max) std::swap(min, max); |
| 701 Node* key = Parameter(Type::Range(min, max, zone())); | 701 Node* key = Parameter(Type::Range(min, max, zone())); |
| 702 Node* base = HeapConstant(array); | 702 Node* base = HeapConstant(array); |
| 703 Node* vector = UndefinedConstant(); | 703 Node* vector = UndefinedConstant(); |
| 704 Node* context = UndefinedConstant(); | 704 Node* context = UndefinedConstant(); |
| 705 Node* effect = graph()->start(); | 705 Node* effect = graph()->start(); |
| 706 Node* control = graph()->start(); | 706 Node* control = graph()->start(); |
| 707 Reduction r = Reduce( | 707 Reduction r = Reduce( |
| 708 graph()->NewNode(javascript()->LoadProperty(feedback, language_mode), | 708 graph()->NewNode(javascript()->LoadProperty(language_mode, feedback), |
| 709 base, key, vector, context, EmptyFrameState(), | 709 base, key, vector, context, EmptyFrameState(), |
| 710 EmptyFrameState(), effect, control)); | 710 EmptyFrameState(), effect, control)); |
| 711 | 711 |
| 712 ASSERT_TRUE(r.Changed()); | 712 ASSERT_TRUE(r.Changed()); |
| 713 EXPECT_THAT( | 713 EXPECT_THAT( |
| 714 r.replacement(), | 714 r.replacement(), |
| 715 IsLoadElement(access, | 715 IsLoadElement(access, |
| 716 IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 716 IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 717 key, effect, control)); | 717 key, effect, control)); |
| 718 } | 718 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { | 870 TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { |
| 871 VectorSlotPair feedback; | 871 VectorSlotPair feedback; |
| 872 Handle<Name> name = factory()->length_string(); | 872 Handle<Name> name = factory()->length_string(); |
| 873 Node* const receiver = Parameter(Type::String(), 0); | 873 Node* const receiver = Parameter(Type::String(), 0); |
| 874 Node* const vector = Parameter(Type::Internal(), 1); | 874 Node* const vector = Parameter(Type::Internal(), 1); |
| 875 Node* const context = UndefinedConstant(); | 875 Node* const context = UndefinedConstant(); |
| 876 Node* const effect = graph()->start(); | 876 Node* const effect = graph()->start(); |
| 877 Node* const control = graph()->start(); | 877 Node* const control = graph()->start(); |
| 878 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 878 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
| 879 Reduction const r = Reduce( | 879 Reduction const r = Reduce( |
| 880 graph()->NewNode(javascript()->LoadNamed(name, feedback, language_mode), | 880 graph()->NewNode(javascript()->LoadNamed(language_mode, name, feedback), |
| 881 receiver, vector, context, EmptyFrameState(), | 881 receiver, vector, context, EmptyFrameState(), |
| 882 EmptyFrameState(), effect, control)); | 882 EmptyFrameState(), effect, control)); |
| 883 ASSERT_TRUE(r.Changed()); | 883 ASSERT_TRUE(r.Changed()); |
| 884 EXPECT_THAT(r.replacement(), | 884 EXPECT_THAT(r.replacement(), |
| 885 IsLoadField(AccessBuilder::ForStringLength(zone()), receiver, | 885 IsLoadField(AccessBuilder::ForStringLength(zone()), receiver, |
| 886 effect, control)); | 886 effect, control)); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 | 890 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 EXPECT_THAT(r.replacement(), | 1108 EXPECT_THAT(r.replacement(), |
| 1109 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1109 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1110 Context::MIN_CONTEXT_SLOTS)), | 1110 Context::MIN_CONTEXT_SLOTS)), |
| 1111 IsBeginRegion(effect), control), | 1111 IsBeginRegion(effect), control), |
| 1112 _)); | 1112 _)); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 } // namespace compiler | 1115 } // namespace compiler |
| 1116 } // namespace internal | 1116 } // namespace internal |
| 1117 } // namespace v8 | 1117 } // namespace v8 |
| OLD | NEW |