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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 11074016: Intrinsify writing to Uint8 and Int8 arrays on IA32. (Closed) Base URL: https://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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intrinsifier_ia32.cc
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index 6f4eb81fbeb7ea4e50b764c8deb6a839529bc9fa..90c8e7099e951e51e9501c4426db17a97aeeaa5d 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -520,6 +520,30 @@ bool Intrinsifier::Int8Array_getIndexed(Assembler* assembler) {
}
+bool Intrinsifier::Int8Array_setIndexed(Assembler* assembler) {
+ Label fall_through;
+ // Verify that the array index is valid.
+ TestByteArraySetIndex(assembler, &fall_through);
srdjan 2012/10/08 21:45:53 Please add comments about register content.
+ __ SmiUntag(EBX);
+ // Move EBX into EDI.
+ __ movl(EDI, EBX);
+ // Move the value into EBX.
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
+ // If EBX is not an Smi, jump to fall through.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
+ __ SmiUntag(EBX);
+ // If EBX is too large an Int8, jump to fall through.
+ __ cmpl(EBX, Immediate(0xFF));
cshapiro 2012/10/08 21:40:41 We need to add 128 to EBX for this compare to be s
+ __ j(GREATER, &fall_through, Assembler::kNearJump);
+ // Store EBX into array EAX[EDI] = EBX.
+ __ movb(FieldAddress(EAX, EDI, TIMES_1, Int8Array::data_offset()), BL);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
Label fall_through;
TestByteArrayIndex(assembler, &fall_through);
@@ -535,6 +559,30 @@ bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
}
+bool Intrinsifier::Uint8Array_setIndexed(Assembler* assembler) {
+ Label fall_through;
+ // Verify that the array index is valid.
+ TestByteArraySetIndex(assembler, &fall_through);
srdjan 2012/10/08 21:45:53 ditto
+ __ SmiUntag(EBX);
+ // Move EBX into EDI.
+ __ movl(EDI, EBX);
+ // Move the value into EBX.
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
+ // If EBX is not an Smi, jump to fall through.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
+ __ SmiUntag(EBX);
+ // If EBX is too large an Uint8, jump to fall through.
+ __ cmpl(EBX, Immediate(0xFF));
+ __ j(GREATER, &fall_through, Assembler::kNearJump);
+ // Store EBX into array EAX[EDI] = EBX.
+ __ 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);

Powered by Google App Engine
This is Rietveld 408576698