| OLD | NEW |
| 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) { | 563 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) { |
| 564 Label fall_through; | 564 Label fall_through; |
| 565 TestByteArraySetIndex(assembler, &fall_through); | 565 TestByteArraySetIndex(assembler, &fall_through); |
| 566 // After TestByteArraySetIndex: | 566 // After TestByteArraySetIndex: |
| 567 // * RAX has the base address of the byte array. | 567 // * RAX has the base address of the byte array. |
| 568 // * R12 has the index into the array. | 568 // * R12 has the index into the array. |
| 569 // R12 contains the SMI index which is shifted by 1. | 569 // R12 contains the SMI index which is shifted by 1. |
| 570 // This shift means we only multiply the index by 2 not 4 (sizeof float). | 570 // This shift means we only multiply the index by 2 not 4 (sizeof float). |
| 571 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 571 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
| 572 // If RDX is not an instance of double, jump to fall through. | 572 // If RDX is not an instance of double, jump to fall through. |
| 573 __ testq(RDX, Immediate(kSmiTagMask)); |
| 574 __ j(ZERO, &fall_through, Assembler::kNearJump); |
| 573 __ CompareClassId(RDX, kDoubleCid); | 575 __ CompareClassId(RDX, kDoubleCid); |
| 574 __ j(NOT_EQUAL, &fall_through); | 576 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 575 // Load double value into XMM7. | 577 // Load double value into XMM7. |
| 576 __ movsd(XMM7, FieldAddress(RDX, Double::value_offset())); | 578 __ movsd(XMM7, FieldAddress(RDX, Double::value_offset())); |
| 577 // Convert from double precision float to single precision float. | 579 // Convert from double precision float to single precision float. |
| 578 __ cvtsd2ss(XMM7, XMM7); | 580 __ cvtsd2ss(XMM7, XMM7); |
| 579 // Store into array. | 581 // Store into array. |
| 580 __ movss(FieldAddress(RAX, R12, TIMES_2, Float32Array::data_offset()), XMM7); | 582 __ movss(FieldAddress(RAX, R12, TIMES_2, Float32Array::data_offset()), XMM7); |
| 581 // End fast path. | 583 // End fast path. |
| 582 __ ret(); | 584 __ ret(); |
| 583 __ Bind(&fall_through); | 585 __ Bind(&fall_through); |
| 584 return false; | 586 return false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 614 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) { | 616 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) { |
| 615 Label fall_through; | 617 Label fall_through; |
| 616 TestByteArraySetIndex(assembler, &fall_through); | 618 TestByteArraySetIndex(assembler, &fall_through); |
| 617 // After TestByteArraySetIndex: | 619 // After TestByteArraySetIndex: |
| 618 // * RAX has the base address of the byte array. | 620 // * RAX has the base address of the byte array. |
| 619 // * R12 has the index into the array. | 621 // * R12 has the index into the array. |
| 620 // R12 contains the SMI index which is shifted by 1. | 622 // R12 contains the SMI index which is shifted by 1. |
| 621 // This shift means we only multiply the index by 4 not 8 (sizeof double). | 623 // This shift means we only multiply the index by 4 not 8 (sizeof double). |
| 622 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 624 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
| 623 // If RDX is not an instance of double, jump to fall through. | 625 // If RDX is not an instance of double, jump to fall through. |
| 626 __ testq(RDX, Immediate(kSmiTagMask)); |
| 627 __ j(ZERO, &fall_through, Assembler::kNearJump); |
| 624 __ CompareClassId(RDX, kDoubleCid); | 628 __ CompareClassId(RDX, kDoubleCid); |
| 625 __ j(NOT_EQUAL, &fall_through); | 629 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 626 // Load double value into XMM7. | 630 // Load double value into XMM7. |
| 627 __ movsd(XMM7, FieldAddress(RDX, Double::value_offset())); | 631 __ movsd(XMM7, FieldAddress(RDX, Double::value_offset())); |
| 628 // Store into array. | 632 // Store into array. |
| 629 __ movsd(FieldAddress(RAX, R12, TIMES_4, Float64Array::data_offset()), XMM7); | 633 __ movsd(FieldAddress(RAX, R12, TIMES_4, Float64Array::data_offset()), XMM7); |
| 630 __ ret(); | 634 __ ret(); |
| 631 __ Bind(&fall_through); | 635 __ Bind(&fall_through); |
| 632 return false; | 636 return false; |
| 633 } | 637 } |
| 634 | 638 |
| 635 | 639 |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 __ LoadObject(RAX, bool_true); | 1504 __ LoadObject(RAX, bool_true); |
| 1501 __ ret(); | 1505 __ ret(); |
| 1502 return true; | 1506 return true; |
| 1503 } | 1507 } |
| 1504 | 1508 |
| 1505 #undef __ | 1509 #undef __ |
| 1506 | 1510 |
| 1507 } // namespace dart | 1511 } // namespace dart |
| 1508 | 1512 |
| 1509 #endif // defined TARGET_ARCH_X64 | 1513 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |