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

Unified Diff: src/objects.cc

Issue 931083002: Implement most common usecase for elements kind generalization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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 775a66479bff7cd527592cacadfb79f491610a47..d745d60ad990650f66f3ff9a18dd6385c0941757 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2243,7 +2243,7 @@ Map* Map::FindLastMatchMap(int verbatim,
DisallowHeapAllocation no_allocation;
// This can only be called on roots of transition trees.
- DCHECK(GetBackPointer()->IsUndefined());
+ DCHECK_EQ(verbatim, NumberOfOwnDescriptors());
Map* current = this;
@@ -2492,6 +2492,16 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> old_map, int modify_index,
new_kind, new_attributes,
"GenAll_NotEquivalent");
}
+
+ ElementsKind from_kind = root_map->elements_kind();
+ ElementsKind to_kind = old_map->elements_kind();
+ if (from_kind != to_kind &&
+ !(IsTransitionableFastElementsKind(from_kind) &&
+ IsMoreGeneralElementsKindTransition(from_kind, to_kind))) {
+ return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
+ new_kind, new_attributes,
+ "GenAll_InvalidElementsTransition");
+ }
int root_nof = root_map->NumberOfOwnDescriptors();
if (modify_index >= 0 && modify_index < root_nof) {
PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
@@ -2511,6 +2521,11 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> old_map, int modify_index,
}
}
+ // From here on, use the map with correct elements kind as root map.
+ if (from_kind != to_kind) {
+ root_map = Map::AsElementsKind(root_map, to_kind);
+ }
+
Handle<Map> target_map = root_map;
for (int i = root_nof; i < old_nof; ++i) {
PropertyDetails old_details = old_descriptors->GetDetails(i);
@@ -9666,13 +9681,13 @@ int Map::Hash() {
static bool CheckEquivalent(Map* first, Map* second) {
- return
- first->constructor() == second->constructor() &&
- first->prototype() == second->prototype() &&
- first->instance_type() == second->instance_type() &&
- first->bit_field() == second->bit_field() &&
- first->bit_field2() == second->bit_field2() &&
- first->has_instance_call_handler() == second->has_instance_call_handler();
+ return first->constructor() == second->constructor() &&
+ first->prototype() == second->prototype() &&
+ first->instance_type() == second->instance_type() &&
+ first->bit_field() == second->bit_field() &&
+ first->is_extensible() == second->is_extensible() &&
+ first->has_instance_call_handler() ==
+ second->has_instance_call_handler();
}
@@ -9685,7 +9700,8 @@ bool Map::EquivalentToForNormalization(Map* other,
PropertyNormalizationMode mode) {
int properties = mode == CLEAR_INOBJECT_PROPERTIES
? 0 : other->inobject_properties();
- return CheckEquivalent(this, other) && inobject_properties() == properties;
+ return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() &&
+ inobject_properties() == properties;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698