mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +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
					
				
					 428 changed files with 723 additions and 22 deletions
				
			
		|  | @ -9,6 +9,8 @@ | |||
| 
 | ||||
| namespace JS::Test262 { | ||||
| 
 | ||||
| JS_DEFINE_ALLOCATOR(IsHTMLDDA); | ||||
| 
 | ||||
| IsHTMLDDA::IsHTMLDDA(Realm& realm) | ||||
|     // NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
 | ||||
|     : NativeFunction("IsHTMLDDA", realm.intrinsics().function_prototype()) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling