diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-03-13 11:48:50 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-13 17:50:21 +0100 |
commit | 41184c960d3f56744c917d9fa8186da577fb8538 (patch) | |
tree | ecdd8b294645cba42d81cdad0f890e4b1648ef88 /Userland/Libraries/LibJS/Bytecode | |
parent | fd8a56cdded113702735818e23b27f40ab4795e4 (diff) | |
download | serenity-41184c960d3f56744c917d9fa8186da577fb8538.zip |
LibJS: Propagate abrupt completions in Bytecode::Op::Call
This was not handling the nullary call case correctly, remove the whole
nullary check as there's nothing particularly expensive in the catch-all
case anyway.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 3bcd99272f..da022f5b3a 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -400,22 +400,15 @@ ThrowCompletionOr<void> Call::execute_impl(Bytecode::Interpreter& interpreter) c auto this_value = interpreter.reg(m_this_value); - Value return_value; - - if (m_argument_count == 0 && m_type == CallType::Call) { - auto return_value_or_error = call(interpreter.global_object(), function, this_value); - if (!return_value_or_error.is_error()) - return_value = return_value_or_error.release_value(); - } else { - MarkedVector<Value> argument_values { interpreter.vm().heap() }; - for (size_t i = 0; i < m_argument_count; ++i) - argument_values.append(interpreter.reg(m_arguments[i])); + MarkedVector<Value> argument_values { interpreter.vm().heap() }; + for (size_t i = 0; i < m_argument_count; ++i) + argument_values.append(interpreter.reg(m_arguments[i])); - if (m_type == CallType::Call) - return_value = TRY(call(interpreter.global_object(), function, this_value, move(argument_values))); - else - return_value = TRY(construct(interpreter.global_object(), function, move(argument_values))); - } + Value return_value; + if (m_type == CallType::Call) + return_value = TRY(call(interpreter.global_object(), function, this_value, move(argument_values))); + else + return_value = TRY(construct(interpreter.global_object(), function, move(argument_values))); interpreter.accumulator() = return_value; return {}; |