Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: src/type-feedback-vector.cc

Issue 866493003: Retry "Use a WeakCell in the CallIC type vector." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/type-info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index 2316f2979951fa285e85eb5d50c72323fafc4856..bb22cac1e39113cae9a72afd727500064af26357 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -132,13 +132,9 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::Copy(
// This logic is copied from
// StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget.
-// TODO(mvstanton): with weak handling of all vector ics, this logic should
-// actually be completely eliminated and we no longer need to clear the
-// vector ICs.
-static bool ClearLogic(Heap* heap, int ic_age, Code::Kind kind,
- InlineCacheState state) {
+static bool ClearLogic(Heap* heap, int ic_age) {
if (FLAG_cleanup_code_caches_at_gc &&
- (kind == Code::CALL_IC || heap->flush_monomorphic_ics() ||
+ (heap->flush_monomorphic_ics() ||
// TODO(mvstanton): is this ic_age granular enough? it comes from
// the SharedFunctionInfo which may change on a different schedule
// than ic targets.
@@ -171,16 +167,22 @@ void TypeFeedbackVector::ClearSlots(SharedFunctionInfo* shared) {
}
}
}
+}
- slots = ICSlots();
- if (slots == 0) return;
- // Now clear vector-based ICs.
- // Try and pass the containing code (the "host").
- Heap* heap = isolate->heap();
- Code* host = shared->code();
+void TypeFeedbackVector::ClearICSlotsImpl(SharedFunctionInfo* shared,
+ bool force_clear) {
+ Heap* heap = GetIsolate()->heap();
+
// I'm not sure yet if this ic age is the correct one.
int ic_age = shared->ic_age();
+
+ if (!force_clear && !ClearLogic(heap, ic_age)) return;
+
+ int slots = ICSlots();
+ Code* host = shared->code();
+ Object* uninitialized_sentinel =
+ TypeFeedbackVector::RawUninitializedSentinel(heap);
for (int i = 0; i < slots; i++) {
FeedbackVectorICSlot slot(i);
Object* obj = Get(slot);
@@ -188,19 +190,13 @@ void TypeFeedbackVector::ClearSlots(SharedFunctionInfo* shared) {
Code::Kind kind = GetKind(slot);
if (kind == Code::CALL_IC) {
CallICNexus nexus(this, slot);
- if (ClearLogic(heap, ic_age, kind, nexus.StateFromFeedback())) {
- nexus.Clear(host);
- }
+ nexus.Clear(host);
} else if (kind == Code::LOAD_IC) {
LoadICNexus nexus(this, slot);
- if (ClearLogic(heap, ic_age, kind, nexus.StateFromFeedback())) {
- nexus.Clear(host);
- }
+ nexus.Clear(host);
} else if (kind == Code::KEYED_LOAD_IC) {
KeyedLoadICNexus nexus(this, slot);
- if (ClearLogic(heap, ic_age, kind, nexus.StateFromFeedback())) {
- nexus.Clear(host);
- }
+ nexus.Clear(host);
}
}
}
@@ -285,7 +281,7 @@ InlineCacheState CallICNexus::StateFromFeedback() const {
if (feedback == *vector()->MegamorphicSentinel(isolate)) {
return GENERIC;
- } else if (feedback->IsAllocationSite() || feedback->IsJSFunction()) {
+ } else if (feedback->IsAllocationSite() || feedback->IsWeakCell()) {
return MONOMORPHIC;
}
@@ -319,7 +315,8 @@ void CallICNexus::ConfigureUninitialized() {
void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) {
- SetFeedback(*function);
+ Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function);
+ SetFeedback(*new_cell);
}
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698