mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibJS: Optimize reading known-to-be-initialized var
bindings
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
`var` bindings are never in the temporal dead zone (TDZ), and so we know accessing them will not throw. We now take advantage of this by having a specialized environment binding value getter that doesn't check for exceptional cases. 1.08x speedup on JetStream.
This commit is contained in:
parent
ad7c1e147f
commit
bf1b754e91
Notes:
github-actions[bot]
2025-05-04 00:32:11 +00:00
Author: https://github.com/awesomekling
Commit: bf1b754e91
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4588
8 changed files with 90 additions and 15 deletions
|
@ -833,6 +833,32 @@ private:
|
|||
mutable EnvironmentCoordinate m_cache;
|
||||
};
|
||||
|
||||
class GetInitializedBinding final : public Instruction {
|
||||
public:
|
||||
explicit GetInitializedBinding(Operand dst, IdentifierTableIndex identifier)
|
||||
: Instruction(Type::GetInitializedBinding)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
||||
|
||||
Operand dst() const { return m_dst; }
|
||||
IdentifierTableIndex identifier() const { return m_identifier; }
|
||||
|
||||
void visit_operands_impl(Function<void(Operand&)> visitor)
|
||||
{
|
||||
visitor(m_dst);
|
||||
}
|
||||
|
||||
private:
|
||||
Operand m_dst;
|
||||
IdentifierTableIndex m_identifier;
|
||||
mutable EnvironmentCoordinate m_cache;
|
||||
};
|
||||
|
||||
class GetGlobal final : public Instruction {
|
||||
public:
|
||||
GetGlobal(Operand dst, IdentifierTableIndex identifier, u32 cache_index)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue