Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: test/unittests/compiler/js-typed-lowering-unittest.cc

Issue 1198983002: [turbofan] Revive the VectorSlotPair and also put feedback on JSCallFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Try to address compilation error. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/js-type-feedback-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 // ----------------------------------------------------------------------------- 642 // -----------------------------------------------------------------------------
643 // JSLoadProperty 643 // JSLoadProperty
644 644
645 645
646 TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) { 646 TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
647 const size_t kLength = 17; 647 const size_t kLength = 17;
648 double backing_store[kLength]; 648 double backing_store[kLength];
649 Handle<JSArrayBuffer> buffer = 649 Handle<JSArrayBuffer> buffer =
650 NewArrayBuffer(backing_store, sizeof(backing_store)); 650 NewArrayBuffer(backing_store, sizeof(backing_store));
651 ResolvedFeedbackSlot feedback; 651 VectorSlotPair feedback;
652 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { 652 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) {
653 Handle<JSTypedArray> array = 653 Handle<JSTypedArray> array =
654 factory()->NewJSTypedArray(type, buffer, 0, kLength); 654 factory()->NewJSTypedArray(type, buffer, 0, kLength);
655 int const element_size = static_cast<int>(array->element_size()); 655 int const element_size = static_cast<int>(array->element_size());
656 656
657 Node* key = Parameter( 657 Node* key = Parameter(
658 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); 658 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone()));
659 Node* base = HeapConstant(array); 659 Node* base = HeapConstant(array);
660 Node* vector = UndefinedConstant(); 660 Node* vector = UndefinedConstant();
661 Node* context = UndefinedConstant(); 661 Node* context = UndefinedConstant();
(...skipping 18 matching lines...) Expand all
680 control)); 680 control));
681 } 681 }
682 } 682 }
683 683
684 684
685 TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) { 685 TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) {
686 const size_t kLength = 17; 686 const size_t kLength = 17;
687 double backing_store[kLength]; 687 double backing_store[kLength];
688 Handle<JSArrayBuffer> buffer = 688 Handle<JSArrayBuffer> buffer =
689 NewArrayBuffer(backing_store, sizeof(backing_store)); 689 NewArrayBuffer(backing_store, sizeof(backing_store));
690 ResolvedFeedbackSlot feedback; 690 VectorSlotPair feedback;
691 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { 691 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) {
692 Handle<JSTypedArray> array = 692 Handle<JSTypedArray> array =
693 factory()->NewJSTypedArray(type, buffer, 0, kLength); 693 factory()->NewJSTypedArray(type, buffer, 0, kLength);
694 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); 694 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true);
695 695
696 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); 696 int min = random_number_generator()->NextInt(static_cast<int>(kLength));
697 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); 697 int max = random_number_generator()->NextInt(static_cast<int>(kLength));
698 if (min > max) std::swap(min, max); 698 if (min > max) std::swap(min, max);
699 Node* key = Parameter(Type::Range(min, max, zone())); 699 Node* key = Parameter(Type::Range(min, max, zone()));
700 Node* base = HeapConstant(array); 700 Node* base = HeapConstant(array);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* context = UndefinedConstant(); 739 Node* context = UndefinedConstant();
740 Node* effect = graph()->start(); 740 Node* effect = graph()->start();
741 Node* control = graph()->start(); 741 Node* control = graph()->start();
742 ResolvedFeedbackSlot slot; 742 VectorSlotPair feedback;
743 Node* node = 743 Node* node =
744 graph()->NewNode(javascript()->StoreProperty(language_mode, slot), 744 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback),
745 base, key, value, 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 =
(...skipping 25 matching lines...) Expand all
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* context = UndefinedConstant(); 787 Node* context = UndefinedConstant();
788 Node* effect = graph()->start(); 788 Node* effect = graph()->start();
789 Node* control = graph()->start(); 789 Node* control = graph()->start();
790 ResolvedFeedbackSlot slot; 790 VectorSlotPair feedback;
791 Node* node = 791 Node* node =
792 graph()->NewNode(javascript()->StoreProperty(language_mode, slot), 792 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback),
793 base, key, value, 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 =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* context = UndefinedConstant(); 848 Node* context = UndefinedConstant();
849 Node* effect = graph()->start(); 849 Node* effect = graph()->start();
850 Node* control = graph()->start(); 850 Node* control = graph()->start();
851 ResolvedFeedbackSlot slot; 851 VectorSlotPair feedback;
852 Node* node = 852 Node* node =
853 graph()->NewNode(javascript()->StoreProperty(language_mode, slot), 853 graph()->NewNode(javascript()->StoreProperty(language_mode, feedback),
854 base, key, value, 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());
(...skipping 13 matching lines...) Expand all
877 Handle<String>(isolate()->heap()->infinity_string(), isolate()), 877 Handle<String>(isolate()->heap()->infinity_string(), isolate()),
878 Handle<String>(isolate()->heap()->nan_string(), isolate()) // -- 878 Handle<String>(isolate()->heap()->nan_string(), isolate()) // --
879 }; 879 };
880 Matcher<Node*> matches[] = { 880 Matcher<Node*> matches[] = {
881 IsHeapConstant(Unique<HeapObject>::CreateImmovable( 881 IsHeapConstant(Unique<HeapObject>::CreateImmovable(
882 Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))), 882 Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))),
883 IsNumberConstant(std::numeric_limits<double>::infinity()), 883 IsNumberConstant(std::numeric_limits<double>::infinity()),
884 IsNumberConstant(IsNaN()) // -- 884 IsNumberConstant(IsNaN()) // --
885 }; 885 };
886 886
887 ResolvedFeedbackSlot feedback; 887 VectorSlotPair feedback;
888 Node* global = Parameter(Type::GlobalObject()); 888 Node* global = Parameter(Type::GlobalObject());
889 Node* vector = UndefinedConstant(); 889 Node* vector = UndefinedConstant();
890 Node* context = UndefinedConstant(); 890 Node* context = UndefinedConstant();
891 Node* effect = graph()->start(); 891 Node* effect = graph()->start();
892 Node* control = graph()->start(); 892 Node* control = graph()->start();
893 893
894 for (size_t i = 0; i < arraysize(names); i++) { 894 for (size_t i = 0; i < arraysize(names); i++) {
895 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); 895 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]);
896 Reduction r = Reduce(graph()->NewNode( 896 Reduction r = Reduce(graph()->NewNode(
897 javascript()->LoadNamed(name, feedback), global, vector, context, 897 javascript()->LoadNamed(name, feedback), global, vector, context,
898 EmptyFrameState(), EmptyFrameState(), effect, control)); 898 EmptyFrameState(), EmptyFrameState(), effect, control));
899 899
900 ASSERT_TRUE(r.Changed()); 900 ASSERT_TRUE(r.Changed());
901 EXPECT_THAT(r.replacement(), matches[i]); 901 EXPECT_THAT(r.replacement(), matches[i]);
902 } 902 }
903 } 903 }
904 904
905 905
906 // ----------------------------------------------------------------------------- 906 // -----------------------------------------------------------------------------
907 // JSLoadDynamicGlobal 907 // JSLoadDynamicGlobal
908 908
909 909
910 TEST_F(JSTypedLoweringTest, JSLoadDynamicGlobal) { 910 TEST_F(JSTypedLoweringTest, JSLoadDynamicGlobal) {
911 Node* const context = Parameter(Type::Any()); 911 Node* const context = Parameter(Type::Any());
912 Node* const vector = UndefinedConstant(); 912 Node* const vector = UndefinedConstant();
913 Node* const frame_state = EmptyFrameState(); 913 Node* const frame_state = EmptyFrameState();
914 Node* const effect = graph()->start(); 914 Node* const effect = graph()->start();
915 Node* const control = graph()->start(); 915 Node* const control = graph()->start();
916 Handle<String> name = factory()->object_string(); 916 Handle<String> name = factory()->object_string();
917 ResolvedFeedbackSlot feedback; 917 VectorSlotPair feedback;
918 for (int i = 0; i < DynamicGlobalAccess::kMaxCheckDepth; ++i) { 918 for (int i = 0; i < DynamicGlobalAccess::kMaxCheckDepth; ++i) {
919 uint32_t bitset = 1 << i; // Only single check. 919 uint32_t bitset = 1 << i; // Only single check.
920 Reduction r = Reduce(graph()->NewNode( 920 Reduction r = Reduce(graph()->NewNode(
921 javascript()->LoadDynamicGlobal(name, bitset, feedback, NOT_CONTEXTUAL), 921 javascript()->LoadDynamicGlobal(name, bitset, feedback, NOT_CONTEXTUAL),
922 vector, context, context, frame_state, frame_state, effect, control)); 922 vector, context, context, frame_state, frame_state, effect, control));
923 ASSERT_TRUE(r.Changed()); 923 ASSERT_TRUE(r.Changed());
924 EXPECT_THAT( 924 EXPECT_THAT(
925 r.replacement(), 925 r.replacement(),
926 IsPhi(kMachAnyTagged, _, _, 926 IsPhi(kMachAnyTagged, _, _,
927 IsMerge( 927 IsMerge(
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-type-feedback-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698