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

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: Also adjust HLoadNamedField::InferRange. 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/ia32/lithium-codegen-ia32.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 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 } 3035 }
3036 3036
3037 3037
3038 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 3038 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3039 HObjectAccess access = instr->hydrogen()->access(); 3039 HObjectAccess access = instr->hydrogen()->access();
3040 int offset = access.offset(); 3040 int offset = access.offset();
3041 Register object = ToRegister(instr->object()); 3041 Register object = ToRegister(instr->object());
3042 3042
3043 if (access.IsExternalMemory()) { 3043 if (access.IsExternalMemory()) {
3044 Register result = ToRegister(instr->result()); 3044 Register result = ToRegister(instr->result());
3045 __ ldr(result, MemOperand(object, offset)); 3045 MemOperand operand = MemOperand(object, offset);
3046 if (access.representation().IsByte()) {
3047 __ ldrb(result, operand);
3048 } else {
3049 __ ldr(result, operand);
3050 }
3046 return; 3051 return;
3047 } 3052 }
3048 3053
3049 if (instr->hydrogen()->representation().IsDouble()) { 3054 if (instr->hydrogen()->representation().IsDouble()) {
3050 DwVfpRegister result = ToDoubleRegister(instr->result()); 3055 DwVfpRegister result = ToDoubleRegister(instr->result());
3051 __ vldr(result, FieldMemOperand(object, offset)); 3056 __ vldr(result, FieldMemOperand(object, offset));
3052 return; 3057 return;
3053 } 3058 }
3054 3059
3055 Register result = ToRegister(instr->result()); 3060 Register result = ToRegister(instr->result());
3056 if (access.IsInobject()) { 3061 if (!access.IsInobject()) {
3057 __ ldr(result, FieldMemOperand(object, offset)); 3062 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
3063 object = result;
3064 }
3065 MemOperand operand = FieldMemOperand(object, offset);
3066 if (access.representation().IsByte()) {
3067 __ ldrb(result, operand);
3058 } else { 3068 } else {
3059 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 3069 __ ldr(result, operand);
3060 __ ldr(result, FieldMemOperand(result, offset));
3061 } 3070 }
3062 } 3071 }
3063 3072
3064 3073
3065 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 3074 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3066 ASSERT(ToRegister(instr->context()).is(cp)); 3075 ASSERT(ToRegister(instr->context()).is(cp));
3067 ASSERT(ToRegister(instr->object()).is(r0)); 3076 ASSERT(ToRegister(instr->object()).is(r0));
3068 ASSERT(ToRegister(instr->result()).is(r0)); 3077 ASSERT(ToRegister(instr->result()).is(r0));
3069 3078
3070 // Name is always in r2. 3079 // Name is always in r2.
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
4156 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 4165 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4157 Representation representation = instr->representation(); 4166 Representation representation = instr->representation();
4158 4167
4159 Register object = ToRegister(instr->object()); 4168 Register object = ToRegister(instr->object());
4160 Register scratch = scratch0(); 4169 Register scratch = scratch0();
4161 HObjectAccess access = instr->hydrogen()->access(); 4170 HObjectAccess access = instr->hydrogen()->access();
4162 int offset = access.offset(); 4171 int offset = access.offset();
4163 4172
4164 if (access.IsExternalMemory()) { 4173 if (access.IsExternalMemory()) {
4165 Register value = ToRegister(instr->value()); 4174 Register value = ToRegister(instr->value());
4166 __ str(value, MemOperand(object, offset)); 4175 MemOperand operand = MemOperand(object, offset);
4176 if (representation.IsByte()) {
4177 __ strb(value, operand);
4178 } else {
4179 __ str(value, operand);
4180 }
4167 return; 4181 return;
4168 } 4182 }
4169 4183
4170 Handle<Map> transition = instr->transition(); 4184 Handle<Map> transition = instr->transition();
4171 4185
4172 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 4186 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
4173 Register value = ToRegister(instr->value()); 4187 Register value = ToRegister(instr->value());
4174 if (!instr->hydrogen()->value()->type().IsHeapObject()) { 4188 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4175 __ SmiTst(value); 4189 __ SmiTst(value);
4176 DeoptimizeIf(eq, instr->environment()); 4190 DeoptimizeIf(eq, instr->environment());
(...skipping 24 matching lines...) Expand all
4201 } 4215 }
4202 } 4216 }
4203 4217
4204 // Do the store. 4218 // Do the store.
4205 Register value = ToRegister(instr->value()); 4219 Register value = ToRegister(instr->value());
4206 ASSERT(!object.is(value)); 4220 ASSERT(!object.is(value));
4207 SmiCheck check_needed = 4221 SmiCheck check_needed =
4208 instr->hydrogen()->value()->IsHeapObject() 4222 instr->hydrogen()->value()->IsHeapObject()
4209 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4223 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4210 if (access.IsInobject()) { 4224 if (access.IsInobject()) {
4211 __ str(value, FieldMemOperand(object, offset)); 4225 MemOperand operand = FieldMemOperand(object, offset);
4226 if (representation.IsByte()) {
4227 __ strb(value, operand);
4228 } else {
4229 __ str(value, operand);
4230 }
4212 if (instr->hydrogen()->NeedsWriteBarrier()) { 4231 if (instr->hydrogen()->NeedsWriteBarrier()) {
4213 // Update the write barrier for the object for in-object properties. 4232 // Update the write barrier for the object for in-object properties.
4214 __ RecordWriteField(object, 4233 __ RecordWriteField(object,
4215 offset, 4234 offset,
4216 value, 4235 value,
4217 scratch, 4236 scratch,
4218 GetLinkRegisterState(), 4237 GetLinkRegisterState(),
4219 kSaveFPRegs, 4238 kSaveFPRegs,
4220 EMIT_REMEMBERED_SET, 4239 EMIT_REMEMBERED_SET,
4221 check_needed); 4240 check_needed);
4222 } 4241 }
4223 } else { 4242 } else {
4224 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); 4243 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
4225 __ str(value, FieldMemOperand(scratch, offset)); 4244 MemOperand operand = FieldMemOperand(scratch, offset);
4245 if (representation.IsByte()) {
4246 __ strb(value, operand);
4247 } else {
4248 __ str(value, operand);
4249 }
4226 if (instr->hydrogen()->NeedsWriteBarrier()) { 4250 if (instr->hydrogen()->NeedsWriteBarrier()) {
4227 // Update the write barrier for the properties array. 4251 // Update the write barrier for the properties array.
4228 // object is used as a scratch register. 4252 // object is used as a scratch register.
4229 __ RecordWriteField(scratch, 4253 __ RecordWriteField(scratch,
4230 offset, 4254 offset,
4231 value, 4255 value,
4232 object, 4256 object,
4233 GetLinkRegisterState(), 4257 GetLinkRegisterState(),
4234 kSaveFPRegs, 4258 kSaveFPRegs,
4235 EMIT_REMEMBERED_SET, 4259 EMIT_REMEMBERED_SET,
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5829 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5806 __ ldr(result, FieldMemOperand(scratch, 5830 __ ldr(result, FieldMemOperand(scratch,
5807 FixedArray::kHeaderSize - kPointerSize)); 5831 FixedArray::kHeaderSize - kPointerSize));
5808 __ bind(&done); 5832 __ bind(&done);
5809 } 5833 }
5810 5834
5811 5835
5812 #undef __ 5836 #undef __
5813 5837
5814 } } // namespace v8::internal 5838 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698