Bug 233335 - CellAttributes should be returned by value.
Summary: CellAttributes should be returned by value.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks: 232849
  Show dependency treegraph
 
Reported: 2021-11-18 14:32 PST by Mark Lam
Modified: 2021-11-18 16:23 PST (History)
8 users (show)

See Also:


Attachments
[fast-cq] proposed patch. (6.61 KB, patch)
2021-11-18 14:40 PST, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 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.
Comment 1 Radar WebKit Bug Importer 2021-11-18 14:33:43 PST
<rdar://problem/85568435>
Comment 2 Mark Lam 2021-11-18 14:40:24 PST
Created attachment 444741 [details]
[fast-cq] proposed patch.
Comment 3 Yusuke Suzuki 2021-11-18 14:52:31 PST
Comment on attachment 444741 [details]
[fast-cq] proposed patch.

r=me
Comment 4 Mark Lam 2021-11-18 15:07:25 PST
Comment on attachment 444741 [details]
[fast-cq] proposed patch.

Thanks for the review.
Comment 5 EWS 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].
Comment 6 Darin Adler 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.
Comment 7 Mark Lam 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.
Comment 8 Mark Lam 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.