OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 case POLYMORPHIC: | 997 case POLYMORPHIC: |
998 // When trying to patch a polymorphic stub with anything other than | 998 // When trying to patch a polymorphic stub with anything other than |
999 // another polymorphic stub, go generic. | 999 // another polymorphic stub, go generic. |
1000 // TODO(verwaest): Currently we always go generic since no polymorphic | 1000 // TODO(verwaest): Currently we always go generic since no polymorphic |
1001 // stubs enter this code path. Replace with proper updating once named | 1001 // stubs enter this code path. Replace with proper updating once named |
1002 // load/store can also be polymorphic. | 1002 // load/store can also be polymorphic. |
1003 set_target((strict_mode == kStrictMode) | 1003 set_target((strict_mode == kStrictMode) |
1004 ? *generic_stub_strict() | 1004 ? *generic_stub_strict() |
1005 : *generic_stub()); | 1005 : *generic_stub()); |
1006 break; | 1006 break; |
| 1007 case DEBUG_STUB: |
| 1008 break; |
1007 case GENERIC: | 1009 case GENERIC: |
1008 case DEBUG_STUB: | 1010 UNREACHABLE(); |
1009 break; | 1011 break; |
1010 } | 1012 } |
1011 } | 1013 } |
1012 | 1014 |
1013 | 1015 |
1014 void LoadIC::UpdateCaches(LookupResult* lookup, | 1016 void LoadIC::UpdateCaches(LookupResult* lookup, |
1015 State state, | 1017 State state, |
1016 Handle<Object> object, | 1018 Handle<Object> object, |
1017 Handle<String> name) { | 1019 Handle<String> name) { |
1018 // Bail out if the result is not cacheable. | 1020 // Bail out if the result is not cacheable. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 1164 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
1163 for (RelocIterator it(*stub, mask); !it.done(); it.next()) { | 1165 for (RelocIterator it(*stub, mask); !it.done(); it.next()) { |
1164 RelocInfo* info = it.rinfo(); | 1166 RelocInfo* info = it.rinfo(); |
1165 Handle<Object> object(info->target_object()); | 1167 Handle<Object> object(info->target_object()); |
1166 ASSERT(object->IsMap()); | 1168 ASSERT(object->IsMap()); |
1167 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); | 1169 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); |
1168 } | 1170 } |
1169 break; | 1171 break; |
1170 } | 1172 } |
1171 case MEGAMORPHIC: | 1173 case MEGAMORPHIC: |
1172 case GENERIC: | |
1173 break; | 1174 break; |
1174 case UNINITIALIZED: | 1175 case UNINITIALIZED: |
1175 case PREMONOMORPHIC: | 1176 case PREMONOMORPHIC: |
1176 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1177 case MONOMORPHIC_PROTOTYPE_FAILURE: |
| 1178 case GENERIC: |
1177 case DEBUG_STUB: | 1179 case DEBUG_STUB: |
1178 UNREACHABLE(); | 1180 UNREACHABLE(); |
1179 break; | 1181 break; |
1180 } | 1182 } |
1181 } | 1183 } |
1182 | 1184 |
1183 | 1185 |
1184 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { | 1186 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { |
1185 State ic_state = target()->ic_state(); | 1187 State ic_state = target()->ic_state(); |
1186 | 1188 |
(...skipping 29 matching lines...) Expand all Loading... |
1216 // monomorphic. If this optimistic assumption is not true, the IC will | 1218 // monomorphic. If this optimistic assumption is not true, the IC will |
1217 // miss again and it will become polymorphic and support both the | 1219 // miss again and it will become polymorphic and support both the |
1218 // untransitioned and transitioned maps. | 1220 // untransitioned and transitioned maps. |
1219 if (ic_state == MONOMORPHIC && | 1221 if (ic_state == MONOMORPHIC && |
1220 IsMoreGeneralElementsKindTransition( | 1222 IsMoreGeneralElementsKindTransition( |
1221 target_receiver_maps.at(0)->elements_kind(), | 1223 target_receiver_maps.at(0)->elements_kind(), |
1222 receiver->GetElementsKind())) { | 1224 receiver->GetElementsKind())) { |
1223 return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); | 1225 return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); |
1224 } | 1226 } |
1225 | 1227 |
1226 ASSERT(target() != *generic_stub()); | 1228 ASSERT(ic_state != GENERIC); |
1227 | 1229 |
1228 // Determine the list of receiver maps that this call site has seen, | 1230 // Determine the list of receiver maps that this call site has seen, |
1229 // adding the map that was just encountered. | 1231 // adding the map that was just encountered. |
1230 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { | 1232 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { |
1231 // If the miss wasn't due to an unseen map, a polymorphic stub | 1233 // If the miss wasn't due to an unseen map, a polymorphic stub |
1232 // won't help, use the generic stub. | 1234 // won't help, use the generic stub. |
1233 TRACE_GENERIC_IC("KeyedIC", "same map added twice"); | 1235 TRACE_GENERIC_IC("KeyedIC", "same map added twice"); |
1234 return generic_stub(); | 1236 return generic_stub(); |
1235 } | 1237 } |
1236 | 1238 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 IsMoreGeneralElementsKindTransition( | 1600 IsMoreGeneralElementsKindTransition( |
1599 target_receiver_maps.at(0)->elements_kind(), | 1601 target_receiver_maps.at(0)->elements_kind(), |
1600 receiver->GetElementsKind())) { | 1602 receiver->GetElementsKind())) { |
1601 Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, stub_kind); | 1603 Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, stub_kind); |
1602 ASSERT(*monomorphic_map != *receiver_map); | 1604 ASSERT(*monomorphic_map != *receiver_map); |
1603 stub_kind = GetNoTransitionStubKind(stub_kind); | 1605 stub_kind = GetNoTransitionStubKind(stub_kind); |
1604 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1606 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
1605 monomorphic_map, stub_kind, strict_mode, grow_mode); | 1607 monomorphic_map, stub_kind, strict_mode, grow_mode); |
1606 } | 1608 } |
1607 | 1609 |
1608 ASSERT(target() != *generic_stub() && target() != *generic_stub_strict()); | 1610 ASSERT(ic_state != GENERIC); |
1609 | 1611 |
1610 bool map_added = | 1612 bool map_added = |
1611 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); | 1613 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); |
1612 | 1614 |
1613 if (IsTransitionStubKind(stub_kind)) { | 1615 if (IsTransitionStubKind(stub_kind)) { |
1614 Handle<Map> new_map = ComputeTransitionedMap(receiver, stub_kind); | 1616 Handle<Map> new_map = ComputeTransitionedMap(receiver, stub_kind); |
1615 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map); | 1617 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map); |
1616 } | 1618 } |
1617 | 1619 |
1618 if (!map_added) { | 1620 if (!map_added) { |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 #undef ADDR | 2574 #undef ADDR |
2573 }; | 2575 }; |
2574 | 2576 |
2575 | 2577 |
2576 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2578 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2577 return IC_utilities[id]; | 2579 return IC_utilities[id]; |
2578 } | 2580 } |
2579 | 2581 |
2580 | 2582 |
2581 } } // namespace v8::internal | 2583 } } // namespace v8::internal |
OLD | NEW |