Chromium Code Reviews| Index: src/mark-compact.cc |
| diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
| index 7c03a49e8536a4ace1e0e4aaa73eddeb22031a08..2cd79bf4393ebb6930215e332b29a97bf6e9e1a1 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), |
|
Michael Starzinger
2012/09/21 09:43:19
The default should be NO_MARKING_PARITY I think.
danno
2012/10/25 10:07:23
Done.
|
| compacting_(false), |
| was_marked_incrementally_(false), |
| tracer_(NULL), |
| @@ -398,6 +399,13 @@ void MarkCompactCollector::CollectGarbage() { |
| Finish(); |
| + if (marking_parity_ == EVEN_MARKING_PARITY) { |
|
Michael Starzinger
2012/09/21 09:43:19
I think it would be safer to set the marking parit
danno
2012/10/25 10:07:23
Done.
|
| + 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); |
| } |
| 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; |
| // 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,15 @@ 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(); |
| + if (stub != NULL) { |
|
Michael Starzinger
2012/09/21 09:43:19
Can the stub really be NULL here? Shouldn't we onl
danno
2012/10/25 10:07:23
Done.
|
| + VisitPointer(&stub); |
| + rinfo->set_code_age_stub(Code::cast(stub)); |
| + } |
| + } |
| + |
| void VisitDebugTarget(RelocInfo* rinfo) { |
| ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
| rinfo->IsPatchedReturnSequence()) || |