Chromium Code Reviews| 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 2908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2919 MathPowStub stub(MathPowStub::INTEGER); | 2919 MathPowStub stub(MathPowStub::INTEGER); |
| 2920 __ CallStub(&stub); | 2920 __ CallStub(&stub); |
| 2921 } else { | 2921 } else { |
| 2922 ASSERT(exponent_type.IsDouble()); | 2922 ASSERT(exponent_type.IsDouble()); |
| 2923 MathPowStub stub(MathPowStub::DOUBLE); | 2923 MathPowStub stub(MathPowStub::DOUBLE); |
| 2924 __ CallStub(&stub); | 2924 __ CallStub(&stub); |
| 2925 } | 2925 } |
| 2926 } | 2926 } |
| 2927 | 2927 |
| 2928 | 2928 |
| 2929 void LCodeGen::DoRandom(LRandom* instr) { | |
| 2930 // Having marked this instruction as a call we can use any | |
| 2931 // registers. | |
| 2932 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | |
| 2933 | |
| 2934 // Choose the right register for the first argument depending on | |
| 2935 // calling convention. | |
| 2936 #ifdef _WIN64 | |
| 2937 ASSERT(ToRegister(instr->InputAt(0)).is(rcx)); | |
| 2938 Register global_object = rdx; | |
|
Jakob Kummerow
2012/01/11 08:10:40
Unused variable. Also, s/rdx/rcx/.
Mads Ager (chromium)
2012/01/11 10:24:46
Done.
| |
| 2939 #else | |
| 2940 ASSERT(ToRegister(instr->InputAt(0)).is(rdi)); | |
| 2941 Register global_object = rdi; | |
| 2942 #endif | |
| 2943 | |
| 2944 __ PrepareCallCFunction(1); | |
| 2945 #ifdef _WIN64 | |
|
Jakob Kummerow
2012/01/11 08:10:40
If you made use of the |global_object| variable de
Mads Ager (chromium)
2012/01/11 10:24:46
Whoops. Thanks Jakob, that was indeed the intentio
| |
| 2946 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset)); | |
| 2947 #else | |
| 2948 __ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset)); | |
| 2949 #endif | |
| 2950 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
| 2951 | |
| 2952 // Convert 32 random bits in rax to 0.(32 random bits) in a double | |
| 2953 // by computing: | |
| 2954 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | |
| 2955 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | |
| 2956 __ movd(xmm2, rcx); | |
| 2957 __ movd(xmm1, rax); | |
| 2958 __ cvtss2sd(xmm2, xmm2); | |
| 2959 __ xorps(xmm1, xmm2); | |
| 2960 __ subsd(xmm1, xmm2); | |
| 2961 } | |
| 2962 | |
| 2963 | |
| 2929 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2964 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
| 2930 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2965 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 2931 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2966 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
| 2932 TranscendentalCacheStub::UNTAGGED); | 2967 TranscendentalCacheStub::UNTAGGED); |
| 2933 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2968 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 2934 } | 2969 } |
| 2935 | 2970 |
| 2936 | 2971 |
| 2937 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { | 2972 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { |
| 2938 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2973 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4337 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4372 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4338 ASSERT(osr_pc_offset_ == -1); | 4373 ASSERT(osr_pc_offset_ == -1); |
| 4339 osr_pc_offset_ = masm()->pc_offset(); | 4374 osr_pc_offset_ = masm()->pc_offset(); |
| 4340 } | 4375 } |
| 4341 | 4376 |
| 4342 #undef __ | 4377 #undef __ |
| 4343 | 4378 |
| 4344 } } // namespace v8::internal | 4379 } } // namespace v8::internal |
| 4345 | 4380 |
| 4346 #endif // V8_TARGET_ARCH_X64 | 4381 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |