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 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1962 // expect to be able to trap element sets to objects with those maps in | 1962 // expect to be able to trap element sets to objects with those maps in |
1963 // the runtime to enable optimization of element hole access. | 1963 // the runtime to enable optimization of element hole access. |
1964 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); | 1964 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); |
1965 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; | 1965 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; |
1966 } | 1966 } |
1967 | 1967 |
1968 if (use_ic) { | 1968 if (use_ic) { |
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 bool indexed_callbacks = false; |
1973 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1973 if (object->IsJSReceiver()) { |
1974 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); | 1974 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); |
1975 if (receiver->elements()->map() == | 1975 indexed_callbacks = |
1976 isolate()->heap()->non_strict_arguments_elements_map()) { | 1976 receiver->map()->MayHaveIndexedCallbacksInPrototypeChain(); |
1977 stub = non_strict_arguments_stub(); | 1977 } |
1978 } else if (key_is_smi_like && | 1978 |
1979 (!target().is_identical_to(non_strict_arguments_stub()))) { | 1979 if (!indexed_callbacks) { |
1980 KeyedAccessStoreMode store_mode = | 1980 if (object->IsJSObject()) { |
danno
2013/10/30 12:17:45
You should only have to check for JSObject once at
mvstanton
2013/10/30 18:22:28
Done.
| |
1981 GetStoreMode(receiver, key, value); | 1981 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1982 stub = StoreElementStub(receiver, store_mode); | 1982 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); |
1983 if (receiver->elements()->map() == | |
1984 isolate()->heap()->non_strict_arguments_elements_map()) { | |
1985 stub = non_strict_arguments_stub(); | |
1986 } else if (key_is_smi_like && | |
1987 !target().is_identical_to(non_strict_arguments_stub())) { | |
1988 KeyedAccessStoreMode store_mode = GetStoreMode( | |
1989 receiver, key, value); | |
1990 stub = StoreElementStub(receiver, store_mode); | |
1991 } else { | |
1992 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "key not a number"); | |
danno
2013/10/30 12:17:45
Remove the TRACE_GENERIC_IC here and below, it's c
mvstanton
2013/10/30 18:22:28
Okay, it is nice to see the reason for going gener
| |
1993 } | |
1994 } else { | |
1995 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "not an object"); | |
1983 } | 1996 } |
1997 } else { | |
1998 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", | |
1999 "indexed callbacks in prototype chain"); | |
1984 } | 2000 } |
1985 } | 2001 } |
1986 } | 2002 } |
1987 } | 2003 } |
1988 | 2004 |
1989 if (!is_target_set()) { | 2005 if (!is_target_set()) { |
1990 if (*stub == *generic_stub()) { | 2006 if (*stub == *generic_stub()) { |
1991 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); | 2007 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); |
1992 } | 2008 } |
1993 ASSERT(!stub.is_null()); | 2009 ASSERT(!stub.is_null()); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2263 ic.UpdateState(receiver, key); | 2279 ic.UpdateState(receiver, key); |
2264 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); | 2280 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); |
2265 } | 2281 } |
2266 | 2282 |
2267 | 2283 |
2268 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { | 2284 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { |
2269 HandleScope scope(isolate); | 2285 HandleScope scope(isolate); |
2270 ASSERT(args.length() == 4); | 2286 ASSERT(args.length() == 4); |
2271 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | 2287 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); |
2272 Handle<Object> value = args.at<Object>(0); | 2288 Handle<Object> value = args.at<Object>(0); |
2289 Handle<Map> map = args.at<Map>(1); | |
2273 Handle<Object> key = args.at<Object>(2); | 2290 Handle<Object> key = args.at<Object>(2); |
2274 Handle<Object> object = args.at<Object>(3); | 2291 Handle<Object> object = args.at<Object>(3); |
2275 StrictModeFlag strict_mode = ic.strict_mode(); | 2292 StrictModeFlag strict_mode = ic.strict_mode(); |
2293 if (object->IsJSObject()) { | |
2294 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), | |
2295 map->elements_kind()); | |
2296 } | |
2276 return Runtime::SetObjectProperty(isolate, | 2297 return Runtime::SetObjectProperty(isolate, |
2277 object, | 2298 object, |
2278 key, | 2299 key, |
2279 value, | 2300 value, |
2280 NONE, | 2301 NONE, |
2281 strict_mode); | 2302 strict_mode); |
2282 } | 2303 } |
2283 | 2304 |
2284 | 2305 |
2285 const char* BinaryOpIC::GetName(TypeInfo type_info) { | 2306 const char* BinaryOpIC::GetName(TypeInfo type_info) { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2726 #undef ADDR | 2747 #undef ADDR |
2727 }; | 2748 }; |
2728 | 2749 |
2729 | 2750 |
2730 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2751 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2731 return IC_utilities[id]; | 2752 return IC_utilities[id]; |
2732 } | 2753 } |
2733 | 2754 |
2734 | 2755 |
2735 } } // namespace v8::internal | 2756 } } // namespace v8::internal |
OLD | NEW |