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

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

Issue 11087087: Apply John's change (Issue 11077007: Intrinsify Float64 array access on ia32 and x64.). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/float_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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 __ cvtsd2ss(XMM7, XMM7); 578 __ cvtsd2ss(XMM7, XMM7);
579 // Store into array. 579 // Store into array.
580 __ movss(FieldAddress(RAX, R12, TIMES_2, Float32Array::data_offset()), XMM7); 580 __ movss(FieldAddress(RAX, R12, TIMES_2, Float32Array::data_offset()), XMM7);
581 // End fast path. 581 // End fast path.
582 __ ret(); 582 __ ret();
583 __ Bind(&fall_through); 583 __ Bind(&fall_through);
584 return false; 584 return false;
585 } 585 }
586 586
587 587
588 bool Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
589 Label fall_through;
590 TestByteArrayIndex(assembler, &fall_through);
591 // After TestByteArrayIndex:
592 // * RAX has the base address of the byte array.
593 // * R12 has the index into the array.
594 // R12 contains the SMI index which is shifted left by 1.
595 // This shift means we only multiply the index by 4 not 8 (sizeof double).
596 // Load double precision float into XMM7.
597 __ movsd(XMM7, FieldAddress(RAX, R12, TIMES_4,
598 Float64Array::data_offset()));
599 // Allocate a double instance.
600 const Class& double_class = Class::Handle(
601 Isolate::Current()->object_store()->double_class());
602 AssemblerMacros::TryAllocate(assembler,
603 double_class,
604 &fall_through,
605 Assembler::kNearJump, RAX);
606 // Store XMM7 into double instance.
607 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM7);
608 __ ret();
609 __ Bind(&fall_through);
610 return false;
611 }
612
613
614 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
615 Label fall_through;
616 TestByteArraySetIndex(assembler, &fall_through);
617 // After TestByteArraySetIndex:
618 // * RAX has the base address of the byte array.
619 // * R12 has the index into the array.
620 // R12 contains the SMI index which is shifted by 1.
621 // This shift means we only multiply the index by 4 not 8 (sizeof double).
622 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
623 // If RDX is not an instance of double, jump to fall through.
624 __ CompareClassId(RDX, kDoubleCid);
625 __ j(NOT_EQUAL, &fall_through);
626 // Load double value into XMM7.
627 __ movsd(XMM7, FieldAddress(RDX, Double::value_offset()));
628 // Store into array.
629 __ movsd(FieldAddress(RAX, R12, TIMES_4, Float64Array::data_offset()), XMM7);
630 __ ret();
631 __ Bind(&fall_through);
632 return false;
633 }
634
635
588 // Tests if two top most arguments are smis, jumps to label not_smi if not. 636 // Tests if two top most arguments are smis, jumps to label not_smi if not.
589 // Topmost argument is in RAX. 637 // Topmost argument is in RAX.
590 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { 638 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
591 __ movq(RAX, Address(RSP, + 1 * kWordSize)); 639 __ movq(RAX, Address(RSP, + 1 * kWordSize));
592 __ movq(RCX, Address(RSP, + 2 * kWordSize)); 640 __ movq(RCX, Address(RSP, + 2 * kWordSize));
593 __ orq(RCX, RAX); 641 __ orq(RCX, RAX);
594 __ testq(RCX, Immediate(kSmiTagMask)); 642 __ testq(RCX, Immediate(kSmiTagMask));
595 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); 643 __ j(NOT_ZERO, not_smi, Assembler::kNearJump);
596 } 644 }
597 645
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 __ LoadObject(RAX, bool_true); 1500 __ LoadObject(RAX, bool_true);
1453 __ ret(); 1501 __ ret();
1454 return true; 1502 return true;
1455 } 1503 }
1456 1504
1457 #undef __ 1505 #undef __
1458 1506
1459 } // namespace dart 1507 } // namespace dart
1460 1508
1461 #endif // defined TARGET_ARCH_X64 1509 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | tests/standalone/float_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698