Commit Graph

22341 Commits

Author SHA1 Message Date
Linus Groh
df095afbcc LibJS: Implement the OrdinaryCreateFromConstructor() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
500818e73d LibJS: Implement the GetPrototypeFromConstructor() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
6312627218 LibJS: Implement the GetFunctionRealm() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
55db9539a5 LibJS: Introduce AbstractOperations.{cpp,h} and move various AOs there
Value.{cpp,h} has become a dumping ground, let's change that.

Things that are directly related to Values (e.g. bitwise/binary ops,
equality related functions) can remain, but everything else that's not a
Value or Object method and globally required (not just a static function
somewhere) is being moved.

Also convert to east-const while we're here.

I haven't touched IteratorOperations.{cpp,h}, it seems fine to still
have those separately.
2021-06-20 12:12:39 +02:00
Adam Hodgen
c03a3dc5b7 LaunchServer: Correctly open file URLs with line numbers
PR #5665 updated TextEditor to open files at a specific line/column
location using the file:line:col argument, rather than the -l flag.

This change updates LaunchServer to use that convention, though note it
does only pass the line number and not a column number, as per all
previous behaviour.
2021-06-20 12:07:55 +02:00
Tom
fb488e2b27 Kernel: Allow VGA-capable graphics adapters to exist with legacy VGA
If we have a VGA-capable graphics adapter that we support, we should
prefer it over any legacy VGA because we wouldn't use it in legacy VGA
mode in this case.

This solves the problem where we would only use the legacy VGA card
when both a legacy VGA card as well as a VGA-mode capable adapter is
present.
2021-06-20 12:07:06 +02:00
Mim Hufford
ddc855ffcd FlappyBug: Add cloud and sky graphics
We now have a nice sunset sky and some random cloud graphics.
The obstacles will get graphics at some point too :)
2021-06-20 10:54:27 +01:00
Mim Hufford
28e08f08c2 FlappyBug: Add new graphics and tweak colors
This adds some actual graphics to the game, and tweaks the obstacle and
sky colors. Eventually there will be graphics for those elements too.
2021-06-20 10:54:27 +01:00
Mim Hufford
f50003bdd2 FlappyBug: Add an input cooldown after game over
This makes sure the player doesn't accidentally start a new game after
they bump into an obstacle.
2021-06-20 10:54:27 +01:00
Mim Hufford
018344bb07 FlappyBug: Keep track of score and highscore
Better information is now shown to the player. Instructions are shown
when first loading the program, and any available scores are shown on
the game over screen.
2021-06-20 10:54:27 +01:00
Mim Hufford
3f603ab082 FlappyBug: Start obstacles off the screen
Previously obstacles were respawning fully on-screen which caused a
discontinuous look. Now they smoothly move into view from off-screen.
2021-06-20 10:54:27 +01:00
Mim Hufford
444fcfd0d2 FlappyBug: Make the obstacle gap position random
The position of the gap in the obstacle is now randomly generated each
time it spawns. The game is more fun to play now :)
2021-06-20 10:54:27 +01:00
Mim Hufford
811d9722f9 FlappyBug: Introduce a new Flappy Bug game
This introduces a Flappy Bug game. It's pretty simple currently, but is
playable.
2021-06-20 10:54:27 +01:00
Lenny Maiorani
24225df979 AK: Reimplement any_of in terms of find_if
Problem:
- Now that a generic free-function form of `find_if` is implemented
  the code in `any_of` is redundant.

Solution:
- Follow the "don't repeat yourself" mantra and make the code DRY by
  implementing `any_of` in terms of `find_if`.
2021-06-20 10:54:09 +01:00
Gunnar Beutner
25c73159ce LibCoreDump: Don't subtract one from the first stack frame's EIP
The first stack frame represents the current instruction pointer
rather than the return address so we shouldn't subtract one
from it.

