Commit Graph

2086 Commits

Author SHA1 Message Date
Ali Mohammad Pur
477ab6dc4c LibWasm: Let the interpreter itself manage the call frame 2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
85794f8244 LibWasm: Add a copy assignment operator to Value 2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
c5df55a8a2 LibWasm: Make Interpreter a virtual interface
This allows multiply different kinds of interpreters to be used by the
runtime; currently a BytecodeInterpreter and a
DebuggerBytecodeInterpreter is provided.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
f91fa79fc5 LibWasm: Use the current configuration to run call ops
This should make it easier to implement multiple types of interpreters
on top of a configuration, and also give a small speed boost in not
initialising as many Stack objects.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
bc936a5fac LibWasm: Make Frame a value type as well
This means stack operations will no longer do extra allocations.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
73eb0785e0 LibWasm: Don't put values and labels in OwnPtrs
Doing that was causing a lot of malloc/free traffic, but since there's
no need to have a stable pointer to them, we can just store them by
value.
This makes execution significantly faster :^)
2021-05-27 17:28:41 +04:30
ry-sev
8146543a43 LibGUI+TextEditor: Add the calculation of selected words
This moves the calculation of selected words that was originally
in the TextEditor application to TextEditor in LibGUI.
This allows all applications with text editors to get
this number without having to calculating it themselves.
2021-05-27 09:05:39 +01:00
Andreas Kling
7a24a60e72 LibGUI: Paint some knurling in the middle of GUI::Splitter
This makes splitters stand out visually so you can actually spot them.
Before this, you had to guess/know where they were, which was weird.

The look of the knurling is the same as GUI::ResizeCorner, to build on
the established visual language.
2021-05-26 22:17:47 +02:00
Andreas Kling
89272e810a LibGUI: Have GUI::Splitter track all grabbable areas
Instead of computing the grabbable areas on the fly in mouse event
handlers, we now figure out which parts of the splitter are grabbable
when something moves around, and then remember it.

This makes the code a lot easier to follow.
2021-05-26 22:17:47 +02:00
Samuel Kelemen
49999006ef LibGfx: remove constexpr, add noexcept on interpolate method
This removes `constexpr` from the interpolate method in Color.h and adds
`noexcept`. The roundf call cannot be constexpr on clang. This is the
only incompatibility preventing serenity from building under clang. I
tested this on OSX Big Sur 11.3 and 11.3.1, and everything works with
this change.
2021-05-27 00:01:38 +04:30
Gunnar Beutner
971f4ca71c Hearts: Highlight cards when an invalid play is attempted
This briefly inverts the selected card when the user attempts to make
an invalid play.
2021-05-26 19:57:08 +02:00
Jelle Raaijmakers
2c772d1848 LibGUI/AbstractView: Remove on_selection
Since the introduction of multi-select, we have had both `on_selection`
and `on_selection_change`, the latter of which was only invoked when a
change in selection came in through the model.

