| 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/simplified-operator.h" | 5 #include "src/compiler/simplified-operator.h" |
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 #include "src/compiler/simplified-operator-reducer.h" | 9 #include "src/compiler/simplified-operator-reducer.h" |
| 10 #include "src/compiler/types.h" | 10 #include "src/compiler/types.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { | 329 TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { |
| 330 TRACED_FOREACH(double, n, kFloat64Values) { | 330 TRACED_FOREACH(double, n, kFloat64Values) { |
| 331 Reduction reduction = Reduce(graph()->NewNode( | 331 Reduction reduction = Reduce(graph()->NewNode( |
| 332 simplified()->TruncateTaggedToWord32(), NumberConstant(n))); | 332 simplified()->TruncateTaggedToWord32(), NumberConstant(n))); |
| 333 ASSERT_TRUE(reduction.Changed()); | 333 ASSERT_TRUE(reduction.Changed()); |
| 334 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n))); | 334 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n))); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 // ----------------------------------------------------------------------------- | 338 // ----------------------------------------------------------------------------- |
| 339 // CheckedFloat64ToInt32 |
| 340 |
| 341 TEST_F(SimplifiedOperatorReducerTest, CheckedFloat64ToInt32WithConstant) { |
| 342 Node* effect = graph()->start(); |
| 343 Node* control = graph()->start(); |
| 344 TRACED_FOREACH(int32_t, n, kInt32Values) { |
| 345 Reduction r = Reduce( |
| 346 graph()->NewNode(simplified()->CheckedFloat64ToInt32( |
| 347 CheckForMinusZeroMode::kDontCheckForMinusZero), |
| 348 Float64Constant(n), effect, control)); |
| 349 ASSERT_TRUE(r.Changed()); |
| 350 EXPECT_THAT(r.replacement(), IsInt32Constant(n)); |
| 351 } |
| 352 } |
| 353 |
| 354 // ----------------------------------------------------------------------------- |
| 339 // CheckHeapObject | 355 // CheckHeapObject |
| 340 | 356 |
| 341 TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithChangeBitToTagged) { | 357 TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithChangeBitToTagged) { |
| 342 Node* param0 = Parameter(0); | 358 Node* param0 = Parameter(0); |
| 343 Node* effect = graph()->start(); | 359 Node* effect = graph()->start(); |
| 344 Node* control = graph()->start(); | 360 Node* control = graph()->start(); |
| 345 Node* value = graph()->NewNode(simplified()->ChangeBitToTagged(), param0); | 361 Node* value = graph()->NewNode(simplified()->ChangeBitToTagged(), param0); |
| 346 Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), | 362 Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), |
| 347 value, effect, control)); | 363 value, effect, control)); |
| 348 ASSERT_TRUE(reduction.Changed()); | 364 ASSERT_TRUE(reduction.Changed()); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 Reduction reduction = Reduce( | 480 Reduction reduction = Reduce( |
| 465 graph()->NewNode(simplified()->ObjectIsSmi(), NumberConstant(n))); | 481 graph()->NewNode(simplified()->ObjectIsSmi(), NumberConstant(n))); |
| 466 ASSERT_TRUE(reduction.Changed()); | 482 ASSERT_TRUE(reduction.Changed()); |
| 467 EXPECT_THAT(reduction.replacement(), IsBooleanConstant(IsSmiDouble(n))); | 483 EXPECT_THAT(reduction.replacement(), IsBooleanConstant(IsSmiDouble(n))); |
| 468 } | 484 } |
| 469 } | 485 } |
| 470 | 486 |
| 471 } // namespace compiler | 487 } // namespace compiler |
| 472 } // namespace internal | 488 } // namespace internal |
| 473 } // namespace v8 | 489 } // namespace v8 |
| OLD | NEW |