Changeset 226725 in webkit for trunk/Source/JavaScriptCore/heap/IsoCellSetInlines.h
- Timestamp:
- Jan 10, 2018, 11:41:12 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/IsoCellSetInlines.h
r226667 r226725 79 79 } 80 80 81 template<typename Func>82 RefPtr<SharedTask<void(SlotVisitor&)>> IsoCellSet::forEachMarkedCellInParallel(const Func& func)83 {84 class Task : public SharedTask<void(SlotVisitor&)> {85 public:86 Task(IsoCellSet& set, const Func& func)87 : m_set(set)88 , m_blockSource(set.parallelNotEmptyMarkedBlockSource())89 , m_func(func)90 {91 }92 93 void run(SlotVisitor& visitor) override94 {95 while (MarkedBlock::Handle* handle = m_blockSource->run()) {96 size_t blockIndex = handle->index();97 auto* bits = m_set.m_bits[blockIndex].get();98 handle->forEachMarkedCell(99 [&] (size_t atomNumber, HeapCell* cell, HeapCell::Kind kind) -> IterationStatus {100 if (bits->get(atomNumber))101 m_func(visitor, cell, kind);102 return IterationStatus::Continue;103 });104 }105 }106 107 private:108 IsoCellSet& m_set;109 RefPtr<SharedTask<MarkedBlock::Handle*()>> m_blockSource;110 Func m_func;111 Lock m_lock;112 };113 114 return adoptRef(new Task(*this, func));115 }116 117 template<typename Func>118 void IsoCellSet::forEachLiveCell(const Func& func)119 {120 MarkedAllocator& allocator = m_subspace.m_allocator;121 m_blocksWithBits.forEachSetBit(122 [&] (size_t blockIndex) {123 MarkedBlock::Handle* block = allocator.m_blocks[blockIndex];124 125 // FIXME: We could optimize this by checking our bits before querying isLive.126 // OOPS! (need bug URL)127 auto* bits = m_bits[blockIndex].get();128 block->forEachLiveCell(129 [&] (size_t atomNumber, HeapCell* cell, HeapCell::Kind kind) -> IterationStatus {130 if (bits->get(atomNumber))131 func(cell, kind);132 return IterationStatus::Continue;133 });134 });135 }136 137 81 } // namespace JSC 138 82
Note:
See TracChangeset
for help on using the changeset viewer.