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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 11411142: Support loads from Uint8Array and ExternalUint8Array in the optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « runtime/vm/intermediate_language_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/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 15254)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -1038,6 +1038,26 @@
Register array = locs()->in(0).reg();
Location index = locs()->in(1);
+ if (class_id() == kExternalUint8ArrayCid) {
+ Register result = locs()->out().reg();
+ Address element_address = index.IsRegister()
+ ? Address(result, index.reg(), TIMES_1, 0)
+ : Address(result, Smi::Cast(index.constant()).Value());
+ if (index.IsRegister()) {
+ __ SmiUntag(index.reg());
+ }
+ __ movq(result,
+ FieldAddress(array, ExternalUint8Array::external_data_offset()));
+ __ movq(result,
+ Address(result, ExternalByteArrayData<uint8_t>::data_offset()));
+ __ movzxb(result, element_address);
+ __ SmiTag(result);
+ if (index.IsRegister()) {
+ __ SmiTag(index.reg()); // Re-tag.
+ }
+ return;
+ }
+
FieldAddress element_address = index.IsRegister() ?
FlowGraphCompiler::ElementAddressForRegIndex(
class_id(), array, index.reg()) :
@@ -1045,18 +1065,34 @@
class_id(), array, Smi::Cast(index.constant()).Value());
if (representation() == kUnboxedDouble) {
+ XmmRegister result = locs()->out().xmm_reg();
if (class_id() == kFloat32ArrayCid) {
// Load single precision float.
- __ movss(locs()->out().xmm_reg(), element_address);
+ __ movss(result, element_address);
// Promote to double.
- __ cvtss2sd(locs()->out().xmm_reg(), locs()->out().xmm_reg());
+ __ cvtss2sd(result, locs()->out().xmm_reg());
} else {
ASSERT(class_id() == kFloat64ArrayCid);
- __ movsd(locs()->out().xmm_reg(), element_address);
+ __ movsd(result, element_address);
}
- } else {
- __ movq(locs()->out().reg(), element_address);
+ return;
}
+
+ Register result = locs()->out().reg();
+ if (class_id() == kUint8ArrayCid) {
+ if (index.IsRegister()) {
+ __ SmiUntag(index.reg());
+ }
+ __ movzxb(result, element_address);
+ __ SmiTag(result);
+ if (index.IsRegister()) {
+ __ SmiTag(index.reg()); // Re-tag.
+ }
+ return;
+ }
+
+ ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
+ __ movq(result, element_address);
}
@@ -1106,6 +1142,7 @@
return;
}
+ ASSERT(class_id() == kArrayCid);
if (ShouldEmitStoreBarrier()) {
Register value = locs()->in(2).reg();
__ StoreIntoObject(array, element_address, value);
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698