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 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 | 3031 |
3032 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | 3032 // Convert 32 random bits in v0 to 0.(32 random bits) in a double |
3033 // by computing: | 3033 // by computing: |
3034 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3034 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3035 if (CpuFeatures::IsSupported(FPU)) { | 3035 if (CpuFeatures::IsSupported(FPU)) { |
3036 __ PrepareCallCFunction(1, a0); | 3036 __ PrepareCallCFunction(1, a0); |
3037 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 3037 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3038 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | 3038 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); |
3039 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3039 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3040 | 3040 |
3041 CpuFeatures::Scope scope(FPU); | 3041 CpuFeatureScope scope(masm(), FPU); |
3042 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3042 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3043 __ li(a1, Operand(0x41300000)); | 3043 __ li(a1, Operand(0x41300000)); |
3044 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | 3044 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. |
3045 __ Move(f12, v0, a1); | 3045 __ Move(f12, v0, a1); |
3046 // Move 0x4130000000000000 to FPU. | 3046 // Move 0x4130000000000000 to FPU. |
3047 __ Move(f14, zero_reg, a1); | 3047 __ Move(f14, zero_reg, a1); |
3048 // Subtract and store the result in the heap number. | 3048 // Subtract and store the result in the heap number. |
3049 __ sub_d(f0, f12, f14); | 3049 __ sub_d(f0, f12, f14); |
3050 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); | 3050 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); |
3051 __ mov(v0, s0); | 3051 __ mov(v0, s0); |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4588 *context_length = 0; | 4588 *context_length = 0; |
4589 return previous_; | 4589 return previous_; |
4590 } | 4590 } |
4591 | 4591 |
4592 | 4592 |
4593 #undef __ | 4593 #undef __ |
4594 | 4594 |
4595 } } // namespace v8::internal | 4595 } } // namespace v8::internal |
4596 | 4596 |
4597 #endif // V8_TARGET_ARCH_MIPS | 4597 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |