| 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 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3291 check_map->map_set_.Add(map, zone); | 3291 check_map->map_set_.Add(map, zone); |
| 3292 if (map->CanOmitMapChecks() && | 3292 if (map->CanOmitMapChecks() && |
| 3293 value->IsConstant() && | 3293 value->IsConstant() && |
| 3294 HConstant::cast(value)->InstanceOf(map)) { | 3294 HConstant::cast(value)->InstanceOf(map)) { |
| 3295 check_map->omit(info); | 3295 check_map->omit(info); |
| 3296 } | 3296 } |
| 3297 return check_map; | 3297 return check_map; |
| 3298 } | 3298 } |
| 3299 | 3299 |
| 3300 | 3300 |
| 3301 HCheckMaps* HCheckMaps::NewWithTransitions(HValue* value, | |
| 3302 Handle<Map> map, | |
| 3303 Zone* zone, | |
| 3304 CompilationInfo* info) { | |
| 3305 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, value); | |
| 3306 check_map->map_set_.Add(map, zone); | |
| 3307 | |
| 3308 // Since transitioned elements maps of the initial map don't fail the map | |
| 3309 // check, the CheckMaps instruction doesn't need to depend on ElementsKinds. | |
| 3310 check_map->ClearGVNFlag(kDependsOnElementsKind); | |
| 3311 | |
| 3312 ElementsKind kind = map->elements_kind(); | |
| 3313 bool packed = IsFastPackedElementsKind(kind); | |
| 3314 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { | |
| 3315 kind = GetNextMoreGeneralFastElementsKind(kind, packed); | |
| 3316 Map* transitioned_map = | |
| 3317 map->LookupElementsTransitionMap(kind); | |
| 3318 if (transitioned_map) { | |
| 3319 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); | |
| 3320 } | |
| 3321 }; | |
| 3322 | |
| 3323 if (map->CanOmitMapChecks() && | |
| 3324 value->IsConstant() && | |
| 3325 HConstant::cast(value)->InstanceOf(map)) { | |
| 3326 check_map->omit(info); | |
| 3327 } | |
| 3328 | |
| 3329 check_map->map_set_.Sort(); | |
| 3330 return check_map; | |
| 3331 } | |
| 3332 | |
| 3333 | |
| 3334 void HCheckMaps::FinalizeUniqueValueId() { | 3301 void HCheckMaps::FinalizeUniqueValueId() { |
| 3335 if (!map_unique_ids_.is_empty()) return; | 3302 if (!map_unique_ids_.is_empty()) return; |
| 3336 Zone* zone = block()->zone(); | 3303 Zone* zone = block()->zone(); |
| 3337 map_unique_ids_.Initialize(map_set_.length(), zone); | 3304 map_unique_ids_.Initialize(map_set_.length(), zone); |
| 3338 for (int i = 0; i < map_set_.length(); i++) { | 3305 for (int i = 0; i < map_set_.length(); i++) { |
| 3339 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); | 3306 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); |
| 3340 } | 3307 } |
| 3341 } | 3308 } |
| 3342 | 3309 |
| 3343 | 3310 |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4566 break; | 4533 break; |
| 4567 case kExternalMemory: | 4534 case kExternalMemory: |
| 4568 stream->Add("[external-memory]"); | 4535 stream->Add("[external-memory]"); |
| 4569 break; | 4536 break; |
| 4570 } | 4537 } |
| 4571 | 4538 |
| 4572 stream->Add("@%d", offset()); | 4539 stream->Add("@%d", offset()); |
| 4573 } | 4540 } |
| 4574 | 4541 |
| 4575 } } // namespace v8::internal | 4542 } } // namespace v8::internal |
| OLD | NEW |