Fixes #8162.
2021-06-20 10:19:02 +01:00
breakgimme
995594b403 Ports: Add libpng to dependencies of dosbox-staging 2021-06-20 01:50:20 +01:00
Linus Groh
34b338702a LibWasm: Remove empty AbstractMachine/Interpreter.cpp
This was moved to BytecodeInterpreter.cpp, so this is unused now.
2021-06-20 01:49:56 +01:00
Jan de Visser
87bd69559f LibSQL: Database layer
This patch implements the beginnings of a database API allowing for the
creation of tables, inserting rows in those tables, and retrieving those
rows.
2021-06-19 22:06:45 +02:00
Jan de Visser
267eb3b329 LibSQL: Hash index implementation for the SQL storage layer
This patch implements a basic hash index. It uses the extendible hashing
algorith. Also includes a test file.
2021-06-19 22:06:45 +02:00
Jan de Visser
224804b424 LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer
Unfortunately this patch is quite large.

The main functionality included are a BTree index implementation and
the Heap class which manages persistent storage.

Also included are a Key subclass of the Tuple class, which is a
specialization for index key tuples. This "dragged in" the Meta layer,
which has classes defining SQL objects like tables and indexes.
2021-06-19 22:06:45 +02:00
Jan de Visser
2a46529170 LibSQL: Basic dynamic value classes for SQL Storage layer
This patch adds the basic dynamic value classes used by the SQL Storage
layer. The most elementary class is Value, which holds a typed Value
which can be converted to standard C++ types. A Tuple is a collection
of Values described by a TupleDescriptor, which specifies the names,
types, and ordering of the elements in the Tuple.

Tuples and Values can be serialized and deserialized to and from
ByteBuffers. This is mechanism which is used to save them to disk.

Tuples are used as keys in SQL indexes and rows in SQL tables.

Also included is a test file.
2021-06-19 22:06:45 +02:00
Gunnar Beutner
a6ba05b02b LibSymbolication+Utilities: Show inlined functions for bt 2021-06-19 22:04:19 +02:00
Idan Horowitz
c31392510a LibJS: Add the Number.prototype.toFixed method 2021-06-19 16:13:59 +01:00
Idan Horowitz
5e53a690ac AK: Add support for keeping trailing zeros in fixed precision floats
This uses the same syntax as zero padding integers:
String::formatted("{:0.5}", 1.234) => "1.23400"
2021-06-19 16:13:59 +01:00
Peter Bocan
4d5ffd364a LibCrypto+LibTLS: Split and move test suite into Tests directory
This change splits test-crypto.cpp from Userland into separate test
suites located in Tests/ directory.
2021-06-19 19:05:36 +04:30
Itamar
3a4017b419 LibDebug: Convert LibDebug to east-const style 2021-06-19 14:51:18 +02:00
Itamar
03ef2a479a LibCoreDump: Include source locations of inlined functions in backtrace 2021-06-19 14:51:18 +02:00
Itamar
a45b5ccd96 LibDebug: Add DebugInfo::get_source_position_with_inlines
This function returns the source position of a given address in the
program. If that address exists in an inline chain, then it also returns
the source positions that are in the chain.
2021-06-19 14:51:18 +02:00
Itamar
835efa1b6a LibDebug: Add DwarfInfo::get_cached_die_at_offset
This function returns a DIE object from the cache with the given offset
in the debug_info section.
2021-06-19 14:51:18 +02:00
Itamar
fb31aae20d LibDebug:: Add DwarfInfo::get_die_at_address
This function returns the die object whose address range intersects
with the given address.

This function will also construct the DIE cache, if it hasn't been
constructed yet.
2021-06-19 14:51:18 +02:00
Itamar
92d4962d04 LibDebug: Add caches of DIE objects to DwarfInfo
There is one cache that indexes DIE objects by the start address of
their range, and another cache that indexes by their offset in the
debug_info section.

Both caches are implemented with RedBlackTree, and are optional - they
will only be populated if 'build_cached_dies' is invoked.
2021-06-19 14:51:18 +02:00
Itamar
a5f69efa5c LibDebug: Store optional parent_offset in Dwarf::DIE objects
In the current implementation, only DIE objects that are created via
DIE::for_each_child() will have parent offsets.

DIE objects that are created with CompilationUnit::get_die_at_offset()
do not currently store a parent offset.

We may improve this in the future, but this is enough for what we
currently need.
2021-06-19 14:51:18 +02:00
Itamar
84609aecc1 LibDebug: Add AttributeForm field to Dwarf::AttributeValue
In some contexts, it's helpful to also know the "Attribute Form",
in addition to the "Attribute Type".

An example for such context is the interpretation of the
"DW_AT_high_pc" attribute, which has different meaning if the form
is an address or a constant.
2021-06-19 14:51:18 +02:00
Itamar
a45ce0c6eb LibCoreDump: Use "eip - 1" when creating backtrace entries
We need to do this because the return address from a function frame is
the instruction that comes after the 'call' instruction.
2021-06-19 14:51:18 +02:00
Itamar
d26f4f9e8c AK: Add RedBlackTree::find_largest_not_above_iterator
It's a version of find_largest_not_above that returns an iterator.
2021-06-19 14:51:18 +02:00
Itamar
98a774a68d LibDebug: Add LineProgram::get_directory_and_file(size_t)
This function returns the directory path & filename for a given file
index.
2021-06-19 14:51:18 +02:00
Itamar
0d89f70b66 LibDebug: Move Dwarf::LineProgram into Dwarf::CompilationUnit
Previously, the LineProgram objects were short-lived, and only created
inside DebugInfo::prepare_lines() to create a vector of sorted LineInfo
data.

However, Dwarf::LineProgram also contains other useful data, such as
index-to-string mapping of source directories and filenames.

This commit makes each Dwarf::CompilationUnit own its
Dwarf::LineProgram.
DebugInfo::prepare_lines() then iterates over the compilation units to
prepare its sorted vector of lines.
2021-06-19 14:51:18 +02:00
Itamar
e9e4358a93 LibDebug: Store LibDebug objects on the heap & make them non-copyable
This fixes an issue were some LibDebug objects (for example,
Dwarf::CompilationUnit) held a reference to their parent
Dwarf::DwarfInfo object, which was constructed on the stack and later
moved to the heap.
2021-06-19 14:51:18 +02:00
Itamar
edd79ddd00 LibDebug: Move Dwarf::AttributeValue to a separate file 2021-06-19 14:51:18 +02:00
Itamar
fea9bb8c51 LibDebug: Move get_die_at_offset to Dwarf::CompilationUnit 2021-06-19 14:51:18 +02:00
Itamar
15b3957885 LibDebug: Remove unused DebugInfo::for_each_source_position 2021-06-19 14:51:18 +02:00
Itamar
68ff0788e5 LibDebug: Fix typo in DebugInfo::get_source_position 2021-06-19 14:51:18 +02:00
Gunnar Beutner
3c3a1726df Kernel: Make sure threads which don't do any syscalls are terminated
Steps to reproduce:

$ cat loop.c
int main() { for (;;); }
$ gcc -o loop loop.c
$ ./loop

Terminating this process wasn't previously possible because we only
checked whether the thread should be terminated on syscall exit.
2021-06-19 12:55:00 +02:00
Gunnar Beutner
c980a51776 Kernel: Make sure the kernel's ELF PHDRs don't use rwx
This doesn't really matter in terms of writability for the kernel text
because we set up proper page mappings anyway which prohibit writing
to the text segment. However, this makes the profiler happy which
previously died when validating the kernel's ELF program headers.
2021-06-19 12:54:33 +02:00
Andreas Kling
f86e241699 LibJS: Object.getOwnPropertyNames() should enumerate String's .length
We were incorrectly aborting property name enumeration after generating
names for all the indexable properties in the underlying string.
2021-06-19 11:46:08 +02:00
Andreas Kling
686213c2b8 LibJS: Make Object.getOwnPropertyDescriptor() work on String subscripts
String objects are a bit special since the indexed properties are
overridden by the contents of the underlying PrimitiveString.

getOwnPropertyDescriptor() was not taking this into account, and would
instead return undefined when asked about an indexed property in a
String object.
2021-06-19 11:34:19 +02:00
Matthew Olsson
25baefdd1e LibJS: Support object rest elements in the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
57b9a228ab LibJS: Support array rest elements in the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
7983324639 LibJS: Implement array destructuring for the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
14fff5df06 LibJS: Implement more IteratorOperations and organize file
Implemented IteratorComplete and IteratorValue, and sorted functions
based on their spec ordering.
2021-06-19 09:38:26 +02:00