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

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

Issue 62443002: VM: Fix double comparisons using != and NaN in optimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1703
1704 // EmitBranchOnCondition expects ordering to be described by CMPRES1, CMPRES2. 1704 // EmitBranchOnCondition expects ordering to be described by CMPRES1, CMPRES2.
1705 branch->EmitBranchOnCondition(this, EQ); 1705 branch->EmitBranchOnCondition(this, EQ);
1706 } 1706 }
1707 1707
1708 1708
1709 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition, 1709 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1710 FpuRegister left, 1710 FpuRegister left,
1711 FpuRegister right, 1711 FpuRegister right,
1712 Register result) { 1712 Register result) {
1713 Label done; 1713 Label done, is_true;
1714 Label* nan_label = (true_condition == NE) ? &is_true : &done;
1714 __ Comment("DoubleCompareBool"); 1715 __ Comment("DoubleCompareBool");
1715 assembler()->LoadObject(result, Bool::False()); 1716 assembler()->LoadObject(result, Bool::False());
1716 assembler()->cund(left, right); 1717 assembler()->cund(left, right);
1717 assembler()->bc1t(&done); 1718 assembler()->bc1t(nan_label);
1718 1719
1719 switch (true_condition) { 1720 switch (true_condition) {
1720 case EQ: assembler()->ceqd(left, right); break; 1721 case EQ: assembler()->ceqd(left, right); break;
1721 case NE: assembler()->ceqd(left, right); break; 1722 case NE: assembler()->ceqd(left, right); break;
1722 case LT: assembler()->coltd(left, right); break; 1723 case LT: assembler()->coltd(left, right); break;
1723 case LE: assembler()->coled(left, right); break; 1724 case LE: assembler()->coled(left, right); break;
1724 case GT: assembler()->coltd(right, left); break; 1725 case GT: assembler()->coltd(right, left); break;
1725 case GE: assembler()->coled(right, left); break; 1726 case GE: assembler()->coled(right, left); break;
1726 default: { 1727 default: {
1727 // Should only passing the above conditions to this function. 1728 // Should only passing the above conditions to this function.
1728 UNREACHABLE(); 1729 UNREACHABLE();
1729 break; 1730 break;
1730 } 1731 }
1731 } 1732 }
1732 1733
1733 if (true_condition == NE) { 1734 if (true_condition == NE) {
1734 assembler()->bc1t(&done); // False is already in result. 1735 assembler()->bc1t(&done); // False is already in result.
1735 } else { 1736 } else {
1736 assembler()->bc1f(&done); 1737 assembler()->bc1f(&done);
1737 } 1738 }
1739 assembler()->Bind(&is_true);
1738 assembler()->LoadObject(result, Bool::True()); 1740 assembler()->LoadObject(result, Bool::True());
1739 assembler()->Bind(&done); 1741 assembler()->Bind(&done);
1740 } 1742 }
1741 1743
1742 1744
1743 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1745 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1744 intptr_t index_scale, 1746 intptr_t index_scale,
1745 Register array, 1747 Register array,
1746 intptr_t index) { 1748 intptr_t index) {
1747 UNREACHABLE(); 1749 UNREACHABLE();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 __ AddImmediate(SP, kDoubleSize); 2001 __ AddImmediate(SP, kDoubleSize);
2000 } 2002 }
2001 2003
2002 2004
2003 #undef __ 2005 #undef __
2004 2006
2005 2007
2006 } // namespace dart 2008 } // namespace dart
2007 2009
2008 #endif // defined TARGET_ARCH_MIPS 2010 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698