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

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

Issue 1942733002: Revert of [turbofan] Remove left-over change bits from ChangeLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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
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-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/change-lowering.h" 6 #include "src/compiler/change-lowering.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 class ChangeLoweringCommonTest 99 class ChangeLoweringCommonTest
100 : public ChangeLoweringTest, 100 : public ChangeLoweringTest,
101 public ::testing::WithParamInterface<MachineRepresentation> { 101 public ::testing::WithParamInterface<MachineRepresentation> {
102 public: 102 public:
103 ~ChangeLoweringCommonTest() override {} 103 ~ChangeLoweringCommonTest() override {}
104 104
105 MachineRepresentation WordRepresentation() const final { return GetParam(); } 105 MachineRepresentation WordRepresentation() const final { return GetParam(); }
106 }; 106 };
107 107
108
109 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) {
110 Node* value = Parameter(Type::Boolean());
111 Reduction r =
112 Reduce(graph()->NewNode(simplified()->ChangeBitToBool(), value));
113 ASSERT_TRUE(r.Changed());
114 EXPECT_THAT(r.replacement(), IsSelect(MachineRepresentation::kTagged, value,
115 IsTrueConstant(), IsFalseConstant()));
116 }
117
118
119 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) {
120 Node* value = Parameter(Type::Number());
121 Reduction r =
122 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), value));
123 ASSERT_TRUE(r.Changed());
124 EXPECT_THAT(r.replacement(), IsWordEqual(value, IsTrueConstant()));
125 }
126
127 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeInt31ToTagged) {
128 Node* value = Parameter(Type::SignedSmall());
129 Reduction r =
130 Reduce(graph()->NewNode(simplified()->ChangeInt31ToTagged(), value));
131 ASSERT_TRUE(r.Changed());
132 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value));
133 }
134
108 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) { 135 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
109 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, 136 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
110 Handle<Name>::null(), Type::Any(), 137 Handle<Name>::null(), Type::Any(),
111 MachineType::AnyTagged()}; 138 MachineType::AnyTagged()};
112 Node* p0 = Parameter(Type::TaggedPointer()); 139 Node* p0 = Parameter(Type::TaggedPointer());
113 Node* p1 = Parameter(Type::TaggedSigned()); 140 Node* p1 = Parameter(Type::TaggedSigned());
114 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1, 141 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
115 graph()->start(), graph()->start()); 142 graph()->start(), graph()->start());
116 Reduction r = Reduce(store); 143 Reduction r = Reduce(store);
117 144
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Reduction r = Reduce(alloc); 291 Reduction r = Reduce(alloc);
265 292
266 // Only check that we lowered, but do not specify the exact form since 293 // Only check that we lowered, but do not specify the exact form since
267 // this is subject to change. 294 // this is subject to change.
268 ASSERT_TRUE(r.Changed()); 295 ASSERT_TRUE(r.Changed());
269 } 296 }
270 297
271 } // namespace compiler 298 } // namespace compiler
272 } // namespace internal 299 } // namespace internal
273 } // namespace v8 300 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | test/unittests/compiler/simplified-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698