OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 Counters::objs_since_last_full.Set(0); | 495 Counters::objs_since_last_full.Set(0); |
496 context_disposed_pending_ = false; | 496 context_disposed_pending_ = false; |
497 } | 497 } |
498 | 498 |
499 | 499 |
500 void Heap::MarkCompactPrologue(bool is_compacting) { | 500 void Heap::MarkCompactPrologue(bool is_compacting) { |
501 // At any old GC clear the keyed lookup cache to enable collection of unused | 501 // At any old GC clear the keyed lookup cache to enable collection of unused |
502 // maps. | 502 // maps. |
503 KeyedLookupCache::Clear(); | 503 KeyedLookupCache::Clear(); |
504 ContextSlotCache::Clear(); | 504 ContextSlotCache::Clear(); |
| 505 DescriptorLookupCache::Clear(); |
505 | 506 |
506 CompilationCache::MarkCompactPrologue(); | 507 CompilationCache::MarkCompactPrologue(); |
507 | 508 |
508 Top::MarkCompactPrologue(is_compacting); | 509 Top::MarkCompactPrologue(is_compacting); |
509 ThreadManager::MarkCompactPrologue(is_compacting); | 510 ThreadManager::MarkCompactPrologue(is_compacting); |
510 } | 511 } |
511 | 512 |
512 | 513 |
513 void Heap::MarkCompactEpilogue(bool is_compacting) { | 514 void Heap::MarkCompactEpilogue(bool is_compacting) { |
514 Top::MarkCompactEpilogue(is_compacting); | 515 Top::MarkCompactEpilogue(is_compacting); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 void Heap::Scavenge() { | 624 void Heap::Scavenge() { |
624 #ifdef DEBUG | 625 #ifdef DEBUG |
625 if (FLAG_enable_slow_asserts) VerifyNonPointerSpacePointers(); | 626 if (FLAG_enable_slow_asserts) VerifyNonPointerSpacePointers(); |
626 #endif | 627 #endif |
627 | 628 |
628 gc_state_ = SCAVENGE; | 629 gc_state_ = SCAVENGE; |
629 | 630 |
630 // Implements Cheney's copying algorithm | 631 // Implements Cheney's copying algorithm |
631 LOG(ResourceEvent("scavenge", "begin")); | 632 LOG(ResourceEvent("scavenge", "begin")); |
632 | 633 |
| 634 // Clear descriptor cache. |
| 635 DescriptorLookupCache::Clear(); |
| 636 |
633 // Used for updating survived_since_last_expansion_ at function end. | 637 // Used for updating survived_since_last_expansion_ at function end. |
634 int survived_watermark = PromotedSpaceSize(); | 638 int survived_watermark = PromotedSpaceSize(); |
635 | 639 |
636 if (new_space_.Capacity() < new_space_.MaximumCapacity() && | 640 if (new_space_.Capacity() < new_space_.MaximumCapacity() && |
637 survived_since_last_expansion_ > new_space_.Capacity()) { | 641 survived_since_last_expansion_ > new_space_.Capacity()) { |
638 // Double the size of new space if there is room to grow and enough | 642 // Double the size of new space if there is room to grow and enough |
639 // data has survived scavenge since the last expansion. | 643 // data has survived scavenge since the last expansion. |
640 // TODO(1240712): NewSpace::Double has a return value which is | 644 // TODO(1240712): NewSpace::Double has a return value which is |
641 // ignored here. | 645 // ignored here. |
642 new_space_.Double(); | 646 new_space_.Double(); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 | 1389 |
1386 // Handling of script id generation is in Factory::NewScript. | 1390 // Handling of script id generation is in Factory::NewScript. |
1387 last_script_id_ = undefined_value(); | 1391 last_script_id_ = undefined_value(); |
1388 | 1392 |
1389 // Initialize keyed lookup cache. | 1393 // Initialize keyed lookup cache. |
1390 KeyedLookupCache::Clear(); | 1394 KeyedLookupCache::Clear(); |
1391 | 1395 |
1392 // Initialize context slot cache. | 1396 // Initialize context slot cache. |
1393 ContextSlotCache::Clear(); | 1397 ContextSlotCache::Clear(); |
1394 | 1398 |
| 1399 // Initialize descriptor cache. |
| 1400 DescriptorLookupCache::Clear(); |
| 1401 |
1395 // Initialize compilation cache. | 1402 // Initialize compilation cache. |
1396 CompilationCache::Clear(); | 1403 CompilationCache::Clear(); |
1397 | 1404 |
1398 return true; | 1405 return true; |
1399 } | 1406 } |
1400 | 1407 |
1401 | 1408 |
1402 static inline int double_get_hash(double d) { | 1409 static inline int double_get_hash(double d) { |
1403 DoubleRepresentation rep(d); | 1410 DoubleRepresentation rep(d); |
1404 return ((static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)) & | 1411 return ((static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)) & |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; | 3559 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; |
3553 } | 3560 } |
3554 | 3561 |
3555 | 3562 |
3556 KeyedLookupCache::Key KeyedLookupCache::keys_[KeyedLookupCache::kLength]; | 3563 KeyedLookupCache::Key KeyedLookupCache::keys_[KeyedLookupCache::kLength]; |
3557 | 3564 |
3558 | 3565 |
3559 int KeyedLookupCache::field_offsets_[KeyedLookupCache::kLength]; | 3566 int KeyedLookupCache::field_offsets_[KeyedLookupCache::kLength]; |
3560 | 3567 |
3561 | 3568 |
| 3569 void DescriptorLookupCache::Clear() { |
| 3570 for (int index = 0; index < kLength; index++) keys_[index].array = NULL; |
| 3571 } |
| 3572 |
| 3573 |
| 3574 DescriptorLookupCache::Key |
| 3575 DescriptorLookupCache::keys_[DescriptorLookupCache::kLength]; |
| 3576 |
| 3577 int DescriptorLookupCache::results_[DescriptorLookupCache::kLength]; |
| 3578 |
| 3579 |
3562 #ifdef DEBUG | 3580 #ifdef DEBUG |
3563 bool Heap::GarbageCollectionGreedyCheck() { | 3581 bool Heap::GarbageCollectionGreedyCheck() { |
3564 ASSERT(FLAG_gc_greedy); | 3582 ASSERT(FLAG_gc_greedy); |
3565 if (Bootstrapper::IsActive()) return true; | 3583 if (Bootstrapper::IsActive()) return true; |
3566 if (disallow_allocation_failure()) return true; | 3584 if (disallow_allocation_failure()) return true; |
3567 return CollectGarbage(0, NEW_SPACE); | 3585 return CollectGarbage(0, NEW_SPACE); |
3568 } | 3586 } |
3569 #endif | 3587 #endif |
3570 | 3588 |
3571 } } // namespace v8::internal | 3589 } } // namespace v8::internal |
OLD | NEW |