therubyracer 0.9.0beta2 → 0.9.0beta3

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 (920) hide show
  1. data/.gitmodules +3 -0
  2. data/ext/v8/upstream/Makefile +1 -2
  3. data/ext/v8/upstream/v8/.gitignore +33 -0
  4. data/ext/v8/upstream/v8/AUTHORS +42 -0
  5. data/ext/v8/upstream/v8/ChangeLog +2663 -0
  6. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE +0 -0
  7. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.strongtalk +0 -0
  8. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.v8 +0 -0
  9. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.valgrind +0 -0
  10. data/ext/v8/upstream/v8/SConstruct +1473 -0
  11. data/ext/v8/upstream/{3.1.8 → v8}/build/README.txt +0 -0
  12. data/ext/v8/upstream/{3.1.8 → v8}/build/all.gyp +0 -0
  13. data/ext/v8/upstream/{3.1.8 → v8}/build/armu.gypi +0 -0
  14. data/ext/v8/upstream/{3.1.8 → v8}/build/common.gypi +0 -0
  15. data/ext/v8/upstream/{3.1.8 → v8}/build/gyp_v8 +0 -0
  16. data/ext/v8/upstream/v8/include/v8-debug.h +394 -0
  17. data/ext/v8/upstream/v8/include/v8-preparser.h +116 -0
  18. data/ext/v8/upstream/v8/include/v8-profiler.h +505 -0
  19. data/ext/v8/upstream/v8/include/v8-testing.h +104 -0
  20. data/ext/v8/upstream/v8/include/v8.h +4000 -0
  21. data/ext/v8/upstream/{3.1.8 → v8}/include/v8stdint.h +0 -0
  22. data/ext/v8/upstream/v8/preparser/SConscript +38 -0
  23. data/ext/v8/upstream/v8/preparser/preparser-process.cc +169 -0
  24. data/ext/v8/upstream/v8/src/SConscript +380 -0
  25. data/ext/v8/upstream/v8/src/accessors.cc +766 -0
  26. data/ext/v8/upstream/{3.1.8 → v8}/src/accessors.h +0 -0
  27. data/ext/v8/upstream/v8/src/allocation-inl.h +49 -0
  28. data/ext/v8/upstream/v8/src/allocation.cc +122 -0
  29. data/ext/v8/upstream/v8/src/allocation.h +143 -0
  30. data/ext/v8/upstream/v8/src/api.cc +5678 -0
  31. data/ext/v8/upstream/v8/src/api.h +572 -0
  32. data/ext/v8/upstream/{3.1.8 → v8}/src/apinatives.js +0 -0
  33. data/ext/v8/upstream/v8/src/apiutils.h +73 -0
  34. data/ext/v8/upstream/v8/src/arguments.h +116 -0
  35. data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +353 -0
  36. data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +2877 -0
  37. data/ext/v8/upstream/v8/src/arm/assembler-arm.h +1382 -0
  38. data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +1634 -0
  39. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +6917 -0
  40. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +623 -0
  41. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/codegen-arm-inl.h +0 -0
  42. data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +7437 -0
  43. data/ext/v8/upstream/v8/src/arm/codegen-arm.h +595 -0
  44. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/constants-arm.cc +0 -0
  45. data/ext/v8/upstream/v8/src/arm/constants-arm.h +778 -0
  46. data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +149 -0
  47. data/ext/v8/upstream/v8/src/arm/debug-arm.cc +317 -0
  48. data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +737 -0
  49. data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +1503 -0
  50. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/frames-arm.cc +0 -0
  51. data/ext/v8/upstream/v8/src/arm/frames-arm.h +168 -0
  52. data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +4374 -0
  53. data/ext/v8/upstream/v8/src/arm/ic-arm.cc +1793 -0
  54. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/jump-target-arm.cc +0 -0
  55. data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +2120 -0
  56. data/ext/v8/upstream/v8/src/arm/lithium-arm.h +2179 -0
  57. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +4132 -0
  58. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +329 -0
  59. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  60. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/lithium-gap-resolver-arm.h +0 -0
  61. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +2939 -0
  62. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +1071 -0
  63. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  64. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  65. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm-inl.h +0 -0
  66. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm.cc +0 -0
  67. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm.h +0 -0
  68. data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +3288 -0
  69. data/ext/v8/upstream/v8/src/arm/simulator-arm.h +413 -0
  70. data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +4034 -0
  71. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/virtual-frame-arm-inl.h +0 -0
  72. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +843 -0
  73. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +523 -0
  74. data/ext/v8/upstream/v8/src/array.js +1249 -0
  75. data/ext/v8/upstream/v8/src/assembler.cc +1067 -0
  76. data/ext/v8/upstream/v8/src/assembler.h +823 -0
  77. data/ext/v8/upstream/v8/src/ast-inl.h +112 -0
  78. data/ext/v8/upstream/v8/src/ast.cc +1078 -0
  79. data/ext/v8/upstream/v8/src/ast.h +2234 -0
  80. data/ext/v8/upstream/v8/src/atomicops.h +167 -0
  81. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_arm_gcc.h +0 -0
  82. data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +169 -0
  83. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_gcc.cc +0 -0
  84. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_gcc.h +0 -0
  85. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_macosx.h +0 -0
  86. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_msvc.h +0 -0
  87. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum-dtoa.cc +0 -0
  88. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum-dtoa.h +0 -0
  89. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum.cc +0 -0
  90. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum.h +0 -0
  91. data/ext/v8/upstream/v8/src/bootstrapper.cc +2138 -0
  92. data/ext/v8/upstream/v8/src/bootstrapper.h +185 -0
  93. data/ext/v8/upstream/v8/src/builtins.cc +1708 -0
  94. data/ext/v8/upstream/v8/src/builtins.h +368 -0
  95. data/ext/v8/upstream/{3.1.8 → v8}/src/bytecodes-irregexp.h +0 -0
  96. data/ext/v8/upstream/{3.1.8 → v8}/src/cached-powers.cc +0 -0
  97. data/ext/v8/upstream/{3.1.8 → v8}/src/cached-powers.h +0 -0
  98. data/ext/v8/upstream/{3.1.8 → v8}/src/char-predicates-inl.h +0 -0
  99. data/ext/v8/upstream/{3.1.8 → v8}/src/char-predicates.h +0 -0
  100. data/ext/v8/upstream/v8/src/checks.cc +110 -0
  101. data/ext/v8/upstream/v8/src/checks.h +296 -0
  102. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue-inl.h +0 -0
  103. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue.cc +0 -0
  104. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue.h +0 -0
  105. data/ext/v8/upstream/v8/src/code-stubs.cc +240 -0
  106. data/ext/v8/upstream/v8/src/code-stubs.h +971 -0
  107. data/ext/v8/upstream/{3.1.8 → v8}/src/code.h +0 -0
  108. data/ext/v8/upstream/v8/src/codegen-inl.h +68 -0
  109. data/ext/v8/upstream/v8/src/codegen.cc +505 -0
  110. data/ext/v8/upstream/v8/src/codegen.h +245 -0
  111. data/ext/v8/upstream/v8/src/compilation-cache.cc +540 -0
  112. data/ext/v8/upstream/v8/src/compilation-cache.h +287 -0
  113. data/ext/v8/upstream/v8/src/compiler.cc +792 -0
  114. data/ext/v8/upstream/v8/src/compiler.h +307 -0
  115. data/ext/v8/upstream/v8/src/contexts.cc +327 -0
  116. data/ext/v8/upstream/v8/src/contexts.h +382 -0
  117. data/ext/v8/upstream/{3.1.8 → v8}/src/conversions-inl.h +0 -0
  118. data/ext/v8/upstream/v8/src/conversions.cc +1125 -0
  119. data/ext/v8/upstream/{3.1.8 → v8}/src/conversions.h +0 -0
  120. data/ext/v8/upstream/v8/src/counters.cc +93 -0
  121. data/ext/v8/upstream/v8/src/counters.h +254 -0
  122. data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +101 -0
  123. data/ext/v8/upstream/v8/src/cpu-profiler.cc +606 -0
  124. data/ext/v8/upstream/v8/src/cpu-profiler.h +305 -0
  125. data/ext/v8/upstream/v8/src/cpu.h +67 -0
  126. data/ext/v8/upstream/v8/src/d8-debug.cc +367 -0
  127. data/ext/v8/upstream/v8/src/d8-debug.h +158 -0
  128. data/ext/v8/upstream/v8/src/d8-posix.cc +695 -0
  129. data/ext/v8/upstream/{3.1.8 → v8}/src/d8-readline.cc +0 -0
  130. data/ext/v8/upstream/{3.1.8 → v8}/src/d8-windows.cc +0 -0
  131. data/ext/v8/upstream/v8/src/d8.cc +796 -0
  132. data/ext/v8/upstream/v8/src/d8.gyp +88 -0
  133. data/ext/v8/upstream/{3.1.8 → v8}/src/d8.h +0 -0
  134. data/ext/v8/upstream/{3.1.8 → v8}/src/d8.js +0 -0
  135. data/ext/v8/upstream/{3.1.8 → v8}/src/data-flow.cc +0 -0
  136. data/ext/v8/upstream/v8/src/data-flow.h +379 -0
  137. data/ext/v8/upstream/{3.1.8 → v8}/src/date.js +0 -0
  138. data/ext/v8/upstream/{3.1.8 → v8}/src/dateparser-inl.h +0 -0
  139. data/ext/v8/upstream/{3.1.8 → v8}/src/dateparser.cc +0 -0
  140. data/ext/v8/upstream/v8/src/dateparser.h +265 -0
  141. data/ext/v8/upstream/v8/src/debug-agent.cc +447 -0
  142. data/ext/v8/upstream/v8/src/debug-agent.h +129 -0
  143. data/ext/v8/upstream/{3.1.8 → v8}/src/debug-debugger.js +0 -0
  144. data/ext/v8/upstream/v8/src/debug.cc +3188 -0
  145. data/ext/v8/upstream/v8/src/debug.h +1055 -0
  146. data/ext/v8/upstream/v8/src/deoptimizer.cc +1296 -0
  147. data/ext/v8/upstream/v8/src/deoptimizer.h +629 -0
  148. data/ext/v8/upstream/v8/src/disasm.h +80 -0
  149. data/ext/v8/upstream/v8/src/disassembler.cc +339 -0
  150. data/ext/v8/upstream/{3.1.8 → v8}/src/disassembler.h +0 -0
  151. data/ext/v8/upstream/{3.1.8 → v8}/src/diy-fp.cc +0 -0
  152. data/ext/v8/upstream/{3.1.8 → v8}/src/diy-fp.h +0 -0
  153. data/ext/v8/upstream/{3.1.8 → v8}/src/double.h +0 -0
  154. data/ext/v8/upstream/{3.1.8 → v8}/src/dtoa.cc +0 -0
  155. data/ext/v8/upstream/{3.1.8 → v8}/src/dtoa.h +0 -0
  156. data/ext/v8/upstream/v8/src/execution.cc +791 -0
  157. data/ext/v8/upstream/v8/src/execution.h +291 -0
  158. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +250 -0
  159. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +89 -0
  160. data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +55 -0
  161. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +284 -0
  162. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/experimental/i18n-extension.h +0 -0
  163. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +141 -0
  164. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/externalize-string-extension.h +0 -0
  165. data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +58 -0
  166. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/gc-extension.h +0 -0
  167. data/ext/v8/upstream/v8/src/factory.cc +1194 -0
  168. data/ext/v8/upstream/v8/src/factory.h +436 -0
  169. data/ext/v8/upstream/{3.1.8 → v8}/src/fast-dtoa.cc +0 -0
  170. data/ext/v8/upstream/{3.1.8 → v8}/src/fast-dtoa.h +0 -0
  171. data/ext/v8/upstream/{3.1.8 → v8}/src/fixed-dtoa.cc +0 -0
  172. data/ext/v8/upstream/{3.1.8 → v8}/src/fixed-dtoa.h +0 -0
  173. data/ext/v8/upstream/v8/src/flag-definitions.h +556 -0
  174. data/ext/v8/upstream/{3.1.8 → v8}/src/flags.cc +0 -0
  175. data/ext/v8/upstream/{3.1.8 → v8}/src/flags.h +0 -0
  176. data/ext/v8/upstream/v8/src/frame-element.cc +37 -0
  177. data/ext/v8/upstream/v8/src/frame-element.h +269 -0
  178. data/ext/v8/upstream/v8/src/frames-inl.h +236 -0
  179. data/ext/v8/upstream/v8/src/frames.cc +1273 -0
  180. data/ext/v8/upstream/v8/src/frames.h +854 -0
  181. data/ext/v8/upstream/v8/src/full-codegen.cc +1385 -0
  182. data/ext/v8/upstream/v8/src/full-codegen.h +753 -0
  183. data/ext/v8/upstream/v8/src/func-name-inferrer.cc +91 -0
  184. data/ext/v8/upstream/v8/src/func-name-inferrer.h +111 -0
  185. data/ext/v8/upstream/v8/src/gdb-jit.cc +1548 -0
  186. data/ext/v8/upstream/{3.1.8 → v8}/src/gdb-jit.h +0 -0
  187. data/ext/v8/upstream/v8/src/global-handles.cc +596 -0
  188. data/ext/v8/upstream/v8/src/global-handles.h +239 -0
  189. data/ext/v8/upstream/v8/src/globals.h +325 -0
  190. data/ext/v8/upstream/v8/src/handles-inl.h +177 -0
  191. data/ext/v8/upstream/v8/src/handles.cc +965 -0
  192. data/ext/v8/upstream/v8/src/handles.h +372 -0
  193. data/ext/v8/upstream/{3.1.8 → v8}/src/hashmap.cc +0 -0
  194. data/ext/v8/upstream/v8/src/hashmap.h +121 -0
  195. data/ext/v8/upstream/v8/src/heap-inl.h +703 -0
  196. data/ext/v8/upstream/v8/src/heap-profiler.cc +1173 -0
  197. data/ext/v8/upstream/v8/src/heap-profiler.h +396 -0
  198. data/ext/v8/upstream/v8/src/heap.cc +5856 -0
  199. data/ext/v8/upstream/v8/src/heap.h +2264 -0
  200. data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +1639 -0
  201. data/ext/v8/upstream/v8/src/hydrogen-instructions.h +3657 -0
  202. data/ext/v8/upstream/v8/src/hydrogen.cc +6011 -0
  203. data/ext/v8/upstream/v8/src/hydrogen.h +1137 -0
  204. data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +430 -0
  205. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +2846 -0
  206. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +1159 -0
  207. data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +1596 -0
  208. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +6549 -0
  209. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +495 -0
  210. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/codegen-ia32-inl.h +0 -0
  211. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +10385 -0
  212. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +801 -0
  213. data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +88 -0
  214. data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +312 -0
  215. data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  216. data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +1620 -0
  217. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/frames-ia32.cc +0 -0
  218. data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +140 -0
  219. data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +4357 -0
  220. data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +1779 -0
  221. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/jump-target-ia32.cc +0 -0
  222. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +4158 -0
  223. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +318 -0
  224. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +466 -0
  225. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/lithium-gap-resolver-ia32.h +0 -0
  226. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +2181 -0
  227. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +2235 -0
  228. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +2056 -0
  229. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +807 -0
  230. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +1264 -0
  231. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  232. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/register-allocator-ia32-inl.h +0 -0
  233. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +157 -0
  234. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/register-allocator-ia32.h +0 -0
  235. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/simulator-ia32.cc +0 -0
  236. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +72 -0
  237. data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +3711 -0
  238. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +1366 -0
  239. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +650 -0
  240. data/ext/v8/upstream/v8/src/ic-inl.h +130 -0
  241. data/ext/v8/upstream/v8/src/ic.cc +2389 -0
  242. data/ext/v8/upstream/v8/src/ic.h +675 -0
  243. data/ext/v8/upstream/{3.1.8 → v8}/src/inspector.cc +0 -0
  244. data/ext/v8/upstream/{3.1.8 → v8}/src/inspector.h +0 -0
  245. data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +659 -0
  246. data/ext/v8/upstream/v8/src/interpreter-irregexp.h +49 -0
  247. data/ext/v8/upstream/v8/src/isolate.cc +883 -0
  248. data/ext/v8/upstream/v8/src/isolate.h +1306 -0
  249. data/ext/v8/upstream/v8/src/json.js +342 -0
  250. data/ext/v8/upstream/v8/src/jsregexp.cc +5371 -0
  251. data/ext/v8/upstream/v8/src/jsregexp.h +1483 -0
  252. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-heavy-inl.h +0 -0
  253. data/ext/v8/upstream/v8/src/jump-target-heavy.cc +427 -0
  254. data/ext/v8/upstream/v8/src/jump-target-heavy.h +238 -0
  255. data/ext/v8/upstream/v8/src/jump-target-inl.h +48 -0
  256. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-light-inl.h +0 -0
  257. data/ext/v8/upstream/v8/src/jump-target-light.cc +111 -0
  258. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-light.h +0 -0
  259. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target.cc +0 -0
  260. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target.h +0 -0
  261. data/ext/v8/upstream/{3.1.8 → v8}/src/list-inl.h +0 -0
  262. data/ext/v8/upstream/{3.1.8 → v8}/src/list.h +0 -0
  263. data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +142 -0
  264. data/ext/v8/upstream/v8/src/lithium-allocator.cc +2105 -0
  265. data/ext/v8/upstream/v8/src/lithium-allocator.h +630 -0
  266. data/ext/v8/upstream/v8/src/lithium.cc +169 -0
  267. data/ext/v8/upstream/{3.1.8 → v8}/src/lithium.h +0 -0
  268. data/ext/v8/upstream/{3.1.8 → v8}/src/liveedit-debugger.js +0 -0
  269. data/ext/v8/upstream/v8/src/liveedit.cc +1693 -0
  270. data/ext/v8/upstream/v8/src/liveedit.h +179 -0
  271. data/ext/v8/upstream/{3.1.8 → v8}/src/liveobjectlist-inl.h +0 -0
  272. data/ext/v8/upstream/v8/src/liveobjectlist.cc +2589 -0
  273. data/ext/v8/upstream/v8/src/liveobjectlist.h +322 -0
  274. data/ext/v8/upstream/{3.1.8 → v8}/src/log-inl.h +0 -0
  275. data/ext/v8/upstream/v8/src/log-utils.cc +423 -0
  276. data/ext/v8/upstream/v8/src/log-utils.h +229 -0
  277. data/ext/v8/upstream/v8/src/log.cc +1666 -0
  278. data/ext/v8/upstream/v8/src/log.h +446 -0
  279. data/ext/v8/upstream/{3.1.8 → v8}/src/macro-assembler.h +0 -0
  280. data/ext/v8/upstream/{3.1.8 → v8}/src/macros.py +0 -0
  281. data/ext/v8/upstream/v8/src/mark-compact.cc +3092 -0
  282. data/ext/v8/upstream/v8/src/mark-compact.h +506 -0
  283. data/ext/v8/upstream/{3.1.8 → v8}/src/math.js +0 -0
  284. data/ext/v8/upstream/v8/src/messages.cc +166 -0
  285. data/ext/v8/upstream/{3.1.8 → v8}/src/messages.h +0 -0
  286. data/ext/v8/upstream/v8/src/messages.js +1090 -0
  287. data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +335 -0
  288. data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +2093 -0
  289. data/ext/v8/upstream/v8/src/mips/assembler-mips.h +1066 -0
  290. data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +148 -0
  291. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +752 -0
  292. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +511 -0
  293. data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +64 -0
  294. data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +1213 -0
  295. data/ext/v8/upstream/v8/src/mips/codegen-mips.h +633 -0
  296. data/ext/v8/upstream/v8/src/mips/constants-mips.cc +352 -0
  297. data/ext/v8/upstream/v8/src/mips/constants-mips.h +723 -0
  298. data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +90 -0
  299. data/ext/v8/upstream/v8/src/mips/debug-mips.cc +155 -0
  300. data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +91 -0
  301. data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +1023 -0
  302. data/ext/v8/upstream/v8/src/mips/frames-mips.cc +48 -0
  303. data/ext/v8/upstream/v8/src/mips/frames-mips.h +179 -0
  304. data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +727 -0
  305. data/ext/v8/upstream/v8/src/mips/ic-mips.cc +244 -0
  306. data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +80 -0
  307. data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +65 -0
  308. data/ext/v8/upstream/v8/src/mips/lithium-mips.h +304 -0
  309. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +3327 -0
  310. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +1058 -0
  311. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +478 -0
  312. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +250 -0
  313. data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +134 -0
  314. data/ext/v8/upstream/{3.1.8 → v8}/src/mips/register-allocator-mips.cc +0 -0
  315. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +47 -0
  316. data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +2438 -0
  317. data/ext/v8/upstream/v8/src/mips/simulator-mips.h +394 -0
  318. data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +601 -0
  319. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +58 -0
  320. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +307 -0
  321. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +530 -0
  322. data/ext/v8/upstream/v8/src/mirror-debugger.js +2381 -0
  323. data/ext/v8/upstream/v8/src/mksnapshot.cc +256 -0
  324. data/ext/v8/upstream/{3.1.8 → v8}/src/natives.h +0 -0
  325. data/ext/v8/upstream/v8/src/objects-debug.cc +722 -0
  326. data/ext/v8/upstream/v8/src/objects-inl.h +4166 -0
  327. data/ext/v8/upstream/v8/src/objects-printer.cc +801 -0
  328. data/ext/v8/upstream/v8/src/objects-visiting.cc +142 -0
  329. data/ext/v8/upstream/v8/src/objects-visiting.h +422 -0
  330. data/ext/v8/upstream/v8/src/objects.cc +10296 -0
  331. data/ext/v8/upstream/v8/src/objects.h +6662 -0
  332. data/ext/v8/upstream/v8/src/parser.cc +5168 -0
  333. data/ext/v8/upstream/v8/src/parser.h +823 -0
  334. data/ext/v8/upstream/v8/src/platform-cygwin.cc +811 -0
  335. data/ext/v8/upstream/v8/src/platform-freebsd.cc +854 -0
  336. data/ext/v8/upstream/v8/src/platform-linux.cc +1120 -0
  337. data/ext/v8/upstream/v8/src/platform-macos.cc +865 -0
  338. data/ext/v8/upstream/v8/src/platform-nullos.cc +504 -0
  339. data/ext/v8/upstream/v8/src/platform-openbsd.cc +672 -0
  340. data/ext/v8/upstream/v8/src/platform-posix.cc +424 -0
  341. data/ext/v8/upstream/v8/src/platform-solaris.cc +796 -0
  342. data/ext/v8/upstream/v8/src/platform-tls-mac.h +62 -0
  343. data/ext/v8/upstream/v8/src/platform-tls-win32.h +62 -0
  344. data/ext/v8/upstream/v8/src/platform-tls.h +50 -0
  345. data/ext/v8/upstream/v8/src/platform-win32.cc +2072 -0
  346. data/ext/v8/upstream/v8/src/platform.h +693 -0
  347. data/ext/v8/upstream/v8/src/preparse-data.cc +185 -0
  348. data/ext/v8/upstream/{3.1.8 → v8}/src/preparse-data.h +0 -0
  349. data/ext/v8/upstream/v8/src/preparser-api.cc +219 -0
  350. data/ext/v8/upstream/v8/src/preparser.cc +1205 -0
  351. data/ext/v8/upstream/{3.1.8 → v8}/src/preparser.h +0 -0
  352. data/ext/v8/upstream/v8/src/prettyprinter.cc +1530 -0
  353. data/ext/v8/upstream/v8/src/prettyprinter.h +223 -0
  354. data/ext/v8/upstream/{3.1.8 → v8}/src/profile-generator-inl.h +0 -0
  355. data/ext/v8/upstream/v8/src/profile-generator.cc +3095 -0
  356. data/ext/v8/upstream/v8/src/profile-generator.h +1125 -0
  357. data/ext/v8/upstream/v8/src/property.cc +102 -0
  358. data/ext/v8/upstream/v8/src/property.h +348 -0
  359. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  360. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +470 -0
  361. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-irregexp.h +0 -0
  362. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-tracer.cc +0 -0
  363. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-tracer.h +0 -0
  364. data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +266 -0
  365. data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +236 -0
  366. data/ext/v8/upstream/v8/src/regexp-stack.cc +111 -0
  367. data/ext/v8/upstream/v8/src/regexp-stack.h +147 -0
  368. data/ext/v8/upstream/v8/src/regexp.js +483 -0
  369. data/ext/v8/upstream/v8/src/register-allocator-inl.h +141 -0
  370. data/ext/v8/upstream/v8/src/register-allocator.cc +98 -0
  371. data/ext/v8/upstream/v8/src/register-allocator.h +310 -0
  372. data/ext/v8/upstream/v8/src/rewriter.cc +1024 -0
  373. data/ext/v8/upstream/{3.1.8 → v8}/src/rewriter.h +0 -0
  374. data/ext/v8/upstream/v8/src/runtime-profiler.cc +478 -0
  375. data/ext/v8/upstream/v8/src/runtime-profiler.h +192 -0
  376. data/ext/v8/upstream/v8/src/runtime.cc +11949 -0
  377. data/ext/v8/upstream/v8/src/runtime.h +643 -0
  378. data/ext/v8/upstream/{3.1.8 → v8}/src/runtime.js +0 -0
  379. data/ext/v8/upstream/v8/src/safepoint-table.cc +256 -0
  380. data/ext/v8/upstream/v8/src/safepoint-table.h +269 -0
  381. data/ext/v8/upstream/v8/src/scanner-base.cc +964 -0
  382. data/ext/v8/upstream/v8/src/scanner-base.h +664 -0
  383. data/ext/v8/upstream/v8/src/scanner.cc +584 -0
  384. data/ext/v8/upstream/v8/src/scanner.h +196 -0
  385. data/ext/v8/upstream/v8/src/scopeinfo.cc +631 -0
  386. data/ext/v8/upstream/v8/src/scopeinfo.h +249 -0
  387. data/ext/v8/upstream/v8/src/scopes.cc +1093 -0
  388. data/ext/v8/upstream/v8/src/scopes.h +508 -0
  389. data/ext/v8/upstream/v8/src/serialize.cc +1574 -0
  390. data/ext/v8/upstream/v8/src/serialize.h +589 -0
  391. data/ext/v8/upstream/{3.1.8 → v8}/src/shell.h +0 -0
  392. data/ext/v8/upstream/{3.1.8 → v8}/src/simulator.h +0 -0
  393. data/ext/v8/upstream/v8/src/small-pointer-list.h +163 -0
  394. data/ext/v8/upstream/{3.1.8 → v8}/src/smart-pointer.h +0 -0
  395. data/ext/v8/upstream/v8/src/snapshot-common.cc +82 -0
  396. data/ext/v8/upstream/{3.1.8 → v8}/src/snapshot-empty.cc +0 -0
  397. data/ext/v8/upstream/v8/src/snapshot.h +73 -0
  398. data/ext/v8/upstream/v8/src/spaces-inl.h +529 -0
  399. data/ext/v8/upstream/v8/src/spaces.cc +3147 -0
  400. data/ext/v8/upstream/v8/src/spaces.h +2368 -0
  401. data/ext/v8/upstream/{3.1.8 → v8}/src/splay-tree-inl.h +0 -0
  402. data/ext/v8/upstream/{3.1.8 → v8}/src/splay-tree.h +0 -0
  403. data/ext/v8/upstream/v8/src/string-search.cc +41 -0
  404. data/ext/v8/upstream/v8/src/string-search.h +568 -0
  405. data/ext/v8/upstream/v8/src/string-stream.cc +592 -0
  406. data/ext/v8/upstream/{3.1.8 → v8}/src/string-stream.h +0 -0
  407. data/ext/v8/upstream/v8/src/string.js +915 -0
  408. data/ext/v8/upstream/{3.1.8 → v8}/src/strtod.cc +0 -0
  409. data/ext/v8/upstream/{3.1.8 → v8}/src/strtod.h +0 -0
  410. data/ext/v8/upstream/v8/src/stub-cache.cc +1940 -0
  411. data/ext/v8/upstream/v8/src/stub-cache.h +866 -0
  412. data/ext/v8/upstream/{3.1.8 → v8}/src/third_party/valgrind/valgrind.h +0 -0
  413. data/ext/v8/upstream/v8/src/token.cc +63 -0
  414. data/ext/v8/upstream/v8/src/token.h +288 -0
  415. data/ext/v8/upstream/v8/src/top.cc +983 -0
  416. data/ext/v8/upstream/v8/src/type-info.cc +472 -0
  417. data/ext/v8/upstream/v8/src/type-info.h +290 -0
  418. data/ext/v8/upstream/{3.1.8 → v8}/src/unbound-queue-inl.h +0 -0
  419. data/ext/v8/upstream/{3.1.8 → v8}/src/unbound-queue.h +0 -0
  420. data/ext/v8/upstream/{3.1.8 → v8}/src/unicode-inl.h +0 -0
  421. data/ext/v8/upstream/v8/src/unicode.cc +1624 -0
  422. data/ext/v8/upstream/v8/src/unicode.h +280 -0
  423. data/ext/v8/upstream/{3.1.8 → v8}/src/uri.js +0 -0
  424. data/ext/v8/upstream/{3.1.8 → v8}/src/utils.cc +0 -0
  425. data/ext/v8/upstream/v8/src/utils.h +796 -0
  426. data/ext/v8/upstream/v8/src/v8-counters.cc +62 -0
  427. data/ext/v8/upstream/v8/src/v8-counters.h +311 -0
  428. data/ext/v8/upstream/v8/src/v8.cc +215 -0
  429. data/ext/v8/upstream/v8/src/v8.h +130 -0
  430. data/ext/v8/upstream/{3.1.8 → v8}/src/v8checks.h +0 -0
  431. data/ext/v8/upstream/{3.1.8 → v8}/src/v8dll-main.cc +0 -0
  432. data/ext/v8/upstream/v8/src/v8globals.h +486 -0
  433. data/ext/v8/upstream/{3.1.8/src/memory.h → v8/src/v8memory.h} +0 -0
  434. data/ext/v8/upstream/v8/src/v8natives.js +1293 -0
  435. data/ext/v8/upstream/{3.1.8 → v8}/src/v8preparserdll-main.cc +0 -0
  436. data/ext/v8/upstream/v8/src/v8threads.cc +453 -0
  437. data/ext/v8/upstream/v8/src/v8threads.h +164 -0
  438. data/ext/v8/upstream/v8/src/v8utils.h +317 -0
  439. data/ext/v8/upstream/{3.1.8 → v8}/src/variables.cc +0 -0
  440. data/ext/v8/upstream/v8/src/variables.h +212 -0
  441. data/ext/v8/upstream/v8/src/version.cc +116 -0
  442. data/ext/v8/upstream/v8/src/version.h +68 -0
  443. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-heavy-inl.h +0 -0
  444. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-heavy.cc +0 -0
  445. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-inl.h +0 -0
  446. data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +171 -0
  447. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-light.cc +0 -0
  448. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame.cc +0 -0
  449. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame.h +0 -0
  450. data/ext/v8/upstream/v8/src/vm-state-inl.h +138 -0
  451. data/ext/v8/upstream/v8/src/vm-state.h +70 -0
  452. data/ext/v8/upstream/v8/src/win32-headers.h +96 -0
  453. data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +456 -0
  454. data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +2954 -0
  455. data/ext/v8/upstream/v8/src/x64/assembler-x64.h +1630 -0
  456. data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +1493 -0
  457. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +5132 -0
  458. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +477 -0
  459. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/codegen-x64-inl.h +0 -0
  460. data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +8843 -0
  461. data/ext/v8/upstream/v8/src/x64/codegen-x64.h +753 -0
  462. data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +88 -0
  463. data/ext/v8/upstream/v8/src/x64/debug-x64.cc +318 -0
  464. data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +815 -0
  465. data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +1752 -0
  466. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/frames-x64.cc +0 -0
  467. data/ext/v8/upstream/v8/src/x64/frames-x64.h +130 -0
  468. data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +4339 -0
  469. data/ext/v8/upstream/v8/src/x64/ic-x64.cc +1752 -0
  470. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/jump-target-x64.cc +0 -0
  471. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +3970 -0
  472. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +318 -0
  473. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/lithium-gap-resolver-x64.cc +0 -0
  474. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/lithium-gap-resolver-x64.h +0 -0
  475. data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +2115 -0
  476. data/ext/v8/upstream/v8/src/x64/lithium-x64.h +2161 -0
  477. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +2911 -0
  478. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +1984 -0
  479. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  480. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  481. data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +87 -0
  482. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +95 -0
  483. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/register-allocator-x64.h +0 -0
  484. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/simulator-x64.cc +0 -0
  485. data/ext/v8/upstream/v8/src/x64/simulator-x64.h +71 -0
  486. data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +3460 -0
  487. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +1296 -0
  488. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +597 -0
  489. data/ext/v8/upstream/v8/src/zone-inl.h +129 -0
  490. data/ext/v8/upstream/v8/src/zone.cc +196 -0
  491. data/ext/v8/upstream/v8/src/zone.h +236 -0
  492. data/ext/v8/upstream/{3.1.8 → v8}/tools/codemap.js +0 -0
  493. data/ext/v8/upstream/{3.1.8 → v8}/tools/consarray.js +0 -0
  494. data/ext/v8/upstream/{3.1.8 → v8}/tools/csvparser.js +0 -0
  495. data/ext/v8/upstream/{3.1.8 → v8}/tools/disasm.py +0 -0
  496. data/ext/v8/upstream/v8/tools/freebsd-tick-processor +10 -0
  497. data/ext/v8/upstream/{3.1.8 → v8}/tools/gc-nvp-trace-processor.py +0 -0
  498. data/ext/v8/upstream/{3.1.8 → v8}/tools/generate-ten-powers.scm +0 -0
  499. data/ext/v8/upstream/{3.1.8 → v8}/tools/grokdump.py +0 -0
  500. data/ext/v8/upstream/v8/tools/gyp/v8.gyp +844 -0
  501. data/ext/v8/upstream/{3.1.8 → v8}/tools/js2c.py +0 -0
  502. data/ext/v8/upstream/{3.1.8 → v8}/tools/jsmin.py +0 -0
  503. data/ext/v8/upstream/v8/tools/linux-tick-processor +35 -0
  504. data/ext/v8/upstream/{3.1.8 → v8}/tools/ll_prof.py +0 -0
  505. data/ext/v8/upstream/{3.1.8 → v8}/tools/logreader.js +0 -0
  506. data/ext/v8/upstream/{3.1.8 → v8}/tools/mac-nm +0 -0
  507. data/ext/v8/upstream/{3.1.8 → v8}/tools/mac-tick-processor +0 -0
  508. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/README +0 -0
  509. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/SConstruct +0 -0
  510. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/oom_dump.cc +0 -0
  511. data/ext/v8/upstream/{3.1.8 → v8}/tools/presubmit.py +0 -0
  512. data/ext/v8/upstream/{3.1.8 → v8}/tools/process-heap-prof.py +0 -0
  513. data/ext/v8/upstream/{3.1.8 → v8}/tools/profile.js +0 -0
  514. data/ext/v8/upstream/{3.1.8 → v8}/tools/profile_view.js +0 -0
  515. data/ext/v8/upstream/{3.1.8 → v8}/tools/run-valgrind.py +0 -0
  516. data/ext/v8/upstream/{3.1.8 → v8}/tools/splaytree.js +0 -0
  517. data/ext/v8/upstream/{3.1.8 → v8}/tools/stats-viewer.py +0 -0
  518. data/ext/v8/upstream/v8/tools/test.py +1490 -0
  519. data/ext/v8/upstream/{3.1.8 → v8}/tools/tickprocessor-driver.js +0 -0
  520. data/ext/v8/upstream/v8/tools/tickprocessor.js +877 -0
  521. data/ext/v8/upstream/{3.1.8 → v8}/tools/utils.py +0 -0
  522. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/README.txt +0 -0
  523. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/arm.vsprops +0 -0
  524. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/common.vsprops +0 -0
  525. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8.vcproj +0 -0
  526. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8_arm.vcproj +0 -0
  527. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8_x64.vcproj +0 -0
  528. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8js2c.cmd +0 -0
  529. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/debug.vsprops +0 -0
  530. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/ia32.vsprops +0 -0
  531. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/js2c.cmd +0 -0
  532. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/release.vsprops +0 -0
  533. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8.sln +0 -0
  534. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8.vcproj +0 -0
  535. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_arm.sln +0 -0
  536. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_arm.vcproj +0 -0
  537. data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +1308 -0
  538. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +1238 -0
  539. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +1300 -0
  540. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest.vcproj +0 -0
  541. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  542. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  543. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  544. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  545. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  546. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  547. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  548. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample.vcproj +0 -0
  549. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -0
  550. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -0
  551. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  552. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  553. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  554. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  555. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_x64.sln +0 -0
  556. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_x64.vcproj +0 -0
  557. data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +18 -0
  558. data/ext/v8/upstream/{3.1.8 → v8}/tools/windows-tick-processor.bat +0 -0
  559. data/ext/v8/v8_callbacks.cpp +52 -92
  560. data/ext/v8/v8_date.cpp +2 -3
  561. data/ext/v8/v8_object.cpp +4 -0
  562. data/ext/v8/v8_template.cpp +2 -2
  563. data/ext/v8/v8_try_catch.cpp +8 -38
  564. data/lib/v8/version.rb +1 -1
  565. data/spec/ext/ext_spec_helper.rb +2 -20
  566. data/spec/ext/object_spec.rb +0 -12
  567. data/spec/ext/try_catch_spec.rb +29 -1
  568. data/spec/spec_helper.rb +1 -0
  569. data/spec/v8/portal/proxies_spec.rb +1 -84
  570. data/specmem/handle_memspec.rb +41 -0
  571. data/specmem/object_memspec.rb +16 -0
  572. data/specmem/proxies_memspec.rb +86 -0
  573. data/specmem/spec_helper.rb +24 -0
  574. data/therubyracer.gemspec +7 -2
  575. metadata +564 -541
  576. data/ext/v8/upstream/3.1.8/.gitignore +0 -31
  577. data/ext/v8/upstream/3.1.8/AUTHORS +0 -40
  578. data/ext/v8/upstream/3.1.8/ChangeLog +0 -2566
  579. data/ext/v8/upstream/3.1.8/SConstruct +0 -1192
  580. data/ext/v8/upstream/3.1.8/include/v8-debug.h +0 -384
  581. data/ext/v8/upstream/3.1.8/include/v8-preparser.h +0 -116
  582. data/ext/v8/upstream/3.1.8/include/v8-profiler.h +0 -426
  583. data/ext/v8/upstream/3.1.8/include/v8-testing.h +0 -99
  584. data/ext/v8/upstream/3.1.8/include/v8.h +0 -3846
  585. data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +0 -206
  586. data/ext/v8/upstream/3.1.8/src/SConscript +0 -356
  587. data/ext/v8/upstream/3.1.8/src/accessors.cc +0 -907
  588. data/ext/v8/upstream/3.1.8/src/allocation.cc +0 -204
  589. data/ext/v8/upstream/3.1.8/src/allocation.h +0 -176
  590. data/ext/v8/upstream/3.1.8/src/api.cc +0 -5191
  591. data/ext/v8/upstream/3.1.8/src/api.h +0 -508
  592. data/ext/v8/upstream/3.1.8/src/apiutils.h +0 -80
  593. data/ext/v8/upstream/3.1.8/src/arguments.h +0 -105
  594. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +0 -352
  595. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +0 -2756
  596. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +0 -1294
  597. data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +0 -1628
  598. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +0 -6783
  599. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +0 -657
  600. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +0 -7403
  601. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +0 -595
  602. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +0 -769
  603. data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +0 -147
  604. data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +0 -315
  605. data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +0 -700
  606. data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +0 -1439
  607. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +0 -168
  608. data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +0 -4230
  609. data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +0 -1799
  610. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +0 -2041
  611. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +0 -2046
  612. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +0 -3822
  613. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +0 -312
  614. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +0 -303
  615. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +0 -2701
  616. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +0 -1015
  617. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +0 -1280
  618. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +0 -252
  619. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +0 -3165
  620. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +0 -402
  621. data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +0 -4077
  622. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +0 -843
  623. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +0 -520
  624. data/ext/v8/upstream/3.1.8/src/array.js +0 -1231
  625. data/ext/v8/upstream/3.1.8/src/assembler.cc +0 -973
  626. data/ext/v8/upstream/3.1.8/src/assembler.h +0 -787
  627. data/ext/v8/upstream/3.1.8/src/ast-inl.h +0 -107
  628. data/ext/v8/upstream/3.1.8/src/ast.cc +0 -1067
  629. data/ext/v8/upstream/3.1.8/src/ast.h +0 -2177
  630. data/ext/v8/upstream/3.1.8/src/atomicops.h +0 -165
  631. data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +0 -1888
  632. data/ext/v8/upstream/3.1.8/src/bootstrapper.h +0 -118
  633. data/ext/v8/upstream/3.1.8/src/builtins.cc +0 -1586
  634. data/ext/v8/upstream/3.1.8/src/builtins.h +0 -339
  635. data/ext/v8/upstream/3.1.8/src/checks.cc +0 -110
  636. data/ext/v8/upstream/3.1.8/src/checks.h +0 -292
  637. data/ext/v8/upstream/3.1.8/src/code-stubs.cc +0 -230
  638. data/ext/v8/upstream/3.1.8/src/code-stubs.h +0 -950
  639. data/ext/v8/upstream/3.1.8/src/codegen-inl.h +0 -64
  640. data/ext/v8/upstream/3.1.8/src/codegen.cc +0 -495
  641. data/ext/v8/upstream/3.1.8/src/codegen.h +0 -245
  642. data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +0 -654
  643. data/ext/v8/upstream/3.1.8/src/compilation-cache.h +0 -112
  644. data/ext/v8/upstream/3.1.8/src/compiler.cc +0 -806
  645. data/ext/v8/upstream/3.1.8/src/compiler.h +0 -290
  646. data/ext/v8/upstream/3.1.8/src/contexts.cc +0 -320
  647. data/ext/v8/upstream/3.1.8/src/contexts.h +0 -376
  648. data/ext/v8/upstream/3.1.8/src/conversions.cc +0 -1069
  649. data/ext/v8/upstream/3.1.8/src/counters.cc +0 -78
  650. data/ext/v8/upstream/3.1.8/src/counters.h +0 -242
  651. data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +0 -100
  652. data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +0 -554
  653. data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +0 -291
  654. data/ext/v8/upstream/3.1.8/src/cpu.h +0 -65
  655. data/ext/v8/upstream/3.1.8/src/d8-debug.cc +0 -367
  656. data/ext/v8/upstream/3.1.8/src/d8-debug.h +0 -157
  657. data/ext/v8/upstream/3.1.8/src/d8-posix.cc +0 -693
  658. data/ext/v8/upstream/3.1.8/src/d8.cc +0 -792
  659. data/ext/v8/upstream/3.1.8/src/d8.gyp +0 -85
  660. data/ext/v8/upstream/3.1.8/src/data-flow.h +0 -379
  661. data/ext/v8/upstream/3.1.8/src/dateparser.h +0 -263
  662. data/ext/v8/upstream/3.1.8/src/debug-agent.cc +0 -446
  663. data/ext/v8/upstream/3.1.8/src/debug-agent.h +0 -131
  664. data/ext/v8/upstream/3.1.8/src/debug.cc +0 -3085
  665. data/ext/v8/upstream/3.1.8/src/debug.h +0 -1025
  666. data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +0 -1185
  667. data/ext/v8/upstream/3.1.8/src/deoptimizer.h +0 -529
  668. data/ext/v8/upstream/3.1.8/src/disasm.h +0 -77
  669. data/ext/v8/upstream/3.1.8/src/disassembler.cc +0 -338
  670. data/ext/v8/upstream/3.1.8/src/execution.cc +0 -735
  671. data/ext/v8/upstream/3.1.8/src/execution.h +0 -322
  672. data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +0 -53
  673. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +0 -264
  674. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +0 -141
  675. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +0 -58
  676. data/ext/v8/upstream/3.1.8/src/factory.cc +0 -1087
  677. data/ext/v8/upstream/3.1.8/src/factory.h +0 -432
  678. data/ext/v8/upstream/3.1.8/src/flag-definitions.h +0 -552
  679. data/ext/v8/upstream/3.1.8/src/frame-element.cc +0 -42
  680. data/ext/v8/upstream/3.1.8/src/frame-element.h +0 -277
  681. data/ext/v8/upstream/3.1.8/src/frames-inl.h +0 -210
  682. data/ext/v8/upstream/3.1.8/src/frames.cc +0 -1232
  683. data/ext/v8/upstream/3.1.8/src/frames.h +0 -826
  684. data/ext/v8/upstream/3.1.8/src/full-codegen.cc +0 -1382
  685. data/ext/v8/upstream/3.1.8/src/full-codegen.h +0 -751
  686. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +0 -90
  687. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +0 -111
  688. data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +0 -1547
  689. data/ext/v8/upstream/3.1.8/src/global-handles.cc +0 -534
  690. data/ext/v8/upstream/3.1.8/src/global-handles.h +0 -181
  691. data/ext/v8/upstream/3.1.8/src/globals.h +0 -325
  692. data/ext/v8/upstream/3.1.8/src/handles-inl.h +0 -80
  693. data/ext/v8/upstream/3.1.8/src/handles.cc +0 -910
  694. data/ext/v8/upstream/3.1.8/src/handles.h +0 -424
  695. data/ext/v8/upstream/3.1.8/src/hashmap.h +0 -121
  696. data/ext/v8/upstream/3.1.8/src/heap-inl.h +0 -587
  697. data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +0 -1128
  698. data/ext/v8/upstream/3.1.8/src/heap-profiler.h +0 -381
  699. data/ext/v8/upstream/3.1.8/src/heap.cc +0 -5610
  700. data/ext/v8/upstream/3.1.8/src/heap.h +0 -2218
  701. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +0 -1490
  702. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +0 -3493
  703. data/ext/v8/upstream/3.1.8/src/hydrogen.cc +0 -6056
  704. data/ext/v8/upstream/3.1.8/src/hydrogen.h +0 -1091
  705. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +0 -429
  706. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +0 -2800
  707. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +0 -1093
  708. data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +0 -1590
  709. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +0 -6624
  710. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +0 -536
  711. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +0 -10354
  712. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +0 -798
  713. data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +0 -87
  714. data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +0 -309
  715. data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +0 -664
  716. data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +0 -1597
  717. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +0 -140
  718. data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +0 -4278
  719. data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +0 -1786
  720. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +0 -3880
  721. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +0 -309
  722. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +0 -460
  723. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +0 -2095
  724. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +0 -2127
  725. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +0 -2031
  726. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +0 -798
  727. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1253
  728. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +0 -215
  729. data/ext/v8/upstream/3.1.8/src/ia32/register-allocator-ia32.cc +0 -157
  730. data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +0 -72
  731. data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +0 -3732
  732. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +0 -1360
  733. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +0 -646
  734. data/ext/v8/upstream/3.1.8/src/ic-inl.h +0 -129
  735. data/ext/v8/upstream/3.1.8/src/ic.cc +0 -2333
  736. data/ext/v8/upstream/3.1.8/src/ic.h +0 -639
  737. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +0 -655
  738. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.h +0 -48
  739. data/ext/v8/upstream/3.1.8/src/json.js +0 -342
  740. data/ext/v8/upstream/3.1.8/src/jsregexp.cc +0 -5340
  741. data/ext/v8/upstream/3.1.8/src/jsregexp.h +0 -1484
  742. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +0 -430
  743. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +0 -244
  744. data/ext/v8/upstream/3.1.8/src/jump-target-inl.h +0 -48
  745. data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +0 -111
  746. data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +0 -140
  747. data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +0 -2093
  748. data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +0 -644
  749. data/ext/v8/upstream/3.1.8/src/lithium.cc +0 -168
  750. data/ext/v8/upstream/3.1.8/src/liveedit.cc +0 -1650
  751. data/ext/v8/upstream/3.1.8/src/liveedit.h +0 -174
  752. data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +0 -2527
  753. data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +0 -322
  754. data/ext/v8/upstream/3.1.8/src/log-utils.cc +0 -336
  755. data/ext/v8/upstream/3.1.8/src/log-utils.h +0 -232
  756. data/ext/v8/upstream/3.1.8/src/log.cc +0 -1608
  757. data/ext/v8/upstream/3.1.8/src/log.h +0 -379
  758. data/ext/v8/upstream/3.1.8/src/mark-compact.cc +0 -2957
  759. data/ext/v8/upstream/3.1.8/src/mark-compact.h +0 -433
  760. data/ext/v8/upstream/3.1.8/src/messages.cc +0 -164
  761. data/ext/v8/upstream/3.1.8/src/messages.js +0 -1071
  762. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips-inl.h +0 -215
  763. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.cc +0 -1219
  764. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +0 -667
  765. data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +0 -205
  766. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips-inl.h +0 -70
  767. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.cc +0 -1437
  768. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +0 -431
  769. data/ext/v8/upstream/3.1.8/src/mips/constants-mips.cc +0 -328
  770. data/ext/v8/upstream/3.1.8/src/mips/constants-mips.h +0 -525
  771. data/ext/v8/upstream/3.1.8/src/mips/cpu-mips.cc +0 -73
  772. data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +0 -127
  773. data/ext/v8/upstream/3.1.8/src/mips/disasm-mips.cc +0 -787
  774. data/ext/v8/upstream/3.1.8/src/mips/fast-codegen-mips.cc +0 -77
  775. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +0 -96
  776. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.h +0 -164
  777. data/ext/v8/upstream/3.1.8/src/mips/full-codegen-mips.cc +0 -277
  778. data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +0 -208
  779. data/ext/v8/upstream/3.1.8/src/mips/jump-target-mips.cc +0 -175
  780. data/ext/v8/upstream/3.1.8/src/mips/macro-assembler-mips.cc +0 -1326
  781. data/ext/v8/upstream/3.1.8/src/mips/macro-assembler-mips.h +0 -461
  782. data/ext/v8/upstream/3.1.8/src/mips/register-allocator-mips-inl.h +0 -137
  783. data/ext/v8/upstream/3.1.8/src/mips/register-allocator-mips.h +0 -46
  784. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +0 -1650
  785. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +0 -311
  786. data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +0 -418
  787. data/ext/v8/upstream/3.1.8/src/mips/virtual-frame-mips.cc +0 -319
  788. data/ext/v8/upstream/3.1.8/src/mips/virtual-frame-mips.h +0 -548
  789. data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +0 -2380
  790. data/ext/v8/upstream/3.1.8/src/mksnapshot.cc +0 -256
  791. data/ext/v8/upstream/3.1.8/src/objects-debug.cc +0 -722
  792. data/ext/v8/upstream/3.1.8/src/objects-inl.h +0 -3946
  793. data/ext/v8/upstream/3.1.8/src/objects-printer.cc +0 -801
  794. data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +0 -142
  795. data/ext/v8/upstream/3.1.8/src/objects-visiting.h +0 -401
  796. data/ext/v8/upstream/3.1.8/src/objects.cc +0 -10044
  797. data/ext/v8/upstream/3.1.8/src/objects.h +0 -6571
  798. data/ext/v8/upstream/3.1.8/src/parser.cc +0 -5165
  799. data/ext/v8/upstream/3.1.8/src/parser.h +0 -802
  800. data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +0 -745
  801. data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +0 -702
  802. data/ext/v8/upstream/3.1.8/src/platform-linux.cc +0 -981
  803. data/ext/v8/upstream/3.1.8/src/platform-macos.cc +0 -732
  804. data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +0 -498
  805. data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +0 -657
  806. data/ext/v8/upstream/3.1.8/src/platform-posix.cc +0 -399
  807. data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +0 -714
  808. data/ext/v8/upstream/3.1.8/src/platform-win32.cc +0 -1974
  809. data/ext/v8/upstream/3.1.8/src/platform.h +0 -636
  810. data/ext/v8/upstream/3.1.8/src/preparse-data.cc +0 -183
  811. data/ext/v8/upstream/3.1.8/src/preparser-api.cc +0 -213
  812. data/ext/v8/upstream/3.1.8/src/preparser.cc +0 -1205
  813. data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +0 -1539
  814. data/ext/v8/upstream/3.1.8/src/prettyprinter.h +0 -223
  815. data/ext/v8/upstream/3.1.8/src/profile-generator.cc +0 -2899
  816. data/ext/v8/upstream/3.1.8/src/profile-generator.h +0 -1151
  817. data/ext/v8/upstream/3.1.8/src/property.cc +0 -96
  818. data/ext/v8/upstream/3.1.8/src/property.h +0 -337
  819. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +0 -470
  820. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +0 -257
  821. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +0 -231
  822. data/ext/v8/upstream/3.1.8/src/regexp-stack.cc +0 -103
  823. data/ext/v8/upstream/3.1.8/src/regexp-stack.h +0 -123
  824. data/ext/v8/upstream/3.1.8/src/regexp.js +0 -483
  825. data/ext/v8/upstream/3.1.8/src/register-allocator-inl.h +0 -141
  826. data/ext/v8/upstream/3.1.8/src/register-allocator.cc +0 -104
  827. data/ext/v8/upstream/3.1.8/src/register-allocator.h +0 -320
  828. data/ext/v8/upstream/3.1.8/src/rewriter.cc +0 -1023
  829. data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +0 -443
  830. data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +0 -77
  831. data/ext/v8/upstream/3.1.8/src/runtime.cc +0 -11592
  832. data/ext/v8/upstream/3.1.8/src/runtime.h +0 -582
  833. data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +0 -253
  834. data/ext/v8/upstream/3.1.8/src/safepoint-table.h +0 -263
  835. data/ext/v8/upstream/3.1.8/src/scanner-base.cc +0 -971
  836. data/ext/v8/upstream/3.1.8/src/scanner-base.h +0 -653
  837. data/ext/v8/upstream/3.1.8/src/scanner.cc +0 -586
  838. data/ext/v8/upstream/3.1.8/src/scanner.h +0 -194
  839. data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +0 -636
  840. data/ext/v8/upstream/3.1.8/src/scopeinfo.h +0 -238
  841. data/ext/v8/upstream/3.1.8/src/scopes.cc +0 -1063
  842. data/ext/v8/upstream/3.1.8/src/scopes.h +0 -494
  843. data/ext/v8/upstream/3.1.8/src/serialize.cc +0 -1535
  844. data/ext/v8/upstream/3.1.8/src/serialize.h +0 -584
  845. data/ext/v8/upstream/3.1.8/src/snapshot-common.cc +0 -82
  846. data/ext/v8/upstream/3.1.8/src/snapshot.h +0 -71
  847. data/ext/v8/upstream/3.1.8/src/spaces-inl.h +0 -524
  848. data/ext/v8/upstream/3.1.8/src/spaces.cc +0 -3254
  849. data/ext/v8/upstream/3.1.8/src/spaces.h +0 -2362
  850. data/ext/v8/upstream/3.1.8/src/string-search.cc +0 -40
  851. data/ext/v8/upstream/3.1.8/src/string-search.h +0 -567
  852. data/ext/v8/upstream/3.1.8/src/string-stream.cc +0 -584
  853. data/ext/v8/upstream/3.1.8/src/string.js +0 -915
  854. data/ext/v8/upstream/3.1.8/src/stub-cache.cc +0 -1878
  855. data/ext/v8/upstream/3.1.8/src/stub-cache.h +0 -849
  856. data/ext/v8/upstream/3.1.8/src/token.cc +0 -63
  857. data/ext/v8/upstream/3.1.8/src/token.h +0 -288
  858. data/ext/v8/upstream/3.1.8/src/top.cc +0 -1152
  859. data/ext/v8/upstream/3.1.8/src/top.h +0 -608
  860. data/ext/v8/upstream/3.1.8/src/type-info.cc +0 -406
  861. data/ext/v8/upstream/3.1.8/src/type-info.h +0 -283
  862. data/ext/v8/upstream/3.1.8/src/unicode.cc +0 -1624
  863. data/ext/v8/upstream/3.1.8/src/unicode.h +0 -280
  864. data/ext/v8/upstream/3.1.8/src/utils.h +0 -793
  865. data/ext/v8/upstream/3.1.8/src/v8-counters.cc +0 -55
  866. data/ext/v8/upstream/3.1.8/src/v8-counters.h +0 -290
  867. data/ext/v8/upstream/3.1.8/src/v8.cc +0 -270
  868. data/ext/v8/upstream/3.1.8/src/v8.h +0 -127
  869. data/ext/v8/upstream/3.1.8/src/v8globals.h +0 -480
  870. data/ext/v8/upstream/3.1.8/src/v8natives.js +0 -1252
  871. data/ext/v8/upstream/3.1.8/src/v8threads.cc +0 -440
  872. data/ext/v8/upstream/3.1.8/src/v8threads.h +0 -157
  873. data/ext/v8/upstream/3.1.8/src/v8utils.h +0 -354
  874. data/ext/v8/upstream/3.1.8/src/variables.h +0 -212
  875. data/ext/v8/upstream/3.1.8/src/version.cc +0 -95
  876. data/ext/v8/upstream/3.1.8/src/version.h +0 -64
  877. data/ext/v8/upstream/3.1.8/src/virtual-frame-light-inl.h +0 -170
  878. data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +0 -134
  879. data/ext/v8/upstream/3.1.8/src/vm-state.h +0 -68
  880. data/ext/v8/upstream/3.1.8/src/win32-headers.h +0 -95
  881. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +0 -455
  882. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +0 -3162
  883. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +0 -1584
  884. data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +0 -1492
  885. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +0 -5150
  886. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +0 -519
  887. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +0 -8835
  888. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +0 -750
  889. data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +0 -86
  890. data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +0 -316
  891. data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +0 -781
  892. data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +0 -1737
  893. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +0 -130
  894. data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +0 -3984
  895. data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +0 -1761
  896. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +0 -3639
  897. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +0 -305
  898. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +0 -2044
  899. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +0 -2052
  900. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +0 -2660
  901. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +0 -1852
  902. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +0 -1382
  903. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +0 -278
  904. data/ext/v8/upstream/3.1.8/src/x64/register-allocator-x64-inl.h +0 -87
  905. data/ext/v8/upstream/3.1.8/src/x64/register-allocator-x64.cc +0 -91
  906. data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +0 -71
  907. data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +0 -3509
  908. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +0 -1292
  909. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +0 -593
  910. data/ext/v8/upstream/3.1.8/src/zone-inl.h +0 -83
  911. data/ext/v8/upstream/3.1.8/src/zone.cc +0 -195
  912. data/ext/v8/upstream/3.1.8/src/zone.h +0 -233
  913. data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +0 -869
  914. data/ext/v8/upstream/3.1.8/tools/linux-tick-processor +0 -33
  915. data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +0 -863
  916. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +0 -1296
  917. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +0 -1234
  918. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +0 -1296
  919. data/ext/v8/upstream/3.1.8/tools/visual_studio/x64.vsprops +0 -17
  920. data/spec/ext/mem_spec.rb +0 -42
