Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: test/cctest/compiler/codegen-tester.cc

Issue 1423133005: Implemented the BufferedRawMachineAssemblerTester. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adjustments to codebase changes. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 561 }
562 562
563 { 563 {
564 RawMachineAssemblerTester<int32_t> m; 564 RawMachineAssemblerTester<int32_t> m;
565 Float64BinopTester bt(&m); 565 Float64BinopTester bt(&m);
566 bt.AddReturn(bt.param1); 566 bt.AddReturn(bt.param1);
567 567
568 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(-11.25, *i)); } 568 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(-11.25, *i)); }
569 } 569 }
570 } 570 }
571
572
573 #if V8_TARGET_ARCH_64_BIT
574 // TODO(ahaas): run int64 tests on all platforms when supported.
575 TEST(RunBufferedRawMachineAssemblerTesterTester) {
576 {
577 BufferedRawMachineAssemblerTester<int64_t> m;
578 m.Return(m.Int64Constant(0x12500000000));
579 CHECK_EQ(0x12500000000, m.Call());
580 }
581 {
582 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
583 m.Return(m.Parameter(0));
584 CHECK_EQ(1.25, m.Call(1.25));
585 }
586 {
587 BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64);
588 m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
589 CHECK_EQ(0x300000000, m.Call(0x100000000, 0x200000000));
590 }
591 {
592 BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
593 kMachInt64);
594 m.Return(
595 m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
596 CHECK_EQ(0x600000000, m.Call(0x100000000, 0x200000000, 0x300000000));
titzer 2015/10/30 19:48:52 Probably want to check some real 64-bit numbers he
ahaas 2015/10/30 21:13:09 Done.
597 }
598 {
599 BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
600 kMachInt64, kMachInt64);
601 m.Return(m.Int64Add(
602 m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)),
603 m.Parameter(3)));
604 CHECK_EQ(0xa00000000,
605 m.Call(0x100000000, 0x200000000, 0x300000000, 0x400000000));
606 }
607 {
608 BufferedRawMachineAssemblerTester<void> m;
609 int64_t result;
610 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
611 m.Int64Constant(0x12500000000), kNoWriteBarrier);
612 m.Return(m.Int32Constant(0));
613 m.Call();
614 CHECK_EQ(0x12500000000, result);
615 }
616 {
617 BufferedRawMachineAssemblerTester<void> m(kMachFloat64);
618 double result;
619 m.Store(MachineTypeForC<double>(), m.PointerConstant(&result),
620 m.Parameter(0), kNoWriteBarrier);
621 m.Return(m.Int32Constant(0));
622 m.Call(1.25);
623 CHECK_EQ(1.25, result);
624 }
625 {
626 BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64);
627 int64_t result;
628 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
629 m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier);
630 m.Return(m.Int32Constant(0));
631 m.Call(0x100000000, 0x200000000);
632 CHECK_EQ(0x300000000, result);
633 }
634 {
635 BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
636 kMachInt64);
637 int64_t result;
638 m.Store(
639 MachineTypeForC<int64_t>(), m.PointerConstant(&result),
640 m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)),
641 kNoWriteBarrier);
642 m.Return(m.Int32Constant(0));
643 m.Call(0x100000000, 0x200000000, 0x300000000);
644 CHECK_EQ(0x600000000, result);
645 }
646 {
647 BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
648 kMachInt64, kMachInt64);
649 int64_t result;
650 m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
651 m.Int64Add(m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)),
652 m.Parameter(2)),
653 m.Parameter(3)),
654 kNoWriteBarrier);
655 m.Return(m.Int32Constant(0));
656 m.Call(0x100000000, 0x200000000, 0x300000000, 0x400000000);
657 CHECK_EQ(0xa00000000, result);
658 }
659 }
660
661 #endif
OLDNEW
« test/cctest/compiler/codegen-tester.h ('K') | « test/cctest/compiler/codegen-tester.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698