Status: New
Owner: ----
New issue 3260 by soywiz: Promote Typed Array elements as native registers
http://code.google.com/p/v8/issues/detail?id=3260
I'm creating a javascript psp emulator:
http://jspspemu.com/#samples/reflection.pbp
https://github.com/soywiz/jspspemu
I'm performing a simple JIT (mips -> js) that compiles at this point basic
blocks, and will eventually create larger functions emulating jumps with a
machine state as emscripten does with arbintrary branches and create normal
loops in some cases.
To emulate 32 32-bit mips registers, I'm using a typed array: var gpr = new
Int32Array(32);
And to perform arithmetic operations I'm performing something like this:
gpr[1] = gpr[2] + gpr[3];
memory.u32[gpr[1]] = gpr[4];
A simple benchmark with this:
http://jsperf.com/loop-with-array-as-variables/3
I like this, because it is simple, and I don't have to do |0 or >>>0 tricks
to get 32-bit arithmetic.
And I was wondering if it would be possible to get a performance boost with
this; accessing constant positions in typed arrays; so I don't have to
extract registers into variables and perform |0 and >>>0 tricks. It could
be also a nice trick to know that the variable is a 32-bit integer and
perform faster native arithmetic without too much heuristics.
About that, I was thinking about some edge cases.
If you are using a single typed array, you can safely read that value from
memory before a loop, use it as a register, and then store it again into
memory after the loop for example.
In the case you are using several typed arrays, you would have to determine
that the arraybuffer sources from those typed arrays are different to do
this safely.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.