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

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

Issue 2125593002: [turbofan] Remove eager frame state from add and subtract. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/cctest/compiler/test-js-typed-lowering.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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 819
820 // ----------------------------------------------------------------------------- 820 // -----------------------------------------------------------------------------
821 // JSAdd 821 // JSAdd
822 822
823 823
824 TEST_F(JSTypedLoweringTest, JSAddWithString) { 824 TEST_F(JSTypedLoweringTest, JSAddWithString) {
825 BinaryOperationHints const hints = BinaryOperationHints::Any(); 825 BinaryOperationHints const hints = BinaryOperationHints::Any();
826 Node* lhs = Parameter(Type::String(), 0); 826 Node* lhs = Parameter(Type::String(), 0);
827 Node* rhs = Parameter(Type::String(), 1); 827 Node* rhs = Parameter(Type::String(), 1);
828 Node* context = Parameter(Type::Any(), 2); 828 Node* context = Parameter(Type::Any(), 2);
829 Node* frame_state0 = EmptyFrameState(); 829 Node* frame_state = EmptyFrameState();
830 Node* frame_state1 = EmptyFrameState();
831 Node* effect = graph()->start(); 830 Node* effect = graph()->start();
832 Node* control = graph()->start(); 831 Node* control = graph()->start();
833 Reduction r = 832 Reduction r =
834 Reduce(graph()->NewNode(javascript()->Add(hints), lhs, rhs, context, 833 Reduce(graph()->NewNode(javascript()->Add(hints), lhs, rhs, context,
835 frame_state0, frame_state1, effect, control)); 834 frame_state, effect, control));
836 ASSERT_TRUE(r.Changed()); 835 ASSERT_TRUE(r.Changed());
837 EXPECT_THAT(r.replacement(), 836 EXPECT_THAT(r.replacement(),
838 IsCall(_, IsHeapConstant(CodeFactory::StringAdd( 837 IsCall(_, IsHeapConstant(
839 isolate(), STRING_ADD_CHECK_NONE, 838 CodeFactory::StringAdd(
840 NOT_TENURED).code()), 839 isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED)
841 lhs, rhs, context, frame_state0, effect, control)); 840 .code()),
841 lhs, rhs, context, frame_state, effect, control));
842 } 842 }
843 843
844 TEST_F(JSTypedLoweringTest, JSAddSmis) { 844 TEST_F(JSTypedLoweringTest, JSAddSmis) {
845 BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall, 845 BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall,
846 BinaryOperationHints::kSignedSmall, 846 BinaryOperationHints::kSignedSmall,
847 BinaryOperationHints::kSignedSmall); 847 BinaryOperationHints::kSignedSmall);
848 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { 848 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
849 Node* lhs = Parameter(Type::Number(), 0); 849 Node* lhs = Parameter(Type::Number(), 0);
850 Node* rhs = Parameter(Type::Number(), 1); 850 Node* rhs = Parameter(Type::Number(), 1);
851 Node* context = Parameter(Type::Any(), 2); 851 Node* context = Parameter(Type::Any(), 2);
852 Node* frame_state0 = EmptyFrameState(); 852 Node* frame_state = EmptyFrameState();
853 Node* frame_state1 = EmptyFrameState();
854 Node* effect = graph()->start(); 853 Node* effect = graph()->start();
855 Node* control = graph()->start(); 854 Node* control = graph()->start();
856 Reduction r = 855 Reduction r =
857 Reduce(graph()->NewNode(javascript()->Add(hints), lhs, rhs, context, 856 Reduce(graph()->NewNode(javascript()->Add(hints), lhs, rhs, context,
858 frame_state0, frame_state1, effect, control)); 857 frame_state, effect, control));
859 ASSERT_TRUE(r.Changed()); 858 ASSERT_TRUE(r.Changed());
860 EXPECT_THAT(r.replacement(), 859 EXPECT_THAT(r.replacement(),
861 IsSpeculativeNumberAdd(BinaryOperationHints::kSignedSmall, lhs, 860 IsSpeculativeNumberAdd(BinaryOperationHints::kSignedSmall, lhs,
862 rhs, effect, control)); 861 rhs, effect, control));
863 } 862 }
864 } 863 }
865 864
866 // ----------------------------------------------------------------------------- 865 // -----------------------------------------------------------------------------
867 // JSSubtract 866 // JSSubtract
868 867
869 TEST_F(JSTypedLoweringTest, JSSubtractSmis) { 868 TEST_F(JSTypedLoweringTest, JSSubtractSmis) {
870 BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall, 869 BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall,
871 BinaryOperationHints::kSignedSmall, 870 BinaryOperationHints::kSignedSmall,
872 BinaryOperationHints::kSignedSmall); 871 BinaryOperationHints::kSignedSmall);
873 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { 872 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
874 Node* lhs = Parameter(Type::Number(), 0); 873 Node* lhs = Parameter(Type::Number(), 0);
875 Node* rhs = Parameter(Type::Number(), 1); 874 Node* rhs = Parameter(Type::Number(), 1);
876 Node* context = Parameter(Type::Any(), 2); 875 Node* context = Parameter(Type::Any(), 2);
877 Node* frame_state0 = EmptyFrameState(); 876 Node* frame_state = EmptyFrameState();
878 Node* frame_state1 = EmptyFrameState();
879 Node* effect = graph()->start(); 877 Node* effect = graph()->start();
880 Node* control = graph()->start(); 878 Node* control = graph()->start();
881 Reduction r = Reduce(graph()->NewNode(javascript()->Subtract(hints), lhs, 879 Reduction r =
882 rhs, context, frame_state0, 880 Reduce(graph()->NewNode(javascript()->Subtract(hints), lhs, rhs,
883 frame_state1, effect, control)); 881 context, frame_state, effect, control));
884 ASSERT_TRUE(r.Changed()); 882 ASSERT_TRUE(r.Changed());
885 EXPECT_THAT(r.replacement(), 883 EXPECT_THAT(r.replacement(),
886 IsSpeculativeNumberSubtract(BinaryOperationHints::kSignedSmall, 884 IsSpeculativeNumberSubtract(BinaryOperationHints::kSignedSmall,
887 lhs, rhs, effect, control)); 885 lhs, rhs, effect, control));
888 } 886 }
889 } 887 }
890 888
891 // ----------------------------------------------------------------------------- 889 // -----------------------------------------------------------------------------
892 // JSInstanceOf 890 // JSInstanceOf
893 // Test that instanceOf is reduced if and only if the right-hand side is a 891 // Test that instanceOf is reduced if and only if the right-hand side is a
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, 945 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context,
948 frame_state, effect, control); 946 frame_state, effect, control);
949 Reduction r = Reduce(instanceOf); 947 Reduction r = Reduce(instanceOf);
950 ASSERT_FALSE(r.Changed()); 948 ASSERT_FALSE(r.Changed());
951 ASSERT_EQ(instanceOf, dummy->InputAt(0)); 949 ASSERT_EQ(instanceOf, dummy->InputAt(0));
952 } 950 }
953 951
954 } // namespace compiler 952 } // namespace compiler
955 } // namespace internal 953 } // namespace internal
956 } // namespace v8 954 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698