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

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

Issue 25460003: MIPS: Add support to load/store byte fields. (Closed) Base URL: https://github.com/v8/v8.git@gbl
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
« no previous file with comments | « no previous file | 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 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 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 } 2945 }
2946 2946
2947 2947
2948 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2948 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2949 HObjectAccess access = instr->hydrogen()->access(); 2949 HObjectAccess access = instr->hydrogen()->access();
2950 int offset = access.offset(); 2950 int offset = access.offset();
2951 Register object = ToRegister(instr->object()); 2951 Register object = ToRegister(instr->object());
2952 2952
2953 if (access.IsExternalMemory()) { 2953 if (access.IsExternalMemory()) {
2954 Register result = ToRegister(instr->result()); 2954 Register result = ToRegister(instr->result());
2955 __ lw(result, MemOperand(object, offset)); 2955 MemOperand operand = MemOperand(object, offset);
2956 if (access.representation().IsByte()) {
2957 __ lb(result, operand);
2958 } else {
2959 __ lw(result, operand);
2960 }
2956 return; 2961 return;
2957 } 2962 }
2958 2963
2959 if (instr->hydrogen()->representation().IsDouble()) { 2964 if (instr->hydrogen()->representation().IsDouble()) {
2960 DoubleRegister result = ToDoubleRegister(instr->result()); 2965 DoubleRegister result = ToDoubleRegister(instr->result());
2961 __ ldc1(result, FieldMemOperand(object, offset)); 2966 __ ldc1(result, FieldMemOperand(object, offset));
2962 return; 2967 return;
2963 } 2968 }
2964 2969
2965 Register result = ToRegister(instr->result()); 2970 Register result = ToRegister(instr->result());
2966 if (access.IsInobject()) { 2971 if (!access.IsInobject()) {
2967 __ lw(result, FieldMemOperand(object, offset)); 2972 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2973 object = result;
2974 }
2975 MemOperand operand = FieldMemOperand(object, offset);
2976 if (access.representation().IsByte()) {
2977 __ lb(result, operand);
2968 } else { 2978 } else {
2969 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 2979 __ lw(result, operand);
2970 __ lw(result, FieldMemOperand(result, offset));
2971 } 2980 }
2972 } 2981 }
2973 2982
2974 2983
2975 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2984 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2976 ASSERT(ToRegister(instr->context()).is(cp)); 2985 ASSERT(ToRegister(instr->context()).is(cp));
2977 ASSERT(ToRegister(instr->object()).is(a0)); 2986 ASSERT(ToRegister(instr->object()).is(a0));
2978 ASSERT(ToRegister(instr->result()).is(v0)); 2987 ASSERT(ToRegister(instr->result()).is(v0));
2979 2988
2980 // Name is always in a2. 2989 // Name is always in a2.
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 4133 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4125 Representation representation = instr->representation(); 4134 Representation representation = instr->representation();
4126 4135
4127 Register object = ToRegister(instr->object()); 4136 Register object = ToRegister(instr->object());
4128 Register scratch = scratch0(); 4137 Register scratch = scratch0();
4129 HObjectAccess access = instr->hydrogen()->access(); 4138 HObjectAccess access = instr->hydrogen()->access();
4130 int offset = access.offset(); 4139 int offset = access.offset();
4131 4140
4132 if (access.IsExternalMemory()) { 4141 if (access.IsExternalMemory()) {
4133 Register value = ToRegister(instr->value()); 4142 Register value = ToRegister(instr->value());
4134 __ sw(value, MemOperand(object, offset)); 4143 MemOperand operand = MemOperand(object, offset);
4144 if (representation.IsByte()) {
4145 __ sb(value, operand);
4146 } else {
4147 __ sw(value, operand);
4148 }
4135 return; 4149 return;
4136 } 4150 }
4137 4151
4138 Handle<Map> transition = instr->transition(); 4152 Handle<Map> transition = instr->transition();
4139 4153
4140 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 4154 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
4141 Register value = ToRegister(instr->value()); 4155 Register value = ToRegister(instr->value());
4142 if (!instr->hydrogen()->value()->type().IsHeapObject()) { 4156 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4143 __ And(scratch, value, Operand(kSmiTagMask)); 4157 __ And(scratch, value, Operand(kSmiTagMask));
4144 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); 4158 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
(...skipping 24 matching lines...) Expand all
4169 } 4183 }
4170 } 4184 }
4171 4185
4172 // Do the store. 4186 // Do the store.
4173 Register value = ToRegister(instr->value()); 4187 Register value = ToRegister(instr->value());
4174 ASSERT(!object.is(value)); 4188 ASSERT(!object.is(value));
4175 SmiCheck check_needed = 4189 SmiCheck check_needed =
4176 instr->hydrogen()->value()->IsHeapObject() 4190 instr->hydrogen()->value()->IsHeapObject()
4177 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4191 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4178 if (access.IsInobject()) { 4192 if (access.IsInobject()) {
4179 __ sw(value, FieldMemOperand(object, offset)); 4193 MemOperand operand = FieldMemOperand(object, offset);
4194 if (representation.IsByte()) {
4195 __ sb(value, operand);
4196 } else {
4197 __ sw(value, operand);
4198 }
4180 if (instr->hydrogen()->NeedsWriteBarrier()) { 4199 if (instr->hydrogen()->NeedsWriteBarrier()) {
4181 // Update the write barrier for the object for in-object properties. 4200 // Update the write barrier for the object for in-object properties.
4182 __ RecordWriteField(object, 4201 __ RecordWriteField(object,
4183 offset, 4202 offset,
4184 value, 4203 value,
4185 scratch, 4204 scratch,
4186 GetRAState(), 4205 GetRAState(),
4187 kSaveFPRegs, 4206 kSaveFPRegs,
4188 EMIT_REMEMBERED_SET, 4207 EMIT_REMEMBERED_SET,
4189 check_needed); 4208 check_needed);
4190 } 4209 }
4191 } else { 4210 } else {
4192 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); 4211 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
4193 __ sw(value, FieldMemOperand(scratch, offset)); 4212 MemOperand operand = FieldMemOperand(scratch, offset);
4213 if (representation.IsByte()) {
4214 __ sb(value, operand);
4215 } else {
4216 __ sw(value, operand);
4217 }
4194 if (instr->hydrogen()->NeedsWriteBarrier()) { 4218 if (instr->hydrogen()->NeedsWriteBarrier()) {
4195 // Update the write barrier for the properties array. 4219 // Update the write barrier for the properties array.
4196 // object is used as a scratch register. 4220 // object is used as a scratch register.
4197 __ RecordWriteField(scratch, 4221 __ RecordWriteField(scratch,
4198 offset, 4222 offset,
4199 value, 4223 value,
4200 object, 4224 object,
4201 GetRAState(), 4225 GetRAState(),
4202 kSaveFPRegs, 4226 kSaveFPRegs,
4203 EMIT_REMEMBERED_SET, 4227 EMIT_REMEMBERED_SET,
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
5848 __ Subu(scratch, result, scratch); 5872 __ Subu(scratch, result, scratch);
5849 __ lw(result, FieldMemOperand(scratch, 5873 __ lw(result, FieldMemOperand(scratch,
5850 FixedArray::kHeaderSize - kPointerSize)); 5874 FixedArray::kHeaderSize - kPointerSize));
5851 __ bind(&done); 5875 __ bind(&done);
5852 } 5876 }
5853 5877
5854 5878
5855 #undef __ 5879 #undef __
5856 5880
5857 } } // namespace v8::internal 5881 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698