@@ -646,7 +646,7 @@ Map Map::FindRootMap(Isolate* isolate) const {
646646 // Initial map always owns descriptors and doesn't have unused entries
647647 // in the descriptor array.
648648 DCHECK (result.owns_descriptors ());
649- DCHECK_EQ (result.NumberOfOwnDescriptors (),
649+ DCHECK_LE (result.NumberOfOwnDescriptors (),
650650 result.instance_descriptors ().number_of_descriptors ());
651651 return result;
652652 }
@@ -1192,7 +1192,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate,
11921192 DisallowHeapAllocation no_allocation;
11931193 DisallowDeoptimization no_deoptimization (isolate);
11941194
1195- if (is_prototype_map ( )) return Map ();
1195+ if (IsDetached (isolate )) return Map ();
11961196
11971197 ElementsKind kind = elements_kind ();
11981198 bool packed = IsFastPackedElementsKind (kind);
@@ -1325,7 +1325,7 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
13251325
13261326 ElementsKind kind = map->elements_kind ();
13271327 TransitionFlag flag;
1328- if (map->is_prototype_map ( )) {
1328+ if (map->IsDetached (isolate )) {
13291329 flag = OMIT_TRANSITION;
13301330 } else {
13311331 flag = INSERT_TRANSITION;
@@ -1687,15 +1687,15 @@ void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
16871687 child->may_have_interesting_symbols ());
16881688 if (!parent->GetBackPointer ().IsUndefined (isolate)) {
16891689 parent->set_owns_descriptors (false );
1690- } else {
1690+ } else if (!parent-> IsDetached (isolate)) {
16911691 // |parent| is initial map and it must keep the ownership, there must be no
16921692 // descriptors in the descriptors array that do not belong to the map.
16931693 DCHECK (parent->owns_descriptors ());
16941694 DCHECK_EQ (parent->NumberOfOwnDescriptors (),
16951695 parent->instance_descriptors ().number_of_descriptors ());
16961696 }
1697- if (parent->is_prototype_map ( )) {
1698- DCHECK (child->is_prototype_map ( ));
1697+ if (parent->IsDetached (isolate )) {
1698+ DCHECK (child->IsDetached (isolate ));
16991699 if (FLAG_trace_maps) {
17001700 LOG (isolate, MapEvent (" Transition" , *parent, *child, " prototype" , *name));
17011701 }
@@ -1722,7 +1722,9 @@ Handle<Map> Map::CopyReplaceDescriptors(
17221722 result->set_may_have_interesting_symbols (true );
17231723 }
17241724
1725- if (!map->is_prototype_map ()) {
1725+ if (map->is_prototype_map ()) {
1726+ result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1727+ } else {
17261728 if (flag == INSERT_TRANSITION &&
17271729 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()) {
17281730 result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
@@ -1733,19 +1735,11 @@ Handle<Map> Map::CopyReplaceDescriptors(
17331735 descriptors->GeneralizeAllFields ();
17341736 result->InitializeDescriptors (isolate, *descriptors,
17351737 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- }
17421738 }
1743- } else {
1744- result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
17451739 }
17461740 if (FLAG_trace_maps &&
17471741 // Mirror conditions above that did not call ConnectTransition().
1748- (map->is_prototype_map ( ) ||
1742+ (map->IsDetached (isolate ) ||
17491743 !(flag == INSERT_TRANSITION &&
17501744 TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()))) {
17511745 LOG (isolate, MapEvent (" ReplaceDescriptors" , *map, *result, reason,
@@ -1926,7 +1920,7 @@ Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
19261920}
19271921
19281922Handle<Map> Map::CopyForElementsTransition (Isolate* isolate, Handle<Map> map) {
1929- DCHECK (!map->is_prototype_map ( ));
1923+ DCHECK (!map->IsDetached (isolate ));
19301924 Handle<Map> new_map = CopyDropDescriptors (isolate, map);
19311925
19321926 if (map->owns_descriptors ()) {
@@ -2126,7 +2120,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
21262120 StoreOrigin store_origin) {
21272121 RuntimeCallTimerScope stats_scope (
21282122 isolate, *map,
2129- map->is_prototype_map ( )
2123+ map->IsDetached (isolate )
21302124 ? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty
21312125 : RuntimeCallCounterId::kMap_TransitionToDataProperty );
21322126
@@ -2238,7 +2232,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
22382232 PropertyAttributes attributes) {
22392233 RuntimeCallTimerScope stats_scope (
22402234 isolate,
2241- map->is_prototype_map ( )
2235+ map->IsDetached (isolate )
22422236 ? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty
22432237 : RuntimeCallCounterId::kMap_TransitionToAccessorProperty );
22442238
0 commit comments