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

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

Issue 11783006: Intrinsify Uint8ClampedArray's store and load indexed, inline load indexed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // Check that the value is a byte. 590 // Check that the value is a byte.
591 __ cmpl(EBX, Immediate(0xFF)); 591 __ cmpl(EBX, Immediate(0xFF));
592 __ j(ABOVE, &fall_through, Assembler::kNearJump); 592 __ j(ABOVE, &fall_through, Assembler::kNearJump);
593 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL); 593 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
594 __ ret(); 594 __ ret();
595 __ Bind(&fall_through); 595 __ Bind(&fall_through);
596 return false; 596 return false;
597 } 597 }
598 598
599 599
600 bool Intrinsifier::UintClamped8Array_getIndexed(Assembler* assembler) {
601 return Uint8Array_setIndexed(assembler);
602 }
603
604
605 bool Intrinsifier::Uint8ClampedArray_setIndexed(Assembler* assembler) {
606 Label fall_through, store_value, load_0xff;
607 // Verify that the array index is valid.
608 TestByteArraySetIndex(assembler, &fall_through);
609 // After TestByteArraySetIndex:
610 // * EAX has the base address of the byte array.
611 // * EBX has the index into the array.
612 // EBX contains the SMI index which is shifted by 1.
613 __ SmiUntag(EBX);
614 // Free EBX for the value since we want a byte register.
sra1 2013/01/05 01:34:50 Could you free EAX and EBX here by generating the
srdjan 2013/01/08 00:34:06 I cannot use EDX (must be preserved, see comment o
sra1 2013/01/08 02:31:15 Sorry, I mis-wrote - EDI. EDI is used below.
615 __ movl(EDI, EBX);
616 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
617 __ testl(EBX, Immediate(kSmiTagMask));
618 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
619
620 __ SmiUntag(EBX);
621 __ cmpl(EBX, Immediate(0xFF));
622 __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
623 __ j(GREATER, &load_0xff, Assembler::kNearJump);
sra1 2013/01/05 01:34:50 Instead of jumping on carry with data dependent br
srdjan 2013/01/08 00:34:06 I do not think that can work. If compare sets CF w
sra1 2013/01/08 02:31:15 You are right! I'm getting my signed and unsigned
624 __ xorl(EBX, EBX); // Zero.
625 __ jmp(&store_value, Assembler::kNearJump);
626 __ Bind(&load_0xff);
627 __ movl(EBX, Immediate(0xFF));
628
629 __ Bind(&store_value);
630 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
631 __ ret();
632 __ Bind(&fall_through);
633 return false;
634 }
635
636
600 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) { 637 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) {
601 Label fall_through; 638 Label fall_through;
602 TestByteArrayIndex(assembler, &fall_through); 639 TestByteArrayIndex(assembler, &fall_through);
603 __ movsxw(EAX, FieldAddress(EAX, 640 __ movsxw(EAX, FieldAddress(EAX,
604 EBX, 641 EBX,
605 TIMES_1, 642 TIMES_1,
606 Int16Array::data_offset())); 643 Int16Array::data_offset()));
607 __ SmiTag(EAX); 644 __ SmiTag(EAX);
608 __ ret(); 645 __ ret();
609 __ Bind(&fall_through); 646 __ Bind(&fall_through);
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 __ Bind(&is_true); 1753 __ Bind(&is_true);
1717 __ LoadObject(EAX, Bool::True()); 1754 __ LoadObject(EAX, Bool::True());
1718 __ ret(); 1755 __ ret();
1719 return true; 1756 return true;
1720 } 1757 }
1721 1758
1722 #undef __ 1759 #undef __
1723 } // namespace dart 1760 } // namespace dart
1724 1761
1725 #endif // defined TARGET_ARCH_IA32 1762 #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