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 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 } | 2889 } |
2890 | 2890 |
2891 | 2891 |
2892 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2892 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2893 HObjectAccess access = instr->hydrogen()->access(); | 2893 HObjectAccess access = instr->hydrogen()->access(); |
2894 int offset = access.offset(); | 2894 int offset = access.offset(); |
2895 Register object = ToRegister(instr->object()); | 2895 Register object = ToRegister(instr->object()); |
2896 | 2896 |
2897 if (access.IsExternalMemory()) { | 2897 if (access.IsExternalMemory()) { |
2898 Register result = ToRegister(instr->result()); | 2898 Register result = ToRegister(instr->result()); |
2899 MemOperand operand = MemOperand(object, offset); | 2899 __ lw(result, MemOperand(object, offset)); |
2900 if (access.representation().IsByte()) { | |
2901 __ lb(result, operand); | |
2902 } else { | |
2903 __ lw(result, operand); | |
2904 } | |
2905 return; | 2900 return; |
2906 } | 2901 } |
2907 | 2902 |
2908 if (instr->hydrogen()->representation().IsDouble()) { | 2903 if (instr->hydrogen()->representation().IsDouble()) { |
2909 DoubleRegister result = ToDoubleRegister(instr->result()); | 2904 DoubleRegister result = ToDoubleRegister(instr->result()); |
2910 __ ldc1(result, FieldMemOperand(object, offset)); | 2905 __ ldc1(result, FieldMemOperand(object, offset)); |
2911 return; | 2906 return; |
2912 } | 2907 } |
2913 | 2908 |
2914 Register result = ToRegister(instr->result()); | 2909 Register result = ToRegister(instr->result()); |
2915 if (!access.IsInobject()) { | 2910 if (access.IsInobject()) { |
| 2911 __ lw(result, FieldMemOperand(object, offset)); |
| 2912 } else { |
2916 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2913 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
2917 object = result; | 2914 __ lw(result, FieldMemOperand(result, offset)); |
2918 } | |
2919 MemOperand operand = FieldMemOperand(object, offset); | |
2920 if (access.representation().IsByte()) { | |
2921 __ lb(result, operand); | |
2922 } else { | |
2923 __ lw(result, operand); | |
2924 } | 2915 } |
2925 } | 2916 } |
2926 | 2917 |
2927 | 2918 |
2928 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2919 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2929 ASSERT(ToRegister(instr->context()).is(cp)); | 2920 ASSERT(ToRegister(instr->context()).is(cp)); |
2930 ASSERT(ToRegister(instr->object()).is(a0)); | 2921 ASSERT(ToRegister(instr->object()).is(a0)); |
2931 ASSERT(ToRegister(instr->result()).is(v0)); | 2922 ASSERT(ToRegister(instr->result()).is(v0)); |
2932 | 2923 |
2933 // Name is always in a2. | 2924 // Name is always in a2. |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4077 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4068 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
4078 Representation representation = instr->representation(); | 4069 Representation representation = instr->representation(); |
4079 | 4070 |
4080 Register object = ToRegister(instr->object()); | 4071 Register object = ToRegister(instr->object()); |
4081 Register scratch = scratch0(); | 4072 Register scratch = scratch0(); |
4082 HObjectAccess access = instr->hydrogen()->access(); | 4073 HObjectAccess access = instr->hydrogen()->access(); |
4083 int offset = access.offset(); | 4074 int offset = access.offset(); |
4084 | 4075 |
4085 if (access.IsExternalMemory()) { | 4076 if (access.IsExternalMemory()) { |
4086 Register value = ToRegister(instr->value()); | 4077 Register value = ToRegister(instr->value()); |
4087 MemOperand operand = MemOperand(object, offset); | 4078 __ sw(value, MemOperand(object, offset)); |
4088 if (representation.IsByte()) { | |
4089 __ sb(value, operand); | |
4090 } else { | |
4091 __ sw(value, operand); | |
4092 } | |
4093 return; | 4079 return; |
4094 } | 4080 } |
4095 | 4081 |
4096 Handle<Map> transition = instr->transition(); | 4082 Handle<Map> transition = instr->transition(); |
4097 | 4083 |
4098 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4084 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
4099 Register value = ToRegister(instr->value()); | 4085 Register value = ToRegister(instr->value()); |
4100 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 4086 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
4101 __ And(scratch, value, Operand(kSmiTagMask)); | 4087 __ And(scratch, value, Operand(kSmiTagMask)); |
4102 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); | 4088 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); |
(...skipping 24 matching lines...) Expand all Loading... |
4127 } | 4113 } |
4128 } | 4114 } |
4129 | 4115 |
4130 // Do the store. | 4116 // Do the store. |
4131 Register value = ToRegister(instr->value()); | 4117 Register value = ToRegister(instr->value()); |
4132 ASSERT(!object.is(value)); | 4118 ASSERT(!object.is(value)); |
4133 SmiCheck check_needed = | 4119 SmiCheck check_needed = |
4134 instr->hydrogen()->value()->IsHeapObject() | 4120 instr->hydrogen()->value()->IsHeapObject() |
4135 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4121 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4136 if (access.IsInobject()) { | 4122 if (access.IsInobject()) { |
4137 MemOperand operand = FieldMemOperand(object, offset); | 4123 __ sw(value, FieldMemOperand(object, offset)); |
4138 if (representation.IsByte()) { | |
4139 __ sb(value, operand); | |
4140 } else { | |
4141 __ sw(value, operand); | |
4142 } | |
4143 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4124 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4144 // Update the write barrier for the object for in-object properties. | 4125 // Update the write barrier for the object for in-object properties. |
4145 __ RecordWriteField(object, | 4126 __ RecordWriteField(object, |
4146 offset, | 4127 offset, |
4147 value, | 4128 value, |
4148 scratch, | 4129 scratch, |
4149 GetRAState(), | 4130 GetRAState(), |
4150 kSaveFPRegs, | 4131 kSaveFPRegs, |
4151 EMIT_REMEMBERED_SET, | 4132 EMIT_REMEMBERED_SET, |
4152 check_needed); | 4133 check_needed); |
4153 } | 4134 } |
4154 } else { | 4135 } else { |
4155 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 4136 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
4156 MemOperand operand = FieldMemOperand(scratch, offset); | 4137 __ sw(value, FieldMemOperand(scratch, offset)); |
4157 if (representation.IsByte()) { | |
4158 __ sb(value, operand); | |
4159 } else { | |
4160 __ sw(value, operand); | |
4161 } | |
4162 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4138 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4163 // Update the write barrier for the properties array. | 4139 // Update the write barrier for the properties array. |
4164 // object is used as a scratch register. | 4140 // object is used as a scratch register. |
4165 __ RecordWriteField(scratch, | 4141 __ RecordWriteField(scratch, |
4166 offset, | 4142 offset, |
4167 value, | 4143 value, |
4168 object, | 4144 object, |
4169 GetRAState(), | 4145 GetRAState(), |
4170 kSaveFPRegs, | 4146 kSaveFPRegs, |
4171 EMIT_REMEMBERED_SET, | 4147 EMIT_REMEMBERED_SET, |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5815 __ Subu(scratch, result, scratch); | 5791 __ Subu(scratch, result, scratch); |
5816 __ lw(result, FieldMemOperand(scratch, | 5792 __ lw(result, FieldMemOperand(scratch, |
5817 FixedArray::kHeaderSize - kPointerSize)); | 5793 FixedArray::kHeaderSize - kPointerSize)); |
5818 __ bind(&done); | 5794 __ bind(&done); |
5819 } | 5795 } |
5820 | 5796 |
5821 | 5797 |
5822 #undef __ | 5798 #undef __ |
5823 | 5799 |
5824 } } // namespace v8::internal | 5800 } } // namespace v8::internal |
OLD | NEW |