johnson 2.0.0.pre1 → 2.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. data/CHANGELOG.rdoc +12 -0
  2. data/Manifest.txt +4 -285
  3. data/Rakefile +13 -20
  4. data/ext/tracemonkey/global.cc +4 -1
  5. data/ext/tracemonkey/js.cc +30 -33
  6. data/ext/tracemonkey/runtime.cc +96 -6
  7. data/ext/tracemonkey/split_global.cc +0 -5
  8. data/ext/tracemonkey/tracemonkey.h +2 -2
  9. data/lib/johnson.rb +2 -2
  10. data/lib/johnson/runtime.rb +25 -15
  11. data/lib/johnson/tracemonkey/runtime.rb +6 -3
  12. data/vendor/tracemonkey/config/system-headers +1 -3
  13. data/vendor/tracemonkey/jscntxt.h +5 -2
  14. data/vendor/tracemonkey/jsdbgapi.cpp +9 -1
  15. data/vendor/tracemonkey/jsdbgapi.h +4 -0
  16. data/vendor/tracemonkey/tests/ecma/NativeObjects/browser.js +0 -0
  17. data/vendor/tracemonkey/tests/ecma/NativeObjects/jstests.list +0 -0
  18. data/vendor/tracemonkey/tests/ecma_3_1/Object/jstests.list +1 -1
  19. data/vendor/tracemonkey/tests/js1_3/misc/browser.js +0 -0
  20. data/vendor/tracemonkey/tests/js1_3/misc/jstests.list +0 -0
  21. data/vendor/tracemonkey/tests/js1_5/Regress/jstests.list +4 -4
  22. data/vendor/tracemonkey/tests/js1_5/Scope/jstests.list +1 -1
  23. data/vendor/tracemonkey/tests/js1_5/decompilation/jstests.list +2 -2
  24. data/vendor/tracemonkey/tests/js1_7/decompilation/jstests.list +1 -1
  25. data/vendor/tracemonkey/tests/shell.js +2 -1
  26. metadata +51 -309
  27. data/ext/spidermonkey/context.c +0 -116
  28. data/ext/spidermonkey/context.h +0 -19
  29. data/ext/spidermonkey/conversions.c +0 -361
  30. data/ext/spidermonkey/conversions.h +0 -31
  31. data/ext/spidermonkey/debugger.c +0 -234
  32. data/ext/spidermonkey/debugger.h +0 -10
  33. data/ext/spidermonkey/extconf.rb +0 -32
  34. data/ext/spidermonkey/extensions.c +0 -37
  35. data/ext/spidermonkey/extensions.h +0 -12
  36. data/ext/spidermonkey/global.c +0 -40
  37. data/ext/spidermonkey/global.h +0 -11
  38. data/ext/spidermonkey/idhash.c +0 -16
  39. data/ext/spidermonkey/idhash.h +0 -8
  40. data/ext/spidermonkey/immutable_node.c +0 -1153
  41. data/ext/spidermonkey/immutable_node.c.erb +0 -523
  42. data/ext/spidermonkey/immutable_node.h +0 -22
  43. data/ext/spidermonkey/jroot.h +0 -197
  44. data/ext/spidermonkey/js_land_proxy.c +0 -620
  45. data/ext/spidermonkey/js_land_proxy.h +0 -20
  46. data/ext/spidermonkey/ruby_land_proxy.c +0 -618
  47. data/ext/spidermonkey/ruby_land_proxy.h +0 -38
  48. data/ext/spidermonkey/runtime.c +0 -396
  49. data/ext/spidermonkey/runtime.h +0 -27
  50. data/ext/spidermonkey/spidermonkey.c +0 -22
  51. data/ext/spidermonkey/spidermonkey.h +0 -29
  52. data/lib/johnson/spidermonkey.rb +0 -12
  53. data/lib/johnson/spidermonkey/context.rb +0 -10
  54. data/lib/johnson/spidermonkey/debugger.rb +0 -67
  55. data/lib/johnson/spidermonkey/immutable_node.rb +0 -282
  56. data/lib/johnson/spidermonkey/js_land_proxy.rb +0 -64
  57. data/lib/johnson/spidermonkey/mutable_tree_visitor.rb +0 -242
  58. data/lib/johnson/spidermonkey/ruby_land_proxy.rb +0 -17
  59. data/lib/johnson/spidermonkey/runtime.rb +0 -74
  60. data/test/johnson/spidermonkey/context_test.rb +0 -21
  61. data/test/johnson/spidermonkey/immutable_node_test.rb +0 -34
  62. data/test/johnson/spidermonkey/js_land_proxy_test.rb +0 -273
  63. data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +0 -274
  64. data/test/johnson/spidermonkey/runtime_test.rb +0 -41
  65. data/vendor/spidermonkey/.cvsignore +0 -9
  66. data/vendor/spidermonkey/Makefile.in +0 -449
  67. data/vendor/spidermonkey/Makefile.ref +0 -365
  68. data/vendor/spidermonkey/README.html +0 -820
  69. data/vendor/spidermonkey/SpiderMonkey.rsp +0 -12
  70. data/vendor/spidermonkey/Y.js +0 -19
  71. data/vendor/spidermonkey/build.mk +0 -43
  72. data/vendor/spidermonkey/config.mk +0 -192
  73. data/vendor/spidermonkey/config/AIX4.1.mk +0 -65
  74. data/vendor/spidermonkey/config/AIX4.2.mk +0 -64
  75. data/vendor/spidermonkey/config/AIX4.3.mk +0 -65
  76. data/vendor/spidermonkey/config/Darwin.mk +0 -83
  77. data/vendor/spidermonkey/config/Darwin1.3.mk +0 -81
  78. data/vendor/spidermonkey/config/Darwin1.4.mk +0 -41
  79. data/vendor/spidermonkey/config/Darwin5.2.mk +0 -81
  80. data/vendor/spidermonkey/config/Darwin5.3.mk +0 -81
  81. data/vendor/spidermonkey/config/HP-UXB.10.10.mk +0 -77
  82. data/vendor/spidermonkey/config/HP-UXB.10.20.mk +0 -77
  83. data/vendor/spidermonkey/config/HP-UXB.11.00.mk +0 -80
  84. data/vendor/spidermonkey/config/IRIX.mk +0 -87
  85. data/vendor/spidermonkey/config/IRIX5.3.mk +0 -44
  86. data/vendor/spidermonkey/config/IRIX6.1.mk +0 -44
  87. data/vendor/spidermonkey/config/IRIX6.2.mk +0 -44
  88. data/vendor/spidermonkey/config/IRIX6.3.mk +0 -44
  89. data/vendor/spidermonkey/config/IRIX6.5.mk +0 -44
  90. data/vendor/spidermonkey/config/Linux_All.mk +0 -103
  91. data/vendor/spidermonkey/config/Mac_OS10.0.mk +0 -82
  92. data/vendor/spidermonkey/config/OSF1V4.0.mk +0 -72
  93. data/vendor/spidermonkey/config/OSF1V5.0.mk +0 -69
  94. data/vendor/spidermonkey/config/SunOS4.1.4.mk +0 -101
  95. data/vendor/spidermonkey/config/SunOS5.10.mk +0 -50
  96. data/vendor/spidermonkey/config/SunOS5.3.mk +0 -91
  97. data/vendor/spidermonkey/config/SunOS5.4.mk +0 -92
  98. data/vendor/spidermonkey/config/SunOS5.5.1.mk +0 -44
  99. data/vendor/spidermonkey/config/SunOS5.5.mk +0 -87
  100. data/vendor/spidermonkey/config/SunOS5.6.mk +0 -89
  101. data/vendor/spidermonkey/config/SunOS5.7.mk +0 -44
  102. data/vendor/spidermonkey/config/SunOS5.8.mk +0 -44
  103. data/vendor/spidermonkey/config/SunOS5.9.mk +0 -44
  104. data/vendor/spidermonkey/config/WINNT4.0.mk +0 -117
  105. data/vendor/spidermonkey/config/WINNT5.0.mk +0 -117
  106. data/vendor/spidermonkey/config/WINNT5.1.mk +0 -117
  107. data/vendor/spidermonkey/config/WINNT5.2.mk +0 -117
  108. data/vendor/spidermonkey/config/WINNT6.0.mk +0 -117
  109. data/vendor/spidermonkey/config/dgux.mk +0 -64
  110. data/vendor/spidermonkey/editline/Makefile.ref +0 -144
  111. data/vendor/spidermonkey/editline/README +0 -83
  112. data/vendor/spidermonkey/editline/editline.3 +0 -175
  113. data/vendor/spidermonkey/editline/editline.c +0 -1369
  114. data/vendor/spidermonkey/editline/editline.h +0 -135
  115. data/vendor/spidermonkey/editline/sysunix.c +0 -182
  116. data/vendor/spidermonkey/editline/unix.h +0 -82
  117. data/vendor/spidermonkey/fdlibm/.cvsignore +0 -7
  118. data/vendor/spidermonkey/fdlibm/Makefile.in +0 -127
  119. data/vendor/spidermonkey/fdlibm/Makefile.ref +0 -192
  120. data/vendor/spidermonkey/fdlibm/e_acos.c +0 -147
  121. data/vendor/spidermonkey/fdlibm/e_acosh.c +0 -105
  122. data/vendor/spidermonkey/fdlibm/e_asin.c +0 -156
  123. data/vendor/spidermonkey/fdlibm/e_atan2.c +0 -165
  124. data/vendor/spidermonkey/fdlibm/e_atanh.c +0 -110
  125. data/vendor/spidermonkey/fdlibm/e_cosh.c +0 -133
  126. data/vendor/spidermonkey/fdlibm/e_exp.c +0 -202
  127. data/vendor/spidermonkey/fdlibm/e_fmod.c +0 -184
  128. data/vendor/spidermonkey/fdlibm/e_gamma.c +0 -71
  129. data/vendor/spidermonkey/fdlibm/e_gamma_r.c +0 -70
  130. data/vendor/spidermonkey/fdlibm/e_hypot.c +0 -173
  131. data/vendor/spidermonkey/fdlibm/e_j0.c +0 -524
  132. data/vendor/spidermonkey/fdlibm/e_j1.c +0 -523
  133. data/vendor/spidermonkey/fdlibm/e_jn.c +0 -315
  134. data/vendor/spidermonkey/fdlibm/e_lgamma.c +0 -71
  135. data/vendor/spidermonkey/fdlibm/e_lgamma_r.c +0 -347
  136. data/vendor/spidermonkey/fdlibm/e_log.c +0 -184
  137. data/vendor/spidermonkey/fdlibm/e_log10.c +0 -134
  138. data/vendor/spidermonkey/fdlibm/e_pow.c +0 -386
  139. data/vendor/spidermonkey/fdlibm/e_rem_pio2.c +0 -222
  140. data/vendor/spidermonkey/fdlibm/e_remainder.c +0 -120
  141. data/vendor/spidermonkey/fdlibm/e_scalb.c +0 -89
  142. data/vendor/spidermonkey/fdlibm/e_sinh.c +0 -122
  143. data/vendor/spidermonkey/fdlibm/e_sqrt.c +0 -497
  144. data/vendor/spidermonkey/fdlibm/fdlibm.h +0 -273
  145. data/vendor/spidermonkey/fdlibm/fdlibm.mak +0 -1453
  146. data/vendor/spidermonkey/fdlibm/fdlibm.mdp +0 -0
  147. data/vendor/spidermonkey/fdlibm/k_cos.c +0 -135
  148. data/vendor/spidermonkey/fdlibm/k_rem_pio2.c +0 -354
  149. data/vendor/spidermonkey/fdlibm/k_sin.c +0 -114
  150. data/vendor/spidermonkey/fdlibm/k_standard.c +0 -785
  151. data/vendor/spidermonkey/fdlibm/k_tan.c +0 -170
  152. data/vendor/spidermonkey/fdlibm/s_asinh.c +0 -101
  153. data/vendor/spidermonkey/fdlibm/s_atan.c +0 -175
  154. data/vendor/spidermonkey/fdlibm/s_cbrt.c +0 -133
  155. data/vendor/spidermonkey/fdlibm/s_ceil.c +0 -120
  156. data/vendor/spidermonkey/fdlibm/s_copysign.c +0 -72
  157. data/vendor/spidermonkey/fdlibm/s_cos.c +0 -118
  158. data/vendor/spidermonkey/fdlibm/s_erf.c +0 -356
  159. data/vendor/spidermonkey/fdlibm/s_expm1.c +0 -267
  160. data/vendor/spidermonkey/fdlibm/s_fabs.c +0 -70
  161. data/vendor/spidermonkey/fdlibm/s_finite.c +0 -71
  162. data/vendor/spidermonkey/fdlibm/s_floor.c +0 -121
  163. data/vendor/spidermonkey/fdlibm/s_frexp.c +0 -99
  164. data/vendor/spidermonkey/fdlibm/s_ilogb.c +0 -85
  165. data/vendor/spidermonkey/fdlibm/s_isnan.c +0 -74
  166. data/vendor/spidermonkey/fdlibm/s_ldexp.c +0 -66
  167. data/vendor/spidermonkey/fdlibm/s_lib_version.c +0 -73
  168. data/vendor/spidermonkey/fdlibm/s_log1p.c +0 -211
  169. data/vendor/spidermonkey/fdlibm/s_logb.c +0 -79
  170. data/vendor/spidermonkey/fdlibm/s_matherr.c +0 -64
  171. data/vendor/spidermonkey/fdlibm/s_modf.c +0 -132
  172. data/vendor/spidermonkey/fdlibm/s_nextafter.c +0 -124
  173. data/vendor/spidermonkey/fdlibm/s_rint.c +0 -131
  174. data/vendor/spidermonkey/fdlibm/s_scalbn.c +0 -107
  175. data/vendor/spidermonkey/fdlibm/s_signgam.c +0 -40
  176. data/vendor/spidermonkey/fdlibm/s_significand.c +0 -68
  177. data/vendor/spidermonkey/fdlibm/s_sin.c +0 -118
  178. data/vendor/spidermonkey/fdlibm/s_tan.c +0 -112
  179. data/vendor/spidermonkey/fdlibm/s_tanh.c +0 -122
  180. data/vendor/spidermonkey/fdlibm/w_acos.c +0 -78
  181. data/vendor/spidermonkey/fdlibm/w_acosh.c +0 -78
  182. data/vendor/spidermonkey/fdlibm/w_asin.c +0 -80
  183. data/vendor/spidermonkey/fdlibm/w_atan2.c +0 -79
  184. data/vendor/spidermonkey/fdlibm/w_atanh.c +0 -81
  185. data/vendor/spidermonkey/fdlibm/w_cosh.c +0 -77
  186. data/vendor/spidermonkey/fdlibm/w_exp.c +0 -88
  187. data/vendor/spidermonkey/fdlibm/w_fmod.c +0 -78
  188. data/vendor/spidermonkey/fdlibm/w_gamma.c +0 -85
  189. data/vendor/spidermonkey/fdlibm/w_gamma_r.c +0 -81
  190. data/vendor/spidermonkey/fdlibm/w_hypot.c +0 -78
  191. data/vendor/spidermonkey/fdlibm/w_j0.c +0 -105
  192. data/vendor/spidermonkey/fdlibm/w_j1.c +0 -106
  193. data/vendor/spidermonkey/fdlibm/w_jn.c +0 -128
  194. data/vendor/spidermonkey/fdlibm/w_lgamma.c +0 -85
  195. data/vendor/spidermonkey/fdlibm/w_lgamma_r.c +0 -81
  196. data/vendor/spidermonkey/fdlibm/w_log.c +0 -78
  197. data/vendor/spidermonkey/fdlibm/w_log10.c +0 -81
  198. data/vendor/spidermonkey/fdlibm/w_pow.c +0 -99
  199. data/vendor/spidermonkey/fdlibm/w_remainder.c +0 -77
  200. data/vendor/spidermonkey/fdlibm/w_scalb.c +0 -95
  201. data/vendor/spidermonkey/fdlibm/w_sinh.c +0 -77
  202. data/vendor/spidermonkey/fdlibm/w_sqrt.c +0 -77
  203. data/vendor/spidermonkey/javascript-trace.d +0 -73
  204. data/vendor/spidermonkey/js.c +0 -3951
  205. data/vendor/spidermonkey/js.mdp +0 -0
  206. data/vendor/spidermonkey/js.msg +0 -308
  207. data/vendor/spidermonkey/js.pkg +0 -2
  208. data/vendor/spidermonkey/js3240.rc +0 -79
  209. data/vendor/spidermonkey/jsOS240.def +0 -654
  210. data/vendor/spidermonkey/jsapi.c +0 -5836
  211. data/vendor/spidermonkey/jsapi.h +0 -2624
  212. data/vendor/spidermonkey/jsarena.c +0 -450
  213. data/vendor/spidermonkey/jsarena.h +0 -318
  214. data/vendor/spidermonkey/jsarray.c +0 -2996
  215. data/vendor/spidermonkey/jsarray.h +0 -127
  216. data/vendor/spidermonkey/jsatom.c +0 -1045
  217. data/vendor/spidermonkey/jsatom.h +0 -442
  218. data/vendor/spidermonkey/jsbit.h +0 -253
  219. data/vendor/spidermonkey/jsbool.c +0 -176
  220. data/vendor/spidermonkey/jsbool.h +0 -73
  221. data/vendor/spidermonkey/jsclist.h +0 -139
  222. data/vendor/spidermonkey/jscntxt.c +0 -1348
  223. data/vendor/spidermonkey/jscntxt.h +0 -1120
  224. data/vendor/spidermonkey/jscompat.h +0 -57
  225. data/vendor/spidermonkey/jsconfig.h +0 -248
  226. data/vendor/spidermonkey/jsconfig.mk +0 -181
  227. data/vendor/spidermonkey/jscpucfg.c +0 -396
  228. data/vendor/spidermonkey/jscpucfg.h +0 -212
  229. data/vendor/spidermonkey/jsdate.c +0 -2390
  230. data/vendor/spidermonkey/jsdate.h +0 -124
  231. data/vendor/spidermonkey/jsdbgapi.c +0 -1802
  232. data/vendor/spidermonkey/jsdbgapi.h +0 -464
  233. data/vendor/spidermonkey/jsdhash.c +0 -868
  234. data/vendor/spidermonkey/jsdhash.h +0 -592
  235. data/vendor/spidermonkey/jsdtoa.c +0 -3167
  236. data/vendor/spidermonkey/jsdtoa.h +0 -130
  237. data/vendor/spidermonkey/jsdtracef.c +0 -317
  238. data/vendor/spidermonkey/jsdtracef.h +0 -77
  239. data/vendor/spidermonkey/jsemit.c +0 -6909
  240. data/vendor/spidermonkey/jsemit.h +0 -741
  241. data/vendor/spidermonkey/jsexn.c +0 -1371
  242. data/vendor/spidermonkey/jsexn.h +0 -96
  243. data/vendor/spidermonkey/jsfile.c +0 -2736
  244. data/vendor/spidermonkey/jsfile.h +0 -56
  245. data/vendor/spidermonkey/jsfile.msg +0 -90
  246. data/vendor/spidermonkey/jsfun.c +0 -2634
  247. data/vendor/spidermonkey/jsfun.h +0 -254
  248. data/vendor/spidermonkey/jsgc.c +0 -3562
  249. data/vendor/spidermonkey/jsgc.h +0 -403
  250. data/vendor/spidermonkey/jshash.c +0 -476
  251. data/vendor/spidermonkey/jshash.h +0 -151
  252. data/vendor/spidermonkey/jsify.pl +0 -485
  253. data/vendor/spidermonkey/jsinterp.c +0 -7007
  254. data/vendor/spidermonkey/jsinterp.h +0 -525
  255. data/vendor/spidermonkey/jsinvoke.c +0 -43
  256. data/vendor/spidermonkey/jsiter.c +0 -1067
  257. data/vendor/spidermonkey/jsiter.h +0 -122
  258. data/vendor/spidermonkey/jskeyword.tbl +0 -124
  259. data/vendor/spidermonkey/jskwgen.c +0 -460
  260. data/vendor/spidermonkey/jslibmath.h +0 -266
  261. data/vendor/spidermonkey/jslock.c +0 -1309
  262. data/vendor/spidermonkey/jslock.h +0 -313
  263. data/vendor/spidermonkey/jslocko.asm +0 -60
  264. data/vendor/spidermonkey/jslog2.c +0 -94
  265. data/vendor/spidermonkey/jslong.c +0 -264
  266. data/vendor/spidermonkey/jslong.h +0 -412
  267. data/vendor/spidermonkey/jsmath.c +0 -567
  268. data/vendor/spidermonkey/jsmath.h +0 -57
  269. data/vendor/spidermonkey/jsnum.c +0 -1239
  270. data/vendor/spidermonkey/jsnum.h +0 -283
  271. data/vendor/spidermonkey/jsobj.c +0 -5282
  272. data/vendor/spidermonkey/jsobj.h +0 -709
  273. data/vendor/spidermonkey/jsopcode.c +0 -5245
  274. data/vendor/spidermonkey/jsopcode.h +0 -394
  275. data/vendor/spidermonkey/jsopcode.tbl +0 -523
  276. data/vendor/spidermonkey/jsotypes.h +0 -202
  277. data/vendor/spidermonkey/jsparse.c +0 -6704
  278. data/vendor/spidermonkey/jsparse.h +0 -511
  279. data/vendor/spidermonkey/jsprf.c +0 -1264
  280. data/vendor/spidermonkey/jsprf.h +0 -150
  281. data/vendor/spidermonkey/jsproto.tbl +0 -128
  282. data/vendor/spidermonkey/jsprvtd.h +0 -267
  283. data/vendor/spidermonkey/jspubtd.h +0 -744
  284. data/vendor/spidermonkey/jsregexp.c +0 -4364
  285. data/vendor/spidermonkey/jsregexp.h +0 -183
  286. data/vendor/spidermonkey/jsreops.tbl +0 -145
  287. data/vendor/spidermonkey/jsscan.c +0 -2012
  288. data/vendor/spidermonkey/jsscan.h +0 -387
  289. data/vendor/spidermonkey/jsscope.c +0 -1957
  290. data/vendor/spidermonkey/jsscope.h +0 -418
  291. data/vendor/spidermonkey/jsscript.c +0 -1832
  292. data/vendor/spidermonkey/jsscript.h +0 -287
  293. data/vendor/spidermonkey/jsshell.msg +0 -50
  294. data/vendor/spidermonkey/jsstddef.h +0 -83
  295. data/vendor/spidermonkey/jsstr.c +0 -5005
  296. data/vendor/spidermonkey/jsstr.h +0 -641
  297. data/vendor/spidermonkey/jstypes.h +0 -475
  298. data/vendor/spidermonkey/jsutil.c +0 -345
  299. data/vendor/spidermonkey/jsutil.h +0 -157
  300. data/vendor/spidermonkey/jsxdrapi.c +0 -800
  301. data/vendor/spidermonkey/jsxdrapi.h +0 -218
  302. data/vendor/spidermonkey/jsxml.c +0 -8476
  303. data/vendor/spidermonkey/jsxml.h +0 -349
  304. data/vendor/spidermonkey/lock_SunOS.s +0 -119
  305. data/vendor/spidermonkey/perfect.js +0 -39
  306. data/vendor/spidermonkey/plify_jsdhash.sed +0 -36
  307. data/vendor/spidermonkey/prmjtime.c +0 -846
  308. data/vendor/spidermonkey/prmjtime.h +0 -103
  309. data/vendor/spidermonkey/resource.h +0 -15
  310. data/vendor/spidermonkey/rules.mk +0 -197
  311. data/vendor/spidermonkey/win32.order +0 -384
@@ -1,394 +0,0 @@
1
- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
- *
3
- * ***** BEGIN LICENSE BLOCK *****
4
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
- *
6
- * The contents of this file are subject to the Mozilla Public License Version
7
- * 1.1 (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- * http://www.mozilla.org/MPL/
10
- *
11
- * Software distributed under the License is distributed on an "AS IS" basis,
12
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
- * for the specific language governing rights and limitations under the
14
- * License.
15
- *
16
- * The Original Code is Mozilla Communicator client code, released
17
- * March 31, 1998.
18
- *
19
- * The Initial Developer of the Original Code is
20
- * Netscape Communications Corporation.
21
- * Portions created by the Initial Developer are Copyright (C) 1998
22
- * the Initial Developer. All Rights Reserved.
23
- *
24
- * Contributor(s):
25
- *
26
- * Alternatively, the contents of this file may be used under the terms of
27
- * either of the GNU General Public License Version 2 or later (the "GPL"),
28
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
- * in which case the provisions of the GPL or the LGPL are applicable instead
30
- * of those above. If you wish to allow use of your version of this file only
31
- * under the terms of either the GPL or the LGPL, and not to allow others to
32
- * use your version of this file under the terms of the MPL, indicate your
33
- * decision by deleting the provisions above and replace them with the notice
34
- * and other provisions required by the GPL or the LGPL. If you do not delete
35
- * the provisions above, a recipient may use your version of this file under
36
- * the terms of any one of the MPL, the GPL or the LGPL.
37
- *
38
- * ***** END LICENSE BLOCK ***** */
39
-
40
- #ifndef jsopcode_h___
41
- #define jsopcode_h___
42
- /*
43
- * JS bytecode definitions.
44
- */
45
- #include <stddef.h>
46
- #include "jsprvtd.h"
47
- #include "jspubtd.h"
48
- #include "jsutil.h"
49
-
50
- JS_BEGIN_EXTERN_C
51
-
52
- /*
53
- * JS operation bytecodes.
54
- */
55
- typedef enum JSOp {
56
- #define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
57
- op = val,
58
- #include "jsopcode.tbl"
59
- #undef OPDEF
60
- JSOP_LIMIT
61
- } JSOp;
62
-
63
- typedef enum JSOpLength {
64
- #define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
65
- op##_LENGTH = length,
66
- #include "jsopcode.tbl"
67
- #undef OPDEF
68
- JSOP_LIMIT_LENGTH
69
- } JSOpLength;
70
-
71
- /*
72
- * JS bytecode formats.
73
- */
74
- #define JOF_BYTE 0 /* single bytecode, no immediates */
75
- #define JOF_JUMP 1 /* signed 16-bit jump offset immediate */
76
- #define JOF_ATOM 2 /* unsigned 16-bit constant pool index */
77
- #define JOF_UINT16 3 /* unsigned 16-bit immediate operand */
78
- #define JOF_TABLESWITCH 4 /* table switch */
79
- #define JOF_LOOKUPSWITCH 5 /* lookup switch */
80
- #define JOF_QARG 6 /* quickened get/set function argument ops */
81
- #define JOF_QVAR 7 /* quickened get/set local variable ops */
82
- #define JOF_SLOTATOM 8 /* uint16 slot index + constant pool index */
83
- #define JOF_JUMPX 9 /* signed 32-bit jump offset immediate */
84
- #define JOF_TABLESWITCHX 10 /* extended (32-bit offset) table switch */
85
- #define JOF_LOOKUPSWITCHX 11 /* extended (32-bit offset) lookup switch */
86
- #define JOF_UINT24 12 /* extended unsigned 24-bit literal (index) */
87
- #define JOF_2BYTE 13 /* 2-byte opcode, e.g., upper 8 bits of 24-bit
88
- atom index */
89
- #define JOF_LOCAL 14 /* block-local operand stack variable */
90
- #define JOF_OBJECT 15 /* unsigned 16-bit object pool index */
91
- #define JOF_SLOTOBJECT 16 /* uint16 slot index + object pool index */
92
- #define JOF_REGEXP 17 /* unsigned 16-bit regexp pool index */
93
- #define JOF_INT8 18 /* int8 immediate operand */
94
- #define JOF_INT32 19 /* int32 immediate operand */
95
- #define JOF_TYPEMASK 0x001f /* mask for above immediate types */
96
-
97
- #define JOF_NAME (1U<<5) /* name operation */
98
- #define JOF_PROP (2U<<5) /* obj.prop operation */
99
- #define JOF_ELEM (3U<<5) /* obj[index] operation */
100
- #define JOF_XMLNAME (4U<<5) /* XML name: *, a::b, @a, @a::b, etc. */
101
- #define JOF_VARPROP (5U<<5) /* x.prop for this, arg, var, or local x */
102
- #define JOF_MODEMASK (7U<<5) /* mask for above addressing modes */
103
- #define JOF_SET (1U<<8) /* set (i.e., assignment) operation */
104
- #define JOF_DEL (1U<<9) /* delete operation */
105
- #define JOF_DEC (1U<<10) /* decrement (--, not ++) opcode */
106
- #define JOF_INC (2U<<10) /* increment (++, not --) opcode */
107
- #define JOF_INCDEC (3U<<10) /* increment or decrement opcode */
108
- #define JOF_POST (1U<<12) /* postorder increment or decrement */
109
- #define JOF_IMPORT (1U<<13) /* import property op */
110
- #define JOF_FOR (1U<<14) /* for-in property op */
111
- #define JOF_ASSIGNING JOF_SET /* hint for JSClass.resolve, used for ops
112
- that do simplex assignment */
113
- #define JOF_DETECTING (1U<<15) /* object detection for JSNewResolveOp */
114
- #define JOF_BACKPATCH (1U<<16) /* backpatch placeholder during codegen */
115
- #define JOF_LEFTASSOC (1U<<17) /* left-associative operator */
116
- #define JOF_DECLARING (1U<<18) /* var, const, or function declaration op */
117
- #define JOF_INDEXBASE (1U<<19) /* atom segment base setting prefix op */
118
- #define JOF_CALLOP (1U<<20) /* call operation that pushes function and
119
- this */
120
- #define JOF_PARENHEAD (1U<<21) /* opcode consumes value of expression in
121
- parenthesized statement head */
122
- #define JOF_INVOKE (1U<<22) /* JSOP_CALL, JSOP_NEW, JSOP_EVAL */
123
- #define JOF_TMPSLOT (1U<<23) /* interpreter uses extra temporary slot
124
- to root intermediate objects besides
125
- the slots opcode uses */
126
- #define JOF_TMPSLOT2 (2U<<23) /* interpreter uses extra 2 temporary slot
127
- besides the slots opcode uses */
128
- #define JOF_TMPSLOT_SHIFT 23
129
- #define JOF_TMPSLOT_MASK (JS_BITMASK(2) << JOF_TMPSLOT_SHIFT)
130
-
131
- /* Shorthands for type from format and type from opcode. */
132
- #define JOF_TYPE(fmt) ((fmt) & JOF_TYPEMASK)
133
- #define JOF_OPTYPE(op) JOF_TYPE(js_CodeSpec[op].format)
134
-
135
- /* Shorthands for mode from format and mode from opcode. */
136
- #define JOF_MODE(fmt) ((fmt) & JOF_MODEMASK)
137
- #define JOF_OPMODE(op) JOF_MODE(js_CodeSpec[op].format)
138
-
139
- #define JOF_TYPE_IS_EXTENDED_JUMP(t) \
140
- ((unsigned)((t) - JOF_JUMPX) <= (unsigned)(JOF_LOOKUPSWITCHX - JOF_JUMPX))
141
-
142
- /*
143
- * Immediate operand getters, setters, and bounds.
144
- */
145
-
146
- /* Common uint16 immediate format helpers. */
147
- #define UINT16_LEN 2
148
- #define UINT16_HI(i) ((jsbytecode)((i) >> 8))
149
- #define UINT16_LO(i) ((jsbytecode)(i))
150
- #define GET_UINT16(pc) ((uintN)(((pc)[1] << 8) | (pc)[2]))
151
- #define SET_UINT16(pc,i) ((pc)[1] = UINT16_HI(i), (pc)[2] = UINT16_LO(i))
152
- #define UINT16_LIMIT ((uintN)1 << 16)
153
-
154
- /* Short (2-byte signed offset) relative jump macros. */
155
- #define JUMP_OFFSET_LEN 2
156
- #define JUMP_OFFSET_HI(off) ((jsbytecode)((off) >> 8))
157
- #define JUMP_OFFSET_LO(off) ((jsbytecode)(off))
158
- #define GET_JUMP_OFFSET(pc) ((int16)GET_UINT16(pc))
159
- #define SET_JUMP_OFFSET(pc,off) ((pc)[1] = JUMP_OFFSET_HI(off), \
160
- (pc)[2] = JUMP_OFFSET_LO(off))
161
- #define JUMP_OFFSET_MIN ((int16)0x8000)
162
- #define JUMP_OFFSET_MAX ((int16)0x7fff)
163
-
164
- /*
165
- * When a short jump won't hold a relative offset, its 2-byte immediate offset
166
- * operand is an unsigned index of a span-dependency record, maintained until
167
- * code generation finishes -- after which some (but we hope not nearly all)
168
- * span-dependent jumps must be extended (see OptimizeSpanDeps in jsemit.c).
169
- *
170
- * If the span-dependency record index overflows SPANDEP_INDEX_MAX, the jump
171
- * offset will contain SPANDEP_INDEX_HUGE, indicating that the record must be
172
- * found (via binary search) by its "before span-dependency optimization" pc
173
- * offset (from script main entry point).
174
- */
175
- #define GET_SPANDEP_INDEX(pc) ((uint16)GET_UINT16(pc))
176
- #define SET_SPANDEP_INDEX(pc,i) ((pc)[1] = JUMP_OFFSET_HI(i), \
177
- (pc)[2] = JUMP_OFFSET_LO(i))
178
- #define SPANDEP_INDEX_MAX ((uint16)0xfffe)
179
- #define SPANDEP_INDEX_HUGE ((uint16)0xffff)
180
-
181
- /* Ultimately, if short jumps won't do, emit long (4-byte signed) offsets. */
182
- #define JUMPX_OFFSET_LEN 4
183
- #define JUMPX_OFFSET_B3(off) ((jsbytecode)((off) >> 24))
184
- #define JUMPX_OFFSET_B2(off) ((jsbytecode)((off) >> 16))
185
- #define JUMPX_OFFSET_B1(off) ((jsbytecode)((off) >> 8))
186
- #define JUMPX_OFFSET_B0(off) ((jsbytecode)(off))
187
- #define GET_JUMPX_OFFSET(pc) ((int32)(((pc)[1] << 24) | ((pc)[2] << 16) \
188
- | ((pc)[3] << 8) | (pc)[4]))
189
- #define SET_JUMPX_OFFSET(pc,off)((pc)[1] = JUMPX_OFFSET_B3(off), \
190
- (pc)[2] = JUMPX_OFFSET_B2(off), \
191
- (pc)[3] = JUMPX_OFFSET_B1(off), \
192
- (pc)[4] = JUMPX_OFFSET_B0(off))
193
- #define JUMPX_OFFSET_MIN ((int32)0x80000000)
194
- #define JUMPX_OFFSET_MAX ((int32)0x7fffffff)
195
-
196
- /*
197
- * A literal is indexed by a per-script atom or object maps. Most scripts
198
- * have relatively few literals, so the standard JOF_ATOM, JOF_OBJECT and
199
- * JOF_REGEXP formats specifies a fixed 16 bits of immediate operand index.
200
- * A script with more than 64K literals must wrap the bytecode into
201
- * JSOP_INDEXBASE and JSOP_RESETBASE pair.
202
- */
203
- #define INDEX_LEN 2
204
- #define INDEX_HI(i) ((jsbytecode)((i) >> 8))
205
- #define INDEX_LO(i) ((jsbytecode)(i))
206
- #define GET_INDEX(pc) GET_UINT16(pc)
207
- #define SET_INDEX(pc,i) ((pc)[1] = INDEX_HI(i), (pc)[2] = INDEX_LO(i))
208
-
209
- #define GET_INDEXBASE(pc) (JS_ASSERT(*(pc) == JSOP_INDEXBASE), \
210
- ((uintN)((pc)[1])) << 16)
211
- #define INDEXBASE_LEN 1
212
-
213
- #define UINT24_HI(i) ((jsbytecode)((i) >> 16))
214
- #define UINT24_MID(i) ((jsbytecode)((i) >> 8))
215
- #define UINT24_LO(i) ((jsbytecode)(i))
216
- #define GET_UINT24(pc) ((jsatomid)(((pc)[1] << 16) | \
217
- ((pc)[2] << 8) | \
218
- (pc)[3]))
219
- #define SET_UINT24(pc,i) ((pc)[1] = UINT24_HI(i), \
220
- (pc)[2] = UINT24_MID(i), \
221
- (pc)[3] = UINT24_LO(i))
222
-
223
- #define GET_INT8(pc) ((jsint)(int8)(pc)[1])
224
-
225
- #define GET_INT32(pc) ((jsint)(((uint32)((pc)[1]) << 24) | \
226
- ((uint32)((pc)[2]) << 16) | \
227
- ((uint32)((pc)[3]) << 8) | \
228
- (uint32)(pc)[4]))
229
- #define SET_INT32(pc,i) ((pc)[1] = (jsbytecode)((uint32)(i) >> 24), \
230
- (pc)[2] = (jsbytecode)((uint32)(i) >> 16), \
231
- (pc)[3] = (jsbytecode)((uint32)(i) >> 8), \
232
- (pc)[4] = (jsbytecode)(uint32)(i))
233
-
234
- /* Index limit is determined by SN_3BYTE_OFFSET_FLAG, see jsemit.h. */
235
- #define INDEX_LIMIT_LOG2 23
236
- #define INDEX_LIMIT ((uint32)1 << INDEX_LIMIT_LOG2)
237
-
238
- JS_STATIC_ASSERT(sizeof(uint32) * JS_BITS_PER_BYTE >= INDEX_LIMIT_LOG2 + 1);
239
-
240
- /* Actual argument count operand format helpers. */
241
- #define ARGC_HI(argc) UINT16_HI(argc)
242
- #define ARGC_LO(argc) UINT16_LO(argc)
243
- #define GET_ARGC(pc) GET_UINT16(pc)
244
- #define ARGC_LIMIT UINT16_LIMIT
245
-
246
- /* Synonyms for quick JOF_QARG and JOF_QVAR bytecodes. */
247
- #define GET_ARGNO(pc) GET_UINT16(pc)
248
- #define SET_ARGNO(pc,argno) SET_UINT16(pc,argno)
249
- #define ARGNO_LEN 2
250
- #define ARGNO_LIMIT UINT16_LIMIT
251
-
252
- #define GET_VARNO(pc) GET_UINT16(pc)
253
- #define SET_VARNO(pc,varno) SET_UINT16(pc,varno)
254
- #define VARNO_LEN 2
255
- #define VARNO_LIMIT UINT16_LIMIT
256
-
257
- struct JSCodeSpec {
258
- int8 length; /* length including opcode byte */
259
- int8 nuses; /* arity, -1 if variadic */
260
- int8 ndefs; /* number of stack results */
261
- uint8 prec; /* operator precedence */
262
- uint32 format; /* immediate operand format */
263
- };
264
-
265
- extern const JSCodeSpec js_CodeSpec[];
266
- extern uintN js_NumCodeSpecs;
267
- extern const char *js_CodeName[];
268
- extern const char js_EscapeMap[];
269
-
270
- /*
271
- * Return a GC'ed string containing the chars in str, with any non-printing
272
- * chars or quotes (' or " as specified by the quote argument) escaped, and
273
- * with the quote character at the beginning and end of the result string.
274
- */
275
- extern JSString *
276
- js_QuoteString(JSContext *cx, JSString *str, jschar quote);
277
-
278
- /*
279
- * JSPrinter operations, for printf style message formatting. The return
280
- * value from js_GetPrinterOutput() is the printer's cumulative output, in
281
- * a GC'ed string.
282
- */
283
-
284
- #ifdef JS_ARENAMETER
285
- # define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
286
- js_NewPrinter(cx, name, fun, indent, pretty)
287
- #else
288
- # define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
289
- js_NewPrinter(cx, fun, indent, pretty)
290
- #endif
291
-
292
- extern JSPrinter *
293
- JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
294
- uintN indent, JSBool pretty);
295
-
296
- extern void
297
- js_DestroyPrinter(JSPrinter *jp);
298
-
299
- extern JSString *
300
- js_GetPrinterOutput(JSPrinter *jp);
301
-
302
- extern int
303
- js_printf(JSPrinter *jp, const char *format, ...);
304
-
305
- extern JSBool
306
- js_puts(JSPrinter *jp, const char *s);
307
-
308
- /*
309
- * Get index operand from the bytecode using a bytecode analysis to deduce the
310
- * the index register. This function is infallible, in spite of taking cx as
311
- * its first parameter; it uses only cx->runtime when calling JS_GetTrapOpcode.
312
- * The GET_*_FROM_BYTECODE macros that call it pick up cx from their caller's
313
- * lexical environments.
314
- */
315
- uintN
316
- js_GetIndexFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc,
317
- ptrdiff_t pcoff);
318
-
319
- /*
320
- * A slower version of GET_ATOM when the caller does not want to maintain
321
- * the index segment register itself.
322
- */
323
- #define GET_ATOM_FROM_BYTECODE(script, pc, pcoff, atom) \
324
- JS_BEGIN_MACRO \
325
- uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
326
- JS_GET_SCRIPT_ATOM((script), index_, atom); \
327
- JS_END_MACRO
328
-
329
- #define GET_OBJECT_FROM_BYTECODE(script, pc, pcoff, obj) \
330
- JS_BEGIN_MACRO \
331
- uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
332
- JS_GET_SCRIPT_OBJECT((script), index_, obj); \
333
- JS_END_MACRO
334
-
335
- #define GET_FUNCTION_FROM_BYTECODE(script, pc, pcoff, fun) \
336
- JS_BEGIN_MACRO \
337
- uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
338
- JS_GET_SCRIPT_FUNCTION((script), index_, fun); \
339
- JS_END_MACRO
340
-
341
- #define GET_REGEXP_FROM_BYTECODE(script, pc, pcoff, obj) \
342
- JS_BEGIN_MACRO \
343
- uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
344
- JS_GET_SCRIPT_REGEXP((script), index_, obj); \
345
- JS_END_MACRO
346
-
347
- #ifdef DEBUG
348
- /*
349
- * Disassemblers, for debugging only.
350
- */
351
- #include <stdio.h>
352
-
353
- extern JS_FRIEND_API(JSBool)
354
- js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp);
355
-
356
- extern JS_FRIEND_API(uintN)
357
- js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
358
- JSBool lines, FILE *fp);
359
- #endif /* DEBUG */
360
-
361
- /*
362
- * Decompilers, for script, function, and expression pretty-printing.
363
- */
364
- extern JSBool
365
- js_DecompileScript(JSPrinter *jp, JSScript *script);
366
-
367
- extern JSBool
368
- js_DecompileFunctionBody(JSPrinter *jp);
369
-
370
- extern JSBool
371
- js_DecompileFunction(JSPrinter *jp);
372
-
373
- /*
374
- * Find the source expression that resulted in v, and return a newly allocated
375
- * C-string containing it. Fall back on v's string conversion (fallback) if we
376
- * can't find the bytecode that generated and pushed v on the operand stack.
377
- *
378
- * Search the current stack frame if spindex is JSDVG_SEARCH_STACK. Don't
379
- * look for v on the stack if spindex is JSDVG_IGNORE_STACK. Otherwise,
380
- * spindex is the negative index of v, measured from cx->fp->sp, or from a
381
- * lower frame's sp if cx->fp is native.
382
- *
383
- * The caller must call JS_free on the result after a succsesful call.
384
- */
385
- extern char *
386
- js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
387
- JSString *fallback);
388
-
389
- #define JSDVG_IGNORE_STACK 0
390
- #define JSDVG_SEARCH_STACK 1
391
-
392
- JS_END_EXTERN_C
393
-
394
- #endif /* jsopcode_h___ */
@@ -1,523 +0,0 @@
1
- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
- * vim: set ts=8 sw=4 et tw=0 ft=C:
3
- *
4
- * ***** BEGIN LICENSE BLOCK *****
5
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
- *
7
- * The contents of this file are subject to the Mozilla Public License Version
8
- * 1.1 (the "License"); you may not use this file except in compliance with
9
- * the License. You may obtain a copy of the License at
10
- * http://www.mozilla.org/MPL/
11
- *
12
- * Software distributed under the License is distributed on an "AS IS" basis,
13
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
- * for the specific language governing rights and limitations under the
15
- * License.
16
- *
17
- * The Original Code is Mozilla Communicator client code, released
18
- * March 31, 1998.
19
- *
20
- * The Initial Developer of the Original Code is
21
- * Netscape Communications Corporation.
22
- * Portions created by the Initial Developer are Copyright (C) 1998
23
- * the Initial Developer. All Rights Reserved.
24
- *
25
- * Contributor(s):
26
- *
27
- * Alternatively, the contents of this file may be used under the terms of
28
- * either of the GNU General Public License Version 2 or later (the "GPL"),
29
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
- * in which case the provisions of the GPL or the LGPL are applicable instead
31
- * of those above. If you wish to allow use of your version of this file only
32
- * under the terms of either the GPL or the LGPL, and not to allow others to
33
- * use your version of this file under the terms of the MPL, indicate your
34
- * decision by deleting the provisions above and replace them with the notice
35
- * and other provisions required by the GPL or the LGPL. If you do not delete
36
- * the provisions above, a recipient may use your version of this file under
37
- * the terms of any one of the MPL, the GPL or the LGPL.
38
- *
39
- * ***** END LICENSE BLOCK ***** */
40
-
41
- /*
42
- * JavaScript operation bytecodes. If you need to allocate a bytecode, look
43
- * for a name of the form JSOP_UNUSED* and claim it. Otherwise, always add at
44
- * the end of the table.
45
- *
46
- * Includers must define an OPDEF macro of the following form:
47
- *
48
- * #define OPDEF(op,val,name,image,length,nuses,ndefs,prec,format) ...
49
- *
50
- * Selected arguments can be expanded in initializers. The op argument is
51
- * expanded followed by comma in the JSOp enum (jsopcode.h), e.g. The value
52
- * field must be dense for now, because jsopcode.c uses an OPDEF() expansion
53
- * inside the js_CodeSpec[] initializer.
54
- *
55
- * Field Description
56
- * op Bytecode name, which is the JSOp enumerator name
57
- * value Bytecode value, which is the JSOp enumerator value
58
- * name C string containing name for disassembler
59
- * image C string containing "image" for pretty-printer, null if ugly
60
- * length Number of bytes including any immediate operands
61
- * nuses Number of stack slots consumed by bytecode, -1 if variadic
62
- * ndefs Number of stack slots produced by bytecode
63
- * prec Operator precedence, zero if not an operator
64
- * format Bytecode plus immediate operand encoding format
65
- *
66
- * Precedence Operators Opcodes
67
- * 1 let (x = y) z, yield w JSOP_LEAVEBLOCKEXPR, JSOP_YIELD
68
- * 2 , JSOP_POP with SRC_PCDELTA, JSOP_RETURN
69
- * 3 =, +=, etc. JSOP_SETNAME, etc. (all JOF_ASSIGNING)
70
- * 4 ?: JSOP_IFEQ, JSOP_IFEQX
71
- * 5 || JSOP_OR, JSOP_ORX
72
- * 6 && JSOP_AND, JSOP_ANDX
73
- * 7 | JSOP_BITOR
74
- * 8 ^ JSOP_BITXOR
75
- * 9 & JSOP_BITAND
76
- * 10 ==, !=, etc. JSOP_EQ, JSOP_NE, etc.
77
- * 11 <, in, etc. JSOP_LT, JSOP_IN, etc.
78
- * 12 <<, >>, >>> JSOP_LSH, JSOP_RSH, JSOP_URSH
79
- * 13 +, -, etc. JSOP_ADD, JSOP_SUB, etc.
80
- * 14 *, /, % JSOP_MUL, JSOP_DIV, JSOP_MOD
81
- * 15 !, ~, etc. JSOP_NOT, JSOP_BITNOT, etc.
82
- * 16 3.14, 0, etc. JSOP_DOUBLE, JSOP_ZERO, etc.
83
- * 17 delete, new JSOP_DEL*, JSOP_NEW
84
- * 18 x.y, f(), etc. JSOP_GETPROP, JSOP_CALL, etc.
85
- * 19 x, null, etc. JSOP_NAME, JSOP_NULL, etc.
86
- *
87
- * The push-numeric-constant operators, JSOP_ZERO, JSOP_DOUBLE, etc., have
88
- * lower precedence than the member operators emitted for the . operator, to
89
- * cause the decompiler to parenthesize the . left operand, e.g. (0).foo.
90
- * Otherwise the . could be taken as a decimal point. We use the same level
91
- * 16 for function expressions too, to force parenthesization.
92
- *
93
- * This file is best viewed with 128 columns:
94
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
95
- */
96
-
97
- /* legend: op val name image len use def prec format */
98
-
99
- /* Longstanding JavaScript bytecodes. */
100
- OPDEF(JSOP_NOP, 0, "nop", NULL, 1, 0, 0, 0, JOF_BYTE)
101
- OPDEF(JSOP_PUSH, 1, "push", NULL, 1, 0, 1, 0, JOF_BYTE)
102
- OPDEF(JSOP_POPV, 2, "popv", NULL, 1, 1, 0, 2, JOF_BYTE)
103
- OPDEF(JSOP_ENTERWITH, 3, "enterwith", NULL, 1, 1, 1, 0, JOF_BYTE|JOF_PARENHEAD)
104
- OPDEF(JSOP_LEAVEWITH, 4, "leavewith", NULL, 1, 1, 0, 0, JOF_BYTE)
105
- OPDEF(JSOP_RETURN, 5, "return", NULL, 1, 1, 0, 2, JOF_BYTE)
106
- OPDEF(JSOP_GOTO, 6, "goto", NULL, 3, 0, 0, 0, JOF_JUMP)
107
- OPDEF(JSOP_IFEQ, 7, "ifeq", NULL, 3, 1, 0, 4, JOF_JUMP|JOF_DETECTING)
108
- OPDEF(JSOP_IFNE, 8, "ifne", NULL, 3, 1, 0, 0, JOF_JUMP|JOF_PARENHEAD)
109
-
110
- /* Get the arguments object for the current, lightweight function activation. */
111
- OPDEF(JSOP_ARGUMENTS, 9, js_arguments_str, js_arguments_str, 1, 0, 1, 18, JOF_BYTE)
112
-
113
- /* ECMA-compliant for-in loop with argument or local variable loop control. */
114
- OPDEF(JSOP_FORARG, 10, "forarg", NULL, 3, 0, 1, 19, JOF_QARG|JOF_NAME|JOF_FOR)
115
- OPDEF(JSOP_FORVAR, 11, "forvar", NULL, 3, 0, 1, 19, JOF_QVAR|JOF_NAME|JOF_FOR)
116
-
117
- /* More longstanding bytecodes. */
118
- OPDEF(JSOP_DUP, 12, "dup", NULL, 1, 1, 2, 0, JOF_BYTE)
119
- OPDEF(JSOP_DUP2, 13, "dup2", NULL, 1, 2, 4, 0, JOF_BYTE)
120
- OPDEF(JSOP_SETCONST, 14, "setconst", NULL, 3, 1, 1, 3, JOF_ATOM|JOF_NAME|JOF_SET)
121
- OPDEF(JSOP_BITOR, 15, "bitor", "|", 1, 2, 1, 7, JOF_BYTE|JOF_LEFTASSOC)
122
- OPDEF(JSOP_BITXOR, 16, "bitxor", "^", 1, 2, 1, 8, JOF_BYTE|JOF_LEFTASSOC)
123
- OPDEF(JSOP_BITAND, 17, "bitand", "&", 1, 2, 1, 9, JOF_BYTE|JOF_LEFTASSOC)
124
- OPDEF(JSOP_EQ, 18, "eq", "==", 1, 2, 1, 10, JOF_BYTE|JOF_LEFTASSOC|JOF_DETECTING)
125
- OPDEF(JSOP_NE, 19, "ne", "!=", 1, 2, 1, 10, JOF_BYTE|JOF_LEFTASSOC|JOF_DETECTING)
126
- OPDEF(JSOP_LT, 20, "lt", "<", 1, 2, 1, 11, JOF_BYTE|JOF_LEFTASSOC)
127
- OPDEF(JSOP_LE, 21, "le", "<=", 1, 2, 1, 11, JOF_BYTE|JOF_LEFTASSOC)
128
- OPDEF(JSOP_GT, 22, "gt", ">", 1, 2, 1, 11, JOF_BYTE|JOF_LEFTASSOC)
129
- OPDEF(JSOP_GE, 23, "ge", ">=", 1, 2, 1, 11, JOF_BYTE|JOF_LEFTASSOC)
130
- OPDEF(JSOP_LSH, 24, "lsh", "<<", 1, 2, 1, 12, JOF_BYTE|JOF_LEFTASSOC)
131
- OPDEF(JSOP_RSH, 25, "rsh", ">>", 1, 2, 1, 12, JOF_BYTE|JOF_LEFTASSOC)
132
- OPDEF(JSOP_URSH, 26, "ursh", ">>>", 1, 2, 1, 12, JOF_BYTE|JOF_LEFTASSOC)
133
- OPDEF(JSOP_ADD, 27, "add", "+", 1, 2, 1, 13, JOF_BYTE|JOF_LEFTASSOC)
134
- OPDEF(JSOP_SUB, 28, "sub", "-", 1, 2, 1, 13, JOF_BYTE|JOF_LEFTASSOC)
135
- OPDEF(JSOP_MUL, 29, "mul", "*", 1, 2, 1, 14, JOF_BYTE|JOF_LEFTASSOC)
136
- OPDEF(JSOP_DIV, 30, "div", "/", 1, 2, 1, 14, JOF_BYTE|JOF_LEFTASSOC)
137
- OPDEF(JSOP_MOD, 31, "mod", "%", 1, 2, 1, 14, JOF_BYTE|JOF_LEFTASSOC)
138
- OPDEF(JSOP_NOT, 32, "not", "!", 1, 1, 1, 15, JOF_BYTE|JOF_DETECTING)
139
- OPDEF(JSOP_BITNOT, 33, "bitnot", "~", 1, 1, 1, 15, JOF_BYTE)
140
- OPDEF(JSOP_NEG, 34, "neg", "- ", 1, 1, 1, 15, JOF_BYTE)
141
- OPDEF(JSOP_NEW, 35, js_new_str, NULL, 3, -1, 1, 17, JOF_UINT16|JOF_INVOKE)
142
- OPDEF(JSOP_DELNAME, 36, "delname", NULL, 3, 0, 1, 17, JOF_ATOM|JOF_NAME|JOF_DEL)
143
- OPDEF(JSOP_DELPROP, 37, "delprop", NULL, 3, 1, 1, 17, JOF_ATOM|JOF_PROP|JOF_DEL)
144
- OPDEF(JSOP_DELELEM, 38, "delelem", NULL, 1, 2, 1, 17, JOF_BYTE |JOF_ELEM|JOF_DEL)
145
- OPDEF(JSOP_TYPEOF, 39, js_typeof_str,NULL, 1, 1, 1, 15, JOF_BYTE|JOF_DETECTING)
146
- OPDEF(JSOP_VOID, 40, js_void_str, NULL, 1, 1, 1, 15, JOF_BYTE)
147
-
148
- OPDEF(JSOP_INCNAME, 41, "incname", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_INC|JOF_TMPSLOT2)
149
- OPDEF(JSOP_INCPROP, 42, "incprop", NULL, 3, 1, 1, 15, JOF_ATOM|JOF_PROP|JOF_INC|JOF_TMPSLOT2)
150
- OPDEF(JSOP_INCELEM, 43, "incelem", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_INC|JOF_TMPSLOT2)
151
- OPDEF(JSOP_DECNAME, 44, "decname", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_DEC|JOF_TMPSLOT2)
152
- OPDEF(JSOP_DECPROP, 45, "decprop", NULL, 3, 1, 1, 15, JOF_ATOM|JOF_PROP|JOF_DEC|JOF_TMPSLOT2)
153
- OPDEF(JSOP_DECELEM, 46, "decelem", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_DEC|JOF_TMPSLOT2)
154
- OPDEF(JSOP_NAMEINC, 47, "nameinc", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_INC|JOF_POST|JOF_TMPSLOT2)
155
- OPDEF(JSOP_PROPINC, 48, "propinc", NULL, 3, 1, 1, 15, JOF_ATOM|JOF_PROP|JOF_INC|JOF_POST|JOF_TMPSLOT2)
156
- OPDEF(JSOP_ELEMINC, 49, "eleminc", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_INC|JOF_POST|JOF_TMPSLOT2)
157
- OPDEF(JSOP_NAMEDEC, 50, "namedec", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_DEC|JOF_POST|JOF_TMPSLOT2)
158
- OPDEF(JSOP_PROPDEC, 51, "propdec", NULL, 3, 1, 1, 15, JOF_ATOM|JOF_PROP|JOF_DEC|JOF_POST|JOF_TMPSLOT2)
159
- OPDEF(JSOP_ELEMDEC, 52, "elemdec", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_DEC|JOF_POST|JOF_TMPSLOT2)
160
-
161
- OPDEF(JSOP_GETPROP, 53, "getprop", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP)
162
- OPDEF(JSOP_SETPROP, 54, "setprop", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
163
- OPDEF(JSOP_GETELEM, 55, "getelem", NULL, 1, 2, 1, 18, JOF_BYTE |JOF_ELEM|JOF_LEFTASSOC)
164
- OPDEF(JSOP_SETELEM, 56, "setelem", NULL, 1, 3, 1, 3, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_DETECTING)
165
- OPDEF(JSOP_CALLNAME, 57, "callname", NULL, 3, 0, 2, 19, JOF_ATOM|JOF_NAME|JOF_CALLOP)
166
- OPDEF(JSOP_CALL, 58, "call", NULL, 3, -1, 1, 18, JOF_UINT16|JOF_INVOKE)
167
- OPDEF(JSOP_NAME, 59, "name", NULL, 3, 0, 1, 19, JOF_ATOM|JOF_NAME)
168
- OPDEF(JSOP_DOUBLE, 60, "double", NULL, 3, 0, 1, 16, JOF_ATOM)
169
- OPDEF(JSOP_STRING, 61, "string", NULL, 3, 0, 1, 19, JOF_ATOM)
170
- OPDEF(JSOP_ZERO, 62, "zero", "0", 1, 0, 1, 16, JOF_BYTE)
171
- OPDEF(JSOP_ONE, 63, "one", "1", 1, 0, 1, 16, JOF_BYTE)
172
- OPDEF(JSOP_NULL, 64, js_null_str, js_null_str, 1, 0, 1, 19, JOF_BYTE)
173
- OPDEF(JSOP_THIS, 65, js_this_str, js_this_str, 1, 0, 1, 19, JOF_BYTE)
174
- OPDEF(JSOP_FALSE, 66, js_false_str, js_false_str, 1, 0, 1, 19, JOF_BYTE)
175
- OPDEF(JSOP_TRUE, 67, js_true_str, js_true_str, 1, 0, 1, 19, JOF_BYTE)
176
- OPDEF(JSOP_OR, 68, "or", NULL, 3, 1, 0, 5, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC)
177
- OPDEF(JSOP_AND, 69, "and", NULL, 3, 1, 0, 6, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC)
178
-
179
- /* The switch bytecodes have variable length. */
180
- OPDEF(JSOP_TABLESWITCH, 70, "tableswitch", NULL, -1, 1, 0, 0, JOF_TABLESWITCH|JOF_DETECTING|JOF_PARENHEAD)
181
- OPDEF(JSOP_LOOKUPSWITCH, 71, "lookupswitch", NULL, -1, 1, 0, 0, JOF_LOOKUPSWITCH|JOF_DETECTING|JOF_PARENHEAD)
182
-
183
- /* New, infallible/transitive identity ops. */
184
- OPDEF(JSOP_STRICTEQ, 72, "stricteq", NULL, 1, 2, 1, 10, JOF_BYTE|JOF_DETECTING)
185
- OPDEF(JSOP_STRICTNE, 73, "strictne", NULL, 1, 2, 1, 10, JOF_BYTE|JOF_DETECTING)
186
-
187
- /* Lexical closure constructor. */
188
- OPDEF(JSOP_CLOSURE, 74, "closure", NULL, 3, 0, 0, 0, JOF_OBJECT)
189
-
190
- /* Export and import ops. */
191
- OPDEF(JSOP_EXPORTALL, 75, "exportall", NULL, 1, 0, 0, 0, JOF_BYTE)
192
- OPDEF(JSOP_EXPORTNAME,76, "exportname", NULL, 3, 0, 0, 0, JOF_ATOM|JOF_NAME)
193
- OPDEF(JSOP_IMPORTALL, 77, "importall", NULL, 1, 1, 0, 0, JOF_BYTE)
194
- OPDEF(JSOP_IMPORTPROP,78, "importprop", NULL, 3, 1, 0, 0, JOF_ATOM|JOF_PROP|JOF_IMPORT)
195
- OPDEF(JSOP_IMPORTELEM,79, "importelem", NULL, 1, 2, 0, 0, JOF_BYTE |JOF_ELEM|JOF_IMPORT)
196
-
197
- /* Push object literal. */
198
- OPDEF(JSOP_OBJECT, 80, "object", NULL, 3, 0, 1, 19, JOF_OBJECT)
199
-
200
- /* Pop value and discard it. */
201
- OPDEF(JSOP_POP, 81, "pop", NULL, 1, 1, 0, 2, JOF_BYTE)
202
-
203
- /* Convert value to number, for unary +. */
204
- OPDEF(JSOP_POS, 82, "pos", "+ ", 1, 1, 1, 15, JOF_BYTE)
205
-
206
- /* Trap into debugger for breakpoint, etc. */
207
- OPDEF(JSOP_TRAP, 83, "trap", NULL, 1, 0, 0, 0, JOF_BYTE)
208
-
209
- /* Fast get/set ops for function arguments and local variables. */
210
- OPDEF(JSOP_GETARG, 84, "getarg", NULL, 3, 0, 1, 19, JOF_QARG |JOF_NAME)
211
- OPDEF(JSOP_SETARG, 85, "setarg", NULL, 3, 1, 1, 3, JOF_QARG |JOF_NAME|JOF_SET)
212
- OPDEF(JSOP_GETVAR, 86, "getvar", NULL, 3, 0, 1, 19, JOF_QVAR |JOF_NAME)
213
- OPDEF(JSOP_SETVAR, 87, "setvar", NULL, 3, 1, 1, 3, JOF_QVAR |JOF_NAME|JOF_SET|JOF_DETECTING)
214
-
215
- /* Push unsigned 16-bit int constant. */
216
- OPDEF(JSOP_UINT16, 88, "uint16", NULL, 3, 0, 1, 16, JOF_UINT16)
217
-
218
- /* Object and array literal support. */
219
- OPDEF(JSOP_NEWINIT, 89, "newinit", NULL, 2, 0, 1, 19, JOF_INT8)
220
- OPDEF(JSOP_ENDINIT, 90, "endinit", NULL, 1, 0, 0, 19, JOF_BYTE)
221
- OPDEF(JSOP_INITPROP, 91, "initprop", NULL, 3, 1, 0, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
222
- OPDEF(JSOP_INITELEM, 92, "initelem", NULL, 1, 2, 0, 3, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_DETECTING)
223
- OPDEF(JSOP_DEFSHARP, 93, "defsharp", NULL, 3, 0, 0, 0, JOF_UINT16)
224
- OPDEF(JSOP_USESHARP, 94, "usesharp", NULL, 3, 0, 1, 0, JOF_UINT16)
225
-
226
- /* Fast inc/dec ops for args and local vars. */
227
- OPDEF(JSOP_INCARG, 95, "incarg", NULL, 3, 0, 1, 15, JOF_QARG |JOF_NAME|JOF_INC)
228
- OPDEF(JSOP_INCVAR, 96, "incvar", NULL, 3, 0, 1, 15, JOF_QVAR |JOF_NAME|JOF_INC)
229
- OPDEF(JSOP_DECARG, 97, "decarg", NULL, 3, 0, 1, 15, JOF_QARG |JOF_NAME|JOF_DEC)
230
- OPDEF(JSOP_DECVAR, 98, "decvar", NULL, 3, 0, 1, 15, JOF_QVAR |JOF_NAME|JOF_DEC)
231
- OPDEF(JSOP_ARGINC, 99, "arginc", NULL, 3, 0, 1, 15, JOF_QARG |JOF_NAME|JOF_INC|JOF_POST)
232
- OPDEF(JSOP_VARINC, 100,"varinc", NULL, 3, 0, 1, 15, JOF_QVAR |JOF_NAME|JOF_INC|JOF_POST)
233
- OPDEF(JSOP_ARGDEC, 101,"argdec", NULL, 3, 0, 1, 15, JOF_QARG |JOF_NAME|JOF_DEC|JOF_POST)
234
- OPDEF(JSOP_VARDEC, 102,"vardec", NULL, 3, 0, 1, 15, JOF_QVAR |JOF_NAME|JOF_DEC|JOF_POST)
235
-
236
- /*
237
- * Initialize for-in iterator. See also JSOP_FOREACH and JSOP_FOREACHKEYVAL.
238
- */
239
- OPDEF(JSOP_FORIN, 103,"forin", NULL, 1, 1, 1, 0, JOF_BYTE)
240
-
241
- /* ECMA-compliant for/in ops. */
242
- OPDEF(JSOP_FORNAME, 104,"forname", NULL, 3, 0, 1, 19, JOF_ATOM|JOF_NAME|JOF_FOR)
243
- OPDEF(JSOP_FORPROP, 105,"forprop", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_FOR)
244
- OPDEF(JSOP_FORELEM, 106,"forelem", NULL, 1, 1, 3, 18, JOF_BYTE |JOF_ELEM|JOF_FOR)
245
- OPDEF(JSOP_POPN, 107,"popn", NULL, 3, -1, 0, 0, JOF_UINT16)
246
-
247
- /* ECMA-compliant assignment ops. */
248
- OPDEF(JSOP_BINDNAME, 108,"bindname", NULL, 3, 0, 1, 0, JOF_ATOM|JOF_NAME|JOF_SET)
249
- OPDEF(JSOP_SETNAME, 109,"setname", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING)
250
-
251
- /* Exception handling ops. */
252
- OPDEF(JSOP_THROW, 110,js_throw_str, NULL, 1, 1, 0, 0, JOF_BYTE)
253
-
254
- /* 'in' and 'instanceof' ops. */
255
- OPDEF(JSOP_IN, 111,js_in_str, js_in_str, 1, 2, 1, 11, JOF_BYTE|JOF_LEFTASSOC)
256
- OPDEF(JSOP_INSTANCEOF,112,js_instanceof_str,js_instanceof_str,1,2,1,11,JOF_BYTE|JOF_LEFTASSOC)
257
-
258
- /* debugger op */
259
- OPDEF(JSOP_DEBUGGER, 113,"debugger", NULL, 1, 0, 0, 0, JOF_BYTE)
260
-
261
- /* gosub/retsub for finally handling */
262
- OPDEF(JSOP_GOSUB, 114,"gosub", NULL, 3, 0, 0, 0, JOF_JUMP)
263
- OPDEF(JSOP_RETSUB, 115,"retsub", NULL, 1, 0, 0, 0, JOF_BYTE)
264
-
265
- /* More exception handling ops. */
266
- OPDEF(JSOP_EXCEPTION, 116,"exception", NULL, 1, 0, 1, 0, JOF_BYTE)
267
-
268
- /* Embedded lineno to speedup pc->line mapping. */
269
- OPDEF(JSOP_LINENO, 117,"lineno", NULL, 3, 0, 0, 0, JOF_UINT16)
270
-
271
- /*
272
- * ECMA-compliant switch statement ops.
273
- * CONDSWITCH is a decompilable NOP; CASE is ===, POP, jump if true, re-push
274
- * lval if false; and DEFAULT is POP lval and GOTO.
275
- */
276
- OPDEF(JSOP_CONDSWITCH,118,"condswitch", NULL, 1, 0, 0, 0, JOF_BYTE|JOF_PARENHEAD)
277
- OPDEF(JSOP_CASE, 119,"case", NULL, 3, 2, 1, 0, JOF_JUMP)
278
- OPDEF(JSOP_DEFAULT, 120,"default", NULL, 3, 1, 0, 0, JOF_JUMP)
279
-
280
- /*
281
- * ECMA-compliant call to eval op
282
- */
283
- OPDEF(JSOP_EVAL, 121,"eval", NULL, 3, -1, 1, 18, JOF_UINT16|JOF_INVOKE)
284
-
285
- /*
286
- * ECMA-compliant helper for 'for (x[i] in o)' loops.
287
- */
288
- OPDEF(JSOP_ENUMELEM, 122,"enumelem", NULL, 1, 3, 0, 3, JOF_BYTE |JOF_SET)
289
-
290
- /*
291
- * Getter and setter prefix bytecodes. These modify the next bytecode, either
292
- * an assignment or a property initializer code, which then defines a property
293
- * getter or setter.
294
- */
295
- OPDEF(JSOP_GETTER, 123,js_getter_str,NULL, 1, 0, 0, 0, JOF_BYTE)
296
- OPDEF(JSOP_SETTER, 124,js_setter_str,NULL, 1, 0, 0, 0, JOF_BYTE)
297
-
298
- /*
299
- * Prolog bytecodes for defining function, var, and const names.
300
- */
301
- OPDEF(JSOP_DEFFUN, 125,"deffun", NULL, 3, 0, 0, 0, JOF_OBJECT|JOF_DECLARING)
302
- OPDEF(JSOP_DEFCONST, 126,"defconst", NULL, 3, 0, 0, 0, JOF_ATOM|JOF_DECLARING)
303
- OPDEF(JSOP_DEFVAR, 127,"defvar", NULL, 3, 0, 0, 0, JOF_ATOM|JOF_DECLARING)
304
-
305
- /* Auto-clone (if needed due to re-parenting) and push an anonymous function. */
306
- OPDEF(JSOP_ANONFUNOBJ, 128, "anonfunobj", NULL, 3, 0, 1, 19, JOF_OBJECT)
307
-
308
- /* ECMA ed. 3 named function expression. */
309
- OPDEF(JSOP_NAMEDFUNOBJ, 129, "namedfunobj", NULL, 3, 0, 1, 19, JOF_OBJECT)
310
-
311
- /*
312
- * Like JSOP_SETLOCAL, but specialized to avoid requiring JSOP_POP immediately
313
- * after to throw away the exception value.
314
- */
315
- OPDEF(JSOP_SETLOCALPOP, 130, "setlocalpop", NULL, 3, 1, 0, 3, JOF_LOCAL|JOF_NAME|JOF_SET)
316
-
317
- /* Parenthesization opcode to help the decompiler. */
318
- OPDEF(JSOP_GROUP, 131, "group", NULL, 1, 0, 0, 19, JOF_BYTE)
319
-
320
- /*
321
- * Host object extension: given 'o.item(i) = j', the left-hand side compiles
322
- * JSOP_SETCALL, rather than JSOP_CALL.
323
- */
324
- OPDEF(JSOP_SETCALL, 132, "setcall", NULL, 3, -1, 2, 18, JOF_UINT16|JOF_SET)
325
-
326
- /*
327
- * Exception handling no-ops, for more economical byte-coding than SRC_TRYFIN
328
- * srcnote-annotated JSOP_NOPs.
329
- */
330
- OPDEF(JSOP_TRY, 133,"try", NULL, 1, 0, 0, 0, JOF_BYTE)
331
- OPDEF(JSOP_FINALLY, 134,"finally", NULL, 1, 0, 0, 0, JOF_BYTE)
332
-
333
- /*
334
- * Swap the top two stack elements.
335
- */
336
- OPDEF(JSOP_SWAP, 135,"swap", NULL, 1, 2, 2, 0, JOF_BYTE)
337
-
338
- /*
339
- * Bytecodes that avoid making an arguments object in most cases:
340
- * JSOP_ARGSUB gets arguments[i] from fp->argv, iff i is in [0, fp->argc-1].
341
- * JSOP_ARGCNT returns fp->argc.
342
- */
343
- OPDEF(JSOP_ARGSUB, 136,"argsub", NULL, 3, 0, 1, 18, JOF_QARG |JOF_NAME)
344
- OPDEF(JSOP_ARGCNT, 137,"argcnt", NULL, 1, 0, 1, 18, JOF_BYTE)
345
-
346
- /*
347
- * Define a local function object as a local variable.
348
- * The local variable's slot number is the first immediate two-byte operand.
349
- * The function object's atom index is the second immediate operand.
350
- */
351
- OPDEF(JSOP_DEFLOCALFUN, 138,"deflocalfun",NULL, 5, 0, 0, 0, JOF_SLOTOBJECT|JOF_DECLARING)
352
-
353
- /* Extended jumps. */
354
- OPDEF(JSOP_GOTOX, 139,"gotox", NULL, 5, 0, 0, 0, JOF_JUMPX)
355
- OPDEF(JSOP_IFEQX, 140,"ifeqx", NULL, 5, 1, 0, 4, JOF_JUMPX|JOF_DETECTING)
356
- OPDEF(JSOP_IFNEX, 141,"ifnex", NULL, 5, 1, 0, 0, JOF_JUMPX|JOF_PARENHEAD)
357
- OPDEF(JSOP_ORX, 142,"orx", NULL, 5, 1, 0, 5, JOF_JUMPX|JOF_DETECTING)
358
- OPDEF(JSOP_ANDX, 143,"andx", NULL, 5, 1, 0, 6, JOF_JUMPX|JOF_DETECTING)
359
- OPDEF(JSOP_GOSUBX, 144,"gosubx", NULL, 5, 0, 0, 0, JOF_JUMPX)
360
- OPDEF(JSOP_CASEX, 145,"casex", NULL, 5, 2, 1, 0, JOF_JUMPX)
361
- OPDEF(JSOP_DEFAULTX, 146,"defaultx", NULL, 5, 1, 0, 0, JOF_JUMPX)
362
- OPDEF(JSOP_TABLESWITCHX, 147,"tableswitchx",NULL, -1, 1, 0, 0, JOF_TABLESWITCHX|JOF_DETECTING|JOF_PARENHEAD)
363
- OPDEF(JSOP_LOOKUPSWITCHX, 148,"lookupswitchx",NULL, -1, 1, 0, 0, JOF_LOOKUPSWITCHX|JOF_DETECTING|JOF_PARENHEAD)
364
-
365
- /* Placeholders for a real jump opcode set during backpatch chain fixup. */
366
- OPDEF(JSOP_BACKPATCH, 149,"backpatch",NULL, 3, 0, 0, 0, JOF_JUMP|JOF_BACKPATCH)
367
- OPDEF(JSOP_BACKPATCH_POP, 150,"backpatch_pop",NULL, 3, 1, 0, 0, JOF_JUMP|JOF_BACKPATCH)
368
-
369
- /* Set pending exception from the stack, to trigger rethrow. */
370
- OPDEF(JSOP_THROWING, 151,"throwing", NULL, 1, 1, 0, 0, JOF_BYTE)
371
-
372
- /* Set and get return value pseudo-register in stack frame. */
373
- OPDEF(JSOP_SETRVAL, 152,"setrval", NULL, 1, 1, 0, 2, JOF_BYTE)
374
- OPDEF(JSOP_RETRVAL, 153,"retrval", NULL, 1, 0, 0, 0, JOF_BYTE)
375
-
376
- /* Optimized global variable ops (we don't bother doing a JSOP_FORGVAR op). */
377
- OPDEF(JSOP_GETGVAR, 154,"getgvar", NULL, 3, 0, 1, 19, JOF_ATOM|JOF_NAME)
378
- OPDEF(JSOP_SETGVAR, 155,"setgvar", NULL, 3, 1, 1, 3, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING)
379
- OPDEF(JSOP_INCGVAR, 156,"incgvar", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_INC|JOF_TMPSLOT2)
380
- OPDEF(JSOP_DECGVAR, 157,"decgvar", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_DEC|JOF_TMPSLOT2)
381
- OPDEF(JSOP_GVARINC, 158,"gvarinc", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_INC|JOF_POST|JOF_TMPSLOT2)
382
- OPDEF(JSOP_GVARDEC, 159,"gvardec", NULL, 3, 0, 1, 15, JOF_ATOM|JOF_NAME|JOF_DEC|JOF_POST|JOF_TMPSLOT2)
383
-
384
- /* Regular expression literal requiring special "fork on exec" handling. */
385
- OPDEF(JSOP_REGEXP, 160,"regexp", NULL, 3, 0, 1, 19, JOF_REGEXP)
386
-
387
- /* XML (ECMA-357, a.k.a. "E4X") support. */
388
- OPDEF(JSOP_DEFXMLNS, 161,"defxmlns", NULL, 1, 1, 0, 0, JOF_BYTE)
389
- OPDEF(JSOP_ANYNAME, 162,"anyname", NULL, 1, 0, 1, 19, JOF_BYTE|JOF_XMLNAME)
390
- OPDEF(JSOP_QNAMEPART, 163,"qnamepart", NULL, 3, 0, 1, 19, JOF_ATOM|JOF_XMLNAME)
391
- OPDEF(JSOP_QNAMECONST, 164,"qnameconst", NULL, 3, 1, 1, 19, JOF_ATOM|JOF_XMLNAME)
392
- OPDEF(JSOP_QNAME, 165,"qname", NULL, 1, 2, 1, 0, JOF_BYTE|JOF_XMLNAME)
393
- OPDEF(JSOP_TOATTRNAME, 166,"toattrname", NULL, 1, 1, 1, 19, JOF_BYTE|JOF_XMLNAME)
394
- OPDEF(JSOP_TOATTRVAL, 167,"toattrval", NULL, 1, 1, 1, 19, JOF_BYTE)
395
- OPDEF(JSOP_ADDATTRNAME, 168,"addattrname",NULL, 1, 2, 1, 13, JOF_BYTE)
396
- OPDEF(JSOP_ADDATTRVAL, 169,"addattrval", NULL, 1, 2, 1, 13, JOF_BYTE)
397
- OPDEF(JSOP_BINDXMLNAME, 170,"bindxmlname",NULL, 1, 1, 2, 3, JOF_BYTE|JOF_SET)
398
- OPDEF(JSOP_SETXMLNAME, 171,"setxmlname", NULL, 1, 3, 1, 3, JOF_BYTE|JOF_SET|JOF_DETECTING)
399
- OPDEF(JSOP_XMLNAME, 172,"xmlname", NULL, 1, 1, 1, 19, JOF_BYTE)
400
- OPDEF(JSOP_DESCENDANTS, 173,"descendants",NULL, 1, 2, 1, 18, JOF_BYTE)
401
- OPDEF(JSOP_FILTER, 174,"filter", NULL, 3, 1, 1, 0, JOF_JUMP)
402
- OPDEF(JSOP_ENDFILTER, 175,"endfilter", NULL, 3, 2, 1, 18, JOF_JUMP)
403
- OPDEF(JSOP_TOXML, 176,"toxml", NULL, 1, 1, 1, 19, JOF_BYTE)
404
- OPDEF(JSOP_TOXMLLIST, 177,"toxmllist", NULL, 1, 1, 1, 19, JOF_BYTE)
405
- OPDEF(JSOP_XMLTAGEXPR, 178,"xmltagexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
406
- OPDEF(JSOP_XMLELTEXPR, 179,"xmleltexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
407
- OPDEF(JSOP_XMLOBJECT, 180,"xmlobject", NULL, 3, 0, 1, 19, JOF_OBJECT)
408
- OPDEF(JSOP_XMLCDATA, 181,"xmlcdata", NULL, 3, 0, 1, 19, JOF_ATOM)
409
- OPDEF(JSOP_XMLCOMMENT, 182,"xmlcomment", NULL, 3, 0, 1, 19, JOF_ATOM)
410
- OPDEF(JSOP_XMLPI, 183,"xmlpi", NULL, 3, 1, 1, 19, JOF_ATOM)
411
- OPDEF(JSOP_CALLPROP, 184,"callprop", NULL, 3, 1, 2, 18, JOF_ATOM|JOF_PROP|JOF_CALLOP)
412
- OPDEF(JSOP_GETFUNNS, 185,"getfunns", NULL, 1, 0, 1, 19, JOF_BYTE)
413
- OPDEF(JSOP_FOREACH, 186,"foreach", NULL, 1, 1, 1, 0, JOF_BYTE)
414
- OPDEF(JSOP_DELDESC, 187,"deldesc", NULL, 1, 2, 1, 17, JOF_BYTE |JOF_ELEM|JOF_DEL)
415
-
416
- /*
417
- * Opcode to hold 24-bit immediate integer operands.
418
- */
419
- OPDEF(JSOP_UINT24, 188,"uint24", NULL, 4, 0, 1, 16, JOF_UINT24)
420
-
421
- /*
422
- * Opcodes to allow 24-bit atom or object indexes. Whenever an index exceeds
423
- * the 16-bit limit, the index-accessing bytecode must be bracketed by
424
- * JSOP_INDEXBASE and JSOP_RESETBASE to provide the upper bits of the index.
425
- * See jsemit.c, EmitIndexOp.
426
- */
427
- OPDEF(JSOP_INDEXBASE, 189,"atombase", NULL, 2, 0, 0, 0, JOF_2BYTE|JOF_INDEXBASE)
428
- OPDEF(JSOP_RESETBASE, 190,"resetbase", NULL, 1, 0, 0, 0, JOF_BYTE)
429
- OPDEF(JSOP_RESETBASE0, 191,"resetbase0", NULL, 1, 0, 0, 0, JOF_BYTE)
430
-
431
- /*
432
- * Opcodes to help the decompiler deal with XML.
433
- */
434
- OPDEF(JSOP_STARTXML, 192,"startxml", NULL, 1, 0, 0, 0, JOF_BYTE)
435
- OPDEF(JSOP_STARTXMLEXPR, 193,"startxmlexpr",NULL, 1, 0, 0, 0, JOF_BYTE)
436
-
437
- OPDEF(JSOP_CALLELEM, 194, "callelem", NULL, 1, 2, 2, 18, JOF_BYTE |JOF_ELEM|JOF_LEFTASSOC|JOF_CALLOP)
438
-
439
- /*
440
- * Stop interpretation, emitted at end of script to save the threaded bytecode
441
- * interpreter an extra branch test on every DO_NEXT_OP (see jsinterp.c).
442
- */
443
- OPDEF(JSOP_STOP, 195,"stop", NULL, 1, 0, 0, 0, JOF_BYTE)
444
-
445
- /*
446
- * Get an extant property value, throwing ReferenceError if the identified
447
- * property does not exist.
448
- */
449
- OPDEF(JSOP_GETXPROP, 196,"getxprop", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP)
450
-
451
- OPDEF(JSOP_CALLXMLNAME, 197, "callxmlname", NULL, 1, 1, 2, 19, JOF_BYTE|JOF_CALLOP)
452
-
453
- /*
454
- * Specialized JSOP_TYPEOF to avoid reporting undefined for typeof(0, undef).
455
- */
456
- OPDEF(JSOP_TYPEOFEXPR, 198,"typeofexpr", NULL, 1, 1, 1, 15, JOF_BYTE|JOF_DETECTING)
457
-
458
- /*
459
- * Block-local scope support.
460
- */
461
- OPDEF(JSOP_ENTERBLOCK, 199,"enterblock", NULL, 3, 0, 0, 0, JOF_OBJECT)
462
- OPDEF(JSOP_LEAVEBLOCK, 200,"leaveblock", NULL, 3, 0, 0, 0, JOF_UINT16)
463
- OPDEF(JSOP_GETLOCAL, 201,"getlocal", NULL, 3, 0, 1, 19, JOF_LOCAL|JOF_NAME)
464
- OPDEF(JSOP_SETLOCAL, 202,"setlocal", NULL, 3, 1, 1, 3, JOF_LOCAL|JOF_NAME|JOF_SET)
465
- OPDEF(JSOP_INCLOCAL, 203,"inclocal", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_INC)
466
- OPDEF(JSOP_DECLOCAL, 204,"declocal", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_DEC)
467
- OPDEF(JSOP_LOCALINC, 205,"localinc", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_INC|JOF_POST)
468
- OPDEF(JSOP_LOCALDEC, 206,"localdec", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_DEC|JOF_POST)
469
- OPDEF(JSOP_FORLOCAL, 207,"forlocal", NULL, 3, 0, 1, 19, JOF_LOCAL|JOF_NAME|JOF_FOR)
470
-
471
- /*
472
- * Iterator, generator, and array comprehension support.
473
- */
474
- OPDEF(JSOP_FORCONST, 208,"forconst", NULL, 3, 0, 1, 19, JOF_QVAR|JOF_NAME|JOF_FOR)
475
- OPDEF(JSOP_ENDITER, 209,"enditer", NULL, 1, 1, 0, 0, JOF_BYTE|JOF_TMPSLOT)
476
- OPDEF(JSOP_GENERATOR, 210,"generator", NULL, 1, 0, 0, 0, JOF_BYTE)
477
- OPDEF(JSOP_YIELD, 211,"yield", NULL, 1, 1, 1, 1, JOF_BYTE)
478
- OPDEF(JSOP_ARRAYPUSH, 212,"arraypush", NULL, 3, 1, 0, 3, JOF_LOCAL)
479
-
480
- OPDEF(JSOP_FOREACHKEYVAL, 213,"foreachkeyval",NULL, 1, 1, 1, 0, JOF_BYTE)
481
-
482
- /*
483
- * Variant of JSOP_ENUMELEM for destructuring const (const [a, b] = ...).
484
- */
485
- OPDEF(JSOP_ENUMCONSTELEM, 214,"enumconstelem",NULL, 1, 3, 0, 3, JOF_BYTE|JOF_SET)
486
-
487
- /*
488
- * Variant of JSOP_LEAVEBLOCK has a result on the stack above the locals,
489
- * which must be moved down when the block pops.
490
- */
491
- OPDEF(JSOP_LEAVEBLOCKEXPR,215,"leaveblockexpr",NULL, 3, 0, 0, 1, JOF_UINT16)
492
-
493
- /*
494
- * Optimize common JSOP_{THIS,GET{ARG,VAR,LOCAL}} -> JSOP_GETPROP cliches.
495
- */
496
- OPDEF(JSOP_GETTHISPROP, 216,"getthisprop", NULL, 3, 0, 1, 18, JOF_ATOM|JOF_VARPROP)
497
- OPDEF(JSOP_GETARGPROP, 217,"getargprop", NULL, 5, 0, 1, 18, JOF_SLOTATOM|JOF_VARPROP)
498
- OPDEF(JSOP_GETVARPROP, 218,"getvarprop", NULL, 5, 0, 1, 18, JOF_SLOTATOM|JOF_VARPROP)
499
- OPDEF(JSOP_GETLOCALPROP, 219,"getlocalprop", NULL, 5, 0, 1, 18, JOF_SLOTATOM|JOF_VARPROP)
500
-
501
- /*
502
- * Optimize atom segments 1-3. These must be followed by JSOP_RESETBASE0 after
503
- * the opcode that they prefix.
504
- */
505
- OPDEF(JSOP_INDEXBASE1, 220,"atombase1", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
506
- OPDEF(JSOP_INDEXBASE2, 221,"atombase2", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
507
- OPDEF(JSOP_INDEXBASE3, 222,"atombase3", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
508
-
509
- OPDEF(JSOP_CALLGVAR, 223, "callgvar", NULL, 3, 0, 2, 19, JOF_ATOM|JOF_NAME|JOF_CALLOP)
510
- OPDEF(JSOP_CALLVAR, 224, "callvar", NULL, 3, 0, 2, 19, JOF_QVAR |JOF_NAME|JOF_CALLOP)
511
- OPDEF(JSOP_CALLARG, 225, "callarg", NULL, 3, 0, 2, 19, JOF_QARG |JOF_NAME|JOF_CALLOP)
512
- OPDEF(JSOP_CALLLOCAL, 226, "calllocal", NULL, 3, 0, 2, 19, JOF_LOCAL|JOF_NAME|JOF_CALLOP)
513
-
514
- /*
515
- * Opcodes to hold 8-bit and 32-bit immediate integer operands.
516
- */
517
- OPDEF(JSOP_INT8, 227, "int8", NULL, 2, 0, 1, 16, JOF_INT8)
518
- OPDEF(JSOP_INT32, 228, "int32", NULL, 5, 0, 1, 16, JOF_INT32)
519
-
520
- /*
521
- * Get the value of the 'length' property from a stacked object.
522
- */
523
- OPDEF(JSOP_LENGTH, 229, "length", NULL, 1, 1, 1, 18, JOF_BYTE|JOF_PROP)