Avoid deoptimizations
This commit is contained in:
parent
dac74191e6
commit
72cb53482a
|
@ -59,7 +59,7 @@ v86.prototype.adc = function(dest_operand, source_operand, op_size)
|
|||
var cf = this.getcf();
|
||||
this.last_op1 = dest_operand;
|
||||
this.last_op2 = source_operand;
|
||||
this.last_add_result = this.last_result = dest_operand + source_operand + cf | 0;
|
||||
this.last_add_result = this.last_result = (dest_operand + source_operand | 0) + cf | 0;
|
||||
|
||||
this.last_op_size = op_size;
|
||||
this.flags_changed = flags_all;
|
||||
|
|
|
@ -100,11 +100,11 @@ flags_all = flag_carry | flag_parity | flag_adjust | flag_zero | flag_sign | fla
|
|||
*
|
||||
* @const
|
||||
*/
|
||||
OPSIZE_8 = 0x80,
|
||||
OPSIZE_8 = 7,
|
||||
/** @const */
|
||||
OPSIZE_16 = 0x8000,
|
||||
OPSIZE_16 = 15,
|
||||
/** @const */
|
||||
OPSIZE_32 = -0x80000000,
|
||||
OPSIZE_32 = 31,
|
||||
|
||||
/** @const */
|
||||
PSE_ENABLED = 128,
|
||||
|
|
|
@ -269,7 +269,7 @@ function v86()
|
|||
#include "instructions.macro.js"
|
||||
#include "misc_instr.macro.js"
|
||||
|
||||
|
||||
#undef unimpl
|
||||
#define unimpl(x) this.debug.unimpl(x)
|
||||
#define vm86_mode() (!!(this.flags & flag_vm))
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
#undef unimpl
|
||||
#define unimpl(x) cpu.debug.unimpl(x)
|
||||
|
||||
var
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
*/
|
||||
function IO(memory)
|
||||
{
|
||||
var me = this,
|
||||
memory_size = memory.size;
|
||||
var memory_size = memory.size;
|
||||
|
||||
function get_port_description(addr)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ function Memory(buffer, memory_size)
|
|||
}
|
||||
|
||||
// use by dynamic translator
|
||||
this.mem_page_infos = new Uint8Array(1 << 20);
|
||||
if(OP_TRANSLATION) this.mem_page_infos = new Uint8Array(1 << 20);
|
||||
|
||||
dbg_assert((memory_size & MMAP_BLOCK_SIZE - 1) === 0);
|
||||
}
|
||||
|
@ -207,7 +207,8 @@ Memory.prototype.write8 = function(addr, value)
|
|||
this.debug_write(addr, 1, value);
|
||||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -228,8 +229,12 @@ Memory.prototype.write16 = function(addr, value)
|
|||
this.debug_write(addr, 2, value);
|
||||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 1 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 1 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -252,7 +257,8 @@ Memory.prototype.write_aligned16 = function(addr, value)
|
|||
this.debug_write(addr << 1, 2, value);
|
||||
|
||||
var page = addr >>> MMAP_BLOCK_BITS - 1;
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -275,8 +281,12 @@ Memory.prototype.write32 = function(addr, value)
|
|||
this.debug_write(addr, 4, value);
|
||||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 3 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 3 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -296,7 +306,8 @@ Memory.prototype.write_aligned32 = function(addr, value)
|
|||
this.debug_write(addr << 2, 4, value);
|
||||
|
||||
var page = addr >>> MMAP_BLOCK_BITS - 2;
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -321,9 +332,12 @@ Memory.prototype.write_blob = function(blob, offset)
|
|||
var page = offset >>> 12,
|
||||
end = (offset + blob) >>> 12;
|
||||
|
||||
for(; page <= end; page++)
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
for(; page <= end; page++)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ v86.prototype.getcf = function()
|
|||
{
|
||||
if(this.flags_changed & 1)
|
||||
{
|
||||
return +!!((this.last_op1 ^ (this.last_op1 ^ this.last_op2) & (this.last_op2 ^ this.last_add_result)) & this.last_op_size);
|
||||
return (this.last_op1 ^ (this.last_op1 ^ this.last_op2) & (this.last_op2 ^ this.last_add_result)) >>> this.last_op_size & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ v86.prototype.getzf = function()
|
|||
{
|
||||
if(this.flags_changed & flag_zero)
|
||||
{
|
||||
return (~this.last_result & this.last_result - 1) & this.last_op_size;
|
||||
return (~this.last_result & this.last_result - 1) >>> this.last_op_size & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ v86.prototype.getsf = function()
|
|||
{
|
||||
if(this.flags_changed & flag_sign)
|
||||
{
|
||||
return this.last_result & this.last_op_size;
|
||||
return this.last_result >>> this.last_op_size & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ v86.prototype.getof = function()
|
|||
{
|
||||
if(this.flags_changed & flag_overflow)
|
||||
{
|
||||
return ((this.last_op1 ^ this.last_add_result) & (this.last_op2 ^ this.last_add_result)) & this.last_op_size;
|
||||
return ((this.last_op1 ^ this.last_add_result) & (this.last_op2 ^ this.last_add_result)) >>> this.last_op_size & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
fn;\
|
||||
if(use_di) dest += size, cpu.regv[cpu.reg_vdi] += size;\
|
||||
if(use_si) src += size, cpu.regv[cpu.reg_vsi] += size;\
|
||||
cont = --cpu.regv[cpu.reg_vcx] && (!use_cmp || (data_src === data_dest) === (cpu.repeat_string_prefix === REPEAT_STRING_PREFIX_Z));\
|
||||
cont = --cpu.regv[cpu.reg_vcx] !== 0 && (!use_cmp || (data_src === data_dest) === (cpu.repeat_string_prefix === REPEAT_STRING_PREFIX_Z));\
|
||||
cpu.timestamp_counter++;\
|
||||
} while(cont && next_cycle--)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
fn;\
|
||||
if(use_di) phys_dest += single_size;\
|
||||
if(use_si) phys_src += single_size;\
|
||||
cont = --count && (!use_cmp || (data_src === data_dest) === (cpu.repeat_string_prefix === REPEAT_STRING_PREFIX_Z));\
|
||||
cont = --count !== 0 && (!use_cmp || (data_src === data_dest) === (cpu.repeat_string_prefix === REPEAT_STRING_PREFIX_Z));\
|
||||
cpu.timestamp_counter++;\
|
||||
} while(cont && next_cycle--)
|
||||
|
||||
|
|
Loading…
Reference in a new issue