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

Side by Side Diff: runtime/vm/intrinsifier_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 348
349 // Gets the length of a TypedData. 349 // Gets the length of a TypedData.
350 void Intrinsifier::TypedData_getLength(Assembler* assembler) { 350 void Intrinsifier::TypedData_getLength(Assembler* assembler) {
351 __ ldr(R0, Address(SP, 0 * kWordSize)); 351 __ ldr(R0, Address(SP, 0 * kWordSize));
352 __ ldr(R0, FieldAddress(R0, TypedData::length_offset())); 352 __ ldr(R0, FieldAddress(R0, TypedData::length_offset()));
353 __ ret(); 353 __ ret();
354 } 354 }
355 355
356 356
357 void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
358 Label fall_through;
359 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
360 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
361 __ tsti(R0, kSmiTagMask);
362 __ b(&fall_through, NE); // Index is not a smi, fall through.
363
364 // Range check.
365 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
366 __ cmp(R0, Operand(R6));
367 __ b(&fall_through, CS);
368
369 // Array element at R1 + R0 + TypedData::data_offset - 1.
370 // Untag R0;
zra 2014/05/30 18:11:00 ; -> .
srdjan 2014/05/30 19:23:12 Done.
371 __ add(R1, R1, Operand(R0, LSR, 1));
372 __ ldr(R0, FieldAddress(R1, TypedData::data_offset()), kUnsignedByte);
373 __ SmiTag(R0);
374 __ ret();
375 __ Bind(&fall_through);
376 }
377
378
379 void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) {
380 Label fall_through;
381
382 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
383 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
384 __ tsti(R0, kSmiTagMask);
385 __ b(&fall_through, NE); // Index is not a smi, fall through.
386
387 // Range check.
388 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
389 __ cmp(R0, Operand(R6));
390 __ b(&fall_through, CS);
391
392 __ ldr(R1, FieldAddress(R1, ExternalTypedData::data_offset()));
393
394 // Untag R0;
zra 2014/05/30 18:11:00 ; -> .
srdjan 2014/05/30 19:23:12 Done.
395 __ add(R1, R1, Operand(R0, LSR, 1));
396 __ ldr(R0, Address(R1, 0), kUnsignedByte);
397 __ SmiTag(R0);
398 __ ret();
399 __ Bind(&fall_through);
400 }
401
402
357 static int GetScaleFactor(intptr_t size) { 403 static int GetScaleFactor(intptr_t size) {
358 switch (size) { 404 switch (size) {
359 case 1: return 0; 405 case 1: return 0;
360 case 2: return 1; 406 case 2: return 1;
361 case 4: return 2; 407 case 4: return 2;
362 case 8: return 3; 408 case 8: return 3;
363 case 16: return 4; 409 case 16: return 4;
364 } 410 }
365 UNREACHABLE(); 411 UNREACHABLE();
366 return -1; 412 return -1;
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 Isolate* isolate = Isolate::Current(); 1597 Isolate* isolate = Isolate::Current();
1552 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); 1598 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP);
1553 // Set return value to Isolate::current_tag_. 1599 // Set return value to Isolate::current_tag_.
1554 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1600 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1555 __ ret(); 1601 __ ret();
1556 } 1602 }
1557 1603
1558 } // namespace dart 1604 } // namespace dart
1559 1605
1560 #endif // defined TARGET_ARCH_ARM64 1606 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698