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

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

Issue 25696004: Add support to load/store byte fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | src/x64/lithium-codegen-x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 } 3091 }
3092 3092
3093 3093
3094 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 3094 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3095 HObjectAccess access = instr->hydrogen()->access(); 3095 HObjectAccess access = instr->hydrogen()->access();
3096 int offset = access.offset(); 3096 int offset = access.offset();
3097 Register object = ToRegister(instr->object()); 3097 Register object = ToRegister(instr->object());
3098 3098
3099 if (access.IsExternalMemory()) { 3099 if (access.IsExternalMemory()) {
3100 Register result = ToRegister(instr->result()); 3100 Register result = ToRegister(instr->result());
3101 __ ldr(result, MemOperand(object, offset)); 3101 MemOperand operand = MemOperand(object, offset);
3102 if (access.representation().IsByte()) {
3103 __ ldrb(result, operand);
3104 } else {
3105 __ ldr(result, operand);
3106 }
3102 return; 3107 return;
3103 } 3108 }
3104 3109
3105 if (instr->hydrogen()->representation().IsDouble()) { 3110 if (instr->hydrogen()->representation().IsDouble()) {
3106 DwVfpRegister result = ToDoubleRegister(instr->result()); 3111 DwVfpRegister result = ToDoubleRegister(instr->result());
3107 __ vldr(result, FieldMemOperand(object, offset)); 3112 __ vldr(result, FieldMemOperand(object, offset));
3108 return; 3113 return;
3109 } 3114 }
3110 3115
3111 Register result = ToRegister(instr->result()); 3116 Register result = ToRegister(instr->result());
3112 if (access.IsInobject()) { 3117 if (!access.IsInobject()) {
3113 __ ldr(result, FieldMemOperand(object, offset)); 3118 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
3119 object = result;
3120 }
3121 MemOperand operand = FieldMemOperand(object, offset);
3122 if (access.representation().IsByte()) {
3123 __ ldrb(result, operand);
3114 } else { 3124 } else {
3115 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 3125 __ ldr(result, operand);
3116 __ ldr(result, FieldMemOperand(result, offset));
3117 } 3126 }
3118 } 3127 }
3119 3128
3120 3129
3121 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 3130 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3122 ASSERT(ToRegister(instr->context()).is(cp)); 3131 ASSERT(ToRegister(instr->context()).is(cp));
3123 ASSERT(ToRegister(instr->object()).is(r0)); 3132 ASSERT(ToRegister(instr->object()).is(r0));
3124 ASSERT(ToRegister(instr->result()).is(r0)); 3133 ASSERT(ToRegister(instr->result()).is(r0));
3125 3134
3126 // Name is always in r2. 3135 // Name is always in r2.
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
4212 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 4221 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4213 Representation representation = instr->representation(); 4222 Representation representation = instr->representation();
4214 4223
4215 Register object = ToRegister(instr->object()); 4224 Register object = ToRegister(instr->object());
4216 Register scratch = scratch0(); 4225 Register scratch = scratch0();
4217 HObjectAccess access = instr->hydrogen()->access(); 4226 HObjectAccess access = instr->hydrogen()->access();
4218 int offset = access.offset(); 4227 int offset = access.offset();
4219 4228
4220 if (access.IsExternalMemory()) { 4229 if (access.IsExternalMemory()) {
4221 Register value = ToRegister(instr->value()); 4230 Register value = ToRegister(instr->value());
4222 __ str(value, MemOperand(object, offset)); 4231 MemOperand operand = MemOperand(object, offset);
4232 if (representation.IsByte()) {
4233 __ strb(value, operand);
4234 } else {
4235 __ str(value, operand);
4236 }
4223 return; 4237 return;
4224 } 4238 }
4225 4239
4226 Handle<Map> transition = instr->transition(); 4240 Handle<Map> transition = instr->transition();
4227 4241
4228 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 4242 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
4229 Register value = ToRegister(instr->value()); 4243 Register value = ToRegister(instr->value());
4230 if (!instr->hydrogen()->value()->type().IsHeapObject()) { 4244 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4231 __ SmiTst(value); 4245 __ SmiTst(value);
4232 DeoptimizeIf(eq, instr->environment()); 4246 DeoptimizeIf(eq, instr->environment());
(...skipping 24 matching lines...) Expand all
4257 } 4271 }
4258 } 4272 }
4259 4273
4260 // Do the store. 4274 // Do the store.
4261 Register value = ToRegister(instr->value()); 4275 Register value = ToRegister(instr->value());
4262 ASSERT(!object.is(value)); 4276 ASSERT(!object.is(value));
4263 SmiCheck check_needed = 4277 SmiCheck check_needed =
4264 instr->hydrogen()->value()->IsHeapObject() 4278 instr->hydrogen()->value()->IsHeapObject()
4265 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4279 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4266 if (access.IsInobject()) { 4280 if (access.IsInobject()) {
4267 __ str(value, FieldMemOperand(object, offset)); 4281 MemOperand operand = FieldMemOperand(object, offset);
4282 if (representation.IsByte()) {
4283 __ strb(value, operand);
4284 } else {
4285 __ str(value, operand);
4286 }
4268 if (instr->hydrogen()->NeedsWriteBarrier()) { 4287 if (instr->hydrogen()->NeedsWriteBarrier()) {
4269 // Update the write barrier for the object for in-object properties. 4288 // Update the write barrier for the object for in-object properties.
4270 __ RecordWriteField(object, 4289 __ RecordWriteField(object,
4271 offset, 4290 offset,
4272 value, 4291 value,
4273 scratch, 4292 scratch,
4274 GetLinkRegisterState(), 4293 GetLinkRegisterState(),
4275 kSaveFPRegs, 4294 kSaveFPRegs,
4276 EMIT_REMEMBERED_SET, 4295 EMIT_REMEMBERED_SET,
4277 check_needed); 4296 check_needed);
4278 } 4297 }
4279 } else { 4298 } else {
4280 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); 4299 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
4281 __ str(value, FieldMemOperand(scratch, offset)); 4300 MemOperand operand = FieldMemOperand(scratch, offset);
4301 if (representation.IsByte()) {
4302 __ strb(value, operand);
4303 } else {
4304 __ str(value, operand);
4305 }
4282 if (instr->hydrogen()->NeedsWriteBarrier()) { 4306 if (instr->hydrogen()->NeedsWriteBarrier()) {
4283 // Update the write barrier for the properties array. 4307 // Update the write barrier for the properties array.
4284 // object is used as a scratch register. 4308 // object is used as a scratch register.
4285 __ RecordWriteField(scratch, 4309 __ RecordWriteField(scratch,
4286 offset, 4310 offset,
4287 value, 4311 value,
4288 object, 4312 object,
4289 GetLinkRegisterState(), 4313 GetLinkRegisterState(),
4290 kSaveFPRegs, 4314 kSaveFPRegs,
4291 EMIT_REMEMBERED_SET, 4315 EMIT_REMEMBERED_SET,
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
5862 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5886 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5863 __ ldr(result, FieldMemOperand(scratch, 5887 __ ldr(result, FieldMemOperand(scratch,
5864 FixedArray::kHeaderSize - kPointerSize)); 5888 FixedArray::kHeaderSize - kPointerSize));
5865 __ bind(&done); 5889 __ bind(&done);
5866 } 5890 }
5867 5891
5868 5892
5869 #undef __ 5893 #undef __
5870 5894
5871 } } // namespace v8::internal 5895 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698