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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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.h ('k') | runtime/vm/intrinsifier_x64.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) 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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 __ cvtsd2ss(XMM7, XMM7); 620 __ cvtsd2ss(XMM7, XMM7);
621 // Store into array. 621 // Store into array.
622 __ movss(FieldAddress(EAX, EBX, TIMES_2, Float32Array::data_offset()), XMM7); 622 __ movss(FieldAddress(EAX, EBX, TIMES_2, Float32Array::data_offset()), XMM7);
623 // End fast path. 623 // End fast path.
624 __ ret(); 624 __ ret();
625 __ Bind(&fall_through); 625 __ Bind(&fall_through);
626 return false; 626 return false;
627 } 627 }
628 628
629 629
630 bool Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
631 Label fall_through;
632 TestByteArrayIndex(assembler, &fall_through);
633 // After TestByteArrayIndex:
634 // * EAX has the base address of the byte array.
635 // * EBX has the index into the array.
636 // EBX contains the SMI index which is shifted left by 1.
637 // This shift means we only multiply the index by 4 not 8 (sizeof double).
638 // Load double precision float into XMM7.
639 __ movsd(XMM7, FieldAddress(EAX, EBX, TIMES_4,
640 Float64Array::data_offset()));
641 // Allocate a double instance.
642 const Class& double_class = Class::Handle(
643 Isolate::Current()->object_store()->double_class());
644 AssemblerMacros::TryAllocate(assembler,
645 double_class,
646 &fall_through,
647 Assembler::kNearJump, EAX);
648 // Store XMM7 into double instance.
649 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM7);
650 __ ret();
651 __ Bind(&fall_through);
652 return false;
653 }
654
655
656 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
657 Label fall_through;
658 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value.
659 // If EAX is not an instance of double, jump to fall through.
660 __ CompareClassId(EAX, kDoubleCid, EDI);
661 __ j(NOT_EQUAL, &fall_through);
662 // Load double value into XMM7.
663 __ movsd(XMM7, FieldAddress(EAX, Double::value_offset()));
664 TestByteArraySetIndex(assembler, &fall_through);
665 // After TestByteArraySetIndex:
666 // * EAX has the base address of the byte array.
667 // * EBX has the index into the array.
668 // EBX contains the SMI index which is shifted by 1.
669 // This shift means we only multiply the index by 4 not 8 (sizeof float).
670 // Store into array.
671 __ movsd(FieldAddress(EAX, EBX, TIMES_4, Float64Array::data_offset()), XMM7);
672 __ ret();
673 __ Bind(&fall_through);
674 return false;
675 }
676
677
630 // Tests if two top most arguments are smis, jumps to label not_smi if not. 678 // Tests if two top most arguments are smis, jumps to label not_smi if not.
631 // Topmost argument is in EAX. 679 // Topmost argument is in EAX.
632 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { 680 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
633 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 681 __ movl(EAX, Address(ESP, + 1 * kWordSize));
634 __ movl(EBX, Address(ESP, + 2 * kWordSize)); 682 __ movl(EBX, Address(ESP, + 2 * kWordSize));
635 __ orl(EBX, EAX); 683 __ orl(EBX, EAX);
636 __ testl(EBX, Immediate(kSmiTagMask)); 684 __ testl(EBX, Immediate(kSmiTagMask));
637 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); 685 __ j(NOT_ZERO, not_smi, Assembler::kNearJump);
638 } 686 }
639 687
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 __ Bind(&is_true); 1546 __ Bind(&is_true);
1499 __ LoadObject(EAX, bool_true); 1547 __ LoadObject(EAX, bool_true);
1500 __ ret(); 1548 __ ret();
1501 return true; 1549 return true;
1502 } 1550 }
1503 1551
1504 #undef __ 1552 #undef __
1505 } // namespace dart 1553 } // namespace dart
1506 1554
1507 #endif // defined TARGET_ARCH_IA32 1555 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698