Commit graph

54901 commits

Author SHA1 Message Date
Bastiaan van der Plaat
5e7a82a853 LibWeb: Create canvas bitmap when not existing in toDataURL and toBlob 2023-09-28 13:09:25 +02:00
Andreas Kling
d24e07579f LibJS: Use a Vector<u8> for BasicBlock instruction storage
This reduces the minimum size of a basic block from 4 KiB to 0 bytes.
With this change, memory usage at the end of Speedometer is 1.2 GiB,
down from 1.8 GiB.
2023-09-28 11:25:19 +02:00
Andreas Kling
89a86798a2 Meta: Add note about tests to CONTRIBUTING.md 2023-09-28 06:25:40 +02:00
Aliaksandr Kalenik
32be413f4e LibWeb: Add missing visit_edges() for ImageStyleValue
ImageStyleValue has a visit_edges() method, although it is not a
GC-allocated object. This is necessary because it owns a GC-allocated
ImageRequest that we want to visit, instead of using JS::Handle, to
avoid leaks. In the future, we might want to make StyleValue be
GC-allocated.

For now, this change adds missing visit_edges() calls for objects that
own ImageStyleValue.
2023-09-28 06:11:17 +02:00
Aliaksandr Kalenik
b43b3d2f8d LibWeb: Null check container while creating srcdoc navigation params
Fixes https://github.com/SerenityOS/serenity/issues/21205
Fixes https://github.com/SerenityOS/serenity/issues/21240
2023-09-28 06:09:52 +02:00
Andreas Kling
feedbd6a01 LibJS: Put __builtin_unreachable() in unused bytecode opcode handlers
For the opcodes that are handled directly in the interpreter loop,
we want the compiler to know that there's nothing to inline here.
2023-09-28 06:09:16 +02:00
Andreas Kling
f3606adc58 LibJS: Inline bytecode ops for direct local/register access
These can do a lot less stuff if we put them directly in the interpreter
loop and allow them to access the locals/registers arrays directly.
2023-09-28 06:09:16 +02:00
Andreas Kling
ae1ac9871b LibJS: Move all bytecode instruction implementations to Interpreter.cpp
This allows aggressive inlining without LTO.
2023-09-28 06:09:16 +02:00
Andreas Kling
e5474c384d LibJS: Inline flow control ops in the bytecode interpreter loop
Instead of calling out to helper functions for flow control (and then
checking control flags on every iteration), we now simply inline those
ops in the interpreter loop directly.
2023-09-28 06:09:16 +02:00
Andreas Kling
39cfb64269 LibJS: Return early from Interpreter on unhandled exception
If we don't have a local unwind context to handle the exception, we can
just return right away. This allows us to remove one check from the
inner loop.
2023-09-28 06:09:16 +02:00
Andreas Kling
c9eff35b96 LibJS: Use goto instead of bool will_jump in interpreter loop
This is honestly less spaghetti-ish.
2023-09-28 06:09:16 +02:00
Andreas Kling
9fe38245b2 LibJS: Move bytecode interpreter's inner loop to its own function 2023-09-28 06:09:16 +02:00
Andreas Kling
951a85992b LibJS: Mark the exception path as [[unlikely]] in the interpreter loop 2023-09-28 06:09:16 +02:00
Andreas Kling
031ec98803 LibJS: Streamline InstructionStreamIterator
Nuke all the per-instruction bounds checking when iterating instructions
by using raw pointers instead of indexing into a ReadonlyBytes.

