Changeset 47959 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Sep 2, 2009, 2:49:31 AM (16 years ago)
Author:
[email protected]
Message:

2009-09-02 Norbert Leser <[email protected]>

Reviewed by Eric Seidel.

Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled

RegisterFile constructor currently throws #error when both
MMAP and VIRTUALALLOC conditions fail.
On any platform that does not provide these features
(for instance, Symbian),
the fallback should be regular malloc (or fastMalloc).
It is functionally equivalent in this case, even though it may
have certain drawbacks such as lack of dynamic pre-allocation.

  • interpreter/RegisterFile.cpp: (JSC::RegisterFile::~RegisterFile):
  • interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile):
Location:
trunk/JavaScriptCore/interpreter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/RegisterFile.cpp

    r43886 r47959  
    3939    VirtualFree(m_buffer, 0, MEM_RELEASE);
    4040#else
    41     #error "Don't know how to release virtual memory on this platform."
     41    fastFree(m_buffer);
    4242#endif
    4343}
  • trunk/JavaScriptCore/interpreter/RegisterFile.h

    r47022 r47959  
    205205        }
    206206        m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize);
    207     #else
    208         #error "Don't know how to reserve virtual memory on this platform."
     207    #else
     208        /*
     209         * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead.
     210         *
     211         * Please note that this is the fallback case, which is non-optimal.
     212         * If any possible, the platform should provide for a better memory
     213         * allocation mechanism that allows for "lazy commit" or dynamic
     214         * pre-allocation, similar to mmap or VirtualAlloc, to avoid waste of memory.
     215         */
     216        m_buffer = static_cast<Register*>(fastMalloc(bufferLength));
    209217    #endif
    210218        m_start = m_buffer + maxGlobals;
Note: See TracChangeset for help on using the changeset viewer.