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

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

Issue 12041005: Optimize loads and stores to Int32Array and Uint32Array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 return Type::DynamicType(); 1121 return Type::DynamicType();
1122 case kFloat32ArrayCid : 1122 case kFloat32ArrayCid :
1123 case kFloat64ArrayCid : 1123 case kFloat64ArrayCid :
1124 return Type::Double(); 1124 return Type::Double();
1125 case kInt8ArrayCid: 1125 case kInt8ArrayCid:
1126 case kUint8ArrayCid: 1126 case kUint8ArrayCid:
1127 case kUint8ClampedArrayCid: 1127 case kUint8ClampedArrayCid:
1128 case kExternalUint8ArrayCid: 1128 case kExternalUint8ArrayCid:
1129 case kInt16ArrayCid: 1129 case kInt16ArrayCid:
1130 case kUint16ArrayCid: 1130 case kUint16ArrayCid:
1131 case kInt32ArrayCid:
1132 case kUint32ArrayCid:
1131 case kOneByteStringCid: 1133 case kOneByteStringCid:
1132 case kTwoByteStringCid: 1134 case kTwoByteStringCid:
1133 return Type::IntType(); 1135 return Type::IntType();
1134 default: 1136 default:
1135 UNIMPLEMENTED(); 1137 UNIMPLEMENTED();
1136 return Type::IntType(); 1138 return Type::IntType();
1137 } 1139 }
1138 } 1140 }
1139 1141
1140 1142
1141 intptr_t LoadIndexedInstr::ResultCid() const {
1142 switch (class_id_) {
1143 case kArrayCid:
1144 case kImmutableArrayCid:
1145 return kDynamicCid;
1146 case kFloat32ArrayCid :
1147 case kFloat64ArrayCid :
1148 return kDoubleCid;
1149 case kInt8ArrayCid:
1150 case kUint8ArrayCid:
1151 case kUint8ClampedArrayCid:
1152 case kExternalUint8ArrayCid:
1153 case kInt16ArrayCid:
1154 case kUint16ArrayCid:
1155 case kOneByteStringCid:
1156 case kTwoByteStringCid:
1157 return kSmiCid;
1158 default:
1159 UNIMPLEMENTED();
1160 return kSmiCid;
1161 }
1162 }
1163
1164
1165 Representation LoadIndexedInstr::representation() const {
1166 switch (class_id_) {
1167 case kArrayCid:
1168 case kImmutableArrayCid:
1169 case kInt8ArrayCid:
1170 case kUint8ArrayCid:
1171 case kUint8ClampedArrayCid:
1172 case kExternalUint8ArrayCid:
1173 case kInt16ArrayCid:
1174 case kUint16ArrayCid:
1175 case kOneByteStringCid:
1176 case kTwoByteStringCid:
1177 return kTagged;
1178 case kFloat32ArrayCid :
1179 case kFloat64ArrayCid :
1180 return kUnboxedDouble;
1181 default:
1182 UNIMPLEMENTED();
1183 return kTagged;
1184 }
1185 }
1186
1187
1188 RawAbstractType* StoreIndexedInstr::CompileType() const { 1143 RawAbstractType* StoreIndexedInstr::CompileType() const {
1189 return AbstractType::null(); 1144 return AbstractType::null();
1190 } 1145 }
1191 1146
1192 1147
1193 Representation StoreIndexedInstr::RequiredInputRepresentation(
1194 intptr_t idx) const {
1195 if ((idx == 0) || (idx == 1)) return kTagged;
1196 ASSERT(idx == 2);
1197 switch (class_id_) {
1198 case kArrayCid:
1199 case kInt8ArrayCid:
1200 case kUint8ArrayCid:
1201 case kUint8ClampedArrayCid:
1202 case kInt16ArrayCid:
1203 case kUint16ArrayCid:
1204 return kTagged;
1205 case kFloat32ArrayCid :
1206 case kFloat64ArrayCid :
1207 return kUnboxedDouble;
1208 default:
1209 UNIMPLEMENTED();
1210 return kTagged;
1211 }
1212 }
1213
1214
1215 RawAbstractType* StoreInstanceFieldInstr::CompileType() const { 1148 RawAbstractType* StoreInstanceFieldInstr::CompileType() const {
1216 return value()->CompileType(); 1149 return value()->CompileType();
1217 } 1150 }
1218 1151
1219 1152
1220 RawAbstractType* LoadStaticFieldInstr::CompileType() const { 1153 RawAbstractType* LoadStaticFieldInstr::CompileType() const {
1221 if (FLAG_enable_type_checks) { 1154 if (FLAG_enable_type_checks) {
1222 return field().type(); 1155 return field().type();
1223 } 1156 }
1224 return Type::DynamicType(); 1157 return Type::DynamicType();
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 return ByteArray::length_offset(); 2612 return ByteArray::length_offset();
2680 default: 2613 default:
2681 UNREACHABLE(); 2614 UNREACHABLE();
2682 return -1; 2615 return -1;
2683 } 2616 }
2684 } 2617 }
2685 2618
2686 #undef __ 2619 #undef __
2687 2620
2688 } // namespace dart 2621 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698