libv8 3.3.10.4 → 3.5.10.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -237,10 +237,10 @@ class UpdateLiveObjectListVisitor: public ObjectVisitor {
237
237
  // to live new space objects, and not actually keep them alive.
238
238
  void UpdatePointer(Object** p) {
239
239
  Object* object = *p;
240
- if (!Heap::InNewSpace(object)) return;
240
+ if (!HEAP->InNewSpace(object)) return;
241
241
 
242
242
  HeapObject* heap_obj = HeapObject::cast(object);
243
- ASSERT(Heap::InFromSpace(heap_obj));
243
+ ASSERT(HEAP->InFromSpace(heap_obj));
244
244
 
245
245
  // We use the first word (where the map pointer usually is) of a heap
246
246
  // object to record the forwarding pointer. A forwarding pointer can
@@ -34,8 +34,6 @@
34
34
  namespace v8 {
35
35
  namespace internal {
36
36
 
37
- #ifdef ENABLE_LOGGING_AND_PROFILING
38
-
39
37
  Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
40
38
  Script* script) {
41
39
  if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG)
@@ -51,8 +49,6 @@ Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
51
49
  }
52
50
  }
53
51
 
54
- #endif // ENABLE_LOGGING_AND_PROFILING
55
-
56
52
 
57
53
  } } // namespace v8::internal
58
54
 
