Commit 50d82ca7 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Introduce POLYMORPHIC

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13329 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 400b8b8c
...@@ -43,9 +43,10 @@ namespace internal { ...@@ -43,9 +43,10 @@ namespace internal {
char IC::TransitionMarkFromState(IC::State state) { char IC::TransitionMarkFromState(IC::State state) {
switch (state) { switch (state) {
case UNINITIALIZED: return '0'; case UNINITIALIZED: return '0';
case PREMONOMORPHIC: return 'P'; case PREMONOMORPHIC: return '.';
case MONOMORPHIC: return '1'; case MONOMORPHIC: return '1';
case MONOMORPHIC_PROTOTYPE_FAILURE: return '^'; case MONOMORPHIC_PROTOTYPE_FAILURE: return '^';
case POLYMORPHIC: return 'P';
case MEGAMORPHIC: return IsGeneric() ? 'G' : 'N'; case MEGAMORPHIC: return IsGeneric() ? 'G' : 'N';
// We never see the debugger states here, because the state is // We never see the debugger states here, because the state is
...@@ -772,6 +773,9 @@ void CallICBase::UpdateCaches(LookupResult* lookup, ...@@ -772,6 +773,9 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
case DEBUG_BREAK: case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
break; break;
case POLYMORPHIC:
UNREACHABLE();
break;
} }
TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC", TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC",
...@@ -1065,6 +1069,9 @@ void LoadIC::UpdateCaches(LookupResult* lookup, ...@@ -1065,6 +1069,9 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
case DEBUG_BREAK: case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
break; break;
case POLYMORPHIC:
UNREACHABLE();
break;
} }
TRACE_IC("LoadIC", name, state, target()); TRACE_IC("LoadIC", name, state, target());
...@@ -1335,6 +1342,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup, ...@@ -1335,6 +1342,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup,
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
break; break;
case MONOMORPHIC_PROTOTYPE_FAILURE: case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
...@@ -1610,6 +1618,9 @@ void StoreIC::UpdateCaches(LookupResult* lookup, ...@@ -1610,6 +1618,9 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
case DEBUG_BREAK: case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
break; break;
case POLYMORPHIC:
UNREACHABLE();
break;
} }
TRACE_IC("StoreIC", name, state, target()); TRACE_IC("StoreIC", name, state, target());
...@@ -1654,6 +1665,7 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub, ...@@ -1654,6 +1665,7 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
case UNINITIALIZED: case UNINITIALIZED:
case PREMONOMORPHIC: case PREMONOMORPHIC:
case MONOMORPHIC_PROTOTYPE_FAILURE: case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
case DEBUG_BREAK: case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
UNREACHABLE(); UNREACHABLE();
...@@ -1747,7 +1759,7 @@ Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, ...@@ -1747,7 +1759,7 @@ Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver,
isolate()->factory()->polymorphic_code_cache(); isolate()->factory()->polymorphic_code_cache();
Code::ExtraICState extra_state = Code::ComputeExtraICState(grow_mode, Code::ExtraICState extra_state = Code::ComputeExtraICState(grow_mode,
strict_mode); strict_mode);
Code::Flags flags = Code::ComputeFlags(kind(), MEGAMORPHIC, extra_state); Code::Flags flags = Code::ComputeFlags(kind(), POLYMORPHIC, extra_state);
Handle<Object> probe = cache->Lookup(&target_receiver_maps, flags); Handle<Object> probe = cache->Lookup(&target_receiver_maps, flags);
if (probe->IsCode()) return Handle<Code>::cast(probe); if (probe->IsCode()) return Handle<Code>::cast(probe);
...@@ -2104,6 +2116,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup, ...@@ -2104,6 +2116,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
case DEBUG_PREPARE_STEP_IN: case DEBUG_PREPARE_STEP_IN:
break; break;
case MONOMORPHIC_PROTOTYPE_FAILURE: case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
......
...@@ -9009,6 +9009,7 @@ const char* Code::ICState2String(InlineCacheState state) { ...@@ -9009,6 +9009,7 @@ const char* Code::ICState2String(InlineCacheState state) {
case PREMONOMORPHIC: return "PREMONOMORPHIC"; case PREMONOMORPHIC: return "PREMONOMORPHIC";
case MONOMORPHIC: return "MONOMORPHIC"; case MONOMORPHIC: return "MONOMORPHIC";
case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE"; case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE";
case POLYMORPHIC: return "POLYMORPHIC";
case MEGAMORPHIC: return "MEGAMORPHIC"; case MEGAMORPHIC: return "MEGAMORPHIC";
case DEBUG_BREAK: return "DEBUG_BREAK"; case DEBUG_BREAK: return "DEBUG_BREAK";
case DEBUG_PREPARE_STEP_IN: return "DEBUG_PREPARE_STEP_IN"; case DEBUG_PREPARE_STEP_IN: return "DEBUG_PREPARE_STEP_IN";
......
...@@ -260,6 +260,8 @@ enum InlineCacheState { ...@@ -260,6 +260,8 @@ enum InlineCacheState {
// Like MONOMORPHIC but check failed due to prototype. // Like MONOMORPHIC but check failed due to prototype.
MONOMORPHIC_PROTOTYPE_FAILURE, MONOMORPHIC_PROTOTYPE_FAILURE,
// Multiple receiver types have been seen. // Multiple receiver types have been seen.
POLYMORPHIC,
// Many receiver types have been seen.
MEGAMORPHIC, MEGAMORPHIC,
// Special states for debug break or step in prepare stubs. // Special states for debug break or step in prepare stubs.
DEBUG_BREAK, DEBUG_BREAK,
......
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