Ignore:
Timestamp:
Mar 20, 2009, 3:56:27 PM (16 years ago)
Author:
[email protected]
Message:

2009-03-20 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


A little cleanup in the RegisterFile code.


Moved large inline functions out of the class declaration, to make it
more readable.


Switched over to using the roundUpAllocationSize function to avoid
duplicate code and subtle bugs.


Renamed m_maxCommitted to m_commitEnd, to match m_end.


Renamed allocationSize to commitSize because it's the chunk size for
committing memory, not allocating memory.


SunSpider reports no change.

  • interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile): (JSC::RegisterFile::shrink): (JSC::RegisterFile::grow):
  • jit/ExecutableAllocator.h: (JSC::roundUpAllocationSize):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/ExecutableAllocator.h

    r39450 r41872  
    4040
    4141namespace JSC {
     42
     43inline size_t roundUpAllocationSize(size_t request, size_t granularity)
     44{
     45    if ((std::numeric_limits<size_t>::max() - granularity) <= request)
     46        CRASH(); // Allocation is too large
     47   
     48    // Round up to next page boundary
     49    size_t size = request + (granularity - 1);
     50    size = size & ~(granularity - 1);
     51    ASSERT(size >= request);
     52    return size;
     53}
    4254
    4355class ExecutablePool : public RefCounted<ExecutablePool> {
     
    8698    static Allocation systemAlloc(size_t n);
    8799    static void systemRelease(const Allocation& alloc);
    88 
    89     inline size_t roundUpAllocationSize(size_t request, size_t granularity)
    90     {
    91         if ((std::numeric_limits<size_t>::max() - granularity) <= request)
    92             CRASH(); // Allocation is too large
    93        
    94         // Round up to next page boundary
    95         size_t size = request + (granularity - 1);
    96         size = size & ~(granularity - 1);
    97         ASSERT(size >= request);
    98         return size;
    99     }
    100100
    101101    ExecutablePool(size_t n);
Note: See TracChangeset for help on using the changeset viewer.