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

Side by Side Diff: test/unittests/compiler/simplified-operator-reducer-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/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/simplified-operator-reducer.h" 9 #include "src/compiler/simplified-operator-reducer.h"
10 #include "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 TEST_F(SimplifiedOperatorReducerTest, BooleanNotWithTrueConstant) { 144 TEST_F(SimplifiedOperatorReducerTest, BooleanNotWithTrueConstant) {
145 Reduction reduction1 = 145 Reduction reduction1 =
146 Reduce(graph()->NewNode(simplified()->BooleanNot(), TrueConstant())); 146 Reduce(graph()->NewNode(simplified()->BooleanNot(), TrueConstant()));
147 ASSERT_TRUE(reduction1.Changed()); 147 ASSERT_TRUE(reduction1.Changed());
148 EXPECT_THAT(reduction1.replacement(), IsFalseConstant()); 148 EXPECT_THAT(reduction1.replacement(), IsFalseConstant());
149 } 149 }
150 150
151 151
152 // ----------------------------------------------------------------------------- 152 // -----------------------------------------------------------------------------
153 // ChangeTaggedToBit 153 // ChangeBoolToBit
154 154
155 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithChangeTaggedToBit) { 155
156 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithChangeBoolToBit) {
156 Node* param0 = Parameter(0); 157 Node* param0 = Parameter(0);
157 Reduction reduction = Reduce(graph()->NewNode( 158 Reduction reduction = Reduce(graph()->NewNode(
158 simplified()->ChangeBitToTagged(), 159 simplified()->ChangeBitToBool(),
159 graph()->NewNode(simplified()->ChangeTaggedToBit(), param0))); 160 graph()->NewNode(simplified()->ChangeBoolToBit(), param0)));
160 ASSERT_TRUE(reduction.Changed()); 161 ASSERT_TRUE(reduction.Changed());
161 EXPECT_EQ(param0, reduction.replacement()); 162 EXPECT_EQ(param0, reduction.replacement());
162 } 163 }
163 164
164 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithZeroConstant) { 165
166 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithZeroConstant) {
165 Reduction reduction = Reduce( 167 Reduction reduction = Reduce(
166 graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(0))); 168 graph()->NewNode(simplified()->ChangeBitToBool(), Int32Constant(0)));
167 ASSERT_TRUE(reduction.Changed()); 169 ASSERT_TRUE(reduction.Changed());
168 EXPECT_THAT(reduction.replacement(), IsFalseConstant()); 170 EXPECT_THAT(reduction.replacement(), IsFalseConstant());
169 } 171 }
170 172
171 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithOneConstant) { 173
174 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithOneConstant) {
172 Reduction reduction = Reduce( 175 Reduction reduction = Reduce(
173 graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(1))); 176 graph()->NewNode(simplified()->ChangeBitToBool(), Int32Constant(1)));
174 ASSERT_TRUE(reduction.Changed()); 177 ASSERT_TRUE(reduction.Changed());
175 EXPECT_THAT(reduction.replacement(), IsTrueConstant()); 178 EXPECT_THAT(reduction.replacement(), IsTrueConstant());
176 } 179 }
177 180
178 181
179 // ----------------------------------------------------------------------------- 182 // -----------------------------------------------------------------------------
180 // ChangeTaggedToBit 183 // ChangeBoolToBit
181 184
182 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithFalseConstant) { 185
186 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithFalseConstant) {
183 Reduction reduction = Reduce( 187 Reduction reduction = Reduce(
184 graph()->NewNode(simplified()->ChangeTaggedToBit(), FalseConstant())); 188 graph()->NewNode(simplified()->ChangeBoolToBit(), FalseConstant()));
185 ASSERT_TRUE(reduction.Changed()); 189 ASSERT_TRUE(reduction.Changed());
186 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0)); 190 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0));
187 } 191 }
188 192
189 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithTrueConstant) { 193
190 Reduction reduction = Reduce( 194 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithTrueConstant) {
191 graph()->NewNode(simplified()->ChangeTaggedToBit(), TrueConstant())); 195 Reduction reduction =
196 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), TrueConstant()));
192 ASSERT_TRUE(reduction.Changed()); 197 ASSERT_TRUE(reduction.Changed());
193 EXPECT_THAT(reduction.replacement(), IsInt32Constant(1)); 198 EXPECT_THAT(reduction.replacement(), IsInt32Constant(1));
194 } 199 }
195 200
196 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithChangeBitToTagged) { 201
202 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithChangeBitToBool) {
197 Node* param0 = Parameter(0); 203 Node* param0 = Parameter(0);
198 Reduction reduction = Reduce(graph()->NewNode( 204 Reduction reduction = Reduce(graph()->NewNode(
199 simplified()->ChangeTaggedToBit(), 205 simplified()->ChangeBoolToBit(),
200 graph()->NewNode(simplified()->ChangeBitToTagged(), param0))); 206 graph()->NewNode(simplified()->ChangeBitToBool(), param0)));
201 ASSERT_TRUE(reduction.Changed()); 207 ASSERT_TRUE(reduction.Changed());
202 EXPECT_EQ(param0, reduction.replacement()); 208 EXPECT_EQ(param0, reduction.replacement());
203 } 209 }
204 210
205 211
206 // ----------------------------------------------------------------------------- 212 // -----------------------------------------------------------------------------
207 // ChangeFloat64ToTagged 213 // ChangeFloat64ToTagged
208 214
209 215
210 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) { 216 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 Reduction reduction = Reduce(graph()->NewNode( 419 Reduction reduction = Reduce(graph()->NewNode(
414 simplified()->TruncateTaggedToWord32(), NumberConstant(n))); 420 simplified()->TruncateTaggedToWord32(), NumberConstant(n)));
415 ASSERT_TRUE(reduction.Changed()); 421 ASSERT_TRUE(reduction.Changed());
416 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n))); 422 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n)));
417 } 423 }
418 } 424 }
419 425
420 } // namespace compiler 426 } // namespace compiler
421 } // namespace internal 427 } // namespace internal
422 } // namespace v8 428 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/change-lowering-unittest.cc ('k') | test/unittests/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698