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

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

Issue 2446983002: [ic] Support negative lookup on receiver in data handlers. (Closed)
Patch Set: Addressing comments Created 4 years, 1 month 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/handler-configuration-inl.h ('k') | no next file » | 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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 LoadFieldStub stub(isolate(), index); 845 LoadFieldStub stub(isolate(), index);
846 return stub.GetCode(); 846 return stub.GetCode();
847 } 847 }
848 848
849 bool LoadIC::IsPrototypeValidityCellCheckEnough(Handle<Map> receiver_map, 849 bool LoadIC::IsPrototypeValidityCellCheckEnough(Handle<Map> receiver_map,
850 Handle<JSObject> holder) { 850 Handle<JSObject> holder) {
851 DCHECK(holder->HasFastProperties()); 851 DCHECK(holder->HasFastProperties());
852 852
853 // The following kinds of receiver maps require custom handler compilation. 853 // The following kinds of receiver maps require custom handler compilation.
854 if (receiver_map->IsPrimitiveMap() || receiver_map->IsJSGlobalProxyMap() || 854 if (receiver_map->IsPrimitiveMap() || receiver_map->IsJSGlobalProxyMap() ||
855 receiver_map->IsJSGlobalObjectMap() || 855 receiver_map->IsJSGlobalObjectMap()) {
856 receiver_map->is_dictionary_map()) {
857 return false; 856 return false;
858 } 857 }
859 858
860 // Switch to custom compiled handler if the prototype chain contains global 859 // Switch to custom compiled handler if the prototype chain contains global
861 // or dictionary objects. 860 // or dictionary objects.
862 for (PrototypeIterator iter(*receiver_map); !iter.IsAtEnd(); iter.Advance()) { 861 for (PrototypeIterator iter(*receiver_map); !iter.IsAtEnd(); iter.Advance()) {
863 JSObject* current = iter.GetCurrent<JSObject>(); 862 JSObject* current = iter.GetCurrent<JSObject>();
864 if (current == *holder) break; 863 if (current == *holder) break;
865 Map* current_map = current->map(); 864 Map* current_map = current->map();
866 if (current_map->IsJSGlobalObjectMap() || 865 if (current_map->IsJSGlobalObjectMap()) {
867 current_map->IsJSGlobalProxyMap() || current_map->is_dictionary_map()) { 866 return false;
867 } else if (current_map->is_dictionary_map()) {
868 DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast.
868 return false; 869 return false;
869 } 870 }
870 // Only objects that do not require access checks are allowed in stubs.
871 DCHECK(!current_map->is_access_check_needed());
872 } 871 }
873 return true; 872 return true;
874 } 873 }
875 874
876 Handle<Object> LoadIC::SimpleLoadFromPrototype(Handle<Map> receiver_map, 875 Handle<Object> LoadIC::SimpleLoadFromPrototype(Handle<Map> receiver_map,
877 Handle<JSObject> holder, 876 Handle<JSObject> holder,
878 Handle<Object> smi_handler) { 877 Handle<Object> smi_handler) {
879 DCHECK(IsPrototypeValidityCellCheckEnough(receiver_map, holder)); 878 DCHECK(IsPrototypeValidityCellCheckEnough(receiver_map, holder));
880 879
880 if (receiver_map->IsJSGlobalProxyMap() ||
881 receiver_map->IsJSGlobalObjectMap()) {
882 UNREACHABLE();
883 } else if (receiver_map->is_dictionary_map()) {
884 smi_handler =
885 LoadHandler::EnableNegativeLookupOnReceiver(isolate(), smi_handler);
886 }
887
881 Handle<Cell> validity_cell = 888 Handle<Cell> validity_cell =
882 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate()); 889 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
883 DCHECK(!validity_cell.is_null()); 890 DCHECK(!validity_cell.is_null());
884 891
885 Handle<WeakCell> holder_cell = 892 Handle<WeakCell> holder_cell =
886 Map::GetOrCreatePrototypeWeakCell(holder, isolate()); 893 Map::GetOrCreatePrototypeWeakCell(holder, isolate());
887 return isolate()->factory()->NewTuple3(validity_cell, holder_cell, 894 return isolate()->factory()->NewTuple3(validity_cell, holder_cell,
888 smi_handler); 895 smi_handler);
889 } 896 }
890 897
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3013 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3007 it.Next(); 3014 it.Next();
3008 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3015 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3009 Object::GetProperty(&it)); 3016 Object::GetProperty(&it));
3010 } 3017 }
3011 3018
3012 return *result; 3019 return *result;
3013 } 3020 }
3014 } // namespace internal 3021 } // namespace internal
3015 } // namespace v8 3022 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/handler-configuration-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698