OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 __ SmiUntag(T0); | 477 __ SmiUntag(T0); |
478 __ addu(T1, T1, T0); | 478 __ addu(T1, T1, T0); |
479 __ lbu(V0, Address(T1, 0)); | 479 __ lbu(V0, Address(T1, 0)); |
480 __ Ret(); | 480 __ Ret(); |
481 __ delay_slot()->SmiTag(V0); | 481 __ delay_slot()->SmiTag(V0); |
482 | 482 |
483 __ Bind(&fall_through); | 483 __ Bind(&fall_through); |
484 } | 484 } |
485 | 485 |
486 | 486 |
| 487 void Intrinsifier::Float64Array_getIndexed(Assembler* assembler) { |
| 488 Label fall_through; |
| 489 |
| 490 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. |
| 491 |
| 492 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 493 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. |
| 494 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. |
| 495 |
| 496 // Range check. |
| 497 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); |
| 498 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 499 |
| 500 Address element_address = |
| 501 __ ElementAddressForRegIndex(true, // Load. |
| 502 false, // Not external. |
| 503 kTypedDataFloat64ArrayCid, // Cid. |
| 504 8, // Index scale. |
| 505 T1, // Array. |
| 506 T0); // Index. |
| 507 |
| 508 __ LoadDFromOffset(D0, element_address.base(), element_address.offset()); |
| 509 |
| 510 const Class& double_class = Class::Handle( |
| 511 Isolate::Current()->object_store()->double_class()); |
| 512 __ TryAllocate(double_class, |
| 513 &fall_through, |
| 514 V0, // Result register. |
| 515 T1); |
| 516 __ StoreDToOffset(D0, V0, Double::value_offset() - kHeapObjectTag); |
| 517 __ Ret(); |
| 518 __ Bind(&fall_through); |
| 519 } |
| 520 |
| 521 |
| 522 void Intrinsifier::Float64Array_setIndexed(Assembler* assembler) { |
| 523 Label fall_through; |
| 524 |
| 525 __ lw(T0, Address(SP, + 1 * kWordSize)); // Index. |
| 526 |
| 527 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 528 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. |
| 529 __ delay_slot()->lw(T1, Address(SP, + 2 * kWordSize)); // Array. |
| 530 |
| 531 // Range check. |
| 532 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); |
| 533 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 534 |
| 535 __ lw(T2, Address(SP, + 0 * kWordSize)); // Value. |
| 536 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); |
| 537 __ beq(CMPRES1, ZR, &fall_through); // Value is a Smi. Fall through. |
| 538 |
| 539 __ LoadClassId(T3, T2); |
| 540 __ BranchNotEqual(T3, kDoubleCid, &fall_through); // Not a Double. |
| 541 |
| 542 __ LoadDFromOffset(D0, T2, Double::value_offset() - kHeapObjectTag); |
| 543 |
| 544 Address element_address = |
| 545 __ ElementAddressForRegIndex(false, // Store. |
| 546 false, // Not external. |
| 547 kTypedDataFloat64ArrayCid, // Cid. |
| 548 8, // Index scale. |
| 549 T1, // Array. |
| 550 T0); // Index. |
| 551 __ StoreDToOffset(D0, element_address.base(), element_address.offset()); |
| 552 __ Ret(); |
| 553 __ Bind(&fall_through); |
| 554 } |
| 555 |
| 556 |
487 static int GetScaleFactor(intptr_t size) { | 557 static int GetScaleFactor(intptr_t size) { |
488 switch (size) { | 558 switch (size) { |
489 case 1: return 0; | 559 case 1: return 0; |
490 case 2: return 1; | 560 case 2: return 1; |
491 case 4: return 2; | 561 case 4: return 2; |
492 case 8: return 3; | 562 case 8: return 3; |
493 case 16: return 4; | 563 case 16: return 4; |
494 } | 564 } |
495 UNREACHABLE(); | 565 UNREACHABLE(); |
496 return -1; | 566 return -1; |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 Isolate* isolate = Isolate::Current(); | 1816 Isolate* isolate = Isolate::Current(); |
1747 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 1817 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
1748 // Set return value. | 1818 // Set return value. |
1749 __ Ret(); | 1819 __ Ret(); |
1750 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 1820 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
1751 } | 1821 } |
1752 | 1822 |
1753 } // namespace dart | 1823 } // namespace dart |
1754 | 1824 |
1755 #endif // defined TARGET_ARCH_MIPS | 1825 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |