Changeset 58346 in webkit for trunk/JavaScriptCore/wtf
- Timestamp:
- Apr 27, 2010, 3:55:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r57457 r58346 1584 1584 Span* result = ll->next; 1585 1585 Carve(result, n, released); 1586 if (result->decommitted) {1587 TCMalloc_SystemCommit(reinterpret_cast<void*>(result->start << kPageShift), static_cast<size_t>(n << kPageShift));1588 result->decommitted = false;1589 }1590 1586 #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1591 else { 1592 // The newly allocated memory is from a span that's in the normal span list (already committed). Update the 1593 // free committed pages count. 1594 ASSERT(free_committed_pages_ >= n); 1595 free_committed_pages_ -= n; 1596 if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 1597 min_free_committed_pages_since_last_scavenge_ = free_committed_pages_; 1598 } 1587 // The newly allocated memory is from a span that's in the normal span list (already committed). Update the 1588 // free committed pages count. 1589 ASSERT(free_committed_pages_ >= n); 1590 free_committed_pages_ -= n; 1591 if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 1592 min_free_committed_pages_since_last_scavenge_ = free_committed_pages_; 1599 1593 #endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1600 1594 ASSERT(Check()); … … 1654 1648 if (best != NULL) { 1655 1649 Carve(best, n, from_released); 1656 if (best->decommitted) {1657 TCMalloc_SystemCommit(reinterpret_cast<void*>(best->start << kPageShift), static_cast<size_t>(n << kPageShift));1658 best->decommitted = false;1659 }1660 1650 #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1661 else { 1662 // The newly allocated memory is from a span that's in the normal span list (already committed). Update the 1663 // free committed pages count. 1664 ASSERT(free_committed_pages_ >= n); 1665 free_committed_pages_ -= n; 1666 if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 1667 min_free_committed_pages_since_last_scavenge_ = free_committed_pages_; 1668 } 1651 // The newly allocated memory is from a span that's in the normal span list (already committed). Update the 1652 // free committed pages count. 1653 ASSERT(free_committed_pages_ >= n); 1654 free_committed_pages_ -= n; 1655 if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 1656 min_free_committed_pages_since_last_scavenge_ = free_committed_pages_; 1669 1657 #endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1670 1658 ASSERT(Check()); … … 1692 1680 } 1693 1681 1694 static ALWAYS_INLINE void propagateDecommittedState(Span* destination, Span* source)1695 {1696 destination->decommitted = source->decommitted;1697 }1698 1699 1682 inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) { 1700 1683 ASSERT(n > 0); … … 1703 1686 Event(span, 'A', n); 1704 1687 1688 if (released) { 1689 // If the span chosen to carve from is decommited, commit the entire span at once to avoid committing spans 1 page at a time. 1690 ASSERT(span->decommitted); 1691 TCMalloc_SystemCommit(reinterpret_cast<void*>(span->start << kPageShift), static_cast<size_t>(span->length << kPageShift)); 1692 span->decommitted = false; 1693 free_committed_pages_ += span->length; 1694 } 1695 1705 1696 const int extra = static_cast<int>(span->length - n); 1706 1697 ASSERT(extra >= 0); … … 1708 1699 Span* leftover = NewSpan(span->start + n, extra); 1709 1700 leftover->free = 1; 1710 propagateDecommittedState(leftover, span);1701 leftover->decommitted = false; 1711 1702 Event(leftover, 'S', extra); 1712 1703 RecordSpan(leftover); … … 1714 1705 // Place leftover span on appropriate free list 1715 1706 SpanList* listpair = (static_cast<size_t>(extra) < kMaxPages) ? &free_[extra] : &large_; 1716 Span* dst = released ? &listpair->returned :&listpair->normal;1707 Span* dst = &listpair->normal; 1717 1708 DLL_Prepend(dst, leftover); 1718 1709
Note:
See TracChangeset
for help on using the changeset viewer.