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

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

Issue 11411142: Support loads from Uint8Array and ExternalUint8Array in the optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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.h ('k') | runtime/vm/intermediate_language_ia32.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) 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/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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 1135
1136 1136
1137 intptr_t StringFromCharCodeInstr::ResultCid() const { 1137 intptr_t StringFromCharCodeInstr::ResultCid() const {
1138 return kDynamicCid; 1138 return kDynamicCid;
1139 } 1139 }
1140 1140
1141 1141
1142 RawAbstractType* LoadIndexedInstr::CompileType() const { 1142 RawAbstractType* LoadIndexedInstr::CompileType() const {
1143 switch (class_id_) { 1143 switch (class_id_) {
1144 case kArrayCid: 1144 case kArrayCid:
1145 case kGrowableObjectArrayCid:
1146 case kImmutableArrayCid: 1145 case kImmutableArrayCid:
1147 return Type::DynamicType(); 1146 return Type::DynamicType();
1148 case kFloat32ArrayCid : 1147 case kFloat32ArrayCid :
1149 case kFloat64ArrayCid : 1148 case kFloat64ArrayCid :
1150 return Type::Double(); 1149 return Type::Double();
1150 case kUint8ArrayCid:
1151 case kExternalUint8ArrayCid:
1152 return Type::IntType();
1151 default: 1153 default:
1152 UNIMPLEMENTED(); 1154 UNIMPLEMENTED();
1153 return Type::IntType(); 1155 return Type::IntType();
1154 } 1156 }
1155 } 1157 }
1156 1158
1157 1159
1158 intptr_t LoadIndexedInstr::ResultCid() const { 1160 intptr_t LoadIndexedInstr::ResultCid() const {
1159 switch (class_id_) { 1161 switch (class_id_) {
1160 case kArrayCid: 1162 case kArrayCid:
1161 case kGrowableObjectArrayCid:
1162 case kImmutableArrayCid: 1163 case kImmutableArrayCid:
1163 return kDynamicCid; 1164 return kDynamicCid;
1164 case kFloat32ArrayCid : 1165 case kFloat32ArrayCid :
1165 case kFloat64ArrayCid : 1166 case kFloat64ArrayCid :
1166 return kDoubleCid; 1167 return kDoubleCid;
1168 case kUint8ArrayCid:
1169 case kExternalUint8ArrayCid:
1170 return kSmiCid;
1167 default: 1171 default:
1168 UNIMPLEMENTED(); 1172 UNIMPLEMENTED();
1169 return kSmiCid; 1173 return kSmiCid;
1170 } 1174 }
1171 } 1175 }
1172 1176
1173 1177
1174 Representation LoadIndexedInstr::representation() const { 1178 Representation LoadIndexedInstr::representation() const {
1175 switch (class_id_) { 1179 switch (class_id_) {
1176 case kArrayCid: 1180 case kArrayCid:
1177 case kGrowableObjectArrayCid:
1178 case kImmutableArrayCid: 1181 case kImmutableArrayCid:
1182 case kUint8ArrayCid:
1183 case kExternalUint8ArrayCid:
1179 return kTagged; 1184 return kTagged;
1180 case kFloat32ArrayCid : 1185 case kFloat32ArrayCid :
1181 case kFloat64ArrayCid : 1186 case kFloat64ArrayCid :
1182 return kUnboxedDouble; 1187 return kUnboxedDouble;
1183 default: 1188 default:
1184 UNIMPLEMENTED(); 1189 UNIMPLEMENTED();
1185 return kTagged; 1190 return kTagged;
1186 } 1191 }
1187 } 1192 }
1188 1193
1189 1194
1190 RawAbstractType* StoreIndexedInstr::CompileType() const { 1195 RawAbstractType* StoreIndexedInstr::CompileType() const {
1191 return AbstractType::null(); 1196 return AbstractType::null();
1192 } 1197 }
1193 1198
1194 1199
1195 Representation StoreIndexedInstr::RequiredInputRepresentation( 1200 Representation StoreIndexedInstr::RequiredInputRepresentation(
1196 intptr_t idx) const { 1201 intptr_t idx) const {
1197 if ((idx == 0) || (idx == 1)) return kTagged; 1202 if ((idx == 0) || (idx == 1)) return kTagged;
1198 ASSERT(idx == 2); 1203 ASSERT(idx == 2);
1199 switch (class_id_) { 1204 switch (class_id_) {
1200 case kArrayCid: 1205 case kArrayCid:
1201 case kGrowableObjectArrayCid:
1202 case kImmutableArrayCid:
1203 return kTagged; 1206 return kTagged;
1204 case kFloat32ArrayCid : 1207 case kFloat32ArrayCid :
1205 case kFloat64ArrayCid : 1208 case kFloat64ArrayCid :
1206 return kUnboxedDouble; 1209 return kUnboxedDouble;
1207 default: 1210 default:
1208 UNIMPLEMENTED(); 1211 UNIMPLEMENTED();
1209 return kTagged; 1212 return kTagged;
1210 } 1213 }
1211 } 1214 }
1212 1215
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 ((recognized_kind() == MethodRecognizer::kObjectArrayLength) || 2433 ((recognized_kind() == MethodRecognizer::kObjectArrayLength) ||
2431 (recognized_kind() == MethodRecognizer::kImmutableArrayLength))) { 2434 (recognized_kind() == MethodRecognizer::kImmutableArrayLength))) {
2432 range_ = new Range(RangeBoundary::FromConstant(0), 2435 range_ = new Range(RangeBoundary::FromConstant(0),
2433 RangeBoundary::FromConstant(Array::kMaxElements)); 2436 RangeBoundary::FromConstant(Array::kMaxElements));
2434 return; 2437 return;
2435 } 2438 }
2436 Definition::InferRange(); 2439 Definition::InferRange();
2437 } 2440 }
2438 2441
2439 2442
2443 void LoadIndexedInstr::InferRange() {
2444 switch (class_id()) {
2445 case kExternalUint8ArrayCid:
2446 case kUint8ArrayCid:
2447 range_ = new Range(RangeBoundary::FromConstant(0),
2448 RangeBoundary::FromConstant(255));
2449 break;
2450 default:
2451 Definition::InferRange();
2452 break;
2453 }
2454 }
2455
2456
2440 void PhiInstr::InferRange() { 2457 void PhiInstr::InferRange() {
2441 RangeBoundary new_min; 2458 RangeBoundary new_min;
2442 RangeBoundary new_max; 2459 RangeBoundary new_max;
2443 2460
2444 for (intptr_t i = 0; i < InputCount(); i++) { 2461 for (intptr_t i = 0; i < InputCount(); i++) {
2445 Range* input_range = InputAt(i)->definition()->range(); 2462 Range* input_range = InputAt(i)->definition()->range();
2446 if (input_range == NULL) { 2463 if (input_range == NULL) {
2447 range_ = Range::Unknown(); 2464 range_ = Range::Unknown();
2448 return; 2465 return;
2449 } 2466 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 case kFloat64ArrayCid: 2672 case kFloat64ArrayCid:
2656 return Float64Array::length_offset(); 2673 return Float64Array::length_offset();
2657 case kFloat32ArrayCid: 2674 case kFloat32ArrayCid:
2658 return Float32Array::length_offset(); 2675 return Float32Array::length_offset();
2659 case kOneByteStringCid: 2676 case kOneByteStringCid:
2660 case kTwoByteStringCid: 2677 case kTwoByteStringCid:
2661 return String::length_offset(); 2678 return String::length_offset();
2662 case kArrayCid: 2679 case kArrayCid:
2663 case kImmutableArrayCid: 2680 case kImmutableArrayCid:
2664 return Array::length_offset(); 2681 return Array::length_offset();
2682 case kUint8ArrayCid:
2683 return Uint8Array::length_offset();
2684 case kExternalUint8ArrayCid:
2685 return ByteArray::length_offset();
2665 default: 2686 default:
2666 UNREACHABLE(); 2687 UNREACHABLE();
2667 return -1; 2688 return -1;
2668 } 2689 }
2669 } 2690 }
2670 2691
2671 #undef __ 2692 #undef __
2672 2693
2673 } // namespace dart 2694 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698