diff options
author | Bruce Dawson <brucedawson@google.com> | 2015-01-05 14:11:00 -0800 |
---|---|---|
committer | Bruce Dawson <brucedawson@google.com> | 2015-01-05 14:11:00 -0800 |
commit | 286ea1d88a41a670a17bd82d85a553c2df53c0c8 (patch) | |
tree | c08739f6145351cda20587950af17f300e8b78bb /pdfium.gyp | |
parent | a975cfae4719986e5ea0ff06a45b91e1cdd042b3 (diff) | |
download | pdfium-286ea1d88a41a670a17bd82d85a553c2df53c0c8.tar.xz |
Remove run-time calculation of hash constants in pdfium.
PDFium static initializers must go. Static initializers are prohibited
by the style guide. They have negative consequences including increased
startup time (from pulling in additional code pages) and reduced sharing
of data pages (since the variables can't go in the read-only data
segment).
This change uses a template struct and typed enums to reproduce
JS_CalcHash at run-time. An unsigned long long constant and masking with
0xFFFFFFFF are used to avoid compile errors due to integer overflow of
compile-time constants.
The HashVerify class is used to check the results, necessary since none
of the functions in global.cpp are called when pdfium_test.exe runs.
const_expr would be a much cleaner way to implement this change but it
is not yet widely supported.
On the Windows release build this reduces the code size (.text
virtual size) by 0x240 (576) bytes, the .data section by 0x20 bytes
(for eight unsigned globals), and the .rdata section by 0x20 bytes
(the unneeded string savings, minus the eight unsigned globals now
being there).
BUG=441899
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/792043005
Diffstat (limited to 'pdfium.gyp')
0 files changed, 0 insertions, 0 deletions