Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 7ddfb27b742c56594422bfb00d6ae0f17dcd5693..ffc465a190b04d755649e8f68cddea9435b6a7ec 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3195,6 +3195,30 @@ 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(d7)); |
+ ASSERT(ToRegister(instr->InputAt(0)).is(r0)); |
+ |
+ __ PrepareCallCFunction(1, scratch0()); |
+ __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
+ |
+ // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
+ // Create this constant using mov/orr to avoid PC relative load. |
+ __ mov(r1, Operand(0x41000000)); |
+ __ orr(r1, r1, Operand(0x300000)); |
+ // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
+ __ vmov(d7, r0, r1); |
+ // Move 0x4130000000000000 to VFP. |
+ __ mov(r0, Operand(0, RelocInfo::NONE)); |
+ __ vmov(d8, r0, r1); |
+ // Subtract and store the result in the heap number. |
+ __ vsub(d7, d7, d8); |
+} |
+ |
+ |
void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
TranscendentalCacheStub stub(TranscendentalCache::LOG, |