OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 | 2719 |
2720 __ PrepareCallCFunction(1, ebx); | 2720 __ PrepareCallCFunction(1, ebx); |
2721 __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address())); | 2721 __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address())); |
2722 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), | 2722 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), |
2723 1); | 2723 1); |
2724 | 2724 |
2725 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2725 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
2726 // by computing: | 2726 // by computing: |
2727 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2727 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2728 // This is implemented on both SSE2 and FPU. | 2728 // This is implemented on both SSE2 and FPU. |
2729 if (isolate()->cpu_features()->IsSupported(SSE2)) { | 2729 if (CpuFeatures::IsSupported(SSE2)) { |
2730 CpuFeatures::Scope fscope(SSE2); | 2730 CpuFeatures::Scope fscope(SSE2); |
2731 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2731 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
2732 __ movd(xmm1, Operand(ebx)); | 2732 __ movd(xmm1, Operand(ebx)); |
2733 __ movd(xmm0, Operand(eax)); | 2733 __ movd(xmm0, Operand(eax)); |
2734 __ cvtss2sd(xmm1, xmm1); | 2734 __ cvtss2sd(xmm1, xmm1); |
2735 __ pxor(xmm0, xmm1); | 2735 __ pxor(xmm0, xmm1); |
2736 __ subsd(xmm0, xmm1); | 2736 __ subsd(xmm0, xmm1); |
2737 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); | 2737 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); |
2738 } else { | 2738 } else { |
2739 // 0x4130000000000000 is 1.0 x 2^20 as a double. | 2739 // 0x4130000000000000 is 1.0 x 2^20 as a double. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 context()->Plug(eax); | 2794 context()->Plug(eax); |
2795 } | 2795 } |
2796 | 2796 |
2797 | 2797 |
2798 void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) { | 2798 void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) { |
2799 // Load the arguments on the stack and call the runtime function. | 2799 // Load the arguments on the stack and call the runtime function. |
2800 ASSERT(args->length() == 2); | 2800 ASSERT(args->length() == 2); |
2801 VisitForStackValue(args->at(0)); | 2801 VisitForStackValue(args->at(0)); |
2802 VisitForStackValue(args->at(1)); | 2802 VisitForStackValue(args->at(1)); |
2803 | 2803 |
2804 if (isolate()->cpu_features()->IsSupported(SSE2)) { | 2804 if (CpuFeatures::IsSupported(SSE2)) { |
2805 MathPowStub stub; | 2805 MathPowStub stub; |
2806 __ CallStub(&stub); | 2806 __ CallStub(&stub); |
2807 } else { | 2807 } else { |
2808 __ CallRuntime(Runtime::kMath_pow, 2); | 2808 __ CallRuntime(Runtime::kMath_pow, 2); |
2809 } | 2809 } |
2810 context()->Plug(eax); | 2810 context()->Plug(eax); |
2811 } | 2811 } |
2812 | 2812 |
2813 | 2813 |
2814 void FullCodeGenerator::EmitSetValueOf(ZoneList<Expression*>* args) { | 2814 void FullCodeGenerator::EmitSetValueOf(ZoneList<Expression*>* args) { |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 // And return. | 4291 // And return. |
4292 __ ret(0); | 4292 __ ret(0); |
4293 } | 4293 } |
4294 | 4294 |
4295 | 4295 |
4296 #undef __ | 4296 #undef __ |
4297 | 4297 |
4298 } } // namespace v8::internal | 4298 } } // namespace v8::internal |
4299 | 4299 |
4300 #endif // V8_TARGET_ARCH_IA32 | 4300 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |