| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 bt.AddReturn(bt.param1); | 556 bt.AddReturn(bt.param1); |
| 557 | 557 |
| 558 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(666, *i)); } | 558 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(666, *i)); } |
| 559 } | 559 } |
| 560 | 560 |
| 561 { | 561 { |
| 562 RawMachineAssemblerTester<int32_t> m; | 562 RawMachineAssemblerTester<int32_t> m; |
| 563 Float64BinopTester bt(&m); | 563 Float64BinopTester bt(&m); |
| 564 bt.AddReturn(bt.param0); | 564 bt.AddReturn(bt.param0); |
| 565 | 565 |
| 566 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(*i, 9.0)); } | 566 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(*i, 9.0)); } |
| 567 } | 567 } |
| 568 | 568 |
| 569 { | 569 { |
| 570 RawMachineAssemblerTester<int32_t> m; | 570 RawMachineAssemblerTester<int32_t> m; |
| 571 Float64BinopTester bt(&m); | 571 Float64BinopTester bt(&m); |
| 572 bt.AddReturn(bt.param1); | 572 bt.AddReturn(bt.param1); |
| 573 | 573 |
| 574 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(-11.25, *i)); } | 574 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(-11.25, *i)); } |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 | 577 |
| 578 | 578 |
| 579 #if V8_TARGET_ARCH_64_BIT | 579 #if V8_TARGET_ARCH_64_BIT |
| 580 // TODO(ahaas): run int64 tests on all platforms when supported. | 580 // TODO(ahaas): run int64 tests on all platforms when supported. |
| 581 TEST(RunBufferedRawMachineAssemblerTesterTester) { | 581 TEST(RunBufferedRawMachineAssemblerTesterTester) { |
| 582 { | 582 { |
| 583 BufferedRawMachineAssemblerTester<int64_t> m; | 583 BufferedRawMachineAssemblerTester<int64_t> m; |
| 584 m.Return(m.Int64Constant(0x12500000000)); | 584 m.Return(m.Int64Constant(0x12500000000)); |
| 585 CHECK_EQ(0x12500000000, m.Call()); | 585 CHECK_EQ(0x12500000000, m.Call()); |
| 586 } | 586 } |
| 587 { | 587 { |
| 588 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | 588 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
| 589 m.Return(m.Parameter(0)); | 589 m.Return(m.Parameter(0)); |
| 590 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, m.Call(*i)); } | 590 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, m.Call(*i)); } |
| 591 } | 591 } |
| 592 { | 592 { |
| 593 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(), | 593 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(), |
| 594 MachineType::Int64()); | 594 MachineType::Int64()); |
| 595 m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1))); | 595 m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1))); |
| 596 FOR_INT64_INPUTS(i) { | 596 FOR_INT64_INPUTS(i) { |
| 597 FOR_INT64_INPUTS(j) { | 597 FOR_INT64_INPUTS(j) { |
| 598 CHECK_EQ(*i + *j, m.Call(*i, *j)); | 598 CHECK_EQ(*i + *j, m.Call(*i, *j)); |
| 599 CHECK_EQ(*j + *i, m.Call(*j, *i)); | 599 CHECK_EQ(*j + *i, m.Call(*j, *i)); |
| 600 } | 600 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 CHECK_EQ(0x12500000000, result); | 640 CHECK_EQ(0x12500000000, result); |
| 641 } | 641 } |
| 642 { | 642 { |
| 643 BufferedRawMachineAssemblerTester<void> m(MachineType::Float64()); | 643 BufferedRawMachineAssemblerTester<void> m(MachineType::Float64()); |
| 644 double result; | 644 double result; |
| 645 m.Store(MachineTypeForC<double>().representation(), | 645 m.Store(MachineTypeForC<double>().representation(), |
| 646 m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier); | 646 m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier); |
| 647 m.Return(m.Int32Constant(0)); | 647 m.Return(m.Int32Constant(0)); |
| 648 FOR_FLOAT64_INPUTS(i) { | 648 FOR_FLOAT64_INPUTS(i) { |
| 649 m.Call(*i); | 649 m.Call(*i); |
| 650 CheckDoubleEq(*i, result); | 650 CHECK_DOUBLE_EQ(*i, result); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 { | 653 { |
| 654 BufferedRawMachineAssemblerTester<void> m(MachineType::Int64(), | 654 BufferedRawMachineAssemblerTester<void> m(MachineType::Int64(), |
| 655 MachineType::Int64()); | 655 MachineType::Int64()); |
| 656 int64_t result; | 656 int64_t result; |
| 657 m.Store(MachineTypeForC<int64_t>().representation(), | 657 m.Store(MachineTypeForC<int64_t>().representation(), |
| 658 m.PointerConstant(&result), | 658 m.PointerConstant(&result), |
| 659 m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier); | 659 m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier); |
| 660 m.Return(m.Int32Constant(0)); | 660 m.Return(m.Int32Constant(0)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 CHECK_EQ(*j + *i + *i + *i, result); | 717 CHECK_EQ(*j + *i + *i + *i, result); |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 #endif | 723 #endif |
| 724 } // namespace compiler | 724 } // namespace compiler |
| 725 } // namespace internal | 725 } // namespace internal |
| 726 } // namespace v8 | 726 } // namespace v8 |
| OLD | NEW |