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

Side by Side Diff: runtime/vm/assembler_dbc_test.cc

Issue 2098573004: DBC: CheckClassInstr (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Clean up comment Created 4 years, 5 months 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
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | runtime/vm/constants_dbc.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 116
117 ASSEMBLER_TEST_RUN(Simple, test) { 117 ASSEMBLER_TEST_RUN(Simple, test) {
118 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); 118 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
119 } 119 }
120 120
121 121
122 ASSEMBLER_TEST_GENERATE(Nop, assembler) { 122 ASSEMBLER_TEST_GENERATE(Nop, assembler) {
123 __ PushConstant(Smi::Handle(Smi::New(42))); 123 __ PushConstant(Smi::Handle(Smi::New(42)));
124 __ Nop(); 124 __ Nop(0);
125 __ Nop(); 125 __ Nop(0);
126 __ Nop(); 126 __ Nop(0);
127 __ Nop(); 127 __ Nop(0);
128 __ Nop(); 128 __ Nop(0);
129 __ ReturnTOS(); 129 __ ReturnTOS();
130 } 130 }
131 131
132 132
133 ASSEMBLER_TEST_RUN(Nop, test) { 133 ASSEMBLER_TEST_RUN(Nop, test) {
134 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); 134 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
135 } 135 }
136 136
137 137
138 // Called from assembler_test.cc. 138 // Called from assembler_test.cc.
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 __ CheckClassId(0, __ AddConstant(Smi::Handle(Smi::New(kBoolCid)))); 1628 __ CheckClassId(0, __ AddConstant(Smi::Handle(Smi::New(kBoolCid))));
1629 __ LoadConstant(0, Smi::Handle(Smi::New(42))); 1629 __ LoadConstant(0, Smi::Handle(Smi::New(42)));
1630 __ Return(0); 1630 __ Return(0);
1631 } 1631 }
1632 1632
1633 1633
1634 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { 1634 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) {
1635 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); 1635 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1636 } 1636 }
1637 1637
1638
1639 // - If<Cond>Null rA
1640 //
1641 // Cond is Eq or Ne. Skips the next instruction unless the given condition
1642 // holds.
1643 ASSEMBLER_TEST_GENERATE(IfEqNullNotNull, assembler) {
1644 __ Frame(2);
1645 __ LoadConstant(0, Smi::Handle(Smi::New(-1)));
1646 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1647 __ IfEqNull(0);
1648 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1649 __ Return(1);
1650 }
1651
1652
1653 ASSEMBLER_TEST_RUN(IfEqNullNotNull, test) {
1654 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1655 }
1656
1657
1658 ASSEMBLER_TEST_GENERATE(IfEqNullIsNull, assembler) {
1659 __ Frame(2);
1660 __ LoadConstant(0, Object::null_object());
1661 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1662 __ IfEqNull(0);
1663 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1664 __ Return(1);
1665 }
1666
1667
1668 ASSEMBLER_TEST_RUN(IfEqNullIsNull, test) {
1669 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1670 }
1671
1672
1673 ASSEMBLER_TEST_GENERATE(IfNeNullIsNull, assembler) {
1674 __ Frame(2);
1675 __ LoadConstant(0, Object::null_object());
1676 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1677 __ IfNeNull(0);
1678 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1679 __ Return(1);
1680 }
1681
1682
1683 ASSEMBLER_TEST_RUN(IfNeNullIsNull, test) {
1684 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1685 }
1686
1687
1688 ASSEMBLER_TEST_GENERATE(IfNeNullNotNull, assembler) {
1689 __ Frame(2);
1690 __ LoadConstant(0, Smi::Handle(Smi::New(-1)));
1691 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1692 __ IfNeNull(0);
1693 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1694 __ Return(1);
1695 }
1696
1697
1698 ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) {
1699 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1700 }
1701
1638 } // namespace dart 1702 } // namespace dart
1639 1703
1640 #endif // defined(TARGET_ARCH_DBC) 1704 #endif // defined(TARGET_ARCH_DBC)
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | runtime/vm/constants_dbc.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698