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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 TEST_F(JSTypedLoweringTest, JSBitwiseAndWithTypeFeedback) { | 1012 TEST_F(JSTypedLoweringTest, JSBitwiseAndWithTypeFeedback) { |
1013 BinaryOperationHints::Hint const feedback_types[] = { | 1013 BinaryOperationHints::Hint const feedback_types[] = { |
1014 BinaryOperationHints::kSignedSmall, | 1014 BinaryOperationHints::kSignedSmall, |
1015 BinaryOperationHints::kNumberOrOddball}; | 1015 BinaryOperationHints::kNumberOrOddball}; |
1016 for (BinaryOperationHints::Hint feedback : feedback_types) { | 1016 for (BinaryOperationHints::Hint feedback : feedback_types) { |
1017 BinaryOperationHints const hints(feedback, feedback, feedback); | 1017 BinaryOperationHints const hints(feedback, feedback, feedback); |
1018 Node* lhs = Parameter(Type::Number(), 2); | 1018 Node* lhs = Parameter(Type::Number(), 2); |
1019 Node* rhs = Parameter(Type::Number(), 3); | 1019 Node* rhs = Parameter(Type::Number(), 3); |
1020 Node* effect = graph()->start(); | 1020 Node* effect = graph()->start(); |
1021 Node* control = graph()->start(); | 1021 Node* control = graph()->start(); |
1022 Reduction r = Reduce(graph()->NewNode( | 1022 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(hints), lhs, |
1023 javascript()->BitwiseAnd(hints), lhs, rhs, UndefinedConstant(), | 1023 rhs, UndefinedConstant(), |
1024 EmptyFrameState(), EmptyFrameState(), effect, control)); | 1024 EmptyFrameState(), effect, control)); |
1025 ASSERT_TRUE(r.Changed()); | 1025 ASSERT_TRUE(r.Changed()); |
1026 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseAnd( | 1026 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseAnd( |
1027 feedback, lhs, rhs, effect, control)); | 1027 feedback, lhs, rhs, effect, control)); |
1028 } | 1028 } |
1029 } | 1029 } |
1030 | 1030 |
1031 // ----------------------------------------------------------------------------- | 1031 // ----------------------------------------------------------------------------- |
1032 // JSBitwiseOr | 1032 // JSBitwiseOr |
1033 | 1033 |
1034 TEST_F(JSTypedLoweringTest, JSBitwiseOrWithTypeFeedback) { | 1034 TEST_F(JSTypedLoweringTest, JSBitwiseOrWithTypeFeedback) { |
1035 BinaryOperationHints::Hint const feedback_types[] = { | 1035 BinaryOperationHints::Hint const feedback_types[] = { |
1036 BinaryOperationHints::kSignedSmall, | 1036 BinaryOperationHints::kSignedSmall, |
1037 BinaryOperationHints::kNumberOrOddball}; | 1037 BinaryOperationHints::kNumberOrOddball}; |
1038 for (BinaryOperationHints::Hint feedback : feedback_types) { | 1038 for (BinaryOperationHints::Hint feedback : feedback_types) { |
1039 BinaryOperationHints const hints(feedback, feedback, feedback); | 1039 BinaryOperationHints const hints(feedback, feedback, feedback); |
1040 Node* lhs = Parameter(Type::Number(), 2); | 1040 Node* lhs = Parameter(Type::Number(), 2); |
1041 Node* rhs = Parameter(Type::Number(), 3); | 1041 Node* rhs = Parameter(Type::Number(), 3); |
1042 Node* effect = graph()->start(); | 1042 Node* effect = graph()->start(); |
1043 Node* control = graph()->start(); | 1043 Node* control = graph()->start(); |
1044 Reduction r = Reduce(graph()->NewNode( | 1044 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseOr(hints), lhs, |
1045 javascript()->BitwiseOr(hints), lhs, rhs, UndefinedConstant(), | 1045 rhs, UndefinedConstant(), |
1046 EmptyFrameState(), EmptyFrameState(), effect, control)); | 1046 EmptyFrameState(), effect, control)); |
1047 ASSERT_TRUE(r.Changed()); | 1047 ASSERT_TRUE(r.Changed()); |
1048 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseOr( | 1048 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseOr( |
1049 feedback, lhs, rhs, effect, control)); | 1049 feedback, lhs, rhs, effect, control)); |
1050 } | 1050 } |
1051 } | 1051 } |
1052 | 1052 |
1053 // ----------------------------------------------------------------------------- | 1053 // ----------------------------------------------------------------------------- |
1054 // JSBitwiseXor | 1054 // JSBitwiseXor |
1055 | 1055 |
1056 TEST_F(JSTypedLoweringTest, JSBitwiseXorWithTypeFeedback) { | 1056 TEST_F(JSTypedLoweringTest, JSBitwiseXorWithTypeFeedback) { |
1057 BinaryOperationHints::Hint const feedback_types[] = { | 1057 BinaryOperationHints::Hint const feedback_types[] = { |
1058 BinaryOperationHints::kSignedSmall, | 1058 BinaryOperationHints::kSignedSmall, |
1059 BinaryOperationHints::kNumberOrOddball}; | 1059 BinaryOperationHints::kNumberOrOddball}; |
1060 for (BinaryOperationHints::Hint feedback : feedback_types) { | 1060 for (BinaryOperationHints::Hint feedback : feedback_types) { |
1061 BinaryOperationHints const hints(feedback, feedback, feedback); | 1061 BinaryOperationHints const hints(feedback, feedback, feedback); |
1062 Node* lhs = Parameter(Type::Number(), 2); | 1062 Node* lhs = Parameter(Type::Number(), 2); |
1063 Node* rhs = Parameter(Type::Number(), 3); | 1063 Node* rhs = Parameter(Type::Number(), 3); |
1064 Node* effect = graph()->start(); | 1064 Node* effect = graph()->start(); |
1065 Node* control = graph()->start(); | 1065 Node* control = graph()->start(); |
1066 Reduction r = Reduce(graph()->NewNode( | 1066 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseXor(hints), lhs, |
1067 javascript()->BitwiseXor(hints), lhs, rhs, UndefinedConstant(), | 1067 rhs, UndefinedConstant(), |
1068 EmptyFrameState(), EmptyFrameState(), effect, control)); | 1068 EmptyFrameState(), effect, control)); |
1069 ASSERT_TRUE(r.Changed()); | 1069 ASSERT_TRUE(r.Changed()); |
1070 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( | 1070 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( |
1071 feedback, lhs, rhs, effect, control)); | 1071 feedback, lhs, rhs, effect, control)); |
1072 } | 1072 } |
1073 } | 1073 } |
1074 | 1074 |
1075 } // namespace compiler | 1075 } // namespace compiler |
1076 } // namespace internal | 1076 } // namespace internal |
1077 } // namespace v8 | 1077 } // namespace v8 |
OLD | NEW |