| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 __ movl(RAX, FieldAddress(RAX, | 510 __ movl(RAX, FieldAddress(RAX, |
| 511 RBX, | 511 RBX, |
| 512 TIMES_2, | 512 TIMES_2, |
| 513 Uint32Array::data_offset())); | 513 Uint32Array::data_offset())); |
| 514 __ SmiTag(RAX); | 514 __ SmiTag(RAX); |
| 515 __ ret(); | 515 __ ret(); |
| 516 __ Bind(&fall_through); | 516 __ Bind(&fall_through); |
| 517 return false; | 517 return false; |
| 518 } | 518 } |
| 519 | 519 |
| 520 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) { |
| 521 Label fall_through; |
| 522 TestByteArrayIndex(assembler, &fall_through); |
| 523 // After TestByteArrayIndex: |
| 524 // * RAX has the base address of the byte array. |
| 525 // * RBX has the index into the array. |
| 526 // RBX contains the SMI index which is shifted left by 1. |
| 527 // This shift means we only multiply the index by 2 not 4 (sizeof float). |
| 528 // Load single precision float into XMM7. |
| 529 __ movss(XMM7, FieldAddress(RAX, RBX, TIMES_2, |
| 530 Float32Array::data_offset())); |
| 531 // Convert into a double precision float. |
| 532 __ cvtss2sd(XMM7, XMM7); |
| 533 // Allocate a double instance. |
| 534 const Class& double_class = Class::Handle( |
| 535 Isolate::Current()->object_store()->double_class()); |
| 536 AssemblerMacros::TryAllocate(assembler, |
| 537 double_class, |
| 538 &fall_through, |
| 539 Assembler::kNearJump, RAX); |
| 540 // Store XMM7 into double instance. |
| 541 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM7); |
| 542 __ ret(); |
| 543 __ Bind(&fall_through); |
| 544 return false; |
| 545 } |
| 546 |
| 547 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) { |
| 548 return false; |
| 549 } |
| 550 |
| 520 | 551 |
| 521 // Tests if two top most arguments are smis, jumps to label not_smi if not. | 552 // Tests if two top most arguments are smis, jumps to label not_smi if not. |
| 522 // Topmost argument is in RAX. | 553 // Topmost argument is in RAX. |
| 523 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { | 554 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { |
| 524 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 555 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 525 __ movq(RCX, Address(RSP, + 2 * kWordSize)); | 556 __ movq(RCX, Address(RSP, + 2 * kWordSize)); |
| 526 __ orq(RCX, RAX); | 557 __ orq(RCX, RAX); |
| 527 __ testq(RCX, Immediate(kSmiTagMask)); | 558 __ testq(RCX, Immediate(kSmiTagMask)); |
| 528 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); | 559 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); |
| 529 } | 560 } |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 __ LoadObject(RAX, bool_true); | 1416 __ LoadObject(RAX, bool_true); |
| 1386 __ ret(); | 1417 __ ret(); |
| 1387 return true; | 1418 return true; |
| 1388 } | 1419 } |
| 1389 | 1420 |
| 1390 #undef __ | 1421 #undef __ |
| 1391 | 1422 |
| 1392 } // namespace dart | 1423 } // namespace dart |
| 1393 | 1424 |
| 1394 #endif // defined TARGET_ARCH_X64 | 1425 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |