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,521 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ * vim: set ts=8 sw=4 et tw=78:
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
+ #ifndef jsinterp_h___
42
+ #define jsinterp_h___
43
+ /*
44
+ * JS interpreter interface.
45
+ */
46
+ #include "jsprvtd.h"
47
+ #include "jspubtd.h"
48
+ #include "jsopcode.h"
49
+
50
+ JS_BEGIN_EXTERN_C
51
+
52
+ typedef struct JSFrameRegs {
53
+ jsbytecode *pc; /* program counter */
54
+ jsval *sp; /* stack pointer */
55
+ } JSFrameRegs;
56
+
57
+ /*
58
+ * JS stack frame, may be allocated on the C stack by native callers. Always
59
+ * allocated on cx->stackPool for calls from the interpreter to an interpreted
60
+ * function.
61
+ *
62
+ * NB: This struct is manually initialized in jsinterp.c and jsiter.c. If you
63
+ * add new members, update both files. But first, try to remove members. The
64
+ * sharp* and xml* members should be moved onto the stack as local variables
65
+ * with well-known slots, if possible.
66
+ */
67
+ struct JSStackFrame {
68
+ JSFrameRegs *regs;
69
+ jsval *spbase; /* operand stack base */
70
+ JSObject *callobj; /* lazily created Call object */
71
+ JSObject *argsobj; /* lazily created arguments object */
72
+ JSObject *varobj; /* variables object, where vars go */
73
+ JSObject *callee; /* function or script object */
74
+ JSScript *script; /* script being interpreted */
75
+ JSFunction *fun; /* function being called or null */
76
+ JSObject *thisp; /* "this" pointer if in method */
77
+ uintN argc; /* actual argument count */
78
+ jsval *argv; /* base of argument stack slots */
79
+ jsval rval; /* function return value */
80
+ uintN nvars; /* local variable count */
81
+ jsval *vars; /* base of variable stack slots */
82
+ JSStackFrame *down; /* previous frame */
83
+ void *annotation; /* used by Java security */
84
+ JSObject *scopeChain; /* scope chain */
85
+ uintN sharpDepth; /* array/object initializer depth */
86
+ JSObject *sharpArray; /* scope for #n= initializer vars */
87
+ uint32 flags; /* frame flags -- see below */
88
+ JSStackFrame *dormantNext; /* next dormant frame chain */
89
+ JSObject *xmlNamespace; /* null or default xml namespace in E4X */
90
+ JSObject *blockChain; /* active compile-time block scopes */
91
+ #ifdef DEBUG
92
+ jsrefcount pcDisabledSave; /* for balanced property cache control */
93
+ #endif
94
+ };
95
+
96
+ typedef struct JSInlineFrame {
97
+ JSStackFrame frame; /* base struct */
98
+ JSFrameRegs callerRegs; /* parent's frame registers */
99
+ void *mark; /* mark before inline frame */
100
+ void *hookData; /* debugger call hook data */
101
+ JSVersion callerVersion; /* dynamic version of calling script */
102
+ } JSInlineFrame;
103
+
104
+ /* JS stack frame flags. */
105
+ #define JSFRAME_CONSTRUCTING 0x01 /* frame is for a constructor invocation */
106
+ #define JSFRAME_COMPUTED_THIS 0x02 /* frame.thisp was computed already */
107
+ #define JSFRAME_ASSIGNING 0x04 /* a complex (not simplex JOF_ASSIGNING) op
108
+ is currently assigning to a property */
109
+ #define JSFRAME_DEBUGGER 0x08 /* frame for JS_EvaluateInStackFrame */
110
+ #define JSFRAME_EVAL 0x10 /* frame for obj_eval */
111
+ #define JSFRAME_SCRIPT_OBJECT 0x20 /* compiling source for a Script object */
112
+ #define JSFRAME_YIELDING 0x40 /* js_Interpret dispatched JSOP_YIELD */
113
+ #define JSFRAME_ITERATOR 0x80 /* trying to get an iterator for for-in */
114
+ #define JSFRAME_POP_BLOCKS 0x100 /* scope chain contains blocks to pop */
115
+ #define JSFRAME_GENERATOR 0x200 /* frame belongs to generator-iterator */
116
+ #define JSFRAME_ROOTED_ARGV 0x400 /* frame.argv is rooted by the caller */
117
+
118
+ #define JSFRAME_OVERRIDE_SHIFT 24 /* override bit-set params; see jsfun.c */
119
+ #define JSFRAME_OVERRIDE_BITS 8
120
+
121
+ #define JSFRAME_SPECIAL (JSFRAME_DEBUGGER | JSFRAME_EVAL)
122
+
123
+ /*
124
+ * Property cache with structurally typed capabilities for invalidation, for
125
+ * polymorphic callsite method/get/set speedups.
126
+ *
127
+ * See bug https://bugzilla.mozilla.org/show_bug.cgi?id=365851.
128
+ */
129
+ #define PROPERTY_CACHE_LOG2 12
130
+ #define PROPERTY_CACHE_SIZE JS_BIT(PROPERTY_CACHE_LOG2)
131
+ #define PROPERTY_CACHE_MASK JS_BITMASK(PROPERTY_CACHE_LOG2)
132
+
133
+ #define PROPERTY_CACHE_HASH(pc,kshape) \
134
+ ((((jsuword)(pc) >> PROPERTY_CACHE_LOG2) ^ (jsuword)(pc) ^ (kshape)) & \
135
+ PROPERTY_CACHE_MASK)
136
+
137
+ #define PROPERTY_CACHE_HASH_PC(pc,kshape) \
138
+ PROPERTY_CACHE_HASH(pc, kshape)
139
+
140
+ #define PROPERTY_CACHE_HASH_ATOM(atom,obj,pobj) \
141
+ PROPERTY_CACHE_HASH((jsuword)(atom) >> 2, OBJ_SCOPE(obj)->shape)
142
+
143
+ /*
144
+ * Property cache value capability macros.
145
+ */
146
+ #define PCVCAP_PROTOBITS 4
147
+ #define PCVCAP_PROTOSIZE JS_BIT(PCVCAP_PROTOBITS)
148
+ #define PCVCAP_PROTOMASK JS_BITMASK(PCVCAP_PROTOBITS)
149
+
150
+ #define PCVCAP_SCOPEBITS 4
151
+ #define PCVCAP_SCOPESIZE JS_BIT(PCVCAP_SCOPEBITS)
152
+ #define PCVCAP_SCOPEMASK JS_BITMASK(PCVCAP_SCOPEBITS)
153
+
154
+ #define PCVCAP_TAGBITS (PCVCAP_PROTOBITS + PCVCAP_SCOPEBITS)
155
+ #define PCVCAP_TAGMASK JS_BITMASK(PCVCAP_TAGBITS)
156
+ #define PCVCAP_TAG(t) ((t) & PCVCAP_TAGMASK)
157
+
158
+ #define PCVCAP_MAKE(t,s,p) (((t) << PCVCAP_TAGBITS) | \
159
+ ((s) << PCVCAP_PROTOBITS) | \
160
+ (p))
161
+ #define PCVCAP_SHAPE(t) ((t) >> PCVCAP_TAGBITS)
162
+
163
+ #define SHAPE_OVERFLOW_BIT JS_BIT(32 - PCVCAP_TAGBITS)
164
+
165
+ extern uint32
166
+ js_GenerateShape(JSContext *cx, JSBool gcLocked);
167
+
168
+ struct JSPropCacheEntry {
169
+ jsbytecode *kpc; /* pc if vcap tag is <= 1, else atom */
170
+ jsuword kshape; /* key shape if pc, else obj for atom */
171
+ jsuword vcap; /* value capability, see above */
172
+ jsuword vword; /* value word, see PCVAL_* below */
173
+ };
174
+
175
+ #if defined DEBUG_brendan || defined DEBUG_brendaneich
176
+ #define JS_PROPERTY_CACHE_METERING 1
177
+ #endif
178
+
179
+ typedef struct JSPropertyCache {
180
+ JSPropCacheEntry table[PROPERTY_CACHE_SIZE];
181
+ JSBool empty;
182
+ jsrefcount disabled; /* signed for anti-underflow asserts */
183
+ #ifdef JS_PROPERTY_CACHE_METERING
184
+ uint32 fills; /* number of cache entry fills */
185
+ uint32 nofills; /* couldn't fill (e.g. default get) */
186
+ uint32 rofills; /* set on read-only prop can't fill */
187
+ uint32 disfills; /* fill attempts on disabled cache */
188
+ uint32 oddfills; /* fill attempt after setter deleted */
189
+ uint32 modfills; /* fill that rehashed to a new entry */
190
+ uint32 brandfills; /* scope brandings to type structural
191
+ method fills */
192
+ uint32 noprotos; /* resolve-returned non-proto pobj */
193
+ uint32 longchains; /* overlong scope and/or proto chain */
194
+ uint32 recycles; /* cache entries recycled by fills */
195
+ uint32 pcrecycles; /* pc-keyed entries recycled by atom-
196
+ keyed fills */
197
+ uint32 tests; /* cache probes */
198
+ uint32 pchits; /* fast-path polymorphic op hits */
199
+ uint32 protopchits; /* pchits hitting immediate prototype */
200
+ uint32 initests; /* cache probes from JSOP_INITPROP */
201
+ uint32 inipchits; /* init'ing next property pchit case */
202
+ uint32 inipcmisses; /* init'ing next property pc misses */
203
+ uint32 settests; /* cache probes from JOF_SET opcodes */
204
+ uint32 addpchits; /* adding next property pchit case */
205
+ uint32 setpchits; /* setting existing property pchit */
206
+ uint32 setpcmisses; /* setting/adding property pc misses */
207
+ uint32 slotchanges; /* clasp->reserveSlots result variance-
208
+ induced slot changes */
209
+ uint32 setmisses; /* JSOP_SET{NAME,PROP} total misses */
210
+ uint32 idmisses; /* slow-path key id == atom misses */
211
+ uint32 komisses; /* slow-path key object misses */
212
+ uint32 vcmisses; /* value capability misses */
213
+ uint32 misses; /* cache misses */
214
+ uint32 flushes; /* cache flushes */
215
+ # define PCMETER(x) x
216
+ #else
217
+ # define PCMETER(x) ((void)0)
218
+ #endif
219
+ } JSPropertyCache;
220
+
221
+ /*
222
+ * Property cache value tagging/untagging macros.
223
+ */
224
+ #define PCVAL_OBJECT 0
225
+ #define PCVAL_SLOT 1
226
+ #define PCVAL_SPROP 2
227
+
228
+ #define PCVAL_TAGBITS 2
229
+ #define PCVAL_TAGMASK JS_BITMASK(PCVAL_TAGBITS)
230
+ #define PCVAL_TAG(v) ((v) & PCVAL_TAGMASK)
231
+ #define PCVAL_CLRTAG(v) ((v) & ~(jsuword)PCVAL_TAGMASK)
232
+ #define PCVAL_SETTAG(v,t) ((jsuword)(v) | (t))
233
+
234
+ #define PCVAL_NULL 0
235
+ #define PCVAL_IS_NULL(v) ((v) == PCVAL_NULL)
236
+
237
+ #define PCVAL_IS_OBJECT(v) (PCVAL_TAG(v) == PCVAL_OBJECT)
238
+ #define PCVAL_TO_OBJECT(v) ((JSObject *) (v))
239
+ #define OBJECT_TO_PCVAL(obj) ((jsuword) (obj))
240
+
241
+ #define PCVAL_OBJECT_TO_JSVAL(v) OBJECT_TO_JSVAL(PCVAL_TO_OBJECT(v))
242
+ #define JSVAL_OBJECT_TO_PCVAL(v) OBJECT_TO_PCVAL(JSVAL_TO_OBJECT(v))
243
+
244
+ #define PCVAL_IS_SLOT(v) ((v) & PCVAL_SLOT)
245
+ #define PCVAL_TO_SLOT(v) ((jsuint)(v) >> 1)
246
+ #define SLOT_TO_PCVAL(i) (((jsuword)(i) << 1) | PCVAL_SLOT)
247
+
248
+ #define PCVAL_IS_SPROP(v) (PCVAL_TAG(v) == PCVAL_SPROP)
249
+ #define PCVAL_TO_SPROP(v) ((JSScopeProperty *) PCVAL_CLRTAG(v))
250
+ #define SPROP_TO_PCVAL(sprop) PCVAL_SETTAG(sprop, PCVAL_SPROP)
251
+
252
+ /*
253
+ * Fill property cache entry for key cx->fp->pc, optimized value word computed
254
+ * from obj and sprop, and entry capability forged from OBJ_SCOPE(obj)->shape,
255
+ * scopeIndex, and protoIndex.
256
+ */
257
+ extern void
258
+ js_FillPropertyCache(JSContext *cx, JSObject *obj, jsuword kshape,
259
+ uintN scopeIndex, uintN protoIndex,
260
+ JSObject *pobj, JSScopeProperty *sprop,
261
+ JSPropCacheEntry **entryp);
262
+
263
+ /*
264
+ * Property cache lookup macros. PROPERTY_CACHE_TEST is designed to inline the
265
+ * fast path in js_Interpret, so it makes "just-so" restrictions on parameters,
266
+ * e.g. pobj and obj should not be the same variable, since for JOF_PROP-mode
267
+ * opcodes, obj must not be changed because of a cache miss.
268
+ *
269
+ * On return from PROPERTY_CACHE_TEST, if atom is null then obj points to the
270
+ * scope chain element in which the property was found, pobj is locked, and
271
+ * entry is valid. If atom is non-null then no object is locked but entry is
272
+ * still set correctly for use, e.g., by js_FillPropertyCache and atom should
273
+ * be used as the id to find.
274
+ *
275
+ * We must lock pobj on a hit in order to close races with threads that might
276
+ * be deleting a property from its scope, or otherwise invalidating property
277
+ * caches (on all threads) by re-generating scope->shape.
278
+ */
279
+ #define PROPERTY_CACHE_TEST(cx, pc, obj, pobj, entry, atom) \
280
+ do { \
281
+ JSPropertyCache *cache_ = &JS_PROPERTY_CACHE(cx); \
282
+ uint32 kshape_ = (JS_ASSERT(OBJ_IS_NATIVE(obj)), \
283
+ OBJ_SCOPE(obj)->shape); \
284
+ entry = &cache_->table[PROPERTY_CACHE_HASH_PC(pc, kshape_)]; \
285
+ PCMETER(cache_->tests++); \
286
+ JS_ASSERT(&obj != &pobj); \
287
+ if (entry->kpc == pc && entry->kshape == kshape_) { \
288
+ JSObject *tmp_; \
289
+ pobj = obj; \
290
+ JS_LOCK_OBJ(cx, pobj); \
291
+ JS_ASSERT(PCVCAP_TAG(entry->vcap) <= 1); \
292
+ if (PCVCAP_TAG(entry->vcap) == 1 && \
293
+ (tmp_ = LOCKED_OBJ_GET_PROTO(pobj)) != NULL && \
294
+ OBJ_IS_NATIVE(tmp_)) { \
295
+ JS_UNLOCK_OBJ(cx, pobj); \
296
+ pobj = tmp_; \
297
+ JS_LOCK_OBJ(cx, pobj); \
298
+ } \
299
+ if (PCVCAP_SHAPE(entry->vcap) == OBJ_SCOPE(pobj)->shape) { \
300
+ PCMETER(cache_->pchits++); \
301
+ PCMETER(!PCVCAP_TAG(entry->vcap) || cache_->protopchits++); \
302
+ pobj = OBJ_SCOPE(pobj)->object; \
303
+ atom = NULL; \
304
+ break; \
305
+ } \
306
+ JS_UNLOCK_OBJ(cx, pobj); \
307
+ } \
308
+ atom = js_FullTestPropertyCache(cx, pc, &obj, &pobj, &entry); \
309
+ if (atom) \
310
+ PCMETER(cache_->misses++); \
311
+ } while (0)
312
+
313
+ extern JSAtom *
314
+ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
315
+ JSObject **objp, JSObject **pobjp,
316
+ JSPropCacheEntry **entryp);
317
+
318
+ extern void
319
+ js_FlushPropertyCache(JSContext *cx);
320
+
321
+ extern void
322
+ js_FlushPropertyCacheForScript(JSContext *cx, JSScript *script);
323
+
324
+ extern void
325
+ js_DisablePropertyCache(JSContext *cx);
326
+
327
+ extern void
328
+ js_EnablePropertyCache(JSContext *cx);
329
+
330
+ /*
331
+ * Interpreter stack arena-pool alloc and free functions.
332
+ */
333
+ extern JS_FRIEND_API(jsval *)
334
+ js_AllocStack(JSContext *cx, uintN nslots, void **markp);
335
+
336
+ extern JS_FRIEND_API(void)
337
+ js_FreeStack(JSContext *cx, void *mark);
338
+
339
+ extern jsval *
340
+ js_AllocRawStack(JSContext *cx, uintN nslots, void **markp);
341
+
342
+ extern void
343
+ js_FreeRawStack(JSContext *cx, void *mark);
344
+
345
+ /*
346
+ * Refresh and return fp->scopeChain. It may be stale if block scopes are
347
+ * active but not yet reflected by objects in the scope chain. If a block
348
+ * scope contains a with, eval, XML filtering predicate, or similar such
349
+ * dynamically scoped construct, then compile-time block scope at fp->blocks
350
+ * must reflect at runtime.
351
+ */
352
+ extern JSObject *
353
+ js_GetScopeChain(JSContext *cx, JSStackFrame *fp);
354
+
355
+ /*
356
+ * Given a context and a vector of [callee, this, args...] for a function that
357
+ * was specified with a JSFUN_THISP_PRIMITIVE flag, get the primitive value of
358
+ * |this| into *thisvp. In doing so, if |this| is an object, insist it is an
359
+ * instance of clasp and extract its private slot value to return via *thisvp.
360
+ *
361
+ * NB: this function loads and uses *vp before storing *thisvp, so the two may
362
+ * alias the same jsval.
363
+ */
364
+ extern JSBool
365
+ js_GetPrimitiveThis(JSContext *cx, jsval *vp, JSClass *clasp, jsval *thisvp);
366
+
367
+ /*
368
+ * For a call with arguments argv including argv[-1] (nominal |this|) and
369
+ * argv[-2] (callee) replace null |this| with callee's parent, replace
370
+ * primitive values with the equivalent wrapper objects and censor activation
371
+ * objects as, per ECMA-262, they may not be referred to by |this|. argv[-1]
372
+ * must not be a JSVAL_VOID.
373
+ */
374
+ extern JSObject *
375
+ js_ComputeThis(JSContext *cx, JSBool lazy, jsval *argv);
376
+
377
+ /*
378
+ * ECMA requires "the global object", but in embeddings such as the browser,
379
+ * which have multiple top-level objects (windows, frames, etc. in the DOM),
380
+ * we prefer fun's parent. An example that causes this code to run:
381
+ *
382
+ * // in window w1
383
+ * function f() { return this }
384
+ * function g() { return f }
385
+ *
386
+ * // in window w2
387
+ * var h = w1.g()
388
+ * alert(h() == w1)
389
+ *
390
+ * The alert should display "true".
391
+ */
392
+ JSObject *
393
+ js_ComputeGlobalThis(JSContext *cx, JSBool lazy, jsval *argv);
394
+
395
+ extern const uint16 js_PrimitiveTestFlags[];
396
+
397
+ #define PRIMITIVE_THIS_TEST(fun,thisv) \
398
+ (JS_ASSERT(thisv != JSVAL_VOID), \
399
+ JSFUN_THISP_TEST(JSFUN_THISP_FLAGS((fun)->flags), \
400
+ js_PrimitiveTestFlags[JSVAL_TAG(thisv) - 1]))
401
+
402
+ /*
403
+ * NB: js_Invoke requires that cx is currently running JS (i.e., that cx->fp
404
+ * is non-null), and that vp points to the callee, |this| parameter, and
405
+ * actual arguments of the call. [vp .. vp + 2 + argc) must belong to the last
406
+ * JS stack segment that js_AllocStack allocated. The function may use the
407
+ * space available after vp + 2 + argc in the stack segment for temporaries,
408
+ * so the caller should not use that space for values that must be preserved
409
+ * across the call.
410
+ */
411
+ extern JS_FRIEND_API(JSBool)
412
+ js_Invoke(JSContext *cx, uintN argc, jsval *vp, uintN flags);
413
+
414
+ /*
415
+ * Consolidated js_Invoke flags simply rename certain JSFRAME_* flags, so that
416
+ * we can share bits stored in JSStackFrame.flags and passed to:
417
+ *
418
+ * js_Invoke
419
+ * js_InternalInvoke
420
+ * js_ValueToFunction
421
+ * js_ValueToFunctionObject
422
+ * js_ValueToCallableObject
423
+ * js_ReportIsNotFunction
424
+ *
425
+ * See jsfun.h for the latter four and flag renaming macros.
426
+ */
427
+ #define JSINVOKE_CONSTRUCT JSFRAME_CONSTRUCTING
428
+ #define JSINVOKE_ITERATOR JSFRAME_ITERATOR
429
+
430
+ /*
431
+ * Mask to isolate construct and iterator flags for use with jsfun.h functions.
432
+ */
433
+ #define JSINVOKE_FUNFLAGS (JSINVOKE_CONSTRUCT | JSINVOKE_ITERATOR)
434
+
435
+ /*
436
+ * "Internal" calls may come from C or C++ code using a JSContext on which no
437
+ * JS is running (!cx->fp), so they may need to push a dummy JSStackFrame.
438
+ */
439
+ #define js_InternalCall(cx,obj,fval,argc,argv,rval) \
440
+ js_InternalInvoke(cx, obj, fval, 0, argc, argv, rval)
441
+
442
+ #define js_InternalConstruct(cx,obj,fval,argc,argv,rval) \
443
+ js_InternalInvoke(cx, obj, fval, JSINVOKE_CONSTRUCT, argc, argv, rval)
444
+
445
+ extern JSBool
446
+ js_InternalInvoke(JSContext *cx, JSObject *obj, jsval fval, uintN flags,
447
+ uintN argc, jsval *argv, jsval *rval);
448
+
449
+ extern JSBool
450
+ js_InternalGetOrSet(JSContext *cx, JSObject *obj, jsid id, jsval fval,
451
+ JSAccessMode mode, uintN argc, jsval *argv, jsval *rval);
452
+
453
+ extern JSBool
454
+ js_Execute(JSContext *cx, JSObject *chain, JSScript *script,
455
+ JSStackFrame *down, uintN flags, jsval *result);
456
+
457
+ extern JSBool
458
+ js_InvokeConstructor(JSContext *cx, uintN argc, jsval *vp);
459
+
460
+ extern JSBool
461
+ js_Interpret(JSContext *cx);
462
+
463
+ #define JSPROP_INITIALIZER 0x100 /* NB: Not a valid property attribute. */
464
+
465
+ extern JSBool
466
+ js_CheckRedeclaration(JSContext *cx, JSObject *obj, jsid id, uintN attrs,
467
+ JSObject **objp, JSProperty **propp);
468
+
469
+ extern JSBool
470
+ js_StrictlyEqual(JSContext *cx, jsval lval, jsval rval);
471
+
472
+ extern JSBool
473
+ js_EnterWith(JSContext *cx, jsint stackIndex);
474
+
475
+ extern void
476
+ js_LeaveWith(JSContext *cx);
477
+
478
+ extern JSClass *
479
+ js_IsActiveWithOrBlock(JSContext *cx, JSObject *obj, int stackDepth);
480
+
481
+ extern jsint
482
+ js_CountWithBlocks(JSContext *cx, JSStackFrame *fp);
483
+
484
+ /*
485
+ * Unwind block and scope chains to match the given depth. The function sets
486
+ * fp->sp on return to stackDepth.
487
+ */
488
+ extern JSBool
489
+ js_UnwindScope(JSContext *cx, JSStackFrame *fp, jsint stackDepth,
490
+ JSBool normalUnwind);
491
+
492
+ extern JSBool
493
+ js_InternNonIntElementId(JSContext *cx, JSObject *obj, jsval idval, jsid *idp);
494
+
495
+ extern JSBool
496
+ js_ImportProperty(JSContext *cx, JSObject *obj, jsid id);
497
+
498
+ extern JSBool
499
+ js_OnUnknownMethod(JSContext *cx, jsval *vp);
500
+
501
+ /*
502
+ * Find the results of incrementing or decrementing *vp. For pre-increments,
503
+ * both *vp and *vp2 will contain the result on return. For post-increments,
504
+ * vp will contain the original value converted to a number and vp2 will get
505
+ * the result. Both vp and vp2 must be roots.
506
+ */
507
+ extern JSBool
508
+ js_DoIncDec(JSContext *cx, const JSCodeSpec *cs, jsval *vp, jsval *vp2);
509
+
510
+ /*
511
+ * JS_OPMETER helper functions.
512
+ */
513
+ extern void
514
+ js_MeterOpcodePair(JSOp op1, JSOp op2);
515
+
516
+ extern void
517
+ js_MeterSlotOpcode(JSOp op, uint32 slot);
518
+
519
+ JS_END_EXTERN_C
520
+
521
+ #endif /* jsinterp_h___ */