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 6342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6353 } | 6353 } |
6354 | 6354 |
6355 | 6355 |
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<HeapType> 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->NumClasses(); | 6366 int num_field_maps = field_type->ClassCount(); |
6367 if (num_field_maps > 0) { | 6367 if (num_field_maps > 0) { |
6368 DCHECK(access_.representation().IsHeapObject()); | 6368 DCHECK(access_.representation().IsHeapObject()); |
6369 field_maps_.Reserve(num_field_maps, zone()); | 6369 field_maps_.Reserve(num_field_maps, zone()); |
6370 HeapType::Iterator<Map> it = field_type->Classes(); | 6370 FieldType::Iterator it = field_type->Classes(); |
6371 while (!it.Done()) { | 6371 while (!it.Done()) { |
6372 Handle<Map> field_map = it.Current(); | 6372 Handle<Map> field_map = it.Current(); |
6373 if (!field_map->is_stable()) { | 6373 if (!field_map->is_stable()) { |
6374 field_maps_.Clear(); | 6374 field_maps_.Clear(); |
6375 break; | 6375 break; |
6376 } | 6376 } |
6377 field_maps_.Add(field_map, zone()); | 6377 field_maps_.Add(field_map, zone()); |
6378 it.Advance(); | 6378 it.Advance(); |
6379 } | 6379 } |
6380 } | 6380 } |
6381 | 6381 |
6382 if (field_maps_.is_empty()) { | 6382 if (field_maps_.is_empty()) { |
6383 // Store is not safe if the field map was cleared. | 6383 // Store is not safe if the field map was cleared. |
6384 return IsLoad() || !field_type->Is(HeapType::None()); | 6384 return IsLoad() || !field_type->IsNone(); |
6385 } | 6385 } |
6386 | 6386 |
6387 field_maps_.Sort(); | 6387 field_maps_.Sort(); |
6388 DCHECK_EQ(num_field_maps, field_maps_.length()); | 6388 DCHECK_EQ(num_field_maps, field_maps_.length()); |
6389 | 6389 |
6390 // Determine field HType from field HeapType. | 6390 // Determine field HType from field type. |
6391 field_type_ = HType::FromType<HeapType>(field_type); | 6391 field_type_ = HType::FromFieldType(field_type, zone()); |
6392 DCHECK(field_type_.IsHeapObject()); | 6392 DCHECK(field_type_.IsHeapObject()); |
6393 | 6393 |
6394 // Add dependency on the map that introduced the field. | 6394 // Add dependency on the map that introduced the field. |
6395 top_info()->dependencies()->AssumeFieldType(GetFieldOwnerFromMap(map)); | 6395 top_info()->dependencies()->AssumeFieldType(GetFieldOwnerFromMap(map)); |
6396 return true; | 6396 return true; |
6397 } | 6397 } |
6398 | 6398 |
6399 | 6399 |
6400 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { | 6400 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { |
6401 Handle<Map> map = this->map(); | 6401 Handle<Map> map = this->map(); |
(...skipping 7236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13638 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13638 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13639 } | 13639 } |
13640 | 13640 |
13641 #ifdef DEBUG | 13641 #ifdef DEBUG |
13642 graph_->Verify(false); // No full verify. | 13642 graph_->Verify(false); // No full verify. |
13643 #endif | 13643 #endif |
13644 } | 13644 } |
13645 | 13645 |
13646 } // namespace internal | 13646 } // namespace internal |
13647 } // namespace v8 | 13647 } // namespace v8 |
OLD | NEW |