therubyracer 0.4.6 → 0.4.7

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 (1148) hide show
  1. data/Manifest.txt +1138 -0
  2. data/README.rdoc +7 -5
  3. data/Rakefile +12 -2
  4. data/ext/v8/Makefile +169 -0
  5. data/ext/v8/extconf.rb +20 -3
  6. data/ext/v8/upstream/2.0.6/.sconsign.dblite +0 -0
  7. data/ext/v8/upstream/2.0.6/AUTHORS +23 -0
  8. data/ext/v8/upstream/2.0.6/ChangeLog +1479 -0
  9. data/ext/v8/upstream/2.0.6/LICENSE +55 -0
  10. data/ext/v8/upstream/2.0.6/SConstruct +1028 -0
  11. data/ext/v8/upstream/2.0.6/benchmarks/README.txt +63 -0
  12. data/ext/v8/upstream/2.0.6/benchmarks/base.js +264 -0
  13. data/ext/v8/upstream/2.0.6/benchmarks/crypto.js +1698 -0
  14. data/ext/v8/upstream/2.0.6/benchmarks/deltablue.js +880 -0
  15. data/ext/v8/upstream/2.0.6/benchmarks/earley-boyer.js +4684 -0
  16. data/ext/v8/upstream/2.0.6/benchmarks/raytrace.js +935 -0
  17. data/ext/v8/upstream/2.0.6/benchmarks/regexp.js +1614 -0
  18. data/ext/v8/upstream/2.0.6/benchmarks/revisions.html +86 -0
  19. data/ext/v8/upstream/2.0.6/benchmarks/richards.js +539 -0
  20. data/ext/v8/upstream/2.0.6/benchmarks/run.html +141 -0
  21. data/ext/v8/upstream/2.0.6/benchmarks/run.js +61 -0
  22. data/ext/v8/upstream/2.0.6/benchmarks/splay.js +378 -0
  23. data/ext/v8/upstream/2.0.6/benchmarks/style.css +77 -0
  24. data/ext/v8/upstream/2.0.6/benchmarks/v8-logo.png +0 -0
  25. data/ext/v8/upstream/2.0.6/include/v8-debug.h +275 -0
  26. data/ext/v8/upstream/2.0.6/include/v8.h +3236 -0
  27. data/ext/v8/upstream/2.0.6/samples/SConscript +38 -0
  28. data/ext/v8/upstream/2.0.6/samples/count-hosts.js +42 -0
  29. data/ext/v8/upstream/2.0.6/samples/process.cc +622 -0
  30. data/ext/v8/upstream/2.0.6/samples/shell.cc +303 -0
  31. data/ext/v8/upstream/2.0.6/src/SConscript +283 -0
  32. data/ext/v8/upstream/2.0.6/src/accessors.cc +695 -0
  33. data/ext/v8/upstream/2.0.6/src/accessors.h +114 -0
  34. data/ext/v8/upstream/2.0.6/src/allocation.cc +198 -0
  35. data/ext/v8/upstream/2.0.6/src/allocation.h +169 -0
  36. data/ext/v8/upstream/2.0.6/src/api.cc +3831 -0
  37. data/ext/v8/upstream/2.0.6/src/api.h +479 -0
  38. data/ext/v8/upstream/2.0.6/src/apinatives.js +110 -0
  39. data/ext/v8/upstream/2.0.6/src/apiutils.h +69 -0
  40. data/ext/v8/upstream/2.0.6/src/arguments.h +97 -0
  41. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm-inl.h +277 -0
  42. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.cc +1821 -0
  43. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.h +1027 -0
  44. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2-inl.h +267 -0
  45. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.cc +1821 -0
  46. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.h +1027 -0
  47. data/ext/v8/upstream/2.0.6/src/arm/builtins-arm.cc +1271 -0
  48. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm-inl.h +74 -0
  49. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.cc +6682 -0
  50. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.h +535 -0
  51. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.cc +112 -0
  52. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.h +347 -0
  53. data/ext/v8/upstream/2.0.6/src/arm/cpu-arm.cc +132 -0
  54. data/ext/v8/upstream/2.0.6/src/arm/debug-arm.cc +213 -0
  55. data/ext/v8/upstream/2.0.6/src/arm/disasm-arm.cc +1166 -0
  56. data/ext/v8/upstream/2.0.6/src/arm/fast-codegen-arm.cc +1698 -0
  57. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.cc +123 -0
  58. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.h +162 -0
  59. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +849 -0
  60. data/ext/v8/upstream/2.0.6/src/arm/jump-target-arm.cc +238 -0
  61. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.cc +1259 -0
  62. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.h +423 -0
  63. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.cc +1266 -0
  64. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.h +282 -0
  65. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm-inl.h +103 -0
  66. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.cc +59 -0
  67. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.h +43 -0
  68. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.cc +2264 -0
  69. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.h +306 -0
  70. data/ext/v8/upstream/2.0.6/src/arm/stub-cache-arm.cc +1516 -0
  71. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +412 -0
  72. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.h +532 -0
  73. data/ext/v8/upstream/2.0.6/src/array.js +1154 -0
  74. data/ext/v8/upstream/2.0.6/src/assembler.cc +772 -0
  75. data/ext/v8/upstream/2.0.6/src/assembler.h +525 -0
  76. data/ext/v8/upstream/2.0.6/src/ast.cc +512 -0
  77. data/ext/v8/upstream/2.0.6/src/ast.h +1820 -0
  78. data/ext/v8/upstream/2.0.6/src/bootstrapper.cc +1680 -0
  79. data/ext/v8/upstream/2.0.6/src/bootstrapper.h +103 -0
  80. data/ext/v8/upstream/2.0.6/src/builtins.cc +851 -0
  81. data/ext/v8/upstream/2.0.6/src/builtins.h +245 -0
  82. data/ext/v8/upstream/2.0.6/src/bytecodes-irregexp.h +104 -0
  83. data/ext/v8/upstream/2.0.6/src/char-predicates-inl.h +86 -0
  84. data/ext/v8/upstream/2.0.6/src/char-predicates.h +65 -0
  85. data/ext/v8/upstream/2.0.6/src/checks.cc +100 -0
  86. data/ext/v8/upstream/2.0.6/src/checks.h +284 -0
  87. data/ext/v8/upstream/2.0.6/src/code-stubs.cc +164 -0
  88. data/ext/v8/upstream/2.0.6/src/code-stubs.h +164 -0
  89. data/ext/v8/upstream/2.0.6/src/code.h +68 -0
  90. data/ext/v8/upstream/2.0.6/src/codegen-inl.h +88 -0
  91. data/ext/v8/upstream/2.0.6/src/codegen.cc +504 -0
  92. data/ext/v8/upstream/2.0.6/src/codegen.h +522 -0
  93. data/ext/v8/upstream/2.0.6/src/compilation-cache.cc +490 -0
  94. data/ext/v8/upstream/2.0.6/src/compilation-cache.h +98 -0
  95. data/ext/v8/upstream/2.0.6/src/compiler.cc +1132 -0
  96. data/ext/v8/upstream/2.0.6/src/compiler.h +107 -0
  97. data/ext/v8/upstream/2.0.6/src/contexts.cc +256 -0
  98. data/ext/v8/upstream/2.0.6/src/contexts.h +345 -0
  99. data/ext/v8/upstream/2.0.6/src/conversions-inl.h +95 -0
  100. data/ext/v8/upstream/2.0.6/src/conversions.cc +709 -0
  101. data/ext/v8/upstream/2.0.6/src/conversions.h +118 -0
  102. data/ext/v8/upstream/2.0.6/src/counters.cc +78 -0
  103. data/ext/v8/upstream/2.0.6/src/counters.h +239 -0
  104. data/ext/v8/upstream/2.0.6/src/cpu.h +65 -0
  105. data/ext/v8/upstream/2.0.6/src/d8-debug.cc +345 -0
  106. data/ext/v8/upstream/2.0.6/src/d8-debug.h +155 -0
  107. data/ext/v8/upstream/2.0.6/src/d8-posix.cc +675 -0
  108. data/ext/v8/upstream/2.0.6/src/d8-readline.cc +128 -0
  109. data/ext/v8/upstream/2.0.6/src/d8-windows.cc +42 -0
  110. data/ext/v8/upstream/2.0.6/src/d8.cc +776 -0
  111. data/ext/v8/upstream/2.0.6/src/d8.h +225 -0
  112. data/ext/v8/upstream/2.0.6/src/d8.js +1625 -0
  113. data/ext/v8/upstream/2.0.6/src/date-delay.js +1138 -0
  114. data/ext/v8/upstream/2.0.6/src/dateparser-inl.h +114 -0
  115. data/ext/v8/upstream/2.0.6/src/dateparser.cc +186 -0
  116. data/ext/v8/upstream/2.0.6/src/dateparser.h +240 -0
  117. data/ext/v8/upstream/2.0.6/src/debug-agent.cc +425 -0
  118. data/ext/v8/upstream/2.0.6/src/debug-agent.h +129 -0
  119. data/ext/v8/upstream/2.0.6/src/debug-delay.js +2073 -0
  120. data/ext/v8/upstream/2.0.6/src/debug.cc +2751 -0
  121. data/ext/v8/upstream/2.0.6/src/debug.h +866 -0
  122. data/ext/v8/upstream/2.0.6/src/disasm.h +77 -0
  123. data/ext/v8/upstream/2.0.6/src/disassembler.cc +318 -0
  124. data/ext/v8/upstream/2.0.6/src/disassembler.h +56 -0
  125. data/ext/v8/upstream/2.0.6/src/dtoa-config.c +91 -0
  126. data/ext/v8/upstream/2.0.6/src/execution.cc +701 -0
  127. data/ext/v8/upstream/2.0.6/src/execution.h +312 -0
  128. data/ext/v8/upstream/2.0.6/src/factory.cc +957 -0
  129. data/ext/v8/upstream/2.0.6/src/factory.h +393 -0
  130. data/ext/v8/upstream/2.0.6/src/fast-codegen.cc +725 -0
  131. data/ext/v8/upstream/2.0.6/src/fast-codegen.h +371 -0
  132. data/ext/v8/upstream/2.0.6/src/flag-definitions.h +426 -0
  133. data/ext/v8/upstream/2.0.6/src/flags.cc +555 -0
  134. data/ext/v8/upstream/2.0.6/src/flags.h +81 -0
  135. data/ext/v8/upstream/2.0.6/src/frame-element.cc +45 -0
  136. data/ext/v8/upstream/2.0.6/src/frame-element.h +235 -0
  137. data/ext/v8/upstream/2.0.6/src/frames-inl.h +215 -0
  138. data/ext/v8/upstream/2.0.6/src/frames.cc +749 -0
  139. data/ext/v8/upstream/2.0.6/src/frames.h +659 -0
  140. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.cc +76 -0
  141. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.h +135 -0
  142. data/ext/v8/upstream/2.0.6/src/global-handles.cc +516 -0
  143. data/ext/v8/upstream/2.0.6/src/global-handles.h +180 -0
  144. data/ext/v8/upstream/2.0.6/src/globals.h +608 -0
  145. data/ext/v8/upstream/2.0.6/src/handles-inl.h +76 -0
  146. data/ext/v8/upstream/2.0.6/src/handles.cc +811 -0
  147. data/ext/v8/upstream/2.0.6/src/handles.h +367 -0
  148. data/ext/v8/upstream/2.0.6/src/hashmap.cc +226 -0
  149. data/ext/v8/upstream/2.0.6/src/hashmap.h +120 -0
  150. data/ext/v8/upstream/2.0.6/src/heap-inl.h +407 -0
  151. data/ext/v8/upstream/2.0.6/src/heap-profiler.cc +695 -0
  152. data/ext/v8/upstream/2.0.6/src/heap-profiler.h +277 -0
  153. data/ext/v8/upstream/2.0.6/src/heap.cc +4204 -0
  154. data/ext/v8/upstream/2.0.6/src/heap.h +1704 -0
  155. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32-inl.h +325 -0
  156. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.cc +2375 -0
  157. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.h +914 -0
  158. data/ext/v8/upstream/2.0.6/src/ia32/builtins-ia32.cc +1222 -0
  159. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32-inl.h +46 -0
  160. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.cc +9770 -0
  161. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.h +834 -0
  162. data/ext/v8/upstream/2.0.6/src/ia32/cpu-ia32.cc +79 -0
  163. data/ext/v8/upstream/2.0.6/src/ia32/debug-ia32.cc +208 -0
  164. data/ext/v8/upstream/2.0.6/src/ia32/disasm-ia32.cc +1357 -0
  165. data/ext/v8/upstream/2.0.6/src/ia32/fast-codegen-ia32.cc +1813 -0
  166. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.cc +111 -0
  167. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.h +135 -0
  168. data/ext/v8/upstream/2.0.6/src/ia32/ic-ia32.cc +1490 -0
  169. data/ext/v8/upstream/2.0.6/src/ia32/jump-target-ia32.cc +432 -0
  170. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.cc +1517 -0
  171. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.h +528 -0
  172. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.cc +1219 -0
  173. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.h +230 -0
  174. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32-inl.h +82 -0
  175. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.cc +99 -0
  176. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.h +43 -0
  177. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.cc +30 -0
  178. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.h +62 -0
  179. data/ext/v8/upstream/2.0.6/src/ia32/stub-cache-ia32.cc +1961 -0
  180. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.cc +1105 -0
  181. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.h +580 -0
  182. data/ext/v8/upstream/2.0.6/src/ic-inl.h +93 -0
  183. data/ext/v8/upstream/2.0.6/src/ic.cc +1426 -0
  184. data/ext/v8/upstream/2.0.6/src/ic.h +443 -0
  185. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.cc +646 -0
  186. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.h +48 -0
  187. data/ext/v8/upstream/2.0.6/src/json-delay.js +254 -0
  188. data/ext/v8/upstream/2.0.6/src/jsregexp.cc +5234 -0
  189. data/ext/v8/upstream/2.0.6/src/jsregexp.h +1439 -0
  190. data/ext/v8/upstream/2.0.6/src/jump-target-inl.h +49 -0
  191. data/ext/v8/upstream/2.0.6/src/jump-target.cc +383 -0
  192. data/ext/v8/upstream/2.0.6/src/jump-target.h +280 -0
  193. data/ext/v8/upstream/2.0.6/src/list-inl.h +166 -0
  194. data/ext/v8/upstream/2.0.6/src/list.h +158 -0
  195. data/ext/v8/upstream/2.0.6/src/log-inl.h +126 -0
  196. data/ext/v8/upstream/2.0.6/src/log-utils.cc +503 -0
  197. data/ext/v8/upstream/2.0.6/src/log-utils.h +292 -0
  198. data/ext/v8/upstream/2.0.6/src/log.cc +1457 -0
  199. data/ext/v8/upstream/2.0.6/src/log.h +371 -0
  200. data/ext/v8/upstream/2.0.6/src/macro-assembler.h +93 -0
  201. data/ext/v8/upstream/2.0.6/src/macros.py +137 -0
  202. data/ext/v8/upstream/2.0.6/src/mark-compact.cc +2007 -0
  203. data/ext/v8/upstream/2.0.6/src/mark-compact.h +442 -0
  204. data/ext/v8/upstream/2.0.6/src/math.js +263 -0
  205. data/ext/v8/upstream/2.0.6/src/memory.h +74 -0
  206. data/ext/v8/upstream/2.0.6/src/messages.cc +177 -0
  207. data/ext/v8/upstream/2.0.6/src/messages.h +112 -0
  208. data/ext/v8/upstream/2.0.6/src/messages.js +937 -0
  209. data/ext/v8/upstream/2.0.6/src/mirror-delay.js +2332 -0
  210. data/ext/v8/upstream/2.0.6/src/mksnapshot.cc +169 -0
  211. data/ext/v8/upstream/2.0.6/src/natives.h +63 -0
  212. data/ext/v8/upstream/2.0.6/src/objects-debug.cc +1317 -0
  213. data/ext/v8/upstream/2.0.6/src/objects-inl.h +3044 -0
  214. data/ext/v8/upstream/2.0.6/src/objects.cc +8306 -0
  215. data/ext/v8/upstream/2.0.6/src/objects.h +4960 -0
  216. data/ext/v8/upstream/2.0.6/src/oprofile-agent.cc +116 -0
  217. data/ext/v8/upstream/2.0.6/src/oprofile-agent.h +69 -0
  218. data/ext/v8/upstream/2.0.6/src/parser.cc +4810 -0
  219. data/ext/v8/upstream/2.0.6/src/parser.h +195 -0
  220. data/ext/v8/upstream/2.0.6/src/platform-freebsd.cc +645 -0
  221. data/ext/v8/upstream/2.0.6/src/platform-linux.cc +808 -0
  222. data/ext/v8/upstream/2.0.6/src/platform-macos.cc +643 -0
  223. data/ext/v8/upstream/2.0.6/src/platform-nullos.cc +454 -0
  224. data/ext/v8/upstream/2.0.6/src/platform-openbsd.cc +597 -0
  225. data/ext/v8/upstream/2.0.6/src/platform-posix.cc +380 -0
  226. data/ext/v8/upstream/2.0.6/src/platform-win32.cc +1908 -0
  227. data/ext/v8/upstream/2.0.6/src/platform.h +556 -0
  228. data/ext/v8/upstream/2.0.6/src/prettyprinter.cc +1511 -0
  229. data/ext/v8/upstream/2.0.6/src/prettyprinter.h +219 -0
  230. data/ext/v8/upstream/2.0.6/src/property.cc +96 -0
  231. data/ext/v8/upstream/2.0.6/src/property.h +327 -0
  232. data/ext/v8/upstream/2.0.6/src/regexp-delay.js +406 -0
  233. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  234. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.cc +464 -0
  235. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.h +141 -0
  236. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.cc +356 -0
  237. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.h +103 -0
  238. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.cc +240 -0
  239. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.h +220 -0
  240. data/ext/v8/upstream/2.0.6/src/regexp-stack.cc +103 -0
  241. data/ext/v8/upstream/2.0.6/src/regexp-stack.h +123 -0
  242. data/ext/v8/upstream/2.0.6/src/register-allocator-inl.h +74 -0
  243. data/ext/v8/upstream/2.0.6/src/register-allocator.cc +100 -0
  244. data/ext/v8/upstream/2.0.6/src/register-allocator.h +295 -0
  245. data/ext/v8/upstream/2.0.6/src/rewriter.cc +855 -0
  246. data/ext/v8/upstream/2.0.6/src/rewriter.h +54 -0
  247. data/ext/v8/upstream/2.0.6/src/runtime.cc +8163 -0
  248. data/ext/v8/upstream/2.0.6/src/runtime.h +432 -0
  249. data/ext/v8/upstream/2.0.6/src/runtime.js +626 -0
  250. data/ext/v8/upstream/2.0.6/src/scanner.cc +1098 -0
  251. data/ext/v8/upstream/2.0.6/src/scanner.h +425 -0
  252. data/ext/v8/upstream/2.0.6/src/scopeinfo.cc +649 -0
  253. data/ext/v8/upstream/2.0.6/src/scopeinfo.h +236 -0
  254. data/ext/v8/upstream/2.0.6/src/scopes.cc +963 -0
  255. data/ext/v8/upstream/2.0.6/src/scopes.h +401 -0
  256. data/ext/v8/upstream/2.0.6/src/serialize.cc +1260 -0
  257. data/ext/v8/upstream/2.0.6/src/serialize.h +404 -0
  258. data/ext/v8/upstream/2.0.6/src/shell.h +55 -0
  259. data/ext/v8/upstream/2.0.6/src/simulator.h +41 -0
  260. data/ext/v8/upstream/2.0.6/src/smart-pointer.h +109 -0
  261. data/ext/v8/upstream/2.0.6/src/snapshot-common.cc +97 -0
  262. data/ext/v8/upstream/2.0.6/src/snapshot-empty.cc +40 -0
  263. data/ext/v8/upstream/2.0.6/src/snapshot.h +59 -0
  264. data/ext/v8/upstream/2.0.6/src/spaces-inl.h +372 -0
  265. data/ext/v8/upstream/2.0.6/src/spaces.cc +2864 -0
  266. data/ext/v8/upstream/2.0.6/src/spaces.h +2072 -0
  267. data/ext/v8/upstream/2.0.6/src/string-stream.cc +584 -0
  268. data/ext/v8/upstream/2.0.6/src/string-stream.h +189 -0
  269. data/ext/v8/upstream/2.0.6/src/string.js +901 -0
  270. data/ext/v8/upstream/2.0.6/src/stub-cache.cc +1108 -0
  271. data/ext/v8/upstream/2.0.6/src/stub-cache.h +578 -0
  272. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/COPYING +15 -0
  273. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/dtoa.c +3330 -0
  274. data/ext/v8/upstream/2.0.6/src/third_party/valgrind/valgrind.h +3925 -0
  275. data/ext/v8/upstream/2.0.6/src/token.cc +56 -0
  276. data/ext/v8/upstream/2.0.6/src/token.h +270 -0
  277. data/ext/v8/upstream/2.0.6/src/top.cc +991 -0
  278. data/ext/v8/upstream/2.0.6/src/top.h +459 -0
  279. data/ext/v8/upstream/2.0.6/src/unicode-inl.h +238 -0
  280. data/ext/v8/upstream/2.0.6/src/unicode.cc +749 -0
  281. data/ext/v8/upstream/2.0.6/src/unicode.h +279 -0
  282. data/ext/v8/upstream/2.0.6/src/uri.js +415 -0
  283. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +426 -0
  284. data/ext/v8/upstream/2.0.6/src/usage-analyzer.h +40 -0
  285. data/ext/v8/upstream/2.0.6/src/utils.cc +322 -0
  286. data/ext/v8/upstream/2.0.6/src/utils.h +592 -0
  287. data/ext/v8/upstream/2.0.6/src/v8-counters.cc +55 -0
  288. data/ext/v8/upstream/2.0.6/src/v8-counters.h +198 -0
  289. data/ext/v8/upstream/2.0.6/src/v8.cc +193 -0
  290. data/ext/v8/upstream/2.0.6/src/v8.h +119 -0
  291. data/ext/v8/upstream/2.0.6/src/v8natives.js +846 -0
  292. data/ext/v8/upstream/2.0.6/src/v8threads.cc +450 -0
  293. data/ext/v8/upstream/2.0.6/src/v8threads.h +144 -0
  294. data/ext/v8/upstream/2.0.6/src/variables.cc +163 -0
  295. data/ext/v8/upstream/2.0.6/src/variables.h +235 -0
  296. data/ext/v8/upstream/2.0.6/src/version.cc +88 -0
  297. data/ext/v8/upstream/2.0.6/src/version.h +64 -0
  298. data/ext/v8/upstream/2.0.6/src/virtual-frame.cc +381 -0
  299. data/ext/v8/upstream/2.0.6/src/virtual-frame.h +44 -0
  300. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64-inl.h +352 -0
  301. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.cc +2539 -0
  302. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.h +1399 -0
  303. data/ext/v8/upstream/2.0.6/src/x64/builtins-x64.cc +1255 -0
  304. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64-inl.h +46 -0
  305. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.cc +8223 -0
  306. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.h +785 -0
  307. data/ext/v8/upstream/2.0.6/src/x64/cpu-x64.cc +79 -0
  308. data/ext/v8/upstream/2.0.6/src/x64/debug-x64.cc +202 -0
  309. data/ext/v8/upstream/2.0.6/src/x64/disasm-x64.cc +1596 -0
  310. data/ext/v8/upstream/2.0.6/src/x64/fast-codegen-x64.cc +1820 -0
  311. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.cc +109 -0
  312. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.h +121 -0
  313. data/ext/v8/upstream/2.0.6/src/x64/ic-x64.cc +1392 -0
  314. data/ext/v8/upstream/2.0.6/src/x64/jump-target-x64.cc +432 -0
  315. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.cc +2409 -0
  316. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.h +765 -0
  317. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.cc +1337 -0
  318. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.h +295 -0
  319. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64-inl.h +86 -0
  320. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.cc +84 -0
  321. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.h +43 -0
  322. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.cc +27 -0
  323. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.h +63 -0
  324. data/ext/v8/upstream/2.0.6/src/x64/stub-cache-x64.cc +1884 -0
  325. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.cc +1089 -0
  326. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.h +560 -0
  327. data/ext/v8/upstream/2.0.6/src/zone-inl.h +297 -0
  328. data/ext/v8/upstream/2.0.6/src/zone.cc +193 -0
  329. data/ext/v8/upstream/2.0.6/src/zone.h +305 -0
  330. data/ext/v8/upstream/2.0.6/test/cctest/SConscript +95 -0
  331. data/ext/v8/upstream/2.0.6/test/cctest/cctest.cc +126 -0
  332. data/ext/v8/upstream/2.0.6/test/cctest/cctest.h +211 -0
  333. data/ext/v8/upstream/2.0.6/test/cctest/cctest.status +54 -0
  334. data/ext/v8/upstream/2.0.6/test/cctest/test-accessors.cc +450 -0
  335. data/ext/v8/upstream/2.0.6/test/cctest/test-alloc.cc +215 -0
  336. data/ext/v8/upstream/2.0.6/test/cctest/test-api.cc +8699 -0
  337. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-arm.cc +227 -0
  338. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-ia32.cc +395 -0
  339. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-x64.cc +292 -0
  340. data/ext/v8/upstream/2.0.6/test/cctest/test-ast.cc +97 -0
  341. data/ext/v8/upstream/2.0.6/test/cctest/test-compiler.cc +318 -0
  342. data/ext/v8/upstream/2.0.6/test/cctest/test-conversions.cc +130 -0
  343. data/ext/v8/upstream/2.0.6/test/cctest/test-debug.cc +5788 -0
  344. data/ext/v8/upstream/2.0.6/test/cctest/test-decls.cc +593 -0
  345. data/ext/v8/upstream/2.0.6/test/cctest/test-disasm-arm.cc +281 -0
  346. data/ext/v8/upstream/2.0.6/test/cctest/test-disasm-ia32.cc +418 -0
  347. data/ext/v8/upstream/2.0.6/test/cctest/test-flags.cc +234 -0
  348. data/ext/v8/upstream/2.0.6/test/cctest/test-func-name-inference.cc +267 -0
  349. data/ext/v8/upstream/2.0.6/test/cctest/test-hashmap.cc +176 -0
  350. data/ext/v8/upstream/2.0.6/test/cctest/test-heap-profiler.cc +396 -0
  351. data/ext/v8/upstream/2.0.6/test/cctest/test-heap.cc +796 -0
  352. data/ext/v8/upstream/2.0.6/test/cctest/test-list.cc +101 -0
  353. data/ext/v8/upstream/2.0.6/test/cctest/test-lock.cc +63 -0
  354. data/ext/v8/upstream/2.0.6/test/cctest/test-log-stack-tracer.cc +372 -0
  355. data/ext/v8/upstream/2.0.6/test/cctest/test-log-utils.cc +310 -0
  356. data/ext/v8/upstream/2.0.6/test/cctest/test-log.cc +1081 -0
  357. data/ext/v8/upstream/2.0.6/test/cctest/test-macro-assembler-x64.cc +2104 -0
  358. data/ext/v8/upstream/2.0.6/test/cctest/test-mark-compact.cc +341 -0
  359. data/ext/v8/upstream/2.0.6/test/cctest/test-parsing.cc +129 -0
  360. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-linux.cc +80 -0
  361. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-macos.cc +10 -0
  362. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-nullos.cc +80 -0
  363. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-win32.cc +26 -0
  364. data/ext/v8/upstream/2.0.6/test/cctest/test-regexp.cc +1815 -0
  365. data/ext/v8/upstream/2.0.6/test/cctest/test-serialize.cc +438 -0
  366. data/ext/v8/upstream/2.0.6/test/cctest/test-sockets.cc +162 -0
  367. data/ext/v8/upstream/2.0.6/test/cctest/test-spaces.cc +248 -0
  368. data/ext/v8/upstream/2.0.6/test/cctest/test-strings.cc +432 -0
  369. data/ext/v8/upstream/2.0.6/test/cctest/test-thread-termination.cc +290 -0
  370. data/ext/v8/upstream/2.0.6/test/cctest/test-threads.cc +52 -0
  371. data/ext/v8/upstream/2.0.6/test/cctest/test-utils.cc +186 -0
  372. data/ext/v8/upstream/2.0.6/test/cctest/test-version.cc +89 -0
  373. data/ext/v8/upstream/2.0.6/test/cctest/testcfg.py +108 -0
  374. data/ext/v8/upstream/2.0.6/test/es5conform/README +14 -0
  375. data/ext/v8/upstream/2.0.6/test/es5conform/es5conform.status +226 -0
  376. data/ext/v8/upstream/2.0.6/test/es5conform/harness-adapt.js +74 -0
  377. data/ext/v8/upstream/2.0.6/test/es5conform/testcfg.py +108 -0
  378. data/ext/v8/upstream/2.0.6/test/message/message.status +31 -0
  379. data/ext/v8/upstream/2.0.6/test/message/overwritten-builtins.js +31 -0
  380. data/ext/v8/upstream/2.0.6/test/message/overwritten-builtins.out +30 -0
  381. data/ext/v8/upstream/2.0.6/test/message/regress/regress-73.js +33 -0
  382. data/ext/v8/upstream/2.0.6/test/message/regress/regress-73.out +30 -0
  383. data/ext/v8/upstream/2.0.6/test/message/regress/regress-75.js +32 -0
  384. data/ext/v8/upstream/2.0.6/test/message/regress/regress-75.out +30 -0
  385. data/ext/v8/upstream/2.0.6/test/message/simple-throw.js +28 -0
  386. data/ext/v8/upstream/2.0.6/test/message/simple-throw.out +30 -0
  387. data/ext/v8/upstream/2.0.6/test/message/testcfg.py +135 -0
  388. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-no-message.js +51 -0
  389. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-no-message.out +26 -0
  390. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-return-in-finally.js +39 -0
  391. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-return-in-finally.out +28 -0
  392. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch-and-finally.js +34 -0
  393. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch-and-finally.out +30 -0
  394. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch.js +34 -0
  395. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch.out +30 -0
  396. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-finally.js +34 -0
  397. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-finally.out +30 -0
  398. data/ext/v8/upstream/2.0.6/test/message/try-finally-return-in-finally.js +37 -0
  399. data/ext/v8/upstream/2.0.6/test/message/try-finally-return-in-finally.out +28 -0
  400. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-finally.js +32 -0
  401. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-finally.out +30 -0
  402. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try-and-finally.js +32 -0
  403. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try-and-finally.out +30 -0
  404. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try.js +32 -0
  405. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try.out +30 -0
  406. data/ext/v8/upstream/2.0.6/test/mjsunit/api-call-after-bypassed-exception.js +39 -0
  407. data/ext/v8/upstream/2.0.6/test/mjsunit/apply.js +196 -0
  408. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-apply.js +134 -0
  409. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-call-apply.js +41 -0
  410. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-enum.js +52 -0
  411. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-indirect.js +47 -0
  412. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-lazy.js +47 -0
  413. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-opt.js +130 -0
  414. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-read-and-assignment.js +164 -0
  415. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments.js +97 -0
  416. data/ext/v8/upstream/2.0.6/test/mjsunit/array-concat.js +120 -0
  417. data/ext/v8/upstream/2.0.6/test/mjsunit/array-constructor.js +119 -0
  418. data/ext/v8/upstream/2.0.6/test/mjsunit/array-functions-prototype.js +159 -0
  419. data/ext/v8/upstream/2.0.6/test/mjsunit/array-indexing.js +66 -0
  420. data/ext/v8/upstream/2.0.6/test/mjsunit/array-iteration.js +228 -0
  421. data/ext/v8/upstream/2.0.6/test/mjsunit/array-join.js +45 -0
  422. data/ext/v8/upstream/2.0.6/test/mjsunit/array-length-number-conversion.js +53 -0
  423. data/ext/v8/upstream/2.0.6/test/mjsunit/array-length.js +111 -0
  424. data/ext/v8/upstream/2.0.6/test/mjsunit/array-reduce.js +514 -0
  425. data/ext/v8/upstream/2.0.6/test/mjsunit/array-sort.js +362 -0
  426. data/ext/v8/upstream/2.0.6/test/mjsunit/array-splice.js +314 -0
  427. data/ext/v8/upstream/2.0.6/test/mjsunit/ascii-regexp-subject.js +49 -0
  428. data/ext/v8/upstream/2.0.6/test/mjsunit/big-array-literal.js +111 -0
  429. data/ext/v8/upstream/2.0.6/test/mjsunit/big-object-literal.js +114 -0
  430. data/ext/v8/upstream/2.0.6/test/mjsunit/binary-operation-overwrite.js +36 -0
  431. data/ext/v8/upstream/2.0.6/test/mjsunit/bit-not.js +75 -0
  432. data/ext/v8/upstream/2.0.6/test/mjsunit/bitwise-operations-undefined.js +49 -0
  433. data/ext/v8/upstream/2.0.6/test/mjsunit/body-not-visible.js +39 -0
  434. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-1344252.js +79 -0
  435. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-222.js +42 -0
  436. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-223.js +39 -0
  437. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-900066.js +38 -0
  438. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-941049.js +100 -0
  439. data/ext/v8/upstream/2.0.6/test/mjsunit/call-non-function-call.js +38 -0
  440. data/ext/v8/upstream/2.0.6/test/mjsunit/call-non-function.js +63 -0
  441. data/ext/v8/upstream/2.0.6/test/mjsunit/call.js +87 -0
  442. data/ext/v8/upstream/2.0.6/test/mjsunit/char-escape.js +53 -0
  443. data/ext/v8/upstream/2.0.6/test/mjsunit/class-of-builtins.js +50 -0
  444. data/ext/v8/upstream/2.0.6/test/mjsunit/closure.js +37 -0
  445. data/ext/v8/upstream/2.0.6/test/mjsunit/codegen-coverage.js +91 -0
  446. data/ext/v8/upstream/2.0.6/test/mjsunit/compare-character.js +50 -0
  447. data/ext/v8/upstream/2.0.6/test/mjsunit/compare-nan.js +66 -0
  448. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/countoperation.js +111 -0
  449. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/function-call.js +52 -0
  450. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/globals.js +65 -0
  451. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/jsnatives.js +33 -0
  452. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/literals-assignment.js +104 -0
  453. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/literals.js +52 -0
  454. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/loops.js +35 -0
  455. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/objectliterals.js +57 -0
  456. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/property-simple.js +39 -0
  457. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/short-circuit.js +102 -0
  458. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/thisfunction.js +35 -0
  459. data/ext/v8/upstream/2.0.6/test/mjsunit/const-declaration.js +172 -0
  460. data/ext/v8/upstream/2.0.6/test/mjsunit/const-eval-init.js +111 -0
  461. data/ext/v8/upstream/2.0.6/test/mjsunit/const-redecl.js +220 -0
  462. data/ext/v8/upstream/2.0.6/test/mjsunit/const.js +70 -0
  463. data/ext/v8/upstream/2.0.6/test/mjsunit/constant-folding.js +232 -0
  464. data/ext/v8/upstream/2.0.6/test/mjsunit/context-variable-assignments.js +37 -0
  465. data/ext/v8/upstream/2.0.6/test/mjsunit/cyclic-array-to-string.js +65 -0
  466. data/ext/v8/upstream/2.0.6/test/mjsunit/cyrillic.js +199 -0
  467. data/ext/v8/upstream/2.0.6/test/mjsunit/d8-os.js +180 -0
  468. data/ext/v8/upstream/2.0.6/test/mjsunit/date-parse.js +268 -0
  469. data/ext/v8/upstream/2.0.6/test/mjsunit/date.js +149 -0
  470. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-backtrace-text.js +122 -0
  471. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-backtrace.js +272 -0
  472. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-breakpoints.js +120 -0
  473. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-changebreakpoint.js +108 -0
  474. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-clearbreakpoint.js +101 -0
  475. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-clearbreakpointgroup.js +117 -0
  476. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-compile-event.js +126 -0
  477. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-conditional-breakpoints.js +171 -0
  478. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-constructed-by.js +60 -0
  479. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-constructor.js +78 -0
  480. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-continue.js +114 -0
  481. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-enable-disable-breakpoints.js +90 -0
  482. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-arguments.js +93 -0
  483. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-bool-constructor.js +80 -0
  484. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-locals.js +132 -0
  485. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-recursive.js +167 -0
  486. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-with.js +77 -0
  487. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate.js +118 -0
  488. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-event-listener.js +73 -0
  489. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-handle.js +252 -0
  490. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-ignore-breakpoints.js +89 -0
  491. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-mirror-cache.js +85 -0
  492. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-multiple-breakpoints.js +105 -0
  493. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-referenced-by.js +112 -0
  494. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-references.js +118 -0
  495. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-scopes.js +761 -0
  496. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-script-breakpoints.js +112 -0
  497. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-script.js +92 -0
  498. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-scripts-request.js +108 -0
  499. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-setbreakpoint.js +165 -0
  500. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-sourceinfo.js +352 -0
  501. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-sourceslice.js +74 -0
  502. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-step-stub-callfunction.js +87 -0
  503. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-step.js +82 -0
  504. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-accessor.js +248 -0
  505. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-builtin.js +78 -0
  506. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-call-function-stub.js +115 -0
  507. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-constructor.js +78 -0
  508. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-function-call.js +149 -0
  509. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepnext-do-while.js +79 -0
  510. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepout-recursive-function.js +106 -0
  511. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepout-to-builtin.js +84 -0
  512. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-suspend.js +96 -0
  513. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-version.js +90 -0
  514. data/ext/v8/upstream/2.0.6/test/mjsunit/declare-locally.js +43 -0
  515. data/ext/v8/upstream/2.0.6/test/mjsunit/deep-recursion.js +66 -0
  516. data/ext/v8/upstream/2.0.6/test/mjsunit/delay-syntax-error.js +41 -0
  517. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-global-properties.js +37 -0
  518. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-in-eval.js +32 -0
  519. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-in-with.js +34 -0
  520. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-vars-from-eval.js +40 -0
  521. data/ext/v8/upstream/2.0.6/test/mjsunit/delete.js +163 -0
  522. data/ext/v8/upstream/2.0.6/test/mjsunit/div-mod.js +157 -0
  523. data/ext/v8/upstream/2.0.6/test/mjsunit/do-not-strip-fc.js +31 -0
  524. data/ext/v8/upstream/2.0.6/test/mjsunit/dont-enum-array-holes.js +35 -0
  525. data/ext/v8/upstream/2.0.6/test/mjsunit/dont-reinit-global-var.js +47 -0
  526. data/ext/v8/upstream/2.0.6/test/mjsunit/double-equals.js +114 -0
  527. data/ext/v8/upstream/2.0.6/test/mjsunit/dtoa.js +32 -0
  528. data/ext/v8/upstream/2.0.6/test/mjsunit/enumeration-order.js +109 -0
  529. data/ext/v8/upstream/2.0.6/test/mjsunit/error-constructors.js +32 -0
  530. data/ext/v8/upstream/2.0.6/test/mjsunit/escape.js +118 -0
  531. data/ext/v8/upstream/2.0.6/test/mjsunit/eval-enclosing-function-name.js +76 -0
  532. data/ext/v8/upstream/2.0.6/test/mjsunit/eval-typeof-non-existing.js +35 -0
  533. data/ext/v8/upstream/2.0.6/test/mjsunit/eval.js +157 -0
  534. data/ext/v8/upstream/2.0.6/test/mjsunit/execScript-case-insensitive.js +34 -0
  535. data/ext/v8/upstream/2.0.6/test/mjsunit/extra-arguments.js +54 -0
  536. data/ext/v8/upstream/2.0.6/test/mjsunit/extra-commas.js +46 -0
  537. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in-null-or-undefined.js +33 -0
  538. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in-special-cases.js +64 -0
  539. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in.js +86 -0
  540. data/ext/v8/upstream/2.0.6/test/mjsunit/fun-as-prototype.js +36 -0
  541. data/ext/v8/upstream/2.0.6/test/mjsunit/fun-name.js +34 -0
  542. data/ext/v8/upstream/2.0.6/test/mjsunit/function-arguments-null.js +30 -0
  543. data/ext/v8/upstream/2.0.6/test/mjsunit/function-caller.js +48 -0
  544. data/ext/v8/upstream/2.0.6/test/mjsunit/function-names.js +133 -0
  545. data/ext/v8/upstream/2.0.6/test/mjsunit/function-property.js +29 -0
  546. data/ext/v8/upstream/2.0.6/test/mjsunit/function-prototype.js +98 -0
  547. data/ext/v8/upstream/2.0.6/test/mjsunit/function-source.js +49 -0
  548. data/ext/v8/upstream/2.0.6/test/mjsunit/function.js +83 -0
  549. data/ext/v8/upstream/2.0.6/test/mjsunit/fuzz-accessors.js +85 -0
  550. data/ext/v8/upstream/2.0.6/test/mjsunit/fuzz-natives.js +159 -0
  551. data/ext/v8/upstream/2.0.6/test/mjsunit/get-own-property-descriptor.js +51 -0
  552. data/ext/v8/upstream/2.0.6/test/mjsunit/get-prototype-of.js +68 -0
  553. data/ext/v8/upstream/2.0.6/test/mjsunit/getter-in-prototype.js +50 -0
  554. data/ext/v8/upstream/2.0.6/test/mjsunit/getter-in-value-prototype.js +35 -0
  555. data/ext/v8/upstream/2.0.6/test/mjsunit/global-const-var-conflicts.js +57 -0
  556. data/ext/v8/upstream/2.0.6/test/mjsunit/global-deleted-property-ic.js +45 -0
  557. data/ext/v8/upstream/2.0.6/test/mjsunit/global-deleted-property-keyed.js +38 -0
  558. data/ext/v8/upstream/2.0.6/test/mjsunit/global-ic.js +48 -0
  559. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-eval-in-with.js +59 -0
  560. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-eval.js +85 -0
  561. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-nested-eval.js +66 -0
  562. data/ext/v8/upstream/2.0.6/test/mjsunit/global-vars-eval.js +34 -0
  563. data/ext/v8/upstream/2.0.6/test/mjsunit/global-vars-with.js +43 -0
  564. data/ext/v8/upstream/2.0.6/test/mjsunit/greedy.js +60 -0
  565. data/ext/v8/upstream/2.0.6/test/mjsunit/has-own-property.js +38 -0
  566. data/ext/v8/upstream/2.0.6/test/mjsunit/html-comments.js +57 -0
  567. data/ext/v8/upstream/2.0.6/test/mjsunit/html-string-funcs.js +47 -0
  568. data/ext/v8/upstream/2.0.6/test/mjsunit/if-in-undefined.js +36 -0
  569. data/ext/v8/upstream/2.0.6/test/mjsunit/in.js +159 -0
  570. data/ext/v8/upstream/2.0.6/test/mjsunit/indexed-accessors.js +120 -0
  571. data/ext/v8/upstream/2.0.6/test/mjsunit/instanceof.js +93 -0
  572. data/ext/v8/upstream/2.0.6/test/mjsunit/integer-to-string.js +35 -0
  573. data/ext/v8/upstream/2.0.6/test/mjsunit/invalid-lhs.js +65 -0
  574. data/ext/v8/upstream/2.0.6/test/mjsunit/invalid-source-element.js +31 -0
  575. data/ext/v8/upstream/2.0.6/test/mjsunit/json.js +207 -0
  576. data/ext/v8/upstream/2.0.6/test/mjsunit/keyed-ic.js +236 -0
  577. data/ext/v8/upstream/2.0.6/test/mjsunit/keyed-storage-extend.js +55 -0
  578. data/ext/v8/upstream/2.0.6/test/mjsunit/large-object-allocation.js +300 -0
  579. data/ext/v8/upstream/2.0.6/test/mjsunit/large-object-literal.js +56 -0
  580. data/ext/v8/upstream/2.0.6/test/mjsunit/lazy-load.js +34 -0
  581. data/ext/v8/upstream/2.0.6/test/mjsunit/leakcheck.js +53 -0
  582. data/ext/v8/upstream/2.0.6/test/mjsunit/length.js +78 -0
  583. data/ext/v8/upstream/2.0.6/test/mjsunit/local-load-from-eval.js +39 -0
  584. data/ext/v8/upstream/2.0.6/test/mjsunit/math-min-max.js +105 -0
  585. data/ext/v8/upstream/2.0.6/test/mjsunit/megamorphic-callbacks.js +70 -0
  586. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-array.js +138 -0
  587. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-boolean.js +59 -0
  588. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-date.js +77 -0
  589. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-error.js +94 -0
  590. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-function.js +90 -0
  591. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-null.js +50 -0
  592. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-number.js +77 -0
  593. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-object.js +227 -0
  594. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-regexp.js +110 -0
  595. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-script.js +100 -0
  596. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-string.js +89 -0
  597. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-undefined.js +50 -0
  598. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-unresolved-function.js +81 -0
  599. data/ext/v8/upstream/2.0.6/test/mjsunit/mjsunit.js +203 -0
  600. data/ext/v8/upstream/2.0.6/test/mjsunit/mjsunit.status +66 -0
  601. data/ext/v8/upstream/2.0.6/test/mjsunit/mul-exhaustive.js +4511 -0
  602. data/ext/v8/upstream/2.0.6/test/mjsunit/multiple-return.js +62 -0
  603. data/ext/v8/upstream/2.0.6/test/mjsunit/negate-zero.js +42 -0
  604. data/ext/v8/upstream/2.0.6/test/mjsunit/negate.js +59 -0
  605. data/ext/v8/upstream/2.0.6/test/mjsunit/new.js +56 -0
  606. data/ext/v8/upstream/2.0.6/test/mjsunit/newline-in-string.js +46 -0
  607. data/ext/v8/upstream/2.0.6/test/mjsunit/no-branch-elimination.js +36 -0
  608. data/ext/v8/upstream/2.0.6/test/mjsunit/no-octal-constants-above-256.js +32 -0
  609. data/ext/v8/upstream/2.0.6/test/mjsunit/no-semicolon.js +45 -0
  610. data/ext/v8/upstream/2.0.6/test/mjsunit/non-ascii-replace.js +30 -0
  611. data/ext/v8/upstream/2.0.6/test/mjsunit/nul-characters.js +38 -0
  612. data/ext/v8/upstream/2.0.6/test/mjsunit/number-limits.js +47 -0
  613. data/ext/v8/upstream/2.0.6/test/mjsunit/number-string-index-call.js +32 -0
  614. data/ext/v8/upstream/2.0.6/test/mjsunit/number-tostring-small.js +395 -0
  615. data/ext/v8/upstream/2.0.6/test/mjsunit/number-tostring.js +338 -0
  616. data/ext/v8/upstream/2.0.6/test/mjsunit/obj-construct.js +46 -0
  617. data/ext/v8/upstream/2.0.6/test/mjsunit/object-create.js +250 -0
  618. data/ext/v8/upstream/2.0.6/test/mjsunit/object-literal-gc.js +66 -0
  619. data/ext/v8/upstream/2.0.6/test/mjsunit/object-literal.js +105 -0
  620. data/ext/v8/upstream/2.0.6/test/mjsunit/override-read-only-property.js +64 -0
  621. data/ext/v8/upstream/2.0.6/test/mjsunit/parse-int-float.js +85 -0
  622. data/ext/v8/upstream/2.0.6/test/mjsunit/property-load-across-eval.js +85 -0
  623. data/ext/v8/upstream/2.0.6/test/mjsunit/property-object-key.js +36 -0
  624. data/ext/v8/upstream/2.0.6/test/mjsunit/proto.js +33 -0
  625. data/ext/v8/upstream/2.0.6/test/mjsunit/prototype.js +93 -0
  626. data/ext/v8/upstream/2.0.6/test/mjsunit/receiver-in-with-calls.js +47 -0
  627. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-UC16.js +47 -0
  628. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-call-as-function.js +36 -0
  629. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-capture.js +57 -0
  630. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-captures.js +31 -0
  631. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-indexof.js +77 -0
  632. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-lookahead.js +166 -0
  633. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-loop-capture.js +29 -0
  634. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-multiline-stack-trace.js +116 -0
  635. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-multiline.js +112 -0
  636. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-standalones.js +78 -0
  637. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-static.js +167 -0
  638. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-string-methods.js +51 -0
  639. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp.js +390 -0
  640. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1030466.js +45 -0
  641. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1036894.js +38 -0
  642. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1039610.js +29 -0
  643. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1050043.js +51 -0
  644. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1062422.js +30 -0
  645. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1066899.js +37 -0
  646. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1081309.js +110 -0
  647. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1102760.js +35 -0
  648. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1110164.js +46 -0
  649. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1112051.js +33 -0
  650. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1114040.js +58 -0
  651. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1134697.js +31 -0
  652. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-114.js +43 -0
  653. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-116.js +40 -0
  654. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1170187.js +80 -0
  655. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1173979.js +48 -0
  656. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1175390.js +30 -0
  657. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1177518.js +39 -0
  658. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1177809.js +31 -0
  659. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1178598.js +90 -0
  660. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1182832.js +38 -0
  661. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1187524.js +34 -0
  662. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1199401.js +75 -0
  663. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1199637.js +78 -0
  664. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1200351.js +2032 -0
  665. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1201933.js +40 -0
  666. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1203459.js +29 -0
  667. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1207276.js +36 -0
  668. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1213516.js +40 -0
  669. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1213575.js +41 -0
  670. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1215653.js +365 -0
  671. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-124.js +57 -0
  672. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1254366.js +38 -0
  673. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1327557.js +36 -0
  674. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1341167.js +33 -0
  675. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1346700.js +29 -0
  676. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-137.js +46 -0
  677. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1439135.js +40 -0
  678. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-149.js +28 -0
  679. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1493017.js +52 -0
  680. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-155924.js +46 -0
  681. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-171.js +41 -0
  682. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-176.js +50 -0
  683. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-186.js +72 -0
  684. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-187.js +30 -0
  685. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-189.js +36 -0
  686. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-191.js +42 -0
  687. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1919169.js +40 -0
  688. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-192.js +38 -0
  689. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-193.js +44 -0
  690. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-20070207.js +42 -0
  691. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-201.js +37 -0
  692. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-219.js +176 -0
  693. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-220.js +31 -0
  694. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-221.js +34 -0
  695. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-2249423.js +40 -0
  696. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-225.js +32 -0
  697. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-227.js +33 -0
  698. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-231.js +92 -0
  699. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-233.js +39 -0
  700. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-244.js +67 -0
  701. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-246.js +31 -0
  702. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-253.js +31 -0
  703. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-254.js +58 -0
  704. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-259.js +33 -0
  705. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-260.js +33 -0
  706. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-263.js +38 -0
  707. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-265.js +64 -0
  708. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-267.js +35 -0
  709. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-269.js +49 -0
  710. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-279.js +62 -0
  711. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-284.js +50 -0
  712. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-286.js +36 -0
  713. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-294.js +43 -0
  714. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-312.js +31 -0
  715. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-317.js +31 -0
  716. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-318.js +35 -0
  717. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-326.js +40 -0
  718. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-334.js +90 -0
  719. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-341.js +36 -0
  720. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-345.js +51 -0
  721. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-349.js +32 -0
  722. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-35.js +33 -0
  723. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-351.js +31 -0
  724. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-386.js +47 -0
  725. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-392.js +34 -0
  726. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-394.js +47 -0
  727. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-396.js +39 -0
  728. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-397.js +34 -0
  729. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-399.js +32 -0
  730. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-406.js +69 -0
  731. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-416.js +38 -0
  732. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-475.js +28 -0
  733. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-483.js +35 -0
  734. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-485.js +64 -0
  735. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-486.js +30 -0
  736. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-490.js +48 -0
  737. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-491.js +47 -0
  738. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-492.js +52 -0
  739. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-496.js +39 -0
  740. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-502.js +38 -0
  741. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-503.js +63 -0
  742. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-515.js +40 -0
  743. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-524.js +32 -0
  744. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-526.js +32 -0
  745. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-540.js +47 -0
  746. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-545.js +47 -0
  747. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-57.js +32 -0
  748. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-580.js +55 -0
  749. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-588599.js +31 -0
  750. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-6-9-regexp.js +30 -0
  751. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-662254.js +40 -0
  752. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-666721.js +53 -0
  753. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-667061.js +90 -0
  754. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-670147.js +34 -0
  755. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-674753.js +87 -0
  756. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-676025.js +31 -0
  757. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-678525.js +59 -0
  758. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-682649.js +30 -0
  759. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-69.js +43 -0
  760. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-734862.js +37 -0
  761. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-737588.js +34 -0
  762. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-74.js +41 -0
  763. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-780423.js +39 -0
  764. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-799761.js +92 -0
  765. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-806473.js +60 -0
  766. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-842017.js +60 -0
  767. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-86.js +46 -0
  768. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-87.js +58 -0
  769. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-874178.js +32 -0
  770. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-875031.js +37 -0
  771. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-877615.js +37 -0
  772. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-892742.js +50 -0
  773. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-900055.js +42 -0
  774. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-900966.js +38 -0
  775. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-91.js +38 -0
  776. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-925537.js +42 -0
  777. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-937896.js +50 -0
  778. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-990205.js +35 -0
  779. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-992733.js +35 -0
  780. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-996542.js +40 -0
  781. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-998565.js +51 -0
  782. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-crbug-18639.js +34 -0
  783. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-r3391.js +77 -0
  784. data/ext/v8/upstream/2.0.6/test/mjsunit/scanner.js +30 -0
  785. data/ext/v8/upstream/2.0.6/test/mjsunit/short-circuit-boolean.js +46 -0
  786. data/ext/v8/upstream/2.0.6/test/mjsunit/simple-constructor.js +140 -0
  787. data/ext/v8/upstream/2.0.6/test/mjsunit/sin-cos.js +45 -0
  788. data/ext/v8/upstream/2.0.6/test/mjsunit/smi-negative-zero.js +100 -0
  789. data/ext/v8/upstream/2.0.6/test/mjsunit/smi-ops.js +671 -0
  790. data/ext/v8/upstream/2.0.6/test/mjsunit/sparse-array-reverse.js +131 -0
  791. data/ext/v8/upstream/2.0.6/test/mjsunit/sparse-array.js +41 -0
  792. data/ext/v8/upstream/2.0.6/test/mjsunit/stack-traces.js +204 -0
  793. data/ext/v8/upstream/2.0.6/test/mjsunit/str-to-num.js +158 -0
  794. data/ext/v8/upstream/2.0.6/test/mjsunit/stress-array-push.js +34 -0
  795. data/ext/v8/upstream/2.0.6/test/mjsunit/strict-equals.js +90 -0
  796. data/ext/v8/upstream/2.0.6/test/mjsunit/string-add.js +195 -0
  797. data/ext/v8/upstream/2.0.6/test/mjsunit/string-case.js +28 -0
  798. data/ext/v8/upstream/2.0.6/test/mjsunit/string-charat.js +53 -0
  799. data/ext/v8/upstream/2.0.6/test/mjsunit/string-charcodeat.js +192 -0
  800. data/ext/v8/upstream/2.0.6/test/mjsunit/string-compare-alignment.js +47 -0
  801. data/ext/v8/upstream/2.0.6/test/mjsunit/string-flatten.js +37 -0
  802. data/ext/v8/upstream/2.0.6/test/mjsunit/string-index.js +154 -0
  803. data/ext/v8/upstream/2.0.6/test/mjsunit/string-indexof-1.js +99 -0
  804. data/ext/v8/upstream/2.0.6/test/mjsunit/string-indexof-2.js +68 -0
  805. data/ext/v8/upstream/2.0.6/test/mjsunit/string-lastindexof.js +88 -0
  806. data/ext/v8/upstream/2.0.6/test/mjsunit/string-localecompare.js +40 -0
  807. data/ext/v8/upstream/2.0.6/test/mjsunit/string-match.js +149 -0
  808. data/ext/v8/upstream/2.0.6/test/mjsunit/string-replace-gc.js +57 -0
  809. data/ext/v8/upstream/2.0.6/test/mjsunit/string-replace.js +182 -0
  810. data/ext/v8/upstream/2.0.6/test/mjsunit/string-search.js +30 -0
  811. data/ext/v8/upstream/2.0.6/test/mjsunit/string-split.js +126 -0
  812. data/ext/v8/upstream/2.0.6/test/mjsunit/substr.js +65 -0
  813. data/ext/v8/upstream/2.0.6/test/mjsunit/switch.js +289 -0
  814. data/ext/v8/upstream/2.0.6/test/mjsunit/testcfg.py +137 -0
  815. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/array-isarray.js +48 -0
  816. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/array-splice-webkit.js +62 -0
  817. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/object-keys.js +68 -0
  818. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/regexp-pcre.js +6603 -0
  819. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/string-trim.js +107 -0
  820. data/ext/v8/upstream/2.0.6/test/mjsunit/this-in-callbacks.js +47 -0
  821. data/ext/v8/upstream/2.0.6/test/mjsunit/this.js +46 -0
  822. data/ext/v8/upstream/2.0.6/test/mjsunit/throw-and-catch-function.js +50 -0
  823. data/ext/v8/upstream/2.0.6/test/mjsunit/throw-exception-for-null-access.js +37 -0
  824. data/ext/v8/upstream/2.0.6/test/mjsunit/to-precision.js +82 -0
  825. data/ext/v8/upstream/2.0.6/test/mjsunit/to_number_order.js +129 -0
  826. data/ext/v8/upstream/2.0.6/test/mjsunit/tobool.js +36 -0
  827. data/ext/v8/upstream/2.0.6/test/mjsunit/toint32.js +129 -0
  828. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/codemap.js +180 -0
  829. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/consarray.js +60 -0
  830. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/csvparser.js +79 -0
  831. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/logreader.js +98 -0
  832. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/profile.js +348 -0
  833. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/profile_view.js +95 -0
  834. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/splaytree.js +166 -0
  835. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.default +55 -0
  836. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.gc-state +21 -0
  837. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.ignore-unknown +51 -0
  838. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.separate-ic +61 -0
  839. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor.js +409 -0
  840. data/ext/v8/upstream/2.0.6/test/mjsunit/top-level-assignments.js +107 -0
  841. data/ext/v8/upstream/2.0.6/test/mjsunit/touint32.js +72 -0
  842. data/ext/v8/upstream/2.0.6/test/mjsunit/transcendentals.js +49 -0
  843. data/ext/v8/upstream/2.0.6/test/mjsunit/try-catch-extension-object.js +58 -0
  844. data/ext/v8/upstream/2.0.6/test/mjsunit/try-catch-scopes.js +42 -0
  845. data/ext/v8/upstream/2.0.6/test/mjsunit/try-finally-nested.js +46 -0
  846. data/ext/v8/upstream/2.0.6/test/mjsunit/try.js +394 -0
  847. data/ext/v8/upstream/2.0.6/test/mjsunit/typeof.js +40 -0
  848. data/ext/v8/upstream/2.0.6/test/mjsunit/undeletable-functions.js +181 -0
  849. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-case-overoptimization.js +35 -0
  850. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-string-to-number.js +46 -0
  851. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-test.js +9169 -0
  852. data/ext/v8/upstream/2.0.6/test/mjsunit/unusual-constructor.js +38 -0
  853. data/ext/v8/upstream/2.0.6/test/mjsunit/uri.js +78 -0
  854. data/ext/v8/upstream/2.0.6/test/mjsunit/value-callic-prototype-change.js +94 -0
  855. data/ext/v8/upstream/2.0.6/test/mjsunit/var.js +37 -0
  856. data/ext/v8/upstream/2.0.6/test/mjsunit/with-function-expression.js +36 -0
  857. data/ext/v8/upstream/2.0.6/test/mjsunit/with-leave.js +61 -0
  858. data/ext/v8/upstream/2.0.6/test/mjsunit/with-parameter-access.js +47 -0
  859. data/ext/v8/upstream/2.0.6/test/mjsunit/with-prototype.js +44 -0
  860. data/ext/v8/upstream/2.0.6/test/mjsunit/with-value.js +38 -0
  861. data/ext/v8/upstream/2.0.6/test/mozilla/mozilla-shell-emulation.js +37 -0
  862. data/ext/v8/upstream/2.0.6/test/mozilla/mozilla.status +815 -0
  863. data/ext/v8/upstream/2.0.6/test/mozilla/testcfg.py +138 -0
  864. data/ext/v8/upstream/2.0.6/test/sputnik/README +6 -0
  865. data/ext/v8/upstream/2.0.6/test/sputnik/sputnik.status +318 -0
  866. data/ext/v8/upstream/2.0.6/test/sputnik/testcfg.py +112 -0
  867. data/ext/v8/upstream/2.0.6/tools/codemap.js +258 -0
  868. data/ext/v8/upstream/2.0.6/tools/consarray.js +93 -0
  869. data/ext/v8/upstream/2.0.6/tools/csvparser.js +98 -0
  870. data/ext/v8/upstream/2.0.6/tools/gyp/v8.gyp +620 -0
  871. data/ext/v8/upstream/2.0.6/tools/js2c.py +376 -0
  872. data/ext/v8/upstream/2.0.6/tools/js2c.pyc +0 -0
  873. data/ext/v8/upstream/2.0.6/tools/jsmin.py +280 -0
  874. data/ext/v8/upstream/2.0.6/tools/jsmin.pyc +0 -0
  875. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor +24 -0
  876. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor.py +78 -0
  877. data/ext/v8/upstream/2.0.6/tools/logreader.js +320 -0
  878. data/ext/v8/upstream/2.0.6/tools/mac-nm +18 -0
  879. data/ext/v8/upstream/2.0.6/tools/mac-tick-processor +6 -0
  880. data/ext/v8/upstream/2.0.6/tools/oprofile/annotate +7 -0
  881. data/ext/v8/upstream/2.0.6/tools/oprofile/common +19 -0
  882. data/ext/v8/upstream/2.0.6/tools/oprofile/dump +7 -0
  883. data/ext/v8/upstream/2.0.6/tools/oprofile/report +7 -0
  884. data/ext/v8/upstream/2.0.6/tools/oprofile/reset +7 -0
  885. data/ext/v8/upstream/2.0.6/tools/oprofile/run +14 -0
  886. data/ext/v8/upstream/2.0.6/tools/oprofile/shutdown +7 -0
  887. data/ext/v8/upstream/2.0.6/tools/oprofile/start +7 -0
  888. data/ext/v8/upstream/2.0.6/tools/presubmit.py +299 -0
  889. data/ext/v8/upstream/2.0.6/tools/process-heap-prof.py +120 -0
  890. data/ext/v8/upstream/2.0.6/tools/profile.js +621 -0
  891. data/ext/v8/upstream/2.0.6/tools/profile_view.js +224 -0
  892. data/ext/v8/upstream/2.0.6/tools/run-valgrind.py +77 -0
  893. data/ext/v8/upstream/2.0.6/tools/splaytree.js +322 -0
  894. data/ext/v8/upstream/2.0.6/tools/splaytree.py +226 -0
  895. data/ext/v8/upstream/2.0.6/tools/stats-viewer.py +456 -0
  896. data/ext/v8/upstream/2.0.6/tools/test.py +1370 -0
  897. data/ext/v8/upstream/2.0.6/tools/tickprocessor-driver.js +53 -0
  898. data/ext/v8/upstream/2.0.6/tools/tickprocessor.js +731 -0
  899. data/ext/v8/upstream/2.0.6/tools/tickprocessor.py +535 -0
  900. data/ext/v8/upstream/2.0.6/tools/utils.py +82 -0
  901. data/ext/v8/upstream/2.0.6/tools/utils.pyc +0 -0
  902. data/ext/v8/upstream/2.0.6/tools/visual_studio/README.txt +71 -0
  903. data/ext/v8/upstream/2.0.6/tools/visual_studio/arm.vsprops +14 -0
  904. data/ext/v8/upstream/2.0.6/tools/visual_studio/common.vsprops +35 -0
  905. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8.vcproj +199 -0
  906. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_arm.vcproj +199 -0
  907. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_x64.vcproj +201 -0
  908. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8js2c.cmd +6 -0
  909. data/ext/v8/upstream/2.0.6/tools/visual_studio/debug.vsprops +17 -0
  910. data/ext/v8/upstream/2.0.6/tools/visual_studio/ia32.vsprops +13 -0
  911. data/ext/v8/upstream/2.0.6/tools/visual_studio/js2c.cmd +6 -0
  912. data/ext/v8/upstream/2.0.6/tools/visual_studio/release.vsprops +24 -0
  913. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.sln +101 -0
  914. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.vcproj +223 -0
  915. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.sln +74 -0
  916. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.vcproj +223 -0
  917. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base.vcproj +971 -0
  918. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_arm.vcproj +983 -0
  919. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_x64.vcproj +959 -0
  920. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest.vcproj +255 -0
  921. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_arm.vcproj +243 -0
  922. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_x64.vcproj +257 -0
  923. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot.vcproj +151 -0
  924. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot_x64.vcproj +151 -0
  925. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample.vcproj +151 -0
  926. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_arm.vcproj +151 -0
  927. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_x64.vcproj +151 -0
  928. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample.vcproj +151 -0
  929. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_arm.vcproj +151 -0
  930. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_x64.vcproj +153 -0
  931. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot.vcproj +142 -0
  932. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc.vcproj +92 -0
  933. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc_x64.vcproj +92 -0
  934. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_x64.vcproj +142 -0
  935. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.sln +101 -0
  936. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.vcproj +223 -0
  937. data/ext/v8/upstream/2.0.6/tools/visual_studio/x64.vsprops +13 -0
  938. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +5 -0
  939. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.py +137 -0
  940. data/ext/v8/upstream/scons/CHANGES.txt +5183 -0
  941. data/ext/v8/upstream/scons/LICENSE.txt +20 -0
  942. data/ext/v8/upstream/scons/MANIFEST +202 -0
  943. data/ext/v8/upstream/scons/PKG-INFO +13 -0
  944. data/ext/v8/upstream/scons/README.txt +273 -0
  945. data/ext/v8/upstream/scons/RELEASE.txt +1040 -0
  946. data/ext/v8/upstream/scons/engine/SCons/Action.py +1256 -0
  947. data/ext/v8/upstream/scons/engine/SCons/Builder.py +868 -0
  948. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +217 -0
  949. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +794 -0
  950. data/ext/v8/upstream/scons/engine/SCons/Debug.py +237 -0
  951. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +485 -0
  952. data/ext/v8/upstream/scons/engine/SCons/Environment.py +2327 -0
  953. data/ext/v8/upstream/scons/engine/SCons/Errors.py +207 -0
  954. data/ext/v8/upstream/scons/engine/SCons/Executor.py +636 -0
  955. data/ext/v8/upstream/scons/engine/SCons/Job.py +435 -0
  956. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +292 -0
  957. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +153 -0
  958. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +3220 -0
  959. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +128 -0
  960. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +1341 -0
  961. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +50 -0
  962. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +50 -0
  963. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +50 -0
  964. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +50 -0
  965. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +76 -0
  966. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +74 -0
  967. data/ext/v8/upstream/scons/engine/SCons/PathList.py +232 -0
  968. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +236 -0
  969. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +70 -0
  970. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +55 -0
  971. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +46 -0
  972. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +46 -0
  973. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +44 -0
  974. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +58 -0
  975. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +264 -0
  976. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +50 -0
  977. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +386 -0
  978. data/ext/v8/upstream/scons/engine/SCons/SConf.py +1038 -0
  979. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +381 -0
  980. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +132 -0
  981. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +74 -0
  982. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +111 -0
  983. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +320 -0
  984. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +48 -0
  985. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +378 -0
  986. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +103 -0
  987. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +55 -0
  988. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +415 -0
  989. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +386 -0
  990. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +1360 -0
  991. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +944 -0
  992. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +642 -0
  993. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +414 -0
  994. data/ext/v8/upstream/scons/engine/SCons/Sig.py +63 -0
  995. data/ext/v8/upstream/scons/engine/SCons/Subst.py +911 -0
  996. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +1030 -0
  997. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +61 -0
  998. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +65 -0
  999. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +73 -0
  1000. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +247 -0
  1001. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +324 -0
  1002. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  1003. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  1004. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +210 -0
  1005. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +84 -0
  1006. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +321 -0
  1007. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +367 -0
  1008. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +497 -0
  1009. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +104 -0
  1010. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +138 -0
  1011. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +64 -0
  1012. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +64 -0
  1013. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +71 -0
  1014. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +675 -0
  1015. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +82 -0
  1016. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +74 -0
  1017. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +80 -0
  1018. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +76 -0
  1019. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +71 -0
  1020. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +63 -0
  1021. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +78 -0
  1022. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +82 -0
  1023. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +99 -0
  1024. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +114 -0
  1025. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +58 -0
  1026. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +50 -0
  1027. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +224 -0
  1028. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +64 -0
  1029. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +125 -0
  1030. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +94 -0
  1031. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +62 -0
  1032. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +62 -0
  1033. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +63 -0
  1034. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +98 -0
  1035. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +63 -0
  1036. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +90 -0
  1037. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +73 -0
  1038. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +53 -0
  1039. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +80 -0
  1040. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +64 -0
  1041. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +63 -0
  1042. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +81 -0
  1043. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +85 -0
  1044. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +53 -0
  1045. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +77 -0
  1046. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +59 -0
  1047. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +52 -0
  1048. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +72 -0
  1049. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +90 -0
  1050. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +59 -0
  1051. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +60 -0
  1052. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +229 -0
  1053. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +490 -0
  1054. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +71 -0
  1055. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +110 -0
  1056. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +234 -0
  1057. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +138 -0
  1058. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +79 -0
  1059. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +99 -0
  1060. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +121 -0
  1061. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +112 -0
  1062. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +63 -0
  1063. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +77 -0
  1064. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +90 -0
  1065. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +159 -0
  1066. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +64 -0
  1067. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +266 -0
  1068. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +50 -0
  1069. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +269 -0
  1070. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +1439 -0
  1071. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +208 -0
  1072. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +107 -0
  1073. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +72 -0
  1074. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +314 -0
  1075. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  1076. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +526 -0
  1077. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +367 -0
  1078. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  1079. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  1080. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  1081. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  1082. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  1083. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  1084. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +78 -0
  1085. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +83 -0
  1086. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +108 -0
  1087. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +336 -0
  1088. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +121 -0
  1089. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +70 -0
  1090. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +132 -0
  1091. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +68 -0
  1092. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +58 -0
  1093. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +53 -0
  1094. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +63 -0
  1095. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +67 -0
  1096. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +142 -0
  1097. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +58 -0
  1098. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +63 -0
  1099. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +64 -0
  1100. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +64 -0
  1101. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +77 -0
  1102. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +186 -0
  1103. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +73 -0
  1104. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +805 -0
  1105. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +175 -0
  1106. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +53 -0
  1107. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +100 -0
  1108. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +131 -0
  1109. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +100 -0
  1110. data/ext/v8/upstream/scons/engine/SCons/Util.py +1645 -0
  1111. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +91 -0
  1112. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +107 -0
  1113. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +139 -0
  1114. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +109 -0
  1115. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +147 -0
  1116. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +317 -0
  1117. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +228 -0
  1118. data/ext/v8/upstream/scons/engine/SCons/__init__.py +49 -0
  1119. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +302 -0
  1120. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +98 -0
  1121. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +91 -0
  1122. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +124 -0
  1123. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +1725 -0
  1124. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +583 -0
  1125. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +176 -0
  1126. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +325 -0
  1127. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +1296 -0
  1128. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +382 -0
  1129. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +187 -0
  1130. data/ext/v8/upstream/scons/engine/SCons/cpp.py +598 -0
  1131. data/ext/v8/upstream/scons/engine/SCons/dblite.py +248 -0
  1132. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +77 -0
  1133. data/ext/v8/upstream/scons/os_spawnv_fix.diff +83 -0
  1134. data/ext/v8/upstream/scons/scons-time.1 +1017 -0
  1135. data/ext/v8/upstream/scons/scons.1 +15179 -0
  1136. data/ext/v8/upstream/scons/sconsign.1 +208 -0
  1137. data/ext/v8/upstream/scons/script/scons +184 -0
  1138. data/ext/v8/upstream/scons/script/scons-time +1529 -0
  1139. data/ext/v8/upstream/scons/script/scons.bat +31 -0
  1140. data/ext/v8/upstream/scons/script/sconsign +508 -0
  1141. data/ext/v8/upstream/scons/setup.cfg +6 -0
  1142. data/ext/v8/upstream/scons/setup.py +427 -0
  1143. data/ext/v8/v8_cxt.cpp +3 -0
  1144. data/ext/v8/v8_cxt.h +9 -0
  1145. data/lib/v8.rb +1 -1
  1146. data/spec/redjs/jsapi_spec.rb +6 -0
  1147. data/therubyracer.gemspec +4 -4
  1148. metadata +1146 -2
@@ -0,0 +1,2751 @@
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