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 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3007 MathPowStub stub(MathPowStub::INTEGER); | 3007 MathPowStub stub(MathPowStub::INTEGER); |
3008 __ CallStub(&stub); | 3008 __ CallStub(&stub); |
3009 } else { | 3009 } else { |
3010 ASSERT(exponent_type.IsDouble()); | 3010 ASSERT(exponent_type.IsDouble()); |
3011 MathPowStub stub(MathPowStub::DOUBLE); | 3011 MathPowStub stub(MathPowStub::DOUBLE); |
3012 __ CallStub(&stub); | 3012 __ CallStub(&stub); |
3013 } | 3013 } |
3014 } | 3014 } |
3015 | 3015 |
3016 | 3016 |
| 3017 void LCodeGen::DoRandom(LRandom* instr) { |
| 3018 // Having marked this instruction as a call we can use any |
| 3019 // registers. |
| 3020 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 3021 ASSERT(ToRegister(instr->InputAt(0)).is(eax)); |
| 3022 |
| 3023 __ PrepareCallCFunction(1, ebx); |
| 3024 __ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset)); |
| 3025 __ mov(Operand(esp, 0), eax); |
| 3026 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 3027 |
| 3028 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
| 3029 // by computing: |
| 3030 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 3031 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 3032 __ movd(xmm2, ebx); |
| 3033 __ movd(xmm1, eax); |
| 3034 __ cvtss2sd(xmm2, xmm2); |
| 3035 __ xorps(xmm1, xmm2); |
| 3036 __ subsd(xmm1, xmm2); |
| 3037 } |
| 3038 |
| 3039 |
3017 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 3040 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
3018 ASSERT(instr->value()->Equals(instr->result())); | 3041 ASSERT(instr->value()->Equals(instr->result())); |
3019 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3042 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
3020 Label positive, done, zero; | 3043 Label positive, done, zero; |
3021 __ xorps(xmm0, xmm0); | 3044 __ xorps(xmm0, xmm0); |
3022 __ ucomisd(input_reg, xmm0); | 3045 __ ucomisd(input_reg, xmm0); |
3023 __ j(above, &positive, Label::kNear); | 3046 __ j(above, &positive, Label::kNear); |
3024 __ j(equal, &zero, Label::kNear); | 3047 __ j(equal, &zero, Label::kNear); |
3025 ExternalReference nan = | 3048 ExternalReference nan = |
3026 ExternalReference::address_of_canonical_non_hole_nan(); | 3049 ExternalReference::address_of_canonical_non_hole_nan(); |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 this, pointers, Safepoint::kLazyDeopt); | 4642 this, pointers, Safepoint::kLazyDeopt); |
4620 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4643 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4621 } | 4644 } |
4622 | 4645 |
4623 | 4646 |
4624 #undef __ | 4647 #undef __ |
4625 | 4648 |
4626 } } // namespace v8::internal | 4649 } } // namespace v8::internal |
4627 | 4650 |
4628 #endif // V8_TARGET_ARCH_IA32 | 4651 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |