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

Unified Diff: src/objects.cc

Issue 15358005: Don't create new maps in CurrentMapForDeprecated. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/objects.h ('k') | src/objects-inl.h » ('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 16d38a6c9a142471f81968bb55c9fc90b4c05ddf..1e586e8f0b26336ec68e4c664788d954490355c2 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2537,6 +2537,7 @@ MaybeObject* Map::GeneralizeRepresentation(int modify_index,
int descriptors = old_map->NumberOfOwnDescriptors();
Map* root_map = old_map->FindRootMap();
+ // Check the state of the root map.
if (!old_map->EquivalentToForTransition(root_map)) {
return CopyGeneralizeAllRepresentations();
}
@@ -2547,7 +2548,6 @@ MaybeObject* Map::GeneralizeRepresentation(int modify_index,
verbatim, descriptors, old_descriptors);
if (updated == NULL) return CopyGeneralizeAllRepresentations();
- // Check the state of the root map.
DescriptorArray* updated_descriptors = updated->instance_descriptors();
int valid = updated->NumberOfOwnDescriptors();
@@ -2624,6 +2624,34 @@ MaybeObject* Map::GeneralizeRepresentation(int modify_index,
}
+Map* Map::CurrentMapForDeprecated() {
+ AssertNoAllocation no_allocation;
+ if (!is_deprecated()) return this;
+
+ DescriptorArray* old_descriptors = instance_descriptors();
+
+ int descriptors = NumberOfOwnDescriptors();
+ Map* root_map = FindRootMap();
+
+ // Check the state of the root map.
+ if (!EquivalentToForTransition(root_map)) return NULL;
+ int verbatim = root_map->NumberOfOwnDescriptors();
+
+ Map* updated = root_map->FindUpdatedMap(
+ verbatim, descriptors, old_descriptors);
+ if (updated == NULL) return NULL;
+
+ DescriptorArray* updated_descriptors = updated->instance_descriptors();
+ int valid = updated->NumberOfOwnDescriptors();
+ if (!updated_descriptors->IsMoreGeneralThan(
+ verbatim, valid, descriptors, old_descriptors)) {
+ return NULL;
+ }
+
+ return updated;
+}
+
+
MaybeObject* JSObject::SetPropertyWithInterceptor(
Name* name,
Object* value,
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698