Bug 933952 - The NO_DELTA flag in CharacterInfo is unnecessary; r=evilpies

This commit is contained in:
Eddy Bruel 2013-11-11 16:52:40 +01:00
parent 4c5da5d643
commit 8ec134fe08
3 changed files with 15 additions and 30 deletions

View File

@ -110,8 +110,8 @@ const CharacterInfo unicode::js_charinfo[] = {
{65334, 0, 2},
{65333, 0, 2},
{65329, 0, 2},
{42893, 613, 10},
{42922, 614, 10},
{42280, 0, 2},
{42308, 0, 2},
{65327, 0, 2},
{65325, 0, 2},
{10743, 0, 2},
@ -152,7 +152,7 @@ const CharacterInfo unicode::js_charinfo[] = {
{0, 48, 2},
{65488, 0, 2},
{0, 7264, 2},
{42877, 7545, 10},
{35332, 0, 2},
{3814, 0, 2},
{65477, 0, 2},
{0, 57921, 2},
@ -193,6 +193,9 @@ const CharacterInfo unicode::js_charinfo[] = {
{0, 54754, 2},
{0, 54721, 2},
{58272, 0, 2},
{0, 30204, 2},
{0, 23256, 2},
{0, 23228, 2},
};
const uint8_t unicode::index1[] = {
@ -687,10 +690,10 @@ const uint8_t unicode::index2[] = {
0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 8, 9, 8, 9, 8, 9,
8, 9, 8, 9, 8, 9, 8, 9, 5, 5, 8, 9, 8, 9, 8, 9, 8, 9,
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,
8, 9, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 9, 8, 9, 98,
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 5, 0, 0, 8, 9, 56, 5, 0,
8, 9, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 9, 8, 9, 139,
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 5, 0, 0, 8, 9, 140, 5, 0,
8, 9, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9,
8, 9, 8, 9, 8, 9, 8, 9, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 9, 8, 9, 8, 9, 8, 9, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 5, 5, 5, 2, 5, 5, 5,

View File

@ -54,8 +54,6 @@ namespace unicode {
* if GetFlag(char) & (FLAG_IDENTIFIER_PART | FLAG_LETTER):
* return True
*
* NO_DELTA
* See comment in CharacterInfo
*/
struct CharFlag {
@ -63,7 +61,6 @@ struct CharFlag {
SPACE = 1 << 0,
LETTER = 1 << 1,
IDENTIFIER_PART = 1 << 2,
NO_DELTA = 1 << 3
};
};
@ -82,10 +79,6 @@ class CharacterInfo {
* For upper case alpha, we would store 0 in upperCase and 32 in
* lowerCase (65 + 32 = 97).
*
* If the delta between the chars wouldn't fit in a T, the flag
* FLAG_NO_DELTA is set, and you can just use upperCase and lowerCase
* without adding them the base char. See CharInfo.toUpperCase().
*
* We use deltas to reuse information for multiple characters. For
* example the whole lower case latin alphabet fits into one entry,
* because it's always a UnicodeLetter and upperCase contains
@ -200,13 +193,6 @@ ToUpperCase(jschar ch)
{
const CharacterInfo &info = CharInfo(ch);
/*
* The delta didn't fit into T, so we had to store the
* actual char code.
*/
if (info.flags & CharFlag::NO_DELTA)
return info.upperCase;
return uint16_t(ch) + info.upperCase;
}
@ -215,9 +201,6 @@ ToLowerCase(jschar ch)
{
const CharacterInfo &info = CharInfo(ch);
if (info.flags & CharFlag::NO_DELTA)
return info.lowerCase;
return uint16_t(ch) + info.lowerCase;
}

View File

@ -48,7 +48,6 @@ ZWJ = ord(u'\N{ZERO WIDTH JOINER}')
FLAG_SPACE = 1 << 0
FLAG_LETTER = 1 << 1
FLAG_IDENTIFIER_PART = 1 << 2
FLAG_NO_DELTA = 1 << 3
MAX = 0xffff
@ -129,11 +128,11 @@ def generate_unicode_stuff(unicode_data, data_file, test_mapping, test_space):
up_d = upper - code
low_d = lower - code
if -32768 <= up_d <= 32767 and -32768 <= low_d <= 32767:
upper = up_d & 0xffff
lower = low_d & 0xffff
else:
flags |= FLAG_NO_DELTA
assert up_d > -65535 and up_d < 65535
assert low_d > -65535 and low_d < 65535
upper = up_d & 0xffff
lower = low_d & 0xffff
item = (upper, lower, flags)
@ -248,7 +247,7 @@ if (typeof reportCompare === "function")
"""
data_file.write('/* Generated by make_unicode.py DO NOT MODIFY */\n')
data_file.write(public_domain)
data_file.write('#include "Unicode.h"\n\n')
data_file.write('#include "vm/Unicode.h"\n\n')
data_file.write('using namespace js;\n')
data_file.write('using namespace js::unicode;\n')
data_file.write(comment)