Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Issue 29293002: Move DateMath weekdayName/monthName arrays to .rodata section (Closed)

Created:
7 years, 2 months ago by Inactive
Modified:
7 years, 2 months ago
CC:
blink-reviews, yurys+blink_chromium.org, loislo+blink_chromium.org, adamk+blink_chromium.org, abarth-chromium
Visibility:
Public.

Description

Move DateMath weekdayName/monthName arrays to .rodata section Move WTF::DateMath's weekdayName/monthName arrays from .data.rel.ro.local section to .rodata section by leveraging the fact that all the strings held in these arrays have the same size. We can therefore define the arrays as: const char weekdayName[7][4] = { ... }; instead of const char* const weekdayName[7] = { ... }; This gets rid of all pointers and enables placing these arrays in readonly memory. This makes sure that they are shared between different library instances, and should help saving RAM on mobile. This also reduces the number of relocations in libchromeview_prebuilt.so by 31 according to relinfo. BUG=249746 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=159981

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M Source/wtf/DateMath.h View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Inactive
relinfo output: before: out/Release/lib/libchromeview_prebuilt.so: 240776 relocations, 240715 relative (99%), 329 PLT entries, 0 for local ...
7 years, 2 months ago (2013-10-18 15:48:32 UTC) #1
abarth-chromium
lgtm Nice!
7 years, 2 months ago (2013-10-18 15:59:50 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/29293002/1
7 years, 2 months ago (2013-10-18 16:00:12 UTC) #3
commit-bot: I haz the power
Change committed as 159981
7 years, 2 months ago (2013-10-19 00:27:12 UTC) #4
eseidel
How much is on the table here? How much do we expect to move in ...
7 years, 2 months ago (2013-10-19 01:26:21 UTC) #5
Inactive
7 years, 2 months ago (2013-10-20 15:03:48 UTC) #6
Message was sent while issue was closed.
On 2013/10/19 01:26:21, eseidel wrote:
> How much is on the table here?  How much do we expect to move in this way?

We move 19 words of data to readonly memory (due to the 12+7=19 pointers), so 76
bytes on my 32-bit phone. I confirmed this using the following command:
size -A -d DateMath.o

My understanding is that the strings themselves were already in readonly memory.

We also get rid of 31 relocations, which affects startup time.

We also potentially increase security by moving those arrays to readonly memory.
To be fair, the linker could already take away write access to this data but
only *after* the relocations (as the pointers were marked as const).

Powered by Google App Engine
This is Rietveld 408576698