Op.h 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
  4. * Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
  5. *
  6. * SPDX-License-Identifier: BSD-2-Clause
  7. */
  8. #pragma once
  9. #include <AK/StdLibExtras.h>
  10. #include <LibCrypto/BigInt/SignedBigInteger.h>
  11. #include <LibJS/Bytecode/IdentifierTable.h>
  12. #include <LibJS/Bytecode/Instruction.h>
  13. #include <LibJS/Bytecode/Label.h>
  14. #include <LibJS/Bytecode/Register.h>
  15. #include <LibJS/Bytecode/StringTable.h>
  16. #include <LibJS/Heap/Cell.h>
  17. #include <LibJS/Runtime/Environment.h>
  18. #include <LibJS/Runtime/EnvironmentCoordinate.h>
  19. #include <LibJS/Runtime/Value.h>
  20. #include <LibJS/Runtime/ValueTraits.h>
  21. namespace JS::Bytecode::Op {
  22. class Load final : public Instruction {
  23. public:
  24. explicit Load(Register src)
  25. : Instruction(Type::Load)
  26. , m_src(src)
  27. {
  28. }
  29. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  30. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  31. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  32. void replace_references_impl(Register from, Register to)
  33. {
  34. if (m_src == from)
  35. m_src = to;
  36. }
  37. private:
  38. Register m_src;
  39. };
  40. class LoadImmediate final : public Instruction {
  41. public:
  42. explicit LoadImmediate(Value value)
  43. : Instruction(Type::LoadImmediate)
  44. , m_value(value)
  45. {
  46. }
  47. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  48. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  49. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  50. void replace_references_impl(Register, Register) { }
  51. private:
  52. Value m_value;
  53. };
  54. class Store final : public Instruction {
  55. public:
  56. explicit Store(Register dst)
  57. : Instruction(Type::Store)
  58. , m_dst(dst)
  59. {
  60. }
  61. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  62. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  63. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  64. void replace_references_impl(Register, Register) { }
  65. Register dst() const { return m_dst; }
  66. private:
  67. Register m_dst;
  68. };
  69. #define JS_ENUMERATE_COMMON_BINARY_OPS(O) \
  70. O(Add, add) \
  71. O(Sub, sub) \
  72. O(Mul, mul) \
  73. O(Div, div) \
  74. O(Exp, exp) \
  75. O(Mod, mod) \
  76. O(In, in) \
  77. O(InstanceOf, instance_of) \
  78. O(GreaterThan, greater_than) \
  79. O(GreaterThanEquals, greater_than_equals) \
  80. O(LessThan, less_than) \
  81. O(LessThanEquals, less_than_equals) \
  82. O(LooselyInequals, abstract_inequals) \
  83. O(LooselyEquals, abstract_equals) \
  84. O(StrictlyInequals, typed_inequals) \
  85. O(StrictlyEquals, typed_equals) \
  86. O(BitwiseAnd, bitwise_and) \
  87. O(BitwiseOr, bitwise_or) \
  88. O(BitwiseXor, bitwise_xor) \
  89. O(LeftShift, left_shift) \
  90. O(RightShift, right_shift) \
  91. O(UnsignedRightShift, unsigned_right_shift)
  92. #define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
  93. class OpTitleCase final : public Instruction { \
  94. public: \
  95. explicit OpTitleCase(Register lhs_reg) \
  96. : Instruction(Type::OpTitleCase) \
  97. , m_lhs_reg(lhs_reg) \
  98. { \
  99. } \
  100. \
  101. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  102. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; \
  103. void replace_references_impl(BasicBlock const&, BasicBlock const&) \
  104. { \
  105. } \
  106. void replace_references_impl(Register from, Register to) \
  107. { \
  108. if (m_lhs_reg == from) \
  109. m_lhs_reg = to; \
  110. } \
  111. \
  112. private: \
  113. Register m_lhs_reg; \
  114. };
  115. JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
  116. #undef JS_DECLARE_COMMON_BINARY_OP
  117. #define JS_ENUMERATE_COMMON_UNARY_OPS(O) \
  118. O(BitwiseNot, bitwise_not) \
  119. O(Not, not_) \
  120. O(UnaryPlus, unary_plus) \
  121. O(UnaryMinus, unary_minus) \
  122. O(Typeof, typeof_)
  123. #define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
  124. class OpTitleCase final : public Instruction { \
  125. public: \
  126. OpTitleCase() \
  127. : Instruction(Type::OpTitleCase) \
  128. { \
  129. } \
  130. \
  131. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  132. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; \
  133. void replace_references_impl(BasicBlock const&, BasicBlock const&) \
  134. { \
  135. } \
  136. void replace_references_impl(Register, Register) \
  137. { \
  138. } \
  139. };
  140. JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
  141. #undef JS_DECLARE_COMMON_UNARY_OP
  142. class NewString final : public Instruction {
  143. public:
  144. explicit NewString(StringTableIndex string)
  145. : Instruction(Type::NewString)
  146. , m_string(string)
  147. {
  148. }
  149. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  150. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  151. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  152. void replace_references_impl(Register, Register) { }
  153. private:
  154. StringTableIndex m_string;
  155. };
  156. class NewObject final : public Instruction {
  157. public:
  158. NewObject()
  159. : Instruction(Type::NewObject)
  160. {
  161. }
  162. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  163. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  164. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  165. void replace_references_impl(Register, Register) { }
  166. };
  167. class NewRegExp final : public Instruction {
  168. public:
  169. NewRegExp(StringTableIndex source_index, StringTableIndex flags_index)
  170. : Instruction(Type::NewRegExp)
  171. , m_source_index(source_index)
  172. , m_flags_index(flags_index)
  173. {
  174. }
  175. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  176. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  177. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  178. void replace_references_impl(Register, Register) { }
  179. private:
  180. StringTableIndex m_source_index;
  181. StringTableIndex m_flags_index;
  182. };
  183. #define JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(O) \
  184. O(TypeError)
  185. #define JS_DECLARE_NEW_BUILTIN_ERROR_OP(ErrorName) \
  186. class New##ErrorName final : public Instruction { \
  187. public: \
  188. explicit New##ErrorName(StringTableIndex error_string) \
  189. : Instruction(Type::New##ErrorName) \
  190. , m_error_string(error_string) \
  191. { \
  192. } \
  193. \
  194. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  195. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; \
  196. void replace_references_impl(BasicBlock const&, BasicBlock const&) \
  197. { \
  198. } \
  199. void replace_references_impl(Register, Register) \
  200. { \
  201. } \
  202. \
  203. private: \
  204. StringTableIndex m_error_string; \
  205. };
  206. JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(JS_DECLARE_NEW_BUILTIN_ERROR_OP)
  207. #undef JS_DECLARE_NEW_BUILTIN_ERROR_OP
  208. // NOTE: This instruction is variable-width depending on the number of excluded names
  209. class CopyObjectExcludingProperties final : public Instruction {
  210. public:
  211. CopyObjectExcludingProperties(Register from_object, Vector<Register> const& excluded_names)
  212. : Instruction(Type::CopyObjectExcludingProperties)
  213. , m_from_object(from_object)
  214. , m_excluded_names_count(excluded_names.size())
  215. {
  216. for (size_t i = 0; i < m_excluded_names_count; i++)
  217. m_excluded_names[i] = excluded_names[i];
  218. }
  219. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  220. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  221. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  222. void replace_references_impl(Register from, Register to);
  223. size_t length_impl() const { return sizeof(*this) + sizeof(Register) * m_excluded_names_count; }
  224. private:
  225. Register m_from_object;
  226. size_t m_excluded_names_count { 0 };
  227. Register m_excluded_names[];
  228. };
  229. class NewBigInt final : public Instruction {
  230. public:
  231. explicit NewBigInt(Crypto::SignedBigInteger bigint)
  232. : Instruction(Type::NewBigInt)
  233. , m_bigint(move(bigint))
  234. {
  235. }
  236. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  237. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  238. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  239. void replace_references_impl(Register, Register) { }
  240. private:
  241. Crypto::SignedBigInteger m_bigint;
  242. };
  243. // NOTE: This instruction is variable-width depending on the number of elements!
  244. class NewArray final : public Instruction {
  245. public:
  246. NewArray()
  247. : Instruction(Type::NewArray)
  248. , m_element_count(0)
  249. {
  250. }
  251. explicit NewArray(AK::Array<Register, 2> const& elements_range)
  252. : Instruction(Type::NewArray)
  253. , m_element_count(elements_range[1].index() - elements_range[0].index() + 1)
  254. {
  255. m_elements[0] = elements_range[0];
  256. m_elements[1] = elements_range[1];
  257. }
  258. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  259. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  260. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  261. // Note: The underlying element range shall never be changed item, by item
  262. // shifting it may be done in the future
  263. void replace_references_impl(Register from, Register) { VERIFY(!m_element_count || from.index() < start().index() || from.index() > end().index()); }
  264. size_t length_impl() const
  265. {
  266. return sizeof(*this) + sizeof(Register) * (m_element_count == 0 ? 0 : 2);
  267. }
  268. Register start() const
  269. {
  270. VERIFY(m_element_count);
  271. return m_elements[0];
  272. }
  273. Register end() const
  274. {
  275. VERIFY(m_element_count);
  276. return m_elements[1];
  277. }
  278. size_t element_count() const { return m_element_count; }
  279. private:
  280. size_t m_element_count { 0 };
  281. Register m_elements[];
  282. };
  283. class Append final : public Instruction {
  284. public:
  285. Append(Register lhs, bool is_spread)
  286. : Instruction(Type::Append)
  287. , m_lhs(lhs)
  288. , m_is_spread(is_spread)
  289. {
  290. }
  291. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  292. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  293. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  294. // Note: This should never do anything, the lhs should always be an array, that is currently being constructed
  295. void replace_references_impl(Register from, Register) { VERIFY(from != m_lhs); }
  296. private:
  297. Register m_lhs;
  298. bool m_is_spread = false;
  299. };
  300. class IteratorToArray final : public Instruction {
  301. public:
  302. IteratorToArray()
  303. : Instruction(Type::IteratorToArray)
  304. {
  305. }
  306. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  307. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  308. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  309. void replace_references_impl(Register, Register) { }
  310. };
  311. class ConcatString final : public Instruction {
  312. public:
  313. explicit ConcatString(Register lhs)
  314. : Instruction(Type::ConcatString)
  315. , m_lhs(lhs)
  316. {
  317. }
  318. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  319. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  320. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  321. // Note: lhs should always be a string in construction, so this should never do anything
  322. void replace_references_impl(Register from, Register) { VERIFY(from != m_lhs); }
  323. private:
  324. Register m_lhs;
  325. };
  326. enum class EnvironmentMode {
  327. Lexical,
  328. Var,
  329. };
  330. class CreateEnvironment final : public Instruction {
  331. public:
  332. explicit CreateEnvironment(EnvironmentMode mode)
  333. : Instruction(Type::CreateEnvironment)
  334. , m_mode(mode)
  335. {
  336. }
  337. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  338. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  339. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  340. void replace_references_impl(Register, Register) { }
  341. private:
  342. EnvironmentMode m_mode { EnvironmentMode::Lexical };
  343. };
  344. class EnterObjectEnvironment final : public Instruction {
  345. public:
  346. explicit EnterObjectEnvironment()
  347. : Instruction(Type::EnterObjectEnvironment)
  348. {
  349. }
  350. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  351. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  352. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  353. void replace_references_impl(Register, Register) { }
  354. };
  355. class CreateVariable final : public Instruction {
  356. public:
  357. explicit CreateVariable(IdentifierTableIndex identifier, EnvironmentMode mode, bool is_immutable, bool is_global = false)
  358. : Instruction(Type::CreateVariable)
  359. , m_identifier(identifier)
  360. , m_mode(mode)
  361. , m_is_immutable(is_immutable)
  362. , m_is_global(is_global)
  363. {
  364. }
  365. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  366. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  367. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  368. void replace_references_impl(Register, Register) { }
  369. private:
  370. IdentifierTableIndex m_identifier;
  371. EnvironmentMode m_mode;
  372. bool m_is_immutable : 4 { false };
  373. bool m_is_global : 4 { false };
  374. };
  375. class SetVariable final : public Instruction {
  376. public:
  377. enum class InitializationMode {
  378. Initialize,
  379. Set,
  380. InitializeOrSet,
  381. };
  382. explicit SetVariable(IdentifierTableIndex identifier, InitializationMode initialization_mode = InitializationMode::Set, EnvironmentMode mode = EnvironmentMode::Lexical)
  383. : Instruction(Type::SetVariable)
  384. , m_identifier(identifier)
  385. , m_mode(mode)
  386. , m_initialization_mode(initialization_mode)
  387. {
  388. }
  389. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  390. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  391. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  392. void replace_references_impl(Register, Register) { }
  393. IdentifierTableIndex identifier() const { return m_identifier; }
  394. private:
  395. IdentifierTableIndex m_identifier;
  396. EnvironmentMode m_mode;
  397. InitializationMode m_initialization_mode { InitializationMode::Set };
  398. };
  399. class GetVariable final : public Instruction {
  400. public:
  401. explicit GetVariable(IdentifierTableIndex identifier)
  402. : Instruction(Type::GetVariable)
  403. , m_identifier(identifier)
  404. {
  405. }
  406. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  407. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  408. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  409. void replace_references_impl(Register, Register) { }
  410. IdentifierTableIndex identifier() const { return m_identifier; }
  411. private:
  412. IdentifierTableIndex m_identifier;
  413. Optional<EnvironmentCoordinate> mutable m_cached_environment_coordinate;
  414. };
  415. class DeleteVariable final : public Instruction {
  416. public:
  417. explicit DeleteVariable(IdentifierTableIndex identifier)
  418. : Instruction(Type::DeleteVariable)
  419. , m_identifier(identifier)
  420. {
  421. }
  422. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  423. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  424. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  425. void replace_references_impl(Register, Register) { }
  426. IdentifierTableIndex identifier() const { return m_identifier; }
  427. private:
  428. IdentifierTableIndex m_identifier;
  429. };
  430. class GetById final : public Instruction {
  431. public:
  432. explicit GetById(IdentifierTableIndex property)
  433. : Instruction(Type::GetById)
  434. , m_property(property)
  435. {
  436. }
  437. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  438. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  439. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  440. void replace_references_impl(Register, Register) { }
  441. private:
  442. IdentifierTableIndex m_property;
  443. };
  444. enum class PropertyKind {
  445. Getter,
  446. Setter,
  447. KeyValue,
  448. Spread,
  449. ProtoSetter,
  450. };
  451. class PutById final : public Instruction {
  452. public:
  453. explicit PutById(Register base, IdentifierTableIndex property, PropertyKind kind = PropertyKind::KeyValue)
  454. : Instruction(Type::PutById)
  455. , m_base(base)
  456. , m_property(property)
  457. , m_kind(kind)
  458. {
  459. }
  460. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  461. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  462. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  463. void replace_references_impl(Register from, Register to)
  464. {
  465. if (m_base == from)
  466. m_base = to;
  467. }
  468. private:
  469. Register m_base;
  470. IdentifierTableIndex m_property;
  471. PropertyKind m_kind;
  472. };
  473. class DeleteById final : public Instruction {
  474. public:
  475. explicit DeleteById(IdentifierTableIndex property)
  476. : Instruction(Type::DeleteById)
  477. , m_property(property)
  478. {
  479. }
  480. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  481. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  482. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  483. void replace_references_impl(Register, Register) { }
  484. private:
  485. IdentifierTableIndex m_property;
  486. };
  487. class GetByValue final : public Instruction {
  488. public:
  489. explicit GetByValue(Register base)
  490. : Instruction(Type::GetByValue)
  491. , m_base(base)
  492. {
  493. }
  494. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  495. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  496. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  497. void replace_references_impl(Register from, Register to)
  498. {
  499. if (m_base == from)
  500. m_base = to;
  501. }
  502. private:
  503. Register m_base;
  504. };
  505. class PutByValue final : public Instruction {
  506. public:
  507. PutByValue(Register base, Register property, PropertyKind kind = PropertyKind::KeyValue)
  508. : Instruction(Type::PutByValue)
  509. , m_base(base)
  510. , m_property(property)
  511. , m_kind(kind)
  512. {
  513. }
  514. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  515. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  516. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  517. void replace_references_impl(Register from, Register to)
  518. {
  519. if (m_base == from)
  520. m_base = to;
  521. }
  522. private:
  523. Register m_base;
  524. Register m_property;
  525. PropertyKind m_kind;
  526. };
  527. class DeleteByValue final : public Instruction {
  528. public:
  529. DeleteByValue(Register base)
  530. : Instruction(Type::DeleteByValue)
  531. , m_base(base)
  532. {
  533. }
  534. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  535. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  536. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  537. void replace_references_impl(Register from, Register to)
  538. {
  539. if (m_base == from)
  540. m_base = to;
  541. }
  542. private:
  543. Register m_base;
  544. };
  545. class Jump : public Instruction {
  546. public:
  547. constexpr static bool IsTerminator = true;
  548. explicit Jump(Type type, Optional<Label> taken_target = {}, Optional<Label> nontaken_target = {})
  549. : Instruction(type)
  550. , m_true_target(move(taken_target))
  551. , m_false_target(move(nontaken_target))
  552. {
  553. }
  554. explicit Jump(Optional<Label> taken_target = {}, Optional<Label> nontaken_target = {})
  555. : Instruction(Type::Jump)
  556. , m_true_target(move(taken_target))
  557. , m_false_target(move(nontaken_target))
  558. {
  559. }
  560. void set_targets(Optional<Label> true_target, Optional<Label> false_target)
  561. {
  562. m_true_target = move(true_target);
  563. m_false_target = move(false_target);
  564. }
  565. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  566. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  567. void replace_references_impl(BasicBlock const&, BasicBlock const&);
  568. void replace_references_impl(Register, Register) { }
  569. auto& true_target() const { return m_true_target; }
  570. auto& false_target() const { return m_false_target; }
  571. protected:
  572. Optional<Label> m_true_target;
  573. Optional<Label> m_false_target;
  574. };
  575. class JumpConditional final : public Jump {
  576. public:
  577. explicit JumpConditional(Optional<Label> true_target = {}, Optional<Label> false_target = {})
  578. : Jump(Type::JumpConditional, move(true_target), move(false_target))
  579. {
  580. }
  581. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  582. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  583. };
  584. class JumpNullish final : public Jump {
  585. public:
  586. explicit JumpNullish(Optional<Label> true_target = {}, Optional<Label> false_target = {})
  587. : Jump(Type::JumpNullish, move(true_target), move(false_target))
  588. {
  589. }
  590. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  591. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  592. };
  593. class JumpUndefined final : public Jump {
  594. public:
  595. explicit JumpUndefined(Optional<Label> true_target = {}, Optional<Label> false_target = {})
  596. : Jump(Type::JumpUndefined, move(true_target), move(false_target))
  597. {
  598. }
  599. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  600. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  601. };
  602. // NOTE: This instruction is variable-width depending on the number of arguments!
  603. class Call final : public Instruction {
  604. public:
  605. enum class CallType {
  606. Call,
  607. Construct,
  608. };
  609. Call(CallType type, Register callee, Register this_value, Optional<StringTableIndex> expression_string = {})
  610. : Instruction(Type::Call)
  611. , m_callee(callee)
  612. , m_this_value(this_value)
  613. , m_type(type)
  614. , m_expression_string(expression_string)
  615. {
  616. }
  617. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  618. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  619. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  620. void replace_references_impl(Register, Register);
  621. Completion throw_type_error_for_callee(Bytecode::Interpreter&, StringView callee_type) const;
  622. private:
  623. Register m_callee;
  624. Register m_this_value;
  625. CallType m_type;
  626. Optional<StringTableIndex> m_expression_string;
  627. };
  628. // NOTE: This instruction is variable-width depending on the number of arguments!
  629. class SuperCall : public Instruction {
  630. public:
  631. explicit SuperCall(bool is_synthetic)
  632. : Instruction(Type::SuperCall)
  633. , m_is_synthetic(is_synthetic)
  634. {
  635. }
  636. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  637. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  638. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  639. void replace_references_impl(Register, Register) { }
  640. private:
  641. bool m_is_synthetic;
  642. };
  643. class NewClass final : public Instruction {
  644. public:
  645. explicit NewClass(ClassExpression const& class_expression)
  646. : Instruction(Type::NewClass)
  647. , m_class_expression(class_expression)
  648. {
  649. }
  650. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  651. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  652. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  653. void replace_references_impl(Register, Register) { }
  654. private:
  655. ClassExpression const& m_class_expression;
  656. };
  657. class NewFunction final : public Instruction {
  658. public:
  659. explicit NewFunction(FunctionNode const& function_node)
  660. : Instruction(Type::NewFunction)
  661. , m_function_node(function_node)
  662. {
  663. }
  664. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  665. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  666. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  667. void replace_references_impl(Register, Register) { }
  668. private:
  669. FunctionNode const& m_function_node;
  670. };
  671. class Return final : public Instruction {
  672. public:
  673. constexpr static bool IsTerminator = true;
  674. Return()
  675. : Instruction(Type::Return)
  676. {
  677. }
  678. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  679. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  680. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  681. void replace_references_impl(Register, Register) { }
  682. };
  683. class Increment final : public Instruction {
  684. public:
  685. Increment()
  686. : Instruction(Type::Increment)
  687. {
  688. }
  689. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  690. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  691. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  692. void replace_references_impl(Register, Register) { }
  693. };
  694. class Decrement final : public Instruction {
  695. public:
  696. Decrement()
  697. : Instruction(Type::Decrement)
  698. {
  699. }
  700. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  701. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  702. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  703. void replace_references_impl(Register, Register) { }
  704. };
  705. class Throw final : public Instruction {
  706. public:
  707. constexpr static bool IsTerminator = true;
  708. Throw()
  709. : Instruction(Type::Throw)
  710. {
  711. }
  712. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  713. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  714. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  715. void replace_references_impl(Register, Register) { }
  716. };
  717. class ThrowIfNotObject final : public Instruction {
  718. public:
  719. ThrowIfNotObject()
  720. : Instruction(Type::ThrowIfNotObject)
  721. {
  722. }
  723. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  724. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  725. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  726. void replace_references_impl(Register, Register) { }
  727. };
  728. class EnterUnwindContext final : public Instruction {
  729. public:
  730. constexpr static bool IsTerminator = true;
  731. EnterUnwindContext(Label entry_point, Optional<Label> handler_target, Optional<Label> finalizer_target)
  732. : Instruction(Type::EnterUnwindContext)
  733. , m_entry_point(move(entry_point))
  734. , m_handler_target(move(handler_target))
  735. , m_finalizer_target(move(finalizer_target))
  736. {
  737. }
  738. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  739. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  740. void replace_references_impl(BasicBlock const&, BasicBlock const&);
  741. void replace_references_impl(Register, Register) { }
  742. auto& entry_point() const { return m_entry_point; }
  743. auto& handler_target() const { return m_handler_target; }
  744. auto& finalizer_target() const { return m_finalizer_target; }
  745. private:
  746. Label m_entry_point;
  747. Optional<Label> m_handler_target;
  748. Optional<Label> m_finalizer_target;
  749. };
  750. class ScheduleJump final : public Instruction {
  751. public:
  752. // Note: We use this instruction to tell the next `finally` block to
  753. // continue execution with a specific break/continue target;
  754. // FIXME: We currently don't clear the interpreter internal flag, when we change
  755. // the control-flow (`break`, `continue`) in a finally-block,
  756. // FIXME: .NET on x86_64 uses a call to the finally instead, which could make this
  757. // easier, at the cost of making control-flow changes (`break`, `continue`, `return`)
  758. // in the finally-block more difficult, but as stated above, those
  759. // aren't handled 100% correctly at the moment anyway
  760. // It might be worth investigating a similar mechanism
  761. constexpr static bool IsTerminator = true;
  762. ScheduleJump(Label target)
  763. : Instruction(Type::ScheduleJump)
  764. , m_target(target)
  765. {
  766. }
  767. Label target() const { return m_target; }
  768. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  769. void replace_references_impl(BasicBlock const& from, BasicBlock const& to)
  770. {
  771. if (&m_target.block() == &from)
  772. m_target = Label { to };
  773. }
  774. void replace_references_impl(Register, Register) { }
  775. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  776. private:
  777. Label m_target;
  778. };
  779. class LeaveEnvironment final : public Instruction {
  780. public:
  781. LeaveEnvironment(EnvironmentMode mode)
  782. : Instruction(Type::LeaveEnvironment)
  783. , m_mode(mode)
  784. {
  785. }
  786. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  787. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  788. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  789. void replace_references_impl(Register, Register) { }
  790. private:
  791. EnvironmentMode m_mode { EnvironmentMode::Lexical };
  792. };
  793. class LeaveUnwindContext final : public Instruction {
  794. public:
  795. LeaveUnwindContext()
  796. : Instruction(Type::LeaveUnwindContext)
  797. {
  798. }
  799. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  800. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  801. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  802. void replace_references_impl(Register, Register) { }
  803. };
  804. class ContinuePendingUnwind final : public Instruction {
  805. public:
  806. constexpr static bool IsTerminator = true;
  807. explicit ContinuePendingUnwind(Label resume_target)
  808. : Instruction(Type::ContinuePendingUnwind)
  809. , m_resume_target(resume_target)
  810. {
  811. }
  812. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  813. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  814. void replace_references_impl(BasicBlock const&, BasicBlock const&);
  815. void replace_references_impl(Register, Register) { }
  816. auto& resume_target() const { return m_resume_target; }
  817. private:
  818. Label m_resume_target;
  819. };
  820. class Yield final : public Instruction {
  821. public:
  822. constexpr static bool IsTerminator = true;
  823. explicit Yield(Label continuation_label)
  824. : Instruction(Type::Yield)
  825. , m_continuation_label(continuation_label)
  826. {
  827. }
  828. explicit Yield(nullptr_t)
  829. : Instruction(Type::Yield)
  830. {
  831. }
  832. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  833. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  834. void replace_references_impl(BasicBlock const&, BasicBlock const&);
  835. void replace_references_impl(Register, Register) { }
  836. auto& continuation() const { return m_continuation_label; }
  837. private:
  838. Optional<Label> m_continuation_label;
  839. };
  840. class PushDeclarativeEnvironment final : public Instruction {
  841. public:
  842. explicit PushDeclarativeEnvironment(HashMap<u32, Variable> variables)
  843. : Instruction(Type::PushDeclarativeEnvironment)
  844. , m_variables(move(variables))
  845. {
  846. }
  847. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  848. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  849. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  850. void replace_references_impl(Register, Register) { }
  851. private:
  852. HashMap<u32, Variable> m_variables;
  853. };
  854. class GetIterator final : public Instruction {
  855. public:
  856. GetIterator()
  857. : Instruction(Type::GetIterator)
  858. {
  859. }
  860. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  861. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  862. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  863. void replace_references_impl(Register, Register) { }
  864. };
  865. class GetMethod final : public Instruction {
  866. public:
  867. GetMethod(IdentifierTableIndex property)
  868. : Instruction(Type::GetMethod)
  869. , m_property(property)
  870. {
  871. }
  872. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  873. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  874. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  875. void replace_references_impl(Register, Register) { }
  876. private:
  877. IdentifierTableIndex m_property;
  878. };
  879. class GetObjectPropertyIterator final : public Instruction {
  880. public:
  881. GetObjectPropertyIterator()
  882. : Instruction(Type::GetObjectPropertyIterator)
  883. {
  884. }
  885. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  886. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  887. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  888. void replace_references_impl(Register, Register) { }
  889. };
  890. class IteratorClose final : public Instruction {
  891. public:
  892. IteratorClose(Completion::Type completion_type, Optional<Value> completion_value)
  893. : Instruction(Type::IteratorClose)
  894. , m_completion_type(completion_type)
  895. , m_completion_value(completion_value)
  896. {
  897. }
  898. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  899. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  900. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  901. void replace_references_impl(Register, Register) { }
  902. private:
  903. Completion::Type m_completion_type { Completion::Type::Normal };
  904. Optional<Value> m_completion_value;
  905. };
  906. class IteratorNext final : public Instruction {
  907. public:
  908. IteratorNext()
  909. : Instruction(Type::IteratorNext)
  910. {
  911. }
  912. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  913. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  914. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  915. void replace_references_impl(Register, Register) { }
  916. };
  917. class IteratorResultDone final : public Instruction {
  918. public:
  919. IteratorResultDone()
  920. : Instruction(Type::IteratorResultDone)
  921. {
  922. }
  923. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  924. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  925. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  926. void replace_references_impl(Register, Register) { }
  927. };
  928. class IteratorResultValue final : public Instruction {
  929. public:
  930. IteratorResultValue()
  931. : Instruction(Type::IteratorResultValue)
  932. {
  933. }
  934. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  935. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  936. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  937. void replace_references_impl(Register, Register) { }
  938. };
  939. class ResolveThisBinding final : public Instruction {
  940. public:
  941. explicit ResolveThisBinding()
  942. : Instruction(Type::ResolveThisBinding)
  943. {
  944. }
  945. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  946. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  947. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  948. void replace_references_impl(Register, Register) { }
  949. };
  950. class ResolveSuperBase final : public Instruction {
  951. public:
  952. explicit ResolveSuperBase()
  953. : Instruction(Type::ResolveSuperBase)
  954. {
  955. }
  956. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  957. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  958. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  959. void replace_references_impl(Register, Register) { }
  960. };
  961. class GetNewTarget final : public Instruction {
  962. public:
  963. explicit GetNewTarget()
  964. : Instruction(Type::GetNewTarget)
  965. {
  966. }
  967. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  968. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  969. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  970. void replace_references_impl(Register, Register) { }
  971. };
  972. class TypeofVariable final : public Instruction {
  973. public:
  974. explicit TypeofVariable(IdentifierTableIndex identifier)
  975. : Instruction(Type::TypeofVariable)
  976. , m_identifier(identifier)
  977. {
  978. }
  979. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  980. DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
  981. void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
  982. void replace_references_impl(Register, Register) { }
  983. private:
  984. IdentifierTableIndex m_identifier;
  985. };
  986. }
  987. namespace JS::Bytecode {
  988. ALWAYS_INLINE ThrowCompletionOr<void> Instruction::execute(Bytecode::Interpreter& interpreter) const
  989. {
  990. #define __BYTECODE_OP(op) \
  991. case Instruction::Type::op: \
  992. return static_cast<Bytecode::Op::op const&>(*this).execute_impl(interpreter);
  993. switch (type()) {
  994. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  995. default:
  996. VERIFY_NOT_REACHED();
  997. }
  998. #undef __BYTECODE_OP
  999. }
  1000. ALWAYS_INLINE void Instruction::replace_references(BasicBlock const& from, BasicBlock const& to)
  1001. {
  1002. #define __BYTECODE_OP(op) \
  1003. case Instruction::Type::op: \
  1004. return static_cast<Bytecode::Op::op&>(*this).replace_references_impl(from, to);
  1005. switch (type()) {
  1006. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  1007. default:
  1008. VERIFY_NOT_REACHED();
  1009. }
  1010. #undef __BYTECODE_OP
  1011. }
  1012. ALWAYS_INLINE void Instruction::replace_references(Register from, Register to)
  1013. {
  1014. #define __BYTECODE_OP(op) \
  1015. case Instruction::Type::op: \
  1016. return static_cast<Bytecode::Op::op&>(*this).replace_references_impl(from, to);
  1017. switch (type()) {
  1018. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  1019. default:
  1020. VERIFY_NOT_REACHED();
  1021. }
  1022. #undef __BYTECODE_OP
  1023. }
  1024. ALWAYS_INLINE size_t Instruction::length() const
  1025. {
  1026. if (type() == Type::NewArray)
  1027. return round_up_to_power_of_two(static_cast<Op::NewArray const&>(*this).length_impl(), alignof(void*));
  1028. if (type() == Type::CopyObjectExcludingProperties)
  1029. return round_up_to_power_of_two(static_cast<Op::CopyObjectExcludingProperties const&>(*this).length_impl(), alignof(void*));
  1030. #define __BYTECODE_OP(op) \
  1031. case Type::op: \
  1032. return sizeof(Op::op);
  1033. switch (type()) {
  1034. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  1035. default:
  1036. VERIFY_NOT_REACHED();
  1037. }
  1038. #undef __BYTECODE_OP
  1039. }
  1040. ALWAYS_INLINE bool Instruction::is_terminator() const
  1041. {
  1042. #define __BYTECODE_OP(op) \
  1043. case Type::op: \
  1044. return Op::op::IsTerminator;
  1045. switch (type()) {
  1046. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  1047. default:
  1048. VERIFY_NOT_REACHED();
  1049. }
  1050. #undef __BYTECODE_OP
  1051. }
  1052. }