OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 __ CallStub(&stub); | 3393 __ CallStub(&stub); |
3394 } else { | 3394 } else { |
3395 DCHECK(exponent_type.IsDouble()); | 3395 DCHECK(exponent_type.IsDouble()); |
3396 MathPowStub stub(isolate(), MathPowStub::DOUBLE); | 3396 MathPowStub stub(isolate(), MathPowStub::DOUBLE); |
3397 __ CallStub(&stub); | 3397 __ CallStub(&stub); |
3398 } | 3398 } |
3399 } | 3399 } |
3400 | 3400 |
3401 | 3401 |
3402 void LCodeGen::DoMathLog(LMathLog* instr) { | 3402 void LCodeGen::DoMathLog(LMathLog* instr) { |
3403 DCHECK(instr->value()->Equals(instr->result())); | 3403 XMMRegister input = ToDoubleRegister(instr->value()); |
3404 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3404 XMMRegister result = ToDoubleRegister(instr->result()); |
3405 XMMRegister xmm_scratch = double_scratch0(); | 3405 // Pass one double as argument on the stack. |
3406 Label positive, done, zero; | 3406 __ PrepareCallCFunction(2, eax); |
3407 __ xorps(xmm_scratch, xmm_scratch); | 3407 __ movsd(Operand(esp, 0 * kDoubleSize), input); |
3408 __ ucomisd(input_reg, xmm_scratch); | 3408 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2); |
3409 __ j(above, &positive, Label::kNear); | 3409 // Return value is in st(0) on ia32. |
3410 __ j(not_carry, &zero, Label::kNear); | 3410 // Store it into the result register. |
3411 __ pcmpeqd(input_reg, input_reg); | 3411 __ sub(esp, Immediate(kDoubleSize)); |
3412 __ jmp(&done, Label::kNear); | |
3413 __ bind(&zero); | |
3414 ExternalReference ninf = | |
3415 ExternalReference::address_of_negative_infinity(); | |
3416 __ movsd(input_reg, Operand::StaticVariable(ninf)); | |
3417 __ jmp(&done, Label::kNear); | |
3418 __ bind(&positive); | |
3419 __ fldln2(); | |
3420 __ sub(Operand(esp), Immediate(kDoubleSize)); | |
3421 __ movsd(Operand(esp, 0), input_reg); | |
3422 __ fld_d(Operand(esp, 0)); | |
3423 __ fyl2x(); | |
3424 __ fstp_d(Operand(esp, 0)); | 3412 __ fstp_d(Operand(esp, 0)); |
3425 __ movsd(input_reg, Operand(esp, 0)); | 3413 __ movsd(result, Operand(esp, 0)); |
3426 __ add(Operand(esp), Immediate(kDoubleSize)); | 3414 __ add(esp, Immediate(kDoubleSize)); |
3427 __ bind(&done); | |
3428 } | 3415 } |
3429 | 3416 |
3430 | 3417 |
3431 void LCodeGen::DoMathClz32(LMathClz32* instr) { | 3418 void LCodeGen::DoMathClz32(LMathClz32* instr) { |
3432 Register input = ToRegister(instr->value()); | 3419 Register input = ToRegister(instr->value()); |
3433 Register result = ToRegister(instr->result()); | 3420 Register result = ToRegister(instr->result()); |
3434 | 3421 |
3435 __ Lzcnt(result, input); | 3422 __ Lzcnt(result, input); |
3436 } | 3423 } |
3437 | 3424 |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5319 __ bind(deferred->exit()); | 5306 __ bind(deferred->exit()); |
5320 __ bind(&done); | 5307 __ bind(&done); |
5321 } | 5308 } |
5322 | 5309 |
5323 #undef __ | 5310 #undef __ |
5324 | 5311 |
5325 } // namespace internal | 5312 } // namespace internal |
5326 } // namespace v8 | 5313 } // namespace v8 |
5327 | 5314 |
5328 #endif // V8_TARGET_ARCH_IA32 | 5315 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |