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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 11415116: Port intrisification of setIndexed on Uint8 and Int8 arrays from ia32 to x64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index fcc63aa6c0e9e5e499d4a43d2a6b16d3822abc53..56752140011fb118aec578678f373a657a686040 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -538,22 +538,19 @@ bool Intrinsifier::Int8Array_setIndexed(Assembler* assembler) {
// * EBX has the index into the array.
// EBX contains the SMI index which is shifted by 1.
__ SmiUntag(EBX);
- // Move EBX into EDI.
+ // Free EBX for the value since we want a byte register.
__ movl(EDI, EBX);
- // Load 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);
- // Add 128 to EBX to bring it into 0..FF.
+ // Check that the value is a byte. Add 128 to EBX to bring it into
+ // the range 0..FF.
__ addl(EBX, Immediate(128));
__ cmpl(EBX, Immediate(0xFF));
- // If EBX is too large an Int8, jump to fall through.
__ j(ABOVE, &fall_through, Assembler::kNearJump);
- // Remove addition.
+ // Undo addition.
__ subl(EBX, Immediate(128));
- // Store BL into array EAX[EDI] = BL.
__ movb(FieldAddress(EAX, EDI, TIMES_1, Int8Array::data_offset()), BL);
__ ret();
__ Bind(&fall_through);
@@ -585,18 +582,15 @@ bool Intrinsifier::Uint8Array_setIndexed(Assembler* assembler) {
// * EBX has the index into the array.
// EBX contains the SMI index which is shifted by 1.
__ SmiUntag(EBX);
- // Move EBX into EDI.
+ // Free EBX for the value since we want a byte register.
__ movl(EDI, EBX);
- // Load 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.
+ // Check that the value is a byte.
__ cmpl(EBX, Immediate(0xFF));
__ j(ABOVE, &fall_through, Assembler::kNearJump);
- // Store BL into array EAX[EDI] = BL.
__ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
__ ret();
__ Bind(&fall_through);
« 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