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 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 | 3041 |
3042 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | 3042 // Convert 32 random bits in v0 to 0.(32 random bits) in a double |
3043 // by computing: | 3043 // by computing: |
3044 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3044 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3045 if (CpuFeatures::IsSupported(FPU)) { | 3045 if (CpuFeatures::IsSupported(FPU)) { |
3046 __ PrepareCallCFunction(1, a0); | 3046 __ PrepareCallCFunction(1, a0); |
3047 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 3047 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3048 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | 3048 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); |
3049 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3049 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3050 | 3050 |
3051 CpuFeatures::Scope scope(FPU); | 3051 CpuFeatureScope scope(masm(), FPU); |
3052 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3052 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3053 __ li(a1, Operand(0x41300000)); | 3053 __ li(a1, Operand(0x41300000)); |
3054 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | 3054 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. |
3055 __ Move(f12, v0, a1); | 3055 __ Move(f12, v0, a1); |
3056 // Move 0x4130000000000000 to FPU. | 3056 // Move 0x4130000000000000 to FPU. |
3057 __ Move(f14, zero_reg, a1); | 3057 __ Move(f14, zero_reg, a1); |
3058 // Subtract and store the result in the heap number. | 3058 // Subtract and store the result in the heap number. |
3059 __ sub_d(f0, f12, f14); | 3059 __ sub_d(f0, f12, f14); |
3060 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); | 3060 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); |
3061 __ mov(v0, s0); | 3061 __ mov(v0, s0); |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 *context_length = 0; | 4598 *context_length = 0; |
4599 return previous_; | 4599 return previous_; |
4600 } | 4600 } |
4601 | 4601 |
4602 | 4602 |
4603 #undef __ | 4603 #undef __ |
4604 | 4604 |
4605 } } // namespace v8::internal | 4605 } } // namespace v8::internal |
4606 | 4606 |
4607 #endif // V8_TARGET_ARCH_MIPS | 4607 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |