Bug 506090 - Speed up the tokenization of named character references in the HTML5 parser. r=bnewman.

--HG--
extra : rebase_source : bee1464b806dd5b1ce85fe6257ffcad18de61825
This commit is contained in:
Henri Sivonen 2010-02-10 11:23:35 +02:00
Родитель 8a75fb4ddc
Коммит d6cc0edab3
8 изменённых файлов: 2575 добавлений и 2216 удалений

Просмотреть файл

@ -5,8 +5,16 @@
#include "nsHtml5NamedCharacters.h"
jArray<jArray<PRUnichar,PRInt32>,PRInt32> nsHtml5NamedCharacters::NAMES;
jArray<PRUnichar,PRInt32>* nsHtml5NamedCharacters::VALUES;
jArray<jArray<PRInt8,PRInt32>,PRInt32> nsHtml5NamedCharacters::NAMES;
const PRUnichar nsHtml5NamedCharacters::VALUES[][2] = {
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE) \
{ VALUE },
#include "nsHtml5NamedCharactersInclude.h"
#undef NAMED_CHARACTER_REFERENCE
{0, 0} };
PRUnichar** nsHtml5NamedCharacters::WINDOWS_1252;
static PRUnichar const WINDOWS_1252_DATA[] = {
0x20AC,
@ -43,12 +51,311 @@ static PRUnichar const WINDOWS_1252_DATA[] = {
0x0178
};
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
static PRUnichar const NAME_##N[] = { CHARS };
static PRInt32 const HILO_ACCEL_65[] = {
0, 0, 0, 0, 0, 0, 0, 12386493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38863441, 0, 0, 0, 0, 58524541, 0, 0, 0, 73466977, 0, 0, 0, 80282823, 0, 0, 0, 0, 0, 109971084, 0, 0, 130549704, 133957628, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_66[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27525540, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80348362, 0, 0, 0, 0, 0, 110036623, 0, 0, 0, 134088701, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_68[] = {
0, 0, 0, 4980811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37159479, 0, 0, 0, 0, 0, 0, 0, 0, 62915519, 0, 0, 0, 0, 0, 0, 0, 89982301, 0, 0, 0, 0, 0, 0, 0, 0, 134154239, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_69[] = {
65536, 0, 0, 0, 0, 0, 0, 0, 13172937, 0, 0, 0, 0, 0, 24052079, 0, 0, 27656613, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69796904, 0, 0, 0, 0, 80479435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_72[] = {
0, 0, 2555943, 0, 0, 0, 0, 0, 0, 0, 15532269, 0, 0, 0, 0, 0, 0, 0, 30540241, 33161721, 0, 0, 0, 0, 0, 39584348, 0, 0, 0, 58590078, 0, 0, 0, 0, 0, 0, 0, 80544973, 0, 0, 0, 0, 0, 110102160, 0, 0, 130615241, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_73[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38928978, 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
};
static PRInt32 const HILO_ACCEL_74[] = {
0, 0, 0, 5046349, 0, 0, 10944679, 0, 13238474, 0, 15597806, 16056565, 0, 20578618, 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
};
static PRInt32 const HILO_ACCEL_76[] = {
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, 92669317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_77[] = {
196610, 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, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_78[] = {
0, 0, 0, 0, 8454273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44696234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_79[] = {
0, 0, 2687016, 0, 0, 0, 0, 0, 13304011, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30605779, 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
};
static PRInt32 const HILO_ACCEL_82[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33227259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92734855, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_83[] = {
0, 0, 0, 5111886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33358332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100599295, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_84[] = {
0, 0, 0, 0, 8585346, 0, 11075752, 0, 0, 0, 0, 16187638, 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
};
static PRInt32 const HILO_ACCEL_85[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27263391, 0, 0, 0, 0, 0, 0, 0, 38994515, 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
};
static PRInt32 const HILO_ACCEL_86[] = {
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, 92865928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_90[] = {
0, 0, 0, 5177423, 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, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_97[] = {
327684, 1900571, 2949162, 5374032, 8716420, 0, 11206826, 12517566, 13435084, 0, 15663343, 16515320, 19988785, 20644155, 24183152, 25952652, 0, 27918759, 30671316, 33489406, 34734607, 0, 0, 0, 39125588, 39649885, 40305254, 45220523, 52691740, 58917759, 63112129, 67240962, 70059050, 73925730, 75367549, 0, 79561917, 81986766, 90703198, 93390218, 100795904, 104990268, 0, 111675025, 116590323, 126814094, 130811850, 135006208, 0, 0, 138479679, 139266125
};
static PRInt32 const HILO_ACCEL_98[] = {
393222, 0, 0, 0, 0, 0, 11272364, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34865683, 37225016, 0, 0, 0, 0, 40370792, 45351603, 0, 59048836, 0, 0, 70124590, 73991273, 0, 0, 0, 82445540, 0, 93521298, 0, 0, 0, 112133801, 116655860, 126879632, 130942925, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_99[] = {
589831, 1966110, 3276846, 5505107, 8978566, 10420383, 11468973, 12583104, 13631694, 15139046, 15794416, 16711933, 20054322, 20840764, 24379762, 26018189, 0, 28115371, 30998997, 33686016, 35062293, 37290553, 38273608, 0, 39256662, 39780958, 40829545, 45482677, 53150501, 59179910, 63505348, 67306499, 70255663, 74056810, 75629695, 79037621, 79692991, 82773227, 90834281, 93914516, 101058051, 105055811, 0, 112461488, 117573365, 127076241, 131139535, 135071757, 136054812, 136906791, 138610754, 139397198
};
static PRInt32 const HILO_ACCEL_100[] = {
0, 0, 3342387, 0, 9044106, 0, 11534512, 0, 13697233, 0, 0, 0, 0, 0, 24445301, 0, 0, 0, 0, 0, 35127832, 37421626, 0, 0, 0, 39846496, 0, 45548215, 53216044, 59442056, 63570890, 0, 70321201, 0, 0, 0, 0, 83166448, 90899819, 93980058, 101385735, 0, 0, 112789173, 117769987, 127141780, 131336146, 135137294, 0, 136972330, 0, 139462736
};
static PRInt32 const HILO_ACCEL_101[] = {
0, 2162719, 3473460, 5636181, 0, 0, 0, 0, 0, 0, 0, 18809088, 20185395, 21299519, 0, 0, 0, 28377518, 0, 0, 0, 37945916, 38339145, 0, 0, 39977569, 40960624, 46072504, 53609261, 59704204, 63636427, 67372036, 71042098, 74318955, 75826307, 0, 0, 84935926, 90965356, 94569883, 101451276, 105383492, 0, 113247930, 118490886, 127207317, 0, 135530511, 136316957, 0, 138741828, 139593809
};
static PRInt32 const HILO_ACCEL_102[] = {
655370, 2228258, 3538998, 5701719, 9109643, 10485920, 11600049, 12648641, 13762770, 15204584, 15859954, 18874656, 20250933, 21365062, 24510838, 26083726, 27328929, 28443058, 31064538, 33751555, 35193369, 38011460, 38404682, 38601293, 39322200, 40043107, 41091698, 46138048, 53674803, 59835280, 63767500, 67634181, 71107645, 74384495, 75957382, 79103159, 79758529, 85132561, 91030893, 94635428, 101582349, 105449033, 109119105, 113444545, 118621969, 127272854, 131467221, 135596053, 136382497, 137037867, 138807366, 139659347
};
static PRInt32 const HILO_ACCEL_103[] = {
786443, 0, 0, 0, 9240716, 0, 11665586, 0, 13893843, 0, 0, 0, 0, 0, 24641911, 0, 0, 0, 0, 0, 35324442, 0, 0, 0, 0, 0, 41222772, 0, 0, 0, 64095182, 0, 71238718, 0, 76088456, 0, 79824066, 85263636, 0, 94963109, 101844495, 0, 0, 0, 0, 0, 131598295, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_104[] = {
0, 0, 3604535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26149263, 0, 28508595, 31326683, 33948164, 0, 0, 0, 0, 0, 0, 0, 0, 53936948, 59966354, 0, 0, 0, 0, 0, 0, 79889603, 85525782, 91096430, 95159722, 101975571, 105711178, 0, 113772228, 119080723, 128059287, 131794905, 0, 0, 137168940, 0, 139724884
};
static PRInt32 const HILO_ACCEL_105[] = {
0, 0, 3866680, 6160472, 0, 10616993, 0, 12714178, 0, 0, 0, 0, 20316470, 0, 0, 26214800, 0, 30015924, 31392223, 34210311, 0, 0, 0, 38666830, 0, 0, 0, 46990017, 54919992, 60752788, 0, 67699721, 71304256, 0, 76416138, 0, 0, 0, 91817327, 95421869, 102041109, 105907790, 109184642, 114493129, 119998234, 128518051, 0, 0, 0, 137234478, 138872903, 139790421
};
static PRInt32 const HILO_ACCEL_106[] = {
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, 60818336, 0, 0, 71369793, 0, 76481679, 0, 79955140, 85591322, 0, 95487409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_107[] = {
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, 47055566, 0, 0, 0, 0, 0, 74515568, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_108[] = {
851981, 0, 4063292, 0, 9306254, 0, 0, 0, 0, 0, 0, 19005729, 0, 0, 0, 26280337, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41419382, 47776463, 55051079, 60949409, 64422867, 67896330, 71631938, 0, 0, 0, 0, 85919003, 91948410, 96273842, 102368790, 106825297, 0, 114689748, 120063784, 0, 132057052, 135661590, 0, 137365551, 0, 0
};
static PRInt32 const HILO_ACCEL_109[] = {
917518, 0, 0, 0, 9502863, 0, 0, 0, 14155989, 0, 0, 19071267, 0, 0, 24838521, 0, 0, 0, 31457760, 0, 35389980, 0, 0, 0, 0, 0, 41681529, 0, 0, 0, 64881624, 0, 0, 0, 76940432, 79168696, 0, 86115616, 0, 96339390, 102696475, 106890847, 0, 114820823, 120522537, 0, 132253664, 0, 0, 137431089, 0, 0
};
static PRInt32 const HILO_ACCEL_110[] = {
983055, 0, 0, 0, 0, 0, 0, 0, 14483673, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35783197, 0, 0, 0, 0, 0, 43188861, 47842010, 0, 0, 65012703, 67961869, 72090694, 0, 77661335, 0, 0, 86574371, 92013948, 0, 0, 0, 0, 114886361, 0, 0, 0, 0, 0, 137496626, 0, 0
};
static PRInt32 const HILO_ACCEL_111[] = {
1114128, 2293795, 4587583, 8257631, 9633938, 10813603, 11731123, 12845251, 14680286, 15270121, 15925491, 19661092, 20382007, 23724359, 24904060, 26411410, 27394466, 30147019, 31523297, 34275851, 35914275, 38076997, 38470219, 38732367, 39387737, 40108644, 43319956, 50987739, 56165193, 61801379, 65143777, 68224014, 72156237, 74908786, 77923490, 79234233, 80020677, 87754026, 92145021, 97060287, 102762016, 107152992, 109250179, 115345114, 120850224, 128976810, 132384739, 135727127, 136448034, 137758771, 138938440, 139855958
};
static PRInt32 const HILO_ACCEL_112[] = {
1179666, 0, 0, 0, 9699476, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25035133, 0, 0, 0, 0, 0, 36766245, 0, 0, 0, 0, 0, 43844246, 51053323, 0, 0, 65536995, 68289554, 0, 0, 77989030, 0, 0, 87885116, 92210559, 97453514, 102958625, 0, 109315716, 115541729, 121046837, 129042353, 132974565, 135792664, 136513571, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_113[] = {
0, 0, 0, 0, 9896085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32047586, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66192361, 0, 0, 0, 78120103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121964344, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_114[] = {
1310739, 2359332, 4653127, 0, 0, 0, 12189876, 0, 0, 0, 0, 0, 0, 0, 25100671, 27001236, 0, 30212557, 0, 34341388, 36831794, 0, 0, 0, 0, 0, 43975326, 51249932, 56296282, 61998000, 66323443, 69600275, 72221774, 0, 0, 0, 0, 88278334, 0, 97781200, 103810596, 108856932, 0, 115607268, 122029894, 130025394, 133302254, 135858201, 136644644, 137889847, 0, 0
};
static PRInt32 const HILO_ACCEL_115[] = {
1441813, 2424869, 4718664, 8388735, 10027160, 10879142, 12255419, 12976325, 14745825, 15401194, 15991028, 19857709, 20447544, 23789931, 25297280, 27132317, 27460003, 30343630, 32113130, 34472461, 36897331, 38142534, 38535756, 38797904, 39453274, 40174181, 44237472, 51708687, 56623964, 62260147, 66520053, 69665831, 72483919, 75105400, 78578857, 79365306, 80086214, 88933700, 92341632, 99026389, 104072753, 108988030, 109381253, 116000485, 122292039, 130287553, 133367795, 135923738, 136710182, 138020921, 139003977, 139921495
};
static PRInt32 const HILO_ACCEL_116[] = {
1572887, 0, 0, 0, 10092698, 0, 12320956, 0, 14811362, 0, 0, 19923248, 0, 23921004, 25493891, 0, 0, 0, 32178667, 0, 36962868, 0, 0, 0, 0, 0, 44368548, 0, 56689505, 62456759, 66716664, 0, 73401427, 0, 78709936, 0, 0, 89785678, 0, 99550696, 104334901, 0, 0, 116393707, 122619723, 0, 133629940, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_117[] = {
1703961, 2490406, 4849737, 0, 10223771, 0, 0, 13107399, 15007971, 15466732, 0, 0, 20513081, 23986542, 25624966, 0, 0, 30409168, 33030636, 0, 37093941, 0, 0, 0, 39518811, 0, 44499622, 52101910, 58262370, 62587834, 66913275, 0, 0, 0, 78906546, 79430844, 0, 89916763, 92538242, 99812848, 104465977, 109053568, 109774470, 116459249, 126224208, 0, 133826552, 0, 0, 138151995, 139200586, 0
};
static PRInt32 const HILO_ACCEL_118[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25887112, 0, 0, 0, 0, 0, 0, 38208071, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100206068, 104531515, 0, 0, 0, 0, 0, 0, 0, 0, 138217533, 0, 0
};
static PRInt32 const HILO_ACCEL_119[] = {
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, 44630696, 0, 58393466, 62653372, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100533754, 0, 0, 0, 0, 126551943, 130484165, 133892091, 0, 0, 138283070, 0, 140052568
};
static PRInt32 const HILO_ACCEL_120[] = {
0, 0, 0, 0, 10354845, 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, 67175422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 116524786, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_121[] = {
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, 58459004, 0, 0, 0, 0, 75236475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static PRInt32 const HILO_ACCEL_122[] = {
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, 62784445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126683020, 0, 0, 135989275, 0, 0, 0, 0
};
const PRInt32* const nsHtml5NamedCharacters::HILO_ACCEL[] = {
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
HILO_ACCEL_65,
HILO_ACCEL_66,
0,
HILO_ACCEL_68,
HILO_ACCEL_69,
0,
0,
HILO_ACCEL_72,
HILO_ACCEL_73,
HILO_ACCEL_74,
0,
HILO_ACCEL_76,
HILO_ACCEL_77,
HILO_ACCEL_78,
HILO_ACCEL_79,
0,
0,
HILO_ACCEL_82,
HILO_ACCEL_83,
HILO_ACCEL_84,
HILO_ACCEL_85,
HILO_ACCEL_86,
0,
0,
0,
HILO_ACCEL_90,
0,
0,
0,
0,
0,
0,
HILO_ACCEL_97,
HILO_ACCEL_98,
HILO_ACCEL_99,
HILO_ACCEL_100,
HILO_ACCEL_101,
HILO_ACCEL_102,
HILO_ACCEL_103,
HILO_ACCEL_104,
HILO_ACCEL_105,
HILO_ACCEL_106,
HILO_ACCEL_107,
HILO_ACCEL_108,
HILO_ACCEL_109,
HILO_ACCEL_110,
HILO_ACCEL_111,
HILO_ACCEL_112,
HILO_ACCEL_113,
HILO_ACCEL_114,
HILO_ACCEL_115,
HILO_ACCEL_116,
HILO_ACCEL_117,
HILO_ACCEL_118,
HILO_ACCEL_119,
HILO_ACCEL_120,
HILO_ACCEL_121,
HILO_ACCEL_122
};
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE) \
static PRInt8 const NAME_##N[] = { CHARS };
#include "nsHtml5NamedCharactersInclude.h"
#undef NAMED_CHARACTER_REFERENCE
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE) \
static PRUnichar const VALUE_##N[] = { VALUE };
#include "nsHtml5NamedCharactersInclude.h"
#undef NAMED_CHARACTER_REFERENCE
@ -61,17 +368,10 @@ static PRUnichar const VALUE_##N[] = { VALUE };
void
nsHtml5NamedCharacters::initializeStatics()
{
NAMES = jArray<jArray<PRUnichar,PRInt32>,PRInt32>(2138);
NAMES = jArray<jArray<PRInt8,PRInt32>,PRInt32>(2138);
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
NAMES[N] = jArray<PRUnichar,PRInt32>((PRUnichar*)NAME_##N, LEN);
#include "nsHtml5NamedCharactersInclude.h"
#undef NAMED_CHARACTER_REFERENCE
VALUES = new jArray<PRUnichar,PRInt32>[2138];
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
VALUES[N] = jArray<PRUnichar,PRInt32>((PRUnichar*)VALUE_##N, SIZE);
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE) \
NAMES[N] = jArray<PRInt8,PRInt32>((PRInt8*)NAME_##N, LEN);
#include "nsHtml5NamedCharactersInclude.h"
#undef NAMED_CHARACTER_REFERENCE
@ -89,6 +389,5 @@ void
nsHtml5NamedCharacters::releaseStatics()
{
NAMES.release();
delete[] VALUES;
delete[] WINDOWS_1252;
}

Просмотреть файл

@ -8,9 +8,10 @@
class nsHtml5NamedCharacters
{
public:
static jArray<jArray<PRUnichar,PRInt32>,PRInt32> NAMES;
static jArray<PRUnichar,PRInt32>* VALUES;
static jArray<jArray<PRInt8,PRInt32>,PRInt32> NAMES;
static const PRUnichar VALUES[][2];
static PRUnichar** WINDOWS_1252;
static const PRInt32* const HILO_ACCEL[];
static void initializeStatics();
static void releaseStatics();
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Henri Sivonen
* Copyright (c) 2007-2009 Mozilla Foundation
* Copyright (c) 2007-2010 Mozilla Foundation
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
@ -2350,46 +2350,70 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
reconsume = PR_TRUE;
goto stateloop;
}
entCol = -1;
lo = 0;
hi = (nsHtml5NamedCharacters::NAMES.length - 1);
candidate = -1;
strBufMark = 0;
state = NS_HTML5TOKENIZER_CHARACTER_REFERENCE_LOOP;
reconsume = PR_TRUE;
if (c >= 'a' && c <= 'z') {
firstCharKey = c - 'a' + 26;
} else if (c >= 'A' && c <= 'Z') {
firstCharKey = c - 'A';
} else {
emitOrAppendStrBuf(returnState);
if (!(returnState & (~1))) {
cstart = pos;
}
state = returnState;
reconsume = PR_TRUE;
goto stateloop;
}
appendStrBuf(c);
state = NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP;
}
}
}
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_LOOP: {
for (; ; ) {
if (reconsume) {
reconsume = PR_FALSE;
} else {
if (++pos == endPos) {
goto stateloop_end;
}
c = checkChar(buf, pos);
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP: {
{
if (++pos == endPos) {
goto stateloop_end;
}
c = checkChar(buf, pos);
if (c == '\0') {
goto stateloop_end;
}
PRInt32 hilo = 0;
if (c <= 'z') {
const PRInt32* row = nsHtml5NamedCharacters::HILO_ACCEL[c];
if (!!row) {
hilo = row[firstCharKey];
}
}
if (!hilo) {
emitOrAppendStrBuf(returnState);
if (!(returnState & (~1))) {
cstart = pos;
}
state = returnState;
reconsume = PR_TRUE;
goto stateloop;
}
appendStrBuf(c);
lo = hilo & 0xFFFF;
hi = hilo >> 16;
entCol = -1;
candidate = -1;
strBufMark = 0;
state = NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL;
}
}
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL: {
for (; ; ) {
if (++pos == endPos) {
goto stateloop_end;
}
c = checkChar(buf, pos);
if (c == '\0') {
goto stateloop_end;
}
entCol++;
for (; ; ) {
if (hi == -1) {
goto hiloop_end;
}
if (entCol == nsHtml5NamedCharacters::NAMES[hi].length) {
goto hiloop_end;
}
if (entCol > nsHtml5NamedCharacters::NAMES[hi].length) {
goto outer_end;
} else if (c < nsHtml5NamedCharacters::NAMES[hi][entCol]) {
hi--;
} else {
goto hiloop_end;
}
}
hiloop_end: ;
for (; ; ) {
if (hi < lo) {
goto outer_end;
@ -2407,6 +2431,22 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
}
loloop_end: ;
for (; ; ) {
if (hi < lo) {
goto outer_end;
}
if (entCol == nsHtml5NamedCharacters::NAMES[hi].length) {
goto hiloop_end;
}
if (entCol > nsHtml5NamedCharacters::NAMES[hi].length) {
goto outer_end;
} else if (c < nsHtml5NamedCharacters::NAMES[hi][entCol]) {
hi--;
} else {
goto hiloop_end;
}
}
hiloop_end: ;
if (hi < lo) {
goto outer_end;
}
@ -2424,8 +2464,8 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
reconsume = PR_TRUE;
goto stateloop;
} else {
jArray<PRUnichar,PRInt32> candidateArr = nsHtml5NamedCharacters::NAMES[candidate];
if (candidateArr[candidateArr.length - 1] != ';') {
jArray<PRInt8,PRInt32> candidateArr = nsHtml5NamedCharacters::NAMES[candidate];
if (!candidateArr.length || candidateArr[candidateArr.length - 1] != ';') {
if ((returnState & (~1))) {
PRUnichar ch;
if (strBufMark == strBufLen) {
@ -2447,8 +2487,12 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
}
jArray<PRUnichar,PRInt32> val = nsHtml5NamedCharacters::VALUES[candidate];
emitOrAppend(val, returnState);
const PRUnichar* val = nsHtml5NamedCharacters::VALUES[candidate];
if ((val[0] & 0xFC00) == 0xD800) {
emitOrAppendTwo(val, returnState);
} else {
emitOrAppendOne(val, returnState);
}
if (strBufMark < strBufLen) {
if ((returnState & (~1))) {
for (PRInt32 i = strBufMark; i < strBufLen; i++) {
@ -3435,7 +3479,7 @@ nsHtml5Tokenizer::handleNcrValue(PRInt32 returnState)
} else if (value <= 0x10FFFF) {
astralChar[0] = (PRUnichar) (NS_HTML5TOKENIZER_LEAD_OFFSET + (value >> 10));
astralChar[1] = (PRUnichar) (0xDC00 + (value & 0x3FF));
emitOrAppend(astralChar, returnState);
emitOrAppendTwo(astralChar, returnState);
} else {
emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
@ -3626,7 +3670,13 @@ nsHtml5Tokenizer::eof()
state = returnState;
continue;
}
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_LOOP: {
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP: {
emitOrAppendStrBuf(returnState);
state = returnState;
continue;
}
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL: {
for (; ; ) {
PRUnichar c = '\0';
entCol++;
@ -3675,8 +3725,8 @@ nsHtml5Tokenizer::eof()
state = returnState;
goto eofloop;
} else {
jArray<PRUnichar,PRInt32> candidateArr = nsHtml5NamedCharacters::NAMES[candidate];
if (candidateArr[candidateArr.length - 1] != ';') {
jArray<PRInt8,PRInt32> candidateArr = nsHtml5NamedCharacters::NAMES[candidate];
if (!candidateArr.length || candidateArr[candidateArr.length - 1] != ';') {
if ((returnState & (~1))) {
PRUnichar ch;
if (strBufMark == strBufLen) {
@ -3697,8 +3747,12 @@ nsHtml5Tokenizer::eof()
}
}
jArray<PRUnichar,PRInt32> val = nsHtml5NamedCharacters::VALUES[candidate];
emitOrAppend(val, returnState);
const PRUnichar* val = nsHtml5NamedCharacters::VALUES[candidate];
if ((val[0] & 0xFC00) == 0xD800) {
emitOrAppendTwo(val, returnState);
} else {
emitOrAppendOne(val, returnState);
}
if (strBufMark < strBufLen) {
if ((returnState & (~1))) {
for (PRInt32 i = strBufMark; i < strBufLen; i++) {
@ -3760,17 +3814,18 @@ nsHtml5Tokenizer::internalEncodingDeclaration(nsString* internalCharset)
}
void
nsHtml5Tokenizer::emitOrAppend(jArray<PRUnichar,PRInt32> val, PRInt32 returnState)
nsHtml5Tokenizer::emitOrAppendTwo(const PRUnichar* val, PRInt32 returnState)
{
if ((returnState & (~1))) {
appendLongStrBuf(val);
appendLongStrBuf(val[0]);
appendLongStrBuf(val[1]);
} else {
tokenHandler->characters(val, 0, val.length);
tokenHandler->characters(val, 0, 2);
}
}
void
nsHtml5Tokenizer::emitOrAppendOne(PRUnichar* val, PRInt32 returnState)
nsHtml5Tokenizer::emitOrAppendOne(const PRUnichar* val, PRInt32 returnState)
{
if ((returnState & (~1))) {
appendLongStrBuf(val[0]);
@ -3865,6 +3920,7 @@ nsHtml5Tokenizer::resetToDataState()
forceQuirks = PR_FALSE;
additional = '\0';
entCol = -1;
firstCharKey = -1;
lo = 0;
hi = (nsHtml5NamedCharacters::NAMES.length - 1);
candidate = -1;
@ -3913,6 +3969,7 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other)
forceQuirks = other->forceQuirks;
additional = other->additional;
entCol = other->entCol;
firstCharKey = other->firstCharKey;
lo = other->lo;
hi = other->hi;
candidate = other->candidate;

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Henri Sivonen
* Copyright (c) 2007-2009 Mozilla Foundation
* Copyright (c) 2007-2010 Mozilla Foundation
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
@ -97,6 +97,7 @@ class nsHtml5Tokenizer
PRBool forceQuirks;
PRUnichar additional;
PRInt32 entCol;
PRInt32 firstCharKey;
PRInt32 lo;
PRInt32 hi;
PRInt32 candidate;
@ -252,8 +253,8 @@ class nsHtml5Tokenizer
public:
void internalEncodingDeclaration(nsString* internalCharset);
private:
void emitOrAppend(jArray<PRUnichar,PRInt32> val, PRInt32 returnState);
void emitOrAppendOne(PRUnichar* val, PRInt32 returnState);
void emitOrAppendTwo(const PRUnichar* val, PRInt32 returnState);
void emitOrAppendOne(const PRUnichar* val, PRInt32 returnState);
public:
void end();
void requestSuspension();
@ -337,7 +338,7 @@ jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOFRAMES_ARR = 0;
#define NS_HTML5TOKENIZER_DOCTYPE_YSTEM 41
#define NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE 42
#define NS_HTML5TOKENIZER_CONSUME_NCR 43
#define NS_HTML5TOKENIZER_CHARACTER_REFERENCE_LOOP 44
#define NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL 44
#define NS_HTML5TOKENIZER_HEX_NCR_LOOP 45
#define NS_HTML5TOKENIZER_DECIMAL_NRC_LOOP 46
#define NS_HTML5TOKENIZER_HANDLE_NCR_VALUE 47
@ -365,6 +366,7 @@ jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOFRAMES_ARR = 0;
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH 69
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH 70
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_END 71
#define NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP 72
#define NS_HTML5TOKENIZER_LEAD_OFFSET (0xD800 - (0x10000 >> 10))
#define NS_HTML5TOKENIZER_BUFFER_GROW_BY 1024

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Henri Sivonen
* Copyright (c) 2007-2009 Mozilla Foundation
* Copyright (c) 2007-2010 Mozilla Foundation
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
@ -194,7 +194,7 @@ nsHtml5TreeBuilder::comment(PRUnichar* buf, PRInt32 start, PRInt32 length)
}
void
nsHtml5TreeBuilder::characters(PRUnichar* buf, PRInt32 start, PRInt32 length)
nsHtml5TreeBuilder::characters(const PRUnichar* buf, PRInt32 start, PRInt32 length)
{
if (needToDropLF) {
if (buf[start] == '\n') {

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Henri Sivonen
* Copyright (c) 2007-2009 Mozilla Foundation
* Copyright (c) 2007-2010 Mozilla Foundation
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
@ -101,7 +101,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, PRBool forceQuirks);
void comment(PRUnichar* buf, PRInt32 start, PRInt32 length);
void characters(PRUnichar* buf, PRInt32 start, PRInt32 length);
void characters(const PRUnichar* buf, PRInt32 start, PRInt32 length);
void eof();
void endTokenization();
void startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, PRBool selfClosing);
@ -182,7 +182,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void appendVoidElementToCurrent(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(PRUnichar* buf, PRInt32 start, PRInt32 length);
void accumulateCharacters(const PRUnichar* buf, PRInt32 start, PRInt32 length);
void accumulateCharacter(PRUnichar c);
void requestSuspension();
nsIContent** createElement(PRInt32 ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes);

Просмотреть файл

@ -603,7 +603,7 @@ nsHtml5TreeBuilder::elementPopped(PRInt32 aNamespace, nsIAtom* aName, nsIContent
}
void
nsHtml5TreeBuilder::accumulateCharacters(PRUnichar* aBuf, PRInt32 aStart, PRInt32 aLength)
nsHtml5TreeBuilder::accumulateCharacters(const PRUnichar* aBuf, PRInt32 aStart, PRInt32 aLength)
{
PRInt32 newFillLen = charBufferLen + aLength;
if (newFillLen > charBuffer.length) {