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 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2775 | 2775 |
2776 __ bind(&skip_assignment); | 2776 __ bind(&skip_assignment); |
2777 } | 2777 } |
2778 | 2778 |
2779 | 2779 |
2780 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2780 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2781 HObjectAccess access = instr->hydrogen()->access(); | 2781 HObjectAccess access = instr->hydrogen()->access(); |
2782 int offset = access.offset(); | 2782 int offset = access.offset(); |
2783 | 2783 |
2784 if (access.IsExternalMemory()) { | 2784 if (access.IsExternalMemory()) { |
2785 ASSERT(!access.representation().IsInteger32()); | |
2786 Register result = ToRegister(instr->result()); | 2785 Register result = ToRegister(instr->result()); |
2787 if (instr->object()->IsConstantOperand()) { | 2786 if (instr->object()->IsConstantOperand()) { |
2788 ASSERT(result.is(rax)); | 2787 ASSERT(result.is(rax)); |
2788 ASSERT(!access.representation().IsSpecialization()); | |
2789 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); | 2789 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); |
2790 } else { | 2790 } else { |
2791 Register object = ToRegister(instr->object()); | 2791 MemOperand operand = MemOperand(ToRegister(instr->object()), offset); |
mvstanton
2013/10/02 11:13:12
How about a helper function that does the right mo
Benedikt Meurer
2013/10/02 11:48:06
Done.
| |
2792 __ movq(result, MemOperand(object, offset)); | 2792 if (access.representation().IsByte()) { |
2793 __ movzxbl(result, operand); | |
2794 } else if (access.representation().IsInteger32()) { | |
2795 __ movl(result, operand); | |
2796 } else { | |
2797 __ movq(result, operand); | |
2798 } | |
2793 } | 2799 } |
2794 return; | 2800 return; |
2795 } | 2801 } |
2796 | 2802 |
2797 Register object = ToRegister(instr->object()); | 2803 Register object = ToRegister(instr->object()); |
2798 if (FLAG_track_double_fields && | 2804 if (FLAG_track_double_fields && |
2799 instr->hydrogen()->representation().IsDouble()) { | 2805 instr->hydrogen()->representation().IsDouble()) { |
2800 XMMRegister result = ToDoubleRegister(instr->result()); | 2806 XMMRegister result = ToDoubleRegister(instr->result()); |
2801 __ movsd(result, FieldOperand(object, offset)); | 2807 __ movsd(result, FieldOperand(object, offset)); |
2802 return; | 2808 return; |
2803 } | 2809 } |
2804 | 2810 |
2805 Register result = ToRegister(instr->result()); | 2811 Register result = ToRegister(instr->result()); |
2806 if (access.IsInobject()) { | 2812 if (!access.IsInobject()) { |
2807 if (access.representation().IsInteger32()) { | 2813 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
2808 __ movl(result, FieldOperand(object, offset)); | 2814 object = result; |
2809 } else { | 2815 } |
2810 __ movq(result, FieldOperand(object, offset)); | 2816 MemOperand operand = FieldOperand(object, offset); |
2811 } | 2817 if (access.representation().IsByte()) { |
2818 __ movzxbl(result, operand); | |
2819 } else if (access.representation().IsInteger32()) { | |
2820 __ movl(result, operand); | |
2812 } else { | 2821 } else { |
2813 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2822 __ movq(result, operand); |
2814 if (access.representation().IsInteger32()) { | |
2815 __ movl(result, FieldOperand(result, offset)); | |
2816 } else { | |
2817 __ movq(result, FieldOperand(result, offset)); | |
2818 } | |
2819 } | 2823 } |
2820 } | 2824 } |
2821 | 2825 |
2822 | 2826 |
2823 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2827 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2824 ASSERT(ToRegister(instr->object()).is(rax)); | 2828 ASSERT(ToRegister(instr->object()).is(rax)); |
2825 ASSERT(ToRegister(instr->result()).is(rax)); | 2829 ASSERT(ToRegister(instr->result()).is(rax)); |
2826 | 2830 |
2827 __ Move(rcx, instr->name()); | 2831 __ Move(rcx, instr->name()); |
2828 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2832 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3927 } | 3931 } |
3928 | 3932 |
3929 | 3933 |
3930 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3934 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
3931 Representation representation = instr->representation(); | 3935 Representation representation = instr->representation(); |
3932 | 3936 |
3933 HObjectAccess access = instr->hydrogen()->access(); | 3937 HObjectAccess access = instr->hydrogen()->access(); |
3934 int offset = access.offset(); | 3938 int offset = access.offset(); |
3935 | 3939 |
3936 if (access.IsExternalMemory()) { | 3940 if (access.IsExternalMemory()) { |
3937 ASSERT(!access.representation().IsInteger32()); | |
3938 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 3941 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
3939 Register value = ToRegister(instr->value()); | 3942 Register value = ToRegister(instr->value()); |
3940 if (instr->object()->IsConstantOperand()) { | 3943 if (instr->object()->IsConstantOperand()) { |
3941 ASSERT(value.is(rax)); | 3944 ASSERT(value.is(rax)); |
3945 ASSERT(!access.representation().IsSpecialization()); | |
3942 LConstantOperand* object = LConstantOperand::cast(instr->object()); | 3946 LConstantOperand* object = LConstantOperand::cast(instr->object()); |
3943 __ store_rax(ToExternalReference(object)); | 3947 __ store_rax(ToExternalReference(object)); |
3944 } else { | 3948 } else { |
3945 Register object = ToRegister(instr->object()); | 3949 MemOperand operand = MemOperand(ToRegister(instr->object()), offset); |
3946 __ movq(MemOperand(object, offset), value); | 3950 if (representation.IsByte()) { |
3951 __ movb(operand, value); | |
3952 } else if (representation.IsInteger32()) { | |
3953 __ movl(operand, value); | |
3954 } else { | |
3955 __ movq(operand, value); | |
3956 } | |
3947 } | 3957 } |
3948 return; | 3958 return; |
3949 } | 3959 } |
3950 | 3960 |
3951 Register object = ToRegister(instr->object()); | 3961 Register object = ToRegister(instr->object()); |
3952 Handle<Map> transition = instr->transition(); | 3962 Handle<Map> transition = instr->transition(); |
3953 | 3963 |
3954 if (FLAG_track_fields && representation.IsSmi()) { | 3964 if (FLAG_track_fields && representation.IsSmi()) { |
3955 if (instr->value()->IsConstantOperand()) { | 3965 if (instr->value()->IsConstantOperand()) { |
3956 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3966 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4002 SmiCheck check_needed = | 4012 SmiCheck check_needed = |
4003 instr->hydrogen()->value()->IsHeapObject() | 4013 instr->hydrogen()->value()->IsHeapObject() |
4004 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4014 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4005 | 4015 |
4006 Register write_register = object; | 4016 Register write_register = object; |
4007 if (!access.IsInobject()) { | 4017 if (!access.IsInobject()) { |
4008 write_register = ToRegister(instr->temp()); | 4018 write_register = ToRegister(instr->temp()); |
4009 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4019 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4010 } | 4020 } |
4011 | 4021 |
4022 MemOperand operand = FieldOperand(write_register, offset); | |
4012 if (instr->value()->IsConstantOperand()) { | 4023 if (instr->value()->IsConstantOperand()) { |
4013 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4024 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4014 if (operand_value->IsRegister()) { | 4025 if (operand_value->IsRegister()) { |
4015 if (access.representation().IsInteger32()) { | 4026 Register value = ToRegister(operand_value); |
4016 __ movl(FieldOperand(write_register, offset), | 4027 if (representation.IsByte()) { |
4017 ToRegister(operand_value)); | 4028 __ movb(operand, value); |
4029 } else if (representation.IsInteger32()) { | |
4030 __ movl(operand, value); | |
4018 } else { | 4031 } else { |
4019 __ movq(FieldOperand(write_register, offset), | 4032 __ movq(operand, value); |
4020 ToRegister(operand_value)); | |
4021 } | 4033 } |
4022 } else { | 4034 } else { |
4023 Handle<Object> handle_value = ToHandle(operand_value); | 4035 Handle<Object> handle_value = ToHandle(operand_value); |
4024 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4036 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4025 __ Move(FieldOperand(write_register, offset), handle_value); | 4037 __ Move(operand, handle_value); |
4026 } | 4038 } |
4027 } else { | 4039 } else { |
4028 if (access.representation().IsInteger32()) { | 4040 Register value = ToRegister(instr->value()); |
4029 __ movl(FieldOperand(write_register, offset), ToRegister(instr->value())); | 4041 if (representation.IsByte()) { |
4042 __ movb(operand, value); | |
4043 } else if (representation.IsInteger32()) { | |
4044 __ movl(operand, value); | |
4030 } else { | 4045 } else { |
4031 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value())); | 4046 __ movq(operand, value); |
4032 } | 4047 } |
4033 } | 4048 } |
4034 | 4049 |
4035 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4050 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4036 Register value = ToRegister(instr->value()); | 4051 Register value = ToRegister(instr->value()); |
4037 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4052 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
4038 // Update the write barrier for the object for in-object properties. | 4053 // Update the write barrier for the object for in-object properties. |
4039 __ RecordWriteField(write_register, | 4054 __ RecordWriteField(write_register, |
4040 offset, | 4055 offset, |
4041 value, | 4056 value, |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5514 FixedArray::kHeaderSize - kPointerSize)); | 5529 FixedArray::kHeaderSize - kPointerSize)); |
5515 __ bind(&done); | 5530 __ bind(&done); |
5516 } | 5531 } |
5517 | 5532 |
5518 | 5533 |
5519 #undef __ | 5534 #undef __ |
5520 | 5535 |
5521 } } // namespace v8::internal | 5536 } } // namespace v8::internal |
5522 | 5537 |
5523 #endif // V8_TARGET_ARCH_X64 | 5538 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |