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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 11198072: Inline load and store index on Float32Arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final patch 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
« 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
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 336e932e5ceb296748af7f97e46ae117330147c8..9d9cd9b437facf5d4f5a3058d5dfd0f474b56d6a 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -921,7 +921,15 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
class_id(), array, Smi::Cast(index.constant()).Value());
if (representation() == kUnboxedDouble) {
- __ movsd(locs()->out().xmm_reg(), element_address);
+ if (class_id() == kFloat32ArrayCid) {
+ // Load single precision float.
+ __ movss(locs()->out().xmm_reg(), element_address);
+ // Promote to double.
+ __ cvtss2sd(locs()->out().xmm_reg(), locs()->out().xmm_reg());
+ } else {
+ ASSERT(class_id() == kFloat64ArrayCid);
+ __ movsd(locs()->out().xmm_reg(), element_address);
+ }
} else {
__ movq(locs()->out().reg(), element_address);
}
@@ -930,9 +938,12 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 3;
- const intptr_t kNumTemps = 0;
+ const intptr_t kNumTemps = class_id() == kFloat32ArrayCid ? 1 : 0;
LocationSummary* locs =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ if (class_id() == kFloat32ArrayCid) {
+ locs->set_temp(0, Location::RequiresXmmRegister());
+ }
locs->set_in(0, Location::RequiresRegister());
locs->set_in(1, CanBeImmediateIndex(index())
? Location::RegisterOrConstant(index())
@@ -958,6 +969,14 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
FlowGraphCompiler::ElementAddressForIntIndex(
class_id(), array, Smi::Cast(index.constant()).Value());
+ if (class_id() == kFloat32ArrayCid) {
+ // Convert to single precision.
+ __ cvtsd2ss(locs()->temp(0).xmm_reg(), locs()->in(2).xmm_reg());
+ // Store.
+ __ movss(element_address, locs()->temp(0).xmm_reg());
+ return;
+ }
+
if (class_id() == kFloat64ArrayCid) {
__ movsd(element_address, locs()->in(2).xmm_reg());
return;
@@ -2180,12 +2199,15 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT((array_type() == kArrayCid) ||
(array_type() == kImmutableArrayCid) ||
(array_type() == kGrowableObjectArrayCid) ||
- (array_type() == kFloat64ArrayCid));
+ (array_type() == kFloat64ArrayCid) ||
+ (array_type() == kFloat32ArrayCid));
intptr_t length_offset = -1;
if (array_type() == kGrowableObjectArrayCid) {
length_offset = GrowableObjectArray::length_offset();
} else if (array_type() == kFloat64ArrayCid) {
length_offset = Float64Array::length_offset();
+ } else if (array_type() == kFloat32ArrayCid) {
+ length_offset = Float32Array::length_offset();
} else {
length_offset = Array::length_offset();
}
« 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