therubyracer 0.4.7-x86-darwin-10

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 (1194) hide show
  1. data/Doxyfile +1514 -0
  2. data/History.txt +39 -0
  3. data/Manifest.txt +1192 -0
  4. data/README.rdoc +157 -0
  5. data/Rakefile +49 -0
  6. data/docs/data_conversion.txt +18 -0
  7. data/ext/v8/Makefile +169 -0
  8. data/ext/v8/callbacks.cpp +160 -0
  9. data/ext/v8/callbacks.h +14 -0
  10. data/ext/v8/convert_ruby.cpp +8 -0
  11. data/ext/v8/convert_ruby.h +99 -0
  12. data/ext/v8/convert_string.cpp +10 -0
  13. data/ext/v8/convert_string.h +73 -0
  14. data/ext/v8/convert_v8.cpp +9 -0
  15. data/ext/v8/convert_v8.h +121 -0
  16. data/ext/v8/converters.cpp +83 -0
  17. data/ext/v8/converters.h +23 -0
  18. data/ext/v8/extconf.rb +44 -0
  19. data/ext/v8/upstream/2.0.6/.sconsign.dblite +0 -0
  20. data/ext/v8/upstream/2.0.6/AUTHORS +23 -0
  21. data/ext/v8/upstream/2.0.6/ChangeLog +1479 -0
  22. data/ext/v8/upstream/2.0.6/LICENSE +55 -0
  23. data/ext/v8/upstream/2.0.6/SConstruct +1028 -0
  24. data/ext/v8/upstream/2.0.6/benchmarks/README.txt +63 -0
  25. data/ext/v8/upstream/2.0.6/benchmarks/base.js +264 -0
  26. data/ext/v8/upstream/2.0.6/benchmarks/crypto.js +1698 -0
  27. data/ext/v8/upstream/2.0.6/benchmarks/deltablue.js +880 -0
  28. data/ext/v8/upstream/2.0.6/benchmarks/earley-boyer.js +4684 -0
  29. data/ext/v8/upstream/2.0.6/benchmarks/raytrace.js +935 -0
  30. data/ext/v8/upstream/2.0.6/benchmarks/regexp.js +1614 -0
  31. data/ext/v8/upstream/2.0.6/benchmarks/revisions.html +86 -0
  32. data/ext/v8/upstream/2.0.6/benchmarks/richards.js +539 -0
  33. data/ext/v8/upstream/2.0.6/benchmarks/run.html +141 -0
  34. data/ext/v8/upstream/2.0.6/benchmarks/run.js +61 -0
  35. data/ext/v8/upstream/2.0.6/benchmarks/splay.js +378 -0
  36. data/ext/v8/upstream/2.0.6/benchmarks/style.css +77 -0
  37. data/ext/v8/upstream/2.0.6/benchmarks/v8-logo.png +0 -0
  38. data/ext/v8/upstream/2.0.6/include/v8-debug.h +275 -0
  39. data/ext/v8/upstream/2.0.6/include/v8.h +3236 -0
  40. data/ext/v8/upstream/2.0.6/samples/SConscript +38 -0
  41. data/ext/v8/upstream/2.0.6/samples/count-hosts.js +42 -0
  42. data/ext/v8/upstream/2.0.6/samples/process.cc +622 -0
  43. data/ext/v8/upstream/2.0.6/samples/shell.cc +303 -0
  44. data/ext/v8/upstream/2.0.6/src/SConscript +283 -0
  45. data/ext/v8/upstream/2.0.6/src/accessors.cc +695 -0
  46. data/ext/v8/upstream/2.0.6/src/accessors.h +114 -0
  47. data/ext/v8/upstream/2.0.6/src/allocation.cc +198 -0
  48. data/ext/v8/upstream/2.0.6/src/allocation.h +169 -0
  49. data/ext/v8/upstream/2.0.6/src/api.cc +3831 -0
  50. data/ext/v8/upstream/2.0.6/src/api.h +479 -0
  51. data/ext/v8/upstream/2.0.6/src/apinatives.js +110 -0
  52. data/ext/v8/upstream/2.0.6/src/apiutils.h +69 -0
  53. data/ext/v8/upstream/2.0.6/src/arguments.h +97 -0
  54. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm-inl.h +277 -0
  55. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.cc +1821 -0
  56. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.h +1027 -0
  57. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2-inl.h +267 -0
  58. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.cc +1821 -0
  59. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.h +1027 -0
  60. data/ext/v8/upstream/2.0.6/src/arm/builtins-arm.cc +1271 -0
  61. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm-inl.h +74 -0
  62. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.cc +6682 -0
  63. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.h +535 -0
  64. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.cc +112 -0
  65. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.h +347 -0
  66. data/ext/v8/upstream/2.0.6/src/arm/cpu-arm.cc +132 -0
  67. data/ext/v8/upstream/2.0.6/src/arm/debug-arm.cc +213 -0
  68. data/ext/v8/upstream/2.0.6/src/arm/disasm-arm.cc +1166 -0
  69. data/ext/v8/upstream/2.0.6/src/arm/fast-codegen-arm.cc +1698 -0
  70. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.cc +123 -0
  71. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.h +162 -0
  72. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +849 -0
  73. data/ext/v8/upstream/2.0.6/src/arm/jump-target-arm.cc +238 -0
  74. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.cc +1259 -0
  75. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.h +423 -0
  76. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.cc +1266 -0
  77. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.h +282 -0
  78. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm-inl.h +103 -0
  79. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.cc +59 -0
  80. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.h +43 -0
  81. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.cc +2264 -0
  82. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.h +306 -0
  83. data/ext/v8/upstream/2.0.6/src/arm/stub-cache-arm.cc +1516 -0
  84. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +412 -0
  85. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.h +532 -0
  86. data/ext/v8/upstream/2.0.6/src/array.js +1154 -0
  87. data/ext/v8/upstream/2.0.6/src/assembler.cc +772 -0
  88. data/ext/v8/upstream/2.0.6/src/assembler.h +525 -0
  89. data/ext/v8/upstream/2.0.6/src/ast.cc +512 -0
  90. data/ext/v8/upstream/2.0.6/src/ast.h +1820 -0
  91. data/ext/v8/upstream/2.0.6/src/bootstrapper.cc +1680 -0
  92. data/ext/v8/upstream/2.0.6/src/bootstrapper.h +103 -0
  93. data/ext/v8/upstream/2.0.6/src/builtins.cc +851 -0
  94. data/ext/v8/upstream/2.0.6/src/builtins.h +245 -0
  95. data/ext/v8/upstream/2.0.6/src/bytecodes-irregexp.h +104 -0
  96. data/ext/v8/upstream/2.0.6/src/char-predicates-inl.h +86 -0
  97. data/ext/v8/upstream/2.0.6/src/char-predicates.h +65 -0
  98. data/ext/v8/upstream/2.0.6/src/checks.cc +100 -0
  99. data/ext/v8/upstream/2.0.6/src/checks.h +284 -0
  100. data/ext/v8/upstream/2.0.6/src/code-stubs.cc +164 -0
  101. data/ext/v8/upstream/2.0.6/src/code-stubs.h +164 -0
  102. data/ext/v8/upstream/2.0.6/src/code.h +68 -0
  103. data/ext/v8/upstream/2.0.6/src/codegen-inl.h +88 -0
  104. data/ext/v8/upstream/2.0.6/src/codegen.cc +504 -0
  105. data/ext/v8/upstream/2.0.6/src/codegen.h +522 -0
  106. data/ext/v8/upstream/2.0.6/src/compilation-cache.cc +490 -0
  107. data/ext/v8/upstream/2.0.6/src/compilation-cache.h +98 -0
  108. data/ext/v8/upstream/2.0.6/src/compiler.cc +1132 -0
  109. data/ext/v8/upstream/2.0.6/src/compiler.h +107 -0
  110. data/ext/v8/upstream/2.0.6/src/contexts.cc +256 -0
  111. data/ext/v8/upstream/2.0.6/src/contexts.h +345 -0
  112. data/ext/v8/upstream/2.0.6/src/conversions-inl.h +95 -0
  113. data/ext/v8/upstream/2.0.6/src/conversions.cc +709 -0
  114. data/ext/v8/upstream/2.0.6/src/conversions.h +118 -0
  115. data/ext/v8/upstream/2.0.6/src/counters.cc +78 -0
  116. data/ext/v8/upstream/2.0.6/src/counters.h +239 -0
  117. data/ext/v8/upstream/2.0.6/src/cpu.h +65 -0
  118. data/ext/v8/upstream/2.0.6/src/d8-debug.cc +345 -0
  119. data/ext/v8/upstream/2.0.6/src/d8-debug.h +155 -0
  120. data/ext/v8/upstream/2.0.6/src/d8-posix.cc +675 -0
  121. data/ext/v8/upstream/2.0.6/src/d8-readline.cc +128 -0
  122. data/ext/v8/upstream/2.0.6/src/d8-windows.cc +42 -0
  123. data/ext/v8/upstream/2.0.6/src/d8.cc +776 -0
  124. data/ext/v8/upstream/2.0.6/src/d8.h +225 -0
  125. data/ext/v8/upstream/2.0.6/src/d8.js +1625 -0
  126. data/ext/v8/upstream/2.0.6/src/date-delay.js +1138 -0
  127. data/ext/v8/upstream/2.0.6/src/dateparser-inl.h +114 -0
  128. data/ext/v8/upstream/2.0.6/src/dateparser.cc +186 -0
  129. data/ext/v8/upstream/2.0.6/src/dateparser.h +240 -0
  130. data/ext/v8/upstream/2.0.6/src/debug-agent.cc +425 -0
  131. data/ext/v8/upstream/2.0.6/src/debug-agent.h +129 -0
  132. data/ext/v8/upstream/2.0.6/src/debug-delay.js +2073 -0
  133. data/ext/v8/upstream/2.0.6/src/debug.cc +2751 -0
  134. data/ext/v8/upstream/2.0.6/src/debug.h +866 -0
  135. data/ext/v8/upstream/2.0.6/src/disasm.h +77 -0
  136. data/ext/v8/upstream/2.0.6/src/disassembler.cc +318 -0
  137. data/ext/v8/upstream/2.0.6/src/disassembler.h +56 -0
  138. data/ext/v8/upstream/2.0.6/src/dtoa-config.c +91 -0
  139. data/ext/v8/upstream/2.0.6/src/execution.cc +701 -0
  140. data/ext/v8/upstream/2.0.6/src/execution.h +312 -0
  141. data/ext/v8/upstream/2.0.6/src/factory.cc +957 -0
  142. data/ext/v8/upstream/2.0.6/src/factory.h +393 -0
  143. data/ext/v8/upstream/2.0.6/src/fast-codegen.cc +725 -0
  144. data/ext/v8/upstream/2.0.6/src/fast-codegen.h +371 -0
  145. data/ext/v8/upstream/2.0.6/src/flag-definitions.h +426 -0
  146. data/ext/v8/upstream/2.0.6/src/flags.cc +555 -0
  147. data/ext/v8/upstream/2.0.6/src/flags.h +81 -0
  148. data/ext/v8/upstream/2.0.6/src/frame-element.cc +45 -0
  149. data/ext/v8/upstream/2.0.6/src/frame-element.h +235 -0
  150. data/ext/v8/upstream/2.0.6/src/frames-inl.h +215 -0
  151. data/ext/v8/upstream/2.0.6/src/frames.cc +749 -0
  152. data/ext/v8/upstream/2.0.6/src/frames.h +659 -0
  153. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.cc +76 -0
  154. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.h +135 -0
  155. data/ext/v8/upstream/2.0.6/src/global-handles.cc +516 -0
  156. data/ext/v8/upstream/2.0.6/src/global-handles.h +180 -0
  157. data/ext/v8/upstream/2.0.6/src/globals.h +608 -0
  158. data/ext/v8/upstream/2.0.6/src/handles-inl.h +76 -0
  159. data/ext/v8/upstream/2.0.6/src/handles.cc +811 -0
  160. data/ext/v8/upstream/2.0.6/src/handles.h +367 -0
  161. data/ext/v8/upstream/2.0.6/src/hashmap.cc +226 -0
  162. data/ext/v8/upstream/2.0.6/src/hashmap.h +120 -0
  163. data/ext/v8/upstream/2.0.6/src/heap-inl.h +407 -0
  164. data/ext/v8/upstream/2.0.6/src/heap-profiler.cc +695 -0
  165. data/ext/v8/upstream/2.0.6/src/heap-profiler.h +277 -0
  166. data/ext/v8/upstream/2.0.6/src/heap.cc +4204 -0
  167. data/ext/v8/upstream/2.0.6/src/heap.h +1704 -0
  168. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32-inl.h +325 -0
  169. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.cc +2375 -0
  170. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.h +914 -0
  171. data/ext/v8/upstream/2.0.6/src/ia32/builtins-ia32.cc +1222 -0
  172. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32-inl.h +46 -0
  173. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.cc +9770 -0
  174. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.h +834 -0
  175. data/ext/v8/upstream/2.0.6/src/ia32/cpu-ia32.cc +79 -0
  176. data/ext/v8/upstream/2.0.6/src/ia32/debug-ia32.cc +208 -0
  177. data/ext/v8/upstream/2.0.6/src/ia32/disasm-ia32.cc +1357 -0
  178. data/ext/v8/upstream/2.0.6/src/ia32/fast-codegen-ia32.cc +1813 -0
  179. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.cc +111 -0
  180. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.h +135 -0
  181. data/ext/v8/upstream/2.0.6/src/ia32/ic-ia32.cc +1490 -0
  182. data/ext/v8/upstream/2.0.6/src/ia32/jump-target-ia32.cc +432 -0
  183. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.cc +1517 -0
  184. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.h +528 -0
  185. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.cc +1219 -0
  186. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.h +230 -0
  187. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32-inl.h +82 -0
  188. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.cc +99 -0
  189. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.h +43 -0
  190. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.cc +30 -0
  191. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.h +62 -0
  192. data/ext/v8/upstream/2.0.6/src/ia32/stub-cache-ia32.cc +1961 -0
  193. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.cc +1105 -0
  194. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.h +580 -0
  195. data/ext/v8/upstream/2.0.6/src/ic-inl.h +93 -0
  196. data/ext/v8/upstream/2.0.6/src/ic.cc +1426 -0
  197. data/ext/v8/upstream/2.0.6/src/ic.h +443 -0
  198. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.cc +646 -0
  199. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.h +48 -0
  200. data/ext/v8/upstream/2.0.6/src/json-delay.js +254 -0
  201. data/ext/v8/upstream/2.0.6/src/jsregexp.cc +5234 -0
  202. data/ext/v8/upstream/2.0.6/src/jsregexp.h +1439 -0
  203. data/ext/v8/upstream/2.0.6/src/jump-target-inl.h +49 -0
  204. data/ext/v8/upstream/2.0.6/src/jump-target.cc +383 -0
  205. data/ext/v8/upstream/2.0.6/src/jump-target.h +280 -0
  206. data/ext/v8/upstream/2.0.6/src/list-inl.h +166 -0
  207. data/ext/v8/upstream/2.0.6/src/list.h +158 -0
  208. data/ext/v8/upstream/2.0.6/src/log-inl.h +126 -0
  209. data/ext/v8/upstream/2.0.6/src/log-utils.cc +503 -0
  210. data/ext/v8/upstream/2.0.6/src/log-utils.h +292 -0
  211. data/ext/v8/upstream/2.0.6/src/log.cc +1457 -0
  212. data/ext/v8/upstream/2.0.6/src/log.h +371 -0
  213. data/ext/v8/upstream/2.0.6/src/macro-assembler.h +93 -0
  214. data/ext/v8/upstream/2.0.6/src/macros.py +137 -0
  215. data/ext/v8/upstream/2.0.6/src/mark-compact.cc +2007 -0
  216. data/ext/v8/upstream/2.0.6/src/mark-compact.h +442 -0
  217. data/ext/v8/upstream/2.0.6/src/math.js +263 -0
  218. data/ext/v8/upstream/2.0.6/src/memory.h +74 -0
  219. data/ext/v8/upstream/2.0.6/src/messages.cc +177 -0
  220. data/ext/v8/upstream/2.0.6/src/messages.h +112 -0
  221. data/ext/v8/upstream/2.0.6/src/messages.js +937 -0
  222. data/ext/v8/upstream/2.0.6/src/mirror-delay.js +2332 -0
  223. data/ext/v8/upstream/2.0.6/src/mksnapshot.cc +169 -0
  224. data/ext/v8/upstream/2.0.6/src/natives.h +63 -0
  225. data/ext/v8/upstream/2.0.6/src/objects-debug.cc +1317 -0
  226. data/ext/v8/upstream/2.0.6/src/objects-inl.h +3044 -0
  227. data/ext/v8/upstream/2.0.6/src/objects.cc +8306 -0
  228. data/ext/v8/upstream/2.0.6/src/objects.h +4960 -0
  229. data/ext/v8/upstream/2.0.6/src/oprofile-agent.cc +116 -0
  230. data/ext/v8/upstream/2.0.6/src/oprofile-agent.h +69 -0
  231. data/ext/v8/upstream/2.0.6/src/parser.cc +4810 -0
  232. data/ext/v8/upstream/2.0.6/src/parser.h +195 -0
  233. data/ext/v8/upstream/2.0.6/src/platform-freebsd.cc +645 -0
  234. data/ext/v8/upstream/2.0.6/src/platform-linux.cc +808 -0
  235. data/ext/v8/upstream/2.0.6/src/platform-macos.cc +643 -0
  236. data/ext/v8/upstream/2.0.6/src/platform-nullos.cc +454 -0
  237. data/ext/v8/upstream/2.0.6/src/platform-openbsd.cc +597 -0
  238. data/ext/v8/upstream/2.0.6/src/platform-posix.cc +380 -0
  239. data/ext/v8/upstream/2.0.6/src/platform-win32.cc +1908 -0
  240. data/ext/v8/upstream/2.0.6/src/platform.h +556 -0
  241. data/ext/v8/upstream/2.0.6/src/prettyprinter.cc +1511 -0
  242. data/ext/v8/upstream/2.0.6/src/prettyprinter.h +219 -0
  243. data/ext/v8/upstream/2.0.6/src/property.cc +96 -0
  244. data/ext/v8/upstream/2.0.6/src/property.h +327 -0
  245. data/ext/v8/upstream/2.0.6/src/regexp-delay.js +406 -0
  246. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  247. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.cc +464 -0
  248. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.h +141 -0
  249. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.cc +356 -0
  250. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.h +103 -0
  251. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.cc +240 -0
  252. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.h +220 -0
  253. data/ext/v8/upstream/2.0.6/src/regexp-stack.cc +103 -0
  254. data/ext/v8/upstream/2.0.6/src/regexp-stack.h +123 -0
  255. data/ext/v8/upstream/2.0.6/src/register-allocator-inl.h +74 -0
  256. data/ext/v8/upstream/2.0.6/src/register-allocator.cc +100 -0
  257. data/ext/v8/upstream/2.0.6/src/register-allocator.h +295 -0
  258. data/ext/v8/upstream/2.0.6/src/rewriter.cc +855 -0
  259. data/ext/v8/upstream/2.0.6/src/rewriter.h +54 -0
  260. data/ext/v8/upstream/2.0.6/src/runtime.cc +8163 -0
  261. data/ext/v8/upstream/2.0.6/src/runtime.h +432 -0
  262. data/ext/v8/upstream/2.0.6/src/runtime.js +626 -0
  263. data/ext/v8/upstream/2.0.6/src/scanner.cc +1098 -0
  264. data/ext/v8/upstream/2.0.6/src/scanner.h +425 -0
  265. data/ext/v8/upstream/2.0.6/src/scopeinfo.cc +649 -0
  266. data/ext/v8/upstream/2.0.6/src/scopeinfo.h +236 -0
  267. data/ext/v8/upstream/2.0.6/src/scopes.cc +963 -0
  268. data/ext/v8/upstream/2.0.6/src/scopes.h +401 -0
  269. data/ext/v8/upstream/2.0.6/src/serialize.cc +1260 -0
  270. data/ext/v8/upstream/2.0.6/src/serialize.h +404 -0
  271. data/ext/v8/upstream/2.0.6/src/shell.h +55 -0
  272. data/ext/v8/upstream/2.0.6/src/simulator.h +41 -0
  273. data/ext/v8/upstream/2.0.6/src/smart-pointer.h +109 -0
  274. data/ext/v8/upstream/2.0.6/src/snapshot-common.cc +97 -0
  275. data/ext/v8/upstream/2.0.6/src/snapshot-empty.cc +40 -0
  276. data/ext/v8/upstream/2.0.6/src/snapshot.h +59 -0
  277. data/ext/v8/upstream/2.0.6/src/spaces-inl.h +372 -0
  278. data/ext/v8/upstream/2.0.6/src/spaces.cc +2864 -0
  279. data/ext/v8/upstream/2.0.6/src/spaces.h +2072 -0
  280. data/ext/v8/upstream/2.0.6/src/string-stream.cc +584 -0
  281. data/ext/v8/upstream/2.0.6/src/string-stream.h +189 -0
  282. data/ext/v8/upstream/2.0.6/src/string.js +901 -0
  283. data/ext/v8/upstream/2.0.6/src/stub-cache.cc +1108 -0
  284. data/ext/v8/upstream/2.0.6/src/stub-cache.h +578 -0
  285. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/COPYING +15 -0
  286. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/dtoa.c +3330 -0
  287. data/ext/v8/upstream/2.0.6/src/third_party/valgrind/valgrind.h +3925 -0
  288. data/ext/v8/upstream/2.0.6/src/token.cc +56 -0
  289. data/ext/v8/upstream/2.0.6/src/token.h +270 -0
  290. data/ext/v8/upstream/2.0.6/src/top.cc +991 -0
  291. data/ext/v8/upstream/2.0.6/src/top.h +459 -0
  292. data/ext/v8/upstream/2.0.6/src/unicode-inl.h +238 -0
  293. data/ext/v8/upstream/2.0.6/src/unicode.cc +749 -0
  294. data/ext/v8/upstream/2.0.6/src/unicode.h +279 -0
  295. data/ext/v8/upstream/2.0.6/src/uri.js +415 -0
  296. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +426 -0
  297. data/ext/v8/upstream/2.0.6/src/usage-analyzer.h +40 -0
  298. data/ext/v8/upstream/2.0.6/src/utils.cc +322 -0
  299. data/ext/v8/upstream/2.0.6/src/utils.h +592 -0
  300. data/ext/v8/upstream/2.0.6/src/v8-counters.cc +55 -0
  301. data/ext/v8/upstream/2.0.6/src/v8-counters.h +198 -0
  302. data/ext/v8/upstream/2.0.6/src/v8.cc +193 -0
  303. data/ext/v8/upstream/2.0.6/src/v8.h +119 -0
  304. data/ext/v8/upstream/2.0.6/src/v8natives.js +846 -0
  305. data/ext/v8/upstream/2.0.6/src/v8threads.cc +450 -0
  306. data/ext/v8/upstream/2.0.6/src/v8threads.h +144 -0
  307. data/ext/v8/upstream/2.0.6/src/variables.cc +163 -0
  308. data/ext/v8/upstream/2.0.6/src/variables.h +235 -0
  309. data/ext/v8/upstream/2.0.6/src/version.cc +88 -0
  310. data/ext/v8/upstream/2.0.6/src/version.h +64 -0
  311. data/ext/v8/upstream/2.0.6/src/virtual-frame.cc +381 -0
  312. data/ext/v8/upstream/2.0.6/src/virtual-frame.h +44 -0
  313. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64-inl.h +352 -0
  314. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.cc +2539 -0
  315. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.h +1399 -0
  316. data/ext/v8/upstream/2.0.6/src/x64/builtins-x64.cc +1255 -0
  317. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64-inl.h +46 -0
  318. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.cc +8223 -0
  319. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.h +785 -0
  320. data/ext/v8/upstream/2.0.6/src/x64/cpu-x64.cc +79 -0
  321. data/ext/v8/upstream/2.0.6/src/x64/debug-x64.cc +202 -0
  322. data/ext/v8/upstream/2.0.6/src/x64/disasm-x64.cc +1596 -0
  323. data/ext/v8/upstream/2.0.6/src/x64/fast-codegen-x64.cc +1820 -0
  324. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.cc +109 -0
  325. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.h +121 -0
  326. data/ext/v8/upstream/2.0.6/src/x64/ic-x64.cc +1392 -0
  327. data/ext/v8/upstream/2.0.6/src/x64/jump-target-x64.cc +432 -0
  328. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.cc +2409 -0
  329. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.h +765 -0
  330. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.cc +1337 -0
  331. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.h +295 -0
  332. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64-inl.h +86 -0
  333. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.cc +84 -0
  334. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.h +43 -0
  335. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.cc +27 -0
  336. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.h +63 -0
  337. data/ext/v8/upstream/2.0.6/src/x64/stub-cache-x64.cc +1884 -0
  338. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.cc +1089 -0
  339. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.h +560 -0
  340. data/ext/v8/upstream/2.0.6/src/zone-inl.h +297 -0
  341. data/ext/v8/upstream/2.0.6/src/zone.cc +193 -0
  342. data/ext/v8/upstream/2.0.6/src/zone.h +305 -0
  343. data/ext/v8/upstream/2.0.6/test/cctest/SConscript +95 -0
  344. data/ext/v8/upstream/2.0.6/test/cctest/cctest.cc +126 -0
  345. data/ext/v8/upstream/2.0.6/test/cctest/cctest.h +211 -0
  346. data/ext/v8/upstream/2.0.6/test/cctest/cctest.status +54 -0
  347. data/ext/v8/upstream/2.0.6/test/cctest/test-accessors.cc +450 -0
  348. data/ext/v8/upstream/2.0.6/test/cctest/test-alloc.cc +215 -0
  349. data/ext/v8/upstream/2.0.6/test/cctest/test-api.cc +8699 -0
  350. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-arm.cc +227 -0
  351. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-ia32.cc +395 -0
  352. data/ext/v8/upstream/2.0.6/test/cctest/test-assembler-x64.cc +292 -0
  353. data/ext/v8/upstream/2.0.6/test/cctest/test-ast.cc +97 -0
  354. data/ext/v8/upstream/2.0.6/test/cctest/test-compiler.cc +318 -0
  355. data/ext/v8/upstream/2.0.6/test/cctest/test-conversions.cc +130 -0
  356. data/ext/v8/upstream/2.0.6/test/cctest/test-debug.cc +5788 -0
  357. data/ext/v8/upstream/2.0.6/test/cctest/test-decls.cc +593 -0
  358. data/ext/v8/upstream/2.0.6/test/cctest/test-disasm-arm.cc +281 -0
  359. data/ext/v8/upstream/2.0.6/test/cctest/test-disasm-ia32.cc +418 -0
  360. data/ext/v8/upstream/2.0.6/test/cctest/test-flags.cc +234 -0
  361. data/ext/v8/upstream/2.0.6/test/cctest/test-func-name-inference.cc +267 -0
  362. data/ext/v8/upstream/2.0.6/test/cctest/test-hashmap.cc +176 -0
  363. data/ext/v8/upstream/2.0.6/test/cctest/test-heap-profiler.cc +396 -0
  364. data/ext/v8/upstream/2.0.6/test/cctest/test-heap.cc +796 -0
  365. data/ext/v8/upstream/2.0.6/test/cctest/test-list.cc +101 -0
  366. data/ext/v8/upstream/2.0.6/test/cctest/test-lock.cc +63 -0
  367. data/ext/v8/upstream/2.0.6/test/cctest/test-log-stack-tracer.cc +372 -0
  368. data/ext/v8/upstream/2.0.6/test/cctest/test-log-utils.cc +310 -0
  369. data/ext/v8/upstream/2.0.6/test/cctest/test-log.cc +1081 -0
  370. data/ext/v8/upstream/2.0.6/test/cctest/test-macro-assembler-x64.cc +2104 -0
  371. data/ext/v8/upstream/2.0.6/test/cctest/test-mark-compact.cc +341 -0
  372. data/ext/v8/upstream/2.0.6/test/cctest/test-parsing.cc +129 -0
  373. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-linux.cc +80 -0
  374. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-macos.cc +10 -0
  375. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-nullos.cc +80 -0
  376. data/ext/v8/upstream/2.0.6/test/cctest/test-platform-win32.cc +26 -0
  377. data/ext/v8/upstream/2.0.6/test/cctest/test-regexp.cc +1815 -0
  378. data/ext/v8/upstream/2.0.6/test/cctest/test-serialize.cc +438 -0
  379. data/ext/v8/upstream/2.0.6/test/cctest/test-sockets.cc +162 -0
  380. data/ext/v8/upstream/2.0.6/test/cctest/test-spaces.cc +248 -0
  381. data/ext/v8/upstream/2.0.6/test/cctest/test-strings.cc +432 -0
  382. data/ext/v8/upstream/2.0.6/test/cctest/test-thread-termination.cc +290 -0
  383. data/ext/v8/upstream/2.0.6/test/cctest/test-threads.cc +52 -0
  384. data/ext/v8/upstream/2.0.6/test/cctest/test-utils.cc +186 -0
  385. data/ext/v8/upstream/2.0.6/test/cctest/test-version.cc +89 -0
  386. data/ext/v8/upstream/2.0.6/test/cctest/testcfg.py +108 -0
  387. data/ext/v8/upstream/2.0.6/test/es5conform/README +14 -0
  388. data/ext/v8/upstream/2.0.6/test/es5conform/es5conform.status +226 -0
  389. data/ext/v8/upstream/2.0.6/test/es5conform/harness-adapt.js +74 -0
  390. data/ext/v8/upstream/2.0.6/test/es5conform/testcfg.py +108 -0
  391. data/ext/v8/upstream/2.0.6/test/message/message.status +31 -0
  392. data/ext/v8/upstream/2.0.6/test/message/overwritten-builtins.js +31 -0
  393. data/ext/v8/upstream/2.0.6/test/message/overwritten-builtins.out +30 -0
  394. data/ext/v8/upstream/2.0.6/test/message/regress/regress-73.js +33 -0
  395. data/ext/v8/upstream/2.0.6/test/message/regress/regress-73.out +30 -0
  396. data/ext/v8/upstream/2.0.6/test/message/regress/regress-75.js +32 -0
  397. data/ext/v8/upstream/2.0.6/test/message/regress/regress-75.out +30 -0
  398. data/ext/v8/upstream/2.0.6/test/message/simple-throw.js +28 -0
  399. data/ext/v8/upstream/2.0.6/test/message/simple-throw.out +30 -0
  400. data/ext/v8/upstream/2.0.6/test/message/testcfg.py +135 -0
  401. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-no-message.js +51 -0
  402. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-no-message.out +26 -0
  403. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-return-in-finally.js +39 -0
  404. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-return-in-finally.out +28 -0
  405. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch-and-finally.js +34 -0
  406. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch-and-finally.out +30 -0
  407. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch.js +34 -0
  408. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-catch.out +30 -0
  409. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-finally.js +34 -0
  410. data/ext/v8/upstream/2.0.6/test/message/try-catch-finally-throw-in-finally.out +30 -0
  411. data/ext/v8/upstream/2.0.6/test/message/try-finally-return-in-finally.js +37 -0
  412. data/ext/v8/upstream/2.0.6/test/message/try-finally-return-in-finally.out +28 -0
  413. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-finally.js +32 -0
  414. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-finally.out +30 -0
  415. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try-and-finally.js +32 -0
  416. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try-and-finally.out +30 -0
  417. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try.js +32 -0
  418. data/ext/v8/upstream/2.0.6/test/message/try-finally-throw-in-try.out +30 -0
  419. data/ext/v8/upstream/2.0.6/test/mjsunit/api-call-after-bypassed-exception.js +39 -0
  420. data/ext/v8/upstream/2.0.6/test/mjsunit/apply.js +196 -0
  421. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-apply.js +134 -0
  422. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-call-apply.js +41 -0
  423. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-enum.js +52 -0
  424. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-indirect.js +47 -0
  425. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-lazy.js +47 -0
  426. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-opt.js +130 -0
  427. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments-read-and-assignment.js +164 -0
  428. data/ext/v8/upstream/2.0.6/test/mjsunit/arguments.js +97 -0
  429. data/ext/v8/upstream/2.0.6/test/mjsunit/array-concat.js +120 -0
  430. data/ext/v8/upstream/2.0.6/test/mjsunit/array-constructor.js +119 -0
  431. data/ext/v8/upstream/2.0.6/test/mjsunit/array-functions-prototype.js +159 -0
  432. data/ext/v8/upstream/2.0.6/test/mjsunit/array-indexing.js +66 -0
  433. data/ext/v8/upstream/2.0.6/test/mjsunit/array-iteration.js +228 -0
  434. data/ext/v8/upstream/2.0.6/test/mjsunit/array-join.js +45 -0
  435. data/ext/v8/upstream/2.0.6/test/mjsunit/array-length-number-conversion.js +53 -0
  436. data/ext/v8/upstream/2.0.6/test/mjsunit/array-length.js +111 -0
  437. data/ext/v8/upstream/2.0.6/test/mjsunit/array-reduce.js +514 -0
  438. data/ext/v8/upstream/2.0.6/test/mjsunit/array-sort.js +362 -0
  439. data/ext/v8/upstream/2.0.6/test/mjsunit/array-splice.js +314 -0
  440. data/ext/v8/upstream/2.0.6/test/mjsunit/ascii-regexp-subject.js +49 -0
  441. data/ext/v8/upstream/2.0.6/test/mjsunit/big-array-literal.js +111 -0
  442. data/ext/v8/upstream/2.0.6/test/mjsunit/big-object-literal.js +114 -0
  443. data/ext/v8/upstream/2.0.6/test/mjsunit/binary-operation-overwrite.js +36 -0
  444. data/ext/v8/upstream/2.0.6/test/mjsunit/bit-not.js +75 -0
  445. data/ext/v8/upstream/2.0.6/test/mjsunit/bitwise-operations-undefined.js +49 -0
  446. data/ext/v8/upstream/2.0.6/test/mjsunit/body-not-visible.js +39 -0
  447. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-1344252.js +79 -0
  448. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-222.js +42 -0
  449. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-223.js +39 -0
  450. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-900066.js +38 -0
  451. data/ext/v8/upstream/2.0.6/test/mjsunit/bugs/bug-941049.js +100 -0
  452. data/ext/v8/upstream/2.0.6/test/mjsunit/call-non-function-call.js +38 -0
  453. data/ext/v8/upstream/2.0.6/test/mjsunit/call-non-function.js +63 -0
  454. data/ext/v8/upstream/2.0.6/test/mjsunit/call.js +87 -0
  455. data/ext/v8/upstream/2.0.6/test/mjsunit/char-escape.js +53 -0
  456. data/ext/v8/upstream/2.0.6/test/mjsunit/class-of-builtins.js +50 -0
  457. data/ext/v8/upstream/2.0.6/test/mjsunit/closure.js +37 -0
  458. data/ext/v8/upstream/2.0.6/test/mjsunit/codegen-coverage.js +91 -0
  459. data/ext/v8/upstream/2.0.6/test/mjsunit/compare-character.js +50 -0
  460. data/ext/v8/upstream/2.0.6/test/mjsunit/compare-nan.js +66 -0
  461. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/countoperation.js +111 -0
  462. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/function-call.js +52 -0
  463. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/globals.js +65 -0
  464. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/jsnatives.js +33 -0
  465. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/literals-assignment.js +104 -0
  466. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/literals.js +52 -0
  467. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/loops.js +35 -0
  468. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/objectliterals.js +57 -0
  469. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/property-simple.js +39 -0
  470. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/short-circuit.js +102 -0
  471. data/ext/v8/upstream/2.0.6/test/mjsunit/compiler/thisfunction.js +35 -0
  472. data/ext/v8/upstream/2.0.6/test/mjsunit/const-declaration.js +172 -0
  473. data/ext/v8/upstream/2.0.6/test/mjsunit/const-eval-init.js +111 -0
  474. data/ext/v8/upstream/2.0.6/test/mjsunit/const-redecl.js +220 -0
  475. data/ext/v8/upstream/2.0.6/test/mjsunit/const.js +70 -0
  476. data/ext/v8/upstream/2.0.6/test/mjsunit/constant-folding.js +232 -0
  477. data/ext/v8/upstream/2.0.6/test/mjsunit/context-variable-assignments.js +37 -0
  478. data/ext/v8/upstream/2.0.6/test/mjsunit/cyclic-array-to-string.js +65 -0
  479. data/ext/v8/upstream/2.0.6/test/mjsunit/cyrillic.js +199 -0
  480. data/ext/v8/upstream/2.0.6/test/mjsunit/d8-os.js +180 -0
  481. data/ext/v8/upstream/2.0.6/test/mjsunit/date-parse.js +268 -0
  482. data/ext/v8/upstream/2.0.6/test/mjsunit/date.js +149 -0
  483. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-backtrace-text.js +122 -0
  484. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-backtrace.js +272 -0
  485. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-breakpoints.js +120 -0
  486. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-changebreakpoint.js +108 -0
  487. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-clearbreakpoint.js +101 -0
  488. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-clearbreakpointgroup.js +117 -0
  489. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-compile-event.js +126 -0
  490. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-conditional-breakpoints.js +171 -0
  491. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-constructed-by.js +60 -0
  492. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-constructor.js +78 -0
  493. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-continue.js +114 -0
  494. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-enable-disable-breakpoints.js +90 -0
  495. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-arguments.js +93 -0
  496. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-bool-constructor.js +80 -0
  497. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-locals.js +132 -0
  498. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-recursive.js +167 -0
  499. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate-with.js +77 -0
  500. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-evaluate.js +118 -0
  501. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-event-listener.js +73 -0
  502. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-handle.js +252 -0
  503. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-ignore-breakpoints.js +89 -0
  504. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-mirror-cache.js +85 -0
  505. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-multiple-breakpoints.js +105 -0
  506. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-referenced-by.js +112 -0
  507. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-references.js +118 -0
  508. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-scopes.js +761 -0
  509. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-script-breakpoints.js +112 -0
  510. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-script.js +92 -0
  511. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-scripts-request.js +108 -0
  512. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-setbreakpoint.js +165 -0
  513. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-sourceinfo.js +352 -0
  514. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-sourceslice.js +74 -0
  515. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-step-stub-callfunction.js +87 -0
  516. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-step.js +82 -0
  517. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-accessor.js +248 -0
  518. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-builtin.js +78 -0
  519. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-call-function-stub.js +115 -0
  520. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-constructor.js +78 -0
  521. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepin-function-call.js +149 -0
  522. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepnext-do-while.js +79 -0
  523. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepout-recursive-function.js +106 -0
  524. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-stepout-to-builtin.js +84 -0
  525. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-suspend.js +96 -0
  526. data/ext/v8/upstream/2.0.6/test/mjsunit/debug-version.js +90 -0
  527. data/ext/v8/upstream/2.0.6/test/mjsunit/declare-locally.js +43 -0
  528. data/ext/v8/upstream/2.0.6/test/mjsunit/deep-recursion.js +66 -0
  529. data/ext/v8/upstream/2.0.6/test/mjsunit/delay-syntax-error.js +41 -0
  530. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-global-properties.js +37 -0
  531. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-in-eval.js +32 -0
  532. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-in-with.js +34 -0
  533. data/ext/v8/upstream/2.0.6/test/mjsunit/delete-vars-from-eval.js +40 -0
  534. data/ext/v8/upstream/2.0.6/test/mjsunit/delete.js +163 -0
  535. data/ext/v8/upstream/2.0.6/test/mjsunit/div-mod.js +157 -0
  536. data/ext/v8/upstream/2.0.6/test/mjsunit/do-not-strip-fc.js +31 -0
  537. data/ext/v8/upstream/2.0.6/test/mjsunit/dont-enum-array-holes.js +35 -0
  538. data/ext/v8/upstream/2.0.6/test/mjsunit/dont-reinit-global-var.js +47 -0
  539. data/ext/v8/upstream/2.0.6/test/mjsunit/double-equals.js +114 -0
  540. data/ext/v8/upstream/2.0.6/test/mjsunit/dtoa.js +32 -0
  541. data/ext/v8/upstream/2.0.6/test/mjsunit/enumeration-order.js +109 -0
  542. data/ext/v8/upstream/2.0.6/test/mjsunit/error-constructors.js +32 -0
  543. data/ext/v8/upstream/2.0.6/test/mjsunit/escape.js +118 -0
  544. data/ext/v8/upstream/2.0.6/test/mjsunit/eval-enclosing-function-name.js +76 -0
  545. data/ext/v8/upstream/2.0.6/test/mjsunit/eval-typeof-non-existing.js +35 -0
  546. data/ext/v8/upstream/2.0.6/test/mjsunit/eval.js +157 -0
  547. data/ext/v8/upstream/2.0.6/test/mjsunit/execScript-case-insensitive.js +34 -0
  548. data/ext/v8/upstream/2.0.6/test/mjsunit/extra-arguments.js +54 -0
  549. data/ext/v8/upstream/2.0.6/test/mjsunit/extra-commas.js +46 -0
  550. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in-null-or-undefined.js +33 -0
  551. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in-special-cases.js +64 -0
  552. data/ext/v8/upstream/2.0.6/test/mjsunit/for-in.js +86 -0
  553. data/ext/v8/upstream/2.0.6/test/mjsunit/fun-as-prototype.js +36 -0
  554. data/ext/v8/upstream/2.0.6/test/mjsunit/fun-name.js +34 -0
  555. data/ext/v8/upstream/2.0.6/test/mjsunit/function-arguments-null.js +30 -0
  556. data/ext/v8/upstream/2.0.6/test/mjsunit/function-caller.js +48 -0
  557. data/ext/v8/upstream/2.0.6/test/mjsunit/function-names.js +133 -0
  558. data/ext/v8/upstream/2.0.6/test/mjsunit/function-property.js +29 -0
  559. data/ext/v8/upstream/2.0.6/test/mjsunit/function-prototype.js +98 -0
  560. data/ext/v8/upstream/2.0.6/test/mjsunit/function-source.js +49 -0
  561. data/ext/v8/upstream/2.0.6/test/mjsunit/function.js +83 -0
  562. data/ext/v8/upstream/2.0.6/test/mjsunit/fuzz-accessors.js +85 -0
  563. data/ext/v8/upstream/2.0.6/test/mjsunit/fuzz-natives.js +159 -0
  564. data/ext/v8/upstream/2.0.6/test/mjsunit/get-own-property-descriptor.js +51 -0
  565. data/ext/v8/upstream/2.0.6/test/mjsunit/get-prototype-of.js +68 -0
  566. data/ext/v8/upstream/2.0.6/test/mjsunit/getter-in-prototype.js +50 -0
  567. data/ext/v8/upstream/2.0.6/test/mjsunit/getter-in-value-prototype.js +35 -0
  568. data/ext/v8/upstream/2.0.6/test/mjsunit/global-const-var-conflicts.js +57 -0
  569. data/ext/v8/upstream/2.0.6/test/mjsunit/global-deleted-property-ic.js +45 -0
  570. data/ext/v8/upstream/2.0.6/test/mjsunit/global-deleted-property-keyed.js +38 -0
  571. data/ext/v8/upstream/2.0.6/test/mjsunit/global-ic.js +48 -0
  572. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-eval-in-with.js +59 -0
  573. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-eval.js +85 -0
  574. data/ext/v8/upstream/2.0.6/test/mjsunit/global-load-from-nested-eval.js +66 -0
  575. data/ext/v8/upstream/2.0.6/test/mjsunit/global-vars-eval.js +34 -0
  576. data/ext/v8/upstream/2.0.6/test/mjsunit/global-vars-with.js +43 -0
  577. data/ext/v8/upstream/2.0.6/test/mjsunit/greedy.js +60 -0
  578. data/ext/v8/upstream/2.0.6/test/mjsunit/has-own-property.js +38 -0
  579. data/ext/v8/upstream/2.0.6/test/mjsunit/html-comments.js +57 -0
  580. data/ext/v8/upstream/2.0.6/test/mjsunit/html-string-funcs.js +47 -0
  581. data/ext/v8/upstream/2.0.6/test/mjsunit/if-in-undefined.js +36 -0
  582. data/ext/v8/upstream/2.0.6/test/mjsunit/in.js +159 -0
  583. data/ext/v8/upstream/2.0.6/test/mjsunit/indexed-accessors.js +120 -0
  584. data/ext/v8/upstream/2.0.6/test/mjsunit/instanceof.js +93 -0
  585. data/ext/v8/upstream/2.0.6/test/mjsunit/integer-to-string.js +35 -0
  586. data/ext/v8/upstream/2.0.6/test/mjsunit/invalid-lhs.js +65 -0
  587. data/ext/v8/upstream/2.0.6/test/mjsunit/invalid-source-element.js +31 -0
  588. data/ext/v8/upstream/2.0.6/test/mjsunit/json.js +207 -0
  589. data/ext/v8/upstream/2.0.6/test/mjsunit/keyed-ic.js +236 -0
  590. data/ext/v8/upstream/2.0.6/test/mjsunit/keyed-storage-extend.js +55 -0
  591. data/ext/v8/upstream/2.0.6/test/mjsunit/large-object-allocation.js +300 -0
  592. data/ext/v8/upstream/2.0.6/test/mjsunit/large-object-literal.js +56 -0
  593. data/ext/v8/upstream/2.0.6/test/mjsunit/lazy-load.js +34 -0
  594. data/ext/v8/upstream/2.0.6/test/mjsunit/leakcheck.js +53 -0
  595. data/ext/v8/upstream/2.0.6/test/mjsunit/length.js +78 -0
  596. data/ext/v8/upstream/2.0.6/test/mjsunit/local-load-from-eval.js +39 -0
  597. data/ext/v8/upstream/2.0.6/test/mjsunit/math-min-max.js +105 -0
  598. data/ext/v8/upstream/2.0.6/test/mjsunit/megamorphic-callbacks.js +70 -0
  599. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-array.js +138 -0
  600. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-boolean.js +59 -0
  601. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-date.js +77 -0
  602. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-error.js +94 -0
  603. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-function.js +90 -0
  604. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-null.js +50 -0
  605. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-number.js +77 -0
  606. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-object.js +227 -0
  607. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-regexp.js +110 -0
  608. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-script.js +100 -0
  609. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-string.js +89 -0
  610. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-undefined.js +50 -0
  611. data/ext/v8/upstream/2.0.6/test/mjsunit/mirror-unresolved-function.js +81 -0
  612. data/ext/v8/upstream/2.0.6/test/mjsunit/mjsunit.js +203 -0
  613. data/ext/v8/upstream/2.0.6/test/mjsunit/mjsunit.status +66 -0
  614. data/ext/v8/upstream/2.0.6/test/mjsunit/mul-exhaustive.js +4511 -0
  615. data/ext/v8/upstream/2.0.6/test/mjsunit/multiple-return.js +62 -0
  616. data/ext/v8/upstream/2.0.6/test/mjsunit/negate-zero.js +42 -0
  617. data/ext/v8/upstream/2.0.6/test/mjsunit/negate.js +59 -0
  618. data/ext/v8/upstream/2.0.6/test/mjsunit/new.js +56 -0
  619. data/ext/v8/upstream/2.0.6/test/mjsunit/newline-in-string.js +46 -0
  620. data/ext/v8/upstream/2.0.6/test/mjsunit/no-branch-elimination.js +36 -0
  621. data/ext/v8/upstream/2.0.6/test/mjsunit/no-octal-constants-above-256.js +32 -0
  622. data/ext/v8/upstream/2.0.6/test/mjsunit/no-semicolon.js +45 -0
  623. data/ext/v8/upstream/2.0.6/test/mjsunit/non-ascii-replace.js +30 -0
  624. data/ext/v8/upstream/2.0.6/test/mjsunit/nul-characters.js +38 -0
  625. data/ext/v8/upstream/2.0.6/test/mjsunit/number-limits.js +47 -0
  626. data/ext/v8/upstream/2.0.6/test/mjsunit/number-string-index-call.js +32 -0
  627. data/ext/v8/upstream/2.0.6/test/mjsunit/number-tostring-small.js +395 -0
  628. data/ext/v8/upstream/2.0.6/test/mjsunit/number-tostring.js +338 -0
  629. data/ext/v8/upstream/2.0.6/test/mjsunit/obj-construct.js +46 -0
  630. data/ext/v8/upstream/2.0.6/test/mjsunit/object-create.js +250 -0
  631. data/ext/v8/upstream/2.0.6/test/mjsunit/object-literal-gc.js +66 -0
  632. data/ext/v8/upstream/2.0.6/test/mjsunit/object-literal.js +105 -0
  633. data/ext/v8/upstream/2.0.6/test/mjsunit/override-read-only-property.js +64 -0
  634. data/ext/v8/upstream/2.0.6/test/mjsunit/parse-int-float.js +85 -0
  635. data/ext/v8/upstream/2.0.6/test/mjsunit/property-load-across-eval.js +85 -0
  636. data/ext/v8/upstream/2.0.6/test/mjsunit/property-object-key.js +36 -0
  637. data/ext/v8/upstream/2.0.6/test/mjsunit/proto.js +33 -0
  638. data/ext/v8/upstream/2.0.6/test/mjsunit/prototype.js +93 -0
  639. data/ext/v8/upstream/2.0.6/test/mjsunit/receiver-in-with-calls.js +47 -0
  640. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-UC16.js +47 -0
  641. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-call-as-function.js +36 -0
  642. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-capture.js +57 -0
  643. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-captures.js +31 -0
  644. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-indexof.js +77 -0
  645. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-lookahead.js +166 -0
  646. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-loop-capture.js +29 -0
  647. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-multiline-stack-trace.js +116 -0
  648. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-multiline.js +112 -0
  649. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-standalones.js +78 -0
  650. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-static.js +167 -0
  651. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp-string-methods.js +51 -0
  652. data/ext/v8/upstream/2.0.6/test/mjsunit/regexp.js +390 -0
  653. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1030466.js +45 -0
  654. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1036894.js +38 -0
  655. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1039610.js +29 -0
  656. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1050043.js +51 -0
  657. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1062422.js +30 -0
  658. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1066899.js +37 -0
  659. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1081309.js +110 -0
  660. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1102760.js +35 -0
  661. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1110164.js +46 -0
  662. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1112051.js +33 -0
  663. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1114040.js +58 -0
  664. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1134697.js +31 -0
  665. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-114.js +43 -0
  666. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-116.js +40 -0
  667. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1170187.js +80 -0
  668. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1173979.js +48 -0
  669. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1175390.js +30 -0
  670. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1177518.js +39 -0
  671. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1177809.js +31 -0
  672. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1178598.js +90 -0
  673. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1182832.js +38 -0
  674. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1187524.js +34 -0
  675. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1199401.js +75 -0
  676. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1199637.js +78 -0
  677. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1200351.js +2032 -0
  678. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1201933.js +40 -0
  679. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1203459.js +29 -0
  680. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1207276.js +36 -0
  681. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1213516.js +40 -0
  682. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1213575.js +41 -0
  683. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1215653.js +365 -0
  684. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-124.js +57 -0
  685. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1254366.js +38 -0
  686. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1327557.js +36 -0
  687. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1341167.js +33 -0
  688. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1346700.js +29 -0
  689. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-137.js +46 -0
  690. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1439135.js +40 -0
  691. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-149.js +28 -0
  692. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1493017.js +52 -0
  693. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-155924.js +46 -0
  694. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-171.js +41 -0
  695. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-176.js +50 -0
  696. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-186.js +72 -0
  697. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-187.js +30 -0
  698. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-189.js +36 -0
  699. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-191.js +42 -0
  700. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-1919169.js +40 -0
  701. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-192.js +38 -0
  702. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-193.js +44 -0
  703. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-20070207.js +42 -0
  704. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-201.js +37 -0
  705. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-219.js +176 -0
  706. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-220.js +31 -0
  707. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-221.js +34 -0
  708. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-2249423.js +40 -0
  709. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-225.js +32 -0
  710. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-227.js +33 -0
  711. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-231.js +92 -0
  712. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-233.js +39 -0
  713. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-244.js +67 -0
  714. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-246.js +31 -0
  715. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-253.js +31 -0
  716. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-254.js +58 -0
  717. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-259.js +33 -0
  718. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-260.js +33 -0
  719. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-263.js +38 -0
  720. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-265.js +64 -0
  721. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-267.js +35 -0
  722. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-269.js +49 -0
  723. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-279.js +62 -0
  724. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-284.js +50 -0
  725. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-286.js +36 -0
  726. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-294.js +43 -0
  727. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-312.js +31 -0
  728. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-317.js +31 -0
  729. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-318.js +35 -0
  730. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-326.js +40 -0
  731. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-334.js +90 -0
  732. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-341.js +36 -0
  733. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-345.js +51 -0
  734. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-349.js +32 -0
  735. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-35.js +33 -0
  736. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-351.js +31 -0
  737. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-386.js +47 -0
  738. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-392.js +34 -0
  739. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-394.js +47 -0
  740. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-396.js +39 -0
  741. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-397.js +34 -0
  742. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-399.js +32 -0
  743. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-406.js +69 -0
  744. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-416.js +38 -0
  745. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-475.js +28 -0
  746. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-483.js +35 -0
  747. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-485.js +64 -0
  748. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-486.js +30 -0
  749. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-490.js +48 -0
  750. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-491.js +47 -0
  751. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-492.js +52 -0
  752. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-496.js +39 -0
  753. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-502.js +38 -0
  754. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-503.js +63 -0
  755. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-515.js +40 -0
  756. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-524.js +32 -0
  757. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-526.js +32 -0
  758. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-540.js +47 -0
  759. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-545.js +47 -0
  760. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-57.js +32 -0
  761. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-580.js +55 -0
  762. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-588599.js +31 -0
  763. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-6-9-regexp.js +30 -0
  764. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-662254.js +40 -0
  765. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-666721.js +53 -0
  766. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-667061.js +90 -0
  767. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-670147.js +34 -0
  768. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-674753.js +87 -0
  769. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-676025.js +31 -0
  770. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-678525.js +59 -0
  771. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-682649.js +30 -0
  772. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-69.js +43 -0
  773. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-734862.js +37 -0
  774. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-737588.js +34 -0
  775. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-74.js +41 -0
  776. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-780423.js +39 -0
  777. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-799761.js +92 -0
  778. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-806473.js +60 -0
  779. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-842017.js +60 -0
  780. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-86.js +46 -0
  781. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-87.js +58 -0
  782. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-874178.js +32 -0
  783. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-875031.js +37 -0
  784. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-877615.js +37 -0
  785. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-892742.js +50 -0
  786. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-900055.js +42 -0
  787. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-900966.js +38 -0
  788. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-91.js +38 -0
  789. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-925537.js +42 -0
  790. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-937896.js +50 -0
  791. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-990205.js +35 -0
  792. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-992733.js +35 -0
  793. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-996542.js +40 -0
  794. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-998565.js +51 -0
  795. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-crbug-18639.js +34 -0
  796. data/ext/v8/upstream/2.0.6/test/mjsunit/regress/regress-r3391.js +77 -0
  797. data/ext/v8/upstream/2.0.6/test/mjsunit/scanner.js +30 -0
  798. data/ext/v8/upstream/2.0.6/test/mjsunit/short-circuit-boolean.js +46 -0
  799. data/ext/v8/upstream/2.0.6/test/mjsunit/simple-constructor.js +140 -0
  800. data/ext/v8/upstream/2.0.6/test/mjsunit/sin-cos.js +45 -0
  801. data/ext/v8/upstream/2.0.6/test/mjsunit/smi-negative-zero.js +100 -0
  802. data/ext/v8/upstream/2.0.6/test/mjsunit/smi-ops.js +671 -0
  803. data/ext/v8/upstream/2.0.6/test/mjsunit/sparse-array-reverse.js +131 -0
  804. data/ext/v8/upstream/2.0.6/test/mjsunit/sparse-array.js +41 -0
  805. data/ext/v8/upstream/2.0.6/test/mjsunit/stack-traces.js +204 -0
  806. data/ext/v8/upstream/2.0.6/test/mjsunit/str-to-num.js +158 -0
  807. data/ext/v8/upstream/2.0.6/test/mjsunit/stress-array-push.js +34 -0
  808. data/ext/v8/upstream/2.0.6/test/mjsunit/strict-equals.js +90 -0
  809. data/ext/v8/upstream/2.0.6/test/mjsunit/string-add.js +195 -0
  810. data/ext/v8/upstream/2.0.6/test/mjsunit/string-case.js +28 -0
  811. data/ext/v8/upstream/2.0.6/test/mjsunit/string-charat.js +53 -0
  812. data/ext/v8/upstream/2.0.6/test/mjsunit/string-charcodeat.js +192 -0
  813. data/ext/v8/upstream/2.0.6/test/mjsunit/string-compare-alignment.js +47 -0
  814. data/ext/v8/upstream/2.0.6/test/mjsunit/string-flatten.js +37 -0
  815. data/ext/v8/upstream/2.0.6/test/mjsunit/string-index.js +154 -0
  816. data/ext/v8/upstream/2.0.6/test/mjsunit/string-indexof-1.js +99 -0
  817. data/ext/v8/upstream/2.0.6/test/mjsunit/string-indexof-2.js +68 -0
  818. data/ext/v8/upstream/2.0.6/test/mjsunit/string-lastindexof.js +88 -0
  819. data/ext/v8/upstream/2.0.6/test/mjsunit/string-localecompare.js +40 -0
  820. data/ext/v8/upstream/2.0.6/test/mjsunit/string-match.js +149 -0
  821. data/ext/v8/upstream/2.0.6/test/mjsunit/string-replace-gc.js +57 -0
  822. data/ext/v8/upstream/2.0.6/test/mjsunit/string-replace.js +182 -0
  823. data/ext/v8/upstream/2.0.6/test/mjsunit/string-search.js +30 -0
  824. data/ext/v8/upstream/2.0.6/test/mjsunit/string-split.js +126 -0
  825. data/ext/v8/upstream/2.0.6/test/mjsunit/substr.js +65 -0
  826. data/ext/v8/upstream/2.0.6/test/mjsunit/switch.js +289 -0
  827. data/ext/v8/upstream/2.0.6/test/mjsunit/testcfg.py +137 -0
  828. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/array-isarray.js +48 -0
  829. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/array-splice-webkit.js +62 -0
  830. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/object-keys.js +68 -0
  831. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/regexp-pcre.js +6603 -0
  832. data/ext/v8/upstream/2.0.6/test/mjsunit/third_party/string-trim.js +107 -0
  833. data/ext/v8/upstream/2.0.6/test/mjsunit/this-in-callbacks.js +47 -0
  834. data/ext/v8/upstream/2.0.6/test/mjsunit/this.js +46 -0
  835. data/ext/v8/upstream/2.0.6/test/mjsunit/throw-and-catch-function.js +50 -0
  836. data/ext/v8/upstream/2.0.6/test/mjsunit/throw-exception-for-null-access.js +37 -0
  837. data/ext/v8/upstream/2.0.6/test/mjsunit/to-precision.js +82 -0
  838. data/ext/v8/upstream/2.0.6/test/mjsunit/to_number_order.js +129 -0
  839. data/ext/v8/upstream/2.0.6/test/mjsunit/tobool.js +36 -0
  840. data/ext/v8/upstream/2.0.6/test/mjsunit/toint32.js +129 -0
  841. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/codemap.js +180 -0
  842. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/consarray.js +60 -0
  843. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/csvparser.js +79 -0
  844. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/logreader.js +98 -0
  845. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/profile.js +348 -0
  846. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/profile_view.js +95 -0
  847. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/splaytree.js +166 -0
  848. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.default +55 -0
  849. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.gc-state +21 -0
  850. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.ignore-unknown +51 -0
  851. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor-test.separate-ic +61 -0
  852. data/ext/v8/upstream/2.0.6/test/mjsunit/tools/tickprocessor.js +409 -0
  853. data/ext/v8/upstream/2.0.6/test/mjsunit/top-level-assignments.js +107 -0
  854. data/ext/v8/upstream/2.0.6/test/mjsunit/touint32.js +72 -0
  855. data/ext/v8/upstream/2.0.6/test/mjsunit/transcendentals.js +49 -0
  856. data/ext/v8/upstream/2.0.6/test/mjsunit/try-catch-extension-object.js +58 -0
  857. data/ext/v8/upstream/2.0.6/test/mjsunit/try-catch-scopes.js +42 -0
  858. data/ext/v8/upstream/2.0.6/test/mjsunit/try-finally-nested.js +46 -0
  859. data/ext/v8/upstream/2.0.6/test/mjsunit/try.js +394 -0
  860. data/ext/v8/upstream/2.0.6/test/mjsunit/typeof.js +40 -0
  861. data/ext/v8/upstream/2.0.6/test/mjsunit/undeletable-functions.js +181 -0
  862. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-case-overoptimization.js +35 -0
  863. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-string-to-number.js +46 -0
  864. data/ext/v8/upstream/2.0.6/test/mjsunit/unicode-test.js +9169 -0
  865. data/ext/v8/upstream/2.0.6/test/mjsunit/unusual-constructor.js +38 -0
  866. data/ext/v8/upstream/2.0.6/test/mjsunit/uri.js +78 -0
  867. data/ext/v8/upstream/2.0.6/test/mjsunit/value-callic-prototype-change.js +94 -0
  868. data/ext/v8/upstream/2.0.6/test/mjsunit/var.js +37 -0
  869. data/ext/v8/upstream/2.0.6/test/mjsunit/with-function-expression.js +36 -0
  870. data/ext/v8/upstream/2.0.6/test/mjsunit/with-leave.js +61 -0
  871. data/ext/v8/upstream/2.0.6/test/mjsunit/with-parameter-access.js +47 -0
  872. data/ext/v8/upstream/2.0.6/test/mjsunit/with-prototype.js +44 -0
  873. data/ext/v8/upstream/2.0.6/test/mjsunit/with-value.js +38 -0
  874. data/ext/v8/upstream/2.0.6/test/mozilla/mozilla-shell-emulation.js +37 -0
  875. data/ext/v8/upstream/2.0.6/test/mozilla/mozilla.status +815 -0
  876. data/ext/v8/upstream/2.0.6/test/mozilla/testcfg.py +138 -0
  877. data/ext/v8/upstream/2.0.6/test/sputnik/README +6 -0
  878. data/ext/v8/upstream/2.0.6/test/sputnik/sputnik.status +318 -0
  879. data/ext/v8/upstream/2.0.6/test/sputnik/testcfg.py +112 -0
  880. data/ext/v8/upstream/2.0.6/tools/codemap.js +258 -0
  881. data/ext/v8/upstream/2.0.6/tools/consarray.js +93 -0
  882. data/ext/v8/upstream/2.0.6/tools/csvparser.js +98 -0
  883. data/ext/v8/upstream/2.0.6/tools/gyp/v8.gyp +620 -0
  884. data/ext/v8/upstream/2.0.6/tools/js2c.py +376 -0
  885. data/ext/v8/upstream/2.0.6/tools/js2c.pyc +0 -0
  886. data/ext/v8/upstream/2.0.6/tools/jsmin.py +280 -0
  887. data/ext/v8/upstream/2.0.6/tools/jsmin.pyc +0 -0
  888. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor +24 -0
  889. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor.py +78 -0
  890. data/ext/v8/upstream/2.0.6/tools/logreader.js +320 -0
  891. data/ext/v8/upstream/2.0.6/tools/mac-nm +18 -0
  892. data/ext/v8/upstream/2.0.6/tools/mac-tick-processor +6 -0
  893. data/ext/v8/upstream/2.0.6/tools/oprofile/annotate +7 -0
  894. data/ext/v8/upstream/2.0.6/tools/oprofile/common +19 -0
  895. data/ext/v8/upstream/2.0.6/tools/oprofile/dump +7 -0
  896. data/ext/v8/upstream/2.0.6/tools/oprofile/report +7 -0
  897. data/ext/v8/upstream/2.0.6/tools/oprofile/reset +7 -0
  898. data/ext/v8/upstream/2.0.6/tools/oprofile/run +14 -0
  899. data/ext/v8/upstream/2.0.6/tools/oprofile/shutdown +7 -0
  900. data/ext/v8/upstream/2.0.6/tools/oprofile/start +7 -0
  901. data/ext/v8/upstream/2.0.6/tools/presubmit.py +299 -0
  902. data/ext/v8/upstream/2.0.6/tools/process-heap-prof.py +120 -0
  903. data/ext/v8/upstream/2.0.6/tools/profile.js +621 -0
  904. data/ext/v8/upstream/2.0.6/tools/profile_view.js +224 -0
  905. data/ext/v8/upstream/2.0.6/tools/run-valgrind.py +77 -0
  906. data/ext/v8/upstream/2.0.6/tools/splaytree.js +322 -0
  907. data/ext/v8/upstream/2.0.6/tools/splaytree.py +226 -0
  908. data/ext/v8/upstream/2.0.6/tools/stats-viewer.py +456 -0
  909. data/ext/v8/upstream/2.0.6/tools/test.py +1370 -0
  910. data/ext/v8/upstream/2.0.6/tools/tickprocessor-driver.js +53 -0
  911. data/ext/v8/upstream/2.0.6/tools/tickprocessor.js +731 -0
  912. data/ext/v8/upstream/2.0.6/tools/tickprocessor.py +535 -0
  913. data/ext/v8/upstream/2.0.6/tools/utils.py +82 -0
  914. data/ext/v8/upstream/2.0.6/tools/utils.pyc +0 -0
  915. data/ext/v8/upstream/2.0.6/tools/visual_studio/README.txt +71 -0
  916. data/ext/v8/upstream/2.0.6/tools/visual_studio/arm.vsprops +14 -0
  917. data/ext/v8/upstream/2.0.6/tools/visual_studio/common.vsprops +35 -0
  918. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8.vcproj +199 -0
  919. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_arm.vcproj +199 -0
  920. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_x64.vcproj +201 -0
  921. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8js2c.cmd +6 -0
  922. data/ext/v8/upstream/2.0.6/tools/visual_studio/debug.vsprops +17 -0
  923. data/ext/v8/upstream/2.0.6/tools/visual_studio/ia32.vsprops +13 -0
  924. data/ext/v8/upstream/2.0.6/tools/visual_studio/js2c.cmd +6 -0
  925. data/ext/v8/upstream/2.0.6/tools/visual_studio/release.vsprops +24 -0
  926. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.sln +101 -0
  927. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.vcproj +223 -0
  928. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.sln +74 -0
  929. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.vcproj +223 -0
  930. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base.vcproj +971 -0
  931. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_arm.vcproj +983 -0
  932. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_x64.vcproj +959 -0
  933. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest.vcproj +255 -0
  934. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_arm.vcproj +243 -0
  935. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_x64.vcproj +257 -0
  936. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot.vcproj +151 -0
  937. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot_x64.vcproj +151 -0
  938. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample.vcproj +151 -0
  939. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_arm.vcproj +151 -0
  940. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_x64.vcproj +151 -0
  941. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample.vcproj +151 -0
  942. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_arm.vcproj +151 -0
  943. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_x64.vcproj +153 -0
  944. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot.vcproj +142 -0
  945. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc.vcproj +92 -0
  946. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc_x64.vcproj +92 -0
  947. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_x64.vcproj +142 -0
  948. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.sln +101 -0
  949. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.vcproj +223 -0
  950. data/ext/v8/upstream/2.0.6/tools/visual_studio/x64.vsprops +13 -0
  951. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +5 -0
  952. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.py +137 -0
  953. data/ext/v8/upstream/scons/CHANGES.txt +5183 -0
  954. data/ext/v8/upstream/scons/LICENSE.txt +20 -0
  955. data/ext/v8/upstream/scons/MANIFEST +202 -0
  956. data/ext/v8/upstream/scons/PKG-INFO +13 -0
  957. data/ext/v8/upstream/scons/README.txt +273 -0
  958. data/ext/v8/upstream/scons/RELEASE.txt +1040 -0
  959. data/ext/v8/upstream/scons/engine/SCons/Action.py +1256 -0
  960. data/ext/v8/upstream/scons/engine/SCons/Builder.py +868 -0
  961. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +217 -0
  962. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +794 -0
  963. data/ext/v8/upstream/scons/engine/SCons/Debug.py +237 -0
  964. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +485 -0
  965. data/ext/v8/upstream/scons/engine/SCons/Environment.py +2327 -0
  966. data/ext/v8/upstream/scons/engine/SCons/Errors.py +207 -0
  967. data/ext/v8/upstream/scons/engine/SCons/Executor.py +636 -0
  968. data/ext/v8/upstream/scons/engine/SCons/Job.py +435 -0
  969. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +292 -0
  970. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +153 -0
  971. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +3220 -0
  972. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +128 -0
  973. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +1341 -0
  974. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +50 -0
  975. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +50 -0
  976. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +50 -0
  977. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +50 -0
  978. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +76 -0
  979. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +74 -0
  980. data/ext/v8/upstream/scons/engine/SCons/PathList.py +232 -0
  981. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +236 -0
  982. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +70 -0
  983. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +55 -0
  984. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +46 -0
  985. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +46 -0
  986. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +44 -0
  987. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +58 -0
  988. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +264 -0
  989. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +50 -0
  990. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +386 -0
  991. data/ext/v8/upstream/scons/engine/SCons/SConf.py +1038 -0
  992. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +381 -0
  993. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +132 -0
  994. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +74 -0
  995. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +111 -0
  996. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +320 -0
  997. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +48 -0
  998. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +378 -0
  999. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +103 -0
  1000. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +55 -0
  1001. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +415 -0
  1002. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +386 -0
  1003. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +1360 -0
  1004. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +944 -0
  1005. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +642 -0
  1006. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +414 -0
  1007. data/ext/v8/upstream/scons/engine/SCons/Sig.py +63 -0
  1008. data/ext/v8/upstream/scons/engine/SCons/Subst.py +911 -0
  1009. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +1030 -0
  1010. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +61 -0
  1011. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +65 -0
  1012. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +73 -0
  1013. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +247 -0
  1014. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +324 -0
  1015. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  1016. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  1017. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +210 -0
  1018. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +84 -0
  1019. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +321 -0
  1020. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +367 -0
  1021. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +497 -0
  1022. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +104 -0
  1023. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +138 -0
  1024. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +64 -0
  1025. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +64 -0
  1026. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +71 -0
  1027. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +675 -0
  1028. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +82 -0
  1029. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +74 -0
  1030. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +80 -0
  1031. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +76 -0
  1032. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +71 -0
  1033. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +63 -0
  1034. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +78 -0
  1035. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +82 -0
  1036. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +99 -0
  1037. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +114 -0
  1038. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +58 -0
  1039. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +50 -0
  1040. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +224 -0
  1041. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +64 -0
  1042. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +125 -0
  1043. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +94 -0
  1044. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +62 -0
  1045. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +62 -0
  1046. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +63 -0
  1047. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +98 -0
  1048. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +63 -0
  1049. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +90 -0
  1050. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +73 -0
  1051. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +53 -0
  1052. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +80 -0
  1053. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +64 -0
  1054. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +63 -0
  1055. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +81 -0
  1056. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +85 -0
  1057. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +53 -0
  1058. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +77 -0
  1059. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +59 -0
  1060. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +52 -0
  1061. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +72 -0
  1062. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +90 -0
  1063. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +59 -0
  1064. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +60 -0
  1065. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +229 -0
  1066. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +490 -0
  1067. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +71 -0
  1068. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +110 -0
  1069. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +234 -0
  1070. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +138 -0
  1071. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +79 -0
  1072. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +99 -0
  1073. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +121 -0
  1074. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +112 -0
  1075. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +63 -0
  1076. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +77 -0
  1077. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +90 -0
  1078. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +159 -0
  1079. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +64 -0
  1080. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +266 -0
  1081. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +50 -0
  1082. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +269 -0
  1083. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +1439 -0
  1084. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +208 -0
  1085. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +107 -0
  1086. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +72 -0
  1087. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +314 -0
  1088. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  1089. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +526 -0
  1090. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +367 -0
  1091. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  1092. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  1093. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  1094. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  1095. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  1096. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  1097. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +78 -0
  1098. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +83 -0
  1099. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +108 -0
  1100. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +336 -0
  1101. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +121 -0
  1102. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +70 -0
  1103. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +132 -0
  1104. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +68 -0
  1105. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +58 -0
  1106. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +53 -0
  1107. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +63 -0
  1108. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +67 -0
  1109. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +142 -0
  1110. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +58 -0
  1111. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +63 -0
  1112. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +64 -0
  1113. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +64 -0
  1114. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +77 -0
  1115. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +186 -0
  1116. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +73 -0
  1117. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +805 -0
  1118. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +175 -0
  1119. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +53 -0
  1120. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +100 -0
  1121. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +131 -0
  1122. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +100 -0
  1123. data/ext/v8/upstream/scons/engine/SCons/Util.py +1645 -0
  1124. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +91 -0
  1125. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +107 -0
  1126. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +139 -0
  1127. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +109 -0
  1128. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +147 -0
  1129. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +317 -0
  1130. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +228 -0
  1131. data/ext/v8/upstream/scons/engine/SCons/__init__.py +49 -0
  1132. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +302 -0
  1133. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +98 -0
  1134. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +91 -0
  1135. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +124 -0
  1136. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +1725 -0
  1137. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +583 -0
  1138. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +176 -0
  1139. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +325 -0
  1140. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +1296 -0
  1141. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +382 -0
  1142. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +187 -0
  1143. data/ext/v8/upstream/scons/engine/SCons/cpp.py +598 -0
  1144. data/ext/v8/upstream/scons/engine/SCons/dblite.py +248 -0
  1145. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +77 -0
  1146. data/ext/v8/upstream/scons/os_spawnv_fix.diff +83 -0
  1147. data/ext/v8/upstream/scons/scons-time.1 +1017 -0
  1148. data/ext/v8/upstream/scons/scons.1 +15179 -0
  1149. data/ext/v8/upstream/scons/sconsign.1 +208 -0
  1150. data/ext/v8/upstream/scons/script/scons +184 -0
  1151. data/ext/v8/upstream/scons/script/scons-time +1529 -0
  1152. data/ext/v8/upstream/scons/script/scons.bat +31 -0
  1153. data/ext/v8/upstream/scons/script/sconsign +508 -0
  1154. data/ext/v8/upstream/scons/setup.cfg +6 -0
  1155. data/ext/v8/upstream/scons/setup.py +427 -0
  1156. data/ext/v8/v8.cpp +81 -0
  1157. data/ext/v8/v8_cxt.cpp +92 -0
  1158. data/ext/v8/v8_cxt.h +20 -0
  1159. data/ext/v8/v8_func.cpp +10 -0
  1160. data/ext/v8/v8_func.h +11 -0
  1161. data/ext/v8/v8_msg.cpp +17 -0
  1162. data/ext/v8/v8_msg.h +10 -0
  1163. data/ext/v8/v8_obj.cpp +52 -0
  1164. data/ext/v8/v8_obj.h +13 -0
  1165. data/ext/v8/v8_ref.cpp +26 -0
  1166. data/ext/v8/v8_ref.h +31 -0
  1167. data/ext/v8/v8_script.cpp +20 -0
  1168. data/ext/v8/v8_script.h +8 -0
  1169. data/ext/v8/v8_standalone.cpp +69 -0
  1170. data/ext/v8/v8_standalone.h +31 -0
  1171. data/ext/v8/v8_str.cpp +17 -0
  1172. data/ext/v8/v8_str.h +9 -0
  1173. data/ext/v8/v8_template.cpp +53 -0
  1174. data/ext/v8/v8_template.h +13 -0
  1175. data/lib/v8.rb +10 -0
  1176. data/lib/v8/context.rb +87 -0
  1177. data/lib/v8/object.rb +38 -0
  1178. data/lib/v8/to.rb +33 -0
  1179. data/lib/v8/v8.bundle +0 -0
  1180. data/script/console +10 -0
  1181. data/script/destroy +14 -0
  1182. data/script/generate +14 -0
  1183. data/spec/ext/cxt_spec.rb +25 -0
  1184. data/spec/ext/obj_spec.rb +13 -0
  1185. data/spec/redjs/README.txt +8 -0
  1186. data/spec/redjs/jsapi_spec.rb +394 -0
  1187. data/spec/redjs/tap.rb +8 -0
  1188. data/spec/redjs_helper.rb +3 -0
  1189. data/spec/spec.opts +1 -0
  1190. data/spec/spec_helper.rb +14 -0
  1191. data/spec/v8/to_spec.rb +15 -0
  1192. data/tasks/rspec.rake +21 -0
  1193. data/therubyracer.gemspec +34 -0
  1194. metadata +1269 -0
@@ -0,0 +1,3831 @@
1
+ // Copyright 2009 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 "compiler.h"
34
+ #include "debug.h"
35
+ #include "execution.h"
36
+ #include "global-handles.h"
37
+ #include "platform.h"
38
+ #include "serialize.h"
39
+ #include "snapshot.h"
40
+ #include "utils.h"
41
+ #include "v8threads.h"
42
+ #include "version.h"
43
+
44
+
45
+ #define LOG_API(expr) LOG(ApiEntryCall(expr))
46
+
47
+ #ifdef ENABLE_HEAP_PROTECTION
48
+ #define ENTER_V8 i::VMState __state__(i::OTHER)
49
+ #define LEAVE_V8 i::VMState __state__(i::EXTERNAL)
50
+ #else
51
+ #define ENTER_V8 ((void) 0)
52
+ #define LEAVE_V8 ((void) 0)
53
+ #endif
54
+
55
+ namespace v8 {
56
+
57
+
58
+ #define ON_BAILOUT(location, code) \
59
+ if (IsDeadCheck(location)) { \
60
+ code; \
61
+ UNREACHABLE(); \
62
+ }
63
+
64
+
65
+ #define EXCEPTION_PREAMBLE() \
66
+ thread_local.IncrementCallDepth(); \
67
+ ASSERT(!i::Top::external_caught_exception()); \
68
+ bool has_pending_exception = false
69
+
70
+
71
+ #define EXCEPTION_BAILOUT_CHECK(value) \
72
+ do { \
73
+ thread_local.DecrementCallDepth(); \
74
+ if (has_pending_exception) { \
75
+ if (thread_local.CallDepthIsZero() && i::Top::is_out_of_memory()) { \
76
+ if (!thread_local.ignore_out_of_memory()) \
77
+ i::V8::FatalProcessOutOfMemory(NULL); \
78
+ } \
79
+ bool call_depth_is_zero = thread_local.CallDepthIsZero(); \
80
+ i::Top::OptionalRescheduleException(call_depth_is_zero); \
81
+ return value; \
82
+ } \
83
+ } while (false)
84
+
85
+
86
+ #define API_ENTRY_CHECK(msg) \
87
+ do { \
88
+ if (v8::Locker::IsActive()) { \
89
+ ApiCheck(i::ThreadManager::IsLockedByCurrentThread(), \
90
+ msg, \
91
+ "Entering the V8 API without proper locking in place"); \
92
+ } \
93
+ } while (false)
94
+
95
+ // --- D a t a t h a t i s s p e c i f i c t o a t h r e a d ---
96
+
97
+
98
+ static i::HandleScopeImplementer thread_local;
99
+
100
+
101
+ // --- E x c e p t i o n B e h a v i o r ---
102
+
103
+
104
+ static FatalErrorCallback exception_behavior = NULL;
105
+ int i::Internals::kJSObjectType = JS_OBJECT_TYPE;
106
+ int i::Internals::kFirstNonstringType = FIRST_NONSTRING_TYPE;
107
+ int i::Internals::kProxyType = PROXY_TYPE;
108
+
109
+ static void DefaultFatalErrorHandler(const char* location,
110
+ const char* message) {
111
+ ENTER_V8;
112
+ API_Fatal(location, message);
113
+ }
114
+
115
+
116
+
117
+ static FatalErrorCallback& GetFatalErrorHandler() {
118
+ if (exception_behavior == NULL) {
119
+ exception_behavior = DefaultFatalErrorHandler;
120
+ }
121
+ return exception_behavior;
122
+ }
123
+
124
+
125
+
126
+ // When V8 cannot allocated memory FatalProcessOutOfMemory is called.
127
+ // The default fatal error handler is called and execution is stopped.
128
+ void i::V8::FatalProcessOutOfMemory(const char* location) {
129
+ i::HeapStats heap_stats;
130
+ int start_marker;
131
+ heap_stats.start_marker = &start_marker;
132
+ int new_space_size;
133
+ heap_stats.new_space_size = &new_space_size;
134
+ int new_space_capacity;
135
+ heap_stats.new_space_capacity = &new_space_capacity;
136
+ int old_pointer_space_size;
137
+ heap_stats.old_pointer_space_size = &old_pointer_space_size;
138
+ int old_pointer_space_capacity;
139
+ heap_stats.old_pointer_space_capacity = &old_pointer_space_capacity;
140
+ int old_data_space_size;
141
+ heap_stats.old_data_space_size = &old_data_space_size;
142
+ int old_data_space_capacity;
143
+ heap_stats.old_data_space_capacity = &old_data_space_capacity;
144
+ int code_space_size;
145
+ heap_stats.code_space_size = &code_space_size;
146
+ int code_space_capacity;
147
+ heap_stats.code_space_capacity = &code_space_capacity;
148
+ int map_space_size;
149
+ heap_stats.map_space_size = &map_space_size;
150
+ int map_space_capacity;
151
+ heap_stats.map_space_capacity = &map_space_capacity;
152
+ int cell_space_size;
153
+ heap_stats.cell_space_size = &cell_space_size;
154
+ int cell_space_capacity;
155
+ heap_stats.cell_space_capacity = &cell_space_capacity;
156
+ int lo_space_size;
157
+ heap_stats.lo_space_size = &lo_space_size;
158
+ int global_handle_count;
159
+ heap_stats.global_handle_count = &global_handle_count;
160
+ int weak_global_handle_count;
161
+ heap_stats.weak_global_handle_count = &weak_global_handle_count;
162
+ int pending_global_handle_count;
163
+ heap_stats.pending_global_handle_count = &pending_global_handle_count;
164
+ int near_death_global_handle_count;
165
+ heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
166
+ int destroyed_global_handle_count;
167
+ heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count;
168
+ int end_marker;
169
+ heap_stats.end_marker = &end_marker;
170
+ i::Heap::RecordStats(&heap_stats);
171
+ i::V8::SetFatalError();
172
+ FatalErrorCallback callback = GetFatalErrorHandler();
173
+ {
174
+ LEAVE_V8;
175
+ callback(location, "Allocation failed - process out of memory");
176
+ }
177
+ // If the callback returns, we stop execution.
178
+ UNREACHABLE();
179
+ }
180
+
181
+
182
+ void V8::SetFatalErrorHandler(FatalErrorCallback that) {
183
+ exception_behavior = that;
184
+ }
185
+
186
+
187
+ bool Utils::ReportApiFailure(const char* location, const char* message) {
188
+ FatalErrorCallback callback = GetFatalErrorHandler();
189
+ callback(location, message);
190
+ i::V8::SetFatalError();
191
+ return false;
192
+ }
193
+
194
+
195
+ bool V8::IsDead() {
196
+ return i::V8::IsDead();
197
+ }
198
+
199
+
200
+ static inline bool ApiCheck(bool condition,
201
+ const char* location,
202
+ const char* message) {
203
+ return condition ? true : Utils::ReportApiFailure(location, message);
204
+ }
205
+
206
+
207
+ static bool ReportV8Dead(const char* location) {
208
+ FatalErrorCallback callback = GetFatalErrorHandler();
209
+ callback(location, "V8 is no longer usable");
210
+ return true;
211
+ }
212
+
213
+
214
+ static bool ReportEmptyHandle(const char* location) {
215
+ FatalErrorCallback callback = GetFatalErrorHandler();
216
+ callback(location, "Reading from empty handle");
217
+ return true;
218
+ }
219
+
220
+
221
+ /**
222
+ * IsDeadCheck checks that the vm is usable. If, for instance, the vm has been
223
+ * out of memory at some point this check will fail. It should be called on
224
+ * entry to all methods that touch anything in the heap, except destructors
225
+ * which you sometimes can't avoid calling after the vm has crashed. Functions
226
+ * that call EnsureInitialized or ON_BAILOUT don't have to also call
227
+ * IsDeadCheck. ON_BAILOUT has the advantage over EnsureInitialized that you
228
+ * can arrange to return if the VM is dead. This is needed to ensure that no VM
229
+ * heap allocations are attempted on a dead VM. EnsureInitialized has the
230
+ * advantage over ON_BAILOUT that it actually initializes the VM if this has not
231
+ * yet been done.
232
+ */
233
+ static inline bool IsDeadCheck(const char* location) {
234
+ return !i::V8::IsRunning()
235
+ && i::V8::IsDead() ? ReportV8Dead(location) : false;
236
+ }
237
+
238
+
239
+ static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) {
240
+ return obj.IsEmpty() ? ReportEmptyHandle(location) : false;
241
+ }
242
+
243
+
244
+ static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
245
+ return (obj == 0) ? ReportEmptyHandle(location) : false;
246
+ }
247
+
248
+ // --- S t a t i c s ---
249
+
250
+
251
+ static i::StringInputBuffer write_input_buffer;
252
+
253
+
254
+ static inline bool EnsureInitialized(const char* location) {
255
+ if (i::V8::IsRunning()) {
256
+ return true;
257
+ }
258
+ if (IsDeadCheck(location)) {
259
+ return false;
260
+ }
261
+ return ApiCheck(v8::V8::Initialize(), location, "Error initializing V8");
262
+ }
263
+
264
+
265
+ ImplementationUtilities::HandleScopeData*
266
+ ImplementationUtilities::CurrentHandleScope() {
267
+ return &i::HandleScope::current_;
268
+ }
269
+
270
+
271
+ #ifdef DEBUG
272
+ void ImplementationUtilities::ZapHandleRange(i::Object** begin,
273
+ i::Object** end) {
274
+ i::HandleScope::ZapRange(begin, end);
275
+ }
276
+ #endif
277
+
278
+
279
+ v8::Handle<v8::Primitive> ImplementationUtilities::Undefined() {
280
+ if (!EnsureInitialized("v8::Undefined()")) return v8::Handle<v8::Primitive>();
281
+ return v8::Handle<Primitive>(ToApi<Primitive>(i::Factory::undefined_value()));
282
+ }
283
+
284
+
285
+ v8::Handle<v8::Primitive> ImplementationUtilities::Null() {
286
+ if (!EnsureInitialized("v8::Null()")) return v8::Handle<v8::Primitive>();
287
+ return v8::Handle<Primitive>(ToApi<Primitive>(i::Factory::null_value()));
288
+ }
289
+
290
+
291
+ v8::Handle<v8::Boolean> ImplementationUtilities::True() {
292
+ if (!EnsureInitialized("v8::True()")) return v8::Handle<v8::Boolean>();
293
+ return v8::Handle<v8::Boolean>(ToApi<Boolean>(i::Factory::true_value()));
294
+ }
295
+
296
+
297
+ v8::Handle<v8::Boolean> ImplementationUtilities::False() {
298
+ if (!EnsureInitialized("v8::False()")) return v8::Handle<v8::Boolean>();
299
+ return v8::Handle<v8::Boolean>(ToApi<Boolean>(i::Factory::false_value()));
300
+ }
301
+
302
+
303
+ void V8::SetFlagsFromString(const char* str, int length) {
304
+ i::FlagList::SetFlagsFromString(str, length);
305
+ }
306
+
307
+
308
+ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
309
+ i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
310
+ }
311
+
312
+
313
+ v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
314
+ if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>();
315
+ ENTER_V8;
316
+ // If we're passed an empty handle, we throw an undefined exception
317
+ // to deal more gracefully with out of memory situations.
318
+ if (value.IsEmpty()) {
319
+ i::Top::ScheduleThrow(i::Heap::undefined_value());
320
+ } else {
321
+ i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
322
+ }
323
+ return v8::Undefined();
324
+ }
325
+
326
+
327
+ RegisteredExtension* RegisteredExtension::first_extension_ = NULL;
328
+
329
+
330
+ RegisteredExtension::RegisteredExtension(Extension* extension)
331
+ : extension_(extension), state_(UNVISITED) { }
332
+
333
+
334
+ void RegisteredExtension::Register(RegisteredExtension* that) {
335
+ that->next_ = RegisteredExtension::first_extension_;
336
+ RegisteredExtension::first_extension_ = that;
337
+ }
338
+
339
+
340
+ void RegisterExtension(Extension* that) {
341
+ RegisteredExtension* extension = new RegisteredExtension(that);
342
+ RegisteredExtension::Register(extension);
343
+ }
344
+
345
+
346
+ Extension::Extension(const char* name,
347
+ const char* source,
348
+ int dep_count,
349
+ const char** deps)
350
+ : name_(name),
351
+ source_(source),
352
+ dep_count_(dep_count),
353
+ deps_(deps),
354
+ auto_enable_(false) { }
355
+
356
+
357
+ v8::Handle<Primitive> Undefined() {
358
+ LOG_API("Undefined");
359
+ return ImplementationUtilities::Undefined();
360
+ }
361
+
362
+
363
+ v8::Handle<Primitive> Null() {
364
+ LOG_API("Null");
365
+ return ImplementationUtilities::Null();
366
+ }
367
+
368
+
369
+ v8::Handle<Boolean> True() {
370
+ LOG_API("True");
371
+ return ImplementationUtilities::True();
372
+ }
373
+
374
+
375
+ v8::Handle<Boolean> False() {
376
+ LOG_API("False");
377
+ return ImplementationUtilities::False();
378
+ }
379
+
380
+
381
+ ResourceConstraints::ResourceConstraints()
382
+ : max_young_space_size_(0),
383
+ max_old_space_size_(0),
384
+ stack_limit_(NULL) { }
385
+
386
+
387
+ bool SetResourceConstraints(ResourceConstraints* constraints) {
388
+ int young_space_size = constraints->max_young_space_size();
389
+ int old_gen_size = constraints->max_old_space_size();
390
+ if (young_space_size != 0 || old_gen_size != 0) {
391
+ bool result = i::Heap::ConfigureHeap(young_space_size / 2, old_gen_size);
392
+ if (!result) return false;
393
+ }
394
+ if (constraints->stack_limit() != NULL) {
395
+ uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
396
+ i::StackGuard::SetStackLimit(limit);
397
+ }
398
+ return true;
399
+ }
400
+
401
+
402
+ i::Object** V8::GlobalizeReference(i::Object** obj) {
403
+ if (IsDeadCheck("V8::Persistent::New")) return NULL;
404
+ LOG_API("Persistent::New");
405
+ i::Handle<i::Object> result =
406
+ i::GlobalHandles::Create(*obj);
407
+ return result.location();
408
+ }
409
+
410
+
411
+ void V8::MakeWeak(i::Object** object, void* parameters,
412
+ WeakReferenceCallback callback) {
413
+ LOG_API("MakeWeak");
414
+ i::GlobalHandles::MakeWeak(object, parameters, callback);
415
+ }
416
+
417
+
418
+ void V8::ClearWeak(i::Object** obj) {
419
+ LOG_API("ClearWeak");
420
+ i::GlobalHandles::ClearWeakness(obj);
421
+ }
422
+
423
+
424
+ bool V8::IsGlobalNearDeath(i::Object** obj) {
425
+ LOG_API("IsGlobalNearDeath");
426
+ if (!i::V8::IsRunning()) return false;
427
+ return i::GlobalHandles::IsNearDeath(obj);
428
+ }
429
+
430
+
431
+ bool V8::IsGlobalWeak(i::Object** obj) {
432
+ LOG_API("IsGlobalWeak");
433
+ if (!i::V8::IsRunning()) return false;
434
+ return i::GlobalHandles::IsWeak(obj);
435
+ }
436
+
437
+
438
+ void V8::DisposeGlobal(i::Object** obj) {
439
+ LOG_API("DisposeGlobal");
440
+ if (!i::V8::IsRunning()) return;
441
+ if ((*obj)->IsGlobalContext()) i::Heap::NotifyContextDisposed();
442
+ i::GlobalHandles::Destroy(obj);
443
+ }
444
+
445
+ // --- H a n d l e s ---
446
+
447
+
448
+ HandleScope::HandleScope() : is_closed_(false) {
449
+ API_ENTRY_CHECK("HandleScope::HandleScope");
450
+ i::HandleScope::Enter(&previous_);
451
+ }
452
+
453
+
454
+ HandleScope::~HandleScope() {
455
+ if (!is_closed_) {
456
+ i::HandleScope::Leave(&previous_);
457
+ }
458
+ }
459
+
460
+
461
+ int HandleScope::NumberOfHandles() {
462
+ return i::HandleScope::NumberOfHandles();
463
+ }
464
+
465
+
466
+ i::Object** v8::HandleScope::CreateHandle(i::Object* value) {
467
+ return i::HandleScope::CreateHandle(value);
468
+ }
469
+
470
+
471
+ void Context::Enter() {
472
+ if (IsDeadCheck("v8::Context::Enter()")) return;
473
+ ENTER_V8;
474
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
475
+ thread_local.EnterContext(env);
476
+
477
+ thread_local.SaveContext(i::Top::context());
478
+ i::Top::set_context(*env);
479
+ }
480
+
481
+
482
+ void Context::Exit() {
483
+ if (!i::V8::IsRunning()) return;
484
+ if (!ApiCheck(thread_local.LeaveLastContext(),
485
+ "v8::Context::Exit()",
486
+ "Cannot exit non-entered context")) {
487
+ return;
488
+ }
489
+
490
+ // Content of 'last_context' could be NULL.
491
+ i::Context* last_context = thread_local.RestoreContext();
492
+ i::Top::set_context(last_context);
493
+ }
494
+
495
+
496
+ void Context::SetData(v8::Handle<String> data) {
497
+ if (IsDeadCheck("v8::Context::SetData()")) return;
498
+ ENTER_V8;
499
+ {
500
+ HandleScope scope;
501
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
502
+ i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
503
+ ASSERT(env->IsGlobalContext());
504
+ if (env->IsGlobalContext()) {
505
+ env->set_data(*raw_data);
506
+ }
507
+ }
508
+ }
509
+
510
+
511
+ v8::Local<v8::Value> Context::GetData() {
512
+ if (IsDeadCheck("v8::Context::GetData()")) return v8::Local<Value>();
513
+ ENTER_V8;
514
+ i::Object* raw_result = NULL;
515
+ {
516
+ HandleScope scope;
517
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
518
+ ASSERT(env->IsGlobalContext());
519
+ if (env->IsGlobalContext()) {
520
+ raw_result = env->data();
521
+ } else {
522
+ return Local<Value>();
523
+ }
524
+ }
525
+ i::Handle<i::Object> result(raw_result);
526
+ return Utils::ToLocal(result);
527
+ }
528
+
529
+
530
+ i::Object** v8::HandleScope::RawClose(i::Object** value) {
531
+ if (!ApiCheck(!is_closed_,
532
+ "v8::HandleScope::Close()",
533
+ "Local scope has already been closed")) {
534
+ return 0;
535
+ }
536
+ LOG_API("CloseHandleScope");
537
+
538
+ // Read the result before popping the handle block.
539
+ i::Object* result = *value;
540
+ is_closed_ = true;
541
+ i::HandleScope::Leave(&previous_);
542
+
543
+ // Allocate a new handle on the previous handle block.
544
+ i::Handle<i::Object> handle(result);
545
+ return handle.location();
546
+ }
547
+
548
+
549
+ // --- N e a n d e r ---
550
+
551
+
552
+ // A constructor cannot easily return an error value, therefore it is necessary
553
+ // to check for a dead VM with ON_BAILOUT before constructing any Neander
554
+ // objects. To remind you about this there is no HandleScope in the
555
+ // NeanderObject constructor. When you add one to the site calling the
556
+ // constructor you should check that you ensured the VM was not dead first.
557
+ NeanderObject::NeanderObject(int size) {
558
+ EnsureInitialized("v8::Nowhere");
559
+ ENTER_V8;
560
+ value_ = i::Factory::NewNeanderObject();
561
+ i::Handle<i::FixedArray> elements = i::Factory::NewFixedArray(size);
562
+ value_->set_elements(*elements);
563
+ }
564
+
565
+
566
+ int NeanderObject::size() {
567
+ return i::FixedArray::cast(value_->elements())->length();
568
+ }
569
+
570
+
571
+ NeanderArray::NeanderArray() : obj_(2) {
572
+ obj_.set(0, i::Smi::FromInt(0));
573
+ }
574
+
575
+
576
+ int NeanderArray::length() {
577
+ return i::Smi::cast(obj_.get(0))->value();
578
+ }
579
+
580
+
581
+ i::Object* NeanderArray::get(int offset) {
582
+ ASSERT(0 <= offset);
583
+ ASSERT(offset < length());
584
+ return obj_.get(offset + 1);
585
+ }
586
+
587
+
588
+ // This method cannot easily return an error value, therefore it is necessary
589
+ // to check for a dead VM with ON_BAILOUT before calling it. To remind you
590
+ // about this there is no HandleScope in this method. When you add one to the
591
+ // site calling this method you should check that you ensured the VM was not
592
+ // dead first.
593
+ void NeanderArray::add(i::Handle<i::Object> value) {
594
+ int length = this->length();
595
+ int size = obj_.size();
596
+ if (length == size - 1) {
597
+ i::Handle<i::FixedArray> new_elms = i::Factory::NewFixedArray(2 * size);
598
+ for (int i = 0; i < length; i++)
599
+ new_elms->set(i + 1, get(i));
600
+ obj_.value()->set_elements(*new_elms);
601
+ }
602
+ obj_.set(length + 1, *value);
603
+ obj_.set(0, i::Smi::FromInt(length + 1));
604
+ }
605
+
606
+
607
+ void NeanderArray::set(int index, i::Object* value) {
608
+ if (index < 0 || index >= this->length()) return;
609
+ obj_.set(index + 1, value);
610
+ }
611
+
612
+
613
+ // --- T e m p l a t e ---
614
+
615
+
616
+ static void InitializeTemplate(i::Handle<i::TemplateInfo> that, int type) {
617
+ that->set_tag(i::Smi::FromInt(type));
618
+ }
619
+
620
+
621
+ void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
622
+ v8::PropertyAttribute attribute) {
623
+ if (IsDeadCheck("v8::Template::SetProperty()")) return;
624
+ ENTER_V8;
625
+ HandleScope scope;
626
+ i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list());
627
+ if (list->IsUndefined()) {
628
+ list = NeanderArray().value();
629
+ Utils::OpenHandle(this)->set_property_list(*list);
630
+ }
631
+ NeanderArray array(list);
632
+ array.add(Utils::OpenHandle(*name));
633
+ array.add(Utils::OpenHandle(*value));
634
+ array.add(Utils::OpenHandle(*v8::Integer::New(attribute)));
635
+ }
636
+
637
+
638
+ // --- F u n c t i o n T e m p l a t e ---
639
+ static void InitializeFunctionTemplate(
640
+ i::Handle<i::FunctionTemplateInfo> info) {
641
+ info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE));
642
+ info->set_flag(0);
643
+ }
644
+
645
+
646
+ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
647
+ if (IsDeadCheck("v8::FunctionTemplate::PrototypeTemplate()")) {
648
+ return Local<ObjectTemplate>();
649
+ }
650
+ ENTER_V8;
651
+ i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template());
652
+ if (result->IsUndefined()) {
653
+ result = Utils::OpenHandle(*ObjectTemplate::New());
654
+ Utils::OpenHandle(this)->set_prototype_template(*result);
655
+ }
656
+ return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result));
657
+ }
658
+
659
+
660
+ void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
661
+ if (IsDeadCheck("v8::FunctionTemplate::Inherit()")) return;
662
+ ENTER_V8;
663
+ Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value));
664
+ }
665
+
666
+
667
+ // To distinguish the function templates, so that we can find them in the
668
+ // function cache of the global context.
669
+ static int next_serial_number = 0;
670
+
671
+
672
+ Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback,
673
+ v8::Handle<Value> data, v8::Handle<Signature> signature) {
674
+ EnsureInitialized("v8::FunctionTemplate::New()");
675
+ LOG_API("FunctionTemplate::New");
676
+ ENTER_V8;
677
+ i::Handle<i::Struct> struct_obj =
678
+ i::Factory::NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
679
+ i::Handle<i::FunctionTemplateInfo> obj =
680
+ i::Handle<i::FunctionTemplateInfo>::cast(struct_obj);
681
+ InitializeFunctionTemplate(obj);
682
+ obj->set_serial_number(i::Smi::FromInt(next_serial_number++));
683
+ if (callback != 0) {
684
+ if (data.IsEmpty()) data = v8::Undefined();
685
+ Utils::ToLocal(obj)->SetCallHandler(callback, data);
686
+ }
687
+ obj->set_undetectable(false);
688
+ obj->set_needs_access_check(false);
689
+
690
+ if (!signature.IsEmpty())
691
+ obj->set_signature(*Utils::OpenHandle(*signature));
692
+ return Utils::ToLocal(obj);
693
+ }
694
+
695
+
696
+ Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
697
+ int argc, Handle<FunctionTemplate> argv[]) {
698
+ EnsureInitialized("v8::Signature::New()");
699
+ LOG_API("Signature::New");
700
+ ENTER_V8;
701
+ i::Handle<i::Struct> struct_obj =
702
+ i::Factory::NewStruct(i::SIGNATURE_INFO_TYPE);
703
+ i::Handle<i::SignatureInfo> obj =
704
+ i::Handle<i::SignatureInfo>::cast(struct_obj);
705
+ if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver));
706
+ if (argc > 0) {
707
+ i::Handle<i::FixedArray> args = i::Factory::NewFixedArray(argc);
708
+ for (int i = 0; i < argc; i++) {
709
+ if (!argv[i].IsEmpty())
710
+ args->set(i, *Utils::OpenHandle(*argv[i]));
711
+ }
712
+ obj->set_args(*args);
713
+ }
714
+ return Utils::ToLocal(obj);
715
+ }
716
+
717
+
718
+ Local<TypeSwitch> TypeSwitch::New(Handle<FunctionTemplate> type) {
719
+ Handle<FunctionTemplate> types[1] = { type };
720
+ return TypeSwitch::New(1, types);
721
+ }
722
+
723
+
724
+ Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) {
725
+ EnsureInitialized("v8::TypeSwitch::New()");
726
+ LOG_API("TypeSwitch::New");
727
+ ENTER_V8;
728
+ i::Handle<i::FixedArray> vector = i::Factory::NewFixedArray(argc);
729
+ for (int i = 0; i < argc; i++)
730
+ vector->set(i, *Utils::OpenHandle(*types[i]));
731
+ i::Handle<i::Struct> struct_obj =
732
+ i::Factory::NewStruct(i::TYPE_SWITCH_INFO_TYPE);
733
+ i::Handle<i::TypeSwitchInfo> obj =
734
+ i::Handle<i::TypeSwitchInfo>::cast(struct_obj);
735
+ obj->set_types(*vector);
736
+ return Utils::ToLocal(obj);
737
+ }
738
+
739
+
740
+ int TypeSwitch::match(v8::Handle<Value> value) {
741
+ LOG_API("TypeSwitch::match");
742
+ i::Handle<i::Object> obj = Utils::OpenHandle(*value);
743
+ i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this);
744
+ i::FixedArray* types = i::FixedArray::cast(info->types());
745
+ for (int i = 0; i < types->length(); i++) {
746
+ if (obj->IsInstanceOf(i::FunctionTemplateInfo::cast(types->get(i))))
747
+ return i + 1;
748
+ }
749
+ return 0;
750
+ }
751
+
752
+
753
+ void FunctionTemplate::SetCallHandler(InvocationCallback callback,
754
+ v8::Handle<Value> data) {
755
+ if (IsDeadCheck("v8::FunctionTemplate::SetCallHandler()")) return;
756
+ ENTER_V8;
757
+ HandleScope scope;
758
+ i::Handle<i::Struct> struct_obj =
759
+ i::Factory::NewStruct(i::CALL_HANDLER_INFO_TYPE);
760
+ i::Handle<i::CallHandlerInfo> obj =
761
+ i::Handle<i::CallHandlerInfo>::cast(struct_obj);
762
+ obj->set_callback(*FromCData(callback));
763
+ if (data.IsEmpty()) data = v8::Undefined();
764
+ obj->set_data(*Utils::OpenHandle(*data));
765
+ Utils::OpenHandle(this)->set_call_code(*obj);
766
+ }
767
+
768
+
769
+ void FunctionTemplate::AddInstancePropertyAccessor(
770
+ v8::Handle<String> name,
771
+ AccessorGetter getter,
772
+ AccessorSetter setter,
773
+ v8::Handle<Value> data,
774
+ v8::AccessControl settings,
775
+ v8::PropertyAttribute attributes) {
776
+ if (IsDeadCheck("v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
777
+ return;
778
+ }
779
+ ENTER_V8;
780
+ HandleScope scope;
781
+ i::Handle<i::AccessorInfo> obj = i::Factory::NewAccessorInfo();
782
+ ASSERT(getter != NULL);
783
+ obj->set_getter(*FromCData(getter));
784
+ obj->set_setter(*FromCData(setter));
785
+ if (data.IsEmpty()) data = v8::Undefined();
786
+ obj->set_data(*Utils::OpenHandle(*data));
787
+ obj->set_name(*Utils::OpenHandle(*name));
788
+ if (settings & ALL_CAN_READ) obj->set_all_can_read(true);
789
+ if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true);
790
+ if (settings & PROHIBITS_OVERWRITING) obj->set_prohibits_overwriting(true);
791
+ obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
792
+
793
+ i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors());
794
+ if (list->IsUndefined()) {
795
+ list = NeanderArray().value();
796
+ Utils::OpenHandle(this)->set_property_accessors(*list);
797
+ }
798
+ NeanderArray array(list);
799
+ array.add(obj);
800
+ }
801
+
802
+
803
+ Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
804
+ if (IsDeadCheck("v8::FunctionTemplate::InstanceTemplate()")
805
+ || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this))
806
+ return Local<ObjectTemplate>();
807
+ ENTER_V8;
808
+ if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) {
809
+ Local<ObjectTemplate> templ =
810
+ ObjectTemplate::New(v8::Handle<FunctionTemplate>(this));
811
+ Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ));
812
+ }
813
+ i::Handle<i::ObjectTemplateInfo> result(i::ObjectTemplateInfo::cast(
814
+ Utils::OpenHandle(this)->instance_template()));
815
+ return Utils::ToLocal(result);
816
+ }
817
+
818
+
819
+ void FunctionTemplate::SetClassName(Handle<String> name) {
820
+ if (IsDeadCheck("v8::FunctionTemplate::SetClassName()")) return;
821
+ ENTER_V8;
822
+ Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name));
823
+ }
824
+
825
+
826
+ void FunctionTemplate::SetHiddenPrototype(bool value) {
827
+ if (IsDeadCheck("v8::FunctionTemplate::SetHiddenPrototype()")) return;
828
+ ENTER_V8;
829
+ Utils::OpenHandle(this)->set_hidden_prototype(value);
830
+ }
831
+
832
+
833
+ void FunctionTemplate::SetNamedInstancePropertyHandler(
834
+ NamedPropertyGetter getter,
835
+ NamedPropertySetter setter,
836
+ NamedPropertyQuery query,
837
+ NamedPropertyDeleter remover,
838
+ NamedPropertyEnumerator enumerator,
839
+ Handle<Value> data) {
840
+ if (IsDeadCheck("v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
841
+ return;
842
+ }
843
+ ENTER_V8;
844
+ HandleScope scope;
845
+ i::Handle<i::Struct> struct_obj =
846
+ i::Factory::NewStruct(i::INTERCEPTOR_INFO_TYPE);
847
+ i::Handle<i::InterceptorInfo> obj =
848
+ i::Handle<i::InterceptorInfo>::cast(struct_obj);
849
+ if (getter != 0) obj->set_getter(*FromCData(getter));
850
+ if (setter != 0) obj->set_setter(*FromCData(setter));
851
+ if (query != 0) obj->set_query(*FromCData(query));
852
+ if (remover != 0) obj->set_deleter(*FromCData(remover));
853
+ if (enumerator != 0) obj->set_enumerator(*FromCData(enumerator));
854
+ if (data.IsEmpty()) data = v8::Undefined();
855
+ obj->set_data(*Utils::OpenHandle(*data));
856
+ Utils::OpenHandle(this)->set_named_property_handler(*obj);
857
+ }
858
+
859
+
860
+ void FunctionTemplate::SetIndexedInstancePropertyHandler(
861
+ IndexedPropertyGetter getter,
862
+ IndexedPropertySetter setter,
863
+ IndexedPropertyQuery query,
864
+ IndexedPropertyDeleter remover,
865
+ IndexedPropertyEnumerator enumerator,
866
+ Handle<Value> data) {
867
+ if (IsDeadCheck(
868
+ "v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
869
+ return;
870
+ }
871
+ ENTER_V8;
872
+ HandleScope scope;
873
+ i::Handle<i::Struct> struct_obj =
874
+ i::Factory::NewStruct(i::INTERCEPTOR_INFO_TYPE);
875
+ i::Handle<i::InterceptorInfo> obj =
876
+ i::Handle<i::InterceptorInfo>::cast(struct_obj);
877
+ if (getter != 0) obj->set_getter(*FromCData(getter));
878
+ if (setter != 0) obj->set_setter(*FromCData(setter));
879
+ if (query != 0) obj->set_query(*FromCData(query));
880
+ if (remover != 0) obj->set_deleter(*FromCData(remover));
881
+ if (enumerator != 0) obj->set_enumerator(*FromCData(enumerator));
882
+ if (data.IsEmpty()) data = v8::Undefined();
883
+ obj->set_data(*Utils::OpenHandle(*data));
884
+ Utils::OpenHandle(this)->set_indexed_property_handler(*obj);
885
+ }
886
+
887
+
888
+ void FunctionTemplate::SetInstanceCallAsFunctionHandler(
889
+ InvocationCallback callback,
890
+ Handle<Value> data) {
891
+ if (IsDeadCheck("v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
892
+ return;
893
+ }
894
+ ENTER_V8;
895
+ HandleScope scope;
896
+ i::Handle<i::Struct> struct_obj =
897
+ i::Factory::NewStruct(i::CALL_HANDLER_INFO_TYPE);
898
+ i::Handle<i::CallHandlerInfo> obj =
899
+ i::Handle<i::CallHandlerInfo>::cast(struct_obj);
900
+ obj->set_callback(*FromCData(callback));
901
+ if (data.IsEmpty()) data = v8::Undefined();
902
+ obj->set_data(*Utils::OpenHandle(*data));
903
+ Utils::OpenHandle(this)->set_instance_call_handler(*obj);
904
+ }
905
+
906
+
907
+ // --- O b j e c t T e m p l a t e ---
908
+
909
+
910
+ Local<ObjectTemplate> ObjectTemplate::New() {
911
+ return New(Local<FunctionTemplate>());
912
+ }
913
+
914
+
915
+ Local<ObjectTemplate> ObjectTemplate::New(
916
+ v8::Handle<FunctionTemplate> constructor) {
917
+ if (IsDeadCheck("v8::ObjectTemplate::New()")) return Local<ObjectTemplate>();
918
+ EnsureInitialized("v8::ObjectTemplate::New()");
919
+ LOG_API("ObjectTemplate::New");
920
+ ENTER_V8;
921
+ i::Handle<i::Struct> struct_obj =
922
+ i::Factory::NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE);
923
+ i::Handle<i::ObjectTemplateInfo> obj =
924
+ i::Handle<i::ObjectTemplateInfo>::cast(struct_obj);
925
+ InitializeTemplate(obj, Consts::OBJECT_TEMPLATE);
926
+ if (!constructor.IsEmpty())
927
+ obj->set_constructor(*Utils::OpenHandle(*constructor));
928
+ obj->set_internal_field_count(i::Smi::FromInt(0));
929
+ return Utils::ToLocal(obj);
930
+ }
931
+
932
+
933
+ // Ensure that the object template has a constructor. If no
934
+ // constructor is available we create one.
935
+ static void EnsureConstructor(ObjectTemplate* object_template) {
936
+ if (Utils::OpenHandle(object_template)->constructor()->IsUndefined()) {
937
+ Local<FunctionTemplate> templ = FunctionTemplate::New();
938
+ i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ);
939
+ constructor->set_instance_template(*Utils::OpenHandle(object_template));
940
+ Utils::OpenHandle(object_template)->set_constructor(*constructor);
941
+ }
942
+ }
943
+
944
+
945
+ void ObjectTemplate::SetAccessor(v8::Handle<String> name,
946
+ AccessorGetter getter,
947
+ AccessorSetter setter,
948
+ v8::Handle<Value> data,
949
+ AccessControl settings,
950
+ PropertyAttribute attribute) {
951
+ if (IsDeadCheck("v8::ObjectTemplate::SetAccessor()")) return;
952
+ ENTER_V8;
953
+ HandleScope scope;
954
+ EnsureConstructor(this);
955
+ i::FunctionTemplateInfo* constructor =
956
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
957
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
958
+ Utils::ToLocal(cons)->AddInstancePropertyAccessor(name,
959
+ getter,
960
+ setter,
961
+ data,
962
+ settings,
963
+ attribute);
964
+ }
965
+
966
+
967
+ void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter,
968
+ NamedPropertySetter setter,
969
+ NamedPropertyQuery query,
970
+ NamedPropertyDeleter remover,
971
+ NamedPropertyEnumerator enumerator,
972
+ Handle<Value> data) {
973
+ if (IsDeadCheck("v8::ObjectTemplate::SetNamedPropertyHandler()")) return;
974
+ ENTER_V8;
975
+ HandleScope scope;
976
+ EnsureConstructor(this);
977
+ i::FunctionTemplateInfo* constructor =
978
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
979
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
980
+ Utils::ToLocal(cons)->SetNamedInstancePropertyHandler(getter,
981
+ setter,
982
+ query,
983
+ remover,
984
+ enumerator,
985
+ data);
986
+ }
987
+
988
+
989
+ void ObjectTemplate::MarkAsUndetectable() {
990
+ if (IsDeadCheck("v8::ObjectTemplate::MarkAsUndetectable()")) return;
991
+ ENTER_V8;
992
+ HandleScope scope;
993
+ EnsureConstructor(this);
994
+ i::FunctionTemplateInfo* constructor =
995
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
996
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
997
+ cons->set_undetectable(true);
998
+ }
999
+
1000
+
1001
+ void ObjectTemplate::SetAccessCheckCallbacks(
1002
+ NamedSecurityCallback named_callback,
1003
+ IndexedSecurityCallback indexed_callback,
1004
+ Handle<Value> data,
1005
+ bool turned_on_by_default) {
1006
+ if (IsDeadCheck("v8::ObjectTemplate::SetAccessCheckCallbacks()")) return;
1007
+ ENTER_V8;
1008
+ HandleScope scope;
1009
+ EnsureConstructor(this);
1010
+
1011
+ i::Handle<i::Struct> struct_info =
1012
+ i::Factory::NewStruct(i::ACCESS_CHECK_INFO_TYPE);
1013
+ i::Handle<i::AccessCheckInfo> info =
1014
+ i::Handle<i::AccessCheckInfo>::cast(struct_info);
1015
+ info->set_named_callback(*FromCData(named_callback));
1016
+ info->set_indexed_callback(*FromCData(indexed_callback));
1017
+ if (data.IsEmpty()) data = v8::Undefined();
1018
+ info->set_data(*Utils::OpenHandle(*data));
1019
+
1020
+ i::FunctionTemplateInfo* constructor =
1021
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1022
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
1023
+ cons->set_access_check_info(*info);
1024
+ cons->set_needs_access_check(turned_on_by_default);
1025
+ }
1026
+
1027
+
1028
+ void ObjectTemplate::SetIndexedPropertyHandler(
1029
+ IndexedPropertyGetter getter,
1030
+ IndexedPropertySetter setter,
1031
+ IndexedPropertyQuery query,
1032
+ IndexedPropertyDeleter remover,
1033
+ IndexedPropertyEnumerator enumerator,
1034
+ Handle<Value> data) {
1035
+ if (IsDeadCheck("v8::ObjectTemplate::SetIndexedPropertyHandler()")) return;
1036
+ ENTER_V8;
1037
+ HandleScope scope;
1038
+ EnsureConstructor(this);
1039
+ i::FunctionTemplateInfo* constructor =
1040
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1041
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
1042
+ Utils::ToLocal(cons)->SetIndexedInstancePropertyHandler(getter,
1043
+ setter,
1044
+ query,
1045
+ remover,
1046
+ enumerator,
1047
+ data);
1048
+ }
1049
+
1050
+
1051
+ void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback,
1052
+ Handle<Value> data) {
1053
+ if (IsDeadCheck("v8::ObjectTemplate::SetCallAsFunctionHandler()")) return;
1054
+ ENTER_V8;
1055
+ HandleScope scope;
1056
+ EnsureConstructor(this);
1057
+ i::FunctionTemplateInfo* constructor =
1058
+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1059
+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
1060
+ Utils::ToLocal(cons)->SetInstanceCallAsFunctionHandler(callback, data);
1061
+ }
1062
+
1063
+
1064
+ int ObjectTemplate::InternalFieldCount() {
1065
+ if (IsDeadCheck("v8::ObjectTemplate::InternalFieldCount()")) {
1066
+ return 0;
1067
+ }
1068
+ return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value();
1069
+ }
1070
+
1071
+
1072
+ void ObjectTemplate::SetInternalFieldCount(int value) {
1073
+ if (IsDeadCheck("v8::ObjectTemplate::SetInternalFieldCount()")) return;
1074
+ if (!ApiCheck(i::Smi::IsValid(value),
1075
+ "v8::ObjectTemplate::SetInternalFieldCount()",
1076
+ "Invalid internal field count")) {
1077
+ return;
1078
+ }
1079
+ ENTER_V8;
1080
+ if (value > 0) {
1081
+ // The internal field count is set by the constructor function's
1082
+ // construct code, so we ensure that there is a constructor
1083
+ // function to do the setting.
1084
+ EnsureConstructor(this);
1085
+ }
1086
+ Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value));
1087
+ }
1088
+
1089
+
1090
+ // --- S c r i p t D a t a ---
1091
+
1092
+
1093
+ ScriptData* ScriptData::PreCompile(const char* input, int length) {
1094
+ unibrow::Utf8InputBuffer<> buf(input, length);
1095
+ return i::PreParse(i::Handle<i::String>(), &buf, NULL);
1096
+ }
1097
+
1098
+
1099
+ ScriptData* ScriptData::New(unsigned* data, int length) {
1100
+ return new i::ScriptDataImpl(i::Vector<unsigned>(data, length));
1101
+ }
1102
+
1103
+
1104
+ // --- S c r i p t ---
1105
+
1106
+
1107
+ Local<Script> Script::New(v8::Handle<String> source,
1108
+ v8::ScriptOrigin* origin,
1109
+ v8::ScriptData* script_data) {
1110
+ ON_BAILOUT("v8::Script::New()", return Local<Script>());
1111
+ LOG_API("Script::New");
1112
+ ENTER_V8;
1113
+ i::Handle<i::String> str = Utils::OpenHandle(*source);
1114
+ i::Handle<i::Object> name_obj;
1115
+ int line_offset = 0;
1116
+ int column_offset = 0;
1117
+ if (origin != NULL) {
1118
+ if (!origin->ResourceName().IsEmpty()) {
1119
+ name_obj = Utils::OpenHandle(*origin->ResourceName());
1120
+ }
1121
+ if (!origin->ResourceLineOffset().IsEmpty()) {
1122
+ line_offset = static_cast<int>(origin->ResourceLineOffset()->Value());
1123
+ }
1124
+ if (!origin->ResourceColumnOffset().IsEmpty()) {
1125
+ column_offset = static_cast<int>(origin->ResourceColumnOffset()->Value());
1126
+ }
1127
+ }
1128
+ EXCEPTION_PREAMBLE();
1129
+ i::ScriptDataImpl* pre_data = static_cast<i::ScriptDataImpl*>(script_data);
1130
+ // We assert that the pre-data is sane, even though we can actually
1131
+ // handle it if it turns out not to be in release mode.
1132
+ ASSERT(pre_data == NULL || pre_data->SanityCheck());
1133
+ // If the pre-data isn't sane we simply ignore it
1134
+ if (pre_data != NULL && !pre_data->SanityCheck()) {
1135
+ pre_data = NULL;
1136
+ }
1137
+ i::Handle<i::JSFunction> boilerplate = i::Compiler::Compile(str,
1138
+ name_obj,
1139
+ line_offset,
1140
+ column_offset,
1141
+ NULL,
1142
+ pre_data);
1143
+ has_pending_exception = boilerplate.is_null();
1144
+ EXCEPTION_BAILOUT_CHECK(Local<Script>());
1145
+ return Local<Script>(ToApi<Script>(boilerplate));
1146
+ }
1147
+
1148
+
1149
+ Local<Script> Script::New(v8::Handle<String> source,
1150
+ v8::Handle<Value> file_name) {
1151
+ ScriptOrigin origin(file_name);
1152
+ return New(source, &origin);
1153
+ }
1154
+
1155
+
1156
+ Local<Script> Script::Compile(v8::Handle<String> source,
1157
+ v8::ScriptOrigin* origin,
1158
+ v8::ScriptData* script_data) {
1159
+ ON_BAILOUT("v8::Script::Compile()", return Local<Script>());
1160
+ LOG_API("Script::Compile");
1161
+ ENTER_V8;
1162
+ Local<Script> generic = New(source, origin, script_data);
1163
+ if (generic.IsEmpty())
1164
+ return generic;
1165
+ i::Handle<i::JSFunction> boilerplate = Utils::OpenHandle(*generic);
1166
+ i::Handle<i::JSFunction> result =
1167
+ i::Factory::NewFunctionFromBoilerplate(boilerplate,
1168
+ i::Top::global_context());
1169
+ return Local<Script>(ToApi<Script>(result));
1170
+ }
1171
+
1172
+
1173
+ Local<Script> Script::Compile(v8::Handle<String> source,
1174
+ v8::Handle<Value> file_name) {
1175
+ ScriptOrigin origin(file_name);
1176
+ return Compile(source, &origin);
1177
+ }
1178
+
1179
+
1180
+ Local<Value> Script::Run() {
1181
+ ON_BAILOUT("v8::Script::Run()", return Local<Value>());
1182
+ LOG_API("Script::Run");
1183
+ ENTER_V8;
1184
+ i::Object* raw_result = NULL;
1185
+ {
1186
+ HandleScope scope;
1187
+ i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
1188
+ if (fun->IsBoilerplate()) {
1189
+ fun = i::Factory::NewFunctionFromBoilerplate(fun,
1190
+ i::Top::global_context());
1191
+ }
1192
+ EXCEPTION_PREAMBLE();
1193
+ i::Handle<i::Object> receiver(i::Top::context()->global_proxy());
1194
+ i::Handle<i::Object> result =
1195
+ i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
1196
+ EXCEPTION_BAILOUT_CHECK(Local<Value>());
1197
+ raw_result = *result;
1198
+ }
1199
+ i::Handle<i::Object> result(raw_result);
1200
+ return Utils::ToLocal(result);
1201
+ }
1202
+
1203
+
1204
+ Local<Value> Script::Id() {
1205
+ ON_BAILOUT("v8::Script::Id()", return Local<Value>());
1206
+ LOG_API("Script::Id");
1207
+ i::Object* raw_id = NULL;
1208
+ {
1209
+ HandleScope scope;
1210
+ i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
1211
+ i::Handle<i::Script> script(i::Script::cast(fun->shared()->script()));
1212
+ i::Handle<i::Object> id(script->id());
1213
+ raw_id = *id;
1214
+ }
1215
+ i::Handle<i::Object> id(raw_id);
1216
+ return Utils::ToLocal(id);
1217
+ }
1218
+
1219
+
1220
+ void Script::SetData(v8::Handle<String> data) {
1221
+ ON_BAILOUT("v8::Script::SetData()", return);
1222
+ LOG_API("Script::SetData");
1223
+ {
1224
+ HandleScope scope;
1225
+ i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
1226
+ i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
1227
+ i::Handle<i::Script> script(i::Script::cast(fun->shared()->script()));
1228
+ script->set_data(*raw_data);
1229
+ }
1230
+ }
1231
+
1232
+
1233
+ // --- E x c e p t i o n s ---
1234
+
1235
+
1236
+ v8::TryCatch::TryCatch()
1237
+ : next_(i::Top::try_catch_handler_address()),
1238
+ exception_(i::Heap::the_hole_value()),
1239
+ message_(i::Smi::FromInt(0)),
1240
+ is_verbose_(false),
1241
+ can_continue_(true),
1242
+ capture_message_(true),
1243
+ rethrow_(false) {
1244
+ i::Top::RegisterTryCatchHandler(this);
1245
+ }
1246
+
1247
+
1248
+ v8::TryCatch::~TryCatch() {
1249
+ if (rethrow_) {
1250
+ v8::HandleScope scope;
1251
+ v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
1252
+ i::Top::UnregisterTryCatchHandler(this);
1253
+ v8::ThrowException(exc);
1254
+ } else {
1255
+ i::Top::UnregisterTryCatchHandler(this);
1256
+ }
1257
+ }
1258
+
1259
+
1260
+ bool v8::TryCatch::HasCaught() const {
1261
+ return !reinterpret_cast<i::Object*>(exception_)->IsTheHole();
1262
+ }
1263
+
1264
+
1265
+ bool v8::TryCatch::CanContinue() const {
1266
+ return can_continue_;
1267
+ }
1268
+
1269
+
1270
+ v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
1271
+ if (!HasCaught()) return v8::Local<v8::Value>();
1272
+ rethrow_ = true;
1273
+ return v8::Undefined();
1274
+ }
1275
+
1276
+
1277
+ v8::Local<Value> v8::TryCatch::Exception() const {
1278
+ if (HasCaught()) {
1279
+ // Check for out of memory exception.
1280
+ i::Object* exception = reinterpret_cast<i::Object*>(exception_);
1281
+ return v8::Utils::ToLocal(i::Handle<i::Object>(exception));
1282
+ } else {
1283
+ return v8::Local<Value>();
1284
+ }
1285
+ }
1286
+
1287
+
1288
+ v8::Local<Value> v8::TryCatch::StackTrace() const {
1289
+ if (HasCaught()) {
1290
+ i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
1291
+ if (!raw_obj->IsJSObject()) return v8::Local<Value>();
1292
+ v8::HandleScope scope;
1293
+ i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj));
1294
+ i::Handle<i::String> name = i::Factory::LookupAsciiSymbol("stack");
1295
+ if (!obj->HasProperty(*name))
1296
+ return v8::Local<Value>();
1297
+ return scope.Close(v8::Utils::ToLocal(i::GetProperty(obj, name)));
1298
+ } else {
1299
+ return v8::Local<Value>();
1300
+ }
1301
+ }
1302
+
1303
+
1304
+ v8::Local<v8::Message> v8::TryCatch::Message() const {
1305
+ if (HasCaught() && message_ != i::Smi::FromInt(0)) {
1306
+ i::Object* message = reinterpret_cast<i::Object*>(message_);
1307
+ return v8::Utils::MessageToLocal(i::Handle<i::Object>(message));
1308
+ } else {
1309
+ return v8::Local<v8::Message>();
1310
+ }
1311
+ }
1312
+
1313
+
1314
+ void v8::TryCatch::Reset() {
1315
+ exception_ = i::Heap::the_hole_value();
1316
+ message_ = i::Smi::FromInt(0);
1317
+ }
1318
+
1319
+
1320
+ void v8::TryCatch::SetVerbose(bool value) {
1321
+ is_verbose_ = value;
1322
+ }
1323
+
1324
+
1325
+ void v8::TryCatch::SetCaptureMessage(bool value) {
1326
+ capture_message_ = value;
1327
+ }
1328
+
1329
+
1330
+ // --- M e s s a g e ---
1331
+
1332
+
1333
+ Local<String> Message::Get() const {
1334
+ ON_BAILOUT("v8::Message::Get()", return Local<String>());
1335
+ ENTER_V8;
1336
+ HandleScope scope;
1337
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1338
+ i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj);
1339
+ Local<String> result = Utils::ToLocal(raw_result);
1340
+ return scope.Close(result);
1341
+ }
1342
+
1343
+
1344
+ v8::Handle<Value> Message::GetScriptResourceName() const {
1345
+ if (IsDeadCheck("v8::Message::GetScriptResourceName()")) {
1346
+ return Local<String>();
1347
+ }
1348
+ ENTER_V8;
1349
+ HandleScope scope;
1350
+ i::Handle<i::JSObject> obj =
1351
+ i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
1352
+ // Return this.script.name.
1353
+ i::Handle<i::JSValue> script =
1354
+ i::Handle<i::JSValue>::cast(GetProperty(obj, "script"));
1355
+ i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name());
1356
+ return scope.Close(Utils::ToLocal(resource_name));
1357
+ }
1358
+
1359
+
1360
+ v8::Handle<Value> Message::GetScriptData() const {
1361
+ if (IsDeadCheck("v8::Message::GetScriptResourceData()")) {
1362
+ return Local<Value>();
1363
+ }
1364
+ ENTER_V8;
1365
+ HandleScope scope;
1366
+ i::Handle<i::JSObject> obj =
1367
+ i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
1368
+ // Return this.script.data.
1369
+ i::Handle<i::JSValue> script =
1370
+ i::Handle<i::JSValue>::cast(GetProperty(obj, "script"));
1371
+ i::Handle<i::Object> data(i::Script::cast(script->value())->data());
1372
+ return scope.Close(Utils::ToLocal(data));
1373
+ }
1374
+
1375
+
1376
+ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
1377
+ i::Handle<i::Object> recv,
1378
+ int argc,
1379
+ i::Object** argv[],
1380
+ bool* has_pending_exception) {
1381
+ i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name);
1382
+ i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str);
1383
+ i::Handle<i::JSFunction> fun =
1384
+ i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
1385
+ i::Handle<i::Object> value =
1386
+ i::Execution::Call(fun, recv, argc, argv, has_pending_exception);
1387
+ return value;
1388
+ }
1389
+
1390
+
1391
+ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
1392
+ i::Handle<i::Object> data,
1393
+ bool* has_pending_exception) {
1394
+ i::Object** argv[1] = { data.location() };
1395
+ return CallV8HeapFunction(name,
1396
+ i::Top::builtins(),
1397
+ 1,
1398
+ argv,
1399
+ has_pending_exception);
1400
+ }
1401
+
1402
+
1403
+ int Message::GetLineNumber() const {
1404
+ ON_BAILOUT("v8::Message::GetLineNumber()", return -1);
1405
+ ENTER_V8;
1406
+ HandleScope scope;
1407
+ EXCEPTION_PREAMBLE();
1408
+ i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber",
1409
+ Utils::OpenHandle(this),
1410
+ &has_pending_exception);
1411
+ EXCEPTION_BAILOUT_CHECK(0);
1412
+ return static_cast<int>(result->Number());
1413
+ }
1414
+
1415
+
1416
+ int Message::GetStartPosition() const {
1417
+ if (IsDeadCheck("v8::Message::GetStartPosition()")) return 0;
1418
+ ENTER_V8;
1419
+ HandleScope scope;
1420
+
1421
+ i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1422
+ return static_cast<int>(GetProperty(data_obj, "startPos")->Number());
1423
+ }
1424
+
1425
+
1426
+ int Message::GetEndPosition() const {
1427
+ if (IsDeadCheck("v8::Message::GetEndPosition()")) return 0;
1428
+ ENTER_V8;
1429
+ HandleScope scope;
1430
+ i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1431
+ return static_cast<int>(GetProperty(data_obj, "endPos")->Number());
1432
+ }
1433
+
1434
+
1435
+ int Message::GetStartColumn() const {
1436
+ if (IsDeadCheck("v8::Message::GetStartColumn()")) return 0;
1437
+ ENTER_V8;
1438
+ HandleScope scope;
1439
+ i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1440
+ EXCEPTION_PREAMBLE();
1441
+ i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
1442
+ "GetPositionInLine",
1443
+ data_obj,
1444
+ &has_pending_exception);
1445
+ EXCEPTION_BAILOUT_CHECK(0);
1446
+ return static_cast<int>(start_col_obj->Number());
1447
+ }
1448
+
1449
+
1450
+ int Message::GetEndColumn() const {
1451
+ if (IsDeadCheck("v8::Message::GetEndColumn()")) return 0;
1452
+ ENTER_V8;
1453
+ HandleScope scope;
1454
+ i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1455
+ EXCEPTION_PREAMBLE();
1456
+ i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
1457
+ "GetPositionInLine",
1458
+ data_obj,
1459
+ &has_pending_exception);
1460
+ EXCEPTION_BAILOUT_CHECK(0);
1461
+ int start = static_cast<int>(GetProperty(data_obj, "startPos")->Number());
1462
+ int end = static_cast<int>(GetProperty(data_obj, "endPos")->Number());
1463
+ return static_cast<int>(start_col_obj->Number()) + (end - start);
1464
+ }
1465
+
1466
+
1467
+ Local<String> Message::GetSourceLine() const {
1468
+ ON_BAILOUT("v8::Message::GetSourceLine()", return Local<String>());
1469
+ ENTER_V8;
1470
+ HandleScope scope;
1471
+ EXCEPTION_PREAMBLE();
1472
+ i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
1473
+ Utils::OpenHandle(this),
1474
+ &has_pending_exception);
1475
+ EXCEPTION_BAILOUT_CHECK(Local<v8::String>());
1476
+ if (result->IsString()) {
1477
+ return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
1478
+ } else {
1479
+ return Local<String>();
1480
+ }
1481
+ }
1482
+
1483
+
1484
+ void Message::PrintCurrentStackTrace(FILE* out) {
1485
+ if (IsDeadCheck("v8::Message::PrintCurrentStackTrace()")) return;
1486
+ ENTER_V8;
1487
+ i::Top::PrintCurrentStackTrace(out);
1488
+ }
1489
+
1490
+
1491
+ // --- D a t a ---
1492
+
1493
+ bool Value::IsUndefined() const {
1494
+ if (IsDeadCheck("v8::Value::IsUndefined()")) return false;
1495
+ return Utils::OpenHandle(this)->IsUndefined();
1496
+ }
1497
+
1498
+
1499
+ bool Value::IsNull() const {
1500
+ if (IsDeadCheck("v8::Value::IsNull()")) return false;
1501
+ return Utils::OpenHandle(this)->IsNull();
1502
+ }
1503
+
1504
+
1505
+ bool Value::IsTrue() const {
1506
+ if (IsDeadCheck("v8::Value::IsTrue()")) return false;
1507
+ return Utils::OpenHandle(this)->IsTrue();
1508
+ }
1509
+
1510
+
1511
+ bool Value::IsFalse() const {
1512
+ if (IsDeadCheck("v8::Value::IsFalse()")) return false;
1513
+ return Utils::OpenHandle(this)->IsFalse();
1514
+ }
1515
+
1516
+
1517
+ bool Value::IsFunction() const {
1518
+ if (IsDeadCheck("v8::Value::IsFunction()")) return false;
1519
+ return Utils::OpenHandle(this)->IsJSFunction();
1520
+ }
1521
+
1522
+
1523
+ bool Value::FullIsString() const {
1524
+ if (IsDeadCheck("v8::Value::IsString()")) return false;
1525
+ bool result = Utils::OpenHandle(this)->IsString();
1526
+ ASSERT_EQ(result, QuickIsString());
1527
+ return result;
1528
+ }
1529
+
1530
+
1531
+ bool Value::IsArray() const {
1532
+ if (IsDeadCheck("v8::Value::IsArray()")) return false;
1533
+ return Utils::OpenHandle(this)->IsJSArray();
1534
+ }
1535
+
1536
+
1537
+ bool Value::IsObject() const {
1538
+ if (IsDeadCheck("v8::Value::IsObject()")) return false;
1539
+ return Utils::OpenHandle(this)->IsJSObject();
1540
+ }
1541
+
1542
+
1543
+ bool Value::IsNumber() const {
1544
+ if (IsDeadCheck("v8::Value::IsNumber()")) return false;
1545
+ return Utils::OpenHandle(this)->IsNumber();
1546
+ }
1547
+
1548
+
1549
+ bool Value::IsBoolean() const {
1550
+ if (IsDeadCheck("v8::Value::IsBoolean()")) return false;
1551
+ return Utils::OpenHandle(this)->IsBoolean();
1552
+ }
1553
+
1554
+
1555
+ bool Value::IsExternal() const {
1556
+ if (IsDeadCheck("v8::Value::IsExternal()")) return false;
1557
+ return Utils::OpenHandle(this)->IsProxy();
1558
+ }
1559
+
1560
+
1561
+ bool Value::IsInt32() const {
1562
+ if (IsDeadCheck("v8::Value::IsInt32()")) return false;
1563
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1564
+ if (obj->IsSmi()) return true;
1565
+ if (obj->IsNumber()) {
1566
+ double value = obj->Number();
1567
+ return i::FastI2D(i::FastD2I(value)) == value;
1568
+ }
1569
+ return false;
1570
+ }
1571
+
1572
+
1573
+ bool Value::IsDate() const {
1574
+ if (IsDeadCheck("v8::Value::IsDate()")) return false;
1575
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1576
+ return obj->HasSpecificClassOf(i::Heap::Date_symbol());
1577
+ }
1578
+
1579
+
1580
+ Local<String> Value::ToString() const {
1581
+ if (IsDeadCheck("v8::Value::ToString()")) return Local<String>();
1582
+ LOG_API("ToString");
1583
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1584
+ i::Handle<i::Object> str;
1585
+ if (obj->IsString()) {
1586
+ str = obj;
1587
+ } else {
1588
+ ENTER_V8;
1589
+ EXCEPTION_PREAMBLE();
1590
+ str = i::Execution::ToString(obj, &has_pending_exception);
1591
+ EXCEPTION_BAILOUT_CHECK(Local<String>());
1592
+ }
1593
+ return Local<String>(ToApi<String>(str));
1594
+ }
1595
+
1596
+
1597
+ Local<String> Value::ToDetailString() const {
1598
+ if (IsDeadCheck("v8::Value::ToDetailString()")) return Local<String>();
1599
+ LOG_API("ToDetailString");
1600
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1601
+ i::Handle<i::Object> str;
1602
+ if (obj->IsString()) {
1603
+ str = obj;
1604
+ } else {
1605
+ ENTER_V8;
1606
+ EXCEPTION_PREAMBLE();
1607
+ str = i::Execution::ToDetailString(obj, &has_pending_exception);
1608
+ EXCEPTION_BAILOUT_CHECK(Local<String>());
1609
+ }
1610
+ return Local<String>(ToApi<String>(str));
1611
+ }
1612
+
1613
+
1614
+ Local<v8::Object> Value::ToObject() const {
1615
+ if (IsDeadCheck("v8::Value::ToObject()")) return Local<v8::Object>();
1616
+ LOG_API("ToObject");
1617
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1618
+ i::Handle<i::Object> val;
1619
+ if (obj->IsJSObject()) {
1620
+ val = obj;
1621
+ } else {
1622
+ ENTER_V8;
1623
+ EXCEPTION_PREAMBLE();
1624
+ val = i::Execution::ToObject(obj, &has_pending_exception);
1625
+ EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
1626
+ }
1627
+ return Local<v8::Object>(ToApi<Object>(val));
1628
+ }
1629
+
1630
+
1631
+ Local<Boolean> Value::ToBoolean() const {
1632
+ if (IsDeadCheck("v8::Value::ToBoolean()")) return Local<Boolean>();
1633
+ LOG_API("ToBoolean");
1634
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1635
+ if (obj->IsBoolean()) {
1636
+ return Local<Boolean>(ToApi<Boolean>(obj));
1637
+ } else {
1638
+ ENTER_V8;
1639
+ i::Handle<i::Object> val = i::Execution::ToBoolean(obj);
1640
+ return Local<Boolean>(ToApi<Boolean>(val));
1641
+ }
1642
+ }
1643
+
1644
+
1645
+ Local<Number> Value::ToNumber() const {
1646
+ if (IsDeadCheck("v8::Value::ToNumber()")) return Local<Number>();
1647
+ LOG_API("ToNumber");
1648
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1649
+ i::Handle<i::Object> num;
1650
+ if (obj->IsNumber()) {
1651
+ num = obj;
1652
+ } else {
1653
+ ENTER_V8;
1654
+ EXCEPTION_PREAMBLE();
1655
+ num = i::Execution::ToNumber(obj, &has_pending_exception);
1656
+ EXCEPTION_BAILOUT_CHECK(Local<Number>());
1657
+ }
1658
+ return Local<Number>(ToApi<Number>(num));
1659
+ }
1660
+
1661
+
1662
+ Local<Integer> Value::ToInteger() const {
1663
+ if (IsDeadCheck("v8::Value::ToInteger()")) return Local<Integer>();
1664
+ LOG_API("ToInteger");
1665
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1666
+ i::Handle<i::Object> num;
1667
+ if (obj->IsSmi()) {
1668
+ num = obj;
1669
+ } else {
1670
+ ENTER_V8;
1671
+ EXCEPTION_PREAMBLE();
1672
+ num = i::Execution::ToInteger(obj, &has_pending_exception);
1673
+ EXCEPTION_BAILOUT_CHECK(Local<Integer>());
1674
+ }
1675
+ return Local<Integer>(ToApi<Integer>(num));
1676
+ }
1677
+
1678
+
1679
+ void External::CheckCast(v8::Value* that) {
1680
+ if (IsDeadCheck("v8::External::Cast()")) return;
1681
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1682
+ ApiCheck(obj->IsProxy(),
1683
+ "v8::External::Cast()",
1684
+ "Could not convert to external");
1685
+ }
1686
+
1687
+
1688
+ void v8::Object::CheckCast(Value* that) {
1689
+ if (IsDeadCheck("v8::Object::Cast()")) return;
1690
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1691
+ ApiCheck(obj->IsJSObject(),
1692
+ "v8::Object::Cast()",
1693
+ "Could not convert to object");
1694
+ }
1695
+
1696
+
1697
+ void v8::Function::CheckCast(Value* that) {
1698
+ if (IsDeadCheck("v8::Function::Cast()")) return;
1699
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1700
+ ApiCheck(obj->IsJSFunction(),
1701
+ "v8::Function::Cast()",
1702
+ "Could not convert to function");
1703
+ }
1704
+
1705
+
1706
+ void v8::String::CheckCast(v8::Value* that) {
1707
+ if (IsDeadCheck("v8::String::Cast()")) return;
1708
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1709
+ ApiCheck(obj->IsString(),
1710
+ "v8::String::Cast()",
1711
+ "Could not convert to string");
1712
+ }
1713
+
1714
+
1715
+ void v8::Number::CheckCast(v8::Value* that) {
1716
+ if (IsDeadCheck("v8::Number::Cast()")) return;
1717
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1718
+ ApiCheck(obj->IsNumber(),
1719
+ "v8::Number::Cast()",
1720
+ "Could not convert to number");
1721
+ }
1722
+
1723
+
1724
+ void v8::Integer::CheckCast(v8::Value* that) {
1725
+ if (IsDeadCheck("v8::Integer::Cast()")) return;
1726
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1727
+ ApiCheck(obj->IsNumber(),
1728
+ "v8::Integer::Cast()",
1729
+ "Could not convert to number");
1730
+ }
1731
+
1732
+
1733
+ void v8::Array::CheckCast(Value* that) {
1734
+ if (IsDeadCheck("v8::Array::Cast()")) return;
1735
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1736
+ ApiCheck(obj->IsJSArray(),
1737
+ "v8::Array::Cast()",
1738
+ "Could not convert to array");
1739
+ }
1740
+
1741
+
1742
+ void v8::Date::CheckCast(v8::Value* that) {
1743
+ if (IsDeadCheck("v8::Date::Cast()")) return;
1744
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
1745
+ ApiCheck(obj->HasSpecificClassOf(i::Heap::Date_symbol()),
1746
+ "v8::Date::Cast()",
1747
+ "Could not convert to date");
1748
+ }
1749
+
1750
+
1751
+ bool Value::BooleanValue() const {
1752
+ if (IsDeadCheck("v8::Value::BooleanValue()")) return false;
1753
+ LOG_API("BooleanValue");
1754
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1755
+ if (obj->IsBoolean()) {
1756
+ return obj->IsTrue();
1757
+ } else {
1758
+ ENTER_V8;
1759
+ i::Handle<i::Object> value = i::Execution::ToBoolean(obj);
1760
+ return value->IsTrue();
1761
+ }
1762
+ }
1763
+
1764
+
1765
+ double Value::NumberValue() const {
1766
+ if (IsDeadCheck("v8::Value::NumberValue()")) return i::OS::nan_value();
1767
+ LOG_API("NumberValue");
1768
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1769
+ i::Handle<i::Object> num;
1770
+ if (obj->IsNumber()) {
1771
+ num = obj;
1772
+ } else {
1773
+ ENTER_V8;
1774
+ EXCEPTION_PREAMBLE();
1775
+ num = i::Execution::ToNumber(obj, &has_pending_exception);
1776
+ EXCEPTION_BAILOUT_CHECK(i::OS::nan_value());
1777
+ }
1778
+ return num->Number();
1779
+ }
1780
+
1781
+
1782
+ int64_t Value::IntegerValue() const {
1783
+ if (IsDeadCheck("v8::Value::IntegerValue()")) return 0;
1784
+ LOG_API("IntegerValue");
1785
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1786
+ i::Handle<i::Object> num;
1787
+ if (obj->IsNumber()) {
1788
+ num = obj;
1789
+ } else {
1790
+ ENTER_V8;
1791
+ EXCEPTION_PREAMBLE();
1792
+ num = i::Execution::ToInteger(obj, &has_pending_exception);
1793
+ EXCEPTION_BAILOUT_CHECK(0);
1794
+ }
1795
+ if (num->IsSmi()) {
1796
+ return i::Smi::cast(*num)->value();
1797
+ } else {
1798
+ return static_cast<int64_t>(num->Number());
1799
+ }
1800
+ }
1801
+
1802
+
1803
+ Local<Int32> Value::ToInt32() const {
1804
+ if (IsDeadCheck("v8::Value::ToInt32()")) return Local<Int32>();
1805
+ LOG_API("ToInt32");
1806
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1807
+ i::Handle<i::Object> num;
1808
+ if (obj->IsSmi()) {
1809
+ num = obj;
1810
+ } else {
1811
+ ENTER_V8;
1812
+ EXCEPTION_PREAMBLE();
1813
+ num = i::Execution::ToInt32(obj, &has_pending_exception);
1814
+ EXCEPTION_BAILOUT_CHECK(Local<Int32>());
1815
+ }
1816
+ return Local<Int32>(ToApi<Int32>(num));
1817
+ }
1818
+
1819
+
1820
+ Local<Uint32> Value::ToUint32() const {
1821
+ if (IsDeadCheck("v8::Value::ToUint32()")) return Local<Uint32>();
1822
+ LOG_API("ToUInt32");
1823
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1824
+ i::Handle<i::Object> num;
1825
+ if (obj->IsSmi()) {
1826
+ num = obj;
1827
+ } else {
1828
+ ENTER_V8;
1829
+ EXCEPTION_PREAMBLE();
1830
+ num = i::Execution::ToUint32(obj, &has_pending_exception);
1831
+ EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
1832
+ }
1833
+ return Local<Uint32>(ToApi<Uint32>(num));
1834
+ }
1835
+
1836
+
1837
+ Local<Uint32> Value::ToArrayIndex() const {
1838
+ if (IsDeadCheck("v8::Value::ToArrayIndex()")) return Local<Uint32>();
1839
+ LOG_API("ToArrayIndex");
1840
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1841
+ if (obj->IsSmi()) {
1842
+ if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj);
1843
+ return Local<Uint32>();
1844
+ }
1845
+ ENTER_V8;
1846
+ EXCEPTION_PREAMBLE();
1847
+ i::Handle<i::Object> string_obj =
1848
+ i::Execution::ToString(obj, &has_pending_exception);
1849
+ EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
1850
+ i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj);
1851
+ uint32_t index;
1852
+ if (str->AsArrayIndex(&index)) {
1853
+ i::Handle<i::Object> value;
1854
+ if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) {
1855
+ value = i::Handle<i::Object>(i::Smi::FromInt(index));
1856
+ } else {
1857
+ value = i::Factory::NewNumber(index);
1858
+ }
1859
+ return Utils::Uint32ToLocal(value);
1860
+ }
1861
+ return Local<Uint32>();
1862
+ }
1863
+
1864
+
1865
+ int32_t Value::Int32Value() const {
1866
+ if (IsDeadCheck("v8::Value::Int32Value()")) return 0;
1867
+ LOG_API("Int32Value");
1868
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1869
+ if (obj->IsSmi()) {
1870
+ return i::Smi::cast(*obj)->value();
1871
+ } else {
1872
+ LOG_API("Int32Value (slow)");
1873
+ ENTER_V8;
1874
+ EXCEPTION_PREAMBLE();
1875
+ i::Handle<i::Object> num =
1876
+ i::Execution::ToInt32(obj, &has_pending_exception);
1877
+ EXCEPTION_BAILOUT_CHECK(0);
1878
+ if (num->IsSmi()) {
1879
+ return i::Smi::cast(*num)->value();
1880
+ } else {
1881
+ return static_cast<int32_t>(num->Number());
1882
+ }
1883
+ }
1884
+ }
1885
+
1886
+
1887
+ bool Value::Equals(Handle<Value> that) const {
1888
+ if (IsDeadCheck("v8::Value::Equals()")
1889
+ || EmptyCheck("v8::Value::Equals()", this)
1890
+ || EmptyCheck("v8::Value::Equals()", that)) {
1891
+ return false;
1892
+ }
1893
+ LOG_API("Equals");
1894
+ ENTER_V8;
1895
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1896
+ i::Handle<i::Object> other = Utils::OpenHandle(*that);
1897
+ i::Object** args[1] = { other.location() };
1898
+ EXCEPTION_PREAMBLE();
1899
+ i::Handle<i::Object> result =
1900
+ CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception);
1901
+ EXCEPTION_BAILOUT_CHECK(false);
1902
+ return *result == i::Smi::FromInt(i::EQUAL);
1903
+ }
1904
+
1905
+
1906
+ bool Value::StrictEquals(Handle<Value> that) const {
1907
+ if (IsDeadCheck("v8::Value::StrictEquals()")
1908
+ || EmptyCheck("v8::Value::StrictEquals()", this)
1909
+ || EmptyCheck("v8::Value::StrictEquals()", that)) {
1910
+ return false;
1911
+ }
1912
+ LOG_API("StrictEquals");
1913
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1914
+ i::Handle<i::Object> other = Utils::OpenHandle(*that);
1915
+ // Must check HeapNumber first, since NaN !== NaN.
1916
+ if (obj->IsHeapNumber()) {
1917
+ if (!other->IsNumber()) return false;
1918
+ double x = obj->Number();
1919
+ double y = other->Number();
1920
+ // Must check explicitly for NaN:s on Windows, but -0 works fine.
1921
+ return x == y && !isnan(x) && !isnan(y);
1922
+ } else if (*obj == *other) { // Also covers Booleans.
1923
+ return true;
1924
+ } else if (obj->IsSmi()) {
1925
+ return other->IsNumber() && obj->Number() == other->Number();
1926
+ } else if (obj->IsString()) {
1927
+ return other->IsString() &&
1928
+ i::String::cast(*obj)->Equals(i::String::cast(*other));
1929
+ } else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
1930
+ return other->IsUndefined() || other->IsUndetectableObject();
1931
+ } else {
1932
+ return false;
1933
+ }
1934
+ }
1935
+
1936
+
1937
+ uint32_t Value::Uint32Value() const {
1938
+ if (IsDeadCheck("v8::Value::Uint32Value()")) return 0;
1939
+ LOG_API("Uint32Value");
1940
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
1941
+ if (obj->IsSmi()) {
1942
+ return i::Smi::cast(*obj)->value();
1943
+ } else {
1944
+ ENTER_V8;
1945
+ EXCEPTION_PREAMBLE();
1946
+ i::Handle<i::Object> num =
1947
+ i::Execution::ToUint32(obj, &has_pending_exception);
1948
+ EXCEPTION_BAILOUT_CHECK(0);
1949
+ if (num->IsSmi()) {
1950
+ return i::Smi::cast(*num)->value();
1951
+ } else {
1952
+ return static_cast<uint32_t>(num->Number());
1953
+ }
1954
+ }
1955
+ }
1956
+
1957
+
1958
+ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
1959
+ v8::PropertyAttribute attribs) {
1960
+ ON_BAILOUT("v8::Object::Set()", return false);
1961
+ ENTER_V8;
1962
+ HandleScope scope;
1963
+ i::Handle<i::Object> self = Utils::OpenHandle(this);
1964
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
1965
+ i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
1966
+ EXCEPTION_PREAMBLE();
1967
+ i::Handle<i::Object> obj = i::SetProperty(
1968
+ self,
1969
+ key_obj,
1970
+ value_obj,
1971
+ static_cast<PropertyAttributes>(attribs));
1972
+ has_pending_exception = obj.is_null();
1973
+ EXCEPTION_BAILOUT_CHECK(false);
1974
+ return true;
1975
+ }
1976
+
1977
+
1978
+ bool v8::Object::ForceSet(v8::Handle<Value> key,
1979
+ v8::Handle<Value> value,
1980
+ v8::PropertyAttribute attribs) {
1981
+ ON_BAILOUT("v8::Object::ForceSet()", return false);
1982
+ ENTER_V8;
1983
+ HandleScope scope;
1984
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1985
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
1986
+ i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
1987
+ EXCEPTION_PREAMBLE();
1988
+ i::Handle<i::Object> obj = i::ForceSetProperty(
1989
+ self,
1990
+ key_obj,
1991
+ value_obj,
1992
+ static_cast<PropertyAttributes>(attribs));
1993
+ has_pending_exception = obj.is_null();
1994
+ EXCEPTION_BAILOUT_CHECK(false);
1995
+ return true;
1996
+ }
1997
+
1998
+
1999
+ bool v8::Object::ForceDelete(v8::Handle<Value> key) {
2000
+ ON_BAILOUT("v8::Object::ForceDelete()", return false);
2001
+ ENTER_V8;
2002
+ HandleScope scope;
2003
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2004
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2005
+ EXCEPTION_PREAMBLE();
2006
+ i::Handle<i::Object> obj = i::ForceDeleteProperty(self, key_obj);
2007
+ has_pending_exception = obj.is_null();
2008
+ EXCEPTION_BAILOUT_CHECK(false);
2009
+ return obj->IsTrue();
2010
+ }
2011
+
2012
+
2013
+ Local<Value> v8::Object::Get(v8::Handle<Value> key) {
2014
+ ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>());
2015
+ ENTER_V8;
2016
+ i::Handle<i::Object> self = Utils::OpenHandle(this);
2017
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2018
+ EXCEPTION_PREAMBLE();
2019
+ i::Handle<i::Object> result = i::GetProperty(self, key_obj);
2020
+ has_pending_exception = result.is_null();
2021
+ EXCEPTION_BAILOUT_CHECK(Local<Value>());
2022
+ return Utils::ToLocal(result);
2023
+ }
2024
+
2025
+
2026
+ Local<Value> v8::Object::GetPrototype() {
2027
+ ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>());
2028
+ ENTER_V8;
2029
+ i::Handle<i::Object> self = Utils::OpenHandle(this);
2030
+ i::Handle<i::Object> result = i::GetPrototype(self);
2031
+ return Utils::ToLocal(result);
2032
+ }
2033
+
2034
+
2035
+ Local<Object> v8::Object::FindInstanceInPrototypeChain(
2036
+ v8::Handle<FunctionTemplate> tmpl) {
2037
+ ON_BAILOUT("v8::Object::FindInstanceInPrototypeChain()",
2038
+ return Local<v8::Object>());
2039
+ ENTER_V8;
2040
+ i::JSObject* object = *Utils::OpenHandle(this);
2041
+ i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
2042
+ while (!object->IsInstanceOf(tmpl_info)) {
2043
+ i::Object* prototype = object->GetPrototype();
2044
+ if (!prototype->IsJSObject()) return Local<Object>();
2045
+ object = i::JSObject::cast(prototype);
2046
+ }
2047
+ return Utils::ToLocal(i::Handle<i::JSObject>(object));
2048
+ }
2049
+
2050
+
2051
+ Local<Array> v8::Object::GetPropertyNames() {
2052
+ ON_BAILOUT("v8::Object::GetPropertyNames()", return Local<v8::Array>());
2053
+ ENTER_V8;
2054
+ v8::HandleScope scope;
2055
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2056
+ i::Handle<i::FixedArray> value =
2057
+ i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS);
2058
+ // Because we use caching to speed up enumeration it is important
2059
+ // to never change the result of the basic enumeration function so
2060
+ // we clone the result.
2061
+ i::Handle<i::FixedArray> elms = i::Factory::CopyFixedArray(value);
2062
+ i::Handle<i::JSArray> result = i::Factory::NewJSArrayWithElements(elms);
2063
+ return scope.Close(Utils::ToLocal(result));
2064
+ }
2065
+
2066
+
2067
+ Local<String> v8::Object::ObjectProtoToString() {
2068
+ ON_BAILOUT("v8::Object::ObjectProtoToString()", return Local<v8::String>());
2069
+ ENTER_V8;
2070
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2071
+
2072
+ i::Handle<i::Object> name(self->class_name());
2073
+
2074
+ // Native implementation of Object.prototype.toString (v8natives.js):
2075
+ // var c = %ClassOf(this);
2076
+ // if (c === 'Arguments') c = 'Object';
2077
+ // return "[object " + c + "]";
2078
+
2079
+ if (!name->IsString()) {
2080
+ return v8::String::New("[object ]");
2081
+
2082
+ } else {
2083
+ i::Handle<i::String> class_name = i::Handle<i::String>::cast(name);
2084
+ if (class_name->IsEqualTo(i::CStrVector("Arguments"))) {
2085
+ return v8::String::New("[object Object]");
2086
+
2087
+ } else {
2088
+ const char* prefix = "[object ";
2089
+ Local<String> str = Utils::ToLocal(class_name);
2090
+ const char* postfix = "]";
2091
+
2092
+ int prefix_len = i::StrLength(prefix);
2093
+ int str_len = str->Length();
2094
+ int postfix_len = i::StrLength(postfix);
2095
+
2096
+ int buf_len = prefix_len + str_len + postfix_len;
2097
+ char* buf = i::NewArray<char>(buf_len);
2098
+
2099
+ // Write prefix.
2100
+ char* ptr = buf;
2101
+ memcpy(ptr, prefix, prefix_len * v8::internal::kCharSize);
2102
+ ptr += prefix_len;
2103
+
2104
+ // Write real content.
2105
+ str->WriteAscii(ptr, 0, str_len);
2106
+ ptr += str_len;
2107
+
2108
+ // Write postfix.
2109
+ memcpy(ptr, postfix, postfix_len * v8::internal::kCharSize);
2110
+
2111
+ // Copy the buffer into a heap-allocated string and return it.
2112
+ Local<String> result = v8::String::New(buf, buf_len);
2113
+ i::DeleteArray(buf);
2114
+ return result;
2115
+ }
2116
+ }
2117
+ }
2118
+
2119
+
2120
+ bool v8::Object::Delete(v8::Handle<String> key) {
2121
+ ON_BAILOUT("v8::Object::Delete()", return false);
2122
+ ENTER_V8;
2123
+ HandleScope scope;
2124
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2125
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2126
+ return i::DeleteProperty(self, key_obj)->IsTrue();
2127
+ }
2128
+
2129
+
2130
+ bool v8::Object::Has(v8::Handle<String> key) {
2131
+ ON_BAILOUT("v8::Object::Has()", return false);
2132
+ ENTER_V8;
2133
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2134
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2135
+ return self->HasProperty(*key_obj);
2136
+ }
2137
+
2138
+
2139
+ bool v8::Object::Delete(uint32_t index) {
2140
+ ON_BAILOUT("v8::Object::DeleteProperty()", return false);
2141
+ ENTER_V8;
2142
+ HandleScope scope;
2143
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2144
+ return i::DeleteElement(self, index)->IsTrue();
2145
+ }
2146
+
2147
+
2148
+ bool v8::Object::Has(uint32_t index) {
2149
+ ON_BAILOUT("v8::Object::HasProperty()", return false);
2150
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2151
+ return self->HasElement(index);
2152
+ }
2153
+
2154
+
2155
+ bool v8::Object::HasRealNamedProperty(Handle<String> key) {
2156
+ ON_BAILOUT("v8::Object::HasRealNamedProperty()", return false);
2157
+ return Utils::OpenHandle(this)->HasRealNamedProperty(
2158
+ *Utils::OpenHandle(*key));
2159
+ }
2160
+
2161
+
2162
+ bool v8::Object::HasRealIndexedProperty(uint32_t index) {
2163
+ ON_BAILOUT("v8::Object::HasRealIndexedProperty()", return false);
2164
+ return Utils::OpenHandle(this)->HasRealElementProperty(index);
2165
+ }
2166
+
2167
+
2168
+ bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) {
2169
+ ON_BAILOUT("v8::Object::HasRealNamedCallbackProperty()", return false);
2170
+ ENTER_V8;
2171
+ return Utils::OpenHandle(this)->HasRealNamedCallbackProperty(
2172
+ *Utils::OpenHandle(*key));
2173
+ }
2174
+
2175
+
2176
+ bool v8::Object::HasNamedLookupInterceptor() {
2177
+ ON_BAILOUT("v8::Object::HasNamedLookupInterceptor()", return false);
2178
+ return Utils::OpenHandle(this)->HasNamedInterceptor();
2179
+ }
2180
+
2181
+
2182
+ bool v8::Object::HasIndexedLookupInterceptor() {
2183
+ ON_BAILOUT("v8::Object::HasIndexedLookupInterceptor()", return false);
2184
+ return Utils::OpenHandle(this)->HasIndexedInterceptor();
2185
+ }
2186
+
2187
+
2188
+ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
2189
+ Handle<String> key) {
2190
+ ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()",
2191
+ return Local<Value>());
2192
+ ENTER_V8;
2193
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2194
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2195
+ i::LookupResult lookup;
2196
+ self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
2197
+ if (lookup.IsValid()) {
2198
+ PropertyAttributes attributes;
2199
+ i::Handle<i::Object> result(self_obj->GetProperty(*self_obj,
2200
+ &lookup,
2201
+ *key_obj,
2202
+ &attributes));
2203
+ return Utils::ToLocal(result);
2204
+ }
2205
+ return Local<Value>(); // No real property was found in prototype chain.
2206
+ }
2207
+
2208
+
2209
+ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
2210
+ ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>());
2211
+ ENTER_V8;
2212
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2213
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2214
+ i::LookupResult lookup;
2215
+ self_obj->LookupRealNamedProperty(*key_obj, &lookup);
2216
+ if (lookup.IsValid()) {
2217
+ PropertyAttributes attributes;
2218
+ i::Handle<i::Object> result(self_obj->GetProperty(*self_obj,
2219
+ &lookup,
2220
+ *key_obj,
2221
+ &attributes));
2222
+ return Utils::ToLocal(result);
2223
+ }
2224
+ return Local<Value>(); // No real property was found in prototype chain.
2225
+ }
2226
+
2227
+
2228
+ // Turns on access checks by copying the map and setting the check flag.
2229
+ // Because the object gets a new map, existing inline cache caching
2230
+ // the old map of this object will fail.
2231
+ void v8::Object::TurnOnAccessCheck() {
2232
+ ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return);
2233
+ ENTER_V8;
2234
+ HandleScope scope;
2235
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2236
+
2237
+ i::Handle<i::Map> new_map =
2238
+ i::Factory::CopyMapDropTransitions(i::Handle<i::Map>(obj->map()));
2239
+ new_map->set_is_access_check_needed(true);
2240
+ obj->set_map(*new_map);
2241
+ }
2242
+
2243
+
2244
+ bool v8::Object::IsDirty() {
2245
+ return Utils::OpenHandle(this)->IsDirty();
2246
+ }
2247
+
2248
+
2249
+ Local<v8::Object> v8::Object::Clone() {
2250
+ ON_BAILOUT("v8::Object::Clone()", return Local<Object>());
2251
+ ENTER_V8;
2252
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2253
+ EXCEPTION_PREAMBLE();
2254
+ i::Handle<i::JSObject> result = i::Copy(self);
2255
+ has_pending_exception = result.is_null();
2256
+ EXCEPTION_BAILOUT_CHECK(Local<Object>());
2257
+ return Utils::ToLocal(result);
2258
+ }
2259
+
2260
+
2261
+ int v8::Object::GetIdentityHash() {
2262
+ ON_BAILOUT("v8::Object::GetIdentityHash()", return 0);
2263
+ ENTER_V8;
2264
+ HandleScope scope;
2265
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2266
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
2267
+ i::Handle<i::Object> hash_symbol = i::Factory::identity_hash_symbol();
2268
+ i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol);
2269
+ int hash_value;
2270
+ if (hash->IsSmi()) {
2271
+ hash_value = i::Smi::cast(*hash)->value();
2272
+ } else {
2273
+ int attempts = 0;
2274
+ do {
2275
+ // Generate a random 32-bit hash value but limit range to fit
2276
+ // within a smi.
2277
+ hash_value = i::V8::Random() & i::Smi::kMaxValue;
2278
+ attempts++;
2279
+ } while (hash_value == 0 && attempts < 30);
2280
+ hash_value = hash_value != 0 ? hash_value : 1; // never return 0
2281
+ i::SetProperty(hidden_props,
2282
+ hash_symbol,
2283
+ i::Handle<i::Object>(i::Smi::FromInt(hash_value)),
2284
+ static_cast<PropertyAttributes>(None));
2285
+ }
2286
+ return hash_value;
2287
+ }
2288
+
2289
+
2290
+ bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
2291
+ v8::Handle<v8::Value> value) {
2292
+ ON_BAILOUT("v8::Object::SetHiddenValue()", return false);
2293
+ ENTER_V8;
2294
+ HandleScope scope;
2295
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2296
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
2297
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2298
+ i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2299
+ EXCEPTION_PREAMBLE();
2300
+ i::Handle<i::Object> obj = i::SetProperty(
2301
+ hidden_props,
2302
+ key_obj,
2303
+ value_obj,
2304
+ static_cast<PropertyAttributes>(None));
2305
+ has_pending_exception = obj.is_null();
2306
+ EXCEPTION_BAILOUT_CHECK(false);
2307
+ return true;
2308
+ }
2309
+
2310
+
2311
+ v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
2312
+ ON_BAILOUT("v8::Object::GetHiddenValue()", return Local<v8::Value>());
2313
+ ENTER_V8;
2314
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2315
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
2316
+ if (hidden_props->IsUndefined()) {
2317
+ return v8::Local<v8::Value>();
2318
+ }
2319
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2320
+ EXCEPTION_PREAMBLE();
2321
+ i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj);
2322
+ has_pending_exception = result.is_null();
2323
+ EXCEPTION_BAILOUT_CHECK(v8::Local<v8::Value>());
2324
+ if (result->IsUndefined()) {
2325
+ return v8::Local<v8::Value>();
2326
+ }
2327
+ return Utils::ToLocal(result);
2328
+ }
2329
+
2330
+
2331
+ bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
2332
+ ON_BAILOUT("v8::DeleteHiddenValue()", return false);
2333
+ ENTER_V8;
2334
+ HandleScope scope;
2335
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2336
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
2337
+ if (hidden_props->IsUndefined()) {
2338
+ return true;
2339
+ }
2340
+ i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props));
2341
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2342
+ return i::DeleteProperty(js_obj, key_obj)->IsTrue();
2343
+ }
2344
+
2345
+
2346
+ void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
2347
+ ON_BAILOUT("v8::SetElementsToPixelData()", return);
2348
+ ENTER_V8;
2349
+ HandleScope scope;
2350
+ if (!ApiCheck(length <= i::PixelArray::kMaxLength,
2351
+ "v8::Object::SetIndexedPropertiesToPixelData()",
2352
+ "length exceeds max acceptable value")) {
2353
+ return;
2354
+ }
2355
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2356
+ if (!ApiCheck(!self->IsJSArray(),
2357
+ "v8::Object::SetIndexedPropertiesToPixelData()",
2358
+ "JSArray is not supported")) {
2359
+ return;
2360
+ }
2361
+ i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(length, data);
2362
+ self->set_elements(*pixels);
2363
+ }
2364
+
2365
+
2366
+ void v8::Object::SetIndexedPropertiesToExternalArrayData(
2367
+ void* data,
2368
+ ExternalArrayType array_type,
2369
+ int length) {
2370
+ ON_BAILOUT("v8::SetIndexedPropertiesToExternalArrayData()", return);
2371
+ ENTER_V8;
2372
+ HandleScope scope;
2373
+ if (!ApiCheck(length <= i::ExternalArray::kMaxLength,
2374
+ "v8::Object::SetIndexedPropertiesToExternalArrayData()",
2375
+ "length exceeds max acceptable value")) {
2376
+ return;
2377
+ }
2378
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2379
+ if (!ApiCheck(!self->IsJSArray(),
2380
+ "v8::Object::SetIndexedPropertiesToExternalArrayData()",
2381
+ "JSArray is not supported")) {
2382
+ return;
2383
+ }
2384
+ i::Handle<i::ExternalArray> array =
2385
+ i::Factory::NewExternalArray(length, array_type, data);
2386
+ self->set_elements(*array);
2387
+ }
2388
+
2389
+
2390
+ Local<v8::Object> Function::NewInstance() const {
2391
+ return NewInstance(0, NULL);
2392
+ }
2393
+
2394
+
2395
+ Local<v8::Object> Function::NewInstance(int argc,
2396
+ v8::Handle<v8::Value> argv[]) const {
2397
+ ON_BAILOUT("v8::Function::NewInstance()", return Local<v8::Object>());
2398
+ LOG_API("Function::NewInstance");
2399
+ ENTER_V8;
2400
+ HandleScope scope;
2401
+ i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
2402
+ STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
2403
+ i::Object*** args = reinterpret_cast<i::Object***>(argv);
2404
+ EXCEPTION_PREAMBLE();
2405
+ i::Handle<i::Object> returned =
2406
+ i::Execution::New(function, argc, args, &has_pending_exception);
2407
+ EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
2408
+ return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
2409
+ }
2410
+
2411
+
2412
+ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
2413
+ v8::Handle<v8::Value> argv[]) {
2414
+ ON_BAILOUT("v8::Function::Call()", return Local<v8::Value>());
2415
+ LOG_API("Function::Call");
2416
+ ENTER_V8;
2417
+ i::Object* raw_result = NULL;
2418
+ {
2419
+ HandleScope scope;
2420
+ i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
2421
+ i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
2422
+ STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
2423
+ i::Object*** args = reinterpret_cast<i::Object***>(argv);
2424
+ EXCEPTION_PREAMBLE();
2425
+ i::Handle<i::Object> returned =
2426
+ i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
2427
+ EXCEPTION_BAILOUT_CHECK(Local<Object>());
2428
+ raw_result = *returned;
2429
+ }
2430
+ i::Handle<i::Object> result(raw_result);
2431
+ return Utils::ToLocal(result);
2432
+ }
2433
+
2434
+
2435
+ void Function::SetName(v8::Handle<v8::String> name) {
2436
+ ENTER_V8;
2437
+ i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
2438
+ func->shared()->set_name(*Utils::OpenHandle(*name));
2439
+ }
2440
+
2441
+
2442
+ Handle<Value> Function::GetName() const {
2443
+ i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
2444
+ return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name()));
2445
+ }
2446
+
2447
+
2448
+ int String::Length() const {
2449
+ if (IsDeadCheck("v8::String::Length()")) return 0;
2450
+ return Utils::OpenHandle(this)->length();
2451
+ }
2452
+
2453
+
2454
+ int String::Utf8Length() const {
2455
+ if (IsDeadCheck("v8::String::Utf8Length()")) return 0;
2456
+ return Utils::OpenHandle(this)->Utf8Length();
2457
+ }
2458
+
2459
+
2460
+ int String::WriteUtf8(char* buffer, int capacity) const {
2461
+ if (IsDeadCheck("v8::String::WriteUtf8()")) return 0;
2462
+ LOG_API("String::WriteUtf8");
2463
+ ENTER_V8;
2464
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2465
+ write_input_buffer.Reset(0, *str);
2466
+ int len = str->length();
2467
+ // Encode the first K - 3 bytes directly into the buffer since we
2468
+ // know there's room for them. If no capacity is given we copy all
2469
+ // of them here.
2470
+ int fast_end = capacity - (unibrow::Utf8::kMaxEncodedSize - 1);
2471
+ int i;
2472
+ int pos = 0;
2473
+ for (i = 0; i < len && (capacity == -1 || pos < fast_end); i++) {
2474
+ i::uc32 c = write_input_buffer.GetNext();
2475
+ int written = unibrow::Utf8::Encode(buffer + pos, c);
2476
+ pos += written;
2477
+ }
2478
+ if (i < len) {
2479
+ // For the last characters we need to check the length for each one
2480
+ // because they may be longer than the remaining space in the
2481
+ // buffer.
2482
+ char intermediate[unibrow::Utf8::kMaxEncodedSize];
2483
+ for (; i < len && pos < capacity; i++) {
2484
+ i::uc32 c = write_input_buffer.GetNext();
2485
+ int written = unibrow::Utf8::Encode(intermediate, c);
2486
+ if (pos + written <= capacity) {
2487
+ for (int j = 0; j < written; j++)
2488
+ buffer[pos + j] = intermediate[j];
2489
+ pos += written;
2490
+ } else {
2491
+ // We've reached the end of the buffer
2492
+ break;
2493
+ }
2494
+ }
2495
+ }
2496
+ if (i == len && (capacity == -1 || pos < capacity))
2497
+ buffer[pos++] = '\0';
2498
+ return pos;
2499
+ }
2500
+
2501
+
2502
+ int String::WriteAscii(char* buffer, int start, int length) const {
2503
+ if (IsDeadCheck("v8::String::WriteAscii()")) return 0;
2504
+ LOG_API("String::WriteAscii");
2505
+ ENTER_V8;
2506
+ ASSERT(start >= 0 && length >= -1);
2507
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2508
+ // Flatten the string for efficiency. This applies whether we are
2509
+ // using StringInputBuffer or Get(i) to access the characters.
2510
+ str->TryFlattenIfNotFlat();
2511
+ int end = length;
2512
+ if ( (length == -1) || (length > str->length() - start) )
2513
+ end = str->length() - start;
2514
+ if (end < 0) return 0;
2515
+ write_input_buffer.Reset(start, *str);
2516
+ int i;
2517
+ for (i = 0; i < end; i++) {
2518
+ char c = static_cast<char>(write_input_buffer.GetNext());
2519
+ if (c == '\0') c = ' ';
2520
+ buffer[i] = c;
2521
+ }
2522
+ if (length == -1 || i < length)
2523
+ buffer[i] = '\0';
2524
+ return i;
2525
+ }
2526
+
2527
+
2528
+ int String::Write(uint16_t* buffer, int start, int length) const {
2529
+ if (IsDeadCheck("v8::String::Write()")) return 0;
2530
+ LOG_API("String::Write");
2531
+ ENTER_V8;
2532
+ ASSERT(start >= 0 && length >= -1);
2533
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2534
+ int end = length;
2535
+ if ( (length == -1) || (length > str->length() - start) )
2536
+ end = str->length() - start;
2537
+ if (end < 0) return 0;
2538
+ i::String::WriteToFlat(*str, buffer, start, end);
2539
+ if (length == -1 || end < length)
2540
+ buffer[end] = '\0';
2541
+ return end;
2542
+ }
2543
+
2544
+
2545
+ bool v8::String::IsExternal() const {
2546
+ EnsureInitialized("v8::String::IsExternal()");
2547
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2548
+ return i::StringShape(*str).IsExternalTwoByte();
2549
+ }
2550
+
2551
+
2552
+ bool v8::String::IsExternalAscii() const {
2553
+ EnsureInitialized("v8::String::IsExternalAscii()");
2554
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2555
+ return i::StringShape(*str).IsExternalAscii();
2556
+ }
2557
+
2558
+
2559
+ void v8::String::VerifyExternalStringResource(
2560
+ v8::String::ExternalStringResource* value) const {
2561
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2562
+ v8::String::ExternalStringResource* expected;
2563
+ if (i::StringShape(*str).IsExternalTwoByte()) {
2564
+ void* resource = i::Handle<i::ExternalTwoByteString>::cast(str)->resource();
2565
+ expected = reinterpret_cast<ExternalStringResource*>(resource);
2566
+ } else {
2567
+ expected = NULL;
2568
+ }
2569
+ CHECK_EQ(expected, value);
2570
+ }
2571
+
2572
+
2573
+ v8::String::ExternalAsciiStringResource*
2574
+ v8::String::GetExternalAsciiStringResource() const {
2575
+ EnsureInitialized("v8::String::GetExternalAsciiStringResource()");
2576
+ i::Handle<i::String> str = Utils::OpenHandle(this);
2577
+ if (i::StringShape(*str).IsExternalAscii()) {
2578
+ void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource();
2579
+ return reinterpret_cast<ExternalAsciiStringResource*>(resource);
2580
+ } else {
2581
+ return NULL;
2582
+ }
2583
+ }
2584
+
2585
+
2586
+ double Number::Value() const {
2587
+ if (IsDeadCheck("v8::Number::Value()")) return 0;
2588
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2589
+ return obj->Number();
2590
+ }
2591
+
2592
+
2593
+ bool Boolean::Value() const {
2594
+ if (IsDeadCheck("v8::Boolean::Value()")) return false;
2595
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2596
+ return obj->IsTrue();
2597
+ }
2598
+
2599
+
2600
+ int64_t Integer::Value() const {
2601
+ if (IsDeadCheck("v8::Integer::Value()")) return 0;
2602
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2603
+ if (obj->IsSmi()) {
2604
+ return i::Smi::cast(*obj)->value();
2605
+ } else {
2606
+ return static_cast<int64_t>(obj->Number());
2607
+ }
2608
+ }
2609
+
2610
+
2611
+ int32_t Int32::Value() const {
2612
+ if (IsDeadCheck("v8::Int32::Value()")) return 0;
2613
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2614
+ if (obj->IsSmi()) {
2615
+ return i::Smi::cast(*obj)->value();
2616
+ } else {
2617
+ return static_cast<int32_t>(obj->Number());
2618
+ }
2619
+ }
2620
+
2621
+
2622
+ int v8::Object::InternalFieldCount() {
2623
+ if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0;
2624
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2625
+ return obj->GetInternalFieldCount();
2626
+ }
2627
+
2628
+
2629
+ Local<Value> v8::Object::CheckedGetInternalField(int index) {
2630
+ if (IsDeadCheck("v8::Object::GetInternalField()")) return Local<Value>();
2631
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2632
+ if (!ApiCheck(index < obj->GetInternalFieldCount(),
2633
+ "v8::Object::GetInternalField()",
2634
+ "Reading internal field out of bounds")) {
2635
+ return Local<Value>();
2636
+ }
2637
+ i::Handle<i::Object> value(obj->GetInternalField(index));
2638
+ Local<Value> result = Utils::ToLocal(value);
2639
+ #ifdef DEBUG
2640
+ Local<Value> unchecked = UncheckedGetInternalField(index);
2641
+ ASSERT(unchecked.IsEmpty() || (unchecked == result));
2642
+ #endif
2643
+ return result;
2644
+ }
2645
+
2646
+
2647
+ void v8::Object::SetInternalField(int index, v8::Handle<Value> value) {
2648
+ if (IsDeadCheck("v8::Object::SetInternalField()")) return;
2649
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2650
+ if (!ApiCheck(index < obj->GetInternalFieldCount(),
2651
+ "v8::Object::SetInternalField()",
2652
+ "Writing internal field out of bounds")) {
2653
+ return;
2654
+ }
2655
+ ENTER_V8;
2656
+ i::Handle<i::Object> val = Utils::OpenHandle(*value);
2657
+ obj->SetInternalField(index, *val);
2658
+ }
2659
+
2660
+
2661
+ void v8::Object::SetPointerInInternalField(int index, void* value) {
2662
+ i::Object* as_object = reinterpret_cast<i::Object*>(value);
2663
+ if (as_object->IsSmi()) {
2664
+ Utils::OpenHandle(this)->SetInternalField(index, as_object);
2665
+ return;
2666
+ }
2667
+ HandleScope scope;
2668
+ i::Handle<i::Proxy> proxy =
2669
+ i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
2670
+ if (!proxy.is_null())
2671
+ Utils::OpenHandle(this)->SetInternalField(index, *proxy);
2672
+ }
2673
+
2674
+
2675
+ // --- E n v i r o n m e n t ---
2676
+
2677
+ bool v8::V8::Initialize() {
2678
+ if (i::V8::IsRunning()) return true;
2679
+ ENTER_V8;
2680
+ HandleScope scope;
2681
+ if (i::Snapshot::Initialize()) return true;
2682
+ return i::V8::Initialize(NULL);
2683
+ }
2684
+
2685
+
2686
+ bool v8::V8::Dispose() {
2687
+ i::V8::TearDown();
2688
+ return true;
2689
+ }
2690
+
2691
+
2692
+ HeapStatistics::HeapStatistics(): total_heap_size_(0), used_heap_size_(0) { }
2693
+
2694
+
2695
+ void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
2696
+ heap_statistics->set_total_heap_size(i::Heap::CommittedMemory());
2697
+ heap_statistics->set_used_heap_size(i::Heap::SizeOfObjects());
2698
+ }
2699
+
2700
+
2701
+ bool v8::V8::IdleNotification() {
2702
+ // Returning true tells the caller that it need not
2703
+ // continue to call IdleNotification.
2704
+ if (!i::V8::IsRunning()) return true;
2705
+ return i::V8::IdleNotification();
2706
+ }
2707
+
2708
+
2709
+ void v8::V8::LowMemoryNotification() {
2710
+ if (!i::V8::IsRunning()) return;
2711
+ i::Heap::CollectAllGarbage(true);
2712
+ }
2713
+
2714
+
2715
+ const char* v8::V8::GetVersion() {
2716
+ static v8::internal::EmbeddedVector<char, 128> buffer;
2717
+ v8::internal::Version::GetString(buffer);
2718
+ return buffer.start();
2719
+ }
2720
+
2721
+
2722
+ static i::Handle<i::FunctionTemplateInfo>
2723
+ EnsureConstructor(i::Handle<i::ObjectTemplateInfo> templ) {
2724
+ if (templ->constructor()->IsUndefined()) {
2725
+ Local<FunctionTemplate> constructor = FunctionTemplate::New();
2726
+ Utils::OpenHandle(*constructor)->set_instance_template(*templ);
2727
+ templ->set_constructor(*Utils::OpenHandle(*constructor));
2728
+ }
2729
+ return i::Handle<i::FunctionTemplateInfo>(
2730
+ i::FunctionTemplateInfo::cast(templ->constructor()));
2731
+ }
2732
+
2733
+
2734
+ Persistent<Context> v8::Context::New(
2735
+ v8::ExtensionConfiguration* extensions,
2736
+ v8::Handle<ObjectTemplate> global_template,
2737
+ v8::Handle<Value> global_object) {
2738
+ EnsureInitialized("v8::Context::New()");
2739
+ LOG_API("Context::New");
2740
+ ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
2741
+
2742
+ // Enter V8 via an ENTER_V8 scope.
2743
+ i::Handle<i::Context> env;
2744
+ {
2745
+ ENTER_V8;
2746
+ #if defined(ANDROID)
2747
+ // On mobile device, full GC is expensive, leave it to the system to
2748
+ // decide when should make a full GC.
2749
+ #else
2750
+ // Give the heap a chance to cleanup if we've disposed contexts.
2751
+ i::Heap::CollectAllGarbageIfContextDisposed();
2752
+ #endif
2753
+ v8::Handle<ObjectTemplate> proxy_template = global_template;
2754
+ i::Handle<i::FunctionTemplateInfo> proxy_constructor;
2755
+ i::Handle<i::FunctionTemplateInfo> global_constructor;
2756
+
2757
+ if (!global_template.IsEmpty()) {
2758
+ // Make sure that the global_template has a constructor.
2759
+ global_constructor =
2760
+ EnsureConstructor(Utils::OpenHandle(*global_template));
2761
+
2762
+ // Create a fresh template for the global proxy object.
2763
+ proxy_template = ObjectTemplate::New();
2764
+ proxy_constructor =
2765
+ EnsureConstructor(Utils::OpenHandle(*proxy_template));
2766
+
2767
+ // Set the global template to be the prototype template of
2768
+ // global proxy template.
2769
+ proxy_constructor->set_prototype_template(
2770
+ *Utils::OpenHandle(*global_template));
2771
+
2772
+ // Migrate security handlers from global_template to
2773
+ // proxy_template. Temporarily removing access check
2774
+ // information from the global template.
2775
+ if (!global_constructor->access_check_info()->IsUndefined()) {
2776
+ proxy_constructor->set_access_check_info(
2777
+ global_constructor->access_check_info());
2778
+ proxy_constructor->set_needs_access_check(
2779
+ global_constructor->needs_access_check());
2780
+ global_constructor->set_needs_access_check(false);
2781
+ global_constructor->set_access_check_info(i::Heap::undefined_value());
2782
+ }
2783
+ }
2784
+
2785
+ // Create the environment.
2786
+ env = i::Bootstrapper::CreateEnvironment(
2787
+ Utils::OpenHandle(*global_object),
2788
+ proxy_template,
2789
+ extensions);
2790
+
2791
+ // Restore the access check info on the global template.
2792
+ if (!global_template.IsEmpty()) {
2793
+ ASSERT(!global_constructor.is_null());
2794
+ ASSERT(!proxy_constructor.is_null());
2795
+ global_constructor->set_access_check_info(
2796
+ proxy_constructor->access_check_info());
2797
+ global_constructor->set_needs_access_check(
2798
+ proxy_constructor->needs_access_check());
2799
+ }
2800
+ }
2801
+ // Leave V8.
2802
+
2803
+ if (env.is_null())
2804
+ return Persistent<Context>();
2805
+ return Persistent<Context>(Utils::ToLocal(env));
2806
+ }
2807
+
2808
+
2809
+ void v8::Context::SetSecurityToken(Handle<Value> token) {
2810
+ if (IsDeadCheck("v8::Context::SetSecurityToken()")) return;
2811
+ ENTER_V8;
2812
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
2813
+ i::Handle<i::Object> token_handle = Utils::OpenHandle(*token);
2814
+ env->set_security_token(*token_handle);
2815
+ }
2816
+
2817
+
2818
+ void v8::Context::UseDefaultSecurityToken() {
2819
+ if (IsDeadCheck("v8::Context::UseDefaultSecurityToken()")) return;
2820
+ ENTER_V8;
2821
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
2822
+ env->set_security_token(env->global());
2823
+ }
2824
+
2825
+
2826
+ Handle<Value> v8::Context::GetSecurityToken() {
2827
+ if (IsDeadCheck("v8::Context::GetSecurityToken()")) return Handle<Value>();
2828
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
2829
+ i::Object* security_token = env->security_token();
2830
+ i::Handle<i::Object> token_handle(security_token);
2831
+ return Utils::ToLocal(token_handle);
2832
+ }
2833
+
2834
+
2835
+ bool Context::HasOutOfMemoryException() {
2836
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
2837
+ return env->has_out_of_memory();
2838
+ }
2839
+
2840
+
2841
+ bool Context::InContext() {
2842
+ return i::Top::context() != NULL;
2843
+ }
2844
+
2845
+
2846
+ v8::Local<v8::Context> Context::GetEntered() {
2847
+ if (IsDeadCheck("v8::Context::GetEntered()")) return Local<Context>();
2848
+ i::Handle<i::Object> last = thread_local.LastEnteredContext();
2849
+ if (last.is_null()) return Local<Context>();
2850
+ i::Handle<i::Context> context = i::Handle<i::Context>::cast(last);
2851
+ return Utils::ToLocal(context);
2852
+ }
2853
+
2854
+
2855
+ v8::Local<v8::Context> Context::GetCurrent() {
2856
+ if (IsDeadCheck("v8::Context::GetCurrent()")) return Local<Context>();
2857
+ i::Handle<i::Object> current = i::Top::global_context();
2858
+ if (current.is_null()) return Local<Context>();
2859
+ i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
2860
+ return Utils::ToLocal(context);
2861
+ }
2862
+
2863
+
2864
+ v8::Local<v8::Context> Context::GetCalling() {
2865
+ if (IsDeadCheck("v8::Context::GetCalling()")) return Local<Context>();
2866
+ i::Handle<i::Object> calling = i::Top::GetCallingGlobalContext();
2867
+ if (calling.is_null()) return Local<Context>();
2868
+ i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling);
2869
+ return Utils::ToLocal(context);
2870
+ }
2871
+
2872
+
2873
+ v8::Local<v8::Object> Context::Global() {
2874
+ if (IsDeadCheck("v8::Context::Global()")) return Local<v8::Object>();
2875
+ i::Object** ctx = reinterpret_cast<i::Object**>(this);
2876
+ i::Handle<i::Context> context =
2877
+ i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
2878
+ i::Handle<i::Object> global(context->global_proxy());
2879
+ return Utils::ToLocal(i::Handle<i::JSObject>::cast(global));
2880
+ }
2881
+
2882
+
2883
+ void Context::DetachGlobal() {
2884
+ if (IsDeadCheck("v8::Context::DetachGlobal()")) return;
2885
+ ENTER_V8;
2886
+ i::Object** ctx = reinterpret_cast<i::Object**>(this);
2887
+ i::Handle<i::Context> context =
2888
+ i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
2889
+ i::Bootstrapper::DetachGlobal(context);
2890
+ }
2891
+
2892
+
2893
+ Local<v8::Object> ObjectTemplate::NewInstance() {
2894
+ ON_BAILOUT("v8::ObjectTemplate::NewInstance()", return Local<v8::Object>());
2895
+ LOG_API("ObjectTemplate::NewInstance");
2896
+ ENTER_V8;
2897
+ EXCEPTION_PREAMBLE();
2898
+ i::Handle<i::Object> obj =
2899
+ i::Execution::InstantiateObject(Utils::OpenHandle(this),
2900
+ &has_pending_exception);
2901
+ EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
2902
+ return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj));
2903
+ }
2904
+
2905
+
2906
+ Local<v8::Function> FunctionTemplate::GetFunction() {
2907
+ ON_BAILOUT("v8::FunctionTemplate::GetFunction()",
2908
+ return Local<v8::Function>());
2909
+ LOG_API("FunctionTemplate::GetFunction");
2910
+ ENTER_V8;
2911
+ EXCEPTION_PREAMBLE();
2912
+ i::Handle<i::Object> obj =
2913
+ i::Execution::InstantiateFunction(Utils::OpenHandle(this),
2914
+ &has_pending_exception);
2915
+ EXCEPTION_BAILOUT_CHECK(Local<v8::Function>());
2916
+ return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj));
2917
+ }
2918
+
2919
+
2920
+ bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
2921
+ ON_BAILOUT("v8::FunctionTemplate::HasInstanceOf()", return false);
2922
+ i::Object* obj = *Utils::OpenHandle(*value);
2923
+ return obj->IsInstanceOf(*Utils::OpenHandle(this));
2924
+ }
2925
+
2926
+
2927
+ static Local<External> ExternalNewImpl(void* data) {
2928
+ return Utils::ToLocal(i::Factory::NewProxy(static_cast<i::Address>(data)));
2929
+ }
2930
+
2931
+ static void* ExternalValueImpl(i::Handle<i::Object> obj) {
2932
+ return reinterpret_cast<void*>(i::Proxy::cast(*obj)->proxy());
2933
+ }
2934
+
2935
+
2936
+ Local<Value> v8::External::Wrap(void* data) {
2937
+ STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
2938
+ LOG_API("External::Wrap");
2939
+ EnsureInitialized("v8::External::Wrap()");
2940
+ ENTER_V8;
2941
+ i::Object* as_object = reinterpret_cast<i::Object*>(data);
2942
+ if (as_object->IsSmi()) {
2943
+ return Utils::ToLocal(i::Handle<i::Object>(as_object));
2944
+ }
2945
+ return ExternalNewImpl(data);
2946
+ }
2947
+
2948
+
2949
+ void* v8::Object::SlowGetPointerFromInternalField(int index) {
2950
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2951
+ i::Object* value = obj->GetInternalField(index);
2952
+ if (value->IsSmi()) {
2953
+ return value;
2954
+ } else if (value->IsProxy()) {
2955
+ return reinterpret_cast<void*>(i::Proxy::cast(value)->proxy());
2956
+ } else {
2957
+ return NULL;
2958
+ }
2959
+ }
2960
+
2961
+
2962
+ void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) {
2963
+ if (IsDeadCheck("v8::External::Unwrap()")) return 0;
2964
+ i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper);
2965
+ void* result;
2966
+ if (obj->IsSmi()) {
2967
+ // The external value was an aligned pointer.
2968
+ result = *obj;
2969
+ } else if (obj->IsProxy()) {
2970
+ result = ExternalValueImpl(obj);
2971
+ } else {
2972
+ result = NULL;
2973
+ }
2974
+ ASSERT_EQ(result, QuickUnwrap(wrapper));
2975
+ return result;
2976
+ }
2977
+
2978
+
2979
+ Local<External> v8::External::New(void* data) {
2980
+ STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
2981
+ LOG_API("External::New");
2982
+ EnsureInitialized("v8::External::New()");
2983
+ ENTER_V8;
2984
+ return ExternalNewImpl(data);
2985
+ }
2986
+
2987
+
2988
+ void* External::Value() const {
2989
+ if (IsDeadCheck("v8::External::Value()")) return 0;
2990
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2991
+ return ExternalValueImpl(obj);
2992
+ }
2993
+
2994
+
2995
+ Local<String> v8::String::Empty() {
2996
+ EnsureInitialized("v8::String::Empty()");
2997
+ LOG_API("String::Empty()");
2998
+ return Utils::ToLocal(i::Factory::empty_symbol());
2999
+ }
3000
+
3001
+
3002
+ Local<String> v8::String::New(const char* data, int length) {
3003
+ EnsureInitialized("v8::String::New()");
3004
+ LOG_API("String::New(char)");
3005
+ if (length == 0) return Empty();
3006
+ ENTER_V8;
3007
+ if (length == -1) length = i::StrLength(data);
3008
+ i::Handle<i::String> result =
3009
+ i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
3010
+ return Utils::ToLocal(result);
3011
+ }
3012
+
3013
+
3014
+ Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
3015
+ EnsureInitialized("v8::String::New()");
3016
+ LOG_API("String::New(char)");
3017
+ ENTER_V8;
3018
+ i::Handle<i::String> left_string = Utils::OpenHandle(*left);
3019
+ i::Handle<i::String> right_string = Utils::OpenHandle(*right);
3020
+ i::Handle<i::String> result = i::Factory::NewConsString(left_string,
3021
+ right_string);
3022
+ return Utils::ToLocal(result);
3023
+ }
3024
+
3025
+
3026
+ Local<String> v8::String::NewUndetectable(const char* data, int length) {
3027
+ EnsureInitialized("v8::String::NewUndetectable()");
3028
+ LOG_API("String::NewUndetectable(char)");
3029
+ ENTER_V8;
3030
+ if (length == -1) length = i::StrLength(data);
3031
+ i::Handle<i::String> result =
3032
+ i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
3033
+ result->MarkAsUndetectable();
3034
+ return Utils::ToLocal(result);
3035
+ }
3036
+
3037
+
3038
+ static int TwoByteStringLength(const uint16_t* data) {
3039
+ int length = 0;
3040
+ while (data[length] != '\0') length++;
3041
+ return length;
3042
+ }
3043
+
3044
+
3045
+ Local<String> v8::String::New(const uint16_t* data, int length) {
3046
+ EnsureInitialized("v8::String::New()");
3047
+ LOG_API("String::New(uint16_)");
3048
+ if (length == 0) return Empty();
3049
+ ENTER_V8;
3050
+ if (length == -1) length = TwoByteStringLength(data);
3051
+ i::Handle<i::String> result =
3052
+ i::Factory::NewStringFromTwoByte(i::Vector<const uint16_t>(data, length));
3053
+ return Utils::ToLocal(result);
3054
+ }
3055
+
3056
+
3057
+ Local<String> v8::String::NewUndetectable(const uint16_t* data, int length) {
3058
+ EnsureInitialized("v8::String::NewUndetectable()");
3059
+ LOG_API("String::NewUndetectable(uint16_)");
3060
+ ENTER_V8;
3061
+ if (length == -1) length = TwoByteStringLength(data);
3062
+ i::Handle<i::String> result =
3063
+ i::Factory::NewStringFromTwoByte(i::Vector<const uint16_t>(data, length));
3064
+ result->MarkAsUndetectable();
3065
+ return Utils::ToLocal(result);
3066
+ }
3067
+
3068
+
3069
+ i::Handle<i::String> NewExternalStringHandle(
3070
+ v8::String::ExternalStringResource* resource) {
3071
+ i::Handle<i::String> result =
3072
+ i::Factory::NewExternalStringFromTwoByte(resource);
3073
+ return result;
3074
+ }
3075
+
3076
+
3077
+ i::Handle<i::String> NewExternalAsciiStringHandle(
3078
+ v8::String::ExternalAsciiStringResource* resource) {
3079
+ i::Handle<i::String> result =
3080
+ i::Factory::NewExternalStringFromAscii(resource);
3081
+ return result;
3082
+ }
3083
+
3084
+
3085
+ Local<String> v8::String::NewExternal(
3086
+ v8::String::ExternalStringResource* resource) {
3087
+ EnsureInitialized("v8::String::NewExternal()");
3088
+ LOG_API("String::NewExternal");
3089
+ ENTER_V8;
3090
+ i::Handle<i::String> result = NewExternalStringHandle(resource);
3091
+ i::ExternalStringTable::AddString(*result);
3092
+ return Utils::ToLocal(result);
3093
+ }
3094
+
3095
+
3096
+ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
3097
+ if (IsDeadCheck("v8::String::MakeExternal()")) return false;
3098
+ if (this->IsExternal()) return false; // Already an external string.
3099
+ ENTER_V8;
3100
+ i::Handle<i::String> obj = Utils::OpenHandle(this);
3101
+ bool result = obj->MakeExternal(resource);
3102
+ if (result && !obj->IsSymbol()) {
3103
+ i::ExternalStringTable::AddString(*obj);
3104
+ }
3105
+ return result;
3106
+ }
3107
+
3108
+
3109
+ Local<String> v8::String::NewExternal(
3110
+ v8::String::ExternalAsciiStringResource* resource) {
3111
+ EnsureInitialized("v8::String::NewExternal()");
3112
+ LOG_API("String::NewExternal");
3113
+ ENTER_V8;
3114
+ i::Handle<i::String> result = NewExternalAsciiStringHandle(resource);
3115
+ i::ExternalStringTable::AddString(*result);
3116
+ return Utils::ToLocal(result);
3117
+ }
3118
+
3119
+
3120
+ bool v8::String::MakeExternal(
3121
+ v8::String::ExternalAsciiStringResource* resource) {
3122
+ if (IsDeadCheck("v8::String::MakeExternal()")) return false;
3123
+ if (this->IsExternal()) return false; // Already an external string.
3124
+ ENTER_V8;
3125
+ i::Handle<i::String> obj = Utils::OpenHandle(this);
3126
+ bool result = obj->MakeExternal(resource);
3127
+ if (result && !obj->IsSymbol()) {
3128
+ i::ExternalStringTable::AddString(*obj);
3129
+ }
3130
+ return result;
3131
+ }
3132
+
3133
+
3134
+ bool v8::String::CanMakeExternal() {
3135
+ if (IsDeadCheck("v8::String::CanMakeExternal()")) return false;
3136
+ i::Handle<i::String> obj = Utils::OpenHandle(this);
3137
+ int size = obj->Size(); // Byte size of the original string.
3138
+ if (size < i::ExternalString::kSize)
3139
+ return false;
3140
+ i::StringShape shape(*obj);
3141
+ return !shape.IsExternal();
3142
+ }
3143
+
3144
+
3145
+ Local<v8::Object> v8::Object::New() {
3146
+ EnsureInitialized("v8::Object::New()");
3147
+ LOG_API("Object::New");
3148
+ ENTER_V8;
3149
+ i::Handle<i::JSObject> obj =
3150
+ i::Factory::NewJSObject(i::Top::object_function());
3151
+ return Utils::ToLocal(obj);
3152
+ }
3153
+
3154
+
3155
+ Local<v8::Value> v8::Date::New(double time) {
3156
+ EnsureInitialized("v8::Date::New()");
3157
+ LOG_API("Date::New");
3158
+ if (isnan(time)) {
3159
+ // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
3160
+ time = i::OS::nan_value();
3161
+ }
3162
+ ENTER_V8;
3163
+ EXCEPTION_PREAMBLE();
3164
+ i::Handle<i::Object> obj =
3165
+ i::Execution::NewDate(time, &has_pending_exception);
3166
+ EXCEPTION_BAILOUT_CHECK(Local<v8::Value>());
3167
+ return Utils::ToLocal(obj);
3168
+ }
3169
+
3170
+
3171
+ double v8::Date::NumberValue() const {
3172
+ if (IsDeadCheck("v8::Date::NumberValue()")) return 0;
3173
+ LOG_API("Date::NumberValue");
3174
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
3175
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
3176
+ return jsvalue->value()->Number();
3177
+ }
3178
+
3179
+
3180
+ Local<v8::Array> v8::Array::New(int length) {
3181
+ EnsureInitialized("v8::Array::New()");
3182
+ LOG_API("Array::New");
3183
+ ENTER_V8;
3184
+ i::Handle<i::JSArray> obj = i::Factory::NewJSArray(length);
3185
+ return Utils::ToLocal(obj);
3186
+ }
3187
+
3188
+
3189
+ uint32_t v8::Array::Length() const {
3190
+ if (IsDeadCheck("v8::Array::Length()")) return 0;
3191
+ i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
3192
+ i::Object* length = obj->length();
3193
+ if (length->IsSmi()) {
3194
+ return i::Smi::cast(length)->value();
3195
+ } else {
3196
+ return static_cast<uint32_t>(length->Number());
3197
+ }
3198
+ }
3199
+
3200
+
3201
+ Local<Object> Array::CloneElementAt(uint32_t index) {
3202
+ ON_BAILOUT("v8::Array::CloneElementAt()", return Local<Object>());
3203
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3204
+ if (!self->HasFastElements()) {
3205
+ return Local<Object>();
3206
+ }
3207
+ i::FixedArray* elms = i::FixedArray::cast(self->elements());
3208
+ i::Object* paragon = elms->get(index);
3209
+ if (!paragon->IsJSObject()) {
3210
+ return Local<Object>();
3211
+ }
3212
+ i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
3213
+ EXCEPTION_PREAMBLE();
3214
+ i::Handle<i::JSObject> result = i::Copy(paragon_handle);
3215
+ has_pending_exception = result.is_null();
3216
+ EXCEPTION_BAILOUT_CHECK(Local<Object>());
3217
+ return Utils::ToLocal(result);
3218
+ }
3219
+
3220
+
3221
+ Local<String> v8::String::NewSymbol(const char* data, int length) {
3222
+ EnsureInitialized("v8::String::NewSymbol()");
3223
+ LOG_API("String::NewSymbol(char)");
3224
+ ENTER_V8;
3225
+ if (length == -1) length = i::StrLength(data);
3226
+ i::Handle<i::String> result =
3227
+ i::Factory::LookupSymbol(i::Vector<const char>(data, length));
3228
+ return Utils::ToLocal(result);
3229
+ }
3230
+
3231
+
3232
+ Local<Number> v8::Number::New(double value) {
3233
+ EnsureInitialized("v8::Number::New()");
3234
+ if (isnan(value)) {
3235
+ // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
3236
+ value = i::OS::nan_value();
3237
+ }
3238
+ ENTER_V8;
3239
+ i::Handle<i::Object> result = i::Factory::NewNumber(value);
3240
+ return Utils::NumberToLocal(result);
3241
+ }
3242
+
3243
+
3244
+ Local<Integer> v8::Integer::New(int32_t value) {
3245
+ EnsureInitialized("v8::Integer::New()");
3246
+ if (i::Smi::IsValid(value)) {
3247
+ return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value)));
3248
+ }
3249
+ ENTER_V8;
3250
+ i::Handle<i::Object> result = i::Factory::NewNumber(value);
3251
+ return Utils::IntegerToLocal(result);
3252
+ }
3253
+
3254
+
3255
+ Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
3256
+ bool fits_into_int32_t = (value & (1 << 31)) == 0;
3257
+ if (fits_into_int32_t) {
3258
+ return Integer::New(static_cast<int32_t>(value));
3259
+ }
3260
+ ENTER_V8;
3261
+ i::Handle<i::Object> result = i::Factory::NewNumber(value);
3262
+ return Utils::IntegerToLocal(result);
3263
+ }
3264
+
3265
+
3266
+ void V8::IgnoreOutOfMemoryException() {
3267
+ thread_local.set_ignore_out_of_memory(true);
3268
+ }
3269
+
3270
+
3271
+ bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
3272
+ EnsureInitialized("v8::V8::AddMessageListener()");
3273
+ ON_BAILOUT("v8::V8::AddMessageListener()", return false);
3274
+ ENTER_V8;
3275
+ HandleScope scope;
3276
+ NeanderArray listeners(i::Factory::message_listeners());
3277
+ NeanderObject obj(2);
3278
+ obj.set(0, *i::Factory::NewProxy(FUNCTION_ADDR(that)));
3279
+ obj.set(1, data.IsEmpty() ?
3280
+ i::Heap::undefined_value() :
3281
+ *Utils::OpenHandle(*data));
3282
+ listeners.add(obj.value());
3283
+ return true;
3284
+ }
3285
+
3286
+
3287
+ void V8::RemoveMessageListeners(MessageCallback that) {
3288
+ EnsureInitialized("v8::V8::RemoveMessageListener()");
3289
+ ON_BAILOUT("v8::V8::RemoveMessageListeners()", return);
3290
+ ENTER_V8;
3291
+ HandleScope scope;
3292
+ NeanderArray listeners(i::Factory::message_listeners());
3293
+ for (int i = 0; i < listeners.length(); i++) {
3294
+ if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
3295
+
3296
+ NeanderObject listener(i::JSObject::cast(listeners.get(i)));
3297
+ i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0)));
3298
+ if (callback_obj->proxy() == FUNCTION_ADDR(that)) {
3299
+ listeners.set(i, i::Heap::undefined_value());
3300
+ }
3301
+ }
3302
+ }
3303
+
3304
+
3305
+ void V8::SetCounterFunction(CounterLookupCallback callback) {
3306
+ if (IsDeadCheck("v8::V8::SetCounterFunction()")) return;
3307
+ i::StatsTable::SetCounterFunction(callback);
3308
+ }
3309
+
3310
+ void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
3311
+ if (IsDeadCheck("v8::V8::SetCreateHistogramFunction()")) return;
3312
+ i::StatsTable::SetCreateHistogramFunction(callback);
3313
+ }
3314
+
3315
+ void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
3316
+ if (IsDeadCheck("v8::V8::SetAddHistogramSampleFunction()")) return;
3317
+ i::StatsTable::SetAddHistogramSampleFunction(callback);
3318
+ }
3319
+
3320
+ void V8::EnableSlidingStateWindow() {
3321
+ if (IsDeadCheck("v8::V8::EnableSlidingStateWindow()")) return;
3322
+ i::Logger::EnableSlidingStateWindow();
3323
+ }
3324
+
3325
+
3326
+ void V8::SetFailedAccessCheckCallbackFunction(
3327
+ FailedAccessCheckCallback callback) {
3328
+ if (IsDeadCheck("v8::V8::SetFailedAccessCheckCallbackFunction()")) return;
3329
+ i::Top::SetFailedAccessCheckCallback(callback);
3330
+ }
3331
+
3332
+
3333
+ void V8::AddObjectGroup(Persistent<Value>* objects, size_t length) {
3334
+ if (IsDeadCheck("v8::V8::AddObjectGroup()")) return;
3335
+ STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
3336
+ i::GlobalHandles::AddGroup(reinterpret_cast<i::Object***>(objects), length);
3337
+ }
3338
+
3339
+
3340
+ int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
3341
+ if (IsDeadCheck("v8::V8::AdjustAmountOfExternalAllocatedMemory()")) return 0;
3342
+ return i::Heap::AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
3343
+ }
3344
+
3345
+
3346
+ void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
3347
+ if (IsDeadCheck("v8::V8::SetGlobalGCPrologueCallback()")) return;
3348
+ i::Heap::SetGlobalGCPrologueCallback(callback);
3349
+ }
3350
+
3351
+
3352
+ void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
3353
+ if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return;
3354
+ i::Heap::SetGlobalGCEpilogueCallback(callback);
3355
+ }
3356
+
3357
+
3358
+ void V8::PauseProfiler() {
3359
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3360
+ i::Logger::PauseProfiler(PROFILER_MODULE_CPU);
3361
+ #endif
3362
+ }
3363
+
3364
+
3365
+ void V8::ResumeProfiler() {
3366
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3367
+ i::Logger::ResumeProfiler(PROFILER_MODULE_CPU);
3368
+ #endif
3369
+ }
3370
+
3371
+
3372
+ bool V8::IsProfilerPaused() {
3373
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3374
+ return i::Logger::GetActiveProfilerModules() & PROFILER_MODULE_CPU;
3375
+ #else
3376
+ return true;
3377
+ #endif
3378
+ }
3379
+
3380
+
3381
+ void V8::ResumeProfilerEx(int flags) {
3382
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3383
+ if (flags & PROFILER_MODULE_HEAP_SNAPSHOT) {
3384
+ // Snapshot mode: resume modules, perform GC, then pause only
3385
+ // those modules which haven't been started prior to making a
3386
+ // snapshot.
3387
+
3388
+ // Reset snapshot flag and CPU module flags.
3389
+ flags &= ~(PROFILER_MODULE_HEAP_SNAPSHOT | PROFILER_MODULE_CPU);
3390
+ const int current_flags = i::Logger::GetActiveProfilerModules();
3391
+ i::Logger::ResumeProfiler(flags);
3392
+ i::Heap::CollectAllGarbage(false);
3393
+ i::Logger::PauseProfiler(~current_flags & flags);
3394
+ } else {
3395
+ i::Logger::ResumeProfiler(flags);
3396
+ }
3397
+ #endif
3398
+ }
3399
+
3400
+
3401
+ void V8::PauseProfilerEx(int flags) {
3402
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3403
+ i::Logger::PauseProfiler(flags);
3404
+ #endif
3405
+ }
3406
+
3407
+
3408
+ int V8::GetActiveProfilerModules() {
3409
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3410
+ return i::Logger::GetActiveProfilerModules();
3411
+ #else
3412
+ return PROFILER_MODULE_NONE;
3413
+ #endif
3414
+ }
3415
+
3416
+
3417
+ int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) {
3418
+ #ifdef ENABLE_LOGGING_AND_PROFILING
3419
+ return i::Logger::GetLogLines(from_pos, dest_buf, max_size);
3420
+ #endif
3421
+ return 0;
3422
+ }
3423
+
3424
+
3425
+ int V8::GetCurrentThreadId() {
3426
+ API_ENTRY_CHECK("V8::GetCurrentThreadId()");
3427
+ EnsureInitialized("V8::GetCurrentThreadId()");
3428
+ return i::Top::thread_id();
3429
+ }
3430
+
3431
+
3432
+ void V8::TerminateExecution(int thread_id) {
3433
+ if (!i::V8::IsRunning()) return;
3434
+ API_ENTRY_CHECK("V8::GetCurrentThreadId()");
3435
+ // If the thread_id identifies the current thread just terminate
3436
+ // execution right away. Otherwise, ask the thread manager to
3437
+ // terminate the thread with the given id if any.
3438
+ if (thread_id == i::Top::thread_id()) {
3439
+ i::StackGuard::TerminateExecution();
3440
+ } else {
3441
+ i::ThreadManager::TerminateExecution(thread_id);
3442
+ }
3443
+ }
3444
+
3445
+
3446
+ void V8::TerminateExecution() {
3447
+ if (!i::V8::IsRunning()) return;
3448
+ i::StackGuard::TerminateExecution();
3449
+ }
3450
+
3451
+
3452
+ String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) {
3453
+ EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
3454
+ if (obj.IsEmpty()) {
3455
+ str_ = NULL;
3456
+ length_ = 0;
3457
+ return;
3458
+ }
3459
+ ENTER_V8;
3460
+ HandleScope scope;
3461
+ TryCatch try_catch;
3462
+ Handle<String> str = obj->ToString();
3463
+ if (str.IsEmpty()) {
3464
+ str_ = NULL;
3465
+ length_ = 0;
3466
+ } else {
3467
+ length_ = str->Utf8Length();
3468
+ str_ = i::NewArray<char>(length_ + 1);
3469
+ str->WriteUtf8(str_);
3470
+ }
3471
+ }
3472
+
3473
+
3474
+ String::Utf8Value::~Utf8Value() {
3475
+ i::DeleteArray(str_);
3476
+ }
3477
+
3478
+
3479
+ String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) {
3480
+ EnsureInitialized("v8::String::AsciiValue::AsciiValue()");
3481
+ if (obj.IsEmpty()) {
3482
+ str_ = NULL;
3483
+ length_ = 0;
3484
+ return;
3485
+ }
3486
+ ENTER_V8;
3487
+ HandleScope scope;
3488
+ TryCatch try_catch;
3489
+ Handle<String> str = obj->ToString();
3490
+ if (str.IsEmpty()) {
3491
+ str_ = NULL;
3492
+ length_ = 0;
3493
+ } else {
3494
+ length_ = str->Length();
3495
+ str_ = i::NewArray<char>(length_ + 1);
3496
+ str->WriteAscii(str_);
3497
+ }
3498
+ }
3499
+
3500
+
3501
+ String::AsciiValue::~AsciiValue() {
3502
+ i::DeleteArray(str_);
3503
+ }
3504
+
3505
+
3506
+ String::Value::Value(v8::Handle<v8::Value> obj) {
3507
+ EnsureInitialized("v8::String::Value::Value()");
3508
+ if (obj.IsEmpty()) {
3509
+ str_ = NULL;
3510
+ length_ = 0;
3511
+ return;
3512
+ }
3513
+ ENTER_V8;
3514
+ HandleScope scope;
3515
+ TryCatch try_catch;
3516
+ Handle<String> str = obj->ToString();
3517
+ if (str.IsEmpty()) {
3518
+ str_ = NULL;
3519
+ length_ = 0;
3520
+ } else {
3521
+ length_ = str->Length();
3522
+ str_ = i::NewArray<uint16_t>(length_ + 1);
3523
+ str->Write(str_);
3524
+ }
3525
+ }
3526
+
3527
+
3528
+ String::Value::~Value() {
3529
+ i::DeleteArray(str_);
3530
+ }
3531
+
3532
+ Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
3533
+ LOG_API("RangeError");
3534
+ ON_BAILOUT("v8::Exception::RangeError()", return Local<Value>());
3535
+ ENTER_V8;
3536
+ i::Object* error;
3537
+ {
3538
+ HandleScope scope;
3539
+ i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
3540
+ i::Handle<i::Object> result = i::Factory::NewRangeError(message);
3541
+ error = *result;
3542
+ }
3543
+ i::Handle<i::Object> result(error);
3544
+ return Utils::ToLocal(result);
3545
+ }
3546
+
3547
+ Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
3548
+ LOG_API("ReferenceError");
3549
+ ON_BAILOUT("v8::Exception::ReferenceError()", return Local<Value>());
3550
+ ENTER_V8;
3551
+ i::Object* error;
3552
+ {
3553
+ HandleScope scope;
3554
+ i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
3555
+ i::Handle<i::Object> result = i::Factory::NewReferenceError(message);
3556
+ error = *result;
3557
+ }
3558
+ i::Handle<i::Object> result(error);
3559
+ return Utils::ToLocal(result);
3560
+ }
3561
+
3562
+ Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
3563
+ LOG_API("SyntaxError");
3564
+ ON_BAILOUT("v8::Exception::SyntaxError()", return Local<Value>());
3565
+ ENTER_V8;
3566
+ i::Object* error;
3567
+ {
3568
+ HandleScope scope;
3569
+ i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
3570
+ i::Handle<i::Object> result = i::Factory::NewSyntaxError(message);
3571
+ error = *result;
3572
+ }
3573
+ i::Handle<i::Object> result(error);
3574
+ return Utils::ToLocal(result);
3575
+ }
3576
+
3577
+ Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
3578
+ LOG_API("TypeError");
3579
+ ON_BAILOUT("v8::Exception::TypeError()", return Local<Value>());
3580
+ ENTER_V8;
3581
+ i::Object* error;
3582
+ {
3583
+ HandleScope scope;
3584
+ i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
3585
+ i::Handle<i::Object> result = i::Factory::NewTypeError(message);
3586
+ error = *result;
3587
+ }
3588
+ i::Handle<i::Object> result(error);
3589
+ return Utils::ToLocal(result);
3590
+ }
3591
+
3592
+ Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
3593
+ LOG_API("Error");
3594
+ ON_BAILOUT("v8::Exception::Error()", return Local<Value>());
3595
+ ENTER_V8;
3596
+ i::Object* error;
3597
+ {
3598
+ HandleScope scope;
3599
+ i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
3600
+ i::Handle<i::Object> result = i::Factory::NewError(message);
3601
+ error = *result;
3602
+ }
3603
+ i::Handle<i::Object> result(error);
3604
+ return Utils::ToLocal(result);
3605
+ }
3606
+
3607
+
3608
+ // --- D e b u g S u p p o r t ---
3609
+
3610
+ #ifdef ENABLE_DEBUGGER_SUPPORT
3611
+ bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
3612
+ EnsureInitialized("v8::Debug::SetDebugEventListener()");
3613
+ ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
3614
+ ENTER_V8;
3615
+ HandleScope scope;
3616
+ i::Handle<i::Object> proxy = i::Factory::undefined_value();
3617
+ if (that != NULL) {
3618
+ proxy = i::Factory::NewProxy(FUNCTION_ADDR(that));
3619
+ }
3620
+ i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data));
3621
+ return true;
3622
+ }
3623
+
3624
+
3625
+ bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
3626
+ Handle<Value> data) {
3627
+ ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
3628
+ ENTER_V8;
3629
+ i::Debugger::SetEventListener(Utils::OpenHandle(*that),
3630
+ Utils::OpenHandle(*data));
3631
+ return true;
3632
+ }
3633
+
3634
+
3635
+ void Debug::DebugBreak() {
3636
+ if (!i::V8::IsRunning()) return;
3637
+ i::StackGuard::DebugBreak();
3638
+ }
3639
+
3640
+
3641
+ static v8::Debug::MessageHandler message_handler = NULL;
3642
+
3643
+ static void MessageHandlerWrapper(const v8::Debug::Message& message) {
3644
+ if (message_handler) {
3645
+ v8::String::Value json(message.GetJSON());
3646
+ message_handler(*json, json.length(), message.GetClientData());
3647
+ }
3648
+ }
3649
+
3650
+
3651
+ void Debug::SetMessageHandler(v8::Debug::MessageHandler handler,
3652
+ bool message_handler_thread) {
3653
+ EnsureInitialized("v8::Debug::SetMessageHandler");
3654
+ ENTER_V8;
3655
+ // Message handler thread not supported any more. Parameter temporally left in
3656
+ // the API for client compatability reasons.
3657
+ CHECK(!message_handler_thread);
3658
+
3659
+ // TODO(sgjesse) support the old message handler API through a simple wrapper.
3660
+ message_handler = handler;
3661
+ if (message_handler != NULL) {
3662
+ i::Debugger::SetMessageHandler(MessageHandlerWrapper);
3663
+ } else {
3664
+ i::Debugger::SetMessageHandler(NULL);
3665
+ }
3666
+ }
3667
+
3668
+
3669
+ void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
3670
+ EnsureInitialized("v8::Debug::SetMessageHandler");
3671
+ ENTER_V8;
3672
+ HandleScope scope;
3673
+ i::Debugger::SetMessageHandler(handler);
3674
+ }
3675
+
3676
+
3677
+ void Debug::SendCommand(const uint16_t* command, int length,
3678
+ ClientData* client_data) {
3679
+ if (!i::V8::IsRunning()) return;
3680
+ i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length),
3681
+ client_data);
3682
+ }
3683
+
3684
+
3685
+ void Debug::SetHostDispatchHandler(HostDispatchHandler handler,
3686
+ int period) {
3687
+ EnsureInitialized("v8::Debug::SetHostDispatchHandler");
3688
+ ENTER_V8;
3689
+ i::Debugger::SetHostDispatchHandler(handler, period);
3690
+ }
3691
+
3692
+
3693
+ void Debug::SetDebugMessageDispatchHandler(
3694
+ DebugMessageDispatchHandler handler) {
3695
+ EnsureInitialized("v8::Debug::SetDebugMessageDispatchHandler");
3696
+ ENTER_V8;
3697
+ i::Debugger::SetDebugMessageDispatchHandler(handler);
3698
+ }
3699
+
3700
+
3701
+ Local<Value> Debug::Call(v8::Handle<v8::Function> fun,
3702
+ v8::Handle<v8::Value> data) {
3703
+ if (!i::V8::IsRunning()) return Local<Value>();
3704
+ ON_BAILOUT("v8::Debug::Call()", return Local<Value>());
3705
+ ENTER_V8;
3706
+ i::Handle<i::Object> result;
3707
+ EXCEPTION_PREAMBLE();
3708
+ if (data.IsEmpty()) {
3709
+ result = i::Debugger::Call(Utils::OpenHandle(*fun),
3710
+ i::Factory::undefined_value(),
3711
+ &has_pending_exception);
3712
+ } else {
3713
+ result = i::Debugger::Call(Utils::OpenHandle(*fun),
3714
+ Utils::OpenHandle(*data),
3715
+ &has_pending_exception);
3716
+ }
3717
+ EXCEPTION_BAILOUT_CHECK(Local<Value>());
3718
+ return Utils::ToLocal(result);
3719
+ }
3720
+
3721
+
3722
+ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
3723
+ if (!i::V8::IsRunning()) return Local<Value>();
3724
+ ON_BAILOUT("v8::Debug::GetMirror()", return Local<Value>());
3725
+ ENTER_V8;
3726
+ v8::HandleScope scope;
3727
+ i::Debug::Load();
3728
+ i::Handle<i::JSObject> debug(i::Debug::debug_context()->global());
3729
+ i::Handle<i::String> name = i::Factory::LookupAsciiSymbol("MakeMirror");
3730
+ i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
3731
+ i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
3732
+ v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
3733
+ const int kArgc = 1;
3734
+ v8::Handle<v8::Value> argv[kArgc] = { obj };
3735
+ EXCEPTION_PREAMBLE();
3736
+ v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug),
3737
+ kArgc,
3738
+ argv);
3739
+ EXCEPTION_BAILOUT_CHECK(Local<Value>());
3740
+ return scope.Close(result);
3741
+ }
3742
+
3743
+
3744
+ bool Debug::EnableAgent(const char* name, int port, bool wait_for_connection) {
3745
+ return i::Debugger::StartAgent(name, port, wait_for_connection);
3746
+ }
3747
+ #endif // ENABLE_DEBUGGER_SUPPORT
3748
+
3749
+ namespace internal {
3750
+
3751
+
3752
+ HandleScopeImplementer* HandleScopeImplementer::instance() {
3753
+ return &thread_local;
3754
+ }
3755
+
3756
+
3757
+ void HandleScopeImplementer::FreeThreadResources() {
3758
+ thread_local.Free();
3759
+ }
3760
+
3761
+
3762
+ char* HandleScopeImplementer::ArchiveThread(char* storage) {
3763
+ return thread_local.ArchiveThreadHelper(storage);
3764
+ }
3765
+
3766
+
3767
+ char* HandleScopeImplementer::ArchiveThreadHelper(char* storage) {
3768
+ v8::ImplementationUtilities::HandleScopeData* current =
3769
+ v8::ImplementationUtilities::CurrentHandleScope();
3770
+ handle_scope_data_ = *current;
3771
+ memcpy(storage, this, sizeof(*this));
3772
+
3773
+ ResetAfterArchive();
3774
+ current->Initialize();
3775
+
3776
+ return storage + ArchiveSpacePerThread();
3777
+ }
3778
+
3779
+
3780
+ int HandleScopeImplementer::ArchiveSpacePerThread() {
3781
+ return sizeof(thread_local);
3782
+ }
3783
+
3784
+
3785
+ char* HandleScopeImplementer::RestoreThread(char* storage) {
3786
+ return thread_local.RestoreThreadHelper(storage);
3787
+ }
3788
+
3789
+
3790
+ char* HandleScopeImplementer::RestoreThreadHelper(char* storage) {
3791
+ memcpy(this, storage, sizeof(*this));
3792
+ *v8::ImplementationUtilities::CurrentHandleScope() = handle_scope_data_;
3793
+ return storage + ArchiveSpacePerThread();
3794
+ }
3795
+
3796
+
3797
+ void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
3798
+ // Iterate over all handles in the blocks except for the last.
3799
+ for (int i = blocks()->length() - 2; i >= 0; --i) {
3800
+ Object** block = blocks()->at(i);
3801
+ v->VisitPointers(block, &block[kHandleBlockSize]);
3802
+ }
3803
+
3804
+ // Iterate over live handles in the last block (if any).
3805
+ if (!blocks()->is_empty()) {
3806
+ v->VisitPointers(blocks()->last(), handle_scope_data_.next);
3807
+ }
3808
+
3809
+ if (!saved_contexts_.is_empty()) {
3810
+ Object** start = reinterpret_cast<Object**>(&saved_contexts_.first());
3811
+ v->VisitPointers(start, start + saved_contexts_.length());
3812
+ }
3813
+ }
3814
+
3815
+
3816
+ void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
3817
+ v8::ImplementationUtilities::HandleScopeData* current =
3818
+ v8::ImplementationUtilities::CurrentHandleScope();
3819
+ thread_local.handle_scope_data_ = *current;
3820
+ thread_local.IterateThis(v);
3821
+ }
3822
+
3823
+
3824
+ char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3825
+ HandleScopeImplementer* thread_local =
3826
+ reinterpret_cast<HandleScopeImplementer*>(storage);
3827
+ thread_local->IterateThis(v);
3828
+ return storage + ArchiveSpacePerThread();
3829
+ }
3830
+
3831
+ } } // namespace v8::internal