RESOLVED FIXED 91759
Web Inspector: count RenderStyle objects in the native memory profiler
https://bugs.webkit.org/show_bug.cgi?id=91759
Summary Web Inspector: count RenderStyle objects in the native memory profiler
Alexei Filippov
Reported 2012-07-19 10:47:45 PDT
EOM
Attachments
Patch (10.26 KB, patch)
2012-07-19 10:53 PDT, Alexei Filippov
no flags
Patch (10.70 KB, patch)
2012-07-20 03:52 PDT, Alexei Filippov
no flags
Patch (13.05 KB, patch)
2012-07-20 04:29 PDT, Alexei Filippov
no flags
Patch (13.03 KB, patch)
2012-07-23 11:18 PDT, Alexei Filippov
yurys: review-
Patch (13.64 KB, patch)
2012-07-26 11:32 PDT, Alexei Filippov
no flags
Patch (14.37 KB, patch)
2012-07-30 04:47 PDT, Alexei Filippov
no flags
Patch (14.34 KB, patch)
2012-07-30 05:34 PDT, Alexei Filippov
no flags
Patch (14.71 KB, patch)
2012-07-30 06:50 PDT, Alexei Filippov
no flags
Patch (18.11 KB, patch)
2012-07-31 06:59 PDT, Alexei Filippov
no flags
Patch (19.09 KB, patch)
2012-08-01 06:46 PDT, Alexei Filippov
no flags
Patch (19.18 KB, patch)
2012-08-01 07:02 PDT, Alexei Filippov
no flags
Patch (19.20 KB, patch)
2012-08-01 07:05 PDT, Alexei Filippov
no flags
Patch (16.66 KB, patch)
2012-08-02 03:49 PDT, Alexei Filippov
no flags
Alexei Filippov
Comment 1 2012-07-19 10:53:41 PDT
Early Warning System Bot
Comment 2 2012-07-19 11:13:00 PDT
Build Bot
Comment 3 2012-07-19 11:20:28 PDT
Build Bot
Comment 4 2012-07-19 11:22:26 PDT
Early Warning System Bot
Comment 5 2012-07-19 12:32:55 PDT
Gyuyoung Kim
Comment 6 2012-07-19 13:29:32 PDT
Pavel Feldman
Comment 7 2012-07-20 02:23:36 PDT
Comment on attachment 153306 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153306&action=review > Source/WebCore/rendering/style/RenderStyle.cpp:1492 > + MemoryClassInfo<RenderStyle> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); Please do not submit additional instrumentation until we find a way to maintain it.
Alexei Filippov
Comment 8 2012-07-20 03:52:19 PDT
Alexei Filippov
Comment 9 2012-07-20 04:29:16 PDT
Alexei Filippov
Comment 10 2012-07-20 04:29:52 PDT
Comment on attachment 153306 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153306&action=review >> Source/WebCore/rendering/style/RenderStyle.cpp:1492 >> + MemoryClassInfo<RenderStyle> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); > > Please do not submit additional instrumentation until we find a way to maintain it. Done
Pavel Feldman
Comment 11 2012-07-20 04:46:33 PDT
Comment on attachment 153479 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153479&action=review > Source/WebCore/rendering/style/RenderStyle.cpp:1490 > +struct InstrumentedRenderStyle : public RefCounted<InstrumentedRenderStyle> { I like the approach, but it puts additional burden to the developers. We need to agree on the approach in webkit-dev prior to proceeding.
Alexei Filippov
Comment 12 2012-07-23 11:18:27 PDT
Yury Semikhatsky
Comment 13 2012-07-26 07:21:03 PDT
Comment on attachment 153820 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153820&action=review > Source/WebCore/rendering/style/RenderStyle.cpp:1507 > + COMPILE_ASSERT(sizeof(RenderStyle) == sizeof(InstrumentedRenderStyle), reportMemoryUsage_may_need_an_update); Let's remove such checks as there were objections against the approach on webkit-dev. The validation tool that Ilya has been working on should give us enough confidence in the instrumentation code correctness.
Alexei Filippov
Comment 14 2012-07-26 07:35:39 PDT
Comment on attachment 153820 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153820&action=review >> Source/WebCore/rendering/style/RenderStyle.cpp:1507 >> + COMPILE_ASSERT(sizeof(RenderStyle) == sizeof(InstrumentedRenderStyle), reportMemoryUsage_may_need_an_update); > > Let's remove such checks as there were objections against the approach on webkit-dev. The validation tool that Ilya has been working on should give us enough confidence in the instrumentation code correctness. Ok. These checks are absent in the previous patch.
Ilya Tikhonovsky
Comment 15 2012-07-26 09:07:43 PDT
Comment on attachment 153471 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153471&action=review > Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:300 > + info.addMember(m_flexibleBox.get()); > + info.addMember(m_marquee.get()); > + info.addMember(m_multiCol.get()); > + info.addMember(m_transform.get()); please remove .get() everywhere and create a specialization of addMember for OwnPtr and RefPtr
Yury Semikhatsky
Comment 16 2012-07-26 10:55:54 PDT
Comment on attachment 153471 [details] Patch r- per Ilya's comment.
Alexei Filippov
Comment 17 2012-07-26 11:32:06 PDT
Alexei Filippov
Comment 18 2012-07-26 11:32:50 PDT
Comment on attachment 153471 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153471&action=review >> Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:300 >> + info.addMember(m_transform.get()); > > please remove .get() everywhere > and create a specialization of addMember for OwnPtr and RefPtr Done
Ilya Tikhonovsky
Comment 19 2012-07-26 13:33:08 PDT
Comment on attachment 154702 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=154702&action=review > Source/WebCore/dom/MemoryInstrumentation.h:119 > + template <typename T> > + struct OwningTraits<RefPtr<T> > { > + static void addInstrumentedMember(MemoryInstrumentation* instrumentation, const RefPtr<T>& t) { instrumentation->addInstrumentedMember(t.get()); } > + static void addMember(MemoryInstrumentation* instrumentation, const RefPtr<T>& t, MemoryInstrumentation::ObjectType objectType) { instrumentation->addMember(t.get(), objectType); } > + }; > + > template <typename T> void addInstrumentedMemberImpl(const T* const&, OwningType); > template <typename T> void addInstrumentedMemberImpl(const OwnPtr<T>* const& object, MemoryInstrumentation::OwningType owningType) { addInstrumentedMemberImpl(object->get(), owningType); } > template <typename T> void addInstrumentedMemberImpl(const RefPtr<T>* const& object, MemoryInstrumentation::OwningType owningType) { addInstrumentedMemberImpl(object->get(), owningType); } It would be simpler to add 'template <typename T> void addMemberImpl(const RefPtr<T>* const& object,.....' as I've done for the instrumented members. It'd cost us only 3 loc. and one line for the instrumented DataRef<T> > Source/WebCore/dom/Node.cpp:2804 > +struct InstrumentedNode : public EventTarget, public ScriptWrappable, public TreeShared<Node, ContainerNode> { > + uint32_t flags; > + void* ptrs[4]; > +}; > + please remove this. > Source/WebCore/dom/Node.cpp:2807 > + COMPILE_ASSERT(sizeof(Node) == sizeof(InstrumentedNode), reportMemoryUsage_may_need_an_update); ditto
Build Bot
Comment 20 2012-07-26 15:14:55 PDT
Build Bot
Comment 21 2012-07-27 11:39:11 PDT
Alexei Filippov
Comment 22 2012-07-30 04:47:29 PDT
Alexei Filippov
Comment 23 2012-07-30 04:50:36 PDT
Comment on attachment 154702 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=154702&action=review > Source/WebCore/dom/MemoryInstrumentation.h:119 > template <typename T> void addInstrumentedMemberImpl(const RefPtr<T>* const& object, MemoryInstrumentation::OwningType owningType) { addInstrumentedMemberImpl(object->get(), owningType); } done >> Source/WebCore/dom/Node.cpp:2804 >> + > > please remove this. done >> Source/WebCore/dom/Node.cpp:2807 >> + COMPILE_ASSERT(sizeof(Node) == sizeof(InstrumentedNode), reportMemoryUsage_may_need_an_update); > > ditto done
Build Bot
Comment 24 2012-07-30 05:15:38 PDT
Build Bot
Comment 25 2012-07-30 05:26:01 PDT
Alexei Filippov
Comment 26 2012-07-30 05:34:52 PDT
Ilya Tikhonovsky
Comment 27 2012-07-30 06:02:52 PDT
Comment on attachment 155270 [details] Patch lgtm
Alexei Filippov
Comment 28 2012-07-30 06:50:45 PDT
Alexei Filippov
Comment 29 2012-07-30 06:51:19 PDT
rebaselined
Yury Semikhatsky
Comment 30 2012-07-30 23:19:44 PDT
Comment on attachment 155282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155282&action=review > Source/WebCore/ChangeLog:6 > + Reviewed by NOBODY (OOPS!). Please provide a brief description of the patch. > Source/WebCore/dom/MemoryInstrumentation.h:34 > +#include "DataRef.h" This way we will include Source/WebCore/rendering/style/DataRef.h into other parts of WebCore. Can we avoid this? > Source/WebCore/dom/MemoryInstrumentation.h:35 > +#include <stdio.h> Revert this. > Source/WebCore/rendering/style/RenderStyle.cpp:1504 > + info.addVector(*m_cachedPseudoStyles); This call will not add sizeof(Vector). One way to fix this would be adding of a specialization for Vector* I think it would make sense as I faced similar problem while instrumenting StylePropertySet.
Alexei Filippov
Comment 31 2012-07-31 06:59:53 PDT
Alexei Filippov
Comment 32 2012-07-31 07:01:22 PDT
Comment on attachment 155282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155282&action=review >> Source/WebCore/ChangeLog:6 >> + Reviewed by NOBODY (OOPS!). > > Please provide a brief description of the patch. done >> Source/WebCore/dom/MemoryInstrumentation.h:34 >> +#include "DataRef.h" > > This way we will include Source/WebCore/rendering/style/DataRef.h into other parts of WebCore. Can we avoid this? done >> Source/WebCore/dom/MemoryInstrumentation.h:35 >> +#include <stdio.h> > > Revert this. oops. done. >> Source/WebCore/rendering/style/RenderStyle.cpp:1504 >> + info.addVector(*m_cachedPseudoStyles); > > This call will not add sizeof(Vector). One way to fix this would be adding of a specialization for Vector* I think it would make sense as I faced similar problem while instrumenting StylePropertySet. fixed.
Alexei Filippov
Comment 33 2012-08-01 06:46:41 PDT
Alexei Filippov
Comment 34 2012-08-01 06:47:10 PDT
rebaselined
Yury Semikhatsky
Comment 35 2012-08-01 06:48:08 PDT
Comment on attachment 155798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155798&action=review > Source/WebCore/dom/MemoryInstrumentation.h:132 > + template <typename T> void addObjectImpl(const DataRef<T>* const& object, ObjectType objectType, OwningType) { addObjectImpl(object->get(), objectType, byPointer); } How does this compile given that you only have a forward declaration of DataRef?
Alexei Filippov
Comment 36 2012-08-01 06:50:33 PDT
Comment on attachment 155798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155798&action=review >> Source/WebCore/dom/MemoryInstrumentation.h:132 >> + template <typename T> void addObjectImpl(const DataRef<T>* const& object, ObjectType objectType, OwningType) { addObjectImpl(object->get(), objectType, byPointer); } > > How does this compile given that you only have a forward declaration of DataRef? At the place of template instantiation DataRef definition should be available.
Yury Semikhatsky
Comment 37 2012-08-01 06:57:21 PDT
Comment on attachment 155798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155798&action=review > Source/WebCore/dom/MemoryInstrumentation.h:286 > + if (!vector || visited(vector)) We should keep the old check in addition to the new one: visited(vector->data()) as several vectors may share same buffer.
Alexei Filippov
Comment 38 2012-08-01 07:02:38 PDT
Alexei Filippov
Comment 39 2012-08-01 07:03:12 PDT
Comment on attachment 155798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155798&action=review >> Source/WebCore/dom/MemoryInstrumentation.h:286 >> + if (!vector || visited(vector)) > > We should keep the old check in addition to the new one: visited(vector->data()) as several vectors may share same buffer. ok
Alexei Filippov
Comment 40 2012-08-01 07:05:58 PDT
Yury Semikhatsky
Comment 41 2012-08-01 23:16:39 PDT
Comment on attachment 155805 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155805&action=review > Source/WebCore/dom/MemoryInstrumentation.h:286 > + if (!vector || visited(vector) || !vector->data() || visited(vector->data())) I think we should return immediately if (!vector || visited(vector)) but otherwise even if vector->data() is already visited it would make sense to add size of Vector itself if it is referenced by a pointer.
Alexei Filippov
Comment 42 2012-08-02 03:49:23 PDT
Alexei Filippov
Comment 43 2012-08-02 03:50:45 PDT
Comment on attachment 155805 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155805&action=review + rebaselining >> Source/WebCore/dom/MemoryInstrumentation.h:286 >> + if (!vector || visited(vector) || !vector->data() || visited(vector->data())) > > I think we should return immediately if (!vector || visited(vector)) > but otherwise even if vector->data() is already visited it would make > sense to add size of Vector itself if it is referenced by a pointer. removed this part from the patch.
WebKit Review Bot
Comment 44 2012-08-02 07:15:16 PDT
Comment on attachment 156030 [details] Patch Clearing flags on attachment: 156030 Committed r124452: <http://trac.webkit.org/changeset/124452>
WebKit Review Bot
Comment 45 2012-08-02 07:15:25 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.