| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index edde934b4e15a5a22de3c779e1f48e417e0d9521..0453272b8974cc4d49bf77de59cc3d6642576f29 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -3016,6 +3016,29 @@ void LCodeGen::DoPower(LPower* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoRandom(LRandom* instr) {
|
| + // Having marked this instruction as a call we can use any
|
| + // registers.
|
| + ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
|
| + ASSERT(ToRegister(instr->InputAt(0)).is(eax));
|
| +
|
| + __ PrepareCallCFunction(1, ebx);
|
| + __ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset));
|
| + __ mov(Operand(esp, 0), eax);
|
| + __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
|
| +
|
| + // Convert 32 random bits in eax to 0.(32 random bits) in a double
|
| + // by computing:
|
| + // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
|
| + __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
|
| + __ movd(xmm2, ebx);
|
| + __ movd(xmm1, eax);
|
| + __ cvtss2sd(xmm2, xmm2);
|
| + __ xorps(xmm1, xmm2);
|
| + __ subsd(xmm1, xmm2);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
|
| ASSERT(instr->value()->Equals(instr->result()));
|
| XMMRegister input_reg = ToDoubleRegister(instr->value());
|
|
|