OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void CallIC::Clear(Address address, Code* target) { | 226 void CallIC::Clear(Address address, Code* target) { |
227 State state = target->ic_state(); | 227 State state = target->ic_state(); |
228 if (state == UNINITIALIZED || state == UNINITIALIZED_IN_LOOP) return; | 228 if (state == UNINITIALIZED || state == UNINITIALIZED_IN_LOOP) return; |
229 Code* code = StubCache::FindCallInitialize(target->arguments_count()); | 229 Code* code = StubCache::FindCallInitialize(target->arguments_count()); |
230 SetTargetAtAddress(address, code); | 230 SetTargetAtAddress(address, code); |
231 } | 231 } |
232 | 232 |
233 | 233 |
234 void KeyedLoadIC::Clear(Address address, Code* target) { | 234 void KeyedLoadIC::Clear(Address address, Code* target) { |
235 if (target->ic_state() == UNINITIALIZED) return; | 235 if (target->ic_state() == UNINITIALIZED) return; |
| 236 // Make sure to also clear the map used in inline fast cases. If we |
| 237 // do not clear these maps, cached code can keep objects alive |
| 238 // through the embedded maps. |
| 239 PatchInlinedMapCheck(address, Heap::null_value()); |
236 SetTargetAtAddress(address, initialize_stub()); | 240 SetTargetAtAddress(address, initialize_stub()); |
237 } | 241 } |
238 | 242 |
239 | 243 |
240 void LoadIC::Clear(Address address, Code* target) { | 244 void LoadIC::Clear(Address address, Code* target) { |
241 if (target->ic_state() == UNINITIALIZED) return; | 245 if (target->ic_state() == UNINITIALIZED) return; |
242 SetTargetAtAddress(address, initialize_stub()); | 246 SetTargetAtAddress(address, initialize_stub()); |
243 } | 247 } |
244 | 248 |
245 | 249 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 return result; | 715 return result; |
712 } | 716 } |
713 | 717 |
714 return object->GetProperty(*object, &lookup, *name, &attr); | 718 return object->GetProperty(*object, &lookup, *name, &attr); |
715 } | 719 } |
716 | 720 |
717 // Do not use ICs for objects that require access checks (including | 721 // Do not use ICs for objects that require access checks (including |
718 // the global object). | 722 // the global object). |
719 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); | 723 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); |
720 | 724 |
721 if (use_ic) set_target(generic_stub()); | 725 if (use_ic) { |
| 726 set_target(generic_stub()); |
| 727 // For JSObjects that are not value wrappers and that do not have |
| 728 // indexed interceptors, we initialize the inlined fast case (if |
| 729 // present) by patching the inlined map check. |
| 730 if (object->IsJSObject() && |
| 731 !object->IsJSValue() && |
| 732 !JSObject::cast(*object)->HasIndexedInterceptor()) { |
| 733 Map* map = JSObject::cast(*object)->map(); |
| 734 PatchInlinedMapCheck(address(), map); |
| 735 } |
| 736 } |
722 | 737 |
723 // Get the property. | 738 // Get the property. |
724 return Runtime::GetObjectProperty(object, key); | 739 return Runtime::GetObjectProperty(object, key); |
725 } | 740 } |
726 | 741 |
727 | 742 |
728 void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state, | 743 void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state, |
729 Handle<Object> object, Handle<String> name) { | 744 Handle<Object> object, Handle<String> name) { |
730 ASSERT(lookup->IsLoaded()); | 745 ASSERT(lookup->IsLoaded()); |
731 // Bail out if we didn't find a result. | 746 // Bail out if we didn't find a result. |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 #undef ADDR | 1209 #undef ADDR |
1195 }; | 1210 }; |
1196 | 1211 |
1197 | 1212 |
1198 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1213 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1199 return IC_utilities[id]; | 1214 return IC_utilities[id]; |
1200 } | 1215 } |
1201 | 1216 |
1202 | 1217 |
1203 } } // namespace v8::internal | 1218 } } // namespace v8::internal |
OLD | NEW |