| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 void Intrinsifier::Array_getIndexed(Assembler* assembler) { | 36 void Intrinsifier::Array_getIndexed(Assembler* assembler) { |
| 37 Label fall_through; | 37 Label fall_through; |
| 38 | 38 |
| 39 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index | 39 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index |
| 40 | 40 |
| 41 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | 41 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 42 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through | 42 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through |
| 43 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array | 43 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array |
| 44 | 44 |
| 45 // range check | 45 // Range check. |
| 46 __ lw(T2, FieldAddress(T1, Array::length_offset())); | 46 __ lw(T2, FieldAddress(T1, Array::length_offset())); |
| 47 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); | 47 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 48 | 48 |
| 49 ASSERT(kSmiTagShift == 1); | 49 ASSERT(kSmiTagShift == 1); |
| 50 // array element at T1 + T0*2 + Array::data_offset - 1 | 50 // array element at T1 + T0*2 + Array::data_offset - 1 |
| 51 __ sll(T2, T0, 1); | 51 __ sll(T2, T0, 1); |
| 52 __ addu(T2, T1, T2); | 52 __ addu(T2, T1, T2); |
| 53 __ Ret(); | 53 __ Ret(); |
| 54 __ delay_slot()->lw(V0, FieldAddress(T2, Array::data_offset())); | 54 __ delay_slot()->lw(V0, FieldAddress(T2, Array::data_offset())); |
| 55 __ Bind(&fall_through); | 55 __ Bind(&fall_through); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 void Intrinsifier::GrowableList_getIndexed(Assembler* assembler) { | 219 void Intrinsifier::GrowableList_getIndexed(Assembler* assembler) { |
| 220 Label fall_through; | 220 Label fall_through; |
| 221 | 221 |
| 222 __ lw(T0, Address(SP, 0 * kWordSize)); // Index | 222 __ lw(T0, Address(SP, 0 * kWordSize)); // Index |
| 223 | 223 |
| 224 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | 224 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 225 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through | 225 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through |
| 226 __ delay_slot()->lw(T1, Address(SP, 1 * kWordSize)); // Array | 226 __ delay_slot()->lw(T1, Address(SP, 1 * kWordSize)); // Array |
| 227 | 227 |
| 228 // range check | 228 // Range check. |
| 229 __ lw(T2, FieldAddress(T1, GrowableObjectArray::length_offset())); | 229 __ lw(T2, FieldAddress(T1, GrowableObjectArray::length_offset())); |
| 230 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); | 230 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 231 | 231 |
| 232 __ lw(T2, FieldAddress(T1, GrowableObjectArray::data_offset())); // data | 232 __ lw(T2, FieldAddress(T1, GrowableObjectArray::data_offset())); // data |
| 233 | 233 |
| 234 ASSERT(kSmiTagShift == 1); | 234 ASSERT(kSmiTagShift == 1); |
| 235 // array element at T2 + T0 * 2 + Array::data_offset - 1 | 235 // array element at T2 + T0 * 2 + Array::data_offset - 1 |
| 236 __ sll(T3, T0, 1); | 236 __ sll(T3, T0, 1); |
| 237 __ addu(T2, T2, T3); | 237 __ addu(T2, T2, T3); |
| 238 __ Ret(); | 238 __ Ret(); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 | 431 |
| 432 // Gets the length of a TypedData. | 432 // Gets the length of a TypedData. |
| 433 void Intrinsifier::TypedData_getLength(Assembler* assembler) { | 433 void Intrinsifier::TypedData_getLength(Assembler* assembler) { |
| 434 __ lw(T0, Address(SP, 0 * kWordSize)); | 434 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 435 __ Ret(); | 435 __ Ret(); |
| 436 __ delay_slot()->lw(V0, FieldAddress(T0, TypedData::length_offset())); | 436 __ delay_slot()->lw(V0, FieldAddress(T0, TypedData::length_offset())); |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) { |
| 441 Label fall_through; |
| 442 |
| 443 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. |
| 444 |
| 445 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 446 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. |
| 447 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. |
| 448 |
| 449 // Range check. |
| 450 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); |
| 451 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 452 |
| 453 __ SmiUntag(T0); |
| 454 __ addu(T1, T1, T0); |
| 455 __ lbu(V0, FieldAddress(T1, TypedData::data_offset())); |
| 456 __ Ret(); |
| 457 __ delay_slot()->SmiTag(V0); |
| 458 |
| 459 __ Bind(&fall_through); |
| 460 } |
| 461 |
| 462 |
| 463 void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) { |
| 464 Label fall_through; |
| 465 |
| 466 __ lw(T0, Address(SP, + 0 * kWordSize)); // Index. |
| 467 |
| 468 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
| 469 __ bne(CMPRES1, ZR, &fall_through); // Index is not an smi, fall through. |
| 470 __ delay_slot()->lw(T1, Address(SP, + 1 * kWordSize)); // Array. |
| 471 |
| 472 // Range check. |
| 473 __ lw(T2, FieldAddress(T1, TypedData::length_offset())); |
| 474 __ BranchUnsignedGreaterEqual(T0, T2, &fall_through); |
| 475 |
| 476 __ lw(T1, FieldAddress(T1, ExternalTypedData::data_offset())); |
| 477 __ SmiUntag(T0); |
| 478 __ addu(T1, T1, T0); |
| 479 __ lbu(V0, Address(T1, 0)); |
| 480 __ Ret(); |
| 481 __ delay_slot()->SmiTag(V0); |
| 482 |
| 483 __ Bind(&fall_through); |
| 484 } |
| 485 |
| 486 |
| 440 static int GetScaleFactor(intptr_t size) { | 487 static int GetScaleFactor(intptr_t size) { |
| 441 switch (size) { | 488 switch (size) { |
| 442 case 1: return 0; | 489 case 1: return 0; |
| 443 case 2: return 1; | 490 case 2: return 1; |
| 444 case 4: return 2; | 491 case 4: return 2; |
| 445 case 8: return 3; | 492 case 8: return 3; |
| 446 case 16: return 4; | 493 case 16: return 4; |
| 447 } | 494 } |
| 448 UNREACHABLE(); | 495 UNREACHABLE(); |
| 449 return -1; | 496 return -1; |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 Isolate* isolate = Isolate::Current(); | 1746 Isolate* isolate = Isolate::Current(); |
| 1700 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 1747 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
| 1701 // Set return value. | 1748 // Set return value. |
| 1702 __ Ret(); | 1749 __ Ret(); |
| 1703 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 1750 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 1704 } | 1751 } |
| 1705 | 1752 |
| 1706 } // namespace dart | 1753 } // namespace dart |
| 1707 | 1754 |
| 1708 #endif // defined TARGET_ARCH_MIPS | 1755 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |