Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: src/objects.cc

Issue 1856653002: Properly complete in-object slack tracking. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-599003.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12501 matching lines...) Expand 10 before | Expand all | Expand 10 after
12512 int slack = *reinterpret_cast<int*>(data); 12512 int slack = *reinterpret_cast<int*>(data);
12513 map->SetInObjectProperties(map->GetInObjectProperties() - slack); 12513 map->SetInObjectProperties(map->GetInObjectProperties() - slack);
12514 map->set_unused_property_fields(map->unused_property_fields() - slack); 12514 map->set_unused_property_fields(map->unused_property_fields() - slack);
12515 map->set_instance_size(map->instance_size() - slack * kPointerSize); 12515 map->set_instance_size(map->instance_size() - slack * kPointerSize);
12516 map->set_construction_counter(Map::kNoSlackTracking); 12516 map->set_construction_counter(Map::kNoSlackTracking);
12517 12517
12518 // Visitor id might depend on the instance size, recalculate it. 12518 // Visitor id might depend on the instance size, recalculate it.
12519 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); 12519 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map));
12520 } 12520 }
12521 12521
12522 static void StopSlackTracking(Map* map, void* data) {
12523 map->set_construction_counter(Map::kNoSlackTracking);
12524 }
12522 12525
12523 void Map::CompleteInobjectSlackTracking() { 12526 void Map::CompleteInobjectSlackTracking() {
12524 // Has to be an initial map. 12527 // Has to be an initial map.
12525 DCHECK(GetBackPointer()->IsUndefined()); 12528 DCHECK(GetBackPointer()->IsUndefined());
12526 12529
12527 int slack = unused_property_fields(); 12530 int slack = unused_property_fields();
12528 TransitionArray::TraverseTransitionTree(this, &GetMinInobjectSlack, &slack); 12531 TransitionArray::TraverseTransitionTree(this, &GetMinInobjectSlack, &slack);
12529 if (slack != 0) { 12532 if (slack != 0) {
12530 // Resize the initial map and all maps in its transition tree. 12533 // Resize the initial map and all maps in its transition tree.
12531 TransitionArray::TraverseTransitionTree(this, &ShrinkInstanceSize, &slack); 12534 TransitionArray::TraverseTransitionTree(this, &ShrinkInstanceSize, &slack);
12535 } else {
12536 TransitionArray::TraverseTransitionTree(this, &StopSlackTracking, nullptr);
12532 } 12537 }
12533 } 12538 }
12534 12539
12535 12540
12536 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) { 12541 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) {
12537 DisallowHeapAllocation no_gc; 12542 DisallowHeapAllocation no_gc;
12538 if (!object->HasFastProperties()) return false; 12543 if (!object->HasFastProperties()) return false;
12539 Map* map = object->map(); 12544 Map* map = object->map();
12540 if (map->is_prototype_map()) return false; 12545 if (map->is_prototype_map()) return false;
12541 DescriptorArray* descriptors = map->instance_descriptors(); 12546 DescriptorArray* descriptors = map->instance_descriptors();
(...skipping 7214 matching lines...) Expand 10 before | Expand all | Expand 10 after
19756 if (cell->value() != *new_value) { 19761 if (cell->value() != *new_value) {
19757 cell->set_value(*new_value); 19762 cell->set_value(*new_value);
19758 Isolate* isolate = cell->GetIsolate(); 19763 Isolate* isolate = cell->GetIsolate();
19759 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19764 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19760 isolate, DependentCode::kPropertyCellChangedGroup); 19765 isolate, DependentCode::kPropertyCellChangedGroup);
19761 } 19766 }
19762 } 19767 }
19763 19768
19764 } // namespace internal 19769 } // namespace internal
19765 } // namespace v8 19770 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-599003.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698