libv8 3.3.10.4 → 3.5.10.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (538) hide show
  1. data/lib/libv8/scons/CHANGES.txt +24 -231
  2. data/lib/libv8/scons/LICENSE.txt +1 -1
  3. data/lib/libv8/scons/MANIFEST +0 -1
  4. data/lib/libv8/scons/PKG-INFO +1 -1
  5. data/lib/libv8/scons/README.txt +9 -9
  6. data/lib/libv8/scons/RELEASE.txt +75 -77
  7. data/lib/libv8/scons/engine/SCons/Action.py +6 -22
  8. data/lib/libv8/scons/engine/SCons/Builder.py +2 -2
  9. data/lib/libv8/scons/engine/SCons/CacheDir.py +2 -2
  10. data/lib/libv8/scons/engine/SCons/Debug.py +2 -2
  11. data/lib/libv8/scons/engine/SCons/Defaults.py +10 -24
  12. data/lib/libv8/scons/engine/SCons/Environment.py +19 -118
  13. data/lib/libv8/scons/engine/SCons/Errors.py +2 -2
  14. data/lib/libv8/scons/engine/SCons/Executor.py +2 -2
  15. data/lib/libv8/scons/engine/SCons/Job.py +2 -2
  16. data/lib/libv8/scons/engine/SCons/Memoize.py +2 -2
  17. data/lib/libv8/scons/engine/SCons/Node/Alias.py +2 -2
  18. data/lib/libv8/scons/engine/SCons/Node/FS.py +121 -281
  19. data/lib/libv8/scons/engine/SCons/Node/Python.py +2 -2
  20. data/lib/libv8/scons/engine/SCons/Node/__init__.py +5 -6
  21. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +2 -2
  22. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +2 -2
  23. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +2 -2
  24. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +2 -2
  25. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +2 -2
  26. data/lib/libv8/scons/engine/SCons/Options/__init__.py +2 -2
  27. data/lib/libv8/scons/engine/SCons/PathList.py +2 -2
  28. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +2 -2
  29. data/lib/libv8/scons/engine/SCons/Platform/aix.py +2 -2
  30. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +2 -2
  31. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +3 -27
  32. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +2 -2
  33. data/lib/libv8/scons/engine/SCons/Platform/irix.py +2 -2
  34. data/lib/libv8/scons/engine/SCons/Platform/os2.py +2 -2
  35. data/lib/libv8/scons/engine/SCons/Platform/posix.py +2 -2
  36. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +2 -2
  37. data/lib/libv8/scons/engine/SCons/Platform/win32.py +2 -2
  38. data/lib/libv8/scons/engine/SCons/SConf.py +2 -2
  39. data/lib/libv8/scons/engine/SCons/SConsign.py +3 -9
  40. data/lib/libv8/scons/engine/SCons/Scanner/C.py +2 -2
  41. data/lib/libv8/scons/engine/SCons/Scanner/D.py +2 -2
  42. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +2 -2
  43. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +2 -2
  44. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +2 -2
  45. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +2 -5
  46. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +2 -2
  47. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +3 -3
  48. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +2 -2
  49. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +2 -2
  50. data/lib/libv8/scons/engine/SCons/Script/Main.py +11 -82
  51. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +5 -5
  52. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +2 -2
  53. data/lib/libv8/scons/engine/SCons/Script/__init__.py +2 -2
  54. data/lib/libv8/scons/engine/SCons/Sig.py +2 -2
  55. data/lib/libv8/scons/engine/SCons/Subst.py +2 -2
  56. data/lib/libv8/scons/engine/SCons/Taskmaster.py +2 -10
  57. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +2 -2
  58. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +2 -2
  59. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +2 -2
  60. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +2 -19
  61. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +2 -2
  62. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +2 -2
  63. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +2 -2
  64. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +2 -2
  65. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +2 -2
  66. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +2 -2
  67. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +6 -9
  68. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +2 -29
  69. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +2 -2
  70. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +2 -2
  71. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +2 -2
  72. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +2 -2
  73. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +2 -2
  74. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +3 -3
  75. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +2 -2
  76. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +2 -2
  77. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +2 -2
  78. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +2 -2
  79. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +2 -2
  80. data/lib/libv8/scons/engine/SCons/Tool/ar.py +2 -2
  81. data/lib/libv8/scons/engine/SCons/Tool/as.py +2 -2
  82. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +2 -2
  83. data/lib/libv8/scons/engine/SCons/Tool/c++.py +2 -2
  84. data/lib/libv8/scons/engine/SCons/Tool/cc.py +2 -2
  85. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +2 -2
  86. data/lib/libv8/scons/engine/SCons/Tool/default.py +2 -2
  87. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +7 -24
  88. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +2 -2
  89. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +2 -3
  90. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +2 -3
  91. data/lib/libv8/scons/engine/SCons/Tool/f77.py +2 -2
  92. data/lib/libv8/scons/engine/SCons/Tool/f90.py +2 -2
  93. data/lib/libv8/scons/engine/SCons/Tool/f95.py +2 -2
  94. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +2 -2
  95. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +2 -2
  96. data/lib/libv8/scons/engine/SCons/Tool/g++.py +2 -2
  97. data/lib/libv8/scons/engine/SCons/Tool/g77.py +2 -2
  98. data/lib/libv8/scons/engine/SCons/Tool/gas.py +2 -2
  99. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +2 -2
  100. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +3 -3
  101. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +3 -2
  102. data/lib/libv8/scons/engine/SCons/Tool/gs.py +2 -2
  103. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +2 -2
  104. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +2 -2
  105. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +2 -2
  106. data/lib/libv8/scons/engine/SCons/Tool/icc.py +2 -2
  107. data/lib/libv8/scons/engine/SCons/Tool/icl.py +2 -2
  108. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +2 -2
  109. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +2 -2
  110. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +2 -2
  111. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +2 -2
  112. data/lib/libv8/scons/engine/SCons/Tool/install.py +3 -57
  113. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +25 -65
  114. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +2 -2
  115. data/lib/libv8/scons/engine/SCons/Tool/jar.py +3 -9
  116. data/lib/libv8/scons/engine/SCons/Tool/javac.py +2 -2
  117. data/lib/libv8/scons/engine/SCons/Tool/javah.py +2 -2
  118. data/lib/libv8/scons/engine/SCons/Tool/latex.py +2 -3
  119. data/lib/libv8/scons/engine/SCons/Tool/lex.py +2 -2
  120. data/lib/libv8/scons/engine/SCons/Tool/link.py +5 -6
  121. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +2 -2
  122. data/lib/libv8/scons/engine/SCons/Tool/m4.py +2 -2
  123. data/lib/libv8/scons/engine/SCons/Tool/masm.py +2 -2
  124. data/lib/libv8/scons/engine/SCons/Tool/midl.py +2 -2
  125. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +10 -31
  126. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +2 -2
  127. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +9 -61
  128. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +2 -2
  129. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +11 -21
  130. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +59 -477
  131. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +2 -2
  132. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +2 -2
  133. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +2 -2
  134. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +2 -2
  135. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +2 -2
  136. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +2 -2
  137. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +2 -2
  138. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +2 -2
  139. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +2 -2
  140. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +2 -2
  141. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +2 -2
  142. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +2 -2
  143. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +2 -2
  144. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +2 -2
  145. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +2 -3
  146. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +2 -3
  147. data/lib/libv8/scons/engine/SCons/Tool/qt.py +2 -2
  148. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +3 -9
  149. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +2 -2
  150. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +2 -2
  151. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +2 -2
  152. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +2 -2
  153. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +2 -2
  154. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +3 -2
  155. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +2 -2
  156. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +2 -2
  157. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +2 -2
  158. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +2 -2
  159. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +2 -2
  160. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +2 -2
  161. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +3 -2
  162. data/lib/libv8/scons/engine/SCons/Tool/swig.py +5 -6
  163. data/lib/libv8/scons/engine/SCons/Tool/tar.py +2 -2
  164. data/lib/libv8/scons/engine/SCons/Tool/tex.py +43 -96
  165. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +2 -2
  166. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +2 -2
  167. data/lib/libv8/scons/engine/SCons/Tool/wix.py +2 -2
  168. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +2 -12
  169. data/lib/libv8/scons/engine/SCons/Tool/zip.py +2 -2
  170. data/lib/libv8/scons/engine/SCons/Util.py +3 -3
  171. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +2 -2
  172. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +3 -3
  173. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +2 -2
  174. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +2 -2
  175. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +2 -2
  176. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +2 -2
  177. data/lib/libv8/scons/engine/SCons/Warnings.py +2 -2
  178. data/lib/libv8/scons/engine/SCons/__init__.py +6 -6
  179. data/lib/libv8/scons/engine/SCons/compat/__init__.py +2 -2
  180. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +2 -2
  181. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +2 -2
  182. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +2 -2
  183. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +2 -2
  184. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +2 -2
  185. data/lib/libv8/scons/engine/SCons/cpp.py +2 -2
  186. data/lib/libv8/scons/engine/SCons/dblite.py +1 -4
  187. data/lib/libv8/scons/engine/SCons/exitfuncs.py +2 -2
  188. data/lib/libv8/scons/scons-time.1 +3 -3
  189. data/lib/libv8/scons/scons.1 +1164 -1170
  190. data/lib/libv8/scons/sconsign.1 +3 -3
  191. data/lib/libv8/scons/script/scons +22 -22
  192. data/lib/libv8/scons/script/scons-time +2 -2
  193. data/lib/libv8/scons/script/scons.bat +4 -7
  194. data/lib/libv8/scons/script/sconsign +20 -21
  195. data/lib/libv8/scons/setup.cfg +1 -0
  196. data/lib/libv8/scons/setup.py +40 -38
  197. data/lib/libv8/v8/.gitignore +1 -1
  198. data/lib/libv8/v8/AUTHORS +2 -0
  199. data/lib/libv8/v8/ChangeLog +387 -0
  200. data/lib/libv8/v8/Makefile +171 -0
  201. data/lib/libv8/v8/SConstruct +124 -51
  202. data/lib/libv8/v8/build/README.txt +31 -14
  203. data/lib/libv8/v8/build/all.gyp +11 -4
  204. data/lib/libv8/v8/build/armu.gypi +6 -2
  205. data/lib/libv8/v8/build/common.gypi +240 -94
  206. data/lib/libv8/v8/build/gyp_v8 +32 -4
  207. data/lib/libv8/v8/build/standalone.gypi +200 -0
  208. data/lib/libv8/v8/include/v8-debug.h +0 -0
  209. data/lib/libv8/v8/include/v8-profiler.h +8 -11
  210. data/lib/libv8/v8/include/v8.h +191 -108
  211. data/lib/libv8/v8/preparser/SConscript +2 -2
  212. data/lib/libv8/v8/preparser/preparser-process.cc +3 -3
  213. data/lib/libv8/v8/preparser/preparser.gyp +42 -0
  214. data/lib/libv8/v8/src/SConscript +33 -8
  215. data/lib/libv8/v8/src/accessors.cc +77 -43
  216. data/lib/libv8/v8/src/api.cc +393 -191
  217. data/lib/libv8/v8/src/api.h +4 -8
  218. data/lib/libv8/v8/src/apinatives.js +15 -3
  219. data/lib/libv8/v8/src/arguments.h +8 -0
  220. data/lib/libv8/v8/src/arm/assembler-arm.cc +120 -120
  221. data/lib/libv8/v8/src/arm/assembler-arm.h +92 -43
  222. data/lib/libv8/v8/src/arm/builtins-arm.cc +32 -39
  223. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +572 -351
  224. data/lib/libv8/v8/src/arm/code-stubs-arm.h +8 -77
  225. data/lib/libv8/v8/src/arm/codegen-arm.h +0 -2
  226. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +50 -30
  227. data/lib/libv8/v8/src/arm/disasm-arm.cc +1 -1
  228. data/lib/libv8/v8/src/arm/frames-arm.h +9 -5
  229. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +331 -432
  230. data/lib/libv8/v8/src/arm/ic-arm.cc +192 -124
  231. data/lib/libv8/v8/src/arm/lithium-arm.cc +216 -232
  232. data/lib/libv8/v8/src/arm/lithium-arm.h +106 -259
  233. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +633 -642
  234. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +4 -4
  235. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +1 -3
  236. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +260 -185
  237. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +45 -25
  238. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +25 -13
  239. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +3 -0
  240. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +413 -226
  241. data/lib/libv8/v8/src/array.js +38 -18
  242. data/lib/libv8/v8/src/assembler.cc +12 -5
  243. data/lib/libv8/v8/src/assembler.h +15 -9
  244. data/lib/libv8/v8/src/ast-inl.h +34 -25
  245. data/lib/libv8/v8/src/ast.cc +141 -72
  246. data/lib/libv8/v8/src/ast.h +255 -181
  247. data/lib/libv8/v8/src/bignum.cc +3 -4
  248. data/lib/libv8/v8/src/bootstrapper.cc +55 -11
  249. data/lib/libv8/v8/src/bootstrapper.h +3 -2
  250. data/lib/libv8/v8/src/builtins.cc +8 -2
  251. data/lib/libv8/v8/src/builtins.h +4 -0
  252. data/lib/libv8/v8/src/cached-powers.cc +8 -4
  253. data/lib/libv8/v8/src/checks.h +3 -3
  254. data/lib/libv8/v8/src/code-stubs.cc +173 -28
  255. data/lib/libv8/v8/src/code-stubs.h +104 -148
  256. data/lib/libv8/v8/src/codegen.cc +8 -8
  257. data/lib/libv8/v8/src/compilation-cache.cc +2 -47
  258. data/lib/libv8/v8/src/compilation-cache.h +0 -10
  259. data/lib/libv8/v8/src/compiler.cc +27 -16
  260. data/lib/libv8/v8/src/compiler.h +13 -18
  261. data/lib/libv8/v8/src/contexts.cc +107 -72
  262. data/lib/libv8/v8/src/contexts.h +70 -34
  263. data/lib/libv8/v8/src/conversions-inl.h +572 -14
  264. data/lib/libv8/v8/src/conversions.cc +9 -707
  265. data/lib/libv8/v8/src/conversions.h +23 -12
  266. data/lib/libv8/v8/src/cpu-profiler-inl.h +2 -19
  267. data/lib/libv8/v8/src/cpu-profiler.cc +4 -21
  268. data/lib/libv8/v8/src/cpu-profiler.h +8 -17
  269. data/lib/libv8/v8/src/d8-debug.cc +5 -3
  270. data/lib/libv8/v8/src/d8-debug.h +6 -7
  271. data/lib/libv8/v8/src/d8-posix.cc +1 -10
  272. data/lib/libv8/v8/src/d8.cc +721 -219
  273. data/lib/libv8/v8/src/d8.gyp +37 -12
  274. data/lib/libv8/v8/src/d8.h +141 -19
  275. data/lib/libv8/v8/src/d8.js +17 -8
  276. data/lib/libv8/v8/src/date.js +16 -5
  277. data/lib/libv8/v8/src/dateparser-inl.h +242 -39
  278. data/lib/libv8/v8/src/dateparser.cc +38 -4
  279. data/lib/libv8/v8/src/dateparser.h +170 -28
  280. data/lib/libv8/v8/src/debug-agent.cc +5 -3
  281. data/lib/libv8/v8/src/debug-agent.h +11 -7
  282. data/lib/libv8/v8/src/debug-debugger.js +65 -34
  283. data/lib/libv8/v8/src/debug.cc +30 -60
  284. data/lib/libv8/v8/src/debug.h +5 -3
  285. data/lib/libv8/v8/src/deoptimizer.cc +227 -10
  286. data/lib/libv8/v8/src/deoptimizer.h +133 -9
  287. data/lib/libv8/v8/src/disassembler.cc +22 -14
  288. data/lib/libv8/v8/src/diy-fp.cc +4 -3
  289. data/lib/libv8/v8/src/diy-fp.h +3 -3
  290. data/lib/libv8/v8/src/elements.cc +634 -0
  291. data/lib/libv8/v8/src/elements.h +95 -0
  292. data/lib/libv8/v8/src/execution.cc +5 -21
  293. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +3 -1
  294. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +1 -1
  295. data/lib/libv8/v8/src/extensions/experimental/collator.cc +6 -2
  296. data/lib/libv8/v8/src/extensions/experimental/collator.h +1 -2
  297. data/lib/libv8/v8/src/extensions/experimental/datetime-format.cc +384 -0
  298. data/lib/libv8/v8/src/extensions/experimental/datetime-format.h +83 -0
  299. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +18 -7
  300. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +12 -16
  301. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +1 -1
  302. data/lib/libv8/v8/src/extensions/experimental/i18n-js2c.py +126 -0
  303. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +3 -4
  304. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +1 -1
  305. data/lib/libv8/v8/src/{shell.h → extensions/experimental/i18n-natives.h} +8 -20
  306. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +45 -1
  307. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +21 -1
  308. data/lib/libv8/v8/src/extensions/experimental/i18n.js +211 -11
  309. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +4 -3
  310. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +1 -1
  311. data/lib/libv8/v8/src/extensions/experimental/number-format.cc +374 -0
  312. data/lib/libv8/v8/src/extensions/experimental/number-format.h +71 -0
  313. data/lib/libv8/v8/src/factory.cc +89 -18
  314. data/lib/libv8/v8/src/factory.h +36 -8
  315. data/lib/libv8/v8/src/flag-definitions.h +11 -44
  316. data/lib/libv8/v8/src/frames-inl.h +8 -1
  317. data/lib/libv8/v8/src/frames.cc +39 -3
  318. data/lib/libv8/v8/src/frames.h +10 -3
  319. data/lib/libv8/v8/src/full-codegen.cc +311 -293
  320. data/lib/libv8/v8/src/full-codegen.h +183 -143
  321. data/lib/libv8/v8/src/func-name-inferrer.cc +29 -15
  322. data/lib/libv8/v8/src/func-name-inferrer.h +19 -9
  323. data/lib/libv8/v8/src/gdb-jit.cc +658 -55
  324. data/lib/libv8/v8/src/gdb-jit.h +6 -2
  325. data/lib/libv8/v8/src/global-handles.cc +368 -312
  326. data/lib/libv8/v8/src/global-handles.h +29 -36
  327. data/lib/libv8/v8/src/globals.h +3 -1
  328. data/lib/libv8/v8/src/handles.cc +43 -69
  329. data/lib/libv8/v8/src/handles.h +21 -16
  330. data/lib/libv8/v8/src/heap-inl.h +11 -13
  331. data/lib/libv8/v8/src/heap-profiler.cc +0 -999
  332. data/lib/libv8/v8/src/heap-profiler.h +0 -303
  333. data/lib/libv8/v8/src/heap.cc +366 -141
  334. data/lib/libv8/v8/src/heap.h +87 -26
  335. data/lib/libv8/v8/src/hydrogen-instructions.cc +192 -81
  336. data/lib/libv8/v8/src/hydrogen-instructions.h +711 -482
  337. data/lib/libv8/v8/src/hydrogen.cc +1146 -629
  338. data/lib/libv8/v8/src/hydrogen.h +100 -64
  339. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +19 -0
  340. data/lib/libv8/v8/src/ia32/assembler-ia32.h +15 -2
  341. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +34 -39
  342. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +675 -377
  343. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +8 -69
  344. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +1 -0
  345. data/lib/libv8/v8/src/ia32/codegen-ia32.h +0 -2
  346. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +3 -2
  347. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +28 -3
  348. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +21 -10
  349. data/lib/libv8/v8/src/ia32/frames-ia32.h +6 -5
  350. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +459 -465
  351. data/lib/libv8/v8/src/ia32/ic-ia32.cc +196 -147
  352. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +575 -650
  353. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +19 -21
  354. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +7 -2
  355. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +261 -256
  356. data/lib/libv8/v8/src/ia32/lithium-ia32.h +234 -335
  357. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +224 -67
  358. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +63 -19
  359. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +22 -8
  360. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +3 -0
  361. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +380 -239
  362. data/lib/libv8/v8/src/ic.cc +198 -234
  363. data/lib/libv8/v8/src/ic.h +32 -30
  364. data/lib/libv8/v8/src/interpreter-irregexp.cc +6 -4
  365. data/lib/libv8/v8/src/isolate.cc +112 -95
  366. data/lib/libv8/v8/src/isolate.h +55 -71
  367. data/lib/libv8/v8/src/json-parser.h +486 -48
  368. data/lib/libv8/v8/src/json.js +28 -23
  369. data/lib/libv8/v8/src/jsregexp.cc +163 -208
  370. data/lib/libv8/v8/src/jsregexp.h +0 -1
  371. data/lib/libv8/v8/src/lithium-allocator-inl.h +29 -27
  372. data/lib/libv8/v8/src/lithium-allocator.cc +22 -17
  373. data/lib/libv8/v8/src/lithium-allocator.h +8 -8
  374. data/lib/libv8/v8/src/lithium.cc +16 -11
  375. data/lib/libv8/v8/src/lithium.h +31 -34
  376. data/lib/libv8/v8/src/liveedit.cc +111 -15
  377. data/lib/libv8/v8/src/liveedit.h +3 -4
  378. data/lib/libv8/v8/src/liveobjectlist.cc +116 -80
  379. data/lib/libv8/v8/src/liveobjectlist.h +2 -2
  380. data/lib/libv8/v8/src/log-inl.h +0 -4
  381. data/lib/libv8/v8/src/log-utils.cc +25 -143
  382. data/lib/libv8/v8/src/log-utils.h +13 -92
  383. data/lib/libv8/v8/src/log.cc +26 -249
  384. data/lib/libv8/v8/src/log.h +6 -17
  385. data/lib/libv8/v8/src/macros.py +9 -6
  386. data/lib/libv8/v8/src/mark-compact.cc +276 -56
  387. data/lib/libv8/v8/src/mark-compact.h +20 -0
  388. data/lib/libv8/v8/src/messages.js +93 -39
  389. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +9 -3
  390. data/lib/libv8/v8/src/mips/assembler-mips.cc +297 -189
  391. data/lib/libv8/v8/src/mips/assembler-mips.h +121 -54
  392. data/lib/libv8/v8/src/mips/builtins-mips.cc +23 -24
  393. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +484 -263
  394. data/lib/libv8/v8/src/mips/code-stubs-mips.h +8 -83
  395. data/lib/libv8/v8/src/mips/codegen-mips.h +0 -2
  396. data/lib/libv8/v8/src/mips/constants-mips.h +37 -11
  397. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +6 -1
  398. data/lib/libv8/v8/src/mips/frames-mips.h +8 -7
  399. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +258 -419
  400. data/lib/libv8/v8/src/mips/ic-mips.cc +181 -121
  401. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +640 -382
  402. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +94 -89
  403. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +23 -10
  404. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +6 -1
  405. data/lib/libv8/v8/src/mips/simulator-mips.cc +249 -49
  406. data/lib/libv8/v8/src/mips/simulator-mips.h +25 -1
  407. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +373 -161
  408. data/lib/libv8/v8/src/mirror-debugger.js +55 -8
  409. data/lib/libv8/v8/src/misc-intrinsics.h +89 -0
  410. data/lib/libv8/v8/src/mksnapshot.cc +36 -4
  411. data/lib/libv8/v8/src/natives.h +5 -2
  412. data/lib/libv8/v8/src/objects-debug.cc +73 -6
  413. data/lib/libv8/v8/src/objects-inl.h +529 -164
  414. data/lib/libv8/v8/src/objects-printer.cc +67 -12
  415. data/lib/libv8/v8/src/objects-visiting.cc +13 -2
  416. data/lib/libv8/v8/src/objects-visiting.h +41 -1
  417. data/lib/libv8/v8/src/objects.cc +2200 -1177
  418. data/lib/libv8/v8/src/objects.h +912 -283
  419. data/lib/libv8/v8/src/parser.cc +566 -371
  420. data/lib/libv8/v8/src/parser.h +35 -33
  421. data/lib/libv8/v8/src/platform-cygwin.cc +10 -25
  422. data/lib/libv8/v8/src/platform-freebsd.cc +4 -29
  423. data/lib/libv8/v8/src/platform-linux.cc +60 -57
  424. data/lib/libv8/v8/src/platform-macos.cc +4 -27
  425. data/lib/libv8/v8/src/platform-nullos.cc +3 -16
  426. data/lib/libv8/v8/src/platform-openbsd.cc +247 -85
  427. data/lib/libv8/v8/src/platform-posix.cc +43 -1
  428. data/lib/libv8/v8/src/platform-solaris.cc +151 -112
  429. data/lib/libv8/v8/src/platform-tls.h +1 -1
  430. data/lib/libv8/v8/src/platform-win32.cc +65 -39
  431. data/lib/libv8/v8/src/platform.h +17 -14
  432. data/lib/libv8/v8/src/preparse-data-format.h +2 -2
  433. data/lib/libv8/v8/src/preparse-data.h +8 -2
  434. data/lib/libv8/v8/src/preparser-api.cc +2 -18
  435. data/lib/libv8/v8/src/preparser.cc +106 -65
  436. data/lib/libv8/v8/src/preparser.h +26 -5
  437. data/lib/libv8/v8/src/prettyprinter.cc +25 -43
  438. data/lib/libv8/v8/src/profile-generator-inl.h +0 -4
  439. data/lib/libv8/v8/src/profile-generator.cc +213 -34
  440. data/lib/libv8/v8/src/profile-generator.h +9 -9
  441. data/lib/libv8/v8/src/property.h +1 -0
  442. data/lib/libv8/v8/src/proxy.js +74 -4
  443. data/lib/libv8/v8/src/regexp-macro-assembler.cc +10 -6
  444. data/lib/libv8/v8/src/regexp.js +16 -11
  445. data/lib/libv8/v8/src/rewriter.cc +24 -133
  446. data/lib/libv8/v8/src/runtime-profiler.cc +27 -151
  447. data/lib/libv8/v8/src/runtime-profiler.h +5 -31
  448. data/lib/libv8/v8/src/runtime.cc +1450 -681
  449. data/lib/libv8/v8/src/runtime.h +47 -31
  450. data/lib/libv8/v8/src/runtime.js +2 -1
  451. data/lib/libv8/v8/src/scanner-base.cc +358 -220
  452. data/lib/libv8/v8/src/scanner-base.h +30 -138
  453. data/lib/libv8/v8/src/scanner.cc +0 -18
  454. data/lib/libv8/v8/src/scanner.h +0 -15
  455. data/lib/libv8/v8/src/scopeinfo.cc +3 -1
  456. data/lib/libv8/v8/src/scopeinfo.h +1 -6
  457. data/lib/libv8/v8/src/scopes.cc +243 -253
  458. data/lib/libv8/v8/src/scopes.h +58 -109
  459. data/lib/libv8/v8/src/serialize.cc +12 -54
  460. data/lib/libv8/v8/src/serialize.h +47 -0
  461. data/lib/libv8/v8/src/small-pointer-list.h +25 -0
  462. data/lib/libv8/v8/src/spaces-inl.h +4 -50
  463. data/lib/libv8/v8/src/spaces.cc +64 -131
  464. data/lib/libv8/v8/src/spaces.h +19 -70
  465. data/lib/libv8/v8/src/string-stream.cc +3 -1
  466. data/lib/libv8/v8/src/string.js +10 -6
  467. data/lib/libv8/v8/src/strtod.cc +7 -3
  468. data/lib/libv8/v8/src/stub-cache.cc +59 -129
  469. data/lib/libv8/v8/src/stub-cache.h +42 -54
  470. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +1447 -1339
  471. data/lib/libv8/v8/src/token.cc +4 -4
  472. data/lib/libv8/v8/src/token.h +6 -5
  473. data/lib/libv8/v8/src/type-info.cc +173 -129
  474. data/lib/libv8/v8/src/type-info.h +40 -22
  475. data/lib/libv8/v8/src/utils.cc +25 -304
  476. data/lib/libv8/v8/src/utils.h +118 -3
  477. data/lib/libv8/v8/src/v8-counters.h +3 -6
  478. data/lib/libv8/v8/src/v8.cc +34 -27
  479. data/lib/libv8/v8/src/v8.h +7 -7
  480. data/lib/libv8/v8/src/v8conversions.cc +129 -0
  481. data/lib/libv8/v8/src/v8conversions.h +60 -0
  482. data/lib/libv8/v8/src/v8globals.h +15 -6
  483. data/lib/libv8/v8/src/v8natives.js +300 -78
  484. data/lib/libv8/v8/src/v8threads.cc +14 -6
  485. data/lib/libv8/v8/src/v8threads.h +4 -1
  486. data/lib/libv8/v8/src/v8utils.cc +360 -0
  487. data/lib/libv8/v8/src/v8utils.h +17 -66
  488. data/lib/libv8/v8/src/variables.cc +7 -12
  489. data/lib/libv8/v8/src/variables.h +12 -10
  490. data/lib/libv8/v8/src/version.cc +2 -2
  491. data/lib/libv8/v8/src/vm-state-inl.h +0 -41
  492. data/lib/libv8/v8/src/vm-state.h +0 -11
  493. data/lib/libv8/v8/src/weakmap.js +103 -0
  494. data/lib/libv8/v8/src/x64/assembler-x64.h +6 -3
  495. data/lib/libv8/v8/src/x64/builtins-x64.cc +25 -22
  496. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +523 -250
  497. data/lib/libv8/v8/src/x64/code-stubs-x64.h +8 -71
  498. data/lib/libv8/v8/src/x64/codegen-x64.cc +1 -0
  499. data/lib/libv8/v8/src/x64/codegen-x64.h +0 -2
  500. data/lib/libv8/v8/src/x64/cpu-x64.cc +2 -1
  501. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +40 -8
  502. data/lib/libv8/v8/src/x64/disasm-x64.cc +12 -10
  503. data/lib/libv8/v8/src/x64/frames-x64.h +7 -6
  504. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +310 -415
  505. data/lib/libv8/v8/src/x64/ic-x64.cc +180 -117
  506. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +411 -523
  507. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +11 -6
  508. data/lib/libv8/v8/src/x64/lithium-x64.cc +191 -216
  509. data/lib/libv8/v8/src/x64/lithium-x64.h +112 -263
  510. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +177 -61
  511. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +23 -7
  512. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +21 -9
  513. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +6 -0
  514. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +273 -107
  515. data/lib/libv8/v8/src/zone.cc +31 -22
  516. data/lib/libv8/v8/src/zone.h +12 -6
  517. data/lib/libv8/v8/tools/codemap.js +8 -0
  518. data/lib/libv8/v8/tools/gcmole/Makefile +43 -0
  519. data/lib/libv8/v8/tools/gcmole/gcmole.lua +0 -2
  520. data/lib/libv8/v8/tools/gdb-v8-support.py +154 -0
  521. data/lib/libv8/v8/tools/grokdump.py +44 -35
  522. data/lib/libv8/v8/tools/gyp/v8.gyp +94 -248
  523. data/lib/libv8/v8/tools/js2c.py +83 -52
  524. data/lib/libv8/v8/tools/linux-tick-processor +4 -6
  525. data/lib/libv8/v8/tools/ll_prof.py +3 -3
  526. data/lib/libv8/v8/tools/oom_dump/README +3 -1
  527. data/lib/libv8/v8/tools/presubmit.py +11 -4
  528. data/lib/libv8/v8/tools/profile.js +46 -2
  529. data/lib/libv8/v8/tools/splaytree.js +11 -0
  530. data/lib/libv8/v8/tools/stats-viewer.py +15 -11
  531. data/lib/libv8/v8/tools/test-wrapper-gypbuild.py +227 -0
  532. data/lib/libv8/v8/tools/test.py +28 -8
  533. data/lib/libv8/v8/tools/tickprocessor.js +0 -16
  534. data/lib/libv8/version.rb +1 -1
  535. data/libv8.gemspec +2 -2
  536. metadata +31 -19
  537. data/lib/libv8/scons/engine/SCons/Tool/f03.py +0 -63
  538. data/lib/libv8/v8/src/json-parser.cc +0 -504
@@ -34,48 +34,62 @@
34
34
  namespace v8 {
35
35
  namespace internal {
36
36
 
37
+ FuncNameInferrer::FuncNameInferrer(Isolate* isolate)
38
+ : isolate_(isolate),
39
+ entries_stack_(10),
40
+ names_stack_(5),
41
+ funcs_to_infer_(4) {
42
+ }
43
+
37
44
 
38
45
  void FuncNameInferrer::PushEnclosingName(Handle<String> name) {
39
46
  // Enclosing name is a name of a constructor function. To check
40
47
  // that it is really a constructor, we check that it is not empty
41
48
  // and starts with a capital letter.
42
49
  if (name->length() > 0 && Runtime::IsUpperCaseChar(
43
- Isolate::Current()->runtime_state(), name->Get(0))) {
44
- names_stack_.Add(name);
50
+ isolate()->runtime_state(), name->Get(0))) {
51
+ names_stack_.Add(Name(name, kEnclosingConstructorName));
45
52
  }
46
53
  }
47
54
 
48
55
 
49
56
  void FuncNameInferrer::PushLiteralName(Handle<String> name) {
50
- if (IsOpen() && !HEAP->prototype_symbol()->Equals(*name)) {
51
- names_stack_.Add(name);
57
+ if (IsOpen() && !isolate()->heap()->prototype_symbol()->Equals(*name)) {
58
+ names_stack_.Add(Name(name, kLiteralName));
52
59
  }
53
60
  }
54
61
 
55
62
 
56
63
  void FuncNameInferrer::PushVariableName(Handle<String> name) {
57
- if (IsOpen() && !HEAP->result_symbol()->Equals(*name)) {
58
- names_stack_.Add(name);
64
+ if (IsOpen() && !isolate()->heap()->result_symbol()->Equals(*name)) {
65
+ names_stack_.Add(Name(name, kVariableName));
59
66
  }
60
67
  }
61
68
 
62
69
 
63
70
  Handle<String> FuncNameInferrer::MakeNameFromStack() {
64
- if (names_stack_.is_empty()) {
65
- return FACTORY->empty_string();
66
- } else {
67
- return MakeNameFromStackHelper(1, names_stack_.at(0));
68
- }
71
+ return MakeNameFromStackHelper(0, isolate()->factory()->empty_string());
69
72
  }
70
73
 
71
74
 
72
75
  Handle<String> FuncNameInferrer::MakeNameFromStackHelper(int pos,
73
76
  Handle<String> prev) {
74
- if (pos >= names_stack_.length()) {
75
- return prev;
77
+ if (pos >= names_stack_.length()) return prev;
78
+ if (pos < names_stack_.length() - 1 &&
79
+ names_stack_.at(pos).type == kVariableName &&
80
+ names_stack_.at(pos + 1).type == kVariableName) {
81
+ // Skip consecutive variable declarations.
82
+ return MakeNameFromStackHelper(pos + 1, prev);
76
83
  } else {
77
- Handle<String> curr = FACTORY->NewConsString(dot_, names_stack_.at(pos));
78
- return MakeNameFromStackHelper(pos + 1, FACTORY->NewConsString(prev, curr));
84
+ if (prev->length() > 0) {
85
+ Factory* factory = isolate()->factory();
86
+ Handle<String> curr = factory->NewConsString(
87
+ factory->dot_symbol(), names_stack_.at(pos).name);
88
+ return MakeNameFromStackHelper(pos + 1,
89
+ factory->NewConsString(prev, curr));
90
+ } else {
91
+ return MakeNameFromStackHelper(pos + 1, names_stack_.at(pos).name);
92
+ }
79
93
  }
80
94
  }
81
95
 
@@ -31,6 +31,8 @@
31
31
  namespace v8 {
32
32
  namespace internal {
33
33
 
34
+ class Isolate;
35
+
34
36
  // FuncNameInferrer is a stateful class that is used to perform name
35
37
  // inference for anonymous functions during static analysis of source code.
36
38
  // Inference is performed in cases when an anonymous function is assigned
@@ -43,12 +45,7 @@ namespace internal {
43
45
  // a name.
44
46
  class FuncNameInferrer : public ZoneObject {
45
47
  public:
46
- FuncNameInferrer()
47
- : entries_stack_(10),
48
- names_stack_(5),
49
- funcs_to_infer_(4),
50
- dot_(FACTORY->NewStringFromAscii(CStrVector("."))) {
51
- }
48
+ explicit FuncNameInferrer(Isolate* isolate);
52
49
 
53
50
  // Returns whether we have entered name collection state.
54
51
  bool IsOpen() const { return !entries_stack_.is_empty(); }
@@ -81,13 +78,26 @@ class FuncNameInferrer : public ZoneObject {
81
78
  }
82
79
  }
83
80
 
84
- // Infers a function name and leaves names collection state.
81
+ // Leaves names collection state.
85
82
  void Leave() {
86
83
  ASSERT(IsOpen());
87
84
  names_stack_.Rewind(entries_stack_.RemoveLast());
88
85
  }
89
86
 
90
87
  private:
88
+ enum NameType {
89
+ kEnclosingConstructorName,
90
+ kLiteralName,
91
+ kVariableName
92
+ };
93
+ struct Name {
94
+ Name(Handle<String> name, NameType type) : name(name), type(type) { }
95
+ Handle<String> name;
96
+ NameType type;
97
+ };
98
+
99
+ Isolate* isolate() { return isolate_; }
100
+
91
101
  // Constructs a full name in dotted notation from gathered names.
92
102
  Handle<String> MakeNameFromStack();
93
103
 
@@ -97,10 +107,10 @@ class FuncNameInferrer : public ZoneObject {
97
107
  // Performs name inferring for added functions.
98
108
  void InferFunctionsNames();
99
109
 
110
+ Isolate* isolate_;
100
111
  ZoneList<int> entries_stack_;
101
- ZoneList<Handle<String> > names_stack_;
112
+ ZoneList<Name> names_stack_;
102
113
  ZoneList<FunctionLiteral*> funcs_to_infer_;
103
- Handle<String> dot_;
104
114
 
105
115
  DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer);
106
116
  };
@@ -34,16 +34,29 @@
34
34
  #include "global-handles.h"
35
35
  #include "messages.h"
36
36
  #include "natives.h"
37
+ #include "scopeinfo.h"
37
38
 
38
39
  namespace v8 {
39
40
  namespace internal {
40
41
 
42
+ #ifdef __APPLE__
43
+ #define __MACH_O
44
+ class MachO;
45
+ class MachOSection;
46
+ typedef MachO DebugObject;
47
+ typedef MachOSection DebugSection;
48
+ #else
49
+ #define __ELF
41
50
  class ELF;
51
+ class ELFSection;
52
+ typedef ELF DebugObject;
53
+ typedef ELFSection DebugSection;
54
+ #endif
42
55
 
43
56
  class Writer BASE_EMBEDDED {
44
57
  public:
45
- explicit Writer(ELF* elf)
46
- : elf_(elf),
58
+ explicit Writer(DebugObject* debug_object)
59
+ : debug_object_(debug_object),
47
60
  position_(0),
48
61
  capacity_(1024),
49
62
  buffer_(reinterpret_cast<byte*>(malloc(capacity_))) {
@@ -112,7 +125,7 @@ class Writer BASE_EMBEDDED {
112
125
  }
113
126
  }
114
127
 
115
- ELF* elf() { return elf_; }
128
+ DebugObject* debug_object() { return debug_object_; }
116
129
 
117
130
  byte* buffer() { return buffer_; }
118
131
 
@@ -165,7 +178,7 @@ class Writer BASE_EMBEDDED {
165
178
  return reinterpret_cast<T*>(&buffer_[offset]);
166
179
  }
167
180
 
168
- ELF* elf_;
181
+ DebugObject* debug_object_;
169
182
  uintptr_t position_;
170
183
  uintptr_t capacity_;
171
184
  byte* buffer_;
@@ -173,21 +186,120 @@ class Writer BASE_EMBEDDED {
173
186
 
174
187
  class StringTable;
175
188
 
176
- class ELFSection : public ZoneObject {
189
+ template<typename THeader>
190
+ class DebugSectionBase : public ZoneObject {
177
191
  public:
178
- struct Header {
179
- uint32_t name;
180
- uint32_t type;
181
- uintptr_t flags;
182
- uintptr_t address;
183
- uintptr_t offset;
184
- uintptr_t size;
185
- uint32_t link;
186
- uint32_t info;
187
- uintptr_t alignment;
188
- uintptr_t entry_size;
192
+ virtual ~DebugSectionBase() { }
193
+
194
+ virtual void WriteBody(Writer::Slot<THeader> header, Writer* writer) {
195
+ uintptr_t start = writer->position();
196
+ if (WriteBody(writer)) {
197
+ uintptr_t end = writer->position();
198
+ header->offset = start;
199
+ #if defined(__MACH_O)
200
+ header->addr = 0;
201
+ #endif
202
+ header->size = end - start;
203
+ }
204
+ }
205
+
206
+ virtual bool WriteBody(Writer* writer) {
207
+ return false;
208
+ }
209
+
210
+ typedef THeader Header;
211
+ };
212
+
213
+
214
+ struct MachOSectionHeader {
215
+ char sectname[16];
216
+ char segname[16];
217
+ #if defined(V8_TARGET_ARCH_IA32)
218
+ uint32_t addr;
219
+ uint32_t size;
220
+ #else
221
+ uint64_t addr;
222
+ uint64_t size;
223
+ #endif
224
+ uint32_t offset;
225
+ uint32_t align;
226
+ uint32_t reloff;
227
+ uint32_t nreloc;
228
+ uint32_t flags;
229
+ uint32_t reserved1;
230
+ uint32_t reserved2;
231
+ };
232
+
233
+
234
+ class MachOSection : public DebugSectionBase<MachOSectionHeader> {
235
+ public:
236
+ enum Type {
237
+ S_REGULAR = 0x0u,
238
+ S_ATTR_COALESCED = 0xbu,
239
+ S_ATTR_SOME_INSTRUCTIONS = 0x400u,
240
+ S_ATTR_DEBUG = 0x02000000u,
241
+ S_ATTR_PURE_INSTRUCTIONS = 0x80000000u
189
242
  };
190
243
 
244
+ MachOSection(const char* name,
245
+ const char* segment,
246
+ uintptr_t align,
247
+ uint32_t flags)
248
+ : name_(name),
249
+ segment_(segment),
250
+ align_(align),
251
+ flags_(flags) {
252
+ ASSERT(IsPowerOf2(align));
253
+ if (align_ != 0) {
254
+ align_ = WhichPowerOf2(align_);
255
+ }
256
+ }
257
+
258
+ virtual ~MachOSection() { }
259
+
260
+ virtual void PopulateHeader(Writer::Slot<Header> header) {
261
+ header->addr = 0;
262
+ header->size = 0;
263
+ header->offset = 0;
264
+ header->align = align_;
265
+ header->reloff = 0;
266
+ header->nreloc = 0;
267
+ header->flags = flags_;
268
+ header->reserved1 = 0;
269
+ header->reserved2 = 0;
270
+ memset(header->sectname, 0, sizeof(header->sectname));
271
+ memset(header->segname, 0, sizeof(header->segname));
272
+ ASSERT(strlen(name_) < sizeof(header->sectname));
273
+ ASSERT(strlen(segment_) < sizeof(header->segname));
274
+ strncpy(header->sectname, name_, sizeof(header->sectname));
275
+ strncpy(header->segname, segment_, sizeof(header->segname));
276
+ }
277
+
278
+ private:
279
+ const char* name_;
280
+ const char* segment_;
281
+ uintptr_t align_;
282
+ uint32_t flags_;
283
+ };
284
+
285
+
286
+ struct ELFSectionHeader {
287
+ uint32_t name;
288
+ uint32_t type;
289
+ uintptr_t flags;
290
+ uintptr_t address;
291
+ uintptr_t offset;
292
+ uintptr_t size;
293
+ uint32_t link;
294
+ uint32_t info;
295
+ uintptr_t alignment;
296
+ uintptr_t entry_size;
297
+ };
298
+
299
+
300
+ #if defined(__ELF)
301
+ class ELFSection : public DebugSectionBase<ELFSectionHeader> {
302
+ public:
191
303
  enum Type {
192
304
  TYPE_NULL = 0,
193
305
  TYPE_PROGBITS = 1,
@@ -252,15 +364,45 @@ class ELFSection : public ZoneObject {
252
364
  header->entry_size = 0;
253
365
  }
254
366
 
255
-
256
367
  private:
257
368
  const char* name_;
258
369
  Type type_;
259
370
  uintptr_t align_;
260
371
  uint16_t index_;
261
372
  };
373
+ #endif // defined(__ELF)
262
374
 
263
375
 
376
+ #if defined(__MACH_O)
377
+ class MachOTextSection : public MachOSection {
378
+ public:
379
+ MachOTextSection(uintptr_t align,
380
+ uintptr_t addr,
381
+ uintptr_t size)
382
+ : MachOSection("__text",
383
+ "__TEXT",
384
+ align,
385
+ MachOSection::S_REGULAR |
386
+ MachOSection::S_ATTR_SOME_INSTRUCTIONS |
387
+ MachOSection::S_ATTR_PURE_INSTRUCTIONS),
388
+ addr_(addr),
389
+ size_(size) { }
390
+
391
+ protected:
392
+ virtual void PopulateHeader(Writer::Slot<Header> header) {
393
+ MachOSection::PopulateHeader(header);
394
+ header->addr = addr_;
395
+ header->size = size_;
396
+ }
397
+
398
+ private:
399
+ uintptr_t addr_;
400
+ uintptr_t size_;
401
+ };
402
+ #endif // defined(__MACH_O)
403
+
404
+
405
+ #if defined(__ELF)
264
406
  class FullHeaderELFSection : public ELFSection {
265
407
  public:
266
408
  FullHeaderELFSection(const char* name,
@@ -349,8 +491,139 @@ void ELFSection::PopulateHeader(Writer::Slot<ELFSection::Header> header,
349
491
  header->alignment = align_;
350
492
  PopulateHeader(header);
351
493
  }
494
+ #endif // defined(__ELF)
495
+
496
+
497
+ #if defined(__MACH_O)
498
+ class MachO BASE_EMBEDDED {
499
+ public:
500
+ MachO() : sections_(6) { }
501
+
502
+ uint32_t AddSection(MachOSection* section) {
503
+ sections_.Add(section);
504
+ return sections_.length() - 1;
505
+ }
506
+
507
+ void Write(Writer* w, uintptr_t code_start, uintptr_t code_size) {
508
+ Writer::Slot<MachOHeader> header = WriteHeader(w);
509
+ uintptr_t load_command_start = w->position();
510
+ Writer::Slot<MachOSegmentCommand> cmd = WriteSegmentCommand(w,
511
+ code_start,
512
+ code_size);
513
+ WriteSections(w, cmd, header, load_command_start);
514
+ }
515
+
516
+ private:
517
+ struct MachOHeader {
518
+ uint32_t magic;
519
+ uint32_t cputype;
520
+ uint32_t cpusubtype;
521
+ uint32_t filetype;
522
+ uint32_t ncmds;
523
+ uint32_t sizeofcmds;
524
+ uint32_t flags;
525
+ #if defined(V8_TARGET_ARCH_X64)
526
+ uint32_t reserved;
527
+ #endif
528
+ };
529
+
530
+ struct MachOSegmentCommand {
531
+ uint32_t cmd;
532
+ uint32_t cmdsize;
533
+ char segname[16];
534
+ #if defined(V8_TARGET_ARCH_IA32)
535
+ uint32_t vmaddr;
536
+ uint32_t vmsize;
537
+ uint32_t fileoff;
538
+ uint32_t filesize;
539
+ #else
540
+ uint64_t vmaddr;
541
+ uint64_t vmsize;
542
+ uint64_t fileoff;
543
+ uint64_t filesize;
544
+ #endif
545
+ uint32_t maxprot;
546
+ uint32_t initprot;
547
+ uint32_t nsects;
548
+ uint32_t flags;
549
+ };
550
+
551
+ enum MachOLoadCommandCmd {
552
+ LC_SEGMENT_32 = 0x00000001u,
553
+ LC_SEGMENT_64 = 0x00000019u
554
+ };
555
+
556
+
557
+ Writer::Slot<MachOHeader> WriteHeader(Writer* w) {
558
+ ASSERT(w->position() == 0);
559
+ Writer::Slot<MachOHeader> header = w->CreateSlotHere<MachOHeader>();
560
+ #if defined(V8_TARGET_ARCH_IA32)
561
+ header->magic = 0xFEEDFACEu;
562
+ header->cputype = 7; // i386
563
+ header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL
564
+ #elif defined(V8_TARGET_ARCH_X64)
565
+ header->magic = 0xFEEDFACFu;
566
+ header->cputype = 7 | 0x01000000; // i386 | 64-bit ABI
567
+ header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL
568
+ header->reserved = 0;
569
+ #else
570
+ #error Unsupported target architecture.
571
+ #endif
572
+ header->filetype = 0x1; // MH_OBJECT
573
+ header->ncmds = 1;
574
+ header->sizeofcmds = 0;
575
+ header->flags = 0;
576
+ return header;
577
+ }
352
578
 
353
579
 
580
+ Writer::Slot<MachOSegmentCommand> WriteSegmentCommand(Writer* w,
581
+ uintptr_t code_start,
582
+ uintptr_t code_size) {
583
+ Writer::Slot<MachOSegmentCommand> cmd =
584
+ w->CreateSlotHere<MachOSegmentCommand>();
585
+ #if defined(V8_TARGET_ARCH_IA32)
586
+ cmd->cmd = LC_SEGMENT_32;
587
+ #else
588
+ cmd->cmd = LC_SEGMENT_64;
589
+ #endif
590
+ cmd->vmaddr = code_start;
591
+ cmd->vmsize = code_size;
592
+ cmd->fileoff = 0;
593
+ cmd->filesize = 0;
594
+ cmd->maxprot = 7;
595
+ cmd->initprot = 7;
596
+ cmd->flags = 0;
597
+ cmd->nsects = sections_.length();
598
+ memset(cmd->segname, 0, 16);
599
+ cmd->cmdsize = sizeof(MachOSegmentCommand) + sizeof(MachOSection::Header) *
600
+ cmd->nsects;
601
+ return cmd;
602
+ }
603
+
604
+
605
+ void WriteSections(Writer* w,
606
+ Writer::Slot<MachOSegmentCommand> cmd,
607
+ Writer::Slot<MachOHeader> header,
608
+ uintptr_t load_command_start) {
609
+ Writer::Slot<MachOSection::Header> headers =
610
+ w->CreateSlotsHere<MachOSection::Header>(sections_.length());
611
+ cmd->fileoff = w->position();
612
+ header->sizeofcmds = w->position() - load_command_start;
613
+ for (int section = 0; section < sections_.length(); ++section) {
614
+ sections_[section]->PopulateHeader(headers.at(section));
615
+ sections_[section]->WriteBody(headers.at(section), w);
616
+ }
617
+ cmd->filesize = w->position() - (uintptr_t)cmd->fileoff;
618
+ }
619
+
620
+
621
+ ZoneList<MachOSection*> sections_;
622
+ };
623
+ #endif // defined(__MACH_O)
624
+
625
+
626
+ #if defined(__ELF)
354
627
  class ELF BASE_EMBEDDED {
355
628
  public:
356
629
  ELF() : sections_(6) {
@@ -596,7 +869,7 @@ class ELFSymbolTable : public ELFSection {
596
869
 
597
870
  // String table for this symbol table should follow it in the section table.
598
871
  StringTable* strtab =
599
- static_cast<StringTable*>(w->elf()->SectionAt(index() + 1));
872
+ static_cast<StringTable*>(w->debug_object()->SectionAt(index() + 1));
600
873
  strtab->AttachWriter(w);
601
874
  symbols.at(0).set(ELFSymbol::SerializedLayout(0,
602
875
  0,
@@ -640,11 +913,11 @@ class ELFSymbolTable : public ELFSection {
640
913
  ZoneList<ELFSymbol> locals_;
641
914
  ZoneList<ELFSymbol> globals_;
642
915
  };
916
+ #endif // defined(__ELF)
643
917
 
644
918
 
645
919
  class CodeDescription BASE_EMBEDDED {
646
920
  public:
647
-
648
921
  #ifdef V8_TARGET_ARCH_X64
649
922
  enum StackState {
650
923
  POST_RBP_PUSH,
@@ -658,12 +931,14 @@ class CodeDescription BASE_EMBEDDED {
658
931
  Code* code,
659
932
  Handle<Script> script,
660
933
  GDBJITLineInfo* lineinfo,
661
- GDBJITInterface::CodeTag tag)
934
+ GDBJITInterface::CodeTag tag,
935
+ CompilationInfo* info)
662
936
  : name_(name),
663
937
  code_(code),
664
938
  script_(script),
665
939
  lineinfo_(lineinfo),
666
- tag_(tag) {
940
+ tag_(tag),
941
+ info_(info) {
667
942
  }
668
943
 
669
944
  const char* name() const {
@@ -678,6 +953,14 @@ class CodeDescription BASE_EMBEDDED {
678
953
  return tag_;
679
954
  }
680
955
 
956
+ CompilationInfo* info() const {
957
+ return info_;
958
+ }
959
+
960
+ bool IsInfoAvailable() const {
961
+ return info_ != NULL;
962
+ }
963
+
681
964
  uintptr_t CodeStart() const {
682
965
  return reinterpret_cast<uintptr_t>(code_->instruction_start());
683
966
  }
@@ -725,12 +1008,13 @@ class CodeDescription BASE_EMBEDDED {
725
1008
  Handle<Script> script_;
726
1009
  GDBJITLineInfo* lineinfo_;
727
1010
  GDBJITInterface::CodeTag tag_;
1011
+ CompilationInfo* info_;
728
1012
  #ifdef V8_TARGET_ARCH_X64
729
1013
  uintptr_t stack_state_start_addresses_[STACK_STATE_MAX];
730
1014
  #endif
731
1015
  };
732
1016
 
733
-
1017
+ #if defined(__ELF)
734
1018
  static void CreateSymbolsTable(CodeDescription* desc,
735
1019
  ELF* elf,
736
1020
  int text_section_index) {
@@ -755,14 +1039,42 @@ static void CreateSymbolsTable(CodeDescription* desc,
755
1039
  ELFSymbol::TYPE_FUNC,
756
1040
  text_section_index));
757
1041
  }
1042
+ #endif // defined(__ELF)
758
1043
 
759
1044
 
760
- class DebugInfoSection : public ELFSection {
1045
+ class DebugInfoSection : public DebugSection {
761
1046
  public:
762
1047
  explicit DebugInfoSection(CodeDescription* desc)
763
- : ELFSection(".debug_info", TYPE_PROGBITS, 1), desc_(desc) { }
1048
+ #if defined(__ELF)
1049
+ : ELFSection(".debug_info", TYPE_PROGBITS, 1),
1050
+ #else
1051
+ : MachOSection("__debug_info",
1052
+ "__DWARF",
1053
+ 1,
1054
+ MachOSection::S_REGULAR | MachOSection::S_ATTR_DEBUG),
1055
+ #endif
1056
+ desc_(desc) { }
1057
+
1058
+ // DWARF2 standard
1059
+ enum DWARF2LocationOp {
1060
+ DW_OP_reg0 = 0x50,
1061
+ DW_OP_reg1 = 0x51,
1062
+ DW_OP_reg2 = 0x52,
1063
+ DW_OP_reg3 = 0x53,
1064
+ DW_OP_reg4 = 0x54,
1065
+ DW_OP_reg5 = 0x55,
1066
+ DW_OP_reg6 = 0x56,
1067
+ DW_OP_reg7 = 0x57,
1068
+ DW_OP_fbreg = 0x91 // 1 param: SLEB128 offset
1069
+ };
1070
+
1071
+ enum DWARF2Encoding {
1072
+ DW_ATE_ADDRESS = 0x1,
1073
+ DW_ATE_SIGNED = 0x5
1074
+ };
764
1075
 
765
1076
  bool WriteBody(Writer* w) {
1077
+ uintptr_t cu_start = w->position();
766
1078
  Writer::Slot<uint32_t> size = w->CreateSlotHere<uint32_t>();
767
1079
  uintptr_t start = w->position();
768
1080
  w->Write<uint16_t>(2); // DWARF version.
@@ -774,6 +1086,123 @@ class DebugInfoSection : public ELFSection {
774
1086
  w->Write<intptr_t>(desc_->CodeStart());
775
1087
  w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize());
776
1088
  w->Write<uint32_t>(0);
1089
+
1090
+ uint32_t ty_offset = static_cast<uint32_t>(w->position() - cu_start);
1091
+ w->WriteULEB128(3);
1092
+ w->Write<uint8_t>(kPointerSize);
1093
+ w->WriteString("v8value");
1094
+
1095
+ if (desc_->IsInfoAvailable()) {
1096
+ CompilationInfo* info = desc_->info();
1097
+ ScopeInfo<FreeStoreAllocationPolicy> scope_info(info->scope());
1098
+ w->WriteULEB128(2);
1099
+ w->WriteString(desc_->name());
1100
+ w->Write<intptr_t>(desc_->CodeStart());
1101
+ w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize());
1102
+ Writer::Slot<uint32_t> fb_block_size = w->CreateSlotHere<uint32_t>();
1103
+ uintptr_t fb_block_start = w->position();
1104
+ #if defined(V8_TARGET_ARCH_IA32)
1105
+ w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32
1106
+ #elif defined(V8_TARGET_ARCH_X64)
1107
+ w->Write<uint8_t>(DW_OP_reg6); // and here on x64.
1108
+ #else
1109
+ #error Unsupported target architecture.
1110
+ #endif
1111
+ fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start));
1112
+
1113
+ int params = scope_info.number_of_parameters();
1114
+ int slots = scope_info.number_of_stack_slots();
1115
+ int context_slots = scope_info.number_of_context_slots();
1116
+ // The real slot ID is internal_slots + context_slot_id.
1117
+ int internal_slots = Context::MIN_CONTEXT_SLOTS;
1118
+ int locals = scope_info.NumberOfLocals();
1119
+ int current_abbreviation = 4;
1120
+
1121
+ for (int param = 0; param < params; ++param) {
1122
+ w->WriteULEB128(current_abbreviation++);
1123
+ w->WriteString(
1124
+ *scope_info.parameter_name(param)->ToCString(DISALLOW_NULLS));
1125
+ w->Write<uint32_t>(ty_offset);
1126
+ Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
1127
+ uintptr_t block_start = w->position();
1128
+ w->Write<uint8_t>(DW_OP_fbreg);
1129
+ w->WriteSLEB128(
1130
+ JavaScriptFrameConstants::kLastParameterOffset +
1131
+ kPointerSize * (params - param - 1));
1132
+ block_size.set(static_cast<uint32_t>(w->position() - block_start));
1133
+ }
1134
+
1135
+ EmbeddedVector<char, 256> buffer;
1136
+ StringBuilder builder(buffer.start(), buffer.length());
1137
+
1138
+ for (int slot = 0; slot < slots; ++slot) {
1139
+ w->WriteULEB128(current_abbreviation++);
1140
+ builder.Reset();
1141
+ builder.AddFormatted("slot%d", slot);
1142
+ w->WriteString(builder.Finalize());
1143
+ }
1144
+
1145
+ // See contexts.h for more information.
1146
+ ASSERT(Context::MIN_CONTEXT_SLOTS == 4);
1147
+ ASSERT(Context::CLOSURE_INDEX == 0);
1148
+ ASSERT(Context::PREVIOUS_INDEX == 1);
1149
+ ASSERT(Context::EXTENSION_INDEX == 2);
1150
+ ASSERT(Context::GLOBAL_INDEX == 3);
1151
+ w->WriteULEB128(current_abbreviation++);
1152
+ w->WriteString(".closure");
1153
+ w->WriteULEB128(current_abbreviation++);
1154
+ w->WriteString(".previous");
1155
+ w->WriteULEB128(current_abbreviation++);
1156
+ w->WriteString(".extension");
1157
+ w->WriteULEB128(current_abbreviation++);
1158
+ w->WriteString(".global");
1159
+
1160
+ for (int context_slot = 0;
1161
+ context_slot < context_slots;
1162
+ ++context_slot) {
1163
+ w->WriteULEB128(current_abbreviation++);
1164
+ builder.Reset();
1165
+ builder.AddFormatted("context_slot%d", context_slot + internal_slots);
1166
+ w->WriteString(builder.Finalize());
1167
+ }
1168
+
1169
+ for (int local = 0; local < locals; ++local) {
1170
+ w->WriteULEB128(current_abbreviation++);
1171
+ w->WriteString(
1172
+ *scope_info.LocalName(local)->ToCString(DISALLOW_NULLS));
1173
+ w->Write<uint32_t>(ty_offset);
1174
+ Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
1175
+ uintptr_t block_start = w->position();
1176
+ w->Write<uint8_t>(DW_OP_fbreg);
1177
+ w->WriteSLEB128(
1178
+ JavaScriptFrameConstants::kLocal0Offset -
1179
+ kPointerSize * local);
1180
+ block_size.set(static_cast<uint32_t>(w->position() - block_start));
1181
+ }
1182
+
1183
+ {
1184
+ w->WriteULEB128(current_abbreviation++);
1185
+ w->WriteString("__function");
1186
+ w->Write<uint32_t>(ty_offset);
1187
+ Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
1188
+ uintptr_t block_start = w->position();
1189
+ w->Write<uint8_t>(DW_OP_fbreg);
1190
+ w->WriteSLEB128(JavaScriptFrameConstants::kFunctionOffset);
1191
+ block_size.set(static_cast<uint32_t>(w->position() - block_start));
1192
+ }
1193
+
1194
+ {
1195
+ w->WriteULEB128(current_abbreviation++);
1196
+ w->WriteString("__context");
1197
+ w->Write<uint32_t>(ty_offset);
1198
+ Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>();
1199
+ uintptr_t block_start = w->position();
1200
+ w->Write<uint8_t>(DW_OP_fbreg);
1201
+ w->WriteSLEB128(StandardFrameConstants::kContextOffset);
1202
+ block_size.set(static_cast<uint32_t>(w->position() - block_start));
1203
+ }
1204
+ }
1205
+
777
1206
  size.set(static_cast<uint32_t>(w->position() - start));
778
1207
  return true;
779
1208
  }
@@ -783,13 +1212,28 @@ class DebugInfoSection : public ELFSection {
783
1212
  };
784
1213
 
785
1214
 
786
- class DebugAbbrevSection : public ELFSection {
1215
+ class DebugAbbrevSection : public DebugSection {
787
1216
  public:
788
- DebugAbbrevSection() : ELFSection(".debug_abbrev", TYPE_PROGBITS, 1) { }
1217
+ explicit DebugAbbrevSection(CodeDescription* desc)
1218
+ #ifdef __ELF
1219
+ : ELFSection(".debug_abbrev", TYPE_PROGBITS, 1),
1220
+ #else
1221
+ : MachOSection("__debug_abbrev",
1222
+ "__DWARF",
1223
+ 1,
1224
+ MachOSection::S_REGULAR | MachOSection::S_ATTR_DEBUG),
1225
+ #endif
1226
+ desc_(desc) { }
789
1227
 
790
1228
  // DWARF2 standard, figure 14.
791
1229
  enum DWARF2Tags {
792
- DW_TAG_COMPILE_UNIT = 0x11
1230
+ DW_TAG_FORMAL_PARAMETER = 0x05,
1231
+ DW_TAG_POINTER_TYPE = 0xf,
1232
+ DW_TAG_COMPILE_UNIT = 0x11,
1233
+ DW_TAG_STRUCTURE_TYPE = 0x13,
1234
+ DW_TAG_BASE_TYPE = 0x24,
1235
+ DW_TAG_SUBPROGRAM = 0x2e,
1236
+ DW_TAG_VARIABLE = 0x34
793
1237
  };
794
1238
 
795
1239
  // DWARF2 standard, figure 16.
@@ -800,23 +1244,55 @@ class DebugAbbrevSection : public ELFSection {
800
1244
 
801
1245
  // DWARF standard, figure 17.
802
1246
  enum DWARF2Attribute {
1247
+ DW_AT_LOCATION = 0x2,
803
1248
  DW_AT_NAME = 0x3,
1249
+ DW_AT_BYTE_SIZE = 0xb,
804
1250
  DW_AT_STMT_LIST = 0x10,
805
1251
  DW_AT_LOW_PC = 0x11,
806
- DW_AT_HIGH_PC = 0x12
1252
+ DW_AT_HIGH_PC = 0x12,
1253
+ DW_AT_ENCODING = 0x3e,
1254
+ DW_AT_FRAME_BASE = 0x40,
1255
+ DW_AT_TYPE = 0x49
807
1256
  };
808
1257
 
809
1258
  // DWARF2 standard, figure 19.
810
1259
  enum DWARF2AttributeForm {
811
1260
  DW_FORM_ADDR = 0x1,
1261
+ DW_FORM_BLOCK4 = 0x4,
812
1262
  DW_FORM_STRING = 0x8,
813
- DW_FORM_DATA4 = 0x6
1263
+ DW_FORM_DATA4 = 0x6,
1264
+ DW_FORM_BLOCK = 0x9,
1265
+ DW_FORM_DATA1 = 0xb,
1266
+ DW_FORM_FLAG = 0xc,
1267
+ DW_FORM_REF4 = 0x13
814
1268
  };
815
1269
 
1270
+ void WriteVariableAbbreviation(Writer* w,
1271
+ int abbreviation_code,
1272
+ bool has_value,
1273
+ bool is_parameter) {
1274
+ w->WriteULEB128(abbreviation_code);
1275
+ w->WriteULEB128(is_parameter ? DW_TAG_FORMAL_PARAMETER : DW_TAG_VARIABLE);
1276
+ w->Write<uint8_t>(DW_CHILDREN_NO);
1277
+ w->WriteULEB128(DW_AT_NAME);
1278
+ w->WriteULEB128(DW_FORM_STRING);
1279
+ if (has_value) {
1280
+ w->WriteULEB128(DW_AT_TYPE);
1281
+ w->WriteULEB128(DW_FORM_REF4);
1282
+ w->WriteULEB128(DW_AT_LOCATION);
1283
+ w->WriteULEB128(DW_FORM_BLOCK4);
1284
+ }
1285
+ w->WriteULEB128(0);
1286
+ w->WriteULEB128(0);
1287
+ }
1288
+
816
1289
  bool WriteBody(Writer* w) {
817
- w->WriteULEB128(1);
1290
+ int current_abbreviation = 1;
1291
+ bool extra_info = desc_->IsInfoAvailable();
1292
+ ASSERT(desc_->IsLineInfoAvailable());
1293
+ w->WriteULEB128(current_abbreviation++);
818
1294
  w->WriteULEB128(DW_TAG_COMPILE_UNIT);
819
- w->Write<uint8_t>(DW_CHILDREN_NO);
1295
+ w->Write<uint8_t>(extra_info ? DW_CHILDREN_YES : DW_CHILDREN_NO);
820
1296
  w->WriteULEB128(DW_AT_NAME);
821
1297
  w->WriteULEB128(DW_FORM_STRING);
822
1298
  w->WriteULEB128(DW_AT_LOW_PC);
@@ -827,16 +1303,101 @@ class DebugAbbrevSection : public ELFSection {
827
1303
  w->WriteULEB128(DW_FORM_DATA4);
828
1304
  w->WriteULEB128(0);
829
1305
  w->WriteULEB128(0);
830
- w->WriteULEB128(0);
1306
+
1307
+ if (extra_info) {
1308
+ CompilationInfo* info = desc_->info();
1309
+ ScopeInfo<FreeStoreAllocationPolicy> scope_info(info->scope());
1310
+ int params = scope_info.number_of_parameters();
1311
+ int slots = scope_info.number_of_stack_slots();
1312
+ int context_slots = scope_info.number_of_context_slots();
1313
+ // The real slot ID is internal_slots + context_slot_id.
1314
+ int internal_slots = Context::MIN_CONTEXT_SLOTS;
1315
+ int locals = scope_info.NumberOfLocals();
1316
+ int total_children =
1317
+ params + slots + context_slots + internal_slots + locals + 2;
1318
+
1319
+ // The extra duplication below seems to be necessary to keep
1320
+ // gdb from getting upset on OSX.
1321
+ w->WriteULEB128(current_abbreviation++); // Abbreviation code.
1322
+ w->WriteULEB128(DW_TAG_SUBPROGRAM);
1323
+ w->Write<uint8_t>(
1324
+ total_children != 0 ? DW_CHILDREN_YES : DW_CHILDREN_NO);
1325
+ w->WriteULEB128(DW_AT_NAME);
1326
+ w->WriteULEB128(DW_FORM_STRING);
1327
+ w->WriteULEB128(DW_AT_LOW_PC);
1328
+ w->WriteULEB128(DW_FORM_ADDR);
1329
+ w->WriteULEB128(DW_AT_HIGH_PC);
1330
+ w->WriteULEB128(DW_FORM_ADDR);
1331
+ w->WriteULEB128(DW_AT_FRAME_BASE);
1332
+ w->WriteULEB128(DW_FORM_BLOCK4);
1333
+ w->WriteULEB128(0);
1334
+ w->WriteULEB128(0);
1335
+
1336
+ w->WriteULEB128(current_abbreviation++);
1337
+ w->WriteULEB128(DW_TAG_STRUCTURE_TYPE);
1338
+ w->Write<uint8_t>(DW_CHILDREN_NO);
1339
+ w->WriteULEB128(DW_AT_BYTE_SIZE);
1340
+ w->WriteULEB128(DW_FORM_DATA1);
1341
+ w->WriteULEB128(DW_AT_NAME);
1342
+ w->WriteULEB128(DW_FORM_STRING);
1343
+ w->WriteULEB128(0);
1344
+ w->WriteULEB128(0);
1345
+
1346
+ for (int param = 0; param < params; ++param) {
1347
+ WriteVariableAbbreviation(w, current_abbreviation++, true, true);
1348
+ }
1349
+
1350
+ for (int slot = 0; slot < slots; ++slot) {
1351
+ WriteVariableAbbreviation(w, current_abbreviation++, false, false);
1352
+ }
1353
+
1354
+ for (int internal_slot = 0;
1355
+ internal_slot < internal_slots;
1356
+ ++internal_slot) {
1357
+ WriteVariableAbbreviation(w, current_abbreviation++, false, false);
1358
+ }
1359
+
1360
+ for (int context_slot = 0;
1361
+ context_slot < context_slots;
1362
+ ++context_slot) {
1363
+ WriteVariableAbbreviation(w, current_abbreviation++, false, false);
1364
+ }
1365
+
1366
+ for (int local = 0; local < locals; ++local) {
1367
+ WriteVariableAbbreviation(w, current_abbreviation++, true, false);
1368
+ }
1369
+
1370
+ // The function.
1371
+ WriteVariableAbbreviation(w, current_abbreviation++, true, false);
1372
+
1373
+ // The context.
1374
+ WriteVariableAbbreviation(w, current_abbreviation++, true, false);
1375
+
1376
+ if (total_children != 0) {
1377
+ w->WriteULEB128(0); // Terminate the sibling list.
1378
+ }
1379
+ }
1380
+
1381
+ w->WriteULEB128(0); // Terminate the table.
831
1382
  return true;
832
1383
  }
1384
+
1385
+ private:
1386
+ CodeDescription* desc_;
833
1387
  };
834
1388
 
835
1389
 
836
- class DebugLineSection : public ELFSection {
1390
+ class DebugLineSection : public DebugSection {
837
1391
  public:
838
1392
  explicit DebugLineSection(CodeDescription* desc)
1393
+ #ifdef __ELF
839
1394
  : ELFSection(".debug_line", TYPE_PROGBITS, 1),
1395
+ #else
1396
+ : MachOSection("__debug_line",
1397
+ "__DWARF",
1398
+ 1,
1399
+ MachOSection::S_REGULAR | MachOSection::S_ATTR_DEBUG),
1400
+ #endif
840
1401
  desc_(desc) { }
841
1402
 
842
1403
  // DWARF2 standard, figure 34.
@@ -993,8 +1554,7 @@ class DebugLineSection : public ELFSection {
993
1554
 
994
1555
  #ifdef V8_TARGET_ARCH_X64
995
1556
 
996
-
997
- class UnwindInfoSection : public ELFSection {
1557
+ class UnwindInfoSection : public DebugSection {
998
1558
  public:
999
1559
  explicit UnwindInfoSection(CodeDescription *desc);
1000
1560
  virtual bool WriteBody(Writer *w);
@@ -1080,8 +1640,13 @@ void UnwindInfoSection::WriteLength(Writer *w,
1080
1640
 
1081
1641
 
1082
1642
  UnwindInfoSection::UnwindInfoSection(CodeDescription *desc)
1083
- : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1), desc_(desc)
1084
- { }
1643
+ #ifdef __ELF
1644
+ : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1),
1645
+ #else
1646
+ : MachOSection("__eh_frame", "__TEXT", sizeof(uintptr_t),
1647
+ MachOSection::S_REGULAR),
1648
+ #endif
1649
+ desc_(desc) { }
1085
1650
 
1086
1651
  int UnwindInfoSection::WriteCIE(Writer *w) {
1087
1652
  Writer::Slot<uint32_t> cie_length_slot = w->CreateSlotHere<uint32_t>();
@@ -1213,15 +1778,14 @@ bool UnwindInfoSection::WriteBody(Writer *w) {
1213
1778
 
1214
1779
  #endif // V8_TARGET_ARCH_X64
1215
1780
 
1216
-
1217
- static void CreateDWARFSections(CodeDescription* desc, ELF* elf) {
1781
+ static void CreateDWARFSections(CodeDescription* desc, DebugObject* obj) {
1218
1782
  if (desc->IsLineInfoAvailable()) {
1219
- elf->AddSection(new DebugInfoSection(desc));
1220
- elf->AddSection(new DebugAbbrevSection);
1221
- elf->AddSection(new DebugLineSection(desc));
1783
+ obj->AddSection(new DebugInfoSection(desc));
1784
+ obj->AddSection(new DebugAbbrevSection(desc));
1785
+ obj->AddSection(new DebugLineSection(desc));
1222
1786
  }
1223
1787
  #ifdef V8_TARGET_ARCH_X64
1224
- elf->AddSection(new UnwindInfoSection(desc));
1788
+ obj->AddSection(new UnwindInfoSection(desc));
1225
1789
  #endif
1226
1790
  }
1227
1791
 
@@ -1261,6 +1825,13 @@ extern "C" {
1261
1825
  // Static initialization is necessary to prevent GDB from seeing
1262
1826
  // uninitialized descriptor.
1263
1827
  JITDescriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
1828
+
1829
+ #ifdef OBJECT_PRINT
1830
+ void __gdb_print_v8_object(MaybeObject* object) {
1831
+ object->Print();
1832
+ fprintf(stdout, "\n");
1833
+ }
1834
+ #endif
1264
1835
  }
1265
1836
 
1266
1837
 
@@ -1284,17 +1855,23 @@ static void DestroyCodeEntry(JITCodeEntry* entry) {
1284
1855
  }
1285
1856
 
1286
1857
 
1287
- static void RegisterCodeEntry(JITCodeEntry* entry) {
1858
+ static void RegisterCodeEntry(JITCodeEntry* entry,
1859
+ bool dump_if_enabled,
1860
+ const char* name_hint) {
1288
1861
  #if defined(DEBUG) && !defined(WIN32)
1289
1862
  static int file_num = 0;
1290
- if (FLAG_gdbjit_dump) {
1863
+ if (FLAG_gdbjit_dump && dump_if_enabled) {
1291
1864
  static const int kMaxFileNameSize = 64;
1292
1865
  static const char* kElfFilePrefix = "/tmp/elfdump";
1293
1866
  static const char* kObjFileExt = ".o";
1294
1867
  char file_name[64];
1295
1868
 
1296
- OS::SNPrintF(Vector<char>(file_name, kMaxFileNameSize), "%s%d%s",
1297
- kElfFilePrefix, file_num++, kObjFileExt);
1869
+ OS::SNPrintF(Vector<char>(file_name, kMaxFileNameSize),
1870
+ "%s%s%d%s",
1871
+ kElfFilePrefix,
1872
+ (name_hint != NULL) ? name_hint : "",
1873
+ file_num++,
1874
+ kObjFileExt);
1298
1875
  WriteBytes(file_name, entry->symfile_addr_, entry->symfile_size_);
1299
1876
  }
1300
1877
  #endif
@@ -1327,8 +1904,19 @@ static void UnregisterCodeEntry(JITCodeEntry* entry) {
1327
1904
 
1328
1905
 
1329
1906
  static JITCodeEntry* CreateELFObject(CodeDescription* desc) {
1330
- ZoneScope zone_scope(DELETE_ON_EXIT);
1907
+ ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1908
+ #ifdef __MACH_O
1909
+ MachO mach_o;
1910
+ Writer w(&mach_o);
1911
+
1912
+ mach_o.AddSection(new MachOTextSection(kCodeAlignment,
1913
+ desc->CodeStart(),
1914
+ desc->CodeSize()));
1915
+
1916
+ CreateDWARFSections(desc, &mach_o);
1331
1917
 
1918
+ mach_o.Write(&w, desc->CodeStart(), desc->CodeSize());
1919
+ #else
1332
1920
  ELF elf;
1333
1921
  Writer w(&elf);
1334
1922
 
@@ -1346,6 +1934,7 @@ static JITCodeEntry* CreateELFObject(CodeDescription* desc) {
1346
1934
  CreateDWARFSections(desc, &elf);
1347
1935
 
1348
1936
  elf.Write(&w);
1937
+ #endif
1349
1938
 
1350
1939
  return CreateCodeEntry(w.buffer(), w.position());
1351
1940
  }
@@ -1394,7 +1983,8 @@ static GDBJITLineInfo* UntagLineInfo(void* ptr) {
1394
1983
 
1395
1984
  void GDBJITInterface::AddCode(Handle<String> name,
1396
1985
  Handle<Script> script,
1397
- Handle<Code> code) {
1986
+ Handle<Code> code,
1987
+ CompilationInfo* info) {
1398
1988
  if (!FLAG_gdbjit) return;
1399
1989
 
1400
1990
  // Force initialization of line_ends array.
@@ -1402,9 +1992,9 @@ void GDBJITInterface::AddCode(Handle<String> name,
1402
1992
 
1403
1993
  if (!name.is_null()) {
1404
1994
  SmartPointer<char> name_cstring = name->ToCString(DISALLOW_NULLS);
1405
- AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script);
1995
+ AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script, info);
1406
1996
  } else {
1407
- AddCode("", *code, GDBJITInterface::FUNCTION, *script);
1997
+ AddCode("", *code, GDBJITInterface::FUNCTION, *script, info);
1408
1998
  }
1409
1999
  }
1410
2000
 
@@ -1451,7 +2041,8 @@ Mutex* GDBJITInterface::mutex_ = OS::CreateMutex();
1451
2041
  void GDBJITInterface::AddCode(const char* name,
1452
2042
  Code* code,
1453
2043
  GDBJITInterface::CodeTag tag,
1454
- Script* script) {
2044
+ Script* script,
2045
+ CompilationInfo* info) {
1455
2046
  if (!FLAG_gdbjit) return;
1456
2047
 
1457
2048
  ScopedLock lock(mutex_);
@@ -1466,7 +2057,8 @@ void GDBJITInterface::AddCode(const char* name,
1466
2057
  script != NULL ? Handle<Script>(script)
1467
2058
  : Handle<Script>(),
1468
2059
  lineinfo,
1469
- tag);
2060
+ tag,
2061
+ info);
1470
2062
 
1471
2063
  if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) {
1472
2064
  delete lineinfo;
@@ -1481,7 +2073,18 @@ void GDBJITInterface::AddCode(const char* name,
1481
2073
  delete lineinfo;
1482
2074
  e->value = entry;
1483
2075
 
1484
- RegisterCodeEntry(entry);
2076
+ const char* name_hint = NULL;
2077
+ bool should_dump = false;
2078
+ if (FLAG_gdbjit_dump) {
2079
+ if (strlen(FLAG_gdbjit_dump_filter) == 0) {
2080
+ name_hint = name;
2081
+ should_dump = true;
2082
+ } else if (name != NULL) {
2083
+ name_hint = strstr(name, FLAG_gdbjit_dump_filter);
2084
+ should_dump = (name_hint != NULL);
2085
+ }
2086
+ }
2087
+ RegisterCodeEntry(entry, should_dump, name_hint);
1485
2088
  }
1486
2089
 
1487
2090
 
@@ -1501,7 +2104,7 @@ void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag,
1501
2104
  builder.AddFormatted(": code object %p", static_cast<void*>(code));
1502
2105
  }
1503
2106
 
1504
- AddCode(builder.Finalize(), code, tag);
2107
+ AddCode(builder.Finalize(), code, tag, NULL, NULL);
1505
2108
  }
1506
2109
 
1507
2110