Instruction.cpp 590 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Bytecode/Instruction.h>
  7. #include <LibJS/Bytecode/Op.h>
  8. namespace JS::Bytecode {
  9. void Instruction::destroy(Instruction& instruction)
  10. {
  11. #define __BYTECODE_OP(op) \
  12. case Type::op: \
  13. static_cast<Op::op&>(instruction).~op(); \
  14. return;
  15. switch (instruction.type()) {
  16. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  17. default:
  18. VERIFY_NOT_REACHED();
  19. }
  20. #undef __BYTECODE_OP
  21. }
  22. }