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 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 } | 1929 } |
1930 } | 1930 } |
1931 } | 1931 } |
1932 | 1932 |
1933 | 1933 |
1934 MaybeObject* KeyedStoreIC::Store(Handle<Object> object, | 1934 MaybeObject* KeyedStoreIC::Store(Handle<Object> object, |
1935 Handle<Object> key, | 1935 Handle<Object> key, |
1936 Handle<Object> value, | 1936 Handle<Object> value, |
1937 ICMissMode miss_mode) { | 1937 ICMissMode miss_mode) { |
1938 if (MigrateDeprecated(object)) { | 1938 if (MigrateDeprecated(object)) { |
1939 return Runtime::SetObjectPropertyOrFail( | 1939 Handle<Object> result = Runtime::SetObjectProperty(isolate(), object, |
1940 isolate(), object , key, value, NONE, strict_mode()); | 1940 key, |
| 1941 value, |
| 1942 NONE, |
| 1943 strict_mode()); |
| 1944 RETURN_IF_EMPTY_HANDLE(isolate(), result); |
| 1945 return *result; |
1941 } | 1946 } |
1942 | 1947 |
1943 // Check for values that can be converted into an internalized string directly | 1948 // Check for values that can be converted into an internalized string directly |
1944 // or is representable as a smi. | 1949 // or is representable as a smi. |
1945 key = TryConvertKey(key, isolate()); | 1950 key = TryConvertKey(key, isolate()); |
1946 | 1951 |
1947 MaybeObject* maybe_object = NULL; | 1952 MaybeObject* maybe_object = NULL; |
1948 Handle<Code> stub = generic_stub(); | 1953 Handle<Code> stub = generic_stub(); |
1949 | 1954 |
1950 if (key->IsInternalizedString()) { | 1955 if (key->IsInternalizedString()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 if (!is_target_set()) { | 2000 if (!is_target_set()) { |
1996 if (*stub == *generic_stub()) { | 2001 if (*stub == *generic_stub()) { |
1997 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); | 2002 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); |
1998 } | 2003 } |
1999 ASSERT(!stub.is_null()); | 2004 ASSERT(!stub.is_null()); |
2000 set_target(*stub); | 2005 set_target(*stub); |
2001 TRACE_IC("StoreIC", key); | 2006 TRACE_IC("StoreIC", key); |
2002 } | 2007 } |
2003 | 2008 |
2004 if (maybe_object) return maybe_object; | 2009 if (maybe_object) return maybe_object; |
2005 return Runtime::SetObjectPropertyOrFail( | 2010 Handle<Object> result = Runtime::SetObjectProperty(isolate(), object, key, |
2006 isolate(), object , key, value, NONE, strict_mode()); | 2011 value, |
| 2012 NONE, |
| 2013 strict_mode()); |
| 2014 RETURN_IF_EMPTY_HANDLE(isolate(), result); |
| 2015 return *result; |
2007 } | 2016 } |
2008 | 2017 |
2009 | 2018 |
2010 #undef TRACE_IC | 2019 #undef TRACE_IC |
2011 | 2020 |
2012 | 2021 |
2013 // ---------------------------------------------------------------------------- | 2022 // ---------------------------------------------------------------------------- |
2014 // Static IC stub generators. | 2023 // Static IC stub generators. |
2015 // | 2024 // |
2016 | 2025 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 | 2236 |
2228 | 2237 |
2229 RUNTIME_FUNCTION(MaybeObject*, StoreIC_Slow) { | 2238 RUNTIME_FUNCTION(MaybeObject*, StoreIC_Slow) { |
2230 HandleScope scope(isolate); | 2239 HandleScope scope(isolate); |
2231 ASSERT(args.length() == 3); | 2240 ASSERT(args.length() == 3); |
2232 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 2241 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
2233 Handle<Object> object = args.at<Object>(0); | 2242 Handle<Object> object = args.at<Object>(0); |
2234 Handle<Object> key = args.at<Object>(1); | 2243 Handle<Object> key = args.at<Object>(1); |
2235 Handle<Object> value = args.at<Object>(2); | 2244 Handle<Object> value = args.at<Object>(2); |
2236 StrictModeFlag strict_mode = ic.strict_mode(); | 2245 StrictModeFlag strict_mode = ic.strict_mode(); |
2237 return Runtime::SetObjectProperty(isolate, | 2246 Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key, |
2238 object, | 2247 value, |
2239 key, | 2248 NONE, |
2240 value, | 2249 strict_mode); |
2241 NONE, | 2250 RETURN_IF_EMPTY_HANDLE(isolate, result); |
2242 strict_mode); | 2251 return *result; |
2243 } | 2252 } |
2244 | 2253 |
2245 | 2254 |
2246 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) { | 2255 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) { |
2247 HandleScope scope(isolate); | 2256 HandleScope scope(isolate); |
2248 ASSERT(args.length() == 3); | 2257 ASSERT(args.length() == 3); |
2249 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 2258 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
2250 Handle<Object> object = args.at<Object>(0); | 2259 Handle<Object> object = args.at<Object>(0); |
2251 Handle<Object> key = args.at<Object>(1); | 2260 Handle<Object> key = args.at<Object>(1); |
2252 Handle<Object> value = args.at<Object>(2); | 2261 Handle<Object> value = args.at<Object>(2); |
2253 StrictModeFlag strict_mode = ic.strict_mode(); | 2262 StrictModeFlag strict_mode = ic.strict_mode(); |
2254 return Runtime::SetObjectProperty(isolate, | 2263 Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key, |
2255 object, | 2264 value, |
2256 key, | 2265 NONE, |
2257 value, | 2266 strict_mode); |
2258 NONE, | 2267 RETURN_IF_EMPTY_HANDLE(isolate, result); |
2259 strict_mode); | 2268 return *result; |
2260 } | 2269 } |
2261 | 2270 |
2262 | 2271 |
2263 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissForceGeneric) { | 2272 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissForceGeneric) { |
2264 HandleScope scope(isolate); | 2273 HandleScope scope(isolate); |
2265 ASSERT(args.length() == 3); | 2274 ASSERT(args.length() == 3); |
2266 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 2275 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
2267 Handle<Object> receiver = args.at<Object>(0); | 2276 Handle<Object> receiver = args.at<Object>(0); |
2268 Handle<Object> key = args.at<Object>(1); | 2277 Handle<Object> key = args.at<Object>(1); |
2269 ic.UpdateState(receiver, key); | 2278 ic.UpdateState(receiver, key); |
2270 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); | 2279 return ic.Store(receiver, key, args.at<Object>(2), MISS_FORCE_GENERIC); |
2271 } | 2280 } |
2272 | 2281 |
2273 | 2282 |
2274 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { | 2283 RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) { |
2275 HandleScope scope(isolate); | 2284 HandleScope scope(isolate); |
2276 ASSERT(args.length() == 4); | 2285 ASSERT(args.length() == 4); |
2277 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | 2286 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); |
2278 Handle<Object> value = args.at<Object>(0); | 2287 Handle<Object> value = args.at<Object>(0); |
2279 Handle<Map> map = args.at<Map>(1); | 2288 Handle<Map> map = args.at<Map>(1); |
2280 Handle<Object> key = args.at<Object>(2); | 2289 Handle<Object> key = args.at<Object>(2); |
2281 Handle<Object> object = args.at<Object>(3); | 2290 Handle<Object> object = args.at<Object>(3); |
2282 StrictModeFlag strict_mode = ic.strict_mode(); | 2291 StrictModeFlag strict_mode = ic.strict_mode(); |
2283 if (object->IsJSObject()) { | 2292 if (object->IsJSObject()) { |
2284 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), | 2293 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), |
2285 map->elements_kind()); | 2294 map->elements_kind()); |
2286 } | 2295 } |
2287 return Runtime::SetObjectProperty(isolate, | 2296 Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key, |
2288 object, | 2297 value, |
2289 key, | 2298 NONE, |
2290 value, | 2299 strict_mode); |
2291 NONE, | 2300 RETURN_IF_EMPTY_HANDLE(isolate, result); |
2292 strict_mode); | 2301 return *result; |
2293 } | 2302 } |
2294 | 2303 |
2295 | 2304 |
2296 const char* BinaryOpIC::GetName(TypeInfo type_info) { | 2305 const char* BinaryOpIC::GetName(TypeInfo type_info) { |
2297 switch (type_info) { | 2306 switch (type_info) { |
2298 case UNINITIALIZED: return "Uninitialized"; | 2307 case UNINITIALIZED: return "Uninitialized"; |
2299 case SMI: return "Smi"; | 2308 case SMI: return "Smi"; |
2300 case INT32: return "Int32"; | 2309 case INT32: return "Int32"; |
2301 case NUMBER: return "Number"; | 2310 case NUMBER: return "Number"; |
2302 case ODDBALL: return "Oddball"; | 2311 case ODDBALL: return "Oddball"; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 #undef ADDR | 2746 #undef ADDR |
2738 }; | 2747 }; |
2739 | 2748 |
2740 | 2749 |
2741 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2750 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2742 return IC_utilities[id]; | 2751 return IC_utilities[id]; |
2743 } | 2752 } |
2744 | 2753 |
2745 | 2754 |
2746 } } // namespace v8::internal | 2755 } } // namespace v8::internal |
OLD | NEW |