| 674 | } |
| 675 | |
| 676 | void LIRSCacheShard::UnprotectedToProtected(LIRSThreadState* tstate, LIRSHandle *e) { |
| 677 | // This only happens for entries that are only the recency list |
| 678 | DCHECK(e->recency_list_hook_.is_linked()); |
| 679 | // Make this the most recent entry in the recency list and remove from the |
| 680 | // unprotected list. |
| 681 | MoveToRecencyListBack(tstate, e); |
| 682 | RemoveFromUnprotectedList(e); |
| 683 | e->set_state(UNPROTECTED, PROTECTED); |
| 684 | // List operations happen before changes to the counts/usage |
| 685 | --num_unprotected_; |
| 686 | ++num_protected_; |
| 687 | // Transfer the usage |
| 688 | unprotected_usage_ -= e->charge(); |
| 689 | protected_usage_ += e->charge(); |
| 690 | // If necessary, evict old entries from the recency list, protected to unprotected |
| 691 | EnforceProtectedCapacity(tstate); |
| 692 | } |
| 693 | |
| 694 | void LIRSCacheShard::ProtectedToUnprotected(LIRSThreadState* tstate, LIRSHandle* e) { |
| 695 | DCHECK(!e->unprotected_tombstone_list_hook_.is_linked()); |