Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1162 } else { | 1162 } else { |
| 1163 locs->set_out(Location::RequiresRegister()); | 1163 locs->set_out(Location::RequiresRegister()); |
| 1164 } | 1164 } |
| 1165 return locs; | 1165 return locs; |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 | 1168 |
| 1169 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1169 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1170 Register array = locs()->in(0).reg(); | 1170 Register array = locs()->in(0).reg(); |
| 1171 Location index = locs()->in(1); | 1171 Location index = locs()->in(1); |
| 1172 | |
| 1173 if (class_id() == kExternalUint8ArrayCid) { | |
| 1174 Register result = locs()->out().reg(); | |
| 1175 Address element_address = index.IsRegister() | |
| 1176 ? Address(result, index.reg(), TIMES_1, 0) | |
| 1177 : Address(result, Smi::Cast(index.constant()).Value()); | |
| 1178 if (index.IsRegister()) { | |
| 1179 __ SmiUntag(index.reg()); | |
| 1180 } | |
| 1181 __ movl(result, | |
| 1182 FieldAddress(array, ExternalUint8Array::external_data_offset())); | |
| 1183 __ movl(result, | |
| 1184 Address(result, ExternalByteArrayData<uint8_t>::data_offset())); | |
| 1185 __ movzxb(result, element_address); | |
| 1186 __ SmiTag(result); | |
| 1187 if (index.IsRegister()) { | |
| 1188 __ SmiTag(index.reg()); // Re-tag. | |
| 1189 } | |
| 1190 return; | |
| 1191 } | |
| 1192 | |
| 1172 FieldAddress element_address = index.IsRegister() ? | 1193 FieldAddress element_address = index.IsRegister() ? |
| 1173 FlowGraphCompiler::ElementAddressForRegIndex( | 1194 FlowGraphCompiler::ElementAddressForRegIndex( |
| 1174 class_id(), array, index.reg()) : | 1195 class_id(), array, index.reg()) : |
| 1175 FlowGraphCompiler::ElementAddressForIntIndex( | 1196 FlowGraphCompiler::ElementAddressForIntIndex( |
| 1176 class_id(), array, Smi::Cast(index.constant()).Value()); | 1197 class_id(), array, Smi::Cast(index.constant()).Value()); |
| 1177 | 1198 |
| 1178 if (representation() == kUnboxedDouble) { | 1199 if (representation() == kUnboxedDouble) { |
| 1200 XmmRegister result = locs()->out().xmm_reg(); | |
| 1179 if (class_id() == kFloat32ArrayCid) { | 1201 if (class_id() == kFloat32ArrayCid) { |
| 1180 // Load single precision float. | 1202 // Load single precision float. |
| 1181 __ movss(locs()->out().xmm_reg(), element_address); | 1203 __ movss(result, element_address); |
| 1182 // Promote to double. | 1204 // Promote to double. |
| 1183 __ cvtss2sd(locs()->out().xmm_reg(), locs()->out().xmm_reg()); | 1205 __ cvtss2sd(result, locs()->out().xmm_reg()); |
| 1184 } else { | 1206 } else { |
| 1185 ASSERT(class_id() == kFloat64ArrayCid); | 1207 ASSERT(class_id() == kFloat64ArrayCid); |
| 1186 __ movsd(locs()->out().xmm_reg(), element_address); | 1208 __ movsd(result, element_address); |
| 1187 } | 1209 } |
| 1210 return; | |
| 1211 } | |
| 1212 | |
| 1213 Register result = locs()->out().reg(); | |
| 1214 if (class_id() == kUint8ArrayCid) { | |
| 1215 if (index.IsRegister()) { | |
| 1216 __ SmiUntag(index.reg()); | |
| 1217 } | |
| 1218 __ movzxb(result, element_address); | |
| 1219 __ SmiTag(result); | |
| 1220 if (index.IsRegister()) { | |
| 1221 __ SmiTag(index.reg()); // Re-tag. | |
| 1222 } | |
|
srdjan
2012/11/22 18:18:19
To be similar to cases above, you could do a retur
Florian Schneider
2012/11/23 14:49:39
Done.
| |
| 1188 } else { | 1223 } else { |
| 1189 __ movl(locs()->out().reg(), element_address); | 1224 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
| 1225 __ movl(result, element_address); | |
| 1190 } | 1226 } |
| 1191 } | 1227 } |
| 1192 | 1228 |
| 1193 | 1229 |
| 1194 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { | 1230 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { |
| 1195 const intptr_t kNumInputs = 3; | 1231 const intptr_t kNumInputs = 3; |
| 1196 const intptr_t kNumTemps = class_id() == kFloat32ArrayCid ? 1 : 0; | 1232 const intptr_t kNumTemps = class_id() == kFloat32ArrayCid ? 1 : 0; |
| 1197 LocationSummary* locs = | 1233 LocationSummary* locs = |
| 1198 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1234 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1199 if (class_id() == kFloat32ArrayCid) { | 1235 if (class_id() == kFloat32ArrayCid) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 // Store. | 1267 // Store. |
| 1232 __ movss(element_address, locs()->temp(0).xmm_reg()); | 1268 __ movss(element_address, locs()->temp(0).xmm_reg()); |
| 1233 return; | 1269 return; |
| 1234 } | 1270 } |
| 1235 | 1271 |
| 1236 if (class_id() == kFloat64ArrayCid) { | 1272 if (class_id() == kFloat64ArrayCid) { |
| 1237 __ movsd(element_address, locs()->in(2).xmm_reg()); | 1273 __ movsd(element_address, locs()->in(2).xmm_reg()); |
| 1238 return; | 1274 return; |
| 1239 } | 1275 } |
| 1240 | 1276 |
| 1277 ASSERT(class_id() == kArrayCid); | |
| 1241 if (ShouldEmitStoreBarrier()) { | 1278 if (ShouldEmitStoreBarrier()) { |
| 1242 Register value = locs()->in(2).reg(); | 1279 Register value = locs()->in(2).reg(); |
| 1243 __ StoreIntoObject(array, element_address, value); | 1280 __ StoreIntoObject(array, element_address, value); |
| 1244 return; | 1281 return; |
| 1245 } | 1282 } |
| 1246 | 1283 |
| 1247 if (locs()->in(2).IsConstant()) { | 1284 if (locs()->in(2).IsConstant()) { |
| 1248 const Object& constant = locs()->in(2).constant(); | 1285 const Object& constant = locs()->in(2).constant(); |
| 1249 __ StoreIntoObjectNoBarrier(array, element_address, constant); | 1286 __ StoreIntoObjectNoBarrier(array, element_address, constant); |
| 1250 } else { | 1287 } else { |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2752 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2789 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
| 2753 __ pxor(value, XMM0); | 2790 __ pxor(value, XMM0); |
| 2754 } | 2791 } |
| 2755 | 2792 |
| 2756 | 2793 |
| 2757 } // namespace dart | 2794 } // namespace dart |
| 2758 | 2795 |
| 2759 #undef __ | 2796 #undef __ |
| 2760 | 2797 |
| 2761 #endif // defined TARGET_ARCH_X64 | 2798 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |