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 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2455 XMMRegister xmm_scratch = xmm0; | 2455 XMMRegister xmm_scratch = xmm0; |
2456 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); | 2456 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
2457 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 2457 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); |
2458 __ xorpd(xmm_scratch, xmm_scratch); | 2458 __ xorpd(xmm_scratch, xmm_scratch); |
2459 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. | 2459 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. |
2460 __ sqrtsd(input_reg, input_reg); | 2460 __ sqrtsd(input_reg, input_reg); |
2461 } | 2461 } |
2462 | 2462 |
2463 | 2463 |
2464 void LCodeGen::DoPower(LPower* instr) { | 2464 void LCodeGen::DoPower(LPower* instr) { |
2465 Abort("Unimplemented: %s", "DoPower"); | 2465 LOperand* left = instr->InputAt(0); |
2466 DoubleRegister left_reg = ToDoubleRegister(left); | |
Rico
2011/02/28 19:18:34
I don't think we use DoubleRegister anywhere else
| |
2467 LOperand* right = instr->InputAt(1); | |
2468 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | |
2469 Representation exponent_type = instr->hydrogen()->right()->representation(); | |
2470 if (exponent_type.IsDouble()) { | |
2471 DoubleRegister right_reg = ToDoubleRegister(right); | |
2472 __ PrepareCallCFunction(2); | |
2473 // Move arguments to correct registers | |
2474 __ movsd(xmm0, left_reg); | |
2475 if (!right_reg.is(xmm1)) { | |
Rico
2011/02/28 19:18:34
We know that right is in xmm2, you explicitly requ
| |
2476 __ movsd(xmm1, right_reg); | |
2477 } | |
2478 __ CallCFunction(ExternalReference::power_double_double_function(), 4); | |
2479 } else if (exponent_type.IsInteger32()) { | |
2480 Register right_reg = ToRegister(right); | |
2481 __ PrepareCallCFunction(2); | |
2482 // Move arguments to correct registers: xmm0 and edi (not rdi). | |
2483 __ movsd(xmm0, left_reg); | |
2484 if (!right_reg.is(rdi)) { | |
Rico
2011/02/28 19:18:34
We know that right is in rax, you explicitly reque
| |
2485 __ movl(rdi, right_reg); | |
2486 } | |
2487 __ CallCFunction(ExternalReference::power_double_int_function(), 4); | |
2488 } else { | |
2489 ASSERT(exponent_type.IsTagged()); | |
2490 CpuFeatures::Scope scope(SSE2); | |
2491 Register right_reg = ToRegister(right); | |
2492 | |
2493 Label non_smi, call; | |
2494 __ JumpIfNotSmi(right_reg, &non_smi); | |
2495 __ SmiToInteger32(right_reg, right_reg); | |
2496 __ cvtlsi2sd(result_reg, right_reg); | |
2497 __ jmp(&call); | |
2498 | |
2499 __ bind(&non_smi); | |
2500 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , kScratchRegister); | |
2501 DeoptimizeIf(not_equal, instr->environment()); | |
2502 __ movsd(result_reg, FieldOperand(right_reg, HeapNumber::kValueOffset)); | |
2503 | |
2504 __ bind(&call); | |
2505 __ PrepareCallCFunction(2); | |
2506 // Move arguments to correct registers xmm0 and xmm1. | |
2507 __ movsd(xmm0, left_reg); | |
2508 if (!result_reg.is(xmm1)) { | |
2509 __ movsd(xmm1, result_reg); | |
2510 } | |
2511 // Right argument is already in xmm1. | |
2512 __ CallCFunction(ExternalReference::power_double_double_function(), 4); | |
2513 } | |
2514 // Return value is in xmm0. | |
2515 __ movsd(result_reg, xmm0); | |
2466 } | 2516 } |
2467 | 2517 |
2468 | 2518 |
2469 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2519 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
2470 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2520 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
2471 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2521 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
2472 TranscendentalCacheStub::UNTAGGED); | 2522 TranscendentalCacheStub::UNTAGGED); |
2473 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2523 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
2474 } | 2524 } |
2475 | 2525 |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3552 RegisterEnvironmentForDeoptimization(environment); | 3602 RegisterEnvironmentForDeoptimization(environment); |
3553 ASSERT(osr_pc_offset_ == -1); | 3603 ASSERT(osr_pc_offset_ == -1); |
3554 osr_pc_offset_ = masm()->pc_offset(); | 3604 osr_pc_offset_ = masm()->pc_offset(); |
3555 } | 3605 } |
3556 | 3606 |
3557 #undef __ | 3607 #undef __ |
3558 | 3608 |
3559 } } // namespace v8::internal | 3609 } } // namespace v8::internal |
3560 | 3610 |
3561 #endif // V8_TARGET_ARCH_X64 | 3611 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |