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 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 MathPowStub stub(MathPowStub::INTEGER); | 2924 MathPowStub stub(MathPowStub::INTEGER); |
2925 __ CallStub(&stub); | 2925 __ CallStub(&stub); |
2926 } else { | 2926 } else { |
2927 ASSERT(exponent_type.IsDouble()); | 2927 ASSERT(exponent_type.IsDouble()); |
2928 MathPowStub stub(MathPowStub::DOUBLE); | 2928 MathPowStub stub(MathPowStub::DOUBLE); |
2929 __ CallStub(&stub); | 2929 __ CallStub(&stub); |
2930 } | 2930 } |
2931 } | 2931 } |
2932 | 2932 |
2933 | 2933 |
| 2934 void LCodeGen::DoRandom(LRandom* instr) { |
| 2935 // Having marked this instruction as a call we can use any |
| 2936 // registers. |
| 2937 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 2938 |
| 2939 // Choose the right register for the first argument depending on |
| 2940 // calling convention. |
| 2941 #ifdef _WIN64 |
| 2942 ASSERT(ToRegister(instr->InputAt(0)).is(rcx)); |
| 2943 Register global_object = rcx; |
| 2944 #else |
| 2945 ASSERT(ToRegister(instr->InputAt(0)).is(rdi)); |
| 2946 Register global_object = rdi; |
| 2947 #endif |
| 2948 |
| 2949 __ PrepareCallCFunction(1); |
| 2950 __ movq(global_object, |
| 2951 FieldOperand(global_object, GlobalObject::kGlobalContextOffset)); |
| 2952 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 2953 |
| 2954 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
| 2955 // by computing: |
| 2956 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2957 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 2958 __ movd(xmm2, rcx); |
| 2959 __ movd(xmm1, rax); |
| 2960 __ cvtss2sd(xmm2, xmm2); |
| 2961 __ xorps(xmm1, xmm2); |
| 2962 __ subsd(xmm1, xmm2); |
| 2963 } |
| 2964 |
| 2965 |
2934 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2966 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
2935 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2967 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
2936 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2968 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
2937 TranscendentalCacheStub::UNTAGGED); | 2969 TranscendentalCacheStub::UNTAGGED); |
2938 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2970 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
2939 } | 2971 } |
2940 | 2972 |
2941 | 2973 |
2942 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { | 2974 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { |
2943 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2975 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4342 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4374 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4343 ASSERT(osr_pc_offset_ == -1); | 4375 ASSERT(osr_pc_offset_ == -1); |
4344 osr_pc_offset_ = masm()->pc_offset(); | 4376 osr_pc_offset_ = masm()->pc_offset(); |
4345 } | 4377 } |
4346 | 4378 |
4347 #undef __ | 4379 #undef __ |
4348 | 4380 |
4349 } } // namespace v8::internal | 4381 } } // namespace v8::internal |
4350 | 4382 |
4351 #endif // V8_TARGET_ARCH_X64 | 4383 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |