/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80: * * Copyright (C) 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Returns the number of bytes that are currently in use (referenced by // live JitCode objects).
size_t usedCodeBytes() const {
size_t res = 0; for (size_t count : m_codeBytes) {
res += count;
} return res;
}
};
using JitPoisonRangeVector = Vector<JitPoisonRange, 0, SystemAllocPolicy>;
class ExecutableAllocator { public:
ExecutableAllocator() = default;
~ExecutableAllocator();
void purge();
// alloc() returns a pointer to some memory, and also (by reference) a // pointer to reference-counted pool. The caller owns a reference to the // pool; i.e. alloc() increments the count before returning the object. void* alloc(JSContext* cx, size_t n, ExecutablePool** poolp, CodeKind type);
// On OOM, this will return an Allocation where pages is nullptr.
ExecutablePool::Allocation systemAlloc(size_t n); staticvoid systemRelease(const ExecutablePool::Allocation& alloc);
// These are strong references; they keep pools alive. staticconst size_t maxSmallPools = 4; using SmallExecPoolVector =
js::Vector<ExecutablePool*, maxSmallPools, js::SystemAllocPolicy>;
SmallExecPoolVector m_smallPools;
// All live pools are recorded here, just for stats purposes. These are // weak references; they don't keep pools alive. When a pool is destroyed // its reference is removed from m_pools. using ExecPoolHashSet =
js::HashSet<ExecutablePool*, js::DefaultHasher<ExecutablePool*>,
js::SystemAllocPolicy>;
ExecPoolHashSet m_pools; // All pools, just for stats purposes.
};
} // namespace jit
} // namespace js
#endif/* jit_ExecutableAllocator_h */
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.