Move two skia arrays to read-only data segment
authorBruce Dawson <brucedawson@google.com>
Thu, 29 Dec 2016 22:05:39 +0000 (14:05 -0800)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 3 Jan 2017 00:11:53 +0000 (00:11 +0000)
The BCP47FromLanguageID and UnicodeFromMacRoman arrays are logically
const but were not marked as such. Marking them as const lets the
compiler/linker store them in the read-only data segment, which is
strictly better than being in read/write memory. This change moves about
3,000 bytes from the .data to .rdata segment in both chrome.dll and
chrome_child.dll.

BUG=677351

Change-Id: I85ff44d61aa232cf29178833fd2bb2e004032b9e
Reviewed-on: https://skia-review.googlesource.com/6424
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>

src/sfnt/SkOTTable_name.cpp

index 476e0ce..9670b6f 100644 (file)
@@ -46,7 +46,7 @@ static void SkStringFromUTF16BE(const uint16_t* utf16be, size_t length, SkString
  *  In MacRoman the first 128 code points match ASCII code points.
  *  This maps the second 128 MacRoman code points to unicode code points.
  */
-static uint16_t UnicodeFromMacRoman[0x80] = {
+static const uint16_t UnicodeFromMacRoman[0x80] = {
     0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1,
     0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
     0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3,
@@ -73,7 +73,7 @@ static void SkStringFromMacRoman(const uint8_t* macRoman, size_t length, SkStrin
     }
 }
 
-static struct BCP47FromLanguageId {
+static const struct BCP47FromLanguageId {
     uint16_t languageID;
     const char* bcp47;
 }