Commit c386538c authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use POLYMORPHIC for polymorphic Keyed(Load|Store)IC

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13332 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 467b7520
......@@ -3327,7 +3327,7 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic(
__ Jump(miss_ic, RelocInfo::CODE_TARGET, al);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......@@ -3431,7 +3431,7 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
__ Jump(miss_ic, RelocInfo::CODE_TARGET, al);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......
......@@ -430,7 +430,7 @@ void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle,
} else if (is_monomorphic_) {
receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this),
zone);
} else if (oracle->LoadIsMegamorphicWithTypeInfo(this)) {
} else if (oracle->LoadIsPolymorphic(this)) {
receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_);
}
......@@ -452,7 +452,7 @@ void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
} else if (is_monomorphic_) {
// Record receiver type for monomorphic keyed stores.
receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone);
} else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) {
} else if (oracle->StoreIsPolymorphic(id)) {
receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
oracle->CollectKeyedReceiverTypes(id, &receiver_types_);
}
......@@ -468,7 +468,7 @@ void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle,
// Record receiver type for monomorphic keyed stores.
receiver_types_.Add(
oracle->StoreMonomorphicReceiverType(id), zone);
} else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) {
} else if (oracle->StoreIsPolymorphic(id)) {
receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
oracle->CollectKeyedReceiverTypes(id, &receiver_types_);
}
......
......@@ -2947,7 +2947,7 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
__ jmp(miss_ic, RelocInfo::CODE_TARGET);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......@@ -3440,7 +3440,7 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic(
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......
......@@ -1109,7 +1109,7 @@ Handle<Code> KeyedLoadIC::ComputePolymorphicStub(
receiver_maps, &handler_ics);
isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
PROFILE(isolate(),
CodeCreateEvent(Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, *code, 0));
CodeCreateEvent(Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG, *code, 0));
return code;
}
......@@ -1329,6 +1329,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup,
switch (state) {
case UNINITIALIZED:
case PREMONOMORPHIC:
case POLYMORPHIC:
set_target(*code);
break;
case MONOMORPHIC:
......@@ -1342,7 +1343,6 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup,
case DEBUG_PREPARE_STEP_IN:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
UNREACHABLE();
break;
}
......@@ -1651,7 +1651,7 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
case MONOMORPHIC:
result->Add(Handle<Map>(stub->FindFirstMap()));
break;
case MEGAMORPHIC: {
case POLYMORPHIC: {
AssertNoAllocation no_allocation;
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*stub, mask); !it.done(); it.next()) {
......@@ -1662,10 +1662,11 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
}
break;
}
case MEGAMORPHIC:
break;
case UNINITIALIZED:
case PREMONOMORPHIC:
case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
UNREACHABLE();
......@@ -1877,7 +1878,7 @@ Handle<Code> KeyedStoreIC::ComputePolymorphicStub(
receiver_maps, &handler_ics, &transitioned_maps);
isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
PROFILE(isolate(),
CodeCreateEvent(Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, *code, 0));
CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0));
return code;
}
......@@ -2101,6 +2102,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
switch (state) {
case UNINITIALIZED:
case PREMONOMORPHIC:
case POLYMORPHIC:
set_target(*code);
break;
case MONOMORPHIC:
......@@ -2116,7 +2118,6 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
case DEBUG_PREPARE_STEP_IN:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
case POLYMORPHIC:
UNREACHABLE();
break;
}
......
......@@ -127,10 +127,10 @@ class Isolate;
V(EVAL_TAG, "Eval") \
V(FUNCTION_TAG, "Function") \
V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \
V(KEYED_LOAD_MEGAMORPHIC_IC_TAG, "KeyedLoadMegamorphicIC") \
V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \
V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \
V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \
V(KEYED_STORE_MEGAMORPHIC_IC_TAG, "KeyedStoreMegamorphicIC") \
V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \
V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \
V(LAZY_COMPILE_TAG, "LazyCompile") \
V(LOAD_IC_TAG, "LoadIC") \
......
......@@ -3319,7 +3319,7 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic(
__ Jump(miss_ic, RelocInfo::CODE_TARGET);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......@@ -3422,7 +3422,7 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
__ Jump(miss_ic, RelocInfo::CODE_TARGET);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......
......@@ -211,7 +211,8 @@ 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 || heap->flush_monomorphic_ics() ||
&& (target->ic_state() == MEGAMORPHIC ||
target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() ||
Serializer::enabled() || target->ic_age() != heap->global_ic_age())) {
IC::Clear(rinfo->pc());
target = Code::GetCodeFromTargetAddress(rinfo->target_address());
......
......@@ -111,14 +111,11 @@ bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
}
bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) {
bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) {
Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
if (map_or_code->IsCode()) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
Builtins* builtins = isolate_->builtins();
return code->is_keyed_load_stub() &&
*code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
code->ic_state() == MEGAMORPHIC;
return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC;
}
return false;
}
......@@ -145,19 +142,15 @@ bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) {
}
bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id) {
bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) {
Handle<Object> map_or_code = GetInfo(ast_id);
if (map_or_code->IsCode()) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
Builtins* builtins = isolate_->builtins();
bool allow_growth =
Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
ALLOW_JSARRAY_GROWTH;
return code->is_keyed_store_stub() &&
!allow_growth &&
*code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) &&
*code != builtins->builtin(Builtins::kKeyedStoreIC_Generic_Strict) &&
code->ic_state() == MEGAMORPHIC;
return code->is_keyed_store_stub() && !allow_growth &&
code->ic_state() == POLYMORPHIC;
}
return false;
}
......@@ -667,7 +660,7 @@ void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
case Code::KEYED_LOAD_IC:
case Code::KEYED_STORE_IC:
if (target->ic_state() == MONOMORPHIC ||
target->ic_state() == MEGAMORPHIC) {
target->ic_state() == POLYMORPHIC) {
SetInfo(ast_id, target);
}
break;
......
......@@ -242,9 +242,9 @@ class TypeFeedbackOracle: public ZoneObject {
bool LoadIsMonomorphicNormal(Property* expr);
bool LoadIsUninitialized(Property* expr);
bool LoadIsMegamorphicWithTypeInfo(Property* expr);
bool LoadIsPolymorphic(Property* expr);
bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id);
bool StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id);
bool StoreIsPolymorphic(TypeFeedbackId ast_id);
bool CallIsMonomorphic(Call* expr);
bool CallNewIsMonomorphic(CallNew* expr);
bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property* prop);
......
......@@ -2772,7 +2772,7 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
__ jmp(ic, RelocInfo::CODE_TARGET);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......@@ -3253,7 +3253,7 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic(
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
}
......
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