summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Heap/Heap.h
AgeCommit message (Collapse)Author
2021-10-02LibJS: Put zombie cell tracking code behind a compile-time flagAndreas Kling
Since this is a debug-only feature, let's not have it impact GC marking performance when you don't need it.
2021-10-01LibJS: Remove transition avoidance & start caching prototype transitionsAndreas Kling
The way that transition avoidance (foo_without_transition) was implemented led to shapes being unshareable and caused shape explosion instead, precisely what we were trying to avoid. This patch removes all the attempts to avoid transitioning shapes, and instead *adds* transitions when changing an object's prototype. This makes transitions flow naturally, and as a result we end up with way fewer shape objects in real-world situations. When we run out of big problems, we can get back to avoiding transitions as an optimization, but for now, let's avoid ballooning our processes with a unique shape for every object.
2021-09-17LibJS: Increase time between garbage collectionsAndreas Kling
This patch ups the max number of heap allocations between each GC from 10'000 to 100'000. This is still relatively aggressive but already does a good job of cutting down on time spent in GC.
2021-09-11LibJS+js+test-js: Add GC debug mode that keeps cells "alive" as zombiesAndreas Kling
This patch adds a `-z` option to js and test-js. When run in this mode, garbage cells are never actually destroyed. We instead keep them around in a special zombie state. This allows us to validate that zombies don't get marked in future GC scans (since there were not supposed to be any more references!) :^) Cells get notified when they become a zombie (via did_become_zombie()) and this is used by WeakContainer cells to deregister themselves from the heap.
2021-09-08test-js: Add a mark_as_garbage method to force GC to collect that objectdavidot
This should fix the flaky tests of test-js. It also fixes the tests when running with the -g flag since the values will not be garbage collected too soon.
2021-08-28LibJS: Avoid pointless transitions and metadata lookups in storage_set()Linus Groh
- Replace the misleading abuse of the m_transitions_enabled flag for the fast path without lookup with a new m_initialized boolean that's set either by Heap::allocate() after calling the Object's initialize(), or by the GlobalObject in its special initialize_global_object(). This makes it work regardless of the shape's uniqueness. - When we're adding a new property past the initialization phase, there's no need to do a second metadata lookup to retrieve the storage value offset - it's known to always be the shape's property count minus one. Also, instead of doing manual storage resizing and assignment via indexing, just use Vector::append(). - When we didn't add a new property but are overwriting an existing one, the property count and therefore storage value offset doesn't change, so we don't have to retrieve it either. As a result, Object::set_shape() is now solely responsible for updating the m_shape pointer and is not resizing storage anymore, so I moved it into the header.
2021-07-21LibJS: Use IntrusiveList for keeping track of WeakContainersAndreas Kling
2021-07-21LibJS: Use IntrusiveList for keeping track of MarkedValueListsAndreas Kling
2021-07-21LibJS: Use IntrusiveList for keeping track of HandleImplsAndreas Kling
This allows us to remove a HashTable from heap and cuts down on some of the malloc traffic when creating handles.
2021-06-12LibJS: Generify the garbage collector's weak container notificationsIdan Horowitz
This will allow us to use the same interface for other JS weak containers like the WeakMap & WeakRef.
2021-06-09LibJS: Notify WeakSets when heap cells are sweepedIdan Horowitz
This is an implementation of the following optional optimization: https://tc39.es/ecma262/#sec-weakref-execution
2021-05-27LibJS: Rename Allocator => CellAllocatorAndreas Kling
Now that we have a BlockAllocator as well, it seems appropriate to name the allocator-that-allocates-cells something more specific to match.
2021-05-27LibJS: Recycle up to 64 HeapBlocks to improve performance :^)Andreas Kling
This patch adds a BlockAllocator to the GC heap where we now cache up to 64 HeapBlock-sized mmap's that get recycled when allocating HeapBlocks. This improves test-js runtime performance by ~35%, pretty cool! :^)
2021-05-17LibJS: Move Cell.{cpp,h} from Runtime/ to Heap/Andreas Kling
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-10AK+Everywhere: Make StdLibExtras templates less wrapper-yAnotherTest
This commit makes the user-facing StdLibExtras templates and utilities arguably more nice-looking by removing the need to reach into the wrapper structs generated by them to get the value/type needed. The C++ standard library had to invent `_v` and `_t` variants (likely because of backwards compat), but we don't need to cater to any codebase except our own, so might as well have good things for free. :^)
2021-03-28LibJS: Fix m_allocations_since_last_gc initialization valueLinus Groh
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling