Commit e9d9c388 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Reorder members of NGConstraintSpace to reduce size

This patch reorders members of NGConstraintSpace so that
value (non-class/struct) members are placed at the end.

Due to byte-align, it reduces the size from 96 bytes to
88 bytes on x64.

Bug: 635619
Change-Id: I7d9471343f3c16d91f7534fd98e2b95f1d18f8c5
Reviewed-on: https://chromium-review.googlesource.com/c/1314070Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604994}
parent 2e274a5c
......@@ -20,11 +20,11 @@ namespace {
struct SameSizeAsNGConstraintSpace {
NGLogicalSize logical_sizes[3];
NGPhysicalSize physical_sizes[1];
LayoutUnit layout_units[3];
NGMarginStrut margin_strut;
NGBfcOffset bfc_offset;
NGExclusionSpace exclusion_space;
base::Optional<LayoutUnit> optional_layout_unit;
LayoutUnit layout_units[3];
unsigned flags[1];
};
......@@ -41,22 +41,22 @@ NGConstraintSpace::NGConstraintSpace(WritingMode out_writing_mode,
replaced_percentage_resolution_size_(
builder.replaced_percentage_resolution_size_),
initial_containing_block_size_(builder.initial_containing_block_size_),
margin_strut_(is_new_fc ? NGMarginStrut() : builder.margin_strut_),
bfc_offset_(is_new_fc ? NGBfcOffset() : builder.bfc_offset_),
floats_bfc_block_offset_(is_new_fc ? base::nullopt
: builder.floats_bfc_block_offset_),
fragmentainer_block_size_(builder.fragmentainer_block_size_),
fragmentainer_space_at_bfc_start_(
builder.fragmentainer_space_at_bfc_start_),
clearance_offset_(is_new_fc ? LayoutUnit::Min()
: builder.clearance_offset_),
block_direction_fragmentation_type_(builder.fragmentation_type_),
table_cell_child_layout_phase_(builder.table_cell_child_layout_phase_),
adjoining_floats_(builder.adjoining_floats_),
writing_mode_(static_cast<unsigned>(out_writing_mode)),
direction_(static_cast<unsigned>(builder.text_direction_)),
flags_(builder.flags_),
baseline_requests_(builder.baseline_requests_.Serialize()),
margin_strut_(is_new_fc ? NGMarginStrut() : builder.margin_strut_),
bfc_offset_(is_new_fc ? NGBfcOffset() : builder.bfc_offset_),
floats_bfc_block_offset_(is_new_fc ? base::nullopt
: builder.floats_bfc_block_offset_),
clearance_offset_(is_new_fc ? LayoutUnit::Min()
: builder.clearance_offset_) {
baseline_requests_(builder.baseline_requests_.Serialize()) {
bool is_in_parallel_flow =
IsParallelWritingMode(builder.parent_writing_mode_, out_writing_mode);
......
......@@ -308,9 +308,17 @@ class CORE_EXPORT NGConstraintSpace final {
NGLogicalSize replaced_percentage_resolution_size_;
NGPhysicalSize initial_containing_block_size_;
NGMarginStrut margin_strut_;
NGBfcOffset bfc_offset_;
base::Optional<LayoutUnit> floats_bfc_block_offset_;
NGExclusionSpace exclusion_space_;
LayoutUnit fragmentainer_block_size_;
LayoutUnit fragmentainer_space_at_bfc_start_;
LayoutUnit clearance_offset_;
unsigned block_direction_fragmentation_type_ : 2;
unsigned table_cell_child_layout_phase_ : 2; // NGTableCellChildLayoutPhase
unsigned adjoining_floats_ : 2; // NGFloatTypes
......@@ -318,13 +326,6 @@ class CORE_EXPORT NGConstraintSpace final {
unsigned direction_ : 1;
unsigned flags_ : kNumberOfConstraintSpaceFlags; // ConstraintSpaceFlags
unsigned baseline_requests_ : NGBaselineRequestList::kSerializedBits;
NGMarginStrut margin_strut_;
NGBfcOffset bfc_offset_;
base::Optional<LayoutUnit> floats_bfc_block_offset_;
NGExclusionSpace exclusion_space_;
LayoutUnit clearance_offset_;
};
inline std::ostream& operator<<(std::ostream& stream,
......
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