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

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

Issue 2455953002: [ic] Remove unnecessary access rights checks from the IC handlers. (Closed)
Patch Set: Addressing comments and rebasing 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/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 namespace { 849 namespace {
850 850
851 template <bool fill_array> 851 template <bool fill_array>
852 int InitPrototypeChecks(Isolate* isolate, Handle<Map> receiver_map, 852 int InitPrototypeChecks(Isolate* isolate, Handle<Map> receiver_map,
853 Handle<JSObject> holder, Handle<FixedArray> array, 853 Handle<JSObject> holder, Handle<FixedArray> array,
854 Handle<Name> name) { 854 Handle<Name> name) {
855 DCHECK(holder->HasFastProperties()); 855 DCHECK(holder->HasFastProperties());
856 856
857 // The following kinds of receiver maps require custom handler compilation. 857 // The following kinds of receiver maps require custom handler compilation.
858 if (receiver_map->IsPrimitiveMap() || receiver_map->IsJSGlobalProxyMap() || 858 if (receiver_map->IsPrimitiveMap() || receiver_map->IsJSGlobalObjectMap()) {
859 receiver_map->IsJSGlobalObjectMap()) {
860 return -1; 859 return -1;
861 } 860 }
861 // We don't encode the requirement to check access rights because we already
862 // passed the access check for current native context and the access
863 // can't be revoked.
862 864
863 HandleScope scope(isolate); 865 HandleScope scope(isolate);
864 int checks_count = 0; 866 int checks_count = 0;
865 867
866 // Switch to custom compiled handler if the prototype chain contains global 868 // Switch to custom compiled handler if the prototype chain contains global
867 // or dictionary objects. 869 // or dictionary objects.
868 for (PrototypeIterator iter(receiver_map); !iter.IsAtEnd(); iter.Advance()) { 870 for (PrototypeIterator iter(receiver_map); !iter.IsAtEnd(); iter.Advance()) {
869 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); 871 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter);
870 if (*current == *holder) break; 872 if (*current == *holder) break;
871 Handle<Map> current_map(current->map(), isolate); 873 Handle<Map> current_map(current->map(), isolate);
872 874
873 // Only global objects and objects that do not require access
874 // checks are allowed in stubs.
875 DCHECK(current_map->IsJSGlobalProxyMap() ||
876 !current_map->is_access_check_needed());
877
878 if (current_map->IsJSGlobalObjectMap()) { 875 if (current_map->IsJSGlobalObjectMap()) {
879 if (fill_array) { 876 if (fill_array) {
880 Handle<JSGlobalObject> global = Handle<JSGlobalObject>::cast(current); 877 Handle<JSGlobalObject> global = Handle<JSGlobalObject>::cast(current);
881 Handle<PropertyCell> cell = JSGlobalObject::EnsureEmptyPropertyCell( 878 Handle<PropertyCell> cell = JSGlobalObject::EnsureEmptyPropertyCell(
882 global, name, PropertyCellType::kInvalidated); 879 global, name, PropertyCellType::kInvalidated);
883 DCHECK(cell->value()->IsTheHole(isolate)); 880 DCHECK(cell->value()->IsTheHole(isolate));
884 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell); 881 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell);
885 array->set(LoadHandler::kFirstPrototypeIndex + checks_count, 882 array->set(LoadHandler::kFirstPrototypeIndex + checks_count,
886 *weak_cell); 883 *weak_cell);
887 } 884 }
(...skipping 23 matching lines...) Expand all
911 Handle<FixedArray>(), Handle<Name>()); 908 Handle<FixedArray>(), Handle<Name>());
912 } 909 }
913 910
914 Handle<Object> LoadIC::SimpleLoadFromPrototype(Handle<Map> receiver_map, 911 Handle<Object> LoadIC::SimpleLoadFromPrototype(Handle<Map> receiver_map,
915 Handle<JSObject> holder, 912 Handle<JSObject> holder,
916 Handle<Name> name, 913 Handle<Name> name,
917 Handle<Object> smi_handler) { 914 Handle<Object> smi_handler) {
918 int checks_count = GetPrototypeCheckCount(receiver_map, holder); 915 int checks_count = GetPrototypeCheckCount(receiver_map, holder);
919 DCHECK_LE(0, checks_count); 916 DCHECK_LE(0, checks_count);
920 917
921 if (receiver_map->IsJSGlobalProxyMap() || 918 if (receiver_map->IsJSGlobalObjectMap()) {
922 receiver_map->IsJSGlobalObjectMap()) {
923 UNREACHABLE(); 919 UNREACHABLE();
924 } else if (receiver_map->is_dictionary_map()) { 920 } else if (receiver_map->is_dictionary_map()) {
925 smi_handler = 921 smi_handler =
926 LoadHandler::EnableNegativeLookupOnReceiver(isolate(), smi_handler); 922 LoadHandler::EnableNegativeLookupOnReceiver(isolate(), smi_handler);
927 } 923 }
928 924
929 Handle<Cell> validity_cell = 925 Handle<Cell> validity_cell =
930 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate()); 926 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
931 DCHECK(!validity_cell.is_null()); 927 DCHECK(!validity_cell.is_null());
932 928
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3062 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3067 it.Next(); 3063 it.Next();
3068 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3064 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3069 Object::GetProperty(&it)); 3065 Object::GetProperty(&it));
3070 } 3066 }
3071 3067
3072 return *result; 3068 return *result;
3073 } 3069 }
3074 } // namespace internal 3070 } // namespace internal
3075 } // namespace v8 3071 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698