| 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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 } | 2040 } |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 if (use_ic) { | 2043 if (use_ic) { |
| 2044 DCHECK(!object->IsAccessCheckNeeded()); | 2044 DCHECK(!object->IsAccessCheckNeeded()); |
| 2045 | 2045 |
| 2046 if (object->IsJSObject()) { | 2046 if (object->IsJSObject()) { |
| 2047 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 2047 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 2048 bool key_is_smi_like = !Object::ToSmi(isolate(), key).is_null(); | 2048 bool key_is_smi_like = !Object::ToSmi(isolate(), key).is_null(); |
| 2049 if (receiver->elements()->map() == | 2049 if (receiver->elements()->map() == |
| 2050 isolate()->heap()->sloppy_arguments_elements_map()) { | 2050 isolate()->heap()->sloppy_arguments_elements_map() && |
| 2051 if (is_sloppy(language_mode())) { | 2051 !is_sloppy(language_mode())) { |
| 2052 stub = sloppy_arguments_stub(); | 2052 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "arguments receiver"); |
| 2053 } else { | 2053 } else if (key_is_smi_like) { |
| 2054 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "arguments receiver"); | |
| 2055 } | |
| 2056 } else if (key_is_smi_like && | |
| 2057 !(target().is_identical_to(sloppy_arguments_stub()))) { | |
| 2058 // We should go generic if receiver isn't a dictionary, but our | 2054 // We should go generic if receiver isn't a dictionary, but our |
| 2059 // prototype chain does have dictionary elements. This ensures that | 2055 // prototype chain does have dictionary elements. This ensures that |
| 2060 // other non-dictionary receivers in the polymorphic case benefit | 2056 // other non-dictionary receivers in the polymorphic case benefit |
| 2061 // from fast path keyed stores. | 2057 // from fast path keyed stores. |
| 2062 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { | 2058 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { |
| 2063 KeyedAccessStoreMode store_mode = GetStoreMode(receiver, key, value); | 2059 KeyedAccessStoreMode store_mode = GetStoreMode(receiver, key, value); |
| 2064 stub = StoreElementStub(receiver, store_mode); | 2060 stub = StoreElementStub(receiver, store_mode); |
| 2065 } else { | 2061 } else { |
| 2066 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "dictionary prototype"); | 2062 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "dictionary prototype"); |
| 2067 } | 2063 } |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 static const Address IC_utilities[] = { | 2901 static const Address IC_utilities[] = { |
| 2906 #define ADDR(name) FUNCTION_ADDR(name), | 2902 #define ADDR(name) FUNCTION_ADDR(name), |
| 2907 IC_UTIL_LIST(ADDR) NULL | 2903 IC_UTIL_LIST(ADDR) NULL |
| 2908 #undef ADDR | 2904 #undef ADDR |
| 2909 }; | 2905 }; |
| 2910 | 2906 |
| 2911 | 2907 |
| 2912 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2908 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 2913 } | 2909 } |
| 2914 } // namespace v8::internal | 2910 } // namespace v8::internal |
| OLD | NEW |