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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 408373002: Adds intrinsics for Float64Array [] and []=. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 Location::RequiresRegister())); 1070 Location::RequiresRegister()));
1071 } 1071 }
1072 } else { 1072 } else {
1073 ASSERT(representation() == kTagged); 1073 ASSERT(representation() == kTagged);
1074 locs->set_out(0, Location::RequiresRegister()); 1074 locs->set_out(0, Location::RequiresRegister());
1075 } 1075 }
1076 return locs; 1076 return locs;
1077 } 1077 }
1078 1078
1079 1079
1080 static Address ElementAddressForIntIndex(bool is_external,
1081 intptr_t cid,
1082 intptr_t index_scale,
1083 Register array,
1084 intptr_t index) {
1085 if (is_external) {
1086 return Address(array, index * index_scale);
1087 } else {
1088 const int64_t disp = static_cast<int64_t>(index) * index_scale +
1089 Instance::DataOffsetFor(cid);
1090 ASSERT(Utils::IsInt(32, disp));
1091 return FieldAddress(array, static_cast<int32_t>(disp));
1092 }
1093 }
1094
1095
1096 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
1097 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with
1098 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
1099 // expected to be untagged before accessing.
1100 ASSERT(kSmiTagShift == 1);
1101 switch (index_scale) {
1102 case 1: return TIMES_1;
1103 case 2: return TIMES_1;
1104 case 4: return TIMES_2;
1105 case 8: return TIMES_4;
1106 case 16: return TIMES_8;
1107 default:
1108 UNREACHABLE();
1109 return TIMES_1;
1110 }
1111 }
1112
1113
1114 static Address ElementAddressForRegIndex(bool is_external,
1115 intptr_t cid,
1116 intptr_t index_scale,
1117 Register array,
1118 Register index) {
1119 if (is_external) {
1120 return Address(array, index, ToScaleFactor(index_scale), 0);
1121 } else {
1122 return FieldAddress(array,
1123 index,
1124 ToScaleFactor(index_scale),
1125 Instance::DataOffsetFor(cid));
1126 }
1127 }
1128
1129
1130 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1080 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1131 // The array register points to the backing store for external arrays. 1081 // The array register points to the backing store for external arrays.
1132 const Register array = locs()->in(0).reg(); 1082 const Register array = locs()->in(0).reg();
1133 const Location index = locs()->in(1); 1083 const Location index = locs()->in(1);
1134 1084
1135 Address element_address = index.IsRegister() 1085 Address element_address = index.IsRegister()
1136 ? ElementAddressForRegIndex(IsExternal(), class_id(), index_scale(), 1086 ? Assembler::ElementAddressForRegIndex(
1137 array, index.reg()) 1087 IsExternal(), class_id(), index_scale(), array, index.reg())
1138 : ElementAddressForIntIndex(IsExternal(), class_id(), index_scale(), 1088 : Assembler::ElementAddressForIntIndex(
1139 array, Smi::Cast(index.constant()).Value()); 1089 IsExternal(), class_id(), index_scale(),
1090 array, Smi::Cast(index.constant()).Value());
1140 1091
1141 if ((representation() == kUnboxedDouble) || 1092 if ((representation() == kUnboxedDouble) ||
1142 (representation() == kUnboxedFloat32x4) || 1093 (representation() == kUnboxedFloat32x4) ||
1143 (representation() == kUnboxedInt32x4) || 1094 (representation() == kUnboxedInt32x4) ||
1144 (representation() == kUnboxedFloat64x2)) { 1095 (representation() == kUnboxedFloat64x2)) {
1145 XmmRegister result = locs()->out(0).fpu_reg(); 1096 XmmRegister result = locs()->out(0).fpu_reg();
1146 if ((index_scale() == 1) && index.IsRegister()) { 1097 if ((index_scale() == 1) && index.IsRegister()) {
1147 __ SmiUntag(index.reg()); 1098 __ SmiUntag(index.reg());
1148 } 1099 }
1149 switch (class_id()) { 1100 switch (class_id()) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 return locs; 1302 return locs;
1352 } 1303 }
1353 1304
1354 1305
1355 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1306 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1356 // The array register points to the backing store for external arrays. 1307 // The array register points to the backing store for external arrays.
1357 const Register array = locs()->in(0).reg(); 1308 const Register array = locs()->in(0).reg();
1358 const Location index = locs()->in(1); 1309 const Location index = locs()->in(1);
1359 1310
1360 Address element_address = index.IsRegister() 1311 Address element_address = index.IsRegister()
1361 ? ElementAddressForRegIndex(IsExternal(), class_id(), index_scale(), 1312 ? Assembler::ElementAddressForRegIndex(
1362 array, index.reg()) 1313 IsExternal(), class_id(), index_scale(), array, index.reg())
1363 : ElementAddressForIntIndex(IsExternal(), class_id(), index_scale(), 1314 : Assembler::ElementAddressForIntIndex(
1364 array, Smi::Cast(index.constant()).Value()); 1315 IsExternal(), class_id(), index_scale(),
1316 array, Smi::Cast(index.constant()).Value());
1365 1317
1366 if ((index_scale() == 1) && index.IsRegister()) { 1318 if ((index_scale() == 1) && index.IsRegister()) {
1367 __ SmiUntag(index.reg()); 1319 __ SmiUntag(index.reg());
1368 } 1320 }
1369 switch (class_id()) { 1321 switch (class_id()) {
1370 case kArrayCid: 1322 case kArrayCid:
1371 if (ShouldEmitStoreBarrier()) { 1323 if (ShouldEmitStoreBarrier()) {
1372 Register value = locs()->in(2).reg(); 1324 Register value = locs()->in(2).reg();
1373 __ StoreIntoObject(array, element_address, value); 1325 __ StoreIntoObject(array, element_address, value);
1374 } else if (locs()->in(2).IsConstant()) { 1326 } else if (locs()->in(2).IsConstant()) {
(...skipping 5482 matching lines...) Expand 10 before | Expand all | Expand 10 after
6857 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6809 __ movl(EDX, Immediate(kInvalidObjectPointer));
6858 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6810 __ movl(EDX, Immediate(kInvalidObjectPointer));
6859 #endif 6811 #endif
6860 } 6812 }
6861 6813
6862 } // namespace dart 6814 } // namespace dart
6863 6815
6864 #undef __ 6816 #undef __
6865 6817
6866 #endif // defined TARGET_ARCH_IA32 6818 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698