summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-15 18:08:12 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-15 22:06:33 +0430
commite81fd7106b47d93345e11059bb80600a66b4daf3 (patch)
treec3b16b56ffbf5475df0e3719fe5fa5f1ee704516 /Userland/Libraries
parent4c7c7c38e2c7e25a014c20b9377b08df71676a1e (diff)
downloadserenity-e81fd7106b47d93345e11059bb80600a66b4daf3.zip
LibJS: Rename the overridden Instruction methods to foo_impl
These are pretty hairy if someone forgets to override one, as the catchall function in Instruction will keep calling itself over and over again, leading to really hard-to-debug situations.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.cpp126
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.h174
2 files changed, 150 insertions, 150 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp
index 55ff3b29d7..676267e4d2 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp
@@ -23,7 +23,7 @@ String Instruction::to_string(Bytecode::Executable const& executable) const
{
#define __BYTECODE_OP(op) \
case Instruction::Type::op: \
- return static_cast<Bytecode::Op::op const&>(*this).to_string(executable);
+ return static_cast<Bytecode::Op::op const&>(*this).to_string_impl(executable);
switch (type()) {
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
@@ -38,17 +38,17 @@ String Instruction::to_string(Bytecode::Executable const& executable) const
namespace JS::Bytecode::Op {
-void Load::execute(Bytecode::Interpreter& interpreter) const
+void Load::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = interpreter.reg(m_src);
}
-void LoadImmediate::execute(Bytecode::Interpreter& interpreter) const
+void LoadImmediate::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = m_value;
}
-void Store::execute(Bytecode::Interpreter& interpreter) const
+void Store::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = interpreter.accumulator();
}
@@ -74,13 +74,13 @@ static Value typed_equals(GlobalObject&, Value src1, Value src2)
}
#define JS_DEFINE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
- void OpTitleCase::execute(Bytecode::Interpreter& interpreter) const \
+ void OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
{ \
auto lhs = interpreter.reg(m_lhs_reg); \
auto rhs = interpreter.accumulator(); \
interpreter.accumulator() = op_snake_case(interpreter.global_object(), lhs, rhs); \
} \
- String OpTitleCase::to_string(Bytecode::Executable const&) const \
+ String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
{ \
return String::formatted(#OpTitleCase " {}", m_lhs_reg); \
}
@@ -98,23 +98,23 @@ static Value typeof_(GlobalObject& global_object, Value value)
}
#define JS_DEFINE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
- void OpTitleCase::execute(Bytecode::Interpreter& interpreter) const \
+ void OpTitleCase::execute_impl(Bytecode::Interpreter& interpreter) const \
{ \
interpreter.accumulator() = op_snake_case(interpreter.global_object(), interpreter.accumulator()); \
} \
- String OpTitleCase::to_string(Bytecode::Executable const&) const \
+ String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
{ \
return #OpTitleCase; \
}
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DEFINE_COMMON_UNARY_OP)
-void NewBigInt::execute(Bytecode::Interpreter& interpreter) const
+void NewBigInt::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), m_bigint);
}
-void NewArray::execute(Bytecode::Interpreter& interpreter) const
+void NewArray::execute_impl(Bytecode::Interpreter& interpreter) const
{
Vector<Value> elements;
elements.ensure_capacity(m_element_count);
@@ -123,49 +123,49 @@ void NewArray::execute(Bytecode::Interpreter& interpreter) const
interpreter.accumulator() = Array::create_from(interpreter.global_object(), elements);
}
-void NewString::execute(Bytecode::Interpreter& interpreter) const
+void NewString::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = js_string(interpreter.vm(), interpreter.current_executable().get_string(m_string));
}
-void NewObject::execute(Bytecode::Interpreter& interpreter) const
+void NewObject::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = Object::create_empty(interpreter.global_object());
}
-void ConcatString::execute(Bytecode::Interpreter& interpreter) const
+void ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_lhs) = add(interpreter.global_object(), interpreter.reg(m_lhs), interpreter.accumulator());
}
-void GetVariable::execute(Bytecode::Interpreter& interpreter) const
+void GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = interpreter.vm().get_variable(interpreter.current_executable().get_string(m_identifier), interpreter.global_object());
}
-void SetVariable::execute(Bytecode::Interpreter& interpreter) const
+void SetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.vm().set_variable(interpreter.current_executable().get_string(m_identifier), interpreter.accumulator(), interpreter.global_object());
}
-void GetById::execute(Bytecode::Interpreter& interpreter) const
+void GetById::execute_impl(Bytecode::Interpreter& interpreter) const
{
if (auto* object = interpreter.accumulator().to_object(interpreter.global_object()))
interpreter.accumulator() = object->get(interpreter.current_executable().get_string(m_property));
}
-void PutById::execute(Bytecode::Interpreter& interpreter) const
+void PutById::execute_impl(Bytecode::Interpreter& interpreter) const
{
if (auto* object = interpreter.reg(m_base).to_object(interpreter.global_object()))
object->put(interpreter.current_executable().get_string(m_property), interpreter.accumulator());
}
-void Jump::execute(Bytecode::Interpreter& interpreter) const
+void Jump::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.jump(*m_true_target);
}
-void JumpConditional::execute(Bytecode::Interpreter& interpreter) const
+void JumpConditional::execute_impl(Bytecode::Interpreter& interpreter) const
{
VERIFY(m_true_target.has_value());
VERIFY(m_false_target.has_value());
@@ -176,7 +176,7 @@ void JumpConditional::execute(Bytecode::Interpreter& interpreter) const
interpreter.jump(m_false_target.value());
}
-void JumpNullish::execute(Bytecode::Interpreter& interpreter) const
+void JumpNullish::execute_impl(Bytecode::Interpreter& interpreter) const
{
VERIFY(m_true_target.has_value());
VERIFY(m_false_target.has_value());
@@ -187,7 +187,7 @@ void JumpNullish::execute(Bytecode::Interpreter& interpreter) const
interpreter.jump(m_false_target.value());
}
-void Call::execute(Bytecode::Interpreter& interpreter) const
+void Call::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto callee = interpreter.reg(m_callee);
if (!callee.is_function()) {
@@ -215,18 +215,18 @@ void Call::execute(Bytecode::Interpreter& interpreter) const
interpreter.accumulator() = return_value;
}
-void NewFunction::execute(Bytecode::Interpreter& interpreter) const
+void NewFunction::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto& vm = interpreter.vm();
interpreter.accumulator() = ScriptFunction::create(interpreter.global_object(), m_function_node.name(), m_function_node.body(), m_function_node.parameters(), m_function_node.function_length(), vm.current_scope(), m_function_node.kind(), m_function_node.is_strict_mode(), m_function_node.is_arrow_function());
}
-void Return::execute(Bytecode::Interpreter& interpreter) const
+void Return::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.do_return(interpreter.accumulator().value_or(js_undefined()));
}
-void Increment::execute(Bytecode::Interpreter& interpreter) const
+void Increment::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto old_value = interpreter.accumulator().to_numeric(interpreter.global_object());
if (interpreter.vm().exception())
@@ -238,7 +238,7 @@ void Increment::execute(Bytecode::Interpreter& interpreter) const
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().plus(Crypto::SignedBigInteger { 1 }));
}
-void Decrement::execute(Bytecode::Interpreter& interpreter) const
+void Decrement::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto old_value = interpreter.accumulator().to_numeric(interpreter.global_object());
if (interpreter.vm().exception())
@@ -250,28 +250,28 @@ void Decrement::execute(Bytecode::Interpreter& interpreter) const
interpreter.accumulator() = js_bigint(interpreter.vm().heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 }));
}
-void Throw::execute(Bytecode::Interpreter& interpreter) const
+void Throw::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.vm().throw_exception(interpreter.global_object(), interpreter.accumulator());
}
-void EnterUnwindContext::execute(Bytecode::Interpreter& interpreter) const
+void EnterUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.enter_unwind_context(m_handler_target, m_finalizer_target);
interpreter.jump(m_entry_point);
}
-void LeaveUnwindContext::execute(Bytecode::Interpreter& interpreter) const
+void LeaveUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.leave_unwind_context();
}
-void ContinuePendingUnwind::execute(Bytecode::Interpreter& interpreter) const
+void ContinuePendingUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.continue_pending_unwind(m_resume_target);
}
-void PushLexicalEnvironment::execute(Bytecode::Interpreter& interpreter) const
+void PushLexicalEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
{
HashMap<FlyString, Variable> resolved_variables;
for (auto& it : m_variables)
@@ -280,7 +280,7 @@ void PushLexicalEnvironment::execute(Bytecode::Interpreter& interpreter) const
interpreter.vm().call_frame().scope = block_lexical_environment;
}
-void Yield::execute(Bytecode::Interpreter& interpreter) const
+void Yield::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto yielded_value = interpreter.accumulator().value_or(js_undefined());
auto object = JS::Object::create_empty(interpreter.global_object());
@@ -292,7 +292,7 @@ void Yield::execute(Bytecode::Interpreter& interpreter) const
interpreter.do_return(object);
}
-void GetByValue::execute(Bytecode::Interpreter& interpreter) const
+void GetByValue::execute_impl(Bytecode::Interpreter& interpreter) const
{
if (auto* object = interpreter.reg(m_base).to_object(interpreter.global_object())) {
auto property_key = interpreter.accumulator().to_property_key(interpreter.global_object());
@@ -302,7 +302,7 @@ void GetByValue::execute(Bytecode::Interpreter& interpreter) const
}
}
-void PutByValue::execute(Bytecode::Interpreter& interpreter) const
+void PutByValue::execute_impl(Bytecode::Interpreter& interpreter) const
{
if (auto* object = interpreter.reg(m_base).to_object(interpreter.global_object())) {
auto property_key = interpreter.reg(m_property).to_property_key(interpreter.global_object());
@@ -312,32 +312,32 @@ void PutByValue::execute(Bytecode::Interpreter& interpreter) const
}
}
-void LoadArgument::execute(Bytecode::Interpreter& interpreter) const
+void LoadArgument::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = interpreter.vm().argument(m_index);
}
-String Load::to_string(Bytecode::Executable const&) const
+String Load::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("Load {}", m_src);
}
-String LoadImmediate::to_string(Bytecode::Executable const&) const
+String LoadImmediate::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("LoadImmediate {}", m_value);
}
-String Store::to_string(Bytecode::Executable const&) const
+String Store::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("Store {}", m_dst);
}
-String NewBigInt::to_string(Bytecode::Executable const&) const
+String NewBigInt::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("NewBigInt \"{}\"", m_bigint.to_base10());
}
-String NewArray::to_string(Bytecode::Executable const&) const
+String NewArray::to_string_impl(Bytecode::Executable const&) const
{
StringBuilder builder;
builder.append("NewArray");
@@ -353,63 +353,63 @@ String NewArray::to_string(Bytecode::Executable const&) const
return builder.to_string();
}
-String NewString::to_string(Bytecode::Executable const& executable) const
+String NewString::to_string_impl(Bytecode::Executable const& executable) const
{
return String::formatted("NewString {} (\"{}\")", m_string, executable.string_table->get(m_string));
}
-String NewObject::to_string(Bytecode::Executable const&) const
+String NewObject::to_string_impl(Bytecode::Executable const&) const
{
return "NewObject";
}
-String ConcatString::to_string(Bytecode::Executable const&) const
+String ConcatString::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("ConcatString {}", m_lhs);
}
-String GetVariable::to_string(Bytecode::Executable const& executable) const
+String GetVariable::to_string_impl(Bytecode::Executable const& executable) const
{
return String::formatted("GetVariable {} ({})", m_identifier, executable.string_table->get(m_identifier));
}
-String SetVariable::to_string(Bytecode::Executable const& executable) const
+String SetVariable::to_string_impl(Bytecode::Executable const& executable) const
{
return String::formatted("SetVariable {} ({})", m_identifier, executable.string_table->get(m_identifier));
}
-String PutById::to_string(Bytecode::Executable const& executable) const
+String PutById::to_string_impl(Bytecode::Executable const& executable) const
{
return String::formatted("PutById base:{}, property:{} ({})", m_base, m_property, executable.string_table->get(m_property));
}
-String GetById::to_string(Bytecode::Executable const& executable) const
+String GetById::to_string_impl(Bytecode::Executable const& executable) const
{
return String::formatted("GetById {} ({})", m_property, executable.string_table->get(m_property));
}
-String Jump::to_string(Bytecode::Executable const&) const
+String Jump::to_string_impl(Bytecode::Executable const&) const
{
if (m_true_target.has_value())
return String::formatted("Jump {}", *m_true_target);
return String::formatted("Jump <empty>");
}
-String JumpConditional::to_string(Bytecode::Executable const&) const
+String JumpConditional::to_string_impl(Bytecode::Executable const&) const
{
auto true_string = m_true_target.has_value() ? String::formatted("{}", *m_true_target) : "<empty>";
auto false_string = m_false_target.has_value() ? String::formatted("{}", *m_false_target) : "<empty>";
return String::formatted("JumpConditional true:{} false:{}", true_string, false_string);
}
-String JumpNullish::to_string(Bytecode::Executable const&) const
+String JumpNullish::to_string_impl(Bytecode::Executable const&) const
{
auto true_string = m_true_target.has_value() ? String::formatted("{}", *m_true_target) : "<empty>";
auto false_string = m_false_target.has_value() ? String::formatted("{}", *m_false_target) : "<empty>";
return String::formatted("JumpNullish null:{} nonnull:{}", true_string, false_string);
}
-String Call::to_string(Bytecode::Executable const&) const
+String Call::to_string_impl(Bytecode::Executable const&) const
{
StringBuilder builder;
builder.appendff("Call callee:{}, this:{}", m_callee, m_this_value);
@@ -425,49 +425,49 @@ String Call::to_string(Bytecode::Executable const&) const
return builder.to_string();
}
-String NewFunction::to_string(Bytecode::Executable const&) const
+String NewFunction::to_string_impl(Bytecode::Executable const&) const
{
return "NewFunction";
}
-String Return::to_string(Bytecode::Executable const&) const
+String Return::to_string_impl(Bytecode::Executable const&) const
{
return "Return";
}
-String Increment::to_string(Bytecode::Executable const&) const
+String Increment::to_string_impl(Bytecode::Executable const&) const
{
return "Increment";
}
-String Decrement::to_string(Bytecode::Executable const&) const
+String Decrement::to_string_impl(Bytecode::Executable const&) const
{
return "Decrement";
}
-String Throw::to_string(Bytecode::Executable const&) const
+String Throw::to_string_impl(Bytecode::Executable const&) const
{
return "Throw";
}
-String EnterUnwindContext::to_string(Bytecode::Executable const&) const
+String EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const
{
auto handler_string = m_handler_target.has_value() ? String::formatted("{}", *m_handler_target) : "<empty>";
auto finalizer_string = m_finalizer_target.has_value() ? String::formatted("{}", *m_finalizer_target) : "<empty>";
return String::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point);
}
-String LeaveUnwindContext::to_string(Bytecode::Executable const&) const
+String LeaveUnwindContext::to_string_impl(Bytecode::Executable const&) const
{
return "LeaveUnwindContext";
}
-String ContinuePendingUnwind::to_string(Bytecode::Executable const&) const
+String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const
{
return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target);
}
-String PushLexicalEnvironment::to_string(const Bytecode::Executable& executable) const
+String PushLexicalEnvironment::to_string_impl(const Bytecode::Executable& executable) const
{
StringBuilder builder;
builder.append("PushLexicalEnvironment");
@@ -482,24 +482,24 @@ String PushLexicalEnvironment::to_string(const Bytecode::Executable& executable)
return builder.to_string();
}
-String Yield::to_string(Bytecode::Executable const&) const
+String Yield::to_string_impl(Bytecode::Executable const&) const
{
if (m_continuation_label.has_value())
return String::formatted("Yield continuation:@{}", m_continuation_label->block().name());
return String::formatted("Yield return");
}
-String GetByValue::to_string(const Bytecode::Executable&) const
+String GetByValue::to_string_impl(const Bytecode::Executable&) const
{
return String::formatted("GetByValue base:{}", m_base);
}
-String PutByValue::to_string(const Bytecode::Executable&) const
+String PutByValue::to_string_impl(const Bytecode::Executable&) const
{
return String::formatted("PutByValue base:{}, property:{}", m_base, m_property);
}
-String LoadArgument::to_string(const Bytecode::Executable&) const
+String LoadArgument::to_string_impl(const Bytecode::Executable&) const
{
return String::formatted("LoadArgument {}", m_index);
}
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h
index e1342d422c..0ca7ad91ab 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.h
+++ b/Userland/Libraries/LibJS/Bytecode/Op.h
@@ -27,8 +27,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_src;
@@ -42,8 +42,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Value m_value;
@@ -57,8 +57,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_dst;
@@ -88,20 +88,20 @@ private:
O(RightShift, right_shift) \
O(UnsignedRightShift, unsigned_right_shift)
-#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
- class OpTitleCase final : public Instruction { \
- public: \
- explicit OpTitleCase(Register lhs_reg) \
- : Instruction(Type::OpTitleCase) \
- , m_lhs_reg(lhs_reg) \
- { \
- } \
- \
- void execute(Bytecode::Interpreter&) const; \
- String to_string(Bytecode::Executable const&) const; \
- \
- private: \
- Register m_lhs_reg; \
+#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
+ class OpTitleCase final : public Instruction { \
+ public: \
+ explicit OpTitleCase(Register lhs_reg) \
+ : Instruction(Type::OpTitleCase) \
+ , m_lhs_reg(lhs_reg) \
+ { \
+ } \
+ \
+ void execute_impl(Bytecode::Interpreter&) const; \
+ String to_string_impl(Bytecode::Executable const&) const; \
+ \
+ private: \
+ Register m_lhs_reg; \
};
JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
@@ -114,16 +114,16 @@ JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
O(UnaryMinus, unary_minus) \
O(Typeof, typeof_)
-#define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
- class OpTitleCase final : public Instruction { \
- public: \
- OpTitleCase() \
- : Instruction(Type::OpTitleCase) \
- { \
- } \
- \
- void execute(Bytecode::Interpreter&) const; \
- String to_string(Bytecode::Executable const&) const; \
+#define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
+ class OpTitleCase final : public Instruction { \
+ public: \
+ OpTitleCase() \
+ : Instruction(Type::OpTitleCase) \
+ { \
+ } \
+ \
+ void execute_impl(Bytecode::Interpreter&) const; \
+ String to_string_impl(Bytecode::Executable const&) const; \
};
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
@@ -137,8 +137,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
StringTableIndex m_string;
@@ -151,8 +151,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class NewBigInt final : public Instruction {
@@ -163,8 +163,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Crypto::SignedBigInteger m_bigint;
@@ -181,10 +181,10 @@ public:
m_elements[i] = elements[i];
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
- size_t length() const { return sizeof(*this) + sizeof(Register) * m_element_count; }
+ size_t length_impl() const { return sizeof(*this) + sizeof(Register) * m_element_count; }
private:
size_t m_element_count { 0 };
@@ -199,8 +199,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_lhs;
@@ -214,8 +214,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
StringTableIndex m_identifier;
@@ -229,8 +229,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
StringTableIndex m_identifier;
@@ -244,8 +244,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
StringTableIndex m_property;
@@ -260,8 +260,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_base;
@@ -276,8 +276,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_base;
@@ -292,8 +292,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Register m_base;
@@ -324,8 +324,8 @@ public:
m_false_target = move(false_target);
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
protected:
Optional<Label> m_true_target;
@@ -339,8 +339,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class JumpNullish final : public Jump {
@@ -350,8 +350,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
// NOTE: This instruction is variable-width depending on the number of arguments!
@@ -373,10 +373,10 @@ public:
m_arguments[i] = arguments[i];
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
- size_t length() const { return sizeof(*this) + sizeof(Register) * m_argument_count; }
+ size_t length_impl() const { return sizeof(*this) + sizeof(Register) * m_argument_count; }
private:
Register m_callee;
@@ -394,8 +394,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
FunctionNode const& m_function_node;
@@ -410,8 +410,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class Increment final : public Instruction {
@@ -421,8 +421,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class Decrement final : public Instruction {
@@ -432,8 +432,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class Throw final : public Instruction {
@@ -445,8 +445,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class EnterUnwindContext final : public Instruction {
@@ -461,8 +461,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Label m_entry_point;
@@ -477,8 +477,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
};
class ContinuePendingUnwind final : public Instruction {
@@ -491,8 +491,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Label m_resume_target;
@@ -513,8 +513,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
Optional<Label> m_continuation_label;
@@ -527,8 +527,8 @@ public:
, m_variables(move(variables))
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
HashMap<u32, Variable> m_variables;
@@ -542,8 +542,8 @@ public:
{
}
- void execute(Bytecode::Interpreter&) const;
- String to_string(Bytecode::Executable const&) const;
+ void execute_impl(Bytecode::Interpreter&) const;
+ String to_string_impl(Bytecode::Executable const&) const;
private:
size_t m_index { 0 };
@@ -557,7 +557,7 @@ ALWAYS_INLINE void Instruction::execute(Bytecode::Interpreter& interpreter) cons
{
#define __BYTECODE_OP(op) \
case Instruction::Type::op: \
- return static_cast<Bytecode::Op::op const&>(*this).execute(interpreter);
+ return static_cast<Bytecode::Op::op const&>(*this).execute_impl(interpreter);
switch (type()) {
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
@@ -571,9 +571,9 @@ ALWAYS_INLINE void Instruction::execute(Bytecode::Interpreter& interpreter) cons
ALWAYS_INLINE size_t Instruction::length() const
{
if (type() == Type::Call)
- return static_cast<Op::Call const&>(*this).length();
+ return static_cast<Op::Call const&>(*this).length_impl();
else if (type() == Type::NewArray)
- return static_cast<Op::NewArray const&>(*this).length();
+ return static_cast<Op::NewArray const&>(*this).length_impl();
#define __BYTECODE_OP(op) \
case Type::op: \