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

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

Issue 1072353002: [turbofan] Optimize silent hole checks on legacy const context slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years, 8 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 | « test/mjsunit/asm/pointer-masking.js ('k') | no next file » | 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/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/common-operator-reducer.h" 6 #include "src/compiler/common-operator-reducer.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/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/machine-type.h" 10 #include "src/compiler/machine-type.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 TRACED_FOREACH(MachineType, type, kMachineTypes) { 214 TRACED_FOREACH(MachineType, type, kMachineTypes) {
215 Reduction r = Reduce( 215 Reduction r = Reduce(
216 graph()->NewNode(common()->Select(type, hint), input, input, input)); 216 graph()->NewNode(common()->Select(type, hint), input, input, input));
217 ASSERT_TRUE(r.Changed()); 217 ASSERT_TRUE(r.Changed());
218 EXPECT_EQ(input, r.replacement()); 218 EXPECT_EQ(input, r.replacement());
219 } 219 }
220 } 220 }
221 } 221 }
222 222
223 223
224 TEST_F(CommonOperatorReducerTest, SelectWithFalseConstant) {
225 Node* p0 = Parameter(0);
226 Node* p1 = Parameter(1);
227 Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
228 FalseConstant(), p0, p1);
229 Reduction r = Reduce(select);
230 ASSERT_TRUE(r.Changed());
231 EXPECT_EQ(p1, r.replacement());
232 }
233
234
235 TEST_F(CommonOperatorReducerTest, SelectWithTrueConstant) {
236 Node* p0 = Parameter(0);
237 Node* p1 = Parameter(1);
238 Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
239 TrueConstant(), p0, p1);
240 Reduction r = Reduce(select);
241 ASSERT_TRUE(r.Changed());
242 EXPECT_EQ(p0, r.replacement());
243 }
244
245
224 TEST_F(CommonOperatorReducerTest, SelectToFloat32Abs) { 246 TEST_F(CommonOperatorReducerTest, SelectToFloat32Abs) {
225 Node* p0 = Parameter(0); 247 Node* p0 = Parameter(0);
226 Node* c0 = Float32Constant(0.0); 248 Node* c0 = Float32Constant(0.0);
227 Node* check = graph()->NewNode(machine()->Float32LessThan(), c0, p0); 249 Node* check = graph()->NewNode(machine()->Float32LessThan(), c0, p0);
228 Node* select = 250 Node* select =
229 graph()->NewNode(common()->Select(kMachFloat32), check, p0, 251 graph()->NewNode(common()->Select(kMachFloat32), check, p0,
230 graph()->NewNode(machine()->Float32Sub(), c0, p0)); 252 graph()->NewNode(machine()->Float32Sub(), c0, p0));
231 Reduction r = Reduce(select, MachineOperatorBuilder::kFloat32Abs); 253 Reduction r = Reduce(select, MachineOperatorBuilder::kFloat32Abs);
232 ASSERT_TRUE(r.Changed()); 254 ASSERT_TRUE(r.Changed());
233 EXPECT_THAT(r.replacement(), IsFloat32Abs(p0)); 255 EXPECT_THAT(r.replacement(), IsFloat32Abs(p0));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 Node* select = 312 Node* select =
291 graph()->NewNode(common()->Select(kMachFloat64), check, p0, p1); 313 graph()->NewNode(common()->Select(kMachFloat64), check, p0, p1);
292 Reduction r = Reduce(select, MachineOperatorBuilder::kFloat64Min); 314 Reduction r = Reduce(select, MachineOperatorBuilder::kFloat64Min);
293 ASSERT_TRUE(r.Changed()); 315 ASSERT_TRUE(r.Changed());
294 EXPECT_THAT(r.replacement(), IsFloat64Min(p0, p1)); 316 EXPECT_THAT(r.replacement(), IsFloat64Min(p0, p1));
295 } 317 }
296 318
297 } // namespace compiler 319 } // namespace compiler
298 } // namespace internal 320 } // namespace internal
299 } // namespace v8 321 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/asm/pointer-masking.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698