mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 01:38:52 +00:00
LibJS: Segregate GC-allocated objects by type
This patch adds two macros to declare per-type allocators: - JS_DECLARE_ALLOCATOR(TypeName) - JS_DEFINE_ALLOCATOR(TypeName) When used, they add a type-specific CellAllocator that the Heap will delegate allocation requests to. The result of this is that GC objects of the same type always end up within the same HeapBlock, drastically reducing the ability to perform type confusion attacks. It also improves HeapBlock utilization, since each block now has cells sized exactly to the type used within that block. (Previously we only had a handful of block sizes available, and most GC allocations ended up with a large amount of slack in their tails.) There is a small performance hit from this, but I'm sure we can make up for it elsewhere. Note that the old size-based allocators still exist, and we fall back to them for any type that doesn't have its own CellAllocator.
This commit is contained in:
parent
84a8ee01e1
commit
3c74dc9f4d
Notes:
sideshowbarker
2024-07-16 17:12:03 +09:00
Author: https://github.com/awesomekling
Commit: 3c74dc9f4d
Pull-request: https://github.com/SerenityOS/serenity/pull/21987
428 changed files with 723 additions and 22 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SourceTextModule);
|
||||
|
||||
// 2.7 Static Semantics: AssertClauseToAssertions, https://tc39.es/proposal-import-assertions/#sec-assert-clause-to-assertions
|
||||
static Vector<ModuleRequest::Assertion> assert_clause_to_assertions(Vector<ModuleRequest::Assertion> const& source_assertions, Vector<DeprecatedString> const& supported_import_assertions)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue