Commit 4cc4e580 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

Revert "[LayoutNG] Heap allocate algorithms to save stack space."

This reverts commit ba345fef.

Reason for revert: Now that win32 stack has increased to 1.5MB[1] we
can reclaim perf. and revert this change.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1682227

Original change's description:
> [LayoutNG] Heap allocate algorithms to save stack space.
> 
> This moves NGLayoutAlgorithm onto the heap using partition alloc.
> 
> This (in mac-64bit) reduces the stack space from 1392 -> 864 bytes
> which is the same as legacy.
> 
> From pinpoint data, this only seems to have a slight performance
> regression.
> 
> A follow up patch will be sent so which performs a refactoring, so that
> this patch can be a simple cherry pick with the beta branch.
> 
> Bug: 977387
> Change-Id: I75a5b995b26c60e69976f41876cea192bc761486
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1669917
> Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
> Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#672086}

TBR=cbiesinger@chromium.org,ikilpatrick@chromium.org,mstensho@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 977387
Change-Id: I694977bee640df021f79f0926e5da723d6f2b911
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1692239Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675732}
parent 9f2ffa6f
...@@ -106,7 +106,7 @@ struct NGInlineBoxState { ...@@ -106,7 +106,7 @@ struct NGInlineBoxState {
// 2) Performs layout when the positin/size of a box was computed. // 2) Performs layout when the positin/size of a box was computed.
// 3) Cache common values for a box. // 3) Cache common values for a box.
class CORE_EXPORT NGInlineLayoutStateStack { class CORE_EXPORT NGInlineLayoutStateStack {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
// The box state for the line box. // The box state for the line box.
......
...@@ -18,7 +18,7 @@ class NGInlineItem; ...@@ -18,7 +18,7 @@ class NGInlineItem;
// Because this context is in initial state for when fragmentation occurs and // Because this context is in initial state for when fragmentation occurs and
// some other cases, do not add things that are too expensive to rebuild. // some other cases, do not add things that are too expensive to rebuild.
class NGInlineChildLayoutContext { class NGInlineChildLayoutContext {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
// Returns the NGInlineLayoutStateStack in this context. // Returns the NGInlineLayoutStateStack in this context.
......
...@@ -24,7 +24,7 @@ class NGInlineBreakToken; ...@@ -24,7 +24,7 @@ class NGInlineBreakToken;
class CORE_EXPORT NGLineBoxFragmentBuilder final class CORE_EXPORT NGLineBoxFragmentBuilder final
: public NGContainerFragmentBuilder { : public NGContainerFragmentBuilder {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
NGLineBoxFragmentBuilder(NGInlineNode node, NGLineBoxFragmentBuilder(NGInlineNode node,
...@@ -173,7 +173,7 @@ class CORE_EXPORT NGLineBoxFragmentBuilder final ...@@ -173,7 +173,7 @@ class CORE_EXPORT NGLineBoxFragmentBuilder final
// Unlike the fragment builder, chlidren are mutable. // Unlike the fragment builder, chlidren are mutable.
// Callers can add to the fragment builder in a batch once finalized. // Callers can add to the fragment builder in a batch once finalized.
class ChildList { class ChildList {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
ChildList() = default; ChildList() = default;
......
...@@ -66,8 +66,8 @@ inline LayoutMultiColumnFlowThread* GetFlowThread(const LayoutBox& box) { ...@@ -66,8 +66,8 @@ inline LayoutMultiColumnFlowThread* GetFlowThread(const LayoutBox& box) {
template <typename Algorithm, typename Callback> template <typename Algorithm, typename Callback>
NOINLINE void CreateAlgorithmAndRun(const NGLayoutAlgorithmParams& params, NOINLINE void CreateAlgorithmAndRun(const NGLayoutAlgorithmParams& params,
const Callback& callback) { const Callback& callback) {
std::unique_ptr<Algorithm> algorithm = std::make_unique<Algorithm>(params); Algorithm algorithm(params);
callback(algorithm.get()); callback(&algorithm);
} }
template <typename Callback> template <typename Callback>
......
...@@ -28,7 +28,7 @@ class NGExclusionSpace; ...@@ -28,7 +28,7 @@ class NGExclusionSpace;
class NGPhysicalFragment; class NGPhysicalFragment;
class CORE_EXPORT NGContainerFragmentBuilder : public NGFragmentBuilder { class CORE_EXPORT NGContainerFragmentBuilder : public NGFragmentBuilder {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
struct ChildWithOffset { struct ChildWithOffset {
......
...@@ -20,7 +20,7 @@ namespace blink { ...@@ -20,7 +20,7 @@ namespace blink {
class LayoutObject; class LayoutObject;
class CORE_EXPORT NGFragmentBuilder { class CORE_EXPORT NGFragmentBuilder {
DISALLOW_NEW(); STACK_ALLOCATED();
public: public:
const ComputedStyle& Style() const { const ComputedStyle& Style() const {
......
...@@ -63,8 +63,7 @@ template <typename NGInputNodeType, ...@@ -63,8 +63,7 @@ template <typename NGInputNodeType,
typename NGBoxFragmentBuilderType, typename NGBoxFragmentBuilderType,
typename NGBreakTokenType> typename NGBreakTokenType>
class CORE_EXPORT NGLayoutAlgorithm : public NGLayoutAlgorithmOperations { class CORE_EXPORT NGLayoutAlgorithm : public NGLayoutAlgorithmOperations {
USING_FAST_MALLOC(NGLayoutAlgorithm); STACK_ALLOCATED();
public: public:
NGLayoutAlgorithm(NGInputNodeType node, NGLayoutAlgorithm(NGInputNodeType node,
scoped_refptr<const ComputedStyle> style, scoped_refptr<const ComputedStyle> style,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment