| Index: src/incremental-marking.h
|
| diff --git a/src/incremental-marking.h b/src/incremental-marking.h
|
| index 98a87e0bd83f5b9c9d157ab34a89e4c92a101833..d6d829e13b9a35b4d3b13d176a2cb02386bc8aae 100644
|
| --- a/src/incremental-marking.h
|
| +++ b/src/incremental-marking.h
|
| @@ -58,6 +58,10 @@ class IncrementalMarking : public AllStatic {
|
|
|
| static void Stop();
|
|
|
| + static void PrepareForScavenge();
|
| +
|
| + static void UpdateMarkingStackAfterScavenge();
|
| +
|
| static void Hurry();
|
|
|
| static void Finalize();
|
| @@ -84,7 +88,7 @@ class IncrementalMarking : public AllStatic {
|
| if (IsWhite(value_bit)) {
|
| MarkBit obj_bit = Marking::MarkBitFrom(obj);
|
| if (IsBlack(obj_bit)) {
|
| - BlackToGrey(obj, obj_bit);
|
| + BlackToGreyAndPush(obj, obj_bit);
|
| RestartIfNotMarking();
|
| }
|
| }
|
| @@ -95,7 +99,7 @@ class IncrementalMarking : public AllStatic {
|
| if (state_ != STOPPED) {
|
| MarkBit value_bit = Marking::MarkBitFrom(value);
|
| if (IsWhite(value_bit)) {
|
| - WhiteToGrey(value, value_bit);
|
| + WhiteToGreyAndPush(value, value_bit);
|
| RestartIfNotMarking();
|
| }
|
| }
|
| @@ -106,7 +110,7 @@ class IncrementalMarking : public AllStatic {
|
| if (!IsStopped()) {
|
| MarkBit obj_bit = Marking::MarkBitFrom(obj);
|
| if (IsBlack(obj_bit)) {
|
| - BlackToGrey(obj, obj_bit);
|
| + BlackToGreyAndPush(obj, obj_bit);
|
| RestartIfNotMarking();
|
| }
|
| }
|
| @@ -135,7 +139,7 @@ class IncrementalMarking : public AllStatic {
|
| return mark_bit.Get() && mark_bit.Next().Get();
|
| }
|
|
|
| - static inline void BlackToGrey(HeapObject* obj, MarkBit mark_bit) {
|
| + static inline void BlackToGreyAndPush(HeapObject* obj, MarkBit mark_bit) {
|
| ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
|
| ASSERT(obj->Size() >= 2*kPointerSize);
|
| ASSERT(!IsStopped());
|
| @@ -147,6 +151,12 @@ class IncrementalMarking : public AllStatic {
|
| ASSERT(!marking_stack_.overflowed());
|
| }
|
|
|
| + static inline void WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) {
|
| + WhiteToGrey(obj, mark_bit);
|
| + marking_stack_.Push(obj);
|
| + ASSERT(!marking_stack_.overflowed());
|
| + }
|
| +
|
| static inline void WhiteToGrey(HeapObject* obj, MarkBit mark_bit) {
|
| ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
|
| ASSERT(obj->Size() >= 2*kPointerSize);
|
| @@ -155,9 +165,6 @@ class IncrementalMarking : public AllStatic {
|
| mark_bit.Set();
|
| mark_bit.Next().Set();
|
| ASSERT(IsGrey(mark_bit));
|
| -
|
| - marking_stack_.Push(obj);
|
| - ASSERT(!marking_stack_.overflowed());
|
| }
|
|
|
| static inline void MarkBlack(MarkBit mark_bit) {
|
| @@ -174,6 +181,22 @@ class IncrementalMarking : public AllStatic {
|
| return "???";
|
| }
|
|
|
| + enum ObjectColor {
|
| + BLACK_OBJECT,
|
| + WHITE_OBJECT,
|
| + GREY_OBJECT,
|
| + IMPOSSIBLE_COLOR
|
| + };
|
| +
|
| + static inline ObjectColor Color(HeapObject* obj) {
|
| + MarkBit mark_bit = Marking::MarkBitFrom(obj);
|
| + if (IsBlack(mark_bit)) return BLACK_OBJECT;
|
| + if (IsWhite(mark_bit)) return WHITE_OBJECT;
|
| + if (IsGrey(mark_bit)) return GREY_OBJECT;
|
| + UNREACHABLE();
|
| + return IMPOSSIBLE_COLOR;
|
| + }
|
| +
|
| private:
|
| static State state_;
|
| static MarkingStack marking_stack_;
|
|
|