diff --git a/lib/zlib/inftrees.js b/lib/zlib/inftrees.js index 193f1ee..8ef756a 100644 --- a/lib/zlib/inftrees.js +++ b/lib/zlib/inftrees.js @@ -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; -}; \ No newline at end of file +};