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

Unified Diff: src/objects.cc

Issue 240813002: Track up to 5 stable maps as field type. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/ia32/stub-cache-ia32.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4a3b54252dca409223e2227572b0a247e8c40c78..4a0173b5f3a64c5b0fa12d185f88f9c7e1ce7401 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -63,15 +63,16 @@ namespace internal {
Handle<HeapType> Object::OptimalType(Isolate* isolate,
Representation representation) {
- if (!FLAG_track_field_types) return HeapType::Any(isolate);
- if (representation.IsNone()) return HeapType::None(isolate);
- if (representation.IsHeapObject() && IsHeapObject()) {
- // We can track only JavaScript objects with stable maps.
- Handle<Map> map(HeapObject::cast(this)->map(), isolate);
- if (map->is_stable() &&
- map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE &&
- map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) {
- return HeapType::Class(map, isolate);
+ if (FLAG_track_field_types) {
+ if (representation.IsNone()) return HeapType::None(isolate);
+ if (representation.IsHeapObject() && IsHeapObject()) {
+ // We can track only JavaScript objects with stable maps.
+ Handle<Map> map(HeapObject::cast(this)->map(), isolate);
+ if (map->is_stable() &&
+ map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE &&
+ map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) {
+ return HeapType::Class(map, isolate);
+ }
}
}
return HeapType::Any(isolate);
@@ -2531,6 +2532,14 @@ Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> old_field_type,
Isolate* isolate) {
if (new_field_type->NowIs(old_field_type)) return old_field_type;
if (old_field_type->NowIs(new_field_type)) return new_field_type;
+ int num_old_classes = old_field_type->NumClasses();
+ int num_new_classes = new_field_type->NumClasses();
+ if (num_old_classes > 0 &&
+ num_new_classes > 0 &&
+ num_old_classes + num_new_classes <= 5 &&
Sven Panne 2014/04/17 06:43:41 Perhaps give the "5" a name...
Benedikt Meurer 2014/04/17 07:26:35 Done.
+ old_field_type->NowStable() && new_field_type->NowStable()) {
+ return HeapType::Union(new_field_type, old_field_type, isolate);
Sven Panne 2014/04/17 06:43:41 As discussed offline: Perhaps calculate the union
Benedikt Meurer 2014/04/17 07:26:35 Done.
+ }
return HeapType::Any(isolate);
}
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698