RESOLVED FIXED 182320
Canonicalize aquiring the JSCell lock.
https://bugs.webkit.org/show_bug.cgi?id=182320
Summary Canonicalize aquiring the JSCell lock.
Keith Miller
Reported 2018-01-30 21:23:36 PST
Canonicalize aquiring the JSCell lock.
Attachments
Patch (14.80 KB, patch)
2018-01-30 21:26 PST, Keith Miller
no flags
Patch (15.06 KB, patch)
2018-01-31 08:15 PST, Keith Miller
no flags
Patch (10.21 KB, patch)
2018-01-31 08:16 PST, Keith Miller
no flags
Patch (17.43 KB, patch)
2018-01-31 10:06 PST, Keith Miller
no flags
Patch (17.51 KB, patch)
2018-01-31 10:15 PST, Keith Miller
no flags
Keith Miller
Comment 1 2018-01-30 21:26:55 PST
Keith Miller
Comment 2 2018-01-31 08:15:46 PST
Keith Miller
Comment 3 2018-01-31 08:16:36 PST
Saam Barati
Comment 4 2018-01-31 09:15:50 PST
Comment on attachment 332763 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332763&action=review > Source/JavaScriptCore/runtime/JSCell.h:124 > + // It's also recommended that cells are locked with the holdJSCellLock() method to help keep Why not make those private and friend lockholder then? Or you could do what I suggest below and make these private and people can call lock/unlock on the wrapper type > Source/JavaScriptCore/runtime/JSCell.h:126 > + Locker<JSCell> holdJSCellLock() { return holdLock(*this); } Not in love with the name here. What if you had some method named “cellLock” and it returned to you some wrapper that exposes lock/unlock methods. You could do: auto locker = holdLock(cell->cellLock()) But I’m not sure if that’s much better
Keith Miller
Comment 5 2018-01-31 09:19:31 PST
Comment on attachment 332763 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332763&action=review >> Source/JavaScriptCore/runtime/JSCell.h:124 >> + // It's also recommended that cells are locked with the holdJSCellLock() method to help keep > > Why not make those private and friend lockholder then? Or you could do what I suggest below and make these private and people can call lock/unlock on the wrapper type You can't really do that. If you friend Locker then anyone can make a Locker that can lock a JSCell so we're in the same boat. You also can't make a subclass of Locker that you friend because the base class needs access to lock/unlock. >> Source/JavaScriptCore/runtime/JSCell.h:126 >> + Locker<JSCell> holdJSCellLock() { return holdLock(*this); } > > Not in love with the name here. What if you had some method named “cellLock” and it returned to you some wrapper that exposes lock/unlock methods. You could do: > auto locker = holdLock(cell->cellLock()) > But I’m not sure if that’s much better Yeah, I guess that's a bit better in that you can't just holdLock(cell).
Keith Miller
Comment 6 2018-01-31 10:06:20 PST
Keith Miller
Comment 7 2018-01-31 10:15:37 PST
Michael Saboff
Comment 8 2018-01-31 10:31:38 PST
Comment on attachment 332775 [details] Patch r=me after build failures.
Keith Miller
Comment 9 2018-01-31 10:32:36 PST
(In reply to Michael Saboff from comment #8) > Comment on attachment 332775 [details] > Patch > > r=me after build failures. Looks like ToT is broken...
WebKit Commit Bot
Comment 10 2018-01-31 10:57:18 PST
Comment on attachment 332775 [details] Patch Clearing flags on attachment: 332775 Committed r227906: <https://trac.webkit.org/changeset/227906>
WebKit Commit Bot
Comment 11 2018-01-31 10:57:20 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2018-01-31 11:00:32 PST
Saam Barati
Comment 13 2018-01-31 12:06:13 PST
Comment on attachment 332775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332775&action=review > Source/JavaScriptCore/runtime/JSCell.h:288 > +class JSCellLock : public JSCell { nice. This patch LGTM too. I think this API works out nicely.
Note You need to log in before you can comment on or make changes to this bug.