OLD | NEW |
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/graph-unittest.h" | 5 #include "src/compiler/graph-unittest.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/simplified-operator.h" | 7 #include "src/compiler/simplified-operator.h" |
8 #include "src/compiler/simplified-operator-reducer.h" | 8 #include "src/compiler/simplified-operator-reducer.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 EXPECT_EQ(param0, reduction.replacement()); | 432 EXPECT_EQ(param0, reduction.replacement()); |
433 } | 433 } |
434 | 434 |
435 | 435 |
436 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithConstant) { | 436 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithConstant) { |
437 TRACED_FOREACH(double, n, kFloat64Values) { | 437 TRACED_FOREACH(double, n, kFloat64Values) { |
438 Reduction reduction = Reduce(graph()->NewNode( | 438 Reduction reduction = Reduce(graph()->NewNode( |
439 simplified()->ChangeTaggedToUint32(), NumberConstant(n))); | 439 simplified()->ChangeTaggedToUint32(), NumberConstant(n))); |
440 ASSERT_TRUE(reduction.Changed()); | 440 ASSERT_TRUE(reduction.Changed()); |
441 EXPECT_THAT(reduction.replacement(), | 441 EXPECT_THAT(reduction.replacement(), |
442 IsInt32Constant(BitCast<int32_t>(DoubleToUint32(n)))); | 442 IsInt32Constant(bit_cast<int32_t>(DoubleToUint32(n)))); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithNaNConstant1) { | 447 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithNaNConstant1) { |
448 Reduction reduction = | 448 Reduction reduction = |
449 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), | 449 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), |
450 NumberConstant(-base::OS::nan_value()))); | 450 NumberConstant(-base::OS::nan_value()))); |
451 ASSERT_TRUE(reduction.Changed()); | 451 ASSERT_TRUE(reduction.Changed()); |
452 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0)); | 452 EXPECT_THAT(reduction.replacement(), IsInt32Constant(0)); |
(...skipping 10 matching lines...) Expand all Loading... |
463 | 463 |
464 | 464 |
465 // ----------------------------------------------------------------------------- | 465 // ----------------------------------------------------------------------------- |
466 // ChangeUint32ToTagged | 466 // ChangeUint32ToTagged |
467 | 467 |
468 | 468 |
469 TEST_F(SimplifiedOperatorReducerTest, ChangeUint32ToTagged) { | 469 TEST_F(SimplifiedOperatorReducerTest, ChangeUint32ToTagged) { |
470 TRACED_FOREACH(uint32_t, n, kUint32Values) { | 470 TRACED_FOREACH(uint32_t, n, kUint32Values) { |
471 Reduction reduction = | 471 Reduction reduction = |
472 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), | 472 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), |
473 Int32Constant(BitCast<int32_t>(n)))); | 473 Int32Constant(bit_cast<int32_t>(n)))); |
474 ASSERT_TRUE(reduction.Changed()); | 474 ASSERT_TRUE(reduction.Changed()); |
475 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); | 475 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 } // namespace compiler | 479 } // namespace compiler |
480 } // namespace internal | 480 } // namespace internal |
481 } // namespace v8 | 481 } // namespace v8 |
OLD | NEW |