| 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) { | 552 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) { |
| 553 return false; | 553 return false; |
| 554 } | 554 } |
| 555 | 555 |
| 556 | 556 |
| 557 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) { | 557 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) { |
| 558 return false; | 558 return false; |
| 559 } | 559 } |
| 560 | 560 |
| 561 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) { |
| 562 Label fall_through; |
| 563 TestByteArrayIndex(assembler, &fall_through); |
| 564 // After TestByteArrayIndex: |
| 565 // * EAX has the base address of the byte array. |
| 566 // * EBX has the index into the array. |
| 567 // EBX contains the SMI index which is shifted left by 1. |
| 568 // This shift means we only multiply the index by 2 not 4 (sizeof float). |
| 569 // Load single precision float into XMM7. |
| 570 __ movss(XMM7, FieldAddress(EAX, EBX, TIMES_2, |
| 571 Float32Array::data_offset())); |
| 572 // Convert into a double precision float. |
| 573 __ cvtss2sd(XMM7, XMM7); |
| 574 // Allocate a double instance. |
| 575 const Class& double_class = Class::Handle( |
| 576 Isolate::Current()->object_store()->double_class()); |
| 577 AssemblerMacros::TryAllocate(assembler, |
| 578 double_class, |
| 579 &fall_through, |
| 580 Assembler::kNearJump, EAX); |
| 581 // Store XMM7 into double instance. |
| 582 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM7); |
| 583 __ ret(); |
| 584 __ Bind(&fall_through); |
| 585 return false; |
| 586 } |
| 587 |
| 588 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) { |
| 589 return false; |
| 590 } |
| 561 | 591 |
| 562 // Tests if two top most arguments are smis, jumps to label not_smi if not. | 592 // Tests if two top most arguments are smis, jumps to label not_smi if not. |
| 563 // Topmost argument is in EAX. | 593 // Topmost argument is in EAX. |
| 564 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { | 594 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { |
| 565 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 595 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
| 566 __ movl(EBX, Address(ESP, + 2 * kWordSize)); | 596 __ movl(EBX, Address(ESP, + 2 * kWordSize)); |
| 567 __ orl(EBX, EAX); | 597 __ orl(EBX, EAX); |
| 568 __ testl(EBX, Immediate(kSmiTagMask)); | 598 __ testl(EBX, Immediate(kSmiTagMask)); |
| 569 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); | 599 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); |
| 570 } | 600 } |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 __ Bind(&is_true); | 1460 __ Bind(&is_true); |
| 1431 __ LoadObject(EAX, bool_true); | 1461 __ LoadObject(EAX, bool_true); |
| 1432 __ ret(); | 1462 __ ret(); |
| 1433 return true; | 1463 return true; |
| 1434 } | 1464 } |
| 1435 | 1465 |
| 1436 #undef __ | 1466 #undef __ |
| 1437 } // namespace dart | 1467 } // namespace dart |
| 1438 | 1468 |
| 1439 #endif // defined TARGET_ARCH_IA32 | 1469 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |