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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 } 1617 }
1618 1618
1619 1619
1620 1620
1621 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition, 1621 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1622 FpuRegister left, 1622 FpuRegister left,
1623 FpuRegister right, 1623 FpuRegister right,
1624 Register result) { 1624 Register result) {
1625 assembler()->comisd(left, right); 1625 assembler()->comisd(left, right);
1626 Label is_false, is_true, done; 1626 Label is_false, is_true, done;
1627 assembler()->j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN false; 1627 // x == NaN -> false, x != NaN -> true.
1628 Label* nan_label = (true_condition == NOT_EQUAL) ? &is_true : &is_false;
1629 assembler()->j(PARITY_EVEN, nan_label, Assembler::kNearJump);
1628 assembler()->j(true_condition, &is_true, Assembler::kNearJump); 1630 assembler()->j(true_condition, &is_true, Assembler::kNearJump);
1629 assembler()->Bind(&is_false); 1631 assembler()->Bind(&is_false);
1630 assembler()->LoadObject(result, Bool::False()); 1632 assembler()->LoadObject(result, Bool::False());
1631 assembler()->jmp(&done); 1633 assembler()->jmp(&done);
1632 assembler()->Bind(&is_true); 1634 assembler()->Bind(&is_true);
1633 assembler()->LoadObject(result, Bool::True()); 1635 assembler()->LoadObject(result, Bool::True());
1634 assembler()->Bind(&done); 1636 assembler()->Bind(&done);
1635 } 1637 }
1636 1638
1637 1639
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 __ movups(reg, Address(ESP, 0)); 1911 __ movups(reg, Address(ESP, 0));
1910 __ addl(ESP, Immediate(kFpuRegisterSize)); 1912 __ addl(ESP, Immediate(kFpuRegisterSize));
1911 } 1913 }
1912 1914
1913 1915
1914 #undef __ 1916 #undef __
1915 1917
1916 } // namespace dart 1918 } // namespace dart
1917 1919
1918 #endif // defined TARGET_ARCH_IA32 1920 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698