libv8-freebsd 3.3.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (703) hide show
  1. data/.gitignore +9 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +75 -0
  5. data/Rakefile +115 -0
  6. data/ext/libv8/extconf.rb +27 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +39 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-freebsd-amd64.patch +16 -0
  11. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  12. data/lib/libv8/scons/CHANGES.txt +5541 -0
  13. data/lib/libv8/scons/LICENSE.txt +20 -0
  14. data/lib/libv8/scons/MANIFEST +200 -0
  15. data/lib/libv8/scons/PKG-INFO +13 -0
  16. data/lib/libv8/scons/README.txt +243 -0
  17. data/lib/libv8/scons/RELEASE.txt +100 -0
  18. data/lib/libv8/scons/engine/SCons/Action.py +1257 -0
  19. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  20. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  21. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  22. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  23. data/lib/libv8/scons/engine/SCons/Defaults.py +494 -0
  24. data/lib/libv8/scons/engine/SCons/Environment.py +2417 -0
  25. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  26. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  27. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  28. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  29. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  30. data/lib/libv8/scons/engine/SCons/Node/FS.py +3302 -0
  31. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  32. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1329 -0
  33. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  37. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  38. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  39. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +70 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  49. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  50. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  51. data/lib/libv8/scons/engine/SCons/SConsign.py +389 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +387 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  60. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  62. data/lib/libv8/scons/engine/SCons/Script/Main.py +1405 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  64. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  65. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  66. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  67. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  68. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1025 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +263 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +459 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +526 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +240 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +125 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +95 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f03.py +63 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +62 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/install.py +283 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +522 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/jar.py +116 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/latex.py +80 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/link.py +122 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +179 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +318 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +278 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1806 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +84 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +109 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +126 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +62 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +76 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/swig.py +183 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tex.py +866 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +140 -0
  182. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  183. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  188. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  189. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  190. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  191. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  192. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  198. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  199. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  200. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  201. data/lib/libv8/scons/engine/SCons/dblite.py +254 -0
  202. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  203. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  204. data/lib/libv8/scons/scons-time.1 +1017 -0
  205. data/lib/libv8/scons/scons.1 +15225 -0
  206. data/lib/libv8/scons/sconsign.1 +208 -0
  207. data/lib/libv8/scons/script/scons +196 -0
  208. data/lib/libv8/scons/script/scons-time +1544 -0
  209. data/lib/libv8/scons/script/scons.bat +34 -0
  210. data/lib/libv8/scons/script/sconsign +514 -0
  211. data/lib/libv8/scons/setup.cfg +5 -0
  212. data/lib/libv8/scons/setup.py +423 -0
  213. data/lib/libv8/v8/.gitignore +35 -0
  214. data/lib/libv8/v8/AUTHORS +44 -0
  215. data/lib/libv8/v8/ChangeLog +2839 -0
  216. data/lib/libv8/v8/LICENSE +52 -0
  217. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  218. data/lib/libv8/v8/LICENSE.v8 +26 -0
  219. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  220. data/lib/libv8/v8/SConstruct +1478 -0
  221. data/lib/libv8/v8/build/README.txt +49 -0
  222. data/lib/libv8/v8/build/all.gyp +18 -0
  223. data/lib/libv8/v8/build/armu.gypi +32 -0
  224. data/lib/libv8/v8/build/common.gypi +144 -0
  225. data/lib/libv8/v8/build/gyp_v8 +145 -0
  226. data/lib/libv8/v8/include/v8-debug.h +395 -0
  227. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  228. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  229. data/lib/libv8/v8/include/v8-testing.h +104 -0
  230. data/lib/libv8/v8/include/v8.h +4124 -0
  231. data/lib/libv8/v8/include/v8stdint.h +53 -0
  232. data/lib/libv8/v8/preparser/SConscript +38 -0
  233. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  234. data/lib/libv8/v8/src/SConscript +368 -0
  235. data/lib/libv8/v8/src/accessors.cc +767 -0
  236. data/lib/libv8/v8/src/accessors.h +123 -0
  237. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  238. data/lib/libv8/v8/src/allocation.cc +122 -0
  239. data/lib/libv8/v8/src/allocation.h +143 -0
  240. data/lib/libv8/v8/src/api.cc +5845 -0
  241. data/lib/libv8/v8/src/api.h +574 -0
  242. data/lib/libv8/v8/src/apinatives.js +110 -0
  243. data/lib/libv8/v8/src/apiutils.h +73 -0
  244. data/lib/libv8/v8/src/arguments.h +118 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  246. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  247. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  248. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  249. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  250. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  251. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  252. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  253. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  254. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  255. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  256. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  257. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  258. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  259. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  260. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  261. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  262. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  263. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  264. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  265. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  266. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  267. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  268. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  269. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  270. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  271. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  272. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  273. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  274. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  275. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  276. data/lib/libv8/v8/src/array.js +1366 -0
  277. data/lib/libv8/v8/src/assembler.cc +1207 -0
  278. data/lib/libv8/v8/src/assembler.h +858 -0
  279. data/lib/libv8/v8/src/ast-inl.h +112 -0
  280. data/lib/libv8/v8/src/ast.cc +1146 -0
  281. data/lib/libv8/v8/src/ast.h +2188 -0
  282. data/lib/libv8/v8/src/atomicops.h +167 -0
  283. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  284. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  287. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  288. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  289. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  290. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  291. data/lib/libv8/v8/src/bignum.cc +768 -0
  292. data/lib/libv8/v8/src/bignum.h +140 -0
  293. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  294. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  295. data/lib/libv8/v8/src/builtins.cc +1707 -0
  296. data/lib/libv8/v8/src/builtins.h +371 -0
  297. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  298. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  299. data/lib/libv8/v8/src/cached-powers.h +65 -0
  300. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  301. data/lib/libv8/v8/src/char-predicates.h +67 -0
  302. data/lib/libv8/v8/src/checks.cc +110 -0
  303. data/lib/libv8/v8/src/checks.h +296 -0
  304. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  305. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  306. data/lib/libv8/v8/src/circular-queue.h +103 -0
  307. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  308. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  309. data/lib/libv8/v8/src/code.h +70 -0
  310. data/lib/libv8/v8/src/codegen.cc +231 -0
  311. data/lib/libv8/v8/src/codegen.h +84 -0
  312. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  313. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  314. data/lib/libv8/v8/src/compiler.cc +786 -0
  315. data/lib/libv8/v8/src/compiler.h +312 -0
  316. data/lib/libv8/v8/src/contexts.cc +347 -0
  317. data/lib/libv8/v8/src/contexts.h +391 -0
  318. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  319. data/lib/libv8/v8/src/conversions.cc +1131 -0
  320. data/lib/libv8/v8/src/conversions.h +135 -0
  321. data/lib/libv8/v8/src/counters.cc +93 -0
  322. data/lib/libv8/v8/src/counters.h +254 -0
  323. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  324. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  325. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  326. data/lib/libv8/v8/src/cpu.h +69 -0
  327. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  328. data/lib/libv8/v8/src/d8-debug.h +158 -0
  329. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  330. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  331. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  332. data/lib/libv8/v8/src/d8.cc +803 -0
  333. data/lib/libv8/v8/src/d8.gyp +91 -0
  334. data/lib/libv8/v8/src/d8.h +235 -0
  335. data/lib/libv8/v8/src/d8.js +2798 -0
  336. data/lib/libv8/v8/src/data-flow.cc +66 -0
  337. data/lib/libv8/v8/src/data-flow.h +205 -0
  338. data/lib/libv8/v8/src/date.js +1103 -0
  339. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  340. data/lib/libv8/v8/src/dateparser.cc +178 -0
  341. data/lib/libv8/v8/src/dateparser.h +266 -0
  342. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  343. data/lib/libv8/v8/src/debug-agent.h +129 -0
  344. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  345. data/lib/libv8/v8/src/debug.cc +3165 -0
  346. data/lib/libv8/v8/src/debug.h +1057 -0
  347. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  348. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  349. data/lib/libv8/v8/src/disasm.h +80 -0
  350. data/lib/libv8/v8/src/disassembler.cc +343 -0
  351. data/lib/libv8/v8/src/disassembler.h +58 -0
  352. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  353. data/lib/libv8/v8/src/diy-fp.h +117 -0
  354. data/lib/libv8/v8/src/double.h +238 -0
  355. data/lib/libv8/v8/src/dtoa.cc +103 -0
  356. data/lib/libv8/v8/src/dtoa.h +85 -0
  357. data/lib/libv8/v8/src/execution.cc +849 -0
  358. data/lib/libv8/v8/src/execution.h +297 -0
  359. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  360. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  361. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  362. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  363. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  369. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  370. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  371. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  372. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  373. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  374. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  375. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  376. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  377. data/lib/libv8/v8/src/factory.cc +1222 -0
  378. data/lib/libv8/v8/src/factory.h +442 -0
  379. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  380. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  381. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  382. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  383. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  384. data/lib/libv8/v8/src/flags.cc +551 -0
  385. data/lib/libv8/v8/src/flags.h +79 -0
  386. data/lib/libv8/v8/src/frames-inl.h +247 -0
  387. data/lib/libv8/v8/src/frames.cc +1243 -0
  388. data/lib/libv8/v8/src/frames.h +870 -0
  389. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  390. data/lib/libv8/v8/src/full-codegen.h +771 -0
  391. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  392. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  393. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  394. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  395. data/lib/libv8/v8/src/global-handles.cc +665 -0
  396. data/lib/libv8/v8/src/global-handles.h +284 -0
  397. data/lib/libv8/v8/src/globals.h +325 -0
  398. data/lib/libv8/v8/src/handles-inl.h +177 -0
  399. data/lib/libv8/v8/src/handles.cc +987 -0
  400. data/lib/libv8/v8/src/handles.h +382 -0
  401. data/lib/libv8/v8/src/hashmap.cc +230 -0
  402. data/lib/libv8/v8/src/hashmap.h +123 -0
  403. data/lib/libv8/v8/src/heap-inl.h +704 -0
  404. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  405. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  406. data/lib/libv8/v8/src/heap.cc +5930 -0
  407. data/lib/libv8/v8/src/heap.h +2268 -0
  408. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  409. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  410. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  411. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  413. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  414. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  415. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  416. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  417. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  418. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  419. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  420. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  421. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  422. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  423. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  424. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  425. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  426. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  427. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  428. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  429. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  430. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  431. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  432. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  433. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  434. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  435. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  436. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  437. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  438. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  439. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  440. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  441. data/lib/libv8/v8/src/ic-inl.h +130 -0
  442. data/lib/libv8/v8/src/ic.cc +2577 -0
  443. data/lib/libv8/v8/src/ic.h +736 -0
  444. data/lib/libv8/v8/src/inspector.cc +63 -0
  445. data/lib/libv8/v8/src/inspector.h +62 -0
  446. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  447. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  448. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  449. data/lib/libv8/v8/src/isolate.cc +1869 -0
  450. data/lib/libv8/v8/src/isolate.h +1382 -0
  451. data/lib/libv8/v8/src/json-parser.cc +504 -0
  452. data/lib/libv8/v8/src/json-parser.h +161 -0
  453. data/lib/libv8/v8/src/json.js +342 -0
  454. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  455. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  456. data/lib/libv8/v8/src/list-inl.h +212 -0
  457. data/lib/libv8/v8/src/list.h +174 -0
  458. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  459. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  460. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  461. data/lib/libv8/v8/src/lithium.cc +190 -0
  462. data/lib/libv8/v8/src/lithium.h +597 -0
  463. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  464. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  465. data/lib/libv8/v8/src/liveedit.h +180 -0
  466. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  467. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  468. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  469. data/lib/libv8/v8/src/log-inl.h +59 -0
  470. data/lib/libv8/v8/src/log-utils.cc +428 -0
  471. data/lib/libv8/v8/src/log-utils.h +231 -0
  472. data/lib/libv8/v8/src/log.cc +1993 -0
  473. data/lib/libv8/v8/src/log.h +476 -0
  474. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  475. data/lib/libv8/v8/src/macros.py +178 -0
  476. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  477. data/lib/libv8/v8/src/mark-compact.h +506 -0
  478. data/lib/libv8/v8/src/math.js +264 -0
  479. data/lib/libv8/v8/src/messages.cc +179 -0
  480. data/lib/libv8/v8/src/messages.h +113 -0
  481. data/lib/libv8/v8/src/messages.js +1096 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  483. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  484. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  485. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  486. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  487. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  488. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  489. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  490. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  491. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  492. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  493. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  494. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  495. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  496. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  497. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  498. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  499. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  500. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  501. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  502. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  503. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  504. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  505. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  506. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  507. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  508. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  509. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  510. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  511. data/lib/libv8/v8/src/natives.h +64 -0
  512. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  513. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  514. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  515. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  516. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  517. data/lib/libv8/v8/src/objects.cc +10585 -0
  518. data/lib/libv8/v8/src/objects.h +6838 -0
  519. data/lib/libv8/v8/src/parser.cc +4997 -0
  520. data/lib/libv8/v8/src/parser.h +765 -0
  521. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  522. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  523. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  524. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  525. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  526. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  527. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  528. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  529. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  530. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  531. data/lib/libv8/v8/src/platform-tls.h +50 -0
  532. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  533. data/lib/libv8/v8/src/platform.h +667 -0
  534. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  535. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  536. data/lib/libv8/v8/src/preparse-data.h +225 -0
  537. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  538. data/lib/libv8/v8/src/preparser.cc +1450 -0
  539. data/lib/libv8/v8/src/preparser.h +493 -0
  540. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  541. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  542. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  543. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  544. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  545. data/lib/libv8/v8/src/property.cc +105 -0
  546. data/lib/libv8/v8/src/property.h +365 -0
  547. data/lib/libv8/v8/src/proxy.js +83 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  553. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  554. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  555. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  556. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  557. data/lib/libv8/v8/src/regexp.js +483 -0
  558. data/lib/libv8/v8/src/rewriter.cc +360 -0
  559. data/lib/libv8/v8/src/rewriter.h +50 -0
  560. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  561. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  562. data/lib/libv8/v8/src/runtime.cc +12227 -0
  563. data/lib/libv8/v8/src/runtime.h +652 -0
  564. data/lib/libv8/v8/src/runtime.js +649 -0
  565. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  566. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  567. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  568. data/lib/libv8/v8/src/scanner-base.h +670 -0
  569. data/lib/libv8/v8/src/scanner.cc +345 -0
  570. data/lib/libv8/v8/src/scanner.h +146 -0
  571. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  572. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  573. data/lib/libv8/v8/src/scopes.cc +1150 -0
  574. data/lib/libv8/v8/src/scopes.h +507 -0
  575. data/lib/libv8/v8/src/serialize.cc +1574 -0
  576. data/lib/libv8/v8/src/serialize.h +589 -0
  577. data/lib/libv8/v8/src/shell.h +55 -0
  578. data/lib/libv8/v8/src/simulator.h +43 -0
  579. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  580. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  581. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  582. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  583. data/lib/libv8/v8/src/snapshot.h +91 -0
  584. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  585. data/lib/libv8/v8/src/spaces.cc +3145 -0
  586. data/lib/libv8/v8/src/spaces.h +2369 -0
  587. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  588. data/lib/libv8/v8/src/splay-tree.h +205 -0
  589. data/lib/libv8/v8/src/string-search.cc +41 -0
  590. data/lib/libv8/v8/src/string-search.h +568 -0
  591. data/lib/libv8/v8/src/string-stream.cc +592 -0
  592. data/lib/libv8/v8/src/string-stream.h +191 -0
  593. data/lib/libv8/v8/src/string.js +994 -0
  594. data/lib/libv8/v8/src/strtod.cc +440 -0
  595. data/lib/libv8/v8/src/strtod.h +40 -0
  596. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  597. data/lib/libv8/v8/src/stub-cache.h +924 -0
  598. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  599. data/lib/libv8/v8/src/token.cc +63 -0
  600. data/lib/libv8/v8/src/token.h +288 -0
  601. data/lib/libv8/v8/src/type-info.cc +507 -0
  602. data/lib/libv8/v8/src/type-info.h +272 -0
  603. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  604. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  605. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  606. data/lib/libv8/v8/src/unicode.cc +1624 -0
  607. data/lib/libv8/v8/src/unicode.h +280 -0
  608. data/lib/libv8/v8/src/uri.js +408 -0
  609. data/lib/libv8/v8/src/utils-inl.h +48 -0
  610. data/lib/libv8/v8/src/utils.cc +371 -0
  611. data/lib/libv8/v8/src/utils.h +800 -0
  612. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  613. data/lib/libv8/v8/src/v8-counters.h +314 -0
  614. data/lib/libv8/v8/src/v8.cc +213 -0
  615. data/lib/libv8/v8/src/v8.h +131 -0
  616. data/lib/libv8/v8/src/v8checks.h +64 -0
  617. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  618. data/lib/libv8/v8/src/v8globals.h +512 -0
  619. data/lib/libv8/v8/src/v8memory.h +82 -0
  620. data/lib/libv8/v8/src/v8natives.js +1310 -0
  621. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  622. data/lib/libv8/v8/src/v8threads.cc +464 -0
  623. data/lib/libv8/v8/src/v8threads.h +165 -0
  624. data/lib/libv8/v8/src/v8utils.h +319 -0
  625. data/lib/libv8/v8/src/variables.cc +114 -0
  626. data/lib/libv8/v8/src/variables.h +167 -0
  627. data/lib/libv8/v8/src/version.cc +116 -0
  628. data/lib/libv8/v8/src/version.h +68 -0
  629. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  630. data/lib/libv8/v8/src/vm-state.h +71 -0
  631. data/lib/libv8/v8/src/win32-headers.h +96 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  633. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  634. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  635. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  636. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  637. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  638. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  639. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  640. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  641. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  642. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  643. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  644. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  645. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  646. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  647. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  648. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  649. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  650. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  651. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  652. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  653. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  654. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  655. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  656. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  657. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  658. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  659. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  660. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  661. data/lib/libv8/v8/src/zone-inl.h +140 -0
  662. data/lib/libv8/v8/src/zone.cc +196 -0
  663. data/lib/libv8/v8/src/zone.h +240 -0
  664. data/lib/libv8/v8/tools/codemap.js +265 -0
  665. data/lib/libv8/v8/tools/consarray.js +93 -0
  666. data/lib/libv8/v8/tools/csvparser.js +78 -0
  667. data/lib/libv8/v8/tools/disasm.py +92 -0
  668. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  669. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  670. data/lib/libv8/v8/tools/gcmole/README +62 -0
  671. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  672. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  673. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  674. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  675. data/lib/libv8/v8/tools/grokdump.py +841 -0
  676. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  677. data/lib/libv8/v8/tools/js2c.py +364 -0
  678. data/lib/libv8/v8/tools/jsmin.py +280 -0
  679. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  680. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  681. data/lib/libv8/v8/tools/logreader.js +185 -0
  682. data/lib/libv8/v8/tools/mac-nm +18 -0
  683. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  684. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  685. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  686. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  687. data/lib/libv8/v8/tools/presubmit.py +305 -0
  688. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  689. data/lib/libv8/v8/tools/profile.js +751 -0
  690. data/lib/libv8/v8/tools/profile_view.js +219 -0
  691. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  692. data/lib/libv8/v8/tools/splaytree.js +316 -0
  693. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  694. data/lib/libv8/v8/tools/test.py +1510 -0
  695. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  696. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  697. data/lib/libv8/v8/tools/utils.py +96 -0
  698. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  699. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  700. data/lib/libv8/version.rb +6 -0
  701. data/libv8.gemspec +36 -0
  702. data/thefrontside.png +0 -0
  703. metadata +776 -0
