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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 : generic_stub(); | 1864 : generic_stub(); |
1865 } | 1865 } |
1866 | 1866 |
1867 // There are several special cases where an IC that is MONOMORPHIC can still | 1867 // There are several special cases where an IC that is MONOMORPHIC can still |
1868 // transition to a different GetNonTransitioningStoreMode IC that handles a | 1868 // transition to a different GetNonTransitioningStoreMode IC that handles a |
1869 // superset of the original IC. Handle those here if the receiver map hasn't | 1869 // superset of the original IC. Handle those here if the receiver map hasn't |
1870 // changed or it has transitioned to a more general kind. | 1870 // changed or it has transitioned to a more general kind. |
1871 KeyedAccessStoreMode old_store_mode = | 1871 KeyedAccessStoreMode old_store_mode = |
1872 Code::GetKeyedAccessStoreMode(target()->extra_ic_state()); | 1872 Code::GetKeyedAccessStoreMode(target()->extra_ic_state()); |
1873 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); | 1873 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); |
1874 if (ic_state == MONOMORPHIC && old_store_mode == STANDARD_STORE) { | 1874 if (ic_state == MONOMORPHIC) { |
1875 // If the "old" and "new" maps are in the same elements map family, stay | 1875 // If the "old" and "new" maps are in the same elements map family, stay |
1876 // MONOMORPHIC and use the map for the most generic ElementsKind. | 1876 // MONOMORPHIC and use the map for the most generic ElementsKind. |
1877 Handle<Map> transitioned_receiver_map = receiver_map; | 1877 Handle<Map> transitioned_receiver_map = receiver_map; |
1878 if (IsTransitionStoreMode(store_mode)) { | 1878 if (IsTransitionStoreMode(store_mode)) { |
1879 transitioned_receiver_map = | 1879 transitioned_receiver_map = |
1880 ComputeTransitionedMap(receiver, store_mode); | 1880 ComputeTransitionedMap(receiver, store_mode); |
1881 } | 1881 } |
1882 if (IsTransitionedMapOfMonomorphicTarget(*transitioned_receiver_map)) { | 1882 if (IsTransitionedMapOfMonomorphicTarget(*transitioned_receiver_map)) { |
1883 // Element family is the same, use the "worst" case map. | 1883 // Element family is the same, use the "worst" case map. |
1884 store_mode = GetNonTransitioningStoreMode(store_mode); | 1884 store_mode = GetNonTransitioningStoreMode(store_mode); |
1885 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1885 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
1886 transitioned_receiver_map, strict_mode, store_mode); | 1886 transitioned_receiver_map, strict_mode, store_mode); |
1887 } else if (*previous_receiver_map == receiver->map()) { | 1887 } else if (*previous_receiver_map == receiver->map() && |
1888 if (IsGrowStoreMode(store_mode) || | 1888 old_store_mode == STANDARD_STORE && |
1889 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 1889 (IsGrowStoreMode(store_mode) || |
1890 store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 1890 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
1891 // A "normal" IC that handles stores can switch to a version that can | 1891 store_mode == STORE_NO_TRANSITION_HANDLE_COW)) { |
1892 // grow at the end of the array, handle OOB accesses or copy COW arrays | 1892 // A "normal" IC that handles stores can switch to a version that can |
1893 // and still stay MONOMORPHIC. | 1893 // grow at the end of the array, handle OOB accesses or copy COW arrays |
1894 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1894 // and still stay MONOMORPHIC. |
1895 receiver_map, strict_mode, store_mode); | 1895 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
1896 } | 1896 receiver_map, strict_mode, store_mode); |
1897 } | 1897 } |
1898 } | 1898 } |
1899 | 1899 |
1900 ASSERT(ic_state != GENERIC); | 1900 ASSERT(ic_state != GENERIC); |
1901 | 1901 |
1902 bool map_added = | 1902 bool map_added = |
1903 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); | 1903 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); |
1904 | 1904 |
1905 if (IsTransitionStoreMode(store_mode)) { | 1905 if (IsTransitionStoreMode(store_mode)) { |
1906 Handle<Map> transitioned_receiver_map = | 1906 Handle<Map> transitioned_receiver_map = |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 #undef ADDR | 3092 #undef ADDR |
3093 }; | 3093 }; |
3094 | 3094 |
3095 | 3095 |
3096 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3096 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3097 return IC_utilities[id]; | 3097 return IC_utilities[id]; |
3098 } | 3098 } |
3099 | 3099 |
3100 | 3100 |
3101 } } // namespace v8::internal | 3101 } } // namespace v8::internal |
OLD | NEW |