|
@@ -42,6 +42,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -77,28 +78,29 @@ private:
|
|
|
O(StrictlyEquals, strict_equals) \
|
|
|
O(LeftShift, left_shift)
|
|
|
|
|
|
-#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
|
|
- class OpTitleCase final : public Instruction { \
|
|
|
- public: \
|
|
|
- explicit OpTitleCase(Operand dst, Operand lhs, Operand rhs) \
|
|
|
- : Instruction(Type::OpTitleCase, sizeof(*this)) \
|
|
|
- , m_dst(dst) \
|
|
|
- , m_lhs(lhs) \
|
|
|
- , m_rhs(rhs) \
|
|
|
- { \
|
|
|
- } \
|
|
|
- \
|
|
|
- ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
- ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
- \
|
|
|
- Operand dst() const { return m_dst; } \
|
|
|
- Operand lhs() const { return m_lhs; } \
|
|
|
- Operand rhs() const { return m_rhs; } \
|
|
|
- \
|
|
|
- private: \
|
|
|
- Operand m_dst; \
|
|
|
- Operand m_lhs; \
|
|
|
- Operand m_rhs; \
|
|
|
+#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
|
|
+ class OpTitleCase final : public Instruction { \
|
|
|
+ public: \
|
|
|
+ explicit OpTitleCase(Operand dst, Operand lhs, Operand rhs) \
|
|
|
+ : Instruction(Type::OpTitleCase, sizeof(*this)) \
|
|
|
+ , m_dst(dst) \
|
|
|
+ , m_lhs(lhs) \
|
|
|
+ , m_rhs(rhs) \
|
|
|
+ { \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
+ ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
|
|
+ \
|
|
|
+ Operand dst() const { return m_dst; } \
|
|
|
+ Operand lhs() const { return m_lhs; } \
|
|
|
+ Operand rhs() const { return m_rhs; } \
|
|
|
+ \
|
|
|
+ private: \
|
|
|
+ Operand m_dst; \
|
|
|
+ Operand m_lhs; \
|
|
|
+ Operand m_rhs; \
|
|
|
};
|
|
|
|
|
|
JS_ENUMERATE_COMMON_BINARY_OPS_WITHOUT_FAST_PATH(JS_DECLARE_COMMON_BINARY_OP)
|
|
@@ -112,25 +114,26 @@ JS_ENUMERATE_COMMON_BINARY_OPS_WITH_FAST_PATH(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(Operand dst, Operand src) \
|
|
|
- : Instruction(Type::OpTitleCase, sizeof(*this)) \
|
|
|
- , m_dst(dst) \
|
|
|
- , m_src(src) \
|
|
|
- { \
|
|
|
- } \
|
|
|
- \
|
|
|
- ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
- ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
- \
|
|
|
- Operand dst() const { return m_dst; } \
|
|
|
- Operand src() const { return m_src; } \
|
|
|
- \
|
|
|
- private: \
|
|
|
- Operand m_dst; \
|
|
|
- Operand m_src; \
|
|
|
+#define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
|
|
|
+ class OpTitleCase final : public Instruction { \
|
|
|
+ public: \
|
|
|
+ OpTitleCase(Operand dst, Operand src) \
|
|
|
+ : Instruction(Type::OpTitleCase, sizeof(*this)) \
|
|
|
+ , m_dst(dst) \
|
|
|
+ , m_src(src) \
|
|
|
+ { \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
+ ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
|
|
+ \
|
|
|
+ Operand dst() const { return m_dst; } \
|
|
|
+ Operand src() const { return m_src; } \
|
|
|
+ \
|
|
|
+ private: \
|
|
|
+ Operand m_dst; \
|
|
|
+ Operand m_src; \
|
|
|
};
|
|
|
|
|
|
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
|
|
@@ -146,6 +149,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -166,6 +170,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
StringTableIndex source_index() const { return m_source_index; }
|
|
@@ -182,25 +187,26 @@ private:
|
|
|
#define JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(O) \
|
|
|
O(TypeError)
|
|
|
|
|
|
-#define JS_DECLARE_NEW_BUILTIN_ERROR_OP(ErrorName) \
|
|
|
- class New##ErrorName final : public Instruction { \
|
|
|
- public: \
|
|
|
- New##ErrorName(Operand dst, StringTableIndex error_string) \
|
|
|
- : Instruction(Type::New##ErrorName, sizeof(*this)) \
|
|
|
- , m_dst(dst) \
|
|
|
- , m_error_string(error_string) \
|
|
|
- { \
|
|
|
- } \
|
|
|
- \
|
|
|
- ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
- ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
- \
|
|
|
- Operand dst() const { return m_dst; } \
|
|
|
- StringTableIndex error_string() const { return m_error_string; } \
|
|
|
- \
|
|
|
- private: \
|
|
|
- Operand m_dst; \
|
|
|
- StringTableIndex m_error_string; \
|
|
|
+#define JS_DECLARE_NEW_BUILTIN_ERROR_OP(ErrorName) \
|
|
|
+ class New##ErrorName final : public Instruction { \
|
|
|
+ public: \
|
|
|
+ New##ErrorName(Operand dst, StringTableIndex error_string) \
|
|
|
+ : Instruction(Type::New##ErrorName, sizeof(*this)) \
|
|
|
+ , m_dst(dst) \
|
|
|
+ , m_error_string(error_string) \
|
|
|
+ { \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
|
|
+ ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { } \
|
|
|
+ \
|
|
|
+ Operand dst() const { return m_dst; } \
|
|
|
+ StringTableIndex error_string() const { return m_error_string; } \
|
|
|
+ \
|
|
|
+ private: \
|
|
|
+ Operand m_dst; \
|
|
|
+ StringTableIndex m_error_string; \
|
|
|
};
|
|
|
|
|
|
JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(JS_DECLARE_NEW_BUILTIN_ERROR_OP)
|
|
@@ -221,6 +227,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
size_t length_impl(size_t excluded_names_count) const
|
|
|
{
|
|
@@ -260,6 +267,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -306,6 +314,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
ReadonlySpan<Value> elements() const { return { m_elements, m_element_count }; }
|
|
@@ -328,6 +337,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -351,6 +361,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand specifier() const { return m_specifier; }
|
|
@@ -373,6 +384,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand iterator() const { return m_iterator; }
|
|
@@ -393,6 +405,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -416,6 +429,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
};
|
|
|
|
|
|
class EnterObjectEnvironment final : public Instruction {
|
|
@@ -428,6 +442,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand object() const { return m_object; }
|
|
|
|
|
@@ -445,6 +460,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -466,6 +482,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
|
EnvironmentMode mode() const { return m_mode; }
|
|
@@ -499,6 +516,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -525,6 +543,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
size_t index() const { return m_index; }
|
|
|
Operand dst() const { return Operand(Operand::Type::Local, m_index); }
|
|
@@ -548,6 +567,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
|
u32 cache_index() const { return m_cache_index; }
|
|
@@ -573,6 +593,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
@@ -596,6 +617,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
@@ -618,6 +640,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
@@ -640,6 +663,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -667,6 +691,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -694,6 +719,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -717,6 +743,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -751,6 +778,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand base() const { return m_base; }
|
|
|
IdentifierTableIndex property() const { return m_property; }
|
|
@@ -781,6 +809,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand base() const { return m_base; }
|
|
|
Operand this_value() const { return m_this_value; }
|
|
@@ -811,6 +840,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand base() const { return m_base; }
|
|
|
IdentifierTableIndex property() const { return m_property; }
|
|
@@ -835,6 +865,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -859,6 +890,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -884,6 +916,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -908,6 +941,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -934,6 +968,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand base() const { return m_base; }
|
|
|
Operand property() const { return m_property; }
|
|
@@ -961,6 +996,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand base() const { return m_base; }
|
|
|
Operand property() const { return m_property; }
|
|
@@ -988,6 +1024,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand base() const { return m_base; }
|
|
@@ -1017,6 +1054,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
private:
|
|
|
Operand m_dst;
|
|
@@ -1052,6 +1090,13 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (m_true_target.has_value() && &m_true_target->block() == &from)
|
|
|
+ m_true_target = Label { to };
|
|
|
+ if (m_false_target.has_value() && &m_false_target->block() == &from)
|
|
|
+ m_false_target = Label { to };
|
|
|
+ }
|
|
|
|
|
|
auto& true_target() const { return m_true_target; }
|
|
|
auto& false_target() const { return m_false_target; }
|
|
@@ -1151,6 +1196,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
private:
|
|
|
Operand m_dst;
|
|
@@ -1185,6 +1231,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
private:
|
|
|
Operand m_dst;
|
|
@@ -1207,6 +1254,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand arguments() const { return m_arguments; }
|
|
@@ -1231,6 +1279,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Optional<Operand> const& super_class() const { return m_super_class; }
|
|
@@ -1257,6 +1306,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
FunctionExpression const& function_node() const { return m_function_node; }
|
|
@@ -1280,6 +1330,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
ScopeNode const& scope_node() const { return m_scope_node; }
|
|
|
|
|
@@ -1299,6 +1350,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Optional<Operand> const& value() const { return m_value; }
|
|
|
|
|
@@ -1316,6 +1368,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1334,6 +1387,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -1353,6 +1407,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1371,6 +1426,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand src() const { return m_src; }
|
|
@@ -1392,6 +1448,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand src() const { return m_src; }
|
|
|
|
|
@@ -1409,6 +1466,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand src() const { return m_src; }
|
|
|
|
|
@@ -1426,6 +1484,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand src() const { return m_src; }
|
|
|
|
|
@@ -1443,6 +1502,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand src() const { return m_src; }
|
|
|
|
|
@@ -1454,19 +1514,34 @@ class EnterUnwindContext final : public Instruction {
|
|
|
public:
|
|
|
constexpr static bool IsTerminator = true;
|
|
|
|
|
|
- EnterUnwindContext(Label entry_point)
|
|
|
+ EnterUnwindContext(Label entry_point, Optional<Label> handler, Optional<Label> finalizer)
|
|
|
: Instruction(Type::EnterUnwindContext, sizeof(*this))
|
|
|
, m_entry_point(move(entry_point))
|
|
|
+ , m_handler(move(handler))
|
|
|
+ , m_finalizer(move(finalizer))
|
|
|
{
|
|
|
}
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (&m_entry_point.block() == &from)
|
|
|
+ m_entry_point = Label { to };
|
|
|
+ if (m_handler.has_value() && &m_handler->block() == &from)
|
|
|
+ m_handler = Label { to };
|
|
|
+ if (m_finalizer.has_value() && &m_finalizer->block() == &from)
|
|
|
+ m_finalizer = Label { to };
|
|
|
+ }
|
|
|
|
|
|
auto& entry_point() const { return m_entry_point; }
|
|
|
+ auto& handler() const { return m_handler; }
|
|
|
+ auto& finalizer() const { return m_finalizer; }
|
|
|
|
|
|
private:
|
|
|
Label m_entry_point;
|
|
|
+ Optional<Label> m_handler;
|
|
|
+ Optional<Label> m_finalizer;
|
|
|
};
|
|
|
|
|
|
class ScheduleJump final : public Instruction {
|
|
@@ -1492,6 +1567,11 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (&m_target.block() == &from)
|
|
|
+ m_target = Label { to };
|
|
|
+ }
|
|
|
|
|
|
private:
|
|
|
Label m_target;
|
|
@@ -1506,6 +1586,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
};
|
|
|
|
|
|
class LeaveUnwindContext final : public Instruction {
|
|
@@ -1517,6 +1598,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
};
|
|
|
|
|
|
class ContinuePendingUnwind final : public Instruction {
|
|
@@ -1531,6 +1613,11 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (&m_resume_target.block() == &from)
|
|
|
+ m_resume_target = Label { to };
|
|
|
+ }
|
|
|
|
|
|
auto& resume_target() const { return m_resume_target; }
|
|
|
|
|
@@ -1557,6 +1644,11 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (m_continuation_label.has_value() && &m_continuation_label->block() == &from)
|
|
|
+ m_continuation_label = Label { to };
|
|
|
+ }
|
|
|
|
|
|
auto& continuation() const { return m_continuation_label; }
|
|
|
Operand value() const { return m_value; }
|
|
@@ -1579,6 +1671,11 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
|
|
+ {
|
|
|
+ if (&m_continuation_label.block() == &from)
|
|
|
+ m_continuation_label = Label { to };
|
|
|
+ }
|
|
|
|
|
|
auto& continuation() const { return m_continuation_label; }
|
|
|
Operand argument() const { return m_argument; }
|
|
@@ -1600,6 +1697,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand iterable() const { return m_iterable; }
|
|
@@ -1622,6 +1720,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand object() const { return m_object; }
|
|
|
Operand iterator_record() const { return m_iterator_record; }
|
|
@@ -1642,6 +1741,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand next_method() const { return m_next_method; }
|
|
|
Operand iterator_record() const { return m_iterator_record; }
|
|
@@ -1663,6 +1763,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand object() const { return m_object; }
|
|
@@ -1685,6 +1786,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand object() const { return m_object; }
|
|
@@ -1706,6 +1808,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand iterator_record() const { return m_iterator_record; }
|
|
|
Completion::Type completion_type() const { return m_completion_type; }
|
|
@@ -1729,6 +1832,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand iterator_record() const { return m_iterator_record; }
|
|
|
Completion::Type completion_type() const { return m_completion_type; }
|
|
@@ -1751,6 +1855,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
Operand iterator_record() const { return m_iterator_record; }
|
|
@@ -1770,6 +1875,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1787,6 +1893,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1804,6 +1911,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1821,6 +1929,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
|
|
@@ -1839,6 +1948,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand dst() const { return m_dst; }
|
|
|
IdentifierTableIndex identifier() const { return m_identifier; }
|
|
@@ -1860,6 +1970,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
Operand value() const { return m_value; }
|
|
|
|
|
@@ -1878,6 +1989,7 @@ public:
|
|
|
|
|
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
|
|
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
|
|
+ void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
|
|
|
|
|
private:
|
|
|
StringView m_text;
|