Reviewers: Vyacheslav Egorov,

Description:
Simplify the write barrier.

Please review this at http://codereview.chromium.org/8537014/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/incremental-marking.cc
  M     src/mark-compact-inl.h
  M     src/mark-compact.cc
  M     src/spaces.h


Index: src/incremental-marking.cc
===================================================================
--- src/incremental-marking.cc  (revision 9979)
+++ src/incremental-marking.cc  (working copy)
@@ -223,12 +223,7 @@
   INLINE(void MarkObject(Object* obj)) {
     HeapObject* heap_object = HeapObject::cast(obj);
     MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
-    if (mark_bit.data_only()) {
-      if (incremental_marking_->MarkBlackOrKeepGrey(mark_bit)) {
-        MemoryChunk::IncrementLiveBytes(heap_object->address(),
-                                        heap_object->Size());
-      }
-    } else if (Marking::IsWhite(mark_bit)) {
+    if (Marking::IsWhite(mark_bit)) {
       incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
     }
   }
@@ -261,15 +256,8 @@

     HeapObject* heap_object = HeapObject::cast(obj);
     MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
-    if (mark_bit.data_only()) {
-      if (incremental_marking_->MarkBlackOrKeepGrey(mark_bit)) {
-          MemoryChunk::IncrementLiveBytes(heap_object->address(),
-                                          heap_object->Size());
-      }
-    } else {
-      if (Marking::IsWhite(mark_bit)) {
-        incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
-      }
+    if (Marking::IsWhite(mark_bit)) {
+      incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
     }
   }

Index: src/mark-compact-inl.h
===================================================================
--- src/mark-compact-inl.h      (revision 9979)
+++ src/mark-compact-inl.h      (working copy)
@@ -39,8 +39,7 @@

 MarkBit Marking::MarkBitFrom(Address addr) {
   MemoryChunk* p = MemoryChunk::FromAddress(addr);
-  return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr),
-                                         p->ContainsOnlyData());
+  return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr));
 }


Index: src/mark-compact.cc
===================================================================
--- src/mark-compact.cc (revision 9979)
+++ src/mark-compact.cc (working copy)
@@ -1742,7 +1742,7 @@
int trailing_zeros = CompilerIntrinsics::CountTrailingZeros(grey_objects);
       grey_objects >>= trailing_zeros;
       offset += trailing_zeros;
-      MarkBit markbit(&cells[cell_index], 1 << offset, false);
+      MarkBit markbit(&cells[cell_index], 1 << offset);
       ASSERT(Marking::IsGrey(markbit));
       Marking::GreyToBlack(markbit);
       Address addr = cell_base + offset * kPointerSize;
Index: src/spaces.h
===================================================================
--- src/spaces.h        (revision 9979)
+++ src/spaces.h        (working copy)
@@ -124,8 +124,8 @@
  public:
   typedef uint32_t CellType;

-  inline MarkBit(CellType* cell, CellType mask, bool data_only)
-      : cell_(cell), mask_(mask), data_only_(data_only) { }
+  inline MarkBit(CellType* cell, CellType mask)
+      : cell_(cell), mask_(mask) { }

   inline CellType* cell() { return cell_; }
   inline CellType mask() { return mask_; }
@@ -140,25 +140,18 @@
   inline bool Get() { return (*cell_ & mask_) != 0; }
   inline void Clear() { *cell_ &= ~mask_; }

-  inline bool data_only() { return data_only_; }
-
   inline MarkBit Next() {
     CellType new_mask = mask_ << 1;
     if (new_mask == 0) {
-      return MarkBit(cell_ + 1, 1, data_only_);
+      return MarkBit(cell_ + 1, 1);
     } else {
-      return MarkBit(cell_, new_mask, data_only_);
+      return MarkBit(cell_, new_mask);
     }
   }

  private:
   CellType* cell_;
   CellType mask_;
-  // This boolean indicates that the object is in a data-only space with no
-  // pointers.  This enables some optimizations when marking.
-  // It is expected that this field is inlined and turned into control flow
-  // at the place where the MarkBit object is created.
-  bool data_only_;
 };


@@ -214,10 +207,10 @@
     return reinterpret_cast<Bitmap*>(addr);
   }

-  inline MarkBit MarkBitFromIndex(uint32_t index, bool data_only = false) {
+  inline MarkBit MarkBitFromIndex(uint32_t index) {
     MarkBit::CellType mask = 1 << (index & kBitIndexMask);
     MarkBit::CellType* cell = this->cells() + (index >> kBitsPerCellLog2);
-    return MarkBit(cell, mask, data_only);
+    return MarkBit(cell, mask);
   }

   static inline void Clear(MemoryChunk* chunk);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to