Chromium Code Reviews| 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); |