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 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 Object* value, | 2281 Object* value, |
2282 WriteBarrierMode mode) { | 2282 WriteBarrierMode mode) { |
2283 // Adjust for the number of properties stored in the object. | 2283 // Adjust for the number of properties stored in the object. |
2284 int offset = GetInObjectPropertyOffset(index); | 2284 int offset = GetInObjectPropertyOffset(index); |
2285 WRITE_FIELD(this, offset, value); | 2285 WRITE_FIELD(this, offset, value); |
2286 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | 2286 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
2287 return value; | 2287 return value; |
2288 } | 2288 } |
2289 | 2289 |
2290 | 2290 |
2291 void JSObject::InitializeBody(Map* map, | 2291 void JSObject::InitializeBody(Map* map, int start_offset, |
2292 Object* pre_allocated_value, | 2292 Object* pre_allocated_value, |
2293 Object* filler_value) { | 2293 Object* filler_value) { |
2294 DCHECK(!filler_value->IsHeapObject() || | 2294 DCHECK(!filler_value->IsHeapObject() || |
2295 !GetHeap()->InNewSpace(filler_value)); | 2295 !GetHeap()->InNewSpace(filler_value)); |
2296 DCHECK(!pre_allocated_value->IsHeapObject() || | 2296 DCHECK(!pre_allocated_value->IsHeapObject() || |
2297 !GetHeap()->InNewSpace(pre_allocated_value)); | 2297 !GetHeap()->InNewSpace(pre_allocated_value)); |
2298 int size = map->instance_size(); | 2298 int size = map->instance_size(); |
2299 int offset = kHeaderSize; | 2299 int offset = start_offset; |
2300 if (filler_value != pre_allocated_value) { | 2300 if (filler_value != pre_allocated_value) { |
2301 int end_of_pre_allocated_offset = | 2301 int end_of_pre_allocated_offset = |
2302 size - (map->unused_property_fields() * kPointerSize); | 2302 size - (map->unused_property_fields() * kPointerSize); |
2303 DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset); | 2303 DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset); |
2304 while (offset < end_of_pre_allocated_offset) { | 2304 while (offset < end_of_pre_allocated_offset) { |
2305 WRITE_FIELD(this, offset, pre_allocated_value); | 2305 WRITE_FIELD(this, offset, pre_allocated_value); |
2306 offset += kPointerSize; | 2306 offset += kPointerSize; |
2307 } | 2307 } |
2308 } | 2308 } |
2309 while (offset < size) { | 2309 while (offset < size) { |
(...skipping 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7891 #undef WRITE_INT64_FIELD | 7891 #undef WRITE_INT64_FIELD |
7892 #undef READ_BYTE_FIELD | 7892 #undef READ_BYTE_FIELD |
7893 #undef WRITE_BYTE_FIELD | 7893 #undef WRITE_BYTE_FIELD |
7894 #undef NOBARRIER_READ_BYTE_FIELD | 7894 #undef NOBARRIER_READ_BYTE_FIELD |
7895 #undef NOBARRIER_WRITE_BYTE_FIELD | 7895 #undef NOBARRIER_WRITE_BYTE_FIELD |
7896 | 7896 |
7897 } // namespace internal | 7897 } // namespace internal |
7898 } // namespace v8 | 7898 } // namespace v8 |
7899 | 7899 |
7900 #endif // V8_OBJECTS_INL_H_ | 7900 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |