Chromium Code Reviews| 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::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 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, 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 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( |
| 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 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 } |
| 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 static Handle<Code> KeyedStoreICInitializeStubHelper( | 940 static Handle<Code> KeyedStoreICInitializeStubHelper( |
| 941 Isolate* isolate, LanguageMode language_mode, | 941 Isolate* isolate, LanguageMode language_mode, |
| 942 InlineCacheState initialization_state) { | 942 InlineCacheState 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() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 980 return stub.GetCode(); | 980 return stub.GetCode(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 return KeyedStoreICInitializeStubHelper(isolate, language_mode, | 983 return KeyedStoreICInitializeStubHelper(isolate, language_mode, |
| 984 initialization_state); | 984 initialization_state); |
| 985 } | 985 } |
| 986 | 986 |
| 987 | 987 |
| 988 Handle<Code> LoadIC::megamorphic_stub() { | 988 Handle<Code> LoadIC::megamorphic_stub() { |
| 989 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); | 989 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
| 990 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); | 990 return KeyedLoadIC::ChooseMegamorphicStub(isolate(), extra_ic_state()); |
| 991 } | 991 } |
| 992 | 992 |
| 993 | 993 |
| 994 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { | 994 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { |
| 995 LoadFieldStub stub(isolate(), index); | 995 LoadFieldStub stub(isolate(), index); |
| 996 return stub.GetCode(); | 996 return stub.GetCode(); |
| 997 } | 997 } |
| 998 | 998 |
| 999 | 999 |
| 1000 void LoadIC::UpdateCaches(LookupIterator* lookup) { | 1000 void LoadIC::UpdateCaches(LookupIterator* lookup) { |
| 1001 if (state() == UNINITIALIZED) { | 1001 if (state() == UNINITIALIZED) { |
| 1002 // This is the first time we execute this inline cache. Set the target to | 1002 // This is the first time we execute this inline cache. Set the target to |
| 1003 // the pre monomorphic stub to delay setting the monomorphic state. | 1003 // the pre monomorphic stub to delay setting the monomorphic state. |
| 1004 ConfigureVectorState(PREMONOMORPHIC); | 1004 ConfigureVectorState(PREMONOMORPHIC); |
| 1005 TRACE_IC("LoadIC", lookup->name()); | 1005 TRACE_IC("LoadIC", lookup->name()); |
| 1006 return; | 1006 return; |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 Handle<Code> code; | 1009 Handle<Code> code; |
| 1010 if (lookup->state() == LookupIterator::JSPROXY || | 1010 if (lookup->state() == LookupIterator::JSPROXY || |
| 1011 lookup->state() == LookupIterator::ACCESS_CHECK) { | 1011 lookup->state() == LookupIterator::ACCESS_CHECK) { |
| 1012 code = slow_stub(); | 1012 code = slow_stub(); |
| 1013 } else if (!lookup->IsFound()) { | 1013 } else if (!lookup->IsFound()) { |
| 1014 if (kind() == Code::LOAD_IC) { | 1014 if (kind() == Code::LOAD_IC && !is_strong(language_mode())) { |
| 1015 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), | 1015 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), |
| 1016 receiver_map()); | 1016 receiver_map()); |
| 1017 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. | 1017 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. |
| 1018 if (code.is_null()) code = slow_stub(); | 1018 if (code.is_null()) code = slow_stub(); |
| 1019 } else { | 1019 } else { |
| 1020 code = slow_stub(); | 1020 code = slow_stub(); |
| 1021 } | 1021 } |
| 1022 } else { | 1022 } else { |
| 1023 code = ComputeHandler(lookup); | 1023 code = ComputeHandler(lookup); |
| 1024 } | 1024 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1197 Handle<Map> stub_holder_map = | 1197 Handle<Map> stub_holder_map = |
| 1198 GetHandlerCacheHolder(map, receiver_is_holder, isolate(), &flag); | 1198 GetHandlerCacheHolder(map, receiver_is_holder, isolate(), &flag); |
| 1199 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); | 1199 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); |
| 1200 return code; | 1200 return code; |
| 1201 } | 1201 } |
| 1202 // There is only one shared stub for loading normalized | 1202 // There is only one shared stub for loading normalized |
| 1203 // properties. It does not traverse the prototype chain, so the | 1203 // properties. It does not traverse the prototype chain, so the |
| 1204 // property must be found in the object for the stub to be | 1204 // property must be found in the object for the stub to be |
| 1205 // applicable. | 1205 // applicable. |
| 1206 if (!receiver_is_holder) break; | 1206 if (!receiver_is_holder) break; |
| 1207 return isolate()->builtins()->LoadIC_Normal(); | 1207 return is_strong(language_mode()) |
| 1208 ? isolate()->builtins()->LoadIC_Normal_Strong() | |
| 1209 : isolate()->builtins()->LoadIC_Normal(); | |
| 1208 } | 1210 } |
| 1209 | 1211 |
| 1210 // -------------- Fields -------------- | 1212 // -------------- Fields -------------- |
| 1211 if (lookup->property_details().type() == DATA) { | 1213 if (lookup->property_details().type() == DATA) { |
| 1212 FieldIndex field = lookup->GetFieldIndex(); | 1214 FieldIndex field = lookup->GetFieldIndex(); |
| 1213 if (receiver_is_holder) { | 1215 if (receiver_is_holder) { |
| 1214 return SimpleFieldLoad(field); | 1216 return SimpleFieldLoad(field); |
| 1215 } | 1217 } |
| 1216 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1218 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
| 1217 return compiler.CompileLoadField(lookup->name(), field); | 1219 return compiler.CompileLoadField(lookup->name(), field); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1263 | 1265 |
| 1264 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { | 1266 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| 1265 Handle<Code> null_handle; | 1267 Handle<Code> null_handle; |
| 1266 Handle<Map> receiver_map(receiver->map(), isolate()); | 1268 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 1267 MapHandleList target_receiver_maps; | 1269 MapHandleList target_receiver_maps; |
| 1268 TargetMaps(&target_receiver_maps); | 1270 TargetMaps(&target_receiver_maps); |
| 1269 | 1271 |
| 1270 | 1272 |
| 1271 if (target_receiver_maps.length() == 0) { | 1273 if (target_receiver_maps.length() == 0) { |
| 1272 Handle<Code> handler = | 1274 Handle<Code> handler = |
| 1273 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1275 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 1276 receiver_map, extra_ic_state()); | |
| 1274 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1277 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| 1275 return null_handle; | 1278 return null_handle; |
| 1276 } | 1279 } |
| 1277 | 1280 |
| 1278 // The first time a receiver is seen that is a transitioned version of the | 1281 // The first time a receiver is seen that is a transitioned version of the |
| 1279 // previous monomorphic receiver type, assume the new ElementsKind is the | 1282 // previous monomorphic receiver type, assume the new ElementsKind is the |
| 1280 // monomorphic type. This benefits global arrays that only transition | 1283 // monomorphic type. This benefits global arrays that only transition |
| 1281 // once, and all call sites accessing them are faster if they remain | 1284 // once, and all call sites accessing them are faster if they remain |
| 1282 // monomorphic. If this optimistic assumption is not true, the IC will | 1285 // monomorphic. If this optimistic assumption is not true, the IC will |
| 1283 // miss again and it will become polymorphic and support both the | 1286 // miss again and it will become polymorphic and support both the |
| 1284 // untransitioned and transitioned maps. | 1287 // untransitioned and transitioned maps. |
| 1285 if (state() == MONOMORPHIC && !receiver->IsString() && | 1288 if (state() == MONOMORPHIC && !receiver->IsString() && |
| 1286 IsMoreGeneralElementsKindTransition( | 1289 IsMoreGeneralElementsKindTransition( |
| 1287 target_receiver_maps.at(0)->elements_kind(), | 1290 target_receiver_maps.at(0)->elements_kind(), |
| 1288 Handle<JSObject>::cast(receiver)->GetElementsKind())) { | 1291 Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
| 1289 Handle<Code> handler = | 1292 Handle<Code> handler = |
| 1290 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); | 1293 PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 1294 receiver_map, extra_ic_state()); | |
| 1291 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); | 1295 ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| 1292 return null_handle; | 1296 return null_handle; |
| 1293 } | 1297 } |
| 1294 | 1298 |
| 1295 DCHECK(state() != GENERIC); | 1299 DCHECK(state() != GENERIC); |
| 1296 | 1300 |
| 1297 // Determine the list of receiver maps that this call site has seen, | 1301 // Determine the list of receiver maps that this call site has seen, |
| 1298 // adding the map that was just encountered. | 1302 // adding the map that was just encountered. |
| 1299 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { | 1303 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { |
| 1300 // If the miss wasn't due to an unseen map, a polymorphic stub | 1304 // If the miss wasn't due to an unseen map, a polymorphic stub |
| 1301 // won't help, use the generic stub. | 1305 // won't help, use the generic stub. |
| 1302 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); | 1306 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); |
| 1303 return megamorphic_stub(); | 1307 return megamorphic_stub(); |
| 1304 } | 1308 } |
| 1305 | 1309 |
| 1306 // If the maximum number of receiver maps has been exceeded, use the generic | 1310 // If the maximum number of receiver maps has been exceeded, use the generic |
| 1307 // version of the IC. | 1311 // version of the IC. |
| 1308 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { | 1312 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { |
| 1309 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); | 1313 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); |
| 1310 return megamorphic_stub(); | 1314 return megamorphic_stub(); |
| 1311 } | 1315 } |
| 1312 | 1316 |
| 1313 CodeHandleList handlers(target_receiver_maps.length()); | 1317 CodeHandleList handlers(target_receiver_maps.length()); |
| 1314 ElementHandlerCompiler compiler(isolate()); | 1318 ElementHandlerCompiler compiler(isolate()); |
| 1315 compiler.CompileElementHandlers(&target_receiver_maps, &handlers); | 1319 compiler.CompileElementHandlers(&target_receiver_maps, &handlers, |
| 1320 language_mode()); | |
| 1316 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); | 1321 ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); |
| 1317 return null_handle; | 1322 return null_handle; |
| 1318 } | 1323 } |
| 1319 | 1324 |
| 1320 | 1325 |
| 1321 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, | 1326 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
| 1322 Handle<Object> key) { | 1327 Handle<Object> key) { |
| 1323 if (MigrateDeprecated(object)) { | 1328 if (MigrateDeprecated(object)) { |
| 1324 Handle<Object> result; | 1329 Handle<Object> result; |
| 1325 ASSIGN_RETURN_ON_EXCEPTION( | 1330 ASSIGN_RETURN_ON_EXCEPTION( |
| 1326 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), | 1331 isolate(), result, |
| 1332 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), | |
| 1327 Object); | 1333 Object); |
| 1328 return result; | 1334 return result; |
| 1329 } | 1335 } |
| 1330 | 1336 |
| 1331 Handle<Object> load_handle; | 1337 Handle<Object> load_handle; |
| 1332 Handle<Code> stub = megamorphic_stub(); | 1338 Handle<Code> stub = megamorphic_stub(); |
| 1333 | 1339 |
| 1334 // Check for non-string values that can be converted into an | 1340 // Check for non-string values that can be converted into an |
| 1335 // internalized string directly or is representable as a smi. | 1341 // internalized string directly or is representable as a smi. |
| 1336 key = TryConvertKey(key, isolate()); | 1342 key = TryConvertKey(key, isolate()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1353 Code* generic = *megamorphic_stub(); | 1359 Code* generic = *megamorphic_stub(); |
| 1354 if (!stub.is_null() && *stub == generic) { | 1360 if (!stub.is_null() && *stub == generic) { |
| 1355 ConfigureVectorState(MEGAMORPHIC); | 1361 ConfigureVectorState(MEGAMORPHIC); |
| 1356 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); | 1362 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); |
| 1357 } | 1363 } |
| 1358 | 1364 |
| 1359 TRACE_IC("LoadIC", key); | 1365 TRACE_IC("LoadIC", key); |
| 1360 } | 1366 } |
| 1361 | 1367 |
| 1362 if (!load_handle.is_null()) return load_handle; | 1368 if (!load_handle.is_null()) return load_handle; |
| 1369 | |
| 1363 Handle<Object> result; | 1370 Handle<Object> result; |
| 1364 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, | 1371 ASSIGN_RETURN_ON_EXCEPTION( |
| 1365 Runtime::GetObjectProperty(isolate(), object, key), | 1372 isolate(), result, |
| 1366 Object); | 1373 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), |
| 1374 Object); | |
| 1367 return result; | 1375 return result; |
| 1368 } | 1376 } |
| 1369 | 1377 |
| 1370 | 1378 |
| 1371 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, | 1379 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, |
| 1372 JSReceiver::StoreFromKeyed store_mode) { | 1380 JSReceiver::StoreFromKeyed store_mode) { |
| 1373 // Disable ICs for non-JSObjects for now. | 1381 // Disable ICs for non-JSObjects for now. |
| 1374 Handle<Object> receiver = it->GetReceiver(); | 1382 Handle<Object> receiver = it->GetReceiver(); |
| 1375 if (!receiver->IsJSObject()) return false; | 1383 if (!receiver->IsJSObject()) return false; |
| 1376 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); | 1384 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2846 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2854 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 2847 Handle<Name> name = | 2855 Handle<Name> name = |
| 2848 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2856 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
| 2849 Handle<JSObject> receiver = | 2857 Handle<JSObject> receiver = |
| 2850 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 2858 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
| 2851 Handle<JSObject> holder = | 2859 Handle<JSObject> holder = |
| 2852 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 2860 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
| 2853 | 2861 |
| 2854 Handle<Object> result; | 2862 Handle<Object> result; |
| 2855 LookupIterator it(receiver, name, holder); | 2863 LookupIterator it(receiver, name, holder); |
| 2864 // TODO(conradw): Investigate strong mode semantics for this. | |
| 2856 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2865 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 2857 JSObject::GetProperty(&it)); | 2866 JSObject::GetProperty(&it)); |
| 2858 | 2867 |
| 2859 if (it.IsFound()) return *result; | 2868 if (it.IsFound()) return *result; |
| 2860 | 2869 |
| 2861 return ThrowReferenceError(isolate, Name::cast(args[0])); | 2870 return ThrowReferenceError(isolate, Name::cast(args[0])); |
| 2862 } | 2871 } |
| 2863 | 2872 |
| 2864 | 2873 |
| 2865 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { | 2874 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2891 } | 2900 } |
| 2892 | 2901 |
| 2893 | 2902 |
| 2894 RUNTIME_FUNCTION(LoadElementWithInterceptor) { | 2903 RUNTIME_FUNCTION(LoadElementWithInterceptor) { |
| 2895 // TODO(verwaest): This should probably get the holder and receiver as input. | 2904 // TODO(verwaest): This should probably get the holder and receiver as input. |
| 2896 HandleScope scope(isolate); | 2905 HandleScope scope(isolate); |
| 2897 Handle<JSObject> receiver = args.at<JSObject>(0); | 2906 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 2898 DCHECK(args.smi_at(1) >= 0); | 2907 DCHECK(args.smi_at(1) >= 0); |
| 2899 uint32_t index = args.smi_at(1); | 2908 uint32_t index = args.smi_at(1); |
| 2900 Handle<Object> result; | 2909 Handle<Object> result; |
| 2910 // TODO(conradw): Investigate strong mode semantics for this. | |
| 2911 LanguageMode language_mode = SLOPPY; | |
| 2901 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2912 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 2902 isolate, result, Object::GetElement(isolate, receiver, index)); | 2913 isolate, result, |
| 2914 Object::GetElement(isolate, receiver, index, language_mode)); | |
| 2903 return *result; | 2915 return *result; |
| 2904 } | 2916 } |
| 2905 | 2917 |
| 2906 | 2918 |
| 2907 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { | 2919 RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { |
| 2908 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2920 TimerEventScope<TimerEventIcMiss> timer(isolate); |
| 2909 HandleScope scope(isolate); | 2921 HandleScope scope(isolate); |
| 2910 Handle<Object> receiver = args.at<Object>(0); | 2922 Handle<Object> receiver = args.at<Object>(0); |
| 2911 Handle<Name> key = args.at<Name>(1); | 2923 Handle<Name> key = args.at<Name>(1); |
| 2912 Handle<Object> result; | 2924 Handle<Object> result; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 2936 | 2948 |
| 2937 | 2949 |
| 2938 static const Address IC_utilities[] = { | 2950 static const Address IC_utilities[] = { |
| 2939 #define ADDR(name) FUNCTION_ADDR(name), | 2951 #define ADDR(name) FUNCTION_ADDR(name), |
| 2940 IC_UTIL_LIST(ADDR) NULL | 2952 IC_UTIL_LIST(ADDR) NULL |
| 2941 #undef ADDR | 2953 #undef ADDR |
| 2942 }; | 2954 }; |
| 2943 | 2955 |
| 2944 | 2956 |
| 2945 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2957 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 2946 } // namespace internal | 2958 } |
| 2947 } // namespace v8 | 2959 } // namespace v8::internal |
|
Toon Verwaest
2015/06/30 14:20:40
Remove this change from the CL, it's unnecessary.
conradw
2015/06/30 14:35:09
oops, this wasn't intentional, I'm not sure how it
| |
| OLD | NEW |