Commit graph

51832 commits

Author SHA1 Message Date
kleines Filmröllchen b4fbd30b70 AudioServer+Userland: Decouple client sample rates from device rate
This change was a long time in the making ever since we obtained sample
rate awareness in the system. Now, each client has its own sample rate,
accessible via new IPC APIs, and the device sample rate is only
accessible via the management interface. AudioServer takes care of
resampling client streams into the device sample rate. Therefore, the
main improvement introduced with this commit is full responsiveness to
sample rate changes; all open audio programs will continue to play at
correct speed with the audio resampled to the new device rate.

The immediate benefits are manifold:
- Gets rid of the legacy hardware sample rate IPC message in the
  non-managing client
- Removes duplicate resampling and sample index rescaling code
  everywhere
- Avoids potential sample index scaling bugs in SoundPlayer (which have
  happened many times before) and fixes a sample index scaling bug in
  aplay
- Removes several FIXMEs
- Reduces amount of sample copying in all applications (especially
  Piano, where this is critical), improving performance
- Reduces number of resampling users, making future API changes (which
  will need to happen for correct resampling to be implemented) easier

I also threw in a simple race condition fix for Piano's audio player
loop.
2023-07-01 23:27:24 +01:00
Sebastian Zaha d52a2ff10e LibGfx: Fix error & crash in Rect::closest_to
Assertion fails if the point is outside of the rect. This was introduced
in introduced in #18970 and causes serenity to crash when changing to 2x
resolution for a monitor, if the cursor after resizing is outside of
the new screen.

Added test to reproduce.
2023-07-01 23:27:00 +02:00
Andreas Kling 0cb9c9e81e LibJS: Add fast paths for bitwise ops on 2x Int32 JS::Value
~9% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Andreas Kling 1efe4b58aa LibJS/Bytecode: Store current interpreter register window as a Span
This avoids a bunch of indirections on every single register access.

~17% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Shannon Booth e7435d68b0 LibJS: Extract named vm variables in ArrayBufferPrototype::slice 2023-07-01 16:55:17 +01:00
Shannon Booth 3781948f0c LibJS: Add initial implementation for SharedArrayBuffer
None of the actual sharing is implemented yet, but this is enough for
most basic functionality.

Diff Tests:
    +260     -262    +2 💀
2023-07-01 16:55:17 +01:00
Ali Mohammad Pur 1c1aa2c0d0 Shell: Handle (most) errors in the parsers
This turns all errors into either "OOM" or a proper shell error (if
propagation is impossible or meaningless).
Fixes `echo -en '\xfe\x4a' | $SHELL` crashing.
2023-07-01 17:01:54 +03:30
Andreas Kling 3f022f4040 LibWeb: Treat non-finite containing block width as zero for percentages
Fixes an assertion when loading https://bun.sh/
2023-07-01 09:06:49 +02:00
Andreas Kling c0a5787395 Ladybird: Don't scroll web view if wheel event is a Ctrl+Wheel zoom 2023-07-01 08:12:42 +02:00
Haikal Zain bf16618fba LibWeb: Add vertical border heights to tr
tr y offset is not being computed correctly.
This is causing errors in hit testing since
td and tr are misaligned.
2023-07-01 08:07:49 +02:00
Zack Penn 5775993a2a Ladybird: Add initial support for Ctrl+Scroll to zoom in/out
This commit adds basic functionality to zoom in/out using the
Ctrl+Scroll shortcut.
2023-07-01 08:07:33 +02:00
Andi Gallo 6b649af447 LibWeb: Fix inset shadow with zero offset and blur
Before this change, we only blurred the shadows which would've been
generated without blur. This meant that we didn't generate a shadow when
the offset was zero, even with blur. However, other browsers generate a
shadow when blur is set.

Instead, always generate a rectangular contour of sufficient thickness,
blur it if needed and blit it into the right position at the very end.
Thanks to the blur radius, we'll have a shadow even when the offset is
zero.
2023-07-01 07:48:33 +02:00
Andrew Kaster e0cf52b024 CI: Enable detect_stack_use_after_return ASAN option 2023-07-01 07:03:11 +02:00
Andrew Kaster 31440687a3 LibJS: Check the ASAN fake stack for heap pointers when ASAN is enabled
This is a similar strategy to what v8 does. Use the ASAN API function
__asan_addr_is_in_fake_stack to check any fake stack frames associated
with each stack address we scan. This fully allows running test-js -g
with the option detect_stack_use_after_return turned on.
2023-07-01 07:03:11 +02:00
Andrew Kaster 7d71acf1bb AK: Use __builtin_frame_address to find current stack depth remaining
Instead of checking the address of a temporary, grab the address of the
current frame pointer to determine how much memory is left on the stack.

This better communicates to the compiler what we're trying to do, and
resolves some crashes with ASAN in test-js while the option
detect_stack_use_after_return is turned on.
2023-07-01 07:03:11 +02:00
Daniel Bertalan 96b197ef46 LibJS/Temporal: Perform floating point arithmetic in RoundTime
The valid range for temporal values (`nsMinInstant`/`nsMaxInstant`)
means performing nanosecond-valued integers could lead to an overflow.

NB: Only the `roundingMode: "day"` case was affected, as all others were
already performing the division on floating-point `fractional_second`
values. I'm adding `.0` suffixes everywhere to make this fact clearer.

This adds a few local tests as well, as those are tested with sanitizers
enabled by default, unlike test262.
2023-07-01 06:51:25 +02:00
Daniel Bertalan 1dce1994eb LibJS: Make the options arg of InterpretTemporalDateTimeFields nullable
This fixes "reference binding to null pointer" UBSan warnings.
2023-07-01 06:51:25 +02:00
Daniel Bertalan 6eb06384b3 Kernel: Increase SD Data Timeout
Otherwise, reading will sometimes fail on the Raspberry Pi.

This is mostly a hack, the spec has some info about how the correct
divisor should be calculated and how we can recover from timeouts.
2023-06-30 23:45:47 +02:00
Daniel Bertalan bbe614c6c5 Kernel: Implement Changing Bus Width per the SDHC specification
Namely, we previously forgot to configure the SD Host Controller for
4-bit mode after issuing ACMD6, which caused data transfers to fail on
bare metal.
2023-06-30 23:45:47 +02:00
Daniel Bertalan 73228fc742 Kernel: Clear previous value before setting new clock divisor
Otherwise it would just get OR'ed together with the previous value,
leading to a slower than expected operation.
2023-06-30 23:45:47 +02:00
Daniel Bertalan 6185a19618 Kernel: Wait for transactions to complete before stopping SD clock 2023-06-30 23:45:47 +02:00
Daniel Bertalan b90a20aee6 Kernel: Make the PresentState register a bitfield in the SDHC driver 2023-06-30 23:45:47 +02:00
Andre Herbst 6391480b80 Ports/ffmpeg: Build shared libraries by using configure option
This fixes build error: relocation R_X86_64_PC32 against symbol
`ff_pw_5' can not be used when making a shared object; recompile
with -fPIC
2023-06-30 23:34:20 +02:00
PrestonLTaylor 850c252b3e LibJS: Implement ArrayBuffer.prototype.transfer & transferToFixedLength 2023-06-30 23:23:15 +02:00
PrestonLTaylor 34c5d34b95 LibJS: Show when an ArrayBuffer is detached when printing 2023-06-30 23:23:15 +02:00
PrestonLTaylor 286bf307d2 LibJS: Don't crash when calling byte_length for a detached ArrayBuffer 2023-06-30 23:23:15 +02:00
Tim Ledbetter a036346e24 Ports: Update stockfish to version 16 2023-06-30 23:21:48 +02:00
Sam Atkins 8c50d5d248 LibWeb: Remove misleading log message about unimplemented functions
`parse_a_calc_function_node()` only detects math functions, but
regularly encounters unrelated functions like `rgba()`. Since we now
support all the math functions, this message is just misleading spam.
2023-06-30 14:39:36 +01:00
Sam Atkins d0808e5d94 LibWeb: Correct @font-face debug log messages 2023-06-30 14:39:36 +01:00
PrestonLTaylor bd0ccbe3c8 LibJS: Implement the ArrayBuffer.prototype.detached getter 2023-06-30 12:47:15 +01:00
Zaggy1024 8157bb601b LibWeb: Place the unique task source used by media elements last
In the merging of an extremely large navigables PR, a task queue source
was added after the unique task source start value that was supposed to
remain last in the enum.
2023-06-30 12:52:46 +02:00
Andrew Kaster bfd6deed1e AK+Meta: Disable consteval completely when building for oss-fuzz
This was missed in 02b74e5a70

We need to disable consteval in AK::String as well as AK::StringView,
and we need to disable it when building both the tools build and the
fuzzer build.
2023-06-29 15:55:54 -06:00
networkException 5bc2c333bd Ladybird: Add qt6.qtmultimedia to dependencies in nix-shell script
See a34e369252
2023-06-29 21:20:37 +01:00
Andreas Kling 854b114c04 LibWeb: Use the script's own URL as filename for fetched classic script
This makes JS backtraces actually show the filename of scripts correctly
again (instead of the URL of the document that loaded them).
2023-06-29 12:07:11 +02:00
Daniel Bertalan 18c735429f LibJS: Fix incorrect is_function() check in NewPromiseCapability
I introduced this copy-paste mistake in c21255d.

Gets rid of 7 assertion failures on test262.
2023-06-29 08:43:28 +02:00
Aliaksandr Kalenik 1550e7c421 LibJS: Stop using execute_ast_node in NewClass instruction
This change replaces usage of `execute_ast_node` to evaluate super
expression in NewClass by generating instructions instead.
2023-06-29 07:14:14 +02:00
Pierre Delagrave 55faff80df Kernet/Net: Close a TCP connection using FIN|ACK instead of just FIN
When initiating a connection termination, the FIN should be sent with
a ACK from the last received segment even if that ACK already been sent.
2023-06-29 05:58:03 +02:00
Andi Gallo d33b99dd24 LibWeb: Check whether table box width is auto when resolving cell width
Computing the table width algorithm bifurcates based on whether
table-root width is auto. We only adjust the used table width based on
cell percentage widths on the auto branch, thus the same check is needed
when we initialize cell widths.
2023-06-29 05:37:34 +02:00
Hendiadyoin1 37067cf3ca LibJS: Use the IdentifierTable for NewFunction and NewClass lhs names
This makes them trivially copyable, which is an assumption multiple
optimizations use when rebuilding the instruction stream.

This fixes most optimized crashes in the test262 suite.
2023-06-29 05:32:08 +02:00
Daniel Bertalan c21255da7f LibJS: Align NewPromiseCapability with spec changes
See https://github.com/tc39/ecma262/commit/874ecf9

After this refactoring, we now correctly handle non-function /
non-undefined objects being passed multiple times: instead of skipping
assignment to promiseCapability altogether and failing with a
NotAFunction error in the end; on the second time the executor closure
is called, we return GetCapabilitiesExecutorCalledMultipleTimes.

This fixes the 7 `capability-executor-called-twice.js` test262 tests.
2023-06-28 23:36:15 +01:00
Shannon Booth 0748e755d8 LibJS: Implement SetValueInBuffer closer to spec
No functional changes intended, mostly just adding spec comments, along
with some asserts.
2023-06-28 23:18:39 +01:00
Shannon Booth fe479ffd66 LibJS: Add spec comment for [[ArrayBufferData]]
I have found myself needing to grep around for this one a bunch.
2023-06-28 23:18:39 +01:00
Shannon Booth 78d5c23c3a LibJS: Add spec comment for IsDetachedBuffer ( arrayBuffer ) 2023-06-28 23:18:39 +01:00
Linus Groh 8ac4a5315b Revert "Meta: Remove my CODEOWNERS entries"
This reverts commit 20f2389e2a.
2023-06-28 18:53:29 +01:00
PrestonLTaylor 0eac8bce6f LibWeb: Fix js execution for js urls in anchor tags href 2023-06-28 16:19:13 +02:00
Daniel Bertalan 1a10e904b5 AK: Use compiler builtins for MakeIntegerSequence/TypeListElement
These recursive templates have a measurable impact on the compile speed
of Variant-heavy code like LibWeb. Using these builtins leads to a 2.5%
speedup for the measured compilation units.
2023-06-28 16:18:32 +02:00
Andi Gallo 4596d41291 LibWeb: Make cell percentage widths relative to table
Cell percentage widths are relative to table width, not containing
block width. If the table width is auto, there isn't a normative
specification, only a brief mention that the user agent should try to
meet it.

As a starting point, we increase the width of the table such that it's
sufficient to cover min-width of cells with a percentage width. This
matches the behavior of other browsers, at least for simple cases.
2023-06-28 16:14:42 +02:00
Daniel Bertalan 50d6b1ba19 LibJS/Bytecode: Keep completion value of switch case if falling through
We do this by moving the `LoadImmediate undefined` instruction to a
separate basic block which jumps to the case's block unconditionally.
We enter a case initially using this wrapper, but when falling through,
we directly jump to the next case's block.
2023-06-28 12:30:23 +02:00
Andrew Kaster 02b74e5a70 AK: Re-enable consteval StringView literal workaround for oss-fuzz
oss-fuzz ships a pre-release commit of clang-15 for all of their build
bots. Until they update to a release of clang-15 that includes the fix
for this bug, or a later release, we need to keep the workaround in
place.
2023-06-28 12:18:06 +02:00
Andi Gallo 9cb4fe6a6f LibWeb: Don't distribute excess width to constrained columns
Bring our implementation closer to the specification, which distributes
excess width to unconstrained columns first.
2023-06-28 12:17:55 +02:00