summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2021-07-06LibJS: Fix runaway let scope when parsing for-in/of statementsHendi
This requires variables that should be exported to the script host or to other scripts to be declared as var (such as in test-common.js), since lexically-scoped variables won't be visible.
2021-07-06LibJS: Fix variable scoping issues in two testsHendi
2021-07-06LibJS: Improve function hoisting across blocksHendi
The parser now keeps track of a scope chain so that it can hoist function declarations to the closest function scope.
2021-07-06LibJS: Remove variables from FunctionNodeHendi
They weren't consumed anywhere outside the AST and went against the usual concept of having declaration in ScopeNode.
2021-07-05LibJS: Implement and use the GetSubstitution abstract operationTimothy Flynn
Used by String.prototype.replace, String.prototype.replaceAll, and RegExp.prototype [ @@replace ].
2021-07-05LibJS: Fix linked specification of String.prototype.concatTimothy Flynn
2021-07-06LibM: Use assembly for all atan versionsHendiadyoin1
2021-07-06LibM: Use fcos for cosineHendiadyoin1
For some reason we were using sin(x+M_PI_2) instead
2021-07-06LibThread: Fix formatting that was broken by the previous commitGunnar Beutner
2021-07-06LibThreading: Fix building the library on macOSGunnar Beutner
2021-07-05Kernel+LibC: Remove sys$donate()Andreas Kling
This was an old SerenityOS-specific syscall for donating the remainder of the calling thread's time-slice to another thread within the same process. Now that Threading::Lock uses a pthread_mutex_t internally, we no longer need this syscall, which allows us to get rid of a surprising amount of unnecessary scheduler logic. :^)
2021-07-05LibThreading: Reimplement Lock in terms of pthread_mutex_tAndreas Kling
This class was previously a spinlock that would call sys$donate() to donate its timeslice to whichever thread was holding the lock. Now that pthread_mutex_t has a fast path, let's implement Lock on top of that instead and get rid of the last remaining user of sys$donate().
2021-07-05Assistant: Add missing <unistd.h> includeAndreas Kling
2021-07-05LibC+LibPthread: Add PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NPAndreas Kling
This is a common but non-standard way of initializing a pthread_mutex_t in recursive mode.
2021-07-05LibWeb: Use is_nullish instead of is_null for nullable typesLuke
As according to: https://heycam.github.io/webidl/#es-nullable-type Both null and undefined are treated as IDL null, but we were only treating null as IDL null.
2021-07-05LibJS: Make Object.prototype.toString() fully spec compliantLinus Groh
- Fix evaluation order: IsArray(O) should always be called and before Get(O, @@toStringTag), previously it was the other way around and IsArray would only be called if @@toStringTag is not a string - Add missing exception checks to both function calls - Add missing builtin tag for arguments object Also, while we're here: - Update variable names to match spec - Add spec step comments
2021-07-05PixelPaint: Make move_selection() cycle through layersMarcus Nilsson
Previously move_selection() did not work as expected. Instead store the selected layer index in a member variable and continue to cycle through the layers when you come to the start/end. Also use it to scroll into view. Lastly rename the function to cycle_through_selection() to make it clearer what it does.
2021-07-05PixelPaint: Use layer menu as context menu in LayerListWidgetMarcus Nilsson
This enables the layer menu as a context menu in LayerListWidget, setting the clicked layer as active for now, but in the future it would be nice to have custom menu applying to the clicked layer instead of the active layer.
2021-07-05PixelPaint: Change color of disabled layers in LayerListWidgetMarcus Nilsson
2021-07-05PixelPaint: Make LayerListWidget scrollableMarcus Nilsson
Previously only a couple of layers would fit in the layer widget, this makes it scrollable and also tweaks some sizes and coordinates.
2021-07-05PixelPaint: Change the default layer name to "Layer"Marcus Nilsson
Change the default layer name to "Layer" and enable the user to press return to quickly close the dialog.
2021-07-05LibPthread: Reimplement semaphoresSergey Bugaev
This implementation does not use locking or condition variables internally; it's purely based on atomics and futexes. Notably, concurrent sem_wait() and sem_post() calls can run *completely in parallel* without slowing each other down, as long as there are empty slots for them all to succeed without blocking. Additionally, sem_wait() never executes an atomic operation with release ordering, and sem_post() never executes an atomic operation with acquire ordering (unless you count the syscall). This means the compiler and the hardware are free to reorder code *into* the critical section.
2021-07-05LibPthread: Reimplement condition variablesSergey Bugaev
This implementation features a fast path for pthread_cond_signal() and pthread_cond_broadcast() for the case there's no thread waiting, and does not exhibit the "thundering herd" issue in pthread_cond_broadcast(). Fixes https://github.com/SerenityOS/serenity/issues/8432
2021-07-05LibC: Add __pthread_mutex_lock_pessimistic_np()Sergey Bugaev
This is a private function that locks the lock much like the regular pthread_mutex_lock(), but causes the corresponding unlock operation to always assume there may be other waiters. This is useful in case some waiters are made to wait on the mutex's futex directly, without going through pthread_mutex_lock(). This is going to be used by the condition variable implementation in the next commit.
2021-07-05LibC: Rewrite pthread_mutexSergey Bugaev
pthread_mutex is now an actual "sleeping" mutex, and not just a spinlock! It still has a fast path that only uses atomics and (in the successful case) returns immediately without sleeping. In case of contention, it calls futex_wait(), which lets the kernel scheduler put this thread to sleep, *and* lets it know exactly when to consider scheduling it again.
2021-07-05LibC: Add futex_wait() and futex_wake() helpersSergey Bugaev
These are convinient wrappers over the most used futex operations. futex_wait() also does some smarts for timeout and clock handling. Use the new futex_wait() instead of a similar private helper in LibPthread.
2021-07-05LibGUI: Don't fire visibility-tracking timers in non-visible widgetsAndreas Kling
We were already avoiding firing timers within non-visible *windows*. This patch extends the mechanism to support timers within non-visible *widgets*.
2021-07-05Piano: Use AudioServer instead of /dev/audio for audiokleines Filmröllchen
Piano is an old application that predates AudioServer. For this reason, it was architected to directly talk to the soundcard via the /dev/audio device. This caused multiple problems including simultaneous playback issues, no ability to change volume/mute for Piano and more. This change moves Piano to use AudioServer like any well-behaved audio application :^) The track processing and IPC communication is moved to the main thread because IPC doesn't like multi-threading. For this, the new AudioPlayerLoop class is utilized that should evolve into the DSP->AudioServer interface in the future. Because Piano's CPU utilization has gotten so low (about 3-6%), the UI update loop is switched back to render at exactly 60fps. This is an important commit on the road to #6528.
2021-07-05LibAudio: Add ClientConnection::async_enqueue()kleines Filmröllchen
async_enqueue() is a wrapper over the async_enqueue_buffer() call to AudioServer. This allows users to asyncronously enqueue audio samples, when the program requires non-blocking audio streaming. This also makes ClientConnection use east-const everywhere.
2021-07-05LibAudio: Improve latency on audio queue failureskleines Filmröllchen
We don't know what is a good time to wait after an audio buffer fails to be processed by AudioServer. However, it seems like decreasing the wait time to 10ms after such a failure should improve latency and has not caused issues in my testing. After all, 10ms is quite some time in audio sample magnitudes.
2021-07-05WindowServer: Fix crash removing modal windowsTom
Calling Window::is_modal requires the window to be on a window stack, so we need to check this before removing it from the window stack.
2021-07-05LibJS: Fix bogus target.[[OwnPropertyKeys]]() call in ProxyLinus Groh
2021-07-05LibJS: Add a missing exception check in Object.assign()Linus Groh
2021-07-05LibJS: Add spec step comments to Object.assign()Linus Groh
2021-07-05LibJS: Add spec step comments to Object.hasOwn()Linus Groh
2021-07-05LibJS: Remove the non-standard get_own_property_descriptor helperIdan Horowitz
2021-07-05LibJS: Remove usage of define_native_property in OrdinaryFunctionObjectIdan Horowitz
The length & name properties are supposed to be normal data properties.
2021-07-05LibThreading: Fix BackgroundAction result use-after-freeTom
We need to move the result out of the BackgroundAction object before posting the completion callback as there is a chance the BackgroundAction instance gets freed before the event loop runs our callback. Fixes #7641
2021-07-05LibJS: Remove PropertyName::to_value since it is not used anymore :^)davidot
2021-07-05LibJS: Use a custom property_name_to_value method instead of to_valuedavidot
2021-07-05LibJS: Use the direct formatter of PropertyName instead of via to_valuedavidot
2021-07-05LibJS: Make AbstractOperations::canonical_num... take a PropertyNamedavidot
This allows us to hide the fact that it could be a number and means we no longer need to check for this optimization in string and typedarray
2021-07-05LibWeb: Replace usage of native properties with accessors in WindowIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibWeb: Replace usage of native properties with accessors in NavigatorIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibWeb: Replace usage of native properties with accessors in LocationIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibJS: Fix Promise constructor reject function argumentLinus Groh
If calling the executor function throws an exception, the return value of `vm.call()` will be an empty value, which we then passed as an argument to the reject function, which is incorrect - what it actually needs is the exception value. This stems from a misunderstanding of the spec I had at the time of implementing this - in their case, the exception value is part of the completion record returned by Call(). This error was previously masked as we would use a fallback (`value_or(js_undefined())` for the empty value argument, but that was removed in 57f7e6e. Fixes #8447.
2021-07-05LibJS: Make FunctionObject's m_home_object an Object*, not ValueLinus Groh
As the name implies (and the spec confirms), this is only ever going to be an object or "nothing", or "undefined" in the spec. By taking this literally and updating a check to check for `is_undefined()`, we introduced a bug - the value was still initialized as an empty value. Instead, use a pointer to an Object - either we have one, or we don't. Fixes #8448.
2021-07-05LibWeb: Use JS_DECLARE_NATIVE_FUNCTION for WebAssembly accessorsLinus Groh
2021-07-05LibWeb: Make WebAssembly.Memory.prototype.buffer an accessor propertyLinus Groh
2021-07-05LibWeb: Make WebAssembly.Instance.prototype.exports an accessor propertyLinus Groh