On 2013/12/16 14:24:52, m.m.capewell wrote:
On 2013/12/16 14:22:27, Sven Panne wrote:
> Addressed feedback and made LChunkBuilder::DoMathLog more uniform across
> platforms.
I think you can either MarkAsCall() or stack/restore the registers
manually in
lithium-codegen using ldm/stm and vldm/vstm, at least for the ARM backend.
Of course one could do this manually, but this would mean that the platform
ABI
logic is spread over the source code, which would be fundamentally wrong.
MarkAsCall will mark far more registers as used than is actually necessary
if I
see things correctly. What we are missing in v8 is a simple and declarative
foreign function interface, e.g. in Haskell one can simply declare
foreign import ccall "log" c_log :: CDouble -> CDouble
and simply use c_log as if it was written in Haskell, other languages have
similar features.
For our problem at hand, one should probably simply write an assembly
version of
log for ARM and MIPS. This should be relatively easy using plain old math:
log((1+ mantissa) * (2 ^ exponent))
= log(1 + mantissa) + log(2 ^ exponent)
= log(1 + mantissa) + exponent * log(2)
Extracting exponent and mantissa is easy given IEEE754, to calculate log in
the
range [1..2) a few terms of the Taylor series (or some other approximation)
should suffice, log is very smooth. A quick Google search showed that this
seems
to be the standard way of doing it, e.g.:
http://www.netlib.org/fdlibm/e_log.c
https://code.google.com/p/math-neon/source/browse/trunk/math_logf.c
https://codereview.chromium.org/113343003/
--
--
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/groups/opt_out.