The interpreter loop already checks that we're in-bounds anyway.
2023-09-28 06:09:16 +02:00
Andreas Kling
213b835b57 LibJS: Remove Bytecode::Interpreter::debug_position()
This was only used in one place, and that place is already covered
by a VERIFY anyway.
2023-09-28 06:09:16 +02:00
Andreas Kling
0c746366cc LibJS: Keep return value in a call frame register 2023-09-28 06:09:16 +02:00
Andreas Kling
c833885fb5 LibJS: Keep cached this value in a call frame register
Just moving more things to call frame registers..
2023-09-28 06:09:16 +02:00
Andreas Kling
3887b840a3 LibJS: Keep current exception in a call frame register
Instead of keeping it in a Bytecode::Interpreter member, move it into
a dedicated call frame register.
2023-09-28 06:09:16 +02:00
Tim Ledbetter
ebb822def9 less: Add the -F option to quit if the input fits on one screen 2023-09-27 20:00:34 +02:00
Tim Ledbetter
938a287d3e ls: Left justify owner and group information in long format 2023-09-27 19:58:17 +02:00
Tim Ledbetter
cb1851f3cc ls: Add the -g option to omit owner information in long format 2023-09-27 19:58:17 +02:00
Tim Ledbetter
d618ef58fb ls: Display results in long format when -n or -o are used 2023-09-27 19:58:17 +02:00
Aliaksandr Kalenik
dc19de58d0 LibWeb: Do not use JS::Handle for "scripts to execute" in DOM::Document
Using JS::Handle in members of GC-allocated object almost always leaks.
Instead we should visit these members in visit_edges().
2023-09-27 19:39:57 +02:00
Aliaksandr Kalenik
cad2d2c85b LibWeb: Use JS::HeapFunction for DocumentObserver callbacks
If GC-allocated object wants to own a function it should use
HeapFunction because using SafeFunction will almost always lead to a
leak.
2023-09-27 19:39:57 +02:00
Tim Ledbetter
12adaac08d GameOfLife: Don't toggle cells on mouse move when placing patterns
Previously, it was very easy to inadvertently toggle cells when
placing a pattern by dragging the mouse slightly.
2023-09-27 19:12:14 +02:00
Tim Ledbetter
6eaae726fa GameOfLife: Clear the selected pattern when the game starts running 2023-09-27 19:12:14 +02:00
Tim Ledbetter
4b48757586 GameOfLife: Allow ctrl+click to place multiple patterns 2023-09-27 19:12:14 +02:00
Aliaksandr Kalenik
15629e8925 LibWeb: Do not use JS::Handle for mutation observers
Using JS::Handle in WebEngineCustomData means that mutation observers
will live as long as VM while actually they should be deallocated as
soon as they are no longer used in a script that created them.
2023-09-27 16:33:21 +02:00
Aliaksandr Kalenik
e7a3040c9f LibWeb: Do not use JS::Handle for TimerHandler
There is no need to use JS::Handle for timer handler because it is
visited from JS::HeapFunction in HTML::Timer.
2023-09-27 16:33:21 +02:00
Aliaksandr Kalenik
3a1f617fbf LibJS: Use Function as callback type in define_native_function/accessor
There is not need to use SafeFunction because
define_native_function or define_native_accessor will pass callback
forward to NativeFunction that uses HeapFunction to visit it.
2023-09-27 16:33:21 +02:00
circl
84f845494e Ladybird/Qt: Add support for color pickers 2023-09-27 12:16:41 +01:00
circl
3e1a154440 Browser: Add support for color pickers 2023-09-27 12:16:41 +01:00
circl
2995a2e212 LibWeb+LibWebView+WebContent: Add support for <input type="color">
This commit introduces 3 things:
- Support for the color type in HTMLInputElement itself
- A mechanism for handling non event loop blocking dialogs in Page
- The associated plumbing up to ViewImplementation

