therubyracer 0.8.1.pre2 → 0.8.1

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 (877) hide show
  1. data/Changelog.md +2 -1
  2. data/README.md +6 -3
  3. data/ext/v8/upstream/3.1.8/.gitignore +31 -0
  4. data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
  5. data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
  6. data/ext/v8/upstream/3.1.8/LICENSE +52 -0
  7. data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
  8. data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
  9. data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
  10. data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
  11. data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
  12. data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
  13. data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
  14. data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
  15. data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
  16. data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
  17. data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
  18. data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
  19. data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
  20. data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
  21. data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
  22. data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
  23. data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
  24. data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
  25. data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
  26. data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
  27. data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
  28. data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
  29. data/ext/v8/upstream/3.1.8/src/api.h +508 -0
  30. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
  31. data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
  32. data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
  33. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
  34. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
  35. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
  36. data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
  37. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
  38. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
  39. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
  40. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
  41. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
  42. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
  43. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
  44. data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
  45. data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
  46. data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
  47. data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
  48. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
  49. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
  50. data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
  51. data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
  52. data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
  53. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
  54. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
  55. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
  56. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
  57. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
  58. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
  59. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
  60. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
  61. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
  62. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
  63. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
  64. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
  65. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
  66. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
  67. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
  68. data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
  69. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
  70. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
  71. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
  72. data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
  73. data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
  74. data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
  75. data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
  76. data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
  77. data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
  78. data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
  79. data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
  80. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
  81. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
  82. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
  83. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
  84. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
  85. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
  86. data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
  87. data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
  88. data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
  89. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
  90. data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
  91. data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
  92. data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
  93. data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
  94. data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
  95. data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
  96. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
  97. data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
  98. data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
  99. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
  100. data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
  101. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
  102. data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
  103. data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
  104. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
  105. data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
  106. data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
  107. data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
  108. data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
  109. data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
  110. data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
  111. data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
  112. data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
  113. data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
  114. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
  115. data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
  116. data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
  117. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
  118. data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
  119. data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
  120. data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
  121. data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
  122. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
  123. data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
  124. data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
  125. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
  126. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
  127. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
  128. data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
  129. data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
  130. data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
  131. data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
  132. data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
  133. data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
  134. data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
  135. data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
  136. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
  137. data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
  138. data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
  139. data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
  140. data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
  141. data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
  142. data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
  143. data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
  144. data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
  145. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
  146. data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
  147. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
  148. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
  149. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
  150. data/ext/v8/upstream/3.1.8/src/double.h +238 -0
  151. data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
  152. data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
  153. data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
  154. data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
  155. data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
  156. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
  157. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
  158. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
  159. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
  160. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
  161. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
  162. data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
  163. data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
  164. data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
  165. data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
  166. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
  167. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
  168. data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
  169. data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
  170. data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
  171. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
  172. data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
  173. data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
  174. data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
  175. data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
  176. data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
  177. data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
  178. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
  179. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
  180. data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
  181. data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
  182. data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
  183. data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
  184. data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
  185. data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
  186. data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
  187. data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
  188. data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
  189. data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
  190. data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
  191. data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
  192. data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
  193. data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
  194. data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
  195. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
  196. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
  197. data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
  198. data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
  199. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
  200. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
  201. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
  202. data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
  203. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
  204. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
  205. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
  206. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
  207. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
  208. data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
  209. data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
  210. data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
  211. data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
  212. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
  213. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
  214. data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
  215. data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
  216. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
  217. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
  218. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
  219. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
  220. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  221. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
  222. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
  223. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
  224. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
  225. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
  226. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
  227. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
  228. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
  229. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
  230. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
  231. data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
  232. data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
  233. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
  234. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
  235. data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
  236. data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
  237. data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
  238. data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
  239. data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
  240. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
  241. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
  242. data/ext/v8/upstream/3.1.8/src/json.js +342 -0
  243. data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
  244. data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
  245. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
  246. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
  247. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
  248. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
  249. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
  250. data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
  251. data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
  252. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
  253. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
  254. data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
  255. data/ext/v8/upstream/3.1.8/src/list.h +164 -0
  256. data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
  257. data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
  258. data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
  259. data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
  260. data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
  261. data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
  262. data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
  263. data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
  264. data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
  265. data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
  266. data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
  267. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
  268. data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
  269. data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
  270. data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
  271. data/ext/v8/upstream/3.1.8/src/log.h +379 -0
  272. data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
  273. data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
  274. data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
  275. data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
  276. data/ext/v8/upstream/3.1.8/src/math.js +264 -0
  277. data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
  278. data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
  279. data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
  280. data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
  281. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
  282. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
  283. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
  284. data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
  285. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
  286. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
  287. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
  288. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
  289. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
  290. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
  291. data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
  292. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
  293. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
  294. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
  295. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
  296. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
  297. data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
  298. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
  299. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
  300. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
  301. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
  302. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
  303. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
  304. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
  305. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
  306. data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
  307. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
  308. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
  309. data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
  310. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
  311. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
  312. data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
  313. data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
  314. data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
  315. data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
  316. data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
  317. data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
  318. data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
  319. data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
  320. data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
  321. data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
  322. data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
  323. data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
  324. data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
  325. data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
  326. data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
  327. data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
  328. data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
  329. data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
  330. data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
  331. data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
  332. data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
  333. data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
  334. data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
  335. data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
  336. data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
  337. data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
  338. data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
  339. data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
  340. data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
  341. data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
  342. data/ext/v8/upstream/3.1.8/src/property.h +337 -0
  343. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  344. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
  345. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
  346. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
  347. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
  348. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
  349. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
  350. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
  351. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
  352. data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
  353. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
  354. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
  355. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
  356. data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
  357. data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
  358. data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
  359. data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
  360. data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
  361. data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
  362. data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
  363. data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
  364. data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
  365. data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
  366. data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
  367. data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
  368. data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
  369. data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
  370. data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
  371. data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
  372. data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
  373. data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
  374. data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
  375. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
  376. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
  377. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
  378. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
  379. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
  380. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
  381. data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
  382. data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
  383. data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
  384. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
  385. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
  386. data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
  387. data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
  388. data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
  389. data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
  390. data/ext/v8/upstream/3.1.8/src/string.js +915 -0
  391. data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
  392. data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
  393. data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
  394. data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
  395. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
  396. data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
  397. data/ext/v8/upstream/3.1.8/src/token.h +288 -0
  398. data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
  399. data/ext/v8/upstream/3.1.8/src/top.h +608 -0
  400. data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
  401. data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
  402. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
  403. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
  404. data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
  405. data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
  406. data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
  407. data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
  408. data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
  409. data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
  410. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
  411. data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
  412. data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
  413. data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
  414. data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
  415. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
  416. data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
  417. data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
  418. data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
  419. data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
  420. data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
  421. data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
  422. data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
  423. data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
  424. data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
  425. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
  426. data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
  427. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
  428. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
  429. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
  430. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
  431. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
  432. data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
  433. data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
  434. data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
  435. data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
  436. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
  437. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
  438. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
  439. data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
  440. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
  441. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
  442. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
  443. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
  444. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
  445. data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
  446. data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
  447. data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
  448. data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
  449. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
  450. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
  451. data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
  452. data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
  453. data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
  454. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
  455. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
  456. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  457. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
  458. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
  459. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
  460. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
  461. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
  462. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
  463. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
  464. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
  465. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
  466. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
  467. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
  468. data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
  469. data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
  470. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
  471. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
  472. data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
  473. data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
  474. data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
  475. data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
  476. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
  477. data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
  478. data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
  479. data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
  480. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
  481. data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
  482. data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
  483. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
  484. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
  485. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
  486. data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
  487. data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
  488. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
  489. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
  490. data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
  491. data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
  492. data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
  493. data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
  494. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
  495. data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
  496. data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
  497. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
  498. data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
  499. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
  500. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
  501. data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
  502. data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
  503. data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
  504. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
  505. data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
  506. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
  507. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
  508. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
  509. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
  510. data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
  511. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
  512. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
  513. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
  514. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
  515. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
  516. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
  517. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
  518. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
  519. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
  520. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
  521. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
  522. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  523. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  524. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  525. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  526. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  527. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  528. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  529. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
  530. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
  531. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
  532. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  533. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  534. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  535. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  536. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
  537. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
  538. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
  539. data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
  540. data/ext/v8/upstream/Makefile +2 -1
  541. data/ext/v8/v8_template.cpp +2 -2
  542. data/lib/v8/version.rb +1 -1
  543. data/spec/redjs/jsapi_spec.rb +2 -2
  544. metadata +552 -490
  545. data/ext/v8/upstream/2.3.3/.gitignore +0 -26
  546. data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
  547. data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
  548. data/ext/v8/upstream/2.3.3/LICENSE +0 -55
  549. data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
  550. data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
  551. data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
  552. data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
  553. data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
  554. data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
  555. data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
  556. data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
  557. data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
  558. data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
  559. data/ext/v8/upstream/2.3.3/src/api.h +0 -485
  560. data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
  561. data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
  562. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
  563. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
  564. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
  565. data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
  566. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
  567. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
  568. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
  569. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
  570. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
  571. data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
  572. data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
  573. data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
  574. data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
  575. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
  576. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
  577. data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
  578. data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
  579. data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
  580. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
  581. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
  582. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
  583. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
  584. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
  585. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
  586. data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
  587. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
  588. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
  589. data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
  590. data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
  591. data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
  592. data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
  593. data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
  594. data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
  595. data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
  596. data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
  597. data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
  598. data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
  599. data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
  600. data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
  601. data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
  602. data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
  603. data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
  604. data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
  605. data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
  606. data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
  607. data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
  608. data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
  609. data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
  610. data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
  611. data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
  612. data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
  613. data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
  614. data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
  615. data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
  616. data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
  617. data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
  618. data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
  619. data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
  620. data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
  621. data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
  622. data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
  623. data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
  624. data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
  625. data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
  626. data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
  627. data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
  628. data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
  629. data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
  630. data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
  631. data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
  632. data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
  633. data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
  634. data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
  635. data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
  636. data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
  637. data/ext/v8/upstream/2.3.3/src/double.h +0 -169
  638. data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
  639. data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
  640. data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
  641. data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
  642. data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
  643. data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
  644. data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
  645. data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
  646. data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
  647. data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
  648. data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
  649. data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
  650. data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
  651. data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
  652. data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
  653. data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
  654. data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
  655. data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
  656. data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
  657. data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
  658. data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
  659. data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
  660. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
  661. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
  662. data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
  663. data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
  664. data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
  665. data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
  666. data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
  667. data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
  668. data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
  669. data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
  670. data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
  671. data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
  672. data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
  673. data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
  674. data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
  675. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
  676. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
  677. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
  678. data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
  679. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
  680. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
  681. data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
  682. data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
  683. data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
  684. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
  685. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
  686. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
  687. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
  688. data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
  689. data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
  690. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
  691. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
  692. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
  693. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
  694. data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
  695. data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
  696. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
  697. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
  698. data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
  699. data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
  700. data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
  701. data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
  702. data/ext/v8/upstream/2.3.3/src/json.js +0 -268
  703. data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
  704. data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
  705. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
  706. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
  707. data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
  708. data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
  709. data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
  710. data/ext/v8/upstream/2.3.3/src/list.h +0 -159
  711. data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
  712. data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
  713. data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
  714. data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
  715. data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
  716. data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
  717. data/ext/v8/upstream/2.3.3/src/log.h +0 -384
  718. data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
  719. data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
  720. data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
  721. data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
  722. data/ext/v8/upstream/2.3.3/src/math.js +0 -264
  723. data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
  724. data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
  725. data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
  726. data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
  727. data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
  728. data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
  729. data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
  730. data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
  731. data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
  732. data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
  733. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
  734. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
  735. data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
  736. data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
  737. data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
  738. data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
  739. data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
  740. data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
  741. data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
  742. data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
  743. data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
  744. data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
  745. data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
  746. data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
  747. data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
  748. data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
  749. data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
  750. data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
  751. data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
  752. data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
  753. data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
  754. data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
  755. data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
  756. data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
  757. data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
  758. data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
  759. data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
  760. data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
  761. data/ext/v8/upstream/2.3.3/src/property.h +0 -315
  762. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
  763. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
  764. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
  765. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
  766. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
  767. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
  768. data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
  769. data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
  770. data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
  771. data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
  772. data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
  773. data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
  774. data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
  775. data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
  776. data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
  777. data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
  778. data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
  779. data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
  780. data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
  781. data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
  782. data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
  783. data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
  784. data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
  785. data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
  786. data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
  787. data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
  788. data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
  789. data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
  790. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
  791. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
  792. data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
  793. data/ext/v8/upstream/2.3.3/src/token.h +0 -270
  794. data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
  795. data/ext/v8/upstream/2.3.3/src/top.h +0 -463
  796. data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
  797. data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
  798. data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
  799. data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
  800. data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
  801. data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
  802. data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
  803. data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
  804. data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
  805. data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
  806. data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
  807. data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
  808. data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
  809. data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
  810. data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
  811. data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
  812. data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
  813. data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
  814. data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
  815. data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
  816. data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
  817. data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
  818. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
  819. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
  820. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
  821. data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
  822. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
  823. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
  824. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
  825. data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
  826. data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
  827. data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
  828. data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
  829. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
  830. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
  831. data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
  832. data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
  833. data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
  834. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
  835. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
  836. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
  837. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
  838. data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
  839. data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
  840. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
  841. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
  842. data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
  843. data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
  844. data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
  845. data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
  846. data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
  847. data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
  848. data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
  849. data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
  850. data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
  851. data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
  852. data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
  853. data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
  854. data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
  855. data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
  856. data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
  857. data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
  858. data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
  859. data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
  860. data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
  861. data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
  862. data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
  863. data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
  864. data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
  865. data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
  866. data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
  867. data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
  868. data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
  869. data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
  870. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
  871. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
  872. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
  873. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
  874. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
  875. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
  876. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
  877. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -0,0 +1,1974 @@
1
+ // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ // Platform specific code for Win32.
29
+
30
+ #define V8_WIN32_HEADERS_FULL
31
+ #include "win32-headers.h"
32
+
33
+ #include "v8.h"
34
+
35
+ #include "platform.h"
36
+ #include "vm-state-inl.h"
37
+
38
+ // Extra POSIX/ANSI routines for Win32 when when using Visual Studio C++. Please
39
+ // refer to The Open Group Base Specification for specification of the correct
40
+ // semantics for these functions.
41
+ // (http://www.opengroup.org/onlinepubs/000095399/)
42
+ #ifdef _MSC_VER
43
+
44
+ namespace v8 {
45
+ namespace internal {
46
+
47
+ // Test for finite value - usually defined in math.h
48
+ int isfinite(double x) {
49
+ return _finite(x);
50
+ }
51
+
52
+ } // namespace v8
53
+ } // namespace internal
54
+
55
+ // Test for a NaN (not a number) value - usually defined in math.h
56
+ int isnan(double x) {
57
+ return _isnan(x);
58
+ }
59
+
60
+
61
+ // Test for infinity - usually defined in math.h
62
+ int isinf(double x) {
63
+ return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0;
64
+ }
65
+
66
+
67
+ // Test if x is less than y and both nominal - usually defined in math.h
68
+ int isless(double x, double y) {
69
+ return isnan(x) || isnan(y) ? 0 : x < y;
70
+ }
71
+
72
+
73
+ // Test if x is greater than y and both nominal - usually defined in math.h
74
+ int isgreater(double x, double y) {
75
+ return isnan(x) || isnan(y) ? 0 : x > y;
76
+ }
77
+
78
+
79
+ // Classify floating point number - usually defined in math.h
80
+ int fpclassify(double x) {
81
+ // Use the MS-specific _fpclass() for classification.
82
+ int flags = _fpclass(x);
83
+
84
+ // Determine class. We cannot use a switch statement because
85
+ // the _FPCLASS_ constants are defined as flags.
86
+ if (flags & (_FPCLASS_PN | _FPCLASS_NN)) return FP_NORMAL;
87
+ if (flags & (_FPCLASS_PZ | _FPCLASS_NZ)) return FP_ZERO;
88
+ if (flags & (_FPCLASS_PD | _FPCLASS_ND)) return FP_SUBNORMAL;
89
+ if (flags & (_FPCLASS_PINF | _FPCLASS_NINF)) return FP_INFINITE;
90
+
91
+ // All cases should be covered by the code above.
92
+ ASSERT(flags & (_FPCLASS_SNAN | _FPCLASS_QNAN));
93
+ return FP_NAN;
94
+ }
95
+
96
+
97
+ // Test sign - usually defined in math.h
98
+ int signbit(double x) {
99
+ // We need to take care of the special case of both positive
100
+ // and negative versions of zero.
101
+ if (x == 0)
102
+ return _fpclass(x) & _FPCLASS_NZ;
103
+ else
104
+ return x < 0;
105
+ }
106
+
107
+
108
+ // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually
109
+ // defined in strings.h.
110
+ int strncasecmp(const char* s1, const char* s2, int n) {
111
+ return _strnicmp(s1, s2, n);
112
+ }
113
+
114
+ #endif // _MSC_VER
115
+
116
+
117
+ // Extra functions for MinGW. Most of these are the _s functions which are in
118
+ // the Microsoft Visual Studio C++ CRT.
119
+ #ifdef __MINGW32__
120
+
121
+ int localtime_s(tm* out_tm, const time_t* time) {
122
+ tm* posix_local_time_struct = localtime(time);
123
+ if (posix_local_time_struct == NULL) return 1;
124
+ *out_tm = *posix_local_time_struct;
125
+ return 0;
126
+ }
127
+
128
+
129
+ // Not sure this the correct interpretation of _mkgmtime
130
+ time_t _mkgmtime(tm* timeptr) {
131
+ return mktime(timeptr);
132
+ }
133
+
134
+
135
+ int fopen_s(FILE** pFile, const char* filename, const char* mode) {
136
+ *pFile = fopen(filename, mode);
137
+ return *pFile != NULL ? 0 : 1;
138
+ }
139
+
140
+
141
+ int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count,
142
+ const char* format, va_list argptr) {
143
+ return _vsnprintf(buffer, sizeOfBuffer, format, argptr);
144
+ }
145
+ #define _TRUNCATE 0
146
+
147
+
148
+ int strncpy_s(char* strDest, size_t numberOfElements,
149
+ const char* strSource, size_t count) {
150
+ strncpy(strDest, strSource, count);
151
+ return 0;
152
+ }
153
+
154
+
155
+ inline void MemoryBarrier() {
156
+ int barrier = 0;
157
+ __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier));
158
+ }
159
+
160
+ #endif // __MINGW32__
161
+
162
+ // Generate a pseudo-random number in the range 0-2^31-1. Usually
163
+ // defined in stdlib.h. Missing in both Microsoft Visual Studio C++ and MinGW.
164
+ int random() {
165
+ return rand();
166
+ }
167
+
168
+
169
+ namespace v8 {
170
+ namespace internal {
171
+
172
+ double ceiling(double x) {
173
+ return ceil(x);
174
+ }
175
+
176
+ #ifdef _WIN64
177
+ typedef double (*ModuloFunction)(double, double);
178
+
179
+ // Defined in codegen-x64.cc.
180
+ ModuloFunction CreateModuloFunction();
181
+
182
+ double modulo(double x, double y) {
183
+ static ModuloFunction function = CreateModuloFunction();
184
+ return function(x, y);
185
+ }
186
+ #else // Win32
187
+
188
+ double modulo(double x, double y) {
189
+ // Workaround MS fmod bugs. ECMA-262 says:
190
+ // dividend is finite and divisor is an infinity => result equals dividend
191
+ // dividend is a zero and divisor is nonzero finite => result equals dividend
192
+ if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) &&
193
+ !(x == 0 && (y != 0 && isfinite(y)))) {
194
+ x = fmod(x, y);
195
+ }
196
+ return x;
197
+ }
198
+
199
+ #endif // _WIN64
200
+
201
+ // ----------------------------------------------------------------------------
202
+ // The Time class represents time on win32. A timestamp is represented as
203
+ // a 64-bit integer in 100 nano-seconds since January 1, 1601 (UTC). JavaScript
204
+ // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC,
205
+ // January 1, 1970.
206
+
207
+ class Time {
208
+ public:
209
+ // Constructors.
210
+ Time();
211
+ explicit Time(double jstime);
212
+ Time(int year, int mon, int day, int hour, int min, int sec);
213
+
214
+ // Convert timestamp to JavaScript representation.
215
+ double ToJSTime();
216
+
217
+ // Set timestamp to current time.
218
+ void SetToCurrentTime();
219
+
220
+ // Returns the local timezone offset in milliseconds east of UTC. This is
221
+ // the number of milliseconds you must add to UTC to get local time, i.e.
222
+ // LocalOffset(CET) = 3600000 and LocalOffset(PST) = -28800000. This
223
+ // routine also takes into account whether daylight saving is effect
224
+ // at the time.
225
+ int64_t LocalOffset();
226
+
227
+ // Returns the daylight savings time offset for the time in milliseconds.
228
+ int64_t DaylightSavingsOffset();
229
+
230
+ // Returns a string identifying the current timezone for the
231
+ // timestamp taking into account daylight saving.
232
+ char* LocalTimezone();
233
+
234
+ private:
235
+ // Constants for time conversion.
236
+ static const int64_t kTimeEpoc = 116444736000000000LL;
237
+ static const int64_t kTimeScaler = 10000;
238
+ static const int64_t kMsPerMinute = 60000;
239
+
240
+ // Constants for timezone information.
241
+ static const int kTzNameSize = 128;
242
+ static const bool kShortTzNames = false;
243
+
244
+ // Timezone information. We need to have static buffers for the
245
+ // timezone names because we return pointers to these in
246
+ // LocalTimezone().
247
+ static bool tz_initialized_;
248
+ static TIME_ZONE_INFORMATION tzinfo_;
249
+ static char std_tz_name_[kTzNameSize];
250
+ static char dst_tz_name_[kTzNameSize];
251
+
252
+ // Initialize the timezone information (if not already done).
253
+ static void TzSet();
254
+
255
+ // Guess the name of the timezone from the bias.
256
+ static const char* GuessTimezoneNameFromBias(int bias);
257
+
258
+ // Return whether or not daylight savings time is in effect at this time.
259
+ bool InDST();
260
+
261
+ // Return the difference (in milliseconds) between this timestamp and
262
+ // another timestamp.
263
+ int64_t Diff(Time* other);
264
+
265
+ // Accessor for FILETIME representation.
266
+ FILETIME& ft() { return time_.ft_; }
267
+
268
+ // Accessor for integer representation.
269
+ int64_t& t() { return time_.t_; }
270
+
271
+ // Although win32 uses 64-bit integers for representing timestamps,
272
+ // these are packed into a FILETIME structure. The FILETIME structure
273
+ // is just a struct representing a 64-bit integer. The TimeStamp union
274
+ // allows access to both a FILETIME and an integer representation of
275
+ // the timestamp.
276
+ union TimeStamp {
277
+ FILETIME ft_;
278
+ int64_t t_;
279
+ };
280
+
281
+ TimeStamp time_;
282
+ };
283
+
284
+ // Static variables.
285
+ bool Time::tz_initialized_ = false;
286
+ TIME_ZONE_INFORMATION Time::tzinfo_;
287
+ char Time::std_tz_name_[kTzNameSize];
288
+ char Time::dst_tz_name_[kTzNameSize];
289
+
290
+
291
+ // Initialize timestamp to start of epoc.
292
+ Time::Time() {
293
+ t() = 0;
294
+ }
295
+
296
+
297
+ // Initialize timestamp from a JavaScript timestamp.
298
+ Time::Time(double jstime) {
299
+ t() = static_cast<int64_t>(jstime) * kTimeScaler + kTimeEpoc;
300
+ }
301
+
302
+
303
+ // Initialize timestamp from date/time components.
304
+ Time::Time(int year, int mon, int day, int hour, int min, int sec) {
305
+ SYSTEMTIME st;
306
+ st.wYear = year;
307
+ st.wMonth = mon;
308
+ st.wDay = day;
309
+ st.wHour = hour;
310
+ st.wMinute = min;
311
+ st.wSecond = sec;
312
+ st.wMilliseconds = 0;
313
+ SystemTimeToFileTime(&st, &ft());
314
+ }
315
+
316
+
317
+ // Convert timestamp to JavaScript timestamp.
318
+ double Time::ToJSTime() {
319
+ return static_cast<double>((t() - kTimeEpoc) / kTimeScaler);
320
+ }
321
+
322
+
323
+ // Guess the name of the timezone from the bias.
324
+ // The guess is very biased towards the northern hemisphere.
325
+ const char* Time::GuessTimezoneNameFromBias(int bias) {
326
+ static const int kHour = 60;
327
+ switch (-bias) {
328
+ case -9*kHour: return "Alaska";
329
+ case -8*kHour: return "Pacific";
330
+ case -7*kHour: return "Mountain";
331
+ case -6*kHour: return "Central";
332
+ case -5*kHour: return "Eastern";
333
+ case -4*kHour: return "Atlantic";
334
+ case 0*kHour: return "GMT";
335
+ case +1*kHour: return "Central Europe";
336
+ case +2*kHour: return "Eastern Europe";
337
+ case +3*kHour: return "Russia";
338
+ case +5*kHour + 30: return "India";
339
+ case +8*kHour: return "China";
340
+ case +9*kHour: return "Japan";
341
+ case +12*kHour: return "New Zealand";
342
+ default: return "Local";
343
+ }
344
+ }
345
+
346
+
347
+ // Initialize timezone information. The timezone information is obtained from
348
+ // windows. If we cannot get the timezone information we fall back to CET.
349
+ // Please notice that this code is not thread-safe.
350
+ void Time::TzSet() {
351
+ // Just return if timezone information has already been initialized.
352
+ if (tz_initialized_) return;
353
+
354
+ // Initialize POSIX time zone data.
355
+ _tzset();
356
+ // Obtain timezone information from operating system.
357
+ memset(&tzinfo_, 0, sizeof(tzinfo_));
358
+ if (GetTimeZoneInformation(&tzinfo_) == TIME_ZONE_ID_INVALID) {
359
+ // If we cannot get timezone information we fall back to CET.
360
+ tzinfo_.Bias = -60;
361
+ tzinfo_.StandardDate.wMonth = 10;
362
+ tzinfo_.StandardDate.wDay = 5;
363
+ tzinfo_.StandardDate.wHour = 3;
364
+ tzinfo_.StandardBias = 0;
365
+ tzinfo_.DaylightDate.wMonth = 3;
366
+ tzinfo_.DaylightDate.wDay = 5;
367
+ tzinfo_.DaylightDate.wHour = 2;
368
+ tzinfo_.DaylightBias = -60;
369
+ }
370
+
371
+ // Make standard and DST timezone names.
372
+ OS::SNPrintF(Vector<char>(std_tz_name_, kTzNameSize),
373
+ "%S",
374
+ tzinfo_.StandardName);
375
+ std_tz_name_[kTzNameSize - 1] = '\0';
376
+ OS::SNPrintF(Vector<char>(dst_tz_name_, kTzNameSize),
377
+ "%S",
378
+ tzinfo_.DaylightName);
379
+ dst_tz_name_[kTzNameSize - 1] = '\0';
380
+
381
+ // If OS returned empty string or resource id (like "@tzres.dll,-211")
382
+ // simply guess the name from the UTC bias of the timezone.
383
+ // To properly resolve the resource identifier requires a library load,
384
+ // which is not possible in a sandbox.
385
+ if (std_tz_name_[0] == '\0' || std_tz_name_[0] == '@') {
386
+ OS::SNPrintF(Vector<char>(std_tz_name_, kTzNameSize - 1),
387
+ "%s Standard Time",
388
+ GuessTimezoneNameFromBias(tzinfo_.Bias));
389
+ }
390
+ if (dst_tz_name_[0] == '\0' || dst_tz_name_[0] == '@') {
391
+ OS::SNPrintF(Vector<char>(dst_tz_name_, kTzNameSize - 1),
392
+ "%s Daylight Time",
393
+ GuessTimezoneNameFromBias(tzinfo_.Bias));
394
+ }
395
+
396
+ // Timezone information initialized.
397
+ tz_initialized_ = true;
398
+ }
399
+
400
+
401
+ // Return the difference in milliseconds between this and another timestamp.
402
+ int64_t Time::Diff(Time* other) {
403
+ return (t() - other->t()) / kTimeScaler;
404
+ }
405
+
406
+
407
+ // Set timestamp to current time.
408
+ void Time::SetToCurrentTime() {
409
+ // The default GetSystemTimeAsFileTime has a ~15.5ms resolution.
410
+ // Because we're fast, we like fast timers which have at least a
411
+ // 1ms resolution.
412
+ //
413
+ // timeGetTime() provides 1ms granularity when combined with
414
+ // timeBeginPeriod(). If the host application for v8 wants fast
415
+ // timers, it can use timeBeginPeriod to increase the resolution.
416
+ //
417
+ // Using timeGetTime() has a drawback because it is a 32bit value
418
+ // and hence rolls-over every ~49days.
419
+ //
420
+ // To use the clock, we use GetSystemTimeAsFileTime as our base;
421
+ // and then use timeGetTime to extrapolate current time from the
422
+ // start time. To deal with rollovers, we resync the clock
423
+ // any time when more than kMaxClockElapsedTime has passed or
424
+ // whenever timeGetTime creates a rollover.
425
+
426
+ static bool initialized = false;
427
+ static TimeStamp init_time;
428
+ static DWORD init_ticks;
429
+ static const int64_t kHundredNanosecondsPerSecond = 10000000;
430
+ static const int64_t kMaxClockElapsedTime =
431
+ 60*kHundredNanosecondsPerSecond; // 1 minute
432
+
433
+ // If we are uninitialized, we need to resync the clock.
434
+ bool needs_resync = !initialized;
435
+
436
+ // Get the current time.
437
+ TimeStamp time_now;
438
+ GetSystemTimeAsFileTime(&time_now.ft_);
439
+ DWORD ticks_now = timeGetTime();
440
+
441
+ // Check if we need to resync due to clock rollover.
442
+ needs_resync |= ticks_now < init_ticks;
443
+
444
+ // Check if we need to resync due to elapsed time.
445
+ needs_resync |= (time_now.t_ - init_time.t_) > kMaxClockElapsedTime;
446
+
447
+ // Resync the clock if necessary.
448
+ if (needs_resync) {
449
+ GetSystemTimeAsFileTime(&init_time.ft_);
450
+ init_ticks = ticks_now = timeGetTime();
451
+ initialized = true;
452
+ }
453
+
454
+ // Finally, compute the actual time. Why is this so hard.
455
+ DWORD elapsed = ticks_now - init_ticks;
456
+ this->time_.t_ = init_time.t_ + (static_cast<int64_t>(elapsed) * 10000);
457
+ }
458
+
459
+
460
+ // Return the local timezone offset in milliseconds east of UTC. This
461
+ // takes into account whether daylight saving is in effect at the time.
462
+ // Only times in the 32-bit Unix range may be passed to this function.
463
+ // Also, adding the time-zone offset to the input must not overflow.
464
+ // The function EquivalentTime() in date.js guarantees this.
465
+ int64_t Time::LocalOffset() {
466
+ // Initialize timezone information, if needed.
467
+ TzSet();
468
+
469
+ Time rounded_to_second(*this);
470
+ rounded_to_second.t() = rounded_to_second.t() / 1000 / kTimeScaler *
471
+ 1000 * kTimeScaler;
472
+ // Convert to local time using POSIX localtime function.
473
+ // Windows XP Service Pack 3 made SystemTimeToTzSpecificLocalTime()
474
+ // very slow. Other browsers use localtime().
475
+
476
+ // Convert from JavaScript milliseconds past 1/1/1970 0:00:00 to
477
+ // POSIX seconds past 1/1/1970 0:00:00.
478
+ double unchecked_posix_time = rounded_to_second.ToJSTime() / 1000;
479
+ if (unchecked_posix_time > INT_MAX || unchecked_posix_time < 0) {
480
+ return 0;
481
+ }
482
+ // Because _USE_32BIT_TIME_T is defined, time_t is a 32-bit int.
483
+ time_t posix_time = static_cast<time_t>(unchecked_posix_time);
484
+
485
+ // Convert to local time, as struct with fields for day, hour, year, etc.
486
+ tm posix_local_time_struct;
487
+ if (localtime_s(&posix_local_time_struct, &posix_time)) return 0;
488
+ // Convert local time in struct to POSIX time as if it were a UTC time.
489
+ time_t local_posix_time = _mkgmtime(&posix_local_time_struct);
490
+ Time localtime(1000.0 * local_posix_time);
491
+
492
+ return localtime.Diff(&rounded_to_second);
493
+ }
494
+
495
+
496
+ // Return whether or not daylight savings time is in effect at this time.
497
+ bool Time::InDST() {
498
+ // Initialize timezone information, if needed.
499
+ TzSet();
500
+
501
+ // Determine if DST is in effect at the specified time.
502
+ bool in_dst = false;
503
+ if (tzinfo_.StandardDate.wMonth != 0 || tzinfo_.DaylightDate.wMonth != 0) {
504
+ // Get the local timezone offset for the timestamp in milliseconds.
505
+ int64_t offset = LocalOffset();
506
+
507
+ // Compute the offset for DST. The bias parameters in the timezone info
508
+ // are specified in minutes. These must be converted to milliseconds.
509
+ int64_t dstofs = -(tzinfo_.Bias + tzinfo_.DaylightBias) * kMsPerMinute;
510
+
511
+ // If the local time offset equals the timezone bias plus the daylight
512
+ // bias then DST is in effect.
513
+ in_dst = offset == dstofs;
514
+ }
515
+
516
+ return in_dst;
517
+ }
518
+
519
+
520
+ // Return the daylight savings time offset for this time.
521
+ int64_t Time::DaylightSavingsOffset() {
522
+ return InDST() ? 60 * kMsPerMinute : 0;
523
+ }
524
+
525
+
526
+ // Returns a string identifying the current timezone for the
527
+ // timestamp taking into account daylight saving.
528
+ char* Time::LocalTimezone() {
529
+ // Return the standard or DST time zone name based on whether daylight
530
+ // saving is in effect at the given time.
531
+ return InDST() ? dst_tz_name_ : std_tz_name_;
532
+ }
533
+
534
+
535
+ void OS::Setup() {
536
+ // Seed the random number generator.
537
+ // Convert the current time to a 64-bit integer first, before converting it
538
+ // to an unsigned. Going directly can cause an overflow and the seed to be
539
+ // set to all ones. The seed will be identical for different instances that
540
+ // call this setup code within the same millisecond.
541
+ uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis());
542
+ srand(static_cast<unsigned int>(seed));
543
+ }
544
+
545
+
546
+ // Returns the accumulated user time for thread.
547
+ int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
548
+ FILETIME dummy;
549
+ uint64_t usertime;
550
+
551
+ // Get the amount of time that the thread has executed in user mode.
552
+ if (!GetThreadTimes(GetCurrentThread(), &dummy, &dummy, &dummy,
553
+ reinterpret_cast<FILETIME*>(&usertime))) return -1;
554
+
555
+ // Adjust the resolution to micro-seconds.
556
+ usertime /= 10;
557
+
558
+ // Convert to seconds and microseconds
559
+ *secs = static_cast<uint32_t>(usertime / 1000000);
560
+ *usecs = static_cast<uint32_t>(usertime % 1000000);
561
+ return 0;
562
+ }
563
+
564
+
565
+ // Returns current time as the number of milliseconds since
566
+ // 00:00:00 UTC, January 1, 1970.
567
+ double OS::TimeCurrentMillis() {
568
+ Time t;
569
+ t.SetToCurrentTime();
570
+ return t.ToJSTime();
571
+ }
572
+
573
+ // Returns the tickcounter based on timeGetTime.
574
+ int64_t OS::Ticks() {
575
+ return timeGetTime() * 1000; // Convert to microseconds.
576
+ }
577
+
578
+
579
+ // Returns a string identifying the current timezone taking into
580
+ // account daylight saving.
581
+ const char* OS::LocalTimezone(double time) {
582
+ return Time(time).LocalTimezone();
583
+ }
584
+
585
+
586
+ // Returns the local time offset in milliseconds east of UTC without
587
+ // taking daylight savings time into account.
588
+ double OS::LocalTimeOffset() {
589
+ // Use current time, rounded to the millisecond.
590
+ Time t(TimeCurrentMillis());
591
+ // Time::LocalOffset inlcudes any daylight savings offset, so subtract it.
592
+ return static_cast<double>(t.LocalOffset() - t.DaylightSavingsOffset());
593
+ }
594
+
595
+
596
+ // Returns the daylight savings offset in milliseconds for the given
597
+ // time.
598
+ double OS::DaylightSavingsOffset(double time) {
599
+ int64_t offset = Time(time).DaylightSavingsOffset();
600
+ return static_cast<double>(offset);
601
+ }
602
+
603
+
604
+ int OS::GetLastError() {
605
+ return ::GetLastError();
606
+ }
607
+
608
+
609
+ // ----------------------------------------------------------------------------
610
+ // Win32 console output.
611
+ //
612
+ // If a Win32 application is linked as a console application it has a normal
613
+ // standard output and standard error. In this case normal printf works fine
614
+ // for output. However, if the application is linked as a GUI application,
615
+ // the process doesn't have a console, and therefore (debugging) output is lost.
616
+ // This is the case if we are embedded in a windows program (like a browser).
617
+ // In order to be able to get debug output in this case the the debugging
618
+ // facility using OutputDebugString. This output goes to the active debugger
619
+ // for the process (if any). Else the output can be monitored using DBMON.EXE.
620
+
621
+ enum OutputMode {
622
+ UNKNOWN, // Output method has not yet been determined.
623
+ CONSOLE, // Output is written to stdout.
624
+ ODS // Output is written to debug facility.
625
+ };
626
+
627
+ static OutputMode output_mode = UNKNOWN; // Current output mode.
628
+
629
+
630
+ // Determine if the process has a console for output.
631
+ static bool HasConsole() {
632
+ // Only check the first time. Eventual race conditions are not a problem,
633
+ // because all threads will eventually determine the same mode.
634
+ if (output_mode == UNKNOWN) {
635
+ // We cannot just check that the standard output is attached to a console
636
+ // because this would fail if output is redirected to a file. Therefore we
637
+ // say that a process does not have an output console if either the
638
+ // standard output handle is invalid or its file type is unknown.
639
+ if (GetStdHandle(STD_OUTPUT_HANDLE) != INVALID_HANDLE_VALUE &&
640
+ GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) != FILE_TYPE_UNKNOWN)
641
+ output_mode = CONSOLE;
642
+ else
643
+ output_mode = ODS;
644
+ }
645
+ return output_mode == CONSOLE;
646
+ }
647
+
648
+
649
+ static void VPrintHelper(FILE* stream, const char* format, va_list args) {
650
+ if (HasConsole()) {
651
+ vfprintf(stream, format, args);
652
+ } else {
653
+ // It is important to use safe print here in order to avoid
654
+ // overflowing the buffer. We might truncate the output, but this
655
+ // does not crash.
656
+ EmbeddedVector<char, 4096> buffer;
657
+ OS::VSNPrintF(buffer, format, args);
658
+ OutputDebugStringA(buffer.start());
659
+ }
660
+ }
661
+
662
+
663
+ FILE* OS::FOpen(const char* path, const char* mode) {
664
+ FILE* result;
665
+ if (fopen_s(&result, path, mode) == 0) {
666
+ return result;
667
+ } else {
668
+ return NULL;
669
+ }
670
+ }
671
+
672
+
673
+ bool OS::Remove(const char* path) {
674
+ return (DeleteFileA(path) != 0);
675
+ }
676
+
677
+
678
+ // Open log file in binary mode to avoid /n -> /r/n conversion.
679
+ const char* OS::LogFileOpenMode = "wb";
680
+
681
+
682
+ // Print (debug) message to console.
683
+ void OS::Print(const char* format, ...) {
684
+ va_list args;
685
+ va_start(args, format);
686
+ VPrint(format, args);
687
+ va_end(args);
688
+ }
689
+
690
+
691
+ void OS::VPrint(const char* format, va_list args) {
692
+ VPrintHelper(stdout, format, args);
693
+ }
694
+
695
+
696
+ void OS::FPrint(FILE* out, const char* format, ...) {
697
+ va_list args;
698
+ va_start(args, format);
699
+ VFPrint(out, format, args);
700
+ va_end(args);
701
+ }
702
+
703
+
704
+ void OS::VFPrint(FILE* out, const char* format, va_list args) {
705
+ VPrintHelper(out, format, args);
706
+ }
707
+
708
+
709
+ // Print error message to console.
710
+ void OS::PrintError(const char* format, ...) {
711
+ va_list args;
712
+ va_start(args, format);
713
+ VPrintError(format, args);
714
+ va_end(args);
715
+ }
716
+
717
+
718
+ void OS::VPrintError(const char* format, va_list args) {
719
+ VPrintHelper(stderr, format, args);
720
+ }
721
+
722
+
723
+ int OS::SNPrintF(Vector<char> str, const char* format, ...) {
724
+ va_list args;
725
+ va_start(args, format);
726
+ int result = VSNPrintF(str, format, args);
727
+ va_end(args);
728
+ return result;
729
+ }
730
+
731
+
732
+ int OS::VSNPrintF(Vector<char> str, const char* format, va_list args) {
733
+ int n = _vsnprintf_s(str.start(), str.length(), _TRUNCATE, format, args);
734
+ // Make sure to zero-terminate the string if the output was
735
+ // truncated or if there was an error.
736
+ if (n < 0 || n >= str.length()) {
737
+ if (str.length() > 0)
738
+ str[str.length() - 1] = '\0';
739
+ return -1;
740
+ } else {
741
+ return n;
742
+ }
743
+ }
744
+
745
+
746
+ char* OS::StrChr(char* str, int c) {
747
+ return const_cast<char*>(strchr(str, c));
748
+ }
749
+
750
+
751
+ void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) {
752
+ int result = strncpy_s(dest.start(), dest.length(), src, n);
753
+ USE(result);
754
+ ASSERT(result == 0);
755
+ }
756
+
757
+
758
+ // We keep the lowest and highest addresses mapped as a quick way of
759
+ // determining that pointers are outside the heap (used mostly in assertions
760
+ // and verification). The estimate is conservative, ie, not all addresses in
761
+ // 'allocated' space are actually allocated to our heap. The range is
762
+ // [lowest, highest), inclusive on the low and and exclusive on the high end.
763
+ static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
764
+ static void* highest_ever_allocated = reinterpret_cast<void*>(0);
765
+
766
+
767
+ static void UpdateAllocatedSpaceLimits(void* address, int size) {
768
+ lowest_ever_allocated = Min(lowest_ever_allocated, address);
769
+ highest_ever_allocated =
770
+ Max(highest_ever_allocated,
771
+ reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size));
772
+ }
773
+
774
+
775
+ bool OS::IsOutsideAllocatedSpace(void* pointer) {
776
+ if (pointer < lowest_ever_allocated || pointer >= highest_ever_allocated)
777
+ return true;
778
+ // Ask the Windows API
779
+ if (IsBadWritePtr(pointer, 1))
780
+ return true;
781
+ return false;
782
+ }
783
+
784
+
785
+ // Get the system's page size used by VirtualAlloc() or the next power
786
+ // of two. The reason for always returning a power of two is that the
787
+ // rounding up in OS::Allocate expects that.
788
+ static size_t GetPageSize() {
789
+ static size_t page_size = 0;
790
+ if (page_size == 0) {
791
+ SYSTEM_INFO info;
792
+ GetSystemInfo(&info);
793
+ page_size = RoundUpToPowerOf2(info.dwPageSize);
794
+ }
795
+ return page_size;
796
+ }
797
+
798
+
799
+ // The allocation alignment is the guaranteed alignment for
800
+ // VirtualAlloc'ed blocks of memory.
801
+ size_t OS::AllocateAlignment() {
802
+ static size_t allocate_alignment = 0;
803
+ if (allocate_alignment == 0) {
804
+ SYSTEM_INFO info;
805
+ GetSystemInfo(&info);
806
+ allocate_alignment = info.dwAllocationGranularity;
807
+ }
808
+ return allocate_alignment;
809
+ }
810
+
811
+
812
+ void* OS::Allocate(const size_t requested,
813
+ size_t* allocated,
814
+ bool is_executable) {
815
+ // The address range used to randomize RWX allocations in OS::Allocate
816
+ // Try not to map pages into the default range that windows loads DLLs
817
+ // Use a multiple of 64k to prevent committing unused memory.
818
+ // Note: This does not guarantee RWX regions will be within the
819
+ // range kAllocationRandomAddressMin to kAllocationRandomAddressMax
820
+ #ifdef V8_HOST_ARCH_64_BIT
821
+ static const intptr_t kAllocationRandomAddressMin = 0x0000000080000000;
822
+ static const intptr_t kAllocationRandomAddressMax = 0x000003FFFFFF0000;
823
+ #else
824
+ static const intptr_t kAllocationRandomAddressMin = 0x04000000;
825
+ static const intptr_t kAllocationRandomAddressMax = 0x3FFF0000;
826
+ #endif
827
+
828
+ // VirtualAlloc rounds allocated size to page size automatically.
829
+ size_t msize = RoundUp(requested, static_cast<int>(GetPageSize()));
830
+ intptr_t address = 0;
831
+
832
+ // Windows XP SP2 allows Data Excution Prevention (DEP).
833
+ int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
834
+
835
+ // For exectutable pages try and randomize the allocation address
836
+ if (prot == PAGE_EXECUTE_READWRITE &&
837
+ msize >= static_cast<size_t>(Page::kPageSize)) {
838
+ address = (V8::RandomPrivate() << kPageSizeBits)
839
+ | kAllocationRandomAddressMin;
840
+ address &= kAllocationRandomAddressMax;
841
+ }
842
+
843
+ LPVOID mbase = VirtualAlloc(reinterpret_cast<void *>(address),
844
+ msize,
845
+ MEM_COMMIT | MEM_RESERVE,
846
+ prot);
847
+ if (mbase == NULL && address != 0)
848
+ mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot);
849
+
850
+ if (mbase == NULL) {
851
+ LOG(StringEvent("OS::Allocate", "VirtualAlloc failed"));
852
+ return NULL;
853
+ }
854
+
855
+ ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment()));
856
+
857
+ *allocated = msize;
858
+ UpdateAllocatedSpaceLimits(mbase, static_cast<int>(msize));
859
+ return mbase;
860
+ }
861
+
862
+
863
+ void OS::Free(void* address, const size_t size) {
864
+ // TODO(1240712): VirtualFree has a return value which is ignored here.
865
+ VirtualFree(address, 0, MEM_RELEASE);
866
+ USE(size);
867
+ }
868
+
869
+
870
+ #ifdef ENABLE_HEAP_PROTECTION
871
+
872
+ void OS::Protect(void* address, size_t size) {
873
+ // TODO(1240712): VirtualProtect has a return value which is ignored here.
874
+ DWORD old_protect;
875
+ VirtualProtect(address, size, PAGE_READONLY, &old_protect);
876
+ }
877
+
878
+
879
+ void OS::Unprotect(void* address, size_t size, bool is_executable) {
880
+ // TODO(1240712): VirtualProtect has a return value which is ignored here.
881
+ DWORD new_protect = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
882
+ DWORD old_protect;
883
+ VirtualProtect(address, size, new_protect, &old_protect);
884
+ }
885
+
886
+ #endif
887
+
888
+
889
+ void OS::Sleep(int milliseconds) {
890
+ ::Sleep(milliseconds);
891
+ }
892
+
893
+
894
+ void OS::Abort() {
895
+ if (!IsDebuggerPresent()) {
896
+ #ifdef _MSC_VER
897
+ // Make the MSVCRT do a silent abort.
898
+ _set_abort_behavior(0, _WRITE_ABORT_MSG);
899
+ _set_abort_behavior(0, _CALL_REPORTFAULT);
900
+ #endif // _MSC_VER
901
+ abort();
902
+ } else {
903
+ DebugBreak();
904
+ }
905
+ }
906
+
907
+
908
+ void OS::DebugBreak() {
909
+ #ifdef _MSC_VER
910
+ __debugbreak();
911
+ #else
912
+ ::DebugBreak();
913
+ #endif
914
+ }
915
+
916
+
917
+ class Win32MemoryMappedFile : public OS::MemoryMappedFile {
918
+ public:
919
+ Win32MemoryMappedFile(HANDLE file,
920
+ HANDLE file_mapping,
921
+ void* memory,
922
+ int size)
923
+ : file_(file),
924
+ file_mapping_(file_mapping),
925
+ memory_(memory),
926
+ size_(size) { }
927
+ virtual ~Win32MemoryMappedFile();
928
+ virtual void* memory() { return memory_; }
929
+ virtual int size() { return size_; }
930
+ private:
931
+ HANDLE file_;
932
+ HANDLE file_mapping_;
933
+ void* memory_;
934
+ int size_;
935
+ };
936
+
937
+
938
+ OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
939
+ // Open a physical file
940
+ HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE,
941
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
942
+ if (file == INVALID_HANDLE_VALUE) return NULL;
943
+
944
+ int size = static_cast<int>(GetFileSize(file, NULL));
945
+
946
+ // Create a file mapping for the physical file
947
+ HANDLE file_mapping = CreateFileMapping(file, NULL,
948
+ PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL);
949
+ if (file_mapping == NULL) return NULL;
950
+
951
+ // Map a view of the file into memory
952
+ void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size);
953
+ return new Win32MemoryMappedFile(file, file_mapping, memory, size);
954
+ }
955
+
956
+
957
+ OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
958
+ void* initial) {
959
+ // Open a physical file
960
+ HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE,
961
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL);
962
+ if (file == NULL) return NULL;
963
+ // Create a file mapping for the physical file
964
+ HANDLE file_mapping = CreateFileMapping(file, NULL,
965
+ PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL);
966
+ if (file_mapping == NULL) return NULL;
967
+ // Map a view of the file into memory
968
+ void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size);
969
+ if (memory) memmove(memory, initial, size);
970
+ return new Win32MemoryMappedFile(file, file_mapping, memory, size);
971
+ }
972
+
973
+
974
+ Win32MemoryMappedFile::~Win32MemoryMappedFile() {
975
+ if (memory_ != NULL)
976
+ UnmapViewOfFile(memory_);
977
+ CloseHandle(file_mapping_);
978
+ CloseHandle(file_);
979
+ }
980
+
981
+
982
+ // The following code loads functions defined in DbhHelp.h and TlHelp32.h
983
+ // dynamically. This is to avoid being depending on dbghelp.dll and
984
+ // tlhelp32.dll when running (the functions in tlhelp32.dll have been moved to
985
+ // kernel32.dll at some point so loading functions defines in TlHelp32.h
986
+ // dynamically might not be necessary any more - for some versions of Windows?).
987
+
988
+ // Function pointers to functions dynamically loaded from dbghelp.dll.
989
+ #define DBGHELP_FUNCTION_LIST(V) \
990
+ V(SymInitialize) \
991
+ V(SymGetOptions) \
992
+ V(SymSetOptions) \
993
+ V(SymGetSearchPath) \
994
+ V(SymLoadModule64) \
995
+ V(StackWalk64) \
996
+ V(SymGetSymFromAddr64) \
997
+ V(SymGetLineFromAddr64) \
998
+ V(SymFunctionTableAccess64) \
999
+ V(SymGetModuleBase64)
1000
+
1001
+ // Function pointers to functions dynamically loaded from dbghelp.dll.
1002
+ #define TLHELP32_FUNCTION_LIST(V) \
1003
+ V(CreateToolhelp32Snapshot) \
1004
+ V(Module32FirstW) \
1005
+ V(Module32NextW)
1006
+
1007
+ // Define the decoration to use for the type and variable name used for
1008
+ // dynamically loaded DLL function..
1009
+ #define DLL_FUNC_TYPE(name) _##name##_
1010
+ #define DLL_FUNC_VAR(name) _##name
1011
+
1012
+ // Define the type for each dynamically loaded DLL function. The function
1013
+ // definitions are copied from DbgHelp.h and TlHelp32.h. The IN and VOID macros
1014
+ // from the Windows include files are redefined here to have the function
1015
+ // definitions to be as close to the ones in the original .h files as possible.
1016
+ #ifndef IN
1017
+ #define IN
1018
+ #endif
1019
+ #ifndef VOID
1020
+ #define VOID void
1021
+ #endif
1022
+
1023
+ // DbgHelp isn't supported on MinGW yet
1024
+ #ifndef __MINGW32__
1025
+ // DbgHelp.h functions.
1026
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(SymInitialize))(IN HANDLE hProcess,
1027
+ IN PSTR UserSearchPath,
1028
+ IN BOOL fInvadeProcess);
1029
+ typedef DWORD (__stdcall *DLL_FUNC_TYPE(SymGetOptions))(VOID);
1030
+ typedef DWORD (__stdcall *DLL_FUNC_TYPE(SymSetOptions))(IN DWORD SymOptions);
1031
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(SymGetSearchPath))(
1032
+ IN HANDLE hProcess,
1033
+ OUT PSTR SearchPath,
1034
+ IN DWORD SearchPathLength);
1035
+ typedef DWORD64 (__stdcall *DLL_FUNC_TYPE(SymLoadModule64))(
1036
+ IN HANDLE hProcess,
1037
+ IN HANDLE hFile,
1038
+ IN PSTR ImageName,
1039
+ IN PSTR ModuleName,
1040
+ IN DWORD64 BaseOfDll,
1041
+ IN DWORD SizeOfDll);
1042
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(StackWalk64))(
1043
+ DWORD MachineType,
1044
+ HANDLE hProcess,
1045
+ HANDLE hThread,
1046
+ LPSTACKFRAME64 StackFrame,
1047
+ PVOID ContextRecord,
1048
+ PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
1049
+ PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
1050
+ PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
1051
+ PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
1052
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(SymGetSymFromAddr64))(
1053
+ IN HANDLE hProcess,
1054
+ IN DWORD64 qwAddr,
1055
+ OUT PDWORD64 pdwDisplacement,
1056
+ OUT PIMAGEHLP_SYMBOL64 Symbol);
1057
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(SymGetLineFromAddr64))(
1058
+ IN HANDLE hProcess,
1059
+ IN DWORD64 qwAddr,
1060
+ OUT PDWORD pdwDisplacement,
1061
+ OUT PIMAGEHLP_LINE64 Line64);
1062
+ // DbgHelp.h typedefs. Implementation found in dbghelp.dll.
1063
+ typedef PVOID (__stdcall *DLL_FUNC_TYPE(SymFunctionTableAccess64))(
1064
+ HANDLE hProcess,
1065
+ DWORD64 AddrBase); // DbgHelp.h typedef PFUNCTION_TABLE_ACCESS_ROUTINE64
1066
+ typedef DWORD64 (__stdcall *DLL_FUNC_TYPE(SymGetModuleBase64))(
1067
+ HANDLE hProcess,
1068
+ DWORD64 AddrBase); // DbgHelp.h typedef PGET_MODULE_BASE_ROUTINE64
1069
+
1070
+ // TlHelp32.h functions.
1071
+ typedef HANDLE (__stdcall *DLL_FUNC_TYPE(CreateToolhelp32Snapshot))(
1072
+ DWORD dwFlags,
1073
+ DWORD th32ProcessID);
1074
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(Module32FirstW))(HANDLE hSnapshot,
1075
+ LPMODULEENTRY32W lpme);
1076
+ typedef BOOL (__stdcall *DLL_FUNC_TYPE(Module32NextW))(HANDLE hSnapshot,
1077
+ LPMODULEENTRY32W lpme);
1078
+
1079
+ #undef IN
1080
+ #undef VOID
1081
+
1082
+ // Declare a variable for each dynamically loaded DLL function.
1083
+ #define DEF_DLL_FUNCTION(name) DLL_FUNC_TYPE(name) DLL_FUNC_VAR(name) = NULL;
1084
+ DBGHELP_FUNCTION_LIST(DEF_DLL_FUNCTION)
1085
+ TLHELP32_FUNCTION_LIST(DEF_DLL_FUNCTION)
1086
+ #undef DEF_DLL_FUNCTION
1087
+
1088
+ // Load the functions. This function has a lot of "ugly" macros in order to
1089
+ // keep down code duplication.
1090
+
1091
+ static bool LoadDbgHelpAndTlHelp32() {
1092
+ static bool dbghelp_loaded = false;
1093
+
1094
+ if (dbghelp_loaded) return true;
1095
+
1096
+ HMODULE module;
1097
+
1098
+ // Load functions from the dbghelp.dll module.
1099
+ module = LoadLibrary(TEXT("dbghelp.dll"));
1100
+ if (module == NULL) {
1101
+ return false;
1102
+ }
1103
+
1104
+ #define LOAD_DLL_FUNC(name) \
1105
+ DLL_FUNC_VAR(name) = \
1106
+ reinterpret_cast<DLL_FUNC_TYPE(name)>(GetProcAddress(module, #name));
1107
+
1108
+ DBGHELP_FUNCTION_LIST(LOAD_DLL_FUNC)
1109
+
1110
+ #undef LOAD_DLL_FUNC
1111
+
1112
+ // Load functions from the kernel32.dll module (the TlHelp32.h function used
1113
+ // to be in tlhelp32.dll but are now moved to kernel32.dll).
1114
+ module = LoadLibrary(TEXT("kernel32.dll"));
1115
+ if (module == NULL) {
1116
+ return false;
1117
+ }
1118
+
1119
+ #define LOAD_DLL_FUNC(name) \
1120
+ DLL_FUNC_VAR(name) = \
1121
+ reinterpret_cast<DLL_FUNC_TYPE(name)>(GetProcAddress(module, #name));
1122
+
1123
+ TLHELP32_FUNCTION_LIST(LOAD_DLL_FUNC)
1124
+
1125
+ #undef LOAD_DLL_FUNC
1126
+
1127
+ // Check that all functions where loaded.
1128
+ bool result =
1129
+ #define DLL_FUNC_LOADED(name) (DLL_FUNC_VAR(name) != NULL) &&
1130
+
1131
+ DBGHELP_FUNCTION_LIST(DLL_FUNC_LOADED)
1132
+ TLHELP32_FUNCTION_LIST(DLL_FUNC_LOADED)
1133
+
1134
+ #undef DLL_FUNC_LOADED
1135
+ true;
1136
+
1137
+ dbghelp_loaded = result;
1138
+ return result;
1139
+ // NOTE: The modules are never unloaded and will stay around until the
1140
+ // application is closed.
1141
+ }
1142
+
1143
+
1144
+ // Load the symbols for generating stack traces.
1145
+ static bool LoadSymbols(HANDLE process_handle) {
1146
+ static bool symbols_loaded = false;
1147
+
1148
+ if (symbols_loaded) return true;
1149
+
1150
+ BOOL ok;
1151
+
1152
+ // Initialize the symbol engine.
1153
+ ok = _SymInitialize(process_handle, // hProcess
1154
+ NULL, // UserSearchPath
1155
+ false); // fInvadeProcess
1156
+ if (!ok) return false;
1157
+
1158
+ DWORD options = _SymGetOptions();
1159
+ options |= SYMOPT_LOAD_LINES;
1160
+ options |= SYMOPT_FAIL_CRITICAL_ERRORS;
1161
+ options = _SymSetOptions(options);
1162
+
1163
+ char buf[OS::kStackWalkMaxNameLen] = {0};
1164
+ ok = _SymGetSearchPath(process_handle, buf, OS::kStackWalkMaxNameLen);
1165
+ if (!ok) {
1166
+ int err = GetLastError();
1167
+ PrintF("%d\n", err);
1168
+ return false;
1169
+ }
1170
+
1171
+ HANDLE snapshot = _CreateToolhelp32Snapshot(
1172
+ TH32CS_SNAPMODULE, // dwFlags
1173
+ GetCurrentProcessId()); // th32ProcessId
1174
+ if (snapshot == INVALID_HANDLE_VALUE) return false;
1175
+ MODULEENTRY32W module_entry;
1176
+ module_entry.dwSize = sizeof(module_entry); // Set the size of the structure.
1177
+ BOOL cont = _Module32FirstW(snapshot, &module_entry);
1178
+ while (cont) {
1179
+ DWORD64 base;
1180
+ // NOTE the SymLoadModule64 function has the peculiarity of accepting a
1181
+ // both unicode and ASCII strings even though the parameter is PSTR.
1182
+ base = _SymLoadModule64(
1183
+ process_handle, // hProcess
1184
+ 0, // hFile
1185
+ reinterpret_cast<PSTR>(module_entry.szExePath), // ImageName
1186
+ reinterpret_cast<PSTR>(module_entry.szModule), // ModuleName
1187
+ reinterpret_cast<DWORD64>(module_entry.modBaseAddr), // BaseOfDll
1188
+ module_entry.modBaseSize); // SizeOfDll
1189
+ if (base == 0) {
1190
+ int err = GetLastError();
1191
+ if (err != ERROR_MOD_NOT_FOUND &&
1192
+ err != ERROR_INVALID_HANDLE) return false;
1193
+ }
1194
+ LOG(SharedLibraryEvent(
1195
+ module_entry.szExePath,
1196
+ reinterpret_cast<unsigned int>(module_entry.modBaseAddr),
1197
+ reinterpret_cast<unsigned int>(module_entry.modBaseAddr +
1198
+ module_entry.modBaseSize)));
1199
+ cont = _Module32NextW(snapshot, &module_entry);
1200
+ }
1201
+ CloseHandle(snapshot);
1202
+
1203
+ symbols_loaded = true;
1204
+ return true;
1205
+ }
1206
+
1207
+
1208
+ void OS::LogSharedLibraryAddresses() {
1209
+ // SharedLibraryEvents are logged when loading symbol information.
1210
+ // Only the shared libraries loaded at the time of the call to
1211
+ // LogSharedLibraryAddresses are logged. DLLs loaded after
1212
+ // initialization are not accounted for.
1213
+ if (!LoadDbgHelpAndTlHelp32()) return;
1214
+ HANDLE process_handle = GetCurrentProcess();
1215
+ LoadSymbols(process_handle);
1216
+ }
1217
+
1218
+
1219
+ void OS::SignalCodeMovingGC() {
1220
+ }
1221
+
1222
+
1223
+ // Walk the stack using the facilities in dbghelp.dll and tlhelp32.dll
1224
+
1225
+ // Switch off warning 4748 (/GS can not protect parameters and local variables
1226
+ // from local buffer overrun because optimizations are disabled in function) as
1227
+ // it is triggered by the use of inline assembler.
1228
+ #pragma warning(push)
1229
+ #pragma warning(disable : 4748)
1230
+ int OS::StackWalk(Vector<OS::StackFrame> frames) {
1231
+ BOOL ok;
1232
+
1233
+ // Load the required functions from DLL's.
1234
+ if (!LoadDbgHelpAndTlHelp32()) return kStackWalkError;
1235
+
1236
+ // Get the process and thread handles.
1237
+ HANDLE process_handle = GetCurrentProcess();
1238
+ HANDLE thread_handle = GetCurrentThread();
1239
+
1240
+ // Read the symbols.
1241
+ if (!LoadSymbols(process_handle)) return kStackWalkError;
1242
+
1243
+ // Capture current context.
1244
+ CONTEXT context;
1245
+ RtlCaptureContext(&context);
1246
+
1247
+ // Initialize the stack walking
1248
+ STACKFRAME64 stack_frame;
1249
+ memset(&stack_frame, 0, sizeof(stack_frame));
1250
+ #ifdef _WIN64
1251
+ stack_frame.AddrPC.Offset = context.Rip;
1252
+ stack_frame.AddrFrame.Offset = context.Rbp;
1253
+ stack_frame.AddrStack.Offset = context.Rsp;
1254
+ #else
1255
+ stack_frame.AddrPC.Offset = context.Eip;
1256
+ stack_frame.AddrFrame.Offset = context.Ebp;
1257
+ stack_frame.AddrStack.Offset = context.Esp;
1258
+ #endif
1259
+ stack_frame.AddrPC.Mode = AddrModeFlat;
1260
+ stack_frame.AddrFrame.Mode = AddrModeFlat;
1261
+ stack_frame.AddrStack.Mode = AddrModeFlat;
1262
+ int frames_count = 0;
1263
+
1264
+ // Collect stack frames.
1265
+ int frames_size = frames.length();
1266
+ while (frames_count < frames_size) {
1267
+ ok = _StackWalk64(
1268
+ IMAGE_FILE_MACHINE_I386, // MachineType
1269
+ process_handle, // hProcess
1270
+ thread_handle, // hThread
1271
+ &stack_frame, // StackFrame
1272
+ &context, // ContextRecord
1273
+ NULL, // ReadMemoryRoutine
1274
+ _SymFunctionTableAccess64, // FunctionTableAccessRoutine
1275
+ _SymGetModuleBase64, // GetModuleBaseRoutine
1276
+ NULL); // TranslateAddress
1277
+ if (!ok) break;
1278
+
1279
+ // Store the address.
1280
+ ASSERT((stack_frame.AddrPC.Offset >> 32) == 0); // 32-bit address.
1281
+ frames[frames_count].address =
1282
+ reinterpret_cast<void*>(stack_frame.AddrPC.Offset);
1283
+
1284
+ // Try to locate a symbol for this frame.
1285
+ DWORD64 symbol_displacement;
1286
+ SmartPointer<IMAGEHLP_SYMBOL64> symbol(
1287
+ NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen));
1288
+ if (symbol.is_empty()) return kStackWalkError; // Out of memory.
1289
+ memset(*symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen);
1290
+ (*symbol)->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
1291
+ (*symbol)->MaxNameLength = kStackWalkMaxNameLen;
1292
+ ok = _SymGetSymFromAddr64(process_handle, // hProcess
1293
+ stack_frame.AddrPC.Offset, // Address
1294
+ &symbol_displacement, // Displacement
1295
+ *symbol); // Symbol
1296
+ if (ok) {
1297
+ // Try to locate more source information for the symbol.
1298
+ IMAGEHLP_LINE64 Line;
1299
+ memset(&Line, 0, sizeof(Line));
1300
+ Line.SizeOfStruct = sizeof(Line);
1301
+ DWORD line_displacement;
1302
+ ok = _SymGetLineFromAddr64(
1303
+ process_handle, // hProcess
1304
+ stack_frame.AddrPC.Offset, // dwAddr
1305
+ &line_displacement, // pdwDisplacement
1306
+ &Line); // Line
1307
+ // Format a text representation of the frame based on the information
1308
+ // available.
1309
+ if (ok) {
1310
+ SNPrintF(MutableCStrVector(frames[frames_count].text,
1311
+ kStackWalkMaxTextLen),
1312
+ "%s %s:%d:%d",
1313
+ (*symbol)->Name, Line.FileName, Line.LineNumber,
1314
+ line_displacement);
1315
+ } else {
1316
+ SNPrintF(MutableCStrVector(frames[frames_count].text,
1317
+ kStackWalkMaxTextLen),
1318
+ "%s",
1319
+ (*symbol)->Name);
1320
+ }
1321
+ // Make sure line termination is in place.
1322
+ frames[frames_count].text[kStackWalkMaxTextLen - 1] = '\0';
1323
+ } else {
1324
+ // No text representation of this frame
1325
+ frames[frames_count].text[0] = '\0';
1326
+
1327
+ // Continue if we are just missing a module (for non C/C++ frames a
1328
+ // module will never be found).
1329
+ int err = GetLastError();
1330
+ if (err != ERROR_MOD_NOT_FOUND) {
1331
+ break;
1332
+ }
1333
+ }
1334
+
1335
+ frames_count++;
1336
+ }
1337
+
1338
+ // Return the number of frames filled in.
1339
+ return frames_count;
1340
+ }
1341
+
1342
+ // Restore warnings to previous settings.
1343
+ #pragma warning(pop)
1344
+
1345
+ #else // __MINGW32__
1346
+ void OS::LogSharedLibraryAddresses() { }
1347
+ void OS::SignalCodeMovingGC() { }
1348
+ int OS::StackWalk(Vector<OS::StackFrame> frames) { return 0; }
1349
+ #endif // __MINGW32__
1350
+
1351
+
1352
+ uint64_t OS::CpuFeaturesImpliedByPlatform() {
1353
+ return 0; // Windows runs on anything.
1354
+ }
1355
+
1356
+
1357
+ double OS::nan_value() {
1358
+ #ifdef _MSC_VER
1359
+ // Positive Quiet NaN with no payload (aka. Indeterminate) has all bits
1360
+ // in mask set, so value equals mask.
1361
+ static const __int64 nanval = kQuietNaNMask;
1362
+ return *reinterpret_cast<const double*>(&nanval);
1363
+ #else // _MSC_VER
1364
+ return NAN;
1365
+ #endif // _MSC_VER
1366
+ }
1367
+
1368
+
1369
+ int OS::ActivationFrameAlignment() {
1370
+ #ifdef _WIN64
1371
+ return 16; // Windows 64-bit ABI requires the stack to be 16-byte aligned.
1372
+ #else
1373
+ return 8; // Floating-point math runs faster with 8-byte alignment.
1374
+ #endif
1375
+ }
1376
+
1377
+
1378
+ void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
1379
+ MemoryBarrier();
1380
+ *ptr = value;
1381
+ }
1382
+
1383
+
1384
+ bool VirtualMemory::IsReserved() {
1385
+ return address_ != NULL;
1386
+ }
1387
+
1388
+
1389
+ VirtualMemory::VirtualMemory(size_t size) {
1390
+ address_ = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
1391
+ size_ = size;
1392
+ }
1393
+
1394
+
1395
+ VirtualMemory::~VirtualMemory() {
1396
+ if (IsReserved()) {
1397
+ if (0 == VirtualFree(address(), 0, MEM_RELEASE)) address_ = NULL;
1398
+ }
1399
+ }
1400
+
1401
+
1402
+ bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
1403
+ int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
1404
+ if (NULL == VirtualAlloc(address, size, MEM_COMMIT, prot)) {
1405
+ return false;
1406
+ }
1407
+
1408
+ UpdateAllocatedSpaceLimits(address, static_cast<int>(size));
1409
+ return true;
1410
+ }
1411
+
1412
+
1413
+ bool VirtualMemory::Uncommit(void* address, size_t size) {
1414
+ ASSERT(IsReserved());
1415
+ return VirtualFree(address, size, MEM_DECOMMIT) != false;
1416
+ }
1417
+
1418
+
1419
+ // ----------------------------------------------------------------------------
1420
+ // Win32 thread support.
1421
+
1422
+ // Definition of invalid thread handle and id.
1423
+ static const HANDLE kNoThread = INVALID_HANDLE_VALUE;
1424
+ static const DWORD kNoThreadId = 0;
1425
+
1426
+
1427
+ class ThreadHandle::PlatformData : public Malloced {
1428
+ public:
1429
+ explicit PlatformData(ThreadHandle::Kind kind) {
1430
+ Initialize(kind);
1431
+ }
1432
+
1433
+ void Initialize(ThreadHandle::Kind kind) {
1434
+ switch (kind) {
1435
+ case ThreadHandle::SELF: tid_ = GetCurrentThreadId(); break;
1436
+ case ThreadHandle::INVALID: tid_ = kNoThreadId; break;
1437
+ }
1438
+ }
1439
+ DWORD tid_; // Win32 thread identifier.
1440
+ };
1441
+
1442
+
1443
+ // Entry point for threads. The supplied argument is a pointer to the thread
1444
+ // object. The entry function dispatches to the run method in the thread
1445
+ // object. It is important that this function has __stdcall calling
1446
+ // convention.
1447
+ static unsigned int __stdcall ThreadEntry(void* arg) {
1448
+ Thread* thread = reinterpret_cast<Thread*>(arg);
1449
+ // This is also initialized by the last parameter to _beginthreadex() but we
1450
+ // don't know which thread will run first (the original thread or the new
1451
+ // one) so we initialize it here too.
1452
+ thread->thread_handle_data()->tid_ = GetCurrentThreadId();
1453
+ thread->Run();
1454
+ return 0;
1455
+ }
1456
+
1457
+
1458
+ // Initialize thread handle to invalid handle.
1459
+ ThreadHandle::ThreadHandle(ThreadHandle::Kind kind) {
1460
+ data_ = new PlatformData(kind);
1461
+ }
1462
+
1463
+
1464
+ ThreadHandle::~ThreadHandle() {
1465
+ delete data_;
1466
+ }
1467
+
1468
+
1469
+ // The thread is running if it has the same id as the current thread.
1470
+ bool ThreadHandle::IsSelf() const {
1471
+ return GetCurrentThreadId() == data_->tid_;
1472
+ }
1473
+
1474
+
1475
+ // Test for invalid thread handle.
1476
+ bool ThreadHandle::IsValid() const {
1477
+ return data_->tid_ != kNoThreadId;
1478
+ }
1479
+
1480
+
1481
+ void ThreadHandle::Initialize(ThreadHandle::Kind kind) {
1482
+ data_->Initialize(kind);
1483
+ }
1484
+
1485
+
1486
+ class Thread::PlatformData : public Malloced {
1487
+ public:
1488
+ explicit PlatformData(HANDLE thread) : thread_(thread) {}
1489
+ HANDLE thread_;
1490
+ };
1491
+
1492
+
1493
+ // Initialize a Win32 thread object. The thread has an invalid thread
1494
+ // handle until it is started.
1495
+
1496
+ Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
1497
+ data_ = new PlatformData(kNoThread);
1498
+ set_name("v8:<unknown>");
1499
+ }
1500
+
1501
+
1502
+ Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) {
1503
+ data_ = new PlatformData(kNoThread);
1504
+ set_name(name);
1505
+ }
1506
+
1507
+
1508
+ void Thread::set_name(const char* name) {
1509
+ OS::StrNCpy(Vector<char>(name_, sizeof(name_)), name, strlen(name));
1510
+ name_[sizeof(name_) - 1] = '\0';
1511
+ }
1512
+
1513
+
1514
+ // Close our own handle for the thread.
1515
+ Thread::~Thread() {
1516
+ if (data_->thread_ != kNoThread) CloseHandle(data_->thread_);
1517
+ delete data_;
1518
+ }
1519
+
1520
+
1521
+ // Create a new thread. It is important to use _beginthreadex() instead of
1522
+ // the Win32 function CreateThread(), because the CreateThread() does not
1523
+ // initialize thread specific structures in the C runtime library.
1524
+ void Thread::Start() {
1525
+ data_->thread_ = reinterpret_cast<HANDLE>(
1526
+ _beginthreadex(NULL,
1527
+ 0,
1528
+ ThreadEntry,
1529
+ this,
1530
+ 0,
1531
+ reinterpret_cast<unsigned int*>(
1532
+ &thread_handle_data()->tid_)));
1533
+ ASSERT(IsValid());
1534
+ }
1535
+
1536
+
1537
+ // Wait for thread to terminate.
1538
+ void Thread::Join() {
1539
+ WaitForSingleObject(data_->thread_, INFINITE);
1540
+ }
1541
+
1542
+
1543
+ Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
1544
+ DWORD result = TlsAlloc();
1545
+ ASSERT(result != TLS_OUT_OF_INDEXES);
1546
+ return static_cast<LocalStorageKey>(result);
1547
+ }
1548
+
1549
+
1550
+ void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
1551
+ BOOL result = TlsFree(static_cast<DWORD>(key));
1552
+ USE(result);
1553
+ ASSERT(result);
1554
+ }
1555
+
1556
+
1557
+ void* Thread::GetThreadLocal(LocalStorageKey key) {
1558
+ return TlsGetValue(static_cast<DWORD>(key));
1559
+ }
1560
+
1561
+
1562
+ void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
1563
+ BOOL result = TlsSetValue(static_cast<DWORD>(key), value);
1564
+ USE(result);
1565
+ ASSERT(result);
1566
+ }
1567
+
1568
+
1569
+
1570
+ void Thread::YieldCPU() {
1571
+ Sleep(0);
1572
+ }
1573
+
1574
+
1575
+ // ----------------------------------------------------------------------------
1576
+ // Win32 mutex support.
1577
+ //
1578
+ // On Win32 mutexes are implemented using CRITICAL_SECTION objects. These are
1579
+ // faster than Win32 Mutex objects because they are implemented using user mode
1580
+ // atomic instructions. Therefore we only do ring transitions if there is lock
1581
+ // contention.
1582
+
1583
+ class Win32Mutex : public Mutex {
1584
+ public:
1585
+
1586
+ Win32Mutex() { InitializeCriticalSection(&cs_); }
1587
+
1588
+ virtual ~Win32Mutex() { DeleteCriticalSection(&cs_); }
1589
+
1590
+ virtual int Lock() {
1591
+ EnterCriticalSection(&cs_);
1592
+ return 0;
1593
+ }
1594
+
1595
+ virtual int Unlock() {
1596
+ LeaveCriticalSection(&cs_);
1597
+ return 0;
1598
+ }
1599
+
1600
+
1601
+ virtual bool TryLock() {
1602
+ // Returns non-zero if critical section is entered successfully entered.
1603
+ return TryEnterCriticalSection(&cs_);
1604
+ }
1605
+
1606
+ private:
1607
+ CRITICAL_SECTION cs_; // Critical section used for mutex
1608
+ };
1609
+
1610
+
1611
+ Mutex* OS::CreateMutex() {
1612
+ return new Win32Mutex();
1613
+ }
1614
+
1615
+
1616
+ // ----------------------------------------------------------------------------
1617
+ // Win32 semaphore support.
1618
+ //
1619
+ // On Win32 semaphores are implemented using Win32 Semaphore objects. The
1620
+ // semaphores are anonymous. Also, the semaphores are initialized to have
1621
+ // no upper limit on count.
1622
+
1623
+
1624
+ class Win32Semaphore : public Semaphore {
1625
+ public:
1626
+ explicit Win32Semaphore(int count) {
1627
+ sem = ::CreateSemaphoreA(NULL, count, 0x7fffffff, NULL);
1628
+ }
1629
+
1630
+ ~Win32Semaphore() {
1631
+ CloseHandle(sem);
1632
+ }
1633
+
1634
+ void Wait() {
1635
+ WaitForSingleObject(sem, INFINITE);
1636
+ }
1637
+
1638
+ bool Wait(int timeout) {
1639
+ // Timeout in Windows API is in milliseconds.
1640
+ DWORD millis_timeout = timeout / 1000;
1641
+ return WaitForSingleObject(sem, millis_timeout) != WAIT_TIMEOUT;
1642
+ }
1643
+
1644
+ void Signal() {
1645
+ LONG dummy;
1646
+ ReleaseSemaphore(sem, 1, &dummy);
1647
+ }
1648
+
1649
+ private:
1650
+ HANDLE sem;
1651
+ };
1652
+
1653
+
1654
+ Semaphore* OS::CreateSemaphore(int count) {
1655
+ return new Win32Semaphore(count);
1656
+ }
1657
+
1658
+
1659
+ // ----------------------------------------------------------------------------
1660
+ // Win32 socket support.
1661
+ //
1662
+
1663
+ class Win32Socket : public Socket {
1664
+ public:
1665
+ explicit Win32Socket() {
1666
+ // Create the socket.
1667
+ socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
1668
+ }
1669
+ explicit Win32Socket(SOCKET socket): socket_(socket) { }
1670
+ virtual ~Win32Socket() { Shutdown(); }
1671
+
1672
+ // Server initialization.
1673
+ bool Bind(const int port);
1674
+ bool Listen(int backlog) const;
1675
+ Socket* Accept() const;
1676
+
1677
+ // Client initialization.
1678
+ bool Connect(const char* host, const char* port);
1679
+
1680
+ // Shutdown socket for both read and write.
1681
+ bool Shutdown();
1682
+
1683
+ // Data Transimission
1684
+ int Send(const char* data, int len) const;
1685
+ int Receive(char* data, int len) const;
1686
+
1687
+ bool SetReuseAddress(bool reuse_address);
1688
+
1689
+ bool IsValid() const { return socket_ != INVALID_SOCKET; }
1690
+
1691
+ private:
1692
+ SOCKET socket_;
1693
+ };
1694
+
1695
+
1696
+ bool Win32Socket::Bind(const int port) {
1697
+ if (!IsValid()) {
1698
+ return false;
1699
+ }
1700
+
1701
+ sockaddr_in addr;
1702
+ memset(&addr, 0, sizeof(addr));
1703
+ addr.sin_family = AF_INET;
1704
+ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
1705
+ addr.sin_port = htons(port);
1706
+ int status = bind(socket_,
1707
+ reinterpret_cast<struct sockaddr *>(&addr),
1708
+ sizeof(addr));
1709
+ return status == 0;
1710
+ }
1711
+
1712
+
1713
+ bool Win32Socket::Listen(int backlog) const {
1714
+ if (!IsValid()) {
1715
+ return false;
1716
+ }
1717
+
1718
+ int status = listen(socket_, backlog);
1719
+ return status == 0;
1720
+ }
1721
+
1722
+
1723
+ Socket* Win32Socket::Accept() const {
1724
+ if (!IsValid()) {
1725
+ return NULL;
1726
+ }
1727
+
1728
+ SOCKET socket = accept(socket_, NULL, NULL);
1729
+ if (socket == INVALID_SOCKET) {
1730
+ return NULL;
1731
+ } else {
1732
+ return new Win32Socket(socket);
1733
+ }
1734
+ }
1735
+
1736
+
1737
+ bool Win32Socket::Connect(const char* host, const char* port) {
1738
+ if (!IsValid()) {
1739
+ return false;
1740
+ }
1741
+
1742
+ // Lookup host and port.
1743
+ struct addrinfo *result = NULL;
1744
+ struct addrinfo hints;
1745
+ memset(&hints, 0, sizeof(addrinfo));
1746
+ hints.ai_family = AF_INET;
1747
+ hints.ai_socktype = SOCK_STREAM;
1748
+ hints.ai_protocol = IPPROTO_TCP;
1749
+ int status = getaddrinfo(host, port, &hints, &result);
1750
+ if (status != 0) {
1751
+ return false;
1752
+ }
1753
+
1754
+ // Connect.
1755
+ status = connect(socket_,
1756
+ result->ai_addr,
1757
+ static_cast<int>(result->ai_addrlen));
1758
+ freeaddrinfo(result);
1759
+ return status == 0;
1760
+ }
1761
+
1762
+
1763
+ bool Win32Socket::Shutdown() {
1764
+ if (IsValid()) {
1765
+ // Shutdown socket for both read and write.
1766
+ int status = shutdown(socket_, SD_BOTH);
1767
+ closesocket(socket_);
1768
+ socket_ = INVALID_SOCKET;
1769
+ return status == SOCKET_ERROR;
1770
+ }
1771
+ return true;
1772
+ }
1773
+
1774
+
1775
+ int Win32Socket::Send(const char* data, int len) const {
1776
+ int status = send(socket_, data, len, 0);
1777
+ return status;
1778
+ }
1779
+
1780
+
1781
+ int Win32Socket::Receive(char* data, int len) const {
1782
+ int status = recv(socket_, data, len, 0);
1783
+ return status;
1784
+ }
1785
+
1786
+
1787
+ bool Win32Socket::SetReuseAddress(bool reuse_address) {
1788
+ BOOL on = reuse_address ? true : false;
1789
+ int status = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR,
1790
+ reinterpret_cast<char*>(&on), sizeof(on));
1791
+ return status == SOCKET_ERROR;
1792
+ }
1793
+
1794
+
1795
+ bool Socket::Setup() {
1796
+ // Initialize Winsock32
1797
+ int err;
1798
+ WSADATA winsock_data;
1799
+ WORD version_requested = MAKEWORD(1, 0);
1800
+ err = WSAStartup(version_requested, &winsock_data);
1801
+ if (err != 0) {
1802
+ PrintF("Unable to initialize Winsock, err = %d\n", Socket::LastError());
1803
+ }
1804
+
1805
+ return err == 0;
1806
+ }
1807
+
1808
+
1809
+ int Socket::LastError() {
1810
+ return WSAGetLastError();
1811
+ }
1812
+
1813
+
1814
+ uint16_t Socket::HToN(uint16_t value) {
1815
+ return htons(value);
1816
+ }
1817
+
1818
+
1819
+ uint16_t Socket::NToH(uint16_t value) {
1820
+ return ntohs(value);
1821
+ }
1822
+
1823
+
1824
+ uint32_t Socket::HToN(uint32_t value) {
1825
+ return htonl(value);
1826
+ }
1827
+
1828
+
1829
+ uint32_t Socket::NToH(uint32_t value) {
1830
+ return ntohl(value);
1831
+ }
1832
+
1833
+
1834
+ Socket* OS::CreateSocket() {
1835
+ return new Win32Socket();
1836
+ }
1837
+
1838
+
1839
+ #ifdef ENABLE_LOGGING_AND_PROFILING
1840
+
1841
+ // ----------------------------------------------------------------------------
1842
+ // Win32 profiler support.
1843
+ //
1844
+ // On win32 we use a sampler thread with high priority to sample the program
1845
+ // counter for the profiled thread.
1846
+
1847
+ class Sampler::PlatformData : public Malloced {
1848
+ public:
1849
+ explicit PlatformData(Sampler* sampler) {
1850
+ sampler_ = sampler;
1851
+ sampler_thread_ = INVALID_HANDLE_VALUE;
1852
+ profiled_thread_ = INVALID_HANDLE_VALUE;
1853
+ }
1854
+
1855
+ Sampler* sampler_;
1856
+ HANDLE sampler_thread_;
1857
+ HANDLE profiled_thread_;
1858
+ RuntimeProfilerRateLimiter rate_limiter_;
1859
+
1860
+ // Sampler thread handler.
1861
+ void Runner() {
1862
+ while (sampler_->IsActive()) {
1863
+ if (rate_limiter_.SuspendIfNecessary()) continue;
1864
+ Sample();
1865
+ Sleep(sampler_->interval_);
1866
+ }
1867
+ }
1868
+
1869
+ void Sample() {
1870
+ if (sampler_->IsProfiling()) {
1871
+ // Context used for sampling the register state of the profiled thread.
1872
+ CONTEXT context;
1873
+ memset(&context, 0, sizeof(context));
1874
+
1875
+ TickSample sample_obj;
1876
+ TickSample* sample = CpuProfiler::TickSampleEvent();
1877
+ if (sample == NULL) sample = &sample_obj;
1878
+
1879
+ static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
1880
+ if (SuspendThread(profiled_thread_) == kSuspendFailed) return;
1881
+ sample->state = Top::current_vm_state();
1882
+
1883
+ context.ContextFlags = CONTEXT_FULL;
1884
+ if (GetThreadContext(profiled_thread_, &context) != 0) {
1885
+ #if V8_HOST_ARCH_X64
1886
+ sample->pc = reinterpret_cast<Address>(context.Rip);
1887
+ sample->sp = reinterpret_cast<Address>(context.Rsp);
1888
+ sample->fp = reinterpret_cast<Address>(context.Rbp);
1889
+ #else
1890
+ sample->pc = reinterpret_cast<Address>(context.Eip);
1891
+ sample->sp = reinterpret_cast<Address>(context.Esp);
1892
+ sample->fp = reinterpret_cast<Address>(context.Ebp);
1893
+ #endif
1894
+ sampler_->SampleStack(sample);
1895
+ sampler_->Tick(sample);
1896
+ }
1897
+ ResumeThread(profiled_thread_);
1898
+ }
1899
+ if (RuntimeProfiler::IsEnabled()) RuntimeProfiler::NotifyTick();
1900
+ }
1901
+ };
1902
+
1903
+
1904
+ // Entry point for sampler thread.
1905
+ static unsigned int __stdcall SamplerEntry(void* arg) {
1906
+ Sampler::PlatformData* data =
1907
+ reinterpret_cast<Sampler::PlatformData*>(arg);
1908
+ data->Runner();
1909
+ return 0;
1910
+ }
1911
+
1912
+
1913
+ // Initialize a profile sampler.
1914
+ Sampler::Sampler(int interval)
1915
+ : interval_(interval),
1916
+ profiling_(false),
1917
+ active_(false),
1918
+ samples_taken_(0) {
1919
+ data_ = new PlatformData(this);
1920
+ }
1921
+
1922
+
1923
+ Sampler::~Sampler() {
1924
+ delete data_;
1925
+ }
1926
+
1927
+
1928
+ // Start profiling.
1929
+ void Sampler::Start() {
1930
+ // Do not start multiple threads for the same sampler.
1931
+ ASSERT(!IsActive());
1932
+
1933
+ // Get a handle to the calling thread. This is the thread that we are
1934
+ // going to profile. We need to make a copy of the handle because we are
1935
+ // going to use it in the sampler thread. Using GetThreadHandle() will
1936
+ // not work in this case. We're using OpenThread because DuplicateHandle
1937
+ // for some reason doesn't work in Chrome's sandbox.
1938
+ data_->profiled_thread_ = OpenThread(THREAD_GET_CONTEXT |
1939
+ THREAD_SUSPEND_RESUME |
1940
+ THREAD_QUERY_INFORMATION,
1941
+ false,
1942
+ GetCurrentThreadId());
1943
+ BOOL ok = data_->profiled_thread_ != NULL;
1944
+ if (!ok) return;
1945
+
1946
+ // Start sampler thread.
1947
+ unsigned int tid;
1948
+ SetActive(true);
1949
+ data_->sampler_thread_ = reinterpret_cast<HANDLE>(
1950
+ _beginthreadex(NULL, 0, SamplerEntry, data_, 0, &tid));
1951
+ // Set thread to high priority to increase sampling accuracy.
1952
+ SetThreadPriority(data_->sampler_thread_, THREAD_PRIORITY_TIME_CRITICAL);
1953
+ }
1954
+
1955
+
1956
+ // Stop profiling.
1957
+ void Sampler::Stop() {
1958
+ // Seting active to false triggers termination of the sampler
1959
+ // thread.
1960
+ SetActive(false);
1961
+
1962
+ // Wait for sampler thread to terminate.
1963
+ Top::WakeUpRuntimeProfilerThreadBeforeShutdown();
1964
+ WaitForSingleObject(data_->sampler_thread_, INFINITE);
1965
+
1966
+ // Release the thread handles
1967
+ CloseHandle(data_->sampler_thread_);
1968
+ CloseHandle(data_->profiled_thread_);
1969
+ }
1970
+
1971
+
1972
+ #endif // ENABLE_LOGGING_AND_PROFILING
1973
+
1974
+ } } // namespace v8::internal