Reviewers: Hannes Payer,
Description:
[heap] Make the Marking class all static.
[email protected]
Please review this at https://codereview.chromium.org/1269313003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -15 lines):
M src/heap/heap.h
M src/heap/heap.cc
M src/heap/mark-compact.h
M src/heap/mark-compact.cc
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
4647157e8e3443275064997d92c326207fe297cc..88843e9b1d81273898e80f461cf011eac55fe1d0
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -136,7 +136,6 @@ Heap::Heap()
last_gc_time_(0.0),
mark_compact_collector_(this),
store_buffer_(this),
- marking_(this),
incremental_marking_(this),
memory_reducer_(this),
full_codegen_bytes_generated_(0),
@@ -3787,7 +3786,7 @@ FixedArrayBase*
Heap::LeftTrimFixedArray(FixedArrayBase* object,
FixedArrayBase::cast(HeapObject::FromAddress(new_start));
// Maintain consistency of live bytes during incremental marking
- marking()->TransferMark(object->address(), new_start);
+ Marking::TransferMark(this, object->address(), new_start);
AdjustLiveBytes(new_object, -bytes_to_trim, Heap::CONCURRENT_TO_SWEEPER);
// Notify the heap profiler of change in object layout.
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index
6666b2c8238189ccfe269a8616c660550a69fe6a..2ac562fb22829d1ddc869a095963f4c22389adfd
100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1426,8 +1426,6 @@ class Heap {
StoreBuffer* store_buffer() { return &store_buffer_; }
- Marking* marking() { return &marking_; }
-
IncrementalMarking* incremental_marking() { return
&incremental_marking_; }
ExternalStringTable* external_string_table() {
@@ -2300,8 +2298,6 @@ class Heap {
StoreBuffer store_buffer_;
- Marking marking_;
-
IncrementalMarking incremental_marking_;
GCIdleTimeHandler gc_idle_time_handler_;
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
ec2e18e5ffd3366a5d69b9585cad95f615efc217..b9259a0a0af7f87cf08e7fa6920af52fd44947ed
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -588,12 +588,12 @@ void MarkCompactCollector::RefillFreeList(PagedSpace*
space) {
}
-void Marking::TransferMark(Address old_start, Address new_start) {
+void Marking::TransferMark(Heap* heap, Address old_start, Address
new_start) {
// This is only used when resizing an object.
DCHECK(MemoryChunk::FromAddress(old_start) ==
MemoryChunk::FromAddress(new_start));
- if (!heap_->incremental_marking()->IsMarking()) return;
+ if (!heap->incremental_marking()->IsMarking()) return;
// If the mark doesn't move, we don't check the color of the object.
// It doesn't matter whether the object is black, since it hasn't changed
@@ -613,9 +613,9 @@ void Marking::TransferMark(Address old_start, Address
new_start) {
return;
} else if (Marking::IsGrey(old_mark_bit)) {
Marking::GreyToWhite(old_mark_bit);
- heap_->incremental_marking()->WhiteToGreyAndPush(
+ heap->incremental_marking()->WhiteToGreyAndPush(
HeapObject::FromAddress(new_start), new_mark_bit);
- heap_->incremental_marking()->RestartIfNotMarking();
+ heap->incremental_marking()->RestartIfNotMarking();
}
#ifdef DEBUG
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index
d78e9bddee44b0f2a1b396e49a4bd90f60bd20d7..9ae01fbe4ae22d1934a8090021354fb68a382374
100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -26,10 +26,8 @@ class MarkingVisitor;
class RootMarkingVisitor;
-class Marking {
+class Marking : public AllStatic {
public:
- explicit Marking(Heap* heap) : heap_(heap) {}
-
INLINE(static MarkBit MarkBitFrom(Address addr));
INLINE(static MarkBit MarkBitFrom(HeapObject* obj)) {
@@ -120,7 +118,7 @@ class Marking {
static void ClearAllMarkBitsOfCellsContainedInRange(MarkBit start,
MarkBit end);
- void TransferMark(Address old_start, Address new_start);
+ static void TransferMark(Heap* heap, Address old_start, Address
new_start);
#ifdef DEBUG
enum ObjectColor {
@@ -174,7 +172,7 @@ class Marking {
}
private:
- Heap* heap_;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Marking);
};
//
----------------------------------------------------------------------------
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.