OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 } | 1192 } |
1193 | 1193 |
1194 | 1194 |
1195 HValue* HCheckInstanceType::Canonicalize() { | 1195 HValue* HCheckInstanceType::Canonicalize() { |
1196 if (check_ == IS_STRING && | 1196 if (check_ == IS_STRING && |
1197 !value()->type().IsUninitialized() && | 1197 !value()->type().IsUninitialized() && |
1198 value()->type().IsString()) { | 1198 value()->type().IsString()) { |
1199 return NULL; | 1199 return NULL; |
1200 } | 1200 } |
1201 | 1201 |
1202 if (check_ == IS_SYMBOL && value()->IsConstant()) { | 1202 if (check_ == IS_INTERNALIZED_STRING && value()->IsConstant()) { |
1203 // Dereferencing is safe here: a symbol cannot become a non-symbol. | 1203 // Dereferencing is safe here: |
| 1204 // an internalized string cannot become non-internalized. |
1204 AllowHandleDereference allow_handle_deref; | 1205 AllowHandleDereference allow_handle_deref; |
1205 if (HConstant::cast(value())->handle()->IsSymbol()) return NULL; | 1206 if (HConstant::cast(value())->handle()->IsInternalizedString()) return NULL; |
1206 } | 1207 } |
1207 return this; | 1208 return this; |
1208 } | 1209 } |
1209 | 1210 |
1210 | 1211 |
1211 void HCheckInstanceType::GetCheckInterval(InstanceType* first, | 1212 void HCheckInstanceType::GetCheckInterval(InstanceType* first, |
1212 InstanceType* last) { | 1213 InstanceType* last) { |
1213 ASSERT(is_interval_check()); | 1214 ASSERT(is_interval_check()); |
1214 switch (check_) { | 1215 switch (check_) { |
1215 case IS_SPEC_OBJECT: | 1216 case IS_SPEC_OBJECT: |
1216 *first = FIRST_SPEC_OBJECT_TYPE; | 1217 *first = FIRST_SPEC_OBJECT_TYPE; |
1217 *last = LAST_SPEC_OBJECT_TYPE; | 1218 *last = LAST_SPEC_OBJECT_TYPE; |
1218 return; | 1219 return; |
1219 case IS_JS_ARRAY: | 1220 case IS_JS_ARRAY: |
1220 *first = *last = JS_ARRAY_TYPE; | 1221 *first = *last = JS_ARRAY_TYPE; |
1221 return; | 1222 return; |
1222 default: | 1223 default: |
1223 UNREACHABLE(); | 1224 UNREACHABLE(); |
1224 } | 1225 } |
1225 } | 1226 } |
1226 | 1227 |
1227 | 1228 |
1228 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) { | 1229 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) { |
1229 ASSERT(!is_interval_check()); | 1230 ASSERT(!is_interval_check()); |
1230 switch (check_) { | 1231 switch (check_) { |
1231 case IS_STRING: | 1232 case IS_STRING: |
1232 *mask = kIsNotStringMask; | 1233 *mask = kIsNotStringMask; |
1233 *tag = kStringTag; | 1234 *tag = kStringTag; |
1234 return; | 1235 return; |
1235 case IS_SYMBOL: | 1236 case IS_INTERNALIZED_STRING: |
1236 *mask = kIsSymbolMask; | 1237 *mask = kIsInternalizedMask; |
1237 *tag = kSymbolTag; | 1238 *tag = kInternalizedTag; |
1238 return; | 1239 return; |
1239 default: | 1240 default: |
1240 UNREACHABLE(); | 1241 UNREACHABLE(); |
1241 } | 1242 } |
1242 } | 1243 } |
1243 | 1244 |
1244 | 1245 |
1245 void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect, | 1246 void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect, |
1246 HValue* dominator) { | 1247 HValue* dominator) { |
1247 ASSERT(side_effect == kChangesMaps); | 1248 ASSERT(side_effect == kChangesMaps); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 value()->PrintNameTo(stream); | 1286 value()->PrintNameTo(stream); |
1286 stream->Add(" %p", *target()); | 1287 stream->Add(" %p", *target()); |
1287 } | 1288 } |
1288 | 1289 |
1289 | 1290 |
1290 const char* HCheckInstanceType::GetCheckName() { | 1291 const char* HCheckInstanceType::GetCheckName() { |
1291 switch (check_) { | 1292 switch (check_) { |
1292 case IS_SPEC_OBJECT: return "object"; | 1293 case IS_SPEC_OBJECT: return "object"; |
1293 case IS_JS_ARRAY: return "array"; | 1294 case IS_JS_ARRAY: return "array"; |
1294 case IS_STRING: return "string"; | 1295 case IS_STRING: return "string"; |
1295 case IS_SYMBOL: return "symbol"; | 1296 case IS_INTERNALIZED_STRING: return "internalized_string"; |
1296 } | 1297 } |
1297 UNREACHABLE(); | 1298 UNREACHABLE(); |
1298 return ""; | 1299 return ""; |
1299 } | 1300 } |
1300 | 1301 |
1301 void HCheckInstanceType::PrintDataTo(StringStream* stream) { | 1302 void HCheckInstanceType::PrintDataTo(StringStream* stream) { |
1302 stream->Add("%s ", GetCheckName()); | 1303 stream->Add("%s ", GetCheckName()); |
1303 HUnaryOperation::PrintDataTo(stream); | 1304 HUnaryOperation::PrintDataTo(stream); |
1304 } | 1305 } |
1305 | 1306 |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2934 | 2935 |
2935 | 2936 |
2936 void HCheckFunction::Verify() { | 2937 void HCheckFunction::Verify() { |
2937 HInstruction::Verify(); | 2938 HInstruction::Verify(); |
2938 ASSERT(HasNoUses()); | 2939 ASSERT(HasNoUses()); |
2939 } | 2940 } |
2940 | 2941 |
2941 #endif | 2942 #endif |
2942 | 2943 |
2943 } } // namespace v8::internal | 2944 } } // namespace v8::internal |
OLD | NEW |