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

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

Issue 62133002: Cleanup of branch code generation (no change in functionality). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 __ Drop(argument_count); 1659 __ Drop(argument_count);
1660 if (!is_last_check) { 1660 if (!is_last_check) {
1661 __ b(&match_found); 1661 __ b(&match_found);
1662 } 1662 }
1663 __ Bind(&next_test); 1663 __ Bind(&next_test);
1664 } 1664 }
1665 __ Bind(&match_found); 1665 __ Bind(&match_found);
1666 } 1666 }
1667 1667
1668 1668
1669 void FlowGraphCompiler::EmitDoubleCompareBranch(Condition true_condition,
1670 FpuRegister left,
1671 FpuRegister right,
1672 BranchInstr* branch) {
1673 ASSERT(branch != NULL);
1674 __ Comment("DoubleCompareBranch");
1675 assembler()->cund(left, right);
1676 BlockEntryInstr* nan_result = (true_condition == NE) ?
1677 branch->true_successor() : branch->false_successor();
1678 assembler()->bc1t(GetJumpLabel(nan_result));
1679
1680 switch (true_condition) {
1681 case EQ: assembler()->ceqd(left, right); break;
1682 case NE: assembler()->ceqd(left, right); break;
1683 case LT: assembler()->coltd(left, right); break;
1684 case LE: assembler()->coled(left, right); break;
1685 case GT: assembler()->coltd(right, left); break;
1686 case GE: assembler()->coled(right, left); break;
1687 default: {
1688 // Should only passing the above conditions to this function.
1689 UNREACHABLE();
1690 break;
1691 }
1692 }
1693
1694 assembler()->LoadImmediate(TMP, 1);
1695 if (true_condition == NE) {
1696 assembler()->movf(CMPRES1, ZR);
1697 assembler()->movt(CMPRES1, TMP);
1698 } else {
1699 assembler()->movf(CMPRES1, TMP);
1700 assembler()->movt(CMPRES1, ZR);
1701 }
1702 assembler()->mov(CMPRES2, ZR);
1703
1704 // EmitBranchOnCondition expects ordering to be described by CMPRES1, CMPRES2.
1705 branch->EmitBranchOnCondition(this, EQ);
1706 }
1707
1708
1709 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1710 FpuRegister left,
1711 FpuRegister right,
1712 Register result) {
1713 Label done, is_true;
1714 Label* nan_label = (true_condition == NE) ? &is_true : &done;
1715 __ Comment("DoubleCompareBool");
1716 assembler()->LoadObject(result, Bool::False());
1717 assembler()->cund(left, right);
1718 assembler()->bc1t(nan_label);
1719
1720 switch (true_condition) {
1721 case EQ: assembler()->ceqd(left, right); break;
1722 case NE: assembler()->ceqd(left, right); break;
1723 case LT: assembler()->coltd(left, right); break;
1724 case LE: assembler()->coled(left, right); break;
1725 case GT: assembler()->coltd(right, left); break;
1726 case GE: assembler()->coled(right, left); break;
1727 default: {
1728 // Should only passing the above conditions to this function.
1729 UNREACHABLE();
1730 break;
1731 }
1732 }
1733
1734 if (true_condition == NE) {
1735 assembler()->bc1t(&done); // False is already in result.
1736 } else {
1737 assembler()->bc1f(&done);
1738 }
1739 assembler()->Bind(&is_true);
1740 assembler()->LoadObject(result, Bool::True());
1741 assembler()->Bind(&done);
1742 }
1743
1744
1745 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1669 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1746 intptr_t index_scale, 1670 intptr_t index_scale,
1747 Register array, 1671 Register array,
1748 intptr_t index) { 1672 intptr_t index) {
1749 UNREACHABLE(); 1673 UNREACHABLE();
1750 return FieldAddress(array, index); 1674 return FieldAddress(array, index);
1751 } 1675 }
1752 1676
1753 1677
1754 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, 1678 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 __ AddImmediate(SP, kDoubleSize); 1925 __ AddImmediate(SP, kDoubleSize);
2002 } 1926 }
2003 1927
2004 1928
2005 #undef __ 1929 #undef __
2006 1930
2007 1931
2008 } // namespace dart 1932 } // namespace dart
2009 1933
2010 #endif // defined TARGET_ARCH_MIPS 1934 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698