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

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: Fix bug, cleanup, add tests 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/deferred_objects.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 1617 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 // - CheckNull rA, D
1640 //
1641 // If D == 1, skip the following instruction when FP[rA] is non-null.
1642 // If D == 0, skip the following instruction when FP[rA] is null.
1643 ASSEMBLER_TEST_GENERATE(CheckIsNotNullSucceed, assembler) {
1644 __ Frame(2);
1645 __ LoadConstant(0, Smi::Handle(Smi::New(-1)));
1646 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1647 __ CheckNull(0, 1);
1648 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1649 __ Return(1);
1650 }
1651
1652
1653 ASSEMBLER_TEST_RUN(CheckIsNotNullSucceed, test) {
1654 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1655 }
1656
1657
1658 ASSEMBLER_TEST_GENERATE(CheckIsNotNullFail, assembler) {
1659 __ Frame(2);
1660 __ LoadConstant(0, Object::null_object());
1661 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1662 __ CheckNull(0, 1);
1663 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1664 __ Return(1);
1665 }
1666
1667
1668 ASSEMBLER_TEST_RUN(CheckIsNotNullFail, test) {
1669 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1670 }
1671
1672
1673 ASSEMBLER_TEST_GENERATE(CheckIsNullSucceed, assembler) {
1674 __ Frame(2);
1675 __ LoadConstant(0, Object::null_object());
1676 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1677 __ CheckNull(0, 0);
1678 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1679 __ Return(1);
1680 }
1681
1682
1683 ASSEMBLER_TEST_RUN(CheckIsNullSucceed, test) {
1684 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code()));
1685 }
1686
1687
1688 ASSEMBLER_TEST_GENERATE(CheckIsNullFail, assembler) {
1689 __ Frame(2);
1690 __ LoadConstant(0, Smi::Handle(Smi::New(-1)));
1691 __ LoadConstant(1, Smi::Handle(Smi::New(-1)));
1692 __ CheckNull(0, 0);
1693 __ LoadConstant(1, Smi::Handle(Smi::New(42)));
1694 __ Return(1);
1695 }
1696
1697
1698 ASSEMBLER_TEST_RUN(CheckIsNullFail, 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/deferred_objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698