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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 12114041: Intrinsify external uint8 clamped array setter and getter. (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 | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_x64.cc
===================================================================
--- runtime/vm/intrinsifier_x64.cc (revision 17988)
+++ runtime/vm/intrinsifier_x64.cc (working copy)
@@ -970,6 +970,49 @@
}
+bool Intrinsifier::ExternalUint8ClampedArray_getIndexed(Assembler* assembler) {
+ Label fall_through;
+ TestByteArrayGetIndex(assembler, &fall_through);
+ // R12: index as Smi.
+ // RAX: array.
+ __ SmiUntag(R12);
+ __ movq(RAX, FieldAddress(RAX, ExternalUint8ClampedArray::data_offset()));
+ __ movzxb(RAX, Address(RAX, R12, TIMES_1, 0));
+ __ SmiTag(RAX);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
+bool Intrinsifier::ExternalUint8ClampedArray_setIndexed(Assembler* assembler) {
+ Label fall_through, store_value, load_0xff;
+ TestByteArraySetIndex(assembler, &fall_through);
+ // R12: index as Smi.
+ // RAX: array.
+ __ SmiUntag(R12);
+ __ movq(RDI, Address(RSP, + 1 * kWordSize)); // Value.
+ __ testq(RDI, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
+
+ __ SmiUntag(RDI);
+ __ cmpq(RDI, Immediate(0xFF));
+ __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
+ __ j(GREATER, &load_0xff, Assembler::kNearJump);
+ __ xorq(RDI, RDI); // Zero.
+ __ jmp(&store_value, Assembler::kNearJump);
+ __ Bind(&load_0xff);
+ __ movq(RDI, Immediate(0xFF));
+
+ __ Bind(&store_value);
+ __ movq(RAX, FieldAddress(RAX, ExternalUint8ClampedArray::data_offset()));
+ __ movb(Address(RAX, R12, TIMES_1, 0), RDI);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
// Tests if two top most arguments are smis, jumps to label not_smi if not.
// Topmost argument is in RAX.
static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698