| 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 KeyedAccessStoreMode store_mode, | 1840 KeyedAccessStoreMode store_mode, |
| 1841 StrictModeFlag strict_mode) { | 1841 StrictModeFlag strict_mode) { |
| 1842 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS | 1842 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS |
| 1843 // via megamorphic stubs, since they don't have a map in their relocation info | 1843 // via megamorphic stubs, since they don't have a map in their relocation info |
| 1844 // and so the stubs can't be harvested for the object needed for a map check. | 1844 // and so the stubs can't be harvested for the object needed for a map check. |
| 1845 if (target()->type() != Code::NORMAL) { | 1845 if (target()->type() != Code::NORMAL) { |
| 1846 TRACE_GENERIC_IC(isolate(), "KeyedIC", "non-NORMAL target type"); | 1846 TRACE_GENERIC_IC(isolate(), "KeyedIC", "non-NORMAL target type"); |
| 1847 return strict_mode == kStrictMode ? generic_stub_strict() : generic_stub(); | 1847 return strict_mode == kStrictMode ? generic_stub_strict() : generic_stub(); |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 if (!FLAG_compiled_keyed_stores && | |
| 1851 (store_mode == STORE_NO_TRANSITION_HANDLE_COW || | |
| 1852 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS)) { | |
| 1853 // TODO(danno): We'll soon handle MONOMORPHIC ICs that also support | |
| 1854 // copying COW arrays and silently ignoring some OOB stores into external | |
| 1855 // arrays, but for now use the generic. | |
| 1856 TRACE_GENERIC_IC(isolate(), "KeyedIC", "COW/OOB external array"); | |
| 1857 return strict_mode == kStrictMode | |
| 1858 ? generic_stub_strict() | |
| 1859 : generic_stub(); | |
| 1860 } | |
| 1861 | |
| 1862 State ic_state = target()->ic_state(); | 1850 State ic_state = target()->ic_state(); |
| 1863 Handle<Map> receiver_map(receiver->map(), isolate()); | 1851 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 1864 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { | 1852 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { |
| 1865 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state | 1853 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state |
| 1866 // yet will do so and stay there. | 1854 // yet will do so and stay there. |
| 1867 Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, store_mode); | 1855 Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, store_mode); |
| 1868 store_mode = GetNonTransitioningStoreMode(store_mode); | 1856 store_mode = GetNonTransitioningStoreMode(store_mode); |
| 1869 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1857 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
| 1870 monomorphic_map, strict_mode, store_mode); | 1858 monomorphic_map, strict_mode, store_mode); |
| 1871 } | 1859 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 if (use_ic) { | 2120 if (use_ic) { |
| 2133 Handle<Code> stub = (strict_mode == kStrictMode) | 2121 Handle<Code> stub = (strict_mode == kStrictMode) |
| 2134 ? generic_stub_strict() | 2122 ? generic_stub_strict() |
| 2135 : generic_stub(); | 2123 : generic_stub(); |
| 2136 if (miss_mode != MISS_FORCE_GENERIC) { | 2124 if (miss_mode != MISS_FORCE_GENERIC) { |
| 2137 if (object->IsJSObject()) { | 2125 if (object->IsJSObject()) { |
| 2138 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 2126 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 2139 if (receiver->map()->is_deprecated()) { | 2127 if (receiver->map()->is_deprecated()) { |
| 2140 JSObject::MigrateInstance(receiver); | 2128 JSObject::MigrateInstance(receiver); |
| 2141 } | 2129 } |
| 2142 bool key_is_smi_like = key->IsSmi() || | 2130 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); |
| 2143 (FLAG_compiled_keyed_stores && !key->ToSmi()->IsFailure()); | |
| 2144 if (receiver->elements()->map() == | 2131 if (receiver->elements()->map() == |
| 2145 isolate()->heap()->non_strict_arguments_elements_map()) { | 2132 isolate()->heap()->non_strict_arguments_elements_map()) { |
| 2146 stub = non_strict_arguments_stub(); | 2133 stub = non_strict_arguments_stub(); |
| 2147 } else if (key_is_smi_like && | 2134 } else if (key_is_smi_like && |
| 2148 (target() != *non_strict_arguments_stub())) { | 2135 (target() != *non_strict_arguments_stub())) { |
| 2149 KeyedAccessStoreMode store_mode = GetStoreMode(receiver, key, value); | 2136 KeyedAccessStoreMode store_mode = GetStoreMode(receiver, key, value); |
| 2150 stub = StoreElementStub(receiver, store_mode, strict_mode); | 2137 stub = StoreElementStub(receiver, store_mode, strict_mode); |
| 2151 } else { | 2138 } else { |
| 2152 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "key not a number"); | 2139 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "key not a number"); |
| 2153 } | 2140 } |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3106 #undef ADDR | 3093 #undef ADDR |
| 3107 }; | 3094 }; |
| 3108 | 3095 |
| 3109 | 3096 |
| 3110 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3097 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3111 return IC_utilities[id]; | 3098 return IC_utilities[id]; |
| 3112 } | 3099 } |
| 3113 | 3100 |
| 3114 | 3101 |
| 3115 } } // namespace v8::internal | 3102 } } // namespace v8::internal |
| OLD | NEW |