| 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 CHECK_EQ(*i + *i + *i + *j, m.Call(*i, *i, *i, *j)); | 625 CHECK_EQ(*i + *i + *i + *j, m.Call(*i, *i, *i, *j)); |
| 626 CHECK_EQ(*i + *i + *j + *i, m.Call(*i, *i, *j, *i)); | 626 CHECK_EQ(*i + *i + *j + *i, m.Call(*i, *i, *j, *i)); |
| 627 CHECK_EQ(*i + *j + *i + *i, m.Call(*i, *j, *i, *i)); | 627 CHECK_EQ(*i + *j + *i + *i, m.Call(*i, *j, *i, *i)); |
| 628 CHECK_EQ(*j + *i + *i + *i, m.Call(*j, *i, *i, *i)); | 628 CHECK_EQ(*j + *i + *i + *i, m.Call(*j, *i, *i, *i)); |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 { | 632 { |
| 633 BufferedRawMachineAssemblerTester<void> m; | 633 BufferedRawMachineAssemblerTester<void> m; |
| 634 int64_t result; | 634 int64_t result; |
| 635 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result), | 635 m.Store(MachineTypeForC<int64_t>().representation(), |
| 636 m.Int64Constant(0x12500000000), kNoWriteBarrier); | 636 m.PointerConstant(&result), m.Int64Constant(0x12500000000), |
| 637 kNoWriteBarrier); |
| 637 m.Return(m.Int32Constant(0)); | 638 m.Return(m.Int32Constant(0)); |
| 638 m.Call(); | 639 m.Call(); |
| 639 CHECK_EQ(0x12500000000, result); | 640 CHECK_EQ(0x12500000000, result); |
| 640 } | 641 } |
| 641 { | 642 { |
| 642 BufferedRawMachineAssemblerTester<void> m(MachineType::Float64()); | 643 BufferedRawMachineAssemblerTester<void> m(MachineType::Float64()); |
| 643 double result; | 644 double result; |
| 644 m.Store(MachineTypeForC<double>(), m.PointerConstant(&result), | 645 m.Store(MachineTypeForC<double>().representation(), |
| 645 m.Parameter(0), kNoWriteBarrier); | 646 m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier); |
| 646 m.Return(m.Int32Constant(0)); | 647 m.Return(m.Int32Constant(0)); |
| 647 FOR_FLOAT64_INPUTS(i) { | 648 FOR_FLOAT64_INPUTS(i) { |
| 648 m.Call(*i); | 649 m.Call(*i); |
| 649 CheckDoubleEq(*i, result); | 650 CheckDoubleEq(*i, result); |
| 650 } | 651 } |
| 651 } | 652 } |
| 652 { | 653 { |
| 653 BufferedRawMachineAssemblerTester<void> m(MachineType::Int64(), | 654 BufferedRawMachineAssemblerTester<void> m(MachineType::Int64(), |
| 654 MachineType::Int64()); | 655 MachineType::Int64()); |
| 655 int64_t result; | 656 int64_t result; |
| 656 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result), | 657 m.Store(MachineTypeForC<int64_t>().representation(), |
| 658 m.PointerConstant(&result), |
| 657 m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier); | 659 m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier); |
| 658 m.Return(m.Int32Constant(0)); | 660 m.Return(m.Int32Constant(0)); |
| 659 FOR_INT64_INPUTS(i) { | 661 FOR_INT64_INPUTS(i) { |
| 660 FOR_INT64_INPUTS(j) { | 662 FOR_INT64_INPUTS(j) { |
| 661 m.Call(*i, *j); | 663 m.Call(*i, *j); |
| 662 CHECK_EQ(*i + *j, result); | 664 CHECK_EQ(*i + *j, result); |
| 663 | 665 |
| 664 m.Call(*j, *i); | 666 m.Call(*j, *i); |
| 665 CHECK_EQ(*j + *i, result); | 667 CHECK_EQ(*j + *i, result); |
| 666 } | 668 } |
| 667 } | 669 } |
| 668 } | 670 } |
| 669 { | 671 { |
| 670 BufferedRawMachineAssemblerTester<void> m( | 672 BufferedRawMachineAssemblerTester<void> m( |
| 671 MachineType::Int64(), MachineType::Int64(), MachineType::Int64()); | 673 MachineType::Int64(), MachineType::Int64(), MachineType::Int64()); |
| 672 int64_t result; | 674 int64_t result; |
| 673 m.Store( | 675 m.Store( |
| 674 MachineTypeForC<int64_t>(), m.PointerConstant(&result), | 676 MachineTypeForC<int64_t>().representation(), m.PointerConstant(&result), |
| 675 m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)), | 677 m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)), |
| 676 kNoWriteBarrier); | 678 kNoWriteBarrier); |
| 677 m.Return(m.Int32Constant(0)); | 679 m.Return(m.Int32Constant(0)); |
| 678 FOR_INT64_INPUTS(i) { | 680 FOR_INT64_INPUTS(i) { |
| 679 FOR_INT64_INPUTS(j) { | 681 FOR_INT64_INPUTS(j) { |
| 680 m.Call(*i, *i, *j); | 682 m.Call(*i, *i, *j); |
| 681 CHECK_EQ(*i + *i + *j, result); | 683 CHECK_EQ(*i + *i + *j, result); |
| 682 | 684 |
| 683 m.Call(*i, *j, *i); | 685 m.Call(*i, *j, *i); |
| 684 CHECK_EQ(*i + *j + *i, result); | 686 CHECK_EQ(*i + *j + *i, result); |
| 685 | 687 |
| 686 m.Call(*j, *i, *i); | 688 m.Call(*j, *i, *i); |
| 687 CHECK_EQ(*j + *i + *i, result); | 689 CHECK_EQ(*j + *i + *i, result); |
| 688 } | 690 } |
| 689 } | 691 } |
| 690 } | 692 } |
| 691 { | 693 { |
| 692 BufferedRawMachineAssemblerTester<void> m( | 694 BufferedRawMachineAssemblerTester<void> m( |
| 693 MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), | 695 MachineType::Int64(), MachineType::Int64(), MachineType::Int64(), |
| 694 MachineType::Int64()); | 696 MachineType::Int64()); |
| 695 int64_t result; | 697 int64_t result; |
| 696 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result), | 698 m.Store(MachineTypeForC<int64_t>().representation(), |
| 699 m.PointerConstant(&result), |
| 697 m.Int64Add(m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), | 700 m.Int64Add(m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), |
| 698 m.Parameter(2)), | 701 m.Parameter(2)), |
| 699 m.Parameter(3)), | 702 m.Parameter(3)), |
| 700 kNoWriteBarrier); | 703 kNoWriteBarrier); |
| 701 m.Return(m.Int32Constant(0)); | 704 m.Return(m.Int32Constant(0)); |
| 702 FOR_INT64_INPUTS(i) { | 705 FOR_INT64_INPUTS(i) { |
| 703 FOR_INT64_INPUTS(j) { | 706 FOR_INT64_INPUTS(j) { |
| 704 m.Call(*i, *i, *i, *j); | 707 m.Call(*i, *i, *i, *j); |
| 705 CHECK_EQ(*i + *i + *i + *j, result); | 708 CHECK_EQ(*i + *i + *i + *j, result); |
| 706 | 709 |
| 707 m.Call(*i, *i, *j, *i); | 710 m.Call(*i, *i, *j, *i); |
| 708 CHECK_EQ(*i + *i + *j + *i, result); | 711 CHECK_EQ(*i + *i + *j + *i, result); |
| 709 | 712 |
| 710 m.Call(*i, *j, *i, *i); | 713 m.Call(*i, *j, *i, *i); |
| 711 CHECK_EQ(*i + *j + *i + *i, result); | 714 CHECK_EQ(*i + *j + *i + *i, result); |
| 712 | 715 |
| 713 m.Call(*j, *i, *i, *i); | 716 m.Call(*j, *i, *i, *i); |
| 714 CHECK_EQ(*j + *i + *i + *i, result); | 717 CHECK_EQ(*j + *i + *i + *i, result); |
| 715 } | 718 } |
| 716 } | 719 } |
| 717 } | 720 } |
| 718 } | 721 } |
| 719 | 722 |
| 720 #endif | 723 #endif |
| 721 } // namespace compiler | 724 } // namespace compiler |
| 722 } // namespace internal | 725 } // namespace internal |
| 723 } // namespace v8 | 726 } // namespace v8 |
| OLD | NEW |