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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | tests/language/double_nan_comparison_test.dart » ('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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 branch->EmitBranchOnCondition(this, true_condition); 1652 branch->EmitBranchOnCondition(this, true_condition);
1653 } 1653 }
1654 1654
1655 1655
1656 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition, 1656 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1657 FpuRegister left, 1657 FpuRegister left,
1658 FpuRegister right, 1658 FpuRegister right,
1659 Register result) { 1659 Register result) {
1660 assembler()->comisd(left, right); 1660 assembler()->comisd(left, right);
1661 Label is_false, is_true, done; 1661 Label is_false, is_true, done;
1662 assembler()->j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN false; 1662 // x == NaN -> false, x != NaN -> true.
1663 Label* nan_label = (true_condition == NOT_EQUAL) ? &is_true : &is_false;
1664 assembler()->j(PARITY_EVEN, nan_label, Assembler::kNearJump);
1663 assembler()->j(true_condition, &is_true, Assembler::kNearJump); 1665 assembler()->j(true_condition, &is_true, Assembler::kNearJump);
1664 assembler()->Bind(&is_false); 1666 assembler()->Bind(&is_false);
1665 assembler()->LoadObject(result, Bool::False(), PP); 1667 assembler()->LoadObject(result, Bool::False(), PP);
1666 assembler()->jmp(&done); 1668 assembler()->jmp(&done);
1667 assembler()->Bind(&is_true); 1669 assembler()->Bind(&is_true);
1668 assembler()->LoadObject(result, Bool::True(), PP); 1670 assembler()->LoadObject(result, Bool::True(), PP);
1669 assembler()->Bind(&done); 1671 assembler()->Bind(&done);
1670 } 1672 }
1671 1673
1672 1674
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 __ movups(reg, Address(RSP, 0)); 1930 __ movups(reg, Address(RSP, 0));
1929 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1931 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1930 } 1932 }
1931 1933
1932 1934
1933 #undef __ 1935 #undef __
1934 1936
1935 } // namespace dart 1937 } // namespace dart
1936 1938
1937 #endif // defined TARGET_ARCH_X64 1939 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | tests/language/double_nan_comparison_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698