@@ -655,7 +655,7 @@ Map Map::FindRootMap(Isolate* isolate) const {
655655 if (back.IsUndefined (isolate)) {
656656 // Initial map must not contain descriptors in the descriptors array
657657 // that do not belong to the map.
658- DCHECK_EQ (result.NumberOfOwnDescriptors (),
658+ DCHECK_LE (result.NumberOfOwnDescriptors (),
659659 result.instance_descriptors ().number_of_descriptors ());
660660 return result;
661661 }
@@ -1205,7 +1205,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate,
12051205 DisallowHeapAllocation no_allocation;
12061206 DisallowDeoptimization no_deoptimization (isolate);
12071207
1208- if (is_prototype_map ( )) return Map ();
1208+ if (IsDetached (isolate )) return Map ();
12091209
12101210 ElementsKind kind = elements_kind ();
12111211 bool packed = IsFastPackedElementsKind (kind);
@@ -1338,7 +1338,7 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
13381338
13391339 ElementsKind kind = map->elements_kind ();
13401340 TransitionFlag flag;
1341- if (map->is_prototype_map ( )) {
1341+ if (map->IsDetached (isolate )) {
13421342 flag = OMIT_TRANSITION;
13431343 } else {
13441344 flag = INSERT_TRANSITION;
@@ -1705,14 +1705,14 @@ void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
17051705 child->may_have_interesting_symbols ());
17061706 if (!parent->GetBackPointer ().IsUndefined (isolate)) {
17071707 parent->set_owns_descriptors (false );
1708- } else {
1708+ } else if (!parent-> IsDetached (isolate)) {
17091709 // |parent| is initial map and it must not contain descriptors in the
17101710 // descriptors array that do not belong to the map.
17111711 DCHECK_EQ (parent->NumberOfOwnDescriptors (),
17121712 parent->instance_descriptors ().number_of_descriptors ());
17131713 }
1714- if (parent->is_prototype_map ( )) {
1715- DCHECK (child->is_prototype_map ( ));
1714+ if (parent->IsDetached (isolate )) {
1715+ DCHECK (child->IsDetached (isolate ));
17161716 if (FLAG_trace_maps) {
17171717 LOG (isolate, MapEvent (" Transition" , parent, child, " prototype" , name));
17181718 }
@@ -1739,7 +1739,9 @@ Handle<Map> Map::CopyReplaceDescriptors(
17391739 result->set_may_have_interesting_symbols (true );
17401740 }
17411741
1742- if (!map->is_prototype_map ()) {
1742+ if (map->is_prototype_map ()) {
1743+ result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1744+ } else {
17431745 if (flag == INSERT_TRANSITION &&
17441746 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()) {
17451747 result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
@@ -1750,19 +1752,11 @@ Handle<Map> Map::CopyReplaceDescriptors(
17501752 descriptors->GeneralizeAllFields ();
17511753 result->InitializeDescriptors (isolate, *descriptors,
17521754 LayoutDescriptor::FastPointerLayout ());
1753- // If we were trying to insert a transition but failed because there are
1754- // too many transitions already, mark the object as a prototype to avoid
1755- // tracking transitions from the detached map.
1756- if (flag == INSERT_TRANSITION) {
1757- result->set_is_prototype_map (true );
1758- }
17591755 }
1760- } else {
1761- result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
17621756 }
17631757 if (FLAG_trace_maps &&
17641758 // Mirror conditions above that did not call ConnectTransition().
1765- (map->is_prototype_map ( ) ||
1759+ (map->IsDetached (isolate ) ||
17661760 !(flag == INSERT_TRANSITION &&
17671761 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()))) {
17681762 LOG (isolate, MapEvent (" ReplaceDescriptors" , map, result, reason,
@@ -1944,7 +1938,7 @@ Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
19441938}
19451939
19461940Handle<Map> Map::CopyForElementsTransition (Isolate* isolate, Handle<Map> map) {
1947- DCHECK (!map->is_prototype_map ( ));
1941+ DCHECK (!map->IsDetached (isolate ));
19481942 Handle<Map> new_map = CopyDropDescriptors (isolate, map);
19491943
19501944 if (map->owns_descriptors ()) {
@@ -2145,7 +2139,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
21452139 StoreOrigin store_origin) {
21462140 RuntimeCallTimerScope stats_scope (
21472141 isolate,
2148- map->is_prototype_map ( )
2142+ map->IsDetached (isolate )
21492143 ? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty
21502144 : RuntimeCallCounterId::kMap_TransitionToDataProperty );
21512145
@@ -2259,7 +2253,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
22592253 PropertyAttributes attributes) {
22602254 RuntimeCallTimerScope stats_scope (
22612255 isolate,
2262- map->is_prototype_map ( )
2256+ map->IsDetached (isolate )
22632257 ? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty
22642258 : RuntimeCallCounterId::kMap_TransitionToAccessorProperty );
22652259
0 commit comments