Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: src/ic/ic.cc

Issue 2054133002: [--runtime-call-stats] Fix ACCESSOR handler computation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/mips/ic-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); 1191 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo());
1192 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), 1192 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
1193 isolate()); 1193 isolate());
1194 CallOptimization call_optimization(getter); 1194 CallOptimization call_optimization(getter);
1195 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); 1195 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
1196 if (call_optimization.is_simple_api_call()) { 1196 if (call_optimization.is_simple_api_call()) {
1197 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); 1197 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback);
1198 int index = lookup->GetAccessorIndex(); 1198 int index = lookup->GetAccessorIndex();
1199 Handle<Code> code = compiler.CompileLoadCallback( 1199 Handle<Code> code = compiler.CompileLoadCallback(
1200 lookup->name(), call_optimization, index); 1200 lookup->name(), call_optimization, index);
1201 if (FLAG_runtime_call_stats) return slow_stub();
1202 return code; 1201 return code;
1203 } 1202 }
1204 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); 1203 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter);
1205 int expected_arguments = Handle<JSFunction>::cast(getter) 1204 int expected_arguments = Handle<JSFunction>::cast(getter)
1206 ->shared() 1205 ->shared()
1207 ->internal_formal_parameter_count(); 1206 ->internal_formal_parameter_count();
1208 return compiler.CompileLoadViaGetter( 1207 return compiler.CompileLoadViaGetter(
1209 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); 1208 lookup->name(), lookup->GetAccessorIndex(), expected_arguments);
1210 } else { 1209 } else {
1211 DCHECK(accessors->IsAccessorInfo()); 1210 DCHECK(accessors->IsAccessorInfo());
1212 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); 1211 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
1213 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr); 1212 DCHECK(v8::ToCData<Address>(info->getter()) != nullptr);
1214 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)); 1213 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map));
1215 DCHECK(holder->HasFastProperties()); 1214 DCHECK(holder->HasFastProperties());
1216 DCHECK(!receiver_is_holder); 1215 DCHECK(!receiver_is_holder);
1217 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); 1216 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver());
1218 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); 1217 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback);
1219 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); 1218 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
1220 Handle<Code> code = compiler.CompileLoadCallback(lookup->name(), info); 1219 Handle<Code> code = compiler.CompileLoadCallback(lookup->name(), info);
1221 if (FLAG_runtime_call_stats) return slow_stub();
1222 return code; 1220 return code;
1223 } 1221 }
1224 UNREACHABLE(); 1222 UNREACHABLE();
1225 } 1223 }
1226 1224
1227 case LookupIterator::DATA: { 1225 case LookupIterator::DATA: {
1228 if (lookup->is_dictionary_holder()) { 1226 if (lookup->is_dictionary_holder()) {
1229 DCHECK(kind() == Code::LOAD_IC); 1227 DCHECK(kind() == Code::LOAD_IC);
1230 DCHECK(holder->IsJSGlobalObject()); 1228 DCHECK(holder->IsJSGlobalObject());
1231 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal); 1229 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadGlobal);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 Handle<Code> code = stub.GetCode(); 1556 Handle<Code> code = stub.GetCode();
1559 return code; 1557 return code;
1560 } 1558 }
1561 1559
1562 Handle<Code> StoreIC::initialize_stub_in_optimized_code( 1560 Handle<Code> StoreIC::initialize_stub_in_optimized_code(
1563 Isolate* isolate, LanguageMode language_mode) { 1561 Isolate* isolate, LanguageMode language_mode) {
1564 VectorStoreICStub stub(isolate, StoreICState(language_mode)); 1562 VectorStoreICStub stub(isolate, StoreICState(language_mode));
1565 return stub.GetCode(); 1563 return stub.GetCode();
1566 } 1564 }
1567 1565
1568 Handle<Code> StoreIC::slow_stub() const {
1569 return isolate()->builtins()->StoreIC_Slow();
1570 }
1571
1572
1573 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, 1566 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
1574 JSReceiver::StoreFromKeyed store_mode) { 1567 JSReceiver::StoreFromKeyed store_mode) {
1575 if (state() == UNINITIALIZED) { 1568 if (state() == UNINITIALIZED) {
1576 // This is the first time we execute this inline cache. Set the target to 1569 // This is the first time we execute this inline cache. Set the target to
1577 // the pre monomorphic stub to delay setting the monomorphic state. 1570 // the pre monomorphic stub to delay setting the monomorphic state.
1578 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); 1571 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>());
1579 TRACE_IC("StoreIC", lookup->name()); 1572 TRACE_IC("StoreIC", lookup->name());
1580 return; 1573 return;
1581 } 1574 }
1582 1575
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 DCHECK(v8::ToCData<Address>(info->setter()) != 0); 1774 DCHECK(v8::ToCData<Address>(info->setter()) != 0);
1782 DCHECK(!AccessorInfo::cast(*accessors)->is_special_data_property() || 1775 DCHECK(!AccessorInfo::cast(*accessors)->is_special_data_property() ||
1783 lookup->HolderIsReceiverOrHiddenPrototype()); 1776 lookup->HolderIsReceiverOrHiddenPrototype());
1784 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info, 1777 DCHECK(AccessorInfo::IsCompatibleReceiverMap(isolate(), info,
1785 receiver_map())); 1778 receiver_map()));
1786 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver()); 1779 DCHECK(!info->is_sloppy() || receiver->IsJSReceiver());
1787 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); 1780 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback);
1788 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); 1781 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
1789 Handle<Code> code = compiler.CompileStoreCallback( 1782 Handle<Code> code = compiler.CompileStoreCallback(
1790 receiver, lookup->name(), info, language_mode()); 1783 receiver, lookup->name(), info, language_mode());
1791 if (FLAG_runtime_call_stats) return slow_stub();
1792 return code; 1784 return code;
1793 } else { 1785 } else {
1794 DCHECK(accessors->IsAccessorPair()); 1786 DCHECK(accessors->IsAccessorPair());
1795 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), 1787 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(),
1796 isolate()); 1788 isolate());
1797 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo()); 1789 DCHECK(setter->IsJSFunction() || setter->IsFunctionTemplateInfo());
1798 CallOptimization call_optimization(setter); 1790 CallOptimization call_optimization(setter);
1799 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); 1791 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
1800 if (call_optimization.is_simple_api_call()) { 1792 if (call_optimization.is_simple_api_call()) {
1801 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder)); 1793 DCHECK(call_optimization.IsCompatibleReceiver(receiver, holder));
1802 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback); 1794 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreCallback);
1803 Handle<Code> code = compiler.CompileStoreCallback( 1795 Handle<Code> code = compiler.CompileStoreCallback(
1804 receiver, lookup->name(), call_optimization, 1796 receiver, lookup->name(), call_optimization,
1805 lookup->GetAccessorIndex()); 1797 lookup->GetAccessorIndex());
1806 if (FLAG_runtime_call_stats) return slow_stub();
1807 return code; 1798 return code;
1808 } 1799 }
1809 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter); 1800 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreViaSetter);
1810 int expected_arguments = JSFunction::cast(*setter) 1801 int expected_arguments = JSFunction::cast(*setter)
1811 ->shared() 1802 ->shared()
1812 ->internal_formal_parameter_count(); 1803 ->internal_formal_parameter_count();
1813 return compiler.CompileStoreViaSetter(receiver, lookup->name(), 1804 return compiler.CompileStoreViaSetter(receiver, lookup->name(),
1814 lookup->GetAccessorIndex(), 1805 lookup->GetAccessorIndex(),
1815 expected_arguments); 1806 expected_arguments);
1816 } 1807 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 2727
2737 RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) { 2728 RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) {
2738 Handle<JSObject> receiver = args.at<JSObject>(0); 2729 Handle<JSObject> receiver = args.at<JSObject>(0);
2739 Handle<JSObject> holder = args.at<JSObject>(1); 2730 Handle<JSObject> holder = args.at<JSObject>(1);
2740 Handle<HeapObject> callback_or_cell = args.at<HeapObject>(2); 2731 Handle<HeapObject> callback_or_cell = args.at<HeapObject>(2);
2741 Handle<Name> name = args.at<Name>(3); 2732 Handle<Name> name = args.at<Name>(3);
2742 Handle<Object> value = args.at<Object>(4); 2733 Handle<Object> value = args.at<Object>(4);
2743 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 5); 2734 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 5);
2744 HandleScope scope(isolate); 2735 HandleScope scope(isolate);
2745 2736
2737 if (FLAG_runtime_call_stats) {
2738 RETURN_RESULT_OR_FAILURE(
2739 isolate, Runtime::SetObjectProperty(isolate, receiver, name, value,
2740 language_mode));
2741 }
2742
2746 Handle<AccessorInfo> callback( 2743 Handle<AccessorInfo> callback(
2747 callback_or_cell->IsWeakCell() 2744 callback_or_cell->IsWeakCell()
2748 ? AccessorInfo::cast(WeakCell::cast(*callback_or_cell)->value()) 2745 ? AccessorInfo::cast(WeakCell::cast(*callback_or_cell)->value())
2749 : AccessorInfo::cast(*callback_or_cell)); 2746 : AccessorInfo::cast(*callback_or_cell));
2750 2747
2751 DCHECK(callback->IsCompatibleReceiver(*receiver)); 2748 DCHECK(callback->IsCompatibleReceiver(*receiver));
2752 2749
2753 Address setter_address = v8::ToCData<Address>(callback->setter()); 2750 Address setter_address = v8::ToCData<Address>(callback->setter());
2754 v8::AccessorNameSetterCallback fun = 2751 v8::AccessorNameSetterCallback fun =
2755 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); 2752 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2948 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2952 vector->GetKind(vector_slot)); 2949 vector->GetKind(vector_slot));
2953 KeyedLoadICNexus nexus(vector, vector_slot); 2950 KeyedLoadICNexus nexus(vector, vector_slot);
2954 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2951 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2955 ic.UpdateState(receiver, key); 2952 ic.UpdateState(receiver, key);
2956 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2953 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2957 } 2954 }
2958 } 2955 }
2959 } // namespace internal 2956 } // namespace internal
2960 } // namespace v8 2957 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698