Ignore:
Timestamp:
Sep 8, 2011, 3:52:04 PM (14 years ago)
Author:
[email protected]
Message:

Use bump allocator for initial property storage
https://bugs.webkit.org/show_bug.cgi?id=67494

Reviewed by Geoffrey Garen.

../../../../Volumes/Data/git/WebKit/OpenSource/Source/JavaScriptCore:

Use a bump allocator for initial allocation of property storage,
and promote to fastMalloc memory only if it survives a GC pass.

Comes out as a 1% win on v8, and is a useful step on the way to
GC allocation of all property storage.

(JSC::Heap::collect):

  • heap/Heap.h:

(JSC::Heap::allocatePropertyStorage):
(JSC::Heap::inPropertyStorageNursery):

  • heap/MarkedBlock.h:
  • heap/NewSpace.cpp:

(JSC::NewSpace::NewSpace):

  • heap/NewSpace.h:

(JSC::NewSpace::resetPropertyStorageNursery):
(JSC::NewSpace::allocatePropertyStorage):
(JSC::NewSpace::inPropertyStorageNursery):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/JSObject.cpp:

(JSC::JSObject::allocatePropertyStorage):

  • runtime/JSObject.h:

(JSC::JSObject::isUsingInlineStorage):
(JSC::JSObject::JSObject):
(JSC::JSObject::propertyStorage):
(JSC::JSObject::~JSObject):
(JSC::JSObject::putDirectInternal):
(JSC::JSObject::putDirectWithoutTransition):
(JSC::JSObject::putDirectFunctionWithoutTransition):
(JSC::JSObject::transitionTo):
(JSC::JSObject::visitChildrenDirect):

  • runtime/StorageBarrier.h: Added.

(JSC::StorageBarrier::StorageBarrier):
(JSC::StorageBarrier::set):
(JSC::StorageBarrier::operator->):
(JSC::StorageBarrier::operator*):
(JSC::StorageBarrier::operator[]):
(JSC::StorageBarrier::get):

../../../../Volumes/Data/git/WebKit/OpenSource/Source/WebCore:

Add a forwarding header.

  • ForwardingHeaders/runtime/StorageBarrier.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/NewSpace.h

    r94522 r94814  
    4747    public:
    4848        static const size_t maxCellSize = 1024;
     49        static const size_t PropertyStorageNurserySize = 4 * MB;
    4950
    5051        struct SizeClass {
     
    6465        SizeClass& sizeClassFor(size_t);
    6566        void* allocate(SizeClass&);
     67        inline void* allocatePropertyStorage(size_t);
     68        inline bool inPropertyStorageNursery(void* ptr);
     69        inline void resetPropertyStorageNursery();
     70       
    6671        void resetAllocator();
    6772
     
    9297        SizeClass m_preciseSizeClasses[preciseCount];
    9398        SizeClass m_impreciseSizeClasses[impreciseCount];
     99        char* m_propertyStorageNursery;
     100        char* m_propertyStorageAllocationPoint;
    94101        size_t m_waterMark;
    95102        size_t m_highWaterMark;
     
    161168    }
    162169
     170    inline void NewSpace::resetPropertyStorageNursery()
     171    {
     172        m_propertyStorageAllocationPoint = m_propertyStorageNursery;
     173    }
     174   
     175    inline void* NewSpace::allocatePropertyStorage(size_t size)
     176    {
     177        char* result = m_propertyStorageAllocationPoint;
     178        if (size > PropertyStorageNurserySize)
     179            CRASH();
     180        m_propertyStorageAllocationPoint += size;
     181        if (static_cast<size_t>(m_propertyStorageAllocationPoint - m_propertyStorageNursery) > PropertyStorageNurserySize) {
     182            m_propertyStorageAllocationPoint = result;
     183            return 0;
     184        }
     185        return result;
     186    }
     187
     188    inline bool NewSpace::inPropertyStorageNursery(void* ptr)
     189    {
     190        char* addr = static_cast<char*>(ptr);
     191        return static_cast<size_t>(addr - m_propertyStorageNursery) < PropertyStorageNurserySize;
     192    }
     193   
    163194    template <typename Functor> inline typename Functor::ReturnType NewSpace::forEachBlock(Functor& functor)
    164195    {
Note: See TracChangeset for help on using the changeset viewer.