Commit 36a26b53 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Separate MEGAMORPHIC and GENERIC ic states

Review URL: https://chromiumcodereview.appspot.com/11824063

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 07c60c2d
......@@ -151,13 +151,13 @@ enum BuiltinExtraArguments {
Code::kNoExtraICState) \
V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \
Code::kNoExtraICState) \
V(KeyedLoadIC_Generic, KEYED_LOAD_IC, MEGAMORPHIC, \
V(KeyedLoadIC_Generic, KEYED_LOAD_IC, GENERIC, \
Code::kNoExtraICState) \
V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \
V(KeyedLoadIC_String, KEYED_LOAD_IC, GENERIC, \
Code::kNoExtraICState) \
V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MEGAMORPHIC, \
V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, GENERIC, \
Code::kNoExtraICState) \
V(KeyedLoadIC_NonStrictArguments, KEYED_LOAD_IC, MEGAMORPHIC, \
V(KeyedLoadIC_NonStrictArguments, KEYED_LOAD_IC, GENERIC, \
Code::kNoExtraICState) \
\
V(StoreIC_Initialize, STORE_IC, UNINITIALIZED, \
......@@ -168,7 +168,7 @@ enum BuiltinExtraArguments {
Code::kNoExtraICState) \
V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC, \
Code::kNoExtraICState) \
V(StoreIC_GlobalProxy, STORE_IC, MEGAMORPHIC, \
V(StoreIC_GlobalProxy, STORE_IC, GENERIC, \
Code::kNoExtraICState) \
V(StoreIC_Initialize_Strict, STORE_IC, UNINITIALIZED, \
kStrictMode) \
......@@ -178,21 +178,21 @@ enum BuiltinExtraArguments {
kStrictMode) \
V(StoreIC_Megamorphic_Strict, STORE_IC, MEGAMORPHIC, \
kStrictMode) \
V(StoreIC_GlobalProxy_Strict, STORE_IC, MEGAMORPHIC, \
V(StoreIC_GlobalProxy_Strict, STORE_IC, GENERIC, \
kStrictMode) \
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
kStrictMode) \
\
V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \
Code::kNoExtraICState) \
V(KeyedStoreIC_Generic, KEYED_STORE_IC, MEGAMORPHIC, \
V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC, \
Code::kNoExtraICState) \
\
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
kStrictMode) \
V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \
V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \
kStrictMode) \
V(KeyedStoreIC_NonStrictArguments, KEYED_STORE_IC, MEGAMORPHIC, \
V(KeyedStoreIC_NonStrictArguments, KEYED_STORE_IC, GENERIC, \
Code::kNoExtraICState) \
V(TransitionElementsSmiToDouble, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
......
......@@ -47,7 +47,8 @@ char IC::TransitionMarkFromState(IC::State state) {
case MONOMORPHIC: return '1';
case MONOMORPHIC_PROTOTYPE_FAILURE: return '^';
case POLYMORPHIC: return 'P';
case MEGAMORPHIC: return IsGeneric() ? 'G' : 'N';
case MEGAMORPHIC: return 'N';
case GENERIC: return 'G';
// We never see the debugger states here, because the state is
// computed from the original code - not the patched code. Let
......@@ -772,6 +773,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
case DEBUG_STUB:
break;
case POLYMORPHIC:
case GENERIC:
UNREACHABLE();
break;
}
......@@ -796,6 +798,7 @@ MaybeObject* KeyedCallIC::LoadFunction(State state,
}
if (FLAG_use_ic && state != MEGAMORPHIC && object->IsHeapObject()) {
ASSERT(state != GENERIC);
int argc = target()->arguments_count();
Handle<Map> map =
isolate()->factory()->non_strict_arguments_elements_map();
......@@ -855,6 +858,7 @@ MaybeObject* LoadIC::Load(State state,
} else if (state == MONOMORPHIC && object->IsStringWrapper()) {
stub = isolate()->builtins()->LoadIC_StringWrapperLength();
} else if (state != MEGAMORPHIC) {
ASSERT(state != GENERIC);
stub = megamorphic_stub();
}
if (!stub.is_null()) {
......@@ -879,6 +883,7 @@ MaybeObject* LoadIC::Load(State state,
} else if (state == PREMONOMORPHIC) {
stub = isolate()->builtins()->LoadIC_ArrayLength();
} else if (state != MEGAMORPHIC) {
ASSERT(state != GENERIC);
stub = megamorphic_stub();
}
if (!stub.is_null()) {
......@@ -900,6 +905,7 @@ MaybeObject* LoadIC::Load(State state,
} else if (state == PREMONOMORPHIC) {
stub = isolate()->builtins()->LoadIC_FunctionPrototype();
} else if (state != MEGAMORPHIC) {
ASSERT(state != GENERIC);
stub = megamorphic_stub();
}
if (!stub.is_null()) {
......@@ -1067,6 +1073,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
case DEBUG_STUB:
break;
case POLYMORPHIC:
case GENERIC:
UNREACHABLE();
break;
}
......@@ -1339,6 +1346,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup,
case DEBUG_STUB:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
case GENERIC:
UNREACHABLE();
break;
}
......@@ -1614,6 +1622,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
case DEBUG_STUB:
break;
case POLYMORPHIC:
case GENERIC:
UNREACHABLE();
break;
}
......@@ -1658,6 +1667,7 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
break;
}
case MEGAMORPHIC:
case GENERIC:
break;
case UNINITIALIZED:
case PREMONOMORPHIC:
......@@ -2111,6 +2121,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
case DEBUG_STUB:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
case GENERIC:
UNREACHABLE();
break;
}
......@@ -2354,7 +2365,7 @@ UnaryOpIC::State UnaryOpIC::ToState(TypeInfo type_info) {
case HEAP_NUMBER:
return MONOMORPHIC;
case GENERIC:
return MEGAMORPHIC;
return ::v8::internal::GENERIC;
}
UNREACHABLE();
return ::v8::internal::UNINITIALIZED;
......@@ -2425,7 +2436,7 @@ BinaryOpIC::State BinaryOpIC::ToState(TypeInfo type_info) {
case STRING:
return MONOMORPHIC;
case GENERIC:
return MEGAMORPHIC;
return ::v8::internal::GENERIC;
}
UNREACHABLE();
return ::v8::internal::UNINITIALIZED;
......
......@@ -97,8 +97,6 @@ class IC {
Code* target() const { return GetTargetAtAddress(address()); }
inline Address address() const;
virtual bool IsGeneric() const { return false; }
// Compute the current IC state based on the target stub, receiver and name.
static State StateFrom(Code* target, Object* receiver, Object* name);
......@@ -519,10 +517,6 @@ class KeyedLoadIC: public KeyedIC {
ElementsKind elements_kind,
KeyedAccessGrowMode grow_mode);
virtual bool IsGeneric() const {
return target() == *generic_stub();
}
protected:
virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
......@@ -680,11 +674,6 @@ class KeyedStoreIC: public KeyedIC {
ElementsKind elements_kind,
KeyedAccessGrowMode grow_mode);
virtual bool IsGeneric() const {
return target() == *generic_stub() ||
target() == *generic_stub_strict();
}
protected:
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
......
......@@ -211,7 +211,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(
// when they might be keeping a Context alive, or when the heap is about
// to be serialized.
if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
&& (target->ic_state() == MEGAMORPHIC ||
&& (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC ||
target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() ||
Serializer::enabled() || target->ic_age() != heap->global_ic_age())) {
IC::Clear(rinfo->pc());
......
......@@ -9038,6 +9038,7 @@ const char* Code::ICState2String(InlineCacheState state) {
case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE";
case POLYMORPHIC: return "POLYMORPHIC";
case MEGAMORPHIC: return "MEGAMORPHIC";
case GENERIC: return "GENERIC";
case DEBUG_STUB: return "DEBUG_STUB";
}
UNREACHABLE();
......
......@@ -488,7 +488,7 @@ void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id,
isolate_->builtins()->builtin(Builtins::kStoreIC_GlobalProxy)) {
// TODO(fschneider): We could collect the maps and signal that
// we need a generic store (or load) here.
ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC);
ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC);
} else if (object->IsMap()) {
types->Add(Handle<Map>::cast(object), zone());
} else if (FLAG_collect_megamorphic_maps_from_stub_cache &&
......
......@@ -263,6 +263,8 @@ enum InlineCacheState {
POLYMORPHIC,
// Many receiver types have been seen.
MEGAMORPHIC,
// A generic handler is installed and no extra typefeedback is recorded.
GENERIC,
// Special state for debug break or step in prepare stubs.
DEBUG_STUB
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment