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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 308513005: Intrinsify [] for ExternalUint8 and Uint8 typed data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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_arm64.cc ('k') | runtime/vm/intrinsifier_mips.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 36830)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -442,6 +442,45 @@
}
+void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
+ __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
+ // Range check.
+ __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
+ // Runtime throws exception.
+ __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
+
+ __ SmiUntag(EBX);
+ __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, TypedData::data_offset()));
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
+}
+
+
+void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
+ __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
+ __ testl(EBX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
+ // Range check.
+ __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
+ // Runtime throws exception.
+ __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
+
+ __ movl(EAX, FieldAddress(EAX, ExternalTypedData::data_offset()));
+ __ SmiUntag(EBX);
+ __ movzxb(EAX, Address(EAX, EBX, TIMES_1, 0));
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
+}
+
+
static ScaleFactor GetScaleFactor(intptr_t size) {
switch (size) {
case 1: return TIMES_1;
« no previous file with comments | « runtime/vm/intrinsifier_arm64.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698