Commit graph

21374 commits

Author SHA1 Message Date
Gunnar Beutner 32ee195d62 LibJS: Avoid allocations in the Exception constructor 2021-06-03 14:47:15 +01:00
Gunnar Beutner 8b449214af LibJS: Optimize insertion order in the Exception constructor
By inserting the stack frames in the correct order we can improve the
runtime for the test-js test suite by about 20%.
2021-06-03 14:47:15 +01:00
Max Wipfli bc8d16ad28 Everywhere: Replace ctype.h to avoid narrowing conversions
This replaces ctype.h with CharacterType.h everywhere I could find
issues with narrowing conversions. While using it will probably make
sense almost everywhere in the future, the most critical places should
have been addressed.
2021-06-03 13:31:46 +02:00
Max Wipfli 1c9d87c455 Tests: Add tests for most functions in AK/CharacterType.h 2021-06-03 13:31:46 +02:00
Max Wipfli f4a4c36fa0 AK: Add CharacterTypes.h
This patch introduces CharacterTypes.h, which aims to be a replacement
for most usages of ctype.h. In contrast to that implementation, this
header makes use of exclusively constexpr functions and support the full
Unicode code point set without any narrowing-conversion issues.
2021-06-03 13:31:46 +02:00
Brian Gianforcaro d0dbb014a0 WindowServer: Switch Window to IntrusiveList from InlineLinkedList
Another small step towards unifying IntrusiveList / InlineLinkedList.
2021-06-03 13:27:40 +02:00
Brian Gianforcaro 7e691f96e1 Kernel: Switch ProcessGroup to IntrusiveList from InlineLinkedList 2021-06-03 13:27:40 +02:00
Brian Gianforcaro ce74fce0df Tests: Add test coverage for AK::IntrusiveList reverse iterator support 2021-06-03 13:27:40 +02:00
Brian Gianforcaro ef4fdcf76f AK: Add reverse iterator support to AK::IntrusiveList
In order for IntrusiveList to be capable of replacing InlineLinkedList,
it needs to support reverse iteration. InlineLinkedList currently
supports manual reverse iteration by calling list->last() followed by
node->prev().
2021-06-03 13:27:40 +02:00
Brian Gianforcaro e37f39d980 LibC: Switch ChunkedBlock to IntrusiveList from InlineLinkedList 2021-06-03 13:27:40 +02:00
Gunnar Beutner 48da8a568d
AK: Remove unused JsonValue <=> IPv4Address conversion code
This removes code that isn't used anywhere.
2021-06-03 11:56:32 +01:00
Brian Gianforcaro 06df26da67 LibGUI: Hide TextEditor dbgln spew under TEXTEDITOR_DEBUG 2021-06-03 11:21:38 +01:00
Brian Gianforcaro c2d556be3d TextEditor: Remove unused header includes 2021-06-03 11:21:38 +01:00
Matthew B. Jones ecaae2d10f
Solitaire: Add keys for drawing and moving cards to foundation stacks
Also shifts logic of starting game length timer into function
`start_timer_if_necessary`, so it can be called from original
mouse event handler and new `auto_move_eligible_cards_to_stacks`
2021-06-03 08:43:28 +01:00
Matthew B. Jones e7cfa9bf8e
LibGUI: Properly wrap multiple lines in IconView search highlighting 2021-06-03 08:32:31 +01:00
Timothy Flynn a870eac0eb LibSQL: Report a syntax error for unsupported LIMIT clause syntax
Rather than aborting when a LIMIT clause of the form 'LIMIT expr, expr'
is encountered, fail the parser with a syntax error. This will be nicer
for the user and fixes the following fuzzer bug:
https://crbug.com/oss-fuzz/34837
2021-06-03 08:30:13 +02:00
Matthew Jones 0ff09d4f74 WindowServer: Add sanity checks to create_window IPC 2021-06-03 08:27:57 +02:00
Matthew Jones ef92493aba LibGUI: ComboBox now goes upwards when running out of room to render 2021-06-03 08:24:18 +02:00
Matthew Jones 36a1162eb8 LibGUI: ComboBox now correctly sizes height in relation to taskbar 2021-06-03 08:23:45 +02:00
Matthew Jones 6c520fab87 LibGUI: Desktop.h should get actual value from TaskbarWindow.h 2021-06-03 08:23:45 +02:00
Matthew Jones b0682a73ee WindowServer: Position popup menu with offset of 1 pixel 2021-06-03 08:21:01 +02:00
Gunnar Beutner a4f320c76b AK: Allow inlining more string functions 2021-06-03 08:06:51 +02:00
Gunnar Beutner ed0068d04d AK: Allow inlining ref-count functionality
Previously we'd incur the costs for a function call via the PLT even
for the most trivial ref-count actions like increasing/decreasing the
reference count.

By moving the code to the header file we allow the compiler to inline
this code into the caller's function.
2021-06-03 08:06:51 +02:00
Matthew B. Jones ab4f4ddc3c
Solitaire: Add undo functionality 2021-06-03 01:16:49 +01:00
Gunnar Beutner 9444272ba0 Profiler: Remove m_deepest_stack_depth
This isn't used anymore so let's remove it entirely.
2021-06-03 01:16:32 +01:00
Gunnar Beutner a607f13fc7 Profiler: Use sequential serial numbers for profiling events
Previously Profiler was using timestamps to distinguish processes.
However it is possible that separate processes with the same PID exist
at the exact same timestamp (e.g. for execve). This changes Profiler
to use unique serial numbers for each event instead.
2021-06-03 01:16:32 +01:00
Matthew Jones af72b5ec82 LibGUI: Show pressed state for Space and Return key events
Also allows the user to press Esc while the button is being pressed
to cancel the button action.
2021-06-03 00:33:26 +01:00
Hediadyoin1 6fe7d4d7b8 Toolchain: Use gcc's ar
the vanilla versions might not handle all things, that gcc can do;
For example is lto not really supported by the vanilla versions
source:
https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ
2021-06-03 00:24:06 +01:00
BrandonKi 0d1481be7d LibWasm: Use builtins for clz, ctz, and popcnt 2021-06-03 03:45:06 +04:30
BrandonKi e53df2ca9d LibWasm: Implement rotr and rotl 2021-06-03 03:45:06 +04:30
Matthew Jones ea4116f5bd LibGUI+LibGfx+WindowServer: Sanity check window size dimensions
Previous to this commit, if a `Window` wanted to set its width or height
greater than `INT16_MAX` (32768), both the application owning the Window
and the WindowServer would crash.

The root of this issue is that `size_would_overflow` check in `Bitmap`
has checks for `INT16_MAX`, and `Window.cpp:786` that is called by
`Gfx::Bitmap::create_with_anonymous_buffer` would get null back, then
causing a chain of events resulting in crashes.

Crashes can still occur but with `VERIFY` and `did_misbehave` the
causes of the crash can be more readily identified.
2021-06-02 23:59:57 +01:00
Oleg Kosenkov 839aad6e5b
Toolchain: Set CMAKE_AR to the right executable 2021-06-02 23:25:44 +01:00
Marcus Nilsson 3931b292b0 HackStudio: Make locator lose focus on close
Make locator lose focus when pressing escape or by clicking in the
editor area.
2021-06-02 23:15:52 +01:00
Marcus Nilsson b43dad1741 HackStudio: Remove unused includes 2021-06-02 23:15:52 +01:00
Marcus Nilsson 8d3539a1c4 HackStudio: Close locator on exit 2021-06-02 23:15:52 +01:00
Matthew B. Jones 3ad7a1e944
Hearts: Play the first valid card (left-to-right) when pressing space 2021-06-02 23:07:12 +01:00
Gunnar Beutner 6f38ce8f47 Kernel: Avoid allocations in the VMObject constructor
This avoids allocations in the VMObject constructor. The number of
inline elements was determined empirically and covers most common cases
including LibC malloc.
2021-06-02 23:00:14 +01:00
Gunnar Beutner 596361791c Kernel: Add operator delete for KString
This doesn't change anything because our global operator delete also
calls kfree() - however instead of relying on this implementation
detail this makes this dependency more explicit.
2021-06-02 22:59:39 +01:00
Matthew Jones f0e9fd09b4 LibGUI: Tooltip no longer exceeds screen width, now truncates 2021-06-02 22:50:51 +01:00
Linus Groh d1d1f4f251 LibJS: Remove declarations of some TODO()'d BigInt and Promise functions
In hindsight declaring these prematurely wasn't the greatest idea - that
just makes any script checking for their existence believe they'll work,
and what follows next is a crash of the js or WebContent process. If we
omit the declarations, a polyfill can be provided instead.

This also affects the test262, which tests these - instead of reporting
a bunch of assertion crash errors, we should simply report test failure
for 'not a function', which in turn makes it easier to spot any actual
bugs causing crashes.
2021-06-02 21:06:21 +01:00
Linus Groh 163d776df6 LibJS: Replace iterator hint string argument with an enum
There's no reason at all for this to be a string or to accept arbitrary
values - just because it's displayed as strings in the spec doesn't mean
we have to do the same :^)
2021-06-02 20:52:46 +01:00
Linus Groh a5903ac4b6 LibRegex: Hide stray dbgln() behind REGEX_DEBUG 2021-06-02 18:31:43 +01:00
Matthew Jones 123848f0c1 LibGUI: Fixes Widget->set_visible(false) still maintains focus bug
When setting a Widget->set_visible(false), if that Widget->has_focus()
it will continue to have focus, even though it's not visible to the user
anymore.

Now calling Widget->set_visible(false) will remove focus from the Widget
if it had focus, and the Window will give focus back to the Widget
that had it previously, if there was one.
2021-06-02 18:22:05 +02:00
Matthew Jones 9720261540 TextEditor/GMLPlayground: Don't close app if user aborts save on exit 2021-06-02 18:15:19 +02:00
NonStandardModel a7d3709e1c KeyboardMapper: Add default path to keymaps 2021-06-02 18:10:06 +02:00
Gunnar Beutner 9e3fb73169 LibC: Use memory_order_acquire instead of memory_order_acq_rel
Acquire ordering should be sufficient for pthread_mutex_lock
and pthread_mutex_trylock.
2021-06-02 18:09:32 +02:00
Gunnar Beutner 90f4c9e44c LibC: Fix race condition in pthread_mutex_unlock()
This ensures the store to mutex->lock doesn't get re-ordered before
the store to mutex->owner which could otherwise result in a locked
owner-less mutex if another thread tries to acquire the lock at
the same time.
2021-06-02 18:09:32 +02:00
Gunnar Beutner 5ca1d4289b LibC: Remove reinterpret_cast in pthread_mutex_{try,}lock 2021-06-02 18:09:32 +02:00
Marcus Nilsson 11fa3e4f92 Terminal/LibGUI::TextEditor: Add shift+return to search forwards
This adds support for shift+return key combo in single line TextEditor
fields. Used in this case for searching backwards/forwards in the
Terminal find window.
2021-06-02 18:08:56 +02:00
Marcus Nilsson 9550564767 Terminal: Remove unused includes 2021-06-02 18:08:56 +02:00