author | Xidorn Quan <me@upsuper.org> |
Thu, 15 Mar 2018 11:59:22 +1100 | |
changeset 448512 | ab2df71dc9dea2415da0970cecb3a83ea4a034ae |
parent 448511 | 94c9d05567db0432218dd9728012a067c1aa3517 |
child 448513 | 7701560f1b143a75a4fcda5111cf398319380012 |
push id | unknown |
push user | unknown |
push date | unknown |
reviewers | bholley |
bugs | 1444296 |
milestone | 61.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
|
--- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -63,16 +63,17 @@ #include "mozilla/Mutex.h" #include "mozilla/Preferences.h" #include "mozilla/ServoElementSnapshot.h" #include "mozilla/ServoRestyleManager.h" #include "mozilla/SizeOfState.h" #include "mozilla/StyleAnimationValue.h" #include "mozilla/SystemGroup.h" #include "mozilla/ServoMediaList.h" +#include "mozilla/ServoTraversalStatistics.h" #include "mozilla/Telemetry.h" #include "mozilla/RWLock.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h" #include "mozilla/dom/HTMLTableCellElement.h" #include "mozilla/dom/HTMLBodyElement.h" #include "mozilla/LookAndFeel.h" #include "mozilla/URLExtraData.h" @@ -92,16 +93,20 @@ using namespace mozilla::dom; RefPtr<type_> result; \ result.swap(mPtr); \ return result.forget(); \ } #include "mozilla/ServoArcTypeList.h" SERVO_ARC_TYPE(StyleContext, ServoStyleContext) #undef SERVO_ARC_TYPE +// Definitions of the global traversal stats. +bool ServoTraversalStatistics::sActive = false; +ServoTraversalStatistics ServoTraversalStatistics::sSingleton; + static RWLock* sServoFFILock = nullptr; static const nsFont* ThreadSafeGetDefaultFontHelper(const nsPresContext* aPresContext, nsAtom* aLanguage, uint8_t aGenericId) { bool needsCache = false;
--- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -71,16 +71,17 @@ headers = [ "mozilla/dom/ChildIterator.h", "mozilla/dom/NameSpaceConstants.h", "mozilla/LookAndFeel.h", "mozilla/StylePrefs.h", "mozilla/ServoBindings.h", "mozilla/ServoMediaList.h", "mozilla/ServoStyleContext.h", "mozilla/ServoDeclarationBlock.h", + "mozilla/ServoTraversalStatistics.h", "mozilla/SizeOfState.h", "nsCSSCounterStyleRule.h", "nsCSSFontFaceRule.h", "nsContentUtils.h", "nsNameSpaceManager.h", "nsMediaFeatures.h", "nsXBLBinding.h", ] @@ -225,16 +226,17 @@ whitelist-types = [ "mozilla::ComputedTimingFunction", "mozilla::ComputedTimingFunction::BeforeFlag", "mozilla::SeenPtrs", "mozilla::ServoElementSnapshot.*", "mozilla::ServoStyleContext", "mozilla::ServoStyleSheet", "mozilla::ServoStyleSheetInner", "mozilla::ServoStyleSetSizes", + "mozilla::ServoTraversalStatistics", "mozilla::CSSPseudoClassType", "mozilla::css::ErrorReporter", "mozilla::css::LoaderReusableStyleSheets", "mozilla::css::SheetLoadData", "mozilla::css::SheetParsingMode", "mozilla::css::URLMatchingFunction", "mozilla::dom::IterationCompositeOperation", "mozilla::dom::StyleChildrenIterator",
new file mode 100644 --- /dev/null +++ b/layout/style/ServoTraversalStatistics.h @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_ServoTraversalStatistics_h +#define mozilla_ServoTraversalStatistics_h + +#include <inttypes.h> + +namespace mozilla { + +// Traversal statistics for Servo traversal. +// +// See style::context::PerThreadTraversalStatistics for +// meaning of these fields. +struct ServoTraversalStatistics +{ + uint32_t mElementsTraversed = 0; + uint32_t mElementsStyled = 0; + uint32_t mElementsMatched = 0; + uint32_t mStylesShared = 0; + uint32_t mStylesReused = 0; + + static bool sActive; + static ServoTraversalStatistics sSingleton; +}; + +} // namespace mozilla + +#endif // mozilla_ServoTraversalStatistics_h
--- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -118,16 +118,17 @@ EXPORTS.mozilla += [ 'ServoPropPrefList.h', 'ServoSpecifiedValues.h', 'ServoStyleContext.h', 'ServoStyleContextInlines.h', 'ServoStyleRule.h', 'ServoStyleSet.h', 'ServoStyleSheet.h', 'ServoSupportsRule.h', + 'ServoTraversalStatistics.h', 'ServoTypes.h', 'ServoUtils.h', 'SheetType.h', 'StyleAnimationValue.h', 'StyleBackendType.h', 'StyleComplexColor.h', 'StylePrefs.h', 'StyleSetHandle.h',