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.h" | 8 #include "src/api.h" |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 if (accessors->IsAccessorPair()) { | 1190 if (accessors->IsAccessorPair()) { |
1191 DCHECK(holder->HasFastProperties()); | 1191 DCHECK(holder->HasFastProperties()); |
1192 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); | 1192 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); |
1193 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1193 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
1194 isolate()); | 1194 isolate()); |
1195 CallOptimization call_optimization(getter); | 1195 CallOptimization call_optimization(getter); |
1196 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1196 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1197 if (call_optimization.is_simple_api_call()) { | 1197 if (call_optimization.is_simple_api_call()) { |
1198 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); | 1198 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); |
1199 int index = lookup->GetAccessorIndex(); | 1199 int index = lookup->GetAccessorIndex(); |
1200 return compiler.CompileLoadCallback(lookup->name(), call_optimization, | 1200 Handle<Code> code = compiler.CompileLoadCallback( |
1201 index); | 1201 lookup->name(), call_optimization, index); |
| 1202 if (FLAG_runtime_call_stats) return slow_stub(); |
| 1203 return code; |
1202 } | 1204 } |
1203 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); | 1205 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); |
1204 int expected_arguments = Handle<JSFunction>::cast(getter) | 1206 int expected_arguments = Handle<JSFunction>::cast(getter) |
1205 ->shared() | 1207 ->shared() |
1206 ->internal_formal_parameter_count(); | 1208 ->internal_formal_parameter_count(); |
1207 return compiler.CompileLoadViaGetter( | 1209 return compiler.CompileLoadViaGetter( |
1208 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); | 1210 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); |
1209 } else { | 1211 } else { |
1210 DCHECK(accessors->IsAccessorInfo()); | 1212 DCHECK(accessors->IsAccessorInfo()); |
1211 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); | 1213 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); |
1212 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr); | 1214 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr); |
1213 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)); | 1215 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)); |
1214 DCHECK(holder->HasFastProperties()); | 1216 DCHECK(holder->HasFastProperties()); |
1215 DCHECK(!receiver_is_holder); | 1217 DCHECK(!receiver_is_holder); |
1216 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); | 1218 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); |
1217 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); | 1219 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); |
1218 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1220 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1219 return compiler.CompileLoadCallback(lookup->name(), info); | 1221 Handle<Code> code = compiler.CompileLoadCallback(lookup->name(), info); |
| 1222 if (FLAG_runtime_call_stats) return slow_stub(); |
| 1223 return code; |
1220 } | 1224 } |
1221 UNREACHABLE(); | 1225 UNREACHABLE(); |
1222 } | 1226 } |
1223 | 1227 |
1224 case LookupIterator::DATA: { | 1228 case LookupIterator::DATA: { |
1225 if (lookup->is_dictionary_holder()) { | 1229 if (lookup->is_dictionary_holder()) { |
1226 DCHECK(kind() == Code::LOAD_IC); | 1230 DCHECK(kind() == Code::LOAD_IC); |
1227 DCHECK(holder->IsJSGlobalObject()); | 1231 DCHECK(holder->IsJSGlobalObject()); |
1228 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal); | 1232 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal); |
1229 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1233 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 if (accessors->IsAccessorInfo()) { | 1787 if (accessors->IsAccessorInfo()) { |
1784 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); | 1788 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); |
1785 DCHECK(v8::ToCData<Address>(info->setter()) != 0); | 1789 DCHECK(v8::ToCData<Address>(info->setter()) != 0); |
1786 DCHECK(!AccessorInfo::cast(*accessors)->is_special_data_property() || | 1790 DCHECK(!AccessorInfo::cast(*accessors)->is_special_data_property() || |
1787 lookup->HolderIsReceiverOrHiddenPrototype()); | 1791 lookup->HolderIsReceiverOrHiddenPrototype()); |
1788 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, | 1792 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, |
1789 receiver_map())); | 1793 receiver_map())); |
1790 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); | 1794 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); |
1791 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); | 1795 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); |
1792 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1796 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
1793 return compiler.CompileStoreCallback(receiver, lookup->name(), info, | 1797 Handle<Code> code = compiler.CompileStoreCallback( |
1794 language_mode()); | 1798 receiver, lookup->name(), info, language_mode()); |
| 1799 if (FLAG_runtime_call_stats) return slow_stub(); |
| 1800 return code; |
1795 } else { | 1801 } else { |
1796 DCHECK(accessors->IsAccessorPair()); | 1802 DCHECK(accessors->IsAccessorPair()); |
1797 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), | 1803 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), |
1798 isolate()); | 1804 isolate()); |
1799 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo()); | 1805 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo()); |
1800 CallOptimization call_optimization(setter); | 1806 CallOptimization call_optimization(setter); |
1801 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1807 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
1802 if (call_optimization.is_simple_api_call()) { | 1808 if (call_optimization.is_simple_api_call()) { |
1803 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder)); | 1809 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder)); |
1804 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); | 1810 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); |
1805 return compiler.CompileStoreCallback(receiver, lookup->name(), | 1811 Handle<Code> code = compiler.CompileStoreCallback( |
1806 call_optimization, | 1812 receiver, lookup->name(), call_optimization, |
1807 lookup->GetAccessorIndex()); | 1813 lookup->GetAccessorIndex()); |
| 1814 if (FLAG_runtime_call_stats) return slow_stub(); |
| 1815 return code; |
1808 } | 1816 } |
1809 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter); | 1817 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter); |
1810 int expected_arguments = JSFunction::cast(*setter) | 1818 int expected_arguments = JSFunction::cast(*setter) |
1811 ->shared() | 1819 ->shared() |
1812 ->internal_formal_parameter_count(); | 1820 ->internal_formal_parameter_count(); |
1813 return compiler.CompileStoreViaSetter(receiver, lookup->name(), | 1821 return compiler.CompileStoreViaSetter(receiver, lookup->name(), |
1814 lookup->GetAccessorIndex(), | 1822 lookup->GetAccessorIndex(), |
1815 expected_arguments); | 1823 expected_arguments); |
1816 } | 1824 } |
1817 } | 1825 } |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 KeyedLoadICNexus nexus(vector, vector_slot); | 2994 KeyedLoadICNexus nexus(vector, vector_slot); |
2987 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2995 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2988 ic.UpdateState(receiver, key); | 2996 ic.UpdateState(receiver, key); |
2989 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2997 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2990 } | 2998 } |
2991 | 2999 |
2992 return *result; | 3000 return *result; |
2993 } | 3001 } |
2994 } // namespace internal | 3002 } // namespace internal |
2995 } // namespace v8 | 3003 } // namespace v8 |
OLD | NEW |