Remove no_initial_alloc, use empty memory instead

This commit is contained in:
copy 2016-08-02 05:33:02 +02:00
parent d8d71f1177
commit 20d58a3c5a
2 changed files with 8 additions and 18 deletions

View file

@ -375,7 +375,8 @@ function V86Starter(options)
{
if(settings.initial_state)
{
settings.no_initial_alloc = true;
// avoid large allocation now, memory will be restored later anyway
settings.memory_size = 0;
}
this.bus.send("cpu-init", settings);

View file

@ -557,7 +557,7 @@ CPU.prototype.reset = function()
};
/** @export */
CPU.prototype.create_memory = function(size, no_alloc)
CPU.prototype.create_memory = function(size)
{
this.memory_size = size;
@ -566,27 +566,16 @@ CPU.prototype.create_memory = function(size, no_alloc)
dbg_assert((size & MMAP_BLOCK_SIZE - 1) === 0);
if(no_alloc)
{
var buffer = new ArrayBuffer(0);
var buffer = new ArrayBuffer(size);
this.mem8 = new Uint8Array(buffer);
this.mem16 = new Uint16Array(buffer);
this.mem32s = new Int32Array(buffer);
}
else
{
var buffer = new ArrayBuffer(size);
this.mem8 = new Uint8Array(buffer);
this.mem16 = new Uint16Array(buffer);
this.mem32s = new Int32Array(buffer);
}
this.mem8 = new Uint8Array(buffer);
this.mem16 = new Uint16Array(buffer);
this.mem32s = new Int32Array(buffer);
};
CPU.prototype.init = function(settings, device_bus)
{
this.create_memory(settings.memory_size || 1024 * 1024 * 64, settings.no_initial_alloc);
this.create_memory(settings.memory_size || 1024 * 1024 * 64);
this.reset();