Ignore:
Timestamp:
Nov 7, 2012, 3:34:30 PM (13 years ago)
Author:
[email protected]
Message:

WeakBlocks should be HeapBlocks
https://bugs.webkit.org/show_bug.cgi?id=101411

Reviewed by Oliver Hunt.

Currently WeakBlocks use fastMalloc memory. They are very similar to the other HeapBlocks, however,
so we should change them to being allocated with the BlockAllocator.

  • heap/BlockAllocator.cpp:

(JSC::BlockAllocator::BlockAllocator):

  • heap/BlockAllocator.h: Added a new RegionSet for WeakBlocks.

(JSC):
(BlockAllocator):
(JSC::WeakBlock):

  • heap/Heap.h: Friended WeakSet to allow access to the BlockAllocator.

(Heap):

  • heap/WeakBlock.cpp:

(JSC::WeakBlock::create): Refactored to use HeapBlocks rather than fastMalloc.
(JSC::WeakBlock::WeakBlock):

  • heap/WeakBlock.h: Changed the WeakBlock size to 4 KB so that it divides evenly into the Region size.

(JSC):
(WeakBlock):

  • heap/WeakSet.cpp:

(JSC::WeakSet::~WeakSet):
(JSC::WeakSet::addAllocator):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/WeakBlock.cpp

    r133358 r133812  
    3535namespace JSC {
    3636
    37 WeakBlock* WeakBlock::create()
     37WeakBlock* WeakBlock::create(DeadBlock* block)
    3838{
    39     void* allocation = fastMalloc(blockSize);
    40     return new (NotNull, allocation) WeakBlock;
     39    Region* region = block->region();
     40    return new (NotNull, block) WeakBlock(region);
    4141}
    4242
    43 void WeakBlock::destroy(WeakBlock* block)
    44 {
    45     fastFree(block);
    46 }
    47 
    48 WeakBlock::WeakBlock()
     43WeakBlock::WeakBlock(Region* region)
     44    : HeapBlock<WeakBlock>(region)
    4945{
    5046    for (size_t i = 0; i < weakImplCount(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.