@@ -0,0 +1,2382 @@
1
+ // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ // Handle id counters.
29
+ var next_handle_ = 0;
30
+ var next_transient_handle_ = -1;
31
+
32
+ // Mirror cache.
33
+ var mirror_cache_ = [];
34
+
35
+
36
+ /**
37
+ * Clear the mirror handle cache.
38
+ */
39
+ function ClearMirrorCache() {
40
+ next_handle_ = 0;
41
+ mirror_cache_ = [];
42
+ }
43
+
44
+
45
+ /**
46
+ * Returns the mirror for a specified value or object.
47
+ *
48
+ * @param {value or Object} value the value or object to retreive the mirror for
49
+ * @param {boolean} transient indicate whether this object is transient and
50
+ * should not be added to the mirror cache. The default is not transient.
51
+ * @returns {Mirror} the mirror reflects the passed value or object
52
+ */
53
+ function MakeMirror(value, opt_transient) {
54
+ var mirror;
55
+
56
+ // Look for non transient mirrors in the mirror cache.
57
+ if (!opt_transient) {
58
+ for (id in mirror_cache_) {
59
+ mirror = mirror_cache_[id];
60
+ if (mirror.value() === value) {
61
+ return mirror;
62
+ }
63
+ // Special check for NaN as NaN == NaN is false.
64
+ if (mirror.isNumber() && isNaN(mirror.value()) &&
65
+ typeof value == 'number' && isNaN(value)) {
66
+ return mirror;
67
+ }
68
+ }
69
+ }
70
+
71
+ if (IS_UNDEFINED(value)) {
72
+ mirror = new UndefinedMirror();
73
+ } else if (IS_NULL(value)) {
74
+ mirror = new NullMirror();
75
+ } else if (IS_BOOLEAN(value)) {
76
+ mirror = new BooleanMirror(value);
77
+ } else if (IS_NUMBER(value)) {
78
+ mirror = new NumberMirror(value);
79
+ } else if (IS_STRING(value)) {
80
+ mirror = new StringMirror(value);
81
+ } else if (IS_ARRAY(value)) {
82
+ mirror = new ArrayMirror(value);
83
+ } else if (IS_DATE(value)) {
84
+ mirror = new DateMirror(value);
85
+ } else if (IS_FUNCTION(value)) {
86
+ mirror = new FunctionMirror(value);
87
+ } else if (IS_REGEXP(value)) {
88
+ mirror = new RegExpMirror(value);
89
+ } else if (IS_ERROR(value)) {
90
+ mirror = new ErrorMirror(value);
91
+ } else if (IS_SCRIPT(value)) {
92
+ mirror = new ScriptMirror(value);
93
+ } else {
94
+ mirror = new ObjectMirror(value, OBJECT_TYPE, opt_transient);
95
+ }
96
+
97
+ mirror_cache_[mirror.handle()] = mirror;
98
+ return mirror;
99
+ }
100
+
101
+
102
+ /**
103
+ * Returns the mirror for a specified mirror handle.
104
+ *
105
+ * @param {number} handle the handle to find the mirror for
106
+ * @returns {Mirror or undefiend} the mirror with the requested handle or
107
+ * undefined if no mirror with the requested handle was found
108
+ */
109
+ function LookupMirror(handle) {
110
+ return mirror_cache_[handle];
111
+ }
112
+
113
+
114
+ /**
115
+ * Returns the mirror for the undefined value.
116
+ *
117
+ * @returns {Mirror} the mirror reflects the undefined value
118
+ */
119
+ function GetUndefinedMirror() {
120
+ return MakeMirror(void 0);
121
+ }
122
+
123
+
124
+ /**
125
+ * Inherit the prototype methods from one constructor into another.
126
+ *
127
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
128
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
129
+ * during bootstrapping this function needs to be revritten using some native
130
+ * functions as prototype setup using normal JavaScript does not work as
131
+ * expected during bootstrapping (see mirror.js in r114903).
132
+ *
133
+ * @param {function} ctor Constructor function which needs to inherit the
134
+ * prototype
135
+ * @param {function} superCtor Constructor function to inherit prototype from
136
+ */
137
+ function inherits(ctor, superCtor) {
138
+ var tempCtor = function(){};
139
+ tempCtor.prototype = superCtor.prototype;
140
+ ctor.super_ = superCtor.prototype;
141
+ ctor.prototype = new tempCtor();
142
+ ctor.prototype.constructor = ctor;
143
+ }
144
+
145
+
146
+ // Type names of the different mirrors.
147
+ const UNDEFINED_TYPE = 'undefined';
148
+ const NULL_TYPE = 'null';
149
+ const BOOLEAN_TYPE = 'boolean';
150
+ const NUMBER_TYPE = 'number';
151
+ const STRING_TYPE = 'string';
152
+ const OBJECT_TYPE = 'object';
153
+ const FUNCTION_TYPE = 'function';
154
+ const REGEXP_TYPE = 'regexp';
155
+ const ERROR_TYPE = 'error';
156
+ const PROPERTY_TYPE = 'property';
157
+ const FRAME_TYPE = 'frame';
158
+ const SCRIPT_TYPE = 'script';
159
+ const CONTEXT_TYPE = 'context';
160
+ const SCOPE_TYPE = 'scope';
161
+
162
+ // Maximum length when sending strings through the JSON protocol.
163
+ const kMaxProtocolStringLength = 80;
164
+
165
+ // Different kind of properties.
166
+ PropertyKind = {};
167
+ PropertyKind.Named = 1;
168
+ PropertyKind.Indexed = 2;
169
+
170
+
171
+ // A copy of the PropertyType enum from global.h
172
+ PropertyType = {};
173
+ PropertyType.Normal = 0;
174
+ PropertyType.Field = 1;
175
+ PropertyType.ConstantFunction = 2;
176
+ PropertyType.Callbacks = 3;
177
+ PropertyType.Handler = 4;
178
+ PropertyType.Interceptor = 5;
179
+ PropertyType.MapTransition = 6;
180
+ PropertyType.ExternalArrayTransition = 7;
181
+ PropertyType.ConstantTransition = 8;
182
+ PropertyType.NullDescriptor = 9;
183
+
184
+
185
+ // Different attributes for a property.
186
+ PropertyAttribute = {};
187
+ PropertyAttribute.None = NONE;
188
+ PropertyAttribute.ReadOnly = READ_ONLY;
189
+ PropertyAttribute.DontEnum = DONT_ENUM;
190
+ PropertyAttribute.DontDelete = DONT_DELETE;
191
+
192
+
193
+ // A copy of the scope types from runtime.cc.
194
+ ScopeType = { Global: 0,
195
+ Local: 1,
196
+ With: 2,
197
+ Closure: 3,
198
+ Catch: 4 };
199
+
200
+
201
+ // Mirror hierarchy:
202
+ // - Mirror
203
+ // - ValueMirror
204
+ // - UndefinedMirror
205
+ // - NullMirror
206
+ // - NumberMirror
207
+ // - StringMirror
208
+ // - ObjectMirror
209
+ // - FunctionMirror
210
+ // - UnresolvedFunctionMirror
211
+ // - ArrayMirror
212
+ // - DateMirror
213
+ // - RegExpMirror
214
+ // - ErrorMirror
215
+ // - PropertyMirror
216
+ // - FrameMirror
217
+ // - ScriptMirror
218
+
219
+
220
+ /**
221
+ * Base class for all mirror objects.
222
+ * @param {string} type The type of the mirror
223
+ * @constructor
224
+ */
225
+ function Mirror(type) {
226
+ this.type_ = type;
227
+ };
228
+
229
+
230
+ Mirror.prototype.type = function() {
231
+ return this.type_;
232
+ };
233
+
234
+
235
+ /**
236
+ * Check whether the mirror reflects a value.
237
+ * @returns {boolean} True if the mirror reflects a value.
238
+ */
239
+ Mirror.prototype.isValue = function() {
240
+ return this instanceof ValueMirror;
241
+ }
242
+
243
+
244
+ /**
245
+ * Check whether the mirror reflects the undefined value.
246
+ * @returns {boolean} True if the mirror reflects the undefined value.
247
+ */
248
+ Mirror.prototype.isUndefined = function() {
249
+ return this instanceof UndefinedMirror;
250
+ }
251
+
252
+
253
+ /**
254
+ * Check whether the mirror reflects the null value.
255
+ * @returns {boolean} True if the mirror reflects the null value
256
+ */
257
+ Mirror.prototype.isNull = function() {
258
+ return this instanceof NullMirror;
259
+ }
260
+
261
+
262
+ /**
263
+ * Check whether the mirror reflects a boolean value.
264
+ * @returns {boolean} True if the mirror reflects a boolean value
265
+ */
266
+ Mirror.prototype.isBoolean = function() {
267
+ return this instanceof BooleanMirror;
268
+ }
269
+
270
+
271
+ /**
272
+ * Check whether the mirror reflects a number value.
273
+ * @returns {boolean} True if the mirror reflects a number value
274
+ */
275
+ Mirror.prototype.isNumber = function() {
276
+ return this instanceof NumberMirror;
277
+ }
278
+
279
+
280
+ /**
281
+ * Check whether the mirror reflects a string value.
282
+ * @returns {boolean} True if the mirror reflects a string value
283
+ */
284
+ Mirror.prototype.isString = function() {
285
+ return this instanceof StringMirror;
286
+ }
287
+
288
+
289
+ /**
290
+ * Check whether the mirror reflects an object.
291
+ * @returns {boolean} True if the mirror reflects an object
292
+ */
293
+ Mirror.prototype.isObject = function() {
294
+ return this instanceof ObjectMirror;
295
+ }
296
+
297
+
298
+ /**
299
+ * Check whether the mirror reflects a function.
300
+ * @returns {boolean} True if the mirror reflects a function
301
+ */
302
+ Mirror.prototype.isFunction = function() {
303
+ return this instanceof FunctionMirror;
304
+ }
305
+
306
+
307
+ /**
308
+ * Check whether the mirror reflects an unresolved function.
309
+ * @returns {boolean} True if the mirror reflects an unresolved function
310
+ */
311
+ Mirror.prototype.isUnresolvedFunction = function() {
312
+ return this instanceof UnresolvedFunctionMirror;
313
+ }
314
+
315
+
316
+ /**
317
+ * Check whether the mirror reflects an array.
318
+ * @returns {boolean} True if the mirror reflects an array
319
+ */
320
+ Mirror.prototype.isArray = function() {
321
+ return this instanceof ArrayMirror;
322
+ }
323
+
324
+
325
+ /**
326
+ * Check whether the mirror reflects a date.
327
+ * @returns {boolean} True if the mirror reflects a date
328
+ */
329
+ Mirror.prototype.isDate = function() {
330
+ return this instanceof DateMirror;
331
+ }
332
+
333
+
334
+ /**
335
+ * Check whether the mirror reflects a regular expression.
336
+ * @returns {boolean} True if the mirror reflects a regular expression
337
+ */
338
+ Mirror.prototype.isRegExp = function() {
339
+ return this instanceof RegExpMirror;
340
+ }
341
+
342
+
343
+ /**
344
+ * Check whether the mirror reflects an error.
345
+ * @returns {boolean} True if the mirror reflects an error
346
+ */
347
+ Mirror.prototype.isError = function() {
348
+ return this instanceof ErrorMirror;
349
+ }
350
+
351
+
352
+ /**
353
+ * Check whether the mirror reflects a property.
354
+ * @returns {boolean} True if the mirror reflects a property
355
+ */
356
+ Mirror.prototype.isProperty = function() {
357
+ return this instanceof PropertyMirror;
358
+ }
359
+
360
+
361
+ /**
362
+ * Check whether the mirror reflects a stack frame.
363
+ * @returns {boolean} True if the mirror reflects a stack frame
364
+ */
365
+ Mirror.prototype.isFrame = function() {
366
+ return this instanceof FrameMirror;
367
+ }
368
+
369
+
370
+ /**
371
+ * Check whether the mirror reflects a script.
372
+ * @returns {boolean} True if the mirror reflects a script
373
+ */
374
+ Mirror.prototype.isScript = function() {
375
+ return this instanceof ScriptMirror;
376
+ }
377
+
378
+
379
+ /**
380
+ * Check whether the mirror reflects a context.
381
+ * @returns {boolean} True if the mirror reflects a context
382
+ */
383
+ Mirror.prototype.isContext = function() {
384
+ return this instanceof ContextMirror;
385
+ }
386
+
387
+
388
+ /**
389
+ * Check whether the mirror reflects a scope.
390
+ * @returns {boolean} True if the mirror reflects a scope
391
+ */
392
+ Mirror.prototype.isScope = function() {
393
+ return this instanceof ScopeMirror;
394
+ }
395
+
396
+
397
+ /**
398
+ * Allocate a handle id for this object.
399
+ */
400
+ Mirror.prototype.allocateHandle_ = function() {
401
+ this.handle_ = next_handle_++;
402
+ }
403
+
404
+
405
+ /**
406
+ * Allocate a transient handle id for this object. Transient handles are
407
+ * negative.
408
+ */
409
+ Mirror.prototype.allocateTransientHandle_ = function() {
410
+ this.handle_ = next_transient_handle_--;
411
+ }
412
+
413
+
414
+ Mirror.prototype.toText = function() {
415
+ // Simpel to text which is used when on specialization in subclass.
416
+ return "#<" + this.constructor.name + ">";
417
+ }
418
+
419
+
420
+ /**
421
+ * Base class for all value mirror objects.
422
+ * @param {string} type The type of the mirror
423
+ * @param {value} value The value reflected by this mirror
424
+ * @param {boolean} transient indicate whether this object is transient with a
425
+ * transient handle
426
+ * @constructor
427
+ * @extends Mirror
428
+ */
429
+ function ValueMirror(type, value, transient) {
430
+ %_CallFunction(this, type, Mirror);
431
+ this.value_ = value;
432
+ if (!transient) {
433
+ this.allocateHandle_();
434
+ } else {
435
+ this.allocateTransientHandle_();
436
+ }
437
+ }
438
+ inherits(ValueMirror, Mirror);
439
+
440
+
441
+ Mirror.prototype.handle = function() {
442
+ return this.handle_;
443
+ };
444
+
445
+
446
+ /**
447
+ * Check whether this is a primitive value.
448
+ * @return {boolean} True if the mirror reflects a primitive value
449
+ */
450
+ ValueMirror.prototype.isPrimitive = function() {
451
+ var type = this.type();
452
+ return type === 'undefined' ||
453
+ type === 'null' ||
454
+ type === 'boolean' ||
455
+ type === 'number' ||
456
+ type === 'string';
457
+ };
458
+
459
+
460
+ /**
461
+ * Get the actual value reflected by this mirror.
462
+ * @return {value} The value reflected by this mirror
463
+ */
464
+ ValueMirror.prototype.value = function() {
465
+ return this.value_;
466
+ };
467
+
468
+
469
+ /**
470
+ * Mirror object for Undefined.
471
+ * @constructor
472
+ * @extends ValueMirror
473
+ */
474
+ function UndefinedMirror() {
475
+ %_CallFunction(this, UNDEFINED_TYPE, void 0, ValueMirror);
476
+ }
477
+ inherits(UndefinedMirror, ValueMirror);
478
+
479
+
480
+ UndefinedMirror.prototype.toText = function() {
481
+ return 'undefined';
482
+ }
483
+
484
+
485
+ /**
486
+ * Mirror object for null.
487
+ * @constructor
488
+ * @extends ValueMirror
489
+ */
490
+ function NullMirror() {
491
+ %_CallFunction(this, NULL_TYPE, null, ValueMirror);
492
+ }
493
+ inherits(NullMirror, ValueMirror);
494
+
495
+
496
+ NullMirror.prototype.toText = function() {
497
+ return 'null';
498
+ }
499
+
500
+
501
+ /**
502
+ * Mirror object for boolean values.
503
+ * @param {boolean} value The boolean value reflected by this mirror
504
+ * @constructor
505
+ * @extends ValueMirror
506
+ */
507
+ function BooleanMirror(value) {
508
+ %_CallFunction(this, BOOLEAN_TYPE, value, ValueMirror);
509
+ }
510
+ inherits(BooleanMirror, ValueMirror);
511
+
512
+
513
+ BooleanMirror.prototype.toText = function() {
514
+ return this.value_ ? 'true' : 'false';
515
+ }
516
+
517
+
518
+ /**
519
+ * Mirror object for number values.
520
+ * @param {number} value The number value reflected by this mirror
521
+ * @constructor
522
+ * @extends ValueMirror
523
+ */
524
+ function NumberMirror(value) {
525
+ %_CallFunction(this, NUMBER_TYPE, value, ValueMirror);
526
+ }
527
+ inherits(NumberMirror, ValueMirror);
528
+
529
+
530
+ NumberMirror.prototype.toText = function() {
531
+ return %NumberToString(this.value_);
532
+ }
533
+
534
+
535
+ /**
536
+ * Mirror object for string values.
537
+ * @param {string} value The string value reflected by this mirror
538
+ * @constructor
539
+ * @extends ValueMirror
540
+ */
541
+ function StringMirror(value) {
542
+ %_CallFunction(this, STRING_TYPE, value, ValueMirror);
543
+ }
544
+ inherits(StringMirror, ValueMirror);
545
+
546
+
547
+ StringMirror.prototype.length = function() {
548
+ return this.value_.length;
549
+ };
550
+
551
+ StringMirror.prototype.getTruncatedValue = function(maxLength) {
552
+ if (maxLength != -1 && this.length() > maxLength) {
553
+ return this.value_.substring(0, maxLength) +
554
+ '... (length: ' + this.length() + ')';
555
+ }
556
+ return this.value_;
557
+ }
558
+
559
+ StringMirror.prototype.toText = function() {
560
+ return this.getTruncatedValue(kMaxProtocolStringLength);
561
+ }
562
+
563
+
564
+ /**
565
+ * Mirror object for objects.
566
+ * @param {object} value The object reflected by this mirror
567
+ * @param {boolean} transient indicate whether this object is transient with a
568
+ * transient handle
569
+ * @constructor
570
+ * @extends ValueMirror
571
+ */
572
+ function ObjectMirror(value, type, transient) {
573
+ %_CallFunction(this, type || OBJECT_TYPE, value, transient, ValueMirror);
574
+ }
575
+ inherits(ObjectMirror, ValueMirror);
576
+
577
+
578
+ ObjectMirror.prototype.className = function() {
579
+ return %_ClassOf(this.value_);
580
+ };
581
+
582
+
583
+ ObjectMirror.prototype.constructorFunction = function() {
584
+ return MakeMirror(%DebugGetProperty(this.value_, 'constructor'));
585
+ };
586
+
587
+
588
+ ObjectMirror.prototype.prototypeObject = function() {
589
+ return MakeMirror(%DebugGetProperty(this.value_, 'prototype'));
590
+ };
591
+
592
+
593
+ ObjectMirror.prototype.protoObject = function() {
594
+ return MakeMirror(%DebugGetPrototype(this.value_));
595
+ };
596
+
597
+
598
+ ObjectMirror.prototype.hasNamedInterceptor = function() {
599
+ // Get information on interceptors for this object.
600
+ var x = %GetInterceptorInfo(this.value_);
601
+ return (x & 2) != 0;
602
+ };
603
+
604
+
605
+ ObjectMirror.prototype.hasIndexedInterceptor = function() {
606
+ // Get information on interceptors for this object.
607
+ var x = %GetInterceptorInfo(this.value_);
608
+ return (x & 1) != 0;
609
+ };
610
+
611
+
612
+ /**
613
+ * Return the property names for this object.
614
+ * @param {number} kind Indicate whether named, indexed or both kinds of
615
+ * properties are requested
616
+ * @param {number} limit Limit the number of names returend to the specified
617
+ value
618
+ * @return {Array} Property names for this object
619
+ */
620
+ ObjectMirror.prototype.propertyNames = function(kind, limit) {
621
+ // Find kind and limit and allocate array for the result
622
+ kind = kind || PropertyKind.Named | PropertyKind.Indexed;
623
+
624
+ var propertyNames;
625
+ var elementNames;
626
+ var total = 0;
627
+
628
+ // Find all the named properties.
629
+ if (kind & PropertyKind.Named) {
630
+ // Get the local property names.
631
+ propertyNames = %GetLocalPropertyNames(this.value_);
632
+ total += propertyNames.length;
633
+
634
+ // Get names for named interceptor properties if any.
635
+ if (this.hasNamedInterceptor() && (kind & PropertyKind.Named)) {
636
+ var namedInterceptorNames =
637
+ %GetNamedInterceptorPropertyNames(this.value_);
638
+ if (namedInterceptorNames) {
639
+ propertyNames = propertyNames.concat(namedInterceptorNames);
640
+ total += namedInterceptorNames.length;
641
+ }
642
+ }
643
+ }
644
+
645
+ // Find all the indexed properties.
646
+ if (kind & PropertyKind.Indexed) {
647
+ // Get the local element names.
648
+ elementNames = %GetLocalElementNames(this.value_);
649
+ total += elementNames.length;
650
+
651
+ // Get names for indexed interceptor properties.
652
+ if (this.hasIndexedInterceptor() && (kind & PropertyKind.Indexed)) {
653
+ var indexedInterceptorNames =
654
+ %GetIndexedInterceptorElementNames(this.value_);
655
+ if (indexedInterceptorNames) {
656
+ elementNames = elementNames.concat(indexedInterceptorNames);
657
+ total += indexedInterceptorNames.length;
658
+ }
659
+ }
660
+ }
661
+ limit = Math.min(limit || total, total);
662
+
663
+ var names = new Array(limit);
664
+ var index = 0;
665
+
666
+ // Copy names for named properties.
667
+ if (kind & PropertyKind.Named) {
668
+ for (var i = 0; index < limit && i < propertyNames.length; i++) {
669
+ names[index++] = propertyNames[i];
670
+ }
671
+ }
672
+
673
+ // Copy names for indexed properties.
674
+ if (kind & PropertyKind.Indexed) {
675
+ for (var i = 0; index < limit && i < elementNames.length; i++) {
676
+ names[index++] = elementNames[i];
677
+ }
678
+ }
679
+
680
+ return names;
681
+ };
682
+
683
+
684
+ /**
685
+ * Return the properties for this object as an array of PropertyMirror objects.
686
+ * @param {number} kind Indicate whether named, indexed or both kinds of
687
+ * properties are requested
688
+ * @param {number} limit Limit the number of properties returend to the
689
+ specified value
690
+ * @return {Array} Property mirrors for this object
691
+ */
692
+ ObjectMirror.prototype.properties = function(kind, limit) {
693
+ var names = this.propertyNames(kind, limit);
694
+ var properties = new Array(names.length);
695
+ for (var i = 0; i < names.length; i++) {
696
+ properties[i] = this.property(names[i]);
697
+ }
698
+
699
+ return properties;
700
+ };
701
+
702
+
703
+ ObjectMirror.prototype.property = function(name) {
704
+ var details = %DebugGetPropertyDetails(this.value_, %ToString(name));
705
+ if (details) {
706
+ return new PropertyMirror(this, name, details);
707
+ }
708
+
709
+ // Nothing found.
710
+ return GetUndefinedMirror();
711
+ };
712
+
713
+
714
+
715
+ /**
716
+ * Try to find a property from its value.
717
+ * @param {Mirror} value The property value to look for
718
+ * @return {PropertyMirror} The property with the specified value. If no
719
+ * property was found with the specified value UndefinedMirror is returned
720
+ */
721
+ ObjectMirror.prototype.lookupProperty = function(value) {
722
+ var properties = this.properties();
723
+
724
+ // Look for property value in properties.
725
+ for (var i = 0; i < properties.length; i++) {
726
+
727
+ // Skip properties which are defined through assessors.
728
+ var property = properties[i];
729
+ if (property.propertyType() != PropertyType.Callbacks) {
730
+ if (%_ObjectEquals(property.value_, value.value_)) {
731
+ return property;
732
+ }
733
+ }
734
+ }
735
+
736
+ // Nothing found.
737
+ return GetUndefinedMirror();
738
+ };
739
+
740
+
741
+ /**
742
+ * Returns objects which has direct references to this object
743
+ * @param {number} opt_max_objects Optional parameter specifying the maximum
744
+ * number of referencing objects to return.
745
+ * @return {Array} The objects which has direct references to this object.
746
+ */
747
+ ObjectMirror.prototype.referencedBy = function(opt_max_objects) {
748
+ // Find all objects with direct references to this object.
749
+ var result = %DebugReferencedBy(this.value_,
750
+ Mirror.prototype, opt_max_objects || 0);
751
+
752
+ // Make mirrors for all the references found.
753
+ for (var i = 0; i < result.length; i++) {
754
+ result[i] = MakeMirror(result[i]);
755
+ }
756
+
757
+ return result;
758
+ };
759
+
760
+
761
+ ObjectMirror.prototype.toText = function() {
762
+ var name;
763
+ var ctor = this.constructorFunction();
764
+ if (!ctor.isFunction()) {
765
+ name = this.className();
766
+ } else {
767
+ name = ctor.name();
768
+ if (!name) {
769
+ name = this.className();
770
+ }
771
+ }
772
+ return '#<' + name + '>';
773
+ };
774
+
775
+
776
+ /**
777
+ * Mirror object for functions.
778
+ * @param {function} value The function object reflected by this mirror.
779
+ * @constructor
780
+ * @extends ObjectMirror
781
+ */
782
+ function FunctionMirror(value) {
783
+ %_CallFunction(this, value, FUNCTION_TYPE, ObjectMirror);
784
+ this.resolved_ = true;
785
+ }
786
+ inherits(FunctionMirror, ObjectMirror);
787
+
788
+
789
+ /**
790
+ * Returns whether the function is resolved.
791
+ * @return {boolean} True if the function is resolved. Unresolved functions can
792
+ * only originate as functions from stack frames
793
+ */
794
+ FunctionMirror.prototype.resolved = function() {
795
+ return this.resolved_;
796
+ };
797
+
798
+
799
+ /**
800
+ * Returns the name of the function.
801
+ * @return {string} Name of the function
802
+ */
803
+ FunctionMirror.prototype.name = function() {
804
+ return %FunctionGetName(this.value_);
805
+ };
806
+
807
+
808
+ /**
809
+ * Returns the inferred name of the function.
810
+ * @return {string} Name of the function
811
+ */
812
+ FunctionMirror.prototype.inferredName = function() {
813
+ return %FunctionGetInferredName(this.value_);
814
+ };
815
+
816
+
817
+ /**
818
+ * Returns the source code for the function.
819
+ * @return {string or undefined} The source code for the function. If the
820
+ * function is not resolved undefined will be returned.
821
+ */
822
+ FunctionMirror.prototype.source = function() {
823
+ // Return source if function is resolved. Otherwise just fall through to
824
+ // return undefined.
825
+ if (this.resolved()) {
826
+ return builtins.FunctionSourceString(this.value_);
827
+ }
828
+ };
829
+
830
+
831
+ /**
832
+ * Returns the script object for the function.
833
+ * @return {ScriptMirror or undefined} Script object for the function or
834
+ * undefined if the function has no script
835
+ */
836
+ FunctionMirror.prototype.script = function() {
837
+ // Return script if function is resolved. Otherwise just fall through
838
+ // to return undefined.
839
+ if (this.resolved()) {
840
+ var script = %FunctionGetScript(this.value_);
841
+ if (script) {
842
+ return MakeMirror(script);
843
+ }
844
+ }
845
+ };
846
+
847
+
848
+ /**
849
+ * Returns the script source position for the function. Only makes sense
850
+ * for functions which has a script defined.
851
+ * @return {Number or undefined} in-script position for the function
852
+ */
853
+ FunctionMirror.prototype.sourcePosition_ = function() {
854
+ // Return script if function is resolved. Otherwise just fall through
855
+ // to return undefined.
856
+ if (this.resolved()) {
857
+ return %FunctionGetScriptSourcePosition(this.value_);
858
+ }
859
+ };
860
+
861
+
862
+ /**
863
+ * Returns the script source location object for the function. Only makes sense
864
+ * for functions which has a script defined.
865
+ * @return {Location or undefined} in-script location for the function begin
866
+ */
867
+ FunctionMirror.prototype.sourceLocation = function() {
868
+ if (this.resolved() && this.script()) {
869
+ return this.script().locationFromPosition(this.sourcePosition_(),
870
+ true);
871
+ }
872
+ };
873
+
874
+
875
+ /**
876
+ * Returns objects constructed by this function.
877
+ * @param {number} opt_max_instances Optional parameter specifying the maximum
878
+ * number of instances to return.
879
+ * @return {Array or undefined} The objects constructed by this function.
880
+ */
881
+ FunctionMirror.prototype.constructedBy = function(opt_max_instances) {
882
+ if (this.resolved()) {
883
+ // Find all objects constructed from this function.
884
+ var result = %DebugConstructedBy(this.value_, opt_max_instances || 0);
885
+
886
+ // Make mirrors for all the instances found.
887
+ for (var i = 0; i < result.length; i++) {
888
+ result[i] = MakeMirror(result[i]);
889
+ }
890
+
891
+ return result;
892
+ } else {
893
+ return [];
894
+ }
895
+ };
896
+
897
+
898
+ FunctionMirror.prototype.toText = function() {
899
+ return this.source();
900
+ }
901
+
902
+
903
+ /**
904
+ * Mirror object for unresolved functions.
905
+ * @param {string} value The name for the unresolved function reflected by this
906
+ * mirror.
907
+ * @constructor
908
+ * @extends ObjectMirror
909
+ */
910
+ function UnresolvedFunctionMirror(value) {
911
+ // Construct this using the ValueMirror as an unresolved function is not a
912
+ // real object but just a string.
913
+ %_CallFunction(this, FUNCTION_TYPE, value, ValueMirror);
914
+ this.propertyCount_ = 0;
915
+ this.elementCount_ = 0;
916
+ this.resolved_ = false;
917
+ }
918
+ inherits(UnresolvedFunctionMirror, FunctionMirror);
919
+
920
+
921
+ UnresolvedFunctionMirror.prototype.className = function() {
922
+ return 'Function';
923
+ };
924
+
925
+
926
+ UnresolvedFunctionMirror.prototype.constructorFunction = function() {
927
+ return GetUndefinedMirror();
928
+ };
929
+
930
+
931
+ UnresolvedFunctionMirror.prototype.prototypeObject = function() {
932
+ return GetUndefinedMirror();
933
+ };
934
+
935
+
936
+ UnresolvedFunctionMirror.prototype.protoObject = function() {
937
+ return GetUndefinedMirror();
938
+ };
939
+
940
+
941
+ UnresolvedFunctionMirror.prototype.name = function() {
942
+ return this.value_;
943
+ };
944
+
945
+
946
+ UnresolvedFunctionMirror.prototype.inferredName = function() {
947
+ return undefined;
948
+ };
949
+
950
+
951
+ UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) {
952
+ return [];
953
+ }
954
+
955
+
956
+ /**
957
+ * Mirror object for arrays.
958
+ * @param {Array} value The Array object reflected by this mirror
959
+ * @constructor
960
+ * @extends ObjectMirror
961
+ */
962
+ function ArrayMirror(value) {
963
+ %_CallFunction(this, value, ObjectMirror);
964
+ }
965
+ inherits(ArrayMirror, ObjectMirror);
966
+
967
+
968
+ ArrayMirror.prototype.length = function() {
969
+ return this.value_.length;
970
+ };
971
+
972
+
973
+ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, opt_to_index) {
974
+ var from_index = opt_from_index || 0;
975
+ var to_index = opt_to_index || this.length() - 1;
976
+ if (from_index > to_index) return new Array();
977
+ var values = new Array(to_index - from_index + 1);
978
+ for (var i = from_index; i <= to_index; i++) {
979
+ var details = %DebugGetPropertyDetails(this.value_, %ToString(i));
980
+ var value;
981
+ if (details) {
982
+ value = new PropertyMirror(this, i, details);
983
+ } else {
984
+ value = GetUndefinedMirror();
985
+ }
986
+ values[i - from_index] = value;
987
+ }
988
+ return values;
989
+ }
990
+
991
+
992
+ /**
993
+ * Mirror object for dates.
994
+ * @param {Date} value The Date object reflected by this mirror
995
+ * @constructor
996
+ * @extends ObjectMirror
997
+ */
998
+ function DateMirror(value) {
999
+ %_CallFunction(this, value, ObjectMirror);
1000
+ }
1001
+ inherits(DateMirror, ObjectMirror);
1002
+
1003
+
1004
+ DateMirror.prototype.toText = function() {
1005
+ var s = JSON.stringify(this.value_);
1006
+ return s.substring(1, s.length - 1); // cut quotes
1007
+ }
1008
+
1009
+
1010
+ /**
1011
+ * Mirror object for regular expressions.
1012
+ * @param {RegExp} value The RegExp object reflected by this mirror
1013
+ * @constructor
1014
+ * @extends ObjectMirror
1015
+ */
1016
+ function RegExpMirror(value) {
1017
+ %_CallFunction(this, value, REGEXP_TYPE, ObjectMirror);
1018
+ }
1019
+ inherits(RegExpMirror, ObjectMirror);
1020
+
1021
+
1022
+ /**
1023
+ * Returns the source to the regular expression.
1024
+ * @return {string or undefined} The source to the regular expression
1025
+ */
1026
+ RegExpMirror.prototype.source = function() {
1027
+ return this.value_.source;
1028
+ };
1029
+
1030
+
1031
+ /**
1032
+ * Returns whether this regular expression has the global (g) flag set.
1033
+ * @return {boolean} Value of the global flag
1034
+ */
1035
+ RegExpMirror.prototype.global = function() {
1036
+ return this.value_.global;
1037
+ };
1038
+
1039
+
1040
+ /**
1041
+ * Returns whether this regular expression has the ignore case (i) flag set.
1042
+ * @return {boolean} Value of the ignore case flag
1043
+ */
1044
+ RegExpMirror.prototype.ignoreCase = function() {
1045
+ return this.value_.ignoreCase;
1046
+ };
1047
+
1048
+
1049
+ /**
1050
+ * Returns whether this regular expression has the multiline (m) flag set.
1051
+ * @return {boolean} Value of the multiline flag
1052
+ */
1053
+ RegExpMirror.prototype.multiline = function() {
1054
+ return this.value_.multiline;
1055
+ };
1056
+
1057
+
1058
+ RegExpMirror.prototype.toText = function() {
1059
+ // Simpel to text which is used when on specialization in subclass.
1060
+ return "/" + this.source() + "/";
1061
+ }
1062
+
1063
+
1064
+ /**
1065
+ * Mirror object for error objects.
1066
+ * @param {Error} value The error object reflected by this mirror
1067
+ * @constructor
1068
+ * @extends ObjectMirror
1069
+ */
1070
+ function ErrorMirror(value) {
1071
+ %_CallFunction(this, value, ERROR_TYPE, ObjectMirror);
1072
+ }
1073
+ inherits(ErrorMirror, ObjectMirror);
1074
+
1075
+
1076
+ /**
1077
+ * Returns the message for this eror object.
1078
+ * @return {string or undefined} The message for this eror object
1079
+ */
1080
+ ErrorMirror.prototype.message = function() {
1081
+ return this.value_.message;
1082
+ };
1083
+
1084
+
1085
+ ErrorMirror.prototype.toText = function() {
1086
+ // Use the same text representation as in messages.js.
1087
+ var text;
1088
+ try {
1089
+ str = %_CallFunction(this.value_, builtins.errorToString);
1090
+ } catch (e) {
1091
+ str = '#<Error>';
1092
+ }
1093
+ return str;
1094
+ }
1095
+
1096
+
1097
+ /**
1098
+ * Base mirror object for properties.
1099
+ * @param {ObjectMirror} mirror The mirror object having this property
1100
+ * @param {string} name The name of the property
1101
+ * @param {Array} details Details about the property
1102
+ * @constructor
1103
+ * @extends Mirror
1104
+ */
1105
+ function PropertyMirror(mirror, name, details) {
1106
+ %_CallFunction(this, PROPERTY_TYPE, Mirror);
1107
+ this.mirror_ = mirror;
1108
+ this.name_ = name;
1109
+ this.value_ = details[0];
1110
+ this.details_ = details[1];
1111
+ if (details.length > 2) {
1112
+ this.exception_ = details[2]
1113
+ this.getter_ = details[3];
1114
+ this.setter_ = details[4];
1115
+ }
1116
+ }
1117
+ inherits(PropertyMirror, Mirror);
1118
+
1119
+
1120
+ PropertyMirror.prototype.isReadOnly = function() {
1121
+ return (this.attributes() & PropertyAttribute.ReadOnly) != 0;
1122
+ }
1123
+
1124
+
1125
+ PropertyMirror.prototype.isEnum = function() {
1126
+ return (this.attributes() & PropertyAttribute.DontEnum) == 0;
1127
+ }
1128
+
1129
+
1130
+ PropertyMirror.prototype.canDelete = function() {
1131
+ return (this.attributes() & PropertyAttribute.DontDelete) == 0;
1132
+ }
1133
+
1134
+
1135
+ PropertyMirror.prototype.name = function() {
1136
+ return this.name_;
1137
+ }
1138
+
1139
+
1140
+ PropertyMirror.prototype.isIndexed = function() {
1141
+ for (var i = 0; i < this.name_.length; i++) {
1142
+ if (this.name_[i] < '0' || '9' < this.name_[i]) {
1143
+ return false;
1144
+ }
1145
+ }
1146
+ return true;
1147
+ }
1148
+
1149
+
1150
+ PropertyMirror.prototype.value = function() {
1151
+ return MakeMirror(this.value_, false);
1152
+ }
1153
+
1154
+
1155
+ /**
1156
+ * Returns whether this property value is an exception.
1157
+ * @return {booolean} True if this property value is an exception
1158
+ */
1159
+ PropertyMirror.prototype.isException = function() {
1160
+ return this.exception_ ? true : false;
1161
+ }
1162
+
1163
+
1164
+ PropertyMirror.prototype.attributes = function() {
1165
+ return %DebugPropertyAttributesFromDetails(this.details_);
1166
+ }
1167
+
1168
+
1169
+ PropertyMirror.prototype.propertyType = function() {
1170
+ return %DebugPropertyTypeFromDetails(this.details_);
1171
+ }
1172
+
1173
+
1174
+ PropertyMirror.prototype.insertionIndex = function() {
1175
+ return %DebugPropertyIndexFromDetails(this.details_);
1176
+ }
1177
+
1178
+
1179
+ /**
1180
+ * Returns whether this property has a getter defined through __defineGetter__.
1181
+ * @return {booolean} True if this property has a getter
1182
+ */
1183
+ PropertyMirror.prototype.hasGetter = function() {
1184
+ return this.getter_ ? true : false;
1185
+ }
1186
+
1187
+
1188
+ /**
1189
+ * Returns whether this property has a setter defined through __defineSetter__.
1190
+ * @return {booolean} True if this property has a setter
1191
+ */
1192
+ PropertyMirror.prototype.hasSetter = function() {
1193
+ return this.setter_ ? true : false;
1194
+ }
1195
+
1196
+
1197
+ /**
1198
+ * Returns the getter for this property defined through __defineGetter__.
1199
+ * @return {Mirror} FunctionMirror reflecting the getter function or
1200
+ * UndefinedMirror if there is no getter for this property
1201
+ */
1202
+ PropertyMirror.prototype.getter = function() {
1203
+ if (this.hasGetter()) {
1204
+ return MakeMirror(this.getter_);
1205
+ } else {
1206
+ return GetUndefinedMirror();
1207
+ }
1208
+ }
1209
+
1210
+
1211
+ /**
1212
+ * Returns the setter for this property defined through __defineSetter__.
1213
+ * @return {Mirror} FunctionMirror reflecting the setter function or
1214
+ * UndefinedMirror if there is no setter for this property
1215
+ */
1216
+ PropertyMirror.prototype.setter = function() {
1217
+ if (this.hasSetter()) {
1218
+ return MakeMirror(this.setter_);
1219
+ } else {
1220
+ return GetUndefinedMirror();
1221
+ }
1222
+ }
1223
+
1224
+
1225
+ /**
1226
+ * Returns whether this property is natively implemented by the host or a set
1227
+ * through JavaScript code.
1228
+ * @return {boolean} True if the property is
1229
+ * UndefinedMirror if there is no setter for this property
1230
+ */
1231
+ PropertyMirror.prototype.isNative = function() {
1232
+ return (this.propertyType() == PropertyType.Interceptor) ||
1233
+ ((this.propertyType() == PropertyType.Callbacks) &&
1234
+ !this.hasGetter() && !this.hasSetter());
1235
+ }
1236
+
1237
+
1238
+ const kFrameDetailsFrameIdIndex = 0;
1239
+ const kFrameDetailsReceiverIndex = 1;
1240
+ const kFrameDetailsFunctionIndex = 2;
1241
+ const kFrameDetailsArgumentCountIndex = 3;
1242
+ const kFrameDetailsLocalCountIndex = 4;
1243
+ const kFrameDetailsSourcePositionIndex = 5;
1244
+ const kFrameDetailsConstructCallIndex = 6;
1245
+ const kFrameDetailsAtReturnIndex = 7;
1246
+ const kFrameDetailsDebuggerFrameIndex = 8;
1247
+ const kFrameDetailsFirstDynamicIndex = 9;
1248
+
1249
+ const kFrameDetailsNameIndex = 0;
1250
+ const kFrameDetailsValueIndex = 1;
1251
+ const kFrameDetailsNameValueSize = 2;
1252
+
1253
+ /**
1254
+ * Wrapper for the frame details information retreived from the VM. The frame
1255
+ * details from the VM is an array with the following content. See runtime.cc
1256
+ * Runtime_GetFrameDetails.
1257
+ * 0: Id
1258
+ * 1: Receiver
1259
+ * 2: Function
1260
+ * 3: Argument count
1261
+ * 4: Local count
1262
+ * 5: Source position
1263
+ * 6: Construct call
1264
+ * 7: Is at return
1265
+ * 8: Debugger frame
1266
+ * Arguments name, value
1267
+ * Locals name, value
1268
+ * Return value if any
1269
+ * @param {number} break_id Current break id
1270
+ * @param {number} index Frame number
1271
+ * @constructor
1272
+ */
1273
+ function FrameDetails(break_id, index) {
1274
+ this.break_id_ = break_id;
1275
+ this.details_ = %GetFrameDetails(break_id, index);
1276
+ }
1277
+
1278
+
1279
+ FrameDetails.prototype.frameId = function() {
1280
+ %CheckExecutionState(this.break_id_);
1281
+ return this.details_[kFrameDetailsFrameIdIndex];
1282
+ }
1283
+
1284
+
1285
+ FrameDetails.prototype.receiver = function() {
1286
+ %CheckExecutionState(this.break_id_);
1287
+ return this.details_[kFrameDetailsReceiverIndex];
1288
+ }
1289
+
1290
+
1291
+ FrameDetails.prototype.func = function() {
1292
+ %CheckExecutionState(this.break_id_);
1293
+ return this.details_[kFrameDetailsFunctionIndex];
1294
+ }
1295
+
1296
+
1297
+ FrameDetails.prototype.isConstructCall = function() {
1298
+ %CheckExecutionState(this.break_id_);
1299
+ return this.details_[kFrameDetailsConstructCallIndex];
1300
+ }
1301
+
1302
+
1303
+ FrameDetails.prototype.isAtReturn = function() {
1304
+ %CheckExecutionState(this.break_id_);
1305
+ return this.details_[kFrameDetailsAtReturnIndex];
1306
+ }
1307
+
1308
+
1309
+ FrameDetails.prototype.isDebuggerFrame = function() {
1310
+ %CheckExecutionState(this.break_id_);
1311
+ return this.details_[kFrameDetailsDebuggerFrameIndex];
1312
+ }
1313
+
1314
+
1315
+ FrameDetails.prototype.argumentCount = function() {
1316
+ %CheckExecutionState(this.break_id_);
1317
+ return this.details_[kFrameDetailsArgumentCountIndex];
1318
+ }
1319
+
1320
+
1321
+ FrameDetails.prototype.argumentName = function(index) {
1322
+ %CheckExecutionState(this.break_id_);
1323
+ if (index >= 0 && index < this.argumentCount()) {
1324
+ return this.details_[kFrameDetailsFirstDynamicIndex +
1325
+ index * kFrameDetailsNameValueSize +
1326
+ kFrameDetailsNameIndex]
1327
+ }
1328
+ }
1329
+
1330
+
1331
+ FrameDetails.prototype.argumentValue = function(index) {
1332
+ %CheckExecutionState(this.break_id_);
1333
+ if (index >= 0 && index < this.argumentCount()) {
1334
+ return this.details_[kFrameDetailsFirstDynamicIndex +
1335
+ index * kFrameDetailsNameValueSize +
1336
+ kFrameDetailsValueIndex]
1337
+ }
1338
+ }
1339
+
1340
+
1341
+ FrameDetails.prototype.localCount = function() {
1342
+ %CheckExecutionState(this.break_id_);
1343
+ return this.details_[kFrameDetailsLocalCountIndex];
1344
+ }
1345
+
1346
+
1347
+ FrameDetails.prototype.sourcePosition = function() {
1348
+ %CheckExecutionState(this.break_id_);
1349
+ return this.details_[kFrameDetailsSourcePositionIndex];
1350
+ }
1351
+
1352
+
1353
+ FrameDetails.prototype.localName = function(index) {
1354
+ %CheckExecutionState(this.break_id_);
1355
+ if (index >= 0 && index < this.localCount()) {
1356
+ var locals_offset = kFrameDetailsFirstDynamicIndex +
1357
+ this.argumentCount() * kFrameDetailsNameValueSize
1358
+ return this.details_[locals_offset +
1359
+ index * kFrameDetailsNameValueSize +
1360
+ kFrameDetailsNameIndex]
1361
+ }
1362
+ }
1363
+
1364
+
1365
+ FrameDetails.prototype.localValue = function(index) {
1366
+ %CheckExecutionState(this.break_id_);
1367
+ if (index >= 0 && index < this.localCount()) {
1368
+ var locals_offset = kFrameDetailsFirstDynamicIndex +
1369
+ this.argumentCount() * kFrameDetailsNameValueSize
1370
+ return this.details_[locals_offset +
1371
+ index * kFrameDetailsNameValueSize +
1372
+ kFrameDetailsValueIndex]
1373
+ }
1374
+ }
1375
+
1376
+
1377
+ FrameDetails.prototype.returnValue = function() {
1378
+ %CheckExecutionState(this.break_id_);
1379
+ var return_value_offset =
1380
+ kFrameDetailsFirstDynamicIndex +
1381
+ (this.argumentCount() + this.localCount()) * kFrameDetailsNameValueSize;
1382
+ if (this.details_[kFrameDetailsAtReturnIndex]) {
1383
+ return this.details_[return_value_offset];
1384
+ }
1385
+ }
1386
+
1387
+
1388
+ FrameDetails.prototype.scopeCount = function() {
1389
+ return %GetScopeCount(this.break_id_, this.frameId());
1390
+ }
1391
+
1392
+
1393
+ /**
1394
+ * Mirror object for stack frames.
1395
+ * @param {number} break_id The break id in the VM for which this frame is
1396
+ valid
1397
+ * @param {number} index The frame index (top frame is index 0)
1398
+ * @constructor
1399
+ * @extends Mirror
1400
+ */
1401
+ function FrameMirror(break_id, index) {
1402
+ %_CallFunction(this, FRAME_TYPE, Mirror);
1403
+ this.break_id_ = break_id;
1404
+ this.index_ = index;
1405
+ this.details_ = new FrameDetails(break_id, index);
1406
+ }
1407
+ inherits(FrameMirror, Mirror);
1408
+
1409
+
1410
+ FrameMirror.prototype.index = function() {
1411
+ return this.index_;
1412
+ };
1413
+
1414
+
1415
+ FrameMirror.prototype.func = function() {
1416
+ // Get the function for this frame from the VM.
1417
+ var f = this.details_.func();
1418
+
1419
+ // Create a function mirror. NOTE: MakeMirror cannot be used here as the
1420
+ // value returned from the VM might be a string if the function for the
1421
+ // frame is unresolved.
1422
+ if (IS_FUNCTION(f)) {
1423
+ return MakeMirror(f);
1424
+ } else {
1425
+ return new UnresolvedFunctionMirror(f);
1426
+ }
1427
+ };
1428
+
1429
+
1430
+ FrameMirror.prototype.receiver = function() {
1431
+ return MakeMirror(this.details_.receiver());
1432
+ };
1433
+
1434
+
1435
+ FrameMirror.prototype.isConstructCall = function() {
1436
+ return this.details_.isConstructCall();
1437
+ };
1438
+
1439
+
1440
+ FrameMirror.prototype.isAtReturn = function() {
1441
+ return this.details_.isAtReturn();
1442
+ };
1443
+
1444
+
1445
+ FrameMirror.prototype.isDebuggerFrame = function() {
1446
+ return this.details_.isDebuggerFrame();
1447
+ };
1448
+
1449
+
1450
+ FrameMirror.prototype.argumentCount = function() {
1451
+ return this.details_.argumentCount();
1452
+ };
1453
+
1454
+
1455
+ FrameMirror.prototype.argumentName = function(index) {
1456
+ return this.details_.argumentName(index);
1457
+ };
1458
+
1459
+
1460
+ FrameMirror.prototype.argumentValue = function(index) {
1461
+ return MakeMirror(this.details_.argumentValue(index));
1462
+ };
1463
+
1464
+
1465
+ FrameMirror.prototype.localCount = function() {
1466
+ return this.details_.localCount();
1467
+ };
1468
+
1469
+
1470
+ FrameMirror.prototype.localName = function(index) {
1471
+ return this.details_.localName(index);
1472
+ };
1473
+
1474
+
1475
+ FrameMirror.prototype.localValue = function(index) {
1476
+ return MakeMirror(this.details_.localValue(index));
1477
+ };
1478
+
1479
+
1480
+ FrameMirror.prototype.returnValue = function() {
1481
+ return MakeMirror(this.details_.returnValue());
1482
+ };
1483
+
1484
+
1485
+ FrameMirror.prototype.sourcePosition = function() {
1486
+ return this.details_.sourcePosition();
1487
+ };
1488
+
1489
+
1490
+ FrameMirror.prototype.sourceLocation = function() {
1491
+ if (this.func().resolved() && this.func().script()) {
1492
+ return this.func().script().locationFromPosition(this.sourcePosition(),
1493
+ true);
1494
+ }
1495
+ };
1496
+
1497
+
1498
+ FrameMirror.prototype.sourceLine = function() {
1499
+ if (this.func().resolved()) {
1500
+ var location = this.sourceLocation();
1501
+ if (location) {
1502
+ return location.line;
1503
+ }
1504
+ }
1505
+ };
1506
+
1507
+
1508
+ FrameMirror.prototype.sourceColumn = function() {
1509
+ if (this.func().resolved()) {
1510
+ var location = this.sourceLocation();
1511
+ if (location) {
1512
+ return location.column;
1513
+ }
1514
+ }
1515
+ };
1516
+
1517
+
1518
+ FrameMirror.prototype.sourceLineText = function() {
1519
+ if (this.func().resolved()) {
1520
+ var location = this.sourceLocation();
1521
+ if (location) {
1522
+ return location.sourceText();
1523
+ }
1524
+ }
1525
+ };
1526
+
1527
+
1528
+ FrameMirror.prototype.scopeCount = function() {
1529
+ return this.details_.scopeCount();
1530
+ };
1531
+
1532
+
1533
+ FrameMirror.prototype.scope = function(index) {
1534
+ return new ScopeMirror(this, index);
1535
+ };
1536
+
1537
+
1538
+ FrameMirror.prototype.evaluate = function(source, disable_break, opt_context_object) {
1539
+ var result = %DebugEvaluate(this.break_id_, this.details_.frameId(),
1540
+ source, Boolean(disable_break), opt_context_object);
1541
+ return MakeMirror(result);
1542
+ };
1543
+
1544
+
1545
+ FrameMirror.prototype.invocationText = function() {
1546
+ // Format frame invoaction (receiver, function and arguments).
1547
+ var result = '';
1548
+ var func = this.func();
1549
+ var receiver = this.receiver();
1550
+ if (this.isConstructCall()) {
1551
+ // For constructor frames display new followed by the function name.
1552
+ result += 'new ';
1553
+ result += func.name() ? func.name() : '[anonymous]';
1554
+ } else if (this.isDebuggerFrame()) {
1555
+ result += '[debugger]';
1556
+ } else {
1557
+ // If the receiver has a className which is 'global' don't display it.
1558
+ var display_receiver = !receiver.className || receiver.className() != 'global';
1559
+ if (display_receiver) {
1560
+ result += receiver.toText();
1561
+ }
1562
+ // Try to find the function as a property in the receiver. Include the
1563
+ // prototype chain in the lookup.
1564
+ var property = GetUndefinedMirror();
1565
+ if (!receiver.isUndefined()) {
1566
+ for (var r = receiver; !r.isNull() && property.isUndefined(); r = r.protoObject()) {
1567
+ property = r.lookupProperty(func);
1568
+ }
1569
+ }
1570
+ if (!property.isUndefined()) {
1571
+ // The function invoked was found on the receiver. Use the property name
1572
+ // for the backtrace.
1573
+ if (!property.isIndexed()) {
1574
+ if (display_receiver) {
1575
+ result += '.';
1576
+ }
1577
+ result += property.name();
1578
+ } else {
1579
+ result += '[';
1580
+ result += property.name();
1581
+ result += ']';
1582
+ }
1583
+ // Also known as - if the name in the function doesn't match the name
1584
+ // under which it was looked up.
1585
+ if (func.name() && func.name() != property.name()) {
1586
+ result += '(aka ' + func.name() + ')';
1587
+ }
1588
+ } else {
1589
+ // The function invoked was not found on the receiver. Use the function
1590
+ // name if available for the backtrace.
1591
+ if (display_receiver) {
1592
+ result += '.';
1593
+ }
1594
+ result += func.name() ? func.name() : '[anonymous]';
1595
+ }
1596
+ }
1597
+
1598
+ // Render arguments for normal frames.
1599
+ if (!this.isDebuggerFrame()) {
1600
+ result += '(';
1601
+ for (var i = 0; i < this.argumentCount(); i++) {
1602
+ if (i != 0) result += ', ';
1603
+ if (this.argumentName(i)) {
1604
+ result += this.argumentName(i);
1605
+ result += '=';
1606
+ }
1607
+ result += this.argumentValue(i).toText();
1608
+ }
1609
+ result += ')';
1610
+ }
1611
+
1612
+ if (this.isAtReturn()) {
1613
+ result += ' returning ';
1614
+ result += this.returnValue().toText();
1615
+ }
1616
+
1617
+ return result;
1618
+ }
1619
+
1620
+
1621
+ FrameMirror.prototype.sourceAndPositionText = function() {
1622
+ // Format source and position.
1623
+ var result = '';
1624
+ var func = this.func();
1625
+ if (func.resolved()) {
1626
+ if (func.script()) {
1627
+ if (func.script().name()) {
1628
+ result += func.script().name();
1629
+ } else {
1630
+ result += '[unnamed]';
1631
+ }
1632
+ if (!this.isDebuggerFrame()) {
1633
+ var location = this.sourceLocation();
1634
+ result += ' line ';
1635
+ result += !IS_UNDEFINED(location) ? (location.line + 1) : '?';
1636
+ result += ' column ';
1637
+ result += !IS_UNDEFINED(location) ? (location.column + 1) : '?';
1638
+ if (!IS_UNDEFINED(this.sourcePosition())) {
1639
+ result += ' (position ' + (this.sourcePosition() + 1) + ')';
1640
+ }
1641
+ }
1642
+ } else {
1643
+ result += '[no source]';
1644
+ }
1645
+ } else {
1646
+ result += '[unresolved]';
1647
+ }
1648
+
1649
+ return result;
1650
+ }
1651
+
1652
+
1653
+ FrameMirror.prototype.localsText = function() {
1654
+ // Format local variables.
1655
+ var result = '';
1656
+ var locals_count = this.localCount()
1657
+ if (locals_count > 0) {
1658
+ for (var i = 0; i < locals_count; ++i) {
1659
+ result += ' var ';
1660
+ result += this.localName(i);
1661
+ result += ' = ';
1662
+ result += this.localValue(i).toText();
1663
+ if (i < locals_count - 1) result += '\n';
1664
+ }
1665
+ }
1666
+
1667
+ return result;
1668
+ }
1669
+
1670
+
1671
+ FrameMirror.prototype.toText = function(opt_locals) {
1672
+ var result = '';
1673
+ result += '#' + (this.index() <= 9 ? '0' : '') + this.index();
1674
+ result += ' ';
1675
+ result += this.invocationText();
1676
+ result += ' ';
1677
+ result += this.sourceAndPositionText();
1678
+ if (opt_locals) {
1679
+ result += '\n';
1680
+ result += this.localsText();
1681
+ }
1682
+ return result;
1683
+ }
1684
+
1685
+
1686
+ const kScopeDetailsTypeIndex = 0;
1687
+ const kScopeDetailsObjectIndex = 1;
1688
+
1689
+ function ScopeDetails(frame, index) {
1690
+ this.break_id_ = frame.break_id_;
1691
+ this.details_ = %GetScopeDetails(frame.break_id_,
1692
+ frame.details_.frameId(),
1693
+ index);
1694
+ }
1695
+
1696
+
1697
+ ScopeDetails.prototype.type = function() {
1698
+ %CheckExecutionState(this.break_id_);
1699
+ return this.details_[kScopeDetailsTypeIndex];
1700
+ }
1701
+
1702
+
1703
+ ScopeDetails.prototype.object = function() {
1704
+ %CheckExecutionState(this.break_id_);
1705
+ return this.details_[kScopeDetailsObjectIndex];
1706
+ }
1707
+
1708
+
1709
+ /**
1710
+ * Mirror object for scope.
1711
+ * @param {FrameMirror} frame The frame this scope is a part of
1712
+ * @param {number} index The scope index in the frame
1713
+ * @constructor
1714
+ * @extends Mirror
1715
+ */
1716
+ function ScopeMirror(frame, index) {
1717
+ %_CallFunction(this, SCOPE_TYPE, Mirror);
1718
+ this.frame_index_ = frame.index_;
1719
+ this.scope_index_ = index;
1720
+ this.details_ = new ScopeDetails(frame, index);
1721
+ }
1722
+ inherits(ScopeMirror, Mirror);
1723
+
1724
+
1725
+ ScopeMirror.prototype.frameIndex = function() {
1726
+ return this.frame_index_;
1727
+ };
1728
+
1729
+
1730
+ ScopeMirror.prototype.scopeIndex = function() {
1731
+ return this.scope_index_;
1732
+ };
1733
+
1734
+
1735
+ ScopeMirror.prototype.scopeType = function() {
1736
+ return this.details_.type();
1737
+ };
1738
+
1739
+
1740
+ ScopeMirror.prototype.scopeObject = function() {
1741
+ // For local and closure scopes create a transient mirror as these objects are
1742
+ // created on the fly materializing the local or closure scopes and
1743
+ // therefore will not preserve identity.
1744
+ var transient = this.scopeType() == ScopeType.Local ||
1745
+ this.scopeType() == ScopeType.Closure;
1746
+ return MakeMirror(this.details_.object(), transient);
1747
+ };
1748
+
1749
+
1750
+ /**
1751
+ * Mirror object for script source.
1752
+ * @param {Script} script The script object
1753
+ * @constructor
1754
+ * @extends Mirror
1755
+ */
1756
+ function ScriptMirror(script) {
1757
+ %_CallFunction(this, SCRIPT_TYPE, Mirror);
1758
+ this.script_ = script;
1759
+ this.context_ = new ContextMirror(script.context_data);
1760
+ this.allocateHandle_();
1761
+ }
1762
+ inherits(ScriptMirror, Mirror);
1763
+
1764
+
1765
+ ScriptMirror.prototype.value = function() {
1766
+ return this.script_;
1767
+ };
1768
+
1769
+
1770
+ ScriptMirror.prototype.name = function() {
1771
+ return this.script_.name || this.script_.nameOrSourceURL();
1772
+ };
1773
+
1774
+
1775
+ ScriptMirror.prototype.id = function() {
1776
+ return this.script_.id;
1777
+ };
1778
+
1779
+
1780
+ ScriptMirror.prototype.source = function() {
1781
+ return this.script_.source;
1782
+ };
1783
+
1784
+
1785
+ ScriptMirror.prototype.lineOffset = function() {
1786
+ return this.script_.line_offset;
1787
+ };
1788
+
1789
+
1790
+ ScriptMirror.prototype.columnOffset = function() {
1791
+ return this.script_.column_offset;
1792
+ };
1793
+
1794
+
1795
+ ScriptMirror.prototype.data = function() {
1796
+ return this.script_.data;
1797
+ };
1798
+
1799
+
1800
+ ScriptMirror.prototype.scriptType = function() {
1801
+ return this.script_.type;
1802
+ };
1803
+
1804
+
1805
+ ScriptMirror.prototype.compilationType = function() {
1806
+ return this.script_.compilation_type;
1807
+ };
1808
+
1809
+
1810
+ ScriptMirror.prototype.lineCount = function() {
1811
+ return this.script_.lineCount();
1812
+ };
1813
+
1814
+
1815
+ ScriptMirror.prototype.locationFromPosition = function(
1816
+ position, include_resource_offset) {
1817
+ return this.script_.locationFromPosition(position, include_resource_offset);
1818
+ }
1819
+
1820
+
1821
+ ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) {
1822
+ return this.script_.sourceSlice(opt_from_line, opt_to_line);
1823
+ }
1824
+
1825
+
1826
+ ScriptMirror.prototype.context = function() {
1827
+ return this.context_;
1828
+ };
1829
+
1830
+
1831
+ ScriptMirror.prototype.evalFromScript = function() {
1832
+ return MakeMirror(this.script_.eval_from_script);
1833
+ };
1834
+
1835
+
1836
+ ScriptMirror.prototype.evalFromFunctionName = function() {
1837
+ return MakeMirror(this.script_.eval_from_function_name);
1838
+ };
1839
+
1840
+
1841
+ ScriptMirror.prototype.evalFromLocation = function() {
1842
+ var eval_from_script = this.evalFromScript();
1843
+ if (!eval_from_script.isUndefined()) {
1844
+ var position = this.script_.eval_from_script_position;
1845
+ return eval_from_script.locationFromPosition(position, true);
1846
+ }
1847
+ };
1848
+
1849
+
1850
+ ScriptMirror.prototype.toText = function() {
1851
+ var result = '';
1852
+ result += this.name();
1853
+ result += ' (lines: ';
1854
+ if (this.lineOffset() > 0) {
1855
+ result += this.lineOffset();
1856
+ result += '-';
1857
+ result += this.lineOffset() + this.lineCount() - 1;
1858
+ } else {
1859
+ result += this.lineCount();
1860
+ }
1861
+ result += ')';
1862
+ return result;
1863
+ }
1864
+
1865
+
1866
+ /**
1867
+ * Mirror object for context.
1868
+ * @param {Object} data The context data
1869
+ * @constructor
1870
+ * @extends Mirror
1871
+ */
1872
+ function ContextMirror(data) {
1873
+ %_CallFunction(this, CONTEXT_TYPE, Mirror);
1874
+ this.data_ = data;
1875
+ this.allocateHandle_();
1876
+ }
1877
+ inherits(ContextMirror, Mirror);
1878
+
1879
+
1880
+ ContextMirror.prototype.data = function() {
1881
+ return this.data_;
1882
+ };
1883
+
1884
+
1885
+ /**
1886
+ * Returns a mirror serializer
1887
+ *
1888
+ * @param {boolean} details Set to true to include details
1889
+ * @param {Object} options Options comtrolling the serialization
1890
+ * The following options can be set:
1891
+ * includeSource: include ths full source of scripts
1892
+ * @returns {MirrorSerializer} mirror serializer
1893
+ */
1894
+ function MakeMirrorSerializer(details, options) {
1895
+ return new JSONProtocolSerializer(details, options);
1896
+ }
1897
+
1898
+
1899
+ /**
1900
+ * Object for serializing a mirror objects and its direct references.
1901
+ * @param {boolean} details Indicates whether to include details for the mirror
1902
+ * serialized
1903
+ * @constructor
1904
+ */
1905
+ function JSONProtocolSerializer(details, options) {
1906
+ this.details_ = details;
1907
+ this.options_ = options;
1908
+ this.mirrors_ = [ ];
1909
+ }
1910
+
1911
+
1912
+ /**
1913
+ * Returns a serialization of an object reference. The referenced object are
1914
+ * added to the serialization state.
1915
+ *
1916
+ * @param {Mirror} mirror The mirror to serialize
1917
+ * @returns {String} JSON serialization
1918
+ */
1919
+ JSONProtocolSerializer.prototype.serializeReference = function(mirror) {
1920
+ return this.serialize_(mirror, true, true);
1921
+ }
1922
+
1923
+
1924
+ /**
1925
+ * Returns a serialization of an object value. The referenced objects are
1926
+ * added to the serialization state.
1927
+ *
1928
+ * @param {Mirror} mirror The mirror to serialize
1929
+ * @returns {String} JSON serialization
1930
+ */
1931
+ JSONProtocolSerializer.prototype.serializeValue = function(mirror) {
1932
+ var json = this.serialize_(mirror, false, true);
1933
+ return json;
1934
+ }
1935
+
1936
+
1937
+ /**
1938
+ * Returns a serialization of all the objects referenced.
1939
+ *
1940
+ * @param {Mirror} mirror The mirror to serialize.
1941
+ * @returns {Array.<Object>} Array of the referenced objects converted to
1942
+ * protcol objects.
1943
+ */
1944
+ JSONProtocolSerializer.prototype.serializeReferencedObjects = function() {
1945
+ // Collect the protocol representation of the referenced objects in an array.
1946
+ var content = [];
1947
+
1948
+ // Get the number of referenced objects.
1949
+ var count = this.mirrors_.length;
1950
+
1951
+ for (var i = 0; i < count; i++) {
1952
+ content.push(this.serialize_(this.mirrors_[i], false, false));
1953
+ }
1954
+
1955
+ return content;
1956
+ }
1957
+
1958
+
1959
+ JSONProtocolSerializer.prototype.includeSource_ = function() {
1960
+ return this.options_ && this.options_.includeSource;
1961
+ }
1962
+
1963
+
1964
+ JSONProtocolSerializer.prototype.inlineRefs_ = function() {
1965
+ return this.options_ && this.options_.inlineRefs;
1966
+ }
1967
+
1968
+
1969
+ JSONProtocolSerializer.prototype.maxStringLength_ = function() {
1970
+ if (IS_UNDEFINED(this.options_) ||
1971
+ IS_UNDEFINED(this.options_.maxStringLength)) {
1972
+ return kMaxProtocolStringLength;
1973
+ }
1974
+ return this.options_.maxStringLength;
1975
+ }
1976
+
1977
+
1978
+ JSONProtocolSerializer.prototype.add_ = function(mirror) {
1979
+ // If this mirror is already in the list just return.
1980
+ for (var i = 0; i < this.mirrors_.length; i++) {
1981
+ if (this.mirrors_[i] === mirror) {
1982
+ return;
1983
+ }
1984
+ }
1985
+
1986
+ // Add the mirror to the list of mirrors to be serialized.
1987
+ this.mirrors_.push(mirror);
1988
+ }
1989
+
1990
+
1991
+ /**
1992
+ * Formats mirror object to protocol reference object with some data that can
1993
+ * be used to display the value in debugger.
1994
+ * @param {Mirror} mirror Mirror to serialize.
1995
+ * @return {Object} Protocol reference object.
1996
+ */
1997
+ JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
1998
+ function(mirror) {
1999
+ var o = {};
2000
+ o.ref = mirror.handle();
2001
+ o.type = mirror.type();
2002
+ switch (mirror.type()) {
2003
+ case UNDEFINED_TYPE:
2004
+ case NULL_TYPE:
2005
+ case BOOLEAN_TYPE:
2006
+ case NUMBER_TYPE:
2007
+ o.value = mirror.value();
2008
+ break;
2009
+ case STRING_TYPE:
2010
+ o.value = mirror.getTruncatedValue(this.maxStringLength_());
2011
+ break;
2012
+ case FUNCTION_TYPE:
2013
+ o.name = mirror.name();
2014
+ o.inferredName = mirror.inferredName();
2015
+ if (mirror.script()) {
2016
+ o.scriptId = mirror.script().id();
2017
+ }
2018
+ break;
2019
+ case ERROR_TYPE:
2020
+ case REGEXP_TYPE:
2021
+ o.value = mirror.toText();
2022
+ break;
2023
+ case OBJECT_TYPE:
2024
+ o.className = mirror.className();
2025
+ break;
2026
+ }
2027
+ return o;
2028
+ };
2029
+
2030
+
2031
+ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
2032
+ details) {
2033
+ // If serializing a reference to a mirror just return the reference and add
2034
+ // the mirror to the referenced mirrors.
2035
+ if (reference &&
2036
+ (mirror.isValue() || mirror.isScript() || mirror.isContext())) {
2037
+ if (this.inlineRefs_() && mirror.isValue()) {
2038
+ return this.serializeReferenceWithDisplayData_(mirror);
2039
+ } else {
2040
+ this.add_(mirror);
2041
+ return {'ref' : mirror.handle()};
2042
+ }
2043
+ }
2044
+
2045
+ // Collect the JSON property/value pairs.
2046
+ var content = {};
2047
+
2048
+ // Add the mirror handle.
2049
+ if (mirror.isValue() || mirror.isScript() || mirror.isContext()) {
2050
+ content.handle = mirror.handle();
2051
+ }
2052
+
2053
+ // Always add the type.
2054
+ content.type = mirror.type();
2055
+
2056
+ switch (mirror.type()) {
2057
+ case UNDEFINED_TYPE:
2058
+ case NULL_TYPE:
2059
+ // Undefined and null are represented just by their type.
2060
+ break;
2061
+
2062
+ case BOOLEAN_TYPE:
2063
+ // Boolean values are simply represented by their value.
2064
+ content.value = mirror.value();
2065
+ break;
2066
+
2067
+ case NUMBER_TYPE:
2068
+ // Number values are simply represented by their value.
2069
+ content.value = NumberToJSON_(mirror.value());
2070
+ break;
2071
+
2072
+ case STRING_TYPE:
2073
+ // String values might have their value cropped to keep down size.
2074
+ if (this.maxStringLength_() != -1 &&
2075
+ mirror.length() > this.maxStringLength_()) {
2076
+ var str = mirror.getTruncatedValue(this.maxStringLength_());
2077
+ content.value = str;
2078
+ content.fromIndex = 0;
2079
+ content.toIndex = this.maxStringLength_();
2080
+ } else {
2081
+ content.value = mirror.value();
2082
+ }
2083
+ content.length = mirror.length();
2084
+ break;
2085
+
2086
+ case OBJECT_TYPE:
2087
+ case FUNCTION_TYPE:
2088
+ case ERROR_TYPE:
2089
+ case REGEXP_TYPE:
2090
+ // Add object representation.
2091
+ this.serializeObject_(mirror, content, details);
2092
+ break;
2093
+
2094
+ case PROPERTY_TYPE:
2095
+ throw new Error('PropertyMirror cannot be serialized independeltly')
2096
+ break;
2097
+
2098
+ case FRAME_TYPE:
2099
+ // Add object representation.
2100
+ this.serializeFrame_(mirror, content);
2101
+ break;
2102
+
2103
+ case SCOPE_TYPE:
2104
+ // Add object representation.
2105
+ this.serializeScope_(mirror, content);
2106
+ break;
2107
+
2108
+ case SCRIPT_TYPE:
2109
+ // Script is represented by id, name and source attributes.
2110
+ if (mirror.name()) {
2111
+ content.name = mirror.name();
2112
+ }
2113
+ content.id = mirror.id();
2114
+ content.lineOffset = mirror.lineOffset();
2115
+ content.columnOffset = mirror.columnOffset();
2116
+ content.lineCount = mirror.lineCount();
2117
+ if (mirror.data()) {
2118
+ content.data = mirror.data();
2119
+ }
2120
+ if (this.includeSource_()) {
2121
+ content.source = mirror.source();
2122
+ } else {
2123
+ var sourceStart = mirror.source().substring(0, 80);
2124
+ content.sourceStart = sourceStart;
2125
+ }
2126
+ content.sourceLength = mirror.source().length;
2127
+ content.scriptType = mirror.scriptType();
2128
+ content.compilationType = mirror.compilationType();
2129
+ // For compilation type eval emit information on the script from which
2130
+ // eval was called if a script is present.
2131
+ if (mirror.compilationType() == 1 &&
2132
+ mirror.evalFromScript()) {
2133
+ content.evalFromScript =
2134
+ this.serializeReference(mirror.evalFromScript());
2135
+ var evalFromLocation = mirror.evalFromLocation()
2136
+ if (evalFromLocation) {
2137
+ content.evalFromLocation = { line: evalFromLocation.line,
2138
+ column: evalFromLocation.column };
2139
+ }
2140
+ if (mirror.evalFromFunctionName()) {
2141
+ content.evalFromFunctionName = mirror.evalFromFunctionName();
2142
+ }
2143
+ }
2144
+ if (mirror.context()) {
2145
+ content.context = this.serializeReference(mirror.context());
2146
+ }
2147
+ break;
2148
+
2149
+ case CONTEXT_TYPE:
2150
+ content.data = mirror.data();
2151
+ break;
2152
+ }
2153
+
2154
+ // Always add the text representation.
2155
+ content.text = mirror.toText();
2156
+
2157
+ // Create and return the JSON string.
2158
+ return content;
2159
+ }
2160
+
2161
+
2162
+ /**
2163
+ * Serialize object information to the following JSON format.
2164
+ *
2165
+ * {"className":"<class name>",
2166
+ * "constructorFunction":{"ref":<number>},
2167
+ * "protoObject":{"ref":<number>},
2168
+ * "prototypeObject":{"ref":<number>},
2169
+ * "namedInterceptor":<boolean>,
2170
+ * "indexedInterceptor":<boolean>,
2171
+ * "properties":[<properties>]}
2172
+ */
2173
+ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
2174
+ details) {
2175
+ // Add general object properties.
2176
+ content.className = mirror.className();
2177
+ content.constructorFunction =
2178
+ this.serializeReference(mirror.constructorFunction());
2179
+ content.protoObject = this.serializeReference(mirror.protoObject());
2180
+ content.prototypeObject = this.serializeReference(mirror.prototypeObject());
2181
+
2182
+ // Add flags to indicate whether there are interceptors.
2183
+ if (mirror.hasNamedInterceptor()) {
2184
+ content.namedInterceptor = true;
2185
+ }
2186
+ if (mirror.hasIndexedInterceptor()) {
2187
+ content.indexedInterceptor = true;
2188
+ }
2189
+
2190
+ // Add function specific properties.
2191
+ if (mirror.isFunction()) {
2192
+ // Add function specific properties.
2193
+ content.name = mirror.name();
2194
+ if (!IS_UNDEFINED(mirror.inferredName())) {
2195
+ content.inferredName = mirror.inferredName();
2196
+ }
2197
+ content.resolved = mirror.resolved();
2198
+ if (mirror.resolved()) {
2199
+ content.source = mirror.source();
2200
+ }
2201
+ if (mirror.script()) {
2202
+ content.script = this.serializeReference(mirror.script());
2203
+ content.scriptId = mirror.script().id();
2204
+
2205
+ serializeLocationFields(mirror.sourceLocation(), content);
2206
+ }
2207
+ }
2208
+
2209
+ // Add date specific properties.
2210
+ if (mirror.isDate()) {
2211
+ // Add date specific properties.
2212
+ content.value = mirror.value();
2213
+ }
2214
+
2215
+ // Add actual properties - named properties followed by indexed properties.
2216
+ var propertyNames = mirror.propertyNames(PropertyKind.Named);
2217
+ var propertyIndexes = mirror.propertyNames(PropertyKind.Indexed);
2218
+ var p = new Array(propertyNames.length + propertyIndexes.length);
2219
+ for (var i = 0; i < propertyNames.length; i++) {
2220
+ var propertyMirror = mirror.property(propertyNames[i]);
2221
+ p[i] = this.serializeProperty_(propertyMirror);
2222
+ if (details) {
2223
+ this.add_(propertyMirror.value());
2224
+ }
2225
+ }
2226
+ for (var i = 0; i < propertyIndexes.length; i++) {
2227
+ var propertyMirror = mirror.property(propertyIndexes[i]);
2228
+ p[propertyNames.length + i] = this.serializeProperty_(propertyMirror);
2229
+ if (details) {
2230
+ this.add_(propertyMirror.value());
2231
+ }
2232
+ }
2233
+ content.properties = p;
2234
+ }
2235
+
2236
+
2237
+ /**
2238
+ * Serialize location information to the following JSON format:
2239
+ *
2240
+ * "position":"<position>",
2241
+ * "line":"<line>",
2242
+ * "column":"<column>",
2243
+ *
2244
+ * @param {SourceLocation} location The location to serialize, may be undefined.
2245
+ */
2246
+ function serializeLocationFields (location, content) {
2247
+ if (!location) {
2248
+ return;
2249
+ }
2250
+ content.position = location.position;
2251
+ var line = location.line;
2252
+ if (!IS_UNDEFINED(line)) {
2253
+ content.line = line;
2254
+ }
2255
+ var column = location.column;
2256
+ if (!IS_UNDEFINED(column)) {
2257
+ content.column = column;
2258
+ }
2259
+ }
2260
+
2261
+
2262
+ /**
2263
+ * Serialize property information to the following JSON format for building the
2264
+ * array of properties.
2265
+ *
2266
+ * {"name":"<property name>",
2267
+ * "attributes":<number>,
2268
+ * "propertyType":<number>,
2269
+ * "ref":<number>}
2270
+ *
2271
+ * If the attribute for the property is PropertyAttribute.None it is not added.
2272
+ * If the propertyType for the property is PropertyType.Normal it is not added.
2273
+ * Here are a couple of examples.
2274
+ *
2275
+ * {"name":"hello","ref":1}
2276
+ * {"name":"length","attributes":7,"propertyType":3,"ref":2}
2277
+ *
2278
+ * @param {PropertyMirror} propertyMirror The property to serialize.
2279
+ * @returns {Object} Protocol object representing the property.
2280
+ */
2281
+ JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) {
2282
+ var result = {};
2283
+
2284
+ result.name = propertyMirror.name();
2285
+ var propertyValue = propertyMirror.value();
2286
+ if (this.inlineRefs_() && propertyValue.isValue()) {
2287
+ result.value = this.serializeReferenceWithDisplayData_(propertyValue);
2288
+ } else {
2289
+ if (propertyMirror.attributes() != PropertyAttribute.None) {
2290
+ result.attributes = propertyMirror.attributes();
2291
+ }
2292
+ if (propertyMirror.propertyType() != PropertyType.Normal) {
2293
+ result.propertyType = propertyMirror.propertyType();
2294
+ }
2295
+ result.ref = propertyValue.handle();
2296
+ }
2297
+ return result;
2298
+ }
2299
+
2300
+
2301
+ JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
2302
+ content.index = mirror.index();
2303
+ content.receiver = this.serializeReference(mirror.receiver());
2304
+ var func = mirror.func();
2305
+ content.func = this.serializeReference(func);
2306
+ if (func.script()) {
2307
+ content.script = this.serializeReference(func.script());
2308
+ }
2309
+ content.constructCall = mirror.isConstructCall();
2310
+ content.atReturn = mirror.isAtReturn();
2311
+ if (mirror.isAtReturn()) {
2312
+ content.returnValue = this.serializeReference(mirror.returnValue());
2313
+ }
2314
+ content.debuggerFrame = mirror.isDebuggerFrame();
2315
+ var x = new Array(mirror.argumentCount());
2316
+ for (var i = 0; i < mirror.argumentCount(); i++) {
2317
+ var arg = {};
2318
+ var argument_name = mirror.argumentName(i)
2319
+ if (argument_name) {
2320
+ arg.name = argument_name;
2321
+ }
2322
+ arg.value = this.serializeReference(mirror.argumentValue(i));
2323
+ x[i] = arg;
2324
+ }
2325
+ content.arguments = x;
2326
+ var x = new Array(mirror.localCount());
2327
+ for (var i = 0; i < mirror.localCount(); i++) {
2328
+ var local = {};
2329
+ local.name = mirror.localName(i);
2330
+ local.value = this.serializeReference(mirror.localValue(i));
2331
+ x[i] = local;
2332
+ }
2333
+ content.locals = x;
2334
+ serializeLocationFields(mirror.sourceLocation(), content);
2335
+ var source_line_text = mirror.sourceLineText();
2336
+ if (!IS_UNDEFINED(source_line_text)) {
2337
+ content.sourceLineText = source_line_text;
2338
+ }
2339
+
2340
+ content.scopes = [];
2341
+ for (var i = 0; i < mirror.scopeCount(); i++) {
2342
+ var scope = mirror.scope(i);
2343
+ content.scopes.push({
2344
+ type: scope.scopeType(),
2345
+ index: i
2346
+ });
2347
+ }
2348
+ }
2349
+
2350
+
2351
+ JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
2352
+ content.index = mirror.scopeIndex();
2353
+ content.frameIndex = mirror.frameIndex();
2354
+ content.type = mirror.scopeType();
2355
+ content.object = this.inlineRefs_() ?
2356
+ this.serializeValue(mirror.scopeObject()) :
2357
+ this.serializeReference(mirror.scopeObject());
2358
+ }
2359
+
2360
+
2361
+ /**
2362
+ * Convert a number to a protocol value. For all finite numbers the number
2363
+ * itself is returned. For non finite numbers NaN, Infinite and
2364
+ * -Infinite the string representation "NaN", "Infinite" or "-Infinite"
2365
+ * (not including the quotes) is returned.
2366
+ *
2367
+ * @param {number} value The number value to convert to a protocol value.
2368
+ * @returns {number|string} Protocol value.
2369
+ */
2370
+ function NumberToJSON_(value) {
2371
+ if (isNaN(value)) {
2372
+ return 'NaN';
2373
+ }
2374
+ if (!NUMBER_IS_FINITE(value)) {
2375
+ if (value > 0) {
2376
+ return 'Infinity';
2377
+ } else {
2378
+ return '-Infinity';
2379
+ }
2380
+ }
2381
+ return value;
2382
+ }