mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:38:10 +00:00
LibJS: Keep cached this
value in a call frame register
Just moving more things to call frame registers..
This commit is contained in:
parent
3887b840a3
commit
c833885fb5
5 changed files with 13 additions and 9 deletions
|
@ -767,13 +767,14 @@ ThrowCompletionOr<void> Jump::execute_impl(Bytecode::Interpreter& interpreter) c
|
|||
|
||||
ThrowCompletionOr<void> ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
if (!interpreter.this_value().has_value()) {
|
||||
auto& cached_this_value = interpreter.reg(Register::this_value());
|
||||
if (cached_this_value.is_empty()) {
|
||||
// OPTIMIZATION: Because the value of 'this' cannot be reassigned during a function execution, it's
|
||||
// resolved once and then saved for subsequent use.
|
||||
auto& vm = interpreter.vm();
|
||||
interpreter.this_value() = TRY(vm.resolve_this_binding());
|
||||
cached_this_value = TRY(vm.resolve_this_binding());
|
||||
}
|
||||
interpreter.accumulator() = interpreter.this_value().value();
|
||||
interpreter.accumulator() = cached_this_value;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue