| 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 3912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 LConstantOperand* offset = LConstantOperand::cast(instr->offset()); | 3923 LConstantOperand* offset = LConstantOperand::cast(instr->offset()); |
| 3924 __ lea(result, Operand(base, ToInteger32(offset))); | 3924 __ lea(result, Operand(base, ToInteger32(offset))); |
| 3925 } else { | 3925 } else { |
| 3926 Register offset = ToRegister(instr->offset()); | 3926 Register offset = ToRegister(instr->offset()); |
| 3927 __ lea(result, Operand(base, offset, times_1, 0)); | 3927 __ lea(result, Operand(base, offset, times_1, 0)); |
| 3928 } | 3928 } |
| 3929 } | 3929 } |
| 3930 | 3930 |
| 3931 | 3931 |
| 3932 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3932 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 3933 HStoreNamedField* hinstr = instr->hydrogen(); |
| 3933 Representation representation = instr->representation(); | 3934 Representation representation = instr->representation(); |
| 3934 | 3935 |
| 3935 HObjectAccess access = instr->hydrogen()->access(); | 3936 HObjectAccess access = hinstr->access(); |
| 3936 int offset = access.offset(); | 3937 int offset = access.offset(); |
| 3937 | 3938 |
| 3938 if (access.IsExternalMemory()) { | 3939 if (access.IsExternalMemory()) { |
| 3939 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 3940 ASSERT(!hinstr->NeedsWriteBarrier()); |
| 3940 Register value = ToRegister(instr->value()); | 3941 Register value = ToRegister(instr->value()); |
| 3941 if (instr->object()->IsConstantOperand()) { | 3942 if (instr->object()->IsConstantOperand()) { |
| 3942 ASSERT(value.is(rax)); | 3943 ASSERT(value.is(rax)); |
| 3943 ASSERT(!access.representation().IsSpecialization()); | 3944 ASSERT(!access.representation().IsSpecialization()); |
| 3944 LConstantOperand* object = LConstantOperand::cast(instr->object()); | 3945 LConstantOperand* object = LConstantOperand::cast(instr->object()); |
| 3945 __ store_rax(ToExternalReference(object)); | 3946 __ store_rax(ToExternalReference(object)); |
| 3946 } else { | 3947 } else { |
| 3947 Register object = ToRegister(instr->object()); | 3948 Register object = ToRegister(instr->object()); |
| 3948 __ Store(MemOperand(object, offset), value, representation); | 3949 __ Store(MemOperand(object, offset), value, representation); |
| 3949 } | 3950 } |
| 3950 return; | 3951 return; |
| 3951 } | 3952 } |
| 3952 | 3953 |
| 3953 Register object = ToRegister(instr->object()); | 3954 Register object = ToRegister(instr->object()); |
| 3954 Handle<Map> transition = instr->transition(); | 3955 Handle<Map> transition = instr->transition(); |
| 3955 | 3956 |
| 3956 if (FLAG_track_fields && representation.IsSmi()) { | 3957 if (FLAG_track_fields && representation.IsSmi()) { |
| 3957 if (instr->value()->IsConstantOperand()) { | 3958 if (instr->value()->IsConstantOperand()) { |
| 3958 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3959 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 3959 if (!IsSmiConstant(operand_value)) { | 3960 if (!IsInteger32Constant(operand_value) && |
| 3961 !IsSmiConstant(operand_value)) { |
| 3960 DeoptimizeIf(no_condition, instr->environment()); | 3962 DeoptimizeIf(no_condition, instr->environment()); |
| 3961 } | 3963 } |
| 3962 } | 3964 } |
| 3963 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 3965 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 3964 if (instr->value()->IsConstantOperand()) { | 3966 if (instr->value()->IsConstantOperand()) { |
| 3965 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3967 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 3966 if (IsInteger32Constant(operand_value)) { | 3968 if (IsInteger32Constant(operand_value)) { |
| 3967 DeoptimizeIf(no_condition, instr->environment()); | 3969 DeoptimizeIf(no_condition, instr->environment()); |
| 3968 } | 3970 } |
| 3969 } else { | 3971 } else { |
| 3970 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 3972 if (!hinstr->value()->type().IsHeapObject()) { |
| 3971 Register value = ToRegister(instr->value()); | 3973 Register value = ToRegister(instr->value()); |
| 3972 Condition cc = masm()->CheckSmi(value); | 3974 Condition cc = masm()->CheckSmi(value); |
| 3973 DeoptimizeIf(cc, instr->environment()); | 3975 DeoptimizeIf(cc, instr->environment()); |
| 3974 } | 3976 } |
| 3975 } | 3977 } |
| 3976 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 3978 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
| 3977 ASSERT(transition.is_null()); | 3979 ASSERT(transition.is_null()); |
| 3978 ASSERT(access.IsInobject()); | 3980 ASSERT(access.IsInobject()); |
| 3979 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 3981 ASSERT(!hinstr->NeedsWriteBarrier()); |
| 3980 XMMRegister value = ToDoubleRegister(instr->value()); | 3982 XMMRegister value = ToDoubleRegister(instr->value()); |
| 3981 __ movsd(FieldOperand(object, offset), value); | 3983 __ movsd(FieldOperand(object, offset), value); |
| 3982 return; | 3984 return; |
| 3983 } | 3985 } |
| 3984 | 3986 |
| 3985 if (!transition.is_null()) { | 3987 if (!transition.is_null()) { |
| 3986 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | 3988 if (!hinstr->NeedsWriteBarrierForMap()) { |
| 3987 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition); | 3989 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition); |
| 3988 } else { | 3990 } else { |
| 3989 Register temp = ToRegister(instr->temp()); | 3991 Register temp = ToRegister(instr->temp()); |
| 3990 __ Move(kScratchRegister, transition); | 3992 __ Move(kScratchRegister, transition); |
| 3991 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); | 3993 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); |
| 3992 // Update the write barrier for the map field. | 3994 // Update the write barrier for the map field. |
| 3993 __ RecordWriteField(object, | 3995 __ RecordWriteField(object, |
| 3994 HeapObject::kMapOffset, | 3996 HeapObject::kMapOffset, |
| 3995 kScratchRegister, | 3997 kScratchRegister, |
| 3996 temp, | 3998 temp, |
| 3997 kSaveFPRegs, | 3999 kSaveFPRegs, |
| 3998 OMIT_REMEMBERED_SET, | 4000 OMIT_REMEMBERED_SET, |
| 3999 OMIT_SMI_CHECK); | 4001 OMIT_SMI_CHECK); |
| 4000 } | 4002 } |
| 4001 } | 4003 } |
| 4002 | 4004 |
| 4003 // Do the store. | 4005 // Do the store. |
| 4004 SmiCheck check_needed = | 4006 SmiCheck check_needed = hinstr->value()->IsHeapObject() |
| 4005 instr->hydrogen()->value()->IsHeapObject() | 4007 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4006 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | |
| 4007 | 4008 |
| 4008 Register write_register = object; | 4009 Register write_register = object; |
| 4009 if (!access.IsInobject()) { | 4010 if (!access.IsInobject()) { |
| 4010 write_register = ToRegister(instr->temp()); | 4011 write_register = ToRegister(instr->temp()); |
| 4011 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4012 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 4012 } | 4013 } |
| 4013 | 4014 |
| 4014 if (instr->value()->IsConstantOperand()) { | 4015 if (representation.IsSmi() && |
| 4016 hinstr->value()->representation().IsInteger32()) { |
| 4017 ASSERT(hinstr->store_mode() == STORE_TO_INITIALIZED_ENTRY); |
| 4018 // Store int value directly to upper half of the smi. |
| 4019 STATIC_ASSERT(kSmiTag == 0); |
| 4020 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); |
| 4021 offset += kPointerSize / 2; |
| 4022 representation = Representation::Integer32(); |
| 4023 } |
| 4024 |
| 4025 Operand operand = FieldOperand(write_register, offset); |
| 4026 |
| 4027 if (instr->value()->IsRegister()) { |
| 4028 Register value = ToRegister(instr->value()); |
| 4029 __ Store(operand, value, representation); |
| 4030 } else { |
| 4015 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4031 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4016 if (operand_value->IsRegister()) { | 4032 if (IsInteger32Constant(operand_value)) { |
| 4017 Register value = ToRegister(operand_value); | 4033 ASSERT(!hinstr->NeedsWriteBarrier()); |
| 4018 __ Store(FieldOperand(write_register, offset), value, representation); | |
| 4019 } else if (representation.IsInteger32()) { | |
| 4020 int32_t value = ToInteger32(operand_value); | 4034 int32_t value = ToInteger32(operand_value); |
| 4021 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4035 if (representation.IsSmi()) { |
| 4022 __ movl(FieldOperand(write_register, offset), Immediate(value)); | 4036 __ Move(operand, Smi::FromInt(value)); |
| 4037 |
| 4038 } else { |
| 4039 __ movl(operand, Immediate(value)); |
| 4040 } |
| 4041 |
| 4023 } else { | 4042 } else { |
| 4024 Handle<Object> handle_value = ToHandle(operand_value); | 4043 Handle<Object> handle_value = ToHandle(operand_value); |
| 4025 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4044 ASSERT(!hinstr->NeedsWriteBarrier()); |
| 4026 __ Move(FieldOperand(write_register, offset), handle_value); | 4045 __ Move(operand, handle_value); |
| 4027 } | 4046 } |
| 4028 } else { | |
| 4029 Register value = ToRegister(instr->value()); | |
| 4030 __ Store(FieldOperand(write_register, offset), value, representation); | |
| 4031 } | 4047 } |
| 4032 | 4048 |
| 4033 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4049 if (hinstr->NeedsWriteBarrier()) { |
| 4034 Register value = ToRegister(instr->value()); | 4050 Register value = ToRegister(instr->value()); |
| 4035 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4051 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
| 4036 // Update the write barrier for the object for in-object properties. | 4052 // Update the write barrier for the object for in-object properties. |
| 4037 __ RecordWriteField(write_register, | 4053 __ RecordWriteField(write_register, |
| 4038 offset, | 4054 offset, |
| 4039 value, | 4055 value, |
| 4040 temp, | 4056 temp, |
| 4041 kSaveFPRegs, | 4057 kSaveFPRegs, |
| 4042 EMIT_REMEMBERED_SET, | 4058 EMIT_REMEMBERED_SET, |
| 4043 check_needed); | 4059 check_needed); |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5592 FixedArray::kHeaderSize - kPointerSize)); | 5608 FixedArray::kHeaderSize - kPointerSize)); |
| 5593 __ bind(&done); | 5609 __ bind(&done); |
| 5594 } | 5610 } |
| 5595 | 5611 |
| 5596 | 5612 |
| 5597 #undef __ | 5613 #undef __ |
| 5598 | 5614 |
| 5599 } } // namespace v8::internal | 5615 } } // namespace v8::internal |
| 5600 | 5616 |
| 5601 #endif // V8_TARGET_ARCH_X64 | 5617 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |