Chromium Code Reviews| Index: src/objects-inl.h |
| =================================================================== |
| --- src/objects-inl.h (revision 10127) |
| +++ src/objects-inl.h (working copy) |
| @@ -1703,6 +1703,19 @@ |
| } |
| +void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array, |
| + int index, |
| + Object* value) { |
| + ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); |
| + ASSERT(index >= 0 && index < array->length()); |
| + int offset = kHeaderSize + index * kPointerSize; |
| + WRITE_FIELD(array, offset, value); |
| + if (array->GetHeap()->InNewSpace(value)) { |
|
Vyacheslav Egorov (Chromium)
2011/12/02 12:44:42
Get heap once and cache it locally.
fschneider
2011/12/02 13:51:19
Done.
|
| + array->GetHeap()->RecordWrite(array->address(), offset); |
| + } |
| +} |
| + |
| + |
| void FixedArray::NoWriteBarrierSet(FixedArray* array, |
| int index, |
| Object* value) { |
| @@ -1797,12 +1810,12 @@ |
| } |
| -void DescriptorArray::NoWriteBarrierSwap(FixedArray* array, |
| - int first, |
| - int second) { |
| +void DescriptorArray::NoIncrementalWriteBarrierSwap(FixedArray* array, |
| + int first, |
| + int second) { |
| Object* tmp = array->get(first); |
| - NoWriteBarrierSet(array, first, array->get(second)); |
| - NoWriteBarrierSet(array, second, tmp); |
| + NoIncrementalWriteBarrierSet(array, first, array->get(second)); |
| + NoIncrementalWriteBarrierSet(array, second, tmp); |
| } |
| @@ -1914,20 +1927,16 @@ |
| // Range check. |
| ASSERT(descriptor_number < number_of_descriptors()); |
| - // Make sure none of the elements in desc are in new space. |
| - ASSERT(!HEAP->InNewSpace(desc->GetKey())); |
| - ASSERT(!HEAP->InNewSpace(desc->GetValue())); |
| - |
| - NoWriteBarrierSet(this, |
| - ToKeyIndex(descriptor_number), |
| - desc->GetKey()); |
| + NoIncrementalWriteBarrierSet(this, |
| + ToKeyIndex(descriptor_number), |
| + desc->GetKey()); |
| FixedArray* content_array = GetContentArray(); |
| - NoWriteBarrierSet(content_array, |
| - ToValueIndex(descriptor_number), |
| - desc->GetValue()); |
| - NoWriteBarrierSet(content_array, |
| - ToDetailsIndex(descriptor_number), |
| - desc->GetDetails().AsSmi()); |
| + NoIncrementalWriteBarrierSet(content_array, |
| + ToValueIndex(descriptor_number), |
| + desc->GetValue()); |
| + NoIncrementalWriteBarrierSet(content_array, |
| + ToDetailsIndex(descriptor_number), |
| + desc->GetDetails().AsSmi()); |
| } |
| @@ -1941,15 +1950,16 @@ |
| } |
| -void DescriptorArray::NoWriteBarrierSwapDescriptors(int first, int second) { |
| - NoWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); |
| +void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( |
| + int first, int second) { |
| + NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); |
| FixedArray* content_array = GetContentArray(); |
| - NoWriteBarrierSwap(content_array, |
| - ToValueIndex(first), |
| - ToValueIndex(second)); |
| - NoWriteBarrierSwap(content_array, |
| - ToDetailsIndex(first), |
| - ToDetailsIndex(second)); |
| + NoIncrementalWriteBarrierSwap(content_array, |
| + ToValueIndex(first), |
| + ToValueIndex(second)); |
| + NoIncrementalWriteBarrierSwap(content_array, |
| + ToDetailsIndex(first), |
| + ToDetailsIndex(second)); |
| } |