JSMemoryStatsSCE.cpp 931 B

123456789101112131415161718192021222324252627282930313233
  1. #include "config.h"
  2. #include "APICast.h"
  3. #include "VM.h"
  4. #include "JSCJSValueInlines.h"
  5. #include "JSMemoryStatsSCE.h"
  6. #include <wtf/MetaAllocator.h>
  7. extern "C" void JSMemoryStatsQuerySCE(
  8. JSContextRef context,
  9. JSMemoryStatsSCE & stats)
  10. {
  11. JSC::ExecState* execState = ::toJS(context);
  12. if (stats.flags & JS_MEMORY_STATS_SCE_FLAG_EXECALLOC) {
  13. #if ENABLE(ASSEMBLER)
  14. JSC::VM & vm(execState->vm());
  15. JSC::ExecutableAllocator allocator(vm.executableAllocator);
  16. stats.executableAllocator.committed = allocator.committedByteCount();
  17. #else
  18. stats.executableAllocator.committed = 0;
  19. #endif
  20. }
  21. if (stats.flags & JS_MEMORY_STATS_SCE_FLAG_GC) {
  22. JSC::Heap* heap = execState->heap();
  23. stats.gcHeap.size = heap->size();
  24. stats.gcHeap.capacity = heap->capacity();
  25. stats.gcHeap.objectCount = heap->objectCount();
  26. }
  27. }