Commit graph

28629 commits

Author SHA1 Message Date
Andreas Kling 3c0b55c284 LibWeb: Add DOMRectReadOnly and make DOMRect inherit from it
This matches the class hierarchy of the CSS Geometry Interfaces Module.
2021-10-08 23:00:49 +02:00
Andreas Kling 77f72c7cfe AK: Always inline the RefCountedBase functions 2021-10-08 22:11:39 +02:00
Andreas Kling 2495460f6e LibJS: Prune WeakContainers before freeing HeapBlocks
WeakContainers need to look at the Cell::State bits to know if their
weak pointees got swept by garbage collection. So we must do this before
potentially freeing one or more HeapBlocks by notifying the allocator
that a block became empty.
2021-10-08 19:47:25 +02:00
Ali Mohammad Pur 13138811df LibJS: Partially revert 12b283f
This commit partially reverts "LibJS: Make accessing the current
function's arguments cheaper".
While the change passed all the currently passing test262 tests, it
seems to have _some_ flaw that silently breaks with some real-world
websites.
As the speedup with negligible at best, let's just revert it until we
can implement it more correctly.
2021-10-08 19:56:02 +03:30
Andreas Kling fa6c06ce8d LibJS: Elide some declarative environments in ECMAScript function calls
By spec, calling an ECMAScript function object in non-strict mode should
always create a new top-level declarative environment, even if there are
no lexically scoped bindings (let/const) that belong in it. This is
used for scope disambiguation in direct eval() calls.

However, if there are no direct eval() calls within the function, and no
lexically scoped bindings, we can simply not allocate the extra
environment and save ourselves the trouble.
2021-10-08 15:00:34 +02:00
Andreas Kling b2de563166 LibJS: Propagate "contains direct call to eval()" flag from parser
We now propagate this flag to FunctionDeclaration, and then also into
ECMAScriptFunctionObject.

This will be used to disable optimizations that aren't safe in the
presence of direct eval().
2021-10-08 12:43:38 +02:00
Ali Mohammad Pur 12b283f32f LibJS: Make accessing the current function's arguments cheaper
Instead of going through an environment record, make arguments of the
currently executing function generate references via the argument index,
which can later be resolved directly through the ExecutionContext.
2021-10-08 12:25:24 +02:00
Ali Mohammad Pur da296ffd56 LibJS: Treat the Catch binding identifier as a var binding 2021-10-08 12:25:24 +02:00
Ali Mohammad Pur 6ab6321c2f LibJS: Remove redundant const_cast
The accessed field is mutable, so there's no need for this const_cast.
2021-10-08 12:25:24 +02:00
Peter Elliott 39baadcddf AK: Calculate CircularQueue::end() correctly (for real this time)
Both my approach and the previous approach were wrong for different
cases. I've changed the Iterators index from storage-relative to
queue-relative, and it's much simpler and more obviously correct.

fixes #10383
2021-10-08 11:40:06 +02:00
Andreas Kling c27f91142d LibJS: Add ScopeNode accessors for declaration counts 2021-10-08 02:22:02 +02:00
Andreas Kling 7de2a84cd4 LibJS: Add missing initializer for ParserState::m_current_scope_pusher 2021-10-08 01:55:24 +02:00
Andreas Kling b00b461b31 LibJS: Pre-size a HashTable in function_declaration_instantiation()
The dynamic resizing of this hash table was showing up in profiles.
Since we have an idea of how big it will get, use ensure_capacity().
2021-10-08 01:32:12 +02:00
Andreas Kling 70e25deea3 LibJS: Avoid a FlyString copy in ECMAScriptFunctionObject 2021-10-08 01:31:39 +02:00
Andreas Kling 5a929f12bc LibWeb: Make sure that root of style updates is marked clean
The recursive style update function was written a bit strangely and
would only mark descendants of the style update root as not needing a
style update.

With this patch, all nodes in the subtree now have clean style after a
style update finishes.
2021-10-08 01:29:18 +02:00
Andreas Kling 13361bc47d LibWeb: Update style (if needed) before updating layout
Layout depends on style (and not the other way around), so if the
document has dirty style when we enter update_layout(), make sure we
call update_style() before proceeding with the layout work.

This has the pleasant effect of coalescing some redundant layouts.
2021-10-08 00:35:29 +02:00
Andreas Kling 23f4ff7247 LibJS: Make BlockAllocator cache reuse blocks in random order 2021-10-08 00:35:29 +02:00
Andreas Kling 17f239e1c0 LibJS: Increase GC heap BlockAllocator cache size
Let's accept keeping up to 8 MiB of HeapBlock memory cached. This allows
the GC allocator to reuse memory instead of asking the kernel for more.
2021-10-08 00:35:29 +02:00
Andreas Kling 527a6f4ded LibJS: Add fast_is<T>() for FunctionDeclaration 2021-10-08 00:35:29 +02:00
Andreas Kling 2bf3a263c5 CrashDaemon: Stop automatically compressing coredumps
This was a nice idea in theory, but in practice it makes big crashes
(e.g WebContent) even more CPU intensive. Let's disable this for now
(but keep the ability for CrashReporter to open compressed coredumps.)
2021-10-08 00:35:29 +02:00
Tim Schumacher 98e878ab3b Documentation: Fix one more path for GRUB netbooting 2021-10-07 23:00:14 +02:00
Tim Schumacher 9f56cf0698 Documentation: Install pxelinux into the root of TFTP
pxelinux doesn't appear to allow switching to the parent directory, and
absolute paths don't seem to work as expected either.
2021-10-07 23:00:14 +02:00
Tim Schumacher 2dcde51a74 Documentation: Update NetworkBoot to include Prekernel 2021-10-07 23:00:14 +02:00
Idan Horowitz 4174fe0156 Kernel: Use find_largest_not_above in VirtualRangeAllocator
Instead of iterating over the regions in the tree which is O(n), we can
just use RedBlackTree's find_largest_not_above method, which is O(logn)
2021-10-07 22:10:45 +02:00
Luke Wilde 49259777ef Kernel: Note if the page fault address is a destroyed smart pointer
While I was working on LibWeb, I got a page fault at 0xe0e0e0e4.
This indicates a destroyed RefPtr if compiled with SANITIZE_PTRS
defined. However, the page fault handler didn't print out this
indication.

This makes the page fault handler print out a note if the faulting
address looks like a recently destroyed RefPtr, OwnPtr, NonnullRefPtr,
NonnullOwnPtr, ThreadSafeRefPtr or ThreadSafeNonnullRefPtr. It will
only do this if SANITIZE_PTRS is defined, as smart pointers don't get
scrubbed without it being defined.
2021-10-07 21:30:13 +02:00
Idan Horowitz 350c5a751d ResourceGraph: Use /proc/stat instead of /proc/all for CPU usage stats
This results in a quite large speedup, as generating /proc/all takes a
very long time.
2021-10-07 21:09:38 +02:00
Idan Horowitz 399b5ffb64 Kernel: Add the /proc/stat ProcFS component
This exposes a small subset of the information exposed by the Linux
equivalent, and will be used to optimize applications that would like
to know the current CPU usage statistics, but don't want to read all of
the unrelated information in /proc/all
2021-10-07 21:09:38 +02:00
Idan Horowitz 900fac27c6 Kernel: Add Processor::time_spent_idle() 2021-10-07 21:09:38 +02:00
Idan Horowitz 9958277317 Meta: Disable -Wmaybe-uninitialized for Lagom 2021-10-07 21:56:03 +03:00
Andreas Kling e67155638c LibJS: Take advantage of Value::Type::Int32 in a bunch of functions
If a JS::Value has type Int32, we know it's a finite, 32-bit integer.
Use this information to avoid converting it to a double if possible.
2021-10-07 19:27:30 +02:00
Andreas Kling 5b1f697460 AK+Kernel: Make automatically locking RefPtr & co a kernel-only thing
Some time ago, automatic locking was added to the AK smart pointers to
paper over various race conditions in the kernel. Until we've actually
solved the issues in the kernel, we're stuck with the locking.

However, we don't need to punish single-threaded userspace programs with
the high cost of locking. This patch moves the thread-safe variants of
RefPtr, NonnullRefPtr, WeakPtr and RefCounted into Kernel/Library/.
2021-10-07 19:27:30 +02:00
Luke Wilde ca060d8566 Base: Use requestAnimationFrame in Game of Life WASM demo
Since OOPWV now supports RAF, we can use it in the GOL WASM demo :^)
2021-10-07 19:13:34 +02:00
Alex Major d4a0ecac31 PixelPaint: Close tab now prompts for a save 2021-10-07 18:35:56 +02:00
Nico Weber a7b558bf7d Meta: Warn on rebuild-toolchain i686 clang
It's "Clang" (capitalized). Silently building gcc if the toolchain
isn't know seems a bit unfriendly. So print a warning for this
(and for other unknown toolchains).
2021-10-07 18:34:13 +03:00
Luke Wilde eb774aadbf PixelPaint: Use reorderable tabs 2021-10-07 17:04:12 +02:00
Linus Groh ef004c6b98 LibJS: Use round_number_to_increment(double) in round_time()
Much nicer :^)
2021-10-07 13:00:24 +01:00
Linus Groh 8b07453bce LibJS: Add non-BigInt overload of round_number_to_increment()
Unlike the spec we chose BigInt for the input and output types here as
it was being used with ℝ(ns), ns being of type BigInt, in one place and
a conversion to double would not be safe.
Since in many places we'll have double input values, let's add a double
overload of this function to avoid awkward conversions and expensive
allocations.
2021-10-07 13:00:24 +01:00
Peter Elliott da804d95f7 Browser: Use reorderable tabs 2021-10-07 12:19:27 +02:00
Peter Elliott e1684860a3 LibGUI: Support drag-to-reorder in TabWidget 2021-10-07 12:19:27 +02:00
Andreas Kling df674023d6 LibJS: Add fast_is<T>() for FunctionExpression and ClassExpression
Spotted RTTI for these two above 1% in a profile.
2021-10-07 12:05:13 +02:00
Andreas Kling 41a072bded LibJS: Fast non-local variable access :^)
This patch introduces the "environment coordinate" concept, which
encodes the distance from a variable access to the binding it ends up
resolving to.

EnvironmentCoordinate has two fields:

    - hops:  The number of hops up the lexical environment chain we have
             to make before getting to the resolved binding.

    - index: The index of the resolved binding within its declarative
             environment record.

Whenever a variable lookup resolves somewhere inside a declarative
environment, we now cache the coordinates and reuse them in subsequent
lookups. This is achieved via a coordinate cache in JS::Identifier.

Note that non-strict direct eval() breaks this optimization and so it
will not be performed if the resolved environment has been permanently
screwed by eval().

This makes variable access *significantly* faster. :^)
2021-10-07 11:53:18 +02:00
Andreas Kling 421845b0cd LibJS: Taint variable environment chain after non-strict direct eval()
Since non-strict direct eval() can insert new bindings into a
surrounding var scope, we cannot safely cache some assumptions about
environment chain layout after eval() has taken place.

Since eval() is rare, let's do what other engines do and simply
deoptimize in its presence. This patch adds a new "permanently screwed"
flag to JS::Environment that will be set on the entire variable
environment chain upon non-strict direct eval().
2021-10-07 11:53:18 +02:00
Rodrigo Tobar 96a67d24e9 Strace: Add formatting for misc syscalls
These are exit, realpath and getrandom. This required a bit of extra
infrastructure to deal with exit's void return type.
2021-10-07 08:47:49 +03:30
Rodrigo Tobar 8125edfe79 Strace: Add formatting for main memory-related syscalls
These include mmap, munmap, mprotect and mmap_set_name.
2021-10-07 08:47:49 +03:30
Rodrigo Tobar 9394cfcaf3 Strace: Add formatting for main socket syscalls
The formatting of these functions is not complete, but gives already
very good information to the user.
2021-10-07 08:47:49 +03:30
Rodrigo Tobar a09b1879ca Strace: Add main infrastructure and formatting of main I/O operations
This commit introduces the main infrastructure used for turning register
values into user-facing values that can be printed by strace. This
includes the ability to copy data from a particular memory address in
the traced process. On top of this, (partial) formatting has been added
for the most common I/O operations (open, read, write, lseek, close,
stat, fstat).
2021-10-07 08:47:49 +03:30
Rodrigo Tobar f7a0196764 Strace: Move output formatting to separate function
Moving the formatting of strace's output into a separate function will
allow us to introduce more complexity into the formatting logic without
touching the main body of the program.

The new function uses a switch statement to select how to format the
arguments and result depending on the syscall. At this point we only
include the default formatting, where the registers are simply dumped,
but later on we can add specializations for each system call we want to
support.
2021-10-07 08:47:49 +03:30
Mart G 5f53dc6a45 SpaceAnalyzer: Fix rendering bug when dealing with large file systems 2021-10-07 08:46:15 +03:30
Ben Wiederhake c569ed7e8b LibWebSocket: Add missing headers to Message.h 2021-10-06 23:52:40 +01:00
Ben Wiederhake c602db1620 LibWeb: Add missing headers 2021-10-06 23:52:40 +01:00