mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 11:48:13 +00:00
LibJS: Convert Instruction::execute in bytecode to ThrowCompletionOr
This allows us to use TRY in these functions :^).
This commit is contained in:
parent
de90d54be0
commit
8108fc7f9c
6 changed files with 238 additions and 294 deletions
|
@ -120,3 +120,20 @@ TEST_CASE(loading_multiple_files)
|
||||||
EXPECT(!vm->exception());
|
EXPECT(!vm->exception());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(catch_exception)
|
||||||
|
{
|
||||||
|
// FIXME: Currently it seems that try/catch with finally is broken so we test both at once.
|
||||||
|
EXPECT_NO_EXCEPTION_ALL("var hitCatch = false;\n"
|
||||||
|
"var hitFinally = false;\n"
|
||||||
|
"try {\n"
|
||||||
|
" a();\n"
|
||||||
|
"} catch (e) {\n"
|
||||||
|
" hitCatch = e instanceof ReferenceError;\n"
|
||||||
|
" !1\n" // This is here to fix the alignment issue until that is actually resolved.
|
||||||
|
"} finally {\n"
|
||||||
|
" hitFinally = true;\n"
|
||||||
|
"}\n"
|
||||||
|
"if (hitCatch !== true) throw new Exception('failed');\n"
|
||||||
|
"if (hitFinally !== true) throw new Exception('failed');");
|
||||||
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
size_t length() const;
|
size_t length() const;
|
||||||
String to_string(Bytecode::Executable const&) const;
|
String to_string(Bytecode::Executable const&) const;
|
||||||
void execute(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute(Bytecode::Interpreter&) const;
|
||||||
void replace_references(BasicBlock const&, BasicBlock const&);
|
void replace_references(BasicBlock const&, BasicBlock const&);
|
||||||
static void destroy(Instruction&);
|
static void destroy(Instruction&);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &executable);
|
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &executable);
|
||||||
|
|
||||||
TemporaryChange restore_executable { m_current_executable, &executable };
|
TemporaryChange restore_executable { m_current_executable, &executable };
|
||||||
|
VERIFY(m_saved_exception.is_null());
|
||||||
|
|
||||||
ExecutionContext execution_context(vm().heap());
|
ExecutionContext execution_context(vm().heap());
|
||||||
if (vm().execution_context_stack().is_empty() || !vm().running_execution_context().lexical_environment) {
|
if (vm().execution_context_stack().is_empty() || !vm().running_execution_context().lexical_environment) {
|
||||||
|
@ -76,9 +77,17 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
bool will_return = false;
|
bool will_return = false;
|
||||||
while (!pc.at_end()) {
|
while (!pc.at_end()) {
|
||||||
auto& instruction = *pc;
|
auto& instruction = *pc;
|
||||||
instruction.execute(*this);
|
auto ran_or_error = instruction.execute(*this);
|
||||||
if (vm().exception()) {
|
if (vm().exception()) {
|
||||||
m_saved_exception = {};
|
if (!ran_or_error.is_error()) {
|
||||||
|
// FIXME: Until exception is removed use this to make sure we always get the error if there is one.
|
||||||
|
ran_or_error = throw_completion(vm().exception()->value());
|
||||||
|
}
|
||||||
|
vm().clear_exception();
|
||||||
|
}
|
||||||
|
if (ran_or_error.is_error()) {
|
||||||
|
auto exception_value = *ran_or_error.throw_completion().value();
|
||||||
|
m_saved_exception = make_handle(exception_value);
|
||||||
if (m_unwind_contexts.is_empty())
|
if (m_unwind_contexts.is_empty())
|
||||||
break;
|
break;
|
||||||
auto& unwind_context = m_unwind_contexts.last();
|
auto& unwind_context = m_unwind_contexts.last();
|
||||||
|
@ -87,8 +96,8 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
if (unwind_context.handler) {
|
if (unwind_context.handler) {
|
||||||
block = unwind_context.handler;
|
block = unwind_context.handler;
|
||||||
unwind_context.handler = nullptr;
|
unwind_context.handler = nullptr;
|
||||||
accumulator() = vm().exception()->value();
|
accumulator() = exception_value;
|
||||||
vm().clear_exception();
|
m_saved_exception = {};
|
||||||
will_jump = true;
|
will_jump = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -96,8 +105,6 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
block = unwind_context.finalizer;
|
block = unwind_context.finalizer;
|
||||||
m_unwind_contexts.take_last();
|
m_unwind_contexts.take_last();
|
||||||
will_jump = true;
|
will_jump = true;
|
||||||
m_saved_exception = Handle<Exception>::create(vm().exception());
|
|
||||||
vm().clear_exception();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +126,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
if (pc.at_end() && !will_jump)
|
if (pc.at_end() && !will_jump)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (vm().exception())
|
if (!m_saved_exception.is_null())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,12 +149,6 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
m_manually_entered_frames.take_last();
|
m_manually_entered_frames.take_last();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value exception_value;
|
|
||||||
if (vm().exception()) {
|
|
||||||
exception_value = vm().exception()->value();
|
|
||||||
vm().clear_exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto return_value = m_return_value.value_or(js_undefined());
|
auto return_value = m_return_value.value_or(js_undefined());
|
||||||
m_return_value = {};
|
m_return_value = {};
|
||||||
|
|
||||||
|
@ -164,8 +165,11 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
||||||
|
|
||||||
vm().finish_execution_generation();
|
vm().finish_execution_generation();
|
||||||
|
|
||||||
if (!exception_value.is_empty())
|
if (!m_saved_exception.is_null()) {
|
||||||
return { throw_completion(exception_value), move(frame) };
|
Value thrown_value = m_saved_exception.value();
|
||||||
|
m_saved_exception = {};
|
||||||
|
return { throw_completion(thrown_value), move(frame) };
|
||||||
|
}
|
||||||
|
|
||||||
return { return_value, move(frame) };
|
return { return_value, move(frame) };
|
||||||
}
|
}
|
||||||
|
@ -180,14 +184,16 @@ void Interpreter::leave_unwind_context()
|
||||||
m_unwind_contexts.take_last();
|
m_unwind_contexts.take_last();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::continue_pending_unwind(Label const& resume_label)
|
ThrowCompletionOr<void> Interpreter::continue_pending_unwind(Label const& resume_label)
|
||||||
{
|
{
|
||||||
if (!m_saved_exception.is_null()) {
|
if (!m_saved_exception.is_null()) {
|
||||||
vm().set_exception(*m_saved_exception.cell());
|
auto result = throw_completion(m_saved_exception.value());
|
||||||
m_saved_exception = {};
|
m_saved_exception = {};
|
||||||
} else {
|
return result;
|
||||||
jump(resume_label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jump(resume_label);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
AK::Array<OwnPtr<PassManager>, static_cast<UnderlyingType<Interpreter::OptimizationLevel>>(Interpreter::OptimizationLevel::__Count)> Interpreter::s_optimization_pipelines {};
|
AK::Array<OwnPtr<PassManager>, static_cast<UnderlyingType<Interpreter::OptimizationLevel>>(Interpreter::OptimizationLevel::__Count)> Interpreter::s_optimization_pipelines {};
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
#include <LibJS/Heap/Handle.h>
|
#include <LibJS/Heap/Handle.h>
|
||||||
#include <LibJS/Runtime/Exception.h>
|
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
|
|
||||||
namespace JS::Bytecode {
|
namespace JS::Bytecode {
|
||||||
|
@ -69,7 +68,7 @@ public:
|
||||||
|
|
||||||
void enter_unwind_context(Optional<Label> handler_target, Optional<Label> finalizer_target);
|
void enter_unwind_context(Optional<Label> handler_target, Optional<Label> finalizer_target);
|
||||||
void leave_unwind_context();
|
void leave_unwind_context();
|
||||||
void continue_pending_unwind(Label const& resume_label);
|
ThrowCompletionOr<void> continue_pending_unwind(Label const& resume_label);
|
||||||
|
|
||||||
Executable const& current_executable() { return *m_current_executable; }
|
Executable const& current_executable() { return *m_current_executable; }
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ private:
|
||||||
Value m_return_value;
|
Value m_return_value;
|
||||||
Executable const* m_current_executable { nullptr };
|
Executable const* m_current_executable { nullptr };
|
||||||
Vector<UnwindInfo> m_unwind_contexts;
|
Vector<UnwindInfo> m_unwind_contexts;
|
||||||
Handle<Exception> m_saved_exception;
|
Handle<Value> m_saved_exception;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool g_dump_bytecode;
|
extern bool g_dump_bytecode;
|
||||||
|
|
|
@ -42,19 +42,22 @@ String Instruction::to_string(Bytecode::Executable const& executable) const
|
||||||
|
|
||||||
namespace JS::Bytecode::Op {
|
namespace JS::Bytecode::Op {
|
||||||
|
|
||||||
void Load::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Load::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.accumulator() = interpreter.reg(m_src);
|
interpreter.accumulator() = interpreter.reg(m_src);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadImmediate::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> LoadImmediate::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.accumulator() = m_value;
|
interpreter.accumulator() = m_value;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Store::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Store::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.reg(m_dst) = interpreter.accumulator();
|
interpreter.reg(m_dst) = interpreter.accumulator();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static ThrowCompletionOr<Value> abstract_inequals(GlobalObject& global_object, Value src1, Value src2)
|
static ThrowCompletionOr<Value> abstract_inequals(GlobalObject& global_object, Value src1, Value src2)
|
||||||
|
@ -78,14 +81,12 @@ static ThrowCompletionOr<Value> typed_equals(GlobalObject&, Value src1, Value sr
|
||||||
}
|
}
|
||||||
|
|
||||||
#define JS_DEFINE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
#define JS_DEFINE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
||||||
void OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
|
ThrowCompletionOr<void> OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
|
||||||
{ \
|
{ \
|
||||||
auto lhs = interpreter.reg(m_lhs_reg); \
|
auto lhs = interpreter.reg(m_lhs_reg); \
|
||||||
auto rhs = interpreter.accumulator(); \
|
auto rhs = interpreter.accumulator(); \
|
||||||
auto result_or_error = op_snake_case(interpreter.global_object(), lhs, rhs); \
|
interpreter.accumulator() = TRY(op_snake_case(interpreter.global_object(), lhs, rhs)); \
|
||||||
if (result_or_error.is_error()) \
|
return {}; \
|
||||||
return; \
|
|
||||||
interpreter.accumulator() = result_or_error.release_value(); \
|
|
||||||
} \
|
} \
|
||||||
String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
||||||
{ \
|
{ \
|
||||||
|
@ -105,12 +106,10 @@ static ThrowCompletionOr<Value> typeof_(GlobalObject& global_object, Value value
|
||||||
}
|
}
|
||||||
|
|
||||||
#define JS_DEFINE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
|
#define JS_DEFINE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
|
||||||
void OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
|
ThrowCompletionOr<void> OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
|
||||||
{ \
|
{ \
|
||||||
auto result_or_error = op_snake_case(interpreter.global_object(), interpreter.accumulator()); \
|
interpreter.accumulator() = TRY(op_snake_case(interpreter.global_object(), interpreter.accumulator())); \
|
||||||
if (result_or_error.is_error()) \
|
return {}; \
|
||||||
return; \
|
|
||||||
interpreter.accumulator() = result_or_error.release_value(); \
|
|
||||||
} \
|
} \
|
||||||
String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
||||||
{ \
|
{ \
|
||||||
|
@ -119,18 +118,20 @@ static ThrowCompletionOr<Value> typeof_(GlobalObject& global_object, Value value
|
||||||
|
|
||||||
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DEFINE_COMMON_UNARY_OP)
|
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DEFINE_COMMON_UNARY_OP)
|
||||||
|
|
||||||
void NewBigInt::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewBigInt::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), m_bigint);
|
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), m_bigint);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
Vector<Value> elements;
|
Vector<Value> elements;
|
||||||
elements.ensure_capacity(m_element_count);
|
elements.ensure_capacity(m_element_count);
|
||||||
for (size_t i = 0; i < m_element_count; i++)
|
for (size_t i = 0; i < m_element_count; i++)
|
||||||
elements.append(interpreter.reg(m_elements[i]));
|
elements.append(interpreter.reg(m_elements[i]));
|
||||||
interpreter.accumulator() = Array::create_from(interpreter.global_object(), elements);
|
interpreter.accumulator() = Array::create_from(interpreter.global_object(), elements);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Since the accumulator is a Value, we store an object there and have to convert back and forth between that an Iterator records. Not great.
|
// FIXME: Since the accumulator is a Value, we store an object there and have to convert back and forth between that an Iterator records. Not great.
|
||||||
|
@ -155,113 +156,87 @@ static Iterator object_to_iterator(GlobalObject& global_object, Object& object)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratorToArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> IteratorToArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto& global_object = interpreter.global_object();
|
auto& global_object = interpreter.global_object();
|
||||||
auto iterator_object_or_error = interpreter.accumulator().to_object(global_object);
|
auto iterator_object = TRY(interpreter.accumulator().to_object(global_object));
|
||||||
if (iterator_object_or_error.is_error())
|
auto iterator = object_to_iterator(global_object, *iterator_object);
|
||||||
return;
|
|
||||||
auto iterator = object_to_iterator(global_object, *iterator_object_or_error.release_value());
|
|
||||||
|
|
||||||
auto* array = MUST(Array::create(global_object, 0));
|
auto* array = MUST(Array::create(global_object, 0));
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
auto iterator_result_or_error = iterator_next(global_object, iterator);
|
auto* iterator_result = TRY(iterator_next(global_object, iterator));
|
||||||
if (iterator_result_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto* iterator_result = iterator_result_or_error.release_value();
|
|
||||||
|
|
||||||
auto complete_or_error = iterator_complete(global_object, *iterator_result);
|
auto complete = TRY(iterator_complete(global_object, *iterator_result));
|
||||||
if (complete_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto complete = complete_or_error.release_value();
|
|
||||||
|
|
||||||
if (complete) {
|
if (complete) {
|
||||||
interpreter.accumulator() = array;
|
interpreter.accumulator() = array;
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto value_or_error = iterator_value(global_object, *iterator_result);
|
auto value = TRY(iterator_value(global_object, *iterator_result));
|
||||||
if (value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto value = value_or_error.release_value();
|
|
||||||
|
|
||||||
MUST(array->create_data_property_or_throw(index, value));
|
MUST(array->create_data_property_or_throw(index, value));
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewString::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewString::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.accumulator() = js_string(interpreter.vm(), interpreter.current_executable().get_string(m_string));
|
interpreter.accumulator() = js_string(interpreter.vm(), interpreter.current_executable().get_string(m_string));
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewObject::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewObject::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.accumulator() = Object::create(interpreter.global_object(), interpreter.global_object().object_prototype());
|
interpreter.accumulator() = Object::create(interpreter.global_object(), interpreter.global_object().object_prototype());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewRegExp::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewRegExp::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto source = interpreter.current_executable().get_string(m_source_index);
|
auto source = interpreter.current_executable().get_string(m_source_index);
|
||||||
auto flags = interpreter.current_executable().get_string(m_flags_index);
|
auto flags = interpreter.current_executable().get_string(m_flags_index);
|
||||||
|
|
||||||
auto regexp_or_error = regexp_create(interpreter.global_object(), js_string(interpreter.vm(), source), js_string(interpreter.vm(), flags));
|
interpreter.accumulator() = TRY(regexp_create(interpreter.global_object(), js_string(interpreter.vm(), source), js_string(interpreter.vm(), flags)));
|
||||||
if (regexp_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
interpreter.accumulator() = regexp_or_error.value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyObjectExcludingProperties::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> CopyObjectExcludingProperties::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto from_object_or_error = interpreter.reg(m_from_object).to_object(interpreter.global_object());
|
auto* from_object = TRY(interpreter.reg(m_from_object).to_object(interpreter.global_object()));
|
||||||
if (from_object_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto* from_object = from_object_or_error.release_value();
|
|
||||||
|
|
||||||
auto* to_object = Object::create(interpreter.global_object(), interpreter.global_object().object_prototype());
|
auto* to_object = Object::create(interpreter.global_object(), interpreter.global_object().object_prototype());
|
||||||
|
|
||||||
HashTable<Value, ValueTraits> excluded_names;
|
HashTable<Value, ValueTraits> excluded_names;
|
||||||
for (size_t i = 0; i < m_excluded_names_count; ++i) {
|
for (size_t i = 0; i < m_excluded_names_count; ++i)
|
||||||
excluded_names.set(interpreter.reg(m_excluded_names[i]));
|
excluded_names.set(interpreter.reg(m_excluded_names[i]));
|
||||||
if (interpreter.vm().exception())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto own_keys_or_error = from_object->internal_own_property_keys();
|
auto own_keys = TRY(from_object->internal_own_property_keys());
|
||||||
if (own_keys_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto own_keys = own_keys_or_error.release_value();
|
|
||||||
|
|
||||||
for (auto& key : own_keys) {
|
for (auto& key : own_keys) {
|
||||||
if (!excluded_names.contains(key)) {
|
if (!excluded_names.contains(key)) {
|
||||||
auto property_key_or_error = key.to_property_key(interpreter.global_object());
|
auto property_key = TRY(key.to_property_key(interpreter.global_object()));
|
||||||
if (property_key_or_error.is_error())
|
auto property_value = TRY(from_object->get(property_key));
|
||||||
return;
|
|
||||||
PropertyKey property_key = property_key_or_error.release_value();
|
|
||||||
auto property_value_or_error = from_object->get(property_key);
|
|
||||||
if (property_value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto property_value = property_value_or_error.release_value();
|
|
||||||
to_object->define_direct_property(property_key, property_value, JS::default_attributes);
|
to_object->define_direct_property(property_key, property_value, JS::default_attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interpreter.accumulator() = to_object;
|
interpreter.accumulator() = to_object;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto result_or_error = add(interpreter.global_object(), interpreter.reg(m_lhs), interpreter.accumulator());
|
interpreter.reg(m_lhs) = TRY(add(interpreter.global_object(), interpreter.reg(m_lhs), interpreter.accumulator()));
|
||||||
if (result_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
interpreter.reg(m_lhs) = result_or_error.release_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto reference = [&] {
|
auto get_reference = [&]() -> ThrowCompletionOr<Reference> {
|
||||||
auto const& string = interpreter.current_executable().get_identifier(m_identifier);
|
auto const& string = interpreter.current_executable().get_identifier(m_identifier);
|
||||||
if (m_cached_environment_coordinate.has_value()) {
|
if (m_cached_environment_coordinate.has_value()) {
|
||||||
auto* environment = interpreter.vm().running_execution_context().lexical_environment;
|
auto* environment = interpreter.vm().running_execution_context().lexical_environment;
|
||||||
|
@ -275,73 +250,49 @@ void GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
m_cached_environment_coordinate = {};
|
m_cached_environment_coordinate = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto reference_or_error = interpreter.vm().resolve_binding(string);
|
auto reference = TRY(interpreter.vm().resolve_binding(string));
|
||||||
if (reference_or_error.is_throw_completion()) {
|
|
||||||
interpreter.vm().throw_exception(interpreter.global_object(), *reference_or_error.release_error().value());
|
|
||||||
return Reference {};
|
|
||||||
}
|
|
||||||
|
|
||||||
auto reference = reference_or_error.release_value();
|
|
||||||
if (reference.environment_coordinate().has_value())
|
if (reference.environment_coordinate().has_value())
|
||||||
m_cached_environment_coordinate = reference.environment_coordinate();
|
m_cached_environment_coordinate = reference.environment_coordinate();
|
||||||
return reference;
|
return reference;
|
||||||
}();
|
};
|
||||||
|
auto reference = TRY(get_reference());
|
||||||
if (interpreter.vm().exception())
|
interpreter.accumulator() = TRY(reference.get_value(interpreter.global_object()));
|
||||||
return;
|
return {};
|
||||||
|
|
||||||
auto value_or_error = reference.get_value(interpreter.global_object());
|
|
||||||
if (value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
interpreter.accumulator() = value_or_error.release_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> SetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto& vm = interpreter.vm();
|
auto& vm = interpreter.vm();
|
||||||
auto reference_or_error = vm.resolve_binding(interpreter.current_executable().get_identifier(m_identifier));
|
auto reference = TRY(vm.resolve_binding(interpreter.current_executable().get_identifier(m_identifier)));
|
||||||
if (reference_or_error.is_throw_completion()) {
|
|
||||||
interpreter.vm().throw_exception(interpreter.global_object(), *reference_or_error.release_error().value());
|
TRY(reference.put_value(interpreter.global_object(), interpreter.accumulator()));
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto reference = reference_or_error.release_value();
|
ThrowCompletionOr<void> GetById::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
// TODO: ThrowCompletionOr<void> return
|
|
||||||
(void)reference.put_value(interpreter.global_object(), interpreter.accumulator());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetById::execute_impl(Bytecode::Interpreter& interpreter) const
|
|
||||||
{
|
{
|
||||||
auto object_or_error = interpreter.accumulator().to_object(interpreter.global_object());
|
auto* object = TRY(interpreter.accumulator().to_object(interpreter.global_object()));
|
||||||
if (object_or_error.is_error())
|
interpreter.accumulator() = TRY(object->get(interpreter.current_executable().get_identifier(m_property)));
|
||||||
return;
|
return {};
|
||||||
auto* object = object_or_error.release_value();
|
|
||||||
auto value_or_error = object->get(interpreter.current_executable().get_identifier(m_property));
|
|
||||||
if (value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
interpreter.accumulator() = value_or_error.release_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PutById::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> PutById::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto object_or_error = interpreter.reg(m_base).to_object(interpreter.global_object());
|
auto* object = TRY(interpreter.reg(m_base).to_object(interpreter.global_object()));
|
||||||
if (object_or_error.is_error())
|
TRY(object->set(interpreter.current_executable().get_identifier(m_property), interpreter.accumulator(), Object::ShouldThrowExceptions::Yes));
|
||||||
return;
|
return {};
|
||||||
auto* object = object_or_error.release_value();
|
|
||||||
MUST(object->set(interpreter.current_executable().get_identifier(m_property), interpreter.accumulator(), Object::ShouldThrowExceptions::Yes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jump::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Jump::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.jump(*m_true_target);
|
interpreter.jump(*m_true_target);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto value_or_error = interpreter.vm().resolve_this_binding(interpreter.global_object());
|
interpreter.accumulator() = TRY(interpreter.vm().resolve_this_binding(interpreter.global_object()));
|
||||||
if (value_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
interpreter.accumulator() = value_or_error.release_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jump::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
void Jump::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
|
@ -352,7 +303,7 @@ void Jump::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
m_false_target = Label { to };
|
m_false_target = Label { to };
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpConditional::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> JumpConditional::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
VERIFY(m_true_target.has_value());
|
VERIFY(m_true_target.has_value());
|
||||||
VERIFY(m_false_target.has_value());
|
VERIFY(m_false_target.has_value());
|
||||||
|
@ -361,9 +312,10 @@ void JumpConditional::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
interpreter.jump(m_true_target.value());
|
interpreter.jump(m_true_target.value());
|
||||||
else
|
else
|
||||||
interpreter.jump(m_false_target.value());
|
interpreter.jump(m_false_target.value());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpNullish::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> JumpNullish::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
VERIFY(m_true_target.has_value());
|
VERIFY(m_true_target.has_value());
|
||||||
VERIFY(m_false_target.has_value());
|
VERIFY(m_false_target.has_value());
|
||||||
|
@ -372,9 +324,10 @@ void JumpNullish::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
interpreter.jump(m_true_target.value());
|
interpreter.jump(m_true_target.value());
|
||||||
else
|
else
|
||||||
interpreter.jump(m_false_target.value());
|
interpreter.jump(m_false_target.value());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpUndefined::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> JumpUndefined::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
VERIFY(m_true_target.has_value());
|
VERIFY(m_true_target.has_value());
|
||||||
VERIFY(m_false_target.has_value());
|
VERIFY(m_false_target.has_value());
|
||||||
|
@ -383,15 +336,15 @@ void JumpUndefined::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
interpreter.jump(m_true_target.value());
|
interpreter.jump(m_true_target.value());
|
||||||
else
|
else
|
||||||
interpreter.jump(m_false_target.value());
|
interpreter.jump(m_false_target.value());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Call::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Call::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto callee = interpreter.reg(m_callee);
|
auto callee = interpreter.reg(m_callee);
|
||||||
if (!callee.is_function()) {
|
if (!callee.is_function())
|
||||||
interpreter.vm().throw_exception<TypeError>(interpreter.global_object(), ErrorType::IsNotA, callee.to_string_without_side_effects(), "function"sv);
|
return interpreter.vm().throw_completion<TypeError>(interpreter.global_object(), ErrorType::IsNotA, callee.to_string_without_side_effects(), "function"sv);
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto& function = callee.as_function();
|
auto& function = callee.as_function();
|
||||||
|
|
||||||
auto this_value = interpreter.reg(m_this_value);
|
auto this_value = interpreter.reg(m_this_value);
|
||||||
|
@ -404,71 +357,64 @@ void Call::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
return_value = return_value_or_error.release_value();
|
return_value = return_value_or_error.release_value();
|
||||||
} else {
|
} else {
|
||||||
MarkedValueList argument_values { interpreter.vm().heap() };
|
MarkedValueList argument_values { interpreter.vm().heap() };
|
||||||
for (size_t i = 0; i < m_argument_count; ++i) {
|
for (size_t i = 0; i < m_argument_count; ++i)
|
||||||
argument_values.append(interpreter.reg(m_arguments[i]));
|
argument_values.append(interpreter.reg(m_arguments[i]));
|
||||||
}
|
|
||||||
if (m_type == CallType::Call) {
|
if (m_type == CallType::Call)
|
||||||
auto return_value_or_error = call(interpreter.global_object(), function, this_value, move(argument_values));
|
return_value = TRY(call(interpreter.global_object(), function, this_value, move(argument_values)));
|
||||||
if (return_value_or_error.is_error())
|
else
|
||||||
return;
|
return_value = TRY(construct(interpreter.global_object(), function, move(argument_values)));
|
||||||
return_value = return_value_or_error.release_value();
|
|
||||||
} else {
|
|
||||||
auto return_value_or_error = construct(interpreter.global_object(), function, move(argument_values));
|
|
||||||
if (return_value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
return_value = return_value_or_error.release_value();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interpreter.accumulator() = return_value;
|
interpreter.accumulator() = return_value;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFunction::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> NewFunction::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto& vm = interpreter.vm();
|
auto& vm = interpreter.vm();
|
||||||
interpreter.accumulator() = ECMAScriptFunctionObject::create(interpreter.global_object(), m_function_node.name(), m_function_node.source_text(), m_function_node.body(), m_function_node.parameters(), m_function_node.function_length(), vm.lexical_environment(), vm.running_execution_context().private_environment, m_function_node.kind(), m_function_node.is_strict_mode(), m_function_node.might_need_arguments_object(), m_function_node.is_arrow_function());
|
interpreter.accumulator() = ECMAScriptFunctionObject::create(interpreter.global_object(), m_function_node.name(), m_function_node.source_text(), m_function_node.body(), m_function_node.parameters(), m_function_node.function_length(), vm.lexical_environment(), vm.running_execution_context().private_environment, m_function_node.kind(), m_function_node.is_strict_mode(), m_function_node.might_need_arguments_object(), m_function_node.is_arrow_function());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Return::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Return::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.do_return(interpreter.accumulator().value_or(js_undefined()));
|
interpreter.do_return(interpreter.accumulator().value_or(js_undefined()));
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Increment::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Increment::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto old_value_or_error = interpreter.accumulator().to_numeric(interpreter.global_object());
|
auto old_value = TRY(interpreter.accumulator().to_numeric(interpreter.global_object()));
|
||||||
if (old_value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto old_value = old_value_or_error.release_value();
|
|
||||||
|
|
||||||
if (old_value.is_number())
|
if (old_value.is_number())
|
||||||
interpreter.accumulator() = Value(old_value.as_double() + 1);
|
interpreter.accumulator() = Value(old_value.as_double() + 1);
|
||||||
else
|
else
|
||||||
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().plus(Crypto::SignedBigInteger { 1 }));
|
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().plus(Crypto::SignedBigInteger { 1 }));
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decrement::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Decrement::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto old_value_or_error = interpreter.accumulator().to_numeric(interpreter.global_object());
|
auto old_value = TRY(interpreter.accumulator().to_numeric(interpreter.global_object()));
|
||||||
if (old_value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto old_value = old_value_or_error.release_value();
|
|
||||||
|
|
||||||
if (old_value.is_number())
|
if (old_value.is_number())
|
||||||
interpreter.accumulator() = Value(old_value.as_double() - 1);
|
interpreter.accumulator() = Value(old_value.as_double() - 1);
|
||||||
else
|
else
|
||||||
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 }));
|
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 }));
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Throw::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Throw::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.vm().throw_exception(interpreter.global_object(), interpreter.accumulator());
|
return throw_completion(interpreter.accumulator());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnterUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> EnterUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.enter_unwind_context(m_handler_target, m_finalizer_target);
|
interpreter.enter_unwind_context(m_handler_target, m_finalizer_target);
|
||||||
interpreter.jump(m_entry_point);
|
interpreter.jump(m_entry_point);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnterUnwindContext::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
void EnterUnwindContext::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
|
@ -481,10 +427,11 @@ void EnterUnwindContext::replace_references_impl(BasicBlock const& from, BasicBl
|
||||||
m_finalizer_target = Label { to };
|
m_finalizer_target = Label { to };
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> FinishUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.leave_unwind_context();
|
interpreter.leave_unwind_context();
|
||||||
interpreter.jump(m_next_target);
|
interpreter.jump(m_next_target);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
void FinishUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
|
@ -493,14 +440,15 @@ void FinishUnwind::replace_references_impl(BasicBlock const& from, BasicBlock co
|
||||||
m_next_target = Label { to };
|
m_next_target = Label { to };
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeaveUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> LeaveUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.leave_unwind_context();
|
interpreter.leave_unwind_context();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContinuePendingUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> ContinuePendingUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
interpreter.continue_pending_unwind(m_resume_target);
|
return interpreter.continue_pending_unwind(m_resume_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
|
@ -509,14 +457,15 @@ void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, Basi
|
||||||
m_resume_target = Label { to };
|
m_resume_target = Label { to };
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushDeclarativeEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> PushDeclarativeEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto* environment = interpreter.vm().heap().allocate_without_global_object<DeclarativeEnvironment>(interpreter.vm().lexical_environment());
|
auto* environment = interpreter.vm().heap().allocate_without_global_object<DeclarativeEnvironment>(interpreter.vm().lexical_environment());
|
||||||
interpreter.vm().running_execution_context().lexical_environment = environment;
|
interpreter.vm().running_execution_context().lexical_environment = environment;
|
||||||
interpreter.vm().running_execution_context().variable_environment = environment;
|
interpreter.vm().running_execution_context().variable_environment = environment;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yield::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> Yield::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto yielded_value = interpreter.accumulator().value_or(js_undefined());
|
auto yielded_value = interpreter.accumulator().value_or(js_undefined());
|
||||||
auto object = JS::Object::create(interpreter.global_object(), nullptr);
|
auto object = JS::Object::create(interpreter.global_object(), nullptr);
|
||||||
|
@ -526,6 +475,7 @@ void Yield::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
else
|
else
|
||||||
object->define_direct_property("continuation", Value(0), JS::default_attributes);
|
object->define_direct_property("continuation", Value(0), JS::default_attributes);
|
||||||
interpreter.do_return(object);
|
interpreter.do_return(object);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yield::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
void Yield::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||||
|
@ -534,87 +484,59 @@ void Yield::replace_references_impl(BasicBlock const& from, BasicBlock const& to
|
||||||
m_continuation_label = Label { to };
|
m_continuation_label = Label { to };
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetByValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> GetByValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto object_or_error = interpreter.reg(m_base).to_object(interpreter.global_object());
|
auto* object = TRY(interpreter.reg(m_base).to_object(interpreter.global_object()));
|
||||||
if (object_or_error.is_error())
|
|
||||||
return;
|
auto property_key = TRY(interpreter.accumulator().to_property_key(interpreter.global_object()));
|
||||||
auto* object = object_or_error.release_value();
|
|
||||||
auto property_key_or_error = interpreter.accumulator().to_property_key(interpreter.global_object());
|
interpreter.accumulator() = TRY(object->get(property_key));
|
||||||
if (property_key_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
auto value_or_error = object->get(property_key_or_error.release_value());
|
|
||||||
if (value_or_error.is_error())
|
|
||||||
return;
|
|
||||||
interpreter.accumulator() = value_or_error.release_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PutByValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> PutByValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto object_or_error = interpreter.reg(m_base).to_object(interpreter.global_object());
|
auto* object = TRY(interpreter.reg(m_base).to_object(interpreter.global_object()));
|
||||||
if (object_or_error.is_error())
|
|
||||||
return;
|
auto property_key = TRY(interpreter.reg(m_property).to_property_key(interpreter.global_object()));
|
||||||
auto* object = object_or_error.release_value();
|
TRY(object->set(property_key, interpreter.accumulator(), Object::ShouldThrowExceptions::Yes));
|
||||||
auto property_key_or_error = interpreter.reg(m_property).to_property_key(interpreter.global_object());
|
return {};
|
||||||
if (property_key_or_error.is_error())
|
|
||||||
return;
|
|
||||||
MUST(object->set(property_key_or_error.release_value(), interpreter.accumulator(), Object::ShouldThrowExceptions::Yes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetIterator::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> GetIterator::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto iterator_or_error = get_iterator(interpreter.global_object(), interpreter.accumulator());
|
auto iterator = TRY(get_iterator(interpreter.global_object(), interpreter.accumulator()));
|
||||||
if (iterator_or_error.is_error())
|
interpreter.accumulator() = iterator_to_object(interpreter.global_object(), iterator);
|
||||||
return;
|
return {};
|
||||||
interpreter.accumulator() = iterator_to_object(interpreter.global_object(), iterator_or_error.release_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratorNext::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> IteratorNext::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto iterator_object_or_error = interpreter.accumulator().to_object(interpreter.global_object());
|
auto* iterator_object = TRY(interpreter.accumulator().to_object(interpreter.global_object()));
|
||||||
if (iterator_object_or_error.is_error())
|
auto iterator = object_to_iterator(interpreter.global_object(), *iterator_object);
|
||||||
return;
|
|
||||||
auto iterator = object_to_iterator(interpreter.global_object(), *iterator_object_or_error.release_value());
|
|
||||||
|
|
||||||
auto iterator_result_or_error = iterator_next(interpreter.global_object(), iterator);
|
interpreter.accumulator() = TRY(iterator_next(interpreter.global_object(), iterator));
|
||||||
if (iterator_result_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
auto* iterator_result = iterator_result_or_error.release_value();
|
|
||||||
|
|
||||||
interpreter.accumulator() = iterator_result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratorResultDone::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> IteratorResultDone::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto iterator_result_or_error = interpreter.accumulator().to_object(interpreter.global_object());
|
auto* iterator_result = TRY(interpreter.accumulator().to_object(interpreter.global_object()));
|
||||||
if (iterator_result_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto* iterator_result = iterator_result_or_error.release_value();
|
|
||||||
|
|
||||||
auto complete_or_error = iterator_complete(interpreter.global_object(), *iterator_result);
|
|
||||||
if (complete_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto complete = complete_or_error.release_value();
|
|
||||||
|
|
||||||
|
auto complete = TRY(iterator_complete(interpreter.global_object(), *iterator_result));
|
||||||
interpreter.accumulator() = Value(complete);
|
interpreter.accumulator() = Value(complete);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratorResultValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> IteratorResultValue::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto iterator_result_or_error = interpreter.accumulator().to_object(interpreter.global_object());
|
auto* iterator_result = TRY(interpreter.accumulator().to_object(interpreter.global_object()));
|
||||||
if (iterator_result_or_error.is_error())
|
|
||||||
return;
|
|
||||||
auto* iterator_result = iterator_result_or_error.release_value();
|
|
||||||
|
|
||||||
auto value_or_error = iterator_value(interpreter.global_object(), *iterator_result);
|
interpreter.accumulator() = TRY(iterator_value(interpreter.global_object(), *iterator_result));
|
||||||
if (value_or_error.is_error())
|
return {};
|
||||||
return;
|
|
||||||
auto value = value_or_error.release_value();
|
|
||||||
|
|
||||||
interpreter.accumulator() = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewClass::execute_impl(Bytecode::Interpreter&) const
|
ThrowCompletionOr<void> NewClass::execute_impl(Bytecode::Interpreter&) const
|
||||||
{
|
{
|
||||||
(void)m_class_expression;
|
(void)m_class_expression;
|
||||||
TODO();
|
TODO();
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ private:
|
||||||
{ \
|
{ \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
void execute_impl(Bytecode::Interpreter&) const; \
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||||
String to_string_impl(Bytecode::Executable const&) const; \
|
String to_string_impl(Bytecode::Executable const&) const; \
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
||||||
\
|
\
|
||||||
|
@ -128,7 +128,7 @@ JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
|
||||||
{ \
|
{ \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
void execute_impl(Bytecode::Interpreter&) const; \
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||||
String to_string_impl(Bytecode::Executable const&) const; \
|
String to_string_impl(Bytecode::Executable const&) const; \
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -173,7 +173,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public:
|
||||||
m_excluded_names[i] = excluded_names[i];
|
m_excluded_names[i] = excluded_names[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ public:
|
||||||
m_elements[i] = elements[i];
|
m_elements[i] = elements[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -273,7 +273,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ public:
|
||||||
m_false_target = move(false_target);
|
m_false_target = move(false_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ public:
|
||||||
m_arguments[i] = arguments[i];
|
m_arguments[i] = arguments[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -541,7 +541,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -553,7 +553,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -567,7 +567,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -584,7 +584,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -618,7 +618,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -706,7 +706,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -718,7 +718,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -730,7 +730,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -742,7 +742,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
String to_string_impl(Bytecode::Executable const&) const;
|
String to_string_impl(Bytecode::Executable const&) const;
|
||||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||||
};
|
};
|
||||||
|
@ -751,7 +751,7 @@ public:
|
||||||
|
|
||||||
namespace JS::Bytecode {
|
namespace JS::Bytecode {
|
||||||
|
|
||||||
ALWAYS_INLINE void Instruction::execute(Bytecode::Interpreter& interpreter) const
|
ALWAYS_INLINE ThrowCompletionOr<void> Instruction::execute(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
#define __BYTECODE_OP(op) \
|
#define __BYTECODE_OP(op) \
|
||||||
case Instruction::Type::op: \
|
case Instruction::Type::op: \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue