OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 MathPowStub stub(MathPowStub::INTEGER); | 3183 MathPowStub stub(MathPowStub::INTEGER); |
3184 __ CallStub(&stub); | 3184 __ CallStub(&stub); |
3185 } else { | 3185 } else { |
3186 ASSERT(exponent_type.IsDouble()); | 3186 ASSERT(exponent_type.IsDouble()); |
3187 MathPowStub stub(MathPowStub::DOUBLE); | 3187 MathPowStub stub(MathPowStub::DOUBLE); |
3188 __ CallStub(&stub); | 3188 __ CallStub(&stub); |
3189 } | 3189 } |
3190 } | 3190 } |
3191 | 3191 |
3192 | 3192 |
| 3193 void LCodeGen::DoRandom(LRandom* instr) { |
| 3194 // Having marked this instruction as a call we can use any |
| 3195 // registers. |
| 3196 ASSERT(ToDoubleRegister(instr->result()).is(d7)); |
| 3197 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); |
| 3198 |
| 3199 __ PrepareCallCFunction(1, scratch0()); |
| 3200 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
| 3201 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 3202 |
| 3203 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
| 3204 // Create this constant using mov/orr to avoid PC relative load. |
| 3205 __ mov(r1, Operand(0x41000000)); |
| 3206 __ orr(r1, r1, Operand(0x300000)); |
| 3207 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
| 3208 __ vmov(d7, r0, r1); |
| 3209 // Move 0x4130000000000000 to VFP. |
| 3210 __ mov(r0, Operand(0, RelocInfo::NONE)); |
| 3211 __ vmov(d8, r0, r1); |
| 3212 // Subtract and store the result in the heap number. |
| 3213 __ vsub(d7, d7, d8); |
| 3214 } |
| 3215 |
| 3216 |
3193 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 3217 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
3194 ASSERT(ToDoubleRegister(instr->result()).is(d2)); | 3218 ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
3195 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 3219 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
3196 TranscendentalCacheStub::UNTAGGED); | 3220 TranscendentalCacheStub::UNTAGGED); |
3197 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3221 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
3198 } | 3222 } |
3199 | 3223 |
3200 | 3224 |
3201 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { | 3225 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { |
3202 ASSERT(ToDoubleRegister(instr->result()).is(d2)); | 3226 ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4745 ASSERT(osr_pc_offset_ == -1); | 4769 ASSERT(osr_pc_offset_ == -1); |
4746 osr_pc_offset_ = masm()->pc_offset(); | 4770 osr_pc_offset_ = masm()->pc_offset(); |
4747 } | 4771 } |
4748 | 4772 |
4749 | 4773 |
4750 | 4774 |
4751 | 4775 |
4752 #undef __ | 4776 #undef __ |
4753 | 4777 |
4754 } } // namespace v8::internal | 4778 } } // namespace v8::internal |
OLD | NEW |