| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 // There are several special cases where an IC that is MONOMORPHIC can still | 1430 // There are several special cases where an IC that is MONOMORPHIC can still |
| 1431 // transition to a different GetNonTransitioningStoreMode IC that handles a | 1431 // transition to a different GetNonTransitioningStoreMode IC that handles a |
| 1432 // superset of the original IC. Handle those here if the receiver map hasn't | 1432 // superset of the original IC. Handle those here if the receiver map hasn't |
| 1433 // changed or it has transitioned to a more general kind. | 1433 // changed or it has transitioned to a more general kind. |
| 1434 KeyedAccessStoreMode old_store_mode = | 1434 KeyedAccessStoreMode old_store_mode = |
| 1435 KeyedStoreIC::GetKeyedAccessStoreMode(target()->extra_ic_state()); | 1435 KeyedStoreIC::GetKeyedAccessStoreMode(target()->extra_ic_state()); |
| 1436 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); | 1436 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); |
| 1437 if (state() == MONOMORPHIC) { | 1437 if (state() == MONOMORPHIC) { |
| 1438 // If the "old" and "new" maps are in the same elements map family, stay | |
| 1439 // MONOMORPHIC and use the map for the most generic ElementsKind. | |
| 1440 Handle<Map> transitioned_receiver_map = receiver_map; | |
| 1441 if (IsTransitionStoreMode(store_mode)) { | 1438 if (IsTransitionStoreMode(store_mode)) { |
| 1442 transitioned_receiver_map = | 1439 // If the "old" and "new" maps are in the same elements map family, or |
| 1440 // if they at least come from the same origin for a transitioning store, |
| 1441 // stay MONOMORPHIC and use the map for the most generic ElementsKind. |
| 1442 Handle<Map> transitioned_receiver_map = |
| 1443 ComputeTransitionedMap(receiver, store_mode); | 1443 ComputeTransitionedMap(receiver, store_mode); |
| 1444 } | 1444 if (*previous_receiver_map == receiver->map() || |
| 1445 if (IsTransitionOfMonomorphicTarget( | 1445 IsTransitionOfMonomorphicTarget( |
| 1446 MapToType<HeapType>(transitioned_receiver_map, isolate()))) { | 1446 MapToType<HeapType>(transitioned_receiver_map, isolate()))) { |
| 1447 // Element family is the same, use the "worst" case map. | 1447 store_mode = GetNonTransitioningStoreMode(store_mode); |
| 1448 store_mode = GetNonTransitioningStoreMode(store_mode); | 1448 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
| 1449 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1449 transitioned_receiver_map, strict_mode(), store_mode); |
| 1450 transitioned_receiver_map, strict_mode(), store_mode); | 1450 } |
| 1451 } else if (*previous_receiver_map == receiver->map() && | 1451 } else if (*previous_receiver_map == receiver->map() && |
| 1452 old_store_mode == STANDARD_STORE && | 1452 old_store_mode == STANDARD_STORE && |
| 1453 (IsGrowStoreMode(store_mode) || | 1453 (IsGrowStoreMode(store_mode) || |
| 1454 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 1454 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 1455 store_mode == STORE_NO_TRANSITION_HANDLE_COW)) { | 1455 store_mode == STORE_NO_TRANSITION_HANDLE_COW)) { |
| 1456 // A "normal" IC that handles stores can switch to a version that can | 1456 // A "normal" IC that handles stores can switch to a version that can |
| 1457 // grow at the end of the array, handle OOB accesses or copy COW arrays | 1457 // grow at the end of the array, handle OOB accesses or copy COW arrays |
| 1458 // and still stay MONOMORPHIC. | 1458 // and still stay MONOMORPHIC. |
| 1459 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1459 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
| 1460 receiver_map, strict_mode(), store_mode); | 1460 receiver_map, strict_mode(), store_mode); |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2817 #undef ADDR | 2817 #undef ADDR |
| 2818 }; | 2818 }; |
| 2819 | 2819 |
| 2820 | 2820 |
| 2821 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2821 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2822 return IC_utilities[id]; | 2822 return IC_utilities[id]; |
| 2823 } | 2823 } |
| 2824 | 2824 |
| 2825 | 2825 |
| 2826 } } // namespace v8::internal | 2826 } } // namespace v8::internal |
| OLD | NEW |