Commit graph

8376 commits

Author SHA1 Message Date
Andreas Kling 26a8984d03 AK: Inline Optional functions more aggressively
This turns into much less code in the most common cases, here's why:
The normal Optional usage pattern is something like:

    auto foo = get_me_an_optional();
    if (foo.has_value())
        do_stuff_with(foo.value());

In this typical scenario, we check has_value() before calling value().
Without inlining, value() will double-check has_value() itself and
assert if it fails. Inlining allows the compiler to optimize all of
this away.
2020-04-12 20:37:51 +02:00
Andreas Kling c84b8e597a LibC: Cache the result of gettid() to avoid syscalls
We now use minherit(MAP_INHERIT_ZERO) to create a gettid() cache that
is automatically invalidated on fork(). This is needed since the TID
will be different in a forked child, and so we can't have a stale
cached TID lying around.

This is a gigantic speedup for LibJS (and everyone else too) :^)
2020-04-12 20:24:34 +02:00
Andreas Kling c19b56dc99 Kernel+LibC: Add minherit() and MAP_INHERIT_ZERO
This patch adds the minherit() syscall originally invented by OpenBSD.
Only the MAP_INHERIT_ZERO mode is supported for now. If set on an mmap
region, that region will be zeroed out on fork().
2020-04-12 20:22:26 +02:00
Andreas Kling dd00175ae2 LibWeb: Use an AffineTransform for CanvasRenderingContext2D :^)
This will allow us to support complex 2D transforms.
2020-04-12 19:23:39 +02:00
Andreas Kling 6f2c63000d LibGfx: Add a basic AffineTransform class
We can now perform some basic 2D transforms through an affine matrix.
This patch adds translate() and scale() :^)
2020-04-12 19:23:39 +02:00
Andreas Kling 3bbc2c7300 AK: Add LogStream operator<< overloads for float and double 2020-04-12 19:23:39 +02:00
Andreas Kling 5c780c9ef7 LibGfx: Allow constructing Float{Rect,Point,Size} from integer buddies 2020-04-12 19:23:39 +02:00
Linus Groh dd7796515f LibJS: Add console.{debug,info,warn,error}() 2020-04-12 18:42:42 +02:00
Hüseyin ASLITÜRK b1e8cc22bd QuickShow: Small code edits to fit standards 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK 70873fdf02 QuickShow: Toolbar for who love to use mouse 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK 6c1af174a1 QuickShow: Add Delete action
Delete current file from file system.
2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK f88ceb872a QuickShow: Use Core::ArgsParser to handle parameters 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK e0bf57d81f QuickShow: Add Fullscreen, Zoom options to View menu 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK d79c81a179 QuickShow: Rotate image left and right, flip vertical and horizontal 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK 2689fdf1d8 QuickShow: Browse the files in the same folder 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK 74a8e3fe1c Base: Add go-first, go-last, zoom-in, zoom-out icons 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK 8e9d031cb3 LibGfx: Add Bitmap::rotated and Bitmap::flipped 2020-04-12 18:08:11 +02:00
Hüseyin ASLITÜRK c6944f8cc2 LibGUI: Use parrent window icon for MessageBox dialog icon 2020-04-12 18:08:11 +02:00
Andreas Kling 264726b2d6 ProfileViewer: Switching to percent mode should take effect immediately 2020-04-12 15:23:24 +02:00
Andreas Kling 235ae80e5e LibGUI: Make TableView ignore custom colors for selected rows
This allows them to look selected instead.
2020-04-12 15:23:24 +02:00
Linus Groh 97de93eed1 LibJS: Add js_negative_infinity()
Value(-js_infinity().as_double()) is kind of awkward.
2020-04-12 14:39:38 +02:00
Linus Groh f226746394 LibJS: Handle Infinity in Value::to_number() 2020-04-12 14:39:38 +02:00
Andreas Kling 477bacddad ProfileViewer: Symbolicate the disassembled instructions
Instead of "call 0x0811d6ac", we now say "call 0x0811d6ac <malloc>" :^)
2020-04-12 14:20:04 +02:00
Andreas Kling e880e4c2d2 LibX86: Add a way for Instruction::to_string() to symbolicate addresses
This patch adds a pure virtual X86::SymbolProvider that can be passed
to Instruction::to_string(). If the instruction contains what appears
to be a program address, stringification will try to symbolicate that
address via the SymbolProvider.

This makes it possible (and very flexible) to add symbolication to
clients of the disassembler. :^)
2020-04-12 14:20:04 +02:00
Andreas Kling 5390d53a80 LibGUI: Remove debug spam in AbstractView::did_update_model() 2020-04-12 14:20:04 +02:00
Andreas Kling 8e4751a963 LibGUI: Add a way for models to update without invalidating indexes
This is really just a workaround to keep SystemMonitor's process table
working right wrt selection retention during resorts (while also doing
full index invalidation on things like ProfileViewer inversion.)

It's starting to feel like the model abstraction is not super great
and we'll need a better approach if we want to actually build some more
dynamic functionality into our views.
2020-04-12 12:03:33 +02:00
Andreas Kling 93f2a4edd3 Kernel: Bump the max stack frame count in sample profiles to 50
Maybe this should be configurable, who knows. For now, 50 works a bit
better for highly nested scenarios like LibJS.
2020-04-12 11:00:38 +02:00
Andreas Kling ff33c5b286 LibJS: Let's show a few more decimals when stringifying numeric values
I'm not sure what the correct behavior is supposed to be, but at least
this makes printing numbers show some more interesting detail for now.
2020-04-12 10:59:29 +02:00
Andreas Kling c596ef3c0e ProfileViewer: Put the tree and disasembly views in a vertical splitter 2020-04-12 10:57:44 +02:00
Brendan Coles 2d699cd5da LibWeb: Add port blacklist for ResourceLoader::load
`ResourceLoader::load` now rejects URLs which specify a `port`
associated with network services known to be vulnerable to
inter-protocol exploitation.

Fixes #1735
2020-04-12 10:33:35 +02:00
Linus Groh c8d0a2eb3c AK: Parse query and fragment in URL::parse() 2020-04-12 01:18:39 +02:00
Linus Groh 21a61b276b AK: Support fragment in URL 2020-04-12 01:18:39 +02:00
Peter Nelson eff27f39d5
Kernel: Store previous thread state upon all transitions to Stopped (#1753)
We now store the previous thread state in m_stop_state for all
transitions to the Stopped state via Thread::set_state.

Fixes #1752 whereupon resuming a thread that was stopped with SIGTSTP,
the previous state of the thread is not remembered correctly, resulting
in m_stop_state == State::Invalid and the associated assertion fails.
2020-04-11 23:39:46 +02:00
Andreas Kling 8aab8faf30 ProfileViewer: Open /boot/kernel for disassembly if possible
If you have access to /boot/kernel, you can see the disassembly of
kernel code in ProfileViewer. This is really useful! :^)
2020-04-11 23:37:11 +02:00
Andreas Kling 34d07e35bd LibX86: Decode RDRAND instruction
I was looking at Kernel::get_good_random_bytes() and wondering where
the RDRAND instruction was. :^)
2020-04-11 23:37:00 +02:00
Andreas Kling dccfff8c19 ProfileViewer: Don't crash when we can't disassemble something 2020-04-11 23:15:33 +02:00
Andreas Kling 8daddcfa0a LibX86: Fix duplicate '+' in SIB byte disassembly
For SIB bytes with base but no index, we were emitting two '+' chars
which looked very off.
2020-04-11 23:11:10 +02:00
Andreas Kling 8ef9c272b6 Browser: Accept file:// URLs on the command line
This could be a lot nicer, but at least we can open file:// URLs now.
2020-04-11 23:11:10 +02:00
Andreas Kling b1555381ee AK: Recompute URL validity after changing protocol/host/path
This allows you to build URLs by calling setters on an empty URL and
actually get a valid URL at the end.
2020-04-11 23:11:10 +02:00
Andrew Kaster 827e375297 LibELF: Validate the mapped file in DynamicLoader constructor
ELF::DynamicLoader now validates the ELF header and the program headers
in its constructor. The requested program interpreter from the
PT_INTERP program header is now avaiable via a getter. The dynamic
loader program will want to check that this matches its name, for extra
shenanigans checking.
2020-04-11 22:41:05 +02:00
Andrew Kaster 61acca223f LibELF: Move validation methods to their own file
These validate_elf_* methods really had no business being static
methods of ELF::Image. Now that the ELF namespace exists, it makes
sense to just move them to be free functions in the namespace.
2020-04-11 22:41:05 +02:00
Andrew Kaster 21b5909dc6 LibELF: Move ELF classes into namespace ELF
This is for consistency with other namespace changes that were made
a while back to the other libraries :)
2020-04-11 22:41:05 +02:00
Brendan Coles 6b0f47683c LibWeb: Prevent http:// URLs loading scripts sourced from file:// URLs
Fixes #1616
2020-04-11 21:10:50 +02:00
Andreas Kling 17b8857dc0 LibVT: Shift+Tab should generate ESC[Z
Fixes #1751.
2020-04-11 21:09:47 +02:00
Andreas Kling 8dd96ad143 ProfileViewer: Color code the instruction rows by sample percentage
We now "heat color" the instruction-level samples so you can get a nice
visual picture of where time is spent in functions. :^)
2020-04-11 21:04:45 +02:00
Andreas Kling a4006e19d7 ProfileViewer: Don't skip the innermost frame when loading profiles
We were skipping the innermost frame as a workaround for the kernel
putting garbage data there. Now that the kernel puts the instruction
poiner there, we can load the frame normally! :^)
2020-04-11 21:04:45 +02:00
Andreas Kling b7ff3b5ad1 Kernel: Include the current instruction pointer in profile samples
We were missing the innermost instruction pointer when sampling.
This makes the instruction-level profile info a lot cooler! :^)
2020-04-11 21:04:45 +02:00
Linus Groh c106451daf LibLine: Cycle backward through suggestions using Shift+Tab 2020-04-11 20:42:17 +02:00
Andrew Kaster f809231718 LibELF: Return false instead of assert on unrecognized program header 2020-04-11 19:32:28 +02:00
Andreas Kling c199b0e1aa LibGUI: Fill whole TableView cells with custom background color
This was easier than I expected. :^)
2020-04-11 19:20:40 +02:00