We were spending way too much time converting unrealized source ranges
into line/column pairs on real web content.
This improves JS parsing speed on x.com by 1.13x
Use `Op::Call` directly instead of creating a single-element array and
using `CallWithArgumentArray` when calling iterator methods (`next`,
`throw`, `return`) in `yield*` expressions.
...instead of doing it on every iteration.
This function is hot in profiles on github.com landing page (invoked
through `for_each_matching_attribute()`), so this helps a bit.
This function essentially performs a BFS traversal over document states.
With this change, we let `doc_states` grow instead of removing traversed
states, avoiding shifting elements on every iteration.
This reduces `./test-web -j 1` from ~7m to ~5m on my machine.
Now that we don't always honor requests to add tasks to a queue, we
can't rely on "last added task" as the place to find the task's ID.
Fortunately we can just get it from the task itself.
Documents that have never been associated with a browsing context will
never become "fully active" so we shouldn't schedule tasks in them since
they'll never run.
The inert temporary documents used for fragment parsing will never
become "fully active" and so any tasks associated with them will never
run. To avoid memory leaks, we now simply ignore any attempts to enqueue
tasks associated with such documents.
The microtask is conceptually global and fires pending observers at the
agent level. As such, it doesn't make sense for it to be associated with
any specific document.
This way databases are allowed to be GC'ed when there are no open
connections to them.
As a side effect, databases are no longer kept alive for the duration of
a browsing session. This will be addressed once IndexedDB gets proper
on-disk persistence. For now, avoiding memory leaks is the better
trade-off.
With this change the number of live `Window` objects in GC graph
captured by `test-web -j 1 --dump-gc-graph` goes down from 50 to 25.
- Delete defined but not implemented
`ConservativeVectorBase& operator=(ConservativeVectorBase const&);`
- Mark `ConservativeVectorBase` as non-copyable because underlying
`m_list_node` cannot be copied safely.
- Change `ConservativeVector` copy assignment to simply copy elements
from one vector to another, since we don't have to worry about
`ConservativeVectorBase` while copying.
The introduction of ENABLE_CI_BASELINE_CPU made -march=native
the default for non-CI builds. This breaks cross-compilation
with Clang, where native CPU detection is explicitly unsupported
when a target triple is set.
Guard the use of -march=native behind NOT CMAKE_CROSSCOMPILING
so native tuning is only applied for true host builds, while
cross builds continue to use the toolchain defaults.
Previously `BroadcastChannelRepository` held strong references to
`BroadcastChannel` instances, which is removed only after `close()` on
corresponding `BroadcastChannel` was called, which might never happen.
This would have to be revisited once we will implement broadcast
channels messaging across different WebContent processes, but for now
using weak references in the repository saves us from leaking all
unclosed `BroadcastChannel`s.
Instead of storing a list of builtin function objects with the realm,
just move the builtin field from NativeFunction up to FunctionObject.
Now you can ask any FunctionObject for its builtin(), and we no longer
need the get_builtin_value() API.
Fixes 10 test262 tests that were querying the realm builtins at a
bad time.
Regressed in 54b755126c.
Post-GC tasks may trigger another GC, and things got very confusing
when that happened. Just dump all stats before running tasks.
Also add a separate Heap function to run these tasks. This makes
backtraces much easier to understand.
This had two fatal bugs:
1. We didn't actually mark the cell that must survive GC, we only
visited its edges.
2. Worse, we didn't actually mark anything at all! We just added
cells to MarkingVisitor's work queue, but this happened after
the work queue had already been processed.
This commit fixes these issues by moving the "must survive" pass
earlier in the mark phase.
HeapVector inherits from GC::Cell, and thus participates in tracing
garbage collection. It's not a standalone vector of roots like
RootVector or ConservativeVector. It must be marked for its elements to
be marked.