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

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

Issue 11568044: Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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_x64.cc ('k') | tests/standalone/double_to_int_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/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 } 1385 }
1386 1386
1387 1387
1388 bool Intrinsifier::Double_toInt(Assembler* assembler) { 1388 bool Intrinsifier::Double_toInt(Assembler* assembler) {
1389 __ movq(RAX, Address(RSP, +1 * kWordSize)); 1389 __ movq(RAX, Address(RSP, +1 * kWordSize));
1390 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); 1390 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset()));
1391 __ cvttsd2siq(RAX, XMM0); 1391 __ cvttsd2siq(RAX, XMM0);
1392 // Overflow is signalled with minint. 1392 // Overflow is signalled with minint.
1393 Label fall_through; 1393 Label fall_through;
1394 // Check for overflow and that it fits into Smi. 1394 // Check for overflow and that it fits into Smi.
1395 __ cmpq(RAX, Immediate(0xC000000000000000)); 1395 __ movq(TMP, RAX);
Vyacheslav Egorov (Google) 2012/12/18 11:45:10 I thought only Assembler could use TMP?
srdjan 2012/12/18 16:29:47 You are correct. Switched to using RCX instead.
1396 __ j(NEGATIVE, &fall_through, Assembler::kNearJump); 1396 __ shlq(TMP, Immediate(1));
1397 __ j(OVERFLOW, &fall_through, Assembler::kNearJump);
1397 __ SmiTag(RAX); 1398 __ SmiTag(RAX);
1398 __ ret(); 1399 __ ret();
1399 __ Bind(&fall_through); 1400 __ Bind(&fall_through);
1400 return false; 1401 return false;
1401 } 1402 }
1402 1403
1403 1404
1404 bool Intrinsifier::Math_sqrt(Assembler* assembler) { 1405 bool Intrinsifier::Math_sqrt(Assembler* assembler) {
1405 Label fall_through, is_smi, double_op; 1406 Label fall_through, is_smi, double_op;
1406 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); 1407 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 __ LoadObject(RAX, bool_true); 1608 __ LoadObject(RAX, bool_true);
1608 __ ret(); 1609 __ ret();
1609 return true; 1610 return true;
1610 } 1611 }
1611 1612
1612 #undef __ 1613 #undef __
1613 1614
1614 } // namespace dart 1615 } // namespace dart
1615 1616
1616 #endif // defined TARGET_ARCH_X64 1617 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | tests/standalone/double_to_int_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698