OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 return megamorphic_stub(); | 1946 return megamorphic_stub(); |
1947 } | 1947 } |
1948 } | 1948 } |
1949 | 1949 |
1950 // If the store mode isn't the standard mode, make sure that all polymorphic | 1950 // If the store mode isn't the standard mode, make sure that all polymorphic |
1951 // receivers are either external arrays, or all "normal" arrays. Otherwise, | 1951 // receivers are either external arrays, or all "normal" arrays. Otherwise, |
1952 // use the megamorphic stub. | 1952 // use the megamorphic stub. |
1953 if (store_mode != STANDARD_STORE) { | 1953 if (store_mode != STANDARD_STORE) { |
1954 int external_arrays = 0; | 1954 int external_arrays = 0; |
1955 for (int i = 0; i < target_receiver_maps.length(); ++i) { | 1955 for (int i = 0; i < target_receiver_maps.length(); ++i) { |
1956 if (target_receiver_maps[i]->has_fixed_typed_array_elements()) { | 1956 if (target_receiver_maps[i]->has_external_array_elements() || |
| 1957 target_receiver_maps[i]->has_fixed_typed_array_elements()) { |
1957 external_arrays++; | 1958 external_arrays++; |
1958 } | 1959 } |
1959 } | 1960 } |
1960 if (external_arrays != 0 && | 1961 if (external_arrays != 0 && |
1961 external_arrays != target_receiver_maps.length()) { | 1962 external_arrays != target_receiver_maps.length()) { |
1962 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", | 1963 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", |
1963 "unsupported combination of external and normal arrays"); | 1964 "unsupported combination of external and normal arrays"); |
1964 return megamorphic_stub(); | 1965 return megamorphic_stub(); |
1965 } | 1966 } |
1966 } | 1967 } |
(...skipping 16 matching lines...) Expand all Loading... |
1983 return Map::TransitionElementsTo(map, FAST_DOUBLE_ELEMENTS); | 1984 return Map::TransitionElementsTo(map, FAST_DOUBLE_ELEMENTS); |
1984 case STORE_TRANSITION_HOLEY_SMI_TO_OBJECT: | 1985 case STORE_TRANSITION_HOLEY_SMI_TO_OBJECT: |
1985 case STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: | 1986 case STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: |
1986 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT: | 1987 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT: |
1987 case STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: | 1988 case STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: |
1988 return Map::TransitionElementsTo(map, FAST_HOLEY_ELEMENTS); | 1989 return Map::TransitionElementsTo(map, FAST_HOLEY_ELEMENTS); |
1989 case STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE: | 1990 case STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE: |
1990 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE: | 1991 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE: |
1991 return Map::TransitionElementsTo(map, FAST_HOLEY_DOUBLE_ELEMENTS); | 1992 return Map::TransitionElementsTo(map, FAST_HOLEY_DOUBLE_ELEMENTS); |
1992 case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS: | 1993 case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS: |
1993 DCHECK(map->has_fixed_typed_array_elements()); | 1994 DCHECK(map->has_external_array_elements()); |
1994 // Fall through | 1995 // Fall through |
1995 case STORE_NO_TRANSITION_HANDLE_COW: | 1996 case STORE_NO_TRANSITION_HANDLE_COW: |
1996 case STANDARD_STORE: | 1997 case STANDARD_STORE: |
1997 case STORE_AND_GROW_NO_TRANSITION: | 1998 case STORE_AND_GROW_NO_TRANSITION: |
1998 return map; | 1999 return map; |
1999 } | 2000 } |
2000 UNREACHABLE(); | 2001 UNREACHABLE(); |
2001 return MaybeHandle<Map>().ToHandleChecked(); | 2002 return MaybeHandle<Map>().ToHandleChecked(); |
2002 } | 2003 } |
2003 | 2004 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 } else if (receiver->HasFastDoubleElements()) { | 2067 } else if (receiver->HasFastDoubleElements()) { |
2067 if (!value->IsSmi() && !value->IsHeapNumber()) { | 2068 if (!value->IsSmi() && !value->IsHeapNumber()) { |
2068 if (receiver->HasFastHoleyElements()) { | 2069 if (receiver->HasFastHoleyElements()) { |
2069 return STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; | 2070 return STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; |
2070 } else { | 2071 } else { |
2071 return STORE_TRANSITION_DOUBLE_TO_OBJECT; | 2072 return STORE_TRANSITION_DOUBLE_TO_OBJECT; |
2072 } | 2073 } |
2073 } | 2074 } |
2074 } | 2075 } |
2075 if (!FLAG_trace_external_array_abuse && | 2076 if (!FLAG_trace_external_array_abuse && |
2076 receiver->map()->has_fixed_typed_array_elements() && oob_access) { | 2077 receiver->map()->has_external_array_elements() && oob_access) { |
2077 return STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS; | 2078 return STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS; |
2078 } | 2079 } |
2079 Heap* heap = receiver->GetHeap(); | 2080 Heap* heap = receiver->GetHeap(); |
2080 if (receiver->elements()->map() == heap->fixed_cow_array_map()) { | 2081 if (receiver->elements()->map() == heap->fixed_cow_array_map()) { |
2081 return STORE_NO_TRANSITION_HANDLE_COW; | 2082 return STORE_NO_TRANSITION_HANDLE_COW; |
2082 } else { | 2083 } else { |
2083 return STANDARD_STORE; | 2084 return STANDARD_STORE; |
2084 } | 2085 } |
2085 } | 2086 } |
2086 } | 2087 } |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3086 KeyedLoadICNexus nexus(vector, vector_slot); | 3087 KeyedLoadICNexus nexus(vector, vector_slot); |
3087 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3088 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3088 ic.UpdateState(receiver, key); | 3089 ic.UpdateState(receiver, key); |
3089 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3090 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3090 } | 3091 } |
3091 | 3092 |
3092 return *result; | 3093 return *result; |
3093 } | 3094 } |
3094 } // namespace internal | 3095 } // namespace internal |
3095 } // namespace v8 | 3096 } // namespace v8 |
OLD | NEW |