Tom
2f0e3da142
AK: Add IPv6Address class
...
This is the IPv6 counter part to the IPv4Address class and implements
parsing strings into a in6_addr and formatting one as a string. It
supports the address compression scheme as well as IPv4 mapped
addresses.
2022-03-08 23:05:44 +01:00
Vrins
73ade62d4f
AK: Add float support for JsonValue and JsonObjectSerializer
2022-03-08 22:09:52 +01:00
Vrins
ae1cd4b448
AK: Add to_double() to JsonValue
2022-03-08 22:09:52 +01:00
Andreas Kling
9d8da1697e
AK: Automatically shrink HashTable when removing entries
...
If the utilization of a HashTable (size vs capacity) goes below 20%,
we'll now shrink the table down to capacity = (size * 2).
This fixes an issue where tables would grow infinitely when inserting
and removing keys repeatedly. Basically, we would accumulate deleted
buckets with nothing reclaiming them, and eventually deciding that we
needed to grow the table (because we grow if used+deleted > limit!)
I found this because HashTable iteration was taking a suspicious amount
of time in Core::EventLoop::get_next_timer_expiration(). Turns out the
timer table kept growing in capacity over time. That made iteration
slower and slower since HashTable iterators visit every bucket.
2022-03-07 00:08:22 +01:00
Andreas Kling
eb829924da
AK: Remove return value from HashTable::remove() and HashMap::remove()
...
This was only used by remove_all_matching(), where it's no longer used.
2022-03-07 00:08:22 +01:00
Andreas Kling
623bdd8b6a
AK: Simplify HashTable::remove_all_matching()
...
Just walk the table from start to finish, deleting buckets as we go.
This removes the need for remove() to return an iterator, which is
preventing me from implementing hash table auto-shrinking.
2022-03-07 00:08:22 +01:00
Linus Groh
1719862d12
LibWeb: Hide some debug logging behind CANVAS_RENDERING_CONTEXT_2D_DEBUG
...
This can be quite noisy and isn't generally useful information.
2022-03-04 23:03:29 +01:00
Peter Ross
34108547b6
AK: Print NaN and infinite numbers in PrintfImplementation
2022-03-02 11:40:37 +01:00
Lucas CHOLLET
39bfc48ea7
AK: Add Time::from_ticks()
...
This helper allows Time to be constructed from a tick count and a ticks
per second value.
2022-02-28 20:09:37 +01:00
Timur Sultanov
406b3fc3fe
AK: Correctly process precision modifiers in printf
2022-02-28 14:08:24 +01:00
kleines Filmröllchen
98058f7efe
AK: Add FixedPoint base 2 logarithm
...
The log base 2 is implemented using the binary logarithm algorithm
by Clay Turner (see the link in the comment)
2022-02-28 13:59:31 +01:00
kleines Filmröllchen
30002c2ccb
AK: Add bit shift to FixedPoint
2022-02-28 13:59:31 +01:00
kleines Filmröllchen
5d6e3441fe
AK: Fix FixedPoint to integral comparisons
...
Add tests to ensure that the fixed point numbers compare correctly to
integrals
2022-02-28 13:59:31 +01:00
Idan Horowitz
feb00b7105
Everywhere: Make JSON serialization fallible
...
This allows us to eliminate a major source of infallible allocation in
the Kernel, as well as lay down the groundwork for OOM fallibility in
userland.
2022-02-27 20:37:57 +01:00
Idan Horowitz
9da8c78133
AK: Add a try variant of StringBuilder::append_escaped_for_json
...
This will allow us to make a fallible version of the JSON serializers.
2022-02-27 20:37:57 +01:00
kleines Filmröllchen
7e18e6e37b
AK: Skip over initial empty chunks in DisjointChunks
...
This will be caught by new test cases: when the initial chunk is empty,
a dereference before calling operator++ on the iterator will crash as
the initial chunk's size is never checked.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
4ec599aae5
AK: Make DisjointChunks support FixedArray
...
This extracts the shatter_chunk logic, because it needs to be different
for FixedArray.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
ee9eef1fa8
AK: Make DisjointChunk::append move the new chunk
...
Previously, although we were taking a moved chunk, we still copied it
into our chunk list. This makes DisjointChunk compatible with containers
that don't have a copy constructor but a move constructor.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
6e5bf7ac6f
AK: Export DisjointSpans into the global namespace
...
I think we just forgot when we added it.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
75eb5e7984
AK: Add at() indexing methods to FixedArray
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
09df8f812a
AK: Allow creating a FixedArray from an initializer list
2022-02-27 00:11:14 +03:30
kleines Filmröllchen
65f34504e9
AK: Add FixedArray::is_empty()
...
This also exists on Vector, and although it's less needed here, it's
perfectly reasonable to have.
2022-02-27 00:11:14 +03:30
Arne Elster
b7110c2a34
AK: Add constructor to create Span from Array
...
It's a convenience constructor. But it also seems more consistent
to allow a Span being made from both raw and managed arrays.
2022-02-26 16:01:26 +01:00
Arne Elster
6a0cac7cdb
AK: Array can tell its inner type
...
Array should be able to tell the type of the elements it contains.
2022-02-26 16:01:26 +01:00
Andreas Kling
f2663f477f
AK: Ignore whitespace while decoding base64
...
This matches how other implementations behave.
1% progression on ACID3. :^)
2022-02-25 19:54:13 +01:00
Andreas Kling
dd7eb3d6d8
AK: Add String::split_view(Function<bool(char)>)
...
This allows you to split around a custom separator, and enables
expressive code like this:
string.split_view(is_ascii_space);
2022-02-25 19:38:31 +01:00
Linus Groh
1752f7720e
AK: Add forward declaration for Utf8CodePointIterator
2022-02-23 21:53:30 +00:00
Linus Groh
b253bca807
AK: Add optional format string parameter to String{,Builder}::join()
...
Allow specifying a custom format string that's being used for each item
instead of hardcoding "{}".
2022-02-23 21:53:30 +00:00
Linus Groh
f8ff8c8dd6
AK: Add Traits<Span<T>>::hash()
2022-02-23 21:53:30 +00:00
kleines Filmröllchen
604309327e
AK: Add the Fundamental concept
2022-02-23 00:42:49 +00:00
kleines Filmröllchen
7418bdb85f
AK: Prevent Atomic with complex types
...
This would throw some really weird linker errors, so let's prevent it
from happening instead!
2022-02-23 00:42:49 +00:00
Max Wipfli
d29d9462e9
AK: Suppress clang-tidy warning on TODO()
...
This adds a NOLINT directive to the definition of the TODO() macro.
clang-tidy wants the assert replaced with a static_assert, since the
macro simply resolves to assert(false). This is obviously nonsensical,
since we want the code to still compile even with TODO().
The same fix has already been implemented for VERIFY_NOT_REACHED().
2022-02-21 19:01:16 +02:00
Andreas Kling
4b900bc100
AK: Add fast path in String::trim() and String::trim_whitespace()
...
If the trimmed string would be the entire string, just return *this
instead of creating a new StringImpl.
2022-02-19 14:45:59 +01:00
Andreas Kling
2dd3b54827
AK: Make CaseInsensitiveStringTraits allocation-free
...
Instead of calling String::to_lowercase(), do case-insensitive hashing
and comparison.
2022-02-19 14:45:59 +01:00
Gunnar Beutner
7a65bd8efb
AK: Don't use x86 assembly when building for non-x86 targets
...
This allows Lagom to be built successfully for Apple M1.
Fixes #12644 .
2022-02-19 13:13:22 +02:00
Ben Abraham
ae346cff6b
LibWeb: Add partially functioning Worker API
...
Add a partial implementation of HTML5 Worker API.
Messages can be sent from the inner context externally.
2022-02-17 22:45:21 +01:00
Sam Atkins
1a4dd47d5f
AK: VERIFY inside release_value_but_fixme_should_propagate_errors()
...
While the code did already VERIFY that the ErrorOr holds a value, this
was done by Variant, so the error message was just that `has<T>()` is
false. This is less helpful than I would like, especially if backtraces
are not working and this is all you have to go on. Adding this extra
VERIFY means the assertion message (`!is_error()`) is easier to
understand.
2022-02-16 19:49:41 -05:00
Idan Horowitz
cec669a89a
AK: Exclude StringUtils String APIs from the Kernel
...
These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
2022-02-16 22:21:37 +01:00
Idan Horowitz
4c6a1f4db2
AK: Exclude StringView String APIs from the Kernel
...
These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
2022-02-16 22:21:37 +01:00
Idan Horowitz
8f093e91e0
AK: Exclude StringBuilder String APIs from the Kernel
...
These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
2022-02-16 22:21:37 +01:00
Idan Horowitz
43e5c326e2
AK: Exclude JsonValue String APIs from the Kernel
...
These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
2022-02-16 22:21:37 +01:00
Idan Horowitz
e95470702e
AK: Use string_view() instead of to_string() in Formatter<wchar_t>
...
This let's us avoid a heap allocation.
2022-02-16 22:21:37 +01:00
Idan Horowitz
b22cb40565
AK: Exclude GenericLexer String APIs from the Kernel
...
These APIs are only used by userland, and String is OOM-infallible,
so let's just ifdef it out of the Kernel.
2022-02-16 22:21:37 +01:00
Idan Horowitz
3219ce3d61
AK: Return KString instead of String from encode_hex in the Kernel
...
This let's us propagate allocation errors from this API.
2022-02-16 22:21:37 +01:00
Idan Horowitz
316fa0c3f3
AK+Kernel: Specialize Trie for NNOP<KString> and use it in UnveilNode
...
This let's us avoid the infallible String allocations.
2022-02-16 22:21:37 +01:00
Idan Horowitz
7f44e54ad6
AK+Kernel: Return KString from UUID::to_string() in the Kernel
...
This lets us safely handle allocation failure.
2022-02-16 22:21:37 +01:00
Idan Horowitz
9277d2dce2
AK+Kernel: Return KString from MACAddress::to_string() in the Kernel
...
This lets us safely handle allocation failure.
2022-02-16 22:21:37 +01:00
Idan Horowitz
6098ffa120
AK+Kernel: Return KString from IPv4Address::to_string() in the Kernel
...
This lets us safely handle allocation failure.
2022-02-16 22:21:37 +01:00
serenitydev
23c72c6728
AK: Fix userland parsing of rounded floating point numbers
...
Parse JSON floating point literals properly,
No longer throwing a SyntaxError when the decimal portion
of the number exceeds the capacity of u32.
Added tests to AK/TestJSON and LibJS/builtins/JSON/JSON.parse
2022-02-16 07:22:51 -05:00
Ali Mohammad Pur
a1cb2c371a
AK+Kernel: OOM-harden most parts of Trie
...
The only part of Unveil that can't handle OOM gracefully is the
String::formatted() use in the node metadata.
2022-02-15 18:03:02 +02:00