| 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 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 | 2826 |
| 2827 Label non_smi, call; | 2827 Label non_smi, call; |
| 2828 __ JumpIfNotSmi(right_reg, &non_smi); | 2828 __ JumpIfNotSmi(right_reg, &non_smi); |
| 2829 __ SmiToInteger32(right_reg, right_reg); | 2829 __ SmiToInteger32(right_reg, right_reg); |
| 2830 __ cvtlsi2sd(xmm1, right_reg); | 2830 __ cvtlsi2sd(xmm1, right_reg); |
| 2831 __ jmp(&call); | 2831 __ jmp(&call); |
| 2832 | 2832 |
| 2833 __ bind(&non_smi); | 2833 __ bind(&non_smi); |
| 2834 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , kScratchRegister); | 2834 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , kScratchRegister); |
| 2835 DeoptimizeIf(not_equal, instr->environment()); | 2835 DeoptimizeIf(not_equal, instr->environment()); |
| 2836 __ movsd(xmm1, FieldOperand(right_reg, HeapNumber::kValueOffset)); | 2836 __ LoadDbl(xmm1, FieldOperand(right_reg, HeapNumber::kValueOffset)); |
| 2837 | 2837 |
| 2838 __ bind(&call); | 2838 __ bind(&call); |
| 2839 __ PrepareCallCFunction(2); | 2839 __ PrepareCallCFunction(2); |
| 2840 // Move arguments to correct registers xmm0 and xmm1. | 2840 // Move arguments to correct registers xmm0 and xmm1. |
| 2841 __ movaps(xmm0, left_reg); | 2841 __ movaps(xmm0, left_reg); |
| 2842 // Right argument is already in xmm1. | 2842 // Right argument is already in xmm1. |
| 2843 __ CallCFunction( | 2843 __ CallCFunction( |
| 2844 ExternalReference::power_double_double_function(isolate()), 2); | 2844 ExternalReference::power_double_double_function(isolate()), 2); |
| 2845 } | 2845 } |
| 2846 // Return value is in xmm0. | 2846 // Return value is in xmm0. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3429 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 3429 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
| 3430 DeoptimizeIf(not_equal, env); | 3430 DeoptimizeIf(not_equal, env); |
| 3431 | 3431 |
| 3432 // Convert undefined to NaN. Compute NaN as 0/0. | 3432 // Convert undefined to NaN. Compute NaN as 0/0. |
| 3433 __ xorps(result_reg, result_reg); | 3433 __ xorps(result_reg, result_reg); |
| 3434 __ divsd(result_reg, result_reg); | 3434 __ divsd(result_reg, result_reg); |
| 3435 __ jmp(&done); | 3435 __ jmp(&done); |
| 3436 | 3436 |
| 3437 // Heap number to XMM conversion. | 3437 // Heap number to XMM conversion. |
| 3438 __ bind(&heap_number); | 3438 __ bind(&heap_number); |
| 3439 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3439 __ LoadDbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 3440 __ jmp(&done); | 3440 __ jmp(&done); |
| 3441 | 3441 |
| 3442 // Smi to XMM conversion | 3442 // Smi to XMM conversion |
| 3443 __ bind(&load_smi); | 3443 __ bind(&load_smi); |
| 3444 __ SmiToInteger32(kScratchRegister, input_reg); | 3444 __ SmiToInteger32(kScratchRegister, input_reg); |
| 3445 __ cvtlsi2sd(result_reg, kScratchRegister); | 3445 __ cvtlsi2sd(result_reg, kScratchRegister); |
| 3446 __ bind(&done); | 3446 __ bind(&done); |
| 3447 } | 3447 } |
| 3448 | 3448 |
| 3449 | 3449 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3469 __ j(equal, &heap_number); | 3469 __ j(equal, &heap_number); |
| 3470 // Check for undefined. Undefined is converted to zero for truncating | 3470 // Check for undefined. Undefined is converted to zero for truncating |
| 3471 // conversions. | 3471 // conversions. |
| 3472 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 3472 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
| 3473 DeoptimizeIf(not_equal, instr->environment()); | 3473 DeoptimizeIf(not_equal, instr->environment()); |
| 3474 __ Set(input_reg, 0); | 3474 __ Set(input_reg, 0); |
| 3475 __ jmp(&done); | 3475 __ jmp(&done); |
| 3476 | 3476 |
| 3477 __ bind(&heap_number); | 3477 __ bind(&heap_number); |
| 3478 | 3478 |
| 3479 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3479 __ LoadDbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 3480 __ cvttsd2siq(input_reg, xmm0); | 3480 __ cvttsd2siq(input_reg, xmm0); |
| 3481 __ Set(kScratchRegister, V8_UINT64_C(0x8000000000000000)); | 3481 __ Set(kScratchRegister, V8_UINT64_C(0x8000000000000000)); |
| 3482 __ cmpq(input_reg, kScratchRegister); | 3482 __ cmpq(input_reg, kScratchRegister); |
| 3483 DeoptimizeIf(equal, instr->environment()); | 3483 DeoptimizeIf(equal, instr->environment()); |
| 3484 } else { | 3484 } else { |
| 3485 // Deoptimize if we don't have a heap number. | 3485 // Deoptimize if we don't have a heap number. |
| 3486 DeoptimizeIf(not_equal, instr->environment()); | 3486 DeoptimizeIf(not_equal, instr->environment()); |
| 3487 | 3487 |
| 3488 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0)); | 3488 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0)); |
| 3489 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3489 __ LoadDbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 3490 __ cvttsd2si(input_reg, xmm0); | 3490 __ cvttsd2si(input_reg, xmm0); |
| 3491 __ cvtlsi2sd(xmm_temp, input_reg); | 3491 __ cvtlsi2sd(xmm_temp, input_reg); |
| 3492 __ ucomisd(xmm0, xmm_temp); | 3492 __ ucomisd(xmm0, xmm_temp); |
| 3493 DeoptimizeIf(not_equal, instr->environment()); | 3493 DeoptimizeIf(not_equal, instr->environment()); |
| 3494 DeoptimizeIf(parity_even, instr->environment()); // NaN. | 3494 DeoptimizeIf(parity_even, instr->environment()); // NaN. |
| 3495 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3495 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 3496 __ testl(input_reg, input_reg); | 3496 __ testl(input_reg, input_reg); |
| 3497 __ j(not_zero, &done); | 3497 __ j(not_zero, &done); |
| 3498 __ movmskpd(input_reg, xmm0); | 3498 __ movmskpd(input_reg, xmm0); |
| 3499 __ andl(input_reg, Immediate(1)); | 3499 __ andl(input_reg, Immediate(1)); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4024 RegisterEnvironmentForDeoptimization(environment); | 4024 RegisterEnvironmentForDeoptimization(environment); |
| 4025 ASSERT(osr_pc_offset_ == -1); | 4025 ASSERT(osr_pc_offset_ == -1); |
| 4026 osr_pc_offset_ = masm()->pc_offset(); | 4026 osr_pc_offset_ = masm()->pc_offset(); |
| 4027 } | 4027 } |
| 4028 | 4028 |
| 4029 #undef __ | 4029 #undef __ |
| 4030 | 4030 |
| 4031 } } // namespace v8::internal | 4031 } } // namespace v8::internal |
| 4032 | 4032 |
| 4033 #endif // V8_TARGET_ARCH_X64 | 4033 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |