Commit 0cd4ab71 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ic] Remove disabled --collect-megamorphic-maps-from-stub-cache option.

... and stop checking that the native contexts of maps recorded in feedback vector
match function's native context - the feedback vector machinery already guarantees
that.

BUG=v8:6325

Change-Id: Iacd3f3a5f703694ff57b774b9658e186ad66641b
Reviewed-on: https://chromium-review.googlesource.com/490084Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44982}
parent f63aaee9
......@@ -483,9 +483,6 @@ class FeedbackNexus {
return NULL;
}
// TODO(mvstanton): remove FindAllMaps, it didn't survive a code review.
void FindAllMaps(MapHandleList* maps) const { ExtractMaps(maps); }
virtual InlineCacheState StateFromFeedback() const = 0;
virtual int ExtractMaps(MapHandleList* maps) const;
virtual MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const;
......
......@@ -363,8 +363,6 @@ DEFINE_INT(max_inlined_nodes_cumulative, 400,
"maximum cumulative number of AST nodes considered for inlining")
DEFINE_BOOL(loop_invariant_code_motion, true, "loop invariant code motion")
DEFINE_BOOL(fast_math, true, "faster (but maybe less accurate) math functions")
DEFINE_BOOL(collect_megamorphic_maps_from_stub_cache, false,
"crankshaft harvests type feedback from stub cache")
DEFINE_BOOL(hydrogen_stats, false, "print statistics for hydrogen")
DEFINE_BOOL(trace_check_elimination, false, "trace check elimination phase")
DEFINE_BOOL(trace_environment_liveness, false,
......
......@@ -111,43 +111,5 @@ void StubCache::Clear() {
}
}
void StubCache::CollectMatchingMaps(SmallMapList* types, Handle<Name> name,
Handle<Context> native_context,
Zone* zone) {
for (int i = 0; i < kPrimaryTableSize; i++) {
if (primary_[i].key == *name) {
Map* map = primary_[i].map;
// Map can be nullptr, if the stub is constant function call
// with a primitive receiver.
if (map == nullptr) continue;
int offset = PrimaryOffset(*name, map);
if (entry(primary_, offset) == &primary_[i] &&
TypeFeedbackOracle::IsRelevantFeedback(map, *native_context)) {
types->AddMapIfMissing(Handle<Map>(map), zone);
}
}
}
for (int i = 0; i < kSecondaryTableSize; i++) {
if (secondary_[i].key == *name) {
Map* map = secondary_[i].map;
// Map can be nullptr, if the stub is constant function call
// with a primitive receiver.
if (map == nullptr) continue;
// Lookup in primary table and skip duplicates.
int primary_offset = PrimaryOffset(*name, map);
// Lookup in secondary table and add matches.
int offset = SecondaryOffset(*name, primary_offset);
if (entry(secondary_, offset) == &secondary_[i] &&
TypeFeedbackOracle::IsRelevantFeedback(map, *native_context)) {
types->AddMapIfMissing(Handle<Map>(map), zone);
}
}
}
}
} // namespace internal
} // namespace v8
......@@ -45,9 +45,6 @@ class StubCache {
Object* Get(Name* name, Map* map);
// Clear the lookup table (@ mark compact collection).
void Clear();
// Collect all maps that match the name.
void CollectMatchingMaps(SmallMapList* types, Handle<Name> name,
Handle<Context> native_context, Zone* zone);
enum Table { kPrimary, kSecondary };
......
......@@ -388,8 +388,7 @@ void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackSlot slot,
receiver_types->Clear();
if (!slot.IsInvalid()) {
LoadICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes(isolate()->load_stub_cache(), &nexus, name,
receiver_types);
CollectReceiverTypes(&nexus, receiver_types);
}
}
......@@ -412,8 +411,8 @@ void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackSlot slot,
Handle<Name> name,
SmallMapList* receiver_types) {
receiver_types->Clear();
CollectReceiverTypes(isolate()->store_stub_cache(), slot, name,
receiver_types);
StoreICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes(&nexus, receiver_types);
}
void TypeFeedbackOracle::KeyedAssignmentReceiverTypes(
......@@ -430,27 +429,6 @@ void TypeFeedbackOracle::CountReceiverTypes(FeedbackSlot slot,
if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types);
}
void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache,
FeedbackSlot slot,
Handle<Name> name,
SmallMapList* types) {
StoreICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes(stub_cache, &nexus, name, types);
}
void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache,
FeedbackNexus* nexus,
Handle<Name> name,
SmallMapList* types) {
if (FLAG_collect_megamorphic_maps_from_stub_cache &&
nexus->ic_state() == MEGAMORPHIC) {
types->Reserve(4, zone());
stub_cache->CollectMatchingMaps(types, name, native_context_, zone());
} else {
CollectReceiverTypes(nexus, types);
}
}
void TypeFeedbackOracle::CollectReceiverTypes(FeedbackSlot slot,
SmallMapList* types) {
FeedbackSlotKind kind = feedback_vector_->GetKind(slot);
......@@ -468,20 +446,13 @@ void TypeFeedbackOracle::CollectReceiverTypes(FeedbackSlot slot,
void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus,
SmallMapList* types) {
MapHandleList maps;
if (nexus->ic_state() == MONOMORPHIC) {
Map* map = nexus->FindFirstMap();
if (map != NULL) maps.Add(handle(map));
} else if (nexus->ic_state() == POLYMORPHIC) {
nexus->FindAllMaps(&maps);
} else {
if (nexus->ExtractMaps(&maps) == 0) {
return;
}
types->Reserve(maps.length(), zone());
for (int i = 0; i < maps.length(); i++) {
Handle<Map> map(maps.at(i));
if (IsRelevantFeedback(*map, *native_context_)) {
types->AddMapIfMissing(maps.at(i), zone());
}
types->AddMapIfMissing(maps.at(i), zone());
}
}
......
......@@ -58,13 +58,6 @@ class TypeFeedbackOracle: public ZoneObject {
void CollectReceiverTypes(FeedbackSlot slot, SmallMapList* types);
void CollectReceiverTypes(FeedbackNexus* nexus, SmallMapList* types);
static bool IsRelevantFeedback(Map* map, Context* native_context) {
Object* constructor = map->GetConstructor();
return !constructor->IsJSFunction() ||
JSFunction::cast(constructor)->context()->native_context() ==
native_context;
}
Handle<JSFunction> GetCallTarget(FeedbackSlot slot);
Handle<AllocationSite> GetCallAllocationSite(FeedbackSlot slot);
Handle<JSFunction> GetCallNewTarget(FeedbackSlot slot);
......@@ -91,11 +84,6 @@ class TypeFeedbackOracle: public ZoneObject {
Isolate* isolate() const { return isolate_; }
private:
void CollectReceiverTypes(StubCache* stub_cache, FeedbackSlot slot,
Handle<Name> name, SmallMapList* types);
void CollectReceiverTypes(StubCache* stub_cache, FeedbackNexus* nexus,
Handle<Name> name, SmallMapList* types);
// Returns true if there is at least one string map and if
// all maps are string maps.
bool HasOnlyStringMaps(SmallMapList* receiver_types);
......
......@@ -350,7 +350,7 @@ TEST(VectorLoadICStates) {
CompileRun("f({ blarg: 3, torino: 10, foo: 2 })");
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps;
nexus.FindAllMaps(&maps);
nexus.ExtractMaps(&maps);
CHECK_EQ(4, maps.length());
// Finally driven megamorphic.
......@@ -429,7 +429,7 @@ TEST(VectorLoadICOnSmi) {
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps;
nexus.FindAllMaps(&maps);
nexus.ExtractMaps(&maps);
CHECK_EQ(2, maps.length());
// One of the maps should be the o map.
......@@ -452,7 +452,7 @@ TEST(VectorLoadICOnSmi) {
CompileRun("f(100)");
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps2;
nexus.FindAllMaps(&maps2);
nexus.ExtractMaps(&maps2);
CHECK_EQ(2, maps2.length());
}
......
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