Commit graph

22107 commits

Author SHA1 Message Date
Gunnar Beutner 1fb4471506 LibRegex: Use a plain array to store opcodes
Using a hash map is unnecessary because the number of opcodes and their
IDs never change.
2021-06-14 16:09:58 +04:30
Pavel Safar c38f051bf7 Ports: Adds Another World VM interpreter implementation 2021-06-14 12:19:54 +01:00
Andreas Kling b07b890ce4 Meta: Request that new contributors don't start with new app/lib
It's strongly preferred that new contributors get comfortable with the
system and the project by working on smaller and/or existing things
before adding entirely new components to it.
2021-06-14 12:57:35 +02:00
Andreas Kling add3d6e9d7 LibGfx: Inline BitmapFont::glyph_or_emoji_width() for fixed-width fonts 2021-06-14 11:26:12 +02:00
Andreas Kling 6e0e8a8242 LibJS: Teach Reference to access call frame arguments directly 2021-06-14 11:26:12 +02:00
Andreas Kling 91fbeeab72 LibJS: Add LoadArgument bytecode instruction for fast argument access
This is generated for Identifier nodes that represent a function
argument variable. It loads a given argument index from the current
call frame into the accumulator.
2021-06-14 11:26:12 +02:00
Andreas Kling 848944113c LibJS: Access function arguments directly in AST interpreter
Instead of doing a generic scoped variable lookup, function arguments
now go directly to the call frame arguments list.

This is a huge speedup on everything that uses arguments. :^)
2021-06-14 11:26:12 +02:00
Andreas Kling a733a30373 LibJS: Write computed function default arguments into the call frame
Previously, default argument values would only show up when accessing
the argument by parameter name. This patch makes us write them back
into the call frame so they can be accessed via VM::argument() as well.
2021-06-14 11:26:12 +02:00
Andreas Kling 481cef59b6 LibJS: Track which Identifier nodes refer to function arguments
This patch adds an "argument index" field to Identifier AST nodes.
If the Identifier refers to a function parameter in the currently
open function scope, we stash the index of the parameter here.

This will allow us to implement much faster direct access to function
argument variables.
2021-06-14 11:26:12 +02:00
davidot ae8b55a80a LibJS: Add additional generic Array.prototype.slice tests 2021-06-14 09:57:06 +01:00
davidot fc1168a3b3 LibJS: Add Array.prototype.@@unscopables 2021-06-14 09:57:06 +01:00
davidot 2d87d5dab9 LibJS: Make Array.prototype.at return undefined on empty slot 2021-06-14 09:57:06 +01:00
davidot 6c13cc67c6 LibJS: Implement Array.prototype.copyWithin generically 2021-06-14 09:57:06 +01:00
davidot 417f752306 LibJS: Implement Array.prototype.entries 2021-06-14 09:57:06 +01:00
davidot 910b803d8d LibJS: Implement Array.prototype.flatMap
Also made recursive_array_flat more compliant with the spec
So renamed it to flatten_into_array
2021-06-14 09:57:06 +01:00
davidot 4152409ac5 LibJS: Make Array.prototype.concat generic 2021-06-14 09:57:06 +01:00
davidot 2ef9df989f LibJS: Make Array.prototype.reverse generic 2021-06-14 09:57:06 +01:00
davidot 516f6240e8 LibJS: Add additional Array.prototype.reverse tests 2021-06-14 09:57:06 +01:00
davidot d723c01af7 LibJS: Make Array.prototype.unshift generic 2021-06-14 09:57:06 +01:00
davidot 7c1e2adf8a LibJS: Make Array.prototype.shift generic 2021-06-14 09:57:06 +01:00
Idan Horowitz 690eb3bb8a LibJS: Add support for hex, octal & binary big integer literals 2021-06-14 01:45:04 +01:00
Idan Horowitz 2ad2e055e2 LibCrypto: Add {Signed,Unsigned}BigInteger::from_base{2, 8, 16} helpers
These can be used to create BigInteger instances from non-decimal
number strings.
2021-06-14 01:45:04 +01:00
Idan Horowitz e4e6e03364 LibJS: Add tests for DataView.prototype getters and setters 2021-06-14 01:45:04 +01:00
Idan Horowitz d7a70eb77c LibJS: Add all of the DataView.prototype.set* methods 2021-06-14 01:45:04 +01:00
Idan Horowitz c54b9a6920 LibJS: Add all of the DataView.prototype.get* methods 2021-06-14 01:45:04 +01:00
Idan Horowitz e4d267d4fb LibJS: Add the DataView built-in object 2021-06-14 01:45:04 +01:00
Linus Groh 5b2255291e LibJS: Make a couple of %TypedArray%.prototype properties accessors
Also use JS_DEFINE_NATIVE_GETTER and not JS_DEFINE_NATIVE_FUNCTION for
their function definitions.
2021-06-13 21:33:41 +01:00
Linus Groh 5c1af1d6f7 LibJS: Make Symbol.prototype.description an accessor 2021-06-13 21:33:41 +01:00
Linus Groh b121837898 LibJS: Make Set.prototype.size an accessor
Also fix its attributes, should be just configurable.
2021-06-13 21:33:41 +01:00
Linus Groh 3ed5a0c68d LibJS: Make a couple of RegExp.prototype properties accessors 2021-06-13 21:33:41 +01:00
Linus Groh 83d3175b13 LibJS: Make ArrayBuffer.prototype.byteLength an accessor 2021-06-13 21:33:41 +01:00
Linus Groh c6c0c6a61a LibJS: Add two missing missing ECMA-262 section/title/URL comments 2021-06-13 21:33:41 +01:00
Linus Groh 4f6aa38434 LibJS: Don't repeat attributes in {Boolean,Symbol}Prototype 2021-06-13 21:33:41 +01:00
Andreas Kling 3ed6a3fea8 Calculator: Fix offensive button misalignment
The UI of this application is still quite bad/uneven, but this at
least fixes the most egregious button misalignment.
2021-06-13 21:48:15 +02:00
Andreas Kling 7d90455fad Browser: Fix build breakage from 29cce65 2021-06-13 21:22:11 +02:00
Jelle Raaijmakers 30abfc2b21 Kernel: Pass absolute path to shebang interpreter
When you invoke a binary with a shebang line, the `execve` syscall
makes sure to pass along command line arguments to the shebang
interpreter including the path to the binary to execute.

This does not work well when the binary lives in $PATH. For example,
given this script living in `/usr/local/bin/my-script`:

  #!/bin/my-interpreter
  echo "well hello friends"

When executing it as `my-script` from outside `/usr/local/bin/`, it is
executed as `/bin/my-interpreter my-script`. To make sure that the
interpreter can find the binary to execute, we need to replace the
first argument with an absolute path to the binary, so that the
resulting command is:

  /bin/my-interpreter /usr/local/bin/my-script
2021-06-13 21:19:51 +02:00
Jelle Raaijmakers 26250779d1 Kernel: Also move() the shebang path in execve 2021-06-13 21:19:51 +02:00
Marcus Nilsson 4faff69974 Browser: Add download finished graphics to download widget
Not the prettiest, but visually indicates that the download has finished
successfully.
2021-06-13 20:55:58 +02:00
Marcus Nilsson 29cce65d2f Browser: Add close on finished checkbox to download widget
Let the user choose if they want the download widget to close when
finished, also save the users choice for future downloads.
2021-06-13 20:55:58 +02:00
Max Trussell b4da228ea5
LibGUI: Make "Return" after tab return to original column in TableView 2021-06-13 19:46:08 +01:00
Sam Atkins 364d728e66 Solitaire: Disable filling with background color during end animation
This fixes #7792.

The visual glitches with card corners, and the screen-clear when
opening a menu, were both caused by the widgets having
`fill_with_background_color` set. We need that set most of the time,
so we just disable it for the duration of the game-over animation.

Also resove a FIXME that no longer applies. :^)
2021-06-13 19:29:52 +01:00
Sam Atkins 679f831451 Solitaire: Only start timer when a move happens
Previously, the timer started if you clicked within the game area,
whether that was on a card or not. Now, we only start when you click
on a card or otherwise attempt a move.

As a bonus, we now immediately update the status bar time indicator
on game start, instead of having to wait until 1 second has elapsed.
2021-06-13 19:29:52 +01:00
Sam Atkins 8ee447b718 Solitaire: Prevent undo when the game is over 2021-06-13 19:29:52 +01:00
Sam Atkins cf504ccc6a Solitaire: Allow automatic moves to end the game and animate
Previously, if a tab-move moved all the remaining cards to the
foundations, the game would not notice until you moved a card
away and then back again.

I had to add a 1-frame delay to starting the animation, so that it
would have time to re-paint the foundation in that case.
2021-06-13 19:29:52 +01:00
Andreas Kling 5eef07d232 LibJS: Avoid lots of string-to-int during global object construction
We were doing a *lot* of string-to-int conversion while creating a new
global object. This happened because Object::put() would try to convert
the property name (string) to an integer to see if it refers to an
indexed property.

Sidestep this issue by using PropertyName for the CommonPropertyNames
struct on VM (vm.names.foo), and giving PropertyName a flag that tells
us whether it's a string that *may be* a number.

All CommonPropertyNames are set up so they are known to not be numbers.
2021-06-13 19:11:29 +02:00
Andreas Kling 53a8a11973 LibJS: Make StringOrSymbol always be FlyString in the string case
This makes equality checking O(1) instead of O(n).
2021-06-13 19:11:29 +02:00
Andreas Kling cd12b182ca AK: Add FlyString::from_fly_impl()
This allows you to create a FlyString directly from a known-fly
StringImpl instance.
2021-06-13 19:11:29 +02:00
Andreas Kling 240d2f88d3 LibJS: Convert PropertyName and StringOrSymbol to east-const style 2021-06-13 19:11:29 +02:00
Andreas Kling b458090d14 LibJS: Don't generate unused HeapBlock names on non-SerenityOS systems
These are just ignored by the BlockAllocator anyway.
2021-06-13 19:11:29 +02:00
Andreas Kling 095accd2b2 LibJS: Add a bunch of fast_is<T> to avoid slow RTTI in hot code 2021-06-13 19:11:29 +02:00