OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 6345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6356 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps( | 6356 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps( |
6357 Handle<Map> map) { | 6357 Handle<Map> map) { |
6358 // Clear any previously collected field maps/type. | 6358 // Clear any previously collected field maps/type. |
6359 field_maps_.Clear(); | 6359 field_maps_.Clear(); |
6360 field_type_ = HType::Tagged(); | 6360 field_type_ = HType::Tagged(); |
6361 | 6361 |
6362 // Figure out the field type from the accessor map. | 6362 // Figure out the field type from the accessor map. |
6363 Handle<FieldType> field_type = GetFieldTypeFromMap(map); | 6363 Handle<FieldType> field_type = GetFieldTypeFromMap(map); |
6364 | 6364 |
6365 // Collect the (stable) maps from the field type. | 6365 // Collect the (stable) maps from the field type. |
6366 int num_field_maps = field_type->ClassCount(); | 6366 if (field_type->IsClass()) { |
6367 if (num_field_maps > 0) { | |
6368 DCHECK(access_.representation().IsHeapObject()); | 6367 DCHECK(access_.representation().IsHeapObject()); |
6369 field_maps_.Reserve(num_field_maps, zone()); | 6368 Handle<Map> field_map = field_type->AsClass(); |
6370 FieldType::Iterator it = field_type->Classes(); | 6369 if (field_map->is_stable()) { |
6371 while (!it.Done()) { | |
6372 Handle<Map> field_map = it.Current(); | |
6373 if (!field_map->is_stable()) { | |
6374 field_maps_.Clear(); | |
6375 break; | |
6376 } | |
6377 field_maps_.Add(field_map, zone()); | 6370 field_maps_.Add(field_map, zone()); |
6378 it.Advance(); | |
6379 } | 6371 } |
6380 } | 6372 } |
6381 | 6373 |
6382 if (field_maps_.is_empty()) { | 6374 if (field_maps_.is_empty()) { |
6383 // Store is not safe if the field map was cleared. | 6375 // Store is not safe if the field map was cleared. |
6384 return IsLoad() || !field_type->IsNone(); | 6376 return IsLoad() || !field_type->IsNone(); |
6385 } | 6377 } |
6386 | 6378 |
6387 field_maps_.Sort(); | |
6388 DCHECK_EQ(num_field_maps, field_maps_.length()); | |
6389 | |
6390 // Determine field HType from field type. | 6379 // Determine field HType from field type. |
6391 field_type_ = HType::FromFieldType(field_type, zone()); | 6380 field_type_ = HType::FromFieldType(field_type, zone()); |
6392 DCHECK(field_type_.IsHeapObject()); | 6381 DCHECK(field_type_.IsHeapObject()); |
6393 | 6382 |
6394 // Add dependency on the map that introduced the field. | 6383 // Add dependency on the map that introduced the field. |
6395 top_info()->dependencies()->AssumeFieldType(GetFieldOwnerFromMap(map)); | 6384 top_info()->dependencies()->AssumeFieldType(GetFieldOwnerFromMap(map)); |
6396 return true; | 6385 return true; |
6397 } | 6386 } |
6398 | 6387 |
6399 | 6388 |
(...skipping 7238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13638 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13627 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13639 } | 13628 } |
13640 | 13629 |
13641 #ifdef DEBUG | 13630 #ifdef DEBUG |
13642 graph_->Verify(false); // No full verify. | 13631 graph_->Verify(false); // No full verify. |
13643 #endif | 13632 #endif |
13644 } | 13633 } |
13645 | 13634 |
13646 } // namespace internal | 13635 } // namespace internal |
13647 } // namespace v8 | 13636 } // namespace v8 |
OLD | NEW |