therubyracer 0.9.0beta4 → 0.9.0beta5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

Files changed (771) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +0 -11
  3. data/ext/v8/extconf.rb +9 -9
  4. data/ext/v8/v8_external.cpp +40 -10
  5. data/lib/v8/cli.rb +2 -1
  6. data/lib/v8/version.rb +1 -1
  7. data/spec/redjs/.gitignore +1 -0
  8. data/therubyracer.gemspec +2 -3
  9. metadata +33 -779
  10. data/ext/v8/upstream/Makefile +0 -38
  11. data/ext/v8/upstream/detect_cpu.rb +0 -27
  12. data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
  13. data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
  14. data/ext/v8/upstream/scons/LICENSE.txt +0 -20
  15. data/ext/v8/upstream/scons/MANIFEST +0 -202
  16. data/ext/v8/upstream/scons/PKG-INFO +0 -13
  17. data/ext/v8/upstream/scons/README.txt +0 -273
  18. data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
  19. data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
  20. data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
  21. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
  22. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
  23. data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
  24. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
  25. data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
  26. data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
  27. data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
  28. data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
  29. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
  30. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
  31. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
  32. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
  33. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
  34. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
  35. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
  36. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
  37. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
  38. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
  39. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
  40. data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
  41. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
  42. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
  43. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
  44. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
  45. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
  46. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
  47. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
  48. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
  49. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
  50. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
  51. data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
  52. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
  53. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
  54. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
  55. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
  56. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
  57. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
  58. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
  59. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
  60. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
  61. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
  62. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
  63. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
  64. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
  65. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
  66. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
  67. data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
  68. data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
  69. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
  70. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
  71. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
  72. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
  73. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
  74. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
  75. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
  76. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
  77. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
  78. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
  79. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
  80. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
  81. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
  82. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
  83. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
  84. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
  85. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
  86. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
  87. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
  88. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
  89. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
  90. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
  91. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
  92. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
  93. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
  94. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
  95. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
  96. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
  97. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
  98. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
  99. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
  100. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
  101. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
  102. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
  103. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
  104. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
  105. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
  106. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
  107. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
  108. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
  109. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
  110. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
  111. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
  112. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
  113. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
  114. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
  115. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
  116. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
  117. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
  118. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
  119. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
  120. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
  121. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
  122. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
  123. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
  124. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
  125. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
  126. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
  127. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
  128. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
  129. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
  130. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
  131. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
  132. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
  133. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
  134. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
  135. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
  136. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
  137. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
  138. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
  139. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
  140. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
  141. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
  142. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
  143. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
  144. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
  145. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
  146. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
  147. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
  148. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
  149. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
  150. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
  151. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
  152. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
  153. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
  154. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
  155. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
  156. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
  157. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
  158. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
  159. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
  160. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
  161. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
  162. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
  163. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
  164. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
  165. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
  166. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
  167. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
  168. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
  169. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
  170. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
  171. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
  172. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
  173. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
  174. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
  175. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
  176. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
  177. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
  178. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
  179. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
  180. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
  181. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
  182. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
  183. data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
  184. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
  185. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
  186. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
  187. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
  188. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
  189. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
  190. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
  191. data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
  192. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
  193. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
  194. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
  195. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
  196. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
  197. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
  198. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
  199. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
  200. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
  201. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
  202. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
  203. data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
  204. data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
  205. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
  206. data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
  207. data/ext/v8/upstream/scons/scons-time.1 +0 -1017
  208. data/ext/v8/upstream/scons/scons.1 +0 -15179
  209. data/ext/v8/upstream/scons/sconsign.1 +0 -208
  210. data/ext/v8/upstream/scons/script/scons +0 -184
  211. data/ext/v8/upstream/scons/script/scons-time +0 -1529
  212. data/ext/v8/upstream/scons/script/scons.bat +0 -31
  213. data/ext/v8/upstream/scons/script/sconsign +0 -508
  214. data/ext/v8/upstream/scons/setup.cfg +0 -6
  215. data/ext/v8/upstream/scons/setup.py +0 -427
  216. data/ext/v8/upstream/v8/.gitignore +0 -33
  217. data/ext/v8/upstream/v8/AUTHORS +0 -42
  218. data/ext/v8/upstream/v8/ChangeLog +0 -2663
  219. data/ext/v8/upstream/v8/LICENSE +0 -52
  220. data/ext/v8/upstream/v8/LICENSE.strongtalk +0 -29
  221. data/ext/v8/upstream/v8/LICENSE.v8 +0 -26
  222. data/ext/v8/upstream/v8/LICENSE.valgrind +0 -45
  223. data/ext/v8/upstream/v8/SConstruct +0 -1473
  224. data/ext/v8/upstream/v8/build/README.txt +0 -25
  225. data/ext/v8/upstream/v8/build/all.gyp +0 -18
  226. data/ext/v8/upstream/v8/build/armu.gypi +0 -32
  227. data/ext/v8/upstream/v8/build/common.gypi +0 -82
  228. data/ext/v8/upstream/v8/build/gyp_v8 +0 -145
  229. data/ext/v8/upstream/v8/include/v8-debug.h +0 -394
  230. data/ext/v8/upstream/v8/include/v8-preparser.h +0 -116
  231. data/ext/v8/upstream/v8/include/v8-profiler.h +0 -505
  232. data/ext/v8/upstream/v8/include/v8-testing.h +0 -104
  233. data/ext/v8/upstream/v8/include/v8.h +0 -4000
  234. data/ext/v8/upstream/v8/include/v8stdint.h +0 -53
  235. data/ext/v8/upstream/v8/preparser/SConscript +0 -38
  236. data/ext/v8/upstream/v8/preparser/preparser-process.cc +0 -169
  237. data/ext/v8/upstream/v8/src/SConscript +0 -380
  238. data/ext/v8/upstream/v8/src/accessors.cc +0 -766
  239. data/ext/v8/upstream/v8/src/accessors.h +0 -121
  240. data/ext/v8/upstream/v8/src/allocation-inl.h +0 -49
  241. data/ext/v8/upstream/v8/src/allocation.cc +0 -122
  242. data/ext/v8/upstream/v8/src/allocation.h +0 -143
  243. data/ext/v8/upstream/v8/src/api.cc +0 -5678
  244. data/ext/v8/upstream/v8/src/api.h +0 -572
  245. data/ext/v8/upstream/v8/src/apinatives.js +0 -110
  246. data/ext/v8/upstream/v8/src/apiutils.h +0 -73
  247. data/ext/v8/upstream/v8/src/arguments.h +0 -116
  248. data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +0 -353
  249. data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +0 -2877
  250. data/ext/v8/upstream/v8/src/arm/assembler-arm.h +0 -1382
  251. data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +0 -1634
  252. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +0 -6917
  253. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +0 -623
  254. data/ext/v8/upstream/v8/src/arm/codegen-arm-inl.h +0 -48
  255. data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +0 -7437
  256. data/ext/v8/upstream/v8/src/arm/codegen-arm.h +0 -595
  257. data/ext/v8/upstream/v8/src/arm/constants-arm.cc +0 -152
  258. data/ext/v8/upstream/v8/src/arm/constants-arm.h +0 -778
  259. data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +0 -149
  260. data/ext/v8/upstream/v8/src/arm/debug-arm.cc +0 -317
  261. data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +0 -737
  262. data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +0 -1503
  263. data/ext/v8/upstream/v8/src/arm/frames-arm.cc +0 -45
  264. data/ext/v8/upstream/v8/src/arm/frames-arm.h +0 -168
  265. data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +0 -4374
  266. data/ext/v8/upstream/v8/src/arm/ic-arm.cc +0 -1793
  267. data/ext/v8/upstream/v8/src/arm/jump-target-arm.cc +0 -174
  268. data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +0 -2120
  269. data/ext/v8/upstream/v8/src/arm/lithium-arm.h +0 -2179
  270. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +0 -4132
  271. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +0 -329
  272. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +0 -305
  273. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.h +0 -84
  274. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +0 -2939
  275. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +0 -1071
  276. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +0 -1287
  277. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +0 -253
  278. data/ext/v8/upstream/v8/src/arm/register-allocator-arm-inl.h +0 -100
  279. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.cc +0 -63
  280. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.h +0 -44
  281. data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +0 -3288
  282. data/ext/v8/upstream/v8/src/arm/simulator-arm.h +0 -413
  283. data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +0 -4034
  284. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm-inl.h +0 -59
  285. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +0 -843
  286. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +0 -523
  287. data/ext/v8/upstream/v8/src/array.js +0 -1249
  288. data/ext/v8/upstream/v8/src/assembler.cc +0 -1067
  289. data/ext/v8/upstream/v8/src/assembler.h +0 -823
  290. data/ext/v8/upstream/v8/src/ast-inl.h +0 -112
  291. data/ext/v8/upstream/v8/src/ast.cc +0 -1078
  292. data/ext/v8/upstream/v8/src/ast.h +0 -2234
  293. data/ext/v8/upstream/v8/src/atomicops.h +0 -167
  294. data/ext/v8/upstream/v8/src/atomicops_internals_arm_gcc.h +0 -145
  295. data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +0 -169
  296. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.cc +0 -126
  297. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.h +0 -287
  298. data/ext/v8/upstream/v8/src/atomicops_internals_x86_macosx.h +0 -301
  299. data/ext/v8/upstream/v8/src/atomicops_internals_x86_msvc.h +0 -203
  300. data/ext/v8/upstream/v8/src/bignum-dtoa.cc +0 -655
  301. data/ext/v8/upstream/v8/src/bignum-dtoa.h +0 -81
  302. data/ext/v8/upstream/v8/src/bignum.cc +0 -768
  303. data/ext/v8/upstream/v8/src/bignum.h +0 -140
  304. data/ext/v8/upstream/v8/src/bootstrapper.cc +0 -2138
  305. data/ext/v8/upstream/v8/src/bootstrapper.h +0 -185
  306. data/ext/v8/upstream/v8/src/builtins.cc +0 -1708
  307. data/ext/v8/upstream/v8/src/builtins.h +0 -368
  308. data/ext/v8/upstream/v8/src/bytecodes-irregexp.h +0 -105
  309. data/ext/v8/upstream/v8/src/cached-powers.cc +0 -177
  310. data/ext/v8/upstream/v8/src/cached-powers.h +0 -65
  311. data/ext/v8/upstream/v8/src/char-predicates-inl.h +0 -94
  312. data/ext/v8/upstream/v8/src/char-predicates.h +0 -65
  313. data/ext/v8/upstream/v8/src/checks.cc +0 -110
  314. data/ext/v8/upstream/v8/src/checks.h +0 -296
  315. data/ext/v8/upstream/v8/src/circular-queue-inl.h +0 -53
  316. data/ext/v8/upstream/v8/src/circular-queue.cc +0 -122
  317. data/ext/v8/upstream/v8/src/circular-queue.h +0 -103
  318. data/ext/v8/upstream/v8/src/code-stubs.cc +0 -240
  319. data/ext/v8/upstream/v8/src/code-stubs.h +0 -971
  320. data/ext/v8/upstream/v8/src/code.h +0 -68
  321. data/ext/v8/upstream/v8/src/codegen-inl.h +0 -68
  322. data/ext/v8/upstream/v8/src/codegen.cc +0 -505
  323. data/ext/v8/upstream/v8/src/codegen.h +0 -245
  324. data/ext/v8/upstream/v8/src/compilation-cache.cc +0 -540
  325. data/ext/v8/upstream/v8/src/compilation-cache.h +0 -287
  326. data/ext/v8/upstream/v8/src/compiler.cc +0 -792
  327. data/ext/v8/upstream/v8/src/compiler.h +0 -307
  328. data/ext/v8/upstream/v8/src/contexts.cc +0 -327
  329. data/ext/v8/upstream/v8/src/contexts.h +0 -382
  330. data/ext/v8/upstream/v8/src/conversions-inl.h +0 -110
  331. data/ext/v8/upstream/v8/src/conversions.cc +0 -1125
  332. data/ext/v8/upstream/v8/src/conversions.h +0 -122
  333. data/ext/v8/upstream/v8/src/counters.cc +0 -93
  334. data/ext/v8/upstream/v8/src/counters.h +0 -254
  335. data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +0 -101
  336. data/ext/v8/upstream/v8/src/cpu-profiler.cc +0 -606
  337. data/ext/v8/upstream/v8/src/cpu-profiler.h +0 -305
  338. data/ext/v8/upstream/v8/src/cpu.h +0 -67
  339. data/ext/v8/upstream/v8/src/d8-debug.cc +0 -367
  340. data/ext/v8/upstream/v8/src/d8-debug.h +0 -158
  341. data/ext/v8/upstream/v8/src/d8-posix.cc +0 -695
  342. data/ext/v8/upstream/v8/src/d8-readline.cc +0 -128
  343. data/ext/v8/upstream/v8/src/d8-windows.cc +0 -42
  344. data/ext/v8/upstream/v8/src/d8.cc +0 -796
  345. data/ext/v8/upstream/v8/src/d8.gyp +0 -88
  346. data/ext/v8/upstream/v8/src/d8.h +0 -231
  347. data/ext/v8/upstream/v8/src/d8.js +0 -2798
  348. data/ext/v8/upstream/v8/src/data-flow.cc +0 -545
  349. data/ext/v8/upstream/v8/src/data-flow.h +0 -379
  350. data/ext/v8/upstream/v8/src/date.js +0 -1103
  351. data/ext/v8/upstream/v8/src/dateparser-inl.h +0 -125
  352. data/ext/v8/upstream/v8/src/dateparser.cc +0 -178
  353. data/ext/v8/upstream/v8/src/dateparser.h +0 -265
  354. data/ext/v8/upstream/v8/src/debug-agent.cc +0 -447
  355. data/ext/v8/upstream/v8/src/debug-agent.h +0 -129
  356. data/ext/v8/upstream/v8/src/debug-debugger.js +0 -2569
  357. data/ext/v8/upstream/v8/src/debug.cc +0 -3188
  358. data/ext/v8/upstream/v8/src/debug.h +0 -1055
  359. data/ext/v8/upstream/v8/src/deoptimizer.cc +0 -1296
  360. data/ext/v8/upstream/v8/src/deoptimizer.h +0 -629
  361. data/ext/v8/upstream/v8/src/disasm.h +0 -80
  362. data/ext/v8/upstream/v8/src/disassembler.cc +0 -339
  363. data/ext/v8/upstream/v8/src/disassembler.h +0 -56
  364. data/ext/v8/upstream/v8/src/diy-fp.cc +0 -58
  365. data/ext/v8/upstream/v8/src/diy-fp.h +0 -117
  366. data/ext/v8/upstream/v8/src/double.h +0 -238
  367. data/ext/v8/upstream/v8/src/dtoa.cc +0 -103
  368. data/ext/v8/upstream/v8/src/dtoa.h +0 -85
  369. data/ext/v8/upstream/v8/src/execution.cc +0 -791
  370. data/ext/v8/upstream/v8/src/execution.h +0 -291
  371. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +0 -250
  372. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +0 -89
  373. data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +0 -55
  374. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +0 -284
  375. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.h +0 -64
  376. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +0 -141
  377. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.h +0 -50
  378. data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +0 -58
  379. data/ext/v8/upstream/v8/src/extensions/gc-extension.h +0 -49
  380. data/ext/v8/upstream/v8/src/factory.cc +0 -1194
  381. data/ext/v8/upstream/v8/src/factory.h +0 -436
  382. data/ext/v8/upstream/v8/src/fast-dtoa.cc +0 -736
  383. data/ext/v8/upstream/v8/src/fast-dtoa.h +0 -83
  384. data/ext/v8/upstream/v8/src/fixed-dtoa.cc +0 -405
  385. data/ext/v8/upstream/v8/src/fixed-dtoa.h +0 -55
  386. data/ext/v8/upstream/v8/src/flag-definitions.h +0 -556
  387. data/ext/v8/upstream/v8/src/flags.cc +0 -551
  388. data/ext/v8/upstream/v8/src/flags.h +0 -79
  389. data/ext/v8/upstream/v8/src/frame-element.cc +0 -37
  390. data/ext/v8/upstream/v8/src/frame-element.h +0 -269
  391. data/ext/v8/upstream/v8/src/frames-inl.h +0 -236
  392. data/ext/v8/upstream/v8/src/frames.cc +0 -1273
  393. data/ext/v8/upstream/v8/src/frames.h +0 -854
  394. data/ext/v8/upstream/v8/src/full-codegen.cc +0 -1385
  395. data/ext/v8/upstream/v8/src/full-codegen.h +0 -753
  396. data/ext/v8/upstream/v8/src/func-name-inferrer.cc +0 -91
  397. data/ext/v8/upstream/v8/src/func-name-inferrer.h +0 -111
  398. data/ext/v8/upstream/v8/src/gdb-jit.cc +0 -1548
  399. data/ext/v8/upstream/v8/src/gdb-jit.h +0 -138
  400. data/ext/v8/upstream/v8/src/global-handles.cc +0 -596
  401. data/ext/v8/upstream/v8/src/global-handles.h +0 -239
  402. data/ext/v8/upstream/v8/src/globals.h +0 -325
  403. data/ext/v8/upstream/v8/src/handles-inl.h +0 -177
  404. data/ext/v8/upstream/v8/src/handles.cc +0 -965
  405. data/ext/v8/upstream/v8/src/handles.h +0 -372
  406. data/ext/v8/upstream/v8/src/hashmap.cc +0 -230
  407. data/ext/v8/upstream/v8/src/hashmap.h +0 -121
  408. data/ext/v8/upstream/v8/src/heap-inl.h +0 -703
  409. data/ext/v8/upstream/v8/src/heap-profiler.cc +0 -1173
  410. data/ext/v8/upstream/v8/src/heap-profiler.h +0 -396
  411. data/ext/v8/upstream/v8/src/heap.cc +0 -5856
  412. data/ext/v8/upstream/v8/src/heap.h +0 -2264
  413. data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +0 -1639
  414. data/ext/v8/upstream/v8/src/hydrogen-instructions.h +0 -3657
  415. data/ext/v8/upstream/v8/src/hydrogen.cc +0 -6011
  416. data/ext/v8/upstream/v8/src/hydrogen.h +0 -1137
  417. data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +0 -430
  418. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +0 -2846
  419. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +0 -1159
  420. data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +0 -1596
  421. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +0 -6549
  422. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +0 -495
  423. data/ext/v8/upstream/v8/src/ia32/codegen-ia32-inl.h +0 -46
  424. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +0 -10385
  425. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +0 -801
  426. data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +0 -88
  427. data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +0 -312
  428. data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +0 -774
  429. data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +0 -1620
  430. data/ext/v8/upstream/v8/src/ia32/frames-ia32.cc +0 -45
  431. data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +0 -140
  432. data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +0 -4357
  433. data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +0 -1779
  434. data/ext/v8/upstream/v8/src/ia32/jump-target-ia32.cc +0 -437
  435. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +0 -4158
  436. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +0 -318
  437. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +0 -466
  438. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.h +0 -110
  439. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +0 -2181
  440. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +0 -2235
  441. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +0 -2056
  442. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +0 -807
  443. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1264
  444. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +0 -216
  445. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32-inl.h +0 -82
  446. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +0 -157
  447. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.h +0 -43
  448. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.cc +0 -30
  449. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +0 -72
  450. data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +0 -3711
  451. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +0 -1366
  452. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +0 -650
  453. data/ext/v8/upstream/v8/src/ic-inl.h +0 -130
  454. data/ext/v8/upstream/v8/src/ic.cc +0 -2389
  455. data/ext/v8/upstream/v8/src/ic.h +0 -675
  456. data/ext/v8/upstream/v8/src/inspector.cc +0 -63
  457. data/ext/v8/upstream/v8/src/inspector.h +0 -62
  458. data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +0 -659
  459. data/ext/v8/upstream/v8/src/interpreter-irregexp.h +0 -49
  460. data/ext/v8/upstream/v8/src/isolate.cc +0 -883
  461. data/ext/v8/upstream/v8/src/isolate.h +0 -1306
  462. data/ext/v8/upstream/v8/src/json.js +0 -342
  463. data/ext/v8/upstream/v8/src/jsregexp.cc +0 -5371
  464. data/ext/v8/upstream/v8/src/jsregexp.h +0 -1483
  465. data/ext/v8/upstream/v8/src/jump-target-heavy-inl.h +0 -51
  466. data/ext/v8/upstream/v8/src/jump-target-heavy.cc +0 -427
  467. data/ext/v8/upstream/v8/src/jump-target-heavy.h +0 -238
  468. data/ext/v8/upstream/v8/src/jump-target-inl.h +0 -48
  469. data/ext/v8/upstream/v8/src/jump-target-light-inl.h +0 -56
  470. data/ext/v8/upstream/v8/src/jump-target-light.cc +0 -111
  471. data/ext/v8/upstream/v8/src/jump-target-light.h +0 -193
  472. data/ext/v8/upstream/v8/src/jump-target.cc +0 -91
  473. data/ext/v8/upstream/v8/src/jump-target.h +0 -90
  474. data/ext/v8/upstream/v8/src/list-inl.h +0 -206
  475. data/ext/v8/upstream/v8/src/list.h +0 -164
  476. data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +0 -142
  477. data/ext/v8/upstream/v8/src/lithium-allocator.cc +0 -2105
  478. data/ext/v8/upstream/v8/src/lithium-allocator.h +0 -630
  479. data/ext/v8/upstream/v8/src/lithium.cc +0 -169
  480. data/ext/v8/upstream/v8/src/lithium.h +0 -592
  481. data/ext/v8/upstream/v8/src/liveedit-debugger.js +0 -1082
  482. data/ext/v8/upstream/v8/src/liveedit.cc +0 -1693
  483. data/ext/v8/upstream/v8/src/liveedit.h +0 -179
  484. data/ext/v8/upstream/v8/src/liveobjectlist-inl.h +0 -126
  485. data/ext/v8/upstream/v8/src/liveobjectlist.cc +0 -2589
  486. data/ext/v8/upstream/v8/src/liveobjectlist.h +0 -322
  487. data/ext/v8/upstream/v8/src/log-inl.h +0 -59
  488. data/ext/v8/upstream/v8/src/log-utils.cc +0 -423
  489. data/ext/v8/upstream/v8/src/log-utils.h +0 -229
  490. data/ext/v8/upstream/v8/src/log.cc +0 -1666
  491. data/ext/v8/upstream/v8/src/log.h +0 -446
  492. data/ext/v8/upstream/v8/src/macro-assembler.h +0 -120
  493. data/ext/v8/upstream/v8/src/macros.py +0 -178
  494. data/ext/v8/upstream/v8/src/mark-compact.cc +0 -3092
  495. data/ext/v8/upstream/v8/src/mark-compact.h +0 -506
  496. data/ext/v8/upstream/v8/src/math.js +0 -264
  497. data/ext/v8/upstream/v8/src/messages.cc +0 -166
  498. data/ext/v8/upstream/v8/src/messages.h +0 -114
  499. data/ext/v8/upstream/v8/src/messages.js +0 -1090
  500. data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +0 -335
  501. data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +0 -2093
  502. data/ext/v8/upstream/v8/src/mips/assembler-mips.h +0 -1066
  503. data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +0 -148
  504. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +0 -752
  505. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +0 -511
  506. data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +0 -64
  507. data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +0 -1213
  508. data/ext/v8/upstream/v8/src/mips/codegen-mips.h +0 -633
  509. data/ext/v8/upstream/v8/src/mips/constants-mips.cc +0 -352
  510. data/ext/v8/upstream/v8/src/mips/constants-mips.h +0 -723
  511. data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +0 -90
  512. data/ext/v8/upstream/v8/src/mips/debug-mips.cc +0 -155
  513. data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +0 -91
  514. data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +0 -1023
  515. data/ext/v8/upstream/v8/src/mips/frames-mips.cc +0 -48
  516. data/ext/v8/upstream/v8/src/mips/frames-mips.h +0 -179
  517. data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +0 -727
  518. data/ext/v8/upstream/v8/src/mips/ic-mips.cc +0 -244
  519. data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +0 -80
  520. data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +0 -65
  521. data/ext/v8/upstream/v8/src/mips/lithium-mips.h +0 -304
  522. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +0 -3327
  523. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +0 -1058
  524. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +0 -478
  525. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +0 -250
  526. data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +0 -134
  527. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.cc +0 -63
  528. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +0 -47
  529. data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +0 -2438
  530. data/ext/v8/upstream/v8/src/mips/simulator-mips.h +0 -394
  531. data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +0 -601
  532. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +0 -58
  533. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +0 -307
  534. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +0 -530
  535. data/ext/v8/upstream/v8/src/mirror-debugger.js +0 -2381
  536. data/ext/v8/upstream/v8/src/mksnapshot.cc +0 -256
  537. data/ext/v8/upstream/v8/src/natives.h +0 -63
  538. data/ext/v8/upstream/v8/src/objects-debug.cc +0 -722
  539. data/ext/v8/upstream/v8/src/objects-inl.h +0 -4166
  540. data/ext/v8/upstream/v8/src/objects-printer.cc +0 -801
  541. data/ext/v8/upstream/v8/src/objects-visiting.cc +0 -142
  542. data/ext/v8/upstream/v8/src/objects-visiting.h +0 -422
  543. data/ext/v8/upstream/v8/src/objects.cc +0 -10296
  544. data/ext/v8/upstream/v8/src/objects.h +0 -6662
  545. data/ext/v8/upstream/v8/src/parser.cc +0 -5168
  546. data/ext/v8/upstream/v8/src/parser.h +0 -823
  547. data/ext/v8/upstream/v8/src/platform-cygwin.cc +0 -811
  548. data/ext/v8/upstream/v8/src/platform-freebsd.cc +0 -854
  549. data/ext/v8/upstream/v8/src/platform-linux.cc +0 -1120
  550. data/ext/v8/upstream/v8/src/platform-macos.cc +0 -865
  551. data/ext/v8/upstream/v8/src/platform-nullos.cc +0 -504
  552. data/ext/v8/upstream/v8/src/platform-openbsd.cc +0 -672
  553. data/ext/v8/upstream/v8/src/platform-posix.cc +0 -424
  554. data/ext/v8/upstream/v8/src/platform-solaris.cc +0 -796
  555. data/ext/v8/upstream/v8/src/platform-tls-mac.h +0 -62
  556. data/ext/v8/upstream/v8/src/platform-tls-win32.h +0 -62
  557. data/ext/v8/upstream/v8/src/platform-tls.h +0 -50
  558. data/ext/v8/upstream/v8/src/platform-win32.cc +0 -2072
  559. data/ext/v8/upstream/v8/src/platform.h +0 -693
  560. data/ext/v8/upstream/v8/src/preparse-data.cc +0 -185
  561. data/ext/v8/upstream/v8/src/preparse-data.h +0 -249
  562. data/ext/v8/upstream/v8/src/preparser-api.cc +0 -219
  563. data/ext/v8/upstream/v8/src/preparser.cc +0 -1205
  564. data/ext/v8/upstream/v8/src/preparser.h +0 -278
  565. data/ext/v8/upstream/v8/src/prettyprinter.cc +0 -1530
  566. data/ext/v8/upstream/v8/src/prettyprinter.h +0 -223
  567. data/ext/v8/upstream/v8/src/profile-generator-inl.h +0 -128
  568. data/ext/v8/upstream/v8/src/profile-generator.cc +0 -3095
  569. data/ext/v8/upstream/v8/src/profile-generator.h +0 -1125
  570. data/ext/v8/upstream/v8/src/property.cc +0 -102
  571. data/ext/v8/upstream/v8/src/property.h +0 -348
  572. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp-inl.h +0 -78
  573. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +0 -470
  574. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.h +0 -142
  575. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.cc +0 -373
  576. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.h +0 -104
  577. data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +0 -266
  578. data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +0 -236
  579. data/ext/v8/upstream/v8/src/regexp-stack.cc +0 -111
  580. data/ext/v8/upstream/v8/src/regexp-stack.h +0 -147
  581. data/ext/v8/upstream/v8/src/regexp.js +0 -483
  582. data/ext/v8/upstream/v8/src/register-allocator-inl.h +0 -141
  583. data/ext/v8/upstream/v8/src/register-allocator.cc +0 -98
  584. data/ext/v8/upstream/v8/src/register-allocator.h +0 -310
  585. data/ext/v8/upstream/v8/src/rewriter.cc +0 -1024
  586. data/ext/v8/upstream/v8/src/rewriter.h +0 -59
  587. data/ext/v8/upstream/v8/src/runtime-profiler.cc +0 -478
  588. data/ext/v8/upstream/v8/src/runtime-profiler.h +0 -192
  589. data/ext/v8/upstream/v8/src/runtime.cc +0 -11949
  590. data/ext/v8/upstream/v8/src/runtime.h +0 -643
  591. data/ext/v8/upstream/v8/src/runtime.js +0 -643
  592. data/ext/v8/upstream/v8/src/safepoint-table.cc +0 -256
  593. data/ext/v8/upstream/v8/src/safepoint-table.h +0 -269
  594. data/ext/v8/upstream/v8/src/scanner-base.cc +0 -964
  595. data/ext/v8/upstream/v8/src/scanner-base.h +0 -664
  596. data/ext/v8/upstream/v8/src/scanner.cc +0 -584
  597. data/ext/v8/upstream/v8/src/scanner.h +0 -196
  598. data/ext/v8/upstream/v8/src/scopeinfo.cc +0 -631
  599. data/ext/v8/upstream/v8/src/scopeinfo.h +0 -249
  600. data/ext/v8/upstream/v8/src/scopes.cc +0 -1093
  601. data/ext/v8/upstream/v8/src/scopes.h +0 -508
  602. data/ext/v8/upstream/v8/src/serialize.cc +0 -1574
  603. data/ext/v8/upstream/v8/src/serialize.h +0 -589
  604. data/ext/v8/upstream/v8/src/shell.h +0 -55
  605. data/ext/v8/upstream/v8/src/simulator.h +0 -43
  606. data/ext/v8/upstream/v8/src/small-pointer-list.h +0 -163
  607. data/ext/v8/upstream/v8/src/smart-pointer.h +0 -109
  608. data/ext/v8/upstream/v8/src/snapshot-common.cc +0 -82
  609. data/ext/v8/upstream/v8/src/snapshot-empty.cc +0 -50
  610. data/ext/v8/upstream/v8/src/snapshot.h +0 -73
  611. data/ext/v8/upstream/v8/src/spaces-inl.h +0 -529
  612. data/ext/v8/upstream/v8/src/spaces.cc +0 -3147
  613. data/ext/v8/upstream/v8/src/spaces.h +0 -2368
  614. data/ext/v8/upstream/v8/src/splay-tree-inl.h +0 -310
  615. data/ext/v8/upstream/v8/src/splay-tree.h +0 -203
  616. data/ext/v8/upstream/v8/src/string-search.cc +0 -41
  617. data/ext/v8/upstream/v8/src/string-search.h +0 -568
  618. data/ext/v8/upstream/v8/src/string-stream.cc +0 -592
  619. data/ext/v8/upstream/v8/src/string-stream.h +0 -191
  620. data/ext/v8/upstream/v8/src/string.js +0 -915
  621. data/ext/v8/upstream/v8/src/strtod.cc +0 -440
  622. data/ext/v8/upstream/v8/src/strtod.h +0 -40
  623. data/ext/v8/upstream/v8/src/stub-cache.cc +0 -1940
  624. data/ext/v8/upstream/v8/src/stub-cache.h +0 -866
  625. data/ext/v8/upstream/v8/src/third_party/valgrind/valgrind.h +0 -3925
  626. data/ext/v8/upstream/v8/src/token.cc +0 -63
  627. data/ext/v8/upstream/v8/src/token.h +0 -288
  628. data/ext/v8/upstream/v8/src/top.cc +0 -983
  629. data/ext/v8/upstream/v8/src/type-info.cc +0 -472
  630. data/ext/v8/upstream/v8/src/type-info.h +0 -290
  631. data/ext/v8/upstream/v8/src/unbound-queue-inl.h +0 -95
  632. data/ext/v8/upstream/v8/src/unbound-queue.h +0 -67
  633. data/ext/v8/upstream/v8/src/unicode-inl.h +0 -238
  634. data/ext/v8/upstream/v8/src/unicode.cc +0 -1624
  635. data/ext/v8/upstream/v8/src/unicode.h +0 -280
  636. data/ext/v8/upstream/v8/src/uri.js +0 -402
  637. data/ext/v8/upstream/v8/src/utils.cc +0 -371
  638. data/ext/v8/upstream/v8/src/utils.h +0 -796
  639. data/ext/v8/upstream/v8/src/v8-counters.cc +0 -62
  640. data/ext/v8/upstream/v8/src/v8-counters.h +0 -311
  641. data/ext/v8/upstream/v8/src/v8.cc +0 -215
  642. data/ext/v8/upstream/v8/src/v8.h +0 -130
  643. data/ext/v8/upstream/v8/src/v8checks.h +0 -64
  644. data/ext/v8/upstream/v8/src/v8dll-main.cc +0 -39
  645. data/ext/v8/upstream/v8/src/v8globals.h +0 -486
  646. data/ext/v8/upstream/v8/src/v8memory.h +0 -82
  647. data/ext/v8/upstream/v8/src/v8natives.js +0 -1293
  648. data/ext/v8/upstream/v8/src/v8preparserdll-main.cc +0 -39
  649. data/ext/v8/upstream/v8/src/v8threads.cc +0 -453
  650. data/ext/v8/upstream/v8/src/v8threads.h +0 -164
  651. data/ext/v8/upstream/v8/src/v8utils.h +0 -317
  652. data/ext/v8/upstream/v8/src/variables.cc +0 -132
  653. data/ext/v8/upstream/v8/src/variables.h +0 -212
  654. data/ext/v8/upstream/v8/src/version.cc +0 -116
  655. data/ext/v8/upstream/v8/src/version.h +0 -68
  656. data/ext/v8/upstream/v8/src/virtual-frame-heavy-inl.h +0 -190
  657. data/ext/v8/upstream/v8/src/virtual-frame-heavy.cc +0 -312
  658. data/ext/v8/upstream/v8/src/virtual-frame-inl.h +0 -39
  659. data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +0 -171
  660. data/ext/v8/upstream/v8/src/virtual-frame-light.cc +0 -52
  661. data/ext/v8/upstream/v8/src/virtual-frame.cc +0 -49
  662. data/ext/v8/upstream/v8/src/virtual-frame.h +0 -59
  663. data/ext/v8/upstream/v8/src/vm-state-inl.h +0 -138
  664. data/ext/v8/upstream/v8/src/vm-state.h +0 -70
  665. data/ext/v8/upstream/v8/src/win32-headers.h +0 -96
  666. data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +0 -456
  667. data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +0 -2954
  668. data/ext/v8/upstream/v8/src/x64/assembler-x64.h +0 -1630
  669. data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +0 -1493
  670. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +0 -5132
  671. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +0 -477
  672. data/ext/v8/upstream/v8/src/x64/codegen-x64-inl.h +0 -46
  673. data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +0 -8843
  674. data/ext/v8/upstream/v8/src/x64/codegen-x64.h +0 -753
  675. data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +0 -88
  676. data/ext/v8/upstream/v8/src/x64/debug-x64.cc +0 -318
  677. data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +0 -815
  678. data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +0 -1752
  679. data/ext/v8/upstream/v8/src/x64/frames-x64.cc +0 -45
  680. data/ext/v8/upstream/v8/src/x64/frames-x64.h +0 -130
  681. data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +0 -4339
  682. data/ext/v8/upstream/v8/src/x64/ic-x64.cc +0 -1752
  683. data/ext/v8/upstream/v8/src/x64/jump-target-x64.cc +0 -437
  684. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +0 -3970
  685. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +0 -318
  686. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.cc +0 -320
  687. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.h +0 -74
  688. data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +0 -2115
  689. data/ext/v8/upstream/v8/src/x64/lithium-x64.h +0 -2161
  690. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +0 -2911
  691. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +0 -1984
  692. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +0 -1398
  693. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +0 -282
  694. data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +0 -87
  695. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +0 -95
  696. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.h +0 -43
  697. data/ext/v8/upstream/v8/src/x64/simulator-x64.cc +0 -27
  698. data/ext/v8/upstream/v8/src/x64/simulator-x64.h +0 -71
  699. data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +0 -3460
  700. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +0 -1296
  701. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +0 -597
  702. data/ext/v8/upstream/v8/src/zone-inl.h +0 -129
  703. data/ext/v8/upstream/v8/src/zone.cc +0 -196
  704. data/ext/v8/upstream/v8/src/zone.h +0 -236
  705. data/ext/v8/upstream/v8/tools/codemap.js +0 -265
  706. data/ext/v8/upstream/v8/tools/consarray.js +0 -93
  707. data/ext/v8/upstream/v8/tools/csvparser.js +0 -78
  708. data/ext/v8/upstream/v8/tools/disasm.py +0 -92
  709. data/ext/v8/upstream/v8/tools/freebsd-tick-processor +0 -10
  710. data/ext/v8/upstream/v8/tools/gc-nvp-trace-processor.py +0 -328
  711. data/ext/v8/upstream/v8/tools/generate-ten-powers.scm +0 -286
  712. data/ext/v8/upstream/v8/tools/grokdump.py +0 -840
  713. data/ext/v8/upstream/v8/tools/gyp/v8.gyp +0 -844
  714. data/ext/v8/upstream/v8/tools/js2c.py +0 -380
  715. data/ext/v8/upstream/v8/tools/jsmin.py +0 -280
  716. data/ext/v8/upstream/v8/tools/linux-tick-processor +0 -35
  717. data/ext/v8/upstream/v8/tools/ll_prof.py +0 -919
  718. data/ext/v8/upstream/v8/tools/logreader.js +0 -185
  719. data/ext/v8/upstream/v8/tools/mac-nm +0 -18
  720. data/ext/v8/upstream/v8/tools/mac-tick-processor +0 -6
  721. data/ext/v8/upstream/v8/tools/oom_dump/README +0 -31
  722. data/ext/v8/upstream/v8/tools/oom_dump/SConstruct +0 -42
  723. data/ext/v8/upstream/v8/tools/oom_dump/oom_dump.cc +0 -288
  724. data/ext/v8/upstream/v8/tools/presubmit.py +0 -305
  725. data/ext/v8/upstream/v8/tools/process-heap-prof.py +0 -120
  726. data/ext/v8/upstream/v8/tools/profile.js +0 -751
  727. data/ext/v8/upstream/v8/tools/profile_view.js +0 -219
  728. data/ext/v8/upstream/v8/tools/run-valgrind.py +0 -77
  729. data/ext/v8/upstream/v8/tools/splaytree.js +0 -316
  730. data/ext/v8/upstream/v8/tools/stats-viewer.py +0 -468
  731. data/ext/v8/upstream/v8/tools/test.py +0 -1490
  732. data/ext/v8/upstream/v8/tools/tickprocessor-driver.js +0 -59
  733. data/ext/v8/upstream/v8/tools/tickprocessor.js +0 -877
  734. data/ext/v8/upstream/v8/tools/utils.py +0 -96
  735. data/ext/v8/upstream/v8/tools/visual_studio/README.txt +0 -70
  736. data/ext/v8/upstream/v8/tools/visual_studio/arm.vsprops +0 -14
  737. data/ext/v8/upstream/v8/tools/visual_studio/common.vsprops +0 -34
  738. data/ext/v8/upstream/v8/tools/visual_studio/d8.vcproj +0 -193
  739. data/ext/v8/upstream/v8/tools/visual_studio/d8_arm.vcproj +0 -193
  740. data/ext/v8/upstream/v8/tools/visual_studio/d8_x64.vcproj +0 -209
  741. data/ext/v8/upstream/v8/tools/visual_studio/d8js2c.cmd +0 -6
  742. data/ext/v8/upstream/v8/tools/visual_studio/debug.vsprops +0 -17
  743. data/ext/v8/upstream/v8/tools/visual_studio/ia32.vsprops +0 -17
  744. data/ext/v8/upstream/v8/tools/visual_studio/js2c.cmd +0 -6
  745. data/ext/v8/upstream/v8/tools/visual_studio/release.vsprops +0 -24
  746. data/ext/v8/upstream/v8/tools/visual_studio/v8.sln +0 -101
  747. data/ext/v8/upstream/v8/tools/visual_studio/v8.vcproj +0 -227
  748. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.sln +0 -74
  749. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.vcproj +0 -227
  750. data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +0 -1308
  751. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +0 -1238
  752. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +0 -1300
  753. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest.vcproj +0 -265
  754. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_arm.vcproj +0 -249
  755. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
  756. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot.vcproj +0 -145
  757. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -145
  758. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample.vcproj +0 -145
  759. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_arm.vcproj +0 -145
  760. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_x64.vcproj +0 -161
  761. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample.vcproj +0 -147
  762. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -147
  763. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -163
  764. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot.vcproj +0 -142
  765. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
  766. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
  767. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
  768. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.sln +0 -101
  769. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.vcproj +0 -227
  770. data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +0 -18
  771. data/ext/v8/upstream/v8/tools/windows-tick-processor.bat +0 -30
