Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/a64/lithium-codegen-a64.cc

Issue 189373006: A64: Improve constraints for StoreNamedField (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/a64/lithium-a64.cc ('K') | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5139 ASSERT(ToRegister(instr->key()).Is(x1)); 5139 ASSERT(ToRegister(instr->key()).Is(x1));
5140 ASSERT(ToRegister(instr->value()).Is(x0)); 5140 ASSERT(ToRegister(instr->value()).Is(x0));
5141 5141
5142 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 5142 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
5143 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 5143 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
5144 : isolate()->builtins()->KeyedStoreIC_Initialize(); 5144 : isolate()->builtins()->KeyedStoreIC_Initialize();
5145 CallCode(ic, RelocInfo::CODE_TARGET, instr); 5145 CallCode(ic, RelocInfo::CODE_TARGET, instr);
5146 } 5146 }
5147 5147
5148 5148
5149 // TODO(jbramley): Once the merge is done and we're tracking bleeding_edge, try
5150 // to tidy up this function.
5151 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 5149 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
5152 Representation representation = instr->representation(); 5150 Representation representation = instr->representation();
5153 5151
5154 Register object = ToRegister(instr->object()); 5152 Register object = ToRegister(instr->object());
5155 Register temp0 = ToRegister(instr->temp0());
5156 Register temp1 = ToRegister(instr->temp1());
5157 HObjectAccess access = instr->hydrogen()->access(); 5153 HObjectAccess access = instr->hydrogen()->access();
5154 Handle<Map> transition = instr->transition();
5158 int offset = access.offset(); 5155 int offset = access.offset();
5159 5156
5160 if (access.IsExternalMemory()) { 5157 if (access.IsExternalMemory()) {
5158 ASSERT(transition.is_null());
5159 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
5161 Register value = ToRegister(instr->value()); 5160 Register value = ToRegister(instr->value());
5162 __ Store(value, MemOperand(object, offset), representation); 5161 __ Store(value, MemOperand(object, offset), representation);
5163 return; 5162 return;
5164 }
5165
5166 Handle<Map> transition = instr->transition();
5167 SmiCheck check_needed =
5168 instr->hydrogen()->value()->IsHeapObject()
5169 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
5170
5171 if (representation.IsHeapObject()) {
5172 Register value = ToRegister(instr->value());
5173 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
5174 DeoptimizeIfSmi(value, instr->environment());
5175
5176 // We know that value is a smi now, so we can omit the check below.
5177 check_needed = OMIT_SMI_CHECK;
5178 }
5179 } else if (representation.IsDouble()) { 5163 } else if (representation.IsDouble()) {
5180 ASSERT(transition.is_null()); 5164 ASSERT(transition.is_null());
5181 ASSERT(access.IsInobject()); 5165 ASSERT(access.IsInobject());
5182 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 5166 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
5183 FPRegister value = ToDoubleRegister(instr->value()); 5167 FPRegister value = ToDoubleRegister(instr->value());
5184 __ Str(value, FieldMemOperand(object, offset)); 5168 __ Str(value, FieldMemOperand(object, offset));
5185 return; 5169 return;
5186 } 5170 }
5187 5171
5172 Register value = ToRegister(instr->value());
5173
5174 SmiCheck check_needed = instr->hydrogen()->value()->IsHeapObject()
5175 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
5176
5177 if (representation.IsHeapObject() &&
5178 !instr->hydrogen()->value()->type().IsHeapObject()) {
5179 DeoptimizeIfSmi(value, instr->environment());
5180
5181 // We know that value is a smi now, so we can omit the check below.
5182 check_needed = OMIT_SMI_CHECK;
5183 }
5184
5188 if (!transition.is_null()) { 5185 if (!transition.is_null()) {
5189 // Store the new map value. 5186 // Store the new map value.
5190 Register new_map_value = temp0; 5187 Register new_map_value = ToRegister(instr->temp0());
5191 __ Mov(new_map_value, Operand(transition)); 5188 __ Mov(new_map_value, Operand(transition));
5192 __ Str(new_map_value, FieldMemOperand(object, HeapObject::kMapOffset)); 5189 __ Str(new_map_value, FieldMemOperand(object, HeapObject::kMapOffset));
5193 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { 5190 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
5194 // Update the write barrier for the map field. 5191 // Update the write barrier for the map field.
5195 __ RecordWriteField(object, 5192 __ RecordWriteField(object,
5196 HeapObject::kMapOffset, 5193 HeapObject::kMapOffset,
5197 new_map_value, 5194 new_map_value,
5198 temp1, 5195 ToRegister(instr->temp1()),
5199 GetLinkRegisterState(), 5196 GetLinkRegisterState(),
5200 kSaveFPRegs, 5197 kSaveFPRegs,
5201 OMIT_REMEMBERED_SET, 5198 OMIT_REMEMBERED_SET,
5202 OMIT_SMI_CHECK); 5199 OMIT_SMI_CHECK);
5203 } 5200 }
5204 } 5201 }
5205 5202
5206 // Do the store. 5203 // Do the store.
5207 Register value = ToRegister(instr->value());
5208 Register destination; 5204 Register destination;
5209 if (access.IsInobject()) { 5205 if (access.IsInobject()) {
5210 destination = object; 5206 destination = object;
5211 } else { 5207 } else {
5208 Register temp0 = ToRegister(instr->temp0());
5212 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5209 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset));
5213 destination = temp0; 5210 destination = temp0;
5214 } 5211 }
5215 5212
5216 if (representation.IsSmi() && 5213 if (representation.IsSmi() &&
5217 instr->hydrogen()->value()->representation().IsInteger32()) { 5214 instr->hydrogen()->value()->representation().IsInteger32()) {
5218 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); 5215 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
5219 #ifdef DEBUG 5216 #ifdef DEBUG
5220 __ Ldr(temp1, FieldMemOperand(destination, offset)); 5217 Register temp0 = ToRegister(instr->temp0());
5221 __ AssertSmi(temp1); 5218 __ Ldr(temp0, FieldMemOperand(destination, offset));
5219 __ AssertSmi(temp0);
5220 // If destination aliased temp0, restore it to the address calculated
5221 // earlier.
5222 if (destination.Is(temp0)) {
5223 ASSERT(!access.IsInobject());
5224 __ Ldr(destination, FieldMemOperand(object, JSObject::kPropertiesOffset));
5225 }
5222 #endif 5226 #endif
5223 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0); 5227 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
5224 __ Store(value, UntagSmiFieldMemOperand(destination, offset), 5228 __ Store(value, UntagSmiFieldMemOperand(destination, offset),
5225 Representation::Integer32()); 5229 Representation::Integer32());
5226 } else { 5230 } else {
5227 __ Store(value, FieldMemOperand(destination, offset), representation); 5231 __ Store(value, FieldMemOperand(destination, offset), representation);
5228 } 5232 }
5229 if (instr->hydrogen()->NeedsWriteBarrier()) { 5233 if (instr->hydrogen()->NeedsWriteBarrier()) {
5230 __ RecordWriteField(destination, 5234 __ RecordWriteField(destination,
5231 offset, 5235 offset,
5232 value, // Clobbered. 5236 value, // Clobbered.
5233 temp1, // Clobbered. 5237 ToRegister(instr->temp1()), // Clobbered.
5234 GetLinkRegisterState(), 5238 GetLinkRegisterState(),
5235 kSaveFPRegs, 5239 kSaveFPRegs,
5236 EMIT_REMEMBERED_SET, 5240 EMIT_REMEMBERED_SET,
5237 check_needed); 5241 check_needed);
5238 } 5242 }
5239 } 5243 }
5240 5244
5241 5245
5242 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 5246 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
5243 ASSERT(ToRegister(instr->context()).is(cp)); 5247 ASSERT(ToRegister(instr->context()).is(cp));
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
5801 __ Bind(&out_of_object); 5805 __ Bind(&out_of_object);
5802 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5806 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5803 // Index is equal to negated out of object property index plus 1. 5807 // Index is equal to negated out of object property index plus 1.
5804 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5808 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5805 __ Ldr(result, FieldMemOperand(result, 5809 __ Ldr(result, FieldMemOperand(result,
5806 FixedArray::kHeaderSize - kPointerSize)); 5810 FixedArray::kHeaderSize - kPointerSize));
5807 __ Bind(&done); 5811 __ Bind(&done);
5808 } 5812 }
5809 5813
5810 } } // namespace v8::internal 5814 } } // namespace v8::internal
OLDNEW
« src/a64/lithium-a64.cc ('K') | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698