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

Unified Diff: src/mark-compact.cc

Issue 10837037: Age code to allow reclaiming old unexecuted functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 3 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/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 7c03a49e8536a4ace1e0e4aaa73eddeb22031a08..ab73e6979dcd19c16ddcd8042016a743accd6864 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -62,6 +62,7 @@ MarkCompactCollector::MarkCompactCollector() : // NOLINT
sweep_precisely_(false),
reduce_memory_footprint_(false),
abort_incremental_marking_(false),
+ marking_parity_(ODD_MARKING_PARITY),
compacting_(false),
was_marked_incrementally_(false),
tracer_(NULL),
@@ -398,6 +399,13 @@ void MarkCompactCollector::CollectGarbage() {
Finish();
+ if (marking_parity_ == EVEN_MARKING_PARITY) {
+ marking_parity_ = ODD_MARKING_PARITY;
+ } else {
+ ASSERT(marking_parity_ == ODD_MARKING_PARITY);
+ marking_parity_ = EVEN_MARKING_PARITY;
+ }
+
tracer_ = NULL;
}
@@ -1193,32 +1201,13 @@ class MarkCompactMarkingVisitor
inline static bool IsFlushable(Heap* heap, JSFunction* function) {
SharedFunctionInfo* shared_info = function->unchecked_shared();
- // Code is either on stack, in compilation cache or referenced
- // 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);
- }
- return false;
- }
-
- // We do not flush code for optimized functions.
- if (function->code() != shared_info->code()) {
- return false;
- }
-
- return IsFlushable(heap, shared_info);
+ // Old code gets flushed if its shared_info is also flushable
+ return function->code()->IsOld() && IsFlushable(heap, shared_info);
Michael Starzinger 2012/10/02 14:58:59 See comment below.
danno 2012/10/25 10:07:23 Done.
}
inline static bool IsFlushable(Heap* heap, SharedFunctionInfo* shared_info) {
- // Code is either on stack, in compilation cache or referenced
- // by optimized version of function.
- MarkBit code_mark =
- Marking::MarkBitFrom(shared_info->code());
- if (code_mark.Get()) {
- return false;
- }
+ // Code that is not old is not flushable.
+ if (!shared_info->code()->IsOld()) return false;
Michael Starzinger 2012/10/02 14:58:59 1) We shouldn't remove the check for the marking b
danno 2012/10/25 10:07:23 Done.
// The function must be compiled and have the source code available,
// to be able to recompile it in case we need the function again.
@@ -1247,12 +1236,6 @@ class MarkCompactMarkingVisitor
return false;
}
- // 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;
}
@@ -1412,8 +1395,8 @@ class MarkCompactMarkingVisitor
Code* code = jsfunction->shared()->code();
MarkBit code_mark = Marking::MarkBitFrom(code);
collector->MarkObject(code, code_mark);
-
if (jsfunction->code()->kind() == Code::OPTIMIZED_FUNCTION) {
+ code->MakeYoung();
collector->MarkInlinedFunctionsCode(jsfunction->code());
}
}
@@ -2730,6 +2713,14 @@ class PointersUpdatingVisitor: public ObjectVisitor {
rinfo->set_target_address(Code::cast(target)->instruction_start());
}
+ void VisitCodeAgeSequence(RelocInfo* rinfo) {
+ ASSERT(RelocInfo::IsCodeAgeSequence(rinfo->rmode()));
+ Object* stub = rinfo->code_age_stub();
+ ASSERT(stub != NULL);
+ VisitPointer(&stub);
+ rinfo->set_code_age_stub(Code::cast(stub));
+ }
+
void VisitDebugTarget(RelocInfo* rinfo) {
ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) &&
rinfo->IsPatchedReturnSequence()) ||
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698