Commit 51aa9fb7 authored by bratell@opera.com's avatar bratell@opera.com

Save some gcc footprint (15 KB) in ExplodedFrameState.

Inlining the assignment and copy constructor for a class
like ExplodedFrameState exploded the machine code in stl::vector.

gcc:
Total change: -14969 bytes
==========================
  2 added, totalling +504 bytes across 1 sources
  1 removed, totalling -3387 bytes across 1 sources
  0 added, totalling 0 bytes across 0 sources
  3 shrunk, for a net change of -12086 bytes (14716 bytes before, 2630 bytes after) across 2 sources

It also helps for clang which normally ignores programmers hints to inline anyway:
clang:
Total change: -918 bytes
========================
  1 added, totalling +263 bytes across 1 sources
  3 removed, totalling -1098 bytes across 2 sources
  2 grown, for a net change of +161 bytes (1822 bytes before, 1983 bytes after) across 1 sources
  1 shrunk, for a net change of -244 bytes (1401 bytes before, 1157 bytes after) across 1 sources

BUG=

Review URL: https://codereview.chromium.org/400923002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284424 0039d316-1c4b-4281-b951-d872f2087c98
parent d118ad7c
...@@ -696,9 +696,34 @@ ExplodedFrameState::ExplodedFrameState() ...@@ -696,9 +696,34 @@ ExplodedFrameState::ExplodedFrameState()
referrer_policy(blink::WebReferrerPolicyDefault) { referrer_policy(blink::WebReferrerPolicyDefault) {
} }
ExplodedFrameState::ExplodedFrameState(const ExplodedFrameState& other) {
assign(other);
}
ExplodedFrameState::~ExplodedFrameState() { ExplodedFrameState::~ExplodedFrameState() {
} }
void ExplodedFrameState::operator=(const ExplodedFrameState& other) {
if (&other != this)
assign(other);
}
void ExplodedFrameState::assign(const ExplodedFrameState& other) {
url_string = other.url_string;
referrer = other.referrer;
target = other.target;
state_object = other.state_object;
document_state = other.document_state;
pinch_viewport_scroll_offset = other.pinch_viewport_scroll_offset;
scroll_offset = other.scroll_offset;
item_sequence_number = other.item_sequence_number;
document_sequence_number = other.document_sequence_number;
page_scale_factor = other.page_scale_factor;
referrer_policy = other.referrer_policy;
http_body = other.http_body;
children = other.children;
}
ExplodedPageState::ExplodedPageState() { ExplodedPageState::ExplodedPageState() {
} }
......
...@@ -58,7 +58,12 @@ struct CONTENT_EXPORT ExplodedFrameState { ...@@ -58,7 +58,12 @@ struct CONTENT_EXPORT ExplodedFrameState {
std::vector<ExplodedFrameState> children; std::vector<ExplodedFrameState> children;
ExplodedFrameState(); ExplodedFrameState();
ExplodedFrameState(const ExplodedFrameState& other);
~ExplodedFrameState(); ~ExplodedFrameState();
void operator=(const ExplodedFrameState& other);
private:
void assign(const ExplodedFrameState& other);
}; };
struct CONTENT_EXPORT ExplodedPageState { struct CONTENT_EXPORT ExplodedPageState {
......
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