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

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

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 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/ic-compiler.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/v8.h" 5 #include "src/v8.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/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // Only clear CompareICs that can retain objects. 564 // Only clear CompareICs that can retain objects.
565 if (stub.state() != CompareICState::KNOWN_OBJECT) return; 565 if (stub.state() != CompareICState::KNOWN_OBJECT) return;
566 SetTargetAtAddress(address, 566 SetTargetAtAddress(address,
567 GetRawUninitialized(isolate, stub.op(), stub.strength()), 567 GetRawUninitialized(isolate, stub.op(), stub.strength()),
568 constant_pool); 568 constant_pool);
569 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); 569 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
570 } 570 }
571 571
572 572
573 // static 573 // static
574 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate) { 574 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate,
575 ExtraICState extra_state) {
575 if (FLAG_compiled_keyed_generic_loads) { 576 if (FLAG_compiled_keyed_generic_loads) {
576 return KeyedLoadGenericStub(isolate).GetCode(); 577 return KeyedLoadGenericStub(isolate, LoadICState(extra_state)).GetCode();
577 } else { 578 } else {
578 return isolate->builtins()->KeyedLoadIC_Megamorphic(); 579 return is_strong(LoadICState::GetLanguageMode(extra_state))
580 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong()
581 : isolate->builtins()->KeyedLoadIC_Megamorphic();
579 } 582 }
580 } 583 }
581 584
582 585
583 static bool MigrateDeprecated(Handle<Object> object) { 586 static bool MigrateDeprecated(Handle<Object> object) {
584 if (!object->IsJSObject()) return false; 587 if (!object->IsJSObject()) return false;
585 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 588 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
586 if (!receiver->map()->is_deprecated()) return false; 589 if (!receiver->map()->is_deprecated()) return false;
587 JSObject::MigrateInstance(Handle<JSObject>::cast(object)); 590 JSObject::MigrateInstance(Handle<JSObject>::cast(object));
588 return true; 591 return true;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 ConfigureVectorState(MEGAMORPHIC); 675 ConfigureVectorState(MEGAMORPHIC);
673 } else { 676 } else {
674 set_target(*megamorphic_stub()); 677 set_target(*megamorphic_stub());
675 } 678 }
676 TRACE_IC("LoadIC", name); 679 TRACE_IC("LoadIC", name);
677 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); 680 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index");
678 } 681 }
679 Handle<Object> result; 682 Handle<Object> result;
680 ASSIGN_RETURN_ON_EXCEPTION( 683 ASSIGN_RETURN_ON_EXCEPTION(
681 isolate(), result, 684 isolate(), result,
682 Runtime::GetElementOrCharAt(isolate(), object, index), Object); 685 Runtime::GetElementOrCharAt(isolate(), object, index, language_mode()),
686 Object);
683 return result; 687 return result;
684 } 688 }
685 689
686 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; 690 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;
687 691
688 if (object->IsGlobalObject() && name->IsString()) { 692 if (object->IsGlobalObject() && name->IsString()) {
689 // Look up in script context table. 693 // Look up in script context table.
690 Handle<String> str_name = Handle<String>::cast(name); 694 Handle<String> str_name = Handle<String>::cast(name);
691 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); 695 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
692 Handle<ScriptContextTable> script_contexts( 696 Handle<ScriptContextTable> script_contexts(
(...skipping 22 matching lines...) Expand all
715 // Named lookup in the object. 719 // Named lookup in the object.
716 LookupIterator it(object, name); 720 LookupIterator it(object, name);
717 LookupForRead(&it); 721 LookupForRead(&it);
718 722
719 if (it.IsFound() || !IsUndeclaredGlobal(object)) { 723 if (it.IsFound() || !IsUndeclaredGlobal(object)) {
720 // Update inline cache and stub cache. 724 // Update inline cache and stub cache.
721 if (use_ic) UpdateCaches(&it); 725 if (use_ic) UpdateCaches(&it);
722 726
723 // Get the property. 727 // Get the property.
724 Handle<Object> result; 728 Handle<Object> result;
725 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, Object::GetProperty(&it), 729
726 Object); 730 ASSIGN_RETURN_ON_EXCEPTION(
731 isolate(), result, Object::GetProperty(&it, language_mode()), Object);
727 if (it.IsFound()) { 732 if (it.IsFound()) {
728 return result; 733 return result;
729 } else if (!IsUndeclaredGlobal(object)) { 734 } else if (!IsUndeclaredGlobal(object)) {
730 LOG(isolate(), SuspectReadEvent(*name, *object)); 735 LOG(isolate(), SuspectReadEvent(*name, *object));
731 return result; 736 return result;
732 } 737 }
733 } 738 }
734 return ReferenceError(name); 739 return ReferenceError(name);
735 } 740 }
736 741
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); 913 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
909 } 914 }
910 915
911 916
912 Handle<Code> LoadIC::initialize_stub_in_optimized_code( 917 Handle<Code> LoadIC::initialize_stub_in_optimized_code(
913 Isolate* isolate, ExtraICState extra_state, State initialization_state) { 918 Isolate* isolate, ExtraICState extra_state, State initialization_state) {
914 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); 919 return LoadICStub(isolate, LoadICState(extra_state)).GetCode();
915 } 920 }
916 921
917 922
918 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { 923 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate,
919 return KeyedLoadICTrampolineStub(isolate).GetCode(); 924 ExtraICState extra_state) {
925 return KeyedLoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
920 } 926 }
921 927
922 928
923 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( 929 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(
924 Isolate* isolate, State initialization_state) { 930 Isolate* isolate, State initialization_state, ExtraICState extra_state) {
925 if (initialization_state != MEGAMORPHIC) { 931 if (initialization_state != MEGAMORPHIC) {
926 return KeyedLoadICStub(isolate).GetCode(); 932 return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode();
927 } 933 }
928 switch (initialization_state) { 934 return is_strong(LoadICState::GetLanguageMode(extra_state))
929 case UNINITIALIZED: 935 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong()
930 return isolate->builtins()->KeyedLoadIC_Initialize(); 936 : isolate->builtins()->KeyedLoadIC_Megamorphic();
931 case MEGAMORPHIC:
932 return isolate->builtins()->KeyedLoadIC_Megamorphic();
933 default:
934 UNREACHABLE();
935 }
936 return Handle<Code>();
937 } 937 }
938 938
939 939
940 Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, 940 Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate,
941 LanguageMode language_mode, 941 LanguageMode language_mode,
942 State initialization_state) { 942 State initialization_state) {
943 switch (initialization_state) { 943 switch (initialization_state) {
944 case UNINITIALIZED: 944 case UNINITIALIZED:
945 return is_strict(language_mode) 945 return is_strict(language_mode)
946 ? isolate->builtins()->KeyedStoreIC_Initialize_Strict() 946 ? isolate->builtins()->KeyedStoreIC_Initialize_Strict()
947 : isolate->builtins()->KeyedStoreIC_Initialize(); 947 : isolate->builtins()->KeyedStoreIC_Initialize();
948 case PREMONOMORPHIC: 948 case PREMONOMORPHIC:
949 return is_strict(language_mode) 949 return is_strict(language_mode)
950 ? isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict() 950 ? isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict()
951 : isolate->builtins()->KeyedStoreIC_PreMonomorphic(); 951 : isolate->builtins()->KeyedStoreIC_PreMonomorphic();
952 case MEGAMORPHIC: 952 case MEGAMORPHIC:
953 return is_strict(language_mode) 953 return is_strict(language_mode)
954 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict() 954 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
955 : isolate->builtins()->KeyedStoreIC_Megamorphic(); 955 : isolate->builtins()->KeyedStoreIC_Megamorphic();
956 default: 956 default:
957 UNREACHABLE(); 957 UNREACHABLE();
958 } 958 }
959 return Handle<Code>(); 959 return Handle<Code>();
960 } 960 }
961 961
962 962
963 Handle<Code> LoadIC::megamorphic_stub() { 963 Handle<Code> LoadIC::megamorphic_stub() {
964 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); 964 DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
965 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); 965 return KeyedLoadIC::ChooseMegamorphicStub(isolate(), extra_ic_state());
966 } 966 }
967 967
968 968
969 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { 969 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) {
970 LoadFieldStub stub(isolate(), index); 970 LoadFieldStub stub(isolate(), index);
971 return stub.GetCode(); 971 return stub.GetCode();
972 } 972 }
973 973
974 974
975 void LoadIC::UpdateCaches(LookupIterator* lookup) { 975 void LoadIC::UpdateCaches(LookupIterator* lookup) {
976 if (state() == UNINITIALIZED) { 976 if (state() == UNINITIALIZED) {
977 // This is the first time we execute this inline cache. Set the target to 977 // This is the first time we execute this inline cache. Set the target to
978 // the pre monomorphic stub to delay setting the monomorphic state. 978 // the pre monomorphic stub to delay setting the monomorphic state.
979 ConfigureVectorState(PREMONOMORPHIC); 979 ConfigureVectorState(PREMONOMORPHIC);
980 TRACE_IC("LoadIC", lookup->name()); 980 TRACE_IC("LoadIC", lookup->name());
981 return; 981 return;
982 } 982 }
983 983
984 Handle<Code> code; 984 Handle<Code> code;
985 if (lookup->state() == LookupIterator::JSPROXY || 985 if (lookup->state() == LookupIterator::JSPROXY ||
986 lookup->state() == LookupIterator::ACCESS_CHECK) { 986 lookup->state() == LookupIterator::ACCESS_CHECK) {
987 code = slow_stub(); 987 code = slow_stub();
988 } else if (!lookup->IsFound()) { 988 } else if (!lookup->IsFound()) {
989 if (kind() == Code::LOAD_IC) { 989 if (kind() == Code::LOAD_IC && !is_strong(language_mode())) {
990 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), 990 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(),
991 receiver_map()); 991 receiver_map());
992 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. 992 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case.
993 if (code.is_null()) code = slow_stub(); 993 if (code.is_null()) code = slow_stub();
994 } else { 994 } else {
995 code = slow_stub(); 995 code = slow_stub();
996 } 996 }
997 } else { 997 } else {
998 code = ComputeHandler(lookup); 998 code = ComputeHandler(lookup);
999 } 999 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 1238
1239 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { 1239 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) {
1240 Handle<Code> null_handle; 1240 Handle<Code> null_handle;
1241 Handle<Map> receiver_map(receiver->map(), isolate()); 1241 Handle<Map> receiver_map(receiver->map(), isolate());
1242 MapHandleList target_receiver_maps; 1242 MapHandleList target_receiver_maps;
1243 TargetMaps(&target_receiver_maps); 1243 TargetMaps(&target_receiver_maps);
1244 1244
1245 1245
1246 if (target_receiver_maps.length() == 0) { 1246 if (target_receiver_maps.length() == 0) {
1247 Handle<Code> handler = 1247 Handle<Code> handler =
1248 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); 1248 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(
1249 receiver_map, extra_ic_state());
1249 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); 1250 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler);
1250 return null_handle; 1251 return null_handle;
1251 } 1252 }
1252 1253
1253 // The first time a receiver is seen that is a transitioned version of the 1254 // The first time a receiver is seen that is a transitioned version of the
1254 // previous monomorphic receiver type, assume the new ElementsKind is the 1255 // previous monomorphic receiver type, assume the new ElementsKind is the
1255 // monomorphic type. This benefits global arrays that only transition 1256 // monomorphic type. This benefits global arrays that only transition
1256 // once, and all call sites accessing them are faster if they remain 1257 // once, and all call sites accessing them are faster if they remain
1257 // monomorphic. If this optimistic assumption is not true, the IC will 1258 // monomorphic. If this optimistic assumption is not true, the IC will
1258 // miss again and it will become polymorphic and support both the 1259 // miss again and it will become polymorphic and support both the
1259 // untransitioned and transitioned maps. 1260 // untransitioned and transitioned maps.
1260 if (state() == MONOMORPHIC && !receiver->IsString() && 1261 if (state() == MONOMORPHIC && !receiver->IsString() &&
1261 IsMoreGeneralElementsKindTransition( 1262 IsMoreGeneralElementsKindTransition(
1262 target_receiver_maps.at(0)->elements_kind(), 1263 target_receiver_maps.at(0)->elements_kind(),
1263 Handle<JSObject>::cast(receiver)->GetElementsKind())) { 1264 Handle<JSObject>::cast(receiver)->GetElementsKind())) {
1264 Handle<Code> handler = 1265 Handle<Code> handler =
1265 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); 1266 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(
1267 receiver_map, extra_ic_state());
1266 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); 1268 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler);
1267 return null_handle; 1269 return null_handle;
1268 } 1270 }
1269 1271
1270 DCHECK(state() != GENERIC); 1272 DCHECK(state() != GENERIC);
1271 1273
1272 // Determine the list of receiver maps that this call site has seen, 1274 // Determine the list of receiver maps that this call site has seen,
1273 // adding the map that was just encountered. 1275 // adding the map that was just encountered.
1274 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { 1276 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) {
1275 // If the miss wasn't due to an unseen map, a polymorphic stub 1277 // If the miss wasn't due to an unseen map, a polymorphic stub
1276 // won't help, use the generic stub. 1278 // won't help, use the generic stub.
1277 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); 1279 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice");
1278 return megamorphic_stub(); 1280 return megamorphic_stub();
1279 } 1281 }
1280 1282
1281 // If the maximum number of receiver maps has been exceeded, use the generic 1283 // If the maximum number of receiver maps has been exceeded, use the generic
1282 // version of the IC. 1284 // version of the IC.
1283 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { 1285 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) {
1284 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); 1286 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded");
1285 return megamorphic_stub(); 1287 return megamorphic_stub();
1286 } 1288 }
1287 1289
1288 CodeHandleList handlers(target_receiver_maps.length()); 1290 CodeHandleList handlers(target_receiver_maps.length());
1289 ElementHandlerCompiler compiler(isolate()); 1291 ElementHandlerCompiler compiler(isolate());
1290 compiler.CompileElementHandlers(&target_receiver_maps, &handlers); 1292 compiler.CompileElementHandlers(&target_receiver_maps, &handlers,
1293 language_mode());
1291 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); 1294 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers);
1292 return null_handle; 1295 return null_handle;
1293 } 1296 }
1294 1297
1295 1298
1296 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, 1299 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
1297 Handle<Object> key) { 1300 Handle<Object> key) {
1298 if (MigrateDeprecated(object)) { 1301 if (MigrateDeprecated(object)) {
1299 Handle<Object> result; 1302 Handle<Object> result;
1300 ASSIGN_RETURN_ON_EXCEPTION( 1303 ASSIGN_RETURN_ON_EXCEPTION(
1301 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), 1304 isolate(), result,
1305 Runtime::GetObjectProperty(isolate(), object, key, language_mode()),
1302 Object); 1306 Object);
1303 return result; 1307 return result;
1304 } 1308 }
1305 1309
1306 Handle<Object> load_handle; 1310 Handle<Object> load_handle;
1307 Handle<Code> stub = megamorphic_stub(); 1311 Handle<Code> stub = megamorphic_stub();
1308 1312
1309 // Check for non-string values that can be converted into an 1313 // Check for non-string values that can be converted into an
1310 // internalized string directly or is representable as a smi. 1314 // internalized string directly or is representable as a smi.
1311 key = TryConvertKey(key, isolate()); 1315 key = TryConvertKey(key, isolate());
(...skipping 27 matching lines...) Expand all
1339 if (!stub.is_null() && *stub == generic) { 1343 if (!stub.is_null() && *stub == generic) {
1340 ConfigureVectorState(MEGAMORPHIC); 1344 ConfigureVectorState(MEGAMORPHIC);
1341 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); 1345 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic");
1342 } 1346 }
1343 1347
1344 TRACE_IC("LoadIC", key); 1348 TRACE_IC("LoadIC", key);
1345 } 1349 }
1346 } 1350 }
1347 1351
1348 if (!load_handle.is_null()) return load_handle; 1352 if (!load_handle.is_null()) return load_handle;
1353
1349 Handle<Object> result; 1354 Handle<Object> result;
1350 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, 1355 ASSIGN_RETURN_ON_EXCEPTION(
1351 Runtime::GetObjectProperty(isolate(), object, key), 1356 isolate(), result,
1352 Object); 1357 Runtime::GetObjectProperty(isolate(), object, key, language_mode()),
1358 Object);
1353 return result; 1359 return result;
1354 } 1360 }
1355 1361
1356 1362
1357 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, 1363 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
1358 JSReceiver::StoreFromKeyed store_mode) { 1364 JSReceiver::StoreFromKeyed store_mode) {
1359 // Disable ICs for non-JSObjects for now. 1365 // Disable ICs for non-JSObjects for now.
1360 Handle<Object> receiver = it->GetReceiver(); 1366 Handle<Object> receiver = it->GetReceiver();
1361 if (!receiver->IsJSObject()) return false; 1367 if (!receiver->IsJSObject()) return false;
1362 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); 1368 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated());
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 2811 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
2806 Handle<Name> name = 2812 Handle<Name> name =
2807 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 2813 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
2808 Handle<JSObject> receiver = 2814 Handle<JSObject> receiver =
2809 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 2815 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
2810 Handle<JSObject> holder = 2816 Handle<JSObject> holder =
2811 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 2817 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
2812 2818
2813 Handle<Object> result; 2819 Handle<Object> result;
2814 LookupIterator it(receiver, name, holder); 2820 LookupIterator it(receiver, name, holder);
2821 // TODO(conradw): Investigate strong mode semantics for this.
2815 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2822 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
2816 JSObject::GetProperty(&it)); 2823 JSObject::GetProperty(&it));
2817 2824
2818 if (it.IsFound()) return *result; 2825 if (it.IsFound()) return *result;
2819 2826
2820 return ThrowReferenceError(isolate, Name::cast(args[0])); 2827 return ThrowReferenceError(isolate, Name::cast(args[0]));
2821 } 2828 }
2822 2829
2823 2830
2824 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { 2831 RUNTIME_FUNCTION(StorePropertyWithInterceptor) {
(...skipping 25 matching lines...) Expand all
2850 } 2857 }
2851 2858
2852 2859
2853 RUNTIME_FUNCTION(LoadElementWithInterceptor) { 2860 RUNTIME_FUNCTION(LoadElementWithInterceptor) {
2854 // TODO(verwaest): This should probably get the holder and receiver as input. 2861 // TODO(verwaest): This should probably get the holder and receiver as input.
2855 HandleScope scope(isolate); 2862 HandleScope scope(isolate);
2856 Handle<JSObject> receiver = args.at<JSObject>(0); 2863 Handle<JSObject> receiver = args.at<JSObject>(0);
2857 DCHECK(args.smi_at(1) >= 0); 2864 DCHECK(args.smi_at(1) >= 0);
2858 uint32_t index = args.smi_at(1); 2865 uint32_t index = args.smi_at(1);
2859 Handle<Object> result; 2866 Handle<Object> result;
2867 // TODO(conradw): Investigate strong mode semantics for this.
2868 LanguageMode language_mode = SLOPPY;
2860 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2869 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2861 isolate, result, Object::GetElement(isolate, receiver, index)); 2870 isolate, result,
2871 Object::GetElement(isolate, receiver, index, language_mode));
2862 return *result; 2872 return *result;
2863 } 2873 }
2864 2874
2865 2875
2866 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { 2876 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) {
2867 TimerEventScope<TimerEventIcMiss> timer(isolate); 2877 TimerEventScope<TimerEventIcMiss> timer(isolate);
2868 HandleScope scope(isolate); 2878 HandleScope scope(isolate);
2869 Handle<Object> receiver = args.at<Object>(0); 2879 Handle<Object> receiver = args.at<Object>(0);
2870 Handle<Name> key = args.at<Name>(1); 2880 Handle<Name> key = args.at<Name>(1);
2871 Handle<Object> result; 2881 Handle<Object> result;
(...skipping 15 matching lines...) Expand all
2887 KeyedLoadICNexus nexus(vector, vector_slot); 2897 KeyedLoadICNexus nexus(vector, vector_slot);
2888 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2898 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2889 ic.UpdateState(receiver, key); 2899 ic.UpdateState(receiver, key);
2890 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2900 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
2891 } 2901 }
2892 2902
2893 return *result; 2903 return *result;
2894 } 2904 }
2895 2905
2896 2906
2907 RUNTIME_FUNCTION(LoadIC_Slow) {
2908 HandleScope scope(isolate);
2909 DCHECK(args.length() == 2);
2910
2911 Handle<Object> receiver = args.at<Object>(0);
2912 Handle<Name> name = args.at<Name>(1);
2913 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
2914 Handle<Object> result;
2915 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2916 isolate, result,
2917 Runtime::GetObjectProperty(isolate, receiver, name, ic.language_mode()));
2918 return *result;
2919 }
2920
2921
2922 RUNTIME_FUNCTION(KeyedLoadIC_Slow) {
2923 HandleScope scope(isolate);
2924 DCHECK(args.length() == 2);
2925
2926 Handle<Object> receiver = args.at<Object>(0);
2927 Handle<Object> key = args.at<Object>(1);
2928 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
2929 Handle<Object> result;
2930 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2931 isolate, result, Runtime::KeyedGetObjectProperty(isolate, receiver, key,
2932 ic.language_mode()));
2933 return *result;
2934 }
2935
2936
2897 static const Address IC_utilities[] = { 2937 static const Address IC_utilities[] = {
2898 #define ADDR(name) FUNCTION_ADDR(name), 2938 #define ADDR(name) FUNCTION_ADDR(name),
2899 IC_UTIL_LIST(ADDR) NULL 2939 IC_UTIL_LIST(ADDR) NULL
2900 #undef ADDR 2940 #undef ADDR
2901 }; 2941 };
2902 2942
2903 2943
2904 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2944 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2905 } // namespace internal 2945 }
2906 } // namespace v8 2946 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698