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

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

Issue 2201073002: [turbofan] Adds speculative operator for bitwise and, or and xor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handles kSigned32 feedback. Created 4 years, 4 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 | « src/compiler/verifier.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 Node* instanceOf = graph()->NewNode( 999 Node* instanceOf = graph()->NewNode(
1000 javascript()->InstanceOf(), Parameter(Type::Any(), 0), 1000 javascript()->InstanceOf(), Parameter(Type::Any(), 0),
1001 Parameter(Type::Any()), context, frame_state, effect, control); 1001 Parameter(Type::Any()), context, frame_state, effect, control);
1002 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, 1002 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context,
1003 frame_state, effect, control); 1003 frame_state, effect, control);
1004 Reduction r = Reduce(instanceOf); 1004 Reduction r = Reduce(instanceOf);
1005 ASSERT_FALSE(r.Changed()); 1005 ASSERT_FALSE(r.Changed());
1006 ASSERT_EQ(instanceOf, dummy->InputAt(0)); 1006 ASSERT_EQ(instanceOf, dummy->InputAt(0));
1007 } 1007 }
1008 1008
1009 // -----------------------------------------------------------------------------
1010 // JSBitwiseAnd
1011
1012 TEST_F(JSTypedLoweringTest, JSBitwiseAndWithTypeFeedback) {
1013 BinaryOperationHints::Hint const feedback_types[] = {
1014 BinaryOperationHints::kSignedSmall,
1015 BinaryOperationHints::kNumberOrOddball};
1016 for (BinaryOperationHints::Hint feedback : feedback_types) {
1017 BinaryOperationHints const hints(feedback, feedback, feedback);
1018 Node* lhs = Parameter(Type::Number(), 2);
1019 Node* rhs = Parameter(Type::Number(), 3);
1020 Node* effect = graph()->start();
1021 Node* control = graph()->start();
1022 Reduction r = Reduce(graph()->NewNode(
1023 javascript()->BitwiseAnd(hints), lhs, rhs, UndefinedConstant(),
1024 EmptyFrameState(), EmptyFrameState(), effect, control));
1025 ASSERT_TRUE(r.Changed());
1026 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseAnd(
1027 feedback, lhs, rhs, effect, control));
1028 }
1029 }
1030
1031 // -----------------------------------------------------------------------------
1032 // JSBitwiseOr
1033
1034 TEST_F(JSTypedLoweringTest, JSBitwiseOrWithTypeFeedback) {
1035 BinaryOperationHints::Hint const feedback_types[] = {
1036 BinaryOperationHints::kSignedSmall,
1037 BinaryOperationHints::kNumberOrOddball};
1038 for (BinaryOperationHints::Hint feedback : feedback_types) {
1039 BinaryOperationHints const hints(feedback, feedback, feedback);
1040 Node* lhs = Parameter(Type::Number(), 2);
1041 Node* rhs = Parameter(Type::Number(), 3);
1042 Node* effect = graph()->start();
1043 Node* control = graph()->start();
1044 Reduction r = Reduce(graph()->NewNode(
1045 javascript()->BitwiseOr(hints), lhs, rhs, UndefinedConstant(),
1046 EmptyFrameState(), EmptyFrameState(), effect, control));
1047 ASSERT_TRUE(r.Changed());
1048 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseOr(
1049 feedback, lhs, rhs, effect, control));
1050 }
1051 }
1052
1053 // -----------------------------------------------------------------------------
1054 // JSBitwiseXor
1055
1056 TEST_F(JSTypedLoweringTest, JSBitwiseXorWithTypeFeedback) {
1057 BinaryOperationHints::Hint const feedback_types[] = {
1058 BinaryOperationHints::kSignedSmall,
1059 BinaryOperationHints::kNumberOrOddball};
1060 for (BinaryOperationHints::Hint feedback : feedback_types) {
1061 BinaryOperationHints const hints(feedback, feedback, feedback);
1062 Node* lhs = Parameter(Type::Number(), 2);
1063 Node* rhs = Parameter(Type::Number(), 3);
1064 Node* effect = graph()->start();
1065 Node* control = graph()->start();
1066 Reduction r = Reduce(graph()->NewNode(
1067 javascript()->BitwiseXor(hints), lhs, rhs, UndefinedConstant(),
1068 EmptyFrameState(), EmptyFrameState(), effect, control));
1069 ASSERT_TRUE(r.Changed());
1070 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
1071 feedback, lhs, rhs, effect, control));
1072 }
1073 }
1074
1009 } // namespace compiler 1075 } // namespace compiler
1010 } // namespace internal 1076 } // namespace internal
1011 } // namespace v8 1077 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698