therubyracer 0.5.0-x86-linux → 0.11.0beta5-x86-linux

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