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

Side by Side Diff: src/objects.cc

Issue 767253002: Refactor Map::ConstructionCount. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 6581 matching lines...) Expand 10 before | Expand all | Expand 10 after
6592 result->set_bit_field2(map->bit_field2()); 6592 result->set_bit_field2(map->bit_field2());
6593 int new_bit_field3 = map->bit_field3(); 6593 int new_bit_field3 = map->bit_field3();
6594 new_bit_field3 = OwnsDescriptors::update(new_bit_field3, true); 6594 new_bit_field3 = OwnsDescriptors::update(new_bit_field3, true);
6595 new_bit_field3 = NumberOfOwnDescriptorsBits::update(new_bit_field3, 0); 6595 new_bit_field3 = NumberOfOwnDescriptorsBits::update(new_bit_field3, 0);
6596 new_bit_field3 = EnumLengthBits::update(new_bit_field3, 6596 new_bit_field3 = EnumLengthBits::update(new_bit_field3,
6597 kInvalidEnumCacheSentinel); 6597 kInvalidEnumCacheSentinel);
6598 new_bit_field3 = Deprecated::update(new_bit_field3, false); 6598 new_bit_field3 = Deprecated::update(new_bit_field3, false);
6599 if (!map->is_dictionary_map()) { 6599 if (!map->is_dictionary_map()) {
6600 new_bit_field3 = IsUnstable::update(new_bit_field3, false); 6600 new_bit_field3 = IsUnstable::update(new_bit_field3, false);
6601 } 6601 }
6602 new_bit_field3 = ConstructionCount::update(new_bit_field3, 6602 new_bit_field3 = Counter::update(new_bit_field3, kRetainingCounterStart);
6603 JSFunction::kNoSlackTracking);
6604 result->set_bit_field3(new_bit_field3); 6603 result->set_bit_field3(new_bit_field3);
6605 return result; 6604 return result;
6606 } 6605 }
6607 6606
6608 6607
6609 Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode, 6608 Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
6610 const char* reason) { 6609 const char* reason) {
6611 DCHECK(!fast_map->is_dictionary_map()); 6610 DCHECK(!fast_map->is_dictionary_map());
6612 6611
6613 Isolate* isolate = fast_map->GetIsolate(); 6612 Isolate* isolate = fast_map->GetIsolate();
(...skipping 3618 matching lines...) Expand 10 before | Expand all | Expand 10 after
10232 USE(ignore); 10231 USE(ignore);
10233 return true; // Return true if there was no DCHECK. 10232 return true; // Return true if there was no DCHECK.
10234 } 10233 }
10235 10234
10236 10235
10237 void JSFunction::StartInobjectSlackTracking() { 10236 void JSFunction::StartInobjectSlackTracking() {
10238 DCHECK(has_initial_map() && !IsInobjectSlackTrackingInProgress()); 10237 DCHECK(has_initial_map() && !IsInobjectSlackTrackingInProgress());
10239 10238
10240 Map* map = initial_map(); 10239 Map* map = initial_map();
10241 10240
10242 // Only initiate the tracking the first time.
10243 if (map->done_inobject_slack_tracking()) return;
10244 map->set_done_inobject_slack_tracking(true);
10245
10246 // No tracking during the snapshot construction phase. 10241 // No tracking during the snapshot construction phase.
10247 Isolate* isolate = GetIsolate(); 10242 Isolate* isolate = GetIsolate();
10248 if (isolate->serializer_enabled()) return; 10243 if (isolate->serializer_enabled()) return;
10249 10244
10250 if (map->unused_property_fields() == 0) return; 10245 if (map->unused_property_fields() == 0) return;
10251 10246
10252 map->set_construction_count(kGenerousAllocationCount); 10247 map->set_counter(Map::kSlackTrackingCounterStart);
10253 } 10248 }
10254 10249
10255 10250
10256 void SharedFunctionInfo::ResetForNewContext(int new_ic_age) { 10251 void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
10257 code()->ClearInlineCaches(); 10252 code()->ClearInlineCaches();
10258 // If we clear ICs, we need to clear the type feedback vector too, since 10253 // If we clear ICs, we need to clear the type feedback vector too, since
10259 // CallICs are synced with a feedback vector slot. 10254 // CallICs are synced with a feedback vector slot.
10260 ClearTypeFeedbackInfo(); 10255 ClearTypeFeedbackInfo();
10261 set_ic_age(new_ic_age); 10256 set_ic_age(new_ic_age);
10262 if (code()->kind() == Code::FUNCTION) { 10257 if (code()->kind() == Code::FUNCTION) {
(...skipping 26 matching lines...) Expand all
10289 10284
10290 // Visitor id might depend on the instance size, recalculate it. 10285 // Visitor id might depend on the instance size, recalculate it.
10291 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); 10286 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map));
10292 } 10287 }
10293 10288
10294 10289
10295 void JSFunction::CompleteInobjectSlackTracking() { 10290 void JSFunction::CompleteInobjectSlackTracking() {
10296 DCHECK(has_initial_map()); 10291 DCHECK(has_initial_map());
10297 Map* map = initial_map(); 10292 Map* map = initial_map();
10298 10293
10299 DCHECK(map->done_inobject_slack_tracking()); 10294 DCHECK(map->counter() >= Map::kSlackTrackingCounterEnd);
10300 map->set_construction_count(kNoSlackTracking); 10295 map->set_counter(Map::kRetainingCounterStart);
10301 10296
10302 int slack = map->unused_property_fields(); 10297 int slack = map->unused_property_fields();
10303 map->TraverseTransitionTree(&GetMinInobjectSlack, &slack); 10298 map->TraverseTransitionTree(&GetMinInobjectSlack, &slack);
10304 if (slack != 0) { 10299 if (slack != 0) {
10305 // Resize the initial map and all maps in its transition tree. 10300 // Resize the initial map and all maps in its transition tree.
10306 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); 10301 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack);
10307 } 10302 }
10308 } 10303 }
10309 10304
10310 10305
(...skipping 6538 matching lines...) Expand 10 before | Expand all | Expand 10 after
16849 Handle<DependentCode> codes = 16844 Handle<DependentCode> codes =
16850 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16845 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16851 DependentCode::kPropertyCellChangedGroup, 16846 DependentCode::kPropertyCellChangedGroup,
16852 info->object_wrapper()); 16847 info->object_wrapper());
16853 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16848 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16854 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16849 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16855 cell, info->zone()); 16850 cell, info->zone());
16856 } 16851 }
16857 16852
16858 } } // namespace v8::internal 16853 } } // namespace v8::internal
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698