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

Unified Diff: src/hydrogen.cc

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 96f4e7899b9df6211e7468e9047a402efa44c055..866b96da085aca7c8a855470a32e699c10108ceb 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5352,7 +5352,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField(
access = HObjectAccess::ForHeapNumberValue();
}
return New<HLoadNamedField>(
- checked_object, static_cast<HValue*>(NULL), access);
+ checked_object, static_cast<HValue*>(NULL), access, info->field_map());
}
@@ -5397,6 +5397,12 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
value, STORE_TO_INITIALIZED_ENTRY);
}
} else {
+ if (!info->field_map().is_null()) {
+ ASSERT(field_access.representation().IsHeapObject());
+ BuildCheckHeapObject(value);
+ value = BuildCheckMap(value, info->field_map());
+ }
+
// This is a normal store.
instr = New<HStoreNamedField>(
checked_object->ActualValue(), field_access, value,
@@ -5460,6 +5466,12 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible(
}
if (info->access_.offset() != access_.offset()) return false;
if (info->access_.IsInobject() != access_.IsInobject()) return false;
+ if (!field_map_.is_identical_to(info->field_map_)) {
+ if (!IsLoad()) return false;
+
+ // Throw away type information for merging polymorphic loads.
+ field_map_ = info->field_map_ = Handle<Map>();
+ }
info->GeneralizeRepresentation(r);
return true;
}
@@ -5479,7 +5491,26 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
}
if (lookup_.IsField()) {
+ // Construct the object field access.
access_ = HObjectAccess::ForField(map, &lookup_, name_);
+
+ if (access_.representation().IsHeapObject()) {
+ // Figure out the field type from the accessor map.
+ HeapType* field_type = lookup_.GetFieldTypeFromMap(*map);
+ if (field_type->IsClass()) {
+ Handle<Map> field_map = field_type->AsClass();
+ if (field_map->is_stable()) { // TODO(bmeurer)
+ field_map_ = field_map;
+ field_map_->AddDependentCompilationInfo(
+ DependentCode::kPrototypeCheckGroup, top_info());
+
+ // Add dependency on the map that introduced the field.
+ Handle<Map> field_owner = handle(lookup_.GetFieldOwnerFromMap(*map));
+ field_owner->AddDependentCompilationInfo(
+ DependentCode::kFieldTypeGroup, top_info());
+ }
+ }
+ }
} else if (lookup_.IsPropertyCallbacks()) {
Handle<Object> callback(lookup_.GetValueFromMap(*map), isolate());
if (!callback->IsAccessorPair()) return false;
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698