inflate speed opts for old v8

master
Vitaly Puzrin 2014-06-10 20:54:29 +04:00
rodzic d846c78df9
commit 0df06dbb67
1 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -191,19 +191,18 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
*/
/* set up for code type */
switch (type) {
case CODES:
// poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8
if (type === CODES) {
base = extra = work; /* dummy value--not used */
end = 19;
break;
case LENS:
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
break;
default: /* DISTS */
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
@ -323,4 +322,4 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
//opts.table_index += used;
opts.bits = root;
return 0;
};
};