mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:07:43 +00:00
UserspaceEmulator: Inline some very hot functions
This improves the browser's load time on welcome.html by ~2%.
This commit is contained in:
parent
1b9a85e4f1
commit
da413a464a
6 changed files with 33 additions and 34 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "MmapRegion.h"
|
||||
#include "SoftMMU.h"
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/HashMap.h>
|
||||
|
@ -92,4 +93,20 @@ private:
|
|||
bool m_auditing_enabled { true };
|
||||
};
|
||||
|
||||
ALWAYS_INLINE Mallocation* MallocTracer::find_mallocation(const Region& region, FlatPtr address)
|
||||
{
|
||||
if (!region.is_mmap())
|
||||
return nullptr;
|
||||
if (!static_cast<const MmapRegion&>(region).is_malloc_block())
|
||||
return nullptr;
|
||||
auto* malloc_data = static_cast<MmapRegion&>(const_cast<Region&>(region)).malloc_metadata();
|
||||
if (!malloc_data)
|
||||
return nullptr;
|
||||
auto& mallocation = malloc_data->mallocation_for_address(address);
|
||||
if (!mallocation.used)
|
||||
return nullptr;
|
||||
ASSERT(mallocation.contains(address));
|
||||
return &mallocation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue