Bug 717501 - reduce space required by unicode tables; r=evilpie
authorNathan Froyd <froydnj@mozilla.com>
Thu, 12 Jan 2012 00:10:26 -0500
changeset 84415 6f3285fc0d028e3cd8bf84f1e570d9692a21c708
parent 84414 d13c738c54ce627f0091580a5825f037c9652a83
child 84416 0153a4156538a9aec7d5845732a69aad19537c6f
push id21848
push usermak77@bonardo.net
push dateSat, 14 Jan 2012 09:02:20 +0000
treeherdermozilla-central@27a7f197c6fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs717501
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 717501 - reduce space required by unicode tables; r=evilpie
js/src/vm/Unicode.cpp
js/src/vm/Unicode.h
js/src/vm/make_unicode.py
--- a/js/src/vm/Unicode.cpp
+++ b/js/src/vm/Unicode.cpp
@@ -191,17 +191,17 @@ const CharacterInfo js_charinfo[] = {
     {0, 54756, 2},
     {0, 54787, 2},
     {0, 54753, 2},
     {0, 54754, 2},
     {0, 54721, 2},
     {58272, 0, 2},
 };
 
-const uint16_t index1[] = {
+const uint8_t index1[] = {
       0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,
      18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  34,
      35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,
      53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  26,  26,  26,  26,
      26,  67,  68,  69,  70,  71,  72,  73,  74,  26,  26,  26,  26,  26,  26,  26,  26,  75,
      76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  34,
      93,  94,  95,  96,  97,  98,  34,  99,  26, 100,  26, 101, 102, 102, 103, 102, 104, 105,
     106, 107, 108, 109, 110, 111, 112, 113, 114,  34,  34,  34,  34,  34,  34,  34,  34,  34,
@@ -251,17 +251,17 @@ const uint16_t index1[] = {
      34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,
      34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,
      34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,
      34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,  34,
      34,  34,  34,  34,  34,  34,  26,  26,  26,  26, 158, 158,  26, 159, 160, 161, 162, 163,
      26,  26,  26,  26, 164, 165, 166, 167, 168, 169,  26, 170, 171, 172, 173, 174,
 };
 
-const uint16_t index2[] = {
+const uint8_t index2[] = {
       0,   0,   0,   0,   0,   0,   0,   0,   0,   1,   1,   1,   1,   1,   0,   0,   0,   0,
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   1,   0,   0,   0,
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   2,   2,   2,   2,   2,   2,
       2,   2,   2,   2,   0,   0,   0,   0,   0,   0,   0,   3,   3,   3,   3,   3,   3,   3,
       3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,
       3,   0,   0,   0,   0,   2,   0,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,
       4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   0,   0,   0,
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
--- a/js/src/vm/Unicode.h
+++ b/js/src/vm/Unicode.h
@@ -155,24 +155,24 @@ class CharacterInfo {
         return flags & CharFlag::ENCLOSING_MARK;
     }
 
     inline bool isCombiningSpacingMark() const {
         return flags & CharFlag::COMBINING_SPACING_MARK;
     }
 };
 
-extern const uint16_t index1[];
-extern const uint16_t index2[];
+extern const uint8_t index1[];
+extern const uint8_t index2[];
 extern const CharacterInfo js_charinfo[];
 
 inline const CharacterInfo&
 CharInfo(jschar code)
 {
-    uint16_t index = index1[code >> 6];
+    size_t index = index1[code >> 6];
     index = index2[(index << 6) + (code & 0x3f)];
 
     return js_charinfo[index];
 }
 
 inline bool
 IsIdentifierStart(jschar ch)
 {
--- a/js/src/vm/make_unicode.py
+++ b/js/src/vm/make_unicode.py
@@ -262,23 +262,23 @@ if (typeof reportCompare === "function")
     for d in table:
         data_file.write('    {')
         data_file.write(', '.join((str(e) for e in d)))
         data_file.write('},\n')
     data_file.write('};\n')
     data_file.write('\n')
 
     def dump(data, name, file):
-        file.write('const uint16_t ' + name + '[] = {\n')
+        file.write('const uint8_t ' + name + '[] = {\n')
 
         line = pad = ' ' * 4
         lines = []
         for entry in data:
+            assert entry < 256
             s = str(entry)
-            assert len(s) <= 3
             s = s.rjust(3)
 
             if len(line + s) + 5 > 99:
                 lines.append(line.rstrip())
                 line = pad + s + ', '
             else:
                 line = line + s + ', '
         lines.append(line.rstrip())