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
@@ -0,0 +1,2954 @@
1
+ // Copyright 2011 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
+ #if defined(V8_TARGET_ARCH_X64)
31
+
32
+ #include "macro-assembler.h"
33
+ #include "serialize.h"
34
+
35
+ namespace v8 {
36
+ namespace internal {
37
+
38
+ // -----------------------------------------------------------------------------
39
+ // Implementation of CpuFeatures
40
+
41
+
42
+ #ifdef DEBUG
43
+ bool CpuFeatures::initialized_ = false;
44
+ #endif
45
+ uint64_t CpuFeatures::supported_ = CpuFeatures::kDefaultCpuFeatures;
46
+ uint64_t CpuFeatures::found_by_runtime_probing_ = 0;
47
+
48
+
49
+ void CpuFeatures::Probe() {
50
+ ASSERT(!initialized_);
51
+ #ifdef DEBUG
52
+ initialized_ = true;
53
+ #endif
54
+ supported_ = kDefaultCpuFeatures;
55
+ if (Serializer::enabled()) {
56
+ supported_ |= OS::CpuFeaturesImpliedByPlatform();
57
+ return; // No features if we might serialize.
58
+ }
59
+
60
+ const int kBufferSize = 4 * KB;
61
+ VirtualMemory* memory = new VirtualMemory(kBufferSize);
62
+ if (!memory->IsReserved()) {
63
+ delete memory;
64
+ return;
65
+ }
66
+ ASSERT(memory->size() >= static_cast<size_t>(kBufferSize));
67
+ if (!memory->Commit(memory->address(), kBufferSize, true/*executable*/)) {
68
+ delete memory;
69
+ return;
70
+ }
71
+
72
+ Assembler assm(NULL, memory->address(), kBufferSize);
73
+ Label cpuid, done;
74
+ #define __ assm.
75
+ // Save old rsp, since we are going to modify the stack.
76
+ __ push(rbp);
77
+ __ pushfq();
78
+ __ push(rcx);
79
+ __ push(rbx);
80
+ __ movq(rbp, rsp);
81
+
82
+ // If we can modify bit 21 of the EFLAGS register, then CPUID is supported.
83
+ __ pushfq();
84
+ __ pop(rax);
85
+ __ movq(rdx, rax);
86
+ __ xor_(rax, Immediate(0x200000)); // Flip bit 21.
87
+ __ push(rax);
88
+ __ popfq();
89
+ __ pushfq();
90
+ __ pop(rax);
91
+ __ xor_(rax, rdx); // Different if CPUID is supported.
92
+ __ j(not_zero, &cpuid);
93
+
94
+ // CPUID not supported. Clear the supported features in rax.
95
+ __ xor_(rax, rax);
96
+ __ jmp(&done);
97
+
98
+ // Invoke CPUID with 1 in eax to get feature information in
99
+ // ecx:edx. Temporarily enable CPUID support because we know it's
100
+ // safe here.
101
+ __ bind(&cpuid);
102
+ __ movq(rax, Immediate(1));
103
+ supported_ = kDefaultCpuFeatures | (1 << CPUID);
104
+ { Scope fscope(CPUID);
105
+ __ cpuid();
106
+ // Move the result from ecx:edx to rdi.
107
+ __ movl(rdi, rdx); // Zero-extended to 64 bits.
108
+ __ shl(rcx, Immediate(32));
109
+ __ or_(rdi, rcx);
110
+
111
+ // Get the sahf supported flag, from CPUID(0x80000001)
112
+ __ movq(rax, 0x80000001, RelocInfo::NONE);
113
+ __ cpuid();
114
+ }
115
+ supported_ = kDefaultCpuFeatures;
116
+
117
+ // Put the CPU flags in rax.
118
+ // rax = (rcx & 1) | (rdi & ~1) | (1 << CPUID).
119
+ __ movl(rax, Immediate(1));
120
+ __ and_(rcx, rax); // Bit 0 is set if SAHF instruction supported.
121
+ __ not_(rax);
122
+ __ and_(rax, rdi);
123
+ __ or_(rax, rcx);
124
+ __ or_(rax, Immediate(1 << CPUID));
125
+
126
+ // Done.
127
+ __ bind(&done);
128
+ __ movq(rsp, rbp);
129
+ __ pop(rbx);
130
+ __ pop(rcx);
131
+ __ popfq();
132
+ __ pop(rbp);
133
+ __ ret(0);
134
+ #undef __
135
+
136
+ typedef uint64_t (*F0)();
137
+ F0 probe = FUNCTION_CAST<F0>(reinterpret_cast<Address>(memory->address()));
138
+ supported_ = probe();
139
+ found_by_runtime_probing_ = supported_;
140
+ found_by_runtime_probing_ &= ~kDefaultCpuFeatures;
141
+ uint64_t os_guarantees = OS::CpuFeaturesImpliedByPlatform();
142
+ supported_ |= os_guarantees;
143
+ found_by_runtime_probing_ &= ~os_guarantees;
144
+ // SSE2 and CMOV must be available on an X64 CPU.
145
+ ASSERT(IsSupported(CPUID));
146
+ ASSERT(IsSupported(SSE2));
147
+ ASSERT(IsSupported(CMOV));
148
+
149
+ delete memory;
150
+ }
151
+
152
+
153
+ // -----------------------------------------------------------------------------
154
+ // Implementation of RelocInfo
155
+
156
+ // Patch the code at the current PC with a call to the target address.
157
+ // Additional guard int3 instructions can be added if required.
158
+ void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
159
+ // Load register with immediate 64 and call through a register instructions
160
+ // takes up 13 bytes and int3 takes up one byte.
161
+ static const int kCallCodeSize = 13;
162
+ int code_size = kCallCodeSize + guard_bytes;
163
+
164
+ // Create a code patcher.
165
+ CodePatcher patcher(pc_, code_size);
166
+
167
+ // Add a label for checking the size of the code used for returning.
168
+ #ifdef DEBUG
169
+ Label check_codesize;
170
+ patcher.masm()->bind(&check_codesize);
171
+ #endif
172
+
173
+ // Patch the code.
174
+ patcher.masm()->movq(r10, target, RelocInfo::NONE);
175
+ patcher.masm()->call(r10);
176
+
177
+ // Check that the size of the code generated is as expected.
178
+ ASSERT_EQ(kCallCodeSize,
179
+ patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
180
+
181
+ // Add the requested number of int3 instructions after the call.
182
+ for (int i = 0; i < guard_bytes; i++) {
183
+ patcher.masm()->int3();
184
+ }
185
+ }
186
+
187
+
188
+ void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
189
+ // Patch the code at the current address with the supplied instructions.
190
+ for (int i = 0; i < instruction_count; i++) {
191
+ *(pc_ + i) = *(instructions + i);
192
+ }
193
+
194
+ // Indicate that code has changed.
195
+ CPU::FlushICache(pc_, instruction_count);
196
+ }
197
+
198
+
199
+ // -----------------------------------------------------------------------------
200
+ // Register constants.
201
+
202
+ const int Register::kRegisterCodeByAllocationIndex[kNumAllocatableRegisters] = {
203
+ // rax, rbx, rdx, rcx, rdi, r8, r9, r11, r14, r15
204
+ 0, 3, 2, 1, 7, 8, 9, 11, 14, 15
205
+ };
206
+
207
+ const int Register::kAllocationIndexByRegisterCode[kNumRegisters] = {
208
+ 0, 3, 2, 1, -1, -1, -1, 4, 5, 6, -1, 7, -1, -1, 8, 9
209
+ };
210
+
211
+
212
+ // -----------------------------------------------------------------------------
213
+ // Implementation of Operand
214
+
215
+ Operand::Operand(Register base, int32_t disp) : rex_(0) {
216
+ len_ = 1;
217
+ if (base.is(rsp) || base.is(r12)) {
218
+ // SIB byte is needed to encode (rsp + offset) or (r12 + offset).
219
+ set_sib(times_1, rsp, base);
220
+ }
221
+
222
+ if (disp == 0 && !base.is(rbp) && !base.is(r13)) {
223
+ set_modrm(0, base);
224
+ } else if (is_int8(disp)) {
225
+ set_modrm(1, base);
226
+ set_disp8(disp);
227
+ } else {
228
+ set_modrm(2, base);
229
+ set_disp32(disp);
230
+ }
231
+ }
232
+
233
+
234
+ Operand::Operand(Register base,
235
+ Register index,
236
+ ScaleFactor scale,
237
+ int32_t disp) : rex_(0) {
238
+ ASSERT(!index.is(rsp));
239
+ len_ = 1;
240
+ set_sib(scale, index, base);
241
+ if (disp == 0 && !base.is(rbp) && !base.is(r13)) {
242
+ // This call to set_modrm doesn't overwrite the REX.B (or REX.X) bits
243
+ // possibly set by set_sib.
244
+ set_modrm(0, rsp);
245
+ } else if (is_int8(disp)) {
246
+ set_modrm(1, rsp);
247
+ set_disp8(disp);
248
+ } else {
249
+ set_modrm(2, rsp);
250
+ set_disp32(disp);
251
+ }
252
+ }
253
+
254
+
255
+ Operand::Operand(Register index,
256
+ ScaleFactor scale,
257
+ int32_t disp) : rex_(0) {
258
+ ASSERT(!index.is(rsp));
259
+ len_ = 1;
260
+ set_modrm(0, rsp);
261
+ set_sib(scale, index, rbp);
262
+ set_disp32(disp);
263
+ }
264
+
265
+
266
+ Operand::Operand(const Operand& operand, int32_t offset) {
267
+ ASSERT(operand.len_ >= 1);
268
+ // Operand encodes REX ModR/M [SIB] [Disp].
269
+ byte modrm = operand.buf_[0];
270
+ ASSERT(modrm < 0xC0); // Disallow mode 3 (register target).
271
+ bool has_sib = ((modrm & 0x07) == 0x04);
272
+ byte mode = modrm & 0xC0;
273
+ int disp_offset = has_sib ? 2 : 1;
274
+ int base_reg = (has_sib ? operand.buf_[1] : modrm) & 0x07;
275
+ // Mode 0 with rbp/r13 as ModR/M or SIB base register always has a 32-bit
276
+ // displacement.
277
+ bool is_baseless = (mode == 0) && (base_reg == 0x05); // No base or RIP base.
278
+ int32_t disp_value = 0;
279
+ if (mode == 0x80 || is_baseless) {
280
+ // Mode 2 or mode 0 with rbp/r13 as base: Word displacement.
281
+ disp_value = *BitCast<const int32_t*>(&operand.buf_[disp_offset]);
282
+ } else if (mode == 0x40) {
283
+ // Mode 1: Byte displacement.
284
+ disp_value = static_cast<signed char>(operand.buf_[disp_offset]);
285
+ }
286
+
287
+ // Write new operand with same registers, but with modified displacement.
288
+ ASSERT(offset >= 0 ? disp_value + offset > disp_value
289
+ : disp_value + offset < disp_value); // No overflow.
290
+ disp_value += offset;
291
+ rex_ = operand.rex_;
292
+ if (!is_int8(disp_value) || is_baseless) {
293
+ // Need 32 bits of displacement, mode 2 or mode 1 with register rbp/r13.
294
+ buf_[0] = (modrm & 0x3f) | (is_baseless ? 0x00 : 0x80);
295
+ len_ = disp_offset + 4;
296
+ Memory::int32_at(&buf_[disp_offset]) = disp_value;
297
+ } else if (disp_value != 0 || (base_reg == 0x05)) {
298
+ // Need 8 bits of displacement.
299
+ buf_[0] = (modrm & 0x3f) | 0x40; // Mode 1.
300
+ len_ = disp_offset + 1;
301
+ buf_[disp_offset] = static_cast<byte>(disp_value);
302
+ } else {
303
+ // Need no displacement.
304
+ buf_[0] = (modrm & 0x3f); // Mode 0.
305
+ len_ = disp_offset;
306
+ }
307
+ if (has_sib) {
308
+ buf_[1] = operand.buf_[1];
309
+ }
310
+ }
311
+
312
+
313
+ bool Operand::AddressUsesRegister(Register reg) const {
314
+ int code = reg.code();
315
+ ASSERT((buf_[0] & 0xC0) != 0xC0); // Always a memory operand.
316
+ // Start with only low three bits of base register. Initial decoding doesn't
317
+ // distinguish on the REX.B bit.
318
+ int base_code = buf_[0] & 0x07;
319
+ if (base_code == rsp.code()) {
320
+ // SIB byte present in buf_[1].
321
+ // Check the index register from the SIB byte + REX.X prefix.
322
+ int index_code = ((buf_[1] >> 3) & 0x07) | ((rex_ & 0x02) << 2);
323
+ // Index code (including REX.X) of 0x04 (rsp) means no index register.
324
+ if (index_code != rsp.code() && index_code == code) return true;
325
+ // Add REX.B to get the full base register code.
326
+ base_code = (buf_[1] & 0x07) | ((rex_ & 0x01) << 3);
327
+ // A base register of 0x05 (rbp) with mod = 0 means no base register.
328
+ if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false;
329
+ return code == base_code;
330
+ } else {
331
+ // A base register with low bits of 0x05 (rbp or r13) and mod = 0 means
332
+ // no base register.
333
+ if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false;
334
+ base_code |= ((rex_ & 0x01) << 3);
335
+ return code == base_code;
336
+ }
337
+ }
338
+
339
+
340
+ // -----------------------------------------------------------------------------
341
+ // Implementation of Assembler.
342
+
343
+ #ifdef GENERATED_CODE_COVERAGE
344
+ static void InitCoverageLog();
345
+ #endif
346
+
347
+ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
348
+ : AssemblerBase(arg_isolate),
349
+ code_targets_(100),
350
+ positions_recorder_(this),
351
+ emit_debug_code_(FLAG_debug_code) {
352
+ if (buffer == NULL) {
353
+ // Do our own buffer management.
354
+ if (buffer_size <= kMinimalBufferSize) {
355
+ buffer_size = kMinimalBufferSize;
356
+
357
+ if (isolate() != NULL && isolate()->assembler_spare_buffer() != NULL) {
358
+ buffer = isolate()->assembler_spare_buffer();
359
+ isolate()->set_assembler_spare_buffer(NULL);
360
+ }
361
+ }
362
+ if (buffer == NULL) {
363
+ buffer_ = NewArray<byte>(buffer_size);
364
+ } else {
365
+ buffer_ = static_cast<byte*>(buffer);
366
+ }
367
+ buffer_size_ = buffer_size;
368
+ own_buffer_ = true;
369
+ } else {
370
+ // Use externally provided buffer instead.
371
+ ASSERT(buffer_size > 0);
372
+ buffer_ = static_cast<byte*>(buffer);
373
+ buffer_size_ = buffer_size;
374
+ own_buffer_ = false;
375
+ }
376
+
377
+ // Clear the buffer in debug mode unless it was provided by the
378
+ // caller in which case we can't be sure it's okay to overwrite
379
+ // existing code in it.
380
+ #ifdef DEBUG
381
+ if (own_buffer_) {
382
+ memset(buffer_, 0xCC, buffer_size); // int3
383
+ }
384
+ #endif
385
+
386
+ // Setup buffer pointers.
387
+ ASSERT(buffer_ != NULL);
388
+ pc_ = buffer_;
389
+ reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
390
+
391
+
392
+ #ifdef GENERATED_CODE_COVERAGE
393
+ InitCoverageLog();
394
+ #endif
395
+ }
396
+
397
+
398
+ Assembler::~Assembler() {
399
+ if (own_buffer_) {
400
+ if (isolate() != NULL &&
401
+ isolate()->assembler_spare_buffer() == NULL &&
402
+ buffer_size_ == kMinimalBufferSize) {
403
+ isolate()->set_assembler_spare_buffer(buffer_);
404
+ } else {
405
+ DeleteArray(buffer_);
406
+ }
407
+ }
408
+ }
409
+
410
+
411
+ void Assembler::GetCode(CodeDesc* desc) {
412
+ // Finalize code (at this point overflow() may be true, but the gap ensures
413
+ // that we are still not overlapping instructions and relocation info).
414
+ ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap.
415
+ // Setup code descriptor.
416
+ desc->buffer = buffer_;
417
+ desc->buffer_size = buffer_size_;
418
+ desc->instr_size = pc_offset();
419
+ ASSERT(desc->instr_size > 0); // Zero-size code objects upset the system.
420
+ desc->reloc_size =
421
+ static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos());
422
+ desc->origin = this;
423
+ }
424
+
425
+
426
+ void Assembler::Align(int m) {
427
+ ASSERT(IsPowerOf2(m));
428
+ int delta = (m - (pc_offset() & (m - 1))) & (m - 1);
429
+ while (delta >= 9) {
430
+ nop(9);
431
+ delta -= 9;
432
+ }
433
+ if (delta > 0) {
434
+ nop(delta);
435
+ }
436
+ }
437
+
438
+
439
+ void Assembler::CodeTargetAlign() {
440
+ Align(16); // Preferred alignment of jump targets on x64.
441
+ }
442
+
443
+
444
+ void Assembler::bind_to(Label* L, int pos) {
445
+ ASSERT(!L->is_bound()); // Label may only be bound once.
446
+ ASSERT(0 <= pos && pos <= pc_offset()); // Position must be valid.
447
+ if (L->is_linked()) {
448
+ int current = L->pos();
449
+ int next = long_at(current);
450
+ while (next != current) {
451
+ // Relative address, relative to point after address.
452
+ int imm32 = pos - (current + sizeof(int32_t));
453
+ long_at_put(current, imm32);
454
+ current = next;
455
+ next = long_at(next);
456
+ }
457
+ // Fix up last fixup on linked list.
458
+ int last_imm32 = pos - (current + sizeof(int32_t));
459
+ long_at_put(current, last_imm32);
460
+ }
461
+ L->bind_to(pos);
462
+ }
463
+
464
+
465
+ void Assembler::bind(Label* L) {
466
+ bind_to(L, pc_offset());
467
+ }
468
+
469
+
470
+ void Assembler::bind(NearLabel* L) {
471
+ ASSERT(!L->is_bound());
472
+ while (L->unresolved_branches_ > 0) {
473
+ int branch_pos = L->unresolved_positions_[L->unresolved_branches_ - 1];
474
+ int disp = pc_offset() - branch_pos;
475
+ ASSERT(is_int8(disp));
476
+ set_byte_at(branch_pos - sizeof(int8_t), disp);
477
+ L->unresolved_branches_--;
478
+ }
479
+ L->bind_to(pc_offset());
480
+ }
481
+
482
+
483
+ void Assembler::GrowBuffer() {
484
+ ASSERT(buffer_overflow());
485
+ if (!own_buffer_) FATAL("external code buffer is too small");
486
+
487
+ // Compute new buffer size.
488
+ CodeDesc desc; // the new buffer
489
+ if (buffer_size_ < 4*KB) {
490
+ desc.buffer_size = 4*KB;
491
+ } else {
492
+ desc.buffer_size = 2*buffer_size_;
493
+ }
494
+ // Some internal data structures overflow for very large buffers,
495
+ // they must ensure that kMaximalBufferSize is not too large.
496
+ if ((desc.buffer_size > kMaximalBufferSize) ||
497
+ (desc.buffer_size > HEAP->MaxOldGenerationSize())) {
498
+ V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
499
+ }
500
+
501
+ // Setup new buffer.
502
+ desc.buffer = NewArray<byte>(desc.buffer_size);
503
+ desc.instr_size = pc_offset();
504
+ desc.reloc_size =
505
+ static_cast<int>((buffer_ + buffer_size_) - (reloc_info_writer.pos()));
506
+
507
+ // Clear the buffer in debug mode. Use 'int3' instructions to make
508
+ // sure to get into problems if we ever run uninitialized code.
509
+ #ifdef DEBUG
510
+ memset(desc.buffer, 0xCC, desc.buffer_size);
511
+ #endif
512
+
513
+ // Copy the data.
514
+ intptr_t pc_delta = desc.buffer - buffer_;
515
+ intptr_t rc_delta = (desc.buffer + desc.buffer_size) -
516
+ (buffer_ + buffer_size_);
517
+ memmove(desc.buffer, buffer_, desc.instr_size);
518
+ memmove(rc_delta + reloc_info_writer.pos(),
519
+ reloc_info_writer.pos(), desc.reloc_size);
520
+
521
+ // Switch buffers.
522
+ if (isolate() != NULL &&
523
+ isolate()->assembler_spare_buffer() == NULL &&
524
+ buffer_size_ == kMinimalBufferSize) {
525
+ isolate()->set_assembler_spare_buffer(buffer_);
526
+ } else {
527
+ DeleteArray(buffer_);
528
+ }
529
+ buffer_ = desc.buffer;
530
+ buffer_size_ = desc.buffer_size;
531
+ pc_ += pc_delta;
532
+ reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta,
533
+ reloc_info_writer.last_pc() + pc_delta);
534
+
535
+ // Relocate runtime entries.
536
+ for (RelocIterator it(desc); !it.done(); it.next()) {
537
+ RelocInfo::Mode rmode = it.rinfo()->rmode();
538
+ if (rmode == RelocInfo::INTERNAL_REFERENCE) {
539
+ intptr_t* p = reinterpret_cast<intptr_t*>(it.rinfo()->pc());
540
+ if (*p != 0) { // 0 means uninitialized.
541
+ *p += pc_delta;
542
+ }
543
+ }
544
+ }
545
+
546
+ ASSERT(!buffer_overflow());
547
+ }
548
+
549
+
550
+ void Assembler::emit_operand(int code, const Operand& adr) {
551
+ ASSERT(is_uint3(code));
552
+ const unsigned length = adr.len_;
553
+ ASSERT(length > 0);
554
+
555
+ // Emit updated ModR/M byte containing the given register.
556
+ ASSERT((adr.buf_[0] & 0x38) == 0);
557
+ pc_[0] = adr.buf_[0] | code << 3;
558
+
559
+ // Emit the rest of the encoded operand.
560
+ for (unsigned i = 1; i < length; i++) pc_[i] = adr.buf_[i];
561
+ pc_ += length;
562
+ }
563
+
564
+
565
+ // Assembler Instruction implementations.
566
+
567
+ void Assembler::arithmetic_op(byte opcode, Register reg, const Operand& op) {
568
+ EnsureSpace ensure_space(this);
569
+ emit_rex_64(reg, op);
570
+ emit(opcode);
571
+ emit_operand(reg, op);
572
+ }
573
+
574
+
575
+ void Assembler::arithmetic_op(byte opcode, Register reg, Register rm_reg) {
576
+ EnsureSpace ensure_space(this);
577
+ ASSERT((opcode & 0xC6) == 2);
578
+ if (rm_reg.low_bits() == 4) { // Forces SIB byte.
579
+ // Swap reg and rm_reg and change opcode operand order.
580
+ emit_rex_64(rm_reg, reg);
581
+ emit(opcode ^ 0x02);
582
+ emit_modrm(rm_reg, reg);
583
+ } else {
584
+ emit_rex_64(reg, rm_reg);
585
+ emit(opcode);
586
+ emit_modrm(reg, rm_reg);
587
+ }
588
+ }
589
+
590
+
591
+ void Assembler::arithmetic_op_16(byte opcode, Register reg, Register rm_reg) {
592
+ EnsureSpace ensure_space(this);
593
+ ASSERT((opcode & 0xC6) == 2);
594
+ if (rm_reg.low_bits() == 4) { // Forces SIB byte.
595
+ // Swap reg and rm_reg and change opcode operand order.
596
+ emit(0x66);
597
+ emit_optional_rex_32(rm_reg, reg);
598
+ emit(opcode ^ 0x02);
599
+ emit_modrm(rm_reg, reg);
600
+ } else {
601
+ emit(0x66);
602
+ emit_optional_rex_32(reg, rm_reg);
603
+ emit(opcode);
604
+ emit_modrm(reg, rm_reg);
605
+ }
606
+ }
607
+
608
+
609
+ void Assembler::arithmetic_op_16(byte opcode,
610
+ Register reg,
611
+ const Operand& rm_reg) {
612
+ EnsureSpace ensure_space(this);
613
+ emit(0x66);
614
+ emit_optional_rex_32(reg, rm_reg);
615
+ emit(opcode);
616
+ emit_operand(reg, rm_reg);
617
+ }
618
+
619
+
620
+ void Assembler::arithmetic_op_32(byte opcode, Register reg, Register rm_reg) {
621
+ EnsureSpace ensure_space(this);
622
+ ASSERT((opcode & 0xC6) == 2);
623
+ if (rm_reg.low_bits() == 4) { // Forces SIB byte.
624
+ // Swap reg and rm_reg and change opcode operand order.
625
+ emit_optional_rex_32(rm_reg, reg);
626
+ emit(opcode ^ 0x02); // E.g. 0x03 -> 0x01 for ADD.
627
+ emit_modrm(rm_reg, reg);
628
+ } else {
629
+ emit_optional_rex_32(reg, rm_reg);
630
+ emit(opcode);
631
+ emit_modrm(reg, rm_reg);
632
+ }
633
+ }
634
+
635
+
636
+ void Assembler::arithmetic_op_32(byte opcode,
637
+ Register reg,
638
+ const Operand& rm_reg) {
639
+ EnsureSpace ensure_space(this);
640
+ emit_optional_rex_32(reg, rm_reg);
641
+ emit(opcode);
642
+ emit_operand(reg, rm_reg);
643
+ }
644
+
645
+
646
+ void Assembler::immediate_arithmetic_op(byte subcode,
647
+ Register dst,
648
+ Immediate src) {
649
+ EnsureSpace ensure_space(this);
650
+ emit_rex_64(dst);
651
+ if (is_int8(src.value_)) {
652
+ emit(0x83);
653
+ emit_modrm(subcode, dst);
654
+ emit(src.value_);
655
+ } else if (dst.is(rax)) {
656
+ emit(0x05 | (subcode << 3));
657
+ emitl(src.value_);
658
+ } else {
659
+ emit(0x81);
660
+ emit_modrm(subcode, dst);
661
+ emitl(src.value_);
662
+ }
663
+ }
664
+
665
+ void Assembler::immediate_arithmetic_op(byte subcode,
666
+ const Operand& dst,
667
+ Immediate src) {
668
+ EnsureSpace ensure_space(this);
669
+ emit_rex_64(dst);
670
+ if (is_int8(src.value_)) {
671
+ emit(0x83);
672
+ emit_operand(subcode, dst);
673
+ emit(src.value_);
674
+ } else {
675
+ emit(0x81);
676
+ emit_operand(subcode, dst);
677
+ emitl(src.value_);
678
+ }
679
+ }
680
+
681
+
682
+ void Assembler::immediate_arithmetic_op_16(byte subcode,
683
+ Register dst,
684
+ Immediate src) {
685
+ EnsureSpace ensure_space(this);
686
+ emit(0x66); // Operand size override prefix.
687
+ emit_optional_rex_32(dst);
688
+ if (is_int8(src.value_)) {
689
+ emit(0x83);
690
+ emit_modrm(subcode, dst);
691
+ emit(src.value_);
692
+ } else if (dst.is(rax)) {
693
+ emit(0x05 | (subcode << 3));
694
+ emitw(src.value_);
695
+ } else {
696
+ emit(0x81);
697
+ emit_modrm(subcode, dst);
698
+ emitw(src.value_);
699
+ }
700
+ }
701
+
702
+
703
+ void Assembler::immediate_arithmetic_op_16(byte subcode,
704
+ const Operand& dst,
705
+ Immediate src) {
706
+ EnsureSpace ensure_space(this);
707
+ emit(0x66); // Operand size override prefix.
708
+ emit_optional_rex_32(dst);
709
+ if (is_int8(src.value_)) {
710
+ emit(0x83);
711
+ emit_operand(subcode, dst);
712
+ emit(src.value_);
713
+ } else {
714
+ emit(0x81);
715
+ emit_operand(subcode, dst);
716
+ emitw(src.value_);
717
+ }
718
+ }
719
+
720
+
721
+ void Assembler::immediate_arithmetic_op_32(byte subcode,
722
+ Register dst,
723
+ Immediate src) {
724
+ EnsureSpace ensure_space(this);
725
+ emit_optional_rex_32(dst);
726
+ if (is_int8(src.value_)) {
727
+ emit(0x83);
728
+ emit_modrm(subcode, dst);
729
+ emit(src.value_);
730
+ } else if (dst.is(rax)) {
731
+ emit(0x05 | (subcode << 3));
732
+ emitl(src.value_);
733
+ } else {
734
+ emit(0x81);
735
+ emit_modrm(subcode, dst);
736
+ emitl(src.value_);
737
+ }
738
+ }
739
+
740
+
741
+ void Assembler::immediate_arithmetic_op_32(byte subcode,
742
+ const Operand& dst,
743
+ Immediate src) {
744
+ EnsureSpace ensure_space(this);
745
+ emit_optional_rex_32(dst);
746
+ if (is_int8(src.value_)) {
747
+ emit(0x83);
748
+ emit_operand(subcode, dst);
749
+ emit(src.value_);
750
+ } else {
751
+ emit(0x81);
752
+ emit_operand(subcode, dst);
753
+ emitl(src.value_);
754
+ }
755
+ }
756
+
757
+
758
+ void Assembler::immediate_arithmetic_op_8(byte subcode,
759
+ const Operand& dst,
760
+ Immediate src) {
761
+ EnsureSpace ensure_space(this);
762
+ emit_optional_rex_32(dst);
763
+ ASSERT(is_int8(src.value_) || is_uint8(src.value_));
764
+ emit(0x80);
765
+ emit_operand(subcode, dst);
766
+ emit(src.value_);
767
+ }
768
+
769
+
770
+ void Assembler::immediate_arithmetic_op_8(byte subcode,
771
+ Register dst,
772
+ Immediate src) {
773
+ EnsureSpace ensure_space(this);
774
+ if (dst.code() > 3) {
775
+ // Use 64-bit mode byte registers.
776
+ emit_rex_64(dst);
777
+ }
778
+ ASSERT(is_int8(src.value_) || is_uint8(src.value_));
779
+ emit(0x80);
780
+ emit_modrm(subcode, dst);
781
+ emit(src.value_);
782
+ }
783
+
784
+
785
+ void Assembler::shift(Register dst, Immediate shift_amount, int subcode) {
786
+ EnsureSpace ensure_space(this);
787
+ ASSERT(is_uint6(shift_amount.value_)); // illegal shift count
788
+ if (shift_amount.value_ == 1) {
789
+ emit_rex_64(dst);
790
+ emit(0xD1);
791
+ emit_modrm(subcode, dst);
792
+ } else {
793
+ emit_rex_64(dst);
794
+ emit(0xC1);
795
+ emit_modrm(subcode, dst);
796
+ emit(shift_amount.value_);
797
+ }
798
+ }
799
+
800
+
801
+ void Assembler::shift(Register dst, int subcode) {
802
+ EnsureSpace ensure_space(this);
803
+ emit_rex_64(dst);
804
+ emit(0xD3);
805
+ emit_modrm(subcode, dst);
806
+ }
807
+
808
+
809
+ void Assembler::shift_32(Register dst, int subcode) {
810
+ EnsureSpace ensure_space(this);
811
+ emit_optional_rex_32(dst);
812
+ emit(0xD3);
813
+ emit_modrm(subcode, dst);
814
+ }
815
+
816
+
817
+ void Assembler::shift_32(Register dst, Immediate shift_amount, int subcode) {
818
+ EnsureSpace ensure_space(this);
819
+ ASSERT(is_uint5(shift_amount.value_)); // illegal shift count
820
+ if (shift_amount.value_ == 1) {
821
+ emit_optional_rex_32(dst);
822
+ emit(0xD1);
823
+ emit_modrm(subcode, dst);
824
+ } else {
825
+ emit_optional_rex_32(dst);
826
+ emit(0xC1);
827
+ emit_modrm(subcode, dst);
828
+ emit(shift_amount.value_);
829
+ }
830
+ }
831
+
832
+
833
+ void Assembler::bt(const Operand& dst, Register src) {
834
+ EnsureSpace ensure_space(this);
835
+ emit_rex_64(src, dst);
836
+ emit(0x0F);
837
+ emit(0xA3);
838
+ emit_operand(src, dst);
839
+ }
840
+
841
+
842
+ void Assembler::bts(const Operand& dst, Register src) {
843
+ EnsureSpace ensure_space(this);
844
+ emit_rex_64(src, dst);
845
+ emit(0x0F);
846
+ emit(0xAB);
847
+ emit_operand(src, dst);
848
+ }
849
+
850
+
851
+ void Assembler::call(Label* L) {
852
+ positions_recorder()->WriteRecordedPositions();
853
+ EnsureSpace ensure_space(this);
854
+ // 1110 1000 #32-bit disp.
855
+ emit(0xE8);
856
+ if (L->is_bound()) {
857
+ int offset = L->pos() - pc_offset() - sizeof(int32_t);
858
+ ASSERT(offset <= 0);
859
+ emitl(offset);
860
+ } else if (L->is_linked()) {
861
+ emitl(L->pos());
862
+ L->link_to(pc_offset() - sizeof(int32_t));
863
+ } else {
864
+ ASSERT(L->is_unused());
865
+ int32_t current = pc_offset();
866
+ emitl(current);
867
+ L->link_to(current);
868
+ }
869
+ }
870
+
871
+
872
+ void Assembler::call(Handle<Code> target, RelocInfo::Mode rmode) {
873
+ positions_recorder()->WriteRecordedPositions();
874
+ EnsureSpace ensure_space(this);
875
+ // 1110 1000 #32-bit disp.
876
+ emit(0xE8);
877
+ emit_code_target(target, rmode);
878
+ }
879
+
880
+
881
+ void Assembler::call(Register adr) {
882
+ positions_recorder()->WriteRecordedPositions();
883
+ EnsureSpace ensure_space(this);
884
+ // Opcode: FF /2 r64.
885
+ emit_optional_rex_32(adr);
886
+ emit(0xFF);
887
+ emit_modrm(0x2, adr);
888
+ }
889
+
890
+
891
+ void Assembler::call(const Operand& op) {
892
+ positions_recorder()->WriteRecordedPositions();
893
+ EnsureSpace ensure_space(this);
894
+ // Opcode: FF /2 m64.
895
+ emit_optional_rex_32(op);
896
+ emit(0xFF);
897
+ emit_operand(0x2, op);
898
+ }
899
+
900
+
901
+ // Calls directly to the given address using a relative offset.
902
+ // Should only ever be used in Code objects for calls within the
903
+ // same Code object. Should not be used when generating new code (use labels),
904
+ // but only when patching existing code.
905
+ void Assembler::call(Address target) {
906
+ positions_recorder()->WriteRecordedPositions();
907
+ EnsureSpace ensure_space(this);
908
+ // 1110 1000 #32-bit disp.
909
+ emit(0xE8);
910
+ Address source = pc_ + 4;
911
+ intptr_t displacement = target - source;
912
+ ASSERT(is_int32(displacement));
913
+ emitl(static_cast<int32_t>(displacement));
914
+ }
915
+
916
+
917
+ void Assembler::clc() {
918
+ EnsureSpace ensure_space(this);
919
+ emit(0xF8);
920
+ }
921
+
922
+ void Assembler::cld() {
923
+ EnsureSpace ensure_space(this);
924
+ emit(0xFC);
925
+ }
926
+
927
+ void Assembler::cdq() {
928
+ EnsureSpace ensure_space(this);
929
+ emit(0x99);
930
+ }
931
+
932
+
933
+ void Assembler::cmovq(Condition cc, Register dst, Register src) {
934
+ if (cc == always) {
935
+ movq(dst, src);
936
+ } else if (cc == never) {
937
+ return;
938
+ }
939
+ // No need to check CpuInfo for CMOV support, it's a required part of the
940
+ // 64-bit architecture.
941
+ ASSERT(cc >= 0); // Use mov for unconditional moves.
942
+ EnsureSpace ensure_space(this);
943
+ // Opcode: REX.W 0f 40 + cc /r.
944
+ emit_rex_64(dst, src);
945
+ emit(0x0f);
946
+ emit(0x40 + cc);
947
+ emit_modrm(dst, src);
948
+ }
949
+
950
+
951
+ void Assembler::cmovq(Condition cc, Register dst, const Operand& src) {
952
+ if (cc == always) {
953
+ movq(dst, src);
954
+ } else if (cc == never) {
955
+ return;
956
+ }
957
+ ASSERT(cc >= 0);
958
+ EnsureSpace ensure_space(this);
959
+ // Opcode: REX.W 0f 40 + cc /r.
960
+ emit_rex_64(dst, src);
961
+ emit(0x0f);
962
+ emit(0x40 + cc);
963
+ emit_operand(dst, src);
964
+ }
965
+
966
+
967
+ void Assembler::cmovl(Condition cc, Register dst, Register src) {
968
+ if (cc == always) {
969
+ movl(dst, src);
970
+ } else if (cc == never) {
971
+ return;
972
+ }
973
+ ASSERT(cc >= 0);
974
+ EnsureSpace ensure_space(this);
975
+ // Opcode: 0f 40 + cc /r.
976
+ emit_optional_rex_32(dst, src);
977
+ emit(0x0f);
978
+ emit(0x40 + cc);
979
+ emit_modrm(dst, src);
980
+ }
981
+
982
+
983
+ void Assembler::cmovl(Condition cc, Register dst, const Operand& src) {
984
+ if (cc == always) {
985
+ movl(dst, src);
986
+ } else if (cc == never) {
987
+ return;
988
+ }
989
+ ASSERT(cc >= 0);
990
+ EnsureSpace ensure_space(this);
991
+ // Opcode: 0f 40 + cc /r.
992
+ emit_optional_rex_32(dst, src);
993
+ emit(0x0f);
994
+ emit(0x40 + cc);
995
+ emit_operand(dst, src);
996
+ }
997
+
998
+
999
+ void Assembler::cmpb_al(Immediate imm8) {
1000
+ ASSERT(is_int8(imm8.value_) || is_uint8(imm8.value_));
1001
+ EnsureSpace ensure_space(this);
1002
+ emit(0x3c);
1003
+ emit(imm8.value_);
1004
+ }
1005
+
1006
+
1007
+ void Assembler::cpuid() {
1008
+ ASSERT(CpuFeatures::IsEnabled(CPUID));
1009
+ EnsureSpace ensure_space(this);
1010
+ emit(0x0F);
1011
+ emit(0xA2);
1012
+ }
1013
+
1014
+
1015
+ void Assembler::cqo() {
1016
+ EnsureSpace ensure_space(this);
1017
+ emit_rex_64();
1018
+ emit(0x99);
1019
+ }
1020
+
1021
+
1022
+ void Assembler::decq(Register dst) {
1023
+ EnsureSpace ensure_space(this);
1024
+ emit_rex_64(dst);
1025
+ emit(0xFF);
1026
+ emit_modrm(0x1, dst);
1027
+ }
1028
+
1029
+
1030
+ void Assembler::decq(const Operand& dst) {
1031
+ EnsureSpace ensure_space(this);
1032
+ emit_rex_64(dst);
1033
+ emit(0xFF);
1034
+ emit_operand(1, dst);
1035
+ }
1036
+
1037
+
1038
+ void Assembler::decl(Register dst) {
1039
+ EnsureSpace ensure_space(this);
1040
+ emit_optional_rex_32(dst);
1041
+ emit(0xFF);
1042
+ emit_modrm(0x1, dst);
1043
+ }
1044
+
1045
+
1046
+ void Assembler::decl(const Operand& dst) {
1047
+ EnsureSpace ensure_space(this);
1048
+ emit_optional_rex_32(dst);
1049
+ emit(0xFF);
1050
+ emit_operand(1, dst);
1051
+ }
1052
+
1053
+
1054
+ void Assembler::decb(Register dst) {
1055
+ EnsureSpace ensure_space(this);
1056
+ if (dst.code() > 3) {
1057
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
1058
+ emit_rex_32(dst);
1059
+ }
1060
+ emit(0xFE);
1061
+ emit_modrm(0x1, dst);
1062
+ }
1063
+
1064
+
1065
+ void Assembler::decb(const Operand& dst) {
1066
+ EnsureSpace ensure_space(this);
1067
+ emit_optional_rex_32(dst);
1068
+ emit(0xFE);
1069
+ emit_operand(1, dst);
1070
+ }
1071
+
1072
+
1073
+ void Assembler::enter(Immediate size) {
1074
+ EnsureSpace ensure_space(this);
1075
+ emit(0xC8);
1076
+ emitw(size.value_); // 16 bit operand, always.
1077
+ emit(0);
1078
+ }
1079
+
1080
+
1081
+ void Assembler::hlt() {
1082
+ EnsureSpace ensure_space(this);
1083
+ emit(0xF4);
1084
+ }
1085
+
1086
+
1087
+ void Assembler::idivq(Register src) {
1088
+ EnsureSpace ensure_space(this);
1089
+ emit_rex_64(src);
1090
+ emit(0xF7);
1091
+ emit_modrm(0x7, src);
1092
+ }
1093
+
1094
+
1095
+ void Assembler::idivl(Register src) {
1096
+ EnsureSpace ensure_space(this);
1097
+ emit_optional_rex_32(src);
1098
+ emit(0xF7);
1099
+ emit_modrm(0x7, src);
1100
+ }
1101
+
1102
+
1103
+ void Assembler::imul(Register src) {
1104
+ EnsureSpace ensure_space(this);
1105
+ emit_rex_64(src);
1106
+ emit(0xF7);
1107
+ emit_modrm(0x5, src);
1108
+ }
1109
+
1110
+
1111
+ void Assembler::imul(Register dst, Register src) {
1112
+ EnsureSpace ensure_space(this);
1113
+ emit_rex_64(dst, src);
1114
+ emit(0x0F);
1115
+ emit(0xAF);
1116
+ emit_modrm(dst, src);
1117
+ }
1118
+
1119
+
1120
+ void Assembler::imul(Register dst, const Operand& src) {
1121
+ EnsureSpace ensure_space(this);
1122
+ emit_rex_64(dst, src);
1123
+ emit(0x0F);
1124
+ emit(0xAF);
1125
+ emit_operand(dst, src);
1126
+ }
1127
+
1128
+
1129
+ void Assembler::imul(Register dst, Register src, Immediate imm) {
1130
+ EnsureSpace ensure_space(this);
1131
+ emit_rex_64(dst, src);
1132
+ if (is_int8(imm.value_)) {
1133
+ emit(0x6B);
1134
+ emit_modrm(dst, src);
1135
+ emit(imm.value_);
1136
+ } else {
1137
+ emit(0x69);
1138
+ emit_modrm(dst, src);
1139
+ emitl(imm.value_);
1140
+ }
1141
+ }
1142
+
1143
+
1144
+ void Assembler::imull(Register dst, Register src) {
1145
+ EnsureSpace ensure_space(this);
1146
+ emit_optional_rex_32(dst, src);
1147
+ emit(0x0F);
1148
+ emit(0xAF);
1149
+ emit_modrm(dst, src);
1150
+ }
1151
+
1152
+
1153
+ void Assembler::imull(Register dst, const Operand& src) {
1154
+ EnsureSpace ensure_space(this);
1155
+ emit_optional_rex_32(dst, src);
1156
+ emit(0x0F);
1157
+ emit(0xAF);
1158
+ emit_operand(dst, src);
1159
+ }
1160
+
1161
+
1162
+ void Assembler::imull(Register dst, Register src, Immediate imm) {
1163
+ EnsureSpace ensure_space(this);
1164
+ emit_optional_rex_32(dst, src);
1165
+ if (is_int8(imm.value_)) {
1166
+ emit(0x6B);
1167
+ emit_modrm(dst, src);
1168
+ emit(imm.value_);
1169
+ } else {
1170
+ emit(0x69);
1171
+ emit_modrm(dst, src);
1172
+ emitl(imm.value_);
1173
+ }
1174
+ }
1175
+
1176
+
1177
+ void Assembler::incq(Register dst) {
1178
+ EnsureSpace ensure_space(this);
1179
+ emit_rex_64(dst);
1180
+ emit(0xFF);
1181
+ emit_modrm(0x0, dst);
1182
+ }
1183
+
1184
+
1185
+ void Assembler::incq(const Operand& dst) {
1186
+ EnsureSpace ensure_space(this);
1187
+ emit_rex_64(dst);
1188
+ emit(0xFF);
1189
+ emit_operand(0, dst);
1190
+ }
1191
+
1192
+
1193
+ void Assembler::incl(const Operand& dst) {
1194
+ EnsureSpace ensure_space(this);
1195
+ emit_optional_rex_32(dst);
1196
+ emit(0xFF);
1197
+ emit_operand(0, dst);
1198
+ }
1199
+
1200
+
1201
+ void Assembler::incl(Register dst) {
1202
+ EnsureSpace ensure_space(this);
1203
+ emit_optional_rex_32(dst);
1204
+ emit(0xFF);
1205
+ emit_modrm(0, dst);
1206
+ }
1207
+
1208
+
1209
+ void Assembler::int3() {
1210
+ EnsureSpace ensure_space(this);
1211
+ emit(0xCC);
1212
+ }
1213
+
1214
+
1215
+ void Assembler::j(Condition cc, Label* L) {
1216
+ if (cc == always) {
1217
+ jmp(L);
1218
+ return;
1219
+ } else if (cc == never) {
1220
+ return;
1221
+ }
1222
+ EnsureSpace ensure_space(this);
1223
+ ASSERT(is_uint4(cc));
1224
+ if (L->is_bound()) {
1225
+ const int short_size = 2;
1226
+ const int long_size = 6;
1227
+ int offs = L->pos() - pc_offset();
1228
+ ASSERT(offs <= 0);
1229
+ if (is_int8(offs - short_size)) {
1230
+ // 0111 tttn #8-bit disp.
1231
+ emit(0x70 | cc);
1232
+ emit((offs - short_size) & 0xFF);
1233
+ } else {
1234
+ // 0000 1111 1000 tttn #32-bit disp.
1235
+ emit(0x0F);
1236
+ emit(0x80 | cc);
1237
+ emitl(offs - long_size);
1238
+ }
1239
+ } else if (L->is_linked()) {
1240
+ // 0000 1111 1000 tttn #32-bit disp.
1241
+ emit(0x0F);
1242
+ emit(0x80 | cc);
1243
+ emitl(L->pos());
1244
+ L->link_to(pc_offset() - sizeof(int32_t));
1245
+ } else {
1246
+ ASSERT(L->is_unused());
1247
+ emit(0x0F);
1248
+ emit(0x80 | cc);
1249
+ int32_t current = pc_offset();
1250
+ emitl(current);
1251
+ L->link_to(current);
1252
+ }
1253
+ }
1254
+
1255
+
1256
+ void Assembler::j(Condition cc,
1257
+ Handle<Code> target,
1258
+ RelocInfo::Mode rmode) {
1259
+ EnsureSpace ensure_space(this);
1260
+ ASSERT(is_uint4(cc));
1261
+ // 0000 1111 1000 tttn #32-bit disp.
1262
+ emit(0x0F);
1263
+ emit(0x80 | cc);
1264
+ emit_code_target(target, rmode);
1265
+ }
1266
+
1267
+
1268
+ void Assembler::j(Condition cc, NearLabel* L, Hint hint) {
1269
+ EnsureSpace ensure_space(this);
1270
+ ASSERT(0 <= cc && cc < 16);
1271
+ if (FLAG_emit_branch_hints && hint != no_hint) emit(hint);
1272
+ if (L->is_bound()) {
1273
+ const int short_size = 2;
1274
+ int offs = L->pos() - pc_offset();
1275
+ ASSERT(offs <= 0);
1276
+ ASSERT(is_int8(offs - short_size));
1277
+ // 0111 tttn #8-bit disp
1278
+ emit(0x70 | cc);
1279
+ emit((offs - short_size) & 0xFF);
1280
+ } else {
1281
+ emit(0x70 | cc);
1282
+ emit(0x00); // The displacement will be resolved later.
1283
+ L->link_to(pc_offset());
1284
+ }
1285
+ }
1286
+
1287
+
1288
+ void Assembler::jmp(Label* L) {
1289
+ EnsureSpace ensure_space(this);
1290
+ const int short_size = sizeof(int8_t);
1291
+ const int long_size = sizeof(int32_t);
1292
+ if (L->is_bound()) {
1293
+ int offs = L->pos() - pc_offset() - 1;
1294
+ ASSERT(offs <= 0);
1295
+ if (is_int8(offs - short_size)) {
1296
+ // 1110 1011 #8-bit disp.
1297
+ emit(0xEB);
1298
+ emit((offs - short_size) & 0xFF);
1299
+ } else {
1300
+ // 1110 1001 #32-bit disp.
1301
+ emit(0xE9);
1302
+ emitl(offs - long_size);
1303
+ }
1304
+ } else if (L->is_linked()) {
1305
+ // 1110 1001 #32-bit disp.
1306
+ emit(0xE9);
1307
+ emitl(L->pos());
1308
+ L->link_to(pc_offset() - long_size);
1309
+ } else {
1310
+ // 1110 1001 #32-bit disp.
1311
+ ASSERT(L->is_unused());
1312
+ emit(0xE9);
1313
+ int32_t current = pc_offset();
1314
+ emitl(current);
1315
+ L->link_to(current);
1316
+ }
1317
+ }
1318
+
1319
+
1320
+ void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) {
1321
+ EnsureSpace ensure_space(this);
1322
+ // 1110 1001 #32-bit disp.
1323
+ emit(0xE9);
1324
+ emit_code_target(target, rmode);
1325
+ }
1326
+
1327
+
1328
+ void Assembler::jmp(NearLabel* L) {
1329
+ EnsureSpace ensure_space(this);
1330
+ if (L->is_bound()) {
1331
+ const int short_size = sizeof(int8_t);
1332
+ int offs = L->pos() - pc_offset();
1333
+ ASSERT(offs <= 0);
1334
+ ASSERT(is_int8(offs - short_size));
1335
+ // 1110 1011 #8-bit disp.
1336
+ emit(0xEB);
1337
+ emit((offs - short_size) & 0xFF);
1338
+ } else {
1339
+ emit(0xEB);
1340
+ emit(0x00); // The displacement will be resolved later.
1341
+ L->link_to(pc_offset());
1342
+ }
1343
+ }
1344
+
1345
+
1346
+ void Assembler::jmp(Register target) {
1347
+ EnsureSpace ensure_space(this);
1348
+ // Opcode FF/4 r64.
1349
+ emit_optional_rex_32(target);
1350
+ emit(0xFF);
1351
+ emit_modrm(0x4, target);
1352
+ }
1353
+
1354
+
1355
+ void Assembler::jmp(const Operand& src) {
1356
+ EnsureSpace ensure_space(this);
1357
+ // Opcode FF/4 m64.
1358
+ emit_optional_rex_32(src);
1359
+ emit(0xFF);
1360
+ emit_operand(0x4, src);
1361
+ }
1362
+
1363
+
1364
+ void Assembler::lea(Register dst, const Operand& src) {
1365
+ EnsureSpace ensure_space(this);
1366
+ emit_rex_64(dst, src);
1367
+ emit(0x8D);
1368
+ emit_operand(dst, src);
1369
+ }
1370
+
1371
+
1372
+ void Assembler::leal(Register dst, const Operand& src) {
1373
+ EnsureSpace ensure_space(this);
1374
+ emit_optional_rex_32(dst, src);
1375
+ emit(0x8D);
1376
+ emit_operand(dst, src);
1377
+ }
1378
+
1379
+
1380
+ void Assembler::load_rax(void* value, RelocInfo::Mode mode) {
1381
+ EnsureSpace ensure_space(this);
1382
+ emit(0x48); // REX.W
1383
+ emit(0xA1);
1384
+ emitq(reinterpret_cast<uintptr_t>(value), mode);
1385
+ }
1386
+
1387
+
1388
+ void Assembler::load_rax(ExternalReference ref) {
1389
+ load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE);
1390
+ }
1391
+
1392
+
1393
+ void Assembler::leave() {
1394
+ EnsureSpace ensure_space(this);
1395
+ emit(0xC9);
1396
+ }
1397
+
1398
+
1399
+ void Assembler::movb(Register dst, const Operand& src) {
1400
+ EnsureSpace ensure_space(this);
1401
+ emit_rex_32(dst, src);
1402
+ emit(0x8A);
1403
+ emit_operand(dst, src);
1404
+ }
1405
+
1406
+
1407
+ void Assembler::movb(Register dst, Immediate imm) {
1408
+ EnsureSpace ensure_space(this);
1409
+ emit_rex_32(dst);
1410
+ emit(0xC6);
1411
+ emit_modrm(0x0, dst);
1412
+ emit(imm.value_);
1413
+ }
1414
+
1415
+
1416
+ void Assembler::movb(const Operand& dst, Register src) {
1417
+ EnsureSpace ensure_space(this);
1418
+ emit_rex_32(src, dst);
1419
+ emit(0x88);
1420
+ emit_operand(src, dst);
1421
+ }
1422
+
1423
+
1424
+ void Assembler::movw(const Operand& dst, Register src) {
1425
+ EnsureSpace ensure_space(this);
1426
+ emit(0x66);
1427
+ emit_optional_rex_32(src, dst);
1428
+ emit(0x89);
1429
+ emit_operand(src, dst);
1430
+ }
1431
+
1432
+
1433
+ void Assembler::movl(Register dst, const Operand& src) {
1434
+ EnsureSpace ensure_space(this);
1435
+ emit_optional_rex_32(dst, src);
1436
+ emit(0x8B);
1437
+ emit_operand(dst, src);
1438
+ }
1439
+
1440
+
1441
+ void Assembler::movl(Register dst, Register src) {
1442
+ EnsureSpace ensure_space(this);
1443
+ if (src.low_bits() == 4) {
1444
+ emit_optional_rex_32(src, dst);
1445
+ emit(0x89);
1446
+ emit_modrm(src, dst);
1447
+ } else {
1448
+ emit_optional_rex_32(dst, src);
1449
+ emit(0x8B);
1450
+ emit_modrm(dst, src);
1451
+ }
1452
+ }
1453
+
1454
+
1455
+ void Assembler::movl(const Operand& dst, Register src) {
1456
+ EnsureSpace ensure_space(this);
1457
+ emit_optional_rex_32(src, dst);
1458
+ emit(0x89);
1459
+ emit_operand(src, dst);
1460
+ }
1461
+
1462
+
1463
+ void Assembler::movl(const Operand& dst, Immediate value) {
1464
+ EnsureSpace ensure_space(this);
1465
+ emit_optional_rex_32(dst);
1466
+ emit(0xC7);
1467
+ emit_operand(0x0, dst);
1468
+ emit(value); // Only 32-bit immediates are possible, not 8-bit immediates.
1469
+ }
1470
+
1471
+
1472
+ void Assembler::movl(Register dst, Immediate value) {
1473
+ EnsureSpace ensure_space(this);
1474
+ emit_optional_rex_32(dst);
1475
+ emit(0xC7);
1476
+ emit_modrm(0x0, dst);
1477
+ emit(value); // Only 32-bit immediates are possible, not 8-bit immediates.
1478
+ }
1479
+
1480
+
1481
+ void Assembler::movq(Register dst, const Operand& src) {
1482
+ EnsureSpace ensure_space(this);
1483
+ emit_rex_64(dst, src);
1484
+ emit(0x8B);
1485
+ emit_operand(dst, src);
1486
+ }
1487
+
1488
+
1489
+ void Assembler::movq(Register dst, Register src) {
1490
+ EnsureSpace ensure_space(this);
1491
+ if (src.low_bits() == 4) {
1492
+ emit_rex_64(src, dst);
1493
+ emit(0x89);
1494
+ emit_modrm(src, dst);
1495
+ } else {
1496
+ emit_rex_64(dst, src);
1497
+ emit(0x8B);
1498
+ emit_modrm(dst, src);
1499
+ }
1500
+ }
1501
+
1502
+
1503
+ void Assembler::movq(Register dst, Immediate value) {
1504
+ EnsureSpace ensure_space(this);
1505
+ emit_rex_64(dst);
1506
+ emit(0xC7);
1507
+ emit_modrm(0x0, dst);
1508
+ emit(value); // Only 32-bit immediates are possible, not 8-bit immediates.
1509
+ }
1510
+
1511
+
1512
+ void Assembler::movq(const Operand& dst, Register src) {
1513
+ EnsureSpace ensure_space(this);
1514
+ emit_rex_64(src, dst);
1515
+ emit(0x89);
1516
+ emit_operand(src, dst);
1517
+ }
1518
+
1519
+
1520
+ void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) {
1521
+ // This method must not be used with heap object references. The stored
1522
+ // address is not GC safe. Use the handle version instead.
1523
+ ASSERT(rmode > RelocInfo::LAST_GCED_ENUM);
1524
+ EnsureSpace ensure_space(this);
1525
+ emit_rex_64(dst);
1526
+ emit(0xB8 | dst.low_bits());
1527
+ emitq(reinterpret_cast<uintptr_t>(value), rmode);
1528
+ }
1529
+
1530
+
1531
+ void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) {
1532
+ // Non-relocatable values might not need a 64-bit representation.
1533
+ if (rmode == RelocInfo::NONE) {
1534
+ // Sadly, there is no zero or sign extending move for 8-bit immediates.
1535
+ if (is_int32(value)) {
1536
+ movq(dst, Immediate(static_cast<int32_t>(value)));
1537
+ return;
1538
+ } else if (is_uint32(value)) {
1539
+ movl(dst, Immediate(static_cast<int32_t>(value)));
1540
+ return;
1541
+ }
1542
+ // Value cannot be represented by 32 bits, so do a full 64 bit immediate
1543
+ // value.
1544
+ }
1545
+ EnsureSpace ensure_space(this);
1546
+ emit_rex_64(dst);
1547
+ emit(0xB8 | dst.low_bits());
1548
+ emitq(value, rmode);
1549
+ }
1550
+
1551
+
1552
+ void Assembler::movq(Register dst, ExternalReference ref) {
1553
+ int64_t value = reinterpret_cast<int64_t>(ref.address());
1554
+ movq(dst, value, RelocInfo::EXTERNAL_REFERENCE);
1555
+ }
1556
+
1557
+
1558
+ void Assembler::movq(const Operand& dst, Immediate value) {
1559
+ EnsureSpace ensure_space(this);
1560
+ emit_rex_64(dst);
1561
+ emit(0xC7);
1562
+ emit_operand(0, dst);
1563
+ emit(value);
1564
+ }
1565
+
1566
+
1567
+ // Loads the ip-relative location of the src label into the target location
1568
+ // (as a 32-bit offset sign extended to 64-bit).
1569
+ void Assembler::movl(const Operand& dst, Label* src) {
1570
+ EnsureSpace ensure_space(this);
1571
+ emit_optional_rex_32(dst);
1572
+ emit(0xC7);
1573
+ emit_operand(0, dst);
1574
+ if (src->is_bound()) {
1575
+ int offset = src->pos() - pc_offset() - sizeof(int32_t);
1576
+ ASSERT(offset <= 0);
1577
+ emitl(offset);
1578
+ } else if (src->is_linked()) {
1579
+ emitl(src->pos());
1580
+ src->link_to(pc_offset() - sizeof(int32_t));
1581
+ } else {
1582
+ ASSERT(src->is_unused());
1583
+ int32_t current = pc_offset();
1584
+ emitl(current);
1585
+ src->link_to(current);
1586
+ }
1587
+ }
1588
+
1589
+
1590
+ void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) {
1591
+ // If there is no relocation info, emit the value of the handle efficiently
1592
+ // (possibly using less that 8 bytes for the value).
1593
+ if (mode == RelocInfo::NONE) {
1594
+ // There is no possible reason to store a heap pointer without relocation
1595
+ // info, so it must be a smi.
1596
+ ASSERT(value->IsSmi());
1597
+ movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE);
1598
+ } else {
1599
+ EnsureSpace ensure_space(this);
1600
+ ASSERT(value->IsHeapObject());
1601
+ ASSERT(!HEAP->InNewSpace(*value));
1602
+ emit_rex_64(dst);
1603
+ emit(0xB8 | dst.low_bits());
1604
+ emitq(reinterpret_cast<uintptr_t>(value.location()), mode);
1605
+ }
1606
+ }
1607
+
1608
+
1609
+ void Assembler::movsxbq(Register dst, const Operand& src) {
1610
+ EnsureSpace ensure_space(this);
1611
+ emit_rex_64(dst, src);
1612
+ emit(0x0F);
1613
+ emit(0xBE);
1614
+ emit_operand(dst, src);
1615
+ }
1616
+
1617
+
1618
+ void Assembler::movsxwq(Register dst, const Operand& src) {
1619
+ EnsureSpace ensure_space(this);
1620
+ emit_rex_64(dst, src);
1621
+ emit(0x0F);
1622
+ emit(0xBF);
1623
+ emit_operand(dst, src);
1624
+ }
1625
+
1626
+
1627
+ void Assembler::movsxlq(Register dst, Register src) {
1628
+ EnsureSpace ensure_space(this);
1629
+ emit_rex_64(dst, src);
1630
+ emit(0x63);
1631
+ emit_modrm(dst, src);
1632
+ }
1633
+
1634
+
1635
+ void Assembler::movsxlq(Register dst, const Operand& src) {
1636
+ EnsureSpace ensure_space(this);
1637
+ emit_rex_64(dst, src);
1638
+ emit(0x63);
1639
+ emit_operand(dst, src);
1640
+ }
1641
+
1642
+
1643
+ void Assembler::movzxbq(Register dst, const Operand& src) {
1644
+ EnsureSpace ensure_space(this);
1645
+ emit_optional_rex_32(dst, src);
1646
+ emit(0x0F);
1647
+ emit(0xB6);
1648
+ emit_operand(dst, src);
1649
+ }
1650
+
1651
+
1652
+ void Assembler::movzxbl(Register dst, const Operand& src) {
1653
+ EnsureSpace ensure_space(this);
1654
+ emit_optional_rex_32(dst, src);
1655
+ emit(0x0F);
1656
+ emit(0xB6);
1657
+ emit_operand(dst, src);
1658
+ }
1659
+
1660
+
1661
+ void Assembler::movzxwq(Register dst, const Operand& src) {
1662
+ EnsureSpace ensure_space(this);
1663
+ emit_optional_rex_32(dst, src);
1664
+ emit(0x0F);
1665
+ emit(0xB7);
1666
+ emit_operand(dst, src);
1667
+ }
1668
+
1669
+
1670
+ void Assembler::movzxwl(Register dst, const Operand& src) {
1671
+ EnsureSpace ensure_space(this);
1672
+ emit_optional_rex_32(dst, src);
1673
+ emit(0x0F);
1674
+ emit(0xB7);
1675
+ emit_operand(dst, src);
1676
+ }
1677
+
1678
+
1679
+ void Assembler::repmovsb() {
1680
+ EnsureSpace ensure_space(this);
1681
+ emit(0xF3);
1682
+ emit(0xA4);
1683
+ }
1684
+
1685
+
1686
+ void Assembler::repmovsw() {
1687
+ EnsureSpace ensure_space(this);
1688
+ emit(0x66); // Operand size override.
1689
+ emit(0xF3);
1690
+ emit(0xA4);
1691
+ }
1692
+
1693
+
1694
+ void Assembler::repmovsl() {
1695
+ EnsureSpace ensure_space(this);
1696
+ emit(0xF3);
1697
+ emit(0xA5);
1698
+ }
1699
+
1700
+
1701
+ void Assembler::repmovsq() {
1702
+ EnsureSpace ensure_space(this);
1703
+ emit(0xF3);
1704
+ emit_rex_64();
1705
+ emit(0xA5);
1706
+ }
1707
+
1708
+
1709
+ void Assembler::mul(Register src) {
1710
+ EnsureSpace ensure_space(this);
1711
+ emit_rex_64(src);
1712
+ emit(0xF7);
1713
+ emit_modrm(0x4, src);
1714
+ }
1715
+
1716
+
1717
+ void Assembler::neg(Register dst) {
1718
+ EnsureSpace ensure_space(this);
1719
+ emit_rex_64(dst);
1720
+ emit(0xF7);
1721
+ emit_modrm(0x3, dst);
1722
+ }
1723
+
1724
+
1725
+ void Assembler::negl(Register dst) {
1726
+ EnsureSpace ensure_space(this);
1727
+ emit_optional_rex_32(dst);
1728
+ emit(0xF7);
1729
+ emit_modrm(0x3, dst);
1730
+ }
1731
+
1732
+
1733
+ void Assembler::neg(const Operand& dst) {
1734
+ EnsureSpace ensure_space(this);
1735
+ emit_rex_64(dst);
1736
+ emit(0xF7);
1737
+ emit_operand(3, dst);
1738
+ }
1739
+
1740
+
1741
+ void Assembler::nop() {
1742
+ EnsureSpace ensure_space(this);
1743
+ emit(0x90);
1744
+ }
1745
+
1746
+
1747
+ void Assembler::not_(Register dst) {
1748
+ EnsureSpace ensure_space(this);
1749
+ emit_rex_64(dst);
1750
+ emit(0xF7);
1751
+ emit_modrm(0x2, dst);
1752
+ }
1753
+
1754
+
1755
+ void Assembler::not_(const Operand& dst) {
1756
+ EnsureSpace ensure_space(this);
1757
+ emit_rex_64(dst);
1758
+ emit(0xF7);
1759
+ emit_operand(2, dst);
1760
+ }
1761
+
1762
+
1763
+ void Assembler::notl(Register dst) {
1764
+ EnsureSpace ensure_space(this);
1765
+ emit_optional_rex_32(dst);
1766
+ emit(0xF7);
1767
+ emit_modrm(0x2, dst);
1768
+ }
1769
+
1770
+
1771
+ void Assembler::nop(int n) {
1772
+ // The recommended muti-byte sequences of NOP instructions from the Intel 64
1773
+ // and IA-32 Architectures Software Developer's Manual.
1774
+ //
1775
+ // Length Assembly Byte Sequence
1776
+ // 2 bytes 66 NOP 66 90H
1777
+ // 3 bytes NOP DWORD ptr [EAX] 0F 1F 00H
1778
+ // 4 bytes NOP DWORD ptr [EAX + 00H] 0F 1F 40 00H
1779
+ // 5 bytes NOP DWORD ptr [EAX + EAX*1 + 00H] 0F 1F 44 00 00H
1780
+ // 6 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 00H] 66 0F 1F 44 00 00H
1781
+ // 7 bytes NOP DWORD ptr [EAX + 00000000H] 0F 1F 80 00 00 00 00H
1782
+ // 8 bytes NOP DWORD ptr [EAX + EAX*1 + 00000000H] 0F 1F 84 00 00 00 00 00H
1783
+ // 9 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 66 0F 1F 84 00 00 00 00
1784
+ // 00000000H] 00H
1785
+
1786
+ ASSERT(1 <= n);
1787
+ ASSERT(n <= 9);
1788
+ EnsureSpace ensure_space(this);
1789
+ switch (n) {
1790
+ case 1:
1791
+ emit(0x90);
1792
+ return;
1793
+ case 2:
1794
+ emit(0x66);
1795
+ emit(0x90);
1796
+ return;
1797
+ case 3:
1798
+ emit(0x0f);
1799
+ emit(0x1f);
1800
+ emit(0x00);
1801
+ return;
1802
+ case 4:
1803
+ emit(0x0f);
1804
+ emit(0x1f);
1805
+ emit(0x40);
1806
+ emit(0x00);
1807
+ return;
1808
+ case 5:
1809
+ emit(0x0f);
1810
+ emit(0x1f);
1811
+ emit(0x44);
1812
+ emit(0x00);
1813
+ emit(0x00);
1814
+ return;
1815
+ case 6:
1816
+ emit(0x66);
1817
+ emit(0x0f);
1818
+ emit(0x1f);
1819
+ emit(0x44);
1820
+ emit(0x00);
1821
+ emit(0x00);
1822
+ return;
1823
+ case 7:
1824
+ emit(0x0f);
1825
+ emit(0x1f);
1826
+ emit(0x80);
1827
+ emit(0x00);
1828
+ emit(0x00);
1829
+ emit(0x00);
1830
+ emit(0x00);
1831
+ return;
1832
+ case 8:
1833
+ emit(0x0f);
1834
+ emit(0x1f);
1835
+ emit(0x84);
1836
+ emit(0x00);
1837
+ emit(0x00);
1838
+ emit(0x00);
1839
+ emit(0x00);
1840
+ emit(0x00);
1841
+ return;
1842
+ case 9:
1843
+ emit(0x66);
1844
+ emit(0x0f);
1845
+ emit(0x1f);
1846
+ emit(0x84);
1847
+ emit(0x00);
1848
+ emit(0x00);
1849
+ emit(0x00);
1850
+ emit(0x00);
1851
+ emit(0x00);
1852
+ return;
1853
+ }
1854
+ }
1855
+
1856
+
1857
+ void Assembler::pop(Register dst) {
1858
+ EnsureSpace ensure_space(this);
1859
+ emit_optional_rex_32(dst);
1860
+ emit(0x58 | dst.low_bits());
1861
+ }
1862
+
1863
+
1864
+ void Assembler::pop(const Operand& dst) {
1865
+ EnsureSpace ensure_space(this);
1866
+ emit_optional_rex_32(dst);
1867
+ emit(0x8F);
1868
+ emit_operand(0, dst);
1869
+ }
1870
+
1871
+
1872
+ void Assembler::popfq() {
1873
+ EnsureSpace ensure_space(this);
1874
+ emit(0x9D);
1875
+ }
1876
+
1877
+
1878
+ void Assembler::push(Register src) {
1879
+ EnsureSpace ensure_space(this);
1880
+ emit_optional_rex_32(src);
1881
+ emit(0x50 | src.low_bits());
1882
+ }
1883
+
1884
+
1885
+ void Assembler::push(const Operand& src) {
1886
+ EnsureSpace ensure_space(this);
1887
+ emit_optional_rex_32(src);
1888
+ emit(0xFF);
1889
+ emit_operand(6, src);
1890
+ }
1891
+
1892
+
1893
+ void Assembler::push(Immediate value) {
1894
+ EnsureSpace ensure_space(this);
1895
+ if (is_int8(value.value_)) {
1896
+ emit(0x6A);
1897
+ emit(value.value_); // Emit low byte of value.
1898
+ } else {
1899
+ emit(0x68);
1900
+ emitl(value.value_);
1901
+ }
1902
+ }
1903
+
1904
+
1905
+ void Assembler::push_imm32(int32_t imm32) {
1906
+ EnsureSpace ensure_space(this);
1907
+ emit(0x68);
1908
+ emitl(imm32);
1909
+ }
1910
+
1911
+
1912
+ void Assembler::pushfq() {
1913
+ EnsureSpace ensure_space(this);
1914
+ emit(0x9C);
1915
+ }
1916
+
1917
+
1918
+ void Assembler::rdtsc() {
1919
+ EnsureSpace ensure_space(this);
1920
+ emit(0x0F);
1921
+ emit(0x31);
1922
+ }
1923
+
1924
+
1925
+ void Assembler::ret(int imm16) {
1926
+ EnsureSpace ensure_space(this);
1927
+ ASSERT(is_uint16(imm16));
1928
+ if (imm16 == 0) {
1929
+ emit(0xC3);
1930
+ } else {
1931
+ emit(0xC2);
1932
+ emit(imm16 & 0xFF);
1933
+ emit((imm16 >> 8) & 0xFF);
1934
+ }
1935
+ }
1936
+
1937
+
1938
+ void Assembler::setcc(Condition cc, Register reg) {
1939
+ if (cc > last_condition) {
1940
+ movb(reg, Immediate(cc == always ? 1 : 0));
1941
+ return;
1942
+ }
1943
+ EnsureSpace ensure_space(this);
1944
+ ASSERT(is_uint4(cc));
1945
+ if (reg.code() > 3) { // Use x64 byte registers, where different.
1946
+ emit_rex_32(reg);
1947
+ }
1948
+ emit(0x0F);
1949
+ emit(0x90 | cc);
1950
+ emit_modrm(0x0, reg);
1951
+ }
1952
+
1953
+
1954
+ void Assembler::shld(Register dst, Register src) {
1955
+ EnsureSpace ensure_space(this);
1956
+ emit_rex_64(src, dst);
1957
+ emit(0x0F);
1958
+ emit(0xA5);
1959
+ emit_modrm(src, dst);
1960
+ }
1961
+
1962
+
1963
+ void Assembler::shrd(Register dst, Register src) {
1964
+ EnsureSpace ensure_space(this);
1965
+ emit_rex_64(src, dst);
1966
+ emit(0x0F);
1967
+ emit(0xAD);
1968
+ emit_modrm(src, dst);
1969
+ }
1970
+
1971
+
1972
+ void Assembler::xchg(Register dst, Register src) {
1973
+ EnsureSpace ensure_space(this);
1974
+ if (src.is(rax) || dst.is(rax)) { // Single-byte encoding
1975
+ Register other = src.is(rax) ? dst : src;
1976
+ emit_rex_64(other);
1977
+ emit(0x90 | other.low_bits());
1978
+ } else if (dst.low_bits() == 4) {
1979
+ emit_rex_64(dst, src);
1980
+ emit(0x87);
1981
+ emit_modrm(dst, src);
1982
+ } else {
1983
+ emit_rex_64(src, dst);
1984
+ emit(0x87);
1985
+ emit_modrm(src, dst);
1986
+ }
1987
+ }
1988
+
1989
+
1990
+ void Assembler::store_rax(void* dst, RelocInfo::Mode mode) {
1991
+ EnsureSpace ensure_space(this);
1992
+ emit(0x48); // REX.W
1993
+ emit(0xA3);
1994
+ emitq(reinterpret_cast<uintptr_t>(dst), mode);
1995
+ }
1996
+
1997
+
1998
+ void Assembler::store_rax(ExternalReference ref) {
1999
+ store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE);
2000
+ }
2001
+
2002
+
2003
+ void Assembler::testb(Register dst, Register src) {
2004
+ EnsureSpace ensure_space(this);
2005
+ if (src.low_bits() == 4) {
2006
+ emit_rex_32(src, dst);
2007
+ emit(0x84);
2008
+ emit_modrm(src, dst);
2009
+ } else {
2010
+ if (dst.code() > 3 || src.code() > 3) {
2011
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
2012
+ emit_rex_32(dst, src);
2013
+ }
2014
+ emit(0x84);
2015
+ emit_modrm(dst, src);
2016
+ }
2017
+ }
2018
+
2019
+
2020
+ void Assembler::testb(Register reg, Immediate mask) {
2021
+ ASSERT(is_int8(mask.value_) || is_uint8(mask.value_));
2022
+ EnsureSpace ensure_space(this);
2023
+ if (reg.is(rax)) {
2024
+ emit(0xA8);
2025
+ emit(mask.value_); // Low byte emitted.
2026
+ } else {
2027
+ if (reg.code() > 3) {
2028
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
2029
+ emit_rex_32(reg);
2030
+ }
2031
+ emit(0xF6);
2032
+ emit_modrm(0x0, reg);
2033
+ emit(mask.value_); // Low byte emitted.
2034
+ }
2035
+ }
2036
+
2037
+
2038
+ void Assembler::testb(const Operand& op, Immediate mask) {
2039
+ ASSERT(is_int8(mask.value_) || is_uint8(mask.value_));
2040
+ EnsureSpace ensure_space(this);
2041
+ emit_optional_rex_32(rax, op);
2042
+ emit(0xF6);
2043
+ emit_operand(rax, op); // Operation code 0
2044
+ emit(mask.value_); // Low byte emitted.
2045
+ }
2046
+
2047
+
2048
+ void Assembler::testb(const Operand& op, Register reg) {
2049
+ EnsureSpace ensure_space(this);
2050
+ if (reg.code() > 3) {
2051
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
2052
+ emit_rex_32(reg, op);
2053
+ } else {
2054
+ emit_optional_rex_32(reg, op);
2055
+ }
2056
+ emit(0x84);
2057
+ emit_operand(reg, op);
2058
+ }
2059
+
2060
+
2061
+ void Assembler::testl(Register dst, Register src) {
2062
+ EnsureSpace ensure_space(this);
2063
+ if (src.low_bits() == 4) {
2064
+ emit_optional_rex_32(src, dst);
2065
+ emit(0x85);
2066
+ emit_modrm(src, dst);
2067
+ } else {
2068
+ emit_optional_rex_32(dst, src);
2069
+ emit(0x85);
2070
+ emit_modrm(dst, src);
2071
+ }
2072
+ }
2073
+
2074
+
2075
+ void Assembler::testl(Register reg, Immediate mask) {
2076
+ // testl with a mask that fits in the low byte is exactly testb.
2077
+ if (is_uint8(mask.value_)) {
2078
+ testb(reg, mask);
2079
+ return;
2080
+ }
2081
+ EnsureSpace ensure_space(this);
2082
+ if (reg.is(rax)) {
2083
+ emit(0xA9);
2084
+ emit(mask);
2085
+ } else {
2086
+ emit_optional_rex_32(rax, reg);
2087
+ emit(0xF7);
2088
+ emit_modrm(0x0, reg);
2089
+ emit(mask);
2090
+ }
2091
+ }
2092
+
2093
+
2094
+ void Assembler::testl(const Operand& op, Immediate mask) {
2095
+ // testl with a mask that fits in the low byte is exactly testb.
2096
+ if (is_uint8(mask.value_)) {
2097
+ testb(op, mask);
2098
+ return;
2099
+ }
2100
+ EnsureSpace ensure_space(this);
2101
+ emit_optional_rex_32(rax, op);
2102
+ emit(0xF7);
2103
+ emit_operand(rax, op); // Operation code 0
2104
+ emit(mask);
2105
+ }
2106
+
2107
+
2108
+ void Assembler::testq(const Operand& op, Register reg) {
2109
+ EnsureSpace ensure_space(this);
2110
+ emit_rex_64(reg, op);
2111
+ emit(0x85);
2112
+ emit_operand(reg, op);
2113
+ }
2114
+
2115
+
2116
+ void Assembler::testq(Register dst, Register src) {
2117
+ EnsureSpace ensure_space(this);
2118
+ if (src.low_bits() == 4) {
2119
+ emit_rex_64(src, dst);
2120
+ emit(0x85);
2121
+ emit_modrm(src, dst);
2122
+ } else {
2123
+ emit_rex_64(dst, src);
2124
+ emit(0x85);
2125
+ emit_modrm(dst, src);
2126
+ }
2127
+ }
2128
+
2129
+
2130
+ void Assembler::testq(Register dst, Immediate mask) {
2131
+ EnsureSpace ensure_space(this);
2132
+ if (dst.is(rax)) {
2133
+ emit_rex_64();
2134
+ emit(0xA9);
2135
+ emit(mask);
2136
+ } else {
2137
+ emit_rex_64(dst);
2138
+ emit(0xF7);
2139
+ emit_modrm(0, dst);
2140
+ emit(mask);
2141
+ }
2142
+ }
2143
+
2144
+
2145
+ // FPU instructions.
2146
+
2147
+
2148
+ void Assembler::fld(int i) {
2149
+ EnsureSpace ensure_space(this);
2150
+ emit_farith(0xD9, 0xC0, i);
2151
+ }
2152
+
2153
+
2154
+ void Assembler::fld1() {
2155
+ EnsureSpace ensure_space(this);
2156
+ emit(0xD9);
2157
+ emit(0xE8);
2158
+ }
2159
+
2160
+
2161
+ void Assembler::fldz() {
2162
+ EnsureSpace ensure_space(this);
2163
+ emit(0xD9);
2164
+ emit(0xEE);
2165
+ }
2166
+
2167
+
2168
+ void Assembler::fldpi() {
2169
+ EnsureSpace ensure_space(this);
2170
+ emit(0xD9);
2171
+ emit(0xEB);
2172
+ }
2173
+
2174
+
2175
+ void Assembler::fldln2() {
2176
+ EnsureSpace ensure_space(this);
2177
+ emit(0xD9);
2178
+ emit(0xED);
2179
+ }
2180
+
2181
+
2182
+ void Assembler::fld_s(const Operand& adr) {
2183
+ EnsureSpace ensure_space(this);
2184
+ emit_optional_rex_32(adr);
2185
+ emit(0xD9);
2186
+ emit_operand(0, adr);
2187
+ }
2188
+
2189
+
2190
+ void Assembler::fld_d(const Operand& adr) {
2191
+ EnsureSpace ensure_space(this);
2192
+ emit_optional_rex_32(adr);
2193
+ emit(0xDD);
2194
+ emit_operand(0, adr);
2195
+ }
2196
+
2197
+
2198
+ void Assembler::fstp_s(const Operand& adr) {
2199
+ EnsureSpace ensure_space(this);
2200
+ emit_optional_rex_32(adr);
2201
+ emit(0xD9);
2202
+ emit_operand(3, adr);
2203
+ }
2204
+
2205
+
2206
+ void Assembler::fstp_d(const Operand& adr) {
2207
+ EnsureSpace ensure_space(this);
2208
+ emit_optional_rex_32(adr);
2209
+ emit(0xDD);
2210
+ emit_operand(3, adr);
2211
+ }
2212
+
2213
+
2214
+ void Assembler::fstp(int index) {
2215
+ ASSERT(is_uint3(index));
2216
+ EnsureSpace ensure_space(this);
2217
+ emit_farith(0xDD, 0xD8, index);
2218
+ }
2219
+
2220
+
2221
+ void Assembler::fild_s(const Operand& adr) {
2222
+ EnsureSpace ensure_space(this);
2223
+ emit_optional_rex_32(adr);
2224
+ emit(0xDB);
2225
+ emit_operand(0, adr);
2226
+ }
2227
+
2228
+
2229
+ void Assembler::fild_d(const Operand& adr) {
2230
+ EnsureSpace ensure_space(this);
2231
+ emit_optional_rex_32(adr);
2232
+ emit(0xDF);
2233
+ emit_operand(5, adr);
2234
+ }
2235
+
2236
+
2237
+ void Assembler::fistp_s(const Operand& adr) {
2238
+ EnsureSpace ensure_space(this);
2239
+ emit_optional_rex_32(adr);
2240
+ emit(0xDB);
2241
+ emit_operand(3, adr);
2242
+ }
2243
+
2244
+
2245
+ void Assembler::fisttp_s(const Operand& adr) {
2246
+ ASSERT(CpuFeatures::IsEnabled(SSE3));
2247
+ EnsureSpace ensure_space(this);
2248
+ emit_optional_rex_32(adr);
2249
+ emit(0xDB);
2250
+ emit_operand(1, adr);
2251
+ }
2252
+
2253
+
2254
+ void Assembler::fisttp_d(const Operand& adr) {
2255
+ ASSERT(CpuFeatures::IsEnabled(SSE3));
2256
+ EnsureSpace ensure_space(this);
2257
+ emit_optional_rex_32(adr);
2258
+ emit(0xDD);
2259
+ emit_operand(1, adr);
2260
+ }
2261
+
2262
+
2263
+ void Assembler::fist_s(const Operand& adr) {
2264
+ EnsureSpace ensure_space(this);
2265
+ emit_optional_rex_32(adr);
2266
+ emit(0xDB);
2267
+ emit_operand(2, adr);
2268
+ }
2269
+
2270
+
2271
+ void Assembler::fistp_d(const Operand& adr) {
2272
+ EnsureSpace ensure_space(this);
2273
+ emit_optional_rex_32(adr);
2274
+ emit(0xDF);
2275
+ emit_operand(7, adr);
2276
+ }
2277
+
2278
+
2279
+ void Assembler::fabs() {
2280
+ EnsureSpace ensure_space(this);
2281
+ emit(0xD9);
2282
+ emit(0xE1);
2283
+ }
2284
+
2285
+
2286
+ void Assembler::fchs() {
2287
+ EnsureSpace ensure_space(this);
2288
+ emit(0xD9);
2289
+ emit(0xE0);
2290
+ }
2291
+
2292
+
2293
+ void Assembler::fcos() {
2294
+ EnsureSpace ensure_space(this);
2295
+ emit(0xD9);
2296
+ emit(0xFF);
2297
+ }
2298
+
2299
+
2300
+ void Assembler::fsin() {
2301
+ EnsureSpace ensure_space(this);
2302
+ emit(0xD9);
2303
+ emit(0xFE);
2304
+ }
2305
+
2306
+
2307
+ void Assembler::fyl2x() {
2308
+ EnsureSpace ensure_space(this);
2309
+ emit(0xD9);
2310
+ emit(0xF1);
2311
+ }
2312
+
2313
+
2314
+ void Assembler::fadd(int i) {
2315
+ EnsureSpace ensure_space(this);
2316
+ emit_farith(0xDC, 0xC0, i);
2317
+ }
2318
+
2319
+
2320
+ void Assembler::fsub(int i) {
2321
+ EnsureSpace ensure_space(this);
2322
+ emit_farith(0xDC, 0xE8, i);
2323
+ }
2324
+
2325
+
2326
+ void Assembler::fisub_s(const Operand& adr) {
2327
+ EnsureSpace ensure_space(this);
2328
+ emit_optional_rex_32(adr);
2329
+ emit(0xDA);
2330
+ emit_operand(4, adr);
2331
+ }
2332
+
2333
+
2334
+ void Assembler::fmul(int i) {
2335
+ EnsureSpace ensure_space(this);
2336
+ emit_farith(0xDC, 0xC8, i);
2337
+ }
2338
+
2339
+
2340
+ void Assembler::fdiv(int i) {
2341
+ EnsureSpace ensure_space(this);
2342
+ emit_farith(0xDC, 0xF8, i);
2343
+ }
2344
+
2345
+
2346
+ void Assembler::faddp(int i) {
2347
+ EnsureSpace ensure_space(this);
2348
+ emit_farith(0xDE, 0xC0, i);
2349
+ }
2350
+
2351
+
2352
+ void Assembler::fsubp(int i) {
2353
+ EnsureSpace ensure_space(this);
2354
+ emit_farith(0xDE, 0xE8, i);
2355
+ }
2356
+
2357
+
2358
+ void Assembler::fsubrp(int i) {
2359
+ EnsureSpace ensure_space(this);
2360
+ emit_farith(0xDE, 0xE0, i);
2361
+ }
2362
+
2363
+
2364
+ void Assembler::fmulp(int i) {
2365
+ EnsureSpace ensure_space(this);
2366
+ emit_farith(0xDE, 0xC8, i);
2367
+ }
2368
+
2369
+
2370
+ void Assembler::fdivp(int i) {
2371
+ EnsureSpace ensure_space(this);
2372
+ emit_farith(0xDE, 0xF8, i);
2373
+ }
2374
+
2375
+
2376
+ void Assembler::fprem() {
2377
+ EnsureSpace ensure_space(this);
2378
+ emit(0xD9);
2379
+ emit(0xF8);
2380
+ }
2381
+
2382
+
2383
+ void Assembler::fprem1() {
2384
+ EnsureSpace ensure_space(this);
2385
+ emit(0xD9);
2386
+ emit(0xF5);
2387
+ }
2388
+
2389
+
2390
+ void Assembler::fxch(int i) {
2391
+ EnsureSpace ensure_space(this);
2392
+ emit_farith(0xD9, 0xC8, i);
2393
+ }
2394
+
2395
+
2396
+ void Assembler::fincstp() {
2397
+ EnsureSpace ensure_space(this);
2398
+ emit(0xD9);
2399
+ emit(0xF7);
2400
+ }
2401
+
2402
+
2403
+ void Assembler::ffree(int i) {
2404
+ EnsureSpace ensure_space(this);
2405
+ emit_farith(0xDD, 0xC0, i);
2406
+ }
2407
+
2408
+
2409
+ void Assembler::ftst() {
2410
+ EnsureSpace ensure_space(this);
2411
+ emit(0xD9);
2412
+ emit(0xE4);
2413
+ }
2414
+
2415
+
2416
+ void Assembler::fucomp(int i) {
2417
+ EnsureSpace ensure_space(this);
2418
+ emit_farith(0xDD, 0xE8, i);
2419
+ }
2420
+
2421
+
2422
+ void Assembler::fucompp() {
2423
+ EnsureSpace ensure_space(this);
2424
+ emit(0xDA);
2425
+ emit(0xE9);
2426
+ }
2427
+
2428
+
2429
+ void Assembler::fucomi(int i) {
2430
+ EnsureSpace ensure_space(this);
2431
+ emit(0xDB);
2432
+ emit(0xE8 + i);
2433
+ }
2434
+
2435
+
2436
+ void Assembler::fucomip() {
2437
+ EnsureSpace ensure_space(this);
2438
+ emit(0xDF);
2439
+ emit(0xE9);
2440
+ }
2441
+
2442
+
2443
+ void Assembler::fcompp() {
2444
+ EnsureSpace ensure_space(this);
2445
+ emit(0xDE);
2446
+ emit(0xD9);
2447
+ }
2448
+
2449
+
2450
+ void Assembler::fnstsw_ax() {
2451
+ EnsureSpace ensure_space(this);
2452
+ emit(0xDF);
2453
+ emit(0xE0);
2454
+ }
2455
+
2456
+
2457
+ void Assembler::fwait() {
2458
+ EnsureSpace ensure_space(this);
2459
+ emit(0x9B);
2460
+ }
2461
+
2462
+
2463
+ void Assembler::frndint() {
2464
+ EnsureSpace ensure_space(this);
2465
+ emit(0xD9);
2466
+ emit(0xFC);
2467
+ }
2468
+
2469
+
2470
+ void Assembler::fnclex() {
2471
+ EnsureSpace ensure_space(this);
2472
+ emit(0xDB);
2473
+ emit(0xE2);
2474
+ }
2475
+
2476
+
2477
+ void Assembler::sahf() {
2478
+ // TODO(X64): Test for presence. Not all 64-bit intel CPU's have sahf
2479
+ // in 64-bit mode. Test CpuID.
2480
+ EnsureSpace ensure_space(this);
2481
+ emit(0x9E);
2482
+ }
2483
+
2484
+
2485
+ void Assembler::emit_farith(int b1, int b2, int i) {
2486
+ ASSERT(is_uint8(b1) && is_uint8(b2)); // wrong opcode
2487
+ ASSERT(is_uint3(i)); // illegal stack offset
2488
+ emit(b1);
2489
+ emit(b2 + i);
2490
+ }
2491
+
2492
+ // SSE 2 operations.
2493
+
2494
+ void Assembler::movd(XMMRegister dst, Register src) {
2495
+ EnsureSpace ensure_space(this);
2496
+ emit(0x66);
2497
+ emit_optional_rex_32(dst, src);
2498
+ emit(0x0F);
2499
+ emit(0x6E);
2500
+ emit_sse_operand(dst, src);
2501
+ }
2502
+
2503
+
2504
+ void Assembler::movd(Register dst, XMMRegister src) {
2505
+ EnsureSpace ensure_space(this);
2506
+ emit(0x66);
2507
+ emit_optional_rex_32(src, dst);
2508
+ emit(0x0F);
2509
+ emit(0x7E);
2510
+ emit_sse_operand(src, dst);
2511
+ }
2512
+
2513
+
2514
+ void Assembler::movq(XMMRegister dst, Register src) {
2515
+ EnsureSpace ensure_space(this);
2516
+ emit(0x66);
2517
+ emit_rex_64(dst, src);
2518
+ emit(0x0F);
2519
+ emit(0x6E);
2520
+ emit_sse_operand(dst, src);
2521
+ }
2522
+
2523
+
2524
+ void Assembler::movq(Register dst, XMMRegister src) {
2525
+ EnsureSpace ensure_space(this);
2526
+ emit(0x66);
2527
+ emit_rex_64(src, dst);
2528
+ emit(0x0F);
2529
+ emit(0x7E);
2530
+ emit_sse_operand(src, dst);
2531
+ }
2532
+
2533
+
2534
+ void Assembler::movdqa(const Operand& dst, XMMRegister src) {
2535
+ EnsureSpace ensure_space(this);
2536
+ emit(0x66);
2537
+ emit_rex_64(src, dst);
2538
+ emit(0x0F);
2539
+ emit(0x7F);
2540
+ emit_sse_operand(src, dst);
2541
+ }
2542
+
2543
+
2544
+ void Assembler::movdqa(XMMRegister dst, const Operand& src) {
2545
+ EnsureSpace ensure_space(this);
2546
+ emit(0x66);
2547
+ emit_rex_64(dst, src);
2548
+ emit(0x0F);
2549
+ emit(0x6F);
2550
+ emit_sse_operand(dst, src);
2551
+ }
2552
+
2553
+
2554
+ void Assembler::extractps(Register dst, XMMRegister src, byte imm8) {
2555
+ ASSERT(is_uint2(imm8));
2556
+ EnsureSpace ensure_space(this);
2557
+ emit(0x66);
2558
+ emit_optional_rex_32(dst, src);
2559
+ emit(0x0F);
2560
+ emit(0x3A);
2561
+ emit(0x17);
2562
+ emit_sse_operand(dst, src);
2563
+ emit(imm8);
2564
+ }
2565
+
2566
+
2567
+ void Assembler::movsd(const Operand& dst, XMMRegister src) {
2568
+ EnsureSpace ensure_space(this);
2569
+ emit(0xF2); // double
2570
+ emit_optional_rex_32(src, dst);
2571
+ emit(0x0F);
2572
+ emit(0x11); // store
2573
+ emit_sse_operand(src, dst);
2574
+ }
2575
+
2576
+
2577
+ void Assembler::movsd(XMMRegister dst, XMMRegister src) {
2578
+ EnsureSpace ensure_space(this);
2579
+ emit(0xF2); // double
2580
+ emit_optional_rex_32(dst, src);
2581
+ emit(0x0F);
2582
+ emit(0x10); // load
2583
+ emit_sse_operand(dst, src);
2584
+ }
2585
+
2586
+
2587
+ void Assembler::movsd(XMMRegister dst, const Operand& src) {
2588
+ EnsureSpace ensure_space(this);
2589
+ emit(0xF2); // double
2590
+ emit_optional_rex_32(dst, src);
2591
+ emit(0x0F);
2592
+ emit(0x10); // load
2593
+ emit_sse_operand(dst, src);
2594
+ }
2595
+
2596
+
2597
+ void Assembler::movss(XMMRegister dst, const Operand& src) {
2598
+ EnsureSpace ensure_space(this);
2599
+ emit(0xF3); // single
2600
+ emit_optional_rex_32(dst, src);
2601
+ emit(0x0F);
2602
+ emit(0x10); // load
2603
+ emit_sse_operand(dst, src);
2604
+ }
2605
+
2606
+
2607
+ void Assembler::movss(const Operand& src, XMMRegister dst) {
2608
+ EnsureSpace ensure_space(this);
2609
+ emit(0xF3); // single
2610
+ emit_optional_rex_32(dst, src);
2611
+ emit(0x0F);
2612
+ emit(0x11); // store
2613
+ emit_sse_operand(dst, src);
2614
+ }
2615
+
2616
+
2617
+ void Assembler::cvttss2si(Register dst, const Operand& src) {
2618
+ EnsureSpace ensure_space(this);
2619
+ emit(0xF3);
2620
+ emit_optional_rex_32(dst, src);
2621
+ emit(0x0F);
2622
+ emit(0x2C);
2623
+ emit_operand(dst, src);
2624
+ }
2625
+
2626
+
2627
+ void Assembler::cvttss2si(Register dst, XMMRegister src) {
2628
+ EnsureSpace ensure_space(this);
2629
+ emit(0xF3);
2630
+ emit_optional_rex_32(dst, src);
2631
+ emit(0x0F);
2632
+ emit(0x2C);
2633
+ emit_sse_operand(dst, src);
2634
+ }
2635
+
2636
+
2637
+ void Assembler::cvttsd2si(Register dst, const Operand& src) {
2638
+ EnsureSpace ensure_space(this);
2639
+ emit(0xF2);
2640
+ emit_optional_rex_32(dst, src);
2641
+ emit(0x0F);
2642
+ emit(0x2C);
2643
+ emit_operand(dst, src);
2644
+ }
2645
+
2646
+
2647
+ void Assembler::cvttsd2si(Register dst, XMMRegister src) {
2648
+ EnsureSpace ensure_space(this);
2649
+ emit(0xF2);
2650
+ emit_optional_rex_32(dst, src);
2651
+ emit(0x0F);
2652
+ emit(0x2C);
2653
+ emit_sse_operand(dst, src);
2654
+ }
2655
+
2656
+
2657
+ void Assembler::cvttsd2siq(Register dst, XMMRegister src) {
2658
+ EnsureSpace ensure_space(this);
2659
+ emit(0xF2);
2660
+ emit_rex_64(dst, src);
2661
+ emit(0x0F);
2662
+ emit(0x2C);
2663
+ emit_sse_operand(dst, src);
2664
+ }
2665
+
2666
+
2667
+ void Assembler::cvtlsi2sd(XMMRegister dst, const Operand& src) {
2668
+ EnsureSpace ensure_space(this);
2669
+ emit(0xF2);
2670
+ emit_optional_rex_32(dst, src);
2671
+ emit(0x0F);
2672
+ emit(0x2A);
2673
+ emit_sse_operand(dst, src);
2674
+ }
2675
+
2676
+
2677
+ void Assembler::cvtlsi2sd(XMMRegister dst, Register src) {
2678
+ EnsureSpace ensure_space(this);
2679
+ emit(0xF2);
2680
+ emit_optional_rex_32(dst, src);
2681
+ emit(0x0F);
2682
+ emit(0x2A);
2683
+ emit_sse_operand(dst, src);
2684
+ }
2685
+
2686
+
2687
+ void Assembler::cvtlsi2ss(XMMRegister dst, Register src) {
2688
+ EnsureSpace ensure_space(this);
2689
+ emit(0xF3);
2690
+ emit_optional_rex_32(dst, src);
2691
+ emit(0x0F);
2692
+ emit(0x2A);
2693
+ emit_sse_operand(dst, src);
2694
+ }
2695
+
2696
+
2697
+ void Assembler::cvtqsi2sd(XMMRegister dst, Register src) {
2698
+ EnsureSpace ensure_space(this);
2699
+ emit(0xF2);
2700
+ emit_rex_64(dst, src);
2701
+ emit(0x0F);
2702
+ emit(0x2A);
2703
+ emit_sse_operand(dst, src);
2704
+ }
2705
+
2706
+
2707
+ void Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) {
2708
+ EnsureSpace ensure_space(this);
2709
+ emit(0xF3);
2710
+ emit_optional_rex_32(dst, src);
2711
+ emit(0x0F);
2712
+ emit(0x5A);
2713
+ emit_sse_operand(dst, src);
2714
+ }
2715
+
2716
+
2717
+ void Assembler::cvtss2sd(XMMRegister dst, const Operand& src) {
2718
+ EnsureSpace ensure_space(this);
2719
+ emit(0xF3);
2720
+ emit_optional_rex_32(dst, src);
2721
+ emit(0x0F);
2722
+ emit(0x5A);
2723
+ emit_sse_operand(dst, src);
2724
+ }
2725
+
2726
+
2727
+ void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) {
2728
+ EnsureSpace ensure_space(this);
2729
+ emit(0xF2);
2730
+ emit_optional_rex_32(dst, src);
2731
+ emit(0x0F);
2732
+ emit(0x5A);
2733
+ emit_sse_operand(dst, src);
2734
+ }
2735
+
2736
+
2737
+ void Assembler::cvtsd2si(Register dst, XMMRegister src) {
2738
+ EnsureSpace ensure_space(this);
2739
+ emit(0xF2);
2740
+ emit_optional_rex_32(dst, src);
2741
+ emit(0x0F);
2742
+ emit(0x2D);
2743
+ emit_sse_operand(dst, src);
2744
+ }
2745
+
2746
+
2747
+ void Assembler::cvtsd2siq(Register dst, XMMRegister src) {
2748
+ EnsureSpace ensure_space(this);
2749
+ emit(0xF2);
2750
+ emit_rex_64(dst, src);
2751
+ emit(0x0F);
2752
+ emit(0x2D);
2753
+ emit_sse_operand(dst, src);
2754
+ }
2755
+
2756
+
2757
+ void Assembler::addsd(XMMRegister dst, XMMRegister src) {
2758
+ EnsureSpace ensure_space(this);
2759
+ emit(0xF2);
2760
+ emit_optional_rex_32(dst, src);
2761
+ emit(0x0F);
2762
+ emit(0x58);
2763
+ emit_sse_operand(dst, src);
2764
+ }
2765
+
2766
+
2767
+ void Assembler::mulsd(XMMRegister dst, XMMRegister src) {
2768
+ EnsureSpace ensure_space(this);
2769
+ emit(0xF2);
2770
+ emit_optional_rex_32(dst, src);
2771
+ emit(0x0F);
2772
+ emit(0x59);
2773
+ emit_sse_operand(dst, src);
2774
+ }
2775
+
2776
+
2777
+ void Assembler::subsd(XMMRegister dst, XMMRegister src) {
2778
+ EnsureSpace ensure_space(this);
2779
+ emit(0xF2);
2780
+ emit_optional_rex_32(dst, src);
2781
+ emit(0x0F);
2782
+ emit(0x5C);
2783
+ emit_sse_operand(dst, src);
2784
+ }
2785
+
2786
+
2787
+ void Assembler::divsd(XMMRegister dst, XMMRegister src) {
2788
+ EnsureSpace ensure_space(this);
2789
+ emit(0xF2);
2790
+ emit_optional_rex_32(dst, src);
2791
+ emit(0x0F);
2792
+ emit(0x5E);
2793
+ emit_sse_operand(dst, src);
2794
+ }
2795
+
2796
+
2797
+ void Assembler::andpd(XMMRegister dst, XMMRegister src) {
2798
+ EnsureSpace ensure_space(this);
2799
+ emit(0x66);
2800
+ emit_optional_rex_32(dst, src);
2801
+ emit(0x0F);
2802
+ emit(0x54);
2803
+ emit_sse_operand(dst, src);
2804
+ }
2805
+
2806
+
2807
+ void Assembler::orpd(XMMRegister dst, XMMRegister src) {
2808
+ EnsureSpace ensure_space(this);
2809
+ emit(0x66);
2810
+ emit_optional_rex_32(dst, src);
2811
+ emit(0x0F);
2812
+ emit(0x56);
2813
+ emit_sse_operand(dst, src);
2814
+ }
2815
+
2816
+
2817
+ void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
2818
+ EnsureSpace ensure_space(this);
2819
+ emit(0x66);
2820
+ emit_optional_rex_32(dst, src);
2821
+ emit(0x0F);
2822
+ emit(0x57);
2823
+ emit_sse_operand(dst, src);
2824
+ }
2825
+
2826
+
2827
+ void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
2828
+ EnsureSpace ensure_space(this);
2829
+ emit(0xF2);
2830
+ emit_optional_rex_32(dst, src);
2831
+ emit(0x0F);
2832
+ emit(0x51);
2833
+ emit_sse_operand(dst, src);
2834
+ }
2835
+
2836
+
2837
+ void Assembler::ucomisd(XMMRegister dst, XMMRegister src) {
2838
+ EnsureSpace ensure_space(this);
2839
+ emit(0x66);
2840
+ emit_optional_rex_32(dst, src);
2841
+ emit(0x0f);
2842
+ emit(0x2e);
2843
+ emit_sse_operand(dst, src);
2844
+ }
2845
+
2846
+
2847
+ void Assembler::ucomisd(XMMRegister dst, const Operand& src) {
2848
+ EnsureSpace ensure_space(this);
2849
+ emit(0x66);
2850
+ emit_optional_rex_32(dst, src);
2851
+ emit(0x0f);
2852
+ emit(0x2e);
2853
+ emit_sse_operand(dst, src);
2854
+ }
2855
+
2856
+
2857
+ void Assembler::movmskpd(Register dst, XMMRegister src) {
2858
+ EnsureSpace ensure_space(this);
2859
+ emit(0x66);
2860
+ emit_optional_rex_32(dst, src);
2861
+ emit(0x0f);
2862
+ emit(0x50);
2863
+ emit_sse_operand(dst, src);
2864
+ }
2865
+
2866
+
2867
+ void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) {
2868
+ Register ireg = { reg.code() };
2869
+ emit_operand(ireg, adr);
2870
+ }
2871
+
2872
+
2873
+ void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) {
2874
+ emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
2875
+ }
2876
+
2877
+ void Assembler::emit_sse_operand(XMMRegister dst, Register src) {
2878
+ emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
2879
+ }
2880
+
2881
+ void Assembler::emit_sse_operand(Register dst, XMMRegister src) {
2882
+ emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
2883
+ }
2884
+
2885
+
2886
+ void Assembler::db(uint8_t data) {
2887
+ EnsureSpace ensure_space(this);
2888
+ emit(data);
2889
+ }
2890
+
2891
+
2892
+ void Assembler::dd(uint32_t data) {
2893
+ EnsureSpace ensure_space(this);
2894
+ emitl(data);
2895
+ }
2896
+
2897
+
2898
+ // Relocation information implementations.
2899
+
2900
+ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
2901
+ ASSERT(rmode != RelocInfo::NONE);
2902
+ // Don't record external references unless the heap will be serialized.
2903
+ if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
2904
+ #ifdef DEBUG
2905
+ if (!Serializer::enabled()) {
2906
+ Serializer::TooLateToEnableNow();
2907
+ }
2908
+ #endif
2909
+ if (!Serializer::enabled() && !emit_debug_code()) {
2910
+ return;
2911
+ }
2912
+ }
2913
+ RelocInfo rinfo(pc_, rmode, data);
2914
+ reloc_info_writer.Write(&rinfo);
2915
+ }
2916
+
2917
+ void Assembler::RecordJSReturn() {
2918
+ positions_recorder()->WriteRecordedPositions();
2919
+ EnsureSpace ensure_space(this);
2920
+ RecordRelocInfo(RelocInfo::JS_RETURN);
2921
+ }
2922
+
2923
+
2924
+ void Assembler::RecordDebugBreakSlot() {
2925
+ positions_recorder()->WriteRecordedPositions();
2926
+ EnsureSpace ensure_space(this);
2927
+ RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
2928
+ }
2929
+
2930
+
2931
+ void Assembler::RecordComment(const char* msg, bool force) {
2932
+ if (FLAG_code_comments || force) {
2933
+ EnsureSpace ensure_space(this);
2934
+ RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
2935
+ }
2936
+ }
2937
+
2938
+
2939
+ const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
2940
+ 1 << RelocInfo::INTERNAL_REFERENCE;
2941
+
2942
+
2943
+ bool RelocInfo::IsCodedSpecially() {
2944
+ // The deserializer needs to know whether a pointer is specially coded. Being
2945
+ // specially coded on x64 means that it is a relative 32 bit address, as used
2946
+ // by branch instructions.
2947
+ return (1 << rmode_) & kApplyMask;
2948
+ }
2949
+
2950
+
2951
+
2952
+ } } // namespace v8::internal
2953
+
2954
+ #endif // V8_TARGET_ARCH_X64