1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-12 23:01:01 +00:00
serenity/Userland/Libraries
davidot e746360b9a LibJS: Use NaN boxing to decrease the memory size of Values
Using the fact that there are 2^52-2 NaN representations we can
"NaN-box" all the Values possible. This means that Value no longer has
an explicit "Type" but that information is now stored in the bits of a
double. This is done by "tagging" the top two bytes of the double.
For a full explanation see the large comment with asserts at the top of
Value.

We can also use the exact representation of the tags to make checking
properties like nullish, or is_cell quicker. But the largest gains are
in the fact that the size of a Value is now halved.

The SunSpider and other benchmarks have been ran to confirm that there
are no regressions in performance compared to the previous
implementation. The tests never performed worse and in some cases
performed better. But the biggest differences can be seen in memory
usage when large arrays are allocated. A simple test which allocates a
1000 arrays of size 100000 has roughly half the memory usage.

There is also space in the representations for future expansions such as
tuples and records.

To ensure that Values on the stack and registers are not lost during
garbage collection we also have to add a check to the Heap to check for
any of the cell tags and extracting the canonical form of the pointer
if it matches.
2022-08-15 17:11:25 +02:00
..
LibArchive Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibAudio Base: Launch AudioServer at session start-up 2022-08-14 21:52:35 +01:00
LibC LibC+LibCore: Use tm_isdst to handle time zone offsets in DST 2022-08-02 21:10:44 +01:00
LibCards Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibChess Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibCodeComprehension Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibCompress LibCompress: Write Deflate window size in the Zlib header 2022-07-10 13:52:18 +03:00
LibConfig Base: Launch ConfigServer at session start-up 2022-08-14 21:52:35 +01:00
LibCore Base: Launch InspectorServer at session start-up 2022-08-14 21:52:35 +01:00
LibCoredump Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
LibCpp Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibCrypt Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00
LibCrypto LibCrypto: Expose UnsignedBigInteger's is_zero() in SignedBigInteger 2022-07-18 08:51:07 +01:00
LibDebug Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
LibDesktop LibCore+LibIPC: Recognise %uid in path 2022-08-14 21:52:35 +01:00
LibDeviceTree Libraries: Add LibDeviceTree for manipulating OpenFirmware Device Trees 2021-10-21 19:20:03 -07:00
LibDiff Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
LibDl Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
LibDNS Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibDSP LibDSP: Add a fixed mastering processor to Track 2022-07-25 15:25:13 +02:00
LibEDID Kernel+Userland: Rename FB.h => Graphics.h 2022-07-23 10:42:08 +01:00
LibELF Utilities+LibELF: Temporary promises for dynamic linker in "pledge" 2022-07-21 16:40:11 +02:00
LibFileSystemAccessClient Base: Launch FileSystemAccessServer at session start-up 2022-08-14 21:52:35 +01:00
LibGemini Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibGfx LibGfx: Add method for copying a Path with a transform applied 2022-08-14 11:30:40 +02:00
LibGL Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibGPU LibGPU: Do not load LibSoftGPU via symlink inside Serenity 2022-06-13 21:45:27 +01:00
LibGUI LibGUI: Initially disable the "Apply" button in SettingsWindow 2022-08-14 23:33:28 +02:00
LibHTTP LibHTTP+WebServer: Add querystring support 2022-08-02 21:05:32 +00:00
LibImageDecoderClient Base: Launch ImageDecoder at session start-up 2022-08-14 21:52:35 +01:00
LibIMAP Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibIPC LibCore+LibIPC: Recognise %uid in path 2022-08-14 21:52:35 +01:00
LibJS LibJS: Use NaN boxing to decrease the memory size of Values 2022-08-15 17:11:25 +02:00
LibKeyboard Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibLine LibLine: Ignore empty spans when stylizing 2022-07-17 00:51:31 +00:00
LibM LibM: Implement fma 2022-07-08 22:27:38 +00:00
LibMain Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00
LibMarkdown LibMarkdown: Fix coloring of the first line 2022-08-04 16:57:26 +00:00
LibPartition LibPartition: Fix end block off by one error 2022-07-21 20:13:44 +01:00
LibPCIDB Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibPDF Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibProtocol Base: Launch WebSocket at session start-up 2022-08-14 21:52:35 +01:00
LibRegex LibRegex: Check code unit count range when accessing by code unit count 2022-07-20 21:25:59 +01:00
LibSanitizer Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibSoftGPU Everywhere: Fix a bunch of typos 2022-05-29 15:22:00 +02:00
LibSQL Base: Launch SQLServer at session start-up 2022-08-14 21:52:35 +01:00
LibSymbolication Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
LibSyntax Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
LibSystem Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option 2022-05-02 01:46:18 +02:00
LibTest LibJS: Let Shape store a Realm instead of a GlobalObject 2022-08-05 12:42:46 +02:00
LibTextCodec Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibThreading Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
LibTimeZone Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00
LibTLS Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibUnicode LibUnicode: Generate per-locale data for the "noon" fixed day period 2022-07-21 20:36:03 +01:00
LibUSBDB Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibVideo Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LibVT LibVT: Remove Vector<Kernel::KString> title stack 2022-07-14 13:13:48 +02:00
LibWasm Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
LibWeb LibJS: Use NaN boxing to decrease the memory size of Values 2022-08-15 17:11:25 +02:00
LibWebSocket Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibWebView Base: Launch WebContent at session start-up 2022-08-14 21:52:35 +01:00
LibX86 Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
LibXML Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
CMakeLists.txt Kernel+LibPartition: Move DiskPartitionMetadata into LibPartition 2022-07-21 20:13:44 +01:00