summaryrefslogtreecommitdiff
path: root/Libraries
AgeCommit message (Collapse)Author
2020-10-20LibC: Fix a warning when building LibC with -O2Andreas Kling
2020-10-20LibWeb: Tear down layout trees properlyAndreas Kling
Instead of just ripping out the root of the layout tree from its RefPtr in Document, actually go through the DOM and gather up all the layout nodes. Then destroy them all in one swoop. Also, make sure to do this when detaching Document from Frame, to enforce the invariant that layout only occurs in framed documents.
2020-10-20Everywhere: Redundant inline specifier on constexpr functions (#3807)Lenny Maiorani
Problem: - `constexpr` functions are decorated with the `inline` specifier keyword. This is redundant because `constexpr` functions are implicitly `inline`. - [dcl.constexpr], ยง7.1.5/2 in the C++11 standard): "constexpr functions and constexpr constructors are implicitly inline (7.1.2)". Solution: - Remove the redundant `inline` keyword.
2020-10-20LibJS: Speed up IndexedPropertyIterator by computing non-empty indicesLinus Groh
This provides a huge speed-up for objects with large numbers as property keys in some situation. Previously we would simply iterate from 0-<max> and check if there's a non-empty value at each index - now we're being smarter and compute a list of non-empty indices upfront, by checking each value in the packed elements vector and appending the sparse elements hashmap keys (for GenericIndexedPropertyStorage). Consider this example, an object with a single own property, which is a number increasing by a factor of 10 each iteration: for (let i = 0; i < 10; ++i) { const o = {[10 ** i]: "foo"}; const start = Date.now(); Object.getOwnPropertyNames(o); // <-- IndexedPropertyIterator const end = Date.now(); console.log(`${10 ** i} -> ${(end - start) / 1000}s`); } Before this change: 1 -> 0.0000s 10 -> 0.0000s 100 -> 0.0000s 1000 -> 0.0000s 10000 -> 0.0005s 100000 -> 0.0039s 1000000 -> 0.0295s 10000000 -> 0.2489s 100000000 -> 2.4758s 1000000000 -> 25.5669s After this change: 1 -> 0.0000s 10 -> 0.0000s 100 -> 0.0000s 1000 -> 0.0000s 10000 -> 0.0000s 100000 -> 0.0000s 1000000 -> 0.0000s 10000000 -> 0.0000s 100000000 -> 0.0000s 1000000000 -> 0.0000s Fixes #3805.
2020-10-20LibX86: clang-formatAndreas Kling
2020-10-19LibX86: malloc a bit lessNico Weber
This reduces malloc()/free() calls in `disasm /bin/id` by 30% according to LIBC_DUMP_MALLOC_STATS. No measurable performance change (the number of empty block hits remains unchanged, and that's what's slow), but maybe a nice change regardless?
2020-10-19LibJS: Unprefixed octal numbers are a syntax error in strict modeLinus Groh
2020-10-19LibJS: Don't parse arrow function with newline between ) and =>Linus Groh
If there's a newline between the closing paren and arrow it's not a valid arrow function, ASI should kick in instead (it'll then fail with "Unexpected token Arrow")
2020-10-19LibJS: Share parameter parsing between regular and arrow functionsLinus Groh
This simplifies try_parse_arrow_function_expression() and fixes a few cases that should not produce an arrow function AST but did: (a,,) => {} (a b) => {} (a ...b) => {} (...b a) => {} The new parsing logic checks whether parens are expected and uses parse_function_parameters() if so, rolling back if a new syntax error occurs during that. Otherwise it's just an identifier in which case we parse the single parameter ourselves.
2020-10-19LibJS: Fix dump() indentation of UpdateExpression with suffix operatorLinus Groh
2020-10-19LibJS: Multiple 'default' clauses in switch statement are a syntax errorLinus Groh
2020-10-18LibJS: Handle continue in switch statement unwindingLinus Groh
2020-10-18LibJS: Handle return value in switch statement unwindingLinus Groh
Fixes #3790.
2020-10-18LibJS: Fix parsing of invalid numeric literalsStephan Unverwerth
i.e. "1e" "0x" "0b" "0o" used to be parsed as valid literals. They now produce invalid tokens. Fixes #3716
2020-10-18LibWeb: Dispatch "load" on document and windowAndreas Kling
These happen right after "DOMContentLoaded" for now, which is incorrect since they should really wait until subresources have loaded. However, this makes a bunch of things work already so let's do it.
2020-10-18LibWeb: Dispatch "load" event on script elementsAndreas Kling
2020-10-18LibWeb: Make DOM::Window into an EventTargetAndreas Kling
This will allow us to dispatch window events.
2020-10-17LibJS: Use allocate_without_global_object for allocating ShapesAndreas Kling
2020-10-17LibJS: Avoid creating temporary Strings to look up tokens while lexingAndreas Kling
It would be cool to solve this in a general way so that looking up a string literal or StringView in a HashMap with String keys avoids creating a temp string. For now, this patch simply addresses the issue in JS::Lexer. This is a 2-3% speed-up on test-js.
2020-10-17LibJS: Prebake the empty object ({}) with a prototypeAndreas Kling
Instead of performing a prototype transition for every new object we create via {}, prebake the object returned by Object::create_empty() with a shape with ObjectPrototype as the prototype. We also prebake the shape for the object assigned to the "prototype" property of new ScriptFunction objects, since those are extremely common and that code broke from this change anyway. This avoid a large number of transitions and is a small speed-up on test-js.
2020-10-17LibCore: Use new format functions in some places.asynts
2020-10-17LibChess: Use new format functions.asynts
2020-10-17LibAudio: Use new format functions.asynts
2020-10-17LibCore: Add formatter for Object.asynts
2020-10-17LibCore: Make Object::m_all_objects_list_node privateNico Weber
2020-10-16LibJS: `constexpr` some Number object constant valuesLinus Groh
2020-10-16LibJS: Reorganize Shape members to reduce sizeof(Shape) a bitAndreas Kling
2020-10-16LibJS: Don't bother deferring GC during ensure_property_table()Andreas Kling
This is not actually necessary, since no GC allocations are made during this process. If we ever make property tables into heap cells, we'd have to rethink this.
2020-10-15LibJS: Support move semantics for StringOrSymbolAndreas Kling
This allows us to rehash property tables without a bunch of ref count churn happening.
2020-10-15Everywhere: Add missing <AK/TemporaryChange.h> includesAndreas Kling
Don't rely on HashTable.h pulling this in.
2020-10-15LibWeb: Fix EventDispatcher::dispatch()Linus Groh
We were never wrapping and using the actual DOM::Event but instead wrapped the *target* twice and passed it to the event listener callback, as this value and as argument. This unbreaks "fun demo" and "canvas path quadratic curve test" - and event dispatching in general, of course :^) Fixes #3721.
2020-10-15LibC: Make difftime a functionStephen Gregoratto
The previous define led to issues when compiling some ports, namely zsh 5.8.
2020-10-14LibGUI: Fix wrong Sequence highlight range in ShellSyntaxHighlighterAnotherTest
This fixes the wrong highlight behaviour when a newline is used as sequence separator: ```sh echo foo if foo {} ^ This character would previously be bold ```
2020-10-14LibC: We still need to use NULL (not nullptr) in C headersAndreas Kling
Thanks to @alimpfard for noticing this.
2020-10-14LibJS: Don't assume value for index < size in IndexedPropertyIteratorLinus Groh
This assumption only works for the m_packed_elements Vector where a missing value at a certain index still returns an empty value, but not for the m_sparse_elements HashMap, which is being used for indices >= 200 - in that case the Optional<ValueAndAttributes> result will not have a value. This fixes a crash in the js REPL where printing an array with a hole at any index >= 200 would crash.
2020-10-14LibJS: Add some more items to CommonPropertyNames that I missedAndreas Kling
2020-10-13LibJS: Avoid property lookups during object initializationAndreas Kling
When we're initializing objects, we're just adding a bunch of new properties, without transition, and without overlap (we never add the same property twice.) Take advantage of this by skipping lookups entirely (no need to see if we're overwriting an existing property) during initialization. Another nice test-js speedup :^)
2020-10-13LibJS: Cache commonly used FlyStrings in the VMAndreas Kling
Roughly 7% of test-js runtime was spent creating FlyStrings from string literals. This patch frontloads that work and caches all the commonly used names in LibJS on a CommonPropertyNames struct that hangs off VM.
2020-10-13LibJS: Tidy up CallExpression::execute() a little bitAndreas Kling
2020-10-13Style: Remove uses of NULL, substituting nullptrMatthew L. Curry
2020-10-12LibGfx+PixelPaint: Fix distortions in convolutions with size != 4 or 5AnotherTest
2020-10-12LibGfx: Allow specifying a separate source bitmap for Filter::applyTom
By allowing to specify a separate source bitmap when calling Filter::apply the same filter can be applied to multiple areas, and also doesn't need to use a temporary bitmap. This also enables us to apply the filter to multiple regions properly, even if they are (almost) adjacent. If no separate source bitmap is supplied then a temporary bitmap is still necessary.
2020-10-12LibGfx: Add overloads to Rect's shrink/inflate that accept a Size<T>Tom
2020-10-12LibGfx: Make Filter::Parameters more light-weightTom
By moving the Bitmap and Rect out of Filter::Parameters we can re-use the parameters more efficiently, allowing the filter to be applied to many bitmaps without having to re-create the filter every time.
2020-10-12LibGfx: Add GenericConvolutionFilter::ApplyCacheTom
Add an overload of GenericConvolutionFilter::apply that can be used with a GenericConvolutionFilter::ApplyCache instance to avoid having to allocate a temporary bitmap every time the filter is being applied.
2020-10-12LibGfx: Add Size::containsTom
2020-10-12LibGfx: Move filters from PixelPaint into LibGfxTom
This allows re-using the same filters outside of PixelPaint.
2020-10-12Kernel+LibC: Use uintptr_t as the main type in the syscall interfaceAndreas Kling
2020-10-12Piano: Highlight pressed key in roll widgetPeter Elliott
2020-10-11LibWeb: Make DOM Nodes keep their Document aliveAndreas Kling
In addition to being reference-counted, all nodes that are part of a document must also keep the document alive. This is achieved by adding a second ref-count to the Document object and incrementing/decrementing it whenever a node is created/destroyed in that document. This brings us much closer to a proper DOM lifetime model, although the JS bindings still need more work.