[webkit-dev] Unnecessary instructions in bytecode

Gabor Loki loki at inf.u-szeged.hu
Fri May 23 04:55:14 PDT 2008


Gabor Loki wrote:
> I have noticed some strange loads in the bytecode (rev34071).
> They look like unnecessary.
> 
> Here it is a simple js:
> 
>   var a, b;
>   a = 5;
>   b = a * a + a;
> 
> And the bytecode output was with 'testkjs -d -f 1.js':
> 
> 9 instructions; 224 bytes at 0x69ca30; 2 locals (0 parameters); 2 temporaries
> 
> [   0] load		 lr6, undefined(@k0)		
> [   3] load		 lr7, undefined(@k0)		
> [   6] load		 tr0, undefined(@k0)		
> [   9] load		 lr6, 5(@k1)		
> [  12] mov		 tr0, lr6
> [  15] mul		 tr1, lr6, lr6
> [  19] add		 lr7, tr1, lr6
> [  23] mov		 tr0, lr7
> [  26] end		 tr0
> 
> Constants:
>    k0 = undefined
>    k1 = 5
> 
> End: 30
> 
> 
> These instructions are unnecessary, aren't they?
> Or is there a technical explanation of them?

Opps, I forgot to point on the instructions.
I think that the first three loads are unnecessary.
[   0] load		 lr6, undefined(@k0)		
[   3] load		 lr7, undefined(@k0)		
[   6] load		 tr0, undefined(@k0)		


--Gabor




More information about the webkit-dev mailing list