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

Unified 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, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_ia32.cc
===================================================================
--- runtime/vm/intrinsifier_ia32.cc (revision 16643)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -597,6 +597,43 @@
}
+bool Intrinsifier::UintClamped8Array_getIndexed(Assembler* assembler) {
+ return Uint8Array_setIndexed(assembler);
+}
+
+
+bool Intrinsifier::Uint8ClampedArray_setIndexed(Assembler* assembler) {
+ Label fall_through, store_value, load_0xff;
+ // Verify that the array index is valid.
+ TestByteArraySetIndex(assembler, &fall_through);
+ // After TestByteArraySetIndex:
+ // * EAX has the base address of the byte array.
+ // * EBX has the index into the array.
+ // EBX contains the SMI index which is shifted by 1.
+ __ SmiUntag(EBX);
+ // 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.
+ __ movl(EDI, EBX);
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
+
+ __ SmiUntag(EBX);
+ __ cmpl(EBX, Immediate(0xFF));
+ __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
+ __ 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
+ __ xorl(EBX, EBX); // Zero.
+ __ jmp(&store_value, Assembler::kNearJump);
+ __ Bind(&load_0xff);
+ __ movl(EBX, Immediate(0xFF));
+
+ __ Bind(&store_value);
+ __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) {
Label fall_through;
TestByteArrayIndex(assembler, &fall_through);
« 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