Frontends may add support for the color picker with the
ViewImplementation.on_request_color_picker function
2023-09-27 12:16:41 +01:00
Andreas Kling
759ad905de LibWeb: Remove FIXME about spec bug in page visibility
Because the spec bug got fixed \o/
2023-09-27 09:31:27 +02:00
Sönke Holz
c42e8ddc48 LibELF: Calculate size of relocation table correctly in all cases
RELASZ might include the PLT table as well. Check if that is the case
and correct the size of the non-PLT relocation table.
2023-09-27 03:33:36 +02:00
kleines Filmröllchen
968038aa79 LibAudio: Use mapped files for audio playback
This is 10-20% of a speed increase on platforms with fast I/O (Linux)
and not a slowdown on Serenity. Again, the file system layer is the
limit for us :^)
2023-09-27 03:22:56 +02:00
kleines Filmröllchen
d6571f54d8 LibCore: Make MappedFile a Stream
The internal reuse of FixedMemoryStream makes this straightforward.
There alread is one user of the new API, demonstrating the need for this
change beyond what I said out to use it for :^)
2023-09-27 03:22:56 +02:00
kleines Filmröllchen
062e0db46c LibCore: Make MappedFile OwnPtr-based
Since it will become a stream in a little bit, it should behave like all
non-trivial stream classes, who are not primarily intended to have
shared ownership to make closing behavior more predictable. Across all
uses of MappedFile, there is only one use case of shared mapped files in
LibVideo, which now uses the thin SharedMappedFile wrapper.
2023-09-27 03:22:56 +02:00
kleines Filmröllchen
5b2496e522 AK: Make writability violation of FixedMemoryStream non-fatal
Writing to a read-only file is not a program-crashing error either, so
we just return the standard EBADFD (see write(2)) here.
2023-09-27 03:22:56 +02:00
kleines Filmröllchen
bbeabe929b AK: Allow specifying writability of a FixedMemoryStream 2023-09-27 03:22:56 +02:00
kleines Filmröllchen
644d9c784d AK: Make FixedMemoryStream non-final 2023-09-27 03:22:56 +02:00
Lucas CHOLLET
e62a4c169b Ports: Add libjxl :^) 2023-09-27 03:14:44 +02:00
Lucas CHOLLET
48a1fe8308 Ports/brotli: Update to 1.1.0 2023-09-27 03:14:44 +02:00
Lucas CHOLLET
7a993cad7a Ports: Add highway
This library is used by multiple projects but was ported to get `libjxl`
on SerenityOS.
2023-09-27 03:14:44 +02:00
Tim Ledbetter
09099cc9a3 du: Prevent multiple counting of the same file
Previously, the same file would be counted more than once if its
containing directory was visited multiple times, or there were
multiple hard links pointing to it.

We now keep track of every visited inode to ensure that files aren't
evaluated multiple times. This matches the behavior of `du` on FreeBSD
and Linux.
2023-09-26 21:27:25 +02:00
Aliaksandr Kalenik
46254101f7 LibWeb: Change DOM::Position to be GC-allocated 2023-09-26 21:25:54 +02:00
Aliaksandr Kalenik
35623ad52e LibWeb: Visit IntersectionObserverRegistration instead of using Handle
This fixes GC-leak caused by JS::Handle<IntersectionObserverver>
preventing an element that owns the handle from being deallocated.
2023-09-26 21:25:54 +02:00
Aliaksandr Kalenik
ac5c4705fd LibWeb: Do not use JS::Handle for captures of AbortSignal callbacks
There is no need to use JS::Handle for captures because AbortSignal
will visit them anyway because it uses JS::HeapFunction to store the
callback.
2023-09-26 21:25:54 +02:00
Aliaksandr Kalenik
3bcd368703 LibWeb: Do not pass JS::Handle into NativeFunction callback captures
NativeFunction uses JS::HeapFunction for the callback so GC-allocated
captures will be visited anyway.
2023-09-26 21:25:54 +02:00
Sam Atkins
90aaa8ab40 LibWeb: Handle shorthands in ResolvedCSSStyleDeclaration generically
Most shorthands can be reconstructed this way, using our generated
property data, so let's use them instead of manually implementing the
code.

Some of these were previously doing some form of error checking or
defaulting, but both of those are unnecessary. (And actually, would
crash if there wasn't a value available due to calling release_nonnull()
on a null RefPtr.) At this point, the CSS machinery has already made
sure each property has a value, and that the value is valid for that
property.
2023-09-26 21:19:42 +02:00