Ignore:
Timestamp:
Jun 4, 2009, 5:36:56 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-04 Gavin Barraclough <[email protected]>

Reviewed by Sam Weinig.

Minor tweak to PatchBuffer, change it so it no longer holds a CodeRef, and instead
holds a separate code pointer and executable pool. Since it now always holds its
own copy of the code size, and to simplify the construction sequence, it's neater
this way.

  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::finalizeCode): (JSC::AbstractMacroAssembler::PatchBuffer::code): (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r44346 r44443  
    720720    class PatchBuffer : public Noncopyable {
    721721    public:
     722        // Note: Initialization sequence is significant, since executablePool is a PassRefPtr.
     723        //       First, executablePool is copied into m_executablePool, then the initialization of
     724        //       m_code uses m_executablePool, *not* executablePool, since this is no longer valid.
    722725        PatchBuffer(AbstractMacroAssembler<AssemblerType>* masm, PassRefPtr<ExecutablePool> executablePool)
    723             : m_ref(0, executablePool, masm->m_assembler.size())
     726            : m_executablePool(executablePool)
     727            , m_code(masm->m_assembler.executableCopy(m_executablePool.get()))
    724728            , m_size(masm->m_assembler.size())
    725729#ifndef NDEBUG
     
    727731#endif
    728732        {
    729             m_ref.m_code = masm->m_assembler.executableCopy(m_ref.m_executablePool.get());
    730733        }
    731734
     
    830833            performFinalization();
    831834
    832             return m_ref;
     835            return CodeRef(m_code, m_executablePool, m_size);
    833836        }
    834837        CodeLocationLabel finalizeCodeAddendum()
     
    844847        void* code()
    845848        {
    846             return m_ref.m_code;
     849            return m_code;
    847850        }
    848851
     
    854857#endif
    855858
    856             ExecutableAllocator::makeExecutable(m_ref.m_code, m_size);
    857         }
    858 
    859         CodeRef m_ref;
     859            ExecutableAllocator::makeExecutable(m_code, m_size);
     860        }
     861
     862        RefPtr<ExecutablePool> m_executablePool;
     863        void* m_code;
    860864        size_t m_size;
    861865#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.