Chromium Code Reviews| 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..5bc457316cb97caa8249bdc91d209d6207a86087 100644 |
| --- a/runtime/vm/intermediate_language_x64.cc |
| +++ b/runtime/vm/intermediate_language_x64.cc |
| @@ -921,7 +921,14 @@ 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 if (class_id() == kFloat64ArrayCid) { |
| + __ movsd(locs()->out().xmm_reg(), element_address); |
|
srdjan
2012/10/19 00:58:33
} else {
ASSERT( ..)
...
}
|
| + } |
| } else { |
| __ movq(locs()->out().reg(), element_address); |
| } |
| @@ -930,9 +937,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 +968,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 +2198,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(); |
| } |