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 3928 matching lines...) Loading... | |
3939 } | 3939 } |
3940 return; | 3940 return; |
3941 } | 3941 } |
3942 | 3942 |
3943 Register object = ToRegister(instr->object()); | 3943 Register object = ToRegister(instr->object()); |
3944 Handle<Map> transition = instr->transition(); | 3944 Handle<Map> transition = instr->transition(); |
3945 | 3945 |
3946 if (FLAG_track_fields && representation.IsSmi()) { | 3946 if (FLAG_track_fields && representation.IsSmi()) { |
3947 if (instr->value()->IsConstantOperand()) { | 3947 if (instr->value()->IsConstantOperand()) { |
3948 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3948 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
3949 if (!IsSmiConstant(operand_value)) { | 3949 if (!IsInteger32Constant(operand_value) && |
3950 !IsSmiConstant(operand_value)) { | |
3950 DeoptimizeIf(no_condition, instr->environment()); | 3951 DeoptimizeIf(no_condition, instr->environment()); |
3951 } | 3952 } |
3952 } | 3953 } |
3953 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 3954 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
3954 if (instr->value()->IsConstantOperand()) { | 3955 if (instr->value()->IsConstantOperand()) { |
3955 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3956 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
3956 if (IsInteger32Constant(operand_value)) { | 3957 if (IsInteger32Constant(operand_value)) { |
3957 DeoptimizeIf(no_condition, instr->environment()); | 3958 DeoptimizeIf(no_condition, instr->environment()); |
3958 } | 3959 } |
3959 } else { | 3960 } else { |
(...skipping 34 matching lines...) Loading... | |
3994 SmiCheck check_needed = | 3995 SmiCheck check_needed = |
3995 instr->hydrogen()->value()->IsHeapObject() | 3996 instr->hydrogen()->value()->IsHeapObject() |
3996 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 3997 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
3997 | 3998 |
3998 Register write_register = object; | 3999 Register write_register = object; |
3999 if (!access.IsInobject()) { | 4000 if (!access.IsInobject()) { |
4000 write_register = ToRegister(instr->temp()); | 4001 write_register = ToRegister(instr->temp()); |
4001 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4002 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4002 } | 4003 } |
4003 | 4004 |
4005 bool kScratchRegisterContainsZero = false; | |
4006 if (representation.IsSmi()) { | |
4007 if (!instr->hydrogen()->can_omit_smi_tag_store()) { | |
4008 // Clear the smi tag as we are not sure that it contains the right value. | |
4009 __ xorl(kScratchRegister, kScratchRegister); | |
4010 kScratchRegisterContainsZero = true; | |
4011 __ movl(FieldOperand(write_register, offset), kScratchRegister); | |
Toon Verwaest
2013/12/09 15:51:10
What about just shifting up the value and storing
Igor Sheludko
2013/12/10 09:13:08
Done.
| |
4012 } | |
4013 // Deal with the upper part of the smi containing the value. | |
4014 offset += kPointerSize / 2; | |
4015 representation = Representation::Integer32(); | |
4016 } | |
4017 | |
4004 if (instr->value()->IsConstantOperand()) { | 4018 if (instr->value()->IsConstantOperand()) { |
4005 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4019 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4006 if (operand_value->IsRegister()) { | 4020 if (operand_value->IsRegister()) { |
4007 Register value = ToRegister(operand_value); | 4021 Register value = ToRegister(operand_value); |
4008 __ Store(FieldOperand(write_register, offset), value, representation); | 4022 __ Store(FieldOperand(write_register, offset), value, representation); |
4009 } else if (representation.IsInteger32()) { | 4023 } else if (representation.IsInteger32()) { |
4010 int32_t value = ToInteger32(operand_value); | 4024 int32_t value = ToInteger32(operand_value); |
4011 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4025 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4012 __ movl(FieldOperand(write_register, offset), Immediate(value)); | 4026 if ((value == 0) && kScratchRegisterContainsZero) { |
4027 __ movl(FieldOperand(write_register, offset), kScratchRegister); | |
4028 } else { | |
4029 __ movl(FieldOperand(write_register, offset), Immediate(value)); | |
4030 } | |
4013 } else { | 4031 } else { |
4014 Handle<Object> handle_value = ToHandle(operand_value); | 4032 Handle<Object> handle_value = ToHandle(operand_value); |
4015 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4033 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4016 __ Move(FieldOperand(write_register, offset), handle_value); | 4034 __ Move(FieldOperand(write_register, offset), handle_value); |
4017 } | 4035 } |
4018 } else { | 4036 } else { |
4019 Register value = ToRegister(instr->value()); | 4037 Register value = ToRegister(instr->value()); |
4020 __ Store(FieldOperand(write_register, offset), value, representation); | 4038 __ Store(FieldOperand(write_register, offset), value, representation); |
4021 } | 4039 } |
4022 | 4040 |
(...skipping 1559 matching lines...) Loading... | |
5582 FixedArray::kHeaderSize - kPointerSize)); | 5600 FixedArray::kHeaderSize - kPointerSize)); |
5583 __ bind(&done); | 5601 __ bind(&done); |
5584 } | 5602 } |
5585 | 5603 |
5586 | 5604 |
5587 #undef __ | 5605 #undef __ |
5588 | 5606 |
5589 } } // namespace v8::internal | 5607 } } // namespace v8::internal |
5590 | 5608 |
5591 #endif // V8_TARGET_ARCH_X64 | 5609 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |