| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 | 400 |
| 401 // Gets the length of a TypedData. | 401 // Gets the length of a TypedData. |
| 402 void Intrinsifier::TypedDataLength(Assembler* assembler) { | 402 void Intrinsifier::TypedDataLength(Assembler* assembler) { |
| 403 __ lw(T0, Address(SP, 0 * kWordSize)); | 403 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 404 __ Ret(); | 404 __ Ret(); |
| 405 __ delay_slot()->lw(V0, FieldAddress(T0, TypedData::length_offset())); | 405 __ delay_slot()->lw(V0, FieldAddress(T0, TypedData::length_offset())); |
| 406 } | 406 } |
| 407 | 407 |
| 408 | 408 |
| 409 void Intrinsifier::Uint8ArrayGetIndexed(Assembler* assembler) { | |
| 410 Label fall_through; | |
| 411 | |
| 412 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. | |
| 413 | |
| 414 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | |
| 415 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. | |
| 416 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. | |
| 417 | |
| 418 // Range check. | |
| 419 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); | |
| 420 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); | |
| 421 | |
| 422 __ SmiUntag(T0); | |
| 423 __ addu(T1, T1, T0); | |
| 424 __ lbu(V0, FieldAddress(T1, TypedData::data_offset())); | |
| 425 __ Ret(); | |
| 426 __ delay_slot()->SmiTag(V0); | |
| 427 | |
| 428 __ Bind(&fall_through); | |
| 429 } | |
| 430 | |
| 431 | |
| 432 void Intrinsifier::ExternalUint8ArrayGetIndexed(Assembler* assembler) { | |
| 433 Label fall_through; | |
| 434 | |
| 435 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. | |
| 436 | |
| 437 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | |
| 438 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. | |
| 439 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. | |
| 440 | |
| 441 // Range check. | |
| 442 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); | |
| 443 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); | |
| 444 | |
| 445 __ lw(T1, FieldAddress(T1, ExternalTypedData::data_offset())); | |
| 446 __ SmiUntag(T0); | |
| 447 __ addu(T1, T1, T0); | |
| 448 __ lbu(V0, Address(T1, 0)); | |
| 449 __ Ret(); | |
| 450 __ delay_slot()->SmiTag(V0); | |
| 451 | |
| 452 __ Bind(&fall_through); | |
| 453 } | |
| 454 | |
| 455 | |
| 456 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { | 409 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { |
| 457 Label fall_through; | 410 Label fall_through; |
| 458 | 411 |
| 459 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. | 412 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. |
| 460 | 413 |
| 461 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | 414 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 462 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. | 415 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. |
| 463 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. | 416 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. |
| 464 | 417 |
| 465 // Range check. | 418 // Range check. |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 Isolate* isolate = Isolate::Current(); | 1786 Isolate* isolate = Isolate::Current(); |
| 1834 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 1787 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
| 1835 // Set return value. | 1788 // Set return value. |
| 1836 __ Ret(); | 1789 __ Ret(); |
| 1837 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 1790 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 1838 } | 1791 } |
| 1839 | 1792 |
| 1840 } // namespace dart | 1793 } // namespace dart |
| 1841 | 1794 |
| 1842 #endif // defined TARGET_ARCH_MIPS | 1795 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |