@@ -655,7 +655,7 @@ Map Map::FindRootMap(Isolate* isolate) const {
655
655
if (back.IsUndefined (isolate)) {
656
656
// Initial map must not contain descriptors in the descriptors array
657
657
// that do not belong to the map.
658
- DCHECK_EQ (result.NumberOfOwnDescriptors (),
658
+ DCHECK_LE (result.NumberOfOwnDescriptors (),
659
659
result.instance_descriptors ().number_of_descriptors ());
660
660
return result;
661
661
}
@@ -1205,7 +1205,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate,
1205
1205
DisallowHeapAllocation no_allocation;
1206
1206
DisallowDeoptimization no_deoptimization (isolate);
1207
1207
1208
- if (is_prototype_map ( )) return Map ();
1208
+ if (IsDetached (isolate )) return Map ();
1209
1209
1210
1210
ElementsKind kind = elements_kind ();
1211
1211
bool packed = IsFastPackedElementsKind (kind);
@@ -1338,7 +1338,7 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
1338
1338
1339
1339
ElementsKind kind = map->elements_kind ();
1340
1340
TransitionFlag flag;
1341
- if (map->is_prototype_map ( )) {
1341
+ if (map->IsDetached (isolate )) {
1342
1342
flag = OMIT_TRANSITION;
1343
1343
} else {
1344
1344
flag = INSERT_TRANSITION;
@@ -1705,14 +1705,14 @@ void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
1705
1705
child->may_have_interesting_symbols ());
1706
1706
if (!parent->GetBackPointer ().IsUndefined (isolate)) {
1707
1707
parent->set_owns_descriptors (false );
1708
- } else {
1708
+ } else if (!parent-> IsDetached (isolate)) {
1709
1709
// |parent| is initial map and it must not contain descriptors in the
1710
1710
// descriptors array that do not belong to the map.
1711
1711
DCHECK_EQ (parent->NumberOfOwnDescriptors (),
1712
1712
parent->instance_descriptors ().number_of_descriptors ());
1713
1713
}
1714
- if (parent->is_prototype_map ( )) {
1715
- DCHECK (child->is_prototype_map ( ));
1714
+ if (parent->IsDetached (isolate )) {
1715
+ DCHECK (child->IsDetached (isolate ));
1716
1716
if (FLAG_trace_maps) {
1717
1717
LOG (isolate, MapEvent (" Transition" , parent, child, " prototype" , name));
1718
1718
}
@@ -1739,7 +1739,9 @@ Handle<Map> Map::CopyReplaceDescriptors(
1739
1739
result->set_may_have_interesting_symbols (true );
1740
1740
}
1741
1741
1742
- if (!map->is_prototype_map ()) {
1742
+ if (map->is_prototype_map ()) {
1743
+ result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1744
+ } else {
1743
1745
if (flag == INSERT_TRANSITION &&
1744
1746
TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()) {
1745
1747
result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
@@ -1750,19 +1752,11 @@ Handle<Map> Map::CopyReplaceDescriptors(
1750
1752
descriptors->GeneralizeAllFields ();
1751
1753
result->InitializeDescriptors (isolate, *descriptors,
1752
1754
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
- }
1759
1755
}
1760
- } else {
1761
- result->InitializeDescriptors (isolate, *descriptors, *layout_descriptor);
1762
1756
}
1763
1757
if (FLAG_trace_maps &&
1764
1758
// Mirror conditions above that did not call ConnectTransition().
1765
- (map->is_prototype_map ( ) ||
1759
+ (map->IsDetached (isolate ) ||
1766
1760
!(flag == INSERT_TRANSITION &&
1767
1761
TransitionsAccessor (isolate, map).CanHaveMoreTransitions ()))) {
1768
1762
LOG (isolate, MapEvent (" ReplaceDescriptors" , map, result, reason,
@@ -1944,7 +1938,7 @@ Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
1944
1938
}
1945
1939
1946
1940
Handle <Map> Map::CopyForElementsTransition (Isolate* isolate, Handle <Map> map) {
1947
- DCHECK (!map->is_prototype_map ( ));
1941
+ DCHECK (!map->IsDetached (isolate ));
1948
1942
Handle <Map> new_map = CopyDropDescriptors (isolate, map);
1949
1943
1950
1944
if (map->owns_descriptors ()) {
@@ -2145,7 +2139,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
2145
2139
StoreOrigin store_origin) {
2146
2140
RuntimeCallTimerScope stats_scope (
2147
2141
isolate,
2148
- map->is_prototype_map ( )
2142
+ map->IsDetached (isolate )
2149
2143
? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty
2150
2144
: RuntimeCallCounterId::kMap_TransitionToDataProperty );
2151
2145
@@ -2259,7 +2253,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
2259
2253
PropertyAttributes attributes) {
2260
2254
RuntimeCallTimerScope stats_scope (
2261
2255
isolate,
2262
- map->is_prototype_map ( )
2256
+ map->IsDetached (isolate )
2263
2257
? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty
2264
2258
: RuntimeCallCounterId::kMap_TransitionToAccessorProperty );
2265
2259
0 commit comments