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 5068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5079 ASSERT(ToRegister(instr->key()).Is(x1)); | 5079 ASSERT(ToRegister(instr->key()).Is(x1)); |
5080 ASSERT(ToRegister(instr->value()).Is(x0)); | 5080 ASSERT(ToRegister(instr->value()).Is(x0)); |
5081 | 5081 |
5082 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 5082 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
5083 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 5083 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
5084 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 5084 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
5085 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 5085 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
5086 } | 5086 } |
5087 | 5087 |
5088 | 5088 |
5089 // TODO(jbramley): Once the merge is done and we're tracking bleeding_edge, try | |
5090 // to tidy up this function. | |
5091 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 5089 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
5092 Representation representation = instr->representation(); | 5090 Representation representation = instr->representation(); |
5093 | 5091 |
5094 Register object = ToRegister(instr->object()); | 5092 Register object = ToRegister(instr->object()); |
5095 Register temp0 = ToRegister(instr->temp0()); | |
5096 Register temp1 = ToRegister(instr->temp1()); | |
5097 HObjectAccess access = instr->hydrogen()->access(); | 5093 HObjectAccess access = instr->hydrogen()->access(); |
| 5094 Handle<Map> transition = instr->transition(); |
5098 int offset = access.offset(); | 5095 int offset = access.offset(); |
5099 | 5096 |
5100 if (access.IsExternalMemory()) { | 5097 if (access.IsExternalMemory()) { |
| 5098 ASSERT(transition.is_null()); |
| 5099 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
5101 Register value = ToRegister(instr->value()); | 5100 Register value = ToRegister(instr->value()); |
5102 __ Store(value, MemOperand(object, offset), representation); | 5101 __ Store(value, MemOperand(object, offset), representation); |
5103 return; | 5102 return; |
5104 } | |
5105 | |
5106 Handle<Map> transition = instr->transition(); | |
5107 SmiCheck check_needed = | |
5108 instr->hydrogen()->value()->IsHeapObject() | |
5109 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | |
5110 | |
5111 if (representation.IsHeapObject()) { | |
5112 Register value = ToRegister(instr->value()); | |
5113 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | |
5114 DeoptimizeIfSmi(value, instr->environment()); | |
5115 | |
5116 // We know that value is a smi now, so we can omit the check below. | |
5117 check_needed = OMIT_SMI_CHECK; | |
5118 } | |
5119 } else if (representation.IsDouble()) { | 5103 } else if (representation.IsDouble()) { |
5120 ASSERT(transition.is_null()); | 5104 ASSERT(transition.is_null()); |
5121 ASSERT(access.IsInobject()); | 5105 ASSERT(access.IsInobject()); |
5122 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 5106 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
5123 FPRegister value = ToDoubleRegister(instr->value()); | 5107 FPRegister value = ToDoubleRegister(instr->value()); |
5124 __ Str(value, FieldMemOperand(object, offset)); | 5108 __ Str(value, FieldMemOperand(object, offset)); |
5125 return; | 5109 return; |
5126 } | 5110 } |
5127 | 5111 |
| 5112 Register value = ToRegister(instr->value()); |
| 5113 |
| 5114 SmiCheck check_needed = instr->hydrogen()->value()->IsHeapObject() |
| 5115 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 5116 |
| 5117 if (representation.IsHeapObject() && |
| 5118 !instr->hydrogen()->value()->type().IsHeapObject()) { |
| 5119 DeoptimizeIfSmi(value, instr->environment()); |
| 5120 |
| 5121 // We know that value is a smi now, so we can omit the check below. |
| 5122 check_needed = OMIT_SMI_CHECK; |
| 5123 } |
| 5124 |
5128 if (!transition.is_null()) { | 5125 if (!transition.is_null()) { |
5129 // Store the new map value. | 5126 // Store the new map value. |
5130 Register new_map_value = temp0; | 5127 Register new_map_value = ToRegister(instr->temp0()); |
5131 __ Mov(new_map_value, Operand(transition)); | 5128 __ Mov(new_map_value, Operand(transition)); |
5132 __ Str(new_map_value, FieldMemOperand(object, HeapObject::kMapOffset)); | 5129 __ Str(new_map_value, FieldMemOperand(object, HeapObject::kMapOffset)); |
5133 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { | 5130 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { |
5134 // Update the write barrier for the map field. | 5131 // Update the write barrier for the map field. |
5135 __ RecordWriteField(object, | 5132 __ RecordWriteField(object, |
5136 HeapObject::kMapOffset, | 5133 HeapObject::kMapOffset, |
5137 new_map_value, | 5134 new_map_value, |
5138 temp1, | 5135 ToRegister(instr->temp1()), |
5139 GetLinkRegisterState(), | 5136 GetLinkRegisterState(), |
5140 kSaveFPRegs, | 5137 kSaveFPRegs, |
5141 OMIT_REMEMBERED_SET, | 5138 OMIT_REMEMBERED_SET, |
5142 OMIT_SMI_CHECK); | 5139 OMIT_SMI_CHECK); |
5143 } | 5140 } |
5144 } | 5141 } |
5145 | 5142 |
5146 // Do the store. | 5143 // Do the store. |
5147 Register value = ToRegister(instr->value()); | |
5148 Register destination; | 5144 Register destination; |
5149 if (access.IsInobject()) { | 5145 if (access.IsInobject()) { |
5150 destination = object; | 5146 destination = object; |
5151 } else { | 5147 } else { |
| 5148 Register temp0 = ToRegister(instr->temp0()); |
5152 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5149 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5153 destination = temp0; | 5150 destination = temp0; |
5154 } | 5151 } |
5155 | 5152 |
5156 if (representation.IsSmi() && | 5153 if (representation.IsSmi() && |
5157 instr->hydrogen()->value()->representation().IsInteger32()) { | 5154 instr->hydrogen()->value()->representation().IsInteger32()) { |
5158 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); | 5155 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); |
5159 #ifdef DEBUG | 5156 #ifdef DEBUG |
5160 __ Ldr(temp1, FieldMemOperand(destination, offset)); | 5157 Register temp0 = ToRegister(instr->temp0()); |
5161 __ AssertSmi(temp1); | 5158 __ Ldr(temp0, FieldMemOperand(destination, offset)); |
| 5159 __ AssertSmi(temp0); |
| 5160 // If destination aliased temp0, restore it to the address calculated |
| 5161 // earlier. |
| 5162 if (destination.Is(temp0)) { |
| 5163 ASSERT(!access.IsInobject()); |
| 5164 __ Ldr(destination, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5165 } |
5162 #endif | 5166 #endif |
5163 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0); | 5167 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0); |
5164 __ Store(value, UntagSmiFieldMemOperand(destination, offset), | 5168 __ Store(value, UntagSmiFieldMemOperand(destination, offset), |
5165 Representation::Integer32()); | 5169 Representation::Integer32()); |
5166 } else { | 5170 } else { |
5167 __ Store(value, FieldMemOperand(destination, offset), representation); | 5171 __ Store(value, FieldMemOperand(destination, offset), representation); |
5168 } | 5172 } |
5169 if (instr->hydrogen()->NeedsWriteBarrier()) { | 5173 if (instr->hydrogen()->NeedsWriteBarrier()) { |
5170 __ RecordWriteField(destination, | 5174 __ RecordWriteField(destination, |
5171 offset, | 5175 offset, |
5172 value, // Clobbered. | 5176 value, // Clobbered. |
5173 temp1, // Clobbered. | 5177 ToRegister(instr->temp1()), // Clobbered. |
5174 GetLinkRegisterState(), | 5178 GetLinkRegisterState(), |
5175 kSaveFPRegs, | 5179 kSaveFPRegs, |
5176 EMIT_REMEMBERED_SET, | 5180 EMIT_REMEMBERED_SET, |
5177 check_needed); | 5181 check_needed); |
5178 } | 5182 } |
5179 } | 5183 } |
5180 | 5184 |
5181 | 5185 |
5182 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 5186 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
5183 ASSERT(ToRegister(instr->context()).is(cp)); | 5187 ASSERT(ToRegister(instr->context()).is(cp)); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5741 __ Bind(&out_of_object); | 5745 __ Bind(&out_of_object); |
5742 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5746 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5743 // Index is equal to negated out of object property index plus 1. | 5747 // Index is equal to negated out of object property index plus 1. |
5744 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5748 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5745 __ Ldr(result, FieldMemOperand(result, | 5749 __ Ldr(result, FieldMemOperand(result, |
5746 FixedArray::kHeaderSize - kPointerSize)); | 5750 FixedArray::kHeaderSize - kPointerSize)); |
5747 __ Bind(&done); | 5751 __ Bind(&done); |
5748 } | 5752 } |
5749 | 5753 |
5750 } } // namespace v8::internal | 5754 } } // namespace v8::internal |
OLD | NEW |