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 { ...@@ -483,9 +483,6 @@ class FeedbackNexus {
return NULL; 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 InlineCacheState StateFromFeedback() const = 0;
virtual int ExtractMaps(MapHandleList* maps) const; virtual int ExtractMaps(MapHandleList* maps) const;
virtual MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const; virtual MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const;
......
...@@ -363,8 +363,6 @@ DEFINE_INT(max_inlined_nodes_cumulative, 400, ...@@ -363,8 +363,6 @@ DEFINE_INT(max_inlined_nodes_cumulative, 400,
"maximum cumulative number of AST nodes considered for inlining") "maximum cumulative number of AST nodes considered for inlining")
DEFINE_BOOL(loop_invariant_code_motion, true, "loop invariant code motion") 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(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(hydrogen_stats, false, "print statistics for hydrogen")
DEFINE_BOOL(trace_check_elimination, false, "trace check elimination phase") DEFINE_BOOL(trace_check_elimination, false, "trace check elimination phase")
DEFINE_BOOL(trace_environment_liveness, false, DEFINE_BOOL(trace_environment_liveness, false,
......
...@@ -111,43 +111,5 @@ void StubCache::Clear() { ...@@ -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 internal
} // namespace v8 } // namespace v8
...@@ -45,9 +45,6 @@ class StubCache { ...@@ -45,9 +45,6 @@ class StubCache {
Object* Get(Name* name, Map* map); Object* Get(Name* name, Map* map);
// Clear the lookup table (@ mark compact collection). // Clear the lookup table (@ mark compact collection).
void Clear(); 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 }; enum Table { kPrimary, kSecondary };
......
...@@ -388,8 +388,7 @@ void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackSlot slot, ...@@ -388,8 +388,7 @@ void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackSlot slot,
receiver_types->Clear(); receiver_types->Clear();
if (!slot.IsInvalid()) { if (!slot.IsInvalid()) {
LoadICNexus nexus(feedback_vector_, slot); LoadICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes(isolate()->load_stub_cache(), &nexus, name, CollectReceiverTypes(&nexus, receiver_types);
receiver_types);
} }
} }
...@@ -412,8 +411,8 @@ void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackSlot slot, ...@@ -412,8 +411,8 @@ void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackSlot slot,
Handle<Name> name, Handle<Name> name,
SmallMapList* receiver_types) { SmallMapList* receiver_types) {
receiver_types->Clear(); receiver_types->Clear();
CollectReceiverTypes(isolate()->store_stub_cache(), slot, name, StoreICNexus nexus(feedback_vector_, slot);
receiver_types); CollectReceiverTypes(&nexus, receiver_types);
} }
void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( void TypeFeedbackOracle::KeyedAssignmentReceiverTypes(
...@@ -430,27 +429,6 @@ void TypeFeedbackOracle::CountReceiverTypes(FeedbackSlot slot, ...@@ -430,27 +429,6 @@ void TypeFeedbackOracle::CountReceiverTypes(FeedbackSlot slot,
if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); 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, void TypeFeedbackOracle::CollectReceiverTypes(FeedbackSlot slot,
SmallMapList* types) { SmallMapList* types) {
FeedbackSlotKind kind = feedback_vector_->GetKind(slot); FeedbackSlotKind kind = feedback_vector_->GetKind(slot);
...@@ -468,21 +446,14 @@ void TypeFeedbackOracle::CollectReceiverTypes(FeedbackSlot slot, ...@@ -468,21 +446,14 @@ void TypeFeedbackOracle::CollectReceiverTypes(FeedbackSlot slot,
void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus, void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus,
SmallMapList* types) { SmallMapList* types) {
MapHandleList maps; MapHandleList maps;
if (nexus->ic_state() == MONOMORPHIC) { if (nexus->ExtractMaps(&maps) == 0) {
Map* map = nexus->FindFirstMap();
if (map != NULL) maps.Add(handle(map));
} else if (nexus->ic_state() == POLYMORPHIC) {
nexus->FindAllMaps(&maps);
} else {
return; return;
} }
types->Reserve(maps.length(), zone()); types->Reserve(maps.length(), zone());
for (int i = 0; i < maps.length(); i++) { 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 { ...@@ -58,13 +58,6 @@ class TypeFeedbackOracle: public ZoneObject {
void CollectReceiverTypes(FeedbackSlot slot, SmallMapList* types); void CollectReceiverTypes(FeedbackSlot slot, SmallMapList* types);
void CollectReceiverTypes(FeedbackNexus* nexus, 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<JSFunction> GetCallTarget(FeedbackSlot slot);
Handle<AllocationSite> GetCallAllocationSite(FeedbackSlot slot); Handle<AllocationSite> GetCallAllocationSite(FeedbackSlot slot);
Handle<JSFunction> GetCallNewTarget(FeedbackSlot slot); Handle<JSFunction> GetCallNewTarget(FeedbackSlot slot);
...@@ -91,11 +84,6 @@ class TypeFeedbackOracle: public ZoneObject { ...@@ -91,11 +84,6 @@ class TypeFeedbackOracle: public ZoneObject {
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
private: 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 // Returns true if there is at least one string map and if
// all maps are string maps. // all maps are string maps.
bool HasOnlyStringMaps(SmallMapList* receiver_types); bool HasOnlyStringMaps(SmallMapList* receiver_types);
......
...@@ -350,7 +350,7 @@ TEST(VectorLoadICStates) { ...@@ -350,7 +350,7 @@ TEST(VectorLoadICStates) {
CompileRun("f({ blarg: 3, torino: 10, foo: 2 })"); CompileRun("f({ blarg: 3, torino: 10, foo: 2 })");
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps; MapHandleList maps;
nexus.FindAllMaps(&maps); nexus.ExtractMaps(&maps);
CHECK_EQ(4, maps.length()); CHECK_EQ(4, maps.length());
// Finally driven megamorphic. // Finally driven megamorphic.
...@@ -429,7 +429,7 @@ TEST(VectorLoadICOnSmi) { ...@@ -429,7 +429,7 @@ TEST(VectorLoadICOnSmi) {
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps; MapHandleList maps;
nexus.FindAllMaps(&maps); nexus.ExtractMaps(&maps);
CHECK_EQ(2, maps.length()); CHECK_EQ(2, maps.length());
// One of the maps should be the o map. // One of the maps should be the o map.
...@@ -452,7 +452,7 @@ TEST(VectorLoadICOnSmi) { ...@@ -452,7 +452,7 @@ TEST(VectorLoadICOnSmi) {
CompileRun("f(100)"); CompileRun("f(100)");
CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
MapHandleList maps2; MapHandleList maps2;
nexus.FindAllMaps(&maps2); nexus.ExtractMaps(&maps2);
CHECK_EQ(2, maps2.length()); 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