This removes `AbstractView::on_selection` and replaces it usage with
the more explicit `on_selection_change` everywhere.
2021-05-26 17:39:13 +04:30
Jesse Buhagiar
ebe38639bc LibGL: Fix incorrect sign compare caused by GLsizei changes 2021-05-26 16:36:53 +04:30
Jesse Buhagiar
3287709df9 LibGL: Add texture sampling to SW Rasterizer
The software rasterizer now samples a texture passed to us from the
GL context. This is currently a bit of a hack, as we should be
scanning from a list of texture units and checking if they are
enabled. For now, this at least gives some visual confirmation
that texturing is working as it should
2021-05-26 16:36:53 +04:30
Jesse Buhagiar
e21ba0cd12 LibGL: Implement glTexCoord2f 2021-05-26 16:36:53 +04:30
Jesse Buhagiar
4f324ba4d7 LibGL: Implement Texture State Management
Some very primitive Texture State management. Data can now be
uploaded to textures.
2021-05-26 16:36:53 +04:30
Jesse Buhagiar
21dff6d40b LibGL: Add Texture Name Allocation
Texture names can now be allocated via
`glGenTextures` and deallocated via `glDeleteTextures`.
2021-05-26 16:36:53 +04:30
Jesse Buhagiar
8a69e6714e LibGL: Change GLsizei from unsigned to signed integral type
There is some really wild stuff going on in the OpenGL spec for this..
The Khronos website states that GLsizei is a 32-bit non-negative value
used for sizes, however, some functions such as `glGenTextures` state
that the input `n` could be negative, which implies signage. Most other
implementations of `gl.h` seem to `typedef` this to `int` so we should
too.
2021-05-26 16:36:53 +04:30
Ali Mohammad Pur
6af596d9e8 LibJS+LibWeb: Make Uint8ClampedArray use TypedArray
Instead of being its own separate unrelated class.
This automatically makes typed array properties available to it,
as well as making it available to the runtime.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
ba5da79617 LibWasm: Add execution hooks and a debugger mode to the wasm tool
This is useful for debugging *our* implementation of wasm :P
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
f740667fa1 LibCore: Add a standard error stream getter 2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
800bcb9965 LibWasm: Drop previous frame when a structured end instruction is run 2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
7966168fea LibWasm: Turn memory read failures into traps 2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
c31a4e9013 LibWasm: Once more fix structured instruction label indices
This finally works correctly. ™️
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
d05e5dbdcf LibWasm: Drop the correct number of frames
Prior to this commit, we would be dropping an extra frame.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
a21ebae652 LibWasm: Implement checked truncation instructions
This implements the 8 i<n>.truncate.f<n>_<s> instructions.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
cf8b75c2e5 LibWasm+LibWeb: Partially resolve memory exports
This allows the JS side to access the wasm memory, assuming it's
exported by the module.
This can be used to draw stuff on the wasm side and display them from
the js side, for example :^)
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
4a459d2430 LibWasm: Correct memory init size when instantiating
These limits are in units of page size, not bytes.
Also fixes incorrect debug logs.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
4fd43a8f96 LibJS: Allow ArrayBuffer to not own its backing data buffer as well
This is implemented as a ByteBuffer* in a variant, so its size should
only be increased by an index.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
3926eab3b7 LibWasm+LibWeb: Implement (a very basic version of) the JS link/import
This allows Wasm code to call javascript functions.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
a2af04837e LibWeb: Implement a very basic WebAssembly JS API
This impl is *extremely* simple, and is missing a lot of things, it's
also not particularly spec-compliant in some places, but it's definitely
a start :^)
2021-05-26 15:34:13 +04:30
Gunnar Beutner
dce97678ae LibCore: Handle partial writes in Socket::send()
Right now Socket::send() assumes that it can send everything in one
go. However, send() is allowed to do partial writes and while that
can't happen at the moment there's nothing that says this can't
happen in the future (like in the next commit).
2021-05-25 22:20:37 +02:00
Andreas Kling
6da481205b LibTest: Use fstatat() to speed up iterate_directory_recursively()
Employ the same technique as SpaceAnalyzer to avoid doing full path
resolution in the kernel over an over. Starting each path resolution
from the base of the directory iterator (using its fd) is significantly
faster and reduces test-js runtime by ~3%.
2021-05-25 20:53:59 +02:00
Andreas Kling
cfe3895991 LibJS: Fix broken dbgln_if(HEAP_DEBUG) 2021-05-25 19:44:32 +02:00
Andreas Kling
2de9139532 LibJS: Fix clang-tidy warnings about redundant types in Heap.cpp 2021-05-25 19:04:15 +02:00
Andreas Kling
679fc3066c LibJS: Fix clang-tidy warnings about unnecessary move()s in VM.cpp 2021-05-25 18:52:00 +02:00
Andreas Kling
47a4b2ba9f LibJS: Make Value::as_cell() return a Cell& 2021-05-25 18:48:11 +02:00
Andreas Kling
0de954e86b LibJS: Make Cell::Visitor::visit_impl() take a Cell&
Passing a null cell pointer is not supported.
2021-05-25 18:39:01 +02:00
Andreas Kling
789d20ebb7 LibJS: Replace Cell live bit with a cell state
So far we only have two states: Live and Dead. In the future, we can
add additional states to support incremental sweeping and/or multi-
stage cell destruction.
2021-05-25 18:37:37 +02:00
Andreas Kling
91656d63c7 LibJS: Inline Cell::Visitor::visit() functions
This allows the calls to MarkingVisitor::visit_impl() during GC to be
devirtualized in Heap::mark_live_cells().
2021-05-25 18:18:48 +02:00
Gunnar Beutner
c81b3e1ee3 LibC: Implement strerror_r()
This implements the XSI-compliant version of strerror_r() - as opposed
to the GNU-specific variant.

The function explicitly saves errno so as to not accidentally change it
with one of the calls to other functions.
2021-05-25 17:36:02 +02:00
Gunnar Beutner
3526fbbc5f LibC: Add definition for PRIxPTR 2021-05-25 17:36:02 +02:00
Tobias Christiansen
820224bb48 LibWeb: Match the :not pseudoclass
When a Selector features a :not() pseudoclass we now check whether the
current element matches with the given selector in the :not and act
accordingly.
2021-05-24 22:10:08 +01:00
Tobias Christiansen
1ab82afee6 LibWeb: Add :not pseudoclass to the CSS parser
The selector given in the :not() is stored in the SimpleSelector as a
String.
2021-05-24 22:10:08 +01:00
Matthew Olsson
78f3bad7e6 LibPDF: Pre-initialize common FlyStrings in CommonNames.h 2021-05-25 00:24:09 +04:30
Matthew Olsson
67b65dffa8 LibPDF: Handle string encodings
Strings can be encoded in either UTF16-BE or UTF8. In either case,
there are a few initial bytes which specify the encoding that must
be checked and also removed from the final string.
2021-05-25 00:24:09 +04:30
Matthew Olsson
a08922d2f6 LibPDF: Parse outline structures 2021-05-25 00:24:09 +04:30
Matthew Olsson
be6e4b6f3c LibPDF: Store indirect value refs in Value objects
IndirectValueRef is so simple that it can be stored directly in the
Value class instead of being heap allocated.

As the comment in Value says, however, in theory the max bits needed to
store is 48 (16 for the generation index and 32(?) for the object
index), but 32 should be good enough for now. We can increase it to u64
later if necessary.
2021-05-25 00:24:09 +04:30
Matthew Olsson
534a2e95d2 LibPDF: Add basic color space support to the renderer
This commit only supports the three most basic color spaces:
DeviceGray, DeviceRGB, and DeviceCMYK
2021-05-25 00:24:09 +04:30
Matthew Olsson
f4941f5940 LibGfx: Add Color::from_cmyk 2021-05-25 00:24:09 +04:30