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

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

Issue 11970038: Remove StringCharCodeAtInstr and handle it as part of LoadIndexed. (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
« 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { 149 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
150 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); 150 LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
151 ASSERT(other_load != NULL); 151 ASSERT(other_load != NULL);
152 // Assert that the field is initialized. 152 // Assert that the field is initialized.
153 ASSERT(field().value() != Object::sentinel().raw()); 153 ASSERT(field().value() != Object::sentinel().raw());
154 ASSERT(field().value() != Object::transition_sentinel().raw()); 154 ASSERT(field().value() != Object::transition_sentinel().raw());
155 return field().raw() == other_load->field().raw(); 155 return field().raw() == other_load->field().raw();
156 } 156 }
157 157
158 158
159 bool StringCharCodeAtInstr::AttributesEqual(Instruction* other) const {
160 StringCharCodeAtInstr* other_load = other->AsStringCharCodeAt();
161 ASSERT(other_load != NULL);
162 return class_id() == other_load->class_id();
163 }
164
165
166 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const { 159 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const {
167 LoadIndexedInstr* other_load = other->AsLoadIndexed(); 160 LoadIndexedInstr* other_load = other->AsLoadIndexed();
168 ASSERT(other_load != NULL); 161 ASSERT(other_load != NULL);
169 return class_id() == other_load->class_id(); 162 return class_id() == other_load->class_id();
170 } 163 }
171 164
172 165
173 bool ConstantInstr::AttributesEqual(Instruction* other) const { 166 bool ConstantInstr::AttributesEqual(Instruction* other) const {
174 ConstantInstr* other_constant = other->AsConstant(); 167 ConstantInstr* other_constant = other->AsConstant();
175 ASSERT(other_constant != NULL); 168 ASSERT(other_constant != NULL);
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1094
1102 1095
1103 RawAbstractType* NativeCallInstr::CompileType() const { 1096 RawAbstractType* NativeCallInstr::CompileType() const {
1104 // The result type of the native function is identical to the result type of 1097 // The result type of the native function is identical to the result type of
1105 // the enclosing native Dart function. However, we prefer to check the type 1098 // the enclosing native Dart function. However, we prefer to check the type
1106 // of the value returned from the native call. 1099 // of the value returned from the native call.
1107 return Type::DynamicType(); 1100 return Type::DynamicType();
1108 } 1101 }
1109 1102
1110 1103
1111 RawAbstractType* StringCharCodeAtInstr::CompileType() const {
1112 return Type::IntType();
1113 }
1114
1115
1116 intptr_t StringCharCodeAtInstr::ResultCid() const {
1117 return kSmiCid;
1118 }
1119
1120
1121 RawAbstractType* StringFromCharCodeInstr::CompileType() const { 1104 RawAbstractType* StringFromCharCodeInstr::CompileType() const {
1122 return Type::StringType(); 1105 return Type::StringType();
1123 } 1106 }
1124 1107
1125 1108
1126 RawAbstractType* LoadIndexedInstr::CompileType() const { 1109 RawAbstractType* LoadIndexedInstr::CompileType() const {
1127 switch (class_id_) { 1110 switch (class_id_) {
1128 case kArrayCid: 1111 case kArrayCid:
1129 case kImmutableArrayCid: 1112 case kImmutableArrayCid:
1130 return Type::DynamicType(); 1113 return Type::DynamicType();
1131 case kFloat32ArrayCid : 1114 case kFloat32ArrayCid :
1132 case kFloat64ArrayCid : 1115 case kFloat64ArrayCid :
1133 return Type::Double(); 1116 return Type::Double();
1134 case kInt8ArrayCid: 1117 case kInt8ArrayCid:
1135 case kUint8ArrayCid: 1118 case kUint8ArrayCid:
1136 case kUint8ClampedArrayCid: 1119 case kUint8ClampedArrayCid:
1137 case kExternalUint8ArrayCid: 1120 case kExternalUint8ArrayCid:
1138 case kInt16ArrayCid: 1121 case kInt16ArrayCid:
1139 case kUint16ArrayCid: 1122 case kUint16ArrayCid:
1123 case kOneByteStringCid:
1124 case kTwoByteStringCid:
1140 return Type::IntType(); 1125 return Type::IntType();
1141 default: 1126 default:
1142 UNIMPLEMENTED(); 1127 UNIMPLEMENTED();
1143 return Type::IntType(); 1128 return Type::IntType();
1144 } 1129 }
1145 } 1130 }
1146 1131
1147 1132
1148 intptr_t LoadIndexedInstr::ResultCid() const { 1133 intptr_t LoadIndexedInstr::ResultCid() const {
1149 switch (class_id_) { 1134 switch (class_id_) {
1150 case kArrayCid: 1135 case kArrayCid:
1151 case kImmutableArrayCid: 1136 case kImmutableArrayCid:
1152 return kDynamicCid; 1137 return kDynamicCid;
1153 case kFloat32ArrayCid : 1138 case kFloat32ArrayCid :
1154 case kFloat64ArrayCid : 1139 case kFloat64ArrayCid :
1155 return kDoubleCid; 1140 return kDoubleCid;
1156 case kInt8ArrayCid: 1141 case kInt8ArrayCid:
1157 case kUint8ArrayCid: 1142 case kUint8ArrayCid:
1158 case kUint8ClampedArrayCid: 1143 case kUint8ClampedArrayCid:
1159 case kExternalUint8ArrayCid: 1144 case kExternalUint8ArrayCid:
1160 case kInt16ArrayCid: 1145 case kInt16ArrayCid:
1161 case kUint16ArrayCid: 1146 case kUint16ArrayCid:
1147 case kOneByteStringCid:
1148 case kTwoByteStringCid:
1162 return kSmiCid; 1149 return kSmiCid;
1163 default: 1150 default:
1164 UNIMPLEMENTED(); 1151 UNIMPLEMENTED();
1165 return kSmiCid; 1152 return kSmiCid;
1166 } 1153 }
1167 } 1154 }
1168 1155
1169 1156
1170 Representation LoadIndexedInstr::representation() const { 1157 Representation LoadIndexedInstr::representation() const {
1171 switch (class_id_) { 1158 switch (class_id_) {
1172 case kArrayCid: 1159 case kArrayCid:
1173 case kImmutableArrayCid: 1160 case kImmutableArrayCid:
1174 case kInt8ArrayCid: 1161 case kInt8ArrayCid:
1175 case kUint8ArrayCid: 1162 case kUint8ArrayCid:
1176 case kUint8ClampedArrayCid: 1163 case kUint8ClampedArrayCid:
1177 case kExternalUint8ArrayCid: 1164 case kExternalUint8ArrayCid:
1178 case kInt16ArrayCid: 1165 case kInt16ArrayCid:
1179 case kUint16ArrayCid: 1166 case kUint16ArrayCid:
1167 case kOneByteStringCid:
1168 case kTwoByteStringCid:
1180 return kTagged; 1169 return kTagged;
1181 case kFloat32ArrayCid : 1170 case kFloat32ArrayCid :
1182 case kFloat64ArrayCid : 1171 case kFloat64ArrayCid :
1183 return kUnboxedDouble; 1172 return kUnboxedDouble;
1184 default: 1173 default:
1185 UNIMPLEMENTED(); 1174 UNIMPLEMENTED();
1186 return kTagged; 1175 return kTagged;
1187 } 1176 }
1188 } 1177 }
1189 1178
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 (recognized_kind() == MethodRecognizer::kStringBaseLength)) { 2682 (recognized_kind() == MethodRecognizer::kStringBaseLength)) {
2694 range_ = new Range(RangeBoundary::FromConstant(0), 2683 range_ = new Range(RangeBoundary::FromConstant(0),
2695 RangeBoundary::FromConstant(String::kMaxElements)); 2684 RangeBoundary::FromConstant(String::kMaxElements));
2696 return; 2685 return;
2697 } 2686 }
2698 Definition::InferRange(); 2687 Definition::InferRange();
2699 } 2688 }
2700 2689
2701 2690
2702 2691
2703 void StringCharCodeAtInstr::InferRange() {
2704 switch (class_id_) {
2705 case kOneByteStringCid:
2706 range_ = new Range(RangeBoundary::FromConstant(0),
2707 RangeBoundary::FromConstant(0xFF));
2708 break;
2709 case kTwoByteStringCid:
2710 range_ = new Range(RangeBoundary::FromConstant(0),
2711 RangeBoundary::FromConstant(0xFFFF));
2712 break;
2713 default:
2714 UNIMPLEMENTED();
2715 }
2716 }
2717
2718
2719 void LoadIndexedInstr::InferRange() { 2692 void LoadIndexedInstr::InferRange() {
2720 switch (class_id()) { 2693 switch (class_id()) {
2721 case kInt8ArrayCid: 2694 case kInt8ArrayCid:
2722 range_ = new Range(RangeBoundary::FromConstant(-128), 2695 range_ = new Range(RangeBoundary::FromConstant(-128),
2723 RangeBoundary::FromConstant(127)); 2696 RangeBoundary::FromConstant(127));
2724 break; 2697 break;
2725 case kUint8ArrayCid: 2698 case kUint8ArrayCid:
2726 case kUint8ClampedArrayCid: 2699 case kUint8ClampedArrayCid:
2727 case kExternalUint8ArrayCid: 2700 case kExternalUint8ArrayCid:
2728 range_ = new Range(RangeBoundary::FromConstant(0), 2701 range_ = new Range(RangeBoundary::FromConstant(0),
2729 RangeBoundary::FromConstant(255)); 2702 RangeBoundary::FromConstant(255));
2730 break; 2703 break;
2731 case kInt16ArrayCid: 2704 case kInt16ArrayCid:
2732 range_ = new Range(RangeBoundary::FromConstant(-32768), 2705 range_ = new Range(RangeBoundary::FromConstant(-32768),
2733 RangeBoundary::FromConstant(32767)); 2706 RangeBoundary::FromConstant(32767));
2734 break; 2707 break;
2735 case kUint16ArrayCid: 2708 case kUint16ArrayCid:
2736 range_ = new Range(RangeBoundary::FromConstant(0), 2709 range_ = new Range(RangeBoundary::FromConstant(0),
2737 RangeBoundary::FromConstant(65535)); 2710 RangeBoundary::FromConstant(65535));
2738 break; 2711 break;
2712 case kOneByteStringCid:
2713 range_ = new Range(RangeBoundary::FromConstant(0),
2714 RangeBoundary::FromConstant(0xFF));
2715 break;
2716 case kTwoByteStringCid:
2717 range_ = new Range(RangeBoundary::FromConstant(0),
2718 RangeBoundary::FromConstant(0xFFFF));
2719 break;
2739 default: 2720 default:
2740 Definition::InferRange(); 2721 Definition::InferRange();
2741 break; 2722 break;
2742 } 2723 }
2743 } 2724 }
2744 2725
2745 2726
2746 void PhiInstr::InferRange() { 2727 void PhiInstr::InferRange() {
2747 RangeBoundary new_min; 2728 RangeBoundary new_min;
2748 RangeBoundary new_max; 2729 RangeBoundary new_max;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 default: 2983 default:
3003 UNREACHABLE(); 2984 UNREACHABLE();
3004 return -1; 2985 return -1;
3005 } 2986 }
3006 } 2987 }
3007 2988
3008 2989
3009 #undef __ 2990 #undef __
3010 2991
3011 } // namespace dart 2992 } // 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