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

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
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 36
37 void Intrinsifier::Array_getIndexed(Assembler* assembler) { 37 void Intrinsifier::Array_getIndexed(Assembler* assembler) {
38 Label fall_through; 38 Label fall_through;
39 39
40 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index 40 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index
41 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array 41 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array
42 42
43 __ tst(R0, Operand(kSmiTagMask)); 43 __ tst(R0, Operand(kSmiTagMask));
44 __ b(&fall_through, NE); // Index is not an smi, fall through 44 __ b(&fall_through, NE); // Index is not an smi, fall through
45 45
46 // range check 46 // Range check.
47 __ ldr(R6, FieldAddress(R1, Array::length_offset())); 47 __ ldr(R6, FieldAddress(R1, Array::length_offset()));
48 __ cmp(R0, Operand(R6)); 48 __ cmp(R0, Operand(R6));
49 49
50 ASSERT(kSmiTagShift == 1); 50 ASSERT(kSmiTagShift == 1);
51 // array element at R1 + R0*2 + Array::data_offset - 1 51 // array element at R1 + R0*2 + Array::data_offset - 1
52 __ add(R6, R1, Operand(R0, LSL, 1), CC); 52 __ add(R6, R1, Operand(R0, LSL, 1), CC);
53 __ ldr(R0, FieldAddress(R6, Array::data_offset()), CC); 53 __ ldr(R0, FieldAddress(R6, Array::data_offset()), CC);
54 __ bx(LR, CC); 54 __ bx(LR, CC);
55 __ Bind(&fall_through); 55 __ Bind(&fall_through);
56 } 56 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 void Intrinsifier::GrowableList_getIndexed(Assembler* assembler) { 222 void Intrinsifier::GrowableList_getIndexed(Assembler* assembler) {
223 Label fall_through; 223 Label fall_through;
224 224
225 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index 225 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index
226 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array 226 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array
227 227
228 __ tst(R0, Operand(kSmiTagMask)); 228 __ tst(R0, Operand(kSmiTagMask));
229 __ b(&fall_through, NE); // Index is not an smi, fall through 229 __ b(&fall_through, NE); // Index is not an smi, fall through
230 230
231 // range check 231 // Range check.
232 __ ldr(R6, FieldAddress(R1, GrowableObjectArray::length_offset())); 232 __ ldr(R6, FieldAddress(R1, GrowableObjectArray::length_offset()));
233 __ cmp(R0, Operand(R6)); 233 __ cmp(R0, Operand(R6));
234 234
235 ASSERT(kSmiTagShift == 1); 235 ASSERT(kSmiTagShift == 1);
236 // array element at R6 + R0 * 2 + Array::data_offset - 1 236 // array element at R6 + R0 * 2 + Array::data_offset - 1
237 __ ldr(R6, FieldAddress(R1, GrowableObjectArray::data_offset()), CC); // data 237 __ ldr(R6, FieldAddress(R1, GrowableObjectArray::data_offset()), CC); // data
238 __ add(R6, R6, Operand(R0, LSL, 1), CC); 238 __ add(R6, R6, Operand(R0, LSL, 1), CC);
239 __ ldr(R0, FieldAddress(R6, Array::data_offset()), CC); 239 __ ldr(R0, FieldAddress(R6, Array::data_offset()), CC);
240 __ bx(LR, CC); 240 __ bx(LR, CC);
241 __ Bind(&fall_through); 241 __ Bind(&fall_through);
(...skipping 182 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
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698