@@ -33,101 +33,14 @@
33
33
  namespace v8 {
34
34
  namespace internal {
35
35
 
36
- #ifdef ENABLE_LOGGING_AND_PROFILING
37
-
38
- LogDynamicBuffer::LogDynamicBuffer(
39
- int block_size, int max_size, const char* seal, int seal_size)
40
- : block_size_(block_size),
41
- max_size_(max_size - (max_size % block_size_)),
42
- seal_(seal),
43
- seal_size_(seal_size),
44
- blocks_(max_size_ / block_size_ + 1),
45
- write_pos_(0), block_index_(0), block_write_pos_(0), is_sealed_(false) {
46
- ASSERT(BlocksCount() > 0);
47
- AllocateBlock(0);
48
- for (int i = 1; i < BlocksCount(); ++i) {
49
- blocks_[i] = NULL;
50
- }
51
- }
52
-
53
36
 
54
- LogDynamicBuffer::~LogDynamicBuffer() {
55
- for (int i = 0; i < BlocksCount(); ++i) {
56
- DeleteArray(blocks_[i]);
57
- }
58
- }
37
+ const char* const Log::kLogToTemporaryFile = "&";
59
38
 
60
39
 
61
- int LogDynamicBuffer::Read(int from_pos, char* dest_buf, int buf_size) {
62
- if (buf_size == 0) return 0;
63
- int read_pos = from_pos;
64
- int block_read_index = BlockIndex(from_pos);
65
- int block_read_pos = PosInBlock(from_pos);
66
- int dest_buf_pos = 0;
67
- // Read until dest_buf is filled, or write_pos_ encountered.
68
- while (read_pos < write_pos_ && dest_buf_pos < buf_size) {
69
- const int read_size = Min(write_pos_ - read_pos,
70
- Min(buf_size - dest_buf_pos, block_size_ - block_read_pos));
71
- memcpy(dest_buf + dest_buf_pos,
72
- blocks_[block_read_index] + block_read_pos, read_size);
73
- block_read_pos += read_size;
74
- dest_buf_pos += read_size;
75
- read_pos += read_size;
76
- if (block_read_pos == block_size_) {
77
- block_read_pos = 0;
78
- ++block_read_index;
79
- }
80
- }
81
- return dest_buf_pos;
82
- }
83
-
84
-
85
- int LogDynamicBuffer::Seal() {
86
- WriteInternal(seal_, seal_size_);
87
- is_sealed_ = true;
88
- return 0;
89
- }
90
-
91
-
92
- int LogDynamicBuffer::Write(const char* data, int data_size) {
93
- if (is_sealed_) {
94
- return 0;
95
- }
96
- if ((write_pos_ + data_size) <= (max_size_ - seal_size_)) {
97
- return WriteInternal(data, data_size);
98
- } else {
99
- return Seal();
100
- }
101
- }
102
-
103
-
104
- int LogDynamicBuffer::WriteInternal(const char* data, int data_size) {
105
- int data_pos = 0;
106
- while (data_pos < data_size) {
107
- const int write_size =
108
- Min(data_size - data_pos, block_size_ - block_write_pos_);
109
- memcpy(blocks_[block_index_] + block_write_pos_, data + data_pos,
110
- write_size);
111
- block_write_pos_ += write_size;
112
- data_pos += write_size;
113
- if (block_write_pos_ == block_size_) {
114
- block_write_pos_ = 0;
115
- AllocateBlock(++block_index_);
116
- }
117
- }
118
- write_pos_ += data_size;
119
- return data_size;
120
- }
121
-
122
- // Must be the same message as in Logger::PauseProfiler.
123
- const char* const Log::kDynamicBufferSeal = "profiler,\"pause\"\n";
124
-
125
40
  Log::Log(Logger* logger)
126
- : write_to_file_(false),
127
- is_stopped_(false),
41
+ : is_stopped_(false),
128
42
  output_handle_(NULL),
129
43
  ll_output_handle_(NULL),
130
- output_buffer_(NULL),
131
44
  mutex_(NULL),
132
45
  message_buffer_(NULL),
133
46
  logger_(logger) {
@@ -142,7 +55,6 @@ static void AddIsolateIdIfNeeded(StringStream* stream) {
142
55
 
143
56
 
144
57
  void Log::Initialize() {
145
- #ifdef ENABLE_LOGGING_AND_PROFILING
146
58
  mutex_ = OS::CreateMutex();
147
59
  message_buffer_ = NewArray<char>(kMessageBufferSize);
148
60
 
@@ -166,19 +78,17 @@ void Log::Initialize() {
166
78
  FLAG_prof_auto = false;
167
79
  }
168
80
 
169
- bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api
81
+ bool open_log_file = FLAG_log || FLAG_log_runtime || FLAG_log_api
170
82
  || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
171
83
  || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof;
172
84
 
173
- bool open_log_file = start_logging || FLAG_prof_lazy;
174
-
175
85
  // If we're logging anything, we need to open the log file.
176
86
  if (open_log_file) {
177
87
  if (strcmp(FLAG_logfile, "-") == 0) {
178
88
  OpenStdout();
179
- } else if (strcmp(FLAG_logfile, "*") == 0) {
180
- OpenMemoryBuffer();
181
- } else {
89
+ } else if (strcmp(FLAG_logfile, kLogToTemporaryFile) == 0) {
90
+ OpenTemporaryFile();
91
+ } else {
182
92
  if (strchr(FLAG_logfile, '%') != NULL ||
183
93
  !Isolate::Current()->IsDefaultIsolate()) {
184
94
  // If there's a '%' in the log file name we have to expand
@@ -222,14 +132,18 @@ void Log::Initialize() {
222
132
  }
223
133
  }
224
134
  }
225
- #endif
226
135
  }
227
136
 
228
137
 
229
138
  void Log::OpenStdout() {
230
139
  ASSERT(!IsEnabled());
231
140
  output_handle_ = stdout;
232
- write_to_file_ = true;
141
+ }
142
+
143
+
144
+ void Log::OpenTemporaryFile() {
145
+ ASSERT(!IsEnabled());
146
+ output_handle_ = i::OS::OpenTemporaryFile();
233
147
  }
234
148
 
235
149
 
@@ -244,7 +158,6 @@ static const int kLowLevelLogBufferSize = 2 * MB;
244
158
  void Log::OpenFile(const char* name) {
245
159
  ASSERT(!IsEnabled());
246
160
  output_handle_ = OS::FOpen(name, OS::LogFileOpenMode);
247
- write_to_file_ = true;
248
161
  if (FLAG_ll_prof) {
249
162
  // Open the low-level log file.
250
163
  size_t len = strlen(name);
@@ -257,25 +170,18 @@ void Log::OpenFile(const char* name) {
257
170
  }
258
171
 
259
172
 
260
- void Log::OpenMemoryBuffer() {
261
- ASSERT(!IsEnabled());
262
- output_buffer_ = new LogDynamicBuffer(
263
- kDynamicBufferBlockSize, kMaxDynamicBufferSize,
264
- kDynamicBufferSeal, StrLength(kDynamicBufferSeal));
265
- write_to_file_ = false;
266
- }
267
-
268
-
269
- void Log::Close() {
270
- if (write_to_file_) {
271
- if (output_handle_ != NULL) fclose(output_handle_);
272
- output_handle_ = NULL;
273
- if (ll_output_handle_ != NULL) fclose(ll_output_handle_);
274
- ll_output_handle_ = NULL;
275
- } else {
276
- delete output_buffer_;
277
- output_buffer_ = NULL;
173
+ FILE* Log::Close() {
174
+ FILE* result = NULL;
175
+ if (output_handle_ != NULL) {
176
+ if (strcmp(FLAG_logfile, kLogToTemporaryFile) != 0) {
177
+ fclose(output_handle_);
178
+ } else {
179
+ result = output_handle_;
180
+ }
278
181
  }
182
+ output_handle_ = NULL;
183
+ if (ll_output_handle_ != NULL) fclose(ll_output_handle_);
184
+ ll_output_handle_ = NULL;
279
185
 
280
186
  DeleteArray(message_buffer_);
281
187
  message_buffer_ = NULL;
@@ -284,27 +190,7 @@ void Log::Close() {
284
190
  mutex_ = NULL;
285
191
 
286
192
  is_stopped_ = false;
287
- }
288
-
289
-
290
- int Log::GetLogLines(int from_pos, char* dest_buf, int max_size) {
291
- if (write_to_file_) return 0;
292
- ASSERT(output_buffer_ != NULL);
293
- ASSERT(from_pos >= 0);
294
- ASSERT(max_size >= 0);
295
- int actual_size = output_buffer_->Read(from_pos, dest_buf, max_size);
296
- ASSERT(actual_size <= max_size);
297
- if (actual_size == 0) return 0;
298
-
299
- // Find previous log line boundary.
300
- char* end_pos = dest_buf + actual_size - 1;
301
- while (end_pos >= dest_buf && *end_pos != '\n') --end_pos;
302
- actual_size = static_cast<int>(end_pos - dest_buf + 1);
303
- // If the assertion below is hit, it means that there was no line end
304
- // found --- something wrong has happened.
305
- ASSERT(actual_size > 0);
306
- ASSERT(actual_size <= max_size);
307
- return actual_size;
193
+ return result;
308
194
  }
309
195
 
310
196
 
@@ -413,9 +299,7 @@ void LogMessageBuilder::AppendStringPart(const char* str, int len) {
413
299
 
414
300
  void LogMessageBuilder::WriteToLogFile() {
415
301
  ASSERT(pos_ <= Log::kMessageBufferSize);
416
- const int written = log_->write_to_file_ ?
417
- log_->WriteToFile(log_->message_buffer_, pos_) :
418
- log_->WriteToMemory(log_->message_buffer_, pos_);
302
+ const int written = log_->WriteToFile(log_->message_buffer_, pos_);
419
303
  if (written != pos_) {
420
304
  log_->stop();
421
305
  log_->logger_->LogFailure();
@@ -423,6 +307,4 @@ void LogMessageBuilder::WriteToLogFile() {
423
307
  }
424
308
 
425
309
 
426
- #endif // ENABLE_LOGGING_AND_PROFILING
427
-
428
310
  } } // namespace v8::internal
@@ -33,69 +33,11 @@
33
33
  namespace v8 {
34
34
  namespace internal {
35
35
 
36
- #ifdef ENABLE_LOGGING_AND_PROFILING
37
-
38
36
  class Logger;
39
37
 
40
- // A memory buffer that increments its size as you write in it. Size
41
- // is incremented with 'block_size' steps, never exceeding 'max_size'.
42
- // During growth, memory contents are never copied. At the end of the
43
- // buffer an amount of memory specified in 'seal_size' is reserved.
44
- // When writing position reaches max_size - seal_size, buffer auto-seals
45
- // itself with 'seal' and allows no further writes. Data pointed by
46
- // 'seal' must be available during entire LogDynamicBuffer lifetime.
47
- //
48
- // An instance of this class is created dynamically by Log.
49
- class LogDynamicBuffer {
50
- public:
51
- LogDynamicBuffer(
52
- int block_size, int max_size, const char* seal, int seal_size);
53
-
54
- ~LogDynamicBuffer();
55
-
56
- // Reads contents of the buffer starting from 'from_pos'. Upon
57
- // return, 'dest_buf' is filled with the data. Actual amount of data
58
- // filled is returned, it is <= 'buf_size'.
59
- int Read(int from_pos, char* dest_buf, int buf_size);
60
-
61
- // Writes 'data' to the buffer, making it larger if necessary. If
62
- // data is too big to fit in the buffer, it doesn't get written at
63
- // all. In that case, buffer auto-seals itself and stops to accept
64
- // any incoming writes. Returns amount of data written (it is either
65
- // 'data_size', or 0, if 'data' is too big).
66
- int Write(const char* data, int data_size);
67
-
68
- private:
69
- void AllocateBlock(int index) {
70
- blocks_[index] = NewArray<char>(block_size_);
71
- }
72
-
73
- int BlockIndex(int pos) const { return pos / block_size_; }
74
-
75
- int BlocksCount() const { return BlockIndex(max_size_) + 1; }
76
-
77
- int PosInBlock(int pos) const { return pos % block_size_; }
78
-
79
- int Seal();
80
-
81
- int WriteInternal(const char* data, int data_size);
82
-
83
- const int block_size_;
84
- const int max_size_;
85
- const char* seal_;
86
- const int seal_size_;
87
- ScopedVector<char*> blocks_;
88
- int write_pos_;
89
- int block_index_;
90
- int block_write_pos_;
91
- bool is_sealed_;
92
- };
93
-
94
-
95
38
  // Functions and data for performing output of log messages.
96
39
  class Log {
97
40
  public:
98
-
99
41
  // Performs process-wide initialization.
100
42
  void Initialize();
101
43
 
@@ -103,18 +45,21 @@ class Log {
103
45
  void stop() { is_stopped_ = true; }
104
46
 
105
47
  // Frees all resources acquired in Initialize and Open... functions.
106
- void Close();
107
-
108
- // See description in include/v8.h.
109
- int GetLogLines(int from_pos, char* dest_buf, int max_size);
48
+ // When a temporary file is used for the log, returns its stream descriptor,
49
+ // leaving the file open.
50
+ FILE* Close();
110
51
 
111
52
  // Returns whether logging is enabled.
112
53
  bool IsEnabled() {
113
- return !is_stopped_ && (output_handle_ != NULL || output_buffer_ != NULL);
54
+ return !is_stopped_ && output_handle_ != NULL;
114
55
  }
115
56
 
116
57
  // Size of buffer used for formatting log messages.
117
- static const int kMessageBufferSize = v8::V8::kMinimumSizeForLogLinesBuffer;
58
+ static const int kMessageBufferSize = 2048;
59
+
60
+ // This mode is only used in tests, as temporary files are automatically
61
+ // deleted on close and thus can't be accessed afterwards.
62
+ static const char* const kLogToTemporaryFile;
118
63
 
119
64
  private:
120
65
  explicit Log(Logger* logger);
@@ -125,8 +70,8 @@ class Log {
125
70
  // Opens file for logging.
126
71
  void OpenFile(const char* name);
127
72
 
128
- // Opens memory buffer for logging.
129
- void OpenMemoryBuffer();
73
+ // Opens a temporary file for logging.
74
+ void OpenTemporaryFile();
130
75
 
131
76
  // Implementation of writing to a log file.
132
77
  int WriteToFile(const char* msg, int length) {
@@ -138,38 +83,16 @@ class Log {
138
83
  return length;
139
84
  }
140
85
 
141
- // Implementation of writing to a memory buffer.
142
- int WriteToMemory(const char* msg, int length) {
143
- ASSERT(output_buffer_ != NULL);
144
- return output_buffer_->Write(msg, length);
145
- }
146
-
147
- bool write_to_file_;
148
-
149
86
  // Whether logging is stopped (e.g. due to insufficient resources).
150
87
  bool is_stopped_;
151
88
 
152
- // When logging is active, either output_handle_ or output_buffer_ is used
153
- // to store a pointer to log destination. If logging was opened via OpenStdout
154
- // or OpenFile, then output_handle_ is used. If logging was opened
155
- // via OpenMemoryBuffer, then output_buffer_ is used.
156
- // mutex_ should be acquired before using output_handle_ or output_buffer_.
89
+ // When logging is active output_handle_ is used to store a pointer to log
90
+ // destination. mutex_ should be acquired before using output_handle_.
157
91
  FILE* output_handle_;
158
92
 
159
93
  // Used when low-level profiling is active.
160
94
  FILE* ll_output_handle_;
161
95
 
162
- LogDynamicBuffer* output_buffer_;
163
-
164
- // Size of dynamic buffer block (and dynamic buffer initial size).
165
- static const int kDynamicBufferBlockSize = 65536;
166
-
167
- // Maximum size of dynamic buffer.
168
- static const int kMaxDynamicBufferSize = 50 * 1024 * 1024;
169
-
170
- // Message to "seal" dynamic buffer with.
171
- static const char* const kDynamicBufferSeal;
172
-
173
96
  // mutex_ is a Mutex used for enforcing exclusive
174
97
  // access to the formatting buffer and the log file or log memory buffer.
175
98
  Mutex* mutex_;
@@ -224,8 +147,6 @@ class LogMessageBuilder BASE_EMBEDDED {
224
147
  int pos_;
225
148
  };
226
149
 
227
- #endif // ENABLE_LOGGING_AND_PROFILING
228
-
229
150
  } } // namespace v8::internal
230
151
 
231
152
  #endif // V8_LOG_UTILS_H_
@@ -43,8 +43,6 @@
43
43
  namespace v8 {
44
44
  namespace internal {
45
45
 
46
- #ifdef ENABLE_LOGGING_AND_PROFILING
47
-
48
46
  //
49
47
  // Sliding state window. Updates counters to keep track of the last
50
48
  // window of kBufferSize states. This is useful to track where we
@@ -122,6 +120,7 @@ class Profiler: public Thread {
122
120
  // Returns the next index in the cyclic buffer.
123
121
  int Succ(int index) { return (index + 1) % kBufferSize; }
124
122
 
123
+ Isolate* isolate_;
125
124
  // Cyclic buffer for communicating profiling samples
126
125
  // between the signal handler and the worker thread.
127
126
  static const int kBufferSize = 128;
@@ -148,10 +147,6 @@ class Profiler: public Thread {
148
147
  void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
149
148
  ASSERT(isolate->IsInitialized());
150
149
 
151
- sample->tos = NULL;
152
- sample->frames_count = 0;
153
- sample->has_external_callback = false;
154
-
155
150
  // Avoid collecting traces while doing GC.
156
151
  if (sample->state == GC) return;
157
152
 
@@ -271,7 +266,8 @@ void SlidingStateWindow::AddState(StateTag state) {
271
266
  // Profiler implementation.
272
267
  //
273
268
  Profiler::Profiler(Isolate* isolate)
274
- : Thread(isolate, "v8:Profiler"),
269
+ : Thread("v8:Profiler"),
270
+ isolate_(isolate),
275
271
  head_(0),
276
272
  tail_(0),
277
273
  overflow_(false),
@@ -326,9 +322,8 @@ void Profiler::Disengage() {
326
322
  void Profiler::Run() {
327
323
  TickSample sample;
328
324
  bool overflow = Remove(&sample);
329
- i::Isolate* isolate = ISOLATE;
330
325
  while (running_) {
331
- LOG(isolate, TickEvent(&sample, overflow));
326
+ LOG(isolate_, TickEvent(&sample, overflow));
332
327
  overflow = Remove(&sample);
333
328
  }
334
329
  }
@@ -399,8 +394,10 @@ class Logger::NameMap {
399
394
 
400
395
  void Remove(Address code_address) {
401
396
  HashMap::Entry* entry = FindEntry(code_address);
402
- if (entry != NULL) DeleteArray(static_cast<const char*>(entry->value));
403
- RemoveEntry(entry);
397
+ if (entry != NULL) {
398
+ DeleteArray(static_cast<char*>(entry->value));
399
+ RemoveEntry(entry);
400
+ }
404
401
  }
405
402
 
406
403
  void Move(Address from, Address to) {
@@ -522,7 +519,6 @@ Logger::Logger()
522
519
  log_events_(NULL),
523
520
  logging_nesting_(0),
524
521
  cpu_profiler_nesting_(0),
525
- heap_profiler_nesting_(0),
526
522
  log_(new Log(this)),
527
523
  name_buffer_(new NameBuffer),
528
524
  address_to_name_map_(NULL),
@@ -556,71 +552,54 @@ void Logger::ProfilerBeginEvent() {
556
552
  msg.WriteToLogFile();
557
553
  }
558
554
 
559
- #endif // ENABLE_LOGGING_AND_PROFILING
560
-
561
555
 
562
556
  void Logger::StringEvent(const char* name, const char* value) {
563
- #ifdef ENABLE_LOGGING_AND_PROFILING
564
557
  if (FLAG_log) UncheckedStringEvent(name, value);
565
- #endif
566
558
  }
567
559
 
568
560
 
569
- #ifdef ENABLE_LOGGING_AND_PROFILING
570
561
  void Logger::UncheckedStringEvent(const char* name, const char* value) {
571
562
  if (!log_->IsEnabled()) return;
572
563
  LogMessageBuilder msg(this);
573
564
  msg.Append("%s,\"%s\"\n", name, value);
574
565
  msg.WriteToLogFile();
575
566
  }
576
- #endif
577
567
 
578
568
 
579
569
  void Logger::IntEvent(const char* name, int value) {
580
- #ifdef ENABLE_LOGGING_AND_PROFILING
581
570
  if (FLAG_log) UncheckedIntEvent(name, value);
582
- #endif
583
571
  }
584
572
 
585
573
 
586
574
  void Logger::IntPtrTEvent(const char* name, intptr_t value) {
587
- #ifdef ENABLE_LOGGING_AND_PROFILING
588
575
  if (FLAG_log) UncheckedIntPtrTEvent(name, value);
589
- #endif
590
576
  }
591
577
 
592
578
 
593
- #ifdef ENABLE_LOGGING_AND_PROFILING
594
579
  void Logger::UncheckedIntEvent(const char* name, int value) {
595
580
  if (!log_->IsEnabled()) return;
596
581
  LogMessageBuilder msg(this);
597
582
  msg.Append("%s,%d\n", name, value);
598
583
  msg.WriteToLogFile();
599
584
  }
600
- #endif
601
585
 
602
586
 
603
- #ifdef ENABLE_LOGGING_AND_PROFILING
604
587
  void Logger::UncheckedIntPtrTEvent(const char* name, intptr_t value) {
605
588
  if (!log_->IsEnabled()) return;
606
589
  LogMessageBuilder msg(this);
607
590
  msg.Append("%s,%" V8_PTR_PREFIX "d\n", name, value);
608
591
  msg.WriteToLogFile();
609
592
  }
610
- #endif
611
593
 
612
594
 
613
595
  void Logger::HandleEvent(const char* name, Object** location) {
614
- #ifdef ENABLE_LOGGING_AND_PROFILING
615
596
  if (!log_->IsEnabled() || !FLAG_log_handles) return;
616
597
  LogMessageBuilder msg(this);
617
598
  msg.Append("%s,0x%" V8PRIxPTR "\n", name, location);
618
599
  msg.WriteToLogFile();
619
- #endif
620
600
  }
621
601
 
622
602
 
623
- #ifdef ENABLE_LOGGING_AND_PROFILING
624
603
  // ApiEvent is private so all the calls come from the Logger class. It is the
625
604
  // caller's responsibility to ensure that log is enabled and that
626
605
  // FLAG_log_api is true.
@@ -633,11 +612,9 @@ void Logger::ApiEvent(const char* format, ...) {
633
612
  va_end(ap);
634
613
  msg.WriteToLogFile();
635
614
  }
636
- #endif
637
615
 
638
616
 
639
617
  void Logger::ApiNamedSecurityCheck(Object* key) {
640
- #ifdef ENABLE_LOGGING_AND_PROFILING
641
618
  if (!log_->IsEnabled() || !FLAG_log_api) return;
642
619
  if (key->IsString()) {
643
620
  SmartPointer<char> str =
@@ -648,14 +625,12 @@ void Logger::ApiNamedSecurityCheck(Object* key) {
648
625
  } else {
649
626
  ApiEvent("api,check-security,['no-name']\n");
650
627
  }
651
- #endif
652
628
  }
653
629
 
654
630
 
655
631
  void Logger::SharedLibraryEvent(const char* library_path,
656
632
  uintptr_t start,
657
633
  uintptr_t end) {
658
- #ifdef ENABLE_LOGGING_AND_PROFILING
659
634
  if (!log_->IsEnabled() || !FLAG_prof) return;
660
635
  LogMessageBuilder msg(this);
661
636
  msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n",
@@ -663,14 +638,12 @@ void Logger::SharedLibraryEvent(const char* library_path,
663
638
  start,
664
639
  end);
665
640
  msg.WriteToLogFile();
666
- #endif
667
641
  }
668
642
 
669
643
 
670
644
  void Logger::SharedLibraryEvent(const wchar_t* library_path,
671
645
  uintptr_t start,
672
646
  uintptr_t end) {
673
- #ifdef ENABLE_LOGGING_AND_PROFILING
674
647
  if (!log_->IsEnabled() || !FLAG_prof) return;
675
648
  LogMessageBuilder msg(this);
676
649
  msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n",
@@ -678,11 +651,9 @@ void Logger::SharedLibraryEvent(const wchar_t* library_path,
678
651
  start,
679
652
  end);
680
653
  msg.WriteToLogFile();
681
- #endif
682
654
  }
683
655
 
684
656
 
685
- #ifdef ENABLE_LOGGING_AND_PROFILING
686
657
  void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
687
658
  // Prints "/" + re.source + "/" +
688
659
  // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"")
@@ -723,23 +694,19 @@ void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
723
694
 
724
695
  msg.WriteToLogFile();
725
696
  }
726
- #endif // ENABLE_LOGGING_AND_PROFILING
727
697
 
728
698
 
729
699
  void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) {
730
- #ifdef ENABLE_LOGGING_AND_PROFILING
731
700
  if (!log_->IsEnabled() || !FLAG_log_regexp) return;
732
701
  LogMessageBuilder msg(this);
733
702
  msg.Append("regexp-compile,");
734
703
  LogRegExpSource(regexp);
735
704
  msg.Append(in_cache ? ",hit\n" : ",miss\n");
736
705
  msg.WriteToLogFile();
737
- #endif
738
706
  }
739
707
 
740
708
 
741
709
  void Logger::LogRuntime(Vector<const char> format, JSArray* args) {
742
- #ifdef ENABLE_LOGGING_AND_PROFILING
743
710
  if (!log_->IsEnabled() || !FLAG_log_runtime) return;
744
711
  HandleScope scope;
745
712
  LogMessageBuilder msg(this);
@@ -780,22 +747,18 @@ void Logger::LogRuntime(Vector<const char> format, JSArray* args) {
780
747
  }
781
748
  msg.Append('\n');
782
749
  msg.WriteToLogFile();
783
- #endif
784
750
  }
785
751
 
786
752
 
787
753
  void Logger::ApiIndexedSecurityCheck(uint32_t index) {
788
- #ifdef ENABLE_LOGGING_AND_PROFILING
789
754
  if (!log_->IsEnabled() || !FLAG_log_api) return;
790
755
  ApiEvent("api,check-security,%u\n", index);
791
- #endif
792
756
  }
793
757
 
794
758
 
795
759
  void Logger::ApiNamedPropertyAccess(const char* tag,
796
760
  JSObject* holder,
797
761
  Object* name) {
798
- #ifdef ENABLE_LOGGING_AND_PROFILING
799
762
  ASSERT(name->IsString());
800
763
  if (!log_->IsEnabled() || !FLAG_log_api) return;
801
764
  String* class_name_obj = holder->class_name();
@@ -804,58 +767,47 @@ void Logger::ApiNamedPropertyAccess(const char* tag,
804
767
  SmartPointer<char> property_name =
805
768
  String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
806
769
  ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name);
807
- #endif
808
770
  }
809
771
 
810
772
  void Logger::ApiIndexedPropertyAccess(const char* tag,
811
773
  JSObject* holder,
812
774
  uint32_t index) {
813
- #ifdef ENABLE_LOGGING_AND_PROFILING
814
775
  if (!log_->IsEnabled() || !FLAG_log_api) return;
815
776
  String* class_name_obj = holder->class_name();
816
777
  SmartPointer<char> class_name =
817
778
  class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
818
779
  ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index);
819
- #endif
820
780
  }
821
781
 
822
782
  void Logger::ApiObjectAccess(const char* tag, JSObject* object) {
823
- #ifdef ENABLE_LOGGING_AND_PROFILING
824
783
  if (!log_->IsEnabled() || !FLAG_log_api) return;
825
784
  String* class_name_obj = object->class_name();
826
785
  SmartPointer<char> class_name =
827
786
  class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
828
787
  ApiEvent("api,%s,\"%s\"\n", tag, *class_name);
829
- #endif
830
788
  }
831
789
 
832
790
 
833
791
  void Logger::ApiEntryCall(const char* name) {
834
- #ifdef ENABLE_LOGGING_AND_PROFILING
835
792
  if (!log_->IsEnabled() || !FLAG_log_api) return;
836
793
  ApiEvent("api,%s\n", name);
837
- #endif
838
794
  }
839
795
 
840
796
 
841
797
  void Logger::NewEvent(const char* name, void* object, size_t size) {
842
- #ifdef ENABLE_LOGGING_AND_PROFILING
843
798
  if (!log_->IsEnabled() || !FLAG_log) return;
844
799
  LogMessageBuilder msg(this);
845
800
  msg.Append("new,%s,0x%" V8PRIxPTR ",%u\n", name, object,
846
801
  static_cast<unsigned int>(size));
847
802
  msg.WriteToLogFile();
848
- #endif
849
803
  }
850
804
 
851
805
 
852
806
  void Logger::DeleteEvent(const char* name, void* object) {
853
- #ifdef ENABLE_LOGGING_AND_PROFILING
854
807
  if (!log_->IsEnabled() || !FLAG_log) return;
855
808
  LogMessageBuilder msg(this);
856
809
  msg.Append("delete,%s,0x%" V8PRIxPTR "\n", name, object);
857
810
  msg.WriteToLogFile();
858
- #endif
859
811
  }
860
812
 
861
813
 
@@ -868,7 +820,6 @@ void Logger::DeleteEventStatic(const char* name, void* object) {
868
820
  LOGGER->DeleteEvent(name, object);
869
821
  }
870
822
 
871
- #ifdef ENABLE_LOGGING_AND_PROFILING
872
823
  void Logger::CallbackEventInternal(const char* prefix, const char* name,
873
824
  Address entry_point) {
874
825
  if (!log_->IsEnabled() || !FLAG_log_code) return;
@@ -881,43 +832,35 @@ void Logger::CallbackEventInternal(const char* prefix, const char* name,
881
832
  msg.Append('\n');
882
833
  msg.WriteToLogFile();
883
834
  }
884
- #endif
885
835
 
886
836
 
887
837
  void Logger::CallbackEvent(String* name, Address entry_point) {
888
- #ifdef ENABLE_LOGGING_AND_PROFILING
889
838
  if (!log_->IsEnabled() || !FLAG_log_code) return;
890
839
  SmartPointer<char> str =
891
840
  name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
892
841
  CallbackEventInternal("", *str, entry_point);
893
- #endif
894
842
  }
895
843
 
896
844
 
897
845
  void Logger::GetterCallbackEvent(String* name, Address entry_point) {
898
- #ifdef ENABLE_LOGGING_AND_PROFILING
899
846
  if (!log_->IsEnabled() || !FLAG_log_code) return;
900
847
  SmartPointer<char> str =
901
848
  name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
902
849
  CallbackEventInternal("get ", *str, entry_point);
903
- #endif
904
850
  }
905
851
 
906
852
 
907
853
  void Logger::SetterCallbackEvent(String* name, Address entry_point) {
908
- #ifdef ENABLE_LOGGING_AND_PROFILING
909
854
  if (!log_->IsEnabled() || !FLAG_log_code) return;
910
855
  SmartPointer<char> str =
911
856
  name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
912
857
  CallbackEventInternal("set ", *str, entry_point);
913
- #endif
914
858
  }
915
859
 
916
860
 
917
861
  void Logger::CodeCreateEvent(LogEventsAndTags tag,
918
862
  Code* code,
919
863
  const char* comment) {
920
- #ifdef ENABLE_LOGGING_AND_PROFILING
921
864
  if (!log_->IsEnabled()) return;
922
865
  if (FLAG_ll_prof || Serializer::enabled()) {
923
866
  name_buffer_->Reset();
@@ -947,14 +890,12 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
947
890
  msg.Append('"');
948
891
  msg.Append('\n');
949
892
  msg.WriteToLogFile();
950
- #endif
951
893
  }
952
894
 
953
895
 
954
896
  void Logger::CodeCreateEvent(LogEventsAndTags tag,
955
897
  Code* code,
956
898
  String* name) {
957
- #ifdef ENABLE_LOGGING_AND_PROFILING
958
899
  if (!log_->IsEnabled()) return;
959
900
  if (FLAG_ll_prof || Serializer::enabled()) {
960
901
  name_buffer_->Reset();
@@ -979,11 +920,9 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
979
920
  msg.Append('"');
980
921
  msg.Append('\n');
981
922
  msg.WriteToLogFile();
982
- #endif
983
923
  }
984
924
 
985
925
 
986
- #ifdef ENABLE_LOGGING_AND_PROFILING
987
926
  // ComputeMarker must only be used when SharedFunctionInfo is known.
988
927
  static const char* ComputeMarker(Code* code) {
989
928
  switch (code->kind()) {
@@ -992,14 +931,12 @@ static const char* ComputeMarker(Code* code) {
992
931
  default: return "";
993
932
  }
994
933
  }
995
- #endif
996
934
 
997
935
 
998
936
  void Logger::CodeCreateEvent(LogEventsAndTags tag,
999
937
  Code* code,
1000
938
  SharedFunctionInfo* shared,
1001
939
  String* name) {
1002
- #ifdef ENABLE_LOGGING_AND_PROFILING
1003
940
  if (!log_->IsEnabled()) return;
1004
941
  if (FLAG_ll_prof || Serializer::enabled()) {
1005
942
  name_buffer_->Reset();
@@ -1031,7 +968,6 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
1031
968
  msg.Append(",%s", ComputeMarker(code));
1032
969
  msg.Append('\n');
1033
970
  msg.WriteToLogFile();
1034
- #endif
1035
971
  }
1036
972
 
1037
973
 
@@ -1042,7 +978,6 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
1042
978
  Code* code,
1043
979
  SharedFunctionInfo* shared,
1044
980
  String* source, int line) {
1045
- #ifdef ENABLE_LOGGING_AND_PROFILING
1046
981
  if (!log_->IsEnabled()) return;
1047
982
  if (FLAG_ll_prof || Serializer::enabled()) {
1048
983
  name_buffer_->Reset();
@@ -1080,12 +1015,10 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
1080
1015
  msg.Append(",%s", ComputeMarker(code));
1081
1016
  msg.Append('\n');
1082
1017
  msg.WriteToLogFile();
1083
- #endif
1084
1018
  }
1085
1019
 
1086
1020
 
1087
1021
  void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
1088
- #ifdef ENABLE_LOGGING_AND_PROFILING
1089
1022
  if (!log_->IsEnabled()) return;
1090
1023
  if (FLAG_ll_prof || Serializer::enabled()) {
1091
1024
  name_buffer_->Reset();
@@ -1108,21 +1041,17 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
1108
1041
  msg.Append(",%d,\"args_count: %d\"", code->ExecutableSize(), args_count);
1109
1042
  msg.Append('\n');
1110
1043
  msg.WriteToLogFile();
1111
- #endif
1112
1044
  }
1113
1045
 
1114
1046
 
1115
1047
  void Logger::CodeMovingGCEvent() {
1116
- #ifdef ENABLE_LOGGING_AND_PROFILING
1117
1048
  if (!log_->IsEnabled() || !FLAG_ll_prof) return;
1118
1049
  LowLevelLogWriteBytes(&kCodeMovingGCTag, sizeof(kCodeMovingGCTag));
1119
1050
  OS::SignalCodeMovingGC();
1120
- #endif
1121
1051
  }
1122
1052
 
1123
1053
 
1124
1054
  void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
1125
- #ifdef ENABLE_LOGGING_AND_PROFILING
1126
1055
  if (!log_->IsEnabled()) return;
1127
1056
  if (FLAG_ll_prof || Serializer::enabled()) {
1128
1057
  name_buffer_->Reset();
@@ -1147,36 +1076,30 @@ void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
1147
1076
  msg.Append('\"');
1148
1077
  msg.Append('\n');
1149
1078
  msg.WriteToLogFile();
1150
- #endif
1151
1079
  }
1152
1080
 
1153
1081
 
1154
1082
  void Logger::CodeMoveEvent(Address from, Address to) {
1155
- #ifdef ENABLE_LOGGING_AND_PROFILING
1156
1083
  if (!log_->IsEnabled()) return;
1157
1084
  if (FLAG_ll_prof) LowLevelCodeMoveEvent(from, to);
1158
1085
  if (Serializer::enabled() && address_to_name_map_ != NULL) {
1159
1086
  address_to_name_map_->Move(from, to);
1160
1087
  }
1161
1088
  MoveEventInternal(CODE_MOVE_EVENT, from, to);
1162
- #endif
1163
1089
  }
1164
1090
 
1165
1091
 
1166
1092
  void Logger::CodeDeleteEvent(Address from) {
1167
- #ifdef ENABLE_LOGGING_AND_PROFILING
1168
1093
  if (!log_->IsEnabled()) return;
1169
1094
  if (FLAG_ll_prof) LowLevelCodeDeleteEvent(from);
1170
1095
  if (Serializer::enabled() && address_to_name_map_ != NULL) {
1171
1096
  address_to_name_map_->Remove(from);
1172
1097
  }
1173
1098
  DeleteEventInternal(CODE_DELETE_EVENT, from);
1174
- #endif
1175
1099
  }
1176
1100
 
1177
1101
 
1178
1102
  void Logger::SnapshotPositionEvent(Address addr, int pos) {
1179
- #ifdef ENABLE_LOGGING_AND_PROFILING
1180
1103
  if (!log_->IsEnabled()) return;
1181
1104
  if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos);
1182
1105
  if (Serializer::enabled() && address_to_name_map_ != NULL) {
@@ -1198,18 +1121,14 @@ void Logger::SnapshotPositionEvent(Address addr, int pos) {
1198
1121
  msg.Append(",%d", pos);
1199
1122
  msg.Append('\n');
1200
1123
  msg.WriteToLogFile();
1201
- #endif
1202
1124
  }
1203
1125
 
1204
1126
 
1205
1127
  void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) {
1206
- #ifdef ENABLE_LOGGING_AND_PROFILING
1207
1128
  MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to);
1208
- #endif
1209
1129
  }
1210
1130
 
1211
1131
 
1212
- #ifdef ENABLE_LOGGING_AND_PROFILING
1213
1132
  void Logger::MoveEventInternal(LogEventsAndTags event,
1214
1133
  Address from,
1215
1134
  Address to) {
@@ -1222,10 +1141,8 @@ void Logger::MoveEventInternal(LogEventsAndTags event,
1222
1141
  msg.Append('\n');
1223
1142
  msg.WriteToLogFile();
1224
1143
  }
1225
- #endif
1226
1144
 
1227
1145
 
1228
- #ifdef ENABLE_LOGGING_AND_PROFILING
1229
1146
  void Logger::DeleteEventInternal(LogEventsAndTags event, Address from) {
1230
1147
  if (!log_->IsEnabled() || !FLAG_log_code) return;
1231
1148
  LogMessageBuilder msg(this);
@@ -1234,11 +1151,9 @@ void Logger::DeleteEventInternal(LogEventsAndTags event, Address from) {
1234
1151
  msg.Append('\n');
1235
1152
  msg.WriteToLogFile();
1236
1153
  }
1237
- #endif
1238
1154
 
1239
1155
 
1240
1156
  void Logger::ResourceEvent(const char* name, const char* tag) {
1241
- #ifdef ENABLE_LOGGING_AND_PROFILING
1242
1157
  if (!log_->IsEnabled() || !FLAG_log) return;
1243
1158
  LogMessageBuilder msg(this);
1244
1159
  msg.Append("%s,%s,", name, tag);
@@ -1251,12 +1166,10 @@ void Logger::ResourceEvent(const char* name, const char* tag) {
1251
1166
 
1252
1167
  msg.Append('\n');
1253
1168
  msg.WriteToLogFile();
1254
- #endif
1255
1169
  }
1256
1170
 
1257
1171
 
1258
1172
  void Logger::SuspectReadEvent(String* name, Object* obj) {
1259
- #ifdef ENABLE_LOGGING_AND_PROFILING
1260
1173
  if (!log_->IsEnabled() || !FLAG_log_suspect) return;
1261
1174
  LogMessageBuilder msg(this);
1262
1175
  String* class_name = obj->IsJSObject()
@@ -1270,12 +1183,10 @@ void Logger::SuspectReadEvent(String* name, Object* obj) {
1270
1183
  msg.Append('"');
1271
1184
  msg.Append('\n');
1272
1185
  msg.WriteToLogFile();
1273
- #endif
1274
1186
  }
1275
1187
 
1276
1188
 
1277
1189
  void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
1278
- #ifdef ENABLE_LOGGING_AND_PROFILING
1279
1190
  if (!log_->IsEnabled() || !FLAG_log_gc) return;
1280
1191
  LogMessageBuilder msg(this);
1281
1192
  // Using non-relative system time in order to be able to synchronize with
@@ -1283,121 +1194,34 @@ void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
1283
1194
  msg.Append("heap-sample-begin,\"%s\",\"%s\",%.0f\n",
1284
1195
  space, kind, OS::TimeCurrentMillis());
1285
1196
  msg.WriteToLogFile();
1286
- #endif
1287
- }
1288
-
1289
-
1290
- void Logger::HeapSampleStats(const char* space, const char* kind,
1291
- intptr_t capacity, intptr_t used) {
1292
- #ifdef ENABLE_LOGGING_AND_PROFILING
1293
- if (!log_->IsEnabled() || !FLAG_log_gc) return;
1294
- LogMessageBuilder msg(this);
1295
- msg.Append("heap-sample-stats,\"%s\",\"%s\","
1296
- "%" V8_PTR_PREFIX "d,%" V8_PTR_PREFIX "d\n",
1297
- space, kind, capacity, used);
1298
- msg.WriteToLogFile();
1299
- #endif
1300
1197
  }
1301
1198
 
1302
1199
 
1303
1200
  void Logger::HeapSampleEndEvent(const char* space, const char* kind) {
1304
- #ifdef ENABLE_LOGGING_AND_PROFILING
1305
1201
  if (!log_->IsEnabled() || !FLAG_log_gc) return;
1306
1202
  LogMessageBuilder msg(this);
1307
1203
  msg.Append("heap-sample-end,\"%s\",\"%s\"\n", space, kind);
1308
1204
  msg.WriteToLogFile();
1309
- #endif
1310
1205
  }
1311
1206
 
1312
1207
 
1313
1208
  void Logger::HeapSampleItemEvent(const char* type, int number, int bytes) {
1314
- #ifdef ENABLE_LOGGING_AND_PROFILING
1315
1209
  if (!log_->IsEnabled() || !FLAG_log_gc) return;
1316
1210
  LogMessageBuilder msg(this);
1317
1211
  msg.Append("heap-sample-item,%s,%d,%d\n", type, number, bytes);
1318
1212
  msg.WriteToLogFile();
1319
- #endif
1320
- }
1321
-
1322
-
1323
- void Logger::HeapSampleJSConstructorEvent(const char* constructor,
1324
- int number, int bytes) {
1325
- #ifdef ENABLE_LOGGING_AND_PROFILING
1326
- if (!log_->IsEnabled() || !FLAG_log_gc) return;
1327
- LogMessageBuilder msg(this);
1328
- msg.Append("heap-js-cons-item,%s,%d,%d\n", constructor, number, bytes);
1329
- msg.WriteToLogFile();
1330
- #endif
1331
- }
1332
-
1333
- // Event starts with comma, so we don't have it in the format string.
1334
- static const char kEventText[] = "heap-js-ret-item,%s";
1335
- // We take placeholder strings into account, but it's OK to be conservative.
1336
- static const int kEventTextLen = sizeof(kEventText)/sizeof(kEventText[0]);
1337
-
1338
- void Logger::HeapSampleJSRetainersEvent(
1339
- const char* constructor, const char* event) {
1340
- #ifdef ENABLE_LOGGING_AND_PROFILING
1341
- if (!log_->IsEnabled() || !FLAG_log_gc) return;
1342
- const int cons_len = StrLength(constructor);
1343
- const int event_len = StrLength(event);
1344
- int pos = 0;
1345
- // Retainer lists can be long. We may need to split them into multiple events.
1346
- do {
1347
- LogMessageBuilder msg(this);
1348
- msg.Append(kEventText, constructor);
1349
- int to_write = event_len - pos;
1350
- if (to_write > Log::kMessageBufferSize - (cons_len + kEventTextLen)) {
1351
- int cut_pos = pos + Log::kMessageBufferSize - (cons_len + kEventTextLen);
1352
- ASSERT(cut_pos < event_len);
1353
- while (cut_pos > pos && event[cut_pos] != ',') --cut_pos;
1354
- if (event[cut_pos] != ',') {
1355
- // Crash in debug mode, skip in release mode.
1356
- ASSERT(false);
1357
- return;
1358
- }
1359
- // Append a piece of event that fits, without trailing comma.
1360
- msg.AppendStringPart(event + pos, cut_pos - pos);
1361
- // Start next piece with comma.
1362
- pos = cut_pos;
1363
- } else {
1364
- msg.Append("%s", event + pos);
1365
- pos += event_len;
1366
- }
1367
- msg.Append('\n');
1368
- msg.WriteToLogFile();
1369
- } while (pos < event_len);
1370
- #endif
1371
- }
1372
-
1373
-
1374
- void Logger::HeapSampleJSProducerEvent(const char* constructor,
1375
- Address* stack) {
1376
- #ifdef ENABLE_LOGGING_AND_PROFILING
1377
- if (!log_->IsEnabled() || !FLAG_log_gc) return;
1378
- LogMessageBuilder msg(this);
1379
- msg.Append("heap-js-prod-item,%s", constructor);
1380
- while (*stack != NULL) {
1381
- msg.Append(",0x%" V8PRIxPTR, *stack++);
1382
- }
1383
- msg.Append("\n");
1384
- msg.WriteToLogFile();
1385
- #endif
1386
1213
  }
1387
1214
 
1388
1215
 
1389
1216
  void Logger::DebugTag(const char* call_site_tag) {
1390
- #ifdef ENABLE_LOGGING_AND_PROFILING
1391
1217
  if (!log_->IsEnabled() || !FLAG_log) return;
1392
1218
  LogMessageBuilder msg(this);
1393
1219
  msg.Append("debug-tag,%s\n", call_site_tag);
1394
1220
  msg.WriteToLogFile();
1395
- #endif
1396
1221
  }
1397
1222
 
1398
1223
 
1399
1224
  void Logger::DebugEvent(const char* event_type, Vector<uint16_t> parameter) {
1400
- #ifdef ENABLE_LOGGING_AND_PROFILING
1401
1225
  if (!log_->IsEnabled() || !FLAG_log) return;
1402
1226
  StringBuilder s(parameter.length() + 1);
1403
1227
  for (int i = 0; i < parameter.length(); ++i) {
@@ -1411,11 +1235,9 @@ void Logger::DebugEvent(const char* event_type, Vector<uint16_t> parameter) {
1411
1235
  parameter_string);
1412
1236
  DeleteArray(parameter_string);
1413
1237
  msg.WriteToLogFile();
1414
- #endif
1415
1238
  }
1416
1239
 
1417
1240
 
1418
- #ifdef ENABLE_LOGGING_AND_PROFILING
1419
1241
  void Logger::TickEvent(TickSample* sample, bool overflow) {
1420
1242
  if (!log_->IsEnabled() || !FLAG_prof) return;
1421
1243
  LogMessageBuilder msg(this);
@@ -1443,21 +1265,14 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
1443
1265
  }
1444
1266
 
1445
1267
 
1446
- int Logger::GetActiveProfilerModules() {
1447
- int result = PROFILER_MODULE_NONE;
1448
- if (profiler_ != NULL && !profiler_->paused()) {
1449
- result |= PROFILER_MODULE_CPU;
1450
- }
1451
- if (FLAG_log_gc) {
1452
- result |= PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS;
1453
- }
1454
- return result;
1268
+ bool Logger::IsProfilerPaused() {
1269
+ return profiler_ == NULL || profiler_->paused();
1455
1270
  }
1456
1271
 
1457
1272
 
1458
- void Logger::PauseProfiler(int flags, int tag) {
1273
+ void Logger::PauseProfiler() {
1459
1274
  if (!log_->IsEnabled()) return;
1460
- if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) {
1275
+ if (profiler_ != NULL) {
1461
1276
  // It is OK to have negative nesting.
1462
1277
  if (--cpu_profiler_nesting_ == 0) {
1463
1278
  profiler_->pause();
@@ -1466,31 +1281,17 @@ void Logger::PauseProfiler(int flags, int tag) {
1466
1281
  ticker_->Stop();
1467
1282
  }
1468
1283
  FLAG_log_code = false;
1469
- // Must be the same message as Log::kDynamicBufferSeal.
1470
1284
  LOG(ISOLATE, UncheckedStringEvent("profiler", "pause"));
1471
1285
  }
1472
1286
  --logging_nesting_;
1473
1287
  }
1474
1288
  }
1475
- if (flags &
1476
- (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
1477
- if (--heap_profiler_nesting_ == 0) {
1478
- FLAG_log_gc = false;
1479
- --logging_nesting_;
1480
- }
1481
- }
1482
- if (tag != 0) {
1483
- UncheckedIntEvent("close-tag", tag);
1484
- }
1485
1289
  }
1486
1290
 
1487
1291
 
1488
- void Logger::ResumeProfiler(int flags, int tag) {
1292
+ void Logger::ResumeProfiler() {
1489
1293
  if (!log_->IsEnabled()) return;
1490
- if (tag != 0) {
1491
- UncheckedIntEvent("open-tag", tag);
1492
- }
1493
- if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) {
1294
+ if (profiler_ != NULL) {
1494
1295
  if (cpu_profiler_nesting_++ == 0) {
1495
1296
  ++logging_nesting_;
1496
1297
  if (FLAG_prof_lazy) {
@@ -1506,20 +1307,13 @@ void Logger::ResumeProfiler(int flags, int tag) {
1506
1307
  profiler_->resume();
1507
1308
  }
1508
1309
  }
1509
- if (flags &
1510
- (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
1511
- if (heap_profiler_nesting_++ == 0) {
1512
- ++logging_nesting_;
1513
- FLAG_log_gc = true;
1514
- }
1515
- }
1516
1310
  }
1517
1311
 
1518
1312
 
1519
1313
  // This function can be called when Log's mutex is acquired,
1520
1314
  // either from main or Profiler's thread.
1521
1315
  void Logger::LogFailure() {
1522
- PauseProfiler(PROFILER_MODULE_CPU, 0);
1316
+ PauseProfiler();
1523
1317
  }
1524
1318
 
1525
1319
 
@@ -1528,11 +1322,6 @@ bool Logger::IsProfilerSamplerActive() {
1528
1322
  }
1529
1323
 
1530
1324
 
1531
- int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) {
1532
- return log_->GetLogLines(from_pos, dest_buf, max_size);
1533
- }
1534
-
1535
-
1536
1325
  class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor {
1537
1326
  public:
1538
1327
  EnumerateOptimizedFunctionsVisitor(Handle<SharedFunctionInfo>* sfis,
@@ -1544,8 +1333,12 @@ class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor {
1544
1333
  virtual void LeaveContext(Context* context) {}
1545
1334
 
1546
1335
  virtual void VisitFunction(JSFunction* function) {
1336
+ SharedFunctionInfo* sfi = SharedFunctionInfo::cast(function->shared());
1337
+ Object* maybe_script = sfi->script();
1338
+ if (maybe_script->IsScript()
1339
+ && !Script::cast(maybe_script)->HasValidSource()) return;
1547
1340
  if (sfis_ != NULL) {
1548
- sfis_[*count_] = Handle<SharedFunctionInfo>(function->shared());
1341
+ sfis_[*count_] = Handle<SharedFunctionInfo>(sfi);
1549
1342
  }
1550
1343
  if (code_objects_ != NULL) {
1551
1344
  ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION);
@@ -1607,6 +1400,7 @@ void Logger::LogCodeObject(Object* object) {
1607
1400
  case Code::UNARY_OP_IC: // fall through
1608
1401
  case Code::BINARY_OP_IC: // fall through
1609
1402
  case Code::COMPARE_IC: // fall through
1403
+ case Code::TO_BOOLEAN_IC: // fall through
1610
1404
  case Code::STUB:
1611
1405
  description =
1612
1406
  CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true);
@@ -1649,7 +1443,6 @@ void Logger::LogCodeObject(Object* object) {
1649
1443
 
1650
1444
 
1651
1445
  void Logger::LogCodeInfo() {
1652
- #ifdef ENABLE_LOGGING_AND_PROFILING
1653
1446
  if (!log_->IsEnabled() || !FLAG_ll_prof) return;
1654
1447
  #if V8_TARGET_ARCH_IA32
1655
1448
  const char arch[] = "ia32";
@@ -1661,7 +1454,6 @@ void Logger::LogCodeInfo() {
1661
1454
  const char arch[] = "unknown";
1662
1455
  #endif
1663
1456
  LowLevelLogWriteBytes(arch, sizeof(arch));
1664
- #endif // ENABLE_LOGGING_AND_PROFILING
1665
1457
  }
1666
1458
 
1667
1459
 
@@ -1814,11 +1606,8 @@ void Logger::LogAccessorCallbacks() {
1814
1606
  }
1815
1607
  }
1816
1608
 
1817
- #endif
1818
-
1819
1609
 
1820
1610
  bool Logger::Setup() {
1821
- #ifdef ENABLE_LOGGING_AND_PROFILING
1822
1611
  // Tests and EnsureInitialize() can call this twice in a row. It's harmless.
1823
1612
  if (is_initialized_) return true;
1824
1613
  is_initialized_ = true;
@@ -1842,9 +1631,9 @@ bool Logger::Setup() {
1842
1631
 
1843
1632
  if (FLAG_ll_prof) LogCodeInfo();
1844
1633
 
1845
- ticker_ = new Ticker(Isolate::Current(), kSamplingIntervalMs);
1846
-
1847
1634
  Isolate* isolate = Isolate::Current();
1635
+ ticker_ = new Ticker(isolate, kSamplingIntervalMs);
1636
+
1848
1637
  if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
1849
1638
  sliding_state_window_ = new SlidingStateWindow(isolate);
1850
1639
  }
@@ -1870,10 +1659,6 @@ bool Logger::Setup() {
1870
1659
  }
1871
1660
 
1872
1661
  return true;
1873
-
1874
- #else
1875
- return false;
1876
- #endif
1877
1662
  }
1878
1663
 
1879
1664
 
@@ -1883,23 +1668,18 @@ Sampler* Logger::sampler() {
1883
1668
 
1884
1669
 
1885
1670
  void Logger::EnsureTickerStarted() {
1886
- #ifdef ENABLE_LOGGING_AND_PROFILING
1887
1671
  ASSERT(ticker_ != NULL);
1888
1672
  if (!ticker_->IsActive()) ticker_->Start();
1889
- #endif
1890
1673
  }
1891
1674
 
1892
1675
 
1893
1676
  void Logger::EnsureTickerStopped() {
1894
- #ifdef ENABLE_LOGGING_AND_PROFILING
1895
1677
  if (ticker_ != NULL && ticker_->IsActive()) ticker_->Stop();
1896
- #endif
1897
1678
  }
1898
1679
 
1899
1680
 
1900
- void Logger::TearDown() {
1901
- #ifdef ENABLE_LOGGING_AND_PROFILING
1902
- if (!is_initialized_) return;
1681
+ FILE* Logger::TearDown() {
1682
+ if (!is_initialized_) return NULL;
1903
1683
  is_initialized_ = false;
1904
1684
 
1905
1685
  // Stop the profiler before closing the file.
@@ -1915,13 +1695,11 @@ void Logger::TearDown() {
1915
1695
  delete ticker_;
1916
1696
  ticker_ = NULL;
1917
1697
 
1918
- log_->Close();
1919
- #endif
1698
+ return log_->Close();
1920
1699
  }
1921
1700
 
1922
1701
 
1923
1702
  void Logger::EnableSlidingStateWindow() {
1924
- #ifdef ENABLE_LOGGING_AND_PROFILING
1925
1703
  // If the ticker is NULL, Logger::Setup has not been called yet. In
1926
1704
  // that case, we set the sliding_state_window flag so that the
1927
1705
  // sliding window computation will be started when Logger::Setup is
@@ -1935,7 +1713,6 @@ void Logger::EnableSlidingStateWindow() {
1935
1713
  if (sliding_state_window_ == NULL) {
1936
1714
  sliding_state_window_ = new SlidingStateWindow(Isolate::Current());
1937
1715
  }
1938
- #endif
1939
1716
  }
1940
1717
 
1941
1718