@@ -1,48 +0,0 @@
1
- // Copyright 2009 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #ifndef V8_JUMP_TARGET_INL_H_
29
- #define V8_JUMP_TARGET_INL_H_
30
-
31
- #include "virtual-frame-inl.h"
32
-
33
- #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
34
- #include "jump-target-heavy-inl.h"
35
- #else
36
- #include "jump-target-light-inl.h"
37
- #endif
38
-
39
- namespace v8 {
40
- namespace internal {
41
-
42
- CodeGenerator* JumpTarget::cgen() {
43
- return CodeGeneratorScope::Current();
44
- }
45
-
46
- } } // namespace v8::internal
47
-
48
- #endif // V8_JUMP_TARGET_INL_H_
@@ -1,111 +0,0 @@
1
- // Copyright 2010 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #include "v8.h"
29
-
30
- #include "codegen-inl.h"
31
- #include "jump-target-inl.h"
32
-
33
- namespace v8 {
34
- namespace internal {
35
-
36
-
37
- DeferredCode::DeferredCode()
38
- : masm_(CodeGeneratorScope::Current()->masm()),
39
- statement_position_(masm_->positions_recorder()->
40
- current_statement_position()),
41
- position_(masm_->positions_recorder()->current_position()),
42
- frame_state_(*CodeGeneratorScope::Current()->frame()) {
43
- ASSERT(statement_position_ != RelocInfo::kNoPosition);
44
- ASSERT(position_ != RelocInfo::kNoPosition);
45
-
46
- CodeGeneratorScope::Current()->AddDeferred(this);
47
-
48
- #ifdef DEBUG
49
- comment_ = "";
50
- #endif
51
- }
52
-
53
-
54
- // -------------------------------------------------------------------------
55
- // BreakTarget implementation.
56
-
57
-
58
- void BreakTarget::SetExpectedHeight() {
59
- expected_height_ = cgen()->frame()->height();
60
- }
61
-
62
-
63
- void BreakTarget::Jump() {
64
- ASSERT(cgen()->has_valid_frame());
65
-
66
- int count = cgen()->frame()->height() - expected_height_;
67
- if (count > 0) {
68
- cgen()->frame()->Drop(count);
69
- }
70
- DoJump();
71
- }
72
-
73
-
74
- void BreakTarget::Branch(Condition cc, Hint hint) {
75
- if (cc == al) {
76
- Jump();
77
- return;
78
- }
79
-
80
- ASSERT(cgen()->has_valid_frame());
81
-
82
- int count = cgen()->frame()->height() - expected_height_;
83
- if (count > 0) {
84
- // We negate and branch here rather than using DoBranch's negate
85
- // and branch. This gives us a hook to remove statement state
86
- // from the frame.
87
- JumpTarget fall_through;
88
- // Branch to fall through will not negate, because it is a
89
- // forward-only target.
90
- fall_through.Branch(NegateCondition(cc), NegateHint(hint));
91
- // Emit merge code.
92
- cgen()->frame()->Drop(count);
93
- DoJump();
94
- fall_through.Bind();
95
- } else {
96
- DoBranch(cc, hint);
97
- }
98
- }
99
-
100
-
101
- void BreakTarget::Bind() {
102
- if (cgen()->has_valid_frame()) {
103
- int count = cgen()->frame()->height() - expected_height_;
104
- if (count > 0) {
105
- cgen()->frame()->Drop(count);
106
- }
107
- }
108
- DoBind();
109
- }
110
-
111
- } } // namespace v8::internal
@@ -1,140 +0,0 @@
1
- // Copyright 2010 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
- #ifndef V8_LITHIUM_ALLOCATOR_INL_H_
29
- #define V8_LITHIUM_ALLOCATOR_INL_H_
30
-
31
- #include "lithium-allocator.h"
32
-
33
- #if V8_TARGET_ARCH_IA32
34
- #include "ia32/lithium-ia32.h"
35
- #elif V8_TARGET_ARCH_X64
36
- #include "x64/lithium-x64.h"
37
- #elif V8_TARGET_ARCH_ARM
38
- #include "arm/lithium-arm.h"
39
- #else
40
- #error "Unknown architecture."
41
- #endif
42
-
43
- namespace v8 {
44
- namespace internal {
45
-
46
- bool LAllocator::IsGapAt(int index) { return chunk_->IsGapAt(index); }
47
-
48
-
49
- LInstruction* LAllocator::InstructionAt(int index) {
50
- return chunk_->instructions()->at(index);
51
- }
52
-
53
-
54
- LGap* LAllocator::GapAt(int index) {
55
- return chunk_->GetGapAt(index);
56
- }
57
-
58
-
59
- TempIterator::TempIterator(LInstruction* instr)
60
- : instr_(instr),
61
- limit_(instr->TempCount()),
62
- current_(0) {
63
- current_ = AdvanceToNext(0);
64
- }
65
-
66
-
67
- bool TempIterator::HasNext() { return current_ < limit_; }
68
-
69
-
70
- LOperand* TempIterator::Next() {
71
- ASSERT(HasNext());
72
- return instr_->TempAt(current_);
73
- }
74
-
75
-
76
- int TempIterator::AdvanceToNext(int start) {
77
- while (start < limit_ && instr_->TempAt(start) == NULL) start++;
78
- return start;
79
- }
80
-
81
-
82
- void TempIterator::Advance() {
83
- current_ = AdvanceToNext(current_ + 1);
84
- }
85
-
86
-
87
- InputIterator::InputIterator(LInstruction* instr)
88
- : instr_(instr),
89
- limit_(instr->InputCount()),
90
- current_(0) {
91
- current_ = AdvanceToNext(0);
92
- }
93
-
94
-
95
- bool InputIterator::HasNext() { return current_ < limit_; }
96
-
97
-
98
- LOperand* InputIterator::Next() {
99
- ASSERT(HasNext());
100
- return instr_->InputAt(current_);
101
- }
102
-
103
-
104
- void InputIterator::Advance() {
105
- current_ = AdvanceToNext(current_ + 1);
106
- }
107
-
108
-
109
- int InputIterator::AdvanceToNext(int start) {
110
- while (start < limit_ && instr_->InputAt(start)->IsConstantOperand()) start++;
111
- return start;
112
- }
113
-
114
-
115
- UseIterator::UseIterator(LInstruction* instr)
116
- : input_iterator_(instr), env_iterator_(instr->environment()) { }
117
-
118
-
119
- bool UseIterator::HasNext() {
120
- return input_iterator_.HasNext() || env_iterator_.HasNext();
121
- }
122
-
123
-
124
- LOperand* UseIterator::Next() {
125
- ASSERT(HasNext());
126
- return input_iterator_.HasNext()
127
- ? input_iterator_.Next()
128
- : env_iterator_.Next();
129
- }
130
-
131
-
132
- void UseIterator::Advance() {
133
- input_iterator_.HasNext()
134
- ? input_iterator_.Advance()
135
- : env_iterator_.Advance();
136
- }
137
-
138
- } } // namespace v8::internal
139
-
140
- #endif // V8_LITHIUM_ALLOCATOR_INL_H_
@@ -1,2093 +0,0 @@
1
- // Copyright 2010 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #include "lithium-allocator-inl.h"
29
-
30
- #include "hydrogen.h"
31
- #include "string-stream.h"
32
-
33
- #if V8_TARGET_ARCH_IA32
34
- #include "ia32/lithium-ia32.h"
35
- #elif V8_TARGET_ARCH_X64
36
- #include "x64/lithium-x64.h"
37
- #elif V8_TARGET_ARCH_ARM
38
- #include "arm/lithium-arm.h"
39
- #else
40
- #error "Unknown architecture."
41
- #endif
42
-
43
- namespace v8 {
44
- namespace internal {
45
-
46
-
47
- #define DEFINE_OPERAND_CACHE(name, type) \
48
- name name::cache[name::kNumCachedOperands]; \
49
- void name::SetupCache() { \
50
- for (int i = 0; i < kNumCachedOperands; i++) { \
51
- cache[i].ConvertTo(type, i); \
52
- } \
53
- }
54
-
55
- DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND)
56
- DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT)
57
- DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT)
58
- DEFINE_OPERAND_CACHE(LRegister, REGISTER)
59
- DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER)
60
-
61
- #undef DEFINE_OPERAND_CACHE
62
-
63
-
64
- static inline LifetimePosition Min(LifetimePosition a, LifetimePosition b) {
65
- return a.Value() < b.Value() ? a : b;
66
- }
67
-
68
-
69
- static inline LifetimePosition Max(LifetimePosition a, LifetimePosition b) {
70
- return a.Value() > b.Value() ? a : b;
71
- }
72
-
73
-
74
- UsePosition::UsePosition(LifetimePosition pos, LOperand* operand)
75
- : operand_(operand),
76
- hint_(NULL),
77
- pos_(pos),
78
- next_(NULL),
79
- requires_reg_(false),
80
- register_beneficial_(true) {
81
- if (operand_ != NULL && operand_->IsUnallocated()) {
82
- LUnallocated* unalloc = LUnallocated::cast(operand_);
83
- requires_reg_ = unalloc->HasRegisterPolicy();
84
- register_beneficial_ = !unalloc->HasAnyPolicy();
85
- }
86
- ASSERT(pos_.IsValid());
87
- }
88
-
89
-
90
- bool UsePosition::HasHint() const {
91
- return hint_ != NULL && !hint_->IsUnallocated();
92
- }
93
-
94
-
95
- bool UsePosition::RequiresRegister() const {
96
- return requires_reg_;
97
- }
98
-
99
-
100
- bool UsePosition::RegisterIsBeneficial() const {
101
- return register_beneficial_;
102
- }
103
-
104
-
105
- void UseInterval::SplitAt(LifetimePosition pos) {
106
- ASSERT(Contains(pos) && pos.Value() != start().Value());
107
- UseInterval* after = new UseInterval(pos, end_);
108
- after->next_ = next_;
109
- next_ = after;
110
- end_ = pos;
111
- }
112
-
113
-
114
- #ifdef DEBUG
115
-
116
-
117
- void LiveRange::Verify() const {
118
- UsePosition* cur = first_pos_;
119
- while (cur != NULL) {
120
- ASSERT(Start().Value() <= cur->pos().Value() &&
121
- cur->pos().Value() <= End().Value());
122
- cur = cur->next();
123
- }
124
- }
125
-
126
-
127
- bool LiveRange::HasOverlap(UseInterval* target) const {
128
- UseInterval* current_interval = first_interval_;
129
- while (current_interval != NULL) {
130
- // Intervals overlap if the start of one is contained in the other.
131
- if (current_interval->Contains(target->start()) ||
132
- target->Contains(current_interval->start())) {
133
- return true;
134
- }
135
- current_interval = current_interval->next();
136
- }
137
- return false;
138
- }
139
-
140
-
141
- #endif
142
-
143
-
144
- LiveRange::LiveRange(int id)
145
- : id_(id),
146
- spilled_(false),
147
- assigned_register_(kInvalidAssignment),
148
- assigned_register_kind_(NONE),
149
- last_interval_(NULL),
150
- first_interval_(NULL),
151
- first_pos_(NULL),
152
- parent_(NULL),
153
- next_(NULL),
154
- current_interval_(NULL),
155
- last_processed_use_(NULL),
156
- spill_start_index_(kMaxInt) {
157
- spill_operand_ = new LUnallocated(LUnallocated::IGNORE);
158
- }
159
-
160
-
161
- void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) {
162
- ASSERT(!HasRegisterAssigned() && !IsSpilled());
163
- assigned_register_ = reg;
164
- assigned_register_kind_ = register_kind;
165
- ConvertOperands();
166
- }
167
-
168
-
169
- void LiveRange::MakeSpilled() {
170
- ASSERT(!IsSpilled());
171
- ASSERT(TopLevel()->HasAllocatedSpillOperand());
172
- spilled_ = true;
173
- assigned_register_ = kInvalidAssignment;
174
- ConvertOperands();
175
- }
176
-
177
-
178
- bool LiveRange::HasAllocatedSpillOperand() const {
179
- return spill_operand_ != NULL && !spill_operand_->IsUnallocated();
180
- }
181
-
182
-
183
- void LiveRange::SetSpillOperand(LOperand* operand) {
184
- ASSERT(!operand->IsUnallocated());
185
- ASSERT(spill_operand_ != NULL);
186
- ASSERT(spill_operand_->IsUnallocated());
187
- spill_operand_->ConvertTo(operand->kind(), operand->index());
188
- }
189
-
190
-
191
- UsePosition* LiveRange::NextUsePosition(LifetimePosition start) {
192
- UsePosition* use_pos = last_processed_use_;
193
- if (use_pos == NULL) use_pos = first_pos();
194
- while (use_pos != NULL && use_pos->pos().Value() < start.Value()) {
195
- use_pos = use_pos->next();
196
- }
197
- last_processed_use_ = use_pos;
198
- return use_pos;
199
- }
200
-
201
-
202
- UsePosition* LiveRange::NextUsePositionRegisterIsBeneficial(
203
- LifetimePosition start) {
204
- UsePosition* pos = NextUsePosition(start);
205
- while (pos != NULL && !pos->RegisterIsBeneficial()) {
206
- pos = pos->next();
207
- }
208
- return pos;
209
- }
210
-
211
-
212
- UsePosition* LiveRange::NextRegisterPosition(LifetimePosition start) {
213
- UsePosition* pos = NextUsePosition(start);
214
- while (pos != NULL && !pos->RequiresRegister()) {
215
- pos = pos->next();
216
- }
217
- return pos;
218
- }
219
-
220
-
221
- bool LiveRange::CanBeSpilled(LifetimePosition pos) {
222
- // TODO(kmillikin): Comment. Now.
223
- if (pos.Value() <= Start().Value() && HasRegisterAssigned()) return false;
224
-
225
- // We cannot spill a live range that has a use requiring a register
226
- // at the current or the immediate next position.
227
- UsePosition* use_pos = NextRegisterPosition(pos);
228
- if (use_pos == NULL) return true;
229
- return use_pos->pos().Value() > pos.NextInstruction().Value();
230
- }
231
-
232
-
233
- UsePosition* LiveRange::FirstPosWithHint() const {
234
- UsePosition* pos = first_pos_;
235
- while (pos != NULL && !pos->HasHint()) pos = pos->next();
236
- return pos;
237
- }
238
-
239
-
240
- LOperand* LiveRange::CreateAssignedOperand() {
241
- LOperand* op = NULL;
242
- if (HasRegisterAssigned()) {
243
- ASSERT(!IsSpilled());
244
- if (IsDouble()) {
245
- op = LDoubleRegister::Create(assigned_register());
246
- } else {
247
- op = LRegister::Create(assigned_register());
248
- }
249
- } else if (IsSpilled()) {
250
- ASSERT(!HasRegisterAssigned());
251
- op = TopLevel()->GetSpillOperand();
252
- ASSERT(!op->IsUnallocated());
253
- } else {
254
- LUnallocated* unalloc = new LUnallocated(LUnallocated::NONE);
255
- unalloc->set_virtual_register(id_);
256
- op = unalloc;
257
- }
258
- return op;
259
- }
260
-
261
-
262
- UseInterval* LiveRange::FirstSearchIntervalForPosition(
263
- LifetimePosition position) const {
264
- if (current_interval_ == NULL) return first_interval_;
265
- if (current_interval_->start().Value() > position.Value()) {
266
- current_interval_ = NULL;
267
- return first_interval_;
268
- }
269
- return current_interval_;
270
- }
271
-
272
-
273
- void LiveRange::AdvanceLastProcessedMarker(
274
- UseInterval* to_start_of, LifetimePosition but_not_past) const {
275
- if (to_start_of == NULL) return;
276
- if (to_start_of->start().Value() > but_not_past.Value()) return;
277
- LifetimePosition start =
278
- current_interval_ == NULL ? LifetimePosition::Invalid()
279
- : current_interval_->start();
280
- if (to_start_of->start().Value() > start.Value()) {
281
- current_interval_ = to_start_of;
282
- }
283
- }
284
-
285
-
286
- void LiveRange::SplitAt(LifetimePosition position, LiveRange* result) {
287
- ASSERT(Start().Value() < position.Value());
288
- ASSERT(result->IsEmpty());
289
- // Find the last interval that ends before the position. If the
290
- // position is contained in one of the intervals in the chain, we
291
- // split that interval and use the first part.
292
- UseInterval* current = FirstSearchIntervalForPosition(position);
293
-
294
- // If the split position coincides with the beginning of a use interval
295
- // we need to split use positons in a special way.
296
- bool split_at_start = false;
297
-
298
- while (current != NULL) {
299
- if (current->Contains(position)) {
300
- current->SplitAt(position);
301
- break;
302
- }
303
- UseInterval* next = current->next();
304
- if (next->start().Value() >= position.Value()) {
305
- split_at_start = (next->start().Value() == position.Value());
306
- break;
307
- }
308
- current = next;
309
- }
310
-
311
- // Partition original use intervals to the two live ranges.
312
- UseInterval* before = current;
313
- UseInterval* after = before->next();
314
- result->last_interval_ = (last_interval_ == before)
315
- ? after // Only interval in the range after split.
316
- : last_interval_; // Last interval of the original range.
317
- result->first_interval_ = after;
318
- last_interval_ = before;
319
-
320
- // Find the last use position before the split and the first use
321
- // position after it.
322
- UsePosition* use_after = first_pos_;
323
- UsePosition* use_before = NULL;
324
- if (split_at_start) {
325
- // The split position coincides with the beginning of a use interval (the
326
- // end of a lifetime hole). Use at this position should be attributed to
327
- // the split child because split child owns use interval covering it.
328
- while (use_after != NULL && use_after->pos().Value() < position.Value()) {
329
- use_before = use_after;
330
- use_after = use_after->next();
331
- }
332
- } else {
333
- while (use_after != NULL && use_after->pos().Value() <= position.Value()) {
334
- use_before = use_after;
335
- use_after = use_after->next();
336
- }
337
- }
338
-
339
- // Partition original use positions to the two live ranges.
340
- if (use_before != NULL) {
341
- use_before->next_ = NULL;
342
- } else {
343
- first_pos_ = NULL;
344
- }
345
- result->first_pos_ = use_after;
346
-
347
- // Link the new live range in the chain before any of the other
348
- // ranges linked from the range before the split.
349
- result->parent_ = (parent_ == NULL) ? this : parent_;
350
- result->next_ = next_;
351
- next_ = result;
352
-
353
- #ifdef DEBUG
354
- Verify();
355
- result->Verify();
356
- #endif
357
- }
358
-
359
-
360
- // This implements an ordering on live ranges so that they are ordered by their
361
- // start positions. This is needed for the correctness of the register
362
- // allocation algorithm. If two live ranges start at the same offset then there
363
- // is a tie breaker based on where the value is first used. This part of the
364
- // ordering is merely a heuristic.
365
- bool LiveRange::ShouldBeAllocatedBefore(const LiveRange* other) const {
366
- LifetimePosition start = Start();
367
- LifetimePosition other_start = other->Start();
368
- if (start.Value() == other_start.Value()) {
369
- UsePosition* pos = FirstPosWithHint();
370
- if (pos == NULL) return false;
371
- UsePosition* other_pos = other->first_pos();
372
- if (other_pos == NULL) return true;
373
- return pos->pos().Value() < other_pos->pos().Value();
374
- }
375
- return start.Value() < other_start.Value();
376
- }
377
-
378
-
379
- void LiveRange::ShortenTo(LifetimePosition start) {
380
- LAllocator::TraceAlloc("Shorten live range %d to [%d\n", id_, start.Value());
381
- ASSERT(first_interval_ != NULL);
382
- ASSERT(first_interval_->start().Value() <= start.Value());
383
- ASSERT(start.Value() < first_interval_->end().Value());
384
- first_interval_->set_start(start);
385
- }
386
-
387
-
388
- void LiveRange::EnsureInterval(LifetimePosition start, LifetimePosition end) {
389
- LAllocator::TraceAlloc("Ensure live range %d in interval [%d %d[\n",
390
- id_,
391
- start.Value(),
392
- end.Value());
393
- LifetimePosition new_end = end;
394
- while (first_interval_ != NULL &&
395
- first_interval_->start().Value() <= end.Value()) {
396
- if (first_interval_->end().Value() > end.Value()) {
397
- new_end = first_interval_->end();
398
- }
399
- first_interval_ = first_interval_->next();
400
- }
401
-
402
- UseInterval* new_interval = new UseInterval(start, new_end);
403
- new_interval->next_ = first_interval_;
404
- first_interval_ = new_interval;
405
- if (new_interval->next() == NULL) {
406
- last_interval_ = new_interval;
407
- }
408
- }
409
-
410
-
411
- void LiveRange::AddUseInterval(LifetimePosition start, LifetimePosition end) {
412
- LAllocator::TraceAlloc("Add to live range %d interval [%d %d[\n",
413
- id_,
414
- start.Value(),
415
- end.Value());
416
- if (first_interval_ == NULL) {
417
- UseInterval* interval = new UseInterval(start, end);
418
- first_interval_ = interval;
419
- last_interval_ = interval;
420
- } else {
421
- if (end.Value() == first_interval_->start().Value()) {
422
- first_interval_->set_start(start);
423
- } else if (end.Value() < first_interval_->start().Value()) {
424
- UseInterval* interval = new UseInterval(start, end);
425
- interval->set_next(first_interval_);
426
- first_interval_ = interval;
427
- } else {
428
- // Order of instruction's processing (see ProcessInstructions) guarantees
429
- // that each new use interval either precedes or intersects with
430
- // last added interval.
431
- ASSERT(start.Value() < first_interval_->end().Value());
432
- first_interval_->start_ = Min(start, first_interval_->start_);
433
- first_interval_->end_ = Max(end, first_interval_->end_);
434
- }
435
- }
436
- }
437
-
438
-
439
- UsePosition* LiveRange::AddUsePosition(LifetimePosition pos,
440
- LOperand* operand) {
441
- LAllocator::TraceAlloc("Add to live range %d use position %d\n",
442
- id_,
443
- pos.Value());
444
- UsePosition* use_pos = new UsePosition(pos, operand);
445
- UsePosition* prev = NULL;
446
- UsePosition* current = first_pos_;
447
- while (current != NULL && current->pos().Value() < pos.Value()) {
448
- prev = current;
449
- current = current->next();
450
- }
451
-
452
- if (prev == NULL) {
453
- use_pos->set_next(first_pos_);
454
- first_pos_ = use_pos;
455
- } else {
456
- use_pos->next_ = prev->next_;
457
- prev->next_ = use_pos;
458
- }
459
-
460
- return use_pos;
461
- }
462
-
463
-
464
- void LiveRange::ConvertOperands() {
465
- LOperand* op = CreateAssignedOperand();
466
- UsePosition* use_pos = first_pos();
467
- while (use_pos != NULL) {
468
- ASSERT(Start().Value() <= use_pos->pos().Value() &&
469
- use_pos->pos().Value() <= End().Value());
470
-
471
- if (use_pos->HasOperand()) {
472
- ASSERT(op->IsRegister() || op->IsDoubleRegister() ||
473
- !use_pos->RequiresRegister());
474
- use_pos->operand()->ConvertTo(op->kind(), op->index());
475
- }
476
- use_pos = use_pos->next();
477
- }
478
- }
479
-
480
-
481
- bool LiveRange::CanCover(LifetimePosition position) const {
482
- if (IsEmpty()) return false;
483
- return Start().Value() <= position.Value() &&
484
- position.Value() < End().Value();
485
- }
486
-
487
-
488
- bool LiveRange::Covers(LifetimePosition position) {
489
- if (!CanCover(position)) return false;
490
- UseInterval* start_search = FirstSearchIntervalForPosition(position);
491
- for (UseInterval* interval = start_search;
492
- interval != NULL;
493
- interval = interval->next()) {
494
- ASSERT(interval->next() == NULL ||
495
- interval->next()->start().Value() >= interval->start().Value());
496
- AdvanceLastProcessedMarker(interval, position);
497
- if (interval->Contains(position)) return true;
498
- if (interval->start().Value() > position.Value()) return false;
499
- }
500
- return false;
501
- }
502
-
503
-
504
- LifetimePosition LiveRange::FirstIntersection(LiveRange* other) {
505
- UseInterval* b = other->first_interval();
506
- if (b == NULL) return LifetimePosition::Invalid();
507
- LifetimePosition advance_last_processed_up_to = b->start();
508
- UseInterval* a = FirstSearchIntervalForPosition(b->start());
509
- while (a != NULL && b != NULL) {
510
- if (a->start().Value() > other->End().Value()) break;
511
- if (b->start().Value() > End().Value()) break;
512
- LifetimePosition cur_intersection = a->Intersect(b);
513
- if (cur_intersection.IsValid()) {
514
- return cur_intersection;
515
- }
516
- if (a->start().Value() < b->start().Value()) {
517
- a = a->next();
518
- if (a == NULL || a->start().Value() > other->End().Value()) break;
519
- AdvanceLastProcessedMarker(a, advance_last_processed_up_to);
520
- } else {
521
- b = b->next();
522
- }
523
- }
524
- return LifetimePosition::Invalid();
525
- }
526
-
527
-
528
- void LAllocator::InitializeLivenessAnalysis() {
529
- // Initialize the live_in sets for each block to NULL.
530
- int block_count = graph_->blocks()->length();
531
- live_in_sets_.Initialize(block_count);
532
- live_in_sets_.AddBlock(NULL, block_count);
533
- }
534
-
535
-
536
- BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) {
537
- // Compute live out for the given block, except not including backward
538
- // successor edges.
539
- BitVector* live_out = new BitVector(next_virtual_register_);
540
-
541
- // Process all successor blocks.
542
- HBasicBlock* successor = block->end()->FirstSuccessor();
543
- while (successor != NULL) {
544
- // Add values live on entry to the successor. Note the successor's
545
- // live_in will not be computed yet for backwards edges.
546
- BitVector* live_in = live_in_sets_[successor->block_id()];
547
- if (live_in != NULL) live_out->Union(*live_in);
548
-
549
- // All phi input operands corresponding to this successor edge are live
550
- // out from this block.
551
- int index = successor->PredecessorIndexOf(block);
552
- const ZoneList<HPhi*>* phis = successor->phis();
553
- for (int i = 0; i < phis->length(); ++i) {
554
- HPhi* phi = phis->at(i);
555
- if (!phi->OperandAt(index)->IsConstant()) {
556
- live_out->Add(phi->OperandAt(index)->id());
557
- }
558
- }
559
-
560
- // Check if we are done with second successor.
561
- if (successor == block->end()->SecondSuccessor()) break;
562
-
563
- successor = block->end()->SecondSuccessor();
564
- }
565
-
566
- return live_out;
567
- }
568
-
569
-
570
- void LAllocator::AddInitialIntervals(HBasicBlock* block,
571
- BitVector* live_out) {
572
- // Add an interval that includes the entire block to the live range for
573
- // each live_out value.
574
- LifetimePosition start = LifetimePosition::FromInstructionIndex(
575
- block->first_instruction_index());
576
- LifetimePosition end = LifetimePosition::FromInstructionIndex(
577
- block->last_instruction_index()).NextInstruction();
578
- BitVector::Iterator iterator(live_out);
579
- while (!iterator.Done()) {
580
- int operand_index = iterator.Current();
581
- LiveRange* range = LiveRangeFor(operand_index);
582
- range->AddUseInterval(start, end);
583
- iterator.Advance();
584
- }
585
- }
586
-
587
-
588
- int LAllocator::FixedDoubleLiveRangeID(int index) {
589
- return -index - 1 - Register::kNumAllocatableRegisters;
590
- }
591
-
592
-
593
- LOperand* LAllocator::AllocateFixed(LUnallocated* operand,
594
- int pos,
595
- bool is_tagged) {
596
- TraceAlloc("Allocating fixed reg for op %d\n", operand->virtual_register());
597
- ASSERT(operand->HasFixedPolicy());
598
- if (operand->policy() == LUnallocated::FIXED_SLOT) {
599
- operand->ConvertTo(LOperand::STACK_SLOT, operand->fixed_index());
600
- } else if (operand->policy() == LUnallocated::FIXED_REGISTER) {
601
- int reg_index = operand->fixed_index();
602
- operand->ConvertTo(LOperand::REGISTER, reg_index);
603
- } else if (operand->policy() == LUnallocated::FIXED_DOUBLE_REGISTER) {
604
- int reg_index = operand->fixed_index();
605
- operand->ConvertTo(LOperand::DOUBLE_REGISTER, reg_index);
606
- } else {
607
- UNREACHABLE();
608
- }
609
- if (is_tagged) {
610
- TraceAlloc("Fixed reg is tagged at %d\n", pos);
611
- LInstruction* instr = InstructionAt(pos);
612
- if (instr->HasPointerMap()) {
613
- instr->pointer_map()->RecordPointer(operand);
614
- }
615
- }
616
- return operand;
617
- }
618
-
619
-
620
- LiveRange* LAllocator::FixedLiveRangeFor(int index) {
621
- if (index >= fixed_live_ranges_.length()) {
622
- fixed_live_ranges_.AddBlock(NULL,
623
- index - fixed_live_ranges_.length() + 1);
624
- }
625
-
626
- LiveRange* result = fixed_live_ranges_[index];
627
- if (result == NULL) {
628
- result = new LiveRange(FixedLiveRangeID(index));
629
- ASSERT(result->IsFixed());
630
- result->set_assigned_register(index, GENERAL_REGISTERS);
631
- fixed_live_ranges_[index] = result;
632
- }
633
- return result;
634
- }
635
-
636
-
637
- LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) {
638
- if (index >= fixed_double_live_ranges_.length()) {
639
- fixed_double_live_ranges_.AddBlock(NULL,
640
- index - fixed_double_live_ranges_.length() + 1);
641
- }
642
-
643
- LiveRange* result = fixed_double_live_ranges_[index];
644
- if (result == NULL) {
645
- result = new LiveRange(FixedDoubleLiveRangeID(index));
646
- ASSERT(result->IsFixed());
647
- result->set_assigned_register(index, DOUBLE_REGISTERS);
648
- fixed_double_live_ranges_[index] = result;
649
- }
650
- return result;
651
- }
652
-
653
- LiveRange* LAllocator::LiveRangeFor(int index) {
654
- if (index >= live_ranges_.length()) {
655
- live_ranges_.AddBlock(NULL, index - live_ranges_.length() + 1);
656
- }
657
- LiveRange* result = live_ranges_[index];
658
- if (result == NULL) {
659
- result = new LiveRange(index);
660
- live_ranges_[index] = result;
661
- }
662
- return result;
663
- }
664
-
665
-
666
- LGap* LAllocator::GetLastGap(HBasicBlock* block) {
667
- int last_instruction = block->last_instruction_index();
668
- int index = chunk_->NearestGapPos(last_instruction);
669
- return GapAt(index);
670
- }
671
-
672
-
673
- HPhi* LAllocator::LookupPhi(LOperand* operand) const {
674
- if (!operand->IsUnallocated()) return NULL;
675
- int index = operand->VirtualRegister();
676
- HValue* instr = graph_->LookupValue(index);
677
- if (instr != NULL && instr->IsPhi()) {
678
- return HPhi::cast(instr);
679
- }
680
- return NULL;
681
- }
682
-
683
-
684
- LiveRange* LAllocator::LiveRangeFor(LOperand* operand) {
685
- if (operand->IsUnallocated()) {
686
- return LiveRangeFor(LUnallocated::cast(operand)->virtual_register());
687
- } else if (operand->IsRegister()) {
688
- return FixedLiveRangeFor(operand->index());
689
- } else if (operand->IsDoubleRegister()) {
690
- return FixedDoubleLiveRangeFor(operand->index());
691
- } else {
692
- return NULL;
693
- }
694
- }
695
-
696
-
697
- void LAllocator::Define(LifetimePosition position,
698
- LOperand* operand,
699
- LOperand* hint) {
700
- LiveRange* range = LiveRangeFor(operand);
701
- if (range == NULL) return;
702
-
703
- if (range->IsEmpty() || range->Start().Value() > position.Value()) {
704
- // Can happen if there is a definition without use.
705
- range->AddUseInterval(position, position.NextInstruction());
706
- range->AddUsePosition(position.NextInstruction(), NULL);
707
- } else {
708
- range->ShortenTo(position);
709
- }
710
-
711
- if (operand->IsUnallocated()) {
712
- LUnallocated* unalloc_operand = LUnallocated::cast(operand);
713
- range->AddUsePosition(position, unalloc_operand)->set_hint(hint);
714
- }
715
- }
716
-
717
-
718
- void LAllocator::Use(LifetimePosition block_start,
719
- LifetimePosition position,
720
- LOperand* operand,
721
- LOperand* hint) {
722
- LiveRange* range = LiveRangeFor(operand);
723
- if (range == NULL) return;
724
- if (operand->IsUnallocated()) {
725
- LUnallocated* unalloc_operand = LUnallocated::cast(operand);
726
- range->AddUsePosition(position, unalloc_operand)->set_hint(hint);
727
- }
728
- range->AddUseInterval(block_start, position);
729
- }
730
-
731
-
732
- void LAllocator::AddConstraintsGapMove(int index,
733
- LOperand* from,
734
- LOperand* to) {
735
- LGap* gap = GapAt(index);
736
- LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
737
- if (from->IsUnallocated()) {
738
- const ZoneList<LMoveOperands>* move_operands = move->move_operands();
739
- for (int i = 0; i < move_operands->length(); ++i) {
740
- LMoveOperands cur = move_operands->at(i);
741
- LOperand* cur_to = cur.destination();
742
- if (cur_to->IsUnallocated()) {
743
- if (cur_to->VirtualRegister() == from->VirtualRegister()) {
744
- move->AddMove(cur.source(), to);
745
- return;
746
- }
747
- }
748
- }
749
- }
750
- move->AddMove(from, to);
751
- }
752
-
753
-
754
- void LAllocator::MeetRegisterConstraints(HBasicBlock* block) {
755
- int start = block->first_instruction_index();
756
- int end = block->last_instruction_index();
757
- for (int i = start; i <= end; ++i) {
758
- if (IsGapAt(i)) {
759
- LInstruction* instr = NULL;
760
- LInstruction* prev_instr = NULL;
761
- if (i < end) instr = InstructionAt(i + 1);
762
- if (i > start) prev_instr = InstructionAt(i - 1);
763
- MeetConstraintsBetween(prev_instr, instr, i);
764
- }
765
- }
766
- }
767
-
768
-
769
- void LAllocator::MeetConstraintsBetween(LInstruction* first,
770
- LInstruction* second,
771
- int gap_index) {
772
- // Handle fixed temporaries.
773
- if (first != NULL) {
774
- for (TempIterator it(first); it.HasNext(); it.Advance()) {
775
- LUnallocated* temp = LUnallocated::cast(it.Next());
776
- if (temp->HasFixedPolicy()) {
777
- AllocateFixed(temp, gap_index - 1, false);
778
- }
779
- }
780
- }
781
-
782
- // Handle fixed output operand.
783
- if (first != NULL && first->Output() != NULL) {
784
- LUnallocated* first_output = LUnallocated::cast(first->Output());
785
- LiveRange* range = LiveRangeFor(first_output->VirtualRegister());
786
- bool assigned = false;
787
- if (first_output->HasFixedPolicy()) {
788
- LUnallocated* output_copy = first_output->CopyUnconstrained();
789
- bool is_tagged = HasTaggedValue(first_output->VirtualRegister());
790
- AllocateFixed(first_output, gap_index, is_tagged);
791
-
792
- // This value is produced on the stack, we never need to spill it.
793
- if (first_output->IsStackSlot()) {
794
- range->SetSpillOperand(first_output);
795
- range->SetSpillStartIndex(gap_index - 1);
796
- assigned = true;
797
- }
798
- chunk_->AddGapMove(gap_index, first_output, output_copy);
799
- }
800
-
801
- if (!assigned) {
802
- range->SetSpillStartIndex(gap_index);
803
-
804
- // This move to spill operand is not a real use. Liveness analysis
805
- // and splitting of live ranges do not account for it.
806
- // Thus it should be inserted to a lifetime position corresponding to
807
- // the instruction end.
808
- LGap* gap = GapAt(gap_index);
809
- LParallelMove* move = gap->GetOrCreateParallelMove(LGap::BEFORE);
810
- move->AddMove(first_output, range->GetSpillOperand());
811
- }
812
- }
813
-
814
- // Handle fixed input operands of second instruction.
815
- if (second != NULL) {
816
- for (UseIterator it(second); it.HasNext(); it.Advance()) {
817
- LUnallocated* cur_input = LUnallocated::cast(it.Next());
818
- if (cur_input->HasFixedPolicy()) {
819
- LUnallocated* input_copy = cur_input->CopyUnconstrained();
820
- bool is_tagged = HasTaggedValue(cur_input->VirtualRegister());
821
- AllocateFixed(cur_input, gap_index + 1, is_tagged);
822
- AddConstraintsGapMove(gap_index, input_copy, cur_input);
823
- } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) {
824
- // The live range of writable input registers always goes until the end
825
- // of the instruction.
826
- ASSERT(!cur_input->IsUsedAtStart());
827
-
828
- LUnallocated* input_copy = cur_input->CopyUnconstrained();
829
- cur_input->set_virtual_register(next_virtual_register_++);
830
-
831
- if (RequiredRegisterKind(input_copy->virtual_register()) ==
832
- DOUBLE_REGISTERS) {
833
- double_artificial_registers_.Add(
834
- cur_input->virtual_register() - first_artificial_register_);
835
- }
836
-
837
- AddConstraintsGapMove(gap_index, input_copy, cur_input);
838
- }
839
- }
840
- }
841
-
842
- // Handle "output same as input" for second instruction.
843
- if (second != NULL && second->Output() != NULL) {
844
- LUnallocated* second_output = LUnallocated::cast(second->Output());
845
- if (second_output->HasSameAsInputPolicy()) {
846
- LUnallocated* cur_input = LUnallocated::cast(second->FirstInput());
847
- int output_vreg = second_output->VirtualRegister();
848
- int input_vreg = cur_input->VirtualRegister();
849
-
850
- LUnallocated* input_copy = cur_input->CopyUnconstrained();
851
- cur_input->set_virtual_register(second_output->virtual_register());
852
- AddConstraintsGapMove(gap_index, input_copy, cur_input);
853
-
854
- if (HasTaggedValue(input_vreg) && !HasTaggedValue(output_vreg)) {
855
- int index = gap_index + 1;
856
- LInstruction* instr = InstructionAt(index);
857
- if (instr->HasPointerMap()) {
858
- instr->pointer_map()->RecordPointer(input_copy);
859
- }
860
- } else if (!HasTaggedValue(input_vreg) && HasTaggedValue(output_vreg)) {
861
- // The input is assumed to immediately have a tagged representation,
862
- // before the pointer map can be used. I.e. the pointer map at the
863
- // instruction will include the output operand (whose value at the
864
- // beginning of the instruction is equal to the input operand). If
865
- // this is not desired, then the pointer map at this instruction needs
866
- // to be adjusted manually.
867
- }
868
- }
869
- }
870
- }
871
-
872
-
873
- void LAllocator::ProcessInstructions(HBasicBlock* block, BitVector* live) {
874
- int block_start = block->first_instruction_index();
875
- int index = block->last_instruction_index();
876
-
877
- LifetimePosition block_start_position =
878
- LifetimePosition::FromInstructionIndex(block_start);
879
-
880
- while (index >= block_start) {
881
- LifetimePosition curr_position =
882
- LifetimePosition::FromInstructionIndex(index);
883
-
884
- if (IsGapAt(index)) {
885
- // We have a gap at this position.
886
- LGap* gap = GapAt(index);
887
- LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
888
- const ZoneList<LMoveOperands>* move_operands = move->move_operands();
889
- for (int i = 0; i < move_operands->length(); ++i) {
890
- LMoveOperands* cur = &move_operands->at(i);
891
- if (cur->IsIgnored()) continue;
892
- LOperand* from = cur->source();
893
- LOperand* to = cur->destination();
894
- HPhi* phi = LookupPhi(to);
895
- LOperand* hint = to;
896
- if (phi != NULL) {
897
- // This is a phi resolving move.
898
- if (!phi->block()->IsLoopHeader()) {
899
- hint = LiveRangeFor(phi->id())->FirstHint();
900
- }
901
- } else {
902
- if (to->IsUnallocated()) {
903
- if (live->Contains(to->VirtualRegister())) {
904
- Define(curr_position, to, from);
905
- live->Remove(to->VirtualRegister());
906
- } else {
907
- cur->Eliminate();
908
- continue;
909
- }
910
- } else {
911
- Define(curr_position, to, from);
912
- }
913
- }
914
- Use(block_start_position, curr_position, from, hint);
915
- if (from->IsUnallocated()) {
916
- live->Add(from->VirtualRegister());
917
- }
918
- }
919
- } else {
920
- ASSERT(!IsGapAt(index));
921
- LInstruction* instr = InstructionAt(index);
922
-
923
- if (instr != NULL) {
924
- LOperand* output = instr->Output();
925
- if (output != NULL) {
926
- if (output->IsUnallocated()) live->Remove(output->VirtualRegister());
927
- Define(curr_position, output, NULL);
928
- }
929
-
930
- if (instr->IsMarkedAsCall()) {
931
- for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) {
932
- if (output == NULL || !output->IsRegister() ||
933
- output->index() != i) {
934
- LiveRange* range = FixedLiveRangeFor(i);
935
- range->AddUseInterval(curr_position,
936
- curr_position.InstructionEnd());
937
- }
938
- }
939
- }
940
-
941
- if (instr->IsMarkedAsCall() || instr->IsMarkedAsSaveDoubles()) {
942
- for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) {
943
- if (output == NULL || !output->IsDoubleRegister() ||
944
- output->index() != i) {
945
- LiveRange* range = FixedDoubleLiveRangeFor(i);
946
- range->AddUseInterval(curr_position,
947
- curr_position.InstructionEnd());
948
- }
949
- }
950
- }
951
-
952
- for (UseIterator it(instr); it.HasNext(); it.Advance()) {
953
- LOperand* input = it.Next();
954
-
955
- LifetimePosition use_pos;
956
- if (input->IsUnallocated() &&
957
- LUnallocated::cast(input)->IsUsedAtStart()) {
958
- use_pos = curr_position;
959
- } else {
960
- use_pos = curr_position.InstructionEnd();
961
- }
962
-
963
- Use(block_start_position, use_pos, input, NULL);
964
- if (input->IsUnallocated()) live->Add(input->VirtualRegister());
965
- }
966
-
967
- for (TempIterator it(instr); it.HasNext(); it.Advance()) {
968
- LOperand* temp = it.Next();
969
- if (instr->IsMarkedAsCall()) {
970
- if (temp->IsRegister()) continue;
971
- if (temp->IsUnallocated()) {
972
- LUnallocated* temp_unalloc = LUnallocated::cast(temp);
973
- if (temp_unalloc->HasFixedPolicy()) {
974
- continue;
975
- }
976
- }
977
- }
978
- Use(block_start_position, curr_position.InstructionEnd(), temp, NULL);
979
- Define(curr_position, temp, NULL);
980
- }
981
- }
982
- }
983
-
984
- index = index - 1;
985
- }
986
- }
987
-
988
-
989
- void LAllocator::ResolvePhis(HBasicBlock* block) {
990
- const ZoneList<HPhi*>* phis = block->phis();
991
- for (int i = 0; i < phis->length(); ++i) {
992
- HPhi* phi = phis->at(i);
993
- LUnallocated* phi_operand = new LUnallocated(LUnallocated::NONE);
994
- phi_operand->set_virtual_register(phi->id());
995
- for (int j = 0; j < phi->OperandCount(); ++j) {
996
- HValue* op = phi->OperandAt(j);
997
- LOperand* operand = NULL;
998
- if (op->IsConstant() && op->EmitAtUses()) {
999
- HConstant* constant = HConstant::cast(op);
1000
- operand = chunk_->DefineConstantOperand(constant);
1001
- } else {
1002
- ASSERT(!op->EmitAtUses());
1003
- LUnallocated* unalloc = new LUnallocated(LUnallocated::NONE);
1004
- unalloc->set_virtual_register(op->id());
1005
- operand = unalloc;
1006
- }
1007
- HBasicBlock* cur_block = block->predecessors()->at(j);
1008
- // The gap move must be added without any special processing as in
1009
- // the AddConstraintsGapMove.
1010
- chunk_->AddGapMove(cur_block->last_instruction_index() - 1,
1011
- operand,
1012
- phi_operand);
1013
- }
1014
-
1015
- LiveRange* live_range = LiveRangeFor(phi->id());
1016
- LLabel* label = chunk_->GetLabel(phi->block()->block_id());
1017
- label->GetOrCreateParallelMove(LGap::START)->
1018
- AddMove(phi_operand, live_range->GetSpillOperand());
1019
- live_range->SetSpillStartIndex(phi->block()->first_instruction_index());
1020
- }
1021
- }
1022
-
1023
-
1024
- void LAllocator::Allocate(LChunk* chunk) {
1025
- ASSERT(chunk_ == NULL);
1026
- chunk_ = chunk;
1027
- MeetRegisterConstraints();
1028
- ResolvePhis();
1029
- BuildLiveRanges();
1030
- AllocateGeneralRegisters();
1031
- AllocateDoubleRegisters();
1032
- PopulatePointerMaps();
1033
- if (has_osr_entry_) ProcessOsrEntry();
1034
- ConnectRanges();
1035
- ResolveControlFlow();
1036
- }
1037
-
1038
-
1039
- void LAllocator::MeetRegisterConstraints() {
1040
- HPhase phase("Register constraints", chunk_);
1041
- first_artificial_register_ = next_virtual_register_;
1042
- const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
1043
- for (int i = 0; i < blocks->length(); ++i) {
1044
- HBasicBlock* block = blocks->at(i);
1045
- MeetRegisterConstraints(block);
1046
- }
1047
- }
1048
-
1049
-
1050
- void LAllocator::ResolvePhis() {
1051
- HPhase phase("Resolve phis", chunk_);
1052
-
1053
- // Process the blocks in reverse order.
1054
- const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
1055
- for (int block_id = blocks->length() - 1; block_id >= 0; --block_id) {
1056
- HBasicBlock* block = blocks->at(block_id);
1057
- ResolvePhis(block);
1058
- }
1059
- }
1060
-
1061
-
1062
- void LAllocator::ResolveControlFlow(LiveRange* range,
1063
- HBasicBlock* block,
1064
- HBasicBlock* pred) {
1065
- LifetimePosition pred_end =
1066
- LifetimePosition::FromInstructionIndex(pred->last_instruction_index());
1067
- LifetimePosition cur_start =
1068
- LifetimePosition::FromInstructionIndex(block->first_instruction_index());
1069
- LiveRange* pred_cover = NULL;
1070
- LiveRange* cur_cover = NULL;
1071
- LiveRange* cur_range = range;
1072
- while (cur_range != NULL && (cur_cover == NULL || pred_cover == NULL)) {
1073
- if (cur_range->CanCover(cur_start)) {
1074
- ASSERT(cur_cover == NULL);
1075
- cur_cover = cur_range;
1076
- }
1077
- if (cur_range->CanCover(pred_end)) {
1078
- ASSERT(pred_cover == NULL);
1079
- pred_cover = cur_range;
1080
- }
1081
- cur_range = cur_range->next();
1082
- }
1083
-
1084
- if (cur_cover->IsSpilled()) return;
1085
- ASSERT(pred_cover != NULL && cur_cover != NULL);
1086
- if (pred_cover != cur_cover) {
1087
- LOperand* pred_op = pred_cover->CreateAssignedOperand();
1088
- LOperand* cur_op = cur_cover->CreateAssignedOperand();
1089
- if (!pred_op->Equals(cur_op)) {
1090
- LGap* gap = NULL;
1091
- if (block->predecessors()->length() == 1) {
1092
- gap = GapAt(block->first_instruction_index());
1093
- } else {
1094
- ASSERT(pred->end()->SecondSuccessor() == NULL);
1095
- gap = GetLastGap(pred);
1096
-
1097
- // We are going to insert a move before the branch instruction.
1098
- // Some branch instructions (e.g. loops' back edges)
1099
- // can potentially cause a GC so they have a pointer map.
1100
- // By insterting a move we essentially create a copy of a
1101
- // value which is invisible to PopulatePointerMaps(), because we store
1102
- // it into a location different from the operand of a live range
1103
- // covering a branch instruction.
1104
- // Thus we need to manually record a pointer.
1105
- if (HasTaggedValue(range->id())) {
1106
- LInstruction* branch = InstructionAt(pred->last_instruction_index());
1107
- if (branch->HasPointerMap()) {
1108
- branch->pointer_map()->RecordPointer(cur_op);
1109
- }
1110
- }
1111
- }
1112
- gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op);
1113
- }
1114
- }
1115
- }
1116
-
1117
-
1118
- LParallelMove* LAllocator::GetConnectingParallelMove(LifetimePosition pos) {
1119
- int index = pos.InstructionIndex();
1120
- if (IsGapAt(index)) {
1121
- LGap* gap = GapAt(index);
1122
- return gap->GetOrCreateParallelMove(
1123
- pos.IsInstructionStart() ? LGap::START : LGap::END);
1124
- }
1125
- int gap_pos = pos.IsInstructionStart() ? (index - 1) : (index + 1);
1126
- return GapAt(gap_pos)->GetOrCreateParallelMove(
1127
- (gap_pos < index) ? LGap::AFTER : LGap::BEFORE);
1128
- }
1129
-
1130
-
1131
- HBasicBlock* LAllocator::GetBlock(LifetimePosition pos) {
1132
- LGap* gap = GapAt(chunk_->NearestGapPos(pos.InstructionIndex()));
1133
- return gap->block();
1134
- }
1135
-
1136
-
1137
- void LAllocator::ConnectRanges() {
1138
- HPhase phase("Connect ranges", this);
1139
- for (int i = 0; i < live_ranges()->length(); ++i) {
1140
- LiveRange* first_range = live_ranges()->at(i);
1141
- if (first_range == NULL || first_range->parent() != NULL) continue;
1142
-
1143
- LiveRange* second_range = first_range->next();
1144
- while (second_range != NULL) {
1145
- LifetimePosition pos = second_range->Start();
1146
-
1147
- if (!second_range->IsSpilled()) {
1148
- // Add gap move if the two live ranges touch and there is no block
1149
- // boundary.
1150
- if (first_range->End().Value() == pos.Value()) {
1151
- bool should_insert = true;
1152
- if (IsBlockBoundary(pos)) {
1153
- should_insert = CanEagerlyResolveControlFlow(GetBlock(pos));
1154
- }
1155
- if (should_insert) {
1156
- LParallelMove* move = GetConnectingParallelMove(pos);
1157
- LOperand* prev_operand = first_range->CreateAssignedOperand();
1158
- LOperand* cur_operand = second_range->CreateAssignedOperand();
1159
- move->AddMove(prev_operand, cur_operand);
1160
- }
1161
- }
1162
- }
1163
-
1164
- first_range = second_range;
1165
- second_range = second_range->next();
1166
- }
1167
- }
1168
- }
1169
-
1170
-
1171
- bool LAllocator::CanEagerlyResolveControlFlow(HBasicBlock* block) const {
1172
- if (block->predecessors()->length() != 1) return false;
1173
- return block->predecessors()->first()->block_id() == block->block_id() - 1;
1174
- }
1175
-
1176
-
1177
- void LAllocator::ResolveControlFlow() {
1178
- HPhase phase("Resolve control flow", this);
1179
- const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
1180
- for (int block_id = 1; block_id < blocks->length(); ++block_id) {
1181
- HBasicBlock* block = blocks->at(block_id);
1182
- if (CanEagerlyResolveControlFlow(block)) continue;
1183
- BitVector* live = live_in_sets_[block->block_id()];
1184
- BitVector::Iterator iterator(live);
1185
- while (!iterator.Done()) {
1186
- int operand_index = iterator.Current();
1187
- for (int i = 0; i < block->predecessors()->length(); ++i) {
1188
- HBasicBlock* cur = block->predecessors()->at(i);
1189
- LiveRange* cur_range = LiveRangeFor(operand_index);
1190
- ResolveControlFlow(cur_range, block, cur);
1191
- }
1192
- iterator.Advance();
1193
- }
1194
- }
1195
- }
1196
-
1197
-
1198
- void LAllocator::BuildLiveRanges() {
1199
- HPhase phase("Build live ranges", this);
1200
- InitializeLivenessAnalysis();
1201
- // Process the blocks in reverse order.
1202
- const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
1203
- for (int block_id = blocks->length() - 1; block_id >= 0; --block_id) {
1204
- HBasicBlock* block = blocks->at(block_id);
1205
- BitVector* live = ComputeLiveOut(block);
1206
- // Initially consider all live_out values live for the entire block. We
1207
- // will shorten these intervals if necessary.
1208
- AddInitialIntervals(block, live);
1209
-
1210
- // Process the instructions in reverse order, generating and killing
1211
- // live values.
1212
- ProcessInstructions(block, live);
1213
- // All phi output operands are killed by this block.
1214
- const ZoneList<HPhi*>* phis = block->phis();
1215
- for (int i = 0; i < phis->length(); ++i) {
1216
- // The live range interval already ends at the first instruction of the
1217
- // block.
1218
- HPhi* phi = phis->at(i);
1219
- live->Remove(phi->id());
1220
-
1221
- LOperand* hint = NULL;
1222
- LOperand* phi_operand = NULL;
1223
- LGap* gap = GetLastGap(phi->block()->predecessors()->at(0));
1224
- LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
1225
- for (int j = 0; j < move->move_operands()->length(); ++j) {
1226
- LOperand* to = move->move_operands()->at(j).destination();
1227
- if (to->IsUnallocated() && to->VirtualRegister() == phi->id()) {
1228
- hint = move->move_operands()->at(j).source();
1229
- phi_operand = to;
1230
- break;
1231
- }
1232
- }
1233
- ASSERT(hint != NULL);
1234
-
1235
- LifetimePosition block_start = LifetimePosition::FromInstructionIndex(
1236
- block->first_instruction_index());
1237
- Define(block_start, phi_operand, hint);
1238
- }
1239
-
1240
- // Now live is live_in for this block except not including values live
1241
- // out on backward successor edges.
1242
- live_in_sets_[block_id] = live;
1243
-
1244
- // If this block is a loop header go back and patch up the necessary
1245
- // predecessor blocks.
1246
- if (block->IsLoopHeader()) {
1247
- // TODO(kmillikin): Need to be able to get the last block of the loop
1248
- // in the loop information. Add a live range stretching from the first
1249
- // loop instruction to the last for each value live on entry to the
1250
- // header.
1251
- HBasicBlock* back_edge = block->loop_information()->GetLastBackEdge();
1252
- BitVector::Iterator iterator(live);
1253
- LifetimePosition start = LifetimePosition::FromInstructionIndex(
1254
- block->first_instruction_index());
1255
- LifetimePosition end = LifetimePosition::FromInstructionIndex(
1256
- back_edge->last_instruction_index()).NextInstruction();
1257
- while (!iterator.Done()) {
1258
- int operand_index = iterator.Current();
1259
- LiveRange* range = LiveRangeFor(operand_index);
1260
- range->EnsureInterval(start, end);
1261
- iterator.Advance();
1262
- }
1263
-
1264
- for (int i = block->block_id() + 1; i <= back_edge->block_id(); ++i) {
1265
- live_in_sets_[i]->Union(*live);
1266
- }
1267
- }
1268
-
1269
- #ifdef DEBUG
1270
- if (block_id == 0) {
1271
- BitVector::Iterator iterator(live);
1272
- bool found = false;
1273
- while (!iterator.Done()) {
1274
- found = true;
1275
- int operand_index = iterator.Current();
1276
- PrintF("Function: %s\n",
1277
- *graph_->info()->function()->debug_name()->ToCString());
1278
- PrintF("Value %d used before first definition!\n", operand_index);
1279
- LiveRange* range = LiveRangeFor(operand_index);
1280
- PrintF("First use is at %d\n", range->first_pos()->pos().Value());
1281
- iterator.Advance();
1282
- }
1283
- ASSERT(!found);
1284
- }
1285
- #endif
1286
- }
1287
- }
1288
-
1289
-
1290
- bool LAllocator::SafePointsAreInOrder() const {
1291
- const ZoneList<LPointerMap*>* pointer_maps = chunk_->pointer_maps();
1292
- int safe_point = 0;
1293
- for (int i = 0; i < pointer_maps->length(); ++i) {
1294
- LPointerMap* map = pointer_maps->at(i);
1295
- if (safe_point > map->lithium_position()) return false;
1296
- safe_point = map->lithium_position();
1297
- }
1298
- return true;
1299
- }
1300
-
1301
-
1302
- void LAllocator::PopulatePointerMaps() {
1303
- HPhase phase("Populate pointer maps", this);
1304
- const ZoneList<LPointerMap*>* pointer_maps = chunk_->pointer_maps();
1305
-
1306
- ASSERT(SafePointsAreInOrder());
1307
-
1308
- // Iterate over all safe point positions and record a pointer
1309
- // for all spilled live ranges at this point.
1310
- int first_safe_point_index = 0;
1311
- int last_range_start = 0;
1312
- for (int range_idx = 0; range_idx < live_ranges()->length(); ++range_idx) {
1313
- LiveRange* range = live_ranges()->at(range_idx);
1314
- if (range == NULL) continue;
1315
- // Iterate over the first parts of multi-part live ranges.
1316
- if (range->parent() != NULL) continue;
1317
- // Skip non-pointer values.
1318
- if (!HasTaggedValue(range->id())) continue;
1319
- // Skip empty live ranges.
1320
- if (range->IsEmpty()) continue;
1321
-
1322
- // Find the extent of the range and its children.
1323
- int start = range->Start().InstructionIndex();
1324
- int end = 0;
1325
- for (LiveRange* cur = range; cur != NULL; cur = cur->next()) {
1326
- LifetimePosition this_end = cur->End();
1327
- if (this_end.InstructionIndex() > end) end = this_end.InstructionIndex();
1328
- ASSERT(cur->Start().InstructionIndex() >= start);
1329
- }
1330
-
1331
- // Most of the ranges are in order, but not all. Keep an eye on when
1332
- // they step backwards and reset the first_safe_point_index so we don't
1333
- // miss any safe points.
1334
- if (start < last_range_start) {
1335
- first_safe_point_index = 0;
1336
- }
1337
- last_range_start = start;
1338
-
1339
- // Step across all the safe points that are before the start of this range,
1340
- // recording how far we step in order to save doing this for the next range.
1341
- while (first_safe_point_index < pointer_maps->length()) {
1342
- LPointerMap* map = pointer_maps->at(first_safe_point_index);
1343
- int safe_point = map->lithium_position();
1344
- if (safe_point >= start) break;
1345
- first_safe_point_index++;
1346
- }
1347
-
1348
- // Step through the safe points to see whether they are in the range.
1349
- for (int safe_point_index = first_safe_point_index;
1350
- safe_point_index < pointer_maps->length();
1351
- ++safe_point_index) {
1352
- LPointerMap* map = pointer_maps->at(safe_point_index);
1353
- int safe_point = map->lithium_position();
1354
-
1355
- // The safe points are sorted so we can stop searching here.
1356
- if (safe_point - 1 > end) break;
1357
-
1358
- // Advance to the next active range that covers the current
1359
- // safe point position.
1360
- LifetimePosition safe_point_pos =
1361
- LifetimePosition::FromInstructionIndex(safe_point);
1362
- LiveRange* cur = range;
1363
- while (cur != NULL && !cur->Covers(safe_point_pos.PrevInstruction())) {
1364
- cur = cur->next();
1365
- }
1366
- if (cur == NULL) continue;
1367
-
1368
- // Check if the live range is spilled and the safe point is after
1369
- // the spill position.
1370
- if (range->HasAllocatedSpillOperand() &&
1371
- safe_point >= range->spill_start_index()) {
1372
- TraceAlloc("Pointer for range %d (spilled at %d) at safe point %d\n",
1373
- range->id(), range->spill_start_index(), safe_point);
1374
- map->RecordPointer(range->GetSpillOperand());
1375
- }
1376
-
1377
- if (!cur->IsSpilled()) {
1378
- TraceAlloc("Pointer in register for range %d (start at %d) "
1379
- "at safe point %d\n",
1380
- cur->id(), cur->Start().Value(), safe_point);
1381
- LOperand* operand = cur->CreateAssignedOperand();
1382
- ASSERT(!operand->IsStackSlot());
1383
- map->RecordPointer(operand);
1384
- }
1385
- }
1386
- }
1387
- }
1388
-
1389
-
1390
- void LAllocator::ProcessOsrEntry() {
1391
- const ZoneList<LInstruction*>* instrs = chunk_->instructions();
1392
-
1393
- // Linear search for the OSR entry instruction in the chunk.
1394
- int index = -1;
1395
- while (++index < instrs->length() &&
1396
- !instrs->at(index)->IsOsrEntry()) {
1397
- }
1398
- ASSERT(index < instrs->length());
1399
- LOsrEntry* instruction = LOsrEntry::cast(instrs->at(index));
1400
-
1401
- LifetimePosition position = LifetimePosition::FromInstructionIndex(index);
1402
- for (int i = 0; i < live_ranges()->length(); ++i) {
1403
- LiveRange* range = live_ranges()->at(i);
1404
- if (range != NULL) {
1405
- if (range->Covers(position) &&
1406
- range->HasRegisterAssigned() &&
1407
- range->TopLevel()->HasAllocatedSpillOperand()) {
1408
- int reg_index = range->assigned_register();
1409
- LOperand* spill_operand = range->TopLevel()->GetSpillOperand();
1410
- if (range->IsDouble()) {
1411
- instruction->MarkSpilledDoubleRegister(reg_index, spill_operand);
1412
- } else {
1413
- instruction->MarkSpilledRegister(reg_index, spill_operand);
1414
- }
1415
- }
1416
- }
1417
- }
1418
- }
1419
-
1420
-
1421
- void LAllocator::AllocateGeneralRegisters() {
1422
- HPhase phase("Allocate general registers", this);
1423
- num_registers_ = Register::kNumAllocatableRegisters;
1424
- mode_ = GENERAL_REGISTERS;
1425
- AllocateRegisters();
1426
- }
1427
-
1428
-
1429
- void LAllocator::AllocateDoubleRegisters() {
1430
- HPhase phase("Allocate double registers", this);
1431
- num_registers_ = DoubleRegister::kNumAllocatableRegisters;
1432
- mode_ = DOUBLE_REGISTERS;
1433
- AllocateRegisters();
1434
- }
1435
-
1436
-
1437
- void LAllocator::AllocateRegisters() {
1438
- ASSERT(mode_ != NONE);
1439
- reusable_slots_.Clear();
1440
-
1441
- for (int i = 0; i < live_ranges_.length(); ++i) {
1442
- if (live_ranges_[i] != NULL) {
1443
- if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) {
1444
- AddToUnhandledUnsorted(live_ranges_[i]);
1445
- }
1446
- }
1447
- }
1448
- SortUnhandled();
1449
- ASSERT(UnhandledIsSorted());
1450
-
1451
- ASSERT(active_live_ranges_.is_empty());
1452
- ASSERT(inactive_live_ranges_.is_empty());
1453
-
1454
- if (mode_ == DOUBLE_REGISTERS) {
1455
- for (int i = 0; i < fixed_double_live_ranges_.length(); ++i) {
1456
- LiveRange* current = fixed_double_live_ranges_.at(i);
1457
- if (current != NULL) {
1458
- AddToInactive(current);
1459
- }
1460
- }
1461
- } else {
1462
- for (int i = 0; i < fixed_live_ranges_.length(); ++i) {
1463
- LiveRange* current = fixed_live_ranges_.at(i);
1464
- if (current != NULL) {
1465
- AddToInactive(current);
1466
- }
1467
- }
1468
- }
1469
-
1470
- while (!unhandled_live_ranges_.is_empty()) {
1471
- ASSERT(UnhandledIsSorted());
1472
- LiveRange* current = unhandled_live_ranges_.RemoveLast();
1473
- ASSERT(UnhandledIsSorted());
1474
- LifetimePosition position = current->Start();
1475
- TraceAlloc("Processing interval %d start=%d\n",
1476
- current->id(),
1477
- position.Value());
1478
-
1479
- if (current->HasAllocatedSpillOperand()) {
1480
- TraceAlloc("Live range %d already has a spill operand\n", current->id());
1481
- LifetimePosition next_pos = position;
1482
- if (IsGapAt(next_pos.InstructionIndex())) {
1483
- next_pos = next_pos.NextInstruction();
1484
- }
1485
- UsePosition* pos = current->NextUsePositionRegisterIsBeneficial(next_pos);
1486
- // If the range already has a spill operand and it doesn't need a
1487
- // register immediately, split it and spill the first part of the range.
1488
- if (pos == NULL) {
1489
- Spill(current);
1490
- continue;
1491
- } else if (pos->pos().Value() >
1492
- current->Start().NextInstruction().Value()) {
1493
- // Do not spill live range eagerly if use position that can benefit from
1494
- // the register is too close to the start of live range.
1495
- SpillBetween(current, current->Start(), pos->pos());
1496
- ASSERT(UnhandledIsSorted());
1497
- continue;
1498
- }
1499
- }
1500
-
1501
- for (int i = 0; i < active_live_ranges_.length(); ++i) {
1502
- LiveRange* cur_active = active_live_ranges_.at(i);
1503
- if (cur_active->End().Value() <= position.Value()) {
1504
- ActiveToHandled(cur_active);
1505
- --i; // The live range was removed from the list of active live ranges.
1506
- } else if (!cur_active->Covers(position)) {
1507
- ActiveToInactive(cur_active);
1508
- --i; // The live range was removed from the list of active live ranges.
1509
- }
1510
- }
1511
-
1512
- for (int i = 0; i < inactive_live_ranges_.length(); ++i) {
1513
- LiveRange* cur_inactive = inactive_live_ranges_.at(i);
1514
- if (cur_inactive->End().Value() <= position.Value()) {
1515
- InactiveToHandled(cur_inactive);
1516
- --i; // Live range was removed from the list of inactive live ranges.
1517
- } else if (cur_inactive->Covers(position)) {
1518
- InactiveToActive(cur_inactive);
1519
- --i; // Live range was removed from the list of inactive live ranges.
1520
- }
1521
- }
1522
-
1523
- ASSERT(!current->HasRegisterAssigned() && !current->IsSpilled());
1524
-
1525
- bool result = TryAllocateFreeReg(current);
1526
- if (!result) {
1527
- AllocateBlockedReg(current);
1528
- }
1529
-
1530
- if (current->HasRegisterAssigned()) {
1531
- AddToActive(current);
1532
- }
1533
- }
1534
-
1535
- active_live_ranges_.Clear();
1536
- inactive_live_ranges_.Clear();
1537
- }
1538
-
1539
-
1540
- void LAllocator::Setup() {
1541
- LConstantOperand::SetupCache();
1542
- LStackSlot::SetupCache();
1543
- LDoubleStackSlot::SetupCache();
1544
- LRegister::SetupCache();
1545
- LDoubleRegister::SetupCache();
1546
- }
1547
-
1548
-
1549
- const char* LAllocator::RegisterName(int allocation_index) {
1550
- ASSERT(mode_ != NONE);
1551
- if (mode_ == GENERAL_REGISTERS) {
1552
- return Register::AllocationIndexToString(allocation_index);
1553
- } else {
1554
- return DoubleRegister::AllocationIndexToString(allocation_index);
1555
- }
1556
- }
1557
-
1558
-
1559
- void LAllocator::TraceAlloc(const char* msg, ...) {
1560
- if (FLAG_trace_alloc) {
1561
- va_list arguments;
1562
- va_start(arguments, msg);
1563
- OS::VPrint(msg, arguments);
1564
- va_end(arguments);
1565
- }
1566
- }
1567
-
1568
-
1569
- bool LAllocator::HasTaggedValue(int virtual_register) const {
1570
- HValue* value = graph_->LookupValue(virtual_register);
1571
- if (value == NULL) return false;
1572
- return value->representation().IsTagged();
1573
- }
1574
-
1575
-
1576
- RegisterKind LAllocator::RequiredRegisterKind(int virtual_register) const {
1577
- if (virtual_register < first_artificial_register_) {
1578
- HValue* value = graph_->LookupValue(virtual_register);
1579
- if (value != NULL && value->representation().IsDouble()) {
1580
- return DOUBLE_REGISTERS;
1581
- }
1582
- } else if (double_artificial_registers_.Contains(
1583
- virtual_register - first_artificial_register_)) {
1584
- return DOUBLE_REGISTERS;
1585
- }
1586
-
1587
- return GENERAL_REGISTERS;
1588
- }
1589
-
1590
-
1591
- void LAllocator::RecordDefinition(HInstruction* instr, LUnallocated* operand) {
1592
- operand->set_virtual_register(instr->id());
1593
- }
1594
-
1595
-
1596
- void LAllocator::RecordTemporary(LUnallocated* operand) {
1597
- ASSERT(next_virtual_register_ < LUnallocated::kMaxVirtualRegisters);
1598
- if (!operand->HasFixedPolicy()) {
1599
- operand->set_virtual_register(next_virtual_register_++);
1600
- }
1601
- }
1602
-
1603
-
1604
- void LAllocator::RecordUse(HValue* value, LUnallocated* operand) {
1605
- operand->set_virtual_register(value->id());
1606
- }
1607
-
1608
-
1609
- int LAllocator::max_initial_value_ids() {
1610
- return LUnallocated::kMaxVirtualRegisters / 32;
1611
- }
1612
-
1613
-
1614
- void LAllocator::AddToActive(LiveRange* range) {
1615
- TraceAlloc("Add live range %d to active\n", range->id());
1616
- active_live_ranges_.Add(range);
1617
- }
1618
-
1619
-
1620
- void LAllocator::AddToInactive(LiveRange* range) {
1621
- TraceAlloc("Add live range %d to inactive\n", range->id());
1622
- inactive_live_ranges_.Add(range);
1623
- }
1624
-
1625
-
1626
- void LAllocator::AddToUnhandledSorted(LiveRange* range) {
1627
- if (range == NULL || range->IsEmpty()) return;
1628
- ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1629
- for (int i = unhandled_live_ranges_.length() - 1; i >= 0; --i) {
1630
- LiveRange* cur_range = unhandled_live_ranges_.at(i);
1631
- if (range->ShouldBeAllocatedBefore(cur_range)) {
1632
- TraceAlloc("Add live range %d to unhandled at %d\n", range->id(), i + 1);
1633
- unhandled_live_ranges_.InsertAt(i + 1, range);
1634
- ASSERT(UnhandledIsSorted());
1635
- return;
1636
- }
1637
- }
1638
- TraceAlloc("Add live range %d to unhandled at start\n", range->id());
1639
- unhandled_live_ranges_.InsertAt(0, range);
1640
- ASSERT(UnhandledIsSorted());
1641
- }
1642
-
1643
-
1644
- void LAllocator::AddToUnhandledUnsorted(LiveRange* range) {
1645
- if (range == NULL || range->IsEmpty()) return;
1646
- ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1647
- TraceAlloc("Add live range %d to unhandled unsorted at end\n", range->id());
1648
- unhandled_live_ranges_.Add(range);
1649
- }
1650
-
1651
-
1652
- static int UnhandledSortHelper(LiveRange* const* a, LiveRange* const* b) {
1653
- ASSERT(!(*a)->ShouldBeAllocatedBefore(*b) ||
1654
- !(*b)->ShouldBeAllocatedBefore(*a));
1655
- if ((*a)->ShouldBeAllocatedBefore(*b)) return 1;
1656
- if ((*b)->ShouldBeAllocatedBefore(*a)) return -1;
1657
- return (*a)->id() - (*b)->id();
1658
- }
1659
-
1660
-
1661
- // Sort the unhandled live ranges so that the ranges to be processed first are
1662
- // at the end of the array list. This is convenient for the register allocation
1663
- // algorithm because it is efficient to remove elements from the end.
1664
- void LAllocator::SortUnhandled() {
1665
- TraceAlloc("Sort unhandled\n");
1666
- unhandled_live_ranges_.Sort(&UnhandledSortHelper);
1667
- }
1668
-
1669
-
1670
- bool LAllocator::UnhandledIsSorted() {
1671
- int len = unhandled_live_ranges_.length();
1672
- for (int i = 1; i < len; i++) {
1673
- LiveRange* a = unhandled_live_ranges_.at(i - 1);
1674
- LiveRange* b = unhandled_live_ranges_.at(i);
1675
- if (a->Start().Value() < b->Start().Value()) return false;
1676
- }
1677
- return true;
1678
- }
1679
-
1680
-
1681
- void LAllocator::FreeSpillSlot(LiveRange* range) {
1682
- // Check that we are the last range.
1683
- if (range->next() != NULL) return;
1684
-
1685
- if (!range->TopLevel()->HasAllocatedSpillOperand()) return;
1686
-
1687
- int index = range->TopLevel()->GetSpillOperand()->index();
1688
- if (index >= 0) {
1689
- reusable_slots_.Add(range);
1690
- }
1691
- }
1692
-
1693
-
1694
- LOperand* LAllocator::TryReuseSpillSlot(LiveRange* range) {
1695
- if (reusable_slots_.is_empty()) return NULL;
1696
- if (reusable_slots_.first()->End().Value() >
1697
- range->TopLevel()->Start().Value()) {
1698
- return NULL;
1699
- }
1700
- LOperand* result = reusable_slots_.first()->TopLevel()->GetSpillOperand();
1701
- reusable_slots_.Remove(0);
1702
- return result;
1703
- }
1704
-
1705
-
1706
- void LAllocator::ActiveToHandled(LiveRange* range) {
1707
- ASSERT(active_live_ranges_.Contains(range));
1708
- active_live_ranges_.RemoveElement(range);
1709
- TraceAlloc("Moving live range %d from active to handled\n", range->id());
1710
- FreeSpillSlot(range);
1711
- }
1712
-
1713
-
1714
- void LAllocator::ActiveToInactive(LiveRange* range) {
1715
- ASSERT(active_live_ranges_.Contains(range));
1716
- active_live_ranges_.RemoveElement(range);
1717
- inactive_live_ranges_.Add(range);
1718
- TraceAlloc("Moving live range %d from active to inactive\n", range->id());
1719
- }
1720
-
1721
-
1722
- void LAllocator::InactiveToHandled(LiveRange* range) {
1723
- ASSERT(inactive_live_ranges_.Contains(range));
1724
- inactive_live_ranges_.RemoveElement(range);
1725
- TraceAlloc("Moving live range %d from inactive to handled\n", range->id());
1726
- FreeSpillSlot(range);
1727
- }
1728
-
1729
-
1730
- void LAllocator::InactiveToActive(LiveRange* range) {
1731
- ASSERT(inactive_live_ranges_.Contains(range));
1732
- inactive_live_ranges_.RemoveElement(range);
1733
- active_live_ranges_.Add(range);
1734
- TraceAlloc("Moving live range %d from inactive to active\n", range->id());
1735
- }
1736
-
1737
-
1738
- // TryAllocateFreeReg and AllocateBlockedReg assume this
1739
- // when allocating local arrays.
1740
- STATIC_ASSERT(DoubleRegister::kNumAllocatableRegisters >=
1741
- Register::kNumAllocatableRegisters);
1742
-
1743
-
1744
- bool LAllocator::TryAllocateFreeReg(LiveRange* current) {
1745
- LifetimePosition free_until_pos[DoubleRegister::kNumAllocatableRegisters];
1746
-
1747
- for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
1748
- free_until_pos[i] = LifetimePosition::MaxPosition();
1749
- }
1750
-
1751
- for (int i = 0; i < active_live_ranges_.length(); ++i) {
1752
- LiveRange* cur_active = active_live_ranges_.at(i);
1753
- free_until_pos[cur_active->assigned_register()] =
1754
- LifetimePosition::FromInstructionIndex(0);
1755
- }
1756
-
1757
- for (int i = 0; i < inactive_live_ranges_.length(); ++i) {
1758
- LiveRange* cur_inactive = inactive_live_ranges_.at(i);
1759
- ASSERT(cur_inactive->End().Value() > current->Start().Value());
1760
- LifetimePosition next_intersection =
1761
- cur_inactive->FirstIntersection(current);
1762
- if (!next_intersection.IsValid()) continue;
1763
- int cur_reg = cur_inactive->assigned_register();
1764
- free_until_pos[cur_reg] = Min(free_until_pos[cur_reg], next_intersection);
1765
- }
1766
-
1767
- UsePosition* hinted_use = current->FirstPosWithHint();
1768
- if (hinted_use != NULL) {
1769
- LOperand* hint = hinted_use->hint();
1770
- if (hint->IsRegister() || hint->IsDoubleRegister()) {
1771
- int register_index = hint->index();
1772
- TraceAlloc(
1773
- "Found reg hint %s (free until [%d) for live range %d (end %d[).\n",
1774
- RegisterName(register_index),
1775
- free_until_pos[register_index].Value(),
1776
- current->id(),
1777
- current->End().Value());
1778
-
1779
- // The desired register is free until the end of the current live range.
1780
- if (free_until_pos[register_index].Value() >= current->End().Value()) {
1781
- TraceAlloc("Assigning preferred reg %s to live range %d\n",
1782
- RegisterName(register_index),
1783
- current->id());
1784
- current->set_assigned_register(register_index, mode_);
1785
- return true;
1786
- }
1787
- }
1788
- }
1789
-
1790
- // Find the register which stays free for the longest time.
1791
- int reg = 0;
1792
- for (int i = 1; i < RegisterCount(); ++i) {
1793
- if (free_until_pos[i].Value() > free_until_pos[reg].Value()) {
1794
- reg = i;
1795
- }
1796
- }
1797
-
1798
- LifetimePosition pos = free_until_pos[reg];
1799
-
1800
- if (pos.Value() <= current->Start().Value()) {
1801
- // All registers are blocked.
1802
- return false;
1803
- }
1804
-
1805
- if (pos.Value() < current->End().Value()) {
1806
- // Register reg is available at the range start but becomes blocked before
1807
- // the range end. Split current at position where it becomes blocked.
1808
- LiveRange* tail = SplitAt(current, pos);
1809
- AddToUnhandledSorted(tail);
1810
- }
1811
-
1812
-
1813
- // Register reg is available at the range start and is free until
1814
- // the range end.
1815
- ASSERT(pos.Value() >= current->End().Value());
1816
- TraceAlloc("Assigning free reg %s to live range %d\n",
1817
- RegisterName(reg),
1818
- current->id());
1819
- current->set_assigned_register(reg, mode_);
1820
-
1821
- return true;
1822
- }
1823
-
1824
-
1825
- void LAllocator::AllocateBlockedReg(LiveRange* current) {
1826
- UsePosition* register_use = current->NextRegisterPosition(current->Start());
1827
- if (register_use == NULL) {
1828
- // There is no use in the current live range that requires a register.
1829
- // We can just spill it.
1830
- Spill(current);
1831
- return;
1832
- }
1833
-
1834
-
1835
- LifetimePosition use_pos[DoubleRegister::kNumAllocatableRegisters];
1836
- LifetimePosition block_pos[DoubleRegister::kNumAllocatableRegisters];
1837
-
1838
- for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
1839
- use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
1840
- }
1841
-
1842
- for (int i = 0; i < active_live_ranges_.length(); ++i) {
1843
- LiveRange* range = active_live_ranges_[i];
1844
- int cur_reg = range->assigned_register();
1845
- if (range->IsFixed() || !range->CanBeSpilled(current->Start())) {
1846
- block_pos[cur_reg] = use_pos[cur_reg] =
1847
- LifetimePosition::FromInstructionIndex(0);
1848
- } else {
1849
- UsePosition* next_use = range->NextUsePositionRegisterIsBeneficial(
1850
- current->Start());
1851
- if (next_use == NULL) {
1852
- use_pos[cur_reg] = range->End();
1853
- } else {
1854
- use_pos[cur_reg] = next_use->pos();
1855
- }
1856
- }
1857
- }
1858
-
1859
- for (int i = 0; i < inactive_live_ranges_.length(); ++i) {
1860
- LiveRange* range = inactive_live_ranges_.at(i);
1861
- ASSERT(range->End().Value() > current->Start().Value());
1862
- LifetimePosition next_intersection = range->FirstIntersection(current);
1863
- if (!next_intersection.IsValid()) continue;
1864
- int cur_reg = range->assigned_register();
1865
- if (range->IsFixed()) {
1866
- block_pos[cur_reg] = Min(block_pos[cur_reg], next_intersection);
1867
- use_pos[cur_reg] = Min(block_pos[cur_reg], use_pos[cur_reg]);
1868
- } else {
1869
- use_pos[cur_reg] = Min(use_pos[cur_reg], next_intersection);
1870
- }
1871
- }
1872
-
1873
- int reg = 0;
1874
- for (int i = 1; i < RegisterCount(); ++i) {
1875
- if (use_pos[i].Value() > use_pos[reg].Value()) {
1876
- reg = i;
1877
- }
1878
- }
1879
-
1880
- LifetimePosition pos = use_pos[reg];
1881
-
1882
- if (pos.Value() < register_use->pos().Value()) {
1883
- // All registers are blocked before the first use that requires a register.
1884
- // Spill starting part of live range up to that use.
1885
- //
1886
- // Corner case: the first use position is equal to the start of the range.
1887
- // In this case we have nothing to spill and SpillBetween will just return
1888
- // this range to the list of unhandled ones. This will lead to the infinite
1889
- // loop.
1890
- ASSERT(current->Start().Value() < register_use->pos().Value());
1891
- SpillBetween(current, current->Start(), register_use->pos());
1892
- return;
1893
- }
1894
-
1895
- if (block_pos[reg].Value() < current->End().Value()) {
1896
- // Register becomes blocked before the current range end. Split before that
1897
- // position.
1898
- LiveRange* tail = SplitBetween(current,
1899
- current->Start(),
1900
- block_pos[reg].InstructionStart());
1901
- AddToUnhandledSorted(tail);
1902
- }
1903
-
1904
- // Register reg is not blocked for the whole range.
1905
- ASSERT(block_pos[reg].Value() >= current->End().Value());
1906
- TraceAlloc("Assigning blocked reg %s to live range %d\n",
1907
- RegisterName(reg),
1908
- current->id());
1909
- current->set_assigned_register(reg, mode_);
1910
-
1911
- // This register was not free. Thus we need to find and spill
1912
- // parts of active and inactive live regions that use the same register
1913
- // at the same lifetime positions as current.
1914
- SplitAndSpillIntersecting(current);
1915
- }
1916
-
1917
-
1918
- void LAllocator::SplitAndSpillIntersecting(LiveRange* current) {
1919
- ASSERT(current->HasRegisterAssigned());
1920
- int reg = current->assigned_register();
1921
- LifetimePosition split_pos = current->Start();
1922
- for (int i = 0; i < active_live_ranges_.length(); ++i) {
1923
- LiveRange* range = active_live_ranges_[i];
1924
- if (range->assigned_register() == reg) {
1925
- UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1926
- if (next_pos == NULL) {
1927
- SpillAfter(range, split_pos);
1928
- } else {
1929
- SpillBetween(range, split_pos, next_pos->pos());
1930
- }
1931
- ActiveToHandled(range);
1932
- --i;
1933
- }
1934
- }
1935
-
1936
- for (int i = 0; i < inactive_live_ranges_.length(); ++i) {
1937
- LiveRange* range = inactive_live_ranges_[i];
1938
- ASSERT(range->End().Value() > current->Start().Value());
1939
- if (range->assigned_register() == reg && !range->IsFixed()) {
1940
- LifetimePosition next_intersection = range->FirstIntersection(current);
1941
- if (next_intersection.IsValid()) {
1942
- UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1943
- if (next_pos == NULL) {
1944
- SpillAfter(range, split_pos);
1945
- } else {
1946
- next_intersection = Min(next_intersection, next_pos->pos());
1947
- SpillBetween(range, split_pos, next_intersection);
1948
- }
1949
- InactiveToHandled(range);
1950
- --i;
1951
- }
1952
- }
1953
- }
1954
- }
1955
-
1956
-
1957
- bool LAllocator::IsBlockBoundary(LifetimePosition pos) {
1958
- return pos.IsInstructionStart() &&
1959
- InstructionAt(pos.InstructionIndex())->IsLabel();
1960
- }
1961
-
1962
-
1963
- LiveRange* LAllocator::SplitAt(LiveRange* range, LifetimePosition pos) {
1964
- ASSERT(!range->IsFixed());
1965
- TraceAlloc("Splitting live range %d at %d\n", range->id(), pos.Value());
1966
-
1967
- if (pos.Value() <= range->Start().Value()) return range;
1968
-
1969
- // We can't properly connect liveranges if split occured at the end
1970
- // of control instruction.
1971
- ASSERT(pos.IsInstructionStart() ||
1972
- !chunk_->instructions()->at(pos.InstructionIndex())->IsControl());
1973
-
1974
- LiveRange* result = LiveRangeFor(next_virtual_register_++);
1975
- range->SplitAt(pos, result);
1976
- return result;
1977
- }
1978
-
1979
-
1980
- LiveRange* LAllocator::SplitBetween(LiveRange* range,
1981
- LifetimePosition start,
1982
- LifetimePosition end) {
1983
- ASSERT(!range->IsFixed());
1984
- TraceAlloc("Splitting live range %d in position between [%d, %d]\n",
1985
- range->id(),
1986
- start.Value(),
1987
- end.Value());
1988
-
1989
- LifetimePosition split_pos = FindOptimalSplitPos(start, end);
1990
- ASSERT(split_pos.Value() >= start.Value());
1991
- return SplitAt(range, split_pos);
1992
- }
1993
-
1994
-
1995
- LifetimePosition LAllocator::FindOptimalSplitPos(LifetimePosition start,
1996
- LifetimePosition end) {
1997
- int start_instr = start.InstructionIndex();
1998
- int end_instr = end.InstructionIndex();
1999
- ASSERT(start_instr <= end_instr);
2000
-
2001
- // We have no choice
2002
- if (start_instr == end_instr) return end;
2003
-
2004
- HBasicBlock* end_block = GetBlock(start);
2005
- HBasicBlock* start_block = GetBlock(end);
2006
-
2007
- if (end_block == start_block) {
2008
- // The interval is split in the same basic block. Split at latest possible
2009
- // position.
2010
- return end;
2011
- }
2012
-
2013
- HBasicBlock* block = end_block;
2014
- // Find header of outermost loop.
2015
- while (block->parent_loop_header() != NULL &&
2016
- block->parent_loop_header()->block_id() > start_block->block_id()) {
2017
- block = block->parent_loop_header();
2018
- }
2019
-
2020
- if (block == end_block) return end;
2021
-
2022
- return LifetimePosition::FromInstructionIndex(
2023
- block->first_instruction_index());
2024
- }
2025
-
2026
-
2027
- void LAllocator::SpillAfter(LiveRange* range, LifetimePosition pos) {
2028
- LiveRange* second_part = SplitAt(range, pos);
2029
- Spill(second_part);
2030
- }
2031
-
2032
-
2033
- void LAllocator::SpillBetween(LiveRange* range,
2034
- LifetimePosition start,
2035
- LifetimePosition end) {
2036
- ASSERT(start.Value() < end.Value());
2037
- LiveRange* second_part = SplitAt(range, start);
2038
-
2039
- if (second_part->Start().Value() < end.Value()) {
2040
- // The split result intersects with [start, end[.
2041
- // Split it at position between ]start+1, end[, spill the middle part
2042
- // and put the rest to unhandled.
2043
- LiveRange* third_part = SplitBetween(
2044
- second_part,
2045
- second_part->Start().InstructionEnd(),
2046
- end.PrevInstruction().InstructionEnd());
2047
-
2048
- ASSERT(third_part != second_part);
2049
-
2050
- Spill(second_part);
2051
- AddToUnhandledSorted(third_part);
2052
- } else {
2053
- // The split result does not intersect with [start, end[.
2054
- // Nothing to spill. Just put it to unhandled as whole.
2055
- AddToUnhandledSorted(second_part);
2056
- }
2057
- }
2058
-
2059
-
2060
- void LAllocator::Spill(LiveRange* range) {
2061
- ASSERT(!range->IsSpilled());
2062
- TraceAlloc("Spilling live range %d\n", range->id());
2063
- LiveRange* first = range->TopLevel();
2064
-
2065
- if (!first->HasAllocatedSpillOperand()) {
2066
- LOperand* op = TryReuseSpillSlot(range);
2067
- if (op == NULL) op = chunk_->GetNextSpillSlot(mode_ == DOUBLE_REGISTERS);
2068
- first->SetSpillOperand(op);
2069
- }
2070
- range->MakeSpilled();
2071
- }
2072
-
2073
-
2074
- int LAllocator::RegisterCount() const {
2075
- return num_registers_;
2076
- }
2077
-
2078
-
2079
- #ifdef DEBUG
2080
-
2081
-
2082
- void LAllocator::Verify() const {
2083
- for (int i = 0; i < live_ranges()->length(); ++i) {
2084
- LiveRange* current = live_ranges()->at(i);
2085
- if (current != NULL) current->Verify();
2086
- }
2087
- }
2088
-
2089
-
2090
- #endif
2091
-
2092
-
2093
- } } // namespace v8::internal