jbarnette-johnson 1.0.0.200806240111 → 1.0.0.200807291507

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. data/MANIFEST +1 -0
  2. data/Rakefile +3 -10
  3. data/bin/johnson +2 -1
  4. data/ext/spidermonkey/context.c +3 -4
  5. data/ext/spidermonkey/context.h +1 -1
  6. data/ext/spidermonkey/conversions.c +39 -33
  7. data/ext/spidermonkey/debugger.c +5 -5
  8. data/ext/spidermonkey/immutable_node.c.erb +11 -11
  9. data/ext/spidermonkey/jroot.h +4 -4
  10. data/ext/spidermonkey/js_land_proxy.c +9 -8
  11. data/ext/spidermonkey/ruby_land_proxy.c +5 -4
  12. data/ext/spidermonkey/runtime.c +1 -1
  13. data/johnson.gemspec +36 -0
  14. data/lib/hoe.rb +0 -7
  15. data/lib/johnson/cli/options.rb +10 -4
  16. data/lib/johnson/spidermonkey/runtime.rb +2 -2
  17. data/lib/johnson/version.rb +4 -2
  18. data/lib/johnson.rb +1 -0
  19. data/test/johnson/runtime_test.rb +11 -0
  20. data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +6 -0
  21. data/vendor/spidermonkey/.cvsignore +9 -0
  22. data/vendor/spidermonkey/Makefile.in +462 -0
  23. data/vendor/spidermonkey/Makefile.ref +364 -0
  24. data/vendor/spidermonkey/README.html +820 -0
  25. data/vendor/spidermonkey/SpiderMonkey.rsp +12 -0
  26. data/vendor/spidermonkey/Y.js +19 -0
  27. data/vendor/spidermonkey/build.mk +43 -0
  28. data/vendor/spidermonkey/config/AIX4.1.mk +65 -0
  29. data/vendor/spidermonkey/config/AIX4.2.mk +64 -0
  30. data/vendor/spidermonkey/config/AIX4.3.mk +65 -0
  31. data/vendor/spidermonkey/config/Darwin.mk +83 -0
  32. data/vendor/spidermonkey/config/Darwin1.3.mk +81 -0
  33. data/vendor/spidermonkey/config/Darwin1.4.mk +41 -0
  34. data/vendor/spidermonkey/config/Darwin5.2.mk +81 -0
  35. data/vendor/spidermonkey/config/Darwin5.3.mk +81 -0
  36. data/vendor/spidermonkey/config/HP-UXB.10.10.mk +77 -0
  37. data/vendor/spidermonkey/config/HP-UXB.10.20.mk +77 -0
  38. data/vendor/spidermonkey/config/HP-UXB.11.00.mk +80 -0
  39. data/vendor/spidermonkey/config/IRIX.mk +87 -0
  40. data/vendor/spidermonkey/config/IRIX5.3.mk +44 -0
  41. data/vendor/spidermonkey/config/IRIX6.1.mk +44 -0
  42. data/vendor/spidermonkey/config/IRIX6.2.mk +44 -0
  43. data/vendor/spidermonkey/config/IRIX6.3.mk +44 -0
  44. data/vendor/spidermonkey/config/IRIX6.5.mk +44 -0
  45. data/vendor/spidermonkey/config/Linux_All.mk +103 -0
  46. data/vendor/spidermonkey/config/Mac_OS10.0.mk +82 -0
  47. data/vendor/spidermonkey/config/OSF1V4.0.mk +72 -0
  48. data/vendor/spidermonkey/config/OSF1V5.0.mk +69 -0
  49. data/vendor/spidermonkey/config/SunOS4.1.4.mk +101 -0
  50. data/vendor/spidermonkey/config/SunOS5.10.mk +50 -0
  51. data/vendor/spidermonkey/config/SunOS5.3.mk +91 -0
  52. data/vendor/spidermonkey/config/SunOS5.4.mk +92 -0
  53. data/vendor/spidermonkey/config/SunOS5.5.1.mk +44 -0
  54. data/vendor/spidermonkey/config/SunOS5.5.mk +87 -0
  55. data/vendor/spidermonkey/config/SunOS5.6.mk +89 -0
  56. data/vendor/spidermonkey/config/SunOS5.7.mk +44 -0
  57. data/vendor/spidermonkey/config/SunOS5.8.mk +44 -0
  58. data/vendor/spidermonkey/config/SunOS5.9.mk +44 -0
  59. data/vendor/spidermonkey/config/WINNT4.0.mk +117 -0
  60. data/vendor/spidermonkey/config/WINNT5.0.mk +117 -0
  61. data/vendor/spidermonkey/config/WINNT5.1.mk +117 -0
  62. data/vendor/spidermonkey/config/WINNT5.2.mk +117 -0
  63. data/vendor/spidermonkey/config/WINNT6.0.mk +117 -0
  64. data/vendor/spidermonkey/config/dgux.mk +64 -0
  65. data/vendor/spidermonkey/config.mk +192 -0
  66. data/vendor/spidermonkey/editline/Makefile.ref +144 -0
  67. data/vendor/spidermonkey/editline/README +83 -0
  68. data/vendor/spidermonkey/editline/editline.3 +175 -0
  69. data/vendor/spidermonkey/editline/editline.c +1369 -0
  70. data/vendor/spidermonkey/editline/editline.h +135 -0
  71. data/vendor/spidermonkey/editline/sysunix.c +182 -0
  72. data/vendor/spidermonkey/editline/unix.h +82 -0
  73. data/vendor/spidermonkey/fdlibm/.cvsignore +7 -0
  74. data/vendor/spidermonkey/fdlibm/Makefile.in +127 -0
  75. data/vendor/spidermonkey/fdlibm/Makefile.ref +192 -0
  76. data/vendor/spidermonkey/fdlibm/e_acos.c +147 -0
  77. data/vendor/spidermonkey/fdlibm/e_acosh.c +105 -0
  78. data/vendor/spidermonkey/fdlibm/e_asin.c +156 -0
  79. data/vendor/spidermonkey/fdlibm/e_atan2.c +165 -0
  80. data/vendor/spidermonkey/fdlibm/e_atanh.c +110 -0
  81. data/vendor/spidermonkey/fdlibm/e_cosh.c +133 -0
  82. data/vendor/spidermonkey/fdlibm/e_exp.c +202 -0
  83. data/vendor/spidermonkey/fdlibm/e_fmod.c +184 -0
  84. data/vendor/spidermonkey/fdlibm/e_gamma.c +71 -0
  85. data/vendor/spidermonkey/fdlibm/e_gamma_r.c +70 -0
  86. data/vendor/spidermonkey/fdlibm/e_hypot.c +173 -0
  87. data/vendor/spidermonkey/fdlibm/e_j0.c +524 -0
  88. data/vendor/spidermonkey/fdlibm/e_j1.c +523 -0
  89. data/vendor/spidermonkey/fdlibm/e_jn.c +315 -0
  90. data/vendor/spidermonkey/fdlibm/e_lgamma.c +71 -0
  91. data/vendor/spidermonkey/fdlibm/e_lgamma_r.c +347 -0
  92. data/vendor/spidermonkey/fdlibm/e_log.c +184 -0
  93. data/vendor/spidermonkey/fdlibm/e_log10.c +134 -0
  94. data/vendor/spidermonkey/fdlibm/e_pow.c +386 -0
  95. data/vendor/spidermonkey/fdlibm/e_rem_pio2.c +222 -0
  96. data/vendor/spidermonkey/fdlibm/e_remainder.c +120 -0
  97. data/vendor/spidermonkey/fdlibm/e_scalb.c +89 -0
  98. data/vendor/spidermonkey/fdlibm/e_sinh.c +122 -0
  99. data/vendor/spidermonkey/fdlibm/e_sqrt.c +497 -0
  100. data/vendor/spidermonkey/fdlibm/fdlibm.h +273 -0
  101. data/vendor/spidermonkey/fdlibm/fdlibm.mak +1453 -0
  102. data/vendor/spidermonkey/fdlibm/fdlibm.mdp +0 -0
  103. data/vendor/spidermonkey/fdlibm/k_cos.c +135 -0
  104. data/vendor/spidermonkey/fdlibm/k_rem_pio2.c +354 -0
  105. data/vendor/spidermonkey/fdlibm/k_sin.c +114 -0
  106. data/vendor/spidermonkey/fdlibm/k_standard.c +785 -0
  107. data/vendor/spidermonkey/fdlibm/k_tan.c +170 -0
  108. data/vendor/spidermonkey/fdlibm/s_asinh.c +101 -0
  109. data/vendor/spidermonkey/fdlibm/s_atan.c +175 -0
  110. data/vendor/spidermonkey/fdlibm/s_cbrt.c +133 -0
  111. data/vendor/spidermonkey/fdlibm/s_ceil.c +120 -0
  112. data/vendor/spidermonkey/fdlibm/s_copysign.c +72 -0
  113. data/vendor/spidermonkey/fdlibm/s_cos.c +118 -0
  114. data/vendor/spidermonkey/fdlibm/s_erf.c +356 -0
  115. data/vendor/spidermonkey/fdlibm/s_expm1.c +267 -0
  116. data/vendor/spidermonkey/fdlibm/s_fabs.c +70 -0
  117. data/vendor/spidermonkey/fdlibm/s_finite.c +71 -0
  118. data/vendor/spidermonkey/fdlibm/s_floor.c +121 -0
  119. data/vendor/spidermonkey/fdlibm/s_frexp.c +99 -0
  120. data/vendor/spidermonkey/fdlibm/s_ilogb.c +85 -0
  121. data/vendor/spidermonkey/fdlibm/s_isnan.c +74 -0
  122. data/vendor/spidermonkey/fdlibm/s_ldexp.c +66 -0
  123. data/vendor/spidermonkey/fdlibm/s_lib_version.c +73 -0
  124. data/vendor/spidermonkey/fdlibm/s_log1p.c +211 -0
  125. data/vendor/spidermonkey/fdlibm/s_logb.c +79 -0
  126. data/vendor/spidermonkey/fdlibm/s_matherr.c +64 -0
  127. data/vendor/spidermonkey/fdlibm/s_modf.c +132 -0
  128. data/vendor/spidermonkey/fdlibm/s_nextafter.c +124 -0
  129. data/vendor/spidermonkey/fdlibm/s_rint.c +131 -0
  130. data/vendor/spidermonkey/fdlibm/s_scalbn.c +107 -0
  131. data/vendor/spidermonkey/fdlibm/s_signgam.c +40 -0
  132. data/vendor/spidermonkey/fdlibm/s_significand.c +68 -0
  133. data/vendor/spidermonkey/fdlibm/s_sin.c +118 -0
  134. data/vendor/spidermonkey/fdlibm/s_tan.c +112 -0
  135. data/vendor/spidermonkey/fdlibm/s_tanh.c +122 -0
  136. data/vendor/spidermonkey/fdlibm/w_acos.c +78 -0
  137. data/vendor/spidermonkey/fdlibm/w_acosh.c +78 -0
  138. data/vendor/spidermonkey/fdlibm/w_asin.c +80 -0
  139. data/vendor/spidermonkey/fdlibm/w_atan2.c +79 -0
  140. data/vendor/spidermonkey/fdlibm/w_atanh.c +81 -0
  141. data/vendor/spidermonkey/fdlibm/w_cosh.c +77 -0
  142. data/vendor/spidermonkey/fdlibm/w_exp.c +88 -0
  143. data/vendor/spidermonkey/fdlibm/w_fmod.c +78 -0
  144. data/vendor/spidermonkey/fdlibm/w_gamma.c +85 -0
  145. data/vendor/spidermonkey/fdlibm/w_gamma_r.c +81 -0
  146. data/vendor/spidermonkey/fdlibm/w_hypot.c +78 -0
  147. data/vendor/spidermonkey/fdlibm/w_j0.c +105 -0
  148. data/vendor/spidermonkey/fdlibm/w_j1.c +106 -0
  149. data/vendor/spidermonkey/fdlibm/w_jn.c +128 -0
  150. data/vendor/spidermonkey/fdlibm/w_lgamma.c +85 -0
  151. data/vendor/spidermonkey/fdlibm/w_lgamma_r.c +81 -0
  152. data/vendor/spidermonkey/fdlibm/w_log.c +78 -0
  153. data/vendor/spidermonkey/fdlibm/w_log10.c +81 -0
  154. data/vendor/spidermonkey/fdlibm/w_pow.c +99 -0
  155. data/vendor/spidermonkey/fdlibm/w_remainder.c +77 -0
  156. data/vendor/spidermonkey/fdlibm/w_scalb.c +95 -0
  157. data/vendor/spidermonkey/fdlibm/w_sinh.c +77 -0
  158. data/vendor/spidermonkey/fdlibm/w_sqrt.c +77 -0
  159. data/vendor/spidermonkey/javascript-trace.d +73 -0
  160. data/vendor/spidermonkey/js.c +3951 -0
  161. data/vendor/spidermonkey/js.mak +4438 -0
  162. data/vendor/spidermonkey/js.mdp +0 -0
  163. data/vendor/spidermonkey/js.msg +307 -0
  164. data/vendor/spidermonkey/js.pkg +2 -0
  165. data/vendor/spidermonkey/js3240.rc +79 -0
  166. data/vendor/spidermonkey/jsOS240.def +654 -0
  167. data/vendor/spidermonkey/jsapi.c +5836 -0
  168. data/vendor/spidermonkey/jsapi.h +2624 -0
  169. data/vendor/spidermonkey/jsarena.c +450 -0
  170. data/vendor/spidermonkey/jsarena.h +318 -0
  171. data/vendor/spidermonkey/jsarray.c +2988 -0
  172. data/vendor/spidermonkey/jsarray.h +124 -0
  173. data/vendor/spidermonkey/jsatom.c +1045 -0
  174. data/vendor/spidermonkey/jsatom.h +442 -0
  175. data/vendor/spidermonkey/jsbit.h +253 -0
  176. data/vendor/spidermonkey/jsbool.c +176 -0
  177. data/vendor/spidermonkey/jsbool.h +73 -0
  178. data/vendor/spidermonkey/jsclist.h +139 -0
  179. data/vendor/spidermonkey/jscntxt.c +1348 -0
  180. data/vendor/spidermonkey/jscntxt.h +1120 -0
  181. data/vendor/spidermonkey/jscompat.h +57 -0
  182. data/vendor/spidermonkey/jsconfig.h +248 -0
  183. data/vendor/spidermonkey/jsconfig.mk +181 -0
  184. data/vendor/spidermonkey/jscpucfg.c +383 -0
  185. data/vendor/spidermonkey/jscpucfg.h +212 -0
  186. data/vendor/spidermonkey/jsdate.c +2398 -0
  187. data/vendor/spidermonkey/jsdate.h +124 -0
  188. data/vendor/spidermonkey/jsdbgapi.c +1799 -0
  189. data/vendor/spidermonkey/jsdbgapi.h +464 -0
  190. data/vendor/spidermonkey/jsdhash.c +868 -0
  191. data/vendor/spidermonkey/jsdhash.h +592 -0
  192. data/vendor/spidermonkey/jsdtoa.c +3167 -0
  193. data/vendor/spidermonkey/jsdtoa.h +130 -0
  194. data/vendor/spidermonkey/jsdtracef.c +317 -0
  195. data/vendor/spidermonkey/jsdtracef.h +77 -0
  196. data/vendor/spidermonkey/jsemit.c +6909 -0
  197. data/vendor/spidermonkey/jsemit.h +741 -0
  198. data/vendor/spidermonkey/jsexn.c +1371 -0
  199. data/vendor/spidermonkey/jsexn.h +96 -0
  200. data/vendor/spidermonkey/jsfile.c +2736 -0
  201. data/vendor/spidermonkey/jsfile.h +56 -0
  202. data/vendor/spidermonkey/jsfile.msg +90 -0
  203. data/vendor/spidermonkey/jsfun.c +2634 -0
  204. data/vendor/spidermonkey/jsfun.h +254 -0
  205. data/vendor/spidermonkey/jsgc.c +3554 -0
  206. data/vendor/spidermonkey/jsgc.h +403 -0
  207. data/vendor/spidermonkey/jshash.c +476 -0
  208. data/vendor/spidermonkey/jshash.h +151 -0
  209. data/vendor/spidermonkey/jsify.pl +485 -0
  210. data/vendor/spidermonkey/jsinterp.c +6981 -0
  211. data/vendor/spidermonkey/jsinterp.h +521 -0
  212. data/vendor/spidermonkey/jsinvoke.c +43 -0
  213. data/vendor/spidermonkey/jsiter.c +1067 -0
  214. data/vendor/spidermonkey/jsiter.h +122 -0
  215. data/vendor/spidermonkey/jskeyword.tbl +124 -0
  216. data/vendor/spidermonkey/jskwgen.c +460 -0
  217. data/vendor/spidermonkey/jslibmath.h +266 -0
  218. data/vendor/spidermonkey/jslock.c +1309 -0
  219. data/vendor/spidermonkey/jslock.h +313 -0
  220. data/vendor/spidermonkey/jslocko.asm +60 -0
  221. data/vendor/spidermonkey/jslog2.c +94 -0
  222. data/vendor/spidermonkey/jslong.c +264 -0
  223. data/vendor/spidermonkey/jslong.h +412 -0
  224. data/vendor/spidermonkey/jsmath.c +568 -0
  225. data/vendor/spidermonkey/jsmath.h +57 -0
  226. data/vendor/spidermonkey/jsnum.c +1228 -0
  227. data/vendor/spidermonkey/jsnum.h +283 -0
  228. data/vendor/spidermonkey/jsobj.c +5266 -0
  229. data/vendor/spidermonkey/jsobj.h +709 -0
  230. data/vendor/spidermonkey/jsopcode.c +5245 -0
  231. data/vendor/spidermonkey/jsopcode.h +394 -0
  232. data/vendor/spidermonkey/jsopcode.tbl +523 -0
  233. data/vendor/spidermonkey/jsotypes.h +202 -0
  234. data/vendor/spidermonkey/jsparse.c +6680 -0
  235. data/vendor/spidermonkey/jsparse.h +511 -0
  236. data/vendor/spidermonkey/jsprf.c +1262 -0
  237. data/vendor/spidermonkey/jsprf.h +150 -0
  238. data/vendor/spidermonkey/jsproto.tbl +128 -0
  239. data/vendor/spidermonkey/jsprvtd.h +267 -0
  240. data/vendor/spidermonkey/jspubtd.h +744 -0
  241. data/vendor/spidermonkey/jsregexp.c +4352 -0
  242. data/vendor/spidermonkey/jsregexp.h +183 -0
  243. data/vendor/spidermonkey/jsreops.tbl +145 -0
  244. data/vendor/spidermonkey/jsscan.c +2003 -0
  245. data/vendor/spidermonkey/jsscan.h +387 -0
  246. data/vendor/spidermonkey/jsscope.c +1948 -0
  247. data/vendor/spidermonkey/jsscope.h +418 -0
  248. data/vendor/spidermonkey/jsscript.c +1832 -0
  249. data/vendor/spidermonkey/jsscript.h +287 -0
  250. data/vendor/spidermonkey/jsshell.msg +50 -0
  251. data/vendor/spidermonkey/jsstddef.h +83 -0
  252. data/vendor/spidermonkey/jsstr.c +5004 -0
  253. data/vendor/spidermonkey/jsstr.h +641 -0
  254. data/vendor/spidermonkey/jstypes.h +475 -0
  255. data/vendor/spidermonkey/jsutil.c +345 -0
  256. data/vendor/spidermonkey/jsutil.h +157 -0
  257. data/vendor/spidermonkey/jsxdrapi.c +800 -0
  258. data/vendor/spidermonkey/jsxdrapi.h +218 -0
  259. data/vendor/spidermonkey/jsxml.c +8471 -0
  260. data/vendor/spidermonkey/jsxml.h +349 -0
  261. data/vendor/spidermonkey/lock_SunOS.s +119 -0
  262. data/vendor/spidermonkey/perfect.js +39 -0
  263. data/vendor/spidermonkey/plify_jsdhash.sed +36 -0
  264. data/vendor/spidermonkey/prmjtime.c +846 -0
  265. data/vendor/spidermonkey/prmjtime.h +103 -0
  266. data/vendor/spidermonkey/resource.h +15 -0
  267. data/vendor/spidermonkey/rules.mk +197 -0
  268. data/vendor/spidermonkey/win32.order +384 -0
  269. metadata +4 -3
@@ -0,0 +1,394 @@
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___ */
@@ -0,0 +1,523 @@
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)