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

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

Issue 1189153002: Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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) {
576 if (FLAG_compiled_keyed_generic_loads) { 575 if (FLAG_compiled_keyed_generic_loads) {
577 return KeyedLoadGenericStub(isolate, LoadICState(extra_state)).GetCode(); 576 return KeyedLoadGenericStub(isolate).GetCode();
578 } else { 577 } else {
579 return is_strong(LoadICState::GetLanguageMode(extra_state)) 578 return isolate->builtins()->KeyedLoadIC_Megamorphic();
580 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong()
581 : isolate->builtins()->KeyedLoadIC_Megamorphic();
582 } 579 }
583 } 580 }
584 581
585 582
586 static bool MigrateDeprecated(Handle<Object> object) { 583 static bool MigrateDeprecated(Handle<Object> object) {
587 if (!object->IsJSObject()) return false; 584 if (!object->IsJSObject()) return false;
588 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 585 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
589 if (!receiver->map()->is_deprecated()) return false; 586 if (!receiver->map()->is_deprecated()) return false;
590 JSObject::MigrateInstance(Handle<JSObject>::cast(object)); 587 JSObject::MigrateInstance(Handle<JSObject>::cast(object));
591 return true; 588 return true;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 ConfigureVectorState(MEGAMORPHIC); 672 ConfigureVectorState(MEGAMORPHIC);
676 } else { 673 } else {
677 set_target(*megamorphic_stub()); 674 set_target(*megamorphic_stub());
678 } 675 }
679 TRACE_IC("LoadIC", name); 676 TRACE_IC("LoadIC", name);
680 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); 677 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index");
681 } 678 }
682 Handle<Object> result; 679 Handle<Object> result;
683 ASSIGN_RETURN_ON_EXCEPTION( 680 ASSIGN_RETURN_ON_EXCEPTION(
684 isolate(), result, 681 isolate(), result,
685 Runtime::GetElementOrCharAt(isolate(), object, index, language_mode()), 682 Runtime::GetElementOrCharAt(isolate(), object, index), Object);
686 Object);
687 return result; 683 return result;
688 } 684 }
689 685
690 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; 686 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;
691 687
692 if (object->IsGlobalObject() && name->IsString()) { 688 if (object->IsGlobalObject() && name->IsString()) {
693 // Look up in script context table. 689 // Look up in script context table.
694 Handle<String> str_name = Handle<String>::cast(name); 690 Handle<String> str_name = Handle<String>::cast(name);
695 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); 691 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
696 Handle<ScriptContextTable> script_contexts( 692 Handle<ScriptContextTable> script_contexts(
(...skipping 22 matching lines...) Expand all
719 // Named lookup in the object. 715 // Named lookup in the object.
720 LookupIterator it(object, name); 716 LookupIterator it(object, name);
721 LookupForRead(&it); 717 LookupForRead(&it);
722 718
723 if (it.IsFound() || !IsUndeclaredGlobal(object)) { 719 if (it.IsFound() || !IsUndeclaredGlobal(object)) {
724 // Update inline cache and stub cache. 720 // Update inline cache and stub cache.
725 if (use_ic) UpdateCaches(&it); 721 if (use_ic) UpdateCaches(&it);
726 722
727 // Get the property. 723 // Get the property.
728 Handle<Object> result; 724 Handle<Object> result;
729 725 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, Object::GetProperty(&it),
730 ASSIGN_RETURN_ON_EXCEPTION( 726 Object);
731 isolate(), result, Object::GetProperty(&it, language_mode()), Object);
732 if (it.IsFound()) { 727 if (it.IsFound()) {
733 return result; 728 return result;
734 } else if (!IsUndeclaredGlobal(object)) { 729 } else if (!IsUndeclaredGlobal(object)) {
735 LOG(isolate(), SuspectReadEvent(*name, *object)); 730 LOG(isolate(), SuspectReadEvent(*name, *object));
736 return result; 731 return result;
737 } 732 }
738 } 733 }
739 return ReferenceError(name); 734 return ReferenceError(name);
740 } 735 }
741 736
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); 908 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
914 } 909 }
915 910
916 911
917 Handle<Code> LoadIC::initialize_stub_in_optimized_code( 912 Handle<Code> LoadIC::initialize_stub_in_optimized_code(
918 Isolate* isolate, ExtraICState extra_state, State initialization_state) { 913 Isolate* isolate, ExtraICState extra_state, State initialization_state) {
919 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); 914 return LoadICStub(isolate, LoadICState(extra_state)).GetCode();
920 } 915 }
921 916
922 917
923 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate, 918 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) {
924 ExtraICState extra_state) { 919 return KeyedLoadICTrampolineStub(isolate).GetCode();
925 return KeyedLoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode();
926 } 920 }
927 921
928 922
929 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( 923 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(
930 Isolate* isolate, State initialization_state, ExtraICState extra_state) { 924 Isolate* isolate, State initialization_state) {
931 if (initialization_state != MEGAMORPHIC) { 925 if (initialization_state != MEGAMORPHIC) {
932 return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode(); 926 return KeyedLoadICStub(isolate).GetCode();
933 } 927 }
934 return is_strong(LoadICState::GetLanguageMode(extra_state)) 928 switch (initialization_state) {
935 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() 929 case UNINITIALIZED:
936 : isolate->builtins()->KeyedLoadIC_Megamorphic(); 930 return isolate->builtins()->KeyedLoadIC_Initialize();
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(), extra_ic_state()); 965 return KeyedLoadIC::ChooseMegamorphicStub(isolate());
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 && !is_strong(language_mode())) { 989 if (kind() == Code::LOAD_IC) {
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( 1248 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map);
1249 receiver_map, extra_ic_state());
1250 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); 1249 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler);
1251 return null_handle; 1250 return null_handle;
1252 } 1251 }
1253 1252
1254 // The first time a receiver is seen that is a transitioned version of the 1253 // The first time a receiver is seen that is a transitioned version of the
1255 // previous monomorphic receiver type, assume the new ElementsKind is the 1254 // previous monomorphic receiver type, assume the new ElementsKind is the
1256 // monomorphic type. This benefits global arrays that only transition 1255 // monomorphic type. This benefits global arrays that only transition
1257 // once, and all call sites accessing them are faster if they remain 1256 // once, and all call sites accessing them are faster if they remain
1258 // monomorphic. If this optimistic assumption is not true, the IC will 1257 // monomorphic. If this optimistic assumption is not true, the IC will
1259 // miss again and it will become polymorphic and support both the 1258 // miss again and it will become polymorphic and support both the
1260 // untransitioned and transitioned maps. 1259 // untransitioned and transitioned maps.
1261 if (state() == MONOMORPHIC && !receiver->IsString() && 1260 if (state() == MONOMORPHIC && !receiver->IsString() &&
1262 IsMoreGeneralElementsKindTransition( 1261 IsMoreGeneralElementsKindTransition(
1263 target_receiver_maps.at(0)->elements_kind(), 1262 target_receiver_maps.at(0)->elements_kind(),
1264 Handle<JSObject>::cast(receiver)->GetElementsKind())) { 1263 Handle<JSObject>::cast(receiver)->GetElementsKind())) {
1265 Handle<Code> handler = 1264 Handle<Code> handler =
1266 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( 1265 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map);
1267 receiver_map, extra_ic_state());
1268 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); 1266 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler);
1269 return null_handle; 1267 return null_handle;
1270 } 1268 }
1271 1269
1272 DCHECK(state() != GENERIC); 1270 DCHECK(state() != GENERIC);
1273 1271
1274 // Determine the list of receiver maps that this call site has seen, 1272 // Determine the list of receiver maps that this call site has seen,
1275 // adding the map that was just encountered. 1273 // adding the map that was just encountered.
1276 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { 1274 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) {
1277 // If the miss wasn't due to an unseen map, a polymorphic stub 1275 // If the miss wasn't due to an unseen map, a polymorphic stub
1278 // won't help, use the generic stub. 1276 // won't help, use the generic stub.
1279 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); 1277 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice");
1280 return megamorphic_stub(); 1278 return megamorphic_stub();
1281 } 1279 }
1282 1280
1283 // If the maximum number of receiver maps has been exceeded, use the generic 1281 // If the maximum number of receiver maps has been exceeded, use the generic
1284 // version of the IC. 1282 // version of the IC.
1285 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { 1283 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) {
1286 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); 1284 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded");
1287 return megamorphic_stub(); 1285 return megamorphic_stub();
1288 } 1286 }
1289 1287
1290 CodeHandleList handlers(target_receiver_maps.length()); 1288 CodeHandleList handlers(target_receiver_maps.length());
1291 ElementHandlerCompiler compiler(isolate()); 1289 ElementHandlerCompiler compiler(isolate());
1292 compiler.CompileElementHandlers(&target_receiver_maps, &handlers, 1290 compiler.CompileElementHandlers(&target_receiver_maps, &handlers);
1293 language_mode());
1294 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); 1291 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers);
1295 return null_handle; 1292 return null_handle;
1296 } 1293 }
1297 1294
1298 1295
1299 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, 1296 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
1300 Handle<Object> key) { 1297 Handle<Object> key) {
1301 if (MigrateDeprecated(object)) { 1298 if (MigrateDeprecated(object)) {
1302 Handle<Object> result; 1299 Handle<Object> result;
1303 ASSIGN_RETURN_ON_EXCEPTION( 1300 ASSIGN_RETURN_ON_EXCEPTION(
1304 isolate(), result, 1301 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key),
1305 Runtime::GetObjectProperty(isolate(), object, key, language_mode()),
1306 Object); 1302 Object);
1307 return result; 1303 return result;
1308 } 1304 }
1309 1305
1310 Handle<Object> load_handle; 1306 Handle<Object> load_handle;
1311 Handle<Code> stub = megamorphic_stub(); 1307 Handle<Code> stub = megamorphic_stub();
1312 1308
1313 // Check for non-string values that can be converted into an 1309 // Check for non-string values that can be converted into an
1314 // internalized string directly or is representable as a smi. 1310 // internalized string directly or is representable as a smi.
1315 key = TryConvertKey(key, isolate()); 1311 key = TryConvertKey(key, isolate());
(...skipping 27 matching lines...) Expand all
1343 if (!stub.is_null() && *stub == generic) { 1339 if (!stub.is_null() && *stub == generic) {
1344 ConfigureVectorState(MEGAMORPHIC); 1340 ConfigureVectorState(MEGAMORPHIC);
1345 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); 1341 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic");
1346 } 1342 }
1347 1343
1348 TRACE_IC("LoadIC", key); 1344 TRACE_IC("LoadIC", key);
1349 } 1345 }
1350 } 1346 }
1351 1347
1352 if (!load_handle.is_null()) return load_handle; 1348 if (!load_handle.is_null()) return load_handle;
1353
1354 Handle<Object> result; 1349 Handle<Object> result;
1355 ASSIGN_RETURN_ON_EXCEPTION( 1350 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result,
1356 isolate(), result, 1351 Runtime::GetObjectProperty(isolate(), object, key),
1357 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), 1352 Object);
1358 Object);
1359 return result; 1353 return result;
1360 } 1354 }
1361 1355
1362 1356
1363 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, 1357 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
1364 JSReceiver::StoreFromKeyed store_mode) { 1358 JSReceiver::StoreFromKeyed store_mode) {
1365 // Disable ICs for non-JSObjects for now. 1359 // Disable ICs for non-JSObjects for now.
1366 Handle<Object> receiver = it->GetReceiver(); 1360 Handle<Object> receiver = it->GetReceiver();
1367 if (!receiver->IsJSObject()) return false; 1361 if (!receiver->IsJSObject()) return false;
1368 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); 1362 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated());
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 2805 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
2812 Handle<Name> name = 2806 Handle<Name> name =
2813 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 2807 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
2814 Handle<JSObject> receiver = 2808 Handle<JSObject> receiver =
2815 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 2809 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
2816 Handle<JSObject> holder = 2810 Handle<JSObject> holder =
2817 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 2811 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
2818 2812
2819 Handle<Object> result; 2813 Handle<Object> result;
2820 LookupIterator it(receiver, name, holder); 2814 LookupIterator it(receiver, name, holder);
2821 // TODO(conradw): Investigate strong mode semantics for this.
2822 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2815 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
2823 JSObject::GetProperty(&it)); 2816 JSObject::GetProperty(&it));
2824 2817
2825 if (it.IsFound()) return *result; 2818 if (it.IsFound()) return *result;
2826 2819
2827 return ThrowReferenceError(isolate, Name::cast(args[0])); 2820 return ThrowReferenceError(isolate, Name::cast(args[0]));
2828 } 2821 }
2829 2822
2830 2823
2831 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { 2824 RUNTIME_FUNCTION(StorePropertyWithInterceptor) {
(...skipping 25 matching lines...) Expand all
2857 } 2850 }
2858 2851
2859 2852
2860 RUNTIME_FUNCTION(LoadElementWithInterceptor) { 2853 RUNTIME_FUNCTION(LoadElementWithInterceptor) {
2861 // TODO(verwaest): This should probably get the holder and receiver as input. 2854 // TODO(verwaest): This should probably get the holder and receiver as input.
2862 HandleScope scope(isolate); 2855 HandleScope scope(isolate);
2863 Handle<JSObject> receiver = args.at<JSObject>(0); 2856 Handle<JSObject> receiver = args.at<JSObject>(0);
2864 DCHECK(args.smi_at(1) >= 0); 2857 DCHECK(args.smi_at(1) >= 0);
2865 uint32_t index = args.smi_at(1); 2858 uint32_t index = args.smi_at(1);
2866 Handle<Object> result; 2859 Handle<Object> result;
2867 // TODO(conradw): Investigate strong mode semantics for this.
2868 LanguageMode language_mode = SLOPPY;
2869 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2860 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2870 isolate, result, 2861 isolate, result, Object::GetElement(isolate, receiver, index));
2871 Object::GetElement(isolate, receiver, index, language_mode));
2872 return *result; 2862 return *result;
2873 } 2863 }
2874 2864
2875 2865
2876 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { 2866 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) {
2877 TimerEventScope<TimerEventIcMiss> timer(isolate); 2867 TimerEventScope<TimerEventIcMiss> timer(isolate);
2878 HandleScope scope(isolate); 2868 HandleScope scope(isolate);
2879 Handle<Object> receiver = args.at<Object>(0); 2869 Handle<Object> receiver = args.at<Object>(0);
2880 Handle<Name> key = args.at<Name>(1); 2870 Handle<Name> key = args.at<Name>(1);
2881 Handle<Object> result; 2871 Handle<Object> result;
(...skipping 15 matching lines...) Expand all
2897 KeyedLoadICNexus nexus(vector, vector_slot); 2887 KeyedLoadICNexus nexus(vector, vector_slot);
2898 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2888 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2899 ic.UpdateState(receiver, key); 2889 ic.UpdateState(receiver, key);
2900 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2890 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
2901 } 2891 }
2902 2892
2903 return *result; 2893 return *result;
2904 } 2894 }
2905 2895
2906 2896
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
2937 static const Address IC_utilities[] = { 2897 static const Address IC_utilities[] = {
2938 #define ADDR(name) FUNCTION_ADDR(name), 2898 #define ADDR(name) FUNCTION_ADDR(name),
2939 IC_UTIL_LIST(ADDR) NULL 2899 IC_UTIL_LIST(ADDR) NULL
2940 #undef ADDR 2900 #undef ADDR
2941 }; 2901 };
2942 2902
2943 2903
2944 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2904 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2945 } 2905 } // namespace internal
2946 } // namespace v8::internal 2906 } // namespace v8
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