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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 Node* control = graph()->start(); | 903 Node* control = graph()->start(); |
904 Reduction r = Reduce(graph()->NewNode( | 904 Reduction r = Reduce(graph()->NewNode( |
905 javascript()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(), | 905 javascript()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(), |
906 EmptyFrameState(), EmptyFrameState(), effect, control)); | 906 EmptyFrameState(), EmptyFrameState(), effect, control)); |
907 ASSERT_TRUE(r.Changed()); | 907 ASSERT_TRUE(r.Changed()); |
908 EXPECT_THAT(r.replacement(), | 908 EXPECT_THAT(r.replacement(), |
909 IsSpeculativeNumberShiftLeft(BinaryOperationHints::kSignedSmall, | 909 IsSpeculativeNumberShiftLeft(BinaryOperationHints::kSignedSmall, |
910 lhs, rhs, effect, control)); | 910 lhs, rhs, effect, control)); |
911 } | 911 } |
912 | 912 |
| 913 TEST_F(JSTypedLoweringTest, JSShiftLeftNumberOrOddball) { |
| 914 BinaryOperationHints const hints(BinaryOperationHints::kNumberOrOddball, |
| 915 BinaryOperationHints::kNumberOrOddball, |
| 916 BinaryOperationHints::kNumberOrOddball); |
| 917 Node* lhs = Parameter(Type::Number(), 2); |
| 918 Node* rhs = Parameter(Type::Number(), 3); |
| 919 Node* effect = graph()->start(); |
| 920 Node* control = graph()->start(); |
| 921 Reduction r = Reduce(graph()->NewNode( |
| 922 javascript()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(), |
| 923 EmptyFrameState(), EmptyFrameState(), effect, control)); |
| 924 ASSERT_TRUE(r.Changed()); |
| 925 EXPECT_THAT(r.replacement(), IsSpeculativeNumberShiftLeft( |
| 926 BinaryOperationHints::kNumberOrOddball, lhs, |
| 927 rhs, effect, control)); |
| 928 } |
| 929 |
913 // ----------------------------------------------------------------------------- | 930 // ----------------------------------------------------------------------------- |
914 // JSInstanceOf | 931 // JSInstanceOf |
915 // Test that instanceOf is reduced if and only if the right-hand side is a | 932 // Test that instanceOf is reduced if and only if the right-hand side is a |
916 // function constant. Functional correctness is ensured elsewhere. | 933 // function constant. Functional correctness is ensured elsewhere. |
917 | 934 |
918 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { | 935 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { |
919 Node* const context = Parameter(Type::Any()); | 936 Node* const context = Parameter(Type::Any()); |
920 Node* const frame_state = EmptyFrameState(); | 937 Node* const frame_state = EmptyFrameState(); |
921 Node* const effect = graph()->start(); | 938 Node* const effect = graph()->start(); |
922 Node* const control = graph()->start(); | 939 Node* const control = graph()->start(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 985 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
969 frame_state, effect, control); | 986 frame_state, effect, control); |
970 Reduction r = Reduce(instanceOf); | 987 Reduction r = Reduce(instanceOf); |
971 ASSERT_FALSE(r.Changed()); | 988 ASSERT_FALSE(r.Changed()); |
972 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 989 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
973 } | 990 } |
974 | 991 |
975 } // namespace compiler | 992 } // namespace compiler |
976 } // namespace internal | 993 } // namespace internal |
977 } // namespace v8 | 994 } // namespace v8 |
OLD | NEW |