RESOLVED FIXED206321
Pass JSToken by const reference
https://bugs.webkit.org/show_bug.cgi?id=206321
Summary Pass JSToken by const reference
Jonathan Bedard
Reported 2020-01-15 15:42:52 PST
Simon shared shared a lgtm link, this was one of issues identified. The JSToken object is larger than the word size, so we should really be passing it by const reference, not by value. https://lgtm.com/projects/g/WebKit/webkit/?tag=&lang=cpp&mode=tree&ruleFocus=2163210742
Attachments
Patch (3.54 KB, patch)
2020-01-15 15:44 PST, Jonathan Bedard
no flags
Jonathan Bedard
Comment 1 2020-01-15 15:44:40 PST
Saam Barati
Comment 2 2020-01-15 17:11:18 PST
Comment on attachment 387859 [details] Patch This call site concerns me since m_token is a field that's updated as we parse more things pattern = createBindingPattern(context, kind, exportType, *m_token.m_data.ident, m_token, bindingContext, duplicateIdentifier);
Saam Barati
Comment 3 2020-01-16 00:20:03 PST
Comment on attachment 387859 [details] Patch Actually it looks like this function doesn’t lex, so we’re ok. Passing it by reference is ok since m_token won’t be updated Can you verify also that it doesn’t end up lexing? r=me
Jonathan Bedard
Comment 4 2020-01-16 07:54:06 PST
(In reply to Saam Barati from comment #3) > Comment on attachment 387859 [details] > Patch > > Actually it looks like this function doesn’t lex, so we’re ok. Passing it by > reference is ok since m_token won’t be updated > > Can you verify also that it doesn’t end up lexing? > > r=me It does not lex. And reading through what the function is doing, seems like it shouldn't be lexing in the future either, although this change would sort of force that on us.
WebKit Commit Bot
Comment 5 2020-01-16 10:14:17 PST
Comment on attachment 387859 [details] Patch Clearing flags on attachment: 387859 Committed r254689: <https://trac.webkit.org/changeset/254689>
WebKit Commit Bot
Comment 6 2020-01-16 10:14:19 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2020-01-16 10:15:13 PST
Note You need to log in before you can comment on or make changes to this bug.