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; |
} |