Chromium Code Reviews| 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 419 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 | |
|
zra
2014/05/30 18:11:00
Range check.
srdjan
2014/05/30 19:23:12
Done.
| |
| 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 |