Commit graph

22643 commits

Author SHA1 Message Date
Andreas Kling c8270dbe2e LibJS: Rename ScriptFunction => OrdinaryFunctionObject
These are basically what the spec calls "ordinary function objects",
so let's have the name reflect that. :^)
2021-06-27 22:36:04 +02:00
Andreas Kling ba9d5c4d54 LibJS: Rename Function => FunctionObject 2021-06-27 22:36:04 +02:00
Andrew Kaster e389ae3c97 LibJS: Ensure shift values in shift_right are modded by 32
The unsigned shift right implementation was already doing this, but
the spec requires a mod32 of rhs before the shift for the signed shift
right implementation as well. Caught by UBSAN and oss-fuzz.
2021-06-27 22:35:37 +02:00
Andrew Kaster 1f2720ce0d LibJS: Avoid undefined static cast of negative values in to_u32
If the value we get after fmod in Value::to_u32 is negative, UBSAN
complains that -N is out of bounds for u32. An extra static cast to i64
makes it stop complaining. An alternative implementation could add 2^32
if the fmod'd value is negative. Caught by UBSAN and oss-fuzz.
2021-06-27 22:35:37 +02:00
Tom 091628202f WindowServer: Un-tile window if resizing warrants it
Since being tiled means we restrict rendering a window to the screen it
is on (so that we don't "bleed" into an adjacent screen), we need to
untile it if the window either can't fit into the screen, or it is
detached from the screen edges.
2021-06-27 22:35:12 +02:00
Linus Groh d3fc8652c7 LibJS: Add content type check to IntegerIndexedElementSet()
Resolves a FIXME.
2021-06-27 21:01:07 +01:00
Linus Groh e08702a235 LibJS: Add content type check to InitializeTypedArrayFromTypedArray()
Resolves a FIXME.
2021-06-27 21:01:02 +01:00
Linus Groh d7750999b3 LibJS: Implement the TypedArray [[ContentType]] internal slot 2021-06-27 21:01:01 +01:00
Linus Groh 93bae37dd9 LibJS: Add 'is detached' check to InitializeTypedArrayFromTypedArray()
Resolves a FIXME.
2021-06-27 21:01:01 +01:00
Linus Groh 48e7fd52e7 LibJS: Make variables in InitializeTypedArrayFromTypedArray() match spec
This makes it easier to follow the code and compare it to the spec.
2021-06-27 21:01:01 +01:00
Linus Groh abb5a1f05c LibJS: Add missing InitializeTypedArrayFromTypedArray() spec link
Also move the others outside of their functions.
2021-06-27 21:00:57 +01:00
Ali Mohammad Pur 37b0f55104 AK: Make the constexpr StringView methods actually constexpr
Also add some tests to ensure that they _remain_ constexpr.
In general, any runtime assertions, weirdo C casts, pointer aliasing,
and such shenanigans should be gated behind the (helpfully newly added)
AK::is_constant_evaluated() function when the intention is to write
constexpr-capable code.
a.k.a. deliver promises of constexpr-ness :P
2021-06-27 20:54:59 +01:00
Andreas Kling 67d1b28b97 FileManager: Pass launch origin rects to spawned programs
This makes GUI applications animate their initial window showing up
on screen. :^)
2021-06-27 19:38:11 +02:00
Andreas Kling 6a132d8672 WindowServer+LibGUI: Allow specifying a "launch origin" for new windows
The launch_origin_rect parameter to create_window() specifies where on
screen the window was launched from. It's optional, but if you provide
it, the new window will have a short wireframe animation from the origin
to the initial window frame rect.

GUI::Window looks for the "__libgui_launch_origin_rect" environment
variable. Put your launch origin rect in there with the format
"<x>,<y>,<width>,<height>" and the first GUI::Window shown by the app
will use that as the launch origin rect.

Also it looks pretty neat, although I'm sure we can improve it. :^)
2021-06-27 19:38:11 +02:00
Andreas Kling 75f870a93f WindowServer: Add a more generic mechanism for animations
This patch adds the WindowServer::Animation class, which represents
a simple animation driven by the compositor.

An animation has a length (in milliseconds) and two hooks:

- on_update: called whenever the animation should render something.
- on_stop: called when the animation is finished and/or stopped.

This patch also ports the window minimization animation to this new
mechanism. :^)
2021-06-27 19:38:11 +02:00
stelar7 1f33c517df Meta: Do not use gl=on if building in WSL 2021-06-27 15:48:08 +02:00
Gunnar Beutner 9ed051fe25 Kernel: Implement initializing threads on x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner f285241cb8 Kernel: Rename Thread::tss to Thread::regs and add x86_64 support
We're using software context switches so calling this struct tss is
somewhat misleading.
2021-06-27 15:46:42 +02:00
Gunnar Beutner eba33f82b8 Kernel: Reorder code a bit to clarify which #if block it belongs to 2021-06-27 15:46:42 +02:00
Gunnar Beutner df530941cc Kernel: Implement safe_* memory access functions for x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner 79ab9cce18 Kernel: Clear segment registers on x86_64
They're supposedly unused but iretq doesn't like ss being non-zero.
2021-06-27 15:46:42 +02:00
Gunnar Beutner 9d9f20391d Kernel: Use macros for GDT indices instead of hardcoding the values 2021-06-27 15:46:42 +02:00
Gunnar Beutner 065c6c307d Kernel: Add support for interrupts on x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner 233ef26e4d Kernel+Userland: Add x86_64 registers to RegisterState/PtraceRegisters 2021-06-27 15:46:42 +02:00
Gunnar Beutner 10ca7f18a7 Kernel: Fix declaration for struct TrapFrame
This is declared as a struct elsewhere.
2021-06-27 15:46:42 +02:00
Gunnar Beutner 324f72d02b Kernel: Fix incorrect flags for the GDT entries
The Sz (protected mode) bit should not be set for 64-bit GDT entries.
2021-06-27 15:46:42 +02:00
Ali Mohammad Pur fd72597999 LibWeb: Make ExceptionOr capable of holding all error types in the spec
The WebIDL spec specifies a few "simple" exception types in addition to
the DOMException type, let's support all of those.
This allows functions returning ExceptionOr<T> to throw regular
javascript exceptions (as limited by the webidl spec) by returning a
`DOM::SimpleException { DOM::SimpleExceptionType::T, "error message" }`
which is pretty damn cool :^)
2021-06-27 12:49:49 +01:00
Ali Mohammad Pur bda19a9ff3 AK: Add explicit Variant conversion operators
This allows converting between Variants of different types with less
pain.
2021-06-27 12:49:49 +01:00
Andreas Kling dff3439ad0 Profiler: Cache the timeline histograms instead of recomputing on paint
There was an aggressive amount of work happening on every paint. :^)
2021-06-27 12:05:28 +02:00
Andreas Kling f4090d46de Kernel: Don't kmalloc() for small (<=1024) dbgputstr() syscalls 2021-06-27 10:50:24 +02:00
Tom a9906cfcd1 WindowServer: Try to auto-add unconfigured framebuffer devices
This will try to auto-add framebuffer devices that haven't been
explicitly configured to the right-hand side.
2021-06-27 09:46:27 +02:00
Tom 38af4c29e6 WindowServer: Coalesce flushing buffers into one ioctl() call
We regularily need to flush many rectangles, so instead of making many
expensive ioctl() calls to the framebuffer driver, collect the
rectangles and only make one call. And if we have too many rectangles
then it may be cheaper to just update the entire region, in which case
we simply convert them all into a union and just flush that one
rectangle instead.
2021-06-27 09:46:27 +02:00
Tom 56cd0f929e Kernel: Enable additional VirtIO displays only on first resolution set
Also, only allocate the amount of memory we actually need for the given
resolution.
2021-06-27 09:46:27 +02:00
Tom 8749235046 Kernel: Add support for multiple VirtIO GPU outputs
This creates /dev/fbX devices for each physical output, owned by the
parent VirtIOGPU instance. This allows mapping and setting resolutions
independently for each output.
2021-06-27 09:46:27 +02:00
Tom 708f27ca0e WindowServer: Use relative coordinates when flushing screen dirty rects
The framebuffer device expects coordinates relative to itself.
2021-06-27 09:46:27 +02:00
Tom c12cbb96ce WindowServer: Fix geometry label not updating if it isn't moving
This fixes a regression where the geometry label isn't updating even
though the window geometry had changed because the geometry label's
location isn't changing.
2021-06-27 09:37:07 +02:00
Andreas Kling f61a9f2dc5 LibJS: Don't extend arguments object to match the parameter count
The `arguments` object should only have the *arguments* as numeric
properties, not the *parameters*.

