OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) { | 2132 void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) { |
2133 if (IsUnboxedDoubleField(index)) { | 2133 if (IsUnboxedDoubleField(index)) { |
2134 DCHECK(value->IsMutableHeapNumber()); | 2134 DCHECK(value->IsMutableHeapNumber()); |
2135 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value()); | 2135 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value()); |
2136 } else { | 2136 } else { |
2137 RawFastPropertyAtPut(index, value); | 2137 RawFastPropertyAtPut(index, value); |
2138 } | 2138 } |
2139 } | 2139 } |
2140 | 2140 |
2141 | 2141 |
| 2142 void JSObject::WriteToField(int descriptor, Object* value) { |
| 2143 DisallowHeapAllocation no_gc; |
| 2144 |
| 2145 DescriptorArray* desc = map()->instance_descriptors(); |
| 2146 PropertyDetails details = desc->GetDetails(descriptor); |
| 2147 |
| 2148 DCHECK(details.type() == DATA); |
| 2149 |
| 2150 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); |
| 2151 if (details.representation().IsDouble()) { |
| 2152 // Nothing more to be done. |
| 2153 if (value->IsUninitialized()) return; |
| 2154 if (IsUnboxedDoubleField(index)) { |
| 2155 RawFastDoublePropertyAtPut(index, value->Number()); |
| 2156 } else { |
| 2157 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index)); |
| 2158 DCHECK(box->IsMutableHeapNumber()); |
| 2159 box->set_value(value->Number()); |
| 2160 } |
| 2161 } else { |
| 2162 RawFastPropertyAtPut(index, value); |
| 2163 } |
| 2164 } |
| 2165 |
| 2166 |
2142 int JSObject::GetInObjectPropertyOffset(int index) { | 2167 int JSObject::GetInObjectPropertyOffset(int index) { |
2143 return map()->GetInObjectPropertyOffset(index); | 2168 return map()->GetInObjectPropertyOffset(index); |
2144 } | 2169 } |
2145 | 2170 |
2146 | 2171 |
2147 Object* JSObject::InObjectPropertyAt(int index) { | 2172 Object* JSObject::InObjectPropertyAt(int index) { |
2148 int offset = GetInObjectPropertyOffset(index); | 2173 int offset = GetInObjectPropertyOffset(index); |
2149 return READ_FIELD(this, offset); | 2174 return READ_FIELD(this, offset); |
2150 } | 2175 } |
2151 | 2176 |
(...skipping 5478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7630 #undef READ_SHORT_FIELD | 7655 #undef READ_SHORT_FIELD |
7631 #undef WRITE_SHORT_FIELD | 7656 #undef WRITE_SHORT_FIELD |
7632 #undef READ_BYTE_FIELD | 7657 #undef READ_BYTE_FIELD |
7633 #undef WRITE_BYTE_FIELD | 7658 #undef WRITE_BYTE_FIELD |
7634 #undef NOBARRIER_READ_BYTE_FIELD | 7659 #undef NOBARRIER_READ_BYTE_FIELD |
7635 #undef NOBARRIER_WRITE_BYTE_FIELD | 7660 #undef NOBARRIER_WRITE_BYTE_FIELD |
7636 | 7661 |
7637 } } // namespace v8::internal | 7662 } } // namespace v8::internal |
7638 | 7663 |
7639 #endif // V8_OBJECTS_INL_H_ | 7664 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |