mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibWasm+Everywhere: Make the instruction count limit configurable
...and enable it for LibWeb and test-wasm. Note that `wasm` will not be limited by this.
This commit is contained in:
parent
70b94f58b2
commit
65cd5526cb
6 changed files with 25 additions and 3 deletions
|
@ -128,6 +128,8 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
module.for_each_section_of_type<GlobalSection>([&](auto& global_section) {
|
||||
for (auto& entry : global_section.entries()) {
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
auxiliary_instance,
|
||||
Vector<Value> {},
|
||||
|
@ -153,6 +155,8 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
Vector<Reference> references;
|
||||
for (auto& entry : segment.init) {
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
main_module_instance,
|
||||
Vector<Value> {},
|
||||
|
@ -204,6 +208,8 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
return IterationDecision::Break;
|
||||
}
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
main_module_instance,
|
||||
Vector<Value> {},
|
||||
|
@ -262,6 +268,8 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
segment.value().visit(
|
||||
[&](DataSection::Data::Active const& data) {
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
main_module_instance,
|
||||
Vector<Value> {},
|
||||
|
@ -439,6 +447,8 @@ Result AbstractMachine::invoke(FunctionAddress address, Vector<Value> arguments)
|
|||
Result AbstractMachine::invoke(Interpreter& interpreter, FunctionAddress address, Vector<Value> arguments)
|
||||
{
|
||||
Configuration configuration { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
configuration.enable_instruction_count_limit();
|
||||
return configuration.call(interpreter, address, move(arguments));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue