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

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

Issue 11139004: Intrinsify natural word size typed array getters on IA32 and X64 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Codereview Created 8 years, 2 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_ia32.cc ('k') | tests/standalone/int_array_test.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 R12, 525 R12,
526 TIMES_2, 526 TIMES_2,
527 Uint32Array::data_offset())); 527 Uint32Array::data_offset()));
528 __ SmiTag(RAX); 528 __ SmiTag(RAX);
529 __ ret(); 529 __ ret();
530 __ Bind(&fall_through); 530 __ Bind(&fall_through);
531 return false; 531 return false;
532 } 532 }
533 533
534 534
535 bool Intrinsifier::Int64Array_getIndexed(Assembler* assembler) {
536 Label fall_through;
537 TestByteArrayIndex(assembler, &fall_through);
538 __ movq(RAX, FieldAddress(RAX,
539 R12,
540 TIMES_4,
541 Int64Array::data_offset()));
542 // Copy RAX into R12.
543 // We destroy R12 while testing if RAX can fit inside a Smi.
544 __ movq(R12, RAX);
545 // Verify that the signed value in RAX can fit inside a Smi.
546 __ shlq(R12, Immediate(0x1));
547 // Jump to fall_through if it can not.
548 __ j(OVERFLOW, &fall_through, Assembler::kNearJump);
549 __ SmiTag(RAX);
550 __ ret();
551 __ Bind(&fall_through);
552 return false;
553 }
554
555
556 bool Intrinsifier::Uint64Array_getIndexed(Assembler* assembler) {
557 Label fall_through;
558 TestByteArrayIndex(assembler, &fall_through);
559 __ movq(RAX, FieldAddress(RAX,
560 R12,
561 TIMES_4,
562 Uint64Array::data_offset()));
563 // Copy RAX into R12.
564 // We destroy R12 while testing if RAX can fit inside a Smi.
565 __ movq(R12, RAX);
566 // Verify that the unsigned value in RAX can be stored in a Smi.
567 __ shrq(R12, Immediate(kSmiBits));
568 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Won't fit Smi.
569 __ SmiTag(RAX);
570 __ ret();
571 __ Bind(&fall_through);
572 return false;
573 }
574
575
535 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) { 576 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) {
536 Label fall_through; 577 Label fall_through;
537 TestByteArrayIndex(assembler, &fall_through); 578 TestByteArrayIndex(assembler, &fall_through);
538 // After TestByteArrayIndex: 579 // After TestByteArrayIndex:
539 // * RAX has the base address of the byte array. 580 // * RAX has the base address of the byte array.
540 // * R12 has the index into the array. 581 // * R12 has the index into the array.
541 // R12 contains the SMI index which is shifted left by 1. 582 // R12 contains the SMI index which is shifted left by 1.
542 // This shift means we only multiply the index by 2 not 4 (sizeof float). 583 // This shift means we only multiply the index by 2 not 4 (sizeof float).
543 // Load single precision float into XMM7. 584 // Load single precision float into XMM7.
544 __ movss(XMM7, FieldAddress(RAX, R12, TIMES_2, 585 __ movss(XMM7, FieldAddress(RAX, R12, TIMES_2,
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 __ LoadObject(RAX, bool_true); 1541 __ LoadObject(RAX, bool_true);
1501 __ ret(); 1542 __ ret();
1502 return true; 1543 return true;
1503 } 1544 }
1504 1545
1505 #undef __ 1546 #undef __
1506 1547
1507 } // namespace dart 1548 } // namespace dart
1508 1549
1509 #endif // defined TARGET_ARCH_X64 1550 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | tests/standalone/int_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698