RESOLVED FIXED204555
[JSC] Introduce IsoHeapCellType
https://bugs.webkit.org/show_bug.cgi?id=204555
Summary [JSC] Introduce IsoHeapCellType
Yusuke Suzuki
Reported 2019-11-24 04:21:30 PST
[JSC] Introduce IsoHeapCellType
Attachments
Patch (43.26 KB, patch)
2019-11-24 04:24 PST, Yusuke Suzuki
no flags
Patch (46.88 KB, patch)
2019-11-24 04:30 PST, Yusuke Suzuki
mark.lam: review+
Yusuke Suzuki
Comment 1 2019-11-24 04:24:26 PST
Yusuke Suzuki
Comment 2 2019-11-24 04:30:19 PST
Mark Lam
Comment 3 2019-11-24 09:49:59 PST
Comment on attachment 384252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384252&action=review Nice work. r=me with suggestions. > Source/JavaScriptCore/heap/IsoHeapCellType.h:35 > +class IsoHeapCellType final : public HeapCellType { > +public: > + IsoHeapCellType() > + : HeapCellType(CellAttributes(CellType::needsDestruction ? NeedsDestruction : DoesNotNeedDestruction, HeapCell::JSCell)) If I understand you correctly, you intend to only use IsoHeapCellType for destructible types, yes? Why not: 1. name it IsoHeapDestructibleCellType? 2. Always pass NeedsDestruction down to HeapCellType constructor here? 3. static_assert(CellType::needsDestruction)? > Source/JavaScriptCore/heap/IsoHeapCellType.h:53 > + DestroyFunc()(vm, cell); Why not just go direct to CellType::destroy(cell) here?
Yusuke Suzuki
Comment 4 2019-11-24 14:37:37 PST
Comment on attachment 384252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384252&action=review Thanks! >> Source/JavaScriptCore/heap/IsoHeapCellType.h:35 >> + : HeapCellType(CellAttributes(CellType::needsDestruction ? NeedsDestruction : DoesNotNeedDestruction, HeapCell::JSCell)) > > If I understand you correctly, you intend to only use IsoHeapCellType for destructible types, yes? Why not: > 1. name it IsoHeapDestructibleCellType? > 2. Always pass NeedsDestruction down to HeapCellType constructor here? > 3. static_assert(CellType::needsDestruction)? Currently, I'm considering using this for all IsoSubspace types (or, merging it into IsoSubspace if possible). So for now, I would like to make it usable for non destructible cell type too. >> Source/JavaScriptCore/heap/IsoHeapCellType.h:53 >> + DestroyFunc()(vm, cell); > > Why not just go direct to CellType::destroy(cell) here? It is OK too. Changed.
Yusuke Suzuki
Comment 5 2019-11-24 14:39:15 PST
Radar WebKit Bug Importer
Comment 6 2019-11-24 14:40:19 PST
Mark Lam
Comment 7 2019-11-24 15:09:42 PST
Comment on attachment 384252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384252&action=review >>> Source/JavaScriptCore/heap/IsoHeapCellType.h:35 >>> + : HeapCellType(CellAttributes(CellType::needsDestruction ? NeedsDestruction : DoesNotNeedDestruction, HeapCell::JSCell)) >> >> If I understand you correctly, you intend to only use IsoHeapCellType for destructible types, yes? Why not: >> 1. name it IsoHeapDestructibleCellType? >> 2. Always pass NeedsDestruction down to HeapCellType constructor here? >> 3. static_assert(CellType::needsDestruction)? > > Currently, I'm considering using this for all IsoSubspace types (or, merging it into IsoSubspace if possible). So for now, I would like to make it usable for non destructible cell type too. How is it possible to use this class for non-destructible cell types too given that instantiation of this class requires that the underlying CellType has a destroy() function? Or are you proposing to add no-op destroy() functions to all non-destructible cell types?
Yusuke Suzuki
Comment 8 2019-11-25 00:30:33 PST
Comment on attachment 384252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384252&action=review >>>> Source/JavaScriptCore/heap/IsoHeapCellType.h:35 >>>> + : HeapCellType(CellAttributes(CellType::needsDestruction ? NeedsDestruction : DoesNotNeedDestruction, HeapCell::JSCell)) >>> >>> If I understand you correctly, you intend to only use IsoHeapCellType for destructible types, yes? Why not: >>> 1. name it IsoHeapDestructibleCellType? >>> 2. Always pass NeedsDestruction down to HeapCellType constructor here? >>> 3. static_assert(CellType::needsDestruction)? >> >> Currently, I'm considering using this for all IsoSubspace types (or, merging it into IsoSubspace if possible). So for now, I would like to make it usable for non destructible cell type too. > > How is it possible to use this class for non-destructible cell types too given that instantiation of this class requires that the underlying CellType has a destroy() function? Or are you proposing to add no-op destroy() functions to all non-destructible cell types? JSCell class has destroy() function, which has RELEASE_ASSERT. So instantiating this works. And it is not called since DoesNotNeedDestruction is specified. So, IsoHeapCellType<NonDestructibleCell> just works.
Note You need to log in before you can comment on or make changes to this bug.