OLD | NEW |
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 Loading... |
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() && |
| 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 |
1252 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { | 1272 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { |
1253 if (start_new_space_size == 0) return; | 1273 if (start_new_space_size == 0) return; |
1254 | 1274 |
1255 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / | 1275 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / |
1256 static_cast<double>(start_new_space_size) * 100); | 1276 static_cast<double>(start_new_space_size) * 100); |
1257 | 1277 |
1258 if (previous_semi_space_copied_object_size_ > 0) { | 1278 if (previous_semi_space_copied_object_size_ > 0) { |
1259 promotion_rate_ = | 1279 promotion_rate_ = |
1260 (static_cast<double>(promoted_objects_size_) / | 1280 (static_cast<double>(promoted_objects_size_) / |
1261 static_cast<double>(previous_semi_space_copied_object_size_) * 100); | 1281 static_cast<double>(previous_semi_space_copied_object_size_) * 100); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 isolate_->context_slot_cache()->Clear(); | 1503 isolate_->context_slot_cache()->Clear(); |
1484 isolate_->descriptor_lookup_cache()->Clear(); | 1504 isolate_->descriptor_lookup_cache()->Clear(); |
1485 RegExpResultsCache::Clear(string_split_cache()); | 1505 RegExpResultsCache::Clear(string_split_cache()); |
1486 RegExpResultsCache::Clear(regexp_multiple_cache()); | 1506 RegExpResultsCache::Clear(regexp_multiple_cache()); |
1487 | 1507 |
1488 isolate_->compilation_cache()->MarkCompactPrologue(); | 1508 isolate_->compilation_cache()->MarkCompactPrologue(); |
1489 | 1509 |
1490 CompletelyClearInstanceofCache(); | 1510 CompletelyClearInstanceofCache(); |
1491 | 1511 |
1492 FlushNumberStringCache(); | 1512 FlushNumberStringCache(); |
| 1513 ClearNormalizedMapCaches(); |
1493 } | 1514 } |
1494 | 1515 |
1495 | 1516 |
1496 void Heap::CheckNewSpaceExpansionCriteria() { | 1517 void Heap::CheckNewSpaceExpansionCriteria() { |
1497 if (FLAG_experimental_new_space_growth_heuristic) { | 1518 if (FLAG_experimental_new_space_growth_heuristic) { |
1498 if (new_space_->TotalCapacity() < new_space_->MaximumCapacity() && | 1519 if (new_space_->TotalCapacity() < new_space_->MaximumCapacity() && |
1499 survived_last_scavenge_ * 100 / new_space_->TotalCapacity() >= 10) { | 1520 survived_last_scavenge_ * 100 / new_space_->TotalCapacity() >= 10) { |
1500 // Grow the size of new space if there is room to grow, and more than 10% | 1521 // Grow the size of new space if there is room to grow, and more than 10% |
1501 // have survived the last scavenge. | 1522 // have survived the last scavenge. |
1502 new_space_->Grow(); | 1523 new_space_->Grow(); |
(...skipping 4850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6353 } | 6374 } |
6354 | 6375 |
6355 | 6376 |
6356 // static | 6377 // static |
6357 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6378 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6358 return StaticVisitorBase::GetVisitorId(map); | 6379 return StaticVisitorBase::GetVisitorId(map); |
6359 } | 6380 } |
6360 | 6381 |
6361 } // namespace internal | 6382 } // namespace internal |
6362 } // namespace v8 | 6383 } // namespace v8 |
OLD | NEW |