function calculateHeapSize(targetSize) {
            /* eslint-disable no-bitwise */
            if (H.cf.wasm) {
                return Math.ceil(targetSize / 65536) * 65536;
            }
            var exp = Math.ceil(Math.log(targetSize) * Math.LOG2E);
            if (exp <= 12) {
                return 1 << 12;
            }
            if (exp < 24) {
                return 1 << exp;
            }
            return Math.ceil(targetSize / (1 << 24)) * (1 << 24);
            /* eslint-enable no-bitwise */
        }
Calculate heap size for (w)asm
wasm page size: 65536 = 64 Ki
asm: http://asmjs.org/spec/latest/#linking-0
@param {number} targetSize The targetet Size
@returns {number} The necessary heap size