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

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

Issue 14812005: Cleanup deoptimization code to make it architecture independent (in progress). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 default: 1028 default:
1029 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1029 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1030 __ ldr(result, element_address); 1030 __ ldr(result, element_address);
1031 break; 1031 break;
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 1035
1036 Representation StoreIndexedInstr::RequiredInputRepresentation( 1036 Representation StoreIndexedInstr::RequiredInputRepresentation(
1037 intptr_t idx) const { 1037 intptr_t idx) const {
1038 UNIMPLEMENTED(); 1038 // Array can be a Dart object or a pointer to external data.
1039 return kTagged; 1039 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1040 if (idx == 1) return kTagged; // Index is a smi.
1041 ASSERT(idx == 2);
1042 switch (class_id_) {
1043 case kArrayCid:
1044 case kTypedDataInt8ArrayCid:
1045 case kTypedDataUint8ArrayCid:
1046 case kExternalTypedDataUint8ArrayCid:
1047 case kTypedDataUint8ClampedArrayCid:
1048 case kExternalTypedDataUint8ClampedArrayCid:
1049 case kTypedDataInt16ArrayCid:
1050 case kTypedDataUint16ArrayCid:
1051 return kTagged;
1052 case kTypedDataInt32ArrayCid:
1053 case kTypedDataUint32ArrayCid:
1054 return value()->IsSmiValue() ? kTagged : kUnboxedMint;
1055 case kTypedDataFloat32ArrayCid:
1056 case kTypedDataFloat64ArrayCid:
1057 return kUnboxedDouble;
1058 case kTypedDataFloat32x4ArrayCid:
1059 return kUnboxedFloat32x4;
1060 default:
1061 UNIMPLEMENTED();
1062 return kTagged;
1063 }
1040 } 1064 }
1041 1065
1042 1066
1043 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { 1067 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
1044 const intptr_t kNumInputs = 3; 1068 const intptr_t kNumInputs = 3;
1045 const intptr_t kNumTemps = 0; 1069 const intptr_t kNumTemps = 0;
1046 LocationSummary* locs = 1070 LocationSummary* locs =
1047 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1071 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1048 locs->set_in(0, Location::RequiresRegister()); 1072 locs->set_in(0, Location::RequiresRegister());
1049 // The smi index is either untagged (element size == 1), or it is left smi 1073 // The smi index is either untagged (element size == 1), or it is left smi
1050 // tagged (for all element sizes > 1). 1074 // tagged (for all element sizes > 1).
1051 // TODO(regis): Revisit and see if the index can be immediate. 1075 // TODO(regis): Revisit and see if the index can be immediate.
1052 locs->set_in(1, Location::WritableRegister()); 1076 locs->set_in(1, Location::WritableRegister());
1053 switch (class_id()) { 1077 switch (class_id()) {
1054 case kArrayCid: 1078 case kArrayCid:
1055 locs->set_in(2, ShouldEmitStoreBarrier() 1079 locs->set_in(2, ShouldEmitStoreBarrier()
1056 ? Location::WritableRegister() 1080 ? Location::WritableRegister()
1057 : Location::RegisterOrConstant(value())); 1081 : Location::RegisterOrConstant(value()));
1058 break; 1082 break;
1059 case kExternalTypedDataUint8ArrayCid: 1083 case kExternalTypedDataUint8ArrayCid:
1060 case kExternalTypedDataUint8ClampedArrayCid: 1084 case kExternalTypedDataUint8ClampedArrayCid:
1061 case kTypedDataInt8ArrayCid: 1085 case kTypedDataInt8ArrayCid:
1062 case kTypedDataUint8ArrayCid: 1086 case kTypedDataUint8ArrayCid:
1063 case kTypedDataUint8ClampedArrayCid: 1087 case kTypedDataUint8ClampedArrayCid:
1088 locs->set_in(2, Location::RegisterOrSmiConstant(value()));
1089 break;
1064 case kTypedDataInt16ArrayCid: 1090 case kTypedDataInt16ArrayCid:
1065 case kTypedDataUint16ArrayCid: 1091 case kTypedDataUint16ArrayCid:
1066 case kTypedDataInt32ArrayCid: 1092 case kTypedDataInt32ArrayCid:
1067 case kTypedDataUint32ArrayCid: 1093 case kTypedDataUint32ArrayCid:
1094 locs->set_in(2, Location::RequiresRegister());
1095 break;
1068 case kTypedDataFloat32ArrayCid: 1096 case kTypedDataFloat32ArrayCid:
1069 case kTypedDataFloat64ArrayCid: 1097 // TODO(regis): Verify.
1098 // Need temp register for float-to-double conversion.
1099 locs->AddTemp(Location::RequiresFpuRegister());
1100 // Fall through.
1101 case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants.
1070 case kTypedDataFloat32x4ArrayCid: 1102 case kTypedDataFloat32x4ArrayCid:
1071 UNIMPLEMENTED(); 1103 locs->set_in(2, Location::RequiresFpuRegister());
1072 break; 1104 break;
1073 default: 1105 default:
1074 UNREACHABLE(); 1106 UNREACHABLE();
1075 return NULL; 1107 return NULL;
1076 } 1108 }
1077 return locs; 1109 return locs;
1078 } 1110 }
1079 1111
1080 1112
1081 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1113 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } else if (locs()->in(2).IsConstant()) { 1160 } else if (locs()->in(2).IsConstant()) {
1129 const Object& constant = locs()->in(2).constant(); 1161 const Object& constant = locs()->in(2).constant();
1130 __ StoreIntoObjectNoBarrier(array, element_address, constant); 1162 __ StoreIntoObjectNoBarrier(array, element_address, constant);
1131 } else { 1163 } else {
1132 Register value = locs()->in(2).reg(); 1164 Register value = locs()->in(2).reg();
1133 __ StoreIntoObjectNoBarrier(array, element_address, value); 1165 __ StoreIntoObjectNoBarrier(array, element_address, value);
1134 } 1166 }
1135 break; 1167 break;
1136 case kTypedDataInt8ArrayCid: 1168 case kTypedDataInt8ArrayCid:
1137 case kTypedDataUint8ArrayCid: 1169 case kTypedDataUint8ArrayCid:
1138 case kExternalTypedDataUint8ArrayCid: 1170 case kExternalTypedDataUint8ArrayCid: {
1171 if (locs()->in(2).IsConstant()) {
1172 const Smi& constant = Smi::Cast(locs()->in(2).constant());
1173 __ LoadImmediate(IP, static_cast<int8_t>(constant.Value()));
1174 __ strb(IP, element_address);
1175 } else {
1176 Register value = locs()->in(2).reg();
1177 __ SmiUntag(value);
1178 __ strb(value, element_address);
1179 }
1180 break;
1181 }
1139 case kTypedDataUint8ClampedArrayCid: 1182 case kTypedDataUint8ClampedArrayCid:
1140 case kExternalTypedDataUint8ClampedArrayCid: 1183 case kExternalTypedDataUint8ClampedArrayCid: {
1184 if (locs()->in(2).IsConstant()) {
1185 const Smi& constant = Smi::Cast(locs()->in(2).constant());
1186 intptr_t value = constant.Value();
1187 // Clamp to 0x0 or 0xFF respectively.
1188 if (value > 0xFF) {
1189 value = 0xFF;
1190 } else if (value < 0) {
1191 value = 0;
1192 }
1193 __ LoadImmediate(IP, static_cast<int8_t>(value));
1194 __ strb(IP, element_address);
1195 } else {
1196 Register value = locs()->in(2).reg();
1197 Label store_value;
1198 __ SmiUntag(value);
1199 __ cmp(value, ShifterOperand(0xFF));
1200 // Clamp to 0x00 or 0xFF respectively.
1201 __ b(&store_value, LS);
1202 __ mov(value, ShifterOperand(0x00), LE);
1203 __ mov(value, ShifterOperand(0xFF), GT);
1204 __ Bind(&store_value);
1205 __ strb(value, element_address);
1206 }
1207 break;
1208 }
1141 case kTypedDataInt16ArrayCid: 1209 case kTypedDataInt16ArrayCid:
1142 case kTypedDataUint16ArrayCid: 1210 case kTypedDataUint16ArrayCid: {
1211 Register value = locs()->in(2).reg();
1212 __ SmiUntag(value);
1213 __ strh(value, element_address);
1214 break;
1215 }
1143 case kTypedDataInt32ArrayCid: 1216 case kTypedDataInt32ArrayCid:
1144 case kTypedDataUint32ArrayCid: 1217 case kTypedDataUint32ArrayCid: {
1218 if (value()->IsSmiValue()) {
1219 ASSERT(RequiredInputRepresentation(2) == kTagged);
1220 Register value = locs()->in(2).reg();
1221 __ SmiUntag(value);
1222 __ str(value, element_address);
1223 } else {
1224 UNIMPLEMENTED();
1225 }
1226 break;
1227 }
1145 case kTypedDataFloat32ArrayCid: 1228 case kTypedDataFloat32ArrayCid:
1146 case kTypedDataFloat64ArrayCid: 1229 case kTypedDataFloat64ArrayCid:
1147 case kTypedDataFloat32x4ArrayCid: 1230 case kTypedDataFloat32x4ArrayCid:
1148 UNIMPLEMENTED(); 1231 UNIMPLEMENTED();
1149 break; 1232 break;
1150 default: 1233 default:
1151 UNREACHABLE(); 1234 UNREACHABLE();
1152 } 1235 }
1153 } 1236 }
1154 1237
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 &label, 2782 &label,
2700 PcDescriptors::kOther, 2783 PcDescriptors::kOther,
2701 locs()); 2784 locs());
2702 __ Drop(2); // Discard type arguments and receiver. 2785 __ Drop(2); // Discard type arguments and receiver.
2703 } 2786 }
2704 2787
2705 } // namespace dart 2788 } // namespace dart
2706 2789
2707 #endif // defined TARGET_ARCH_ARM 2790 #endif // defined TARGET_ARCH_ARM
2708 2791
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698