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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 ASSERT(!object->IsJSGlobalProxy()); | 1969 ASSERT(!object->IsJSGlobalProxy()); |
1970 | 1970 |
1971 if (miss_mode != MISS_FORCE_GENERIC) { | 1971 if (miss_mode != MISS_FORCE_GENERIC) { |
1972 if (object->IsJSObject()) { | 1972 if (object->IsJSObject()) { |
1973 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1973 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1974 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); | 1974 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); |
1975 if (receiver->elements()->map() == | 1975 if (receiver->elements()->map() == |
1976 isolate()->heap()->non_strict_arguments_elements_map()) { | 1976 isolate()->heap()->non_strict_arguments_elements_map()) { |
1977 stub = non_strict_arguments_stub(); | 1977 stub = non_strict_arguments_stub(); |
1978 } else if (key_is_smi_like && | 1978 } else if (key_is_smi_like && |
1979 (!target().is_identical_to(non_strict_arguments_stub()))) { | 1979 !(target().is_identical_to(non_strict_arguments_stub()))) { |
1980 KeyedAccessStoreMode store_mode = | 1980 // We should go generic if receiver isn't a dictionary, but our |
1981 GetStoreMode(receiver, key, value); | 1981 // prototype chain does have dictionary elements. This ensures that |
1982 stub = StoreElementStub(receiver, store_mode); | 1982 // other non-dictionary receivers in the polymorphic case benefit |
| 1983 // from fast path keyed stores. |
| 1984 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { |
| 1985 KeyedAccessStoreMode store_mode = |
| 1986 GetStoreMode(receiver, key, value); |
| 1987 stub = StoreElementStub(receiver, store_mode); |
| 1988 } |
1983 } | 1989 } |
1984 } | 1990 } |
1985 } | 1991 } |
1986 } | 1992 } |
1987 } | 1993 } |
1988 | 1994 |
1989 if (!is_target_set()) { | 1995 if (!is_target_set()) { |
1990 if (*stub == *generic_stub()) { | 1996 if (*stub == *generic_stub()) { |
1991 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); | 1997 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); |
1992 } | 1998 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 ic.UpdateState(receiver, key); | 2269 ic.UpdateState(receiver, key); |
2264 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); | 2270 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); |
2265 } | 2271 } |
2266 | 2272 |
2267 | 2273 |
2268 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { | 2274 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { |
2269 HandleScope scope(isolate); | 2275 HandleScope scope(isolate); |
2270 ASSERT(args.length() == 4); | 2276 ASSERT(args.length() == 4); |
2271 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | 2277 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); |
2272 Handle<Object> value = args.at<Object>(0); | 2278 Handle<Object> value = args.at<Object>(0); |
| 2279 Handle<Map> map = args.at<Map>(1); |
2273 Handle<Object> key = args.at<Object>(2); | 2280 Handle<Object> key = args.at<Object>(2); |
2274 Handle<Object> object = args.at<Object>(3); | 2281 Handle<Object> object = args.at<Object>(3); |
2275 StrictModeFlag strict_mode = ic.strict_mode(); | 2282 StrictModeFlag strict_mode = ic.strict_mode(); |
| 2283 if (object->IsJSObject()) { |
| 2284 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), |
| 2285 map->elements_kind()); |
| 2286 } |
2276 return Runtime::SetObjectProperty(isolate, | 2287 return Runtime::SetObjectProperty(isolate, |
2277 object, | 2288 object, |
2278 key, | 2289 key, |
2279 value, | 2290 value, |
2280 NONE, | 2291 NONE, |
2281 strict_mode); | 2292 strict_mode); |
2282 } | 2293 } |
2283 | 2294 |
2284 | 2295 |
2285 const char* BinaryOpIC::GetName(TypeInfo type_info) { | 2296 const char* BinaryOpIC::GetName(TypeInfo type_info) { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 #undef ADDR | 2737 #undef ADDR |
2727 }; | 2738 }; |
2728 | 2739 |
2729 | 2740 |
2730 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2741 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2731 return IC_utilities[id]; | 2742 return IC_utilities[id]; |
2732 } | 2743 } |
2733 | 2744 |
2734 | 2745 |
2735 } } // namespace v8::internal | 2746 } } // namespace v8::internal |
OLD | NEW |