Commit graph

13719 commits

Author SHA1 Message Date
Dano Perniš
d30c559774 AK: Implement HashTable assignment in terms of swap 2020-10-18 14:44:23 +02:00
Dano Perniš
7f3f63dd92 AK: Provide swap() for HashTable 2020-10-18 14:44:23 +02:00
Andreas Kling
af20b9424f Kernel: Unbreak /proc/interrupts when running with APIC
We can't assert here since these are exposed through /proc JSON.
2020-10-18 14:40:16 +02:00
Andreas Kling
c7a13b7a74 Kernel: Tweak strange PAGE_ROUND_UP(1) in APIC code 2020-10-18 14:18:38 +02:00
Andreas Kling
24162127ba LibWeb: Dispatch "load" on document and window
These happen right after "DOMContentLoaded" for now, which is incorrect
since they should really wait until subresources have loaded.
However, this makes a bunch of things work already so let's do it.
2020-10-18 13:45:28 +02:00
Andreas Kling
b71c1851b7 LibWeb: Dispatch "load" event on script elements 2020-10-18 13:44:20 +02:00
Andreas Kling
b92bc9c6e5 LibWeb: Make DOM::Window into an EventTarget
This will allow us to dispatch window events.
2020-10-18 13:43:44 +02:00
Andreas Kling
77c1957961 LibJS: Use allocate_without_global_object for allocating Shapes 2020-10-17 23:47:07 +02:00
Andreas Kling
d8269c343c LibJS: Avoid creating temporary Strings to look up tokens while lexing
It would be cool to solve this in a general way so that looking up
a string literal or StringView in a HashMap with String keys avoids
creating a temp string.

For now, this patch simply addresses the issue in JS::Lexer.
This is a 2-3% speed-up on test-js.
2020-10-17 23:44:41 +02:00
Andreas Kling
d3dfd55472 LibJS: Prebake the empty object ({}) with a prototype
Instead of performing a prototype transition for every new object we
create via {}, prebake the object returned by Object::create_empty()
with a shape with ObjectPrototype as the prototype.

We also prebake the shape for the object assigned to the "prototype"
property of new ScriptFunction objects, since those are extremely
common and that code broke from this change anyway.

This avoid a large number of transitions and is a small speed-up on
test-js.
2020-10-17 23:23:53 +02:00
Lenny Maiorani
919fc7a814 CircularQueue: Ensure constructor does not construct any values
Problem:
- There is no test which guarantees the CircularQueue does not
  construct any objects of the value type. The goal is to have
  uninitialized memory which can be used.

Solution:
- Add a test requiring that the constructor of the value type is never
  called.
2020-10-17 23:21:00 +02:00
asynts
c9ca897a45 LibCore: Use new format functions in some places. 2020-10-17 23:20:31 +02:00
asynts
43e37c7cde LibChess: Use new format functions. 2020-10-17 23:20:31 +02:00
asynts
805ed03b48 LibAudio: Use new format functions. 2020-10-17 23:20:31 +02:00
asynts
80e23d1b98 Games: Use new format functions. 2020-10-17 23:20:31 +02:00
asynts
56cf272ed5 LibCore: Add formatter for Object. 2020-10-17 23:20:31 +02:00
asynts
235622dc7f AK: Add formatters for NonnullOwnPtr and WeakPtr. 2020-10-17 23:20:31 +02:00
asynts
0508fdbbcd AK+Format: Add outln(FILE*, ...) overload.
This commit also removes a few functions like raw_out and vwarn. If we
want to write raw output, we can do this as follows:

    out("{}", "Hello, World!");

The vout stuff isn't really public API anyways, so no need for another
vwarn.
2020-10-17 23:20:31 +02:00
Lenny Maiorani
a274a8e5a0 BinarySearch: constexpr support
Problem:
- It is not possible to perform a binary search at compile-time
  because `binary_search` is not `constexpr`-aware.

Solution:
- Add `constexpr` support.
2020-10-17 23:19:37 +02:00
Nico Weber
0658051996 ntpquery: Add some more validation of the response header 2020-10-17 23:19:14 +02:00
Nico Weber
18d88e0eaa ntpquery: For stratum 1 servers, print reference ID in ASCII with -v 2020-10-17 23:19:14 +02:00
Nico Weber
4153a99ae1 LibCore: Make Object::m_all_objects_list_node private 2020-10-17 23:19:14 +02:00
Nico Weber
52e3a0f16c ntpquery: Add a comment listing a few more NTP servers 2020-10-17 23:19:14 +02:00
Nico Weber
5f50af3b4f ntpquery: Don't leak local time, and check origin time in reply
This implements the transmit time suggestion in (abandoned?)
draft-ietf-ntp-data-minimization. (The other suggestions were already
implemented as far as I can tell.)
2020-10-17 23:19:14 +02:00
Nico Weber
019788a150 ntpquery: Make a few variable names more descriptive 2020-10-17 23:19:14 +02:00
Tom
6fbced6f4f Kernel: Ensure PhysicalRegion free page hint is within valid range
Fixes #3770
2020-10-16 17:39:42 +02:00
Linus Groh
b98b83712f LibJS: constexpr some Number object constant values 2020-10-16 17:06:57 +02:00
Lenny Maiorani
4c759ff751 Span: constexpr support
Problem:
- `Span` is not `constexpr` aware.

Solution:
- Add `constexpr` support for all parts that do not require
  `reinterpret_cast`.
- Modify tests which use the `constexpr` functions.
2020-10-16 17:06:47 +02:00
Andreas Kling
2c956ac132 LibJS: Reorganize Shape members to reduce sizeof(Shape) a bit 2020-10-16 16:46:27 +02:00
Itamar
26b430bee7 Kernel: Fix sys$join_thread
Previously, when we unblocked because the joinee has died, we didn't
copy its exit value back to the user.
2020-10-16 11:42:20 +02:00
Andreas Kling
2c0e153396 LibJS: Don't bother deferring GC during ensure_property_table()
This is not actually necessary, since no GC allocations are made during
this process. If we ever make property tables into heap cells, we'd
have to rethink this.
2020-10-16 08:59:51 +02:00
Andreas Kling
7ad8bb5be6 AK: Tune HashTable load factor
Double the capacity when used+deleted buckets crosses 60% of capacity.
This appears to be a sweet spot for performance based on some ad-hoc
testing with test-js. :^)
2020-10-16 08:47:10 +02:00
BenJilks
afd52e2576 PixelPaint: Tool properties panel
Each tool can have its own set of properties that can be modified
through a panel on the right side.

The tools I've added properties for are:

Pen:
	Thickness

Brush:
	Size
	Hardness

Spray:
	Thickness
	Density

Bucket:
	Threshold
2020-10-16 00:03:53 +02:00
Andreas Kling
544f2f3c96 AK: Add some more checks to the HashMap test 2020-10-16 00:02:23 +02:00
Andreas Kling
4e50079f36 AK: Redesign HashTable to use closed hashing
Instead of each hash bucket being a SinglyLinkedList, switch to using
closed hashing (open addressing). Buckets are chained together via
double hashing (hashing the hash until we find an unused bucket.)

This greatly reduces malloc traffic, since each added element no longer
allocates a new linked list node.

Appears performance neutral on test-js. Can definitely be tuned and
could use proper management of load factor, etc.
2020-10-15 23:49:53 +02:00
Andreas Kling
4387590e65 LibJS: Support move semantics for StringOrSymbol
This allows us to rehash property tables without a bunch of ref count
churn happening.
2020-10-15 23:49:53 +02:00
Andreas Kling
1d96ecf148 Everywhere: Add missing <AK/TemporaryChange.h> includes
Don't rely on HashTable.h pulling this in.
2020-10-15 23:49:53 +02:00
Andreas Kling
76aab2fe8d AK: Improve HashMap tests a little bit 2020-10-15 23:49:53 +02:00
Linus Groh
20907780bd FileManager: Only set ~/Desktop as model root path in desktop mode
Setting it as model root path in DirectoryView::setup_model() for
windowed mode as well would cause an issue with the following:

- "open ~/Desktop"
- "FileManager ~/Desktop"
- "Show in FileManager..." from Desktop context menu

When viewing the Desktop as the initial path it would be the same and
on_path_change wasn't called, leading to various widgets and window
properties not being updated.

Fixes #3772.
2020-10-15 23:49:34 +02:00
Linus Groh
ac98a48177 LibWeb: Fix EventDispatcher::dispatch()
We were never wrapping and using the actual DOM::Event but instead
wrapped the *target* twice and passed it to the event listener callback,
as this value and as argument.

This unbreaks "fun demo" and "canvas path quadratic curve test" - and
event dispatching in general, of course :^)

Fixes #3721.
2020-10-15 20:40:35 +02:00
Matthew L. Curry
a45ba638a7 seq: Add help option
Added a help option to the seq command that gives usage information. Further,
when a user gives an incorrect argument, usage is supplied on stderr.
2020-10-15 13:48:42 +02:00
nooga
7b481a2c73 Userland: Add --loop option for aplay
A tiny feature, useful when listening to your favorite song.
2020-10-15 13:47:42 +02:00
Marcin Gasperowicz
3039c36836 AudioApplet: Make the slider exponential for finer volume control
The volume slider was linear, which is not ideal for an audio volume 
control. Perceived volume would not change much within 30-100% range
and would change in leaps within 0-30% range where the resolution is
not sufficient for fine grained control.

The simplest solution is to bring the value into 0.0-1.0 range and 
square it to obtain an exponential curve. This is a decent 
approximation of the logarithmic taper used in audio potentiometers.
2020-10-15 13:47:27 +02:00
Stephen Gregoratto
5245277369 LibC: Make difftime a function
The previous define led to issues when compiling some ports, namely zsh
5.8.
2020-10-15 13:45:00 +02:00
AnotherTest
9545ed1c21 LibGUI: Fix wrong Sequence highlight range in ShellSyntaxHighlighter
This fixes the wrong highlight behaviour when a newline is used as
sequence separator:
```sh
echo foo
if foo {}
^ This character would previously be bold
```
2020-10-14 21:05:39 +02:00
AnotherTest
b1b202124c Shell: Use Node::kind() instead of Node::class_name() in formatter 2020-10-14 21:05:39 +02:00
AnotherTest
738f512919 Shell: Respect input sources' blank lines between sequences
But collapse them to a single empty line.
This makes the generated sources look significantly better.
2020-10-14 21:05:39 +02:00
AnotherTest
cd48ec2abd Shell: Put a space after the match pattern expression when formatting 2020-10-14 21:05:39 +02:00
BenJilks
5f15fb17d9 PixelPaint: Basic brush tool
This patch adds a very basic implementation of the classic brush
tool. It features a wide brush with a falloff around the edges.
2020-10-14 20:36:40 +02:00
Andreas Kling
1208f3fd75 LibC: We still need to use NULL (not nullptr) in C headers
Thanks to @alimpfard for noticing this.
2020-10-14 13:57:51 +02:00