summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-15AK+Everywhere: Add sincos and use it in some placesHendiadyoin1
Calculating sin and cos at once is quite a bit cheaper than calculating them individually. x87 has even a dedicated instruction for it: `fsincos`.
2022-03-15UserspaceEmulator: Clear c0 on x87 constant load instructionsHendiadyoin1
2022-03-15UserspaceEmulator: Make error checks in FYL2XP1 and FYL2X a bit closerHendiadyoin1
...to the manual This removes the non complete NaN checks and fixes a bounds check in FYL2X.
2022-03-15UserspaceEmulator: Add more FIXMES to SoftFPUHendiadyoin1
This also includes an exception check for sqrt and two pow(2,...) -> exp2(...) changes.
2022-03-15Spreadsheet: Move tab widget actions to the main widget constructorKarol Kosek
There's no need to reassign these functions when we add a new tab. Nothing changes inside them and they don't depend on anything in the function.
2022-03-15Spreadsheet: Get the active sheet via TabWidget::active_widget()Karol Kosek
We don't have to track the active widget ourselves anymore -- less possible boogs!
2022-03-15Spreadsheet: Set tab functions for every tab on setupKarol Kosek
Previously, we were setting tab actions only for the active tab on a tab change, and the same actions for the previous tab were removed. Unfortunately, this also happened when making a new tab, which meant that you could trick the cell editor to jump to the new sheet and start writing there. To fix this, every view will always have on_selection_changed and on_selection_dropped assigned. I haven't seen much difference in the memory usage, so I guess it'll be fine :)
2022-03-15LibJS/Bytecode: Fix typo in object binding an entry with no aliasLuke Wilde
In object binding, we would attempt to get NonnullRefPtr<Identifier> from alias on the alias.has<Empty>() code path. In this case, we need to get it from name instead.
2022-03-15LibJS/Bytecode: End for's variable scope after update block generationLuke Wilde
The update block can generate bytecode that refers to the lexical environment, so we have to end the scope after it has been generated. Previously the Jump to the update block would terminate the block, causing us to leave the lexical environment just before jumping to the update block.
2022-03-15LibJS: Stop generating switch case statements on block terminationLuke Wilde
After we terminate a block (e.g. break, continue), we cannot generate anymore bytecode for the block. This caused us to crash with this example code: ``` a = 0; switch (a) { case 0: break; console.log("hello world"); } ``` Anything after a block terminating instruction is considered unreachable code, so we can safely skip any statements after it.
2022-03-14HackStudio: Remove Terminal widget when the bound shell process diesLucas CHOLLET
This feature allows the terminal widget to be automatically closed when typing `exit` inside the shell.
2022-03-14Kernel: Try to reuse empty slabheaps before expanding the kmalloc-heapHendiadyoin1
2022-03-14Kernel: Bail out earlier from Process::lookup_stacks_directoryHendiadyoin1
2022-03-14Meta: Add copy-src to commands in ZSH autocomplete scriptLinus Groh
2022-03-14Meta: Add aarch64 to targets in ZSH autocomplete scriptLinus Groh
2022-03-14HexEditor: Selection follows cursor while pressing shiftSamu698
This patch makes the HexEditor behaviour similar to the one of the text editor, this can be seen by pressing shift and the arrow keys
2022-03-14HexEditor: Disable selection dependent actions when no selection is madeSamu698
This applies for the "copy as hex", "copy as text", "copy as C code", "fill selection" actions
2022-03-14HexEditor: Offset segment in status bar opens goto offset dialogSamu698
2022-03-14HexEditor: Fill selection sets only bytes inside selectionSamu698
Before this patch the fill selection command would set the selection and one byte after it
2022-03-14HexEditor: Copy as C code doesn't add trailing spacesSamu698
2022-03-14AudioServer: Decrease sample headroom to 5%kleines Filmröllchen
This might still be too much, but it's better than what we had before.
2022-03-14Piano: Decrease sample headroomkleines Filmröllchen
Multiplying all samples by 0.1 was kind of silly. This also requires adjusting the wave visualizer so that the waves still fit.
2022-03-14SoundPlayer: Implement logarithmic spectrum displaykleines Filmröllchen
Now that we have y-axis (gain) logarithmic display, we should also have x-axis (frequency) logarithmic display; that's how our ears work. This can be turned off with an option, but it generally looks much nicer.
2022-03-14SoundPlayer: Adjust peaking logic for bars visualizationkleines Filmröllchen
This should give us better peaks by also reducing the energy on lower frequency bars.
2022-03-14SoundPlayer: Use overlapping windows for bars visualizationkleines Filmröllchen
For DSP reasons I can't explain myself (yet, sorry), short-time Fourier transform (STFT) is much more accurate and aesthetically pleasing when the windows that select the samples for STFT overlap. This implements that behavior by storing the previous samples and performing windowed FFT over both it as well as the current samples. This gives us 50% overlap between windows, a common standard that is nice to look at.
2022-03-14SoundPlayer: Rework FFT visualizationArne Elster
The input to the FFT was distorted by the usage of fabs on the samples. It led to a big DC offset and a distorted spectrum. Simply removing fabs improves the quality of the spectrum a lot. The FFT input should be windowed to reduce spectral leakage. This also improves the visual quality of the spectrum. Also, no need to do a FFT of the whole buffer if we only mean to render 64 bars. A 8192 point FFT may smooth out fast local changes but at 44100 hz samplerate that's 200 ms worth of sound which significantly reduces FPS. A better approach for a fluent visualization is to do small FFTs at the current playing position inside the current buffer. There may be a better way to get the current playing position, but for now it's implemented as an estimation depending on how many frames where already rendered with the current buffer. Also I picked y-axis log scale as a default because there's usually a big difference in energy between low and high frequency bands. log scale looks nicer.
2022-03-14SoundPlayer: Auto refresh visualization widgetsArne Elster
Visualization widgets should only have to tell how many samples they need per frame and have a render method which receives all data relevant to draw the next frame.
2022-03-14SoundPlayer: Enable frequency energy adjustment by defaultkleines Filmröllchen
Although it's nice to have this as an option, it should be the default to adjust higher frequencies as they intrinsically have less energy than lower energies.
2022-03-14LibDSP: Add windowing functionsArne Elster
Windows are used in many DSP related applications. A prominent use case is spectral analysis, where windowing the signal before doing spectral analysis mitigates spectral leakage.
2022-03-14LibDSP: Generalize & improve FFTkleines Filmröllchen
Several related improvements to our Fast Fourier Transform implementation: - FFT now operates on spans, allowing it to use many more container types other than Vector. It's intended anyways that FFT transmutes the input data. - FFT is now constexpr, moving the implementation to the header and removing the cpp file. This means that if we have static collections of samples, we can transform them at compile time. - sample_data.data() weirdness is now gone.
2022-03-14Kernel/PCI: Break early of controller iteration over devices in OOM caseLiav A
This is mainly useful when adding an HostController but due to OOM condition, we abort temporary Vector insertion of a DeviceIdentifier and then exit the iteration loop to report back the error if occured.
2022-03-14Kernel/PCI: Don't hold spinlocks when doing fast device enumerationLiav A
Instead, hold the lock while we copy the contents to a stack-based Vector then iterate on it without any locking. Because we rely on heap allocations, we need to propagate errors back in case of OOM condition, therefore, both PCI::enumerate API function and PCI::Access::add_host_controller_and_enumerate_attached_devices use now a ErrorOr<void> return value to propagate errors. OOM Error can only occur when enumerating the m_device_identifiers vector under a spinlock and trying to expand the temporary Vector which will be used locklessly to actually iterate over the PCI::DeviceIdentifiers objects.
2022-03-14Kernel: Fix buffer overflow in VirtIOGPU create_3d_resource(..)Brian Gianforcaro
This code attempts to copy the `Protocol::Resource3DSpecification` struct into request, starting at `Protocol::ResourceCreate3D::target` member of the `Protocol::ResourceCreate3D` struct. The problem is that the `Protocol::Resource3DSpecification` struct does not having the trailing `u32 padding` that the `ResourceCreate3D` struct has. Leading to memcopy overrunning the struct and corrupting 32 bits of data trailing the struct. Found by SonarCloud: - Memory copy function overflows the destination buffer.
2022-03-14LibWeb: Fix height/width copy paste bug in SVGFormattingContext::runBrian Gianforcaro
This was found by SonarCloud: - Identical sub-expressions on both sides of operator "&&".
2022-03-14WindowServer: Update menu buttons' rects on font changeKarol Kosek
Prior to this change, after changing the system font, the menu rects stayed the same, making the menu bar look a bit cramped on larger fonts.
2022-03-14WindowServer: Use font height for item heights in MenusKarol Kosek
The height of menu items was relatively small on larger fonts.
2022-03-14LibGUI: Use preferred font line height for item heights in ListViewKarol Kosek
Previously, changing the font to one with a height greater than 18 meant that no text was visible in the list items anymore.
2022-03-14LibJS: Implement default values for function parameters in BCAli Mohammad Pur
2022-03-14LibJS/Bytecode: Replace merged block references before copying themAli Mohammad Pur
2022-03-14LibWeb: Invalidate styles after CSSImportRule loadsSimon Wanner
This replicates the behavior of StyleSheetList::add_sheet, making sure the rules added by the imported style sheet are applied.
2022-03-14LibWeb: Fix resolving relative URLs in style sheetsSimon Wanner
Relative URLs in style sheets should be resolved relative to the style sheet they're in instead of the document.
2022-03-14LibJS: Use ranges instead of specifying all registers for NewArrayAli Mohammad Pur
Listing all the registers will lead to the inability to allocate enough space in one basic block (as there can be an arbitrary number of registers used), instead switch to specifying the range of registers used and save a lot of space in the process.
2022-03-14LibJS/Bytecode: Make NewArray write directly to indexed propertiesLuke Wilde
This follows how the regular AST interpreter creates arrays, as using Array::create_from uses create_data_property_or_throw, which will crash when it encounters an empty value. We require empty values to represent array holes.
2022-03-14LibJS/Bytecode: Setup declarative environment for lexical for statementsLuke Wilde
2022-03-14LibJS/Bytecode: Setup declarative environment for catch with variableLuke Wilde
2022-03-14LibJS/Bytecode: Setup lexical environment boundary for with statementsLuke Wilde
This allows us to properly unwind the object environment for `with` on a block terminating instruction, e.g. an unconditional throw.
2022-03-14LibJS/Bytecode: Unwind to closest unwind boundary on ThrowLuke Wilde
This will leave any lexical/variable environments on the way to the closest unwind context boundary. This will not leave the closest unwind context, as we still need the unwind context to perform the Throw instruction correctly.
2022-03-14LibJS/Bytecode: Unwind environments before block terminating instructionLuke Wilde
When we reach a block terminating instruction (e.g. Break, Throw), we cannot generate anymore instructions after it. This would not allow us to leave any lexical/variable environments. This uses the mechanism introduced in ba9c49 to unwind environments when we encounter these instructions.
2022-03-14LibJS: Leave unwind context if it has no finalizer when using handlerLuke Wilde
For example, a try/catch block with no finally. The try block and catch block do not need to unwind to a finally block, so the unwind context is no longer needed when we jump to the catch block. If we threw an exception in a catch block of a try/catch, there will be no handler or finalizer and the unit would continue on as if nothing happened. This would subsequently crash with the `m_saved_exception.is_null()` assertion failure when we next call a non-native function.
2022-03-14LibJS/Bytecode: Unconditionally end break/continuable scopesLuke Wilde
Previously we would only end these scopes if the block was not terminated. If the block was generated, we would not end the scope and would generate other bytecode with these scopes still open. These functions do not generate any code, so they can be used even if the current block is terminated. The enter and end scope functions are only used to track where to unwind to when break/continue are used.