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 "test/cctest/cctest.h" | 5 #include "test/cctest/cctest.h" |
6 #include "test/cctest/compiler/codegen-tester.h" | 6 #include "test/cctest/compiler/codegen-tester.h" |
7 #include "test/cctest/compiler/value-helper.h" | 7 #include "test/cctest/compiler/value-helper.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 : eq_constant) | 450 : eq_constant) |
451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant | 451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant |
452 : ne_constant); | 452 : ne_constant); |
453 CHECK_EQ(expected, m.Call()); | 453 CHECK_EQ(expected, m.Call()); |
454 } | 454 } |
455 } | 455 } |
456 } | 456 } |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
| 460 #if V8_TARGET_ARCH_64_BIT |
| 461 TEST(BranchCombineWord64EqualZeroPhi) { |
| 462 // Test combining a branch with a Word64Equal between a phi node and 0. |
| 463 RawMachineAssemblerTester<int32_t> m(MachineType::AnyTagged()); |
| 464 uintptr_t something = 0x100000000; |
| 465 uintptr_t null = 0; |
| 466 |
| 467 Node* p0 = m.Parameter(0); |
| 468 |
| 469 RawMachineLabel is_null, is_not_null, merge; |
| 470 m.Branch(m.IntPtrEqual(p0, m.IntPtrConstant(0)), &is_null, &is_not_null); |
| 471 m.Bind(&is_not_null); |
| 472 Node* val = m.Load(MachineType::AnyTagged(), p0); |
| 473 m.Goto(&merge); |
| 474 m.Bind(&is_null); |
| 475 Node* fail_val = m.IntPtrConstant(0); |
| 476 m.Goto(&merge); |
| 477 |
| 478 m.Bind(&merge); |
| 479 Node* phi = m.Phi(MachineRepresentation::kTagged, val, fail_val); |
| 480 |
| 481 RawMachineLabel pass, fail; |
| 482 m.Branch(m.IntPtrEqual(phi, m.IntPtrConstant(0)), &pass, &fail); |
| 483 m.Bind(&pass); |
| 484 m.Return(m.Int32Constant(0)); |
| 485 m.Bind(&fail); |
| 486 m.Return(m.Int32Constant(1)); |
| 487 |
| 488 CHECK_EQ(1, m.Call(reinterpret_cast<v8::internal::Object*>(&something))); |
| 489 CHECK_EQ(0, m.Call(reinterpret_cast<v8::internal::Object*>(&null))); |
| 490 CHECK_EQ(0, m.Call(static_cast<v8::internal::Object*>(nullptr))); |
| 491 } |
| 492 |
| 493 #endif |
| 494 |
460 } // namespace compiler | 495 } // namespace compiler |
461 } // namespace internal | 496 } // namespace internal |
462 } // namespace v8 | 497 } // namespace v8 |
OLD | NEW |