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

Side by Side Diff: src/heap/heap.cc

Issue 2745183002: [heap] Simplify clearing of normalized map caches. (Closed)
Patch Set: Created 3 years, 9 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 | « src/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/assembler-inl.h" 9 #include "src/assembler-inl.h"
10 #include "src/ast/context-slot-cache.h" 10 #include "src/ast/context-slot-cache.h"
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 1242
1243 void Heap::EnsureFromSpaceIsCommitted() { 1243 void Heap::EnsureFromSpaceIsCommitted() {
1244 if (new_space_->CommitFromSpaceIfNeeded()) return; 1244 if (new_space_->CommitFromSpaceIfNeeded()) return;
1245 1245
1246 // Committing memory to from space failed. 1246 // Committing memory to from space failed.
1247 // Memory is exhausted and we will die. 1247 // Memory is exhausted and we will die.
1248 V8::FatalProcessOutOfMemory("Committing semi space failed."); 1248 V8::FatalProcessOutOfMemory("Committing semi space failed.");
1249 } 1249 }
1250 1250
1251 1251
1252 void Heap::ClearNormalizedMapCaches() {
1253 if (isolate_->bootstrapper()->IsActive() &&
ulan 2017/03/13 14:36:01 I don't understand the intent of this condition. W
1254 !incremental_marking()->IsMarking()) {
1255 return;
1256 }
1257
1258 Object* context = native_contexts_list();
1259 while (!context->IsUndefined(isolate())) {
1260 // GC can happen when the context is not fully initialized,
1261 // so the cache can be undefined.
1262 Object* cache =
1263 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX);
1264 if (!cache->IsUndefined(isolate())) {
1265 NormalizedMapCache::cast(cache)->Clear();
1266 }
1267 context = Context::cast(context)->next_context_link();
1268 }
1269 }
1270
1271
1272 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { 1252 void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
1273 if (start_new_space_size == 0) return; 1253 if (start_new_space_size == 0) return;
1274 1254
1275 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / 1255 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) /
1276 static_cast<double>(start_new_space_size) * 100); 1256 static_cast<double>(start_new_space_size) * 100);
1277 1257
1278 if (previous_semi_space_copied_object_size_ > 0) { 1258 if (previous_semi_space_copied_object_size_ > 0) {
1279 promotion_rate_ = 1259 promotion_rate_ =
1280 (static_cast<double>(promoted_objects_size_) / 1260 (static_cast<double>(promoted_objects_size_) /
1281 static_cast<double>(previous_semi_space_copied_object_size_) * 100); 1261 static_cast<double>(previous_semi_space_copied_object_size_) * 100);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 isolate_->context_slot_cache()->Clear(); 1483 isolate_->context_slot_cache()->Clear();
1504 isolate_->descriptor_lookup_cache()->Clear(); 1484 isolate_->descriptor_lookup_cache()->Clear();
1505 RegExpResultsCache::Clear(string_split_cache()); 1485 RegExpResultsCache::Clear(string_split_cache());
1506 RegExpResultsCache::Clear(regexp_multiple_cache()); 1486 RegExpResultsCache::Clear(regexp_multiple_cache());
1507 1487
1508 isolate_->compilation_cache()->MarkCompactPrologue(); 1488 isolate_->compilation_cache()->MarkCompactPrologue();
1509 1489
1510 CompletelyClearInstanceofCache(); 1490 CompletelyClearInstanceofCache();
1511 1491
1512 FlushNumberStringCache(); 1492 FlushNumberStringCache();
1513 ClearNormalizedMapCaches();
1514 } 1493 }
1515 1494
1516 1495
1517 void Heap::CheckNewSpaceExpansionCriteria() { 1496 void Heap::CheckNewSpaceExpansionCriteria() {
1518 if (FLAG_experimental_new_space_growth_heuristic) { 1497 if (FLAG_experimental_new_space_growth_heuristic) {
1519 if (new_space_->TotalCapacity() < new_space_->MaximumCapacity() && 1498 if (new_space_->TotalCapacity() < new_space_->MaximumCapacity() &&
1520 survived_last_scavenge_ * 100 / new_space_->TotalCapacity() >= 10) { 1499 survived_last_scavenge_ * 100 / new_space_->TotalCapacity() >= 10) {
1521 // Grow the size of new space if there is room to grow, and more than 10% 1500 // Grow the size of new space if there is room to grow, and more than 10%
1522 // have survived the last scavenge. 1501 // have survived the last scavenge.
1523 new_space_->Grow(); 1502 new_space_->Grow();
(...skipping 4850 matching lines...) Expand 10 before | Expand all | Expand 10 after
6374 } 6353 }
6375 6354
6376 6355
6377 // static 6356 // static
6378 int Heap::GetStaticVisitorIdForMap(Map* map) { 6357 int Heap::GetStaticVisitorIdForMap(Map* map) {
6379 return StaticVisitorBase::GetVisitorId(map); 6358 return StaticVisitorBase::GetVisitorId(map);
6380 } 6359 }
6381 6360
6382 } // namespace internal 6361 } // namespace internal
6383 } // namespace v8 6362 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698