| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 // Only clear CompareICs that can retain objects. | 584 // Only clear CompareICs that can retain objects. |
| 585 if (stub.state() != CompareICState::KNOWN_OBJECT) return; | 585 if (stub.state() != CompareICState::KNOWN_OBJECT) return; |
| 586 SetTargetAtAddress(address, | 586 SetTargetAtAddress(address, |
| 587 GetRawUninitialized(isolate, stub.op(), stub.strength()), | 587 GetRawUninitialized(isolate, stub.op(), stub.strength()), |
| 588 constant_pool); | 588 constant_pool); |
| 589 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); | 589 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); |
| 590 } | 590 } |
| 591 | 591 |
| 592 | 592 |
| 593 // static | 593 // static |
| 594 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate) { | 594 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate, |
| 595 ExtraICState extra_state) { |
| 595 if (FLAG_compiled_keyed_generic_loads) { | 596 if (FLAG_compiled_keyed_generic_loads) { |
| 596 return KeyedLoadGenericStub(isolate).GetCode(); | 597 return KeyedLoadGenericStub(isolate, LoadICState(extra_state)).GetCode(); |
| 597 } else { | 598 } else { |
| 598 return isolate->builtins()->KeyedLoadIC_Megamorphic(); | 599 return is_strong(LoadICState::GetLanguageMode(extra_state)) |
| 600 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() |
| 601 : isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| 599 } | 602 } |
| 600 } | 603 } |
| 601 | 604 |
| 602 | 605 |
| 603 static bool MigrateDeprecated(Handle<Object> object) { | 606 static bool MigrateDeprecated(Handle<Object> object) { |
| 604 if (!object->IsJSObject()) return false; | 607 if (!object->IsJSObject()) return false; |
| 605 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 608 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 606 if (!receiver->map()->is_deprecated()) return false; | 609 if (!receiver->map()->is_deprecated()) return false; |
| 607 JSObject::MigrateInstance(Handle<JSObject>::cast(object)); | 610 JSObject::MigrateInstance(Handle<JSObject>::cast(object)); |
| 608 return true; | 611 return true; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 // Rewrite to the generic keyed load stub. | 690 // Rewrite to the generic keyed load stub. |
| 688 if (FLAG_use_ic) { | 691 if (FLAG_use_ic) { |
| 689 DCHECK(UseVector()); | 692 DCHECK(UseVector()); |
| 690 ConfigureVectorState(MEGAMORPHIC); | 693 ConfigureVectorState(MEGAMORPHIC); |
| 691 TRACE_IC("LoadIC", name); | 694 TRACE_IC("LoadIC", name); |
| 692 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); | 695 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); |
| 693 } | 696 } |
| 694 Handle<Object> result; | 697 Handle<Object> result; |
| 695 ASSIGN_RETURN_ON_EXCEPTION( | 698 ASSIGN_RETURN_ON_EXCEPTION( |
| 696 isolate(), result, | 699 isolate(), result, |
| 697 Runtime::GetElementOrCharAt(isolate(), object, index), Object); | 700 Runtime::GetElementOrCharAt(isolate(), object, index, language_mode()), |
| 701 Object); |
| 698 return result; | 702 return result; |
| 699 } | 703 } |
| 700 | 704 |
| 701 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; | 705 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; |
| 702 | 706 |
| 703 if (object->IsGlobalObject() && name->IsString()) { | 707 if (object->IsGlobalObject() && name->IsString()) { |
| 704 // Look up in script context table. | 708 // Look up in script context table. |
| 705 Handle<String> str_name = Handle<String>::cast(name); | 709 Handle<String> str_name = Handle<String>::cast(name); |
| 706 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); | 710 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); |
| 707 Handle<ScriptContextTable> script_contexts( | 711 Handle<ScriptContextTable> script_contexts( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 730 // Named lookup in the object. | 734 // Named lookup in the object. |
| 731 LookupIterator it(object, name); | 735 LookupIterator it(object, name); |
| 732 LookupForRead(&it); | 736 LookupForRead(&it); |
| 733 | 737 |
| 734 if (it.IsFound() || !IsUndeclaredGlobal(object)) { | 738 if (it.IsFound() || !IsUndeclaredGlobal(object)) { |
| 735 // Update inline cache and stub cache. | 739 // Update inline cache and stub cache. |
| 736 if (use_ic) UpdateCaches(&it); | 740 if (use_ic) UpdateCaches(&it); |
| 737 | 741 |
| 738 // Get the property. | 742 // Get the property. |
| 739 Handle<Object> result; | 743 Handle<Object> result; |
| 740 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, Object::GetProperty(&it), | 744 |
| 741 Object); | 745 ASSIGN_RETURN_ON_EXCEPTION( |
| 746 isolate(), result, Object::GetProperty(&it, language_mode()), Object); |
| 742 if (it.IsFound()) { | 747 if (it.IsFound()) { |
| 743 return result; | 748 return result; |
| 744 } else if (!IsUndeclaredGlobal(object)) { | 749 } else if (!IsUndeclaredGlobal(object)) { |
| 745 LOG(isolate(), SuspectReadEvent(*name, *object)); | 750 LOG(isolate(), SuspectReadEvent(*name, *object)); |
| 746 return result; | 751 return result; |
| 747 } | 752 } |
| 748 } | 753 } |
| 749 return ReferenceError(name); | 754 return ReferenceError(name); |
| 750 } | 755 } |
| 751 | 756 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); | 928 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
| 924 } | 929 } |
| 925 | 930 |
| 926 | 931 |
| 927 Handle<Code> LoadIC::initialize_stub_in_optimized_code( | 932 Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
| 928 Isolate* isolate, ExtraICState extra_state, State initialization_state) { | 933 Isolate* isolate, ExtraICState extra_state, State initialization_state) { |
| 929 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); | 934 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); |
| 930 } | 935 } |
| 931 | 936 |
| 932 | 937 |
| 933 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { | 938 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate, |
| 934 return KeyedLoadICTrampolineStub(isolate).GetCode(); | 939 ExtraICState extra_state) { |
| 940 return KeyedLoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
| 935 } | 941 } |
| 936 | 942 |
| 937 | 943 |
| 938 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( | 944 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( |
| 939 Isolate* isolate, State initialization_state) { | 945 Isolate* isolate, State initialization_state, ExtraICState extra_state) { |
| 940 if (initialization_state != MEGAMORPHIC) { | 946 if (initialization_state != MEGAMORPHIC) { |
| 941 return KeyedLoadICStub(isolate).GetCode(); | 947 return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode(); |
| 942 } | 948 } |
| 943 switch (initialization_state) { | 949 return is_strong(LoadICState::GetLanguageMode(extra_state)) |
| 944 case UNINITIALIZED: | 950 ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() |
| 945 return isolate->builtins()->KeyedLoadIC_Initialize(); | 951 : isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| 946 case MEGAMORPHIC: | |
| 947 return isolate->builtins()->KeyedLoadIC_Megamorphic(); | |
| 948 default: | |
| 949 UNREACHABLE(); | |
| 950 } | |
| 951 return Handle<Code>(); | |
| 952 } | 952 } |
| 953 | 953 |
| 954 | 954 |
| 955 static Handle<Code> KeyedStoreICInitializeStubHelper( | 955 static Handle<Code> KeyedStoreICInitializeStubHelper( |
| 956 Isolate* isolate, LanguageMode language_mode, | 956 Isolate* isolate, LanguageMode language_mode, |
| 957 InlineCacheState initialization_state) { | 957 InlineCacheState initialization_state) { |
| 958 switch (initialization_state) { | 958 switch (initialization_state) { |
| 959 case UNINITIALIZED: | 959 case UNINITIALIZED: |
| 960 return is_strict(language_mode) | 960 return is_strict(language_mode) |
| 961 ? isolate->builtins()->KeyedStoreIC_Initialize_Strict() | 961 ? isolate->builtins()->KeyedStoreIC_Initialize_Strict() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 return stub.GetCode(); | 995 return stub.GetCode(); |
| 996 } | 996 } |
| 997 | 997 |
| 998 return KeyedStoreICInitializeStubHelper(isolate, language_mode, | 998 return KeyedStoreICInitializeStubHelper(isolate, language_mode, |
| 999 initialization_state); | 999 initialization_state); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 | 1002 |
| 1003 Handle<Code> LoadIC::megamorphic_stub() { | 1003 Handle<Code> LoadIC::megamorphic_stub() { |
| 1004 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); | 1004 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
| 1005 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); | 1005 return KeyedLoadIC::ChooseMegamorphicStub(isolate(), extra_ic_state()); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 | 1008 |
| 1009 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { | 1009 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { |
| 1010 LoadFieldStub stub(isolate(), index); | 1010 LoadFieldStub stub(isolate(), index); |
| 1011 return stub.GetCode(); | 1011 return stub.GetCode(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 | 1014 |
| 1015 void LoadIC::UpdateCaches(LookupIterator* lookup) { | 1015 void LoadIC::UpdateCaches(LookupIterator* lookup) { |
| 1016 if (state() == UNINITIALIZED) { | 1016 if (state() == UNINITIALIZED) { |
| 1017 // This is the first time we execute this inline cache. Set the target to | 1017 // This is the first time we execute this inline cache. Set the target to |
| 1018 // the pre monomorphic stub to delay setting the monomorphic state. | 1018 // the pre monomorphic stub to delay setting the monomorphic state. |
| 1019 ConfigureVectorState(PREMONOMORPHIC); | 1019 ConfigureVectorState(PREMONOMORPHIC); |
| 1020 TRACE_IC("LoadIC", lookup->name()); | 1020 TRACE_IC("LoadIC", lookup->name()); |
| 1021 return; | 1021 return; |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 Handle<Code> code; | 1024 Handle<Code> code; |
| 1025 if (lookup->state() == LookupIterator::JSPROXY || | 1025 if (lookup->state() == LookupIterator::JSPROXY || |
| 1026 lookup->state() == LookupIterator::ACCESS_CHECK) { | 1026 lookup->state() == LookupIterator::ACCESS_CHECK) { |
| 1027 code = slow_stub(); | 1027 code = slow_stub(); |
| 1028 } else if (!lookup->IsFound()) { | 1028 } else if (!lookup->IsFound()) { |
| 1029 if (kind() == Code::LOAD_IC) { | 1029 if (kind() == Code::LOAD_IC && !is_strong(language_mode())) { |
| 1030 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), | 1030 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), |
| 1031 receiver_map()); | 1031 receiver_map()); |
| 1032 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. | 1032 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. |
| 1033 if (code.is_null()) code = slow_stub(); | 1033 if (code.is_null()) code = slow_stub(); |
| 1034 } else { | 1034 } else { |
| 1035 code = slow_stub(); | 1035 code = slow_stub(); |
| 1036 } | 1036 } |
| 1037 } else { | 1037 } else { |
| 1038 code = ComputeHandler(lookup); | 1038 code = ComputeHandler(lookup); |
| 1039 } | 1039 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 Handle<Map> stub_holder_map = | 1212 Handle<Map> stub_holder_map = |
| 1213 GetHandlerCacheHolder(map, receiver_is_holder, isolate(), &flag); | 1213 GetHandlerCacheHolder(map, receiver_is_holder, isolate(), &flag); |
| 1214 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); | 1214 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); |
| 1215 return code; | 1215 return code; |
| 1216 } | 1216 } |
| 1217 // There is only one shared stub for loading normalized | 1217 // There is only one shared stub for loading normalized |
| 1218 // properties. It does not traverse the prototype chain, so the | 1218 // properties. It does not traverse the prototype chain, so the |
| 1219 // property must be found in the object for the stub to be | 1219 // property must be found in the object for the stub to be |
| 1220 // applicable. | 1220 // applicable. |
| 1221 if (!receiver_is_holder) break; | 1221 if (!receiver_is_holder) break; |
| 1222 return isolate()->builtins()->LoadIC_Normal(); | 1222 return is_strong(language_mode()) |
| 1223 ? isolate()->builtins()->LoadIC_Normal_Strong() |
| 1224 : isolate()->builtins()->LoadIC_Normal(); |
| 1223 } | 1225 } |
| 1224 | 1226 |
| 1225 // -------------- Fields -------------- | 1227 // -------------- Fields -------------- |
| 1226 if (lookup->property_details().type() == DATA) { | 1228 if (lookup->property_details().type() == DATA) { |
| 1227 FieldIndex field = lookup->GetFieldIndex(); | 1229 FieldIndex field = lookup->GetFieldIndex(); |
| 1228 if (receiver_is_holder) { | 1230 if (receiver_is_holder) { |
| 1229 return SimpleFieldLoad(field); | 1231 return SimpleFieldLoad(field); |
| 1230 } | 1232 } |
| 1231 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1233 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
| 1232 return compiler.CompileLoadField(lookup->name(), field); | 1234 return compiler.CompileLoadField(lookup->name(), field); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 | 1280 |
| 1279 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { | 1281 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| 1280 Handle<Code> null_handle; | 1282 Handle<Code> null_handle; |
| 1281 Handle<Map> receiver_map(receiver->map(), isolate()); | 1283 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 1282 MapHandleList target_receiver_maps; | 1284 MapHandleList target_receiver_maps; |
| 1283 TargetMaps(&target_receiver_maps); | 1285 TargetMaps(&target_receiver_maps); |
| 1284 | 1286 |
| 1285 | 1287 |
| 1286 if (target_receiver_maps.length() == 0) { | 1288 if (target_receiver_maps.length() == 0) { |
| 1287 Handle<Code> handler = | 1289 Handle<Code> handler = |
| 1288 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1290 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 1291 receiver_map, extra_ic_state()); |
| 1289 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1292 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| 1290 return null_handle; | 1293 return null_handle; |
| 1291 } | 1294 } |
| 1292 | 1295 |
| 1293 // The first time a receiver is seen that is a transitioned version of the | 1296 // The first time a receiver is seen that is a transitioned version of the |
| 1294 // previous monomorphic receiver type, assume the new ElementsKind is the | 1297 // previous monomorphic receiver type, assume the new ElementsKind is the |
| 1295 // monomorphic type. This benefits global arrays that only transition | 1298 // monomorphic type. This benefits global arrays that only transition |
| 1296 // once, and all call sites accessing them are faster if they remain | 1299 // once, and all call sites accessing them are faster if they remain |
| 1297 // monomorphic. If this optimistic assumption is not true, the IC will | 1300 // monomorphic. If this optimistic assumption is not true, the IC will |
| 1298 // miss again and it will become polymorphic and support both the | 1301 // miss again and it will become polymorphic and support both the |
| 1299 // untransitioned and transitioned maps. | 1302 // untransitioned and transitioned maps. |
| 1300 if (state() == MONOMORPHIC && !receiver->IsString() && | 1303 if (state() == MONOMORPHIC && !receiver->IsString() && |
| 1301 IsMoreGeneralElementsKindTransition( | 1304 IsMoreGeneralElementsKindTransition( |
| 1302 target_receiver_maps.at(0)->elements_kind(), | 1305 target_receiver_maps.at(0)->elements_kind(), |
| 1303 Handle<JSObject>::cast(receiver)->GetElementsKind())) { | 1306 Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
| 1304 Handle<Code> handler = | 1307 Handle<Code> handler = |
| 1305 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1308 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 1309 receiver_map, extra_ic_state()); |
| 1306 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1310 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| 1307 return null_handle; | 1311 return null_handle; |
| 1308 } | 1312 } |
| 1309 | 1313 |
| 1310 DCHECK(state() != GENERIC); | 1314 DCHECK(state() != GENERIC); |
| 1311 | 1315 |
| 1312 // Determine the list of receiver maps that this call site has seen, | 1316 // Determine the list of receiver maps that this call site has seen, |
| 1313 // adding the map that was just encountered. | 1317 // adding the map that was just encountered. |
| 1314 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { | 1318 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { |
| 1315 // If the miss wasn't due to an unseen map, a polymorphic stub | 1319 // If the miss wasn't due to an unseen map, a polymorphic stub |
| 1316 // won't help, use the generic stub. | 1320 // won't help, use the generic stub. |
| 1317 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); | 1321 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); |
| 1318 return megamorphic_stub(); | 1322 return megamorphic_stub(); |
| 1319 } | 1323 } |
| 1320 | 1324 |
| 1321 // If the maximum number of receiver maps has been exceeded, use the generic | 1325 // If the maximum number of receiver maps has been exceeded, use the generic |
| 1322 // version of the IC. | 1326 // version of the IC. |
| 1323 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { | 1327 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { |
| 1324 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); | 1328 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); |
| 1325 return megamorphic_stub(); | 1329 return megamorphic_stub(); |
| 1326 } | 1330 } |
| 1327 | 1331 |
| 1328 CodeHandleList handlers(target_receiver_maps.length()); | 1332 CodeHandleList handlers(target_receiver_maps.length()); |
| 1329 ElementHandlerCompiler compiler(isolate()); | 1333 ElementHandlerCompiler compiler(isolate()); |
| 1330 compiler.CompileElementHandlers(&target_receiver_maps, &handlers); | 1334 compiler.CompileElementHandlers(&target_receiver_maps, &handlers, |
| 1335 language_mode()); |
| 1331 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); | 1336 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); |
| 1332 return null_handle; | 1337 return null_handle; |
| 1333 } | 1338 } |
| 1334 | 1339 |
| 1335 | 1340 |
| 1336 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, | 1341 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
| 1337 Handle<Object> key) { | 1342 Handle<Object> key) { |
| 1338 if (MigrateDeprecated(object)) { | 1343 if (MigrateDeprecated(object)) { |
| 1339 Handle<Object> result; | 1344 Handle<Object> result; |
| 1340 ASSIGN_RETURN_ON_EXCEPTION( | 1345 ASSIGN_RETURN_ON_EXCEPTION( |
| 1341 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), | 1346 isolate(), result, |
| 1347 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), |
| 1342 Object); | 1348 Object); |
| 1343 return result; | 1349 return result; |
| 1344 } | 1350 } |
| 1345 | 1351 |
| 1346 Handle<Object> load_handle; | 1352 Handle<Object> load_handle; |
| 1347 Handle<Code> stub = megamorphic_stub(); | 1353 Handle<Code> stub = megamorphic_stub(); |
| 1348 | 1354 |
| 1349 // Check for non-string values that can be converted into an | 1355 // Check for non-string values that can be converted into an |
| 1350 // internalized string directly or is representable as a smi. | 1356 // internalized string directly or is representable as a smi. |
| 1351 key = TryConvertKey(key, isolate()); | 1357 key = TryConvertKey(key, isolate()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1368 Code* generic = *megamorphic_stub(); | 1374 Code* generic = *megamorphic_stub(); |
| 1369 if (!stub.is_null() && *stub == generic) { | 1375 if (!stub.is_null() && *stub == generic) { |
| 1370 ConfigureVectorState(MEGAMORPHIC); | 1376 ConfigureVectorState(MEGAMORPHIC); |
| 1371 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); | 1377 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); |
| 1372 } | 1378 } |
| 1373 | 1379 |
| 1374 TRACE_IC("LoadIC", key); | 1380 TRACE_IC("LoadIC", key); |
| 1375 } | 1381 } |
| 1376 | 1382 |
| 1377 if (!load_handle.is_null()) return load_handle; | 1383 if (!load_handle.is_null()) return load_handle; |
| 1384 |
| 1378 Handle<Object> result; | 1385 Handle<Object> result; |
| 1379 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, | 1386 ASSIGN_RETURN_ON_EXCEPTION( |
| 1380 Runtime::GetObjectProperty(isolate(), object, key), | 1387 isolate(), result, |
| 1381 Object); | 1388 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), |
| 1389 Object); |
| 1382 return result; | 1390 return result; |
| 1383 } | 1391 } |
| 1384 | 1392 |
| 1385 | 1393 |
| 1386 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, | 1394 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, |
| 1387 JSReceiver::StoreFromKeyed store_mode) { | 1395 JSReceiver::StoreFromKeyed store_mode) { |
| 1388 // Disable ICs for non-JSObjects for now. | 1396 // Disable ICs for non-JSObjects for now. |
| 1389 Handle<Object> receiver = it->GetReceiver(); | 1397 Handle<Object> receiver = it->GetReceiver(); |
| 1390 if (!receiver->IsJSObject()) return false; | 1398 if (!receiver->IsJSObject()) return false; |
| 1391 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); | 1399 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2959 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2967 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 2960 Handle<Name> name = | 2968 Handle<Name> name = |
| 2961 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2969 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
| 2962 Handle<JSObject> receiver = | 2970 Handle<JSObject> receiver = |
| 2963 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 2971 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
| 2964 Handle<JSObject> holder = | 2972 Handle<JSObject> holder = |
| 2965 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 2973 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
| 2966 | 2974 |
| 2967 Handle<Object> result; | 2975 Handle<Object> result; |
| 2968 LookupIterator it(receiver, name, holder); | 2976 LookupIterator it(receiver, name, holder); |
| 2977 // TODO(conradw): Investigate strong mode semantics for this. |
| 2969 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2978 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 2970 JSObject::GetProperty(&it)); | 2979 JSObject::GetProperty(&it)); |
| 2971 | 2980 |
| 2972 if (it.IsFound()) return *result; | 2981 if (it.IsFound()) return *result; |
| 2973 | 2982 |
| 2974 return ThrowReferenceError(isolate, Name::cast(args[0])); | 2983 return ThrowReferenceError(isolate, Name::cast(args[0])); |
| 2975 } | 2984 } |
| 2976 | 2985 |
| 2977 | 2986 |
| 2978 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { | 2987 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3004 } | 3013 } |
| 3005 | 3014 |
| 3006 | 3015 |
| 3007 RUNTIME_FUNCTION(LoadElementWithInterceptor) { | 3016 RUNTIME_FUNCTION(LoadElementWithInterceptor) { |
| 3008 // TODO(verwaest): This should probably get the holder and receiver as input. | 3017 // TODO(verwaest): This should probably get the holder and receiver as input. |
| 3009 HandleScope scope(isolate); | 3018 HandleScope scope(isolate); |
| 3010 Handle<JSObject> receiver = args.at<JSObject>(0); | 3019 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 3011 DCHECK(args.smi_at(1) >= 0); | 3020 DCHECK(args.smi_at(1) >= 0); |
| 3012 uint32_t index = args.smi_at(1); | 3021 uint32_t index = args.smi_at(1); |
| 3013 Handle<Object> result; | 3022 Handle<Object> result; |
| 3023 // TODO(conradw): Investigate strong mode semantics for this. |
| 3024 LanguageMode language_mode = SLOPPY; |
| 3014 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 3025 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 3015 isolate, result, Object::GetElement(isolate, receiver, index)); | 3026 isolate, result, |
| 3027 Object::GetElement(isolate, receiver, index, language_mode)); |
| 3016 return *result; | 3028 return *result; |
| 3017 } | 3029 } |
| 3018 | 3030 |
| 3019 | 3031 |
| 3020 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { | 3032 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { |
| 3021 TimerEventScope<TimerEventIcMiss> timer(isolate); | 3033 TimerEventScope<TimerEventIcMiss> timer(isolate); |
| 3022 HandleScope scope(isolate); | 3034 HandleScope scope(isolate); |
| 3023 Handle<Object> receiver = args.at<Object>(0); | 3035 Handle<Object> receiver = args.at<Object>(0); |
| 3024 Handle<Name> key = args.at<Name>(1); | 3036 Handle<Name> key = args.at<Name>(1); |
| 3025 Handle<Object> result; | 3037 Handle<Object> result; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3051 static const Address IC_utilities[] = { | 3063 static const Address IC_utilities[] = { |
| 3052 #define ADDR(name) FUNCTION_ADDR(name), | 3064 #define ADDR(name) FUNCTION_ADDR(name), |
| 3053 IC_UTIL_LIST(ADDR) NULL | 3065 IC_UTIL_LIST(ADDR) NULL |
| 3054 #undef ADDR | 3066 #undef ADDR |
| 3055 }; | 3067 }; |
| 3056 | 3068 |
| 3057 | 3069 |
| 3058 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3070 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 3059 } // namespace internal | 3071 } // namespace internal |
| 3060 } // namespace v8 | 3072 } // namespace v8 |
| OLD | NEW |