1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

Revert "LibWasm: Some more performance stuff (#8812)"

This reverts commit 35394dbfaa.
I pushed the wrong button again, hopefully this will be the last of
such incidents.
This commit is contained in:
Ali Mohammad Pur 2021-07-17 01:11:28 +04:30
parent 35394dbfaa
commit 23b48f8fe1
8 changed files with 27 additions and 49 deletions

View file

@ -37,15 +37,12 @@ void BytecodeInterpreter::interpret(Configuration& configuration)
auto& instructions = configuration.frame().expression().instructions();
auto max_ip_value = InstructionPointer { instructions.size() };
auto& current_ip_value = configuration.ip();
auto const should_limit_instruction_count = configuration.should_limit_instruction_count();
u64 executed_instructions = 0;
while (current_ip_value < max_ip_value) {
if (should_limit_instruction_count) {
if (executed_instructions++ >= Constants::max_allowed_executed_instructions_per_call) [[unlikely]] {
m_trap = Trap { "Exceeded maximum allowed number of instructions" };
return;
}
if (executed_instructions++ >= Constants::max_allowed_executed_instructions_per_call) [[unlikely]] {
m_trap = Trap { "Exceeded maximum allowed number of instructions" };
return;
}
auto& instruction = instructions[current_ip_value.value()];
auto old_ip = current_ip_value;
@ -1126,15 +1123,17 @@ void DebuggerBytecodeInterpreter::interpret(Configuration& configuration, Instru
}
}
BytecodeInterpreter::interpret(configuration, ip, instruction);
if (post_interpret_hook) {
auto result = post_interpret_hook(configuration, ip, instruction, *this);
if (!result) {
m_trap = Trap { "Trapped by user request" };
return;
ScopeGuard guard { [&] {
if (post_interpret_hook) {
auto result = post_interpret_hook(configuration, ip, instruction, *this);
if (!result) {
m_trap = Trap { "Trapped by user request" };
return;
}
}
}
} };
BytecodeInterpreter::interpret(configuration, ip, instruction);
}
}