[heap] Fixes for Bitmap
Bug: chromium:651354 Change-Id: Ib384ca2d386421a0a466ef318b278f8fc677cdb2 Reviewed-on: https://chromium-review.googlesource.com/555172 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#46320}
This commit is contained in:
parent
039849478b
commit
5157325bae
@ -106,11 +106,15 @@ class ObjectMarking : public AllStatic {
|
||||
class MarkBitCellIterator {
|
||||
public:
|
||||
MarkBitCellIterator(MemoryChunk* chunk, MarkingState state) : chunk_(chunk) {
|
||||
last_cell_index_ = Bitmap::IndexToCell(Bitmap::CellAlignIndex(
|
||||
DCHECK(Bitmap::IsCellAligned(
|
||||
chunk_->AddressToMarkbitIndex(chunk_->area_start())));
|
||||
DCHECK(Bitmap::IsCellAligned(
|
||||
chunk_->AddressToMarkbitIndex(chunk_->area_end())));
|
||||
last_cell_index_ =
|
||||
Bitmap::IndexToCell(chunk_->AddressToMarkbitIndex(chunk_->area_end()));
|
||||
cell_base_ = chunk_->area_start();
|
||||
cell_index_ = Bitmap::IndexToCell(
|
||||
Bitmap::CellAlignIndex(chunk_->AddressToMarkbitIndex(cell_base_)));
|
||||
cell_index_ =
|
||||
Bitmap::IndexToCell(chunk_->AddressToMarkbitIndex(cell_base_));
|
||||
cells_ = state.bitmap()->cells();
|
||||
}
|
||||
|
||||
@ -119,14 +123,14 @@ class MarkBitCellIterator {
|
||||
inline bool HasNext() { return cell_index_ < last_cell_index_ - 1; }
|
||||
|
||||
inline MarkBit::CellType* CurrentCell() {
|
||||
DCHECK(cell_index_ == Bitmap::IndexToCell(Bitmap::CellAlignIndex(
|
||||
chunk_->AddressToMarkbitIndex(cell_base_))));
|
||||
DCHECK_EQ(cell_index_, Bitmap::IndexToCell(Bitmap::CellAlignIndex(
|
||||
chunk_->AddressToMarkbitIndex(cell_base_))));
|
||||
return &cells_[cell_index_];
|
||||
}
|
||||
|
||||
inline Address CurrentCellBase() {
|
||||
DCHECK(cell_index_ == Bitmap::IndexToCell(Bitmap::CellAlignIndex(
|
||||
chunk_->AddressToMarkbitIndex(cell_base_))));
|
||||
DCHECK_EQ(cell_index_, Bitmap::IndexToCell(Bitmap::CellAlignIndex(
|
||||
chunk_->AddressToMarkbitIndex(cell_base_))));
|
||||
return cell_base_;
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,7 @@ class V8_EXPORT_PRIVATE Bitmap {
|
||||
|
||||
int CellsCount() { return CellsForLength(kLength); }
|
||||
|
||||
static int SizeFor(int cells_count) {
|
||||
return sizeof(MarkBit::CellType) * cells_count;
|
||||
}
|
||||
|
||||
INLINE(static uint32_t IndexToCell(uint32_t index)) {
|
||||
V8_INLINE static uint32_t IndexToCell(uint32_t index) {
|
||||
return index >> kBitsPerCellLog2;
|
||||
}
|
||||
|
||||
@ -121,21 +117,20 @@ class V8_EXPORT_PRIVATE Bitmap {
|
||||
return index & kBitIndexMask;
|
||||
}
|
||||
|
||||
INLINE(static uint32_t CellToIndex(uint32_t index)) {
|
||||
return index << kBitsPerCellLog2;
|
||||
// Retrieves the cell containing the provided markbit index.
|
||||
V8_INLINE static uint32_t CellAlignIndex(uint32_t index) {
|
||||
return index & ~kBitIndexMask;
|
||||
}
|
||||
|
||||
INLINE(static uint32_t CellAlignIndex(uint32_t index)) {
|
||||
return (index + kBitIndexMask) & ~kBitIndexMask;
|
||||
V8_INLINE static bool IsCellAligned(uint32_t index) {
|
||||
return (index & kBitIndexMask) == 0;
|
||||
}
|
||||
|
||||
INLINE(MarkBit::CellType* cells()) {
|
||||
V8_INLINE MarkBit::CellType* cells() {
|
||||
return reinterpret_cast<MarkBit::CellType*>(this);
|
||||
}
|
||||
|
||||
INLINE(Address address()) { return reinterpret_cast<Address>(this); }
|
||||
|
||||
INLINE(static Bitmap* FromAddress(Address addr)) {
|
||||
V8_INLINE static Bitmap* FromAddress(Address addr) {
|
||||
return reinterpret_cast<Bitmap*>(addr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user