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

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

Issue 10828189: Do not silently convert integers to doubles in binary operations. Only when at least one of argumen… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/double_int_addition_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 __ popq(right); 1760 __ popq(right);
1761 __ popq(left); 1761 __ popq(left);
1762 1762
1763 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 1763 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
1764 instance_call()->token_pos(), 1764 instance_call()->token_pos(),
1765 instance_call()->try_index(), 1765 instance_call()->try_index(),
1766 kDeoptDoubleBinaryOp, 1766 kDeoptDoubleBinaryOp,
1767 left, 1767 left,
1768 right); 1768 right);
1769 1769
1770 // Binary operation of two Smi's produces a Smi not a double.
1771 __ movq(temp, left);
1772 __ orq(temp, right);
1773 __ testq(temp, Immediate(kSmiTagMask));
1774 __ j(ZERO, deopt);
1775
1770 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); 1776 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt);
1771 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); 1777 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt);
1772 1778
1773 switch (op_kind()) { 1779 switch (op_kind()) {
1774 case Token::kADD: __ addsd(XMM0, XMM1); break; 1780 case Token::kADD: __ addsd(XMM0, XMM1); break;
1775 case Token::kSUB: __ subsd(XMM0, XMM1); break; 1781 case Token::kSUB: __ subsd(XMM0, XMM1); break;
1776 case Token::kMUL: __ mulsd(XMM0, XMM1); break; 1782 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
1777 case Token::kDIV: __ divsd(XMM0, XMM1); break; 1783 case Token::kDIV: __ divsd(XMM0, XMM1); break;
1778 default: UNREACHABLE(); 1784 default: UNREACHABLE();
1779 } 1785 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 ASSERT(locs()->out().reg() == RAX); 2109 ASSERT(locs()->out().reg() == RAX);
2104 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2110 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2105 EmitBranchOnCondition(compiler, branch_condition); 2111 EmitBranchOnCondition(compiler, branch_condition);
2106 } 2112 }
2107 2113
2108 } // namespace dart 2114 } // namespace dart
2109 2115
2110 #undef __ 2116 #undef __
2111 2117
2112 #endif // defined TARGET_ARCH_X64 2118 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/double_int_addition_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698