OLD | NEW |
---|---|
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 Loading... | |
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::GetStrength(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 Loading... | |
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, strength()), |
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 Loading... | |
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(isolate(), result, |
731 Object::GetProperty(&it, strength()), 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 Loading... | |
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 } |
934 bool strong = is_strong(LoadICState::GetStrength(extra_state)); | |
928 switch (initialization_state) { | 935 switch (initialization_state) { |
929 case UNINITIALIZED: | 936 case UNINITIALIZED: |
930 return isolate->builtins()->KeyedLoadIC_Initialize(); | 937 return strong ? isolate->builtins()->KeyedLoadIC_Initialize_Strong() |
mvstanton
2015/06/09 12:46:44
I think this shows some unfinished clean-up work n
conradw
2015/06/09 13:09:27
Done.
| |
938 : isolate->builtins()->KeyedLoadIC_Initialize(); | |
931 case MEGAMORPHIC: | 939 case MEGAMORPHIC: |
932 return isolate->builtins()->KeyedLoadIC_Megamorphic(); | 940 return strong ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() |
941 : isolate->builtins()->KeyedLoadIC_Megamorphic(); | |
933 default: | 942 default: |
934 UNREACHABLE(); | 943 UNREACHABLE(); |
935 } | 944 } |
936 return Handle<Code>(); | 945 return Handle<Code>(); |
937 } | 946 } |
938 | 947 |
939 | 948 |
940 Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, | 949 Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, |
941 LanguageMode language_mode, | 950 LanguageMode language_mode, |
942 State initialization_state) { | 951 State initialization_state) { |
(...skipping 12 matching lines...) Expand all Loading... | |
955 : isolate->builtins()->KeyedStoreIC_Megamorphic(); | 964 : isolate->builtins()->KeyedStoreIC_Megamorphic(); |
956 default: | 965 default: |
957 UNREACHABLE(); | 966 UNREACHABLE(); |
958 } | 967 } |
959 return Handle<Code>(); | 968 return Handle<Code>(); |
960 } | 969 } |
961 | 970 |
962 | 971 |
963 Handle<Code> LoadIC::megamorphic_stub() { | 972 Handle<Code> LoadIC::megamorphic_stub() { |
964 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); | 973 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
965 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); | 974 return KeyedLoadIC::ChooseMegamorphicStub(isolate(), extra_ic_state()); |
966 } | 975 } |
967 | 976 |
968 | 977 |
969 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { | 978 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { |
970 LoadFieldStub stub(isolate(), index); | 979 LoadFieldStub stub(isolate(), index); |
971 return stub.GetCode(); | 980 return stub.GetCode(); |
972 } | 981 } |
973 | 982 |
974 | 983 |
975 void LoadIC::UpdateCaches(LookupIterator* lookup) { | 984 void LoadIC::UpdateCaches(LookupIterator* lookup) { |
976 if (state() == UNINITIALIZED) { | 985 if (state() == UNINITIALIZED) { |
977 // This is the first time we execute this inline cache. Set the target to | 986 // 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. | 987 // the pre monomorphic stub to delay setting the monomorphic state. |
979 ConfigureVectorState(PREMONOMORPHIC); | 988 ConfigureVectorState(PREMONOMORPHIC); |
980 TRACE_IC("LoadIC", lookup->name()); | 989 TRACE_IC("LoadIC", lookup->name()); |
981 return; | 990 return; |
982 } | 991 } |
983 | 992 |
984 Handle<Code> code; | 993 Handle<Code> code; |
985 if (lookup->state() == LookupIterator::JSPROXY || | 994 if (lookup->state() == LookupIterator::JSPROXY || |
986 lookup->state() == LookupIterator::ACCESS_CHECK) { | 995 lookup->state() == LookupIterator::ACCESS_CHECK) { |
987 code = slow_stub(); | 996 code = slow_stub(); |
988 } else if (!lookup->IsFound()) { | 997 } else if (!lookup->IsFound()) { |
989 if (kind() == Code::LOAD_IC) { | 998 if (kind() == Code::LOAD_IC && !is_strong(strength())) { |
990 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), | 999 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), |
991 receiver_map()); | 1000 receiver_map()); |
992 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. | 1001 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. |
993 if (code.is_null()) code = slow_stub(); | 1002 if (code.is_null()) code = slow_stub(); |
994 } else { | 1003 } else { |
995 code = slow_stub(); | 1004 code = slow_stub(); |
996 } | 1005 } |
997 } else { | 1006 } else { |
998 code = ComputeHandler(lookup); | 1007 code = ComputeHandler(lookup); |
999 } | 1008 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 | 1247 |
1239 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { | 1248 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
1240 Handle<Code> null_handle; | 1249 Handle<Code> null_handle; |
1241 Handle<Map> receiver_map(receiver->map(), isolate()); | 1250 Handle<Map> receiver_map(receiver->map(), isolate()); |
1242 MapHandleList target_receiver_maps; | 1251 MapHandleList target_receiver_maps; |
1243 TargetMaps(&target_receiver_maps); | 1252 TargetMaps(&target_receiver_maps); |
1244 | 1253 |
1245 | 1254 |
1246 if (target_receiver_maps.length() == 0) { | 1255 if (target_receiver_maps.length() == 0) { |
1247 Handle<Code> handler = | 1256 Handle<Code> handler = |
1248 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1257 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
1258 receiver_map, extra_ic_state()); | |
1249 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1259 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
1250 return null_handle; | 1260 return null_handle; |
1251 } | 1261 } |
1252 | 1262 |
1253 // The first time a receiver is seen that is a transitioned version of the | 1263 // 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 | 1264 // previous monomorphic receiver type, assume the new ElementsKind is the |
1255 // monomorphic type. This benefits global arrays that only transition | 1265 // monomorphic type. This benefits global arrays that only transition |
1256 // once, and all call sites accessing them are faster if they remain | 1266 // once, and all call sites accessing them are faster if they remain |
1257 // monomorphic. If this optimistic assumption is not true, the IC will | 1267 // monomorphic. If this optimistic assumption is not true, the IC will |
1258 // miss again and it will become polymorphic and support both the | 1268 // miss again and it will become polymorphic and support both the |
1259 // untransitioned and transitioned maps. | 1269 // untransitioned and transitioned maps. |
1260 if (state() == MONOMORPHIC && !receiver->IsString() && | 1270 if (state() == MONOMORPHIC && !receiver->IsString() && |
1261 IsMoreGeneralElementsKindTransition( | 1271 IsMoreGeneralElementsKindTransition( |
1262 target_receiver_maps.at(0)->elements_kind(), | 1272 target_receiver_maps.at(0)->elements_kind(), |
1263 Handle<JSObject>::cast(receiver)->GetElementsKind())) { | 1273 Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
1264 Handle<Code> handler = | 1274 Handle<Code> handler = |
1265 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1275 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
1276 receiver_map, extra_ic_state()); | |
1266 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1277 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
1267 return null_handle; | 1278 return null_handle; |
1268 } | 1279 } |
1269 | 1280 |
1270 DCHECK(state() != GENERIC); | 1281 DCHECK(state() != GENERIC); |
1271 | 1282 |
1272 // Determine the list of receiver maps that this call site has seen, | 1283 // Determine the list of receiver maps that this call site has seen, |
1273 // adding the map that was just encountered. | 1284 // adding the map that was just encountered. |
1274 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { | 1285 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { |
1275 // If the miss wasn't due to an unseen map, a polymorphic stub | 1286 // If the miss wasn't due to an unseen map, a polymorphic stub |
1276 // won't help, use the generic stub. | 1287 // won't help, use the generic stub. |
1277 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); | 1288 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); |
1278 return megamorphic_stub(); | 1289 return megamorphic_stub(); |
1279 } | 1290 } |
1280 | 1291 |
1281 // If the maximum number of receiver maps has been exceeded, use the generic | 1292 // If the maximum number of receiver maps has been exceeded, use the generic |
1282 // version of the IC. | 1293 // version of the IC. |
1283 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { | 1294 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { |
1284 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); | 1295 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); |
1285 return megamorphic_stub(); | 1296 return megamorphic_stub(); |
1286 } | 1297 } |
1287 | 1298 |
1288 CodeHandleList handlers(target_receiver_maps.length()); | 1299 CodeHandleList handlers(target_receiver_maps.length()); |
1289 ElementHandlerCompiler compiler(isolate()); | 1300 ElementHandlerCompiler compiler(isolate()); |
1290 compiler.CompileElementHandlers(&target_receiver_maps, &handlers); | 1301 compiler.CompileElementHandlers(&target_receiver_maps, &handlers, strength()); |
1291 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); | 1302 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); |
1292 return null_handle; | 1303 return null_handle; |
1293 } | 1304 } |
1294 | 1305 |
1295 | 1306 |
1296 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, | 1307 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
1297 Handle<Object> key) { | 1308 Handle<Object> key) { |
1298 if (MigrateDeprecated(object)) { | 1309 if (MigrateDeprecated(object)) { |
1299 Handle<Object> result; | 1310 Handle<Object> result; |
1300 ASSIGN_RETURN_ON_EXCEPTION( | 1311 ASSIGN_RETURN_ON_EXCEPTION( |
1301 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), | 1312 isolate(), result, |
1302 Object); | 1313 Runtime::GetObjectProperty(isolate(), object, key, strength()), Object); |
1303 return result; | 1314 return result; |
1304 } | 1315 } |
1305 | 1316 |
1306 Handle<Object> load_handle; | 1317 Handle<Object> load_handle; |
1307 Handle<Code> stub = megamorphic_stub(); | 1318 Handle<Code> stub = megamorphic_stub(); |
1308 | 1319 |
1309 // Check for non-string values that can be converted into an | 1320 // Check for non-string values that can be converted into an |
1310 // internalized string directly or is representable as a smi. | 1321 // internalized string directly or is representable as a smi. |
1311 key = TryConvertKey(key, isolate()); | 1322 key = TryConvertKey(key, isolate()); |
1312 | 1323 |
(...skipping 26 matching lines...) Expand all Loading... | |
1339 if (!stub.is_null() && *stub == generic) { | 1350 if (!stub.is_null() && *stub == generic) { |
1340 ConfigureVectorState(MEGAMORPHIC); | 1351 ConfigureVectorState(MEGAMORPHIC); |
1341 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); | 1352 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); |
1342 } | 1353 } |
1343 | 1354 |
1344 TRACE_IC("LoadIC", key); | 1355 TRACE_IC("LoadIC", key); |
1345 } | 1356 } |
1346 } | 1357 } |
1347 | 1358 |
1348 if (!load_handle.is_null()) return load_handle; | 1359 if (!load_handle.is_null()) return load_handle; |
1360 | |
1349 Handle<Object> result; | 1361 Handle<Object> result; |
1350 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, | 1362 ASSIGN_RETURN_ON_EXCEPTION( |
1351 Runtime::GetObjectProperty(isolate(), object, key), | 1363 isolate(), result, |
1352 Object); | 1364 Runtime::GetObjectProperty(isolate(), object, key, strength()), Object); |
1353 return result; | 1365 return result; |
1354 } | 1366 } |
1355 | 1367 |
1356 | 1368 |
1357 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, | 1369 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, |
1358 JSReceiver::StoreFromKeyed store_mode) { | 1370 JSReceiver::StoreFromKeyed store_mode) { |
1359 // Disable ICs for non-JSObjects for now. | 1371 // Disable ICs for non-JSObjects for now. |
1360 Handle<Object> receiver = it->GetReceiver(); | 1372 Handle<Object> receiver = it->GetReceiver(); |
1361 if (!receiver->IsJSObject()) return false; | 1373 if (!receiver->IsJSObject()) return false; |
1362 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); | 1374 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2805 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2817 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
2806 Handle<Name> name = | 2818 Handle<Name> name = |
2807 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2819 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
2808 Handle<JSObject> receiver = | 2820 Handle<JSObject> receiver = |
2809 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 2821 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
2810 Handle<JSObject> holder = | 2822 Handle<JSObject> holder = |
2811 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 2823 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
2812 | 2824 |
2813 Handle<Object> result; | 2825 Handle<Object> result; |
2814 LookupIterator it(receiver, name, holder); | 2826 LookupIterator it(receiver, name, holder); |
2827 // TODO(conradw): Investigate strong mode semantics for this. | |
2815 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2828 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2816 JSObject::GetProperty(&it)); | 2829 JSObject::GetProperty(&it)); |
2817 | 2830 |
2818 if (it.IsFound()) return *result; | 2831 if (it.IsFound()) return *result; |
2819 | 2832 |
2820 return ThrowReferenceError(isolate, Name::cast(args[0])); | 2833 return ThrowReferenceError(isolate, Name::cast(args[0])); |
2821 } | 2834 } |
2822 | 2835 |
2823 | 2836 |
2824 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { | 2837 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { |
(...skipping 25 matching lines...) Expand all Loading... | |
2850 } | 2863 } |
2851 | 2864 |
2852 | 2865 |
2853 RUNTIME_FUNCTION(LoadElementWithInterceptor) { | 2866 RUNTIME_FUNCTION(LoadElementWithInterceptor) { |
2854 // TODO(verwaest): This should probably get the holder and receiver as input. | 2867 // TODO(verwaest): This should probably get the holder and receiver as input. |
2855 HandleScope scope(isolate); | 2868 HandleScope scope(isolate); |
2856 Handle<JSObject> receiver = args.at<JSObject>(0); | 2869 Handle<JSObject> receiver = args.at<JSObject>(0); |
2857 DCHECK(args.smi_at(1) >= 0); | 2870 DCHECK(args.smi_at(1) >= 0); |
2858 uint32_t index = args.smi_at(1); | 2871 uint32_t index = args.smi_at(1); |
2859 Handle<Object> result; | 2872 Handle<Object> result; |
2873 // TODO(conradw): Investigate strong mode semantics for this. | |
2874 Strength strength = Strength::WEAK; | |
2860 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2875 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2861 isolate, result, Object::GetElement(isolate, receiver, index)); | 2876 isolate, result, Object::GetElement(isolate, receiver, index, strength)); |
2862 return *result; | 2877 return *result; |
2863 } | 2878 } |
2864 | 2879 |
2865 | 2880 |
2866 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { | 2881 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { |
2867 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2882 TimerEventScope<TimerEventIcMiss> timer(isolate); |
2868 HandleScope scope(isolate); | 2883 HandleScope scope(isolate); |
2869 Handle<Object> receiver = args.at<Object>(0); | 2884 Handle<Object> receiver = args.at<Object>(0); |
2870 Handle<Name> key = args.at<Name>(1); | 2885 Handle<Name> key = args.at<Name>(1); |
2871 Handle<Object> result; | 2886 Handle<Object> result; |
(...skipping 15 matching lines...) Expand all Loading... | |
2887 KeyedLoadICNexus nexus(vector, vector_slot); | 2902 KeyedLoadICNexus nexus(vector, vector_slot); |
2888 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2903 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2889 ic.UpdateState(receiver, key); | 2904 ic.UpdateState(receiver, key); |
2890 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2905 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2891 } | 2906 } |
2892 | 2907 |
2893 return *result; | 2908 return *result; |
2894 } | 2909 } |
2895 | 2910 |
2896 | 2911 |
2912 RUNTIME_FUNCTION(LoadIC_Slow) { | |
2913 HandleScope scope(isolate); | |
2914 DCHECK(args.length() == 2); | |
2915 | |
2916 Handle<Object> receiver = args.at<Object>(0); | |
2917 Handle<Name> name = args.at<Name>(1); | |
2918 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); | |
2919 Handle<Object> result; | |
2920 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
2921 isolate, result, | |
2922 Runtime::GetObjectProperty(isolate, receiver, name, ic.strength())); | |
2923 return *result; | |
2924 } | |
2925 | |
2926 | |
2927 RUNTIME_FUNCTION(KeyedLoadIC_Slow) { | |
2928 HandleScope scope(isolate); | |
2929 DCHECK(args.length() == 2); | |
2930 | |
2931 Handle<Object> receiver = args.at<Object>(0); | |
2932 Handle<Object> key = args.at<Object>(1); | |
2933 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); | |
2934 Handle<Object> result; | |
2935 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
2936 isolate, result, | |
2937 Runtime::KeyedGetObjectProperty(isolate, receiver, key, ic.strength())); | |
2938 return *result; | |
2939 } | |
2940 | |
2941 | |
2897 static const Address IC_utilities[] = { | 2942 static const Address IC_utilities[] = { |
2898 #define ADDR(name) FUNCTION_ADDR(name), | 2943 #define ADDR(name) FUNCTION_ADDR(name), |
2899 IC_UTIL_LIST(ADDR) NULL | 2944 IC_UTIL_LIST(ADDR) NULL |
2900 #undef ADDR | 2945 #undef ADDR |
2901 }; | 2946 }; |
2902 | 2947 |
2903 | 2948 |
2904 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2949 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
2905 } // namespace internal | 2950 } |
2906 } // namespace v8 | 2951 } // namespace v8::internal |
OLD | NEW |