OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3193 // Installs |new_descriptors| over the current instance_descriptors to ensure | 3193 // Installs |new_descriptors| over the current instance_descriptors to ensure |
3194 // proper sharing of descriptor arrays. | 3194 // proper sharing of descriptor arrays. |
3195 void Map::ReplaceDescriptors(DescriptorArray* new_descriptors, | 3195 void Map::ReplaceDescriptors(DescriptorArray* new_descriptors, |
3196 LayoutDescriptor* new_layout_descriptor) { | 3196 LayoutDescriptor* new_layout_descriptor) { |
3197 // Don't overwrite the empty descriptor array or initial map's descriptors. | 3197 // Don't overwrite the empty descriptor array or initial map's descriptors. |
3198 if (NumberOfOwnDescriptors() == 0 || GetBackPointer()->IsUndefined()) { | 3198 if (NumberOfOwnDescriptors() == 0 || GetBackPointer()->IsUndefined()) { |
3199 return; | 3199 return; |
3200 } | 3200 } |
3201 | 3201 |
3202 DescriptorArray* to_replace = instance_descriptors(); | 3202 DescriptorArray* to_replace = instance_descriptors(); |
3203 GetHeap()->incremental_marking()->RecordWrites(to_replace); | 3203 GetHeap()->incremental_marking()->IterateBlackObject(to_replace); |
3204 Map* current = this; | 3204 Map* current = this; |
3205 while (current->instance_descriptors() == to_replace) { | 3205 while (current->instance_descriptors() == to_replace) { |
3206 Object* next = current->GetBackPointer(); | 3206 Object* next = current->GetBackPointer(); |
3207 if (next->IsUndefined()) break; // Stop overwriting at initial map. | 3207 if (next->IsUndefined()) break; // Stop overwriting at initial map. |
3208 current->SetEnumLength(kInvalidEnumCacheSentinel); | 3208 current->SetEnumLength(kInvalidEnumCacheSentinel); |
3209 current->UpdateDescriptors(new_descriptors, new_layout_descriptor); | 3209 current->UpdateDescriptors(new_descriptors, new_layout_descriptor); |
3210 current = Map::cast(next); | 3210 current = Map::cast(next); |
3211 } | 3211 } |
3212 set_owns_descriptors(false); | 3212 set_owns_descriptors(false); |
3213 } | 3213 } |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4567 // If the source descriptors had an enum cache we copy it. This ensures | 4567 // If the source descriptors had an enum cache we copy it. This ensures |
4568 // that the maps to which we push the new descriptor array back can rely | 4568 // that the maps to which we push the new descriptor array back can rely |
4569 // on a cache always being available once it is set. If the map has more | 4569 // on a cache always being available once it is set. If the map has more |
4570 // enumerated descriptors than available in the original cache, the cache | 4570 // enumerated descriptors than available in the original cache, the cache |
4571 // will be lazily replaced by the extended cache when needed. | 4571 // will be lazily replaced by the extended cache when needed. |
4572 if (descriptors->HasEnumCache()) { | 4572 if (descriptors->HasEnumCache()) { |
4573 new_descriptors->CopyEnumCacheFrom(*descriptors); | 4573 new_descriptors->CopyEnumCacheFrom(*descriptors); |
4574 } | 4574 } |
4575 | 4575 |
4576 // Replace descriptors by new_descriptors in all maps that share it. | 4576 // Replace descriptors by new_descriptors in all maps that share it. |
4577 map->GetHeap()->incremental_marking()->RecordWrites(*descriptors); | 4577 map->GetHeap()->incremental_marking()->IterateBlackObject(*descriptors); |
4578 | 4578 |
4579 Map* current = *map; | 4579 Map* current = *map; |
4580 while (current->instance_descriptors() == *descriptors) { | 4580 while (current->instance_descriptors() == *descriptors) { |
4581 Object* next = current->GetBackPointer(); | 4581 Object* next = current->GetBackPointer(); |
4582 if (next->IsUndefined()) break; // Stop overwriting at initial map. | 4582 if (next->IsUndefined()) break; // Stop overwriting at initial map. |
4583 current->UpdateDescriptors(*new_descriptors, layout_descriptor); | 4583 current->UpdateDescriptors(*new_descriptors, layout_descriptor); |
4584 current = Map::cast(next); | 4584 current = Map::cast(next); |
4585 } | 4585 } |
4586 map->UpdateDescriptors(*new_descriptors, layout_descriptor); | 4586 map->UpdateDescriptors(*new_descriptors, layout_descriptor); |
4587 } | 4587 } |
(...skipping 15160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19748 if (cell->value() != *new_value) { | 19748 if (cell->value() != *new_value) { |
19749 cell->set_value(*new_value); | 19749 cell->set_value(*new_value); |
19750 Isolate* isolate = cell->GetIsolate(); | 19750 Isolate* isolate = cell->GetIsolate(); |
19751 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19751 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19752 isolate, DependentCode::kPropertyCellChangedGroup); | 19752 isolate, DependentCode::kPropertyCellChangedGroup); |
19753 } | 19753 } |
19754 } | 19754 } |
19755 | 19755 |
19756 } // namespace internal | 19756 } // namespace internal |
19757 } // namespace v8 | 19757 } // namespace v8 |
OLD | NEW |