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

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

Issue 2065113002: [ic] LoadGlobalIC caches PropertyCells in the feedback vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing 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/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.h » ('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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 460
461 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { 461 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) {
462 if (IsCleared(nexus)) return; 462 if (IsCleared(nexus)) return;
463 nexus->ConfigurePremonomorphic(); 463 nexus->ConfigurePremonomorphic();
464 OnTypeFeedbackChanged(isolate, host); 464 OnTypeFeedbackChanged(isolate, host);
465 } 465 }
466 466
467 void LoadGlobalIC::Clear(Isolate* isolate, Code* host, 467 void LoadGlobalIC::Clear(Isolate* isolate, Code* host,
468 LoadGlobalICNexus* nexus) { 468 LoadGlobalICNexus* nexus) {
469 if (IsCleared(nexus)) return; 469 if (IsCleared(nexus)) return;
470 nexus->ConfigureUninitialized(); 470 if (FLAG_new_load_global_ic) {
471 nexus->ConfigureUninitialized();
472 } else {
473 nexus->ConfigurePremonomorphic();
474 }
471 OnTypeFeedbackChanged(isolate, host); 475 OnTypeFeedbackChanged(isolate, host);
472 } 476 }
473 477
474 void StoreIC::Clear(Isolate* isolate, Code* host, StoreICNexus* nexus) { 478 void StoreIC::Clear(Isolate* isolate, Code* host, StoreICNexus* nexus) {
475 if (IsCleared(nexus)) return; 479 if (IsCleared(nexus)) return;
476 nexus->ConfigurePremonomorphic(); 480 nexus->ConfigurePremonomorphic();
477 OnTypeFeedbackChanged(isolate, host); 481 OnTypeFeedbackChanged(isolate, host);
478 } 482 }
479 483
480 484
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 546
543 547
544 void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map, 548 void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map,
545 Handle<Code> handler) { 549 Handle<Code> handler) {
546 DCHECK(UseVector()); 550 DCHECK(UseVector());
547 if (kind() == Code::LOAD_IC) { 551 if (kind() == Code::LOAD_IC) {
548 LoadICNexus* nexus = casted_nexus<LoadICNexus>(); 552 LoadICNexus* nexus = casted_nexus<LoadICNexus>();
549 nexus->ConfigureMonomorphic(map, handler); 553 nexus->ConfigureMonomorphic(map, handler);
550 } else if (kind() == Code::LOAD_GLOBAL_IC) { 554 } else if (kind() == Code::LOAD_GLOBAL_IC) {
551 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>(); 555 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>();
552 nexus->ConfigureMonomorphic(map, handler); 556 if (FLAG_new_load_global_ic) {
557 nexus->ConfigureHandlerMode(handler);
558 } else {
559 nexus->ConfigureMonomorphic(map, handler);
560 }
553 } else if (kind() == Code::KEYED_LOAD_IC) { 561 } else if (kind() == Code::KEYED_LOAD_IC) {
554 KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>(); 562 KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>();
555 nexus->ConfigureMonomorphic(name, map, handler); 563 nexus->ConfigureMonomorphic(name, map, handler);
556 } else if (kind() == Code::STORE_IC) { 564 } else if (kind() == Code::STORE_IC) {
557 StoreICNexus* nexus = casted_nexus<StoreICNexus>(); 565 StoreICNexus* nexus = casted_nexus<StoreICNexus>();
558 nexus->ConfigureMonomorphic(map, handler); 566 nexus->ConfigureMonomorphic(map, handler);
559 } else { 567 } else {
560 DCHECK(kind() == Code::KEYED_STORE_IC); 568 DCHECK(kind() == Code::KEYED_STORE_IC);
561 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); 569 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>();
562 nexus->ConfigureMonomorphic(name, map, handler); 570 nexus->ConfigureMonomorphic(name, map, handler);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) { 915 !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) {
908 return false; 916 return false;
909 } 917 }
910 } 918 }
911 } 919 }
912 return true; 920 return true;
913 } 921 }
914 922
915 923
916 void LoadIC::UpdateCaches(LookupIterator* lookup) { 924 void LoadIC::UpdateCaches(LookupIterator* lookup) {
917 if (state() == UNINITIALIZED) { 925 if (state() == UNINITIALIZED &&
926 (!FLAG_new_load_global_ic || kind() != Code::LOAD_GLOBAL_IC)) {
918 // This is the first time we execute this inline cache. Set the target to 927 // This is the first time we execute this inline cache. Set the target to
919 // the pre monomorphic stub to delay setting the monomorphic state. 928 // the pre monomorphic stub to delay setting the monomorphic state.
920 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); 929 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>());
921 TRACE_IC("LoadIC", lookup->name()); 930 TRACE_IC("LoadIC", lookup->name());
922 return; 931 return;
923 } 932 }
924 933
925 Handle<Code> code; 934 Handle<Code> code;
926 if (lookup->state() == LookupIterator::JSPROXY || 935 if (lookup->state() == LookupIterator::JSPROXY ||
927 lookup->state() == LookupIterator::ACCESS_CHECK) { 936 lookup->state() == LookupIterator::ACCESS_CHECK) {
928 code = slow_stub(); 937 code = slow_stub();
929 } else if (!lookup->IsFound()) { 938 } else if (!lookup->IsFound()) {
930 if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC) { 939 if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC) {
931 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), 940 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(),
932 receiver_map()); 941 receiver_map());
933 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. 942 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case.
934 if (code.is_null()) code = slow_stub(); 943 if (code.is_null()) code = slow_stub();
935 } else { 944 } else {
936 code = slow_stub(); 945 code = slow_stub();
937 } 946 }
938 } else { 947 } else {
939 if (lookup->state() == LookupIterator::ACCESSOR) { 948 if (FLAG_new_load_global_ic && kind() == Code::LOAD_GLOBAL_IC &&
949 lookup->state() == LookupIterator::DATA &&
950 lookup->GetHolder<Object>()->IsJSGlobalObject()) {
951 #if DEBUG
952 Handle<Object> holder = lookup->GetHolder<Object>();
953 Handle<Object> receiver = lookup->GetReceiver();
954 DCHECK_EQ(*receiver, *holder);
955 #endif
956 // Now update the cell in the feedback vector.
957 LoadGlobalICNexus* nexus = casted_nexus<LoadGlobalICNexus>();
958 nexus->ConfigurePropertyCellMode(lookup->GetPropertyCell());
959 TRACE_IC("LoadGlobalIC", lookup->name());
960 return;
961 } else if (lookup->state() == LookupIterator::ACCESSOR) {
940 if (!IsCompatibleReceiver(lookup, receiver_map())) { 962 if (!IsCompatibleReceiver(lookup, receiver_map())) {
941 TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type"); 963 TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type");
942 code = slow_stub(); 964 code = slow_stub();
943 } 965 }
944 } else if (lookup->state() == LookupIterator::INTERCEPTOR) { 966 } else if (lookup->state() == LookupIterator::INTERCEPTOR) {
945 // Perform a lookup behind the interceptor. Copy the LookupIterator since 967 // Perform a lookup behind the interceptor. Copy the LookupIterator since
946 // the original iterator will be used to fetch the value. 968 // the original iterator will be used to fetch the value.
947 LookupIterator it = *lookup; 969 LookupIterator it = *lookup;
948 it.Next(); 970 it.Next();
949 LookupForRead(&it); 971 LookupForRead(&it);
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 3025 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
3004 vector->GetKind(vector_slot)); 3026 vector->GetKind(vector_slot));
3005 KeyedLoadICNexus nexus(vector, vector_slot); 3027 KeyedLoadICNexus nexus(vector, vector_slot);
3006 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 3028 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
3007 ic.UpdateState(receiver, key); 3029 ic.UpdateState(receiver, key);
3008 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 3030 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
3009 } 3031 }
3010 } 3032 }
3011 } // namespace internal 3033 } // namespace internal
3012 } // namespace v8 3034 } // namespace v8
OLDNEW
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698