mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibJS: Add caching of this value in ResolveThisBinding instruction
Because "this" value cannot be changed during function execution it is safe to compute it once and then use for future access. This optimization makes ai-astar.js run 8% faster.
This commit is contained in:
parent
bbd80d2e4d
commit
2bdc69c42c
3 changed files with 12 additions and 2 deletions
|
@ -208,6 +208,8 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu
|
|||
else
|
||||
push_call_frame(make<CallFrame>(), executable.number_of_registers);
|
||||
|
||||
TemporaryChange restore_this_value { m_this_value, {} };
|
||||
|
||||
for (;;) {
|
||||
Bytecode::InstructionStreamIterator pc(m_current_block->instruction_stream());
|
||||
TemporaryChange temp_change { m_pc, &pc };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue