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

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

Issue 408373002: Adds intrinsics for Float64Array [] and []=. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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_arm.cc ('k') | runtime/vm/intrinsifier_ia32.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) 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 // Untag R0. 394 // Untag R0.
395 __ add(R1, R1, Operand(R0, LSR, 1)); 395 __ add(R1, R1, Operand(R0, LSR, 1));
396 __ ldr(R0, Address(R1, 0), kUnsignedByte); 396 __ ldr(R0, Address(R1, 0), kUnsignedByte);
397 __ SmiTag(R0); 397 __ SmiTag(R0);
398 __ ret(); 398 __ ret();
399 __ Bind(&fall_through); 399 __ Bind(&fall_through);
400 } 400 }
401 401
402 402
403 void Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
404 Label fall_through;
405 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
406 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
407 __ tsti(R0, kSmiTagMask);
408 __ b(&fall_through, NE); // Index is not a smi, fall through.
409
410 // Range check.
411 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
412 __ cmp(R0, Operand(R6));
413 __ b(&fall_through, CS);
414
415 Address element_address =
416 __ ElementAddressForRegIndex(true, // Load.
417 false, // Not external.
418 kTypedDataFloat64ArrayCid, // Cid.
419 8, // Index scale.
420 R1, // Array.
421 R0); // Index.
422
423 __ fldrd(V0, element_address);
424
425 const Class& double_class = Class::Handle(
426 Isolate::Current()->object_store()->double_class());
427 __ TryAllocate(double_class,
428 &fall_through,
429 R0, // Result register.
430 kNoPP);
431 __ StoreDFieldToOffset(V0, R0, Double::value_offset(), kNoPP);
432 __ ret();
433 __ Bind(&fall_through);
434 }
435
436
437 void Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
438 Label fall_through;
439 __ ldr(R0, Address(SP, + 1 * kWordSize)); // Index.
440 __ ldr(R1, Address(SP, + 2 * kWordSize)); // Array.
441 __ tsti(R0, kSmiTagMask);
442 __ b(&fall_through, NE); // Index is not a smi, fall through.
443
444 // Range check.
445 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
446 __ cmp(R0, Operand(R6));
447 __ b(&fall_through, CS);
448
449 __ ldr(R2, Address(SP, + 0 * kWordSize)); // Value.
450 __ tsti(R2, kSmiTagMask);
451 __ b(&fall_through, EQ); // Value is Smi, fall through.
452
453 __ LoadClassId(R3, R2, kNoPP);
454 __ CompareImmediate(R3, kDoubleCid, kNoPP);
455 __ b(&fall_through, NE); // Not a Double, fall through.
456
457 __ LoadDFieldFromOffset(V0, R2, Double::value_offset(), kNoPP);
458
459 Address element_address =
460 __ ElementAddressForRegIndex(false, // Store.
461 false, // Not external.
462 kTypedDataFloat64ArrayCid, // Cid.
463 8, // Index scale.
464 R1, // Array.
465 R0); // Index.
466 __ fstrd(V0, element_address);
467 __ ret();
468 __ Bind(&fall_through);
469 }
470
471
403 static int GetScaleFactor(intptr_t size) { 472 static int GetScaleFactor(intptr_t size) {
404 switch (size) { 473 switch (size) {
405 case 1: return 0; 474 case 1: return 0;
406 case 2: return 1; 475 case 2: return 1;
407 case 4: return 2; 476 case 4: return 2;
408 case 8: return 3; 477 case 8: return 3;
409 case 16: return 4; 478 case 16: return 4;
410 } 479 }
411 UNREACHABLE(); 480 UNREACHABLE();
412 return -1; 481 return -1;
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 Isolate* isolate = Isolate::Current(); 1666 Isolate* isolate = Isolate::Current();
1598 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); 1667 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP);
1599 // Set return value to Isolate::current_tag_. 1668 // Set return value to Isolate::current_tag_.
1600 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1669 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1601 __ ret(); 1670 __ ret();
1602 } 1671 }
1603 1672
1604 } // namespace dart 1673 } // namespace dart
1605 1674
1606 #endif // defined TARGET_ARCH_ARM64 1675 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698