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/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 DCHECK(holder->HasFastProperties()); | 1217 DCHECK(holder->HasFastProperties()); |
1218 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); | 1218 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); |
1219 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1219 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
1220 isolate()); | 1220 isolate()); |
1221 CallOptimization call_optimization(getter); | 1221 CallOptimization call_optimization(getter); |
1222 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1222 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1223 if (call_optimization.is_simple_api_call()) { | 1223 if (call_optimization.is_simple_api_call()) { |
1224 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); | 1224 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); |
1225 int index = lookup->GetAccessorIndex(); | 1225 int index = lookup->GetAccessorIndex(); |
1226 Handle<Code> code = compiler.CompileLoadCallback( | 1226 Handle<Code> code = compiler.CompileLoadCallback( |
1227 lookup->name(), call_optimization, index); | 1227 lookup->name(), call_optimization, index, slow_stub()); |
1228 return code; | 1228 return code; |
1229 } | 1229 } |
1230 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); | 1230 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); |
1231 int expected_arguments = Handle<JSFunction>::cast(getter) | 1231 int expected_arguments = Handle<JSFunction>::cast(getter) |
1232 ->shared() | 1232 ->shared() |
1233 ->internal_formal_parameter_count(); | 1233 ->internal_formal_parameter_count(); |
1234 return compiler.CompileLoadViaGetter( | 1234 return compiler.CompileLoadViaGetter( |
1235 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); | 1235 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); |
1236 } else { | 1236 } else { |
1237 DCHECK(accessors->IsAccessorInfo()); | 1237 DCHECK(accessors->IsAccessorInfo()); |
1238 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); | 1238 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); |
1239 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr); | 1239 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr); |
1240 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)); | 1240 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)); |
1241 DCHECK(holder->HasFastProperties()); | 1241 DCHECK(holder->HasFastProperties()); |
1242 DCHECK(!receiver_is_holder); | 1242 DCHECK(!receiver_is_holder); |
1243 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); | 1243 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); |
1244 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); | 1244 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); |
1245 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1245 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1246 Handle<Code> code = compiler.CompileLoadCallback(lookup->name(), info); | 1246 Handle<Code> code = |
| 1247 compiler.CompileLoadCallback(lookup->name(), info, slow_stub()); |
1247 return code; | 1248 return code; |
1248 } | 1249 } |
1249 UNREACHABLE(); | 1250 UNREACHABLE(); |
1250 } | 1251 } |
1251 | 1252 |
1252 case LookupIterator::DATA: { | 1253 case LookupIterator::DATA: { |
1253 if (lookup->is_dictionary_holder()) { | 1254 if (lookup->is_dictionary_holder()) { |
1254 DCHECK(kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC); | 1255 DCHECK(kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC); |
1255 DCHECK(holder->IsJSGlobalObject()); | 1256 DCHECK(holder->IsJSGlobalObject()); |
1256 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal); | 1257 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), | 1799 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), |
1799 isolate()); | 1800 isolate()); |
1800 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo()); | 1801 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo()); |
1801 CallOptimization call_optimization(setter); | 1802 CallOptimization call_optimization(setter); |
1802 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1803 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
1803 if (call_optimization.is_simple_api_call()) { | 1804 if (call_optimization.is_simple_api_call()) { |
1804 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder)); | 1805 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder)); |
1805 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); | 1806 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); |
1806 Handle<Code> code = compiler.CompileStoreCallback( | 1807 Handle<Code> code = compiler.CompileStoreCallback( |
1807 receiver, lookup->name(), call_optimization, | 1808 receiver, lookup->name(), call_optimization, |
1808 lookup->GetAccessorIndex()); | 1809 lookup->GetAccessorIndex(), slow_stub()); |
1809 return code; | 1810 return code; |
1810 } | 1811 } |
1811 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter); | 1812 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter); |
1812 int expected_arguments = JSFunction::cast(*setter) | 1813 int expected_arguments = JSFunction::cast(*setter) |
1813 ->shared() | 1814 ->shared() |
1814 ->internal_formal_parameter_count(); | 1815 ->internal_formal_parameter_count(); |
1815 return compiler.CompileStoreViaSetter(receiver, lookup->name(), | 1816 return compiler.CompileStoreViaSetter(receiver, lookup->name(), |
1816 lookup->GetAccessorIndex(), | 1817 lookup->GetAccessorIndex(), |
1817 expected_arguments); | 1818 expected_arguments); |
1818 } | 1819 } |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 Handle<Smi> slot = args.at<Smi>(3); | 2466 Handle<Smi> slot = args.at<Smi>(3); |
2466 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); | 2467 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); |
2467 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2468 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
2468 KeyedStoreICNexus nexus(vector, vector_slot); | 2469 KeyedStoreICNexus nexus(vector, vector_slot); |
2469 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2470 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2470 ic.UpdateState(receiver, key); | 2471 ic.UpdateState(receiver, key); |
2471 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2472 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
2472 } | 2473 } |
2473 | 2474 |
2474 | 2475 |
2475 RUNTIME_FUNCTION(Runtime_StoreIC_Slow) { | |
2476 HandleScope scope(isolate); | |
2477 DCHECK(args.length() == 5); | |
2478 Handle<Object> object = args.at<Object>(0); | |
2479 Handle<Object> key = args.at<Object>(1); | |
2480 Handle<Object> value = args.at<Object>(2); | |
2481 LanguageMode language_mode; | |
2482 StoreICNexus nexus(isolate); | |
2483 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | |
2484 language_mode = ic.language_mode(); | |
2485 RETURN_RESULT_OR_FAILURE( | |
2486 isolate, | |
2487 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); | |
2488 } | |
2489 | |
2490 | |
2491 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { | 2476 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { |
2492 HandleScope scope(isolate); | 2477 HandleScope scope(isolate); |
2493 DCHECK(args.length() == 5); | 2478 DCHECK(args.length() == 5); |
2494 Handle<Object> object = args.at<Object>(0); | 2479 Handle<Object> object = args.at<Object>(0); |
2495 Handle<Object> key = args.at<Object>(1); | 2480 Handle<Object> key = args.at<Object>(1); |
2496 Handle<Object> value = args.at<Object>(2); | 2481 Handle<Object> value = args.at<Object>(2); |
2497 LanguageMode language_mode; | 2482 LanguageMode language_mode; |
2498 KeyedStoreICNexus nexus(isolate); | 2483 KeyedStoreICNexus nexus(isolate); |
2499 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2484 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2500 language_mode = ic.language_mode(); | 2485 language_mode = ic.language_mode(); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | 2977 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
2993 vector->GetKind(vector_slot)); | 2978 vector->GetKind(vector_slot)); |
2994 KeyedLoadICNexus nexus(vector, vector_slot); | 2979 KeyedLoadICNexus nexus(vector, vector_slot); |
2995 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2980 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2996 ic.UpdateState(receiver, key); | 2981 ic.UpdateState(receiver, key); |
2997 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 2982 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
2998 } | 2983 } |
2999 } | 2984 } |
3000 } // namespace internal | 2985 } // namespace internal |
3001 } // namespace v8 | 2986 } // namespace v8 |
OLD | NEW |