RESOLVED FIXED 233335
CellAttributes should be returned by value.
https://bugs.webkit.org/show_bug.cgi?id=233335
Summary CellAttributes should be returned by value.
Mark Lam
Reported 2021-11-18 14:32:30 PST
CellAttributes fits in 16 bits, and client code never modifies returned CellAttributes values. Hence, there is no reason to return them by reference.
Attachments
[fast-cq] proposed patch. (6.61 KB, patch)
2021-11-18 14:40 PST, Mark Lam
no flags
Radar WebKit Bug Importer
Comment 1 2021-11-18 14:33:43 PST
Mark Lam
Comment 2 2021-11-18 14:40:24 PST
Created attachment 444741 [details] [fast-cq] proposed patch.
Yusuke Suzuki
Comment 3 2021-11-18 14:52:31 PST
Comment on attachment 444741 [details] [fast-cq] proposed patch. r=me
Mark Lam
Comment 4 2021-11-18 15:07:25 PST
Comment on attachment 444741 [details] [fast-cq] proposed patch. Thanks for the review.
EWS
Comment 5 2021-11-18 15:09:16 PST
Committed r286033 (244421@main): <https://commits.webkit.org/244421@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 444741 [details].
Darin Adler
Comment 6 2021-11-18 15:38:50 PST
Comment on attachment 444741 [details] [fast-cq] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=444741&action=review > Source/JavaScriptCore/heap/BlockDirectory.h:77 > + const CellAttributes attributes() const { return m_attributes; } The const here in "const CellAttributes" doesn't provide much value, and should be removed. Same in all the other sites below. When returning a scalar, specifying const has almost no effect. We don’t label functions that return an int as returning a "const int". > Source/JavaScriptCore/heap/MarkedBlock.h:350 > + const CellAttributes attributes() const; Ditto.
Mark Lam
Comment 7 2021-11-18 16:05:25 PST
(In reply to Darin Adler from comment #6) > Comment on attachment 444741 [details] > [fast-cq] proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=444741&action=review > > > Source/JavaScriptCore/heap/BlockDirectory.h:77 > > + const CellAttributes attributes() const { return m_attributes; } > > The const here in "const CellAttributes" doesn't provide much value, and > should be removed. Same in all the other sites below. When returning a > scalar, specifying const has almost no effect. We don’t label functions that > return an int as returning a "const int". > > > Source/JavaScriptCore/heap/MarkedBlock.h:350 > > + const CellAttributes attributes() const; > > Ditto. I'll take care of this in an upcoming patch.
Mark Lam
Comment 8 2021-11-18 16:23:07 PST
(In reply to Mark Lam from comment #7) > (In reply to Darin Adler from comment #6) > > > Source/JavaScriptCore/heap/BlockDirectory.h:77 > > > + const CellAttributes attributes() const { return m_attributes; } > > > > The const here in "const CellAttributes" doesn't provide much value, and > > should be removed. Same in all the other sites below. When returning a > > scalar, specifying const has almost no effect. We don’t label functions that > > return an int as returning a "const int". > > I'll take care of this in an upcoming patch. Fixing this in https://bugs.webkit.org/show_bug.cgi?id=233341.
Note You need to log in before you can comment on or make changes to this bug.