@@ -658,7 +658,7 @@ Map Map::FindRootMap(Isolate* isolate) const {
658658 if (back.IsUndefined (isolate)) {
659659 // Initial map must not contain descriptors in the descriptors array
660660 // that do not belong to the map.
661- DCHECK_EQ (result.NumberOfOwnDescriptors (),
661+ DCHECK_LE (result.NumberOfOwnDescriptors (),
662662 result.instance_descriptors ().number_of_descriptors ());
663663 return result;
664664 }
@@ -1221,7 +1221,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate,
12211221 DisallowHeapAllocation no_allocation;
12221222 DisallowDeoptimization no_deoptimization (isolate);
12231223
1224- if (is_prototype_map ( )) return Map ();
1224+ if (IsDetached (isolate )) return Map ();
12251225
12261226 ElementsKind kind = elements_kind ();
12271227 bool packed = IsFastPackedElementsKind (kind);
@@ -1354,7 +1354,7 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
13541354
13551355 ElementsKind kind = map->elements_kind ();
13561356 TransitionFlag flag;
1357- if (map->is_prototype_map ( )) {
1357+ if (map->IsDetached (isolate )) {
13581358 flag = OMIT_TRANSITION ;
13591359 } else {
13601360 flag = INSERT_TRANSITION ;
@@ -1721,14 +1721,14 @@ void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
17211721 child->may_have_interesting_symbols ());
17221722 if (!parent->GetBackPointer ().IsUndefined (isolate)) {
17231723 parent->set_owns_descriptors (false );
1724- } else {
1724+ } else if (!parent-> IsDetached (isolate)) {
17251725 // |parent| is initial map and it must not contain descriptors in the
17261726 // descriptors array that do not belong to the map.
17271727 DCHECK_EQ (parent->NumberOfOwnDescriptors (),
17281728 parent->instance_descriptors ().number_of_descriptors ());
17291729 }
1730- if (parent->is_prototype_map ( )) {
1731- DCHECK (child->is_prototype_map ( ));
1730+ if (parent->IsDetached (isolate )) {
1731+ DCHECK (child->IsDetached (isolate ));
17321732 if (FLAG_trace_maps) {
17331733 LOG (isolate, MapEvent (" Transition" , parent, child, " prototype" , name));
17341734 }
@@ -1755,7 +1755,9 @@ Handle<Map> Map::CopyReplaceDescriptors(
17551755 result->set_may_have_interesting_symbols (true );
17561756 }
17571757
1758- if (!map->is_prototype_map ()) {
1758+ if (map->is_prototype_map ()) {
1759+ result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1760+ } else {
17591761 if (flag == INSERT_TRANSITION &&
17601762 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()) {
17611763 result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
@@ -1766,19 +1768,11 @@ Handle<Map> Map::CopyReplaceDescriptors(
17661768 descriptors->GeneralizeAllFields ();
17671769 result->InitializeDescriptors (isolate, *descriptors,
17681770 LayoutDescriptor::FastPointerLayout ());
1769- // If we were trying to insert a transition but failed because there are
1770- // too many transitions already, mark the object as a prototype to avoid
1771- // tracking transitions from the detached map.
1772- if (flag == INSERT_TRANSITION ) {
1773- result->set_is_prototype_map (true );
1774- }
17751771 }
1776- } else {
1777- result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
17781772 }
17791773 if (FLAG_trace_maps &&
17801774 // Mirror conditions above that did not call ConnectTransition().
1781- (map->is_prototype_map ( ) ||
1775+ (map->IsDetached (isolate ) ||
17821776 !(flag == INSERT_TRANSITION &&
17831777 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()))) {
17841778 LOG (isolate, MapEvent (" ReplaceDescriptors" , map, result, reason,
@@ -1960,7 +1954,7 @@ Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
19601954}
19611955
19621956Handle<Map> Map::CopyForElementsTransition (Isolate* isolate, Handle<Map> map) {
1963- DCHECK (!map->is_prototype_map ( ));
1957+ DCHECK (!map->IsDetached (isolate ));
19641958 Handle<Map> new_map = CopyDropDescriptors (isolate, map);
19651959
19661960 if (map->owns_descriptors ()) {
@@ -2161,7 +2155,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
21612155 StoreOrigin store_origin) {
21622156 RuntimeCallTimerScope stats_scope (
21632157 isolate,
2164- map->is_prototype_map ( )
2158+ map->IsDetached (isolate )
21652159 ? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty
21662160 : RuntimeCallCounterId::kMap_TransitionToDataProperty );
21672161
@@ -2275,7 +2269,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
22752269 PropertyAttributes attributes) {
22762270 RuntimeCallTimerScope stats_scope (
22772271 isolate,
2278- map->is_prototype_map ( )
2272+ map->IsDetached (isolate )
22792273 ? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty
22802274 : RuntimeCallCounterId::kMap_TransitionToAccessorProperty );
22812275
0 commit comments