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

Unified Diff: src/objects-visiting-inl.h

Issue 10837037: Age code to allow reclaiming old unexecuted functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Nits Created 8 years, 2 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
Index: src/objects-visiting-inl.h
diff --git a/src/objects-visiting-inl.h b/src/objects-visiting-inl.h
index d698a8df06f95a548b8da3b246f78a62cd3ddc01..1594377f4203a762736d6c8c1c087e068dedd2b8 100644
--- a/src/objects-visiting-inl.h
+++ b/src/objects-visiting-inl.h
@@ -225,6 +225,17 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(
template<typename StaticVisitor>
+void StaticMarkingVisitor<StaticVisitor>::VisitCodeAgeSequence(
+ Heap* heap, RelocInfo* rinfo) {
+ ASSERT(RelocInfo::IsCodeAgeSequence(rinfo->rmode()));
+ Code* target = rinfo->code_age_stub();
+ ASSERT(target != NULL);
+ heap->mark_compact_collector()->RecordRelocSlot(rinfo, target);
+ StaticVisitor::MarkObject(heap, target);
+}
+
+
+template<typename StaticVisitor>
void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext(
Map* map, HeapObject* object) {
FixedBodyVisitor<StaticVisitor,
@@ -277,6 +288,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCode(
code->ClearTypeFeedbackCells(heap);
}
code->CodeIterateBody<StaticVisitor>(heap);
+ if (FLAG_age_code && !Serializer::enabled()) {
Michael Starzinger 2012/11/02 15:29:34 Technically it shouldn't make any difference in th
danno 2012/11/09 13:05:30 Done.
+ code->MakeOlder(heap->mark_compact_collector()->marking_parity());
+ }
}
@@ -449,8 +463,10 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
// by optimized version of function.
MarkBit code_mark = Marking::MarkBitFrom(function->code());
if (code_mark.Get()) {
- if (!Marking::MarkBitFrom(shared_info).Get()) {
- shared_info->set_code_age(0);
+ if (!FLAG_age_code) {
+ if (!Marking::MarkBitFrom(shared_info).Get()) {
+ shared_info->set_code_age(0);
+ }
}
return false;
}
@@ -460,12 +476,16 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
return false;
}
- // We do not flush code for optimized functions.
- if (function->code() != shared_info->code()) {
- return false;
- }
+ if (FLAG_age_code) {
+ return function->code()->IsOld() && IsFlushable(heap, shared_info);
Michael Starzinger 2012/11/02 15:29:34 We cannot yet flush optimized code because they ar
danno 2012/11/09 13:05:30 Done.
+ } else {
+ // We do not flush code for optimized functions.
+ if (function->code() != shared_info->code()) {
+ return false;
+ }
- return IsFlushable(heap, shared_info);
+ return IsFlushable(heap, shared_info);
+ }
}
@@ -506,20 +526,20 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
return false;
}
- // TODO(mstarzinger): The following will soon be replaced by a new way of
- // aging code, that is based on an aging stub in the function prologue.
-
- // How many collections newly compiled code object will survive before being
- // flushed.
- static const int kCodeAgeThreshold = 5;
-
- // Age this shared function info.
- if (shared_info->code_age() < kCodeAgeThreshold) {
- shared_info->set_code_age(shared_info->code_age() + 1);
- return false;
+ if (FLAG_age_code) {
+ return shared_info->code()->IsOld();
+ } else {
+ // How many collections newly compiled code object will survive before being
+ // flushed.
+ static const int kCodeAgeThreshold = 5;
+
+ // Age this shared function info.
+ if (shared_info->code_age() < kCodeAgeThreshold) {
+ shared_info->set_code_age(shared_info->code_age() + 1);
+ return false;
+ }
+ return true;
}
-
- return true;
}
« src/mark-compact.cc ('K') | « src/objects-visiting.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698