1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-24 08:12:07 +00:00
serenity/Userland/Libraries/LibWeb/Bindings
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
..
AudioConstructor.cpp
AudioConstructor.h
CallbackType.h
CrossOriginAbstractOperations.cpp
CrossOriginAbstractOperations.h
CSSNamespace.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
CSSNamespace.h
CSSRuleWrapperFactory.cpp
CSSRuleWrapperFactory.h
CSSStyleDeclarationWrapperCustom.cpp
EventListenerWrapper.cpp
EventListenerWrapper.h
EventTargetWrapperFactory.cpp
EventTargetWrapperFactory.h
EventWrapperFactory.cpp
EventWrapperFactory.h
ExceptionOrUtils.h
IDLAbstractOperations.cpp LibJS: Use NaN boxing to decrease the memory size of Values 2022-08-15 17:11:25 +02:00
IDLAbstractOperations.h LibWeb: Let get_buffer_source_copy() return ErrorOr instead of Optional 2022-07-22 23:08:28 +01:00
ImageConstructor.cpp
ImageConstructor.h
LocationConstructor.cpp
LocationConstructor.h
LocationObject.cpp
LocationObject.h
LocationPrototype.h
MainThreadVM.cpp LibJS+LibWeb: Restore type safety of Realm::set_global_object() 2022-08-06 12:02:48 +02:00
MainThreadVM.h LibJS+LibWeb: Restore type safety of Realm::set_global_object() 2022-08-06 12:02:48 +02:00
NavigatorConstructor.cpp
NavigatorConstructor.h
NavigatorObject.cpp
NavigatorObject.h
NavigatorPrototype.h
NodeWrapperFactory.cpp LibWeb: Wrap DOM::Attribute in NodeWrapperFactory 2022-07-11 22:35:08 +02:00
NodeWrapperFactory.h
OptionConstructor.cpp
OptionConstructor.h
Replaceable.h
WindowConstructor.cpp
WindowConstructor.h
WindowObject.cpp LibWeb: Support assigning to window.location 2022-08-05 12:46:42 +02:00
WindowObject.h LibWeb: Support assigning to window.location 2022-08-05 12:46:42 +02:00
WindowObjectHelper.h LibWeb: Implement Path2D class 2022-08-14 11:30:40 +02:00
WindowPrototype.h
WindowProxy.cpp
WindowProxy.h
Wrappable.cpp
Wrappable.h
Wrapper.h