Given this function:

    function foo(a, b) {
        return arguments.length;
    }

Calling foo() with no arguments now correctly returns 0 instead of 2.
2021-06-27 00:37:07 +02:00
Andreas Kling beb43f673e AK: Undo bogus Variant::downcast() rename
I accidentally renamed these to verify_cast() when doing the global
AK::downcast() rename.
2021-06-26 21:27:58 +02:00
Linus Groh 337ad6d15c LibJS: Implement the GetMethod() abstract operation as a Value method
This was a standalone function previously (get_method()), but instead of
passing a Value to it, we can just make it a method.

Also add spec step comments and fix the receiver value by using GetV().
2021-06-26 19:24:35 +01:00
Linus Groh 31f5797e89 LibJS: Implement the GetV() abstract operation
Like Get(), but with any value instead of an object - it's calling
ToObject() for us and passes the value to [[Get]]() as the receiver.

This will be used in GetMethod() (and a couple of other places, which
can be updated over time).

I also tried something new here: adding the three steps from the spec as
inline comments :^)
2021-06-26 19:17:28 +01:00
Linus Groh dbda5a9a4c LibJS: Move install_error_cause() from Object to Error
This is only used by Error and its subclasses, so it doesn't need to be
available to all objects.
2021-06-26 19:06:55 +01:00
davidot a63cc2c6b9 LibJS: Skip tests which broke with reversion of f102b563
These tests are correct as other engines pass them but are now broken
2021-06-26 18:16:53 +01:00
davidot 83dd0164b2 Revert "LibJS: Fix this_value in native setters and getters"
This reverts commit f102b563
The reverted to behavior is not correct for example with a double proxy
But this change lead to problems with DOMNodes
2021-06-26 18:16:53 +01:00
davidot 19f505d320 LibJS: Fix propagation of setters and getters from prototypes
If we define a property with just a setter/getter (not both) we must:
- take the previous getter/setter if defined on the actual object
- overwrite the other to nullptr if it is from a prototype
2021-06-26 18:16:53 +01:00
davidot b1441a47b1 LibJS: Allow setting the length of an object with prototype Array
Before this it would always go through the native setter thus
 modifying the array but now you can set length to anything
2021-06-26 18:16:53 +01:00
davidot b38fb418f8 LibJS: Don't remove non-configurable items in Array when setting length 2021-06-26 18:16:53 +01:00
davidot c7aaf40a35 LibJS: Make Array.prototype.lastIndexOf slightly more spec compliant 2021-06-26 18:16:53 +01:00
Sahan Fernando 44174a44bd Meta: Use virtio-vga instead of virtio-gpu if using multiple monitors 2021-06-26 18:45:35 +02:00
Idan Horowitz 5b909a94e7 Toolchain: Build the x86_64 target in addition to i386 in BuildQemu.sh 2021-06-26 17:59:54 +02:00
Andreas Kling 9683b10aec LibJS: Make sure this in the global environment is the global object
Fixes regressed with 0f9038b732.
2021-06-26 17:06:36 +02:00