Op.h 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916
  1. /*
  2. * Copyright (c) 2021-2023, 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/FixedArray.h>
  10. #include <AK/StdLibExtras.h>
  11. #include <LibCrypto/BigInt/SignedBigInteger.h>
  12. #include <LibJS/Bytecode/Builtins.h>
  13. #include <LibJS/Bytecode/IdentifierTable.h>
  14. #include <LibJS/Bytecode/Instruction.h>
  15. #include <LibJS/Bytecode/Label.h>
  16. #include <LibJS/Bytecode/Operand.h>
  17. #include <LibJS/Bytecode/RegexTable.h>
  18. #include <LibJS/Bytecode/Register.h>
  19. #include <LibJS/Bytecode/StringTable.h>
  20. #include <LibJS/Heap/Cell.h>
  21. #include <LibJS/Runtime/Environment.h>
  22. #include <LibJS/Runtime/Iterator.h>
  23. #include <LibJS/Runtime/Value.h>
  24. #include <LibJS/Runtime/ValueTraits.h>
  25. namespace JS {
  26. class FunctionExpression;
  27. }
  28. namespace JS::Bytecode::Op {
  29. class Mov final : public Instruction {
  30. public:
  31. Mov(Operand dst, Operand src)
  32. : Instruction(Type::Mov, sizeof(*this))
  33. , m_dst(dst)
  34. , m_src(src)
  35. {
  36. }
  37. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  38. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  39. Operand dst() const { return m_dst; }
  40. Operand src() const { return m_src; }
  41. private:
  42. Operand m_dst;
  43. Operand m_src;
  44. };
  45. #define JS_ENUMERATE_COMMON_BINARY_OPS_WITH_FAST_PATH(O) \
  46. O(Add, add) \
  47. O(BitwiseAnd, bitwise_and) \
  48. O(BitwiseOr, bitwise_or) \
  49. O(BitwiseXor, bitwise_xor) \
  50. O(GreaterThan, greater_than) \
  51. O(GreaterThanEquals, greater_than_equals) \
  52. O(LeftShift, left_shift) \
  53. O(LessThan, less_than) \
  54. O(LessThanEquals, less_than_equals) \
  55. O(Mul, mul) \
  56. O(RightShift, right_shift) \
  57. O(Sub, sub) \
  58. O(UnsignedRightShift, unsigned_right_shift)
  59. #define JS_ENUMERATE_COMMON_BINARY_OPS_WITHOUT_FAST_PATH(O) \
  60. O(Div, div) \
  61. O(Exp, exp) \
  62. O(Mod, mod) \
  63. O(In, in) \
  64. O(InstanceOf, instance_of) \
  65. O(LooselyInequals, loosely_inequals) \
  66. O(LooselyEquals, loosely_equals) \
  67. O(StrictlyInequals, strict_inequals) \
  68. O(StrictlyEquals, strict_equals)
  69. #define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
  70. class OpTitleCase final : public Instruction { \
  71. public: \
  72. explicit OpTitleCase(Operand dst, Operand lhs, Operand rhs) \
  73. : Instruction(Type::OpTitleCase, sizeof(*this)) \
  74. , m_dst(dst) \
  75. , m_lhs(lhs) \
  76. , m_rhs(rhs) \
  77. { \
  78. } \
  79. \
  80. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  81. ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
  82. \
  83. Operand dst() const { return m_dst; } \
  84. Operand lhs() const { return m_lhs; } \
  85. Operand rhs() const { return m_rhs; } \
  86. \
  87. private: \
  88. Operand m_dst; \
  89. Operand m_lhs; \
  90. Operand m_rhs; \
  91. };
  92. JS_ENUMERATE_COMMON_BINARY_OPS_WITHOUT_FAST_PATH(JS_DECLARE_COMMON_BINARY_OP)
  93. JS_ENUMERATE_COMMON_BINARY_OPS_WITH_FAST_PATH(JS_DECLARE_COMMON_BINARY_OP)
  94. #undef JS_DECLARE_COMMON_BINARY_OP
  95. #define JS_ENUMERATE_COMMON_UNARY_OPS(O) \
  96. O(BitwiseNot, bitwise_not) \
  97. O(Not, not_) \
  98. O(UnaryPlus, unary_plus) \
  99. O(UnaryMinus, unary_minus) \
  100. O(Typeof, typeof_)
  101. #define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
  102. class OpTitleCase final : public Instruction { \
  103. public: \
  104. OpTitleCase(Operand dst, Operand src) \
  105. : Instruction(Type::OpTitleCase, sizeof(*this)) \
  106. , m_dst(dst) \
  107. , m_src(src) \
  108. { \
  109. } \
  110. \
  111. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  112. ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
  113. \
  114. Operand dst() const { return m_dst; } \
  115. Operand src() const { return m_src; } \
  116. \
  117. private: \
  118. Operand m_dst; \
  119. Operand m_src; \
  120. };
  121. JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
  122. #undef JS_DECLARE_COMMON_UNARY_OP
  123. class NewObject final : public Instruction {
  124. public:
  125. explicit NewObject(Operand dst)
  126. : Instruction(Type::NewObject, sizeof(*this))
  127. , m_dst(dst)
  128. {
  129. }
  130. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  131. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  132. Operand dst() const { return m_dst; }
  133. private:
  134. Operand m_dst;
  135. };
  136. class NewRegExp final : public Instruction {
  137. public:
  138. NewRegExp(Operand dst, StringTableIndex source_index, StringTableIndex flags_index, RegexTableIndex regex_index)
  139. : Instruction(Type::NewRegExp, sizeof(*this))
  140. , m_dst(dst)
  141. , m_source_index(source_index)
  142. , m_flags_index(flags_index)
  143. , m_regex_index(regex_index)
  144. {
  145. }
  146. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  147. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  148. Operand dst() const { return m_dst; }
  149. StringTableIndex source_index() const { return m_source_index; }
  150. StringTableIndex flags_index() const { return m_flags_index; }
  151. RegexTableIndex regex_index() const { return m_regex_index; }
  152. private:
  153. Operand m_dst;
  154. StringTableIndex m_source_index;
  155. StringTableIndex m_flags_index;
  156. RegexTableIndex m_regex_index;
  157. };
  158. #define JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(O) \
  159. O(TypeError)
  160. #define JS_DECLARE_NEW_BUILTIN_ERROR_OP(ErrorName) \
  161. class New##ErrorName final : public Instruction { \
  162. public: \
  163. New##ErrorName(Operand dst, StringTableIndex error_string) \
  164. : Instruction(Type::New##ErrorName, sizeof(*this)) \
  165. , m_dst(dst) \
  166. , m_error_string(error_string) \
  167. { \
  168. } \
  169. \
  170. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
  171. ByteString to_byte_string_impl(Bytecode::Executable const&) const; \
  172. \
  173. Operand dst() const { return m_dst; } \
  174. StringTableIndex error_string() const { return m_error_string; } \
  175. \
  176. private: \
  177. Operand m_dst; \
  178. StringTableIndex m_error_string; \
  179. };
  180. JS_ENUMERATE_NEW_BUILTIN_ERROR_OPS(JS_DECLARE_NEW_BUILTIN_ERROR_OP)
  181. #undef JS_DECLARE_NEW_BUILTIN_ERROR_OP
  182. // NOTE: This instruction is variable-width depending on the number of excluded names
  183. class CopyObjectExcludingProperties final : public Instruction {
  184. public:
  185. CopyObjectExcludingProperties(Operand dst, Operand from_object, Vector<Operand> const& excluded_names)
  186. : Instruction(Type::CopyObjectExcludingProperties, length_impl(excluded_names.size()))
  187. , m_dst(dst)
  188. , m_from_object(from_object)
  189. , m_excluded_names_count(excluded_names.size())
  190. {
  191. for (size_t i = 0; i < m_excluded_names_count; i++)
  192. m_excluded_names[i] = excluded_names[i];
  193. }
  194. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  195. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  196. size_t length_impl(size_t excluded_names_count) const
  197. {
  198. return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * excluded_names_count);
  199. }
  200. Operand dst() const { return m_dst; }
  201. Operand from_object() const { return m_from_object; }
  202. size_t excluded_names_count() const { return m_excluded_names_count; }
  203. Operand const* excluded_names() const { return m_excluded_names; }
  204. private:
  205. Operand m_dst;
  206. Operand m_from_object;
  207. size_t m_excluded_names_count { 0 };
  208. Operand m_excluded_names[];
  209. };
  210. // NOTE: This instruction is variable-width depending on the number of elements!
  211. class NewArray final : public Instruction {
  212. public:
  213. explicit NewArray(Operand dst)
  214. : Instruction(Type::NewArray, length_impl(0))
  215. , m_dst(dst)
  216. , m_element_count(0)
  217. {
  218. }
  219. NewArray(Operand dst, AK::Array<Operand, 2> const& elements_range)
  220. : Instruction(Type::NewArray, length_impl(elements_range[1].index() - elements_range[0].index() + 1))
  221. , m_dst(dst)
  222. , m_element_count(elements_range[1].index() - elements_range[0].index() + 1)
  223. {
  224. m_elements[0] = elements_range[0];
  225. m_elements[1] = elements_range[1];
  226. }
  227. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  228. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  229. Operand dst() const { return m_dst; }
  230. size_t length_impl(size_t element_count) const
  231. {
  232. return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * (element_count == 0 ? 0 : 2));
  233. }
  234. Operand start() const
  235. {
  236. VERIFY(m_element_count);
  237. return m_elements[0];
  238. }
  239. Operand end() const
  240. {
  241. VERIFY(m_element_count);
  242. return m_elements[1];
  243. }
  244. size_t element_count() const { return m_element_count; }
  245. private:
  246. Operand m_dst;
  247. size_t m_element_count { 0 };
  248. Operand m_elements[];
  249. };
  250. class NewPrimitiveArray final : public Instruction {
  251. public:
  252. NewPrimitiveArray(Operand dst, ReadonlySpan<Value> elements)
  253. : Instruction(Type::NewPrimitiveArray, length_impl(elements.size()))
  254. , m_dst(dst)
  255. , m_element_count(elements.size())
  256. {
  257. for (size_t i = 0; i < m_element_count; ++i)
  258. m_elements[i] = elements[i];
  259. }
  260. size_t length_impl(size_t element_count) const
  261. {
  262. return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Value) * element_count);
  263. }
  264. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  265. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  266. Operand dst() const { return m_dst; }
  267. ReadonlySpan<Value> elements() const { return { m_elements, m_element_count }; }
  268. private:
  269. Operand m_dst;
  270. size_t m_element_count { 0 };
  271. Value m_elements[];
  272. };
  273. class ArrayAppend final : public Instruction {
  274. public:
  275. ArrayAppend(Operand dst, Operand src, bool is_spread)
  276. : Instruction(Type::ArrayAppend, sizeof(*this))
  277. , m_dst(dst)
  278. , m_src(src)
  279. , m_is_spread(is_spread)
  280. {
  281. }
  282. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  283. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  284. Operand dst() const { return m_dst; }
  285. Operand src() const { return m_src; }
  286. bool is_spread() const { return m_is_spread; }
  287. private:
  288. Operand m_dst;
  289. Operand m_src;
  290. bool m_is_spread = false;
  291. };
  292. class ImportCall final : public Instruction {
  293. public:
  294. ImportCall(Operand dst, Operand specifier, Operand options)
  295. : Instruction(Type::ImportCall, sizeof(*this))
  296. , m_dst(dst)
  297. , m_specifier(specifier)
  298. , m_options(options)
  299. {
  300. }
  301. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  302. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  303. Operand dst() const { return m_dst; }
  304. Operand specifier() const { return m_specifier; }
  305. Operand options() const { return m_options; }
  306. private:
  307. Operand m_dst;
  308. Operand m_specifier;
  309. Operand m_options;
  310. };
  311. class IteratorToArray final : public Instruction {
  312. public:
  313. explicit IteratorToArray(Operand dst, Operand iterator)
  314. : Instruction(Type::IteratorToArray, sizeof(*this))
  315. , m_dst(dst)
  316. , m_iterator(iterator)
  317. {
  318. }
  319. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  320. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  321. Operand dst() const { return m_dst; }
  322. Operand iterator() const { return m_iterator; }
  323. private:
  324. Operand m_dst;
  325. Operand m_iterator;
  326. };
  327. class ConcatString final : public Instruction {
  328. public:
  329. explicit ConcatString(Operand dst, Operand src)
  330. : Instruction(Type::ConcatString, sizeof(*this))
  331. , m_dst(dst)
  332. , m_src(src)
  333. {
  334. }
  335. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  336. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  337. Operand dst() const { return m_dst; }
  338. Operand src() const { return m_src; }
  339. private:
  340. Operand m_dst;
  341. Operand m_src;
  342. };
  343. enum class EnvironmentMode {
  344. Lexical,
  345. Var,
  346. };
  347. class CreateLexicalEnvironment final : public Instruction {
  348. public:
  349. explicit CreateLexicalEnvironment()
  350. : Instruction(Type::CreateLexicalEnvironment, sizeof(*this))
  351. {
  352. }
  353. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  354. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  355. };
  356. class EnterObjectEnvironment final : public Instruction {
  357. public:
  358. explicit EnterObjectEnvironment(Operand object)
  359. : Instruction(Type::EnterObjectEnvironment, sizeof(*this))
  360. , m_object(object)
  361. {
  362. }
  363. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  364. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  365. Operand object() const { return m_object; }
  366. private:
  367. Operand m_object;
  368. };
  369. class Catch final : public Instruction {
  370. public:
  371. explicit Catch(Operand dst)
  372. : Instruction(Type::Catch, sizeof(*this))
  373. , m_dst(dst)
  374. {
  375. }
  376. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  377. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  378. Operand dst() const { return m_dst; }
  379. private:
  380. Operand m_dst;
  381. };
  382. class CreateVariable final : public Instruction {
  383. public:
  384. explicit CreateVariable(IdentifierTableIndex identifier, EnvironmentMode mode, bool is_immutable, bool is_global = false, bool is_strict = false)
  385. : Instruction(Type::CreateVariable, sizeof(*this))
  386. , m_identifier(identifier)
  387. , m_mode(mode)
  388. , m_is_immutable(is_immutable)
  389. , m_is_global(is_global)
  390. , m_is_strict(is_strict)
  391. {
  392. }
  393. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  394. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  395. IdentifierTableIndex identifier() const { return m_identifier; }
  396. EnvironmentMode mode() const { return m_mode; }
  397. bool is_immutable() const { return m_is_immutable; }
  398. bool is_global() const { return m_is_global; }
  399. bool is_strict() const { return m_is_strict; }
  400. private:
  401. IdentifierTableIndex m_identifier;
  402. EnvironmentMode m_mode;
  403. bool m_is_immutable : 4 { false };
  404. bool m_is_global : 4 { false };
  405. bool m_is_strict { false };
  406. };
  407. class SetVariable final : public Instruction {
  408. public:
  409. enum class InitializationMode {
  410. Initialize,
  411. Set,
  412. };
  413. explicit SetVariable(IdentifierTableIndex identifier, Operand src, u32 cache_index, InitializationMode initialization_mode = InitializationMode::Set, EnvironmentMode mode = EnvironmentMode::Lexical)
  414. : Instruction(Type::SetVariable, sizeof(*this))
  415. , m_identifier(identifier)
  416. , m_src(src)
  417. , m_mode(mode)
  418. , m_initialization_mode(initialization_mode)
  419. , m_cache_index(cache_index)
  420. {
  421. }
  422. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  423. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  424. IdentifierTableIndex identifier() const { return m_identifier; }
  425. Operand src() const { return m_src; }
  426. EnvironmentMode mode() const { return m_mode; }
  427. InitializationMode initialization_mode() const { return m_initialization_mode; }
  428. u32 cache_index() const { return m_cache_index; }
  429. private:
  430. IdentifierTableIndex m_identifier;
  431. Operand m_src;
  432. EnvironmentMode m_mode;
  433. InitializationMode m_initialization_mode { InitializationMode::Set };
  434. u32 m_cache_index { 0 };
  435. };
  436. class SetLocal final : public Instruction {
  437. public:
  438. SetLocal(size_t index, Operand src)
  439. : Instruction(Type::SetLocal, sizeof(*this))
  440. , m_index(index)
  441. , m_src(src)
  442. {
  443. }
  444. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  445. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  446. size_t index() const { return m_index; }
  447. Operand dst() const { return Operand(Operand::Type::Local, m_index); }
  448. Operand src() const { return m_src; }
  449. private:
  450. size_t m_index;
  451. Operand m_src;
  452. };
  453. class GetCalleeAndThisFromEnvironment final : public Instruction {
  454. public:
  455. explicit GetCalleeAndThisFromEnvironment(Operand callee, Operand this_value, IdentifierTableIndex identifier, u32 cache_index)
  456. : Instruction(Type::GetCalleeAndThisFromEnvironment, sizeof(*this))
  457. , m_identifier(identifier)
  458. , m_callee(callee)
  459. , m_this_value(this_value)
  460. , m_cache_index(cache_index)
  461. {
  462. }
  463. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  464. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  465. IdentifierTableIndex identifier() const { return m_identifier; }
  466. u32 cache_index() const { return m_cache_index; }
  467. Operand callee() const { return m_callee; }
  468. Operand this_() const { return m_this_value; }
  469. private:
  470. IdentifierTableIndex m_identifier;
  471. Operand m_callee;
  472. Operand m_this_value;
  473. u32 m_cache_index { 0 };
  474. };
  475. class GetVariable final : public Instruction {
  476. public:
  477. explicit GetVariable(Operand dst, IdentifierTableIndex identifier, u32 cache_index)
  478. : Instruction(Type::GetVariable, sizeof(*this))
  479. , m_dst(dst)
  480. , m_identifier(identifier)
  481. , m_cache_index(cache_index)
  482. {
  483. }
  484. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  485. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  486. Operand dst() const { return m_dst; }
  487. IdentifierTableIndex identifier() const { return m_identifier; }
  488. u32 cache_index() const { return m_cache_index; }
  489. private:
  490. Operand m_dst;
  491. IdentifierTableIndex m_identifier;
  492. u32 m_cache_index { 0 };
  493. };
  494. class GetGlobal final : public Instruction {
  495. public:
  496. GetGlobal(Operand dst, IdentifierTableIndex identifier, u32 cache_index)
  497. : Instruction(Type::GetGlobal, sizeof(*this))
  498. , m_dst(dst)
  499. , m_identifier(identifier)
  500. , m_cache_index(cache_index)
  501. {
  502. }
  503. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  504. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  505. Operand dst() const { return m_dst; }
  506. IdentifierTableIndex identifier() const { return m_identifier; }
  507. u32 cache_index() const { return m_cache_index; }
  508. private:
  509. Operand m_dst;
  510. IdentifierTableIndex m_identifier;
  511. u32 m_cache_index { 0 };
  512. };
  513. class DeleteVariable final : public Instruction {
  514. public:
  515. explicit DeleteVariable(Operand dst, IdentifierTableIndex identifier)
  516. : Instruction(Type::DeleteVariable, sizeof(*this))
  517. , m_dst(dst)
  518. , m_identifier(identifier)
  519. {
  520. }
  521. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  522. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  523. Operand dst() const { return m_dst; }
  524. IdentifierTableIndex identifier() const { return m_identifier; }
  525. private:
  526. Operand m_dst;
  527. IdentifierTableIndex m_identifier;
  528. };
  529. class GetById final : public Instruction {
  530. public:
  531. GetById(Operand dst, Operand base, IdentifierTableIndex property, Optional<IdentifierTableIndex> base_identifier, u32 cache_index)
  532. : Instruction(Type::GetById, sizeof(*this))
  533. , m_dst(dst)
  534. , m_base(base)
  535. , m_property(property)
  536. , m_base_identifier(move(base_identifier))
  537. , m_cache_index(cache_index)
  538. {
  539. }
  540. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  541. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  542. Operand dst() const { return m_dst; }
  543. Operand base() const { return m_base; }
  544. IdentifierTableIndex property() const { return m_property; }
  545. u32 cache_index() const { return m_cache_index; }
  546. private:
  547. Operand m_dst;
  548. Operand m_base;
  549. IdentifierTableIndex m_property;
  550. Optional<IdentifierTableIndex> m_base_identifier;
  551. u32 m_cache_index { 0 };
  552. };
  553. class GetByIdWithThis final : public Instruction {
  554. public:
  555. GetByIdWithThis(Operand dst, Operand base, IdentifierTableIndex property, Operand this_value, u32 cache_index)
  556. : Instruction(Type::GetByIdWithThis, sizeof(*this))
  557. , m_dst(dst)
  558. , m_base(base)
  559. , m_property(property)
  560. , m_this_value(this_value)
  561. , m_cache_index(cache_index)
  562. {
  563. }
  564. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  565. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  566. Operand dst() const { return m_dst; }
  567. Operand base() const { return m_base; }
  568. IdentifierTableIndex property() const { return m_property; }
  569. Operand this_value() const { return m_this_value; }
  570. u32 cache_index() const { return m_cache_index; }
  571. private:
  572. Operand m_dst;
  573. Operand m_base;
  574. IdentifierTableIndex m_property;
  575. Operand m_this_value;
  576. u32 m_cache_index { 0 };
  577. };
  578. class GetPrivateById final : public Instruction {
  579. public:
  580. explicit GetPrivateById(Operand dst, Operand base, IdentifierTableIndex property)
  581. : Instruction(Type::GetPrivateById, sizeof(*this))
  582. , m_dst(dst)
  583. , m_base(base)
  584. , m_property(property)
  585. {
  586. }
  587. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  588. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  589. Operand dst() const { return m_dst; }
  590. Operand base() const { return m_base; }
  591. IdentifierTableIndex property() const { return m_property; }
  592. private:
  593. Operand m_dst;
  594. Operand m_base;
  595. IdentifierTableIndex m_property;
  596. };
  597. class HasPrivateId final : public Instruction {
  598. public:
  599. HasPrivateId(Operand dst, Operand base, IdentifierTableIndex property)
  600. : Instruction(Type::HasPrivateId, sizeof(*this))
  601. , m_dst(dst)
  602. , m_base(base)
  603. , m_property(property)
  604. {
  605. }
  606. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  607. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  608. Operand dst() const { return m_dst; }
  609. Operand base() const { return m_base; }
  610. IdentifierTableIndex property() const { return m_property; }
  611. private:
  612. Operand m_dst;
  613. Operand m_base;
  614. IdentifierTableIndex m_property;
  615. };
  616. enum class PropertyKind {
  617. Getter,
  618. Setter,
  619. KeyValue,
  620. DirectKeyValue, // Used for Object expressions. Always sets an own property, never calls a setter.
  621. Spread,
  622. ProtoSetter,
  623. };
  624. class PutById final : public Instruction {
  625. public:
  626. explicit PutById(Operand base, IdentifierTableIndex property, Operand src, PropertyKind kind, u32 cache_index, Optional<IdentifierTableIndex> base_identifier = {})
  627. : Instruction(Type::PutById, sizeof(*this))
  628. , m_base(base)
  629. , m_property(property)
  630. , m_src(src)
  631. , m_kind(kind)
  632. , m_cache_index(cache_index)
  633. , m_base_identifier(move(base_identifier))
  634. {
  635. }
  636. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  637. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  638. Operand base() const { return m_base; }
  639. IdentifierTableIndex property() const { return m_property; }
  640. Operand src() const { return m_src; }
  641. PropertyKind kind() const { return m_kind; }
  642. u32 cache_index() const { return m_cache_index; }
  643. private:
  644. Operand m_base;
  645. IdentifierTableIndex m_property;
  646. Operand m_src;
  647. PropertyKind m_kind;
  648. u32 m_cache_index { 0 };
  649. Optional<IdentifierTableIndex> m_base_identifier {};
  650. };
  651. class PutByIdWithThis final : public Instruction {
  652. public:
  653. PutByIdWithThis(Operand base, Operand this_value, IdentifierTableIndex property, Operand src, PropertyKind kind, u32 cache_index)
  654. : Instruction(Type::PutByIdWithThis, sizeof(*this))
  655. , m_base(base)
  656. , m_this_value(this_value)
  657. , m_property(property)
  658. , m_src(src)
  659. , m_kind(kind)
  660. , m_cache_index(cache_index)
  661. {
  662. }
  663. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  664. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  665. Operand base() const { return m_base; }
  666. Operand this_value() const { return m_this_value; }
  667. IdentifierTableIndex property() const { return m_property; }
  668. Operand src() const { return m_src; }
  669. PropertyKind kind() const { return m_kind; }
  670. u32 cache_index() const { return m_cache_index; }
  671. private:
  672. Operand m_base;
  673. Operand m_this_value;
  674. IdentifierTableIndex m_property;
  675. Operand m_src;
  676. PropertyKind m_kind;
  677. u32 m_cache_index { 0 };
  678. };
  679. class PutPrivateById final : public Instruction {
  680. public:
  681. explicit PutPrivateById(Operand base, IdentifierTableIndex property, Operand src, PropertyKind kind = PropertyKind::KeyValue)
  682. : Instruction(Type::PutPrivateById, sizeof(*this))
  683. , m_base(base)
  684. , m_property(property)
  685. , m_src(src)
  686. , m_kind(kind)
  687. {
  688. }
  689. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  690. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  691. Operand base() const { return m_base; }
  692. IdentifierTableIndex property() const { return m_property; }
  693. Operand src() const { return m_src; }
  694. private:
  695. Operand m_base;
  696. IdentifierTableIndex m_property;
  697. Operand m_src;
  698. PropertyKind m_kind;
  699. };
  700. class DeleteById final : public Instruction {
  701. public:
  702. explicit DeleteById(Operand dst, Operand base, IdentifierTableIndex property)
  703. : Instruction(Type::DeleteById, sizeof(*this))
  704. , m_dst(dst)
  705. , m_base(base)
  706. , m_property(property)
  707. {
  708. }
  709. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  710. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  711. Operand dst() const { return m_dst; }
  712. Operand base() const { return m_base; }
  713. IdentifierTableIndex property() const { return m_property; }
  714. private:
  715. Operand m_dst;
  716. Operand m_base;
  717. IdentifierTableIndex m_property;
  718. };
  719. class DeleteByIdWithThis final : public Instruction {
  720. public:
  721. DeleteByIdWithThis(Operand dst, Operand base, Operand this_value, IdentifierTableIndex property)
  722. : Instruction(Type::DeleteByIdWithThis, sizeof(*this))
  723. , m_dst(dst)
  724. , m_base(base)
  725. , m_this_value(this_value)
  726. , m_property(property)
  727. {
  728. }
  729. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  730. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  731. Operand dst() const { return m_dst; }
  732. Operand base() const { return m_base; }
  733. Operand this_value() const { return m_this_value; }
  734. IdentifierTableIndex property() const { return m_property; }
  735. private:
  736. Operand m_dst;
  737. Operand m_base;
  738. Operand m_this_value;
  739. IdentifierTableIndex m_property;
  740. };
  741. class GetByValue final : public Instruction {
  742. public:
  743. GetByValue(Operand dst, Operand base, Operand property, Optional<IdentifierTableIndex> base_identifier = {})
  744. : Instruction(Type::GetByValue, sizeof(*this))
  745. , m_dst(dst)
  746. , m_base(base)
  747. , m_property(property)
  748. , m_base_identifier(move(base_identifier))
  749. {
  750. }
  751. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  752. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  753. Operand dst() const { return m_dst; }
  754. Operand base() const { return m_base; }
  755. Operand property() const { return m_property; }
  756. Optional<DeprecatedFlyString const&> base_identifier(Bytecode::Interpreter const&) const;
  757. private:
  758. Operand m_dst;
  759. Operand m_base;
  760. Operand m_property;
  761. Optional<IdentifierTableIndex> m_base_identifier;
  762. };
  763. class GetByValueWithThis final : public Instruction {
  764. public:
  765. GetByValueWithThis(Operand dst, Operand base, Operand property, Operand this_value)
  766. : Instruction(Type::GetByValueWithThis, sizeof(*this))
  767. , m_dst(dst)
  768. , m_base(base)
  769. , m_property(property)
  770. , m_this_value(this_value)
  771. {
  772. }
  773. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  774. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  775. Operand dst() const { return m_dst; }
  776. Operand base() const { return m_base; }
  777. Operand property() const { return m_property; }
  778. Operand this_value() const { return m_this_value; }
  779. private:
  780. Operand m_dst;
  781. Operand m_base;
  782. Operand m_property;
  783. Operand m_this_value;
  784. };
  785. class PutByValue final : public Instruction {
  786. public:
  787. PutByValue(Operand base, Operand property, Operand src, PropertyKind kind = PropertyKind::KeyValue, Optional<IdentifierTableIndex> base_identifier = {})
  788. : Instruction(Type::PutByValue, sizeof(*this))
  789. , m_base(base)
  790. , m_property(property)
  791. , m_src(src)
  792. , m_kind(kind)
  793. , m_base_identifier(move(base_identifier))
  794. {
  795. }
  796. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  797. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  798. Operand base() const { return m_base; }
  799. Operand property() const { return m_property; }
  800. Operand src() const { return m_src; }
  801. PropertyKind kind() const { return m_kind; }
  802. private:
  803. Operand m_base;
  804. Operand m_property;
  805. Operand m_src;
  806. PropertyKind m_kind;
  807. Optional<IdentifierTableIndex> m_base_identifier;
  808. };
  809. class PutByValueWithThis final : public Instruction {
  810. public:
  811. PutByValueWithThis(Operand base, Operand property, Operand this_value, Operand src, PropertyKind kind = PropertyKind::KeyValue)
  812. : Instruction(Type::PutByValueWithThis, sizeof(*this))
  813. , m_base(base)
  814. , m_property(property)
  815. , m_this_value(this_value)
  816. , m_src(src)
  817. , m_kind(kind)
  818. {
  819. }
  820. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  821. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  822. Operand base() const { return m_base; }
  823. Operand property() const { return m_property; }
  824. Operand this_value() const { return m_this_value; }
  825. Operand src() const { return m_src; }
  826. PropertyKind kind() const { return m_kind; }
  827. private:
  828. Operand m_base;
  829. Operand m_property;
  830. Operand m_this_value;
  831. Operand m_src;
  832. PropertyKind m_kind;
  833. };
  834. class DeleteByValue final : public Instruction {
  835. public:
  836. DeleteByValue(Operand dst, Operand base, Operand property)
  837. : Instruction(Type::DeleteByValue, sizeof(*this))
  838. , m_dst(dst)
  839. , m_base(base)
  840. , m_property(property)
  841. {
  842. }
  843. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  844. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  845. Operand dst() const { return m_dst; }
  846. Operand base() const { return m_base; }
  847. Operand property() const { return m_property; }
  848. private:
  849. Operand m_dst;
  850. Operand m_base;
  851. Operand m_property;
  852. };
  853. class DeleteByValueWithThis final : public Instruction {
  854. public:
  855. DeleteByValueWithThis(Operand dst, Operand base, Operand this_value, Operand property)
  856. : Instruction(Type::DeleteByValueWithThis, sizeof(*this))
  857. , m_dst(dst)
  858. , m_base(base)
  859. , m_this_value(this_value)
  860. , m_property(property)
  861. {
  862. }
  863. Operand dst() const { return m_dst; }
  864. Operand base() const { return m_base; }
  865. Operand this_value() const { return m_this_value; }
  866. Operand property() const { return m_property; }
  867. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  868. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  869. private:
  870. Operand m_dst;
  871. Operand m_base;
  872. Operand m_this_value;
  873. Operand m_property;
  874. };
  875. class Jump : public Instruction {
  876. public:
  877. constexpr static bool IsTerminator = true;
  878. explicit Jump(Type type, Label taken_target, Optional<Label> nontaken_target = {})
  879. : Instruction(type, sizeof(*this))
  880. , m_true_target(move(taken_target))
  881. , m_false_target(move(nontaken_target))
  882. {
  883. }
  884. explicit Jump(Type type, Label taken_target, Label nontaken_target, size_t sizeof_self)
  885. : Instruction(type, sizeof_self)
  886. , m_true_target(move(taken_target))
  887. , m_false_target(move(nontaken_target))
  888. {
  889. }
  890. explicit Jump(Label taken_target, Optional<Label> nontaken_target = {})
  891. : Instruction(Type::Jump, sizeof(*this))
  892. , m_true_target(move(taken_target))
  893. , m_false_target(move(nontaken_target))
  894. {
  895. }
  896. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  897. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  898. auto& true_target() const { return m_true_target; }
  899. auto& false_target() const { return m_false_target; }
  900. protected:
  901. Optional<Label> m_true_target;
  902. Optional<Label> m_false_target;
  903. };
  904. class JumpIf final : public Jump {
  905. public:
  906. explicit JumpIf(Operand condition, Label true_target, Label false_target)
  907. : Jump(Type::JumpIf, move(true_target), move(false_target), sizeof(*this))
  908. , m_condition(condition)
  909. {
  910. }
  911. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  912. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  913. Operand condition() const { return m_condition; }
  914. private:
  915. Operand m_condition;
  916. };
  917. class JumpNullish final : public Jump {
  918. public:
  919. explicit JumpNullish(Operand condition, Label true_target, Label false_target)
  920. : Jump(Type::JumpNullish, move(true_target), move(false_target), sizeof(*this))
  921. , m_condition(condition)
  922. {
  923. }
  924. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  925. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  926. Operand condition() const { return m_condition; }
  927. private:
  928. Operand m_condition;
  929. };
  930. class JumpUndefined final : public Jump {
  931. public:
  932. explicit JumpUndefined(Operand condition, Label true_target, Label false_target)
  933. : Jump(Type::JumpUndefined, move(true_target), move(false_target), sizeof(*this))
  934. , m_condition(condition)
  935. {
  936. }
  937. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  938. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  939. Operand condition() const { return m_condition; }
  940. private:
  941. Operand m_condition;
  942. };
  943. enum class CallType {
  944. Call,
  945. Construct,
  946. DirectEval,
  947. };
  948. class Call final : public Instruction {
  949. public:
  950. Call(CallType type, Operand dst, Operand callee, Operand this_value, ReadonlySpan<Operand> arguments, Optional<StringTableIndex> expression_string = {}, Optional<Builtin> builtin = {})
  951. : Instruction(Type::Call, length_impl(arguments.size()))
  952. , m_dst(dst)
  953. , m_callee(callee)
  954. , m_this_value(this_value)
  955. , m_argument_count(arguments.size())
  956. , m_type(type)
  957. , m_expression_string(expression_string)
  958. , m_builtin(builtin)
  959. {
  960. for (size_t i = 0; i < arguments.size(); ++i)
  961. m_arguments[i] = arguments[i];
  962. }
  963. size_t length_impl(size_t argument_count) const
  964. {
  965. return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * argument_count);
  966. }
  967. CallType call_type() const { return m_type; }
  968. Operand dst() const { return m_dst; }
  969. Operand callee() const { return m_callee; }
  970. Operand this_value() const { return m_this_value; }
  971. Optional<StringTableIndex> const& expression_string() const { return m_expression_string; }
  972. u32 argument_count() const { return m_argument_count; }
  973. Optional<Builtin> const& builtin() const { return m_builtin; }
  974. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  975. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  976. private:
  977. Operand m_dst;
  978. Operand m_callee;
  979. Operand m_this_value;
  980. u32 m_argument_count { 0 };
  981. CallType m_type;
  982. Optional<StringTableIndex> m_expression_string;
  983. Optional<Builtin> m_builtin;
  984. Operand m_arguments[];
  985. };
  986. class CallWithArgumentArray final : public Instruction {
  987. public:
  988. CallWithArgumentArray(CallType type, Operand dst, Operand callee, Operand this_value, Operand arguments, Optional<StringTableIndex> expression_string = {})
  989. : Instruction(Type::CallWithArgumentArray, sizeof(*this))
  990. , m_dst(dst)
  991. , m_callee(callee)
  992. , m_this_value(this_value)
  993. , m_arguments(arguments)
  994. , m_type(type)
  995. , m_expression_string(expression_string)
  996. {
  997. }
  998. Operand dst() const { return m_dst; }
  999. CallType call_type() const { return m_type; }
  1000. Operand callee() const { return m_callee; }
  1001. Operand this_value() const { return m_this_value; }
  1002. Operand arguments() const { return m_arguments; }
  1003. Optional<StringTableIndex> const& expression_string() const { return m_expression_string; }
  1004. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1005. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1006. private:
  1007. Operand m_dst;
  1008. Operand m_callee;
  1009. Operand m_this_value;
  1010. Operand m_arguments;
  1011. CallType m_type;
  1012. Optional<StringTableIndex> m_expression_string;
  1013. };
  1014. class SuperCallWithArgumentArray : public Instruction {
  1015. public:
  1016. explicit SuperCallWithArgumentArray(Operand dst, Operand arguments, bool is_synthetic)
  1017. : Instruction(Type::SuperCallWithArgumentArray, sizeof(*this))
  1018. , m_dst(dst)
  1019. , m_arguments(arguments)
  1020. , m_is_synthetic(is_synthetic)
  1021. {
  1022. }
  1023. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1024. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1025. Operand dst() const { return m_dst; }
  1026. Operand arguments() const { return m_arguments; }
  1027. bool is_synthetic() const { return m_is_synthetic; }
  1028. private:
  1029. Operand m_dst;
  1030. Operand m_arguments;
  1031. bool m_is_synthetic;
  1032. };
  1033. class NewClass final : public Instruction {
  1034. public:
  1035. explicit NewClass(Operand dst, Optional<Operand> super_class, ClassExpression const& class_expression, Optional<IdentifierTableIndex> lhs_name)
  1036. : Instruction(Type::NewClass, sizeof(*this))
  1037. , m_dst(dst)
  1038. , m_super_class(super_class)
  1039. , m_class_expression(class_expression)
  1040. , m_lhs_name(lhs_name)
  1041. {
  1042. }
  1043. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1044. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1045. Operand dst() const { return m_dst; }
  1046. Optional<Operand> const& super_class() const { return m_super_class; }
  1047. ClassExpression const& class_expression() const { return m_class_expression; }
  1048. Optional<IdentifierTableIndex> const& lhs_name() const { return m_lhs_name; }
  1049. private:
  1050. Operand m_dst;
  1051. Optional<Operand> m_super_class;
  1052. ClassExpression const& m_class_expression;
  1053. Optional<IdentifierTableIndex> m_lhs_name;
  1054. };
  1055. class NewFunction final : public Instruction {
  1056. public:
  1057. explicit NewFunction(Operand dst, FunctionExpression const& function_node, Optional<IdentifierTableIndex> lhs_name, Optional<Operand> home_object = {})
  1058. : Instruction(Type::NewFunction, sizeof(*this))
  1059. , m_dst(dst)
  1060. , m_function_node(function_node)
  1061. , m_lhs_name(lhs_name)
  1062. , m_home_object(move(home_object))
  1063. {
  1064. }
  1065. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1066. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1067. Operand dst() const { return m_dst; }
  1068. FunctionExpression const& function_node() const { return m_function_node; }
  1069. Optional<IdentifierTableIndex> const& lhs_name() const { return m_lhs_name; }
  1070. Optional<Operand> const& home_object() const { return m_home_object; }
  1071. private:
  1072. Operand m_dst;
  1073. FunctionExpression const& m_function_node;
  1074. Optional<IdentifierTableIndex> m_lhs_name;
  1075. Optional<Operand> m_home_object;
  1076. };
  1077. class BlockDeclarationInstantiation final : public Instruction {
  1078. public:
  1079. explicit BlockDeclarationInstantiation(ScopeNode const& scope_node)
  1080. : Instruction(Type::BlockDeclarationInstantiation, sizeof(*this))
  1081. , m_scope_node(scope_node)
  1082. {
  1083. }
  1084. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1085. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1086. ScopeNode const& scope_node() const { return m_scope_node; }
  1087. private:
  1088. ScopeNode const& m_scope_node;
  1089. };
  1090. class Return final : public Instruction {
  1091. public:
  1092. constexpr static bool IsTerminator = true;
  1093. explicit Return(Optional<Operand> value = {})
  1094. : Instruction(Type::Return, sizeof(*this))
  1095. , m_value(value)
  1096. {
  1097. }
  1098. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1099. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1100. Optional<Operand> const& value() const { return m_value; }
  1101. private:
  1102. Optional<Operand> m_value;
  1103. };
  1104. class Increment final : public Instruction {
  1105. public:
  1106. explicit Increment(Operand dst)
  1107. : Instruction(Type::Increment, sizeof(*this))
  1108. , m_dst(dst)
  1109. {
  1110. }
  1111. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1112. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1113. Operand dst() const { return m_dst; }
  1114. private:
  1115. Operand m_dst;
  1116. };
  1117. class PostfixIncrement final : public Instruction {
  1118. public:
  1119. explicit PostfixIncrement(Operand dst, Operand src)
  1120. : Instruction(Type::PostfixIncrement, sizeof(*this))
  1121. , m_dst(dst)
  1122. , m_src(src)
  1123. {
  1124. }
  1125. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1126. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1127. Operand dst() const { return m_dst; }
  1128. Operand src() const { return m_src; }
  1129. private:
  1130. Operand m_dst;
  1131. Operand m_src;
  1132. };
  1133. class Decrement final : public Instruction {
  1134. public:
  1135. explicit Decrement(Operand dst)
  1136. : Instruction(Type::Decrement, sizeof(*this))
  1137. , m_dst(dst)
  1138. {
  1139. }
  1140. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1141. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1142. Operand dst() const { return m_dst; }
  1143. private:
  1144. Operand m_dst;
  1145. };
  1146. class PostfixDecrement final : public Instruction {
  1147. public:
  1148. explicit PostfixDecrement(Operand dst, Operand src)
  1149. : Instruction(Type::PostfixDecrement, sizeof(*this))
  1150. , m_dst(dst)
  1151. , m_src(src)
  1152. {
  1153. }
  1154. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1155. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1156. Operand dst() const { return m_dst; }
  1157. Operand src() const { return m_src; }
  1158. private:
  1159. Operand m_dst;
  1160. Operand m_src;
  1161. };
  1162. class Throw final : public Instruction {
  1163. public:
  1164. constexpr static bool IsTerminator = true;
  1165. explicit Throw(Operand src)
  1166. : Instruction(Type::Throw, sizeof(*this))
  1167. , m_src(src)
  1168. {
  1169. }
  1170. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1171. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1172. Operand src() const { return m_src; }
  1173. private:
  1174. Operand m_src;
  1175. };
  1176. class ThrowIfNotObject final : public Instruction {
  1177. public:
  1178. ThrowIfNotObject(Operand src)
  1179. : Instruction(Type::ThrowIfNotObject, sizeof(*this))
  1180. , m_src(src)
  1181. {
  1182. }
  1183. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1184. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1185. Operand src() const { return m_src; }
  1186. private:
  1187. Operand m_src;
  1188. };
  1189. class ThrowIfNullish final : public Instruction {
  1190. public:
  1191. explicit ThrowIfNullish(Operand src)
  1192. : Instruction(Type::ThrowIfNullish, sizeof(*this))
  1193. , m_src(src)
  1194. {
  1195. }
  1196. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1197. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1198. Operand src() const { return m_src; }
  1199. private:
  1200. Operand m_src;
  1201. };
  1202. class ThrowIfTDZ final : public Instruction {
  1203. public:
  1204. explicit ThrowIfTDZ(Operand src)
  1205. : Instruction(Type::ThrowIfTDZ, sizeof(*this))
  1206. , m_src(src)
  1207. {
  1208. }
  1209. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1210. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1211. Operand src() const { return m_src; }
  1212. private:
  1213. Operand m_src;
  1214. };
  1215. class EnterUnwindContext final : public Instruction {
  1216. public:
  1217. constexpr static bool IsTerminator = true;
  1218. EnterUnwindContext(Label entry_point)
  1219. : Instruction(Type::EnterUnwindContext, sizeof(*this))
  1220. , m_entry_point(move(entry_point))
  1221. {
  1222. }
  1223. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1224. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1225. auto& entry_point() const { return m_entry_point; }
  1226. private:
  1227. Label m_entry_point;
  1228. };
  1229. class ScheduleJump final : public Instruction {
  1230. public:
  1231. // Note: We use this instruction to tell the next `finally` block to
  1232. // continue execution with a specific break/continue target;
  1233. // FIXME: We currently don't clear the interpreter internal flag, when we change
  1234. // the control-flow (`break`, `continue`) in a finally-block,
  1235. // FIXME: .NET on x86_64 uses a call to the finally instead, which could make this
  1236. // easier, at the cost of making control-flow changes (`break`, `continue`, `return`)
  1237. // in the finally-block more difficult, but as stated above, those
  1238. // aren't handled 100% correctly at the moment anyway
  1239. // It might be worth investigating a similar mechanism
  1240. constexpr static bool IsTerminator = true;
  1241. ScheduleJump(Label target)
  1242. : Instruction(Type::ScheduleJump, sizeof(*this))
  1243. , m_target(target)
  1244. {
  1245. }
  1246. Label target() const { return m_target; }
  1247. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1248. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1249. private:
  1250. Label m_target;
  1251. };
  1252. class LeaveLexicalEnvironment final : public Instruction {
  1253. public:
  1254. LeaveLexicalEnvironment()
  1255. : Instruction(Type::LeaveLexicalEnvironment, sizeof(*this))
  1256. {
  1257. }
  1258. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1259. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1260. };
  1261. class LeaveUnwindContext final : public Instruction {
  1262. public:
  1263. LeaveUnwindContext()
  1264. : Instruction(Type::LeaveUnwindContext, sizeof(*this))
  1265. {
  1266. }
  1267. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1268. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1269. };
  1270. class ContinuePendingUnwind final : public Instruction {
  1271. public:
  1272. constexpr static bool IsTerminator = true;
  1273. explicit ContinuePendingUnwind(Label resume_target)
  1274. : Instruction(Type::ContinuePendingUnwind, sizeof(*this))
  1275. , m_resume_target(resume_target)
  1276. {
  1277. }
  1278. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1279. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1280. auto& resume_target() const { return m_resume_target; }
  1281. private:
  1282. Label m_resume_target;
  1283. };
  1284. class Yield final : public Instruction {
  1285. public:
  1286. constexpr static bool IsTerminator = true;
  1287. explicit Yield(Label continuation_label, Operand value)
  1288. : Instruction(Type::Yield, sizeof(*this))
  1289. , m_continuation_label(continuation_label)
  1290. , m_value(value)
  1291. {
  1292. }
  1293. explicit Yield(nullptr_t, Operand value)
  1294. : Instruction(Type::Yield, sizeof(*this))
  1295. , m_value(value)
  1296. {
  1297. }
  1298. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1299. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1300. auto& continuation() const { return m_continuation_label; }
  1301. Operand value() const { return m_value; }
  1302. private:
  1303. Optional<Label> m_continuation_label;
  1304. Operand m_value;
  1305. };
  1306. class Await final : public Instruction {
  1307. public:
  1308. constexpr static bool IsTerminator = true;
  1309. explicit Await(Label continuation_label, Operand argument)
  1310. : Instruction(Type::Await, sizeof(*this))
  1311. , m_continuation_label(continuation_label)
  1312. , m_argument(argument)
  1313. {
  1314. }
  1315. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1316. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1317. auto& continuation() const { return m_continuation_label; }
  1318. Operand argument() const { return m_argument; }
  1319. private:
  1320. Label m_continuation_label;
  1321. Operand m_argument;
  1322. };
  1323. class GetIterator final : public Instruction {
  1324. public:
  1325. GetIterator(Operand dst, Operand iterable, IteratorHint hint = IteratorHint::Sync)
  1326. : Instruction(Type::GetIterator, sizeof(*this))
  1327. , m_dst(dst)
  1328. , m_iterable(iterable)
  1329. , m_hint(hint)
  1330. {
  1331. }
  1332. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1333. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1334. Operand dst() const { return m_dst; }
  1335. Operand iterable() const { return m_iterable; }
  1336. IteratorHint hint() const { return m_hint; }
  1337. private:
  1338. Operand m_dst;
  1339. Operand m_iterable;
  1340. IteratorHint m_hint { IteratorHint::Sync };
  1341. };
  1342. class GetObjectFromIteratorRecord final : public Instruction {
  1343. public:
  1344. GetObjectFromIteratorRecord(Operand object, Operand iterator_record)
  1345. : Instruction(Type::GetObjectFromIteratorRecord, sizeof(*this))
  1346. , m_object(object)
  1347. , m_iterator_record(iterator_record)
  1348. {
  1349. }
  1350. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1351. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1352. Operand object() const { return m_object; }
  1353. Operand iterator_record() const { return m_iterator_record; }
  1354. private:
  1355. Operand m_object;
  1356. Operand m_iterator_record;
  1357. };
  1358. class GetNextMethodFromIteratorRecord final : public Instruction {
  1359. public:
  1360. GetNextMethodFromIteratorRecord(Operand next_method, Operand iterator_record)
  1361. : Instruction(Type::GetNextMethodFromIteratorRecord, sizeof(*this))
  1362. , m_next_method(next_method)
  1363. , m_iterator_record(iterator_record)
  1364. {
  1365. }
  1366. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1367. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1368. Operand next_method() const { return m_next_method; }
  1369. Operand iterator_record() const { return m_iterator_record; }
  1370. private:
  1371. Operand m_next_method;
  1372. Operand m_iterator_record;
  1373. };
  1374. class GetMethod final : public Instruction {
  1375. public:
  1376. GetMethod(Operand dst, Operand object, IdentifierTableIndex property)
  1377. : Instruction(Type::GetMethod, sizeof(*this))
  1378. , m_dst(dst)
  1379. , m_object(object)
  1380. , m_property(property)
  1381. {
  1382. }
  1383. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1384. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1385. Operand dst() const { return m_dst; }
  1386. Operand object() const { return m_object; }
  1387. IdentifierTableIndex property() const { return m_property; }
  1388. private:
  1389. Operand m_dst;
  1390. Operand m_object;
  1391. IdentifierTableIndex m_property;
  1392. };
  1393. class GetObjectPropertyIterator final : public Instruction {
  1394. public:
  1395. GetObjectPropertyIterator(Operand dst, Operand object)
  1396. : Instruction(Type::GetObjectPropertyIterator, sizeof(*this))
  1397. , m_dst(dst)
  1398. , m_object(object)
  1399. {
  1400. }
  1401. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1402. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1403. Operand dst() const { return m_dst; }
  1404. Operand object() const { return m_object; }
  1405. private:
  1406. Operand m_dst;
  1407. Operand m_object;
  1408. };
  1409. class IteratorClose final : public Instruction {
  1410. public:
  1411. IteratorClose(Operand iterator_record, Completion::Type completion_type, Optional<Value> completion_value)
  1412. : Instruction(Type::IteratorClose, sizeof(*this))
  1413. , m_iterator_record(iterator_record)
  1414. , m_completion_type(completion_type)
  1415. , m_completion_value(completion_value)
  1416. {
  1417. }
  1418. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1419. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1420. Operand iterator_record() const { return m_iterator_record; }
  1421. Completion::Type completion_type() const { return m_completion_type; }
  1422. Optional<Value> const& completion_value() const { return m_completion_value; }
  1423. private:
  1424. Operand m_iterator_record;
  1425. Completion::Type m_completion_type { Completion::Type::Normal };
  1426. Optional<Value> m_completion_value;
  1427. };
  1428. class AsyncIteratorClose final : public Instruction {
  1429. public:
  1430. AsyncIteratorClose(Operand iterator_record, Completion::Type completion_type, Optional<Value> completion_value)
  1431. : Instruction(Type::AsyncIteratorClose, sizeof(*this))
  1432. , m_iterator_record(iterator_record)
  1433. , m_completion_type(completion_type)
  1434. , m_completion_value(completion_value)
  1435. {
  1436. }
  1437. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1438. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1439. Operand iterator_record() const { return m_iterator_record; }
  1440. Completion::Type completion_type() const { return m_completion_type; }
  1441. Optional<Value> const& completion_value() const { return m_completion_value; }
  1442. private:
  1443. Operand m_iterator_record;
  1444. Completion::Type m_completion_type { Completion::Type::Normal };
  1445. Optional<Value> m_completion_value;
  1446. };
  1447. class IteratorNext final : public Instruction {
  1448. public:
  1449. IteratorNext(Operand dst, Operand iterator_record)
  1450. : Instruction(Type::IteratorNext, sizeof(*this))
  1451. , m_dst(dst)
  1452. , m_iterator_record(iterator_record)
  1453. {
  1454. }
  1455. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1456. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1457. Operand dst() const { return m_dst; }
  1458. Operand iterator_record() const { return m_iterator_record; }
  1459. private:
  1460. Operand m_dst;
  1461. Operand m_iterator_record;
  1462. };
  1463. class ResolveThisBinding final : public Instruction {
  1464. public:
  1465. explicit ResolveThisBinding(Operand dst)
  1466. : Instruction(Type::ResolveThisBinding, sizeof(*this))
  1467. , m_dst(dst)
  1468. {
  1469. }
  1470. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1471. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1472. Operand dst() const { return m_dst; }
  1473. private:
  1474. Operand m_dst;
  1475. };
  1476. class ResolveSuperBase final : public Instruction {
  1477. public:
  1478. explicit ResolveSuperBase(Operand dst)
  1479. : Instruction(Type::ResolveSuperBase, sizeof(*this))
  1480. , m_dst(dst)
  1481. {
  1482. }
  1483. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1484. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1485. Operand dst() const { return m_dst; }
  1486. private:
  1487. Operand m_dst;
  1488. };
  1489. class GetNewTarget final : public Instruction {
  1490. public:
  1491. explicit GetNewTarget(Operand dst)
  1492. : Instruction(Type::GetNewTarget, sizeof(*this))
  1493. , m_dst(dst)
  1494. {
  1495. }
  1496. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1497. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1498. Operand dst() const { return m_dst; }
  1499. private:
  1500. Operand m_dst;
  1501. };
  1502. class GetImportMeta final : public Instruction {
  1503. public:
  1504. explicit GetImportMeta(Operand dst)
  1505. : Instruction(Type::GetImportMeta, sizeof(*this))
  1506. , m_dst(dst)
  1507. {
  1508. }
  1509. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1510. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1511. Operand dst() const { return m_dst; }
  1512. private:
  1513. Operand m_dst;
  1514. };
  1515. class TypeofVariable final : public Instruction {
  1516. public:
  1517. TypeofVariable(Operand dst, IdentifierTableIndex identifier)
  1518. : Instruction(Type::TypeofVariable, sizeof(*this))
  1519. , m_dst(dst)
  1520. , m_identifier(identifier)
  1521. {
  1522. }
  1523. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1524. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1525. Operand dst() const { return m_dst; }
  1526. IdentifierTableIndex identifier() const { return m_identifier; }
  1527. private:
  1528. Operand m_dst;
  1529. IdentifierTableIndex m_identifier;
  1530. };
  1531. class End final : public Instruction {
  1532. public:
  1533. constexpr static bool IsTerminator = true;
  1534. explicit End(Operand value)
  1535. : Instruction(Type::End, sizeof(*this))
  1536. , m_value(value)
  1537. {
  1538. }
  1539. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1540. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1541. Operand value() const { return m_value; }
  1542. private:
  1543. Operand m_value;
  1544. };
  1545. class Dump final : public Instruction {
  1546. public:
  1547. explicit Dump(StringView text, Operand value)
  1548. : Instruction(Type::Dump, sizeof(*this))
  1549. , m_text(text)
  1550. , m_value(value)
  1551. {
  1552. }
  1553. ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
  1554. ByteString to_byte_string_impl(Bytecode::Executable const&) const;
  1555. private:
  1556. StringView m_text;
  1557. Operand m_value;
  1558. };
  1559. }
  1560. namespace JS::Bytecode {
  1561. ALWAYS_INLINE ThrowCompletionOr<void> Instruction::execute(Bytecode::Interpreter& interpreter) const
  1562. {
  1563. #define __BYTECODE_OP(op) \
  1564. case Instruction::Type::op: \
  1565. return static_cast<Bytecode::Op::op const&>(*this).execute_impl(interpreter);
  1566. switch (type()) {
  1567. ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
  1568. default:
  1569. VERIFY_NOT_REACHED();
  1570. }
  1571. #undef __BYTECODE_OP
  1572. }
  1573. }