@@ -2333,13 +2333,31 @@ void Map::StartInobjectSlackTracking() {
23332333
23342334Handle<Map> Map::TransitionToPrototype (Isolate* isolate, Handle<Map> map,
23352335 Handle<HeapObject> prototype) {
2336- Handle<Map> new_map =
2337- TransitionsAccessor::GetPrototypeTransition ( isolate, map, prototype);
2336+ Handle<Map> new_map = TransitionsAccessor::GetPrototypeTransition (
2337+ isolate, map, prototype, map-> new_target_is_base () );
23382338 if (new_map.is_null ()) {
23392339 new_map = Copy (isolate, map, " TransitionToPrototype" );
23402340 TransitionsAccessor::PutPrototypeTransition (isolate, map, prototype,
23412341 new_map);
2342- Map::SetPrototype (isolate, new_map, prototype);
2342+ if (*prototype != map->prototype ()) {
2343+ Map::SetPrototype (isolate, new_map, prototype);
2344+ }
2345+ }
2346+ return new_map;
2347+ }
2348+
2349+ Handle<Map> Map::TransitionToDerivedMap (Isolate* isolate, Handle<Map> map,
2350+ Handle<HeapObject> prototype) {
2351+ Handle<Map> new_map = TransitionsAccessor::GetPrototypeTransition (
2352+ isolate, map, prototype, /* new_target_is_base */ false );
2353+ if (new_map.is_null ()) {
2354+ new_map = CopyInitialMap (isolate, map);
2355+ TransitionsAccessor::PutPrototypeTransition (isolate, map, prototype,
2356+ new_map);
2357+ if (*prototype != map->prototype ()) {
2358+ Map::SetPrototype (isolate, new_map, prototype);
2359+ }
2360+ new_map->set_new_target_is_base (false );
23432361 }
23442362 return new_map;
23452363}
0 commit comments