| 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 12568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12579 int slack = *reinterpret_cast<int*>(data); | 12579 int slack = *reinterpret_cast<int*>(data); |
| 12580 map->SetInObjectProperties(map->GetInObjectProperties() - slack); | 12580 map->SetInObjectProperties(map->GetInObjectProperties() - slack); |
| 12581 map->set_unused_property_fields(map->unused_property_fields() - slack); | 12581 map->set_unused_property_fields(map->unused_property_fields() - slack); |
| 12582 map->set_instance_size(map->instance_size() - slack * kPointerSize); | 12582 map->set_instance_size(map->instance_size() - slack * kPointerSize); |
| 12583 map->set_construction_counter(Map::kNoSlackTracking); | 12583 map->set_construction_counter(Map::kNoSlackTracking); |
| 12584 | 12584 |
| 12585 // Visitor id might depend on the instance size, recalculate it. | 12585 // Visitor id might depend on the instance size, recalculate it. |
| 12586 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); | 12586 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); |
| 12587 } | 12587 } |
| 12588 | 12588 |
| 12589 static void StopSlackTracking(Map* map, void* data) { |
| 12590 map->set_construction_counter(Map::kNoSlackTracking); |
| 12591 } |
| 12589 | 12592 |
| 12590 void Map::CompleteInobjectSlackTracking() { | 12593 void Map::CompleteInobjectSlackTracking() { |
| 12591 // Has to be an initial map. | 12594 // Has to be an initial map. |
| 12592 DCHECK(GetBackPointer()->IsUndefined()); | 12595 DCHECK(GetBackPointer()->IsUndefined()); |
| 12593 | 12596 |
| 12594 int slack = unused_property_fields(); | 12597 int slack = unused_property_fields(); |
| 12595 TransitionArray::TraverseTransitionTree(this, &GetMinInobjectSlack, &slack); | 12598 TransitionArray::TraverseTransitionTree(this, &GetMinInobjectSlack, &slack); |
| 12596 if (slack != 0) { | 12599 if (slack != 0) { |
| 12597 // Resize the initial map and all maps in its transition tree. | 12600 // Resize the initial map and all maps in its transition tree. |
| 12598 TransitionArray::TraverseTransitionTree(this, &ShrinkInstanceSize, &slack); | 12601 TransitionArray::TraverseTransitionTree(this, &ShrinkInstanceSize, &slack); |
| 12602 } else { |
| 12603 TransitionArray::TraverseTransitionTree(this, &StopSlackTracking, nullptr); |
| 12599 } | 12604 } |
| 12600 } | 12605 } |
| 12601 | 12606 |
| 12602 | 12607 |
| 12603 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) { | 12608 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) { |
| 12604 DisallowHeapAllocation no_gc; | 12609 DisallowHeapAllocation no_gc; |
| 12605 if (!object->HasFastProperties()) return false; | 12610 if (!object->HasFastProperties()) return false; |
| 12606 Map* map = object->map(); | 12611 Map* map = object->map(); |
| 12607 if (map->is_prototype_map()) return false; | 12612 if (map->is_prototype_map()) return false; |
| 12608 DescriptorArray* descriptors = map->instance_descriptors(); | 12613 DescriptorArray* descriptors = map->instance_descriptors(); |
| (...skipping 7246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19855 if (cell->value() != *new_value) { | 19860 if (cell->value() != *new_value) { |
| 19856 cell->set_value(*new_value); | 19861 cell->set_value(*new_value); |
| 19857 Isolate* isolate = cell->GetIsolate(); | 19862 Isolate* isolate = cell->GetIsolate(); |
| 19858 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19863 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19859 isolate, DependentCode::kPropertyCellChangedGroup); | 19864 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19860 } | 19865 } |
| 19861 } | 19866 } |
| 19862 | 19867 |
| 19863 } // namespace internal | 19868 } // namespace internal |
| 19864 } // namespace v8 | 19869 } // namespace v8 |
| OLD | NEW |