OLD | NEW |
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 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2914 | 2914 |
2915 | 2915 |
2916 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2916 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2917 HObjectAccess access = instr->hydrogen()->access(); | 2917 HObjectAccess access = instr->hydrogen()->access(); |
2918 int offset = access.offset(); | 2918 int offset = access.offset(); |
2919 Register object = ToRegister(instr->object()); | 2919 Register object = ToRegister(instr->object()); |
2920 | 2920 |
2921 if (access.IsExternalMemory()) { | 2921 if (access.IsExternalMemory()) { |
2922 Register result = ToRegister(instr->result()); | 2922 Register result = ToRegister(instr->result()); |
2923 MemOperand operand = MemOperand(object, offset); | 2923 MemOperand operand = MemOperand(object, offset); |
2924 if (access.representation().IsByte()) { | 2924 __ Load(result, operand, access.representation()); |
2925 __ lb(result, operand); | |
2926 } else { | |
2927 __ lw(result, operand); | |
2928 } | |
2929 return; | 2925 return; |
2930 } | 2926 } |
2931 | 2927 |
2932 if (instr->hydrogen()->representation().IsDouble()) { | 2928 if (instr->hydrogen()->representation().IsDouble()) { |
2933 DoubleRegister result = ToDoubleRegister(instr->result()); | 2929 DoubleRegister result = ToDoubleRegister(instr->result()); |
2934 __ ldc1(result, FieldMemOperand(object, offset)); | 2930 __ ldc1(result, FieldMemOperand(object, offset)); |
2935 return; | 2931 return; |
2936 } | 2932 } |
2937 | 2933 |
2938 Register result = ToRegister(instr->result()); | 2934 Register result = ToRegister(instr->result()); |
2939 if (!access.IsInobject()) { | 2935 if (!access.IsInobject()) { |
2940 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2936 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
2941 object = result; | 2937 object = result; |
2942 } | 2938 } |
2943 MemOperand operand = FieldMemOperand(object, offset); | 2939 MemOperand operand = FieldMemOperand(object, offset); |
2944 if (access.representation().IsByte()) { | 2940 __ Load(result, operand, access.representation()); |
2945 __ lb(result, operand); | |
2946 } else { | |
2947 __ lw(result, operand); | |
2948 } | |
2949 } | 2941 } |
2950 | 2942 |
2951 | 2943 |
2952 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2944 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2953 ASSERT(ToRegister(instr->context()).is(cp)); | 2945 ASSERT(ToRegister(instr->context()).is(cp)); |
2954 ASSERT(ToRegister(instr->object()).is(a0)); | 2946 ASSERT(ToRegister(instr->object()).is(a0)); |
2955 ASSERT(ToRegister(instr->result()).is(v0)); | 2947 ASSERT(ToRegister(instr->result()).is(v0)); |
2956 | 2948 |
2957 // Name is always in a2. | 2949 // Name is always in a2. |
2958 __ li(a2, Operand(instr->name())); | 2950 __ li(a2, Operand(instr->name())); |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 Representation representation = instr->representation(); | 4091 Representation representation = instr->representation(); |
4100 | 4092 |
4101 Register object = ToRegister(instr->object()); | 4093 Register object = ToRegister(instr->object()); |
4102 Register scratch = scratch0(); | 4094 Register scratch = scratch0(); |
4103 HObjectAccess access = instr->hydrogen()->access(); | 4095 HObjectAccess access = instr->hydrogen()->access(); |
4104 int offset = access.offset(); | 4096 int offset = access.offset(); |
4105 | 4097 |
4106 if (access.IsExternalMemory()) { | 4098 if (access.IsExternalMemory()) { |
4107 Register value = ToRegister(instr->value()); | 4099 Register value = ToRegister(instr->value()); |
4108 MemOperand operand = MemOperand(object, offset); | 4100 MemOperand operand = MemOperand(object, offset); |
4109 if (representation.IsByte()) { | 4101 __ Store(value, operand, representation); |
4110 __ sb(value, operand); | |
4111 } else { | |
4112 __ sw(value, operand); | |
4113 } | |
4114 return; | 4102 return; |
4115 } | 4103 } |
4116 | 4104 |
4117 Handle<Map> transition = instr->transition(); | 4105 Handle<Map> transition = instr->transition(); |
4118 | 4106 |
4119 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4107 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
4120 Register value = ToRegister(instr->value()); | 4108 Register value = ToRegister(instr->value()); |
4121 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 4109 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
4122 __ And(scratch, value, Operand(kSmiTagMask)); | 4110 __ And(scratch, value, Operand(kSmiTagMask)); |
4123 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); | 4111 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); |
(...skipping 25 matching lines...) Expand all Loading... |
4149 } | 4137 } |
4150 | 4138 |
4151 // Do the store. | 4139 // Do the store. |
4152 Register value = ToRegister(instr->value()); | 4140 Register value = ToRegister(instr->value()); |
4153 ASSERT(!object.is(value)); | 4141 ASSERT(!object.is(value)); |
4154 SmiCheck check_needed = | 4142 SmiCheck check_needed = |
4155 instr->hydrogen()->value()->IsHeapObject() | 4143 instr->hydrogen()->value()->IsHeapObject() |
4156 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4144 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4157 if (access.IsInobject()) { | 4145 if (access.IsInobject()) { |
4158 MemOperand operand = FieldMemOperand(object, offset); | 4146 MemOperand operand = FieldMemOperand(object, offset); |
4159 if (representation.IsByte()) { | 4147 __ Store(value, operand, representation); |
4160 __ sb(value, operand); | |
4161 } else { | |
4162 __ sw(value, operand); | |
4163 } | |
4164 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4148 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4165 // Update the write barrier for the object for in-object properties. | 4149 // Update the write barrier for the object for in-object properties. |
4166 __ RecordWriteField(object, | 4150 __ RecordWriteField(object, |
4167 offset, | 4151 offset, |
4168 value, | 4152 value, |
4169 scratch, | 4153 scratch, |
4170 GetRAState(), | 4154 GetRAState(), |
4171 kSaveFPRegs, | 4155 kSaveFPRegs, |
4172 EMIT_REMEMBERED_SET, | 4156 EMIT_REMEMBERED_SET, |
4173 check_needed); | 4157 check_needed); |
4174 } | 4158 } |
4175 } else { | 4159 } else { |
4176 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 4160 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
4177 MemOperand operand = FieldMemOperand(scratch, offset); | 4161 MemOperand operand = FieldMemOperand(scratch, offset); |
4178 if (representation.IsByte()) { | 4162 __ Store(value, operand, representation); |
4179 __ sb(value, operand); | |
4180 } else { | |
4181 __ sw(value, operand); | |
4182 } | |
4183 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4163 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4184 // Update the write barrier for the properties array. | 4164 // Update the write barrier for the properties array. |
4185 // object is used as a scratch register. | 4165 // object is used as a scratch register. |
4186 __ RecordWriteField(scratch, | 4166 __ RecordWriteField(scratch, |
4187 offset, | 4167 offset, |
4188 value, | 4168 value, |
4189 object, | 4169 object, |
4190 GetRAState(), | 4170 GetRAState(), |
4191 kSaveFPRegs, | 4171 kSaveFPRegs, |
4192 EMIT_REMEMBERED_SET, | 4172 EMIT_REMEMBERED_SET, |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5866 __ Subu(scratch, result, scratch); | 5846 __ Subu(scratch, result, scratch); |
5867 __ lw(result, FieldMemOperand(scratch, | 5847 __ lw(result, FieldMemOperand(scratch, |
5868 FixedArray::kHeaderSize - kPointerSize)); | 5848 FixedArray::kHeaderSize - kPointerSize)); |
5869 __ bind(&done); | 5849 __ bind(&done); |
5870 } | 5850 } |
5871 | 5851 |
5872 | 5852 |
5873 #undef __ | 5853 #undef __ |
5874 | 5854 |
5875 } } // namespace v8::internal | 5855 } } // namespace v8::internal |
OLD | NEW |