Bug 1384669: Reduce refcount churn in BidiParagraphData by using non-refcounted pointer hash keys. r=jfkthame
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 26 Jul 2017 12:47:53 -0700
changeset 422256 702f9dbca19f3a8f31b628909fa4f75001a2f184
parent 422255 e68cb2040ee39bc0240a0f27b2bae1cf9f9dbb20
child 422257 d9e5fd58d089cbf9504cdd510d8a7fb31a8e46ea
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1384669
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384669: Reduce refcount churn in BidiParagraphData by using non-refcounted pointer hash keys. r=jfkthame We don't need to bother with refcounting for these pointers, because they're pointing to DOM elements, and the DOM is basically immutable during reflow. And BidiParagraphData is a stack-only class which only lives for a short period of reflow - so it can assume these pointers' targets will stick around for its whole life. MozReview-Commit-ID: J3SfRYoRweX
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -11,16 +11,17 @@
 #include "nsFontMetrics.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsBidiUtils.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsContainerFrame.h"
 #include "nsInlineFrame.h"
 #include "nsPlaceholderFrame.h"
+#include "nsPointerHashKeys.h"
 #include "nsFirstLetterFrame.h"
 #include "nsUnicodeProperties.h"
 #include "nsTextFrame.h"
 #include "nsBlockFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsStyleStructInlines.h"
 #include "RubyUtils.h"
 #include "nsRubyFrame.h"
@@ -127,17 +128,18 @@ GetBidiControl(nsStyleContext* aStyleCon
 }
 
 struct MOZ_STACK_CLASS BidiParagraphData
 {
   nsAutoString        mBuffer;
   AutoTArray<char16_t, 16> mEmbeddingStack;
   AutoTArray<nsIFrame*, 16> mLogicalFrames;
   AutoTArray<nsLineBox*, 16> mLinePerFrame;
-  nsDataHashtable<nsISupportsHashKey, int32_t> mContentToFrameIndex;
+  nsDataHashtable<nsPtrHashKey<const nsIContent>, int32_t>
+    mContentToFrameIndex;
   // Cached presentation context for the frames we're processing.
   nsPresContext*      mPresContext;
   bool                mIsVisual;
   bool                mRequiresBidi;
   nsBidiLevel         mParaLevel;
   nsIContent*         mPrevContent;
   nsIFrame*           mPrevFrame;
 #ifdef DEBUG