@@ -1,3188 +0,0 @@
1
- // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #include "v8.h"
29
-
30
- #include "api.h"
31
- #include "arguments.h"
32
- #include "bootstrapper.h"
33
- #include "code-stubs.h"
34
- #include "codegen.h"
35
- #include "compilation-cache.h"
36
- #include "compiler.h"
37
- #include "debug.h"
38
- #include "deoptimizer.h"
39
- #include "execution.h"
40
- #include "global-handles.h"
41
- #include "ic.h"
42
- #include "ic-inl.h"
43
- #include "messages.h"
44
- #include "natives.h"
45
- #include "stub-cache.h"
46
- #include "log.h"
47
-
48
- #include "../include/v8-debug.h"
49
-
50
- namespace v8 {
51
- namespace internal {
52
-
53
- #ifdef ENABLE_DEBUGGER_SUPPORT
54
-
55
-
56
- Debug::Debug(Isolate* isolate)
57
- : has_break_points_(false),
58
- script_cache_(NULL),
59
- debug_info_list_(NULL),
60
- disable_break_(false),
61
- break_on_exception_(false),
62
- break_on_uncaught_exception_(false),
63
- debug_break_return_(NULL),
64
- debug_break_slot_(NULL),
65
- isolate_(isolate) {
66
- memset(registers_, 0, sizeof(JSCallerSavedBuffer));
67
- }
68
-
69
-
70
- Debug::~Debug() {
71
- }
72
-
73
-
74
- static void PrintLn(v8::Local<v8::Value> value) {
75
- v8::Local<v8::String> s = value->ToString();
76
- ScopedVector<char> data(s->Length() + 1);
77
- if (data.start() == NULL) {
78
- V8::FatalProcessOutOfMemory("PrintLn");
79
- return;
80
- }
81
- s->WriteAscii(data.start());
82
- PrintF("%s\n", data.start());
83
- }
84
-
85
-
86
- static Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind) {
87
- Isolate* isolate = Isolate::Current();
88
- CALL_HEAP_FUNCTION(
89
- isolate,
90
- isolate->stub_cache()->ComputeCallDebugBreak(argc, kind),
91
- Code);
92
- }
93
-
94
-
95
- static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) {
96
- Isolate* isolate = Isolate::Current();
97
- CALL_HEAP_FUNCTION(
98
- isolate,
99
- isolate->stub_cache()->ComputeCallDebugPrepareStepIn(argc, kind),
100
- Code);
101
- }
102
-
103
-
104
- static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) {
105
- Handle<Context> context = isolate->debug()->debugger_entry()->GetContext();
106
- // Isolate::context() may have been NULL when "script collected" event
107
- // occured.
108
- if (context.is_null()) return v8::Local<v8::Context>();
109
- Handle<Context> global_context(context->global_context());
110
- return v8::Utils::ToLocal(global_context);
111
- }
112
-
113
-
114
- BreakLocationIterator::BreakLocationIterator(Handle<DebugInfo> debug_info,
115
- BreakLocatorType type) {
116
- debug_info_ = debug_info;
117
- type_ = type;
118
- reloc_iterator_ = NULL;
119
- reloc_iterator_original_ = NULL;
120
- Reset(); // Initialize the rest of the member variables.
121
- }
122
-
123
-
124
- BreakLocationIterator::~BreakLocationIterator() {
125
- ASSERT(reloc_iterator_ != NULL);
126
- ASSERT(reloc_iterator_original_ != NULL);
127
- delete reloc_iterator_;
128
- delete reloc_iterator_original_;
129
- }
130
-
131
-
132
- void BreakLocationIterator::Next() {
133
- AssertNoAllocation nogc;
134
- ASSERT(!RinfoDone());
135
-
136
- // Iterate through reloc info for code and original code stopping at each
137
- // breakable code target.
138
- bool first = break_point_ == -1;
139
- while (!RinfoDone()) {
140
- if (!first) RinfoNext();
141
- first = false;
142
- if (RinfoDone()) return;
143
-
144
- // Whenever a statement position or (plain) position is passed update the
145
- // current value of these.
146
- if (RelocInfo::IsPosition(rmode())) {
147
- if (RelocInfo::IsStatementPosition(rmode())) {
148
- statement_position_ = static_cast<int>(
149
- rinfo()->data() - debug_info_->shared()->start_position());
150
- }
151
- // Always update the position as we don't want that to be before the
152
- // statement position.
153
- position_ = static_cast<int>(
154
- rinfo()->data() - debug_info_->shared()->start_position());
155
- ASSERT(position_ >= 0);
156
- ASSERT(statement_position_ >= 0);
157
- }
158
-
159
- if (IsDebugBreakSlot()) {
160
- // There is always a possible break point at a debug break slot.
161
- break_point_++;
162
- return;
163
- } else if (RelocInfo::IsCodeTarget(rmode())) {
164
- // Check for breakable code target. Look in the original code as setting
165
- // break points can cause the code targets in the running (debugged) code
166
- // to be of a different kind than in the original code.
167
- Address target = original_rinfo()->target_address();
168
- Code* code = Code::GetCodeFromTargetAddress(target);
169
- if ((code->is_inline_cache_stub() &&
170
- !code->is_binary_op_stub() &&
171
- !code->is_type_recording_binary_op_stub() &&
172
- !code->is_compare_ic_stub()) ||
173
- RelocInfo::IsConstructCall(rmode())) {
174
- break_point_++;
175
- return;
176
- }
177
- if (code->kind() == Code::STUB) {
178
- if (IsDebuggerStatement()) {
179
- break_point_++;
180
- return;
181
- }
182
- if (type_ == ALL_BREAK_LOCATIONS) {
183
- if (Debug::IsBreakStub(code)) {
184
- break_point_++;
185
- return;
186
- }
187
- } else {
188
- ASSERT(type_ == SOURCE_BREAK_LOCATIONS);
189
- if (Debug::IsSourceBreakStub(code)) {
190
- break_point_++;
191
- return;
192
- }
193
- }
194
- }
195
- }
196
-
197
- // Check for break at return.
198
- if (RelocInfo::IsJSReturn(rmode())) {
199
- // Set the positions to the end of the function.
200
- if (debug_info_->shared()->HasSourceCode()) {
201
- position_ = debug_info_->shared()->end_position() -
202
- debug_info_->shared()->start_position() - 1;
203
- } else {
204
- position_ = 0;
205
- }
206
- statement_position_ = position_;
207
- break_point_++;
208
- return;
209
- }
210
- }
211
- }
212
-
213
-
214
- void BreakLocationIterator::Next(int count) {
215
- while (count > 0) {
216
- Next();
217
- count--;
218
- }
219
- }
220
-
221
-
222
- // Find the break point closest to the supplied address.
223
- void BreakLocationIterator::FindBreakLocationFromAddress(Address pc) {
224
- // Run through all break points to locate the one closest to the address.
225
- int closest_break_point = 0;
226
- int distance = kMaxInt;
227
- while (!Done()) {
228
- // Check if this break point is closer that what was previously found.
229
- if (this->pc() < pc && pc - this->pc() < distance) {
230
- closest_break_point = break_point();
231
- distance = static_cast<int>(pc - this->pc());
232
- // Check whether we can't get any closer.
233
- if (distance == 0) break;
234
- }
235
- Next();
236
- }
237
-
238
- // Move to the break point found.
239
- Reset();
240
- Next(closest_break_point);
241
- }
242
-
243
-
244
- // Find the break point closest to the supplied source position.
245
- void BreakLocationIterator::FindBreakLocationFromPosition(int position) {
246
- // Run through all break points to locate the one closest to the source
247
- // position.
248
- int closest_break_point = 0;
249
- int distance = kMaxInt;
250
- while (!Done()) {
251
- // Check if this break point is closer that what was previously found.
252
- if (position <= statement_position() &&
253
- statement_position() - position < distance) {
254
- closest_break_point = break_point();
255
- distance = statement_position() - position;
256
- // Check whether we can't get any closer.
257
- if (distance == 0) break;
258
- }
259
- Next();
260
- }
261
-
262
- // Move to the break point found.
263
- Reset();
264
- Next(closest_break_point);
265
- }
266
-
267
-
268
- void BreakLocationIterator::Reset() {
269
- // Create relocation iterators for the two code objects.
270
- if (reloc_iterator_ != NULL) delete reloc_iterator_;
271
- if (reloc_iterator_original_ != NULL) delete reloc_iterator_original_;
272
- reloc_iterator_ = new RelocIterator(debug_info_->code());
273
- reloc_iterator_original_ = new RelocIterator(debug_info_->original_code());
274
-
275
- // Position at the first break point.
276
- break_point_ = -1;
277
- position_ = 1;
278
- statement_position_ = 1;
279
- Next();
280
- }
281
-
282
-
283
- bool BreakLocationIterator::Done() const {
284
- return RinfoDone();
285
- }
286
-
287
-
288
- void BreakLocationIterator::SetBreakPoint(Handle<Object> break_point_object) {
289
- // If there is not already a real break point here patch code with debug
290
- // break.
291
- if (!HasBreakPoint()) {
292
- SetDebugBreak();
293
- }
294
- ASSERT(IsDebugBreak() || IsDebuggerStatement());
295
- // Set the break point information.
296
- DebugInfo::SetBreakPoint(debug_info_, code_position(),
297
- position(), statement_position(),
298
- break_point_object);
299
- }
300
-
301
-
302
- void BreakLocationIterator::ClearBreakPoint(Handle<Object> break_point_object) {
303
- // Clear the break point information.
304
- DebugInfo::ClearBreakPoint(debug_info_, code_position(), break_point_object);
305
- // If there are no more break points here remove the debug break.
306
- if (!HasBreakPoint()) {
307
- ClearDebugBreak();
308
- ASSERT(!IsDebugBreak());
309
- }
310
- }
311
-
312
-
313
- void BreakLocationIterator::SetOneShot() {
314
- // Debugger statement always calls debugger. No need to modify it.
315
- if (IsDebuggerStatement()) {
316
- return;
317
- }
318
-
319
- // If there is a real break point here no more to do.
320
- if (HasBreakPoint()) {
321
- ASSERT(IsDebugBreak());
322
- return;
323
- }
324
-
325
- // Patch code with debug break.
326
- SetDebugBreak();
327
- }
328
-
329
-
330
- void BreakLocationIterator::ClearOneShot() {
331
- // Debugger statement always calls debugger. No need to modify it.
332
- if (IsDebuggerStatement()) {
333
- return;
334
- }
335
-
336
- // If there is a real break point here no more to do.
337
- if (HasBreakPoint()) {
338
- ASSERT(IsDebugBreak());
339
- return;
340
- }
341
-
342
- // Patch code removing debug break.
343
- ClearDebugBreak();
344
- ASSERT(!IsDebugBreak());
345
- }
346
-
347
-
348
- void BreakLocationIterator::SetDebugBreak() {
349
- // Debugger statement always calls debugger. No need to modify it.
350
- if (IsDebuggerStatement()) {
351
- return;
352
- }
353
-
354
- // If there is already a break point here just return. This might happen if
355
- // the same code is flooded with break points twice. Flooding the same
356
- // function twice might happen when stepping in a function with an exception
357
- // handler as the handler and the function is the same.
358
- if (IsDebugBreak()) {
359
- return;
360
- }
361
-
362
- if (RelocInfo::IsJSReturn(rmode())) {
363
- // Patch the frame exit code with a break point.
364
- SetDebugBreakAtReturn();
365
- } else if (IsDebugBreakSlot()) {
366
- // Patch the code in the break slot.
367
- SetDebugBreakAtSlot();
368
- } else {
369
- // Patch the IC call.
370
- SetDebugBreakAtIC();
371
- }
372
- ASSERT(IsDebugBreak());
373
- }
374
-
375
-
376
- void BreakLocationIterator::ClearDebugBreak() {
377
- // Debugger statement always calls debugger. No need to modify it.
378
- if (IsDebuggerStatement()) {
379
- return;
380
- }
381
-
382
- if (RelocInfo::IsJSReturn(rmode())) {
383
- // Restore the frame exit code.
384
- ClearDebugBreakAtReturn();
385
- } else if (IsDebugBreakSlot()) {
386
- // Restore the code in the break slot.
387
- ClearDebugBreakAtSlot();
388
- } else {
389
- // Patch the IC call.
390
- ClearDebugBreakAtIC();
391
- }
392
- ASSERT(!IsDebugBreak());
393
- }
394
-
395
-
396
- void BreakLocationIterator::PrepareStepIn() {
397
- HandleScope scope;
398
-
399
- // Step in can only be prepared if currently positioned on an IC call,
400
- // construct call or CallFunction stub call.
401
- Address target = rinfo()->target_address();
402
- Handle<Code> code(Code::GetCodeFromTargetAddress(target));
403
- if (code->is_call_stub() || code->is_keyed_call_stub()) {
404
- // Step in through IC call is handled by the runtime system. Therefore make
405
- // sure that the any current IC is cleared and the runtime system is
406
- // called. If the executing code has a debug break at the location change
407
- // the call in the original code as it is the code there that will be
408
- // executed in place of the debug break call.
409
- Handle<Code> stub = ComputeCallDebugPrepareStepIn(code->arguments_count(),
410
- code->kind());
411
- if (IsDebugBreak()) {
412
- original_rinfo()->set_target_address(stub->entry());
413
- } else {
414
- rinfo()->set_target_address(stub->entry());
415
- }
416
- } else {
417
- #ifdef DEBUG
418
- // All the following stuff is needed only for assertion checks so the code
419
- // is wrapped in ifdef.
420
- Handle<Code> maybe_call_function_stub = code;
421
- if (IsDebugBreak()) {
422
- Address original_target = original_rinfo()->target_address();
423
- maybe_call_function_stub =
424
- Handle<Code>(Code::GetCodeFromTargetAddress(original_target));
425
- }
426
- bool is_call_function_stub =
427
- (maybe_call_function_stub->kind() == Code::STUB &&
428
- maybe_call_function_stub->major_key() == CodeStub::CallFunction);
429
-
430
- // Step in through construct call requires no changes to the running code.
431
- // Step in through getters/setters should already be prepared as well
432
- // because caller of this function (Debug::PrepareStep) is expected to
433
- // flood the top frame's function with one shot breakpoints.
434
- // Step in through CallFunction stub should also be prepared by caller of
435
- // this function (Debug::PrepareStep) which should flood target function
436
- // with breakpoints.
437
- ASSERT(RelocInfo::IsConstructCall(rmode()) || code->is_inline_cache_stub()
438
- || is_call_function_stub);
439
- #endif
440
- }
441
- }
442
-
443
-
444
- // Check whether the break point is at a position which will exit the function.
445
- bool BreakLocationIterator::IsExit() const {
446
- return (RelocInfo::IsJSReturn(rmode()));
447
- }
448
-
449
-
450
- bool BreakLocationIterator::HasBreakPoint() {
451
- return debug_info_->HasBreakPoint(code_position());
452
- }
453
-
454
-
455
- // Check whether there is a debug break at the current position.
456
- bool BreakLocationIterator::IsDebugBreak() {
457
- if (RelocInfo::IsJSReturn(rmode())) {
458
- return IsDebugBreakAtReturn();
459
- } else if (IsDebugBreakSlot()) {
460
- return IsDebugBreakAtSlot();
461
- } else {
462
- return Debug::IsDebugBreak(rinfo()->target_address());
463
- }
464
- }
465
-
466
-
467
- void BreakLocationIterator::SetDebugBreakAtIC() {
468
- // Patch the original code with the current address as the current address
469
- // might have changed by the inline caching since the code was copied.
470
- original_rinfo()->set_target_address(rinfo()->target_address());
471
-
472
- RelocInfo::Mode mode = rmode();
473
- if (RelocInfo::IsCodeTarget(mode)) {
474
- Address target = rinfo()->target_address();
475
- Handle<Code> code(Code::GetCodeFromTargetAddress(target));
476
-
477
- // Patch the code to invoke the builtin debug break function matching the
478
- // calling convention used by the call site.
479
- Handle<Code> dbgbrk_code(Debug::FindDebugBreak(code, mode));
480
- rinfo()->set_target_address(dbgbrk_code->entry());
481
-
482
- // For stubs that refer back to an inlined version clear the cached map for
483
- // the inlined case to always go through the IC. As long as the break point
484
- // is set the patching performed by the runtime system will take place in
485
- // the code copy and will therefore have no effect on the running code
486
- // keeping it from using the inlined code.
487
- if (code->is_keyed_load_stub()) {
488
- KeyedLoadIC::ClearInlinedVersion(pc());
489
- } else if (code->is_keyed_store_stub()) {
490
- KeyedStoreIC::ClearInlinedVersion(pc());
491
- } else if (code->is_load_stub()) {
492
- LoadIC::ClearInlinedVersion(pc());
493
- } else if (code->is_store_stub()) {
494
- StoreIC::ClearInlinedVersion(pc());
495
- }
496
- }
497
- }
498
-
499
-
500
- void BreakLocationIterator::ClearDebugBreakAtIC() {
501
- // Patch the code to the original invoke.
502
- rinfo()->set_target_address(original_rinfo()->target_address());
503
-
504
- RelocInfo::Mode mode = rmode();
505
- if (RelocInfo::IsCodeTarget(mode)) {
506
- AssertNoAllocation nogc;
507
- Address target = original_rinfo()->target_address();
508
- Code* code = Code::GetCodeFromTargetAddress(target);
509
-
510
- // Restore the inlined version of keyed stores to get back to the
511
- // fast case. We need to patch back the keyed store because no
512
- // patching happens when running normally. For keyed loads, the
513
- // map check will get patched back when running normally after ICs
514
- // have been cleared at GC.
515
- if (code->is_keyed_store_stub()) KeyedStoreIC::RestoreInlinedVersion(pc());
516
- }
517
- }
518
-
519
-
520
- bool BreakLocationIterator::IsDebuggerStatement() {
521
- return RelocInfo::DEBUG_BREAK == rmode();
522
- }
523
-
524
-
525
- bool BreakLocationIterator::IsDebugBreakSlot() {
526
- return RelocInfo::DEBUG_BREAK_SLOT == rmode();
527
- }
528
-
529
-
530
- Object* BreakLocationIterator::BreakPointObjects() {
531
- return debug_info_->GetBreakPointObjects(code_position());
532
- }
533
-
534
-
535
- // Clear out all the debug break code. This is ONLY supposed to be used when
536
- // shutting down the debugger as it will leave the break point information in
537
- // DebugInfo even though the code is patched back to the non break point state.
538
- void BreakLocationIterator::ClearAllDebugBreak() {
539
- while (!Done()) {
540
- ClearDebugBreak();
541
- Next();
542
- }
543
- }
544
-
545
-
546
- bool BreakLocationIterator::RinfoDone() const {
547
- ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
548
- return reloc_iterator_->done();
549
- }
550
-
551
-
552
- void BreakLocationIterator::RinfoNext() {
553
- reloc_iterator_->next();
554
- reloc_iterator_original_->next();
555
- #ifdef DEBUG
556
- ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
557
- if (!reloc_iterator_->done()) {
558
- ASSERT(rmode() == original_rmode());
559
- }
560
- #endif
561
- }
562
-
563
-
564
- // Threading support.
565
- void Debug::ThreadInit() {
566
- thread_local_.break_count_ = 0;
567
- thread_local_.break_id_ = 0;
568
- thread_local_.break_frame_id_ = StackFrame::NO_ID;
569
- thread_local_.last_step_action_ = StepNone;
570
- thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
571
- thread_local_.step_count_ = 0;
572
- thread_local_.last_fp_ = 0;
573
- thread_local_.step_into_fp_ = 0;
574
- thread_local_.step_out_fp_ = 0;
575
- thread_local_.after_break_target_ = 0;
576
- // TODO(isolates): frames_are_dropped_?
577
- thread_local_.debugger_entry_ = NULL;
578
- thread_local_.pending_interrupts_ = 0;
579
- thread_local_.restarter_frame_function_pointer_ = NULL;
580
- }
581
-
582
-
583
- char* Debug::ArchiveDebug(char* storage) {
584
- char* to = storage;
585
- memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
586
- to += sizeof(ThreadLocal);
587
- memcpy(to, reinterpret_cast<char*>(&registers_), sizeof(registers_));
588
- ThreadInit();
589
- ASSERT(to <= storage + ArchiveSpacePerThread());
590
- return storage + ArchiveSpacePerThread();
591
- }
592
-
593
-
594
- char* Debug::RestoreDebug(char* storage) {
595
- char* from = storage;
596
- memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
597
- from += sizeof(ThreadLocal);
598
- memcpy(reinterpret_cast<char*>(&registers_), from, sizeof(registers_));
599
- ASSERT(from <= storage + ArchiveSpacePerThread());
600
- return storage + ArchiveSpacePerThread();
601
- }
602
-
603
-
604
- int Debug::ArchiveSpacePerThread() {
605
- return sizeof(ThreadLocal) + sizeof(JSCallerSavedBuffer);
606
- }
607
-
608
-
609
- // Frame structure (conforms InternalFrame structure):
610
- // -- code
611
- // -- SMI maker
612
- // -- function (slot is called "context")
613
- // -- frame base
614
- Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
615
- Handle<Code> code) {
616
- ASSERT(bottom_js_frame->is_java_script());
617
-
618
- Address fp = bottom_js_frame->fp();
619
-
620
- // Move function pointer into "context" slot.
621
- Memory::Object_at(fp + StandardFrameConstants::kContextOffset) =
622
- Memory::Object_at(fp + JavaScriptFrameConstants::kFunctionOffset);
623
-
624
- Memory::Object_at(fp + InternalFrameConstants::kCodeOffset) = *code;
625
- Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) =
626
- Smi::FromInt(StackFrame::INTERNAL);
627
-
628
- return reinterpret_cast<Object**>(&Memory::Object_at(
629
- fp + StandardFrameConstants::kContextOffset));
630
- }
631
-
632
- const int Debug::kFrameDropperFrameSize = 4;
633
-
634
-
635
- void ScriptCache::Add(Handle<Script> script) {
636
- GlobalHandles* global_handles = Isolate::Current()->global_handles();
637
- // Create an entry in the hash map for the script.
638
- int id = Smi::cast(script->id())->value();
639
- HashMap::Entry* entry =
640
- HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true);
641
- if (entry->value != NULL) {
642
- ASSERT(*script == *reinterpret_cast<Script**>(entry->value));
643
- return;
644
- }
645
-
646
- // Globalize the script object, make it weak and use the location of the
647
- // global handle as the value in the hash map.
648
- Handle<Script> script_ =
649
- Handle<Script>::cast(
650
- (global_handles->Create(*script)));
651
- global_handles->MakeWeak(
652
- reinterpret_cast<Object**>(script_.location()),
653
- this,
654
- ScriptCache::HandleWeakScript);
655
- entry->value = script_.location();
656
- }
657
-
658
-
659
- Handle<FixedArray> ScriptCache::GetScripts() {
660
- Handle<FixedArray> instances = FACTORY->NewFixedArray(occupancy());
661
- int count = 0;
662
- for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
663
- ASSERT(entry->value != NULL);
664
- if (entry->value != NULL) {
665
- instances->set(count, *reinterpret_cast<Script**>(entry->value));
666
- count++;
667
- }
668
- }
669
- return instances;
670
- }
671
-
672
-
673
- void ScriptCache::ProcessCollectedScripts() {
674
- Debugger* debugger = Isolate::Current()->debugger();
675
- for (int i = 0; i < collected_scripts_.length(); i++) {
676
- debugger->OnScriptCollected(collected_scripts_[i]);
677
- }
678
- collected_scripts_.Clear();
679
- }
680
-
681
-
682
- void ScriptCache::Clear() {
683
- GlobalHandles* global_handles = Isolate::Current()->global_handles();
684
- // Iterate the script cache to get rid of all the weak handles.
685
- for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
686
- ASSERT(entry != NULL);
687
- Object** location = reinterpret_cast<Object**>(entry->value);
688
- ASSERT((*location)->IsScript());
689
- global_handles->ClearWeakness(location);
690
- global_handles->Destroy(location);
691
- }
692
- // Clear the content of the hash map.
693
- HashMap::Clear();
694
- }
695
-
696
-
697
- void ScriptCache::HandleWeakScript(v8::Persistent<v8::Value> obj, void* data) {
698
- ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data);
699
- // Find the location of the global handle.
700
- Script** location =
701
- reinterpret_cast<Script**>(Utils::OpenHandle(*obj).location());
702
- ASSERT((*location)->IsScript());
703
-
704
- // Remove the entry from the cache.
705
- int id = Smi::cast((*location)->id())->value();
706
- script_cache->Remove(reinterpret_cast<void*>(id), Hash(id));
707
- script_cache->collected_scripts_.Add(id);
708
-
709
- // Clear the weak handle.
710
- obj.Dispose();
711
- obj.Clear();
712
- }
713
-
714
-
715
- void Debug::Setup(bool create_heap_objects) {
716
- ThreadInit();
717
- if (create_heap_objects) {
718
- // Get code to handle debug break on return.
719
- debug_break_return_ =
720
- isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak);
721
- ASSERT(debug_break_return_->IsCode());
722
- // Get code to handle debug break in debug break slots.
723
- debug_break_slot_ =
724
- isolate_->builtins()->builtin(Builtins::kSlot_DebugBreak);
725
- ASSERT(debug_break_slot_->IsCode());
726
- }
727
- }
728
-
729
-
730
- void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
731
- Debug* debug = Isolate::Current()->debug();
732
- DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data);
733
- // We need to clear all breakpoints associated with the function to restore
734
- // original code and avoid patching the code twice later because
735
- // the function will live in the heap until next gc, and can be found by
736
- // Runtime::FindSharedFunctionInfoInScript.
737
- BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
738
- it.ClearAllDebugBreak();
739
- debug->RemoveDebugInfo(node->debug_info());
740
- #ifdef DEBUG
741
- node = debug->debug_info_list_;
742
- while (node != NULL) {
743
- ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data));
744
- node = node->next();
745
- }
746
- #endif
747
- }
748
-
749
-
750
- DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) {
751
- GlobalHandles* global_handles = Isolate::Current()->global_handles();
752
- // Globalize the request debug info object and make it weak.
753
- debug_info_ = Handle<DebugInfo>::cast(
754
- (global_handles->Create(debug_info)));
755
- global_handles->MakeWeak(
756
- reinterpret_cast<Object**>(debug_info_.location()),
757
- this,
758
- Debug::HandleWeakDebugInfo);
759
- }
760
-
761
-
762
- DebugInfoListNode::~DebugInfoListNode() {
763
- Isolate::Current()->global_handles()->Destroy(
764
- reinterpret_cast<Object**>(debug_info_.location()));
765
- }
766
-
767
-
768
- bool Debug::CompileDebuggerScript(int index) {
769
- Isolate* isolate = Isolate::Current();
770
- Factory* factory = isolate->factory();
771
- HandleScope scope(isolate);
772
-
773
- // Bail out if the index is invalid.
774
- if (index == -1) {
775
- return false;
776
- }
777
-
778
- // Find source and name for the requested script.
779
- Handle<String> source_code =
780
- isolate->bootstrapper()->NativesSourceLookup(index);
781
- Vector<const char> name = Natives::GetScriptName(index);
782
- Handle<String> script_name = factory->NewStringFromAscii(name);
783
-
784
- // Compile the script.
785
- Handle<SharedFunctionInfo> function_info;
786
- function_info = Compiler::Compile(source_code,
787
- script_name,
788
- 0, 0, NULL, NULL,
789
- Handle<String>::null(),
790
- NATIVES_CODE);
791
-
792
- // Silently ignore stack overflows during compilation.
793
- if (function_info.is_null()) {
794
- ASSERT(isolate->has_pending_exception());
795
- isolate->clear_pending_exception();
796
- return false;
797
- }
798
-
799
- // Execute the shared function in the debugger context.
800
- Handle<Context> context = isolate->global_context();
801
- bool caught_exception = false;
802
- Handle<JSFunction> function =
803
- factory->NewFunctionFromSharedFunctionInfo(function_info, context);
804
- Handle<Object> result =
805
- Execution::TryCall(function, Handle<Object>(context->global()),
806
- 0, NULL, &caught_exception);
807
-
808
- // Check for caught exceptions.
809
- if (caught_exception) {
810
- Handle<Object> message = MessageHandler::MakeMessageObject(
811
- "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(),
812
- Handle<String>(), Handle<JSArray>());
813
- MessageHandler::ReportMessage(NULL, message);
814
- return false;
815
- }
816
-
817
- // Mark this script as native and return successfully.
818
- Handle<Script> script(Script::cast(function->shared()->script()));
819
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
820
- return true;
821
- }
822
-
823
-
824
- bool Debug::Load() {
825
- // Return if debugger is already loaded.
826
- if (IsLoaded()) return true;
827
-
828
- ASSERT(Isolate::Current() == isolate_);
829
- Debugger* debugger = isolate_->debugger();
830
-
831
- // Bail out if we're already in the process of compiling the native
832
- // JavaScript source code for the debugger.
833
- if (debugger->compiling_natives() ||
834
- debugger->is_loading_debugger())
835
- return false;
836
- debugger->set_loading_debugger(true);
837
-
838
- // Disable breakpoints and interrupts while compiling and running the
839
- // debugger scripts including the context creation code.
840
- DisableBreak disable(true);
841
- PostponeInterruptsScope postpone(isolate_);
842
-
843
- // Create the debugger context.
844
- HandleScope scope(isolate_);
845
- Handle<Context> context =
846
- isolate_->bootstrapper()->CreateEnvironment(
847
- Handle<Object>::null(),
848
- v8::Handle<ObjectTemplate>(),
849
- NULL);
850
-
851
- // Use the debugger context.
852
- SaveContext save(isolate_);
853
- isolate_->set_context(*context);
854
-
855
- // Expose the builtins object in the debugger context.
856
- Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins");
857
- Handle<GlobalObject> global = Handle<GlobalObject>(context->global());
858
- RETURN_IF_EMPTY_HANDLE_VALUE(
859
- isolate_,
860
- SetProperty(global, key, Handle<Object>(global->builtins()),
861
- NONE, kNonStrictMode),
862
- false);
863
-
864
- // Compile the JavaScript for the debugger in the debugger context.
865
- debugger->set_compiling_natives(true);
866
- bool caught_exception =
867
- !CompileDebuggerScript(Natives::GetIndex("mirror")) ||
868
- !CompileDebuggerScript(Natives::GetIndex("debug"));
869
-
870
- if (FLAG_enable_liveedit) {
871
- caught_exception = caught_exception ||
872
- !CompileDebuggerScript(Natives::GetIndex("liveedit"));
873
- }
874
-
875
- debugger->set_compiling_natives(false);
876
-
877
- // Make sure we mark the debugger as not loading before we might
878
- // return.
879
- debugger->set_loading_debugger(false);
880
-
881
- // Check for caught exceptions.
882
- if (caught_exception) return false;
883
-
884
- // Debugger loaded.
885
- debug_context_ = context;
886
-
887
- return true;
888
- }
889
-
890
-
891
- void Debug::Unload() {
892
- // Return debugger is not loaded.
893
- if (!IsLoaded()) {
894
- return;
895
- }
896
-
897
- // Clear the script cache.
898
- DestroyScriptCache();
899
-
900
- // Clear debugger context global handle.
901
- Isolate::Current()->global_handles()->Destroy(
902
- reinterpret_cast<Object**>(debug_context_.location()));
903
- debug_context_ = Handle<Context>();
904
- }
905
-
906
-
907
- // Set the flag indicating that preemption happened during debugging.
908
- void Debug::PreemptionWhileInDebugger() {
909
- ASSERT(InDebugger());
910
- Debug::set_interrupts_pending(PREEMPT);
911
- }
912
-
913
-
914
- void Debug::Iterate(ObjectVisitor* v) {
915
- v->VisitPointer(BitCast<Object**>(&(debug_break_return_)));
916
- v->VisitPointer(BitCast<Object**>(&(debug_break_slot_)));
917
- }
918
-
919
-
920
- Object* Debug::Break(Arguments args) {
921
- Heap* heap = isolate_->heap();
922
- HandleScope scope(isolate_);
923
- ASSERT(args.length() == 0);
924
-
925
- thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED;
926
-
927
- // Get the top-most JavaScript frame.
928
- JavaScriptFrameIterator it(isolate_);
929
- JavaScriptFrame* frame = it.frame();
930
-
931
- // Just continue if breaks are disabled or debugger cannot be loaded.
932
- if (disable_break() || !Load()) {
933
- SetAfterBreakTarget(frame);
934
- return heap->undefined_value();
935
- }
936
-
937
- // Enter the debugger.
938
- EnterDebugger debugger;
939
- if (debugger.FailedToEnter()) {
940
- return heap->undefined_value();
941
- }
942
-
943
- // Postpone interrupt during breakpoint processing.
944
- PostponeInterruptsScope postpone(isolate_);
945
-
946
- // Get the debug info (create it if it does not exist).
947
- Handle<SharedFunctionInfo> shared =
948
- Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
949
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
950
-
951
- // Find the break point where execution has stopped.
952
- BreakLocationIterator break_location_iterator(debug_info,
953
- ALL_BREAK_LOCATIONS);
954
- break_location_iterator.FindBreakLocationFromAddress(frame->pc());
955
-
956
- // Check whether step next reached a new statement.
957
- if (!StepNextContinue(&break_location_iterator, frame)) {
958
- // Decrease steps left if performing multiple steps.
959
- if (thread_local_.step_count_ > 0) {
960
- thread_local_.step_count_--;
961
- }
962
- }
963
-
964
- // If there is one or more real break points check whether any of these are
965
- // triggered.
966
- Handle<Object> break_points_hit(heap->undefined_value());
967
- if (break_location_iterator.HasBreakPoint()) {
968
- Handle<Object> break_point_objects =
969
- Handle<Object>(break_location_iterator.BreakPointObjects());
970
- break_points_hit = CheckBreakPoints(break_point_objects);
971
- }
972
-
973
- // If step out is active skip everything until the frame where we need to step
974
- // out to is reached, unless real breakpoint is hit.
975
- if (StepOutActive() && frame->fp() != step_out_fp() &&
976
- break_points_hit->IsUndefined() ) {
977
- // Step count should always be 0 for StepOut.
978
- ASSERT(thread_local_.step_count_ == 0);
979
- } else if (!break_points_hit->IsUndefined() ||
980
- (thread_local_.last_step_action_ != StepNone &&
981
- thread_local_.step_count_ == 0)) {
982
- // Notify debugger if a real break point is triggered or if performing
983
- // single stepping with no more steps to perform. Otherwise do another step.
984
-
985
- // Clear all current stepping setup.
986
- ClearStepping();
987
-
988
- // Notify the debug event listeners.
989
- isolate_->debugger()->OnDebugBreak(break_points_hit, false);
990
- } else if (thread_local_.last_step_action_ != StepNone) {
991
- // Hold on to last step action as it is cleared by the call to
992
- // ClearStepping.
993
- StepAction step_action = thread_local_.last_step_action_;
994
- int step_count = thread_local_.step_count_;
995
-
996
- // Clear all current stepping setup.
997
- ClearStepping();
998
-
999
- // Set up for the remaining steps.
1000
- PrepareStep(step_action, step_count);
1001
- }
1002
-
1003
- if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) {
1004
- SetAfterBreakTarget(frame);
1005
- } else if (thread_local_.frame_drop_mode_ ==
1006
- FRAME_DROPPED_IN_IC_CALL) {
1007
- // We must have been calling IC stub. Do not go there anymore.
1008
- Code* plain_return = isolate_->builtins()->builtin(
1009
- Builtins::kPlainReturn_LiveEdit);
1010
- thread_local_.after_break_target_ = plain_return->entry();
1011
- } else if (thread_local_.frame_drop_mode_ ==
1012
- FRAME_DROPPED_IN_DEBUG_SLOT_CALL) {
1013
- // Debug break slot stub does not return normally, instead it manually
1014
- // cleans the stack and jumps. We should patch the jump address.
1015
- Code* plain_return = isolate_->builtins()->builtin(
1016
- Builtins::kFrameDropper_LiveEdit);
1017
- thread_local_.after_break_target_ = plain_return->entry();
1018
- } else if (thread_local_.frame_drop_mode_ ==
1019
- FRAME_DROPPED_IN_DIRECT_CALL) {
1020
- // Nothing to do, after_break_target is not used here.
1021
- } else {
1022
- UNREACHABLE();
1023
- }
1024
-
1025
- return heap->undefined_value();
1026
- }
1027
-
1028
-
1029
- RUNTIME_FUNCTION(Object*, Debug_Break) {
1030
- return isolate->debug()->Break(args);
1031
- }
1032
-
1033
-
1034
- // Check the break point objects for whether one or more are actually
1035
- // triggered. This function returns a JSArray with the break point objects
1036
- // which is triggered.
1037
- Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
1038
- Factory* factory = isolate_->factory();
1039
-
1040
- // Count the number of break points hit. If there are multiple break points
1041
- // they are in a FixedArray.
1042
- Handle<FixedArray> break_points_hit;
1043
- int break_points_hit_count = 0;
1044
- ASSERT(!break_point_objects->IsUndefined());
1045
- if (break_point_objects->IsFixedArray()) {
1046
- Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
1047
- break_points_hit = factory->NewFixedArray(array->length());
1048
- for (int i = 0; i < array->length(); i++) {
1049
- Handle<Object> o(array->get(i));
1050
- if (CheckBreakPoint(o)) {
1051
- break_points_hit->set(break_points_hit_count++, *o);
1052
- }
1053
- }
1054
- } else {
1055
- break_points_hit = factory->NewFixedArray(1);
1056
- if (CheckBreakPoint(break_point_objects)) {
1057
- break_points_hit->set(break_points_hit_count++, *break_point_objects);
1058
- }
1059
- }
1060
-
1061
- // Return undefined if no break points were triggered.
1062
- if (break_points_hit_count == 0) {
1063
- return factory->undefined_value();
1064
- }
1065
- // Return break points hit as a JSArray.
1066
- Handle<JSArray> result = factory->NewJSArrayWithElements(break_points_hit);
1067
- result->set_length(Smi::FromInt(break_points_hit_count));
1068
- return result;
1069
- }
1070
-
1071
-
1072
- // Check whether a single break point object is triggered.
1073
- bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
1074
- ASSERT(Isolate::Current() == isolate_);
1075
- Factory* factory = isolate_->factory();
1076
- HandleScope scope(isolate_);
1077
-
1078
- // Ignore check if break point object is not a JSObject.
1079
- if (!break_point_object->IsJSObject()) return true;
1080
-
1081
- // Get the function IsBreakPointTriggered (defined in debug-debugger.js).
1082
- Handle<String> is_break_point_triggered_symbol =
1083
- factory->LookupAsciiSymbol("IsBreakPointTriggered");
1084
- Handle<JSFunction> check_break_point =
1085
- Handle<JSFunction>(JSFunction::cast(
1086
- debug_context()->global()->GetPropertyNoExceptionThrown(
1087
- *is_break_point_triggered_symbol)));
1088
-
1089
- // Get the break id as an object.
1090
- Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id());
1091
-
1092
- // Call HandleBreakPointx.
1093
- bool caught_exception = false;
1094
- const int argc = 2;
1095
- Object** argv[argc] = {
1096
- break_id.location(),
1097
- reinterpret_cast<Object**>(break_point_object.location())
1098
- };
1099
- Handle<Object> result = Execution::TryCall(check_break_point,
1100
- isolate_->js_builtins_object(), argc, argv, &caught_exception);
1101
-
1102
- // If exception or non boolean result handle as not triggered
1103
- if (caught_exception || !result->IsBoolean()) {
1104
- return false;
1105
- }
1106
-
1107
- // Return whether the break point is triggered.
1108
- ASSERT(!result.is_null());
1109
- return (*result)->IsTrue();
1110
- }
1111
-
1112
-
1113
- // Check whether the function has debug information.
1114
- bool Debug::HasDebugInfo(Handle<SharedFunctionInfo> shared) {
1115
- return !shared->debug_info()->IsUndefined();
1116
- }
1117
-
1118
-
1119
- // Return the debug info for this function. EnsureDebugInfo must be called
1120
- // prior to ensure the debug info has been generated for shared.
1121
- Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
1122
- ASSERT(HasDebugInfo(shared));
1123
- return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
1124
- }
1125
-
1126
-
1127
- void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
1128
- Handle<Object> break_point_object,
1129
- int* source_position) {
1130
- HandleScope scope(isolate_);
1131
-
1132
- if (!EnsureDebugInfo(shared)) {
1133
- // Return if retrieving debug info failed.
1134
- return;
1135
- }
1136
-
1137
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1138
- // Source positions starts with zero.
1139
- ASSERT(source_position >= 0);
1140
-
1141
- // Find the break point and change it.
1142
- BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1143
- it.FindBreakLocationFromPosition(*source_position);
1144
- it.SetBreakPoint(break_point_object);
1145
-
1146
- *source_position = it.position();
1147
-
1148
- // At least one active break point now.
1149
- ASSERT(debug_info->GetBreakPointCount() > 0);
1150
- }
1151
-
1152
-
1153
- void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
1154
- HandleScope scope(isolate_);
1155
-
1156
- DebugInfoListNode* node = debug_info_list_;
1157
- while (node != NULL) {
1158
- Object* result = DebugInfo::FindBreakPointInfo(node->debug_info(),
1159
- break_point_object);
1160
- if (!result->IsUndefined()) {
1161
- // Get information in the break point.
1162
- BreakPointInfo* break_point_info = BreakPointInfo::cast(result);
1163
- Handle<DebugInfo> debug_info = node->debug_info();
1164
- Handle<SharedFunctionInfo> shared(debug_info->shared());
1165
- int source_position = break_point_info->statement_position()->value();
1166
-
1167
- // Source positions starts with zero.
1168
- ASSERT(source_position >= 0);
1169
-
1170
- // Find the break point and clear it.
1171
- BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1172
- it.FindBreakLocationFromPosition(source_position);
1173
- it.ClearBreakPoint(break_point_object);
1174
-
1175
- // If there are no more break points left remove the debug info for this
1176
- // function.
1177
- if (debug_info->GetBreakPointCount() == 0) {
1178
- RemoveDebugInfo(debug_info);
1179
- }
1180
-
1181
- return;
1182
- }
1183
- node = node->next();
1184
- }
1185
- }
1186
-
1187
-
1188
- void Debug::ClearAllBreakPoints() {
1189
- DebugInfoListNode* node = debug_info_list_;
1190
- while (node != NULL) {
1191
- // Remove all debug break code.
1192
- BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
1193
- it.ClearAllDebugBreak();
1194
- node = node->next();
1195
- }
1196
-
1197
- // Remove all debug info.
1198
- while (debug_info_list_ != NULL) {
1199
- RemoveDebugInfo(debug_info_list_->debug_info());
1200
- }
1201
- }
1202
-
1203
-
1204
- void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
1205
- // Make sure the function has setup the debug info.
1206
- if (!EnsureDebugInfo(shared)) {
1207
- // Return if we failed to retrieve the debug info.
1208
- return;
1209
- }
1210
-
1211
- // Flood the function with break points.
1212
- BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS);
1213
- while (!it.Done()) {
1214
- it.SetOneShot();
1215
- it.Next();
1216
- }
1217
- }
1218
-
1219
-
1220
- void Debug::FloodHandlerWithOneShot() {
1221
- // Iterate through the JavaScript stack looking for handlers.
1222
- StackFrame::Id id = break_frame_id();
1223
- if (id == StackFrame::NO_ID) {
1224
- // If there is no JavaScript stack don't do anything.
1225
- return;
1226
- }
1227
- for (JavaScriptFrameIterator it(isolate_, id); !it.done(); it.Advance()) {
1228
- JavaScriptFrame* frame = it.frame();
1229
- if (frame->HasHandler()) {
1230
- Handle<SharedFunctionInfo> shared =
1231
- Handle<SharedFunctionInfo>(
1232
- JSFunction::cast(frame->function())->shared());
1233
- // Flood the function with the catch block with break points
1234
- FloodWithOneShot(shared);
1235
- return;
1236
- }
1237
- }
1238
- }
1239
-
1240
-
1241
- void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) {
1242
- if (type == BreakUncaughtException) {
1243
- break_on_uncaught_exception_ = enable;
1244
- } else {
1245
- break_on_exception_ = enable;
1246
- }
1247
- }
1248
-
1249
-
1250
- bool Debug::IsBreakOnException(ExceptionBreakType type) {
1251
- if (type == BreakUncaughtException) {
1252
- return break_on_uncaught_exception_;
1253
- } else {
1254
- return break_on_exception_;
1255
- }
1256
- }
1257
-
1258
-
1259
- void Debug::PrepareStep(StepAction step_action, int step_count) {
1260
- ASSERT(Isolate::Current() == isolate_);
1261
- HandleScope scope(isolate_);
1262
- ASSERT(Debug::InDebugger());
1263
-
1264
- // Remember this step action and count.
1265
- thread_local_.last_step_action_ = step_action;
1266
- if (step_action == StepOut) {
1267
- // For step out target frame will be found on the stack so there is no need
1268
- // to set step counter for it. It's expected to always be 0 for StepOut.
1269
- thread_local_.step_count_ = 0;
1270
- } else {
1271
- thread_local_.step_count_ = step_count;
1272
- }
1273
-
1274
- // Get the frame where the execution has stopped and skip the debug frame if
1275
- // any. The debug frame will only be present if execution was stopped due to
1276
- // hitting a break point. In other situations (e.g. unhandled exception) the
1277
- // debug frame is not present.
1278
- StackFrame::Id id = break_frame_id();
1279
- if (id == StackFrame::NO_ID) {
1280
- // If there is no JavaScript stack don't do anything.
1281
- return;
1282
- }
1283
- JavaScriptFrameIterator frames_it(isolate_, id);
1284
- JavaScriptFrame* frame = frames_it.frame();
1285
-
1286
- // First of all ensure there is one-shot break points in the top handler
1287
- // if any.
1288
- FloodHandlerWithOneShot();
1289
-
1290
- // If the function on the top frame is unresolved perform step out. This will
1291
- // be the case when calling unknown functions and having the debugger stopped
1292
- // in an unhandled exception.
1293
- if (!frame->function()->IsJSFunction()) {
1294
- // Step out: Find the calling JavaScript frame and flood it with
1295
- // breakpoints.
1296
- frames_it.Advance();
1297
- // Fill the function to return to with one-shot break points.
1298
- JSFunction* function = JSFunction::cast(frames_it.frame()->function());
1299
- FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
1300
- return;
1301
- }
1302
-
1303
- // Get the debug info (create it if it does not exist).
1304
- Handle<SharedFunctionInfo> shared =
1305
- Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
1306
- if (!EnsureDebugInfo(shared)) {
1307
- // Return if ensuring debug info failed.
1308
- return;
1309
- }
1310
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1311
-
1312
- // Find the break location where execution has stopped.
1313
- BreakLocationIterator it(debug_info, ALL_BREAK_LOCATIONS);
1314
- it.FindBreakLocationFromAddress(frame->pc());
1315
-
1316
- // Compute whether or not the target is a call target.
1317
- bool is_load_or_store = false;
1318
- bool is_inline_cache_stub = false;
1319
- bool is_at_restarted_function = false;
1320
- Handle<Code> call_function_stub;
1321
-
1322
- if (thread_local_.restarter_frame_function_pointer_ == NULL) {
1323
- if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
1324
- bool is_call_target = false;
1325
- Address target = it.rinfo()->target_address();
1326
- Code* code = Code::GetCodeFromTargetAddress(target);
1327
- if (code->is_call_stub() || code->is_keyed_call_stub()) {
1328
- is_call_target = true;
1329
- }
1330
- if (code->is_inline_cache_stub()) {
1331
- is_inline_cache_stub = true;
1332
- is_load_or_store = !is_call_target;
1333
- }
1334
-
1335
- // Check if target code is CallFunction stub.
1336
- Code* maybe_call_function_stub = code;
1337
- // If there is a breakpoint at this line look at the original code to
1338
- // check if it is a CallFunction stub.
1339
- if (it.IsDebugBreak()) {
1340
- Address original_target = it.original_rinfo()->target_address();
1341
- maybe_call_function_stub =
1342
- Code::GetCodeFromTargetAddress(original_target);
1343
- }
1344
- if (maybe_call_function_stub->kind() == Code::STUB &&
1345
- maybe_call_function_stub->major_key() == CodeStub::CallFunction) {
1346
- // Save reference to the code as we may need it to find out arguments
1347
- // count for 'step in' later.
1348
- call_function_stub = Handle<Code>(maybe_call_function_stub);
1349
- }
1350
- }
1351
- } else {
1352
- is_at_restarted_function = true;
1353
- }
1354
-
1355
- // If this is the last break code target step out is the only possibility.
1356
- if (it.IsExit() || step_action == StepOut) {
1357
- if (step_action == StepOut) {
1358
- // Skip step_count frames starting with the current one.
1359
- while (step_count-- > 0 && !frames_it.done()) {
1360
- frames_it.Advance();
1361
- }
1362
- } else {
1363
- ASSERT(it.IsExit());
1364
- frames_it.Advance();
1365
- }
1366
- // Skip builtin functions on the stack.
1367
- while (!frames_it.done() &&
1368
- JSFunction::cast(frames_it.frame()->function())->IsBuiltin()) {
1369
- frames_it.Advance();
1370
- }
1371
- // Step out: If there is a JavaScript caller frame, we need to
1372
- // flood it with breakpoints.
1373
- if (!frames_it.done()) {
1374
- // Fill the function to return to with one-shot break points.
1375
- JSFunction* function = JSFunction::cast(frames_it.frame()->function());
1376
- FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
1377
- // Set target frame pointer.
1378
- ActivateStepOut(frames_it.frame());
1379
- }
1380
- } else if (!(is_inline_cache_stub || RelocInfo::IsConstructCall(it.rmode()) ||
1381
- !call_function_stub.is_null() || is_at_restarted_function)
1382
- || step_action == StepNext || step_action == StepMin) {
1383
- // Step next or step min.
1384
-
1385
- // Fill the current function with one-shot break points.
1386
- FloodWithOneShot(shared);
1387
-
1388
- // Remember source position and frame to handle step next.
1389
- thread_local_.last_statement_position_ =
1390
- debug_info->code()->SourceStatementPosition(frame->pc());
1391
- thread_local_.last_fp_ = frame->fp();
1392
- } else {
1393
- // If there's restarter frame on top of the stack, just get the pointer
1394
- // to function which is going to be restarted.
1395
- if (is_at_restarted_function) {
1396
- Handle<JSFunction> restarted_function(
1397
- JSFunction::cast(*thread_local_.restarter_frame_function_pointer_));
1398
- Handle<SharedFunctionInfo> restarted_shared(
1399
- restarted_function->shared());
1400
- FloodWithOneShot(restarted_shared);
1401
- } else if (!call_function_stub.is_null()) {
1402
- // If it's CallFunction stub ensure target function is compiled and flood
1403
- // it with one shot breakpoints.
1404
-
1405
- // Find out number of arguments from the stub minor key.
1406
- // Reverse lookup required as the minor key cannot be retrieved
1407
- // from the code object.
1408
- Handle<Object> obj(
1409
- isolate_->heap()->code_stubs()->SlowReverseLookup(
1410
- *call_function_stub));
1411
- ASSERT(!obj.is_null());
1412
- ASSERT(!(*obj)->IsUndefined());
1413
- ASSERT(obj->IsSmi());
1414
- // Get the STUB key and extract major and minor key.
1415
- uint32_t key = Smi::cast(*obj)->value();
1416
- // Argc in the stub is the number of arguments passed - not the
1417
- // expected arguments of the called function.
1418
- int call_function_arg_count =
1419
- CallFunctionStub::ExtractArgcFromMinorKey(
1420
- CodeStub::MinorKeyFromKey(key));
1421
- ASSERT(call_function_stub->major_key() ==
1422
- CodeStub::MajorKeyFromKey(key));
1423
-
1424
- // Find target function on the expression stack.
1425
- // Expression stack looks like this (top to bottom):
1426
- // argN
1427
- // ...
1428
- // arg0
1429
- // Receiver
1430
- // Function to call
1431
- int expressions_count = frame->ComputeExpressionsCount();
1432
- ASSERT(expressions_count - 2 - call_function_arg_count >= 0);
1433
- Object* fun = frame->GetExpression(
1434
- expressions_count - 2 - call_function_arg_count);
1435
- if (fun->IsJSFunction()) {
1436
- Handle<JSFunction> js_function(JSFunction::cast(fun));
1437
- // Don't step into builtins.
1438
- if (!js_function->IsBuiltin()) {
1439
- // It will also compile target function if it's not compiled yet.
1440
- FloodWithOneShot(Handle<SharedFunctionInfo>(js_function->shared()));
1441
- }
1442
- }
1443
- }
1444
-
1445
- // Fill the current function with one-shot break points even for step in on
1446
- // a call target as the function called might be a native function for
1447
- // which step in will not stop. It also prepares for stepping in
1448
- // getters/setters.
1449
- FloodWithOneShot(shared);
1450
-
1451
- if (is_load_or_store) {
1452
- // Remember source position and frame to handle step in getter/setter. If
1453
- // there is a custom getter/setter it will be handled in
1454
- // Object::Get/SetPropertyWithCallback, otherwise the step action will be
1455
- // propagated on the next Debug::Break.
1456
- thread_local_.last_statement_position_ =
1457
- debug_info->code()->SourceStatementPosition(frame->pc());
1458
- thread_local_.last_fp_ = frame->fp();
1459
- }
1460
-
1461
- // Step in or Step in min
1462
- it.PrepareStepIn();
1463
- ActivateStepIn(frame);
1464
- }
1465
- }
1466
-
1467
-
1468
- // Check whether the current debug break should be reported to the debugger. It
1469
- // is used to have step next and step in only report break back to the debugger
1470
- // if on a different frame or in a different statement. In some situations
1471
- // there will be several break points in the same statement when the code is
1472
- // flooded with one-shot break points. This function helps to perform several
1473
- // steps before reporting break back to the debugger.
1474
- bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
1475
- JavaScriptFrame* frame) {
1476
- // If the step last action was step next or step in make sure that a new
1477
- // statement is hit.
1478
- if (thread_local_.last_step_action_ == StepNext ||
1479
- thread_local_.last_step_action_ == StepIn) {
1480
- // Never continue if returning from function.
1481
- if (break_location_iterator->IsExit()) return false;
1482
-
1483
- // Continue if we are still on the same frame and in the same statement.
1484
- int current_statement_position =
1485
- break_location_iterator->code()->SourceStatementPosition(frame->pc());
1486
- return thread_local_.last_fp_ == frame->fp() &&
1487
- thread_local_.last_statement_position_ == current_statement_position;
1488
- }
1489
-
1490
- // No step next action - don't continue.
1491
- return false;
1492
- }
1493
-
1494
-
1495
- // Check whether the code object at the specified address is a debug break code
1496
- // object.
1497
- bool Debug::IsDebugBreak(Address addr) {
1498
- Code* code = Code::GetCodeFromTargetAddress(addr);
1499
- return code->ic_state() == DEBUG_BREAK;
1500
- }
1501
-
1502
-
1503
- // Check whether a code stub with the specified major key is a possible break
1504
- // point location when looking for source break locations.
1505
- bool Debug::IsSourceBreakStub(Code* code) {
1506
- CodeStub::Major major_key = CodeStub::GetMajorKey(code);
1507
- return major_key == CodeStub::CallFunction;
1508
- }
1509
-
1510
-
1511
- // Check whether a code stub with the specified major key is a possible break
1512
- // location.
1513
- bool Debug::IsBreakStub(Code* code) {
1514
- CodeStub::Major major_key = CodeStub::GetMajorKey(code);
1515
- return major_key == CodeStub::CallFunction;
1516
- }
1517
-
1518
-
1519
- // Find the builtin to use for invoking the debug break
1520
- Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
1521
- // Find the builtin debug break function matching the calling convention
1522
- // used by the call site.
1523
- if (code->is_inline_cache_stub()) {
1524
- switch (code->kind()) {
1525
- case Code::CALL_IC:
1526
- case Code::KEYED_CALL_IC:
1527
- return ComputeCallDebugBreak(code->arguments_count(), code->kind());
1528
-
1529
- case Code::LOAD_IC:
1530
- return Isolate::Current()->builtins()->LoadIC_DebugBreak();
1531
-
1532
- case Code::STORE_IC:
1533
- return Isolate::Current()->builtins()->StoreIC_DebugBreak();
1534
-
1535
- case Code::KEYED_LOAD_IC:
1536
- return Isolate::Current()->builtins()->KeyedLoadIC_DebugBreak();
1537
-
1538
- case Code::KEYED_STORE_IC:
1539
- return Isolate::Current()->builtins()->KeyedStoreIC_DebugBreak();
1540
-
1541
- default:
1542
- UNREACHABLE();
1543
- }
1544
- }
1545
- if (RelocInfo::IsConstructCall(mode)) {
1546
- Handle<Code> result =
1547
- Isolate::Current()->builtins()->ConstructCall_DebugBreak();
1548
- return result;
1549
- }
1550
- if (code->kind() == Code::STUB) {
1551
- ASSERT(code->major_key() == CodeStub::CallFunction);
1552
- Handle<Code> result =
1553
- Isolate::Current()->builtins()->StubNoRegisters_DebugBreak();
1554
- return result;
1555
- }
1556
-
1557
- UNREACHABLE();
1558
- return Handle<Code>::null();
1559
- }
1560
-
1561
-
1562
- // Simple function for returning the source positions for active break points.
1563
- Handle<Object> Debug::GetSourceBreakLocations(
1564
- Handle<SharedFunctionInfo> shared) {
1565
- Isolate* isolate = Isolate::Current();
1566
- Heap* heap = isolate->heap();
1567
- if (!HasDebugInfo(shared)) return Handle<Object>(heap->undefined_value());
1568
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1569
- if (debug_info->GetBreakPointCount() == 0) {
1570
- return Handle<Object>(heap->undefined_value());
1571
- }
1572
- Handle<FixedArray> locations =
1573
- isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
1574
- int count = 0;
1575
- for (int i = 0; i < debug_info->break_points()->length(); i++) {
1576
- if (!debug_info->break_points()->get(i)->IsUndefined()) {
1577
- BreakPointInfo* break_point_info =
1578
- BreakPointInfo::cast(debug_info->break_points()->get(i));
1579
- if (break_point_info->GetBreakPointCount() > 0) {
1580
- locations->set(count++, break_point_info->statement_position());
1581
- }
1582
- }
1583
- }
1584
- return locations;
1585
- }
1586
-
1587
-
1588
- void Debug::NewBreak(StackFrame::Id break_frame_id) {
1589
- thread_local_.break_frame_id_ = break_frame_id;
1590
- thread_local_.break_id_ = ++thread_local_.break_count_;
1591
- }
1592
-
1593
-
1594
- void Debug::SetBreak(StackFrame::Id break_frame_id, int break_id) {
1595
- thread_local_.break_frame_id_ = break_frame_id;
1596
- thread_local_.break_id_ = break_id;
1597
- }
1598
-
1599
-
1600
- // Handle stepping into a function.
1601
- void Debug::HandleStepIn(Handle<JSFunction> function,
1602
- Handle<Object> holder,
1603
- Address fp,
1604
- bool is_constructor) {
1605
- // If the frame pointer is not supplied by the caller find it.
1606
- if (fp == 0) {
1607
- StackFrameIterator it;
1608
- it.Advance();
1609
- // For constructor functions skip another frame.
1610
- if (is_constructor) {
1611
- ASSERT(it.frame()->is_construct());
1612
- it.Advance();
1613
- }
1614
- fp = it.frame()->fp();
1615
- }
1616
-
1617
- // Flood the function with one-shot break points if it is called from where
1618
- // step into was requested.
1619
- if (fp == step_in_fp()) {
1620
- // Don't allow step into functions in the native context.
1621
- if (!function->IsBuiltin()) {
1622
- if (function->shared()->code() ==
1623
- Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply) ||
1624
- function->shared()->code() ==
1625
- Isolate::Current()->builtins()->builtin(Builtins::kFunctionCall)) {
1626
- // Handle function.apply and function.call separately to flood the
1627
- // function to be called and not the code for Builtins::FunctionApply or
1628
- // Builtins::FunctionCall. The receiver of call/apply is the target
1629
- // function.
1630
- if (!holder.is_null() && holder->IsJSFunction() &&
1631
- !JSFunction::cast(*holder)->IsBuiltin()) {
1632
- Handle<SharedFunctionInfo> shared_info(
1633
- JSFunction::cast(*holder)->shared());
1634
- Debug::FloodWithOneShot(shared_info);
1635
- }
1636
- } else {
1637
- Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
1638
- }
1639
- }
1640
- }
1641
- }
1642
-
1643
-
1644
- void Debug::ClearStepping() {
1645
- // Clear the various stepping setup.
1646
- ClearOneShot();
1647
- ClearStepIn();
1648
- ClearStepOut();
1649
- ClearStepNext();
1650
-
1651
- // Clear multiple step counter.
1652
- thread_local_.step_count_ = 0;
1653
- }
1654
-
1655
- // Clears all the one-shot break points that are currently set. Normally this
1656
- // function is called each time a break point is hit as one shot break points
1657
- // are used to support stepping.
1658
- void Debug::ClearOneShot() {
1659
- // The current implementation just runs through all the breakpoints. When the
1660
- // last break point for a function is removed that function is automatically
1661
- // removed from the list.
1662
-
1663
- DebugInfoListNode* node = debug_info_list_;
1664
- while (node != NULL) {
1665
- BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
1666
- while (!it.Done()) {
1667
- it.ClearOneShot();
1668
- it.Next();
1669
- }
1670
- node = node->next();
1671
- }
1672
- }
1673
-
1674
-
1675
- void Debug::ActivateStepIn(StackFrame* frame) {
1676
- ASSERT(!StepOutActive());
1677
- thread_local_.step_into_fp_ = frame->fp();
1678
- }
1679
-
1680
-
1681
- void Debug::ClearStepIn() {
1682
- thread_local_.step_into_fp_ = 0;
1683
- }
1684
-
1685
-
1686
- void Debug::ActivateStepOut(StackFrame* frame) {
1687
- ASSERT(!StepInActive());
1688
- thread_local_.step_out_fp_ = frame->fp();
1689
- }
1690
-
1691
-
1692
- void Debug::ClearStepOut() {
1693
- thread_local_.step_out_fp_ = 0;
1694
- }
1695
-
1696
-
1697
- void Debug::ClearStepNext() {
1698
- thread_local_.last_step_action_ = StepNone;
1699
- thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
1700
- thread_local_.last_fp_ = 0;
1701
- }
1702
-
1703
-
1704
- // Ensures the debug information is present for shared.
1705
- bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) {
1706
- // Return if we already have the debug info for shared.
1707
- if (HasDebugInfo(shared)) return true;
1708
-
1709
- // Ensure shared in compiled. Return false if this failed.
1710
- if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1711
-
1712
- // If preparing for the first break point make sure to deoptimize all
1713
- // functions as debugging does not work with optimized code.
1714
- if (!has_break_points_) {
1715
- Deoptimizer::DeoptimizeAll();
1716
- }
1717
-
1718
- // Create the debug info object.
1719
- Handle<DebugInfo> debug_info = FACTORY->NewDebugInfo(shared);
1720
-
1721
- // Add debug info to the list.
1722
- DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
1723
- node->set_next(debug_info_list_);
1724
- debug_info_list_ = node;
1725
-
1726
- // Now there is at least one break point.
1727
- has_break_points_ = true;
1728
-
1729
- return true;
1730
- }
1731
-
1732
-
1733
- void Debug::RemoveDebugInfo(Handle<DebugInfo> debug_info) {
1734
- ASSERT(debug_info_list_ != NULL);
1735
- // Run through the debug info objects to find this one and remove it.
1736
- DebugInfoListNode* prev = NULL;
1737
- DebugInfoListNode* current = debug_info_list_;
1738
- while (current != NULL) {
1739
- if (*current->debug_info() == *debug_info) {
1740
- // Unlink from list. If prev is NULL we are looking at the first element.
1741
- if (prev == NULL) {
1742
- debug_info_list_ = current->next();
1743
- } else {
1744
- prev->set_next(current->next());
1745
- }
1746
- current->debug_info()->shared()->set_debug_info(
1747
- isolate_->heap()->undefined_value());
1748
- delete current;
1749
-
1750
- // If there are no more debug info objects there are not more break
1751
- // points.
1752
- has_break_points_ = debug_info_list_ != NULL;
1753
-
1754
- return;
1755
- }
1756
- // Move to next in list.
1757
- prev = current;
1758
- current = current->next();
1759
- }
1760
- UNREACHABLE();
1761
- }
1762
-
1763
-
1764
- void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
1765
- ASSERT(Isolate::Current() == isolate_);
1766
- HandleScope scope(isolate_);
1767
-
1768
- // Get the executing function in which the debug break occurred.
1769
- Handle<SharedFunctionInfo> shared =
1770
- Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
1771
- if (!EnsureDebugInfo(shared)) {
1772
- // Return if we failed to retrieve the debug info.
1773
- return;
1774
- }
1775
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1776
- Handle<Code> code(debug_info->code());
1777
- Handle<Code> original_code(debug_info->original_code());
1778
- #ifdef DEBUG
1779
- // Get the code which is actually executing.
1780
- Handle<Code> frame_code(frame->LookupCode());
1781
- ASSERT(frame_code.is_identical_to(code));
1782
- #endif
1783
-
1784
- // Find the call address in the running code. This address holds the call to
1785
- // either a DebugBreakXXX or to the debug break return entry code if the
1786
- // break point is still active after processing the break point.
1787
- Address addr = frame->pc() - Assembler::kCallTargetAddressOffset;
1788
-
1789
- // Check if the location is at JS exit or debug break slot.
1790
- bool at_js_return = false;
1791
- bool break_at_js_return_active = false;
1792
- bool at_debug_break_slot = false;
1793
- RelocIterator it(debug_info->code());
1794
- while (!it.done() && !at_js_return && !at_debug_break_slot) {
1795
- if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
1796
- at_js_return = (it.rinfo()->pc() ==
1797
- addr - Assembler::kPatchReturnSequenceAddressOffset);
1798
- break_at_js_return_active = it.rinfo()->IsPatchedReturnSequence();
1799
- }
1800
- if (RelocInfo::IsDebugBreakSlot(it.rinfo()->rmode())) {
1801
- at_debug_break_slot = (it.rinfo()->pc() ==
1802
- addr - Assembler::kPatchDebugBreakSlotAddressOffset);
1803
- }
1804
- it.next();
1805
- }
1806
-
1807
- // Handle the jump to continue execution after break point depending on the
1808
- // break location.
1809
- if (at_js_return) {
1810
- // If the break point as return is still active jump to the corresponding
1811
- // place in the original code. If not the break point was removed during
1812
- // break point processing.
1813
- if (break_at_js_return_active) {
1814
- addr += original_code->instruction_start() - code->instruction_start();
1815
- }
1816
-
1817
- // Move back to where the call instruction sequence started.
1818
- thread_local_.after_break_target_ =
1819
- addr - Assembler::kPatchReturnSequenceAddressOffset;
1820
- } else if (at_debug_break_slot) {
1821
- // Address of where the debug break slot starts.
1822
- addr = addr - Assembler::kPatchDebugBreakSlotAddressOffset;
1823
-
1824
- // Continue just after the slot.
1825
- thread_local_.after_break_target_ = addr + Assembler::kDebugBreakSlotLength;
1826
- } else if (IsDebugBreak(Assembler::target_address_at(addr))) {
1827
- // We now know that there is still a debug break call at the target address,
1828
- // so the break point is still there and the original code will hold the
1829
- // address to jump to in order to complete the call which is replaced by a
1830
- // call to DebugBreakXXX.
1831
-
1832
- // Find the corresponding address in the original code.
1833
- addr += original_code->instruction_start() - code->instruction_start();
1834
-
1835
- // Install jump to the call address in the original code. This will be the
1836
- // call which was overwritten by the call to DebugBreakXXX.
1837
- thread_local_.after_break_target_ = Assembler::target_address_at(addr);
1838
- } else {
1839
- // There is no longer a break point present. Don't try to look in the
1840
- // original code as the running code will have the right address. This takes
1841
- // care of the case where the last break point is removed from the function
1842
- // and therefore no "original code" is available.
1843
- thread_local_.after_break_target_ = Assembler::target_address_at(addr);
1844
- }
1845
- }
1846
-
1847
-
1848
- bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
1849
- HandleScope scope(isolate_);
1850
-
1851
- // Get the executing function in which the debug break occurred.
1852
- Handle<SharedFunctionInfo> shared =
1853
- Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
1854
- if (!EnsureDebugInfo(shared)) {
1855
- // Return if we failed to retrieve the debug info.
1856
- return false;
1857
- }
1858
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1859
- Handle<Code> code(debug_info->code());
1860
- #ifdef DEBUG
1861
- // Get the code which is actually executing.
1862
- Handle<Code> frame_code(frame->LookupCode());
1863
- ASSERT(frame_code.is_identical_to(code));
1864
- #endif
1865
-
1866
- // Find the call address in the running code.
1867
- Address addr = frame->pc() - Assembler::kCallTargetAddressOffset;
1868
-
1869
- // Check if the location is at JS return.
1870
- RelocIterator it(debug_info->code());
1871
- while (!it.done()) {
1872
- if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
1873
- return (it.rinfo()->pc() ==
1874
- addr - Assembler::kPatchReturnSequenceAddressOffset);
1875
- }
1876
- it.next();
1877
- }
1878
- return false;
1879
- }
1880
-
1881
-
1882
- void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
1883
- FrameDropMode mode,
1884
- Object** restarter_frame_function_pointer) {
1885
- thread_local_.frame_drop_mode_ = mode;
1886
- thread_local_.break_frame_id_ = new_break_frame_id;
1887
- thread_local_.restarter_frame_function_pointer_ =
1888
- restarter_frame_function_pointer;
1889
- }
1890
-
1891
-
1892
- bool Debug::IsDebugGlobal(GlobalObject* global) {
1893
- return IsLoaded() && global == debug_context()->global();
1894
- }
1895
-
1896
-
1897
- void Debug::ClearMirrorCache() {
1898
- ASSERT(Isolate::Current() == isolate_);
1899
- PostponeInterruptsScope postpone(isolate_);
1900
- HandleScope scope(isolate_);
1901
- ASSERT(isolate_->context() == *Debug::debug_context());
1902
-
1903
- // Clear the mirror cache.
1904
- Handle<String> function_name =
1905
- isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache"));
1906
- Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown(
1907
- *function_name));
1908
- ASSERT(fun->IsJSFunction());
1909
- bool caught_exception;
1910
- Handle<Object> js_object = Execution::TryCall(
1911
- Handle<JSFunction>::cast(fun),
1912
- Handle<JSObject>(Debug::debug_context()->global()),
1913
- 0, NULL, &caught_exception);
1914
- }
1915
-
1916
-
1917
- void Debug::CreateScriptCache() {
1918
- ASSERT(Isolate::Current() == isolate_);
1919
- Heap* heap = isolate_->heap();
1920
- HandleScope scope(isolate_);
1921
-
1922
- // Perform two GCs to get rid of all unreferenced scripts. The first GC gets
1923
- // rid of all the cached script wrappers and the second gets rid of the
1924
- // scripts which are no longer referenced.
1925
- heap->CollectAllGarbage(false);
1926
- heap->CollectAllGarbage(false);
1927
-
1928
- ASSERT(script_cache_ == NULL);
1929
- script_cache_ = new ScriptCache();
1930
-
1931
- // Scan heap for Script objects.
1932
- int count = 0;
1933
- HeapIterator iterator;
1934
- for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1935
- if (obj->IsScript() && Script::cast(obj)->HasValidSource()) {
1936
- script_cache_->Add(Handle<Script>(Script::cast(obj)));
1937
- count++;
1938
- }
1939
- }
1940
- }
1941
-
1942
-
1943
- void Debug::DestroyScriptCache() {
1944
- // Get rid of the script cache if it was created.
1945
- if (script_cache_ != NULL) {
1946
- delete script_cache_;
1947
- script_cache_ = NULL;
1948
- }
1949
- }
1950
-
1951
-
1952
- void Debug::AddScriptToScriptCache(Handle<Script> script) {
1953
- if (script_cache_ != NULL) {
1954
- script_cache_->Add(script);
1955
- }
1956
- }
1957
-
1958
-
1959
- Handle<FixedArray> Debug::GetLoadedScripts() {
1960
- ASSERT(Isolate::Current() == isolate_);
1961
- // Create and fill the script cache when the loaded scripts is requested for
1962
- // the first time.
1963
- if (script_cache_ == NULL) {
1964
- CreateScriptCache();
1965
- }
1966
-
1967
- // If the script cache is not active just return an empty array.
1968
- ASSERT(script_cache_ != NULL);
1969
- if (script_cache_ == NULL) {
1970
- isolate_->factory()->NewFixedArray(0);
1971
- }
1972
-
1973
- // Perform GC to get unreferenced scripts evicted from the cache before
1974
- // returning the content.
1975
- isolate_->heap()->CollectAllGarbage(false);
1976
-
1977
- // Get the scripts from the cache.
1978
- return script_cache_->GetScripts();
1979
- }
1980
-
1981
-
1982
- void Debug::AfterGarbageCollection() {
1983
- // Generate events for collected scripts.
1984
- if (script_cache_ != NULL) {
1985
- script_cache_->ProcessCollectedScripts();
1986
- }
1987
- }
1988
-
1989
-
1990
- Debugger::Debugger()
1991
- : debugger_access_(OS::CreateMutex()),
1992
- event_listener_(Handle<Object>()),
1993
- event_listener_data_(Handle<Object>()),
1994
- compiling_natives_(false),
1995
- is_loading_debugger_(false),
1996
- never_unload_debugger_(false),
1997
- message_handler_(NULL),
1998
- debugger_unload_pending_(false),
1999
- host_dispatch_handler_(NULL),
2000
- dispatch_handler_access_(OS::CreateMutex()),
2001
- debug_message_dispatch_handler_(NULL),
2002
- message_dispatch_helper_thread_(NULL),
2003
- host_dispatch_micros_(100 * 1000),
2004
- agent_(NULL),
2005
- command_queue_(kQueueInitialSize),
2006
- command_received_(OS::CreateSemaphore(0)),
2007
- event_command_queue_(kQueueInitialSize) {
2008
- }
2009
-
2010
-
2011
- Debugger::~Debugger() {
2012
- delete debugger_access_;
2013
- debugger_access_ = 0;
2014
- delete dispatch_handler_access_;
2015
- dispatch_handler_access_ = 0;
2016
- delete command_received_;
2017
- command_received_ = 0;
2018
- }
2019
-
2020
-
2021
- Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
2022
- int argc, Object*** argv,
2023
- bool* caught_exception) {
2024
- ASSERT(Isolate::Current() == isolate_);
2025
- ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
2026
-
2027
- // Create the execution state object.
2028
- Handle<String> constructor_str =
2029
- isolate_->factory()->LookupSymbol(constructor_name);
2030
- Handle<Object> constructor(
2031
- isolate_->global()->GetPropertyNoExceptionThrown(*constructor_str));
2032
- ASSERT(constructor->IsJSFunction());
2033
- if (!constructor->IsJSFunction()) {
2034
- *caught_exception = true;
2035
- return isolate_->factory()->undefined_value();
2036
- }
2037
- Handle<Object> js_object = Execution::TryCall(
2038
- Handle<JSFunction>::cast(constructor),
2039
- Handle<JSObject>(isolate_->debug()->debug_context()->global()),
2040
- argc, argv, caught_exception);
2041
- return js_object;
2042
- }
2043
-
2044
-
2045
- Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
2046
- ASSERT(Isolate::Current() == isolate_);
2047
- // Create the execution state object.
2048
- Handle<Object> break_id = isolate_->factory()->NewNumberFromInt(
2049
- isolate_->debug()->break_id());
2050
- const int argc = 1;
2051
- Object** argv[argc] = { break_id.location() };
2052
- return MakeJSObject(CStrVector("MakeExecutionState"),
2053
- argc, argv, caught_exception);
2054
- }
2055
-
2056
-
2057
- Handle<Object> Debugger::MakeBreakEvent(Handle<Object> exec_state,
2058
- Handle<Object> break_points_hit,
2059
- bool* caught_exception) {
2060
- ASSERT(Isolate::Current() == isolate_);
2061
- // Create the new break event object.
2062
- const int argc = 2;
2063
- Object** argv[argc] = { exec_state.location(),
2064
- break_points_hit.location() };
2065
- return MakeJSObject(CStrVector("MakeBreakEvent"),
2066
- argc,
2067
- argv,
2068
- caught_exception);
2069
- }
2070
-
2071
-
2072
- Handle<Object> Debugger::MakeExceptionEvent(Handle<Object> exec_state,
2073
- Handle<Object> exception,
2074
- bool uncaught,
2075
- bool* caught_exception) {
2076
- ASSERT(Isolate::Current() == isolate_);
2077
- Factory* factory = isolate_->factory();
2078
- // Create the new exception event object.
2079
- const int argc = 3;
2080
- Object** argv[argc] = { exec_state.location(),
2081
- exception.location(),
2082
- uncaught ? factory->true_value().location() :
2083
- factory->false_value().location()};
2084
- return MakeJSObject(CStrVector("MakeExceptionEvent"),
2085
- argc, argv, caught_exception);
2086
- }
2087
-
2088
-
2089
- Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
2090
- bool* caught_exception) {
2091
- ASSERT(Isolate::Current() == isolate_);
2092
- // Create the new function event object.
2093
- const int argc = 1;
2094
- Object** argv[argc] = { function.location() };
2095
- return MakeJSObject(CStrVector("MakeNewFunctionEvent"),
2096
- argc, argv, caught_exception);
2097
- }
2098
-
2099
-
2100
- Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
2101
- bool before,
2102
- bool* caught_exception) {
2103
- ASSERT(Isolate::Current() == isolate_);
2104
- Factory* factory = isolate_->factory();
2105
- // Create the compile event object.
2106
- Handle<Object> exec_state = MakeExecutionState(caught_exception);
2107
- Handle<Object> script_wrapper = GetScriptWrapper(script);
2108
- const int argc = 3;
2109
- Object** argv[argc] = { exec_state.location(),
2110
- script_wrapper.location(),
2111
- before ? factory->true_value().location() :
2112
- factory->false_value().location() };
2113
-
2114
- return MakeJSObject(CStrVector("MakeCompileEvent"),
2115
- argc,
2116
- argv,
2117
- caught_exception);
2118
- }
2119
-
2120
-
2121
- Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
2122
- bool* caught_exception) {
2123
- ASSERT(Isolate::Current() == isolate_);
2124
- // Create the script collected event object.
2125
- Handle<Object> exec_state = MakeExecutionState(caught_exception);
2126
- Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id));
2127
- const int argc = 2;
2128
- Object** argv[argc] = { exec_state.location(), id_object.location() };
2129
-
2130
- return MakeJSObject(CStrVector("MakeScriptCollectedEvent"),
2131
- argc,
2132
- argv,
2133
- caught_exception);
2134
- }
2135
-
2136
-
2137
- void Debugger::OnException(Handle<Object> exception, bool uncaught) {
2138
- ASSERT(Isolate::Current() == isolate_);
2139
- HandleScope scope(isolate_);
2140
- Debug* debug = isolate_->debug();
2141
-
2142
- // Bail out based on state or if there is no listener for this event
2143
- if (debug->InDebugger()) return;
2144
- if (!Debugger::EventActive(v8::Exception)) return;
2145
-
2146
- // Bail out if exception breaks are not active
2147
- if (uncaught) {
2148
- // Uncaught exceptions are reported by either flags.
2149
- if (!(debug->break_on_uncaught_exception() ||
2150
- debug->break_on_exception())) return;
2151
- } else {
2152
- // Caught exceptions are reported is activated.
2153
- if (!debug->break_on_exception()) return;
2154
- }
2155
-
2156
- // Enter the debugger.
2157
- EnterDebugger debugger;
2158
- if (debugger.FailedToEnter()) return;
2159
-
2160
- // Clear all current stepping setup.
2161
- debug->ClearStepping();
2162
- // Create the event data object.
2163
- bool caught_exception = false;
2164
- Handle<Object> exec_state = MakeExecutionState(&caught_exception);
2165
- Handle<Object> event_data;
2166
- if (!caught_exception) {
2167
- event_data = MakeExceptionEvent(exec_state, exception, uncaught,
2168
- &caught_exception);
2169
- }
2170
- // Bail out and don't call debugger if exception.
2171
- if (caught_exception) {
2172
- return;
2173
- }
2174
-
2175
- // Process debug event.
2176
- ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
2177
- // Return to continue execution from where the exception was thrown.
2178
- }
2179
-
2180
-
2181
- void Debugger::OnDebugBreak(Handle<Object> break_points_hit,
2182
- bool auto_continue) {
2183
- ASSERT(Isolate::Current() == isolate_);
2184
- HandleScope scope(isolate_);
2185
-
2186
- // Debugger has already been entered by caller.
2187
- ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
2188
-
2189
- // Bail out if there is no listener for this event
2190
- if (!Debugger::EventActive(v8::Break)) return;
2191
-
2192
- // Debugger must be entered in advance.
2193
- ASSERT(Isolate::Current()->context() == *isolate_->debug()->debug_context());
2194
-
2195
- // Create the event data object.
2196
- bool caught_exception = false;
2197
- Handle<Object> exec_state = MakeExecutionState(&caught_exception);
2198
- Handle<Object> event_data;
2199
- if (!caught_exception) {
2200
- event_data = MakeBreakEvent(exec_state, break_points_hit,
2201
- &caught_exception);
2202
- }
2203
- // Bail out and don't call debugger if exception.
2204
- if (caught_exception) {
2205
- return;
2206
- }
2207
-
2208
- // Process debug event.
2209
- ProcessDebugEvent(v8::Break,
2210
- Handle<JSObject>::cast(event_data),
2211
- auto_continue);
2212
- }
2213
-
2214
-
2215
- void Debugger::OnBeforeCompile(Handle<Script> script) {
2216
- ASSERT(Isolate::Current() == isolate_);
2217
- HandleScope scope(isolate_);
2218
-
2219
- // Bail out based on state or if there is no listener for this event
2220
- if (isolate_->debug()->InDebugger()) return;
2221
- if (compiling_natives()) return;
2222
- if (!EventActive(v8::BeforeCompile)) return;
2223
-
2224
- // Enter the debugger.
2225
- EnterDebugger debugger;
2226
- if (debugger.FailedToEnter()) return;
2227
-
2228
- // Create the event data object.
2229
- bool caught_exception = false;
2230
- Handle<Object> event_data = MakeCompileEvent(script, true, &caught_exception);
2231
- // Bail out and don't call debugger if exception.
2232
- if (caught_exception) {
2233
- return;
2234
- }
2235
-
2236
- // Process debug event.
2237
- ProcessDebugEvent(v8::BeforeCompile,
2238
- Handle<JSObject>::cast(event_data),
2239
- true);
2240
- }
2241
-
2242
-
2243
- // Handle debugger actions when a new script is compiled.
2244
- void Debugger::OnAfterCompile(Handle<Script> script,
2245
- AfterCompileFlags after_compile_flags) {
2246
- ASSERT(Isolate::Current() == isolate_);
2247
- HandleScope scope(isolate_);
2248
- Debug* debug = isolate_->debug();
2249
-
2250
- // Add the newly compiled script to the script cache.
2251
- debug->AddScriptToScriptCache(script);
2252
-
2253
- // No more to do if not debugging.
2254
- if (!IsDebuggerActive()) return;
2255
-
2256
- // No compile events while compiling natives.
2257
- if (compiling_natives()) return;
2258
-
2259
- // Store whether in debugger before entering debugger.
2260
- bool in_debugger = debug->InDebugger();
2261
-
2262
- // Enter the debugger.
2263
- EnterDebugger debugger;
2264
- if (debugger.FailedToEnter()) return;
2265
-
2266
- // If debugging there might be script break points registered for this
2267
- // script. Make sure that these break points are set.
2268
-
2269
- // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
2270
- Handle<String> update_script_break_points_symbol =
2271
- isolate_->factory()->LookupAsciiSymbol("UpdateScriptBreakPoints");
2272
- Handle<Object> update_script_break_points =
2273
- Handle<Object>(debug->debug_context()->global()->
2274
- GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
2275
- if (!update_script_break_points->IsJSFunction()) {
2276
- return;
2277
- }
2278
- ASSERT(update_script_break_points->IsJSFunction());
2279
-
2280
- // Wrap the script object in a proper JS object before passing it
2281
- // to JavaScript.
2282
- Handle<JSValue> wrapper = GetScriptWrapper(script);
2283
-
2284
- // Call UpdateScriptBreakPoints expect no exceptions.
2285
- bool caught_exception = false;
2286
- const int argc = 1;
2287
- Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
2288
- Handle<Object> result = Execution::TryCall(
2289
- Handle<JSFunction>::cast(update_script_break_points),
2290
- Isolate::Current()->js_builtins_object(), argc, argv,
2291
- &caught_exception);
2292
- if (caught_exception) {
2293
- return;
2294
- }
2295
- // Bail out based on state or if there is no listener for this event
2296
- if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return;
2297
- if (!Debugger::EventActive(v8::AfterCompile)) return;
2298
-
2299
- // Create the compile state object.
2300
- Handle<Object> event_data = MakeCompileEvent(script,
2301
- false,
2302
- &caught_exception);
2303
- // Bail out and don't call debugger if exception.
2304
- if (caught_exception) {
2305
- return;
2306
- }
2307
- // Process debug event.
2308
- ProcessDebugEvent(v8::AfterCompile,
2309
- Handle<JSObject>::cast(event_data),
2310
- true);
2311
- }
2312
-
2313
-
2314
- void Debugger::OnScriptCollected(int id) {
2315
- ASSERT(Isolate::Current() == isolate_);
2316
- HandleScope scope(isolate_);
2317
-
2318
- // No more to do if not debugging.
2319
- if (!IsDebuggerActive()) return;
2320
- if (!Debugger::EventActive(v8::ScriptCollected)) return;
2321
-
2322
- // Enter the debugger.
2323
- EnterDebugger debugger;
2324
- if (debugger.FailedToEnter()) return;
2325
-
2326
- // Create the script collected state object.
2327
- bool caught_exception = false;
2328
- Handle<Object> event_data = MakeScriptCollectedEvent(id,
2329
- &caught_exception);
2330
- // Bail out and don't call debugger if exception.
2331
- if (caught_exception) {
2332
- return;
2333
- }
2334
-
2335
- // Process debug event.
2336
- ProcessDebugEvent(v8::ScriptCollected,
2337
- Handle<JSObject>::cast(event_data),
2338
- true);
2339
- }
2340
-
2341
-
2342
- void Debugger::ProcessDebugEvent(v8::DebugEvent event,
2343
- Handle<JSObject> event_data,
2344
- bool auto_continue) {
2345
- ASSERT(Isolate::Current() == isolate_);
2346
- HandleScope scope(isolate_);
2347
-
2348
- // Clear any pending debug break if this is a real break.
2349
- if (!auto_continue) {
2350
- isolate_->debug()->clear_interrupt_pending(DEBUGBREAK);
2351
- }
2352
-
2353
- // Create the execution state.
2354
- bool caught_exception = false;
2355
- Handle<Object> exec_state = MakeExecutionState(&caught_exception);
2356
- if (caught_exception) {
2357
- return;
2358
- }
2359
- // First notify the message handler if any.
2360
- if (message_handler_ != NULL) {
2361
- NotifyMessageHandler(event,
2362
- Handle<JSObject>::cast(exec_state),
2363
- event_data,
2364
- auto_continue);
2365
- }
2366
- // Notify registered debug event listener. This can be either a C or
2367
- // a JavaScript function. Don't call event listener for v8::Break
2368
- // here, if it's only a debug command -- they will be processed later.
2369
- if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) {
2370
- CallEventCallback(event, exec_state, event_data, NULL);
2371
- }
2372
- // Process pending debug commands.
2373
- if (event == v8::Break) {
2374
- while (!event_command_queue_.IsEmpty()) {
2375
- CommandMessage command = event_command_queue_.Get();
2376
- if (!event_listener_.is_null()) {
2377
- CallEventCallback(v8::BreakForCommand,
2378
- exec_state,
2379
- event_data,
2380
- command.client_data());
2381
- }
2382
- command.Dispose();
2383
- }
2384
- }
2385
- }
2386
-
2387
-
2388
- void Debugger::CallEventCallback(v8::DebugEvent event,
2389
- Handle<Object> exec_state,
2390
- Handle<Object> event_data,
2391
- v8::Debug::ClientData* client_data) {
2392
- if (event_listener_->IsProxy()) {
2393
- CallCEventCallback(event, exec_state, event_data, client_data);
2394
- } else {
2395
- CallJSEventCallback(event, exec_state, event_data);
2396
- }
2397
- }
2398
-
2399
-
2400
- void Debugger::CallCEventCallback(v8::DebugEvent event,
2401
- Handle<Object> exec_state,
2402
- Handle<Object> event_data,
2403
- v8::Debug::ClientData* client_data) {
2404
- Handle<Proxy> callback_obj(Handle<Proxy>::cast(event_listener_));
2405
- v8::Debug::EventCallback2 callback =
2406
- FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->proxy());
2407
- EventDetailsImpl event_details(
2408
- event,
2409
- Handle<JSObject>::cast(exec_state),
2410
- Handle<JSObject>::cast(event_data),
2411
- event_listener_data_,
2412
- client_data);
2413
- callback(event_details);
2414
- }
2415
-
2416
-
2417
- void Debugger::CallJSEventCallback(v8::DebugEvent event,
2418
- Handle<Object> exec_state,
2419
- Handle<Object> event_data) {
2420
- ASSERT(event_listener_->IsJSFunction());
2421
- ASSERT(Isolate::Current() == isolate_);
2422
- Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
2423
-
2424
- // Invoke the JavaScript debug event listener.
2425
- const int argc = 4;
2426
- Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(),
2427
- exec_state.location(),
2428
- Handle<Object>::cast(event_data).location(),
2429
- event_listener_data_.location() };
2430
- bool caught_exception = false;
2431
- Execution::TryCall(fun, isolate_->global(), argc, argv, &caught_exception);
2432
- // Silently ignore exceptions from debug event listeners.
2433
- }
2434
-
2435
-
2436
- Handle<Context> Debugger::GetDebugContext() {
2437
- ASSERT(Isolate::Current() == isolate_);
2438
- never_unload_debugger_ = true;
2439
- EnterDebugger debugger;
2440
- return isolate_->debug()->debug_context();
2441
- }
2442
-
2443
-
2444
- void Debugger::UnloadDebugger() {
2445
- ASSERT(Isolate::Current() == isolate_);
2446
- Debug* debug = isolate_->debug();
2447
-
2448
- // Make sure that there are no breakpoints left.
2449
- debug->ClearAllBreakPoints();
2450
-
2451
- // Unload the debugger if feasible.
2452
- if (!never_unload_debugger_) {
2453
- debug->Unload();
2454
- }
2455
-
2456
- // Clear the flag indicating that the debugger should be unloaded.
2457
- debugger_unload_pending_ = false;
2458
- }
2459
-
2460
-
2461
- void Debugger::NotifyMessageHandler(v8::DebugEvent event,
2462
- Handle<JSObject> exec_state,
2463
- Handle<JSObject> event_data,
2464
- bool auto_continue) {
2465
- ASSERT(Isolate::Current() == isolate_);
2466
- HandleScope scope(isolate_);
2467
-
2468
- if (!isolate_->debug()->Load()) return;
2469
-
2470
- // Process the individual events.
2471
- bool sendEventMessage = false;
2472
- switch (event) {
2473
- case v8::Break:
2474
- case v8::BreakForCommand:
2475
- sendEventMessage = !auto_continue;
2476
- break;
2477
- case v8::Exception:
2478
- sendEventMessage = true;
2479
- break;
2480
- case v8::BeforeCompile:
2481
- break;
2482
- case v8::AfterCompile:
2483
- sendEventMessage = true;
2484
- break;
2485
- case v8::ScriptCollected:
2486
- sendEventMessage = true;
2487
- break;
2488
- case v8::NewFunction:
2489
- break;
2490
- default:
2491
- UNREACHABLE();
2492
- }
2493
-
2494
- // The debug command interrupt flag might have been set when the command was
2495
- // added. It should be enough to clear the flag only once while we are in the
2496
- // debugger.
2497
- ASSERT(isolate_->debug()->InDebugger());
2498
- isolate_->stack_guard()->Continue(DEBUGCOMMAND);
2499
-
2500
- // Notify the debugger that a debug event has occurred unless auto continue is
2501
- // active in which case no event is send.
2502
- if (sendEventMessage) {
2503
- MessageImpl message = MessageImpl::NewEvent(
2504
- event,
2505
- auto_continue,
2506
- Handle<JSObject>::cast(exec_state),
2507
- Handle<JSObject>::cast(event_data));
2508
- InvokeMessageHandler(message);
2509
- }
2510
-
2511
- // If auto continue don't make the event cause a break, but process messages
2512
- // in the queue if any. For script collected events don't even process
2513
- // messages in the queue as the execution state might not be what is expected
2514
- // by the client.
2515
- if ((auto_continue && !HasCommands()) || event == v8::ScriptCollected) {
2516
- return;
2517
- }
2518
-
2519
- v8::TryCatch try_catch;
2520
-
2521
- // DebugCommandProcessor goes here.
2522
- v8::Local<v8::Object> cmd_processor;
2523
- {
2524
- v8::Local<v8::Object> api_exec_state =
2525
- v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
2526
- v8::Local<v8::String> fun_name =
2527
- v8::String::New("debugCommandProcessor");
2528
- v8::Local<v8::Function> fun =
2529
- v8::Function::Cast(*api_exec_state->Get(fun_name));
2530
-
2531
- v8::Handle<v8::Boolean> running =
2532
- auto_continue ? v8::True() : v8::False();
2533
- static const int kArgc = 1;
2534
- v8::Handle<Value> argv[kArgc] = { running };
2535
- cmd_processor = v8::Object::Cast(*fun->Call(api_exec_state, kArgc, argv));
2536
- if (try_catch.HasCaught()) {
2537
- PrintLn(try_catch.Exception());
2538
- return;
2539
- }
2540
- }
2541
-
2542
- bool running = auto_continue;
2543
-
2544
- // Process requests from the debugger.
2545
- while (true) {
2546
- // Wait for new command in the queue.
2547
- if (Debugger::host_dispatch_handler_) {
2548
- // In case there is a host dispatch - do periodic dispatches.
2549
- if (!command_received_->Wait(host_dispatch_micros_)) {
2550
- // Timout expired, do the dispatch.
2551
- Debugger::host_dispatch_handler_();
2552
- continue;
2553
- }
2554
- } else {
2555
- // In case there is no host dispatch - just wait.
2556
- command_received_->Wait();
2557
- }
2558
-
2559
- // Get the command from the queue.
2560
- CommandMessage command = command_queue_.Get();
2561
- LOGGER->DebugTag("Got request from command queue, in interactive loop.");
2562
- if (!Debugger::IsDebuggerActive()) {
2563
- // Delete command text and user data.
2564
- command.Dispose();
2565
- return;
2566
- }
2567
-
2568
- // Invoke JavaScript to process the debug request.
2569
- v8::Local<v8::String> fun_name;
2570
- v8::Local<v8::Function> fun;
2571
- v8::Local<v8::Value> request;
2572
- v8::TryCatch try_catch;
2573
- fun_name = v8::String::New("processDebugRequest");
2574
- fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
2575
-
2576
- request = v8::String::New(command.text().start(),
2577
- command.text().length());
2578
- static const int kArgc = 1;
2579
- v8::Handle<Value> argv[kArgc] = { request };
2580
- v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
2581
-
2582
- // Get the response.
2583
- v8::Local<v8::String> response;
2584
- if (!try_catch.HasCaught()) {
2585
- // Get response string.
2586
- if (!response_val->IsUndefined()) {
2587
- response = v8::String::Cast(*response_val);
2588
- } else {
2589
- response = v8::String::New("");
2590
- }
2591
-
2592
- // Log the JSON request/response.
2593
- if (FLAG_trace_debug_json) {
2594
- PrintLn(request);
2595
- PrintLn(response);
2596
- }
2597
-
2598
- // Get the running state.
2599
- fun_name = v8::String::New("isRunning");
2600
- fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
2601
- static const int kArgc = 1;
2602
- v8::Handle<Value> argv[kArgc] = { response };
2603
- v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
2604
- if (!try_catch.HasCaught()) {
2605
- running = running_val->ToBoolean()->Value();
2606
- }
2607
- } else {
2608
- // In case of failure the result text is the exception text.
2609
- response = try_catch.Exception()->ToString();
2610
- }
2611
-
2612
- // Return the result.
2613
- MessageImpl message = MessageImpl::NewResponse(
2614
- event,
2615
- running,
2616
- Handle<JSObject>::cast(exec_state),
2617
- Handle<JSObject>::cast(event_data),
2618
- Handle<String>(Utils::OpenHandle(*response)),
2619
- command.client_data());
2620
- InvokeMessageHandler(message);
2621
- command.Dispose();
2622
-
2623
- // Return from debug event processing if either the VM is put into the
2624
- // runnning state (through a continue command) or auto continue is active
2625
- // and there are no more commands queued.
2626
- if (running && !HasCommands()) {
2627
- return;
2628
- }
2629
- }
2630
- }
2631
-
2632
-
2633
- void Debugger::SetEventListener(Handle<Object> callback,
2634
- Handle<Object> data) {
2635
- ASSERT(Isolate::Current() == isolate_);
2636
- HandleScope scope(isolate_);
2637
- GlobalHandles* global_handles = isolate_->global_handles();
2638
-
2639
- // Clear the global handles for the event listener and the event listener data
2640
- // object.
2641
- if (!event_listener_.is_null()) {
2642
- global_handles->Destroy(
2643
- reinterpret_cast<Object**>(event_listener_.location()));
2644
- event_listener_ = Handle<Object>();
2645
- }
2646
- if (!event_listener_data_.is_null()) {
2647
- global_handles->Destroy(
2648
- reinterpret_cast<Object**>(event_listener_data_.location()));
2649
- event_listener_data_ = Handle<Object>();
2650
- }
2651
-
2652
- // If there is a new debug event listener register it together with its data
2653
- // object.
2654
- if (!callback->IsUndefined() && !callback->IsNull()) {
2655
- event_listener_ = Handle<Object>::cast(
2656
- global_handles->Create(*callback));
2657
- if (data.is_null()) {
2658
- data = isolate_->factory()->undefined_value();
2659
- }
2660
- event_listener_data_ = Handle<Object>::cast(
2661
- global_handles->Create(*data));
2662
- }
2663
-
2664
- ListenersChanged();
2665
- }
2666
-
2667
-
2668
- void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
2669
- ASSERT(Isolate::Current() == isolate_);
2670
- ScopedLock with(debugger_access_);
2671
-
2672
- message_handler_ = handler;
2673
- ListenersChanged();
2674
- if (handler == NULL) {
2675
- // Send an empty command to the debugger if in a break to make JavaScript
2676
- // run again if the debugger is closed.
2677
- if (isolate_->debug()->InDebugger()) {
2678
- ProcessCommand(Vector<const uint16_t>::empty());
2679
- }
2680
- }
2681
- }
2682
-
2683
-
2684
- void Debugger::ListenersChanged() {
2685
- ASSERT(Isolate::Current() == isolate_);
2686
- if (IsDebuggerActive()) {
2687
- // Disable the compilation cache when the debugger is active.
2688
- isolate_->compilation_cache()->Disable();
2689
- debugger_unload_pending_ = false;
2690
- } else {
2691
- isolate_->compilation_cache()->Enable();
2692
- // Unload the debugger if event listener and message handler cleared.
2693
- // Schedule this for later, because we may be in non-V8 thread.
2694
- debugger_unload_pending_ = true;
2695
- }
2696
- }
2697
-
2698
-
2699
- void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
2700
- int period) {
2701
- ASSERT(Isolate::Current() == isolate_);
2702
- host_dispatch_handler_ = handler;
2703
- host_dispatch_micros_ = period * 1000;
2704
- }
2705
-
2706
-
2707
- void Debugger::SetDebugMessageDispatchHandler(
2708
- v8::Debug::DebugMessageDispatchHandler handler, bool provide_locker) {
2709
- ASSERT(Isolate::Current() == isolate_);
2710
- ScopedLock with(dispatch_handler_access_);
2711
- debug_message_dispatch_handler_ = handler;
2712
-
2713
- if (provide_locker && message_dispatch_helper_thread_ == NULL) {
2714
- message_dispatch_helper_thread_ = new MessageDispatchHelperThread(isolate_);
2715
- message_dispatch_helper_thread_->Start();
2716
- }
2717
- }
2718
-
2719
-
2720
- // Calls the registered debug message handler. This callback is part of the
2721
- // public API.
2722
- void Debugger::InvokeMessageHandler(MessageImpl message) {
2723
- ASSERT(Isolate::Current() == isolate_);
2724
- ScopedLock with(debugger_access_);
2725
-
2726
- if (message_handler_ != NULL) {
2727
- message_handler_(message);
2728
- }
2729
- }
2730
-
2731
-
2732
- // Puts a command coming from the public API on the queue. Creates
2733
- // a copy of the command string managed by the debugger. Up to this
2734
- // point, the command data was managed by the API client. Called
2735
- // by the API client thread.
2736
- void Debugger::ProcessCommand(Vector<const uint16_t> command,
2737
- v8::Debug::ClientData* client_data) {
2738
- ASSERT(Isolate::Current() == isolate_);
2739
- // Need to cast away const.
2740
- CommandMessage message = CommandMessage::New(
2741
- Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
2742
- command.length()),
2743
- client_data);
2744
- LOGGER->DebugTag("Put command on command_queue.");
2745
- command_queue_.Put(message);
2746
- command_received_->Signal();
2747
-
2748
- // Set the debug command break flag to have the command processed.
2749
- if (!isolate_->debug()->InDebugger()) {
2750
- isolate_->stack_guard()->DebugCommand();
2751
- }
2752
-
2753
- MessageDispatchHelperThread* dispatch_thread;
2754
- {
2755
- ScopedLock with(dispatch_handler_access_);
2756
- dispatch_thread = message_dispatch_helper_thread_;
2757
- }
2758
-
2759
- if (dispatch_thread == NULL) {
2760
- CallMessageDispatchHandler();
2761
- } else {
2762
- dispatch_thread->Schedule();
2763
- }
2764
- }
2765
-
2766
-
2767
- bool Debugger::HasCommands() {
2768
- ASSERT(Isolate::Current() == isolate_);
2769
- return !command_queue_.IsEmpty();
2770
- }
2771
-
2772
-
2773
- void Debugger::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
2774
- ASSERT(Isolate::Current() == isolate_);
2775
- CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
2776
- event_command_queue_.Put(message);
2777
-
2778
- // Set the debug command break flag to have the command processed.
2779
- if (!isolate_->debug()->InDebugger()) {
2780
- isolate_->stack_guard()->DebugCommand();
2781
- }
2782
- }
2783
-
2784
-
2785
- bool Debugger::IsDebuggerActive() {
2786
- ASSERT(Isolate::Current() == isolate_);
2787
- ScopedLock with(debugger_access_);
2788
-
2789
- return message_handler_ != NULL || !event_listener_.is_null();
2790
- }
2791
-
2792
-
2793
- Handle<Object> Debugger::Call(Handle<JSFunction> fun,
2794
- Handle<Object> data,
2795
- bool* pending_exception) {
2796
- ASSERT(Isolate::Current() == isolate_);
2797
- // When calling functions in the debugger prevent it from beeing unloaded.
2798
- Debugger::never_unload_debugger_ = true;
2799
-
2800
- // Enter the debugger.
2801
- EnterDebugger debugger;
2802
- if (debugger.FailedToEnter()) {
2803
- return isolate_->factory()->undefined_value();
2804
- }
2805
-
2806
- // Create the execution state.
2807
- bool caught_exception = false;
2808
- Handle<Object> exec_state = MakeExecutionState(&caught_exception);
2809
- if (caught_exception) {
2810
- return isolate_->factory()->undefined_value();
2811
- }
2812
-
2813
- static const int kArgc = 2;
2814
- Object** argv[kArgc] = { exec_state.location(), data.location() };
2815
- Handle<Object> result = Execution::Call(
2816
- fun,
2817
- Handle<Object>(isolate_->debug()->debug_context_->global_proxy()),
2818
- kArgc,
2819
- argv,
2820
- pending_exception);
2821
- return result;
2822
- }
2823
-
2824
-
2825
- static void StubMessageHandler2(const v8::Debug::Message& message) {
2826
- // Simply ignore message.
2827
- }
2828
-
2829
-
2830
- bool Debugger::StartAgent(const char* name, int port,
2831
- bool wait_for_connection) {
2832
- ASSERT(Isolate::Current() == isolate_);
2833
- if (wait_for_connection) {
2834
- // Suspend V8 if it is already running or set V8 to suspend whenever
2835
- // it starts.
2836
- // Provide stub message handler; V8 auto-continues each suspend
2837
- // when there is no message handler; we doesn't need it.
2838
- // Once become suspended, V8 will stay so indefinitely long, until remote
2839
- // debugger connects and issues "continue" command.
2840
- Debugger::message_handler_ = StubMessageHandler2;
2841
- v8::Debug::DebugBreak();
2842
- }
2843
-
2844
- if (Socket::Setup()) {
2845
- if (agent_ == NULL) {
2846
- agent_ = new DebuggerAgent(isolate_, name, port);
2847
- agent_->Start();
2848
- }
2849
- return true;
2850
- }
2851
-
2852
- return false;
2853
- }
2854
-
2855
-
2856
- void Debugger::StopAgent() {
2857
- ASSERT(Isolate::Current() == isolate_);
2858
- if (agent_ != NULL) {
2859
- agent_->Shutdown();
2860
- agent_->Join();
2861
- delete agent_;
2862
- agent_ = NULL;
2863
- }
2864
- }
2865
-
2866
-
2867
- void Debugger::WaitForAgent() {
2868
- ASSERT(Isolate::Current() == isolate_);
2869
- if (agent_ != NULL)
2870
- agent_->WaitUntilListening();
2871
- }
2872
-
2873
-
2874
- void Debugger::CallMessageDispatchHandler() {
2875
- ASSERT(Isolate::Current() == isolate_);
2876
- v8::Debug::DebugMessageDispatchHandler handler;
2877
- {
2878
- ScopedLock with(dispatch_handler_access_);
2879
- handler = Debugger::debug_message_dispatch_handler_;
2880
- }
2881
- if (handler != NULL) {
2882
- handler();
2883
- }
2884
- }
2885
-
2886
-
2887
- MessageImpl MessageImpl::NewEvent(DebugEvent event,
2888
- bool running,
2889
- Handle<JSObject> exec_state,
2890
- Handle<JSObject> event_data) {
2891
- MessageImpl message(true, event, running,
2892
- exec_state, event_data, Handle<String>(), NULL);
2893
- return message;
2894
- }
2895
-
2896
-
2897
- MessageImpl MessageImpl::NewResponse(DebugEvent event,
2898
- bool running,
2899
- Handle<JSObject> exec_state,
2900
- Handle<JSObject> event_data,
2901
- Handle<String> response_json,
2902
- v8::Debug::ClientData* client_data) {
2903
- MessageImpl message(false, event, running,
2904
- exec_state, event_data, response_json, client_data);
2905
- return message;
2906
- }
2907
-
2908
-
2909
- MessageImpl::MessageImpl(bool is_event,
2910
- DebugEvent event,
2911
- bool running,
2912
- Handle<JSObject> exec_state,
2913
- Handle<JSObject> event_data,
2914
- Handle<String> response_json,
2915
- v8::Debug::ClientData* client_data)
2916
- : is_event_(is_event),
2917
- event_(event),
2918
- running_(running),
2919
- exec_state_(exec_state),
2920
- event_data_(event_data),
2921
- response_json_(response_json),
2922
- client_data_(client_data) {}
2923
-
2924
-
2925
- bool MessageImpl::IsEvent() const {
2926
- return is_event_;
2927
- }
2928
-
2929
-
2930
- bool MessageImpl::IsResponse() const {
2931
- return !is_event_;
2932
- }
2933
-
2934
-
2935
- DebugEvent MessageImpl::GetEvent() const {
2936
- return event_;
2937
- }
2938
-
2939
-
2940
- bool MessageImpl::WillStartRunning() const {
2941
- return running_;
2942
- }
2943
-
2944
-
2945
- v8::Handle<v8::Object> MessageImpl::GetExecutionState() const {
2946
- return v8::Utils::ToLocal(exec_state_);
2947
- }
2948
-
2949
-
2950
- v8::Handle<v8::Object> MessageImpl::GetEventData() const {
2951
- return v8::Utils::ToLocal(event_data_);
2952
- }
2953
-
2954
-
2955
- v8::Handle<v8::String> MessageImpl::GetJSON() const {
2956
- v8::HandleScope scope;
2957
-
2958
- if (IsEvent()) {
2959
- // Call toJSONProtocol on the debug event object.
2960
- Handle<Object> fun = GetProperty(event_data_, "toJSONProtocol");
2961
- if (!fun->IsJSFunction()) {
2962
- return v8::Handle<v8::String>();
2963
- }
2964
- bool caught_exception;
2965
- Handle<Object> json = Execution::TryCall(Handle<JSFunction>::cast(fun),
2966
- event_data_,
2967
- 0, NULL, &caught_exception);
2968
- if (caught_exception || !json->IsString()) {
2969
- return v8::Handle<v8::String>();
2970
- }
2971
- return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json)));
2972
- } else {
2973
- return v8::Utils::ToLocal(response_json_);
2974
- }
2975
- }
2976
-
2977
-
2978
- v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
2979
- Isolate* isolate = Isolate::Current();
2980
- v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
2981
- // Isolate::context() may be NULL when "script collected" event occures.
2982
- ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
2983
- return GetDebugEventContext(isolate);
2984
- }
2985
-
2986
-
2987
- v8::Debug::ClientData* MessageImpl::GetClientData() const {
2988
- return client_data_;
2989
- }
2990
-
2991
-
2992
- EventDetailsImpl::EventDetailsImpl(DebugEvent event,
2993
- Handle<JSObject> exec_state,
2994
- Handle<JSObject> event_data,
2995
- Handle<Object> callback_data,
2996
- v8::Debug::ClientData* client_data)
2997
- : event_(event),
2998
- exec_state_(exec_state),
2999
- event_data_(event_data),
3000
- callback_data_(callback_data),
3001
- client_data_(client_data) {}
3002
-
3003
-
3004
- DebugEvent EventDetailsImpl::GetEvent() const {
3005
- return event_;
3006
- }
3007
-
3008
-
3009
- v8::Handle<v8::Object> EventDetailsImpl::GetExecutionState() const {
3010
- return v8::Utils::ToLocal(exec_state_);
3011
- }
3012
-
3013
-
3014
- v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const {
3015
- return v8::Utils::ToLocal(event_data_);
3016
- }
3017
-
3018
-
3019
- v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const {
3020
- return GetDebugEventContext(Isolate::Current());
3021
- }
3022
-
3023
-
3024
- v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const {
3025
- return v8::Utils::ToLocal(callback_data_);
3026
- }
3027
-
3028
-
3029
- v8::Debug::ClientData* EventDetailsImpl::GetClientData() const {
3030
- return client_data_;
3031
- }
3032
-
3033
-
3034
- CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()),
3035
- client_data_(NULL) {
3036
- }
3037
-
3038
-
3039
- CommandMessage::CommandMessage(const Vector<uint16_t>& text,
3040
- v8::Debug::ClientData* data)
3041
- : text_(text),
3042
- client_data_(data) {
3043
- }
3044
-
3045
-
3046
- CommandMessage::~CommandMessage() {
3047
- }
3048
-
3049
-
3050
- void CommandMessage::Dispose() {
3051
- text_.Dispose();
3052
- delete client_data_;
3053
- client_data_ = NULL;
3054
- }
3055
-
3056
-
3057
- CommandMessage CommandMessage::New(const Vector<uint16_t>& command,
3058
- v8::Debug::ClientData* data) {
3059
- return CommandMessage(command.Clone(), data);
3060
- }
3061
-
3062
-
3063
- CommandMessageQueue::CommandMessageQueue(int size) : start_(0), end_(0),
3064
- size_(size) {
3065
- messages_ = NewArray<CommandMessage>(size);
3066
- }
3067
-
3068
-
3069
- CommandMessageQueue::~CommandMessageQueue() {
3070
- while (!IsEmpty()) {
3071
- CommandMessage m = Get();
3072
- m.Dispose();
3073
- }
3074
- DeleteArray(messages_);
3075
- }
3076
-
3077
-
3078
- CommandMessage CommandMessageQueue::Get() {
3079
- ASSERT(!IsEmpty());
3080
- int result = start_;
3081
- start_ = (start_ + 1) % size_;
3082
- return messages_[result];
3083
- }
3084
-
3085
-
3086
- void CommandMessageQueue::Put(const CommandMessage& message) {
3087
- if ((end_ + 1) % size_ == start_) {
3088
- Expand();
3089
- }
3090
- messages_[end_] = message;
3091
- end_ = (end_ + 1) % size_;
3092
- }
3093
-
3094
-
3095
- void CommandMessageQueue::Expand() {
3096
- CommandMessageQueue new_queue(size_ * 2);
3097
- while (!IsEmpty()) {
3098
- new_queue.Put(Get());
3099
- }
3100
- CommandMessage* array_to_free = messages_;
3101
- *this = new_queue;
3102
- new_queue.messages_ = array_to_free;
3103
- // Make the new_queue empty so that it doesn't call Dispose on any messages.
3104
- new_queue.start_ = new_queue.end_;
3105
- // Automatic destructor called on new_queue, freeing array_to_free.
3106
- }
3107
-
3108
-
3109
- LockingCommandMessageQueue::LockingCommandMessageQueue(int size)
3110
- : queue_(size) {
3111
- lock_ = OS::CreateMutex();
3112
- }
3113
-
3114
-
3115
- LockingCommandMessageQueue::~LockingCommandMessageQueue() {
3116
- delete lock_;
3117
- }
3118
-
3119
-
3120
- bool LockingCommandMessageQueue::IsEmpty() const {
3121
- ScopedLock sl(lock_);
3122
- return queue_.IsEmpty();
3123
- }
3124
-
3125
-
3126
- CommandMessage LockingCommandMessageQueue::Get() {
3127
- ScopedLock sl(lock_);
3128
- CommandMessage result = queue_.Get();
3129
- LOGGER->DebugEvent("Get", result.text());
3130
- return result;
3131
- }
3132
-
3133
-
3134
- void LockingCommandMessageQueue::Put(const CommandMessage& message) {
3135
- ScopedLock sl(lock_);
3136
- queue_.Put(message);
3137
- LOGGER->DebugEvent("Put", message.text());
3138
- }
3139
-
3140
-
3141
- void LockingCommandMessageQueue::Clear() {
3142
- ScopedLock sl(lock_);
3143
- queue_.Clear();
3144
- }
3145
-
3146
-
3147
- MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
3148
- : Thread(isolate, "v8:MsgDispHelpr"),
3149
- sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
3150
- already_signalled_(false) {
3151
- }
3152
-
3153
-
3154
- MessageDispatchHelperThread::~MessageDispatchHelperThread() {
3155
- delete mutex_;
3156
- delete sem_;
3157
- }
3158
-
3159
-
3160
- void MessageDispatchHelperThread::Schedule() {
3161
- {
3162
- ScopedLock lock(mutex_);
3163
- if (already_signalled_) {
3164
- return;
3165
- }
3166
- already_signalled_ = true;
3167
- }
3168
- sem_->Signal();
3169
- }
3170
-
3171
-
3172
- void MessageDispatchHelperThread::Run() {
3173
- while (true) {
3174
- sem_->Wait();
3175
- {
3176
- ScopedLock lock(mutex_);
3177
- already_signalled_ = false;
3178
- }
3179
- {
3180
- Locker locker;
3181
- Isolate::Current()->debugger()->CallMessageDispatchHandler();
3182
- }
3183
- }
3184
- }
3185
-
3186
- #endif // ENABLE_DEBUGGER_SUPPORT
3187
-
3188
- } } // namespace v8::internal