| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 int false_block = instr->FalseDestination(chunk_); | 1940 int false_block = instr->FalseDestination(chunk_); |
| 1941 __ j(cc, chunk_->GetAssemblyLabel(false_block)); | 1941 __ j(cc, chunk_->GetAssemblyLabel(false_block)); |
| 1942 } | 1942 } |
| 1943 | 1943 |
| 1944 | 1944 |
| 1945 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { | 1945 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
| 1946 __ int3(); | 1946 __ int3(); |
| 1947 } | 1947 } |
| 1948 | 1948 |
| 1949 | 1949 |
| 1950 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { |
| 1951 Representation r = instr->hydrogen()->value()->representation(); |
| 1952 if (r.IsSmiOrInteger32() || r.IsDouble()) { |
| 1953 EmitBranch(instr, no_condition); |
| 1954 } else { |
| 1955 ASSERT(r.IsTagged()); |
| 1956 Register reg = ToRegister(instr->value()); |
| 1957 HType type = instr->hydrogen()->value()->type(); |
| 1958 if (type.IsTaggedNumber()) { |
| 1959 EmitBranch(instr, no_condition); |
| 1960 } |
| 1961 __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); |
| 1962 __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset), |
| 1963 Heap::kHeapNumberMapRootIndex); |
| 1964 EmitBranch(instr, equal); |
| 1965 } |
| 1966 } |
| 1967 |
| 1968 |
| 1950 void LCodeGen::DoBranch(LBranch* instr) { | 1969 void LCodeGen::DoBranch(LBranch* instr) { |
| 1951 Representation r = instr->hydrogen()->value()->representation(); | 1970 Representation r = instr->hydrogen()->value()->representation(); |
| 1952 if (r.IsInteger32()) { | 1971 if (r.IsInteger32()) { |
| 1953 ASSERT(!info()->IsStub()); | 1972 ASSERT(!info()->IsStub()); |
| 1954 Register reg = ToRegister(instr->value()); | 1973 Register reg = ToRegister(instr->value()); |
| 1955 __ testl(reg, reg); | 1974 __ testl(reg, reg); |
| 1956 EmitBranch(instr, not_zero); | 1975 EmitBranch(instr, not_zero); |
| 1957 } else if (r.IsSmi()) { | 1976 } else if (r.IsSmi()) { |
| 1958 ASSERT(!info()->IsStub()); | 1977 ASSERT(!info()->IsStub()); |
| 1959 Register reg = ToRegister(instr->value()); | 1978 Register reg = ToRegister(instr->value()); |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 | 2792 |
| 2774 __ bind(&skip_assignment); | 2793 __ bind(&skip_assignment); |
| 2775 } | 2794 } |
| 2776 | 2795 |
| 2777 | 2796 |
| 2778 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2797 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2779 HObjectAccess access = instr->hydrogen()->access(); | 2798 HObjectAccess access = instr->hydrogen()->access(); |
| 2780 int offset = access.offset(); | 2799 int offset = access.offset(); |
| 2781 | 2800 |
| 2782 if (access.IsExternalMemory()) { | 2801 if (access.IsExternalMemory()) { |
| 2783 ASSERT(!access.representation().IsInteger32()); | |
| 2784 Register result = ToRegister(instr->result()); | 2802 Register result = ToRegister(instr->result()); |
| 2785 if (instr->object()->IsConstantOperand()) { | 2803 if (instr->object()->IsConstantOperand()) { |
| 2786 ASSERT(result.is(rax)); | 2804 ASSERT(result.is(rax)); |
| 2787 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); | 2805 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); |
| 2788 } else { | 2806 } else { |
| 2789 Register object = ToRegister(instr->object()); | 2807 Register object = ToRegister(instr->object()); |
| 2790 __ movq(result, MemOperand(object, offset)); | 2808 __ movq(result, MemOperand(object, offset)); |
| 2791 } | 2809 } |
| 2792 return; | 2810 return; |
| 2793 } | 2811 } |
| 2794 | 2812 |
| 2795 Register object = ToRegister(instr->object()); | 2813 Register object = ToRegister(instr->object()); |
| 2796 if (FLAG_track_double_fields && | 2814 if (FLAG_track_double_fields && |
| 2797 instr->hydrogen()->representation().IsDouble()) { | 2815 instr->hydrogen()->representation().IsDouble()) { |
| 2798 XMMRegister result = ToDoubleRegister(instr->result()); | 2816 XMMRegister result = ToDoubleRegister(instr->result()); |
| 2799 __ movsd(result, FieldOperand(object, offset)); | 2817 __ movsd(result, FieldOperand(object, offset)); |
| 2800 return; | 2818 return; |
| 2801 } | 2819 } |
| 2802 | 2820 |
| 2803 Register result = ToRegister(instr->result()); | 2821 Register result = ToRegister(instr->result()); |
| 2804 if (access.IsInobject()) { | 2822 if (access.IsInobject()) { |
| 2805 if (access.representation().IsInteger32()) { | 2823 __ movq(result, FieldOperand(object, offset)); |
| 2806 __ movl(result, FieldOperand(object, offset)); | |
| 2807 } else { | |
| 2808 __ movq(result, FieldOperand(object, offset)); | |
| 2809 } | |
| 2810 } else { | 2824 } else { |
| 2811 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2825 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 2812 if (access.representation().IsInteger32()) { | 2826 __ movq(result, FieldOperand(result, offset)); |
| 2813 __ movl(result, FieldOperand(result, offset)); | |
| 2814 } else { | |
| 2815 __ movq(result, FieldOperand(result, offset)); | |
| 2816 } | |
| 2817 } | 2827 } |
| 2818 } | 2828 } |
| 2819 | 2829 |
| 2820 | 2830 |
| 2821 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2831 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2822 ASSERT(ToRegister(instr->object()).is(rax)); | 2832 ASSERT(ToRegister(instr->object()).is(rax)); |
| 2823 ASSERT(ToRegister(instr->result()).is(rax)); | 2833 ASSERT(ToRegister(instr->result()).is(rax)); |
| 2824 | 2834 |
| 2825 __ Move(rcx, instr->name()); | 2835 __ Move(rcx, instr->name()); |
| 2826 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2836 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 __ cvttsd2si(output_reg, input_reg); | 3513 __ cvttsd2si(output_reg, input_reg); |
| 3504 // Overflow is signalled with minint. | 3514 // Overflow is signalled with minint. |
| 3505 __ cmpl(output_reg, Immediate(0x80000000)); | 3515 __ cmpl(output_reg, Immediate(0x80000000)); |
| 3506 DeoptimizeIf(equal, instr->environment()); | 3516 DeoptimizeIf(equal, instr->environment()); |
| 3507 __ jmp(&done, Label::kNear); | 3517 __ jmp(&done, Label::kNear); |
| 3508 | 3518 |
| 3509 // Non-zero negative reaches here. | 3519 // Non-zero negative reaches here. |
| 3510 __ bind(&negative_sign); | 3520 __ bind(&negative_sign); |
| 3511 // Truncate, then compare and compensate. | 3521 // Truncate, then compare and compensate. |
| 3512 __ cvttsd2si(output_reg, input_reg); | 3522 __ cvttsd2si(output_reg, input_reg); |
| 3513 __ Cvtlsi2sd(xmm_scratch, output_reg); | 3523 __ cvtlsi2sd(xmm_scratch, output_reg); |
| 3514 __ ucomisd(input_reg, xmm_scratch); | 3524 __ ucomisd(input_reg, xmm_scratch); |
| 3515 __ j(equal, &done, Label::kNear); | 3525 __ j(equal, &done, Label::kNear); |
| 3516 __ subl(output_reg, Immediate(1)); | 3526 __ subl(output_reg, Immediate(1)); |
| 3517 DeoptimizeIf(overflow, instr->environment()); | 3527 DeoptimizeIf(overflow, instr->environment()); |
| 3518 | 3528 |
| 3519 __ bind(&done); | 3529 __ bind(&done); |
| 3520 } | 3530 } |
| 3521 } | 3531 } |
| 3522 | 3532 |
| 3523 | 3533 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3552 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then | 3562 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then |
| 3553 // compare and compensate. | 3563 // compare and compensate. |
| 3554 __ movq(kScratchRegister, input_reg); // Back up input_reg. | 3564 __ movq(kScratchRegister, input_reg); // Back up input_reg. |
| 3555 __ subsd(input_reg, xmm_scratch); | 3565 __ subsd(input_reg, xmm_scratch); |
| 3556 __ cvttsd2si(output_reg, input_reg); | 3566 __ cvttsd2si(output_reg, input_reg); |
| 3557 // Catch minint due to overflow, and to prevent overflow when compensating. | 3567 // Catch minint due to overflow, and to prevent overflow when compensating. |
| 3558 __ cmpl(output_reg, Immediate(0x80000000)); | 3568 __ cmpl(output_reg, Immediate(0x80000000)); |
| 3559 __ RecordComment("D2I conversion overflow"); | 3569 __ RecordComment("D2I conversion overflow"); |
| 3560 DeoptimizeIf(equal, instr->environment()); | 3570 DeoptimizeIf(equal, instr->environment()); |
| 3561 | 3571 |
| 3562 __ Cvtlsi2sd(xmm_scratch, output_reg); | 3572 __ cvtlsi2sd(xmm_scratch, output_reg); |
| 3563 __ ucomisd(input_reg, xmm_scratch); | 3573 __ ucomisd(input_reg, xmm_scratch); |
| 3564 __ j(equal, &restore, Label::kNear); | 3574 __ j(equal, &restore, Label::kNear); |
| 3565 __ subl(output_reg, Immediate(1)); | 3575 __ subl(output_reg, Immediate(1)); |
| 3566 // No overflow because we already ruled out minint. | 3576 // No overflow because we already ruled out minint. |
| 3567 __ bind(&restore); | 3577 __ bind(&restore); |
| 3568 __ movq(input_reg, kScratchRegister); // Restore input_reg. | 3578 __ movq(input_reg, kScratchRegister); // Restore input_reg. |
| 3569 __ jmp(&done); | 3579 __ jmp(&done); |
| 3570 | 3580 |
| 3571 __ bind(&round_to_zero); | 3581 __ bind(&round_to_zero); |
| 3572 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if | 3582 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3919 } | 3929 } |
| 3920 | 3930 |
| 3921 | 3931 |
| 3922 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3932 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 3923 Representation representation = instr->representation(); | 3933 Representation representation = instr->representation(); |
| 3924 | 3934 |
| 3925 HObjectAccess access = instr->hydrogen()->access(); | 3935 HObjectAccess access = instr->hydrogen()->access(); |
| 3926 int offset = access.offset(); | 3936 int offset = access.offset(); |
| 3927 | 3937 |
| 3928 if (access.IsExternalMemory()) { | 3938 if (access.IsExternalMemory()) { |
| 3929 ASSERT(!access.representation().IsInteger32()); | |
| 3930 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 3939 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 3931 Register value = ToRegister(instr->value()); | 3940 Register value = ToRegister(instr->value()); |
| 3932 if (instr->object()->IsConstantOperand()) { | 3941 if (instr->object()->IsConstantOperand()) { |
| 3933 ASSERT(value.is(rax)); | 3942 ASSERT(value.is(rax)); |
| 3934 LConstantOperand* object = LConstantOperand::cast(instr->object()); | 3943 LConstantOperand* object = LConstantOperand::cast(instr->object()); |
| 3935 __ store_rax(ToExternalReference(object)); | 3944 __ store_rax(ToExternalReference(object)); |
| 3936 } else { | 3945 } else { |
| 3937 Register object = ToRegister(instr->object()); | 3946 Register object = ToRegister(instr->object()); |
| 3938 __ movq(MemOperand(object, offset), value); | 3947 __ movq(MemOperand(object, offset), value); |
| 3939 } | 3948 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3997 | 4006 |
| 3998 Register write_register = object; | 4007 Register write_register = object; |
| 3999 if (!access.IsInobject()) { | 4008 if (!access.IsInobject()) { |
| 4000 write_register = ToRegister(instr->temp()); | 4009 write_register = ToRegister(instr->temp()); |
| 4001 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4010 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 4002 } | 4011 } |
| 4003 | 4012 |
| 4004 if (instr->value()->IsConstantOperand()) { | 4013 if (instr->value()->IsConstantOperand()) { |
| 4005 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4014 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4006 if (operand_value->IsRegister()) { | 4015 if (operand_value->IsRegister()) { |
| 4007 if (access.representation().IsInteger32()) { | 4016 __ movq(FieldOperand(write_register, offset), |
| 4008 __ movl(FieldOperand(write_register, offset), | 4017 ToRegister(operand_value)); |
| 4009 ToRegister(operand_value)); | |
| 4010 } else { | |
| 4011 __ movq(FieldOperand(write_register, offset), | |
| 4012 ToRegister(operand_value)); | |
| 4013 } | |
| 4014 } else { | 4018 } else { |
| 4015 Handle<Object> handle_value = ToHandle(operand_value); | 4019 Handle<Object> handle_value = ToHandle(operand_value); |
| 4016 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4020 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4017 __ Move(FieldOperand(write_register, offset), handle_value); | 4021 __ Move(FieldOperand(write_register, offset), handle_value); |
| 4018 } | 4022 } |
| 4019 } else { | 4023 } else { |
| 4020 if (access.representation().IsInteger32()) { | 4024 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value())); |
| 4021 __ movl(FieldOperand(write_register, offset), ToRegister(instr->value())); | |
| 4022 } else { | |
| 4023 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value())); | |
| 4024 } | |
| 4025 } | 4025 } |
| 4026 | 4026 |
| 4027 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4027 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 4028 Register value = ToRegister(instr->value()); | 4028 Register value = ToRegister(instr->value()); |
| 4029 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4029 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
| 4030 // Update the write barrier for the object for in-object properties. | 4030 // Update the write barrier for the object for in-object properties. |
| 4031 __ RecordWriteField(write_register, | 4031 __ RecordWriteField(write_register, |
| 4032 offset, | 4032 offset, |
| 4033 value, | 4033 value, |
| 4034 temp, | 4034 temp, |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4442 __ StoreToSafepointRegisterSlot(result, rax); | 4442 __ StoreToSafepointRegisterSlot(result, rax); |
| 4443 } | 4443 } |
| 4444 | 4444 |
| 4445 | 4445 |
| 4446 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 4446 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
| 4447 LOperand* input = instr->value(); | 4447 LOperand* input = instr->value(); |
| 4448 ASSERT(input->IsRegister() || input->IsStackSlot()); | 4448 ASSERT(input->IsRegister() || input->IsStackSlot()); |
| 4449 LOperand* output = instr->result(); | 4449 LOperand* output = instr->result(); |
| 4450 ASSERT(output->IsDoubleRegister()); | 4450 ASSERT(output->IsDoubleRegister()); |
| 4451 if (input->IsRegister()) { | 4451 if (input->IsRegister()) { |
| 4452 __ Cvtlsi2sd(ToDoubleRegister(output), ToRegister(input)); | 4452 __ cvtlsi2sd(ToDoubleRegister(output), ToRegister(input)); |
| 4453 } else { | 4453 } else { |
| 4454 __ Cvtlsi2sd(ToDoubleRegister(output), ToOperand(input)); | 4454 __ cvtlsi2sd(ToDoubleRegister(output), ToOperand(input)); |
| 4455 } | 4455 } |
| 4456 } | 4456 } |
| 4457 | 4457 |
| 4458 | 4458 |
| 4459 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | 4459 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { |
| 4460 LOperand* input = instr->value(); | 4460 LOperand* input = instr->value(); |
| 4461 ASSERT(input->IsRegister()); | 4461 ASSERT(input->IsRegister()); |
| 4462 LOperand* output = instr->result(); | 4462 LOperand* output = instr->result(); |
| 4463 __ Integer32ToSmi(ToRegister(output), ToRegister(input)); | 4463 __ Integer32ToSmi(ToRegister(output), ToRegister(input)); |
| 4464 if (!instr->hydrogen()->value()->HasRange() || | 4464 if (!instr->hydrogen()->value()->HasRange() || |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4616 __ SmiToInteger32(input, input); | 4616 __ SmiToInteger32(input, input); |
| 4617 } | 4617 } |
| 4618 | 4618 |
| 4619 | 4619 |
| 4620 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4620 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4621 XMMRegister result_reg, | 4621 XMMRegister result_reg, |
| 4622 bool can_convert_undefined_to_nan, | 4622 bool can_convert_undefined_to_nan, |
| 4623 bool deoptimize_on_minus_zero, | 4623 bool deoptimize_on_minus_zero, |
| 4624 LEnvironment* env, | 4624 LEnvironment* env, |
| 4625 NumberUntagDMode mode) { | 4625 NumberUntagDMode mode) { |
| 4626 Label convert, load_smi, done; | 4626 Label load_smi, done; |
| 4627 | 4627 |
| 4628 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { | 4628 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
| 4629 // Smi check. | 4629 // Smi check. |
| 4630 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); | 4630 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); |
| 4631 | 4631 |
| 4632 // Heap number map check. | 4632 // Heap number map check. |
| 4633 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 4633 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 4634 Heap::kHeapNumberMapRootIndex); | 4634 Heap::kHeapNumberMapRootIndex); |
| 4635 if (!can_convert_undefined_to_nan) { |
| 4636 DeoptimizeIf(not_equal, env); |
| 4637 } else { |
| 4638 Label heap_number, convert; |
| 4639 __ j(equal, &heap_number, Label::kNear); |
| 4635 | 4640 |
| 4636 // On x64 it is safe to load at heap number offset before evaluating the map | 4641 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. |
| 4637 // check, since all heap objects are at least two words long. | 4642 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
| 4643 DeoptimizeIf(not_equal, env); |
| 4644 |
| 4645 __ bind(&convert); |
| 4646 __ xorps(result_reg, result_reg); |
| 4647 __ divsd(result_reg, result_reg); |
| 4648 __ jmp(&done, Label::kNear); |
| 4649 |
| 4650 __ bind(&heap_number); |
| 4651 } |
| 4652 // Heap number to XMM conversion. |
| 4638 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 4653 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 4639 | |
| 4640 if (can_convert_undefined_to_nan) { | |
| 4641 __ j(not_equal, &convert); | |
| 4642 } else { | |
| 4643 DeoptimizeIf(not_equal, env); | |
| 4644 } | |
| 4645 | |
| 4646 if (deoptimize_on_minus_zero) { | 4654 if (deoptimize_on_minus_zero) { |
| 4647 XMMRegister xmm_scratch = xmm0; | 4655 XMMRegister xmm_scratch = xmm0; |
| 4648 __ xorps(xmm_scratch, xmm_scratch); | 4656 __ xorps(xmm_scratch, xmm_scratch); |
| 4649 __ ucomisd(xmm_scratch, result_reg); | 4657 __ ucomisd(xmm_scratch, result_reg); |
| 4650 __ j(not_equal, &done, Label::kNear); | 4658 __ j(not_equal, &done, Label::kNear); |
| 4651 __ movmskpd(kScratchRegister, result_reg); | 4659 __ movmskpd(kScratchRegister, result_reg); |
| 4652 __ testq(kScratchRegister, Immediate(1)); | 4660 __ testq(kScratchRegister, Immediate(1)); |
| 4653 DeoptimizeIf(not_zero, env); | 4661 DeoptimizeIf(not_zero, env); |
| 4654 } | 4662 } |
| 4655 __ jmp(&done, Label::kNear); | 4663 __ jmp(&done, Label::kNear); |
| 4656 | |
| 4657 if (can_convert_undefined_to_nan) { | |
| 4658 __ bind(&convert); | |
| 4659 | |
| 4660 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. | |
| 4661 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | |
| 4662 DeoptimizeIf(not_equal, env); | |
| 4663 | |
| 4664 __ xorps(result_reg, result_reg); | |
| 4665 __ divsd(result_reg, result_reg); | |
| 4666 __ jmp(&done, Label::kNear); | |
| 4667 } | |
| 4668 } else { | 4664 } else { |
| 4669 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 4665 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
| 4670 } | 4666 } |
| 4671 | 4667 |
| 4672 // Smi to XMM conversion | 4668 // Smi to XMM conversion |
| 4673 __ bind(&load_smi); | 4669 __ bind(&load_smi); |
| 4674 __ SmiToInteger32(kScratchRegister, input_reg); | 4670 __ SmiToInteger32(kScratchRegister, input_reg); |
| 4675 __ Cvtlsi2sd(result_reg, kScratchRegister); | 4671 __ cvtlsi2sd(result_reg, kScratchRegister); |
| 4676 __ bind(&done); | 4672 __ bind(&done); |
| 4677 } | 4673 } |
| 4678 | 4674 |
| 4679 | 4675 |
| 4680 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 4676 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
| 4681 Label heap_number; | 4677 Label heap_number; |
| 4682 Register input_reg = ToRegister(instr->value()); | 4678 Register input_reg = ToRegister(instr->value()); |
| 4683 | 4679 |
| 4684 | 4680 |
| 4685 if (instr->truncating()) { | 4681 if (instr->truncating()) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4718 codegen()->DoDeferredTaggedToI(instr_, done()); | 4714 codegen()->DoDeferredTaggedToI(instr_, done()); |
| 4719 } | 4715 } |
| 4720 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4716 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4721 private: | 4717 private: |
| 4722 LTaggedToI* instr_; | 4718 LTaggedToI* instr_; |
| 4723 }; | 4719 }; |
| 4724 | 4720 |
| 4725 LOperand* input = instr->value(); | 4721 LOperand* input = instr->value(); |
| 4726 ASSERT(input->IsRegister()); | 4722 ASSERT(input->IsRegister()); |
| 4727 ASSERT(input->Equals(instr->result())); | 4723 ASSERT(input->Equals(instr->result())); |
| 4724 |
| 4728 Register input_reg = ToRegister(input); | 4725 Register input_reg = ToRegister(input); |
| 4729 | 4726 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
| 4730 if (instr->hydrogen()->value()->representation().IsSmi()) { | 4727 __ JumpIfNotSmi(input_reg, deferred->entry()); |
| 4731 __ SmiToInteger32(input_reg, input_reg); | 4728 __ SmiToInteger32(input_reg, input_reg); |
| 4732 } else { | 4729 __ bind(deferred->exit()); |
| 4733 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | |
| 4734 __ JumpIfNotSmi(input_reg, deferred->entry()); | |
| 4735 __ SmiToInteger32(input_reg, input_reg); | |
| 4736 __ bind(deferred->exit()); | |
| 4737 } | |
| 4738 } | 4730 } |
| 4739 | 4731 |
| 4740 | 4732 |
| 4741 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 4733 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
| 4742 LOperand* input = instr->value(); | 4734 LOperand* input = instr->value(); |
| 4743 ASSERT(input->IsRegister()); | 4735 ASSERT(input->IsRegister()); |
| 4744 LOperand* result = instr->result(); | 4736 LOperand* result = instr->result(); |
| 4745 ASSERT(result->IsDoubleRegister()); | 4737 ASSERT(result->IsDoubleRegister()); |
| 4746 | 4738 |
| 4747 Register input_reg = ToRegister(input); | 4739 Register input_reg = ToRegister(input); |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5501 FixedArray::kHeaderSize - kPointerSize)); | 5493 FixedArray::kHeaderSize - kPointerSize)); |
| 5502 __ bind(&done); | 5494 __ bind(&done); |
| 5503 } | 5495 } |
| 5504 | 5496 |
| 5505 | 5497 |
| 5506 #undef __ | 5498 #undef __ |
| 5507 | 5499 |
| 5508 } } // namespace v8::internal | 5500 } } // namespace v8::internal |
| 5509 | 5501 |
| 5510 #endif // V8_TARGET_ARCH_X64 | 5502 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |