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

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

Issue 12086045: On Ia32 optimistically assume that results from int32 and uint32 array loads fit into Smi. Only if … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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_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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 case kUint8ClampedArrayCid: 1107 case kUint8ClampedArrayCid:
1108 case kExternalUint8ArrayCid: 1108 case kExternalUint8ArrayCid:
1109 case kInt16ArrayCid: 1109 case kInt16ArrayCid:
1110 case kUint16ArrayCid: 1110 case kUint16ArrayCid:
1111 case kOneByteStringCid: 1111 case kOneByteStringCid:
1112 case kTwoByteStringCid: 1112 case kTwoByteStringCid:
1113 return kSmiCid; 1113 return kSmiCid;
1114 case kInt32ArrayCid: 1114 case kInt32ArrayCid:
1115 case kUint32ArrayCid: 1115 case kUint32ArrayCid:
1116 // Result can be smi or mint when boxed. 1116 // Result can be smi or mint when boxed.
1117 return kDynamicCid; 1117 // Optimistic assumption that result is Smi means that the instruction
1118 // can deoptimize.
1119 return CanDeoptimize() ? kSmiCid : kDynamicCid;
1118 default: 1120 default:
1119 UNIMPLEMENTED(); 1121 UNIMPLEMENTED();
1120 return kDynamicCid; 1122 return kDynamicCid;
1121 } 1123 }
1122 } 1124 }
1123 1125
1124 1126
1125 Representation LoadIndexedInstr::representation() const { 1127 Representation LoadIndexedInstr::representation() const {
1126 switch (class_id_) { 1128 switch (class_id_) {
1127 case kArrayCid: 1129 case kArrayCid:
1128 case kImmutableArrayCid: 1130 case kImmutableArrayCid:
1129 case kInt8ArrayCid: 1131 case kInt8ArrayCid:
1130 case kUint8ArrayCid: 1132 case kUint8ArrayCid:
1131 case kUint8ClampedArrayCid: 1133 case kUint8ClampedArrayCid:
1132 case kExternalUint8ArrayCid: 1134 case kExternalUint8ArrayCid:
1133 case kInt16ArrayCid: 1135 case kInt16ArrayCid:
1134 case kUint16ArrayCid: 1136 case kUint16ArrayCid:
1135 case kOneByteStringCid: 1137 case kOneByteStringCid:
1136 case kTwoByteStringCid: 1138 case kTwoByteStringCid:
1137 return kTagged; 1139 return kTagged;
1138 case kInt32ArrayCid: 1140 case kInt32ArrayCid:
1139 case kUint32ArrayCid: 1141 case kUint32ArrayCid:
1140 return kUnboxedMint; 1142 // Optimistic assumption that result is Smi means that the instruction
1143 // can deoptimize.
1144 return CanDeoptimize() ? kTagged : kUnboxedMint;
1141 case kFloat32ArrayCid : 1145 case kFloat32ArrayCid :
1142 case kFloat64ArrayCid : 1146 case kFloat64ArrayCid :
1143 return kUnboxedDouble; 1147 return kUnboxedDouble;
1144 default: 1148 default:
1145 UNIMPLEMENTED(); 1149 UNIMPLEMENTED();
1146 return kTagged; 1150 return kTagged;
1147 } 1151 }
1148 } 1152 }
1149 1153
1150 1154
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 break; 1250 break;
1247 case kInt16ArrayCid: 1251 case kInt16ArrayCid:
1248 __ movsxw(result, element_address); 1252 __ movsxw(result, element_address);
1249 __ SmiTag(result); 1253 __ SmiTag(result);
1250 break; 1254 break;
1251 case kUint16ArrayCid: 1255 case kUint16ArrayCid:
1252 case kTwoByteStringCid: 1256 case kTwoByteStringCid:
1253 __ movzxw(result, element_address); 1257 __ movzxw(result, element_address);
1254 __ SmiTag(result); 1258 __ SmiTag(result);
1255 break; 1259 break;
1260 case kInt32ArrayCid: {
1261 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptInt32Load);
1262 __ movl(result, element_address);
1263 // Verify that the signed value in 'result' can fit inside a Smi.
1264 __ cmpl(result, Immediate(0xC0000000));
1265 __ j(NEGATIVE, deopt);
1266 __ SmiTag(result);
1267 }
1268 break;
1269 case kUint32ArrayCid: {
1270 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptUint32Load);
1271 __ movl(result, element_address);
1272 // Verify that the unsigned value in 'result' can fit inside a Smi.
1273 __ testl(result, Immediate(0xC0000000));
1274 __ j(NOT_ZERO, deopt);
1275 __ SmiTag(result);
1276 }
1277 break;
1256 default: 1278 default:
1257 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1279 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1258 __ movl(result, element_address); 1280 __ movl(result, element_address);
1259 break; 1281 break;
1260 } 1282 }
1261 } 1283 }
1262 1284
1263 1285
1264 Representation StoreIndexedInstr::RequiredInputRepresentation( 1286 Representation StoreIndexedInstr::RequiredInputRepresentation(
1265 intptr_t idx) const { 1287 intptr_t idx) const {
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after
3346 PcDescriptors::kOther, 3368 PcDescriptors::kOther,
3347 locs()); 3369 locs());
3348 __ Drop(2); // Discard type arguments and receiver. 3370 __ Drop(2); // Discard type arguments and receiver.
3349 } 3371 }
3350 3372
3351 } // namespace dart 3373 } // namespace dart
3352 3374
3353 #undef __ 3375 #undef __
3354 3376
3355 #endif // defined TARGET_ARCH_IA32 3377 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698