Ignore:
Timestamp:
Sep 2, 2011, 1:41:59 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 Gavin Barraclough.

Switch to a bump allocator for the initial out of line
property storage. This gives us slightly faster allocation
for short lived objects that need out of line storage at
the cost of an additional memcpy when the object survives
a GC pass.

No performance impact.

(JSC::Heap::collect):

  • heap/Heap.h:

(JSC::Heap::allocatePropertyStorage):
(JSC::Heap::inPropertyStorageNursary):

  • heap/NewSpace.cpp:

(JSC::NewSpace::NewSpace):

  • heap/NewSpace.h:

(JSC::NewSpace::resetPropertyStorageNursary):
(JSC::NewSpace::allocatePropertyStorage):
(JSC::NewSpace::inPropertyStorageNursary):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/JSObject.cpp:

(JSC::JSObject::allocatePropertyStorage):

  • runtime/JSObject.h:

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

File:
1 edited

Legend:

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

    r92146 r94445  
    4747    public:
    4848        static const size_t maxCellSize = 1024;
     49        static const ptrdiff_t PropertyStorageNurserySize = 1024 * 1024 * 4;
    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 > static_cast<size_t>(PropertyStorageNurserySize))
     179            CRASH();
     180        m_propertyStorageAllocationPoint += size;
     181        if ((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<uintptr_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.