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

Unified Diff: src/hydrogen.cc

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.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 cf345170fb0c7692dbdb42277d7c2d2d5d32db99..c5d45772ef59816d022342b60195ec44925ac828 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5370,7 +5370,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());
}
@@ -5415,6 +5415,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,
@@ -5478,6 +5484,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;
}
@@ -5497,7 +5509,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698