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

Side by Side Diff: test/unittests/compiler/simplified-operator-reducer-unittest.cc

Issue 1941673002: [turbofan] Remove left-over change bits from ChangeLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't mess with the regions yet 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 // ChangeBoolToBit 153 // ChangeTaggedToBit
154 154
155 155 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithChangeTaggedToBit) {
156 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithChangeBoolToBit) {
157 Node* param0 = Parameter(0); 156 Node* param0 = Parameter(0);
158 Reduction reduction = Reduce(graph()->NewNode( 157 Reduction reduction = Reduce(graph()->NewNode(
159 simplified()->ChangeBitToBool(), 158 simplified()->ChangeBitToTagged(),
160 graph()->NewNode(simplified()->ChangeBoolToBit(), param0))); 159 graph()->NewNode(simplified()->ChangeTaggedToBit(), param0)));
161 ASSERT_TRUE(reduction.Changed()); 160 ASSERT_TRUE(reduction.Changed());
162 EXPECT_EQ(param0, reduction.replacement()); 161 EXPECT_EQ(param0, reduction.replacement());
163 } 162 }
164 163
165 164 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithZeroConstant) {
166 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithZeroConstant) {
167 Reduction reduction = Reduce( 165 Reduction reduction = Reduce(
168 graph()->NewNode(simplified()->ChangeBitToBool(), Int32Constant(0))); 166 graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(0)));
169 ASSERT_TRUE(reduction.Changed()); 167 ASSERT_TRUE(reduction.Changed());
170 EXPECT_THAT(reduction.replacement(), IsFalseConstant()); 168 EXPECT_THAT(reduction.replacement(), IsFalseConstant());
171 } 169 }
172 170
173 171 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithOneConstant) {
174 TEST_F(SimplifiedOperatorReducerTest, ChangeBitToBoolWithOneConstant) {
175 Reduction reduction = Reduce( 172 Reduction reduction = Reduce(
176 graph()->NewNode(simplified()->ChangeBitToBool(), Int32Constant(1))); 173 graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(1)));
177 ASSERT_TRUE(reduction.Changed()); 174 ASSERT_TRUE(reduction.Changed());
178 EXPECT_THAT(reduction.replacement(), IsTrueConstant()); 175 EXPECT_THAT(reduction.replacement(), IsTrueConstant());
179 } 176 }
180 177
181 178
182 // ----------------------------------------------------------------------------- 179 // -----------------------------------------------------------------------------
183 // ChangeBoolToBit 180 // ChangeTaggedToBit
184 181
185 182 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithFalseConstant) {
186 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithFalseConstant) {
187 Reduction reduction = Reduce( 183 Reduction reduction = Reduce(
188 graph()->NewNode(simplified()->ChangeBoolToBit(), FalseConstant())); 184 graph()->NewNode(simplified()->ChangeTaggedToBit(), FalseConstant()));
189 ASSERT_TRUE(reduction.Changed()); 185 ASSERT_TRUE(reduction.Changed());
190 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0)); 186 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0));
191 } 187 }
192 188
193 189 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithTrueConstant) {
194 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithTrueConstant) { 190 Reduction reduction = Reduce(
195 Reduction reduction = 191 graph()->NewNode(simplified()->ChangeTaggedToBit(), TrueConstant()));
196 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), TrueConstant()));
197 ASSERT_TRUE(reduction.Changed()); 192 ASSERT_TRUE(reduction.Changed());
198 EXPECT_THAT(reduction.replacement(), IsInt32Constant(1)); 193 EXPECT_THAT(reduction.replacement(), IsInt32Constant(1));
199 } 194 }
200 195
201 196 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithChangeBitToTagged) {
202 TEST_F(SimplifiedOperatorReducerTest, ChangeBoolToBitWithChangeBitToBool) {
203 Node* param0 = Parameter(0); 197 Node* param0 = Parameter(0);
204 Reduction reduction = Reduce(graph()->NewNode( 198 Reduction reduction = Reduce(graph()->NewNode(
205 simplified()->ChangeBoolToBit(), 199 simplified()->ChangeTaggedToBit(),
206 graph()->NewNode(simplified()->ChangeBitToBool(), param0))); 200 graph()->NewNode(simplified()->ChangeBitToTagged(), param0)));
207 ASSERT_TRUE(reduction.Changed()); 201 ASSERT_TRUE(reduction.Changed());
208 EXPECT_EQ(param0, reduction.replacement()); 202 EXPECT_EQ(param0, reduction.replacement());
209 } 203 }
210 204
211 205
212 // ----------------------------------------------------------------------------- 206 // -----------------------------------------------------------------------------
213 // ChangeFloat64ToTagged 207 // ChangeFloat64ToTagged
214 208
215 209
216 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) { 210 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 Reduction reduction = Reduce(graph()->NewNode( 413 Reduction reduction = Reduce(graph()->NewNode(
420 simplified()->TruncateTaggedToWord32(), NumberConstant(n))); 414 simplified()->TruncateTaggedToWord32(), NumberConstant(n)));
421 ASSERT_TRUE(reduction.Changed()); 415 ASSERT_TRUE(reduction.Changed());
422 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n))); 416 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n)));
423 } 417 }
424 } 418 }
425 419
426 } // namespace compiler 420 } // namespace compiler
427 } // namespace internal 421 } // namespace internal
428 } // namespace v8 422 } // 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