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

Unified Diff: src/hydrogen.cc

Issue 1081033004: Do not inline store if field map was cleared. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index b9e032487defd50f182da1aaf35f90a80bcb7f3b..c79a8170b64ddfa0b8b3125fb6f4977db993ae6d 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -6014,7 +6014,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
access_ = HObjectAccess::ForField(map, index, representation(), name_);
// Load field map for heap objects.
- LoadFieldMaps(map);
+ return LoadFieldMaps(map);
} else if (IsAccessorConstant()) {
Handle<Object> accessors = GetAccessorsFromMap(map);
if (!accessors->IsAccessorPair()) return false;
@@ -6040,7 +6040,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
}
-void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(
+bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(
Handle<Map> map) {
// Clear any previously collected field maps/type.
field_maps_.Clear();
@@ -6051,19 +6051,26 @@ void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(
// Collect the (stable) maps from the field type.
int num_field_maps = field_type->NumClasses();
- if (num_field_maps == 0) return;
- DCHECK(access_.representation().IsHeapObject());
- field_maps_.Reserve(num_field_maps, zone());
- HeapType::Iterator<Map> it = field_type->Classes();
- while (!it.Done()) {
- Handle<Map> field_map = it.Current();
- if (!field_map->is_stable()) {
- field_maps_.Clear();
- return;
+ if (num_field_maps > 0) {
+ DCHECK(access_.representation().IsHeapObject());
+ field_maps_.Reserve(num_field_maps, zone());
+ HeapType::Iterator<Map> it = field_type->Classes();
+ while (!it.Done()) {
+ Handle<Map> field_map = it.Current();
+ if (!field_map->is_stable()) {
+ field_maps_.Clear();
+ break;
+ }
+ field_maps_.Add(field_map, zone());
+ it.Advance();
}
- field_maps_.Add(field_map, zone());
- it.Advance();
}
+
+ if (field_maps_.is_empty()) {
+ // Store is not safe if the field map was cleared.
+ return IsLoad() || !field_type->Is(HeapType::None());
+ }
+
field_maps_.Sort();
DCHECK_EQ(num_field_maps, field_maps_.length());
@@ -6074,6 +6081,7 @@ void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(
// Add dependency on the map that introduced the field.
Map::AddDependentCompilationInfo(GetFieldOwnerFromMap(map),
DependentCode::kFieldTypeGroup, top_info());
+ return true;
}
@@ -6132,8 +6140,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() {
access_ = HObjectAccess::ForField(map_, index, representation, name_);
// Load field map for heap objects.
- LoadFieldMaps(transition());
- return true;
+ return LoadFieldMaps(transition());
}
return false;
}
« no previous file with comments | « src/hydrogen.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698