Bug 146556 - Drop RefPtr::clear() method
Summary: Drop RefPtr::clear() method
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 12:39 PDT by Chris Dumez
Modified: 2015-07-04 12:43 PDT (History)
5 users (show)

See Also:


Attachments
WIP Patch (79.19 KB, patch)
2015-07-02 12:41 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (79.80 KB, patch)
2015-07-02 13:02 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (80.48 KB, patch)
2015-07-02 13:14 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (105.03 KB, patch)
2015-07-02 13:54 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (163.25 KB, patch)
2015-07-03 19:09 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (175.97 KB, patch)
2015-07-03 19:36 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (177.09 KB, patch)
2015-07-03 20:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (177.72 KB, patch)
2015-07-03 20:36 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (178.59 KB, patch)
2015-07-03 20:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (178.98 KB, patch)
2015-07-03 20:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (180.05 KB, patch)
2015-07-03 21:05 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (180.89 KB, patch)
2015-07-03 21:22 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (181.50 KB, patch)
2015-07-03 21:28 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (170.38 KB, patch)
2015-07-03 21:36 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (173.58 KB, patch)
2015-07-03 23:34 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-07-02 12:39:43 PDT
Drop RefPtr::clear() method as we are instructing people to use "= nullptr" pattern instead.
Comment 1 Chris Dumez 2015-07-02 12:41:03 PDT
Created attachment 256024 [details]
WIP Patch
Comment 2 Chris Dumez 2015-07-02 13:02:54 PDT
Created attachment 256026 [details]
WIP Patch
Comment 3 Chris Dumez 2015-07-02 13:14:49 PDT
Created attachment 256027 [details]
WIP Patch
Comment 4 Chris Dumez 2015-07-02 13:54:17 PDT
Created attachment 256031 [details]
Patch
Comment 5 Brady Eidson 2015-07-02 14:20:38 PDT
I think this is a super great thing to do, and even started poking around it myself.

I did notice that the mechanics behind operator=(T*) and .clear() are subtly different, and I wasn't able to immediately convince myself there was 0-risk of a change in performance characteristics.

I brought this up to Chris on IRC, and I believe he's digging in more detail.
Comment 6 Darin Adler 2015-07-02 14:27:34 PDT
If there is any performance cost to using operator= we can overload it for std::nullptr_t.
Comment 7 Chris Dumez 2015-07-02 14:28:55 PDT
(In reply to comment #6)
> If there is any performance cost to using operator= we can overload it for
> std::nullptr_t.

Right. I'll benchmark locally to confirm if there is a noticeable performance difference between clear() and our current operator=(T*).
Comment 8 Chris Dumez 2015-07-03 19:09:38 PDT
Created attachment 256126 [details]
WIP Patch
Comment 9 WebKit Commit Bot 2015-07-03 19:12:40 PDT
Attachment 256126 [details] did not pass style-queue:


ERROR: Source/WebKit/Storage/StorageAreaSync.cpp:91:  One space before end of line comments  [whitespace/comments] [5]
Total errors found: 1 in 187 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Chris Dumez 2015-07-03 19:36:37 PDT
Created attachment 256127 [details]
Patch
Comment 11 Chris Dumez 2015-07-03 20:13:58 PDT
Created attachment 256129 [details]
Patch
Comment 12 Chris Dumez 2015-07-03 20:36:29 PDT
Created attachment 256130 [details]
Patch
Comment 13 Chris Dumez 2015-07-03 20:40:43 PDT
Created attachment 256131 [details]
Patch
Comment 14 Chris Dumez 2015-07-03 20:52:39 PDT
Created attachment 256132 [details]
Patch
Comment 15 Chris Dumez 2015-07-03 21:05:06 PDT
Created attachment 256133 [details]
Patch
Comment 16 Chris Dumez 2015-07-03 21:22:45 PDT
Created attachment 256134 [details]
Patch
Comment 17 Chris Dumez 2015-07-03 21:28:15 PDT
Created attachment 256135 [details]
Patch
Comment 18 Chris Dumez 2015-07-03 21:36:34 PDT
Created attachment 256136 [details]
Patch
Comment 19 Brady Eidson 2015-07-03 22:19:37 PDT
GETTING SO CLOSE!

Damned Windows build!
Comment 20 Chris Dumez 2015-07-03 22:21:33 PDT
(In reply to comment #19)
> GETTING SO CLOSE!
> 
> Damned Windows build!

No no, the Windows EWS issue is unrelated :) The patch is ready.
Comment 21 Brady Eidson 2015-07-03 23:11:03 PDT
Really?

https://webkit-queues.appspot.com/results/5659624707457024

c:\cygwin\home\buildbot\webkit\source\webcore\dom\Position.h(95): error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj]
c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(115): error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj]
c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(117): error C2593: 'operator =' is ambiguous (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj]

etc etc.
Comment 22 Chris Dumez 2015-07-03 23:17:30 PDT
(In reply to comment #21)
> Really?
> 
> https://webkit-queues.appspot.com/results/5659624707457024
> 
> c:\cygwin\home\buildbot\webkit\source\webcore\dom\Position.h(95): error
> C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>'
> (..\page\win\EventHandlerWin.cpp)
> [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.
> vcxproj]
> c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(115):
> error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>'
> (..\page\win\EventHandlerWin.cpp)
> [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.
> vcxproj]
> c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(117):
> error C2593: 'operator =' is ambiguous (..\page\win\EventHandlerWin.cpp)
> [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.
> vcxproj]
> 
> etc etc.

Weird, I missed those when I looked. I'll fix them, thanks.
Comment 23 Chris Dumez 2015-07-03 23:34:17 PDT
Created attachment 256139 [details]
Patch
Comment 24 Brady Eidson 2015-07-04 08:08:29 PDT
Comment on attachment 256139 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256139&action=review

> Source/JavaScriptCore/parser/Parser.cpp:494
> +        lastPattern = TreeDestructuringPattern(0);

Is this one necessary?

> Source/JavaScriptCore/parser/Parser.cpp:897
> +            pattern = TreeDestructuringPattern(0);

Or this one?
Comment 25 Brady Eidson 2015-07-04 08:09:19 PDT
Comment on attachment 256139 [details]
Patch

r+ but please make sure it won't break anything else.
Comment 26 Chris Dumez 2015-07-04 09:17:50 PDT
(In reply to comment #24)
> Comment on attachment 256139 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=256139&action=review
> 
> > Source/JavaScriptCore/parser/Parser.cpp:494
> > +        lastPattern = TreeDestructuringPattern(0);
> 
> Is this one necessary?
> 
> > Source/JavaScriptCore/parser/Parser.cpp:897
> > +            pattern = TreeDestructuringPattern(0);
> 
> Or this one?

The reason I did this is because the functions are templated and depending on the template parameter, lastPattern / pattern can be either an int or a RefPtr. Therefore, using eight "= 0;" or "= nullptr;" wouldn't build. Calling the TreeDestructuringPattern constructor explicitly is the simplest workaround I found.
Comment 27 Chris Dumez 2015-07-04 12:43:21 PDT
Comment on attachment 256139 [details]
Patch

Clearing flags on attachment: 256139

Committed r186279: <http://trac.webkit.org/changeset/186279>
Comment 28 Chris Dumez 2015-07-04 12:43:29 PDT
All reviewed patches have been landed.  Closing bug.