Bug 143942

Summary: Merge TreeShared into Node.
Product: WebKit Reporter: Andreas Kling <kling>
Component: WebCore Misc.Assignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, darin, esprehn+autocc, kangil.han, kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
darin: review+
Patch for landing none

Andreas Kling
Reported 2015-04-19 22:39:09 PDT
Node is the only remaining subclass of TreeShared. Let's just fold TreeShared into Node.
Attachments
Patch (13.36 KB, patch)
2015-04-19 22:49 PDT, Andreas Kling
darin: review+
Patch for landing (13.49 KB, patch)
2015-04-20 01:23 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2015-04-19 22:49:57 PDT
Darin Adler
Comment 2 2015-04-19 23:19:39 PDT
Comment on attachment 251143 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251143&action=review > Source/WebCore/dom/Node.h:545 > + void ref() > + { > + ASSERT(isMainThread()); > + ASSERT(!m_deletionHasBegun); > + ASSERT(!m_inRemovedLastRefFunction); > + ASSERT(!m_adoptionIsRequired); > + ++m_refCount; > + } These function bodies are kind of big. I’d rather see them at the end of the file, outside the class definition. Some day we have a chance of being able to read the class definition. > Source/WebCore/dom/Node.h:560 > + void deref() > + { > + ASSERT(isMainThread()); > + ASSERT(m_refCount >= 0); > + ASSERT(!m_deletionHasBegun); > + ASSERT(!m_inRemovedLastRefFunction); > + ASSERT(!m_adoptionIsRequired); > + if (--m_refCount <= 0 && !parentNode()) { > +#ifndef NDEBUG > + m_inRemovedLastRefFunction = true; > +#endif > + removedLastRef(); > + } > + } This one too. > Source/WebCore/dom/Node.h:567 > + bool hasOneRef() const > + { > + ASSERT(!m_deletionHasBegun); > + ASSERT(!m_inRemovedLastRefFunction); > + return m_refCount == 1; > + } Maybe even this one. > Source/WebCore/dom/Node.h:572 > + int refCount() const > + { > + return m_refCount; > + } Not sure about this one. Not sure why we even have it! > Source/WebCore/dom/Node.h:578 > +#ifndef NDEBUG > + bool m_deletionHasBegun { false }; > + bool m_inRemovedLastRefFunction { false }; > + bool m_adoptionIsRequired { true }; > +#endif Lame that these are public, but I guess that’s how we do it. > Source/WebCore/dom/Node.h:721 > + int m_refCount; How did you decide whether to put this before or after m_nodeFlags?
Andreas Kling
Comment 3 2015-04-20 01:22:44 PDT
(In reply to comment #2) > Comment on attachment 251143 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=251143&action=review > > > Source/WebCore/dom/Node.h:545 > > + void ref() > > + { > > + ASSERT(isMainThread()); > > + ASSERT(!m_deletionHasBegun); > > + ASSERT(!m_inRemovedLastRefFunction); > > + ASSERT(!m_adoptionIsRequired); > > + ++m_refCount; > > + } > > These function bodies are kind of big. I’d rather see them at the end of the > file, outside the class definition. Some day we have a chance of being able > to read the class definition. Sure thing, I'll pop them all out. > > Source/WebCore/dom/Node.h:721 > > + int m_refCount; > > How did you decide whether to put this before or after m_nodeFlags? I didn't think enough about this. I'll move it to before so the object layout matches what we had before the change.
Andreas Kling
Comment 4 2015-04-20 01:23:47 PDT
Created attachment 251153 [details] Patch for landing
WebKit Commit Bot
Comment 5 2015-04-20 02:19:32 PDT
Comment on attachment 251153 [details] Patch for landing Clearing flags on attachment: 251153 Committed r183009: <http://trac.webkit.org/changeset/183009>
WebKit Commit Bot
Comment 6 2015-04-20 02:19:36 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 8 2015-04-21 15:11:49 PDT
Really!? I wonder what happened.
Andreas Kling
Comment 9 2015-04-21 15:19:28 PDT
(In reply to comment #8) > Really!? I wonder what happened. I'll try to reproduce locally, but if there's indeed a problem, my guess would be failure to inline Node::ref() or Node::deref().
Andreas Kling
Comment 10 2015-04-23 02:08:36 PDT
The bug was that DOM nodes were no longer getting WTF_MAKE_FAST_ALLOCATED :| Fixed in <https://trac.webkit.org/r183183>
Darin Adler
Comment 11 2015-04-23 08:01:36 PDT
Wow, how did we miss that!? Did we also forget to make Node noncopyable, or was that handled some other way?
Chris Dumez
Comment 12 2015-04-23 09:33:49 PDT
(In reply to comment #10) > The bug was that DOM nodes were no longer getting WTF_MAKE_FAST_ALLOCATED :| > > Fixed in <https://trac.webkit.org/r183183> oh boy I'm glad the bots caught this :)
Note You need to log in before you can comment on or make changes to this bug.