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,335 @@
1
+ // Copyright (c) 1994-2006 Sun Microsystems Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // - Redistributions of source code must retain the above copyright notice,
9
+ // this list of conditions and the following disclaimer.
10
+ //
11
+ // - Redistribution in binary form must reproduce the above copyright
12
+ // notice, this list of conditions and the following disclaimer in the
13
+ // documentation and/or other materials provided with the distribution.
14
+ //
15
+ // - Neither the name of Sun Microsystems or the names of contributors may
16
+ // be used to endorse or promote products derived from this software without
17
+ // specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // The original source code covered by the above license above has been
32
+ // modified significantly by Google Inc.
33
+ // Copyright 2010 the V8 project authors. All rights reserved.
34
+
35
+
36
+ #ifndef V8_MIPS_ASSEMBLER_MIPS_INL_H_
37
+ #define V8_MIPS_ASSEMBLER_MIPS_INL_H_
38
+
39
+ #include "mips/assembler-mips.h"
40
+ #include "cpu.h"
41
+ #include "debug.h"
42
+
43
+
44
+ namespace v8 {
45
+ namespace internal {
46
+
47
+ // -----------------------------------------------------------------------------
48
+ // Operand and MemOperand
49
+
50
+ Operand::Operand(int32_t immediate, RelocInfo::Mode rmode) {
51
+ rm_ = no_reg;
52
+ imm32_ = immediate;
53
+ rmode_ = rmode;
54
+ }
55
+
56
+
57
+ Operand::Operand(const ExternalReference& f) {
58
+ rm_ = no_reg;
59
+ imm32_ = reinterpret_cast<int32_t>(f.address());
60
+ rmode_ = RelocInfo::EXTERNAL_REFERENCE;
61
+ }
62
+
63
+
64
+ Operand::Operand(Smi* value) {
65
+ rm_ = no_reg;
66
+ imm32_ = reinterpret_cast<intptr_t>(value);
67
+ rmode_ = RelocInfo::NONE;
68
+ }
69
+
70
+
71
+ Operand::Operand(Register rm) {
72
+ rm_ = rm;
73
+ }
74
+
75
+
76
+ bool Operand::is_reg() const {
77
+ return rm_.is_valid();
78
+ }
79
+
80
+
81
+
82
+ // -----------------------------------------------------------------------------
83
+ // RelocInfo
84
+
85
+ void RelocInfo::apply(intptr_t delta) {
86
+ // On MIPS we do not use pc relative addressing, so we don't need to patch the
87
+ // code here.
88
+ }
89
+
90
+
91
+ Address RelocInfo::target_address() {
92
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
93
+ return Assembler::target_address_at(pc_);
94
+ }
95
+
96
+
97
+ Address RelocInfo::target_address_address() {
98
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY
99
+ || rmode_ == EMBEDDED_OBJECT
100
+ || rmode_ == EXTERNAL_REFERENCE);
101
+ // Read the address of the word containing the target_address in an
102
+ // instruction stream.
103
+ // The only architecture-independent user of this function is the serializer.
104
+ // The serializer uses it to find out how many raw bytes of instruction to
105
+ // output before the next target.
106
+ // For an instructions like LUI/ORI where the target bits are mixed into the
107
+ // instruction bits, the size of the target will be zero, indicating that the
108
+ // serializer should not step forward in memory after a target is resolved
109
+ // and written. In this case the target_address_address function should
110
+ // return the end of the instructions to be patched, allowing the
111
+ // deserializer to deserialize the instructions as raw bytes and put them in
112
+ // place, ready to be patched with the target. In our case, that is the
113
+ // address of the instruction that follows LUI/ORI instruction pair.
114
+ return reinterpret_cast<Address>(
115
+ pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize);
116
+ }
117
+
118
+
119
+ int RelocInfo::target_address_size() {
120
+ return Assembler::kExternalTargetSize;
121
+ }
122
+
123
+
124
+ void RelocInfo::set_target_address(Address target) {
125
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
126
+ Assembler::set_target_address_at(pc_, target);
127
+ }
128
+
129
+
130
+ Object* RelocInfo::target_object() {
131
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
132
+ return reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
133
+ }
134
+
135
+
136
+ Handle<Object> RelocInfo::target_object_handle(Assembler *origin) {
137
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
138
+ return Handle<Object>(reinterpret_cast<Object**>(
139
+ Assembler::target_address_at(pc_)));
140
+ }
141
+
142
+
143
+ Object** RelocInfo::target_object_address() {
144
+ // Provide a "natural pointer" to the embedded object,
145
+ // which can be de-referenced during heap iteration.
146
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
147
+ // TODO(mips): Commenting out, to simplify arch-independent changes.
148
+ // GC won't work like this, but this commit is for asm/disasm/sim.
149
+ // reconstructed_obj_ptr_ =
150
+ // reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
151
+ // return &reconstructed_obj_ptr_;
152
+ return NULL;
153
+ }
154
+
155
+
156
+ void RelocInfo::set_target_object(Object* target) {
157
+ ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
158
+ Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
159
+ }
160
+
161
+
162
+ Address* RelocInfo::target_reference_address() {
163
+ ASSERT(rmode_ == EXTERNAL_REFERENCE);
164
+ // TODO(mips): Commenting out, to simplify arch-independent changes.
165
+ // GC won't work like this, but this commit is for asm/disasm/sim.
166
+ // reconstructed_adr_ptr_ = Assembler::target_address_at(pc_);
167
+ // return &reconstructed_adr_ptr_;
168
+ return NULL;
169
+ }
170
+
171
+
172
+ Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
173
+ ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
174
+ Address address = Memory::Address_at(pc_);
175
+ return Handle<JSGlobalPropertyCell>(
176
+ reinterpret_cast<JSGlobalPropertyCell**>(address));
177
+ }
178
+
179
+
180
+ JSGlobalPropertyCell* RelocInfo::target_cell() {
181
+ ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
182
+ Address address = Memory::Address_at(pc_);
183
+ Object* object = HeapObject::FromAddress(
184
+ address - JSGlobalPropertyCell::kValueOffset);
185
+ return reinterpret_cast<JSGlobalPropertyCell*>(object);
186
+ }
187
+
188
+
189
+ void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
190
+ ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
191
+ Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
192
+ Memory::Address_at(pc_) = address;
193
+ }
194
+
195
+
196
+ Address RelocInfo::call_address() {
197
+ ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
198
+ (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
199
+ // The pc_ offset of 0 assumes mips patched return sequence per
200
+ // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
201
+ // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
202
+ return Assembler::target_address_at(pc_);
203
+ }
204
+
205
+
206
+ void RelocInfo::set_call_address(Address target) {
207
+ ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
208
+ (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
209
+ // The pc_ offset of 0 assumes mips patched return sequence per
210
+ // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
211
+ // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
212
+ Assembler::set_target_address_at(pc_, target);
213
+ }
214
+
215
+
216
+ Object* RelocInfo::call_object() {
217
+ return *call_object_address();
218
+ }
219
+
220
+
221
+ Object** RelocInfo::call_object_address() {
222
+ ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
223
+ (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
224
+ return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
225
+ }
226
+
227
+
228
+ void RelocInfo::set_call_object(Object* target) {
229
+ *call_object_address() = target;
230
+ }
231
+
232
+
233
+ bool RelocInfo::IsPatchedReturnSequence() {
234
+ Instr instr0 = Assembler::instr_at(pc_);
235
+ Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
236
+ Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
237
+ bool patched_return = ((instr0 & kOpcodeMask) == LUI &&
238
+ (instr1 & kOpcodeMask) == ORI &&
239
+ (instr2 & kOpcodeMask) == SPECIAL &&
240
+ (instr2 & kFunctionFieldMask) == JALR);
241
+ return patched_return;
242
+ }
243
+
244
+
245
+ bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
246
+ Instr current_instr = Assembler::instr_at(pc_);
247
+ return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
248
+ }
249
+
250
+
251
+ void RelocInfo::Visit(ObjectVisitor* visitor) {
252
+ RelocInfo::Mode mode = rmode();
253
+ if (mode == RelocInfo::EMBEDDED_OBJECT) {
254
+ // RelocInfo is needed when pointer must be updated/serialized, such as
255
+ // UpdatingVisitor in mark-compact.cc or Serializer in serialize.cc.
256
+ // It is ignored by visitors that do not need it.
257
+ // Commenting out, to simplify arch-independednt changes.
258
+ // GC won't work like this, but this commit is for asm/disasm/sim.
259
+ // visitor->VisitPointer(target_object_address(), this);
260
+ } else if (RelocInfo::IsCodeTarget(mode)) {
261
+ visitor->VisitCodeTarget(this);
262
+ } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
263
+ // RelocInfo is needed when external-references must be serialized by
264
+ // Serializer Visitor in serialize.cc. It is ignored by visitors that
265
+ // do not need it.
266
+ // Commenting out, to simplify arch-independednt changes.
267
+ // Serializer won't work like this, but this commit is for asm/disasm/sim.
268
+ // visitor->VisitExternalReference(target_reference_address(), this);
269
+ #ifdef ENABLE_DEBUGGER_SUPPORT
270
+ // TODO(isolates): Get a cached isolate below.
271
+ } else if (((RelocInfo::IsJSReturn(mode) &&
272
+ IsPatchedReturnSequence()) ||
273
+ (RelocInfo::IsDebugBreakSlot(mode) &&
274
+ IsPatchedDebugBreakSlotSequence())) &&
275
+ Isolate::Current()->debug()->has_break_points()) {
276
+ visitor->VisitDebugTarget(this);
277
+ #endif
278
+ } else if (mode == RelocInfo::RUNTIME_ENTRY) {
279
+ visitor->VisitRuntimeEntry(this);
280
+ }
281
+ }
282
+
283
+
284
+ template<typename StaticVisitor>
285
+ void RelocInfo::Visit(Heap* heap) {
286
+ RelocInfo::Mode mode = rmode();
287
+ if (mode == RelocInfo::EMBEDDED_OBJECT) {
288
+ StaticVisitor::VisitPointer(heap, target_object_address());
289
+ } else if (RelocInfo::IsCodeTarget(mode)) {
290
+ StaticVisitor::VisitCodeTarget(this);
291
+ } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
292
+ StaticVisitor::VisitExternalReference(target_reference_address());
293
+ #ifdef ENABLE_DEBUGGER_SUPPORT
294
+ } else if (heap->isolate()->debug()->has_break_points() &&
295
+ ((RelocInfo::IsJSReturn(mode) &&
296
+ IsPatchedReturnSequence()) ||
297
+ (RelocInfo::IsDebugBreakSlot(mode) &&
298
+ IsPatchedDebugBreakSlotSequence()))) {
299
+ StaticVisitor::VisitDebugTarget(this);
300
+ #endif
301
+ } else if (mode == RelocInfo::RUNTIME_ENTRY) {
302
+ StaticVisitor::VisitRuntimeEntry(this);
303
+ }
304
+ }
305
+
306
+
307
+ // -----------------------------------------------------------------------------
308
+ // Assembler
309
+
310
+
311
+ void Assembler::CheckBuffer() {
312
+ if (buffer_space() <= kGap) {
313
+ GrowBuffer();
314
+ }
315
+ }
316
+
317
+
318
+ void Assembler::CheckTrampolinePoolQuick() {
319
+ if (pc_offset() >= next_buffer_check_) {
320
+ CheckTrampolinePool();
321
+ }
322
+ }
323
+
324
+
325
+ void Assembler::emit(Instr x) {
326
+ CheckBuffer();
327
+ *reinterpret_cast<Instr*>(pc_) = x;
328
+ pc_ += kInstrSize;
329
+ CheckTrampolinePoolQuick();
330
+ }
331
+
332
+
333
+ } } // namespace v8::internal
334
+
335
+ #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
@@ -0,0 +1,2093 @@
1
+ // Copyright (c) 1994-2006 Sun Microsystems Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // - Redistributions of source code must retain the above copyright notice,
9
+ // this list of conditions and the following disclaimer.
10
+ //
11
+ // - Redistribution in binary form must reproduce the above copyright
12
+ // notice, this list of conditions and the following disclaimer in the
13
+ // documentation and/or other materials provided with the distribution.
14
+ //
15
+ // - Neither the name of Sun Microsystems or the names of contributors may
16
+ // be used to endorse or promote products derived from this software without
17
+ // specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // The original source code covered by the above license above has been
32
+ // modified significantly by Google Inc.
33
+ // Copyright 2010 the V8 project authors. All rights reserved.
34
+
35
+
36
+ #include "v8.h"
37
+
38
+ #if defined(V8_TARGET_ARCH_MIPS)
39
+
40
+ #include "mips/assembler-mips-inl.h"
41
+ #include "serialize.h"
42
+
43
+ namespace v8 {
44
+ namespace internal {
45
+
46
+ CpuFeatures::CpuFeatures()
47
+ : supported_(0),
48
+ enabled_(0),
49
+ found_by_runtime_probing_(0) {
50
+ }
51
+
52
+ void CpuFeatures::Probe(bool portable) {
53
+ // If the compiler is allowed to use fpu then we can use fpu too in our
54
+ // code generation.
55
+ #if !defined(__mips__)
56
+ // For the simulator=mips build, use FPU when FLAG_enable_fpu is enabled.
57
+ if (FLAG_enable_fpu) {
58
+ supported_ |= 1u << FPU;
59
+ }
60
+ #else
61
+ if (portable && Serializer::enabled()) {
62
+ supported_ |= OS::CpuFeaturesImpliedByPlatform();
63
+ return; // No features if we might serialize.
64
+ }
65
+
66
+ if (OS::MipsCpuHasFeature(FPU)) {
67
+ // This implementation also sets the FPU flags if
68
+ // runtime detection of FPU returns true.
69
+ supported_ |= 1u << FPU;
70
+ found_by_runtime_probing_ |= 1u << FPU;
71
+ }
72
+
73
+ if (!portable) found_by_runtime_probing_ = 0;
74
+ #endif
75
+ }
76
+
77
+
78
+ int ToNumber(Register reg) {
79
+ ASSERT(reg.is_valid());
80
+ const int kNumbers[] = {
81
+ 0, // zero_reg
82
+ 1, // at
83
+ 2, // v0
84
+ 3, // v1
85
+ 4, // a0
86
+ 5, // a1
87
+ 6, // a2
88
+ 7, // a3
89
+ 8, // t0
90
+ 9, // t1
91
+ 10, // t2
92
+ 11, // t3
93
+ 12, // t4
94
+ 13, // t5
95
+ 14, // t6
96
+ 15, // t7
97
+ 16, // s0
98
+ 17, // s1
99
+ 18, // s2
100
+ 19, // s3
101
+ 20, // s4
102
+ 21, // s5
103
+ 22, // s6
104
+ 23, // s7
105
+ 24, // t8
106
+ 25, // t9
107
+ 26, // k0
108
+ 27, // k1
109
+ 28, // gp
110
+ 29, // sp
111
+ 30, // s8_fp
112
+ 31, // ra
113
+ };
114
+ return kNumbers[reg.code()];
115
+ }
116
+
117
+
118
+ Register ToRegister(int num) {
119
+ ASSERT(num >= 0 && num < kNumRegisters);
120
+ const Register kRegisters[] = {
121
+ zero_reg,
122
+ at,
123
+ v0, v1,
124
+ a0, a1, a2, a3,
125
+ t0, t1, t2, t3, t4, t5, t6, t7,
126
+ s0, s1, s2, s3, s4, s5, s6, s7,
127
+ t8, t9,
128
+ k0, k1,
129
+ gp,
130
+ sp,
131
+ s8_fp,
132
+ ra
133
+ };
134
+ return kRegisters[num];
135
+ }
136
+
137
+
138
+ // -----------------------------------------------------------------------------
139
+ // Implementation of RelocInfo.
140
+
141
+ const int RelocInfo::kApplyMask = 0;
142
+
143
+
144
+ bool RelocInfo::IsCodedSpecially() {
145
+ // The deserializer needs to know whether a pointer is specially coded. Being
146
+ // specially coded on MIPS means that it is a lui/ori instruction, and that is
147
+ // always the case inside code objects.
148
+ return true;
149
+ }
150
+
151
+
152
+ // Patch the code at the current address with the supplied instructions.
153
+ void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
154
+ Instr* pc = reinterpret_cast<Instr*>(pc_);
155
+ Instr* instr = reinterpret_cast<Instr*>(instructions);
156
+ for (int i = 0; i < instruction_count; i++) {
157
+ *(pc + i) = *(instr + i);
158
+ }
159
+
160
+ // Indicate that code has changed.
161
+ CPU::FlushICache(pc_, instruction_count * Assembler::kInstrSize);
162
+ }
163
+
164
+
165
+ // Patch the code at the current PC with a call to the target address.
166
+ // Additional guard instructions can be added if required.
167
+ void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
168
+ // Patch the code at the current address with a call to the target.
169
+ UNIMPLEMENTED_MIPS();
170
+ }
171
+
172
+
173
+ // -----------------------------------------------------------------------------
174
+ // Implementation of Operand and MemOperand.
175
+ // See assembler-mips-inl.h for inlined constructors.
176
+
177
+ Operand::Operand(Handle<Object> handle) {
178
+ rm_ = no_reg;
179
+ // Verify all Objects referred by code are NOT in new space.
180
+ Object* obj = *handle;
181
+ ASSERT(!HEAP->InNewSpace(obj));
182
+ if (obj->IsHeapObject()) {
183
+ imm32_ = reinterpret_cast<intptr_t>(handle.location());
184
+ rmode_ = RelocInfo::EMBEDDED_OBJECT;
185
+ } else {
186
+ // No relocation needed.
187
+ imm32_ = reinterpret_cast<intptr_t>(obj);
188
+ rmode_ = RelocInfo::NONE;
189
+ }
190
+ }
191
+
192
+
193
+ MemOperand::MemOperand(Register rm, int32_t offset) : Operand(rm) {
194
+ offset_ = offset;
195
+ }
196
+
197
+
198
+ // -----------------------------------------------------------------------------
199
+ // Specific instructions, constants, and masks.
200
+
201
+ static const int kNegOffset = 0x00008000;
202
+ // addiu(sp, sp, 4) aka Pop() operation or part of Pop(r)
203
+ // operations as post-increment of sp.
204
+ const Instr kPopInstruction = ADDIU | (sp.code() << kRsShift)
205
+ | (sp.code() << kRtShift) | (kPointerSize & kImm16Mask);
206
+ // addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp.
207
+ const Instr kPushInstruction = ADDIU | (sp.code() << kRsShift)
208
+ | (sp.code() << kRtShift) | (-kPointerSize & kImm16Mask);
209
+ // sw(r, MemOperand(sp, 0))
210
+ const Instr kPushRegPattern = SW | (sp.code() << kRsShift)
211
+ | (0 & kImm16Mask);
212
+ // lw(r, MemOperand(sp, 0))
213
+ const Instr kPopRegPattern = LW | (sp.code() << kRsShift)
214
+ | (0 & kImm16Mask);
215
+
216
+ const Instr kLwRegFpOffsetPattern = LW | (s8_fp.code() << kRsShift)
217
+ | (0 & kImm16Mask);
218
+
219
+ const Instr kSwRegFpOffsetPattern = SW | (s8_fp.code() << kRsShift)
220
+ | (0 & kImm16Mask);
221
+
222
+ const Instr kLwRegFpNegOffsetPattern = LW | (s8_fp.code() << kRsShift)
223
+ | (kNegOffset & kImm16Mask);
224
+
225
+ const Instr kSwRegFpNegOffsetPattern = SW | (s8_fp.code() << kRsShift)
226
+ | (kNegOffset & kImm16Mask);
227
+ // A mask for the Rt register for push, pop, lw, sw instructions.
228
+ const Instr kRtMask = kRtFieldMask;
229
+ const Instr kLwSwInstrTypeMask = 0xffe00000;
230
+ const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask;
231
+ const Instr kLwSwOffsetMask = kImm16Mask;
232
+
233
+
234
+ // Spare buffer.
235
+ static const int kMinimalBufferSize = 4 * KB;
236
+
237
+
238
+ Assembler::Assembler(void* buffer, int buffer_size)
239
+ : AssemblerBase(Isolate::Current()),
240
+ positions_recorder_(this),
241
+ allow_peephole_optimization_(false) {
242
+ // BUG(3245989): disable peephole optimization if crankshaft is enabled.
243
+ allow_peephole_optimization_ = FLAG_peephole_optimization;
244
+ if (buffer == NULL) {
245
+ // Do our own buffer management.
246
+ if (buffer_size <= kMinimalBufferSize) {
247
+ buffer_size = kMinimalBufferSize;
248
+
249
+ if (isolate()->assembler_spare_buffer() != NULL) {
250
+ buffer = isolate()->assembler_spare_buffer();
251
+ isolate()->set_assembler_spare_buffer(NULL);
252
+ }
253
+ }
254
+ if (buffer == NULL) {
255
+ buffer_ = NewArray<byte>(buffer_size);
256
+ } else {
257
+ buffer_ = static_cast<byte*>(buffer);
258
+ }
259
+ buffer_size_ = buffer_size;
260
+ own_buffer_ = true;
261
+
262
+ } else {
263
+ // Use externally provided buffer instead.
264
+ ASSERT(buffer_size > 0);
265
+ buffer_ = static_cast<byte*>(buffer);
266
+ buffer_size_ = buffer_size;
267
+ own_buffer_ = false;
268
+ }
269
+
270
+ // Setup buffer pointers.
271
+ ASSERT(buffer_ != NULL);
272
+ pc_ = buffer_;
273
+ reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
274
+
275
+ last_trampoline_pool_end_ = 0;
276
+ no_trampoline_pool_before_ = 0;
277
+ trampoline_pool_blocked_nesting_ = 0;
278
+ next_buffer_check_ = kMaxBranchOffset - kTrampolineSize;
279
+ }
280
+
281
+
282
+ Assembler::~Assembler() {
283
+ if (own_buffer_) {
284
+ if (isolate()->assembler_spare_buffer() == NULL &&
285
+ buffer_size_ == kMinimalBufferSize) {
286
+ isolate()->set_assembler_spare_buffer(buffer_);
287
+ } else {
288
+ DeleteArray(buffer_);
289
+ }
290
+ }
291
+ }
292
+
293
+
294
+ void Assembler::GetCode(CodeDesc* desc) {
295
+ ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap.
296
+ // Setup code descriptor.
297
+ desc->buffer = buffer_;
298
+ desc->buffer_size = buffer_size_;
299
+ desc->instr_size = pc_offset();
300
+ desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos();
301
+ }
302
+
303
+
304
+ void Assembler::Align(int m) {
305
+ ASSERT(m >= 4 && IsPowerOf2(m));
306
+ while ((pc_offset() & (m - 1)) != 0) {
307
+ nop();
308
+ }
309
+ }
310
+
311
+
312
+ void Assembler::CodeTargetAlign() {
313
+ // No advantage to aligning branch/call targets to more than
314
+ // single instruction, that I am aware of.
315
+ Align(4);
316
+ }
317
+
318
+
319
+ Register Assembler::GetRt(Instr instr) {
320
+ Register rt;
321
+ rt.code_ = (instr & kRtMask) >> kRtShift;
322
+ return rt;
323
+ }
324
+
325
+
326
+ bool Assembler::IsPop(Instr instr) {
327
+ return (instr & ~kRtMask) == kPopRegPattern;
328
+ }
329
+
330
+
331
+ bool Assembler::IsPush(Instr instr) {
332
+ return (instr & ~kRtMask) == kPushRegPattern;
333
+ }
334
+
335
+
336
+ bool Assembler::IsSwRegFpOffset(Instr instr) {
337
+ return ((instr & kLwSwInstrTypeMask) == kSwRegFpOffsetPattern);
338
+ }
339
+
340
+
341
+ bool Assembler::IsLwRegFpOffset(Instr instr) {
342
+ return ((instr & kLwSwInstrTypeMask) == kLwRegFpOffsetPattern);
343
+ }
344
+
345
+
346
+ bool Assembler::IsSwRegFpNegOffset(Instr instr) {
347
+ return ((instr & (kLwSwInstrTypeMask | kNegOffset)) ==
348
+ kSwRegFpNegOffsetPattern);
349
+ }
350
+
351
+
352
+ bool Assembler::IsLwRegFpNegOffset(Instr instr) {
353
+ return ((instr & (kLwSwInstrTypeMask | kNegOffset)) ==
354
+ kLwRegFpNegOffsetPattern);
355
+ }
356
+
357
+
358
+ // Labels refer to positions in the (to be) generated code.
359
+ // There are bound, linked, and unused labels.
360
+ //
361
+ // Bound labels refer to known positions in the already
362
+ // generated code. pos() is the position the label refers to.
363
+ //
364
+ // Linked labels refer to unknown positions in the code
365
+ // to be generated; pos() is the position of the last
366
+ // instruction using the label.
367
+
368
+ // The link chain is terminated by a value in the instruction of -1,
369
+ // which is an otherwise illegal value (branch -1 is inf loop).
370
+ // The instruction 16-bit offset field addresses 32-bit words, but in
371
+ // code is conv to an 18-bit value addressing bytes, hence the -4 value.
372
+
373
+ const int kEndOfChain = -4;
374
+
375
+
376
+ bool Assembler::IsBranch(Instr instr) {
377
+ uint32_t opcode = ((instr & kOpcodeMask));
378
+ uint32_t rt_field = ((instr & kRtFieldMask));
379
+ uint32_t rs_field = ((instr & kRsFieldMask));
380
+ uint32_t label_constant = (instr & ~kImm16Mask);
381
+ // Checks if the instruction is a branch.
382
+ return opcode == BEQ ||
383
+ opcode == BNE ||
384
+ opcode == BLEZ ||
385
+ opcode == BGTZ ||
386
+ opcode == BEQL ||
387
+ opcode == BNEL ||
388
+ opcode == BLEZL ||
389
+ opcode == BGTZL||
390
+ (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ ||
391
+ rt_field == BLTZAL || rt_field == BGEZAL)) ||
392
+ (opcode == COP1 && rs_field == BC1) || // Coprocessor branch.
393
+ label_constant == 0; // Emitted label const in reg-exp engine.
394
+ }
395
+
396
+
397
+ bool Assembler::IsNop(Instr instr, unsigned int type) {
398
+ // See Assembler::nop(type).
399
+ ASSERT(type < 32);
400
+ uint32_t opcode = ((instr & kOpcodeMask));
401
+ uint32_t rt = ((instr & kRtFieldMask) >> kRtShift);
402
+ uint32_t rs = ((instr & kRsFieldMask) >> kRsShift);
403
+ uint32_t sa = ((instr & kSaFieldMask) >> kSaShift);
404
+
405
+ // nop(type) == sll(zero_reg, zero_reg, type);
406
+ // Technically all these values will be 0 but
407
+ // this makes more sense to the reader.
408
+
409
+ bool ret = (opcode == SLL &&
410
+ rt == static_cast<uint32_t>(ToNumber(zero_reg)) &&
411
+ rs == static_cast<uint32_t>(ToNumber(zero_reg)) &&
412
+ sa == type);
413
+
414
+ return ret;
415
+ }
416
+
417
+
418
+ int32_t Assembler::GetBranchOffset(Instr instr) {
419
+ ASSERT(IsBranch(instr));
420
+ return ((int16_t)(instr & kImm16Mask)) << 2;
421
+ }
422
+
423
+
424
+ bool Assembler::IsLw(Instr instr) {
425
+ return ((instr & kOpcodeMask) == LW);
426
+ }
427
+
428
+
429
+ int16_t Assembler::GetLwOffset(Instr instr) {
430
+ ASSERT(IsLw(instr));
431
+ return ((instr & kImm16Mask));
432
+ }
433
+
434
+
435
+ Instr Assembler::SetLwOffset(Instr instr, int16_t offset) {
436
+ ASSERT(IsLw(instr));
437
+
438
+ // We actually create a new lw instruction based on the original one.
439
+ Instr temp_instr = LW | (instr & kRsFieldMask) | (instr & kRtFieldMask)
440
+ | (offset & kImm16Mask);
441
+
442
+ return temp_instr;
443
+ }
444
+
445
+
446
+ bool Assembler::IsSw(Instr instr) {
447
+ return ((instr & kOpcodeMask) == SW);
448
+ }
449
+
450
+
451
+ Instr Assembler::SetSwOffset(Instr instr, int16_t offset) {
452
+ ASSERT(IsSw(instr));
453
+ return ((instr & ~kImm16Mask) | (offset & kImm16Mask));
454
+ }
455
+
456
+
457
+ bool Assembler::IsAddImmediate(Instr instr) {
458
+ return ((instr & kOpcodeMask) == ADDIU);
459
+ }
460
+
461
+
462
+ Instr Assembler::SetAddImmediateOffset(Instr instr, int16_t offset) {
463
+ ASSERT(IsAddImmediate(instr));
464
+ return ((instr & ~kImm16Mask) | (offset & kImm16Mask));
465
+ }
466
+
467
+
468
+ int Assembler::target_at(int32_t pos) {
469
+ Instr instr = instr_at(pos);
470
+ if ((instr & ~kImm16Mask) == 0) {
471
+ // Emitted label constant, not part of a branch.
472
+ if (instr == 0) {
473
+ return kEndOfChain;
474
+ } else {
475
+ int32_t imm18 =((instr & static_cast<int32_t>(kImm16Mask)) << 16) >> 14;
476
+ return (imm18 + pos);
477
+ }
478
+ }
479
+ // Check we have a branch instruction.
480
+ ASSERT(IsBranch(instr));
481
+ // Do NOT change this to <<2. We rely on arithmetic shifts here, assuming
482
+ // the compiler uses arithmectic shifts for signed integers.
483
+ int32_t imm18 = ((instr & static_cast<int32_t>(kImm16Mask)) << 16) >> 14;
484
+
485
+ if (imm18 == kEndOfChain) {
486
+ // EndOfChain sentinel is returned directly, not relative to pc or pos.
487
+ return kEndOfChain;
488
+ } else {
489
+ return pos + kBranchPCOffset + imm18;
490
+ }
491
+ }
492
+
493
+
494
+ void Assembler::target_at_put(int32_t pos, int32_t target_pos) {
495
+ Instr instr = instr_at(pos);
496
+ if ((instr & ~kImm16Mask) == 0) {
497
+ ASSERT(target_pos == kEndOfChain || target_pos >= 0);
498
+ // Emitted label constant, not part of a branch.
499
+ // Make label relative to Code* of generated Code object.
500
+ instr_at_put(pos, target_pos + (Code::kHeaderSize - kHeapObjectTag));
501
+ return;
502
+ }
503
+
504
+ ASSERT(IsBranch(instr));
505
+ int32_t imm18 = target_pos - (pos + kBranchPCOffset);
506
+ ASSERT((imm18 & 3) == 0);
507
+
508
+ instr &= ~kImm16Mask;
509
+ int32_t imm16 = imm18 >> 2;
510
+ ASSERT(is_int16(imm16));
511
+
512
+ instr_at_put(pos, instr | (imm16 & kImm16Mask));
513
+ }
514
+
515
+
516
+ void Assembler::print(Label* L) {
517
+ if (L->is_unused()) {
518
+ PrintF("unused label\n");
519
+ } else if (L->is_bound()) {
520
+ PrintF("bound label to %d\n", L->pos());
521
+ } else if (L->is_linked()) {
522
+ Label l = *L;
523
+ PrintF("unbound label");
524
+ while (l.is_linked()) {
525
+ PrintF("@ %d ", l.pos());
526
+ Instr instr = instr_at(l.pos());
527
+ if ((instr & ~kImm16Mask) == 0) {
528
+ PrintF("value\n");
529
+ } else {
530
+ PrintF("%d\n", instr);
531
+ }
532
+ next(&l);
533
+ }
534
+ } else {
535
+ PrintF("label in inconsistent state (pos = %d)\n", L->pos_);
536
+ }
537
+ }
538
+
539
+
540
+ void Assembler::bind_to(Label* L, int pos) {
541
+ ASSERT(0 <= pos && pos <= pc_offset()); // Must have valid binding position.
542
+ while (L->is_linked()) {
543
+ int32_t fixup_pos = L->pos();
544
+ int32_t dist = pos - fixup_pos;
545
+ next(L); // Call next before overwriting link with target at fixup_pos.
546
+ if (dist > kMaxBranchOffset) {
547
+ do {
548
+ int32_t trampoline_pos = get_trampoline_entry(fixup_pos);
549
+ ASSERT((trampoline_pos - fixup_pos) <= kMaxBranchOffset);
550
+ target_at_put(fixup_pos, trampoline_pos);
551
+ fixup_pos = trampoline_pos;
552
+ dist = pos - fixup_pos;
553
+ } while (dist > kMaxBranchOffset);
554
+ } else if (dist < -kMaxBranchOffset) {
555
+ do {
556
+ int32_t trampoline_pos = get_trampoline_entry(fixup_pos, false);
557
+ ASSERT((trampoline_pos - fixup_pos) >= -kMaxBranchOffset);
558
+ target_at_put(fixup_pos, trampoline_pos);
559
+ fixup_pos = trampoline_pos;
560
+ dist = pos - fixup_pos;
561
+ } while (dist < -kMaxBranchOffset);
562
+ };
563
+ target_at_put(fixup_pos, pos);
564
+ }
565
+ L->bind_to(pos);
566
+
567
+ // Keep track of the last bound label so we don't eliminate any instructions
568
+ // before a bound label.
569
+ if (pos > last_bound_pos_)
570
+ last_bound_pos_ = pos;
571
+ }
572
+
573
+
574
+ void Assembler::link_to(Label* L, Label* appendix) {
575
+ if (appendix->is_linked()) {
576
+ if (L->is_linked()) {
577
+ // Append appendix to L's list.
578
+ int fixup_pos;
579
+ int link = L->pos();
580
+ do {
581
+ fixup_pos = link;
582
+ link = target_at(fixup_pos);
583
+ } while (link > 0);
584
+ ASSERT(link == kEndOfChain);
585
+ target_at_put(fixup_pos, appendix->pos());
586
+ } else {
587
+ // L is empty, simply use appendix.
588
+ *L = *appendix;
589
+ }
590
+ }
591
+ appendix->Unuse(); // Appendix should not be used anymore.
592
+ }
593
+
594
+
595
+ void Assembler::bind(Label* L) {
596
+ ASSERT(!L->is_bound()); // Label can only be bound once.
597
+ bind_to(L, pc_offset());
598
+ }
599
+
600
+
601
+ void Assembler::next(Label* L) {
602
+ ASSERT(L->is_linked());
603
+ int link = target_at(L->pos());
604
+ ASSERT(link > 0 || link == kEndOfChain);
605
+ if (link == kEndOfChain) {
606
+ L->Unuse();
607
+ } else if (link > 0) {
608
+ L->link_to(link);
609
+ }
610
+ }
611
+
612
+
613
+ // We have to use a temporary register for things that can be relocated even
614
+ // if they can be encoded in the MIPS's 16 bits of immediate-offset instruction
615
+ // space. There is no guarantee that the relocated location can be similarly
616
+ // encoded.
617
+ bool Assembler::MustUseReg(RelocInfo::Mode rmode) {
618
+ return rmode != RelocInfo::NONE;
619
+ }
620
+
621
+
622
+ void Assembler::GenInstrRegister(Opcode opcode,
623
+ Register rs,
624
+ Register rt,
625
+ Register rd,
626
+ uint16_t sa,
627
+ SecondaryField func) {
628
+ ASSERT(rd.is_valid() && rs.is_valid() && rt.is_valid() && is_uint5(sa));
629
+ Instr instr = opcode | (rs.code() << kRsShift) | (rt.code() << kRtShift)
630
+ | (rd.code() << kRdShift) | (sa << kSaShift) | func;
631
+ emit(instr);
632
+ }
633
+
634
+
635
+ void Assembler::GenInstrRegister(Opcode opcode,
636
+ Register rs,
637
+ Register rt,
638
+ uint16_t msb,
639
+ uint16_t lsb,
640
+ SecondaryField func) {
641
+ ASSERT(rs.is_valid() && rt.is_valid() && is_uint5(msb) && is_uint5(lsb));
642
+ Instr instr = opcode | (rs.code() << kRsShift) | (rt.code() << kRtShift)
643
+ | (msb << kRdShift) | (lsb << kSaShift) | func;
644
+ emit(instr);
645
+ }
646
+
647
+
648
+ void Assembler::GenInstrRegister(Opcode opcode,
649
+ SecondaryField fmt,
650
+ FPURegister ft,
651
+ FPURegister fs,
652
+ FPURegister fd,
653
+ SecondaryField func) {
654
+ ASSERT(fd.is_valid() && fs.is_valid() && ft.is_valid());
655
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
656
+ Instr instr = opcode | fmt | (ft.code() << kFtShift) | (fs.code() << kFsShift)
657
+ | (fd.code() << kFdShift) | func;
658
+ emit(instr);
659
+ }
660
+
661
+
662
+ void Assembler::GenInstrRegister(Opcode opcode,
663
+ SecondaryField fmt,
664
+ Register rt,
665
+ FPURegister fs,
666
+ FPURegister fd,
667
+ SecondaryField func) {
668
+ ASSERT(fd.is_valid() && fs.is_valid() && rt.is_valid());
669
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
670
+ Instr instr = opcode | fmt | (rt.code() << kRtShift)
671
+ | (fs.code() << kFsShift) | (fd.code() << kFdShift) | func;
672
+ emit(instr);
673
+ }
674
+
675
+
676
+ void Assembler::GenInstrRegister(Opcode opcode,
677
+ SecondaryField fmt,
678
+ Register rt,
679
+ FPUControlRegister fs,
680
+ SecondaryField func) {
681
+ ASSERT(fs.is_valid() && rt.is_valid());
682
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
683
+ Instr instr =
684
+ opcode | fmt | (rt.code() << kRtShift) | (fs.code() << kFsShift) | func;
685
+ emit(instr);
686
+ }
687
+
688
+
689
+ // Instructions with immediate value.
690
+ // Registers are in the order of the instruction encoding, from left to right.
691
+ void Assembler::GenInstrImmediate(Opcode opcode,
692
+ Register rs,
693
+ Register rt,
694
+ int32_t j) {
695
+ ASSERT(rs.is_valid() && rt.is_valid() && (is_int16(j) || is_uint16(j)));
696
+ Instr instr = opcode | (rs.code() << kRsShift) | (rt.code() << kRtShift)
697
+ | (j & kImm16Mask);
698
+ emit(instr);
699
+ }
700
+
701
+
702
+ void Assembler::GenInstrImmediate(Opcode opcode,
703
+ Register rs,
704
+ SecondaryField SF,
705
+ int32_t j) {
706
+ ASSERT(rs.is_valid() && (is_int16(j) || is_uint16(j)));
707
+ Instr instr = opcode | (rs.code() << kRsShift) | SF | (j & kImm16Mask);
708
+ emit(instr);
709
+ }
710
+
711
+
712
+ void Assembler::GenInstrImmediate(Opcode opcode,
713
+ Register rs,
714
+ FPURegister ft,
715
+ int32_t j) {
716
+ ASSERT(rs.is_valid() && ft.is_valid() && (is_int16(j) || is_uint16(j)));
717
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
718
+ Instr instr = opcode | (rs.code() << kRsShift) | (ft.code() << kFtShift)
719
+ | (j & kImm16Mask);
720
+ emit(instr);
721
+ }
722
+
723
+
724
+ // Registers are in the order of the instruction encoding, from left to right.
725
+ void Assembler::GenInstrJump(Opcode opcode,
726
+ uint32_t address) {
727
+ BlockTrampolinePoolScope block_trampoline_pool(this);
728
+ ASSERT(is_uint26(address));
729
+ Instr instr = opcode | address;
730
+ emit(instr);
731
+ BlockTrampolinePoolFor(1); // For associated delay slot.
732
+ }
733
+
734
+
735
+ // Returns the next free label entry from the next trampoline pool.
736
+ int32_t Assembler::get_label_entry(int32_t pos, bool next_pool) {
737
+ int trampoline_count = trampolines_.length();
738
+ int32_t label_entry = 0;
739
+ ASSERT(trampoline_count > 0);
740
+
741
+ if (next_pool) {
742
+ for (int i = 0; i < trampoline_count; i++) {
743
+ if (trampolines_[i].start() > pos) {
744
+ label_entry = trampolines_[i].take_label();
745
+ break;
746
+ }
747
+ }
748
+ } else { // Caller needs a label entry from the previous pool.
749
+ for (int i = trampoline_count-1; i >= 0; i--) {
750
+ if (trampolines_[i].end() < pos) {
751
+ label_entry = trampolines_[i].take_label();
752
+ break;
753
+ }
754
+ }
755
+ }
756
+ return label_entry;
757
+ }
758
+
759
+
760
+ // Returns the next free trampoline entry from the next trampoline pool.
761
+ int32_t Assembler::get_trampoline_entry(int32_t pos, bool next_pool) {
762
+ int trampoline_count = trampolines_.length();
763
+ int32_t trampoline_entry = 0;
764
+ ASSERT(trampoline_count > 0);
765
+
766
+ if (next_pool) {
767
+ for (int i = 0; i < trampoline_count; i++) {
768
+ if (trampolines_[i].start() > pos) {
769
+ trampoline_entry = trampolines_[i].take_slot();
770
+ break;
771
+ }
772
+ }
773
+ } else { // Caller needs a trampoline entry from the previous pool.
774
+ for (int i = trampoline_count-1; i >= 0; i--) {
775
+ if (trampolines_[i].end() < pos) {
776
+ trampoline_entry = trampolines_[i].take_slot();
777
+ break;
778
+ }
779
+ }
780
+ }
781
+ return trampoline_entry;
782
+ }
783
+
784
+
785
+ int32_t Assembler::branch_offset(Label* L, bool jump_elimination_allowed) {
786
+ int32_t target_pos;
787
+ int32_t pc_offset_v = pc_offset();
788
+
789
+ if (L->is_bound()) {
790
+ target_pos = L->pos();
791
+ int32_t dist = pc_offset_v - target_pos;
792
+ if (dist > kMaxBranchOffset) {
793
+ do {
794
+ int32_t trampoline_pos = get_trampoline_entry(target_pos);
795
+ ASSERT((trampoline_pos - target_pos) > 0);
796
+ ASSERT((trampoline_pos - target_pos) <= kMaxBranchOffset);
797
+ target_at_put(trampoline_pos, target_pos);
798
+ target_pos = trampoline_pos;
799
+ dist = pc_offset_v - target_pos;
800
+ } while (dist > kMaxBranchOffset);
801
+ } else if (dist < -kMaxBranchOffset) {
802
+ do {
803
+ int32_t trampoline_pos = get_trampoline_entry(target_pos, false);
804
+ ASSERT((target_pos - trampoline_pos) > 0);
805
+ ASSERT((target_pos - trampoline_pos) <= kMaxBranchOffset);
806
+ target_at_put(trampoline_pos, target_pos);
807
+ target_pos = trampoline_pos;
808
+ dist = pc_offset_v - target_pos;
809
+ } while (dist < -kMaxBranchOffset);
810
+ }
811
+ } else {
812
+ if (L->is_linked()) {
813
+ target_pos = L->pos(); // L's link.
814
+ int32_t dist = pc_offset_v - target_pos;
815
+ if (dist > kMaxBranchOffset) {
816
+ do {
817
+ int32_t label_pos = get_label_entry(target_pos);
818
+ ASSERT((label_pos - target_pos) < kMaxBranchOffset);
819
+ label_at_put(L, label_pos);
820
+ target_pos = label_pos;
821
+ dist = pc_offset_v - target_pos;
822
+ } while (dist > kMaxBranchOffset);
823
+ } else if (dist < -kMaxBranchOffset) {
824
+ do {
825
+ int32_t label_pos = get_label_entry(target_pos, false);
826
+ ASSERT((label_pos - target_pos) > -kMaxBranchOffset);
827
+ label_at_put(L, label_pos);
828
+ target_pos = label_pos;
829
+ dist = pc_offset_v - target_pos;
830
+ } while (dist < -kMaxBranchOffset);
831
+ }
832
+ L->link_to(pc_offset());
833
+ } else {
834
+ L->link_to(pc_offset());
835
+ return kEndOfChain;
836
+ }
837
+ }
838
+
839
+ int32_t offset = target_pos - (pc_offset() + kBranchPCOffset);
840
+ ASSERT((offset & 3) == 0);
841
+ ASSERT(is_int16(offset >> 2));
842
+
843
+ return offset;
844
+ }
845
+
846
+
847
+ void Assembler::label_at_put(Label* L, int at_offset) {
848
+ int target_pos;
849
+ if (L->is_bound()) {
850
+ target_pos = L->pos();
851
+ instr_at_put(at_offset, target_pos + (Code::kHeaderSize - kHeapObjectTag));
852
+ } else {
853
+ if (L->is_linked()) {
854
+ target_pos = L->pos(); // L's link.
855
+ int32_t imm18 = target_pos - at_offset;
856
+ ASSERT((imm18 & 3) == 0);
857
+ int32_t imm16 = imm18 >> 2;
858
+ ASSERT(is_int16(imm16));
859
+ instr_at_put(at_offset, (imm16 & kImm16Mask));
860
+ } else {
861
+ target_pos = kEndOfChain;
862
+ instr_at_put(at_offset, 0);
863
+ }
864
+ L->link_to(at_offset);
865
+ }
866
+ }
867
+
868
+
869
+ //------- Branch and jump instructions --------
870
+
871
+ void Assembler::b(int16_t offset) {
872
+ beq(zero_reg, zero_reg, offset);
873
+ }
874
+
875
+
876
+ void Assembler::bal(int16_t offset) {
877
+ positions_recorder()->WriteRecordedPositions();
878
+ bgezal(zero_reg, offset);
879
+ }
880
+
881
+
882
+ void Assembler::beq(Register rs, Register rt, int16_t offset) {
883
+ BlockTrampolinePoolScope block_trampoline_pool(this);
884
+ GenInstrImmediate(BEQ, rs, rt, offset);
885
+ BlockTrampolinePoolFor(1); // For associated delay slot.
886
+ }
887
+
888
+
889
+ void Assembler::bgez(Register rs, int16_t offset) {
890
+ BlockTrampolinePoolScope block_trampoline_pool(this);
891
+ GenInstrImmediate(REGIMM, rs, BGEZ, offset);
892
+ BlockTrampolinePoolFor(1); // For associated delay slot.
893
+ }
894
+
895
+
896
+ void Assembler::bgezal(Register rs, int16_t offset) {
897
+ BlockTrampolinePoolScope block_trampoline_pool(this);
898
+ positions_recorder()->WriteRecordedPositions();
899
+ GenInstrImmediate(REGIMM, rs, BGEZAL, offset);
900
+ BlockTrampolinePoolFor(1); // For associated delay slot.
901
+ }
902
+
903
+
904
+ void Assembler::bgtz(Register rs, int16_t offset) {
905
+ BlockTrampolinePoolScope block_trampoline_pool(this);
906
+ GenInstrImmediate(BGTZ, rs, zero_reg, offset);
907
+ BlockTrampolinePoolFor(1); // For associated delay slot.
908
+ }
909
+
910
+
911
+ void Assembler::blez(Register rs, int16_t offset) {
912
+ BlockTrampolinePoolScope block_trampoline_pool(this);
913
+ GenInstrImmediate(BLEZ, rs, zero_reg, offset);
914
+ BlockTrampolinePoolFor(1); // For associated delay slot.
915
+ }
916
+
917
+
918
+ void Assembler::bltz(Register rs, int16_t offset) {
919
+ BlockTrampolinePoolScope block_trampoline_pool(this);
920
+ GenInstrImmediate(REGIMM, rs, BLTZ, offset);
921
+ BlockTrampolinePoolFor(1); // For associated delay slot.
922
+ }
923
+
924
+
925
+ void Assembler::bltzal(Register rs, int16_t offset) {
926
+ BlockTrampolinePoolScope block_trampoline_pool(this);
927
+ positions_recorder()->WriteRecordedPositions();
928
+ GenInstrImmediate(REGIMM, rs, BLTZAL, offset);
929
+ BlockTrampolinePoolFor(1); // For associated delay slot.
930
+ }
931
+
932
+
933
+ void Assembler::bne(Register rs, Register rt, int16_t offset) {
934
+ BlockTrampolinePoolScope block_trampoline_pool(this);
935
+ GenInstrImmediate(BNE, rs, rt, offset);
936
+ BlockTrampolinePoolFor(1); // For associated delay slot.
937
+ }
938
+
939
+
940
+ void Assembler::j(int32_t target) {
941
+ ASSERT(is_uint28(target) && ((target & 3) == 0));
942
+ GenInstrJump(J, target >> 2);
943
+ }
944
+
945
+
946
+ void Assembler::jr(Register rs) {
947
+ BlockTrampolinePoolScope block_trampoline_pool(this);
948
+ if (rs.is(ra)) {
949
+ positions_recorder()->WriteRecordedPositions();
950
+ }
951
+ GenInstrRegister(SPECIAL, rs, zero_reg, zero_reg, 0, JR);
952
+ BlockTrampolinePoolFor(1); // For associated delay slot.
953
+ }
954
+
955
+
956
+ void Assembler::jal(int32_t target) {
957
+ positions_recorder()->WriteRecordedPositions();
958
+ ASSERT(is_uint28(target) && ((target & 3) == 0));
959
+ GenInstrJump(JAL, target >> 2);
960
+ }
961
+
962
+
963
+ void Assembler::jalr(Register rs, Register rd) {
964
+ BlockTrampolinePoolScope block_trampoline_pool(this);
965
+ positions_recorder()->WriteRecordedPositions();
966
+ GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR);
967
+ BlockTrampolinePoolFor(1); // For associated delay slot.
968
+ }
969
+
970
+
971
+ //-------Data-processing-instructions---------
972
+
973
+ // Arithmetic.
974
+
975
+ void Assembler::addu(Register rd, Register rs, Register rt) {
976
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, ADDU);
977
+ }
978
+
979
+
980
+ void Assembler::addiu(Register rd, Register rs, int32_t j) {
981
+ GenInstrImmediate(ADDIU, rs, rd, j);
982
+
983
+ // Eliminate pattern: push(r), pop().
984
+ // addiu(sp, sp, Operand(-kPointerSize));
985
+ // sw(src, MemOperand(sp, 0);
986
+ // addiu(sp, sp, Operand(kPointerSize));
987
+ // Both instructions can be eliminated.
988
+ if (can_peephole_optimize(3) &&
989
+ // Pattern.
990
+ instr_at(pc_ - 1 * kInstrSize) == kPopInstruction &&
991
+ (instr_at(pc_ - 2 * kInstrSize) & ~kRtMask) == kPushRegPattern &&
992
+ (instr_at(pc_ - 3 * kInstrSize)) == kPushInstruction) {
993
+ pc_ -= 3 * kInstrSize;
994
+ if (FLAG_print_peephole_optimization) {
995
+ PrintF("%x push(reg)/pop() eliminated\n", pc_offset());
996
+ }
997
+ }
998
+
999
+ // Eliminate pattern: push(ry), pop(rx).
1000
+ // addiu(sp, sp, -kPointerSize)
1001
+ // sw(ry, MemOperand(sp, 0)
1002
+ // lw(rx, MemOperand(sp, 0)
1003
+ // addiu(sp, sp, kPointerSize);
1004
+ // Both instructions can be eliminated if ry = rx.
1005
+ // If ry != rx, a register copy from ry to rx is inserted
1006
+ // after eliminating the push and the pop instructions.
1007
+ if (can_peephole_optimize(4)) {
1008
+ Instr pre_push_sp_set = instr_at(pc_ - 4 * kInstrSize);
1009
+ Instr push_instr = instr_at(pc_ - 3 * kInstrSize);
1010
+ Instr pop_instr = instr_at(pc_ - 2 * kInstrSize);
1011
+ Instr post_pop_sp_set = instr_at(pc_ - 1 * kInstrSize);
1012
+
1013
+ if (IsPush(push_instr) &&
1014
+ IsPop(pop_instr) && pre_push_sp_set == kPushInstruction &&
1015
+ post_pop_sp_set == kPopInstruction) {
1016
+ if ((pop_instr & kRtMask) != (push_instr & kRtMask)) {
1017
+ // For consecutive push and pop on different registers,
1018
+ // we delete both the push & pop and insert a register move.
1019
+ // push ry, pop rx --> mov rx, ry.
1020
+ Register reg_pushed, reg_popped;
1021
+ reg_pushed = GetRt(push_instr);
1022
+ reg_popped = GetRt(pop_instr);
1023
+ pc_ -= 4 * kInstrSize;
1024
+ // Insert a mov instruction, which is better than a pair of push & pop.
1025
+ or_(reg_popped, reg_pushed, zero_reg);
1026
+ if (FLAG_print_peephole_optimization) {
1027
+ PrintF("%x push/pop (diff reg) replaced by a reg move\n",
1028
+ pc_offset());
1029
+ }
1030
+ } else {
1031
+ // For consecutive push and pop on the same register,
1032
+ // both the push and the pop can be deleted.
1033
+ pc_ -= 4 * kInstrSize;
1034
+ if (FLAG_print_peephole_optimization) {
1035
+ PrintF("%x push/pop (same reg) eliminated\n", pc_offset());
1036
+ }
1037
+ }
1038
+ }
1039
+ }
1040
+
1041
+ if (can_peephole_optimize(5)) {
1042
+ Instr pre_push_sp_set = instr_at(pc_ - 5 * kInstrSize);
1043
+ Instr mem_write_instr = instr_at(pc_ - 4 * kInstrSize);
1044
+ Instr lw_instr = instr_at(pc_ - 3 * kInstrSize);
1045
+ Instr mem_read_instr = instr_at(pc_ - 2 * kInstrSize);
1046
+ Instr post_pop_sp_set = instr_at(pc_ - 1 * kInstrSize);
1047
+
1048
+ if (IsPush(mem_write_instr) &&
1049
+ pre_push_sp_set == kPushInstruction &&
1050
+ IsPop(mem_read_instr) &&
1051
+ post_pop_sp_set == kPopInstruction) {
1052
+ if ((IsLwRegFpOffset(lw_instr) ||
1053
+ IsLwRegFpNegOffset(lw_instr))) {
1054
+ if ((mem_write_instr & kRtMask) ==
1055
+ (mem_read_instr & kRtMask)) {
1056
+ // Pattern: push & pop from/to same register,
1057
+ // with a fp+offset lw in between.
1058
+ //
1059
+ // The following:
1060
+ // addiu sp, sp, -4
1061
+ // sw rx, [sp, #0]!
1062
+ // lw rz, [fp, #-24]
1063
+ // lw rx, [sp, 0],
1064
+ // addiu sp, sp, 4
1065
+ //
1066
+ // Becomes:
1067
+ // if(rx == rz)
1068
+ // delete all
1069
+ // else
1070
+ // lw rz, [fp, #-24]
1071
+
1072
+ if ((mem_write_instr & kRtMask) == (lw_instr & kRtMask)) {
1073
+ pc_ -= 5 * kInstrSize;
1074
+ } else {
1075
+ pc_ -= 5 * kInstrSize;
1076
+ // Reinsert back the lw rz.
1077
+ emit(lw_instr);
1078
+ }
1079
+ if (FLAG_print_peephole_optimization) {
1080
+ PrintF("%x push/pop -dead ldr fp+offset in middle\n", pc_offset());
1081
+ }
1082
+ } else {
1083
+ // Pattern: push & pop from/to different registers
1084
+ // with a fp + offset lw in between.
1085
+ //
1086
+ // The following:
1087
+ // addiu sp, sp ,-4
1088
+ // sw rx, [sp, 0]
1089
+ // lw rz, [fp, #-24]
1090
+ // lw ry, [sp, 0]
1091
+ // addiu sp, sp, 4
1092
+ //
1093
+ // Becomes:
1094
+ // if(ry == rz)
1095
+ // mov ry, rx;
1096
+ // else if(rx != rz)
1097
+ // lw rz, [fp, #-24]
1098
+ // mov ry, rx
1099
+ // else if((ry != rz) || (rx == rz)) becomes:
1100
+ // mov ry, rx
1101
+ // lw rz, [fp, #-24]
1102
+
1103
+ Register reg_pushed, reg_popped;
1104
+ if ((mem_read_instr & kRtMask) == (lw_instr & kRtMask)) {
1105
+ reg_pushed = GetRt(mem_write_instr);
1106
+ reg_popped = GetRt(mem_read_instr);
1107
+ pc_ -= 5 * kInstrSize;
1108
+ or_(reg_popped, reg_pushed, zero_reg); // Move instruction.
1109
+ } else if ((mem_write_instr & kRtMask)
1110
+ != (lw_instr & kRtMask)) {
1111
+ reg_pushed = GetRt(mem_write_instr);
1112
+ reg_popped = GetRt(mem_read_instr);
1113
+ pc_ -= 5 * kInstrSize;
1114
+ emit(lw_instr);
1115
+ or_(reg_popped, reg_pushed, zero_reg); // Move instruction.
1116
+ } else if (((mem_read_instr & kRtMask)
1117
+ != (lw_instr & kRtMask)) ||
1118
+ ((mem_write_instr & kRtMask)
1119
+ == (lw_instr & kRtMask)) ) {
1120
+ reg_pushed = GetRt(mem_write_instr);
1121
+ reg_popped = GetRt(mem_read_instr);
1122
+ pc_ -= 5 * kInstrSize;
1123
+ or_(reg_popped, reg_pushed, zero_reg); // Move instruction.
1124
+ emit(lw_instr);
1125
+ }
1126
+ if (FLAG_print_peephole_optimization) {
1127
+ PrintF("%x push/pop (ldr fp+off in middle)\n", pc_offset());
1128
+ }
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+ }
1134
+
1135
+
1136
+ void Assembler::subu(Register rd, Register rs, Register rt) {
1137
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SUBU);
1138
+ }
1139
+
1140
+
1141
+ void Assembler::mul(Register rd, Register rs, Register rt) {
1142
+ GenInstrRegister(SPECIAL2, rs, rt, rd, 0, MUL);
1143
+ }
1144
+
1145
+
1146
+ void Assembler::mult(Register rs, Register rt) {
1147
+ GenInstrRegister(SPECIAL, rs, rt, zero_reg, 0, MULT);
1148
+ }
1149
+
1150
+
1151
+ void Assembler::multu(Register rs, Register rt) {
1152
+ GenInstrRegister(SPECIAL, rs, rt, zero_reg, 0, MULTU);
1153
+ }
1154
+
1155
+
1156
+ void Assembler::div(Register rs, Register rt) {
1157
+ GenInstrRegister(SPECIAL, rs, rt, zero_reg, 0, DIV);
1158
+ }
1159
+
1160
+
1161
+ void Assembler::divu(Register rs, Register rt) {
1162
+ GenInstrRegister(SPECIAL, rs, rt, zero_reg, 0, DIVU);
1163
+ }
1164
+
1165
+
1166
+ // Logical.
1167
+
1168
+ void Assembler::and_(Register rd, Register rs, Register rt) {
1169
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, AND);
1170
+ }
1171
+
1172
+
1173
+ void Assembler::andi(Register rt, Register rs, int32_t j) {
1174
+ GenInstrImmediate(ANDI, rs, rt, j);
1175
+ }
1176
+
1177
+
1178
+ void Assembler::or_(Register rd, Register rs, Register rt) {
1179
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, OR);
1180
+ }
1181
+
1182
+
1183
+ void Assembler::ori(Register rt, Register rs, int32_t j) {
1184
+ GenInstrImmediate(ORI, rs, rt, j);
1185
+ }
1186
+
1187
+
1188
+ void Assembler::xor_(Register rd, Register rs, Register rt) {
1189
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, XOR);
1190
+ }
1191
+
1192
+
1193
+ void Assembler::xori(Register rt, Register rs, int32_t j) {
1194
+ GenInstrImmediate(XORI, rs, rt, j);
1195
+ }
1196
+
1197
+
1198
+ void Assembler::nor(Register rd, Register rs, Register rt) {
1199
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, NOR);
1200
+ }
1201
+
1202
+
1203
+ // Shifts.
1204
+ void Assembler::sll(Register rd,
1205
+ Register rt,
1206
+ uint16_t sa,
1207
+ bool coming_from_nop) {
1208
+ // Don't allow nop instructions in the form sll zero_reg, zero_reg to be
1209
+ // generated using the sll instruction. They must be generated using
1210
+ // nop(int/NopMarkerTypes) or MarkCode(int/NopMarkerTypes) pseudo
1211
+ // instructions.
1212
+ ASSERT(coming_from_nop || !(rd.is(zero_reg) && rt.is(zero_reg)));
1213
+ GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SLL);
1214
+ }
1215
+
1216
+
1217
+ void Assembler::sllv(Register rd, Register rt, Register rs) {
1218
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SLLV);
1219
+ }
1220
+
1221
+
1222
+ void Assembler::srl(Register rd, Register rt, uint16_t sa) {
1223
+ GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SRL);
1224
+ }
1225
+
1226
+
1227
+ void Assembler::srlv(Register rd, Register rt, Register rs) {
1228
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRLV);
1229
+ }
1230
+
1231
+
1232
+ void Assembler::sra(Register rd, Register rt, uint16_t sa) {
1233
+ GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SRA);
1234
+ }
1235
+
1236
+
1237
+ void Assembler::srav(Register rd, Register rt, Register rs) {
1238
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRAV);
1239
+ }
1240
+
1241
+
1242
+ void Assembler::rotr(Register rd, Register rt, uint16_t sa) {
1243
+ // Should be called via MacroAssembler::Ror.
1244
+ ASSERT(rd.is_valid() && rt.is_valid() && is_uint5(sa));
1245
+ ASSERT(mips32r2);
1246
+ Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift)
1247
+ | (rd.code() << kRdShift) | (sa << kSaShift) | SRL;
1248
+ emit(instr);
1249
+ }
1250
+
1251
+
1252
+ void Assembler::rotrv(Register rd, Register rt, Register rs) {
1253
+ // Should be called via MacroAssembler::Ror.
1254
+ ASSERT(rd.is_valid() && rt.is_valid() && rs.is_valid() );
1255
+ ASSERT(mips32r2);
1256
+ Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift)
1257
+ | (rd.code() << kRdShift) | (1 << kSaShift) | SRLV;
1258
+ emit(instr);
1259
+ }
1260
+
1261
+
1262
+ //------------Memory-instructions-------------
1263
+
1264
+ // Helper for base-reg + offset, when offset is larger than int16.
1265
+ void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) {
1266
+ ASSERT(!src.rm().is(at));
1267
+ lui(at, src.offset_ >> kLuiShift);
1268
+ ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset.
1269
+ addu(at, at, src.rm()); // Add base register.
1270
+ }
1271
+
1272
+
1273
+ void Assembler::lb(Register rd, const MemOperand& rs) {
1274
+ if (is_int16(rs.offset_)) {
1275
+ GenInstrImmediate(LB, rs.rm(), rd, rs.offset_);
1276
+ } else { // Offset > 16 bits, use multiple instructions to load.
1277
+ LoadRegPlusOffsetToAt(rs);
1278
+ GenInstrImmediate(LB, at, rd, 0); // Equiv to lb(rd, MemOperand(at, 0));
1279
+ }
1280
+ }
1281
+
1282
+
1283
+ void Assembler::lbu(Register rd, const MemOperand& rs) {
1284
+ if (is_int16(rs.offset_)) {
1285
+ GenInstrImmediate(LBU, rs.rm(), rd, rs.offset_);
1286
+ } else { // Offset > 16 bits, use multiple instructions to load.
1287
+ LoadRegPlusOffsetToAt(rs);
1288
+ GenInstrImmediate(LBU, at, rd, 0); // Equiv to lbu(rd, MemOperand(at, 0));
1289
+ }
1290
+ }
1291
+
1292
+
1293
+ void Assembler::lh(Register rd, const MemOperand& rs) {
1294
+ if (is_int16(rs.offset_)) {
1295
+ GenInstrImmediate(LH, rs.rm(), rd, rs.offset_);
1296
+ } else { // Offset > 16 bits, use multiple instructions to load.
1297
+ LoadRegPlusOffsetToAt(rs);
1298
+ GenInstrImmediate(LH, at, rd, 0); // Equiv to lh(rd, MemOperand(at, 0));
1299
+ }
1300
+ }
1301
+
1302
+
1303
+ void Assembler::lhu(Register rd, const MemOperand& rs) {
1304
+ if (is_int16(rs.offset_)) {
1305
+ GenInstrImmediate(LHU, rs.rm(), rd, rs.offset_);
1306
+ } else { // Offset > 16 bits, use multiple instructions to load.
1307
+ LoadRegPlusOffsetToAt(rs);
1308
+ GenInstrImmediate(LHU, at, rd, 0); // Equiv to lhu(rd, MemOperand(at, 0));
1309
+ }
1310
+ }
1311
+
1312
+
1313
+ void Assembler::lw(Register rd, const MemOperand& rs) {
1314
+ if (is_int16(rs.offset_)) {
1315
+ GenInstrImmediate(LW, rs.rm(), rd, rs.offset_);
1316
+ } else { // Offset > 16 bits, use multiple instructions to load.
1317
+ LoadRegPlusOffsetToAt(rs);
1318
+ GenInstrImmediate(LW, at, rd, 0); // Equiv to lw(rd, MemOperand(at, 0));
1319
+ }
1320
+
1321
+ if (can_peephole_optimize(2)) {
1322
+ Instr sw_instr = instr_at(pc_ - 2 * kInstrSize);
1323
+ Instr lw_instr = instr_at(pc_ - 1 * kInstrSize);
1324
+
1325
+ if ((IsSwRegFpOffset(sw_instr) &&
1326
+ IsLwRegFpOffset(lw_instr)) ||
1327
+ (IsSwRegFpNegOffset(sw_instr) &&
1328
+ IsLwRegFpNegOffset(lw_instr))) {
1329
+ if ((lw_instr & kLwSwInstrArgumentMask) ==
1330
+ (sw_instr & kLwSwInstrArgumentMask)) {
1331
+ // Pattern: Lw/sw same fp+offset, same register.
1332
+ //
1333
+ // The following:
1334
+ // sw rx, [fp, #-12]
1335
+ // lw rx, [fp, #-12]
1336
+ //
1337
+ // Becomes:
1338
+ // sw rx, [fp, #-12]
1339
+
1340
+ pc_ -= 1 * kInstrSize;
1341
+ if (FLAG_print_peephole_optimization) {
1342
+ PrintF("%x sw/lw (fp + same offset), same reg\n", pc_offset());
1343
+ }
1344
+ } else if ((lw_instr & kLwSwOffsetMask) ==
1345
+ (sw_instr & kLwSwOffsetMask)) {
1346
+ // Pattern: Lw/sw same fp+offset, different register.
1347
+ //
1348
+ // The following:
1349
+ // sw rx, [fp, #-12]
1350
+ // lw ry, [fp, #-12]
1351
+ //
1352
+ // Becomes:
1353
+ // sw rx, [fp, #-12]
1354
+ // mov ry, rx
1355
+
1356
+ Register reg_stored, reg_loaded;
1357
+ reg_stored = GetRt(sw_instr);
1358
+ reg_loaded = GetRt(lw_instr);
1359
+ pc_ -= 1 * kInstrSize;
1360
+ // Insert a mov instruction, which is better than lw.
1361
+ or_(reg_loaded, reg_stored, zero_reg); // Move instruction.
1362
+ if (FLAG_print_peephole_optimization) {
1363
+ PrintF("%x sw/lw (fp + same offset), diff reg \n", pc_offset());
1364
+ }
1365
+ }
1366
+ }
1367
+ }
1368
+ }
1369
+
1370
+
1371
+ void Assembler::lwl(Register rd, const MemOperand& rs) {
1372
+ GenInstrImmediate(LWL, rs.rm(), rd, rs.offset_);
1373
+ }
1374
+
1375
+
1376
+ void Assembler::lwr(Register rd, const MemOperand& rs) {
1377
+ GenInstrImmediate(LWR, rs.rm(), rd, rs.offset_);
1378
+ }
1379
+
1380
+
1381
+ void Assembler::sb(Register rd, const MemOperand& rs) {
1382
+ if (is_int16(rs.offset_)) {
1383
+ GenInstrImmediate(SB, rs.rm(), rd, rs.offset_);
1384
+ } else { // Offset > 16 bits, use multiple instructions to store.
1385
+ LoadRegPlusOffsetToAt(rs);
1386
+ GenInstrImmediate(SB, at, rd, 0); // Equiv to sb(rd, MemOperand(at, 0));
1387
+ }
1388
+ }
1389
+
1390
+
1391
+ void Assembler::sh(Register rd, const MemOperand& rs) {
1392
+ if (is_int16(rs.offset_)) {
1393
+ GenInstrImmediate(SH, rs.rm(), rd, rs.offset_);
1394
+ } else { // Offset > 16 bits, use multiple instructions to store.
1395
+ LoadRegPlusOffsetToAt(rs);
1396
+ GenInstrImmediate(SH, at, rd, 0); // Equiv to sh(rd, MemOperand(at, 0));
1397
+ }
1398
+ }
1399
+
1400
+
1401
+ void Assembler::sw(Register rd, const MemOperand& rs) {
1402
+ if (is_int16(rs.offset_)) {
1403
+ GenInstrImmediate(SW, rs.rm(), rd, rs.offset_);
1404
+ } else { // Offset > 16 bits, use multiple instructions to store.
1405
+ LoadRegPlusOffsetToAt(rs);
1406
+ GenInstrImmediate(SW, at, rd, 0); // Equiv to sw(rd, MemOperand(at, 0));
1407
+ }
1408
+
1409
+ // Eliminate pattern: pop(), push(r).
1410
+ // addiu sp, sp, Operand(kPointerSize);
1411
+ // addiu sp, sp, Operand(-kPointerSize);
1412
+ // -> sw r, MemOpernad(sp, 0);
1413
+ if (can_peephole_optimize(3) &&
1414
+ // Pattern.
1415
+ instr_at(pc_ - 1 * kInstrSize) ==
1416
+ (kPushRegPattern | (rd.code() << kRtShift)) &&
1417
+ instr_at(pc_ - 2 * kInstrSize) == kPushInstruction &&
1418
+ instr_at(pc_ - 3 * kInstrSize) == kPopInstruction) {
1419
+ pc_ -= 3 * kInstrSize;
1420
+ GenInstrImmediate(SW, rs.rm(), rd, rs.offset_);
1421
+ if (FLAG_print_peephole_optimization) {
1422
+ PrintF("%x pop()/push(reg) eliminated\n", pc_offset());
1423
+ }
1424
+ }
1425
+ }
1426
+
1427
+
1428
+ void Assembler::swl(Register rd, const MemOperand& rs) {
1429
+ GenInstrImmediate(SWL, rs.rm(), rd, rs.offset_);
1430
+ }
1431
+
1432
+
1433
+ void Assembler::swr(Register rd, const MemOperand& rs) {
1434
+ GenInstrImmediate(SWR, rs.rm(), rd, rs.offset_);
1435
+ }
1436
+
1437
+
1438
+ void Assembler::lui(Register rd, int32_t j) {
1439
+ GenInstrImmediate(LUI, zero_reg, rd, j);
1440
+ }
1441
+
1442
+
1443
+ //-------------Misc-instructions--------------
1444
+
1445
+ // Break / Trap instructions.
1446
+ void Assembler::break_(uint32_t code) {
1447
+ ASSERT((code & ~0xfffff) == 0);
1448
+ Instr break_instr = SPECIAL | BREAK | (code << 6);
1449
+ emit(break_instr);
1450
+ }
1451
+
1452
+
1453
+ void Assembler::tge(Register rs, Register rt, uint16_t code) {
1454
+ ASSERT(is_uint10(code));
1455
+ Instr instr = SPECIAL | TGE | rs.code() << kRsShift
1456
+ | rt.code() << kRtShift | code << 6;
1457
+ emit(instr);
1458
+ }
1459
+
1460
+
1461
+ void Assembler::tgeu(Register rs, Register rt, uint16_t code) {
1462
+ ASSERT(is_uint10(code));
1463
+ Instr instr = SPECIAL | TGEU | rs.code() << kRsShift
1464
+ | rt.code() << kRtShift | code << 6;
1465
+ emit(instr);
1466
+ }
1467
+
1468
+
1469
+ void Assembler::tlt(Register rs, Register rt, uint16_t code) {
1470
+ ASSERT(is_uint10(code));
1471
+ Instr instr =
1472
+ SPECIAL | TLT | rs.code() << kRsShift | rt.code() << kRtShift | code << 6;
1473
+ emit(instr);
1474
+ }
1475
+
1476
+
1477
+ void Assembler::tltu(Register rs, Register rt, uint16_t code) {
1478
+ ASSERT(is_uint10(code));
1479
+ Instr instr =
1480
+ SPECIAL | TLTU | rs.code() << kRsShift
1481
+ | rt.code() << kRtShift | code << 6;
1482
+ emit(instr);
1483
+ }
1484
+
1485
+
1486
+ void Assembler::teq(Register rs, Register rt, uint16_t code) {
1487
+ ASSERT(is_uint10(code));
1488
+ Instr instr =
1489
+ SPECIAL | TEQ | rs.code() << kRsShift | rt.code() << kRtShift | code << 6;
1490
+ emit(instr);
1491
+ }
1492
+
1493
+
1494
+ void Assembler::tne(Register rs, Register rt, uint16_t code) {
1495
+ ASSERT(is_uint10(code));
1496
+ Instr instr =
1497
+ SPECIAL | TNE | rs.code() << kRsShift | rt.code() << kRtShift | code << 6;
1498
+ emit(instr);
1499
+ }
1500
+
1501
+
1502
+ // Move from HI/LO register.
1503
+
1504
+ void Assembler::mfhi(Register rd) {
1505
+ GenInstrRegister(SPECIAL, zero_reg, zero_reg, rd, 0, MFHI);
1506
+ }
1507
+
1508
+
1509
+ void Assembler::mflo(Register rd) {
1510
+ GenInstrRegister(SPECIAL, zero_reg, zero_reg, rd, 0, MFLO);
1511
+ }
1512
+
1513
+
1514
+ // Set on less than instructions.
1515
+ void Assembler::slt(Register rd, Register rs, Register rt) {
1516
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SLT);
1517
+ }
1518
+
1519
+
1520
+ void Assembler::sltu(Register rd, Register rs, Register rt) {
1521
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, SLTU);
1522
+ }
1523
+
1524
+
1525
+ void Assembler::slti(Register rt, Register rs, int32_t j) {
1526
+ GenInstrImmediate(SLTI, rs, rt, j);
1527
+ }
1528
+
1529
+
1530
+ void Assembler::sltiu(Register rt, Register rs, int32_t j) {
1531
+ GenInstrImmediate(SLTIU, rs, rt, j);
1532
+ }
1533
+
1534
+
1535
+ // Conditional move.
1536
+ void Assembler::movz(Register rd, Register rs, Register rt) {
1537
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVZ);
1538
+ }
1539
+
1540
+
1541
+ void Assembler::movn(Register rd, Register rs, Register rt) {
1542
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVN);
1543
+ }
1544
+
1545
+
1546
+ void Assembler::movt(Register rd, Register rs, uint16_t cc) {
1547
+ Register rt;
1548
+ rt.code_ = (cc & 0x0003) << 2 | 1;
1549
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI);
1550
+ }
1551
+
1552
+
1553
+ void Assembler::movf(Register rd, Register rs, uint16_t cc) {
1554
+ Register rt;
1555
+ rt.code_ = (cc & 0x0003) << 2 | 0;
1556
+ GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI);
1557
+ }
1558
+
1559
+
1560
+ // Bit twiddling.
1561
+ void Assembler::clz(Register rd, Register rs) {
1562
+ // Clz instr requires same GPR number in 'rd' and 'rt' fields.
1563
+ GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ);
1564
+ }
1565
+
1566
+
1567
+ void Assembler::ins_(Register rt, Register rs, uint16_t pos, uint16_t size) {
1568
+ // Should be called via MacroAssembler::Ins.
1569
+ // Ins instr has 'rt' field as dest, and two uint5: msb, lsb.
1570
+ ASSERT(mips32r2);
1571
+ GenInstrRegister(SPECIAL3, rs, rt, pos + size - 1, pos, INS);
1572
+ }
1573
+
1574
+
1575
+ void Assembler::ext_(Register rt, Register rs, uint16_t pos, uint16_t size) {
1576
+ // Should be called via MacroAssembler::Ext.
1577
+ // Ext instr has 'rt' field as dest, and two uint5: msb, lsb.
1578
+ ASSERT(mips32r2);
1579
+ GenInstrRegister(SPECIAL3, rs, rt, size - 1, pos, EXT);
1580
+ }
1581
+
1582
+
1583
+ //--------Coprocessor-instructions----------------
1584
+
1585
+ // Load, store, move.
1586
+ void Assembler::lwc1(FPURegister fd, const MemOperand& src) {
1587
+ GenInstrImmediate(LWC1, src.rm(), fd, src.offset_);
1588
+ }
1589
+
1590
+
1591
+ void Assembler::ldc1(FPURegister fd, const MemOperand& src) {
1592
+ // Workaround for non-8-byte alignment of HeapNumber, convert 64-bit
1593
+ // load to two 32-bit loads.
1594
+ GenInstrImmediate(LWC1, src.rm(), fd, src.offset_);
1595
+ FPURegister nextfpreg;
1596
+ nextfpreg.setcode(fd.code() + 1);
1597
+ GenInstrImmediate(LWC1, src.rm(), nextfpreg, src.offset_ + 4);
1598
+ }
1599
+
1600
+
1601
+ void Assembler::swc1(FPURegister fd, const MemOperand& src) {
1602
+ GenInstrImmediate(SWC1, src.rm(), fd, src.offset_);
1603
+ }
1604
+
1605
+
1606
+ void Assembler::sdc1(FPURegister fd, const MemOperand& src) {
1607
+ // Workaround for non-8-byte alignment of HeapNumber, convert 64-bit
1608
+ // store to two 32-bit stores.
1609
+ GenInstrImmediate(SWC1, src.rm(), fd, src.offset_);
1610
+ FPURegister nextfpreg;
1611
+ nextfpreg.setcode(fd.code() + 1);
1612
+ GenInstrImmediate(SWC1, src.rm(), nextfpreg, src.offset_ + 4);
1613
+ }
1614
+
1615
+
1616
+ void Assembler::mtc1(Register rt, FPURegister fs) {
1617
+ GenInstrRegister(COP1, MTC1, rt, fs, f0);
1618
+ }
1619
+
1620
+
1621
+ void Assembler::mfc1(Register rt, FPURegister fs) {
1622
+ GenInstrRegister(COP1, MFC1, rt, fs, f0);
1623
+ }
1624
+
1625
+
1626
+ void Assembler::ctc1(Register rt, FPUControlRegister fs) {
1627
+ GenInstrRegister(COP1, CTC1, rt, fs);
1628
+ }
1629
+
1630
+
1631
+ void Assembler::cfc1(Register rt, FPUControlRegister fs) {
1632
+ GenInstrRegister(COP1, CFC1, rt, fs);
1633
+ }
1634
+
1635
+
1636
+ // Arithmetic.
1637
+
1638
+ void Assembler::add_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1639
+ GenInstrRegister(COP1, D, ft, fs, fd, ADD_D);
1640
+ }
1641
+
1642
+
1643
+ void Assembler::sub_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1644
+ GenInstrRegister(COP1, D, ft, fs, fd, SUB_D);
1645
+ }
1646
+
1647
+
1648
+ void Assembler::mul_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1649
+ GenInstrRegister(COP1, D, ft, fs, fd, MUL_D);
1650
+ }
1651
+
1652
+
1653
+ void Assembler::div_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1654
+ GenInstrRegister(COP1, D, ft, fs, fd, DIV_D);
1655
+ }
1656
+
1657
+
1658
+ void Assembler::abs_d(FPURegister fd, FPURegister fs) {
1659
+ GenInstrRegister(COP1, D, f0, fs, fd, ABS_D);
1660
+ }
1661
+
1662
+
1663
+ void Assembler::mov_d(FPURegister fd, FPURegister fs) {
1664
+ GenInstrRegister(COP1, D, f0, fs, fd, MOV_D);
1665
+ }
1666
+
1667
+
1668
+ void Assembler::neg_d(FPURegister fd, FPURegister fs) {
1669
+ GenInstrRegister(COP1, D, f0, fs, fd, NEG_D);
1670
+ }
1671
+
1672
+
1673
+ void Assembler::sqrt_d(FPURegister fd, FPURegister fs) {
1674
+ GenInstrRegister(COP1, D, f0, fs, fd, SQRT_D);
1675
+ }
1676
+
1677
+
1678
+ // Conversions.
1679
+
1680
+ void Assembler::cvt_w_s(FPURegister fd, FPURegister fs) {
1681
+ GenInstrRegister(COP1, S, f0, fs, fd, CVT_W_S);
1682
+ }
1683
+
1684
+
1685
+ void Assembler::cvt_w_d(FPURegister fd, FPURegister fs) {
1686
+ GenInstrRegister(COP1, D, f0, fs, fd, CVT_W_D);
1687
+ }
1688
+
1689
+
1690
+ void Assembler::trunc_w_s(FPURegister fd, FPURegister fs) {
1691
+ GenInstrRegister(COP1, S, f0, fs, fd, TRUNC_W_S);
1692
+ }
1693
+
1694
+
1695
+ void Assembler::trunc_w_d(FPURegister fd, FPURegister fs) {
1696
+ GenInstrRegister(COP1, D, f0, fs, fd, TRUNC_W_D);
1697
+ }
1698
+
1699
+
1700
+ void Assembler::round_w_s(FPURegister fd, FPURegister fs) {
1701
+ GenInstrRegister(COP1, S, f0, fs, fd, ROUND_W_S);
1702
+ }
1703
+
1704
+
1705
+ void Assembler::round_w_d(FPURegister fd, FPURegister fs) {
1706
+ GenInstrRegister(COP1, D, f0, fs, fd, ROUND_W_D);
1707
+ }
1708
+
1709
+
1710
+ void Assembler::floor_w_s(FPURegister fd, FPURegister fs) {
1711
+ GenInstrRegister(COP1, S, f0, fs, fd, FLOOR_W_S);
1712
+ }
1713
+
1714
+
1715
+ void Assembler::floor_w_d(FPURegister fd, FPURegister fs) {
1716
+ GenInstrRegister(COP1, D, f0, fs, fd, FLOOR_W_D);
1717
+ }
1718
+
1719
+
1720
+ void Assembler::ceil_w_s(FPURegister fd, FPURegister fs) {
1721
+ GenInstrRegister(COP1, S, f0, fs, fd, CEIL_W_S);
1722
+ }
1723
+
1724
+
1725
+ void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) {
1726
+ GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D);
1727
+ }
1728
+
1729
+
1730
+ void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) {
1731
+ ASSERT(mips32r2);
1732
+ GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S);
1733
+ }
1734
+
1735
+
1736
+ void Assembler::cvt_l_d(FPURegister fd, FPURegister fs) {
1737
+ ASSERT(mips32r2);
1738
+ GenInstrRegister(COP1, D, f0, fs, fd, CVT_L_D);
1739
+ }
1740
+
1741
+
1742
+ void Assembler::trunc_l_s(FPURegister fd, FPURegister fs) {
1743
+ ASSERT(mips32r2);
1744
+ GenInstrRegister(COP1, S, f0, fs, fd, TRUNC_L_S);
1745
+ }
1746
+
1747
+
1748
+ void Assembler::trunc_l_d(FPURegister fd, FPURegister fs) {
1749
+ ASSERT(mips32r2);
1750
+ GenInstrRegister(COP1, D, f0, fs, fd, TRUNC_L_D);
1751
+ }
1752
+
1753
+
1754
+ void Assembler::round_l_s(FPURegister fd, FPURegister fs) {
1755
+ GenInstrRegister(COP1, S, f0, fs, fd, ROUND_L_S);
1756
+ }
1757
+
1758
+
1759
+ void Assembler::round_l_d(FPURegister fd, FPURegister fs) {
1760
+ GenInstrRegister(COP1, D, f0, fs, fd, ROUND_L_D);
1761
+ }
1762
+
1763
+
1764
+ void Assembler::floor_l_s(FPURegister fd, FPURegister fs) {
1765
+ GenInstrRegister(COP1, S, f0, fs, fd, FLOOR_L_S);
1766
+ }
1767
+
1768
+
1769
+ void Assembler::floor_l_d(FPURegister fd, FPURegister fs) {
1770
+ GenInstrRegister(COP1, D, f0, fs, fd, FLOOR_L_D);
1771
+ }
1772
+
1773
+
1774
+ void Assembler::ceil_l_s(FPURegister fd, FPURegister fs) {
1775
+ GenInstrRegister(COP1, S, f0, fs, fd, CEIL_L_S);
1776
+ }
1777
+
1778
+
1779
+ void Assembler::ceil_l_d(FPURegister fd, FPURegister fs) {
1780
+ GenInstrRegister(COP1, D, f0, fs, fd, CEIL_L_D);
1781
+ }
1782
+
1783
+
1784
+ void Assembler::cvt_s_w(FPURegister fd, FPURegister fs) {
1785
+ GenInstrRegister(COP1, W, f0, fs, fd, CVT_S_W);
1786
+ }
1787
+
1788
+
1789
+ void Assembler::cvt_s_l(FPURegister fd, FPURegister fs) {
1790
+ ASSERT(mips32r2);
1791
+ GenInstrRegister(COP1, L, f0, fs, fd, CVT_S_L);
1792
+ }
1793
+
1794
+
1795
+ void Assembler::cvt_s_d(FPURegister fd, FPURegister fs) {
1796
+ GenInstrRegister(COP1, D, f0, fs, fd, CVT_S_D);
1797
+ }
1798
+
1799
+
1800
+ void Assembler::cvt_d_w(FPURegister fd, FPURegister fs) {
1801
+ GenInstrRegister(COP1, W, f0, fs, fd, CVT_D_W);
1802
+ }
1803
+
1804
+
1805
+ void Assembler::cvt_d_l(FPURegister fd, FPURegister fs) {
1806
+ ASSERT(mips32r2);
1807
+ GenInstrRegister(COP1, L, f0, fs, fd, CVT_D_L);
1808
+ }
1809
+
1810
+
1811
+ void Assembler::cvt_d_s(FPURegister fd, FPURegister fs) {
1812
+ GenInstrRegister(COP1, S, f0, fs, fd, CVT_D_S);
1813
+ }
1814
+
1815
+
1816
+ // Conditions.
1817
+ void Assembler::c(FPUCondition cond, SecondaryField fmt,
1818
+ FPURegister fs, FPURegister ft, uint16_t cc) {
1819
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
1820
+ ASSERT(is_uint3(cc));
1821
+ ASSERT((fmt & ~(31 << kRsShift)) == 0);
1822
+ Instr instr = COP1 | fmt | ft.code() << 16 | fs.code() << kFsShift
1823
+ | cc << 8 | 3 << 4 | cond;
1824
+ emit(instr);
1825
+ }
1826
+
1827
+
1828
+ void Assembler::fcmp(FPURegister src1, const double src2,
1829
+ FPUCondition cond) {
1830
+ ASSERT(isolate()->cpu_features()->IsSupported(FPU));
1831
+ ASSERT(src2 == 0.0);
1832
+ mtc1(zero_reg, f14);
1833
+ cvt_d_w(f14, f14);
1834
+ c(cond, D, src1, f14, 0);
1835
+ }
1836
+
1837
+
1838
+ void Assembler::bc1f(int16_t offset, uint16_t cc) {
1839
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
1840
+ ASSERT(is_uint3(cc));
1841
+ Instr instr = COP1 | BC1 | cc << 18 | 0 << 16 | (offset & kImm16Mask);
1842
+ emit(instr);
1843
+ }
1844
+
1845
+
1846
+ void Assembler::bc1t(int16_t offset, uint16_t cc) {
1847
+ ASSERT(isolate()->cpu_features()->IsEnabled(FPU));
1848
+ ASSERT(is_uint3(cc));
1849
+ Instr instr = COP1 | BC1 | cc << 18 | 1 << 16 | (offset & kImm16Mask);
1850
+ emit(instr);
1851
+ }
1852
+
1853
+
1854
+ // Debugging.
1855
+ void Assembler::RecordJSReturn() {
1856
+ positions_recorder()->WriteRecordedPositions();
1857
+ CheckBuffer();
1858
+ RecordRelocInfo(RelocInfo::JS_RETURN);
1859
+ }
1860
+
1861
+
1862
+ void Assembler::RecordDebugBreakSlot() {
1863
+ positions_recorder()->WriteRecordedPositions();
1864
+ CheckBuffer();
1865
+ RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
1866
+ }
1867
+
1868
+
1869
+ void Assembler::RecordComment(const char* msg) {
1870
+ if (FLAG_code_comments) {
1871
+ CheckBuffer();
1872
+ RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
1873
+ }
1874
+ }
1875
+
1876
+
1877
+ void Assembler::GrowBuffer() {
1878
+ if (!own_buffer_) FATAL("external code buffer is too small");
1879
+
1880
+ // Compute new buffer size.
1881
+ CodeDesc desc; // The new buffer.
1882
+ if (buffer_size_ < 4*KB) {
1883
+ desc.buffer_size = 4*KB;
1884
+ } else if (buffer_size_ < 1*MB) {
1885
+ desc.buffer_size = 2*buffer_size_;
1886
+ } else {
1887
+ desc.buffer_size = buffer_size_ + 1*MB;
1888
+ }
1889
+ CHECK_GT(desc.buffer_size, 0); // No overflow.
1890
+
1891
+ // Setup new buffer.
1892
+ desc.buffer = NewArray<byte>(desc.buffer_size);
1893
+
1894
+ desc.instr_size = pc_offset();
1895
+ desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos();
1896
+
1897
+ // Copy the data.
1898
+ int pc_delta = desc.buffer - buffer_;
1899
+ int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_);
1900
+ memmove(desc.buffer, buffer_, desc.instr_size);
1901
+ memmove(reloc_info_writer.pos() + rc_delta,
1902
+ reloc_info_writer.pos(), desc.reloc_size);
1903
+
1904
+ // Switch buffers.
1905
+ DeleteArray(buffer_);
1906
+ buffer_ = desc.buffer;
1907
+ buffer_size_ = desc.buffer_size;
1908
+ pc_ += pc_delta;
1909
+ reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta,
1910
+ reloc_info_writer.last_pc() + pc_delta);
1911
+
1912
+ // On ia32 and ARM pc relative addressing is used, and we thus need to apply a
1913
+ // shift by pc_delta. But on MIPS the target address it directly loaded, so
1914
+ // we do not need to relocate here.
1915
+
1916
+ ASSERT(!overflow());
1917
+ }
1918
+
1919
+
1920
+ void Assembler::db(uint8_t data) {
1921
+ CheckBuffer();
1922
+ *reinterpret_cast<uint8_t*>(pc_) = data;
1923
+ pc_ += sizeof(uint8_t);
1924
+ }
1925
+
1926
+
1927
+ void Assembler::dd(uint32_t data) {
1928
+ CheckBuffer();
1929
+ *reinterpret_cast<uint32_t*>(pc_) = data;
1930
+ pc_ += sizeof(uint32_t);
1931
+ }
1932
+
1933
+
1934
+ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
1935
+ RelocInfo rinfo(pc_, rmode, data); // We do not try to reuse pool constants.
1936
+ if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::DEBUG_BREAK_SLOT) {
1937
+ // Adjust code for new modes.
1938
+ ASSERT(RelocInfo::IsDebugBreakSlot(rmode)
1939
+ || RelocInfo::IsJSReturn(rmode)
1940
+ || RelocInfo::IsComment(rmode)
1941
+ || RelocInfo::IsPosition(rmode));
1942
+ // These modes do not need an entry in the constant pool.
1943
+ }
1944
+ if (rinfo.rmode() != RelocInfo::NONE) {
1945
+ // Don't record external references unless the heap will be serialized.
1946
+ if (rmode == RelocInfo::EXTERNAL_REFERENCE &&
1947
+ !Serializer::enabled() &&
1948
+ !FLAG_debug_code) {
1949
+ return;
1950
+ }
1951
+ ASSERT(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here.
1952
+ reloc_info_writer.Write(&rinfo);
1953
+ }
1954
+ }
1955
+
1956
+
1957
+ void Assembler::BlockTrampolinePoolFor(int instructions) {
1958
+ BlockTrampolinePoolBefore(pc_offset() + instructions * kInstrSize);
1959
+ }
1960
+
1961
+
1962
+ void Assembler::CheckTrampolinePool(bool force_emit) {
1963
+ // Calculate the offset of the next check.
1964
+ next_buffer_check_ = pc_offset() + kCheckConstInterval;
1965
+
1966
+ int dist = pc_offset() - last_trampoline_pool_end_;
1967
+
1968
+ if (dist <= kMaxDistBetweenPools && !force_emit) {
1969
+ return;
1970
+ }
1971
+
1972
+ // Some small sequences of instructions must not be broken up by the
1973
+ // insertion of a trampoline pool; such sequences are protected by setting
1974
+ // either trampoline_pool_blocked_nesting_ or no_trampoline_pool_before_,
1975
+ // which are both checked here. Also, recursive calls to CheckTrampolinePool
1976
+ // are blocked by trampoline_pool_blocked_nesting_.
1977
+ if ((trampoline_pool_blocked_nesting_ > 0) ||
1978
+ (pc_offset() < no_trampoline_pool_before_)) {
1979
+ // Emission is currently blocked; make sure we try again as soon as
1980
+ // possible.
1981
+ if (trampoline_pool_blocked_nesting_ > 0) {
1982
+ next_buffer_check_ = pc_offset() + kInstrSize;
1983
+ } else {
1984
+ next_buffer_check_ = no_trampoline_pool_before_;
1985
+ }
1986
+ return;
1987
+ }
1988
+
1989
+ // First we emit jump (2 instructions), then we emit trampoline pool.
1990
+ { BlockTrampolinePoolScope block_trampoline_pool(this);
1991
+ Label after_pool;
1992
+ b(&after_pool);
1993
+ nop();
1994
+
1995
+ int pool_start = pc_offset();
1996
+ for (int i = 0; i < kSlotsPerTrampoline; i++) {
1997
+ b(&after_pool);
1998
+ nop();
1999
+ }
2000
+ for (int i = 0; i < kLabelsPerTrampoline; i++) {
2001
+ emit(0);
2002
+ }
2003
+ last_trampoline_pool_end_ = pc_offset() - kInstrSize;
2004
+ bind(&after_pool);
2005
+ trampolines_.Add(Trampoline(pool_start,
2006
+ kSlotsPerTrampoline,
2007
+ kLabelsPerTrampoline));
2008
+
2009
+ // Since a trampoline pool was just emitted,
2010
+ // move the check offset forward by the standard interval.
2011
+ next_buffer_check_ = last_trampoline_pool_end_ + kMaxDistBetweenPools;
2012
+ }
2013
+ return;
2014
+ }
2015
+
2016
+
2017
+ Address Assembler::target_address_at(Address pc) {
2018
+ Instr instr1 = instr_at(pc);
2019
+ Instr instr2 = instr_at(pc + kInstrSize);
2020
+ // Check we have 2 instructions generated by li.
2021
+ ASSERT(((instr1 & kOpcodeMask) == LUI && (instr2 & kOpcodeMask) == ORI) ||
2022
+ ((instr1 == nopInstr) && ((instr2 & kOpcodeMask) == ADDI ||
2023
+ (instr2 & kOpcodeMask) == ORI ||
2024
+ (instr2 & kOpcodeMask) == LUI)));
2025
+ // Interpret these 2 instructions.
2026
+ if (instr1 == nopInstr) {
2027
+ if ((instr2 & kOpcodeMask) == ADDI) {
2028
+ return reinterpret_cast<Address>(((instr2 & kImm16Mask) << 16) >> 16);
2029
+ } else if ((instr2 & kOpcodeMask) == ORI) {
2030
+ return reinterpret_cast<Address>(instr2 & kImm16Mask);
2031
+ } else if ((instr2 & kOpcodeMask) == LUI) {
2032
+ return reinterpret_cast<Address>((instr2 & kImm16Mask) << 16);
2033
+ }
2034
+ } else if ((instr1 & kOpcodeMask) == LUI && (instr2 & kOpcodeMask) == ORI) {
2035
+ // 32 bit value.
2036
+ return reinterpret_cast<Address>(
2037
+ (instr1 & kImm16Mask) << 16 | (instr2 & kImm16Mask));
2038
+ }
2039
+
2040
+ // We should never get here.
2041
+ UNREACHABLE();
2042
+ return (Address)0x0;
2043
+ }
2044
+
2045
+
2046
+ void Assembler::set_target_address_at(Address pc, Address target) {
2047
+ // On MIPS we need to patch the code to generate.
2048
+
2049
+ // First check we have a li.
2050
+ Instr instr2 = instr_at(pc + kInstrSize);
2051
+ #ifdef DEBUG
2052
+ Instr instr1 = instr_at(pc);
2053
+
2054
+ // Check we have indeed the result from a li with MustUseReg true.
2055
+ CHECK(((instr1 & kOpcodeMask) == LUI && (instr2 & kOpcodeMask) == ORI) ||
2056
+ ((instr1 == 0) && ((instr2 & kOpcodeMask)== ADDIU ||
2057
+ (instr2 & kOpcodeMask)== ORI ||
2058
+ (instr2 & kOpcodeMask)== LUI)));
2059
+ #endif
2060
+
2061
+ uint32_t rt_code = (instr2 & kRtFieldMask);
2062
+ uint32_t* p = reinterpret_cast<uint32_t*>(pc);
2063
+ uint32_t itarget = reinterpret_cast<uint32_t>(target);
2064
+
2065
+ if (is_int16(itarget)) {
2066
+ // nop.
2067
+ // addiu rt zero_reg j.
2068
+ *p = nopInstr;
2069
+ *(p+1) = ADDIU | rt_code | (itarget & kImm16Mask);
2070
+ } else if (!(itarget & kHiMask)) {
2071
+ // nop.
2072
+ // ori rt zero_reg j.
2073
+ *p = nopInstr;
2074
+ *(p+1) = ORI | rt_code | (itarget & kImm16Mask);
2075
+ } else if (!(itarget & kImm16Mask)) {
2076
+ // nop.
2077
+ // lui rt (kHiMask & itarget) >> kLuiShift.
2078
+ *p = nopInstr;
2079
+ *(p+1) = LUI | rt_code | ((itarget & kHiMask) >> kLuiShift);
2080
+ } else {
2081
+ // lui rt (kHiMask & itarget) >> kLuiShift.
2082
+ // ori rt rt, (kImm16Mask & itarget).
2083
+ *p = LUI | rt_code | ((itarget & kHiMask) >> kLuiShift);
2084
+ *(p+1) = ORI | rt_code | (rt_code << 5) | (itarget & kImm16Mask);
2085
+ }
2086
+
2087
+ CPU::FlushICache(pc, 2 * sizeof(int32_t));
2088
+ }
2089
+
2090
+
2091
+ } } // namespace v8::internal
2092
+
2093
+ #endif // V8_TARGET_ARCH_MIPS