Update Rusha (the asm.js heap size issue has been fixed)

This commit is contained in:
Marco Castelluccio 2014-09-04 08:56:39 -07:00
Родитель e48dae88ce
Коммит 8811c9cc08
1 изменённых файлов: 28 добавлений и 15 удалений

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

@ -119,14 +119,28 @@
return res.join('');
};
var nextPow2 = function (v) {
var p = 1; while (p < v) p = p << 1; return p;
var ceilHeapSize = function (v) {
// The asm.js spec says:
// The heap object's byteLength must be either
// 2^n for n in [12, 24) or 2^24 * n for n ≥ 1.
var p;
// If v is smaller than 2^12, the smallest possible solution
// is 2^12.
if (v <= 4096) return 4096;
// If v < 2^24, we round up to 2^n,
// otherwise we round up to 2^24 * n.
if (v < 16777216) {
for (p = 1; p < v; p = p << 1);
} else {
for (p = 16777216; p < v; p += 16777216);
}
return p;
};
// Resize the internal data structures to a new capacity.
var resize = function (size) {
self.sizeHint = size;
self.heap = new ArrayBuffer(nextPow2(padlen(size) + 320));
self.heap = new ArrayBuffer(ceilHeapSize(padlen(size) + 320));
self.core = RushaCore({Int32Array: Int32Array, DataView: DataView}, {}, self.heap);
};
@ -210,17 +224,17 @@
z3 = y3;
z4 = y4;
for (j = 0; (j|0) < 16; j = j + 1 |0) {
t1 = H[i+j<<2>>2]|0;
@ -278,4 +292,3 @@
}
})();