Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: runtime/vm/intrinsifier_arm.cc

Issue 308513005: Intrinsify [] for ExternalUint8 and Uint8 typed data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 425
426 // Gets the length of a TypedData. 426 // Gets the length of a TypedData.
427 void Intrinsifier::TypedData_getLength(Assembler* assembler) { 427 void Intrinsifier::TypedData_getLength(Assembler* assembler) {
428 __ ldr(R0, Address(SP, 0 * kWordSize)); 428 __ ldr(R0, Address(SP, 0 * kWordSize));
429 __ ldr(R0, FieldAddress(R0, TypedData::length_offset())); 429 __ ldr(R0, FieldAddress(R0, TypedData::length_offset()));
430 __ Ret(); 430 __ Ret();
431 } 431 }
432 432
433 433
434 void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
435 Label fall_through;
436 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
437 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
438 __ tst(R0, Operand(kSmiTagMask));
439 __ b(&fall_through, NE); // Index is not a smi, fall through.
440
441 // Range check.
442 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
443 __ cmp(R0, Operand(R6));
444 __ b(&fall_through, CS);
445
446 __ SmiUntag(R0);
447 __ AddImmediate(R1, TypedData::data_offset() - kHeapObjectTag);
448 __ ldrb(R0, Address(R1, R0));
449 __ SmiTag(R0);
450 __ Ret();
451 __ Bind(&fall_through);
452 }
453
454
455 void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) {
456 Label fall_through;
457
458 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
459 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
460 __ tst(R0, Operand(kSmiTagMask));
461 __ b(&fall_through, NE); // Index is not a smi, fall through.
462
463 // Range check.
464 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
465 __ cmp(R0, Operand(R6));
466 __ b(&fall_through, CS);
467
468 __ LoadFromOffset(kWord, R1, R1,
469 ExternalTypedData::data_offset() - kHeapObjectTag);
470 __ SmiUntag(R0);
471 __ ldrb(R0, Address(R1, R0));
472 __ SmiTag(R0);
473 __ Ret();
474 __ Bind(&fall_through);
475 }
476
477
434 static int GetScaleFactor(intptr_t size) { 478 static int GetScaleFactor(intptr_t size) {
435 switch (size) { 479 switch (size) {
436 case 1: return 0; 480 case 1: return 0;
437 case 2: return 1; 481 case 2: return 1;
438 case 4: return 2; 482 case 4: return 2;
439 case 8: return 3; 483 case 8: return 3;
440 case 16: return 4; 484 case 16: return 4;
441 } 485 }
442 UNREACHABLE(); 486 UNREACHABLE();
443 return -1; 487 return -1;
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 Isolate* isolate = Isolate::Current(); 1699 Isolate* isolate = Isolate::Current();
1656 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 1700 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1657 // Set return value to Isolate::current_tag_. 1701 // Set return value to Isolate::current_tag_.
1658 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1702 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1659 __ Ret(); 1703 __ Ret();
1660 } 1704 }
1661 1705
1662 } // namespace dart 1706 } // namespace dart
1663 1707
1664 #endif // defined TARGET_ARCH_ARM 1708 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698