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

Side by Side Diff: runtime/vm/intrinsifier_arm.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.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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 __ LoadFromOffset(kWord, R1, R1, 468 __ LoadFromOffset(kWord, R1, R1,
469 ExternalTypedData::data_offset() - kHeapObjectTag); 469 ExternalTypedData::data_offset() - kHeapObjectTag);
470 __ SmiUntag(R0); 470 __ SmiUntag(R0);
471 __ ldrb(R0, Address(R1, R0)); 471 __ ldrb(R0, Address(R1, R0));
472 __ SmiTag(R0); 472 __ SmiTag(R0);
473 __ Ret(); 473 __ Ret();
474 __ Bind(&fall_through); 474 __ Bind(&fall_through);
475 } 475 }
476 476
477 477
478 void Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
479 Label fall_through;
480 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
481 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
482 __ tst(R0, Operand(kSmiTagMask));
483 __ b(&fall_through, NE); // Index is not a smi, fall through.
484
485 // Range check.
486 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
487 __ cmp(R0, Operand(R6));
488 __ b(&fall_through, CS);
489
490
491 Address element_address =
492 __ ElementAddressForRegIndex(true, // Load.
493 false, // Not external.
494 kTypedDataFloat64ArrayCid, // Cid.
495 8, // Index scale.
496 R1, // Array.
497 R0); // Index.
498
499 __ vldrd(D0, element_address);
500
501 const Class& double_class = Class::Handle(
502 Isolate::Current()->object_store()->double_class());
503 __ TryAllocate(double_class,
504 &fall_through,
505 R0, // Result register.
506 R1);
507 __ StoreDToOffset(D0, R0, Double::value_offset() - kHeapObjectTag);
508 __ Ret();
509 __ Bind(&fall_through);
510 }
511
512
513 void Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
514 Label fall_through;
515 __ ldr(R0, Address(SP, + 1 * kWordSize)); // Index.
516 __ ldr(R1, Address(SP, + 2 * kWordSize)); // Array.
517 __ tst(R0, Operand(kSmiTagMask));
518 __ b(&fall_through, NE); // Index is not a smi, fall through.
519
520 // Range check.
521 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
522 __ cmp(R0, Operand(R6));
523 __ b(&fall_through, CS);
524
525 __ ldr(R2, Address(SP, + 0 * kWordSize)); // Value.
526 __ tst(R2, Operand(kSmiTagMask));
527 __ b(&fall_through, EQ); // Value is Smi, fall through.
528
529 __ LoadClassId(R3, R2);
530 __ CompareImmediate(R3, kDoubleCid);
531 __ b(&fall_through, NE); // Not a Double, fall through.
532
533 __ LoadDFromOffset(D0, R2, Double::value_offset() - kHeapObjectTag);
534
535 Address element_address =
536 __ ElementAddressForRegIndex(false, // Store.
537 false, // Not external.
538 kTypedDataFloat64ArrayCid, // Cid.
539 8, // Index scale.
540 R1, // Array.
541 R0); // Index.
542 __ vstrd(D0, element_address);
543 __ Ret();
544 __ Bind(&fall_through);
545 }
546
547
478 static int GetScaleFactor(intptr_t size) { 548 static int GetScaleFactor(intptr_t size) {
479 switch (size) { 549 switch (size) {
480 case 1: return 0; 550 case 1: return 0;
481 case 2: return 1; 551 case 2: return 1;
482 case 4: return 2; 552 case 4: return 2;
483 case 8: return 3; 553 case 8: return 3;
484 case 16: return 4; 554 case 16: return 4;
485 } 555 }
486 UNREACHABLE(); 556 UNREACHABLE();
487 return -1; 557 return -1;
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 Isolate* isolate = Isolate::Current(); 1767 Isolate* isolate = Isolate::Current();
1698 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 1768 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1699 // Set return value to Isolate::current_tag_. 1769 // Set return value to Isolate::current_tag_.
1700 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1770 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1701 __ Ret(); 1771 __ Ret();
1702 } 1772 }
1703 1773
1704 } // namespace dart 1774 } // namespace dart
1705 1775
1706 #endif // defined TARGET_ARCH_ARM 1776 #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