Commit graph

22614 commits

Author SHA1 Message Date
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
Andreas Kling 49018553d3 LibJS+LibCrypto: Allow '_' as a numeric literal separator :^)
This patch adds support for the NumericLiteralSeparator concept from
the ECMAScript grammar.
2021-06-26 16:30:35 +02:00
Andreas Kling 527c639c1f LibJS: Fix spelling mistake in one of the syntax error descriptions 2021-06-26 16:25:11 +02:00
Idan Horowitz f3197faf39 CI: Increase the on-target tests timeout to 60 minutes from 30 minutes
This should help reduce the random test failures due to timeouts on
slower github actions runners.
2021-06-26 13:41:58 +01:00
Luke a1f3e711c0 LibJS: Add %TypedArray%.prototype.entries 2021-06-26 13:32:53 +01:00
Luke a6324481e1 LibJS: Add %TypedArray%.prototype.values 2021-06-26 13:32:53 +01:00
Luke fb43b778ab LibJS: Add %TypedArray%.prototype.keys 2021-06-26 13:32:53 +01:00
Luke 293974c1cb LibJS: Add TypedArray support to ArrayIterator
ArrayIteratorPrototype::next seems to implement CreateArrayIterator,
which is an issue for a separate PR.
2021-06-26 13:32:53 +01:00
Gunnar Beutner 787f80d114 Kernel: Specify -fno-pic when using -mcmodel=large
According to the gcc man page these are mutually exclusive and did
in fact cause problems when trying to get the address for asm labels
on x86_64.
2021-06-26 11:08:52 +02:00
Gunnar Beutner b9f6b40651 Kernel: Clean up create_signal_trampoline a bit
The types for asm_signal_trampoline and asm_signal_trampoline_end
were incorrect. They both point into the text segment but they're
not really functions.
2021-06-26 11:08:52 +02:00
Gunnar Beutner 389bf82889 Kernel: Add CPUID flag for long mode
This isn't particularly useful because by the time we've entered
init() the CPU had better support x86_64 anyway. However this shows the
CPU flag in System Monitor - even in 32-bit mode.
2021-06-26 11:08:52 +02:00
Gunnar Beutner 409b874514 Kernel: Ensure that the ProcessBase class is properly laid out on x86_64
Without this the ProcessBase class is placed into the padding for the
ProtectedProcessBase class which then causes the members of the
RefCounted class to end up without the first 4096 bytes of the Process
class:

BP 1, Kernel::Process::protect_data (this=this@entry=0xc063b000)
205     {
(gdb) p &m_ref_count
$1 = (AK::Atomic<unsigned int, (AK::MemoryOrder)5> *) 0xc063bffc

Note how the difference between 'this' and &m_ref_count is less than
4096.
2021-06-26 11:08:52 +02:00
Gunnar Beutner 9077c64d37 Kernel: Correct spelling mistake 2021-06-26 11:08:52 +02:00
Gunnar Beutner 078eeb7bb0 Kernel: Make addresses returned by kmalloc() properly aligned for x86_64 2021-06-26 11:08:52 +02:00
Gunnar Beutner 1e20dd2a45 Kernel: Add PML4T support for the PageDirectory class 2021-06-26 11:08:52 +02:00
Gunnar Beutner f5cd366006 Kernel: Fix memcpy and memset for x86_64
Those size_ts sure are growing up fast.
2021-06-26 11:08:52 +02:00
Gunnar Beutner c4acfdc0fb Kernel: Add slab allocator for 256 bytes
Our types are getting a tiny bit larger for x86_64 so we need another
slab allocator to deal with that.
2021-06-26 11:08:52 +02:00
Gunnar Beutner e52051903b Kernel: Fix off-by-one error in Processor::write_raw_gdt_entry 2021-06-26 11:08:52 +02:00
Gunnar Beutner f630299d49 Kernel: Add support for setting up a x86_64 GDT once in C++ land 2021-06-26 11:08:52 +02:00
Gunnar Beutner 29d9666e02 Kernel: Fix GDT limits
The GDT limits are inclusive, so for correctness we should subtract
one from the structs' size.
2021-06-26 11:08:52 +02:00
Andreas Kling ee4fc97038 LibJS: Align ObjectEnvironmentRecord member names with the spec
In the spec, object environments have a [[BindingObject]], so let's
call it the same thing in our implementation.
2021-06-26 10:39:16 +02:00
Andreas Kling 0f9038b732 LibJS: Remove unnecessary GlobalObject& member on global environment
We already store the GlobalObject& in a base class, so no need to also
store it in the subclass. :^)
2021-06-26 10:34:55 +02:00
Andreas Kling 6d7d8f3db9 LibJS: Create new object earlier in VM::construct()
Also make use of OrdinaryCreateFromConstructor() instead of setting
the prototype manually.

This fixes 2 function tests in test262. :^)
2021-06-26 00:04:54 +02:00
Tom 8fe52b8306 Meta: Force relative mouse coordinates with multiple screens
QEMU appears to always relay absolute mouse coordinates relative to the
screen that the mouse is pointed to, without any way for us to know
what screen it was. So, when dealing with multiple displays force using
relative coordinates only.
2021-06-25 23:54:37 +02:00
Linus Groh a59ba0e21f LibJS: Change PropertyName(i32) => template<Integral T> PropertyName(T)
Negative numeric properties are not a thing (and we even VERIFY()'d this
in the constructor). It still allows using types with a negative range
for now as we have various places using int for example (without
actually needing the negative range, but that's a different story).

u32 is the internal type of `m_number` already, so this now allows us to
leverage the full u32 range for numeric properties.
2021-06-25 22:01:23 +01:00
Linus Groh f4867572b7 LibJS: Change PropertyName(Symbol*) => PropertyName(Symbol&)
Requires a bunch of find-and-replace updates across LibJS, but
constructing a PropertyName from a nullptr Symbol* should not be
possible - let's enforce this at the compiler level instead of using
VERIFY() (and already dereference Symbol pointers at the call site).
2021-06-25 22:01:23 +01:00
Tom 3d5340d033 Meta: Add SERENITY_SCREENS environment variable
This allows specifying how many screens we should use. This also then
only enables virtio-gpu if more than one display is requested.

This also adds an environment variable SERENITY_QEMU_DISPLAY_BACKEND
which allows overriding the default qemu display backend, as it may
not be available.
2021-06-25 22:20:55 +02:00
Andreas Kling d436d6d565 LibJS: Rename ScriptFunction::m_parent_scope => m_environment
This is for the [[Environment]] slot so let's have a matching name. :^)
2021-06-25 21:22:37 +02:00
Andreas Kling 667bba2410 LibJS: Add the Function.[[ThisMode]] field
This is not a behavioral change in itself, just prep work for future
spec-compliance changes.
2021-06-25 21:15:04 +02:00
Andreas Kling b650d11dd3 LibJS: FunctionEnvironment.[[FunctionObject]] is the *invoked* function
We were setting the wrong [[FunctionObject]] on the environment when
going through ProxyObject and BoundFunction.
2021-06-25 20:38:43 +02:00