@@ -646,7 +646,7 @@ Map Map::FindRootMap(Isolate* isolate) const {
646
646
// Initial map always owns descriptors and doesn't have unused entries
647
647
// in the descriptor array.
648
648
DCHECK (result.owns_descriptors ());
649
- DCHECK_EQ (result.NumberOfOwnDescriptors (),
649
+ DCHECK_LE (result.NumberOfOwnDescriptors (),
650
650
result.instance_descriptors ().number_of_descriptors ());
651
651
return result;
652
652
}
@@ -1192,7 +1192,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate,
1192
1192
DisallowHeapAllocation no_allocation;
1193
1193
DisallowDeoptimization no_deoptimization (isolate);
1194
1194
1195
- if (is_prototype_map ( )) return Map ();
1195
+ if (IsDetached (isolate )) return Map ();
1196
1196
1197
1197
ElementsKind kind = elements_kind ();
1198
1198
bool packed = IsFastPackedElementsKind (kind);
@@ -1325,7 +1325,7 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
1325
1325
1326
1326
ElementsKind kind = map->elements_kind ();
1327
1327
TransitionFlag flag;
1328
- if (map->is_prototype_map ( )) {
1328
+ if (map->IsDetached (isolate )) {
1329
1329
flag = OMIT_TRANSITION;
1330
1330
} else {
1331
1331
flag = INSERT_TRANSITION;
@@ -1687,15 +1687,15 @@ void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
1687
1687
child->may_have_interesting_symbols ());
1688
1688
if (!parent->GetBackPointer ().IsUndefined (isolate)) {
1689
1689
parent->set_owns_descriptors (false );
1690
- } else {
1690
+ } else if (!parent-> IsDetached (isolate)) {
1691
1691
// |parent| is initial map and it must keep the ownership, there must be no
1692
1692
// descriptors in the descriptors array that do not belong to the map.
1693
1693
DCHECK (parent->owns_descriptors ());
1694
1694
DCHECK_EQ (parent->NumberOfOwnDescriptors (),
1695
1695
parent->instance_descriptors ().number_of_descriptors ());
1696
1696
}
1697
- if (parent->is_prototype_map ( )) {
1698
- DCHECK (child->is_prototype_map ( ));
1697
+ if (parent->IsDetached (isolate )) {
1698
+ DCHECK (child->IsDetached (isolate ));
1699
1699
if (FLAG_trace_maps) {
1700
1700
LOG (isolate, MapEvent (" Transition" , *parent, *child, " prototype" , *name));
1701
1701
}
@@ -1722,7 +1722,9 @@ Handle<Map> Map::CopyReplaceDescriptors(
1722
1722
result->set_may_have_interesting_symbols (true );
1723
1723
}
1724
1724
1725
- if (!map->is_prototype_map ()) {
1725
+ if (map->is_prototype_map ()) {
1726
+ result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1727
+ } else {
1726
1728
if (flag == INSERT_TRANSITION &&
1727
1729
TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()) {
1728
1730
result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
@@ -1733,19 +1735,11 @@ Handle<Map> Map::CopyReplaceDescriptors(
1733
1735
descriptors->GeneralizeAllFields ();
1734
1736
result->InitializeDescriptors (isolate, *descriptors,
1735
1737
LayoutDescriptor::FastPointerLayout ());
1736
- // If we were trying to insert a transition but failed because there are
1737
- // too many transitions already, mark the object as a prototype to avoid
1738
- // tracking transitions from the detached map.
1739
- if (flag == INSERT_TRANSITION) {
1740
- result->set_is_prototype_map (true );
1741
- }
1742
1738
}
1743
- } else {
1744
- result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1745
1739
}
1746
1740
if (FLAG_trace_maps &&
1747
1741
// Mirror conditions above that did not call ConnectTransition().
1748
- (map->is_prototype_map ( ) ||
1742
+ (map->IsDetached (isolate ) ||
1749
1743
!(flag == INSERT_TRANSITION &&
1750
1744
TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()))) {
1751
1745
LOG (isolate, MapEvent (" ReplaceDescriptors" , *map, *result, reason,
@@ -1926,7 +1920,7 @@ Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
1926
1920
}
1927
1921
1928
1922
Handle <Map> Map::CopyForElementsTransition (Isolate* isolate, Handle <Map> map) {
1929
- DCHECK (!map->is_prototype_map ( ));
1923
+ DCHECK (!map->IsDetached (isolate ));
1930
1924
Handle <Map> new_map = CopyDropDescriptors (isolate, map);
1931
1925
1932
1926
if (map->owns_descriptors ()) {
@@ -2126,7 +2120,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
2126
2120
StoreOrigin store_origin) {
2127
2121
RuntimeCallTimerScope stats_scope (
2128
2122
isolate, *map,
2129
- map->is_prototype_map ( )
2123
+ map->IsDetached (isolate )
2130
2124
? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty
2131
2125
: RuntimeCallCounterId::kMap_TransitionToDataProperty );
2132
2126
@@ -2238,7 +2232,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
2238
2232
PropertyAttributes attributes) {
2239
2233
RuntimeCallTimerScope stats_scope (
2240
2234
isolate,
2241
- map->is_prototype_map ( )
2235
+ map->IsDetached (isolate )
2242
2236
? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty
2243
2237
: RuntimeCallCounterId::kMap_TransitionToAccessorProperty );
2244
2238
0 commit comments