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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 11794038: Bug fix and improvements to clamped arrays. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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 16756)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -584,7 +584,17 @@
bool Intrinsifier::UintClamped8Array_getIndexed(Assembler* assembler) {
- return Uint8Array_setIndexed(assembler);
+ Label fall_through;
+ TestByteArrayIndex(assembler, &fall_through);
+ __ SmiUntag(EBX);
+ __ movzxb(EAX, FieldAddress(EAX,
+ EBX,
+ TIMES_1,
+ Uint8ClampedArray::data_offset()));
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
}
@@ -597,8 +607,9 @@
// * 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.
- __ movl(EDI, EBX);
+ // Free EBX for the value since we need a byte register.
+ __ leal(EAX, FieldAddress(EAX, EBX, TIMES_1,
+ Uint8ClampedArray::data_offset()));
__ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
__ testl(EBX, Immediate(kSmiTagMask));
__ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
@@ -606,6 +617,7 @@
__ SmiUntag(EBX);
__ cmpl(EBX, Immediate(0xFF));
__ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
+ // Clamp to 0x00 or 0xFF respectively.
__ j(GREATER, &load_0xff, Assembler::kNearJump);
__ xorl(EBX, EBX); // Zero.
__ jmp(&store_value, Assembler::kNearJump);
@@ -613,7 +625,7 @@
__ movl(EBX, Immediate(0xFF));
__ Bind(&store_value);
- __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
+ __ movb(Address(EAX, 0), BL);
__ ret();
__ Bind(&fall_through);
return false;
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698