Chromium Code Reviews| Index: src/ic.cc |
| diff --git a/src/ic.cc b/src/ic.cc |
| index f01c3d120af1fe6bd00647712ab0e4622b4bb761..fc5707fad54743dc6145f443d872d26fb3b2dc2e 100644 |
| --- a/src/ic.cc |
| +++ b/src/ic.cc |
| @@ -121,7 +121,8 @@ void IC::TraceIC(const char* type, |
| IC::IC(FrameDepth depth, Isolate* isolate) |
| : isolate_(isolate), |
| - target_set_(false) { |
| + target_set_(false), |
| + target_maps_set_(false) { |
| // To improve the performance of the (much used) IC code, we unfold a few |
| // levels of the stack frame iteration code. This yields a ~35% speedup when |
| // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag. |
| @@ -298,7 +299,7 @@ bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, |
| // If the IC is shared between multiple receivers (slow dictionary mode), then |
| // the map cannot be deprecated and the stub invalidated. |
| if (cache_holder == OWN_MAP) { |
| - Map* old_map = target()->FindFirstMap(); |
| + Map* old_map = FirstTargetMap(); |
| if (old_map == *map) return true; |
| if (old_map != NULL) { |
| if (old_map->is_deprecated()) return true; |
| @@ -624,7 +625,7 @@ bool IC::UpdatePolymorphicIC(Handle<HeapType> type, |
| TypeHandleList types; |
| CodeHandleList handlers; |
| - target()->FindAllTypes(&types); |
| + TargetTypes(&types); |
| int number_of_types = types.length(); |
| int deprecated_types = 0; |
| int handler_to_overwrite = -1; |
| @@ -727,7 +728,7 @@ void IC::UpdateMonomorphicIC(Handle<HeapType> type, |
| void IC::CopyICToMegamorphicCache(Handle<String> name) { |
| TypeHandleList types; |
| CodeHandleList handlers; |
| - target()->FindAllTypes(&types); |
| + TargetTypes(&types); |
| if (!target()->FindHandlers(&handlers, types.length())) return; |
| for (int i = 0; i < types.length(); i++) { |
| UpdateMegamorphicCache(*types.at(i), *name, *handlers.at(i)); |
| @@ -1028,19 +1029,13 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { |
| Handle<Map> receiver_map(receiver->map(), isolate()); |
| MapHandleList target_receiver_maps; |
| - if (state() == UNINITIALIZED || state() == PREMONOMORPHIC) { |
| - // Optimistically assume that ICs that haven't reached the MONOMORPHIC state |
| - // yet will do so and stay there. |
| - return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); |
| - } |
| - |
| if (target().is_identical_to(string_stub())) { |
| target_receiver_maps.Add(isolate()->factory()->string_map()); |
| } else { |
| - target()->FindAllMaps(&target_receiver_maps); |
| - if (target_receiver_maps.length() == 0) { |
| - return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); |
| - } |
| + TargetMaps(&target_receiver_maps); |
| + } |
| + if (target_receiver_maps.length() == 0) { |
| + return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); |
| } |
| // The first time a receiver is seen that is a transitioned version of the |
| @@ -1426,24 +1421,15 @@ Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver, |
| } |
| Handle<Map> receiver_map(receiver->map(), isolate()); |
| - if (state() == UNINITIALIZED || state() == PREMONOMORPHIC) { |
| - // Optimistically assume that ICs that haven't reached the MONOMORPHIC state |
| - // yet will do so and stay there. |
| + MapHandleList target_receiver_maps; |
| + TargetMaps(&target_receiver_maps); |
| + if (target_receiver_maps.length() == 0) { |
|
Toon Verwaest
2014/04/01 15:22:05
length() == 0 isn't the same as UNINITIALIZED || P
ulan
2014/04/01 16:14:07
The comment that I removed seems to be out-dated:
|
| Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, store_mode); |
| store_mode = GetNonTransitioningStoreMode(store_mode); |
| return isolate()->stub_cache()->ComputeKeyedStoreElement( |
| monomorphic_map, strict_mode(), store_mode); |
| } |
| - MapHandleList target_receiver_maps; |
| - target()->FindAllMaps(&target_receiver_maps); |
| - if (target_receiver_maps.length() == 0) { |
| - // In the case that there is a non-map-specific IC is installed (e.g. keyed |
| - // stores into properties in dictionary mode), then there will be not |
| - // receiver maps in the target. |
| - return generic_stub(); |
| - } |
| - |
| // There are several special cases where an IC that is MONOMORPHIC can still |
| // transition to a different GetNonTransitioningStoreMode IC that handles a |
| // superset of the original IC. Handle those here if the receiver map hasn't |
| @@ -2745,8 +2731,8 @@ MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { |
| // Find or create the specialized stub to support the new set of types. |
| Handle<Code> code; |
| if (stub.IsMonomorphic()) { |
| - Handle<Map> monomorphic_map(already_monomorphic |
| - ? target()->FindFirstMap() |
| + Handle<Map> monomorphic_map(already_monomorphic && FirstTargetMap() != NULL |
| + ? FirstTargetMap() |
| : HeapObject::cast(*object)->map()); |
| code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub); |
| } else { |