| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 Handle<JSTypedArray> array = | 652 Handle<JSTypedArray> array = |
| 653 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 653 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 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* context = UndefinedConstant(); | 659 Node* context = UndefinedConstant(); |
| 660 Node* effect = graph()->start(); | 660 Node* effect = graph()->start(); |
| 661 Node* control = graph()->start(); | 661 Node* control = graph()->start(); |
| 662 Reduction r = | 662 Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), |
| 663 Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key, | 663 base, key, context, EmptyFrameState(), |
| 664 context, EmptyFrameState(), effect, control)); | 664 EmptyFrameState(), effect, control)); |
| 665 | 665 |
| 666 Matcher<Node*> offset_matcher = | 666 Matcher<Node*> offset_matcher = |
| 667 element_size == 1 | 667 element_size == 1 |
| 668 ? key | 668 ? key |
| 669 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); | 669 : IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size))); |
| 670 | 670 |
| 671 ASSERT_TRUE(r.Changed()); | 671 ASSERT_TRUE(r.Changed()); |
| 672 EXPECT_THAT( | 672 EXPECT_THAT( |
| 673 r.replacement(), | 673 r.replacement(), |
| 674 IsLoadBuffer(BufferAccess(type), | 674 IsLoadBuffer(BufferAccess(type), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 693 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); | 693 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); |
| 694 | 694 |
| 695 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); | 695 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 696 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 696 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 697 if (min > max) std::swap(min, max); | 697 if (min > max) std::swap(min, max); |
| 698 Node* key = Parameter(Type::Range(min, max, zone())); | 698 Node* key = Parameter(Type::Range(min, max, zone())); |
| 699 Node* base = HeapConstant(array); | 699 Node* base = HeapConstant(array); |
| 700 Node* context = UndefinedConstant(); | 700 Node* context = UndefinedConstant(); |
| 701 Node* effect = graph()->start(); | 701 Node* effect = graph()->start(); |
| 702 Node* control = graph()->start(); | 702 Node* control = graph()->start(); |
| 703 Reduction r = | 703 Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), |
| 704 Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key, | 704 base, key, context, EmptyFrameState(), |
| 705 context, EmptyFrameState(), effect, control)); | 705 EmptyFrameState(), effect, control)); |
| 706 | 706 |
| 707 ASSERT_TRUE(r.Changed()); | 707 ASSERT_TRUE(r.Changed()); |
| 708 EXPECT_THAT( | 708 EXPECT_THAT( |
| 709 r.replacement(), | 709 r.replacement(), |
| 710 IsLoadElement(access, | 710 IsLoadElement(access, |
| 711 IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 711 IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 712 key, effect, control)); | 712 key, effect, control)); |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 EXPECT_THAT(r.replacement(), | 987 EXPECT_THAT(r.replacement(), |
| 988 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 988 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 989 Context::MIN_CONTEXT_SLOTS)), | 989 Context::MIN_CONTEXT_SLOTS)), |
| 990 effect, control), | 990 effect, control), |
| 991 _)); | 991 _)); |
| 992 } | 992 } |
| 993 | 993 |
| 994 } // namespace compiler | 994 } // namespace compiler |
| 995 } // namespace internal | 995 } // namespace internal |
| 996 } // namespace v8 | 996 } // namespace v8 |
| OLD | NEW |