Implement a mechanism to realloc array buffers; Trap when trying to allocate more than max size; Test allocators in CI

This commit is contained in:
dcodeIO
2018-04-08 00:43:38 +02:00
parent dcc0e284fb
commit 9731958738
41 changed files with 2911 additions and 2024 deletions

View File

@ -25,12 +25,14 @@ function test(file) {
console.log("mem final: " + exports.memory.buffer.byteLength);
console.log();
if (exports.allocate_memory(COMMON_MAX + 1) != 0) {
try {
exports.allocate_memory(COMMON_MAX + 1); // unreachable
throw Error("allocation is allowed to overflow MAX_SIZE");
}
if (exports.allocate_memory(0xffffffff) != 0) {
} catch (e) {}
try {
exports.allocate_memory(0xffffffff); // unreachable
throw Error("allocation is allowed to overflow INT_MAX");
}
} catch (e) {}
}
if (process.argv.length > 2) {