therubyracer 0.8.1.pre2 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

Files changed (877) hide show
  1. data/Changelog.md +2 -1
  2. data/README.md +6 -3
  3. data/ext/v8/upstream/3.1.8/.gitignore +31 -0
  4. data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
  5. data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
  6. data/ext/v8/upstream/3.1.8/LICENSE +52 -0
  7. data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
  8. data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
  9. data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
  10. data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
  11. data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
  12. data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
  13. data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
  14. data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
  15. data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
  16. data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
  17. data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
  18. data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
  19. data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
  20. data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
  21. data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
  22. data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
  23. data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
  24. data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
  25. data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
  26. data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
  27. data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
  28. data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
  29. data/ext/v8/upstream/3.1.8/src/api.h +508 -0
  30. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
  31. data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
  32. data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
  33. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
  34. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
  35. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
  36. data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
  37. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
  38. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
  39. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
  40. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
  41. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
  42. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
  43. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
  44. data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
  45. data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
  46. data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
  47. data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
  48. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
  49. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
  50. data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
  51. data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
  52. data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
  53. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
  54. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
  55. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
  56. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
  57. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
  58. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
  59. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
  60. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
  61. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
  62. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
  63. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
  64. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
  65. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
  66. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
  67. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
  68. data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
  69. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
  70. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
  71. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
  72. data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
  73. data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
  74. data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
  75. data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
  76. data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
  77. data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
  78. data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
  79. data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
  80. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
  81. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
  82. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
  83. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
  84. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
  85. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
  86. data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
  87. data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
  88. data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
  89. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
  90. data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
  91. data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
  92. data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
  93. data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
  94. data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
  95. data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
  96. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
  97. data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
  98. data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
  99. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
  100. data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
  101. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
  102. data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
  103. data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
  104. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
  105. data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
  106. data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
  107. data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
  108. data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
  109. data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
  110. data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
  111. data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
  112. data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
  113. data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
  114. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
  115. data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
  116. data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
  117. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
  118. data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
  119. data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
  120. data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
  121. data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
  122. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
  123. data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
  124. data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
  125. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
  126. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
  127. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
  128. data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
  129. data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
  130. data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
  131. data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
  132. data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
  133. data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
  134. data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
  135. data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
  136. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
  137. data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
  138. data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
  139. data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
  140. data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
  141. data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
  142. data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
  143. data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
  144. data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
  145. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
  146. data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
  147. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
  148. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
  149. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
  150. data/ext/v8/upstream/3.1.8/src/double.h +238 -0
  151. data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
  152. data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
  153. data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
  154. data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
  155. data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
  156. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
  157. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
  158. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
  159. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
  160. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
  161. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
  162. data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
  163. data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
  164. data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
  165. data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
  166. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
  167. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
  168. data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
  169. data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
  170. data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
  171. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
  172. data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
  173. data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
  174. data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
  175. data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
  176. data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
  177. data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
  178. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
  179. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
  180. data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
  181. data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
  182. data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
  183. data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
  184. data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
  185. data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
  186. data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
  187. data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
  188. data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
  189. data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
  190. data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
  191. data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
  192. data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
  193. data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
  194. data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
  195. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
  196. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
  197. data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
  198. data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
  199. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
  200. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
  201. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
  202. data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
  203. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
  204. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
  205. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
  206. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
  207. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
  208. data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
  209. data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
  210. data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
  211. data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
  212. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
  213. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
  214. data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
  215. data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
  216. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
  217. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
  218. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
  219. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
  220. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  221. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
  222. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
  223. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
  224. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
  225. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
  226. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
  227. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
  228. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
  229. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
  230. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
  231. data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
  232. data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
  233. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
  234. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
  235. data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
  236. data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
  237. data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
  238. data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
  239. data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
  240. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
  241. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
  242. data/ext/v8/upstream/3.1.8/src/json.js +342 -0
  243. data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
  244. data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
  245. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
  246. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
  247. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
  248. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
  249. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
  250. data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
  251. data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
  252. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
  253. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
  254. data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
  255. data/ext/v8/upstream/3.1.8/src/list.h +164 -0
  256. data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
  257. data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
  258. data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
  259. data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
  260. data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
  261. data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
  262. data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
  263. data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
  264. data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
  265. data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
  266. data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
  267. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
  268. data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
  269. data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
  270. data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
  271. data/ext/v8/upstream/3.1.8/src/log.h +379 -0
  272. data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
  273. data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
  274. data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
  275. data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
  276. data/ext/v8/upstream/3.1.8/src/math.js +264 -0
  277. data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
  278. data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
  279. data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
  280. data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
  281. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
  282. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
  283. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
  284. data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
  285. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
  286. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
  287. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
  288. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
  289. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
  290. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
  291. data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
  292. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
  293. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
  294. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
  295. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
  296. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
  297. data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
  298. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
  299. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
  300. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
  301. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
  302. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
  303. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
  304. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
  305. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
  306. data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
  307. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
  308. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
  309. data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
  310. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
  311. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
  312. data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
  313. data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
  314. data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
  315. data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
  316. data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
  317. data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
  318. data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
  319. data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
  320. data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
  321. data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
  322. data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
  323. data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
  324. data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
  325. data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
  326. data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
  327. data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
  328. data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
  329. data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
  330. data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
  331. data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
  332. data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
  333. data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
  334. data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
  335. data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
  336. data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
  337. data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
  338. data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
  339. data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
  340. data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
  341. data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
  342. data/ext/v8/upstream/3.1.8/src/property.h +337 -0
  343. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  344. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
  345. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
  346. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
  347. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
  348. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
  349. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
  350. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
  351. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
  352. data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
  353. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
  354. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
  355. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
  356. data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
  357. data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
  358. data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
  359. data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
  360. data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
  361. data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
  362. data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
  363. data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
  364. data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
  365. data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
  366. data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
  367. data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
  368. data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
  369. data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
  370. data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
  371. data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
  372. data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
  373. data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
  374. data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
  375. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
  376. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
  377. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
  378. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
  379. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
  380. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
  381. data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
  382. data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
  383. data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
  384. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
  385. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
  386. data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
  387. data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
  388. data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
  389. data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
  390. data/ext/v8/upstream/3.1.8/src/string.js +915 -0
  391. data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
  392. data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
  393. data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
  394. data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
  395. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
  396. data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
  397. data/ext/v8/upstream/3.1.8/src/token.h +288 -0
  398. data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
  399. data/ext/v8/upstream/3.1.8/src/top.h +608 -0
  400. data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
  401. data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
  402. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
  403. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
  404. data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
  405. data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
  406. data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
  407. data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
  408. data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
  409. data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
  410. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
  411. data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
  412. data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
  413. data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
  414. data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
  415. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
  416. data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
  417. data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
  418. data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
  419. data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
  420. data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
  421. data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
  422. data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
  423. data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
  424. data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
  425. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
  426. data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
  427. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
  428. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
  429. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
  430. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
  431. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
  432. data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
  433. data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
  434. data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
  435. data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
  436. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
  437. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
  438. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
  439. data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
  440. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
  441. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
  442. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
  443. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
  444. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
  445. data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
  446. data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
  447. data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
  448. data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
  449. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
  450. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
  451. data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
  452. data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
  453. data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
  454. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
  455. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
  456. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  457. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
  458. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
  459. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
  460. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
  461. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
  462. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
  463. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
  464. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
  465. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
  466. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
  467. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
  468. data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
  469. data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
  470. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
  471. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
  472. data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
  473. data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
  474. data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
  475. data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
  476. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
  477. data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
  478. data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
  479. data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
  480. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
  481. data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
  482. data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
  483. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
  484. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
  485. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
  486. data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
  487. data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
  488. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
  489. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
  490. data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
  491. data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
  492. data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
  493. data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
  494. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
  495. data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
  496. data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
  497. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
  498. data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
  499. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
  500. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
  501. data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
  502. data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
  503. data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
  504. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
  505. data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
  506. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
  507. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
  508. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
  509. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
  510. data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
  511. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
  512. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
  513. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
  514. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
  515. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
  516. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
  517. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
  518. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
  519. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
  520. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
  521. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
  522. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  523. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  524. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  525. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  526. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  527. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  528. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  529. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
  530. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
  531. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
  532. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  533. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  534. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  535. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  536. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
  537. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
  538. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
  539. data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
  540. data/ext/v8/upstream/Makefile +2 -1
  541. data/ext/v8/v8_template.cpp +2 -2
  542. data/lib/v8/version.rb +1 -1
  543. data/spec/redjs/jsapi_spec.rb +2 -2
  544. metadata +552 -490
  545. data/ext/v8/upstream/2.3.3/.gitignore +0 -26
  546. data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
  547. data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
  548. data/ext/v8/upstream/2.3.3/LICENSE +0 -55
  549. data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
  550. data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
  551. data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
  552. data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
  553. data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
  554. data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
  555. data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
  556. data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
  557. data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
  558. data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
  559. data/ext/v8/upstream/2.3.3/src/api.h +0 -485
  560. data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
  561. data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
  562. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
  563. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
  564. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
  565. data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
  566. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
  567. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
  568. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
  569. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
  570. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
  571. data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
  572. data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
  573. data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
  574. data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
  575. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
  576. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
  577. data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
  578. data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
  579. data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
  580. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
  581. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
  582. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
  583. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
  584. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
  585. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
  586. data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
  587. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
  588. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
  589. data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
  590. data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
  591. data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
  592. data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
  593. data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
  594. data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
  595. data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
  596. data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
  597. data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
  598. data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
  599. data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
  600. data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
  601. data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
  602. data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
  603. data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
  604. data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
  605. data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
  606. data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
  607. data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
  608. data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
  609. data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
  610. data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
  611. data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
  612. data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
  613. data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
  614. data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
  615. data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
  616. data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
  617. data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
  618. data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
  619. data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
  620. data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
  621. data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
  622. data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
  623. data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
  624. data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
  625. data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
  626. data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
  627. data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
  628. data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
  629. data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
  630. data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
  631. data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
  632. data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
  633. data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
  634. data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
  635. data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
  636. data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
  637. data/ext/v8/upstream/2.3.3/src/double.h +0 -169
  638. data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
  639. data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
  640. data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
  641. data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
  642. data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
  643. data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
  644. data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
  645. data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
  646. data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
  647. data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
  648. data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
  649. data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
  650. data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
  651. data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
  652. data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
  653. data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
  654. data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
  655. data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
  656. data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
  657. data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
  658. data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
  659. data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
  660. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
  661. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
  662. data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
  663. data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
  664. data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
  665. data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
  666. data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
  667. data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
  668. data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
  669. data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
  670. data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
  671. data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
  672. data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
  673. data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
  674. data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
  675. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
  676. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
  677. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
  678. data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
  679. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
  680. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
  681. data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
  682. data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
  683. data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
  684. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
  685. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
  686. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
  687. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
  688. data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
  689. data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
  690. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
  691. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
  692. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
  693. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
  694. data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
  695. data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
  696. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
  697. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
  698. data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
  699. data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
  700. data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
  701. data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
  702. data/ext/v8/upstream/2.3.3/src/json.js +0 -268
  703. data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
  704. data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
  705. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
  706. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
  707. data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
  708. data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
  709. data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
  710. data/ext/v8/upstream/2.3.3/src/list.h +0 -159
  711. data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
  712. data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
  713. data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
  714. data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
  715. data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
  716. data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
  717. data/ext/v8/upstream/2.3.3/src/log.h +0 -384
  718. data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
  719. data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
  720. data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
  721. data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
  722. data/ext/v8/upstream/2.3.3/src/math.js +0 -264
  723. data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
  724. data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
  725. data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
  726. data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
  727. data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
  728. data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
  729. data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
  730. data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
  731. data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
  732. data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
  733. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
  734. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
  735. data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
  736. data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
  737. data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
  738. data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
  739. data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
  740. data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
  741. data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
  742. data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
  743. data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
  744. data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
  745. data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
  746. data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
  747. data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
  748. data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
  749. data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
  750. data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
  751. data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
  752. data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
  753. data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
  754. data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
  755. data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
  756. data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
  757. data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
  758. data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
  759. data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
  760. data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
  761. data/ext/v8/upstream/2.3.3/src/property.h +0 -315
  762. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
  763. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
  764. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
  765. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
  766. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
  767. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
  768. data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
  769. data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
  770. data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
  771. data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
  772. data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
  773. data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
  774. data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
  775. data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
  776. data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
  777. data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
  778. data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
  779. data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
  780. data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
  781. data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
  782. data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
  783. data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
  784. data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
  785. data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
  786. data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
  787. data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
  788. data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
  789. data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
  790. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
  791. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
  792. data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
  793. data/ext/v8/upstream/2.3.3/src/token.h +0 -270
  794. data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
  795. data/ext/v8/upstream/2.3.3/src/top.h +0 -463
  796. data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
  797. data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
  798. data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
  799. data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
  800. data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
  801. data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
  802. data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
  803. data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
  804. data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
  805. data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
  806. data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
  807. data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
  808. data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
  809. data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
  810. data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
  811. data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
  812. data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
  813. data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
  814. data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
  815. data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
  816. data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
  817. data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
  818. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
  819. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
  820. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
  821. data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
  822. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
  823. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
  824. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
  825. data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
  826. data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
  827. data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
  828. data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
  829. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
  830. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
  831. data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
  832. data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
  833. data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
  834. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
  835. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
  836. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
  837. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
  838. data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
  839. data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
  840. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
  841. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
  842. data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
  843. data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
  844. data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
  845. data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
  846. data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
  847. data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
  848. data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
  849. data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
  850. data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
  851. data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
  852. data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
  853. data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
  854. data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
  855. data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
  856. data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
  857. data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
  858. data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
  859. data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
  860. data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
  861. data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
  862. data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
  863. data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
  864. data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
  865. data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
  866. data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
  867. data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
  868. data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
  869. data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
  870. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
  871. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
  872. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
  873. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
  874. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
  875. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
  876. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
  877. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -0,0 +1,3822 @@
1
+ // Copyright 2011 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "arm/lithium-codegen-arm.h"
29
+ #include "arm/lithium-gap-resolver-arm.h"
30
+ #include "code-stubs.h"
31
+ #include "stub-cache.h"
32
+
33
+ namespace v8 {
34
+ namespace internal {
35
+
36
+
37
+ class SafepointGenerator : public PostCallGenerator {
38
+ public:
39
+ SafepointGenerator(LCodeGen* codegen,
40
+ LPointerMap* pointers,
41
+ int deoptimization_index)
42
+ : codegen_(codegen),
43
+ pointers_(pointers),
44
+ deoptimization_index_(deoptimization_index) { }
45
+ virtual ~SafepointGenerator() { }
46
+
47
+ virtual void Generate() {
48
+ codegen_->RecordSafepoint(pointers_, deoptimization_index_);
49
+ }
50
+
51
+ private:
52
+ LCodeGen* codegen_;
53
+ LPointerMap* pointers_;
54
+ int deoptimization_index_;
55
+ };
56
+
57
+
58
+ #define __ masm()->
59
+
60
+ bool LCodeGen::GenerateCode() {
61
+ HPhase phase("Code generation", chunk());
62
+ ASSERT(is_unused());
63
+ status_ = GENERATING;
64
+ CpuFeatures::Scope scope1(VFP3);
65
+ CpuFeatures::Scope scope2(ARMv7);
66
+ return GeneratePrologue() &&
67
+ GenerateBody() &&
68
+ GenerateDeferredCode() &&
69
+ GenerateSafepointTable();
70
+ }
71
+
72
+
73
+ void LCodeGen::FinishCode(Handle<Code> code) {
74
+ ASSERT(is_done());
75
+ code->set_stack_slots(StackSlotCount());
76
+ code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
77
+ PopulateDeoptimizationData(code);
78
+ }
79
+
80
+
81
+ void LCodeGen::Abort(const char* format, ...) {
82
+ if (FLAG_trace_bailout) {
83
+ SmartPointer<char> debug_name = graph()->debug_name()->ToCString();
84
+ PrintF("Aborting LCodeGen in @\"%s\": ", *debug_name);
85
+ va_list arguments;
86
+ va_start(arguments, format);
87
+ OS::VPrint(format, arguments);
88
+ va_end(arguments);
89
+ PrintF("\n");
90
+ }
91
+ status_ = ABORTED;
92
+ }
93
+
94
+
95
+ void LCodeGen::Comment(const char* format, ...) {
96
+ if (!FLAG_code_comments) return;
97
+ char buffer[4 * KB];
98
+ StringBuilder builder(buffer, ARRAY_SIZE(buffer));
99
+ va_list arguments;
100
+ va_start(arguments, format);
101
+ builder.AddFormattedList(format, arguments);
102
+ va_end(arguments);
103
+
104
+ // Copy the string before recording it in the assembler to avoid
105
+ // issues when the stack allocated buffer goes out of scope.
106
+ size_t length = builder.position();
107
+ Vector<char> copy = Vector<char>::New(length + 1);
108
+ memcpy(copy.start(), builder.Finalize(), copy.length());
109
+ masm()->RecordComment(copy.start());
110
+ }
111
+
112
+
113
+ bool LCodeGen::GeneratePrologue() {
114
+ ASSERT(is_generating());
115
+
116
+ #ifdef DEBUG
117
+ if (strlen(FLAG_stop_at) > 0 &&
118
+ info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
119
+ __ stop("stop_at");
120
+ }
121
+ #endif
122
+
123
+ // r1: Callee's JS function.
124
+ // cp: Callee's context.
125
+ // fp: Caller's frame pointer.
126
+ // lr: Caller's pc.
127
+
128
+ __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
129
+ __ add(fp, sp, Operand(2 * kPointerSize)); // Adjust FP to point to saved FP.
130
+
131
+ // Reserve space for the stack slots needed by the code.
132
+ int slots = StackSlotCount();
133
+ if (slots > 0) {
134
+ if (FLAG_debug_code) {
135
+ __ mov(r0, Operand(slots));
136
+ __ mov(r2, Operand(kSlotsZapValue));
137
+ Label loop;
138
+ __ bind(&loop);
139
+ __ push(r2);
140
+ __ sub(r0, r0, Operand(1), SetCC);
141
+ __ b(ne, &loop);
142
+ } else {
143
+ __ sub(sp, sp, Operand(slots * kPointerSize));
144
+ }
145
+ }
146
+
147
+ // Possibly allocate a local context.
148
+ int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
149
+ if (heap_slots > 0) {
150
+ Comment(";;; Allocate local context");
151
+ // Argument to NewContext is the function, which is in r1.
152
+ __ push(r1);
153
+ if (heap_slots <= FastNewContextStub::kMaximumSlots) {
154
+ FastNewContextStub stub(heap_slots);
155
+ __ CallStub(&stub);
156
+ } else {
157
+ __ CallRuntime(Runtime::kNewContext, 1);
158
+ }
159
+ RecordSafepoint(Safepoint::kNoDeoptimizationIndex);
160
+ // Context is returned in both r0 and cp. It replaces the context
161
+ // passed to us. It's saved in the stack and kept live in cp.
162
+ __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
163
+ // Copy any necessary parameters into the context.
164
+ int num_parameters = scope()->num_parameters();
165
+ for (int i = 0; i < num_parameters; i++) {
166
+ Slot* slot = scope()->parameter(i)->AsSlot();
167
+ if (slot != NULL && slot->type() == Slot::CONTEXT) {
168
+ int parameter_offset = StandardFrameConstants::kCallerSPOffset +
169
+ (num_parameters - 1 - i) * kPointerSize;
170
+ // Load parameter from stack.
171
+ __ ldr(r0, MemOperand(fp, parameter_offset));
172
+ // Store it in the context.
173
+ __ mov(r1, Operand(Context::SlotOffset(slot->index())));
174
+ __ str(r0, MemOperand(cp, r1));
175
+ // Update the write barrier. This clobbers all involved
176
+ // registers, so we have to use two more registers to avoid
177
+ // clobbering cp.
178
+ __ mov(r2, Operand(cp));
179
+ __ RecordWrite(r2, Operand(r1), r3, r0);
180
+ }
181
+ }
182
+ Comment(";;; End allocate local context");
183
+ }
184
+
185
+ // Trace the call.
186
+ if (FLAG_trace) {
187
+ __ CallRuntime(Runtime::kTraceEnter, 0);
188
+ }
189
+ return !is_aborted();
190
+ }
191
+
192
+
193
+ bool LCodeGen::GenerateBody() {
194
+ ASSERT(is_generating());
195
+ bool emit_instructions = true;
196
+ for (current_instruction_ = 0;
197
+ !is_aborted() && current_instruction_ < instructions_->length();
198
+ current_instruction_++) {
199
+ LInstruction* instr = instructions_->at(current_instruction_);
200
+ if (instr->IsLabel()) {
201
+ LLabel* label = LLabel::cast(instr);
202
+ emit_instructions = !label->HasReplacement();
203
+ }
204
+
205
+ if (emit_instructions) {
206
+ Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
207
+ instr->CompileToNative(this);
208
+ }
209
+ }
210
+ return !is_aborted();
211
+ }
212
+
213
+
214
+ LInstruction* LCodeGen::GetNextInstruction() {
215
+ if (current_instruction_ < instructions_->length() - 1) {
216
+ return instructions_->at(current_instruction_ + 1);
217
+ } else {
218
+ return NULL;
219
+ }
220
+ }
221
+
222
+
223
+ bool LCodeGen::GenerateDeferredCode() {
224
+ ASSERT(is_generating());
225
+ for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
226
+ LDeferredCode* code = deferred_[i];
227
+ __ bind(code->entry());
228
+ code->Generate();
229
+ __ jmp(code->exit());
230
+ }
231
+
232
+ // Force constant pool emission at the end of deferred code to make
233
+ // sure that no constant pools are emitted after the official end of
234
+ // the instruction sequence.
235
+ masm()->CheckConstPool(true, false);
236
+
237
+ // Deferred code is the last part of the instruction sequence. Mark
238
+ // the generated code as done unless we bailed out.
239
+ if (!is_aborted()) status_ = DONE;
240
+ return !is_aborted();
241
+ }
242
+
243
+
244
+ bool LCodeGen::GenerateSafepointTable() {
245
+ ASSERT(is_done());
246
+ safepoints_.Emit(masm(), StackSlotCount());
247
+ return !is_aborted();
248
+ }
249
+
250
+
251
+ Register LCodeGen::ToRegister(int index) const {
252
+ return Register::FromAllocationIndex(index);
253
+ }
254
+
255
+
256
+ DoubleRegister LCodeGen::ToDoubleRegister(int index) const {
257
+ return DoubleRegister::FromAllocationIndex(index);
258
+ }
259
+
260
+
261
+ Register LCodeGen::ToRegister(LOperand* op) const {
262
+ ASSERT(op->IsRegister());
263
+ return ToRegister(op->index());
264
+ }
265
+
266
+
267
+ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) {
268
+ if (op->IsRegister()) {
269
+ return ToRegister(op->index());
270
+ } else if (op->IsConstantOperand()) {
271
+ __ mov(scratch, ToOperand(op));
272
+ return scratch;
273
+ } else if (op->IsStackSlot() || op->IsArgument()) {
274
+ __ ldr(scratch, ToMemOperand(op));
275
+ return scratch;
276
+ }
277
+ UNREACHABLE();
278
+ return scratch;
279
+ }
280
+
281
+
282
+ DoubleRegister LCodeGen::ToDoubleRegister(LOperand* op) const {
283
+ ASSERT(op->IsDoubleRegister());
284
+ return ToDoubleRegister(op->index());
285
+ }
286
+
287
+
288
+ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op,
289
+ SwVfpRegister flt_scratch,
290
+ DoubleRegister dbl_scratch) {
291
+ if (op->IsDoubleRegister()) {
292
+ return ToDoubleRegister(op->index());
293
+ } else if (op->IsConstantOperand()) {
294
+ LConstantOperand* const_op = LConstantOperand::cast(op);
295
+ Handle<Object> literal = chunk_->LookupLiteral(const_op);
296
+ Representation r = chunk_->LookupLiteralRepresentation(const_op);
297
+ if (r.IsInteger32()) {
298
+ ASSERT(literal->IsNumber());
299
+ __ mov(ip, Operand(static_cast<int32_t>(literal->Number())));
300
+ __ vmov(flt_scratch, ip);
301
+ __ vcvt_f64_s32(dbl_scratch, flt_scratch);
302
+ return dbl_scratch;
303
+ } else if (r.IsDouble()) {
304
+ Abort("unsupported double immediate");
305
+ } else if (r.IsTagged()) {
306
+ Abort("unsupported tagged immediate");
307
+ }
308
+ } else if (op->IsStackSlot() || op->IsArgument()) {
309
+ // TODO(regis): Why is vldr not taking a MemOperand?
310
+ // __ vldr(dbl_scratch, ToMemOperand(op));
311
+ MemOperand mem_op = ToMemOperand(op);
312
+ __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset());
313
+ return dbl_scratch;
314
+ }
315
+ UNREACHABLE();
316
+ return dbl_scratch;
317
+ }
318
+
319
+
320
+ int LCodeGen::ToInteger32(LConstantOperand* op) const {
321
+ Handle<Object> value = chunk_->LookupLiteral(op);
322
+ ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32());
323
+ ASSERT(static_cast<double>(static_cast<int32_t>(value->Number())) ==
324
+ value->Number());
325
+ return static_cast<int32_t>(value->Number());
326
+ }
327
+
328
+
329
+ Operand LCodeGen::ToOperand(LOperand* op) {
330
+ if (op->IsConstantOperand()) {
331
+ LConstantOperand* const_op = LConstantOperand::cast(op);
332
+ Handle<Object> literal = chunk_->LookupLiteral(const_op);
333
+ Representation r = chunk_->LookupLiteralRepresentation(const_op);
334
+ if (r.IsInteger32()) {
335
+ ASSERT(literal->IsNumber());
336
+ return Operand(static_cast<int32_t>(literal->Number()));
337
+ } else if (r.IsDouble()) {
338
+ Abort("ToOperand Unsupported double immediate.");
339
+ }
340
+ ASSERT(r.IsTagged());
341
+ return Operand(literal);
342
+ } else if (op->IsRegister()) {
343
+ return Operand(ToRegister(op));
344
+ } else if (op->IsDoubleRegister()) {
345
+ Abort("ToOperand IsDoubleRegister unimplemented");
346
+ return Operand(0);
347
+ }
348
+ // Stack slots not implemented, use ToMemOperand instead.
349
+ UNREACHABLE();
350
+ return Operand(0);
351
+ }
352
+
353
+
354
+ MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
355
+ ASSERT(!op->IsRegister());
356
+ ASSERT(!op->IsDoubleRegister());
357
+ ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
358
+ int index = op->index();
359
+ if (index >= 0) {
360
+ // Local or spill slot. Skip the frame pointer, function, and
361
+ // context in the fixed part of the frame.
362
+ return MemOperand(fp, -(index + 3) * kPointerSize);
363
+ } else {
364
+ // Incoming parameter. Skip the return address.
365
+ return MemOperand(fp, -(index - 1) * kPointerSize);
366
+ }
367
+ }
368
+
369
+
370
+ MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
371
+ ASSERT(op->IsDoubleStackSlot());
372
+ int index = op->index();
373
+ if (index >= 0) {
374
+ // Local or spill slot. Skip the frame pointer, function, context,
375
+ // and the first word of the double in the fixed part of the frame.
376
+ return MemOperand(fp, -(index + 3) * kPointerSize + kPointerSize);
377
+ } else {
378
+ // Incoming parameter. Skip the return address and the first word of
379
+ // the double.
380
+ return MemOperand(fp, -(index - 1) * kPointerSize + kPointerSize);
381
+ }
382
+ }
383
+
384
+
385
+ void LCodeGen::WriteTranslation(LEnvironment* environment,
386
+ Translation* translation) {
387
+ if (environment == NULL) return;
388
+
389
+ // The translation includes one command per value in the environment.
390
+ int translation_size = environment->values()->length();
391
+ // The output frame height does not include the parameters.
392
+ int height = translation_size - environment->parameter_count();
393
+
394
+ WriteTranslation(environment->outer(), translation);
395
+ int closure_id = DefineDeoptimizationLiteral(environment->closure());
396
+ translation->BeginFrame(environment->ast_id(), closure_id, height);
397
+ for (int i = 0; i < translation_size; ++i) {
398
+ LOperand* value = environment->values()->at(i);
399
+ // spilled_registers_ and spilled_double_registers_ are either
400
+ // both NULL or both set.
401
+ if (environment->spilled_registers() != NULL && value != NULL) {
402
+ if (value->IsRegister() &&
403
+ environment->spilled_registers()[value->index()] != NULL) {
404
+ translation->MarkDuplicate();
405
+ AddToTranslation(translation,
406
+ environment->spilled_registers()[value->index()],
407
+ environment->HasTaggedValueAt(i));
408
+ } else if (
409
+ value->IsDoubleRegister() &&
410
+ environment->spilled_double_registers()[value->index()] != NULL) {
411
+ translation->MarkDuplicate();
412
+ AddToTranslation(
413
+ translation,
414
+ environment->spilled_double_registers()[value->index()],
415
+ false);
416
+ }
417
+ }
418
+
419
+ AddToTranslation(translation, value, environment->HasTaggedValueAt(i));
420
+ }
421
+ }
422
+
423
+
424
+ void LCodeGen::AddToTranslation(Translation* translation,
425
+ LOperand* op,
426
+ bool is_tagged) {
427
+ if (op == NULL) {
428
+ // TODO(twuerthinger): Introduce marker operands to indicate that this value
429
+ // is not present and must be reconstructed from the deoptimizer. Currently
430
+ // this is only used for the arguments object.
431
+ translation->StoreArgumentsObject();
432
+ } else if (op->IsStackSlot()) {
433
+ if (is_tagged) {
434
+ translation->StoreStackSlot(op->index());
435
+ } else {
436
+ translation->StoreInt32StackSlot(op->index());
437
+ }
438
+ } else if (op->IsDoubleStackSlot()) {
439
+ translation->StoreDoubleStackSlot(op->index());
440
+ } else if (op->IsArgument()) {
441
+ ASSERT(is_tagged);
442
+ int src_index = StackSlotCount() + op->index();
443
+ translation->StoreStackSlot(src_index);
444
+ } else if (op->IsRegister()) {
445
+ Register reg = ToRegister(op);
446
+ if (is_tagged) {
447
+ translation->StoreRegister(reg);
448
+ } else {
449
+ translation->StoreInt32Register(reg);
450
+ }
451
+ } else if (op->IsDoubleRegister()) {
452
+ DoubleRegister reg = ToDoubleRegister(op);
453
+ translation->StoreDoubleRegister(reg);
454
+ } else if (op->IsConstantOperand()) {
455
+ Handle<Object> literal = chunk()->LookupLiteral(LConstantOperand::cast(op));
456
+ int src_index = DefineDeoptimizationLiteral(literal);
457
+ translation->StoreLiteral(src_index);
458
+ } else {
459
+ UNREACHABLE();
460
+ }
461
+ }
462
+
463
+
464
+ void LCodeGen::CallCode(Handle<Code> code,
465
+ RelocInfo::Mode mode,
466
+ LInstruction* instr) {
467
+ ASSERT(instr != NULL);
468
+ LPointerMap* pointers = instr->pointer_map();
469
+ RecordPosition(pointers->position());
470
+ __ Call(code, mode);
471
+ RegisterLazyDeoptimization(instr);
472
+ }
473
+
474
+
475
+ void LCodeGen::CallRuntime(Runtime::Function* function,
476
+ int num_arguments,
477
+ LInstruction* instr) {
478
+ ASSERT(instr != NULL);
479
+ LPointerMap* pointers = instr->pointer_map();
480
+ ASSERT(pointers != NULL);
481
+ RecordPosition(pointers->position());
482
+
483
+ __ CallRuntime(function, num_arguments);
484
+ RegisterLazyDeoptimization(instr);
485
+ }
486
+
487
+
488
+ void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) {
489
+ // Create the environment to bailout to. If the call has side effects
490
+ // execution has to continue after the call otherwise execution can continue
491
+ // from a previous bailout point repeating the call.
492
+ LEnvironment* deoptimization_environment;
493
+ if (instr->HasDeoptimizationEnvironment()) {
494
+ deoptimization_environment = instr->deoptimization_environment();
495
+ } else {
496
+ deoptimization_environment = instr->environment();
497
+ }
498
+
499
+ RegisterEnvironmentForDeoptimization(deoptimization_environment);
500
+ RecordSafepoint(instr->pointer_map(),
501
+ deoptimization_environment->deoptimization_index());
502
+ }
503
+
504
+
505
+ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment) {
506
+ if (!environment->HasBeenRegistered()) {
507
+ // Physical stack frame layout:
508
+ // -x ............. -4 0 ..................................... y
509
+ // [incoming arguments] [spill slots] [pushed outgoing arguments]
510
+
511
+ // Layout of the environment:
512
+ // 0 ..................................................... size-1
513
+ // [parameters] [locals] [expression stack including arguments]
514
+
515
+ // Layout of the translation:
516
+ // 0 ........................................................ size - 1 + 4
517
+ // [expression stack including arguments] [locals] [4 words] [parameters]
518
+ // |>------------ translation_size ------------<|
519
+
520
+ int frame_count = 0;
521
+ for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
522
+ ++frame_count;
523
+ }
524
+ Translation translation(&translations_, frame_count);
525
+ WriteTranslation(environment, &translation);
526
+ int deoptimization_index = deoptimizations_.length();
527
+ environment->Register(deoptimization_index, translation.index());
528
+ deoptimizations_.Add(environment);
529
+ }
530
+ }
531
+
532
+
533
+ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
534
+ RegisterEnvironmentForDeoptimization(environment);
535
+ ASSERT(environment->HasBeenRegistered());
536
+ int id = environment->deoptimization_index();
537
+ Address entry = Deoptimizer::GetDeoptimizationEntry(id, Deoptimizer::EAGER);
538
+ ASSERT(entry != NULL);
539
+ if (entry == NULL) {
540
+ Abort("bailout was not prepared");
541
+ return;
542
+ }
543
+
544
+ ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM.
545
+
546
+ if (FLAG_deopt_every_n_times == 1 &&
547
+ info_->shared_info()->opt_count() == id) {
548
+ __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
549
+ return;
550
+ }
551
+
552
+ if (cc == al) {
553
+ if (FLAG_trap_on_deopt) __ stop("trap_on_deopt");
554
+ __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
555
+ } else {
556
+ if (FLAG_trap_on_deopt) {
557
+ Label done;
558
+ __ b(&done, NegateCondition(cc));
559
+ __ stop("trap_on_deopt");
560
+ __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
561
+ __ bind(&done);
562
+ } else {
563
+ __ Jump(entry, RelocInfo::RUNTIME_ENTRY, cc);
564
+ }
565
+ }
566
+ }
567
+
568
+
569
+ void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
570
+ int length = deoptimizations_.length();
571
+ if (length == 0) return;
572
+ ASSERT(FLAG_deopt);
573
+ Handle<DeoptimizationInputData> data =
574
+ Factory::NewDeoptimizationInputData(length, TENURED);
575
+
576
+ Handle<ByteArray> translations = translations_.CreateByteArray();
577
+ data->SetTranslationByteArray(*translations);
578
+ data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
579
+
580
+ Handle<FixedArray> literals =
581
+ Factory::NewFixedArray(deoptimization_literals_.length(), TENURED);
582
+ for (int i = 0; i < deoptimization_literals_.length(); i++) {
583
+ literals->set(i, *deoptimization_literals_[i]);
584
+ }
585
+ data->SetLiteralArray(*literals);
586
+
587
+ data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id()));
588
+ data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
589
+
590
+ // Populate the deoptimization entries.
591
+ for (int i = 0; i < length; i++) {
592
+ LEnvironment* env = deoptimizations_[i];
593
+ data->SetAstId(i, Smi::FromInt(env->ast_id()));
594
+ data->SetTranslationIndex(i, Smi::FromInt(env->translation_index()));
595
+ data->SetArgumentsStackHeight(i,
596
+ Smi::FromInt(env->arguments_stack_height()));
597
+ }
598
+ code->set_deoptimization_data(*data);
599
+ }
600
+
601
+
602
+ int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
603
+ int result = deoptimization_literals_.length();
604
+ for (int i = 0; i < deoptimization_literals_.length(); ++i) {
605
+ if (deoptimization_literals_[i].is_identical_to(literal)) return i;
606
+ }
607
+ deoptimization_literals_.Add(literal);
608
+ return result;
609
+ }
610
+
611
+
612
+ void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
613
+ ASSERT(deoptimization_literals_.length() == 0);
614
+
615
+ const ZoneList<Handle<JSFunction> >* inlined_closures =
616
+ chunk()->inlined_closures();
617
+
618
+ for (int i = 0, length = inlined_closures->length();
619
+ i < length;
620
+ i++) {
621
+ DefineDeoptimizationLiteral(inlined_closures->at(i));
622
+ }
623
+
624
+ inlined_function_count_ = deoptimization_literals_.length();
625
+ }
626
+
627
+
628
+ void LCodeGen::RecordSafepoint(
629
+ LPointerMap* pointers,
630
+ Safepoint::Kind kind,
631
+ int arguments,
632
+ int deoptimization_index) {
633
+ const ZoneList<LOperand*>* operands = pointers->operands();
634
+ Safepoint safepoint = safepoints_.DefineSafepoint(masm(),
635
+ kind, arguments, deoptimization_index);
636
+ for (int i = 0; i < operands->length(); i++) {
637
+ LOperand* pointer = operands->at(i);
638
+ if (pointer->IsStackSlot()) {
639
+ safepoint.DefinePointerSlot(pointer->index());
640
+ } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) {
641
+ safepoint.DefinePointerRegister(ToRegister(pointer));
642
+ }
643
+ }
644
+ if (kind & Safepoint::kWithRegisters) {
645
+ // Register cp always contains a pointer to the context.
646
+ safepoint.DefinePointerRegister(cp);
647
+ }
648
+ }
649
+
650
+
651
+ void LCodeGen::RecordSafepoint(LPointerMap* pointers,
652
+ int deoptimization_index) {
653
+ RecordSafepoint(pointers, Safepoint::kSimple, 0, deoptimization_index);
654
+ }
655
+
656
+
657
+ void LCodeGen::RecordSafepoint(int deoptimization_index) {
658
+ LPointerMap empty_pointers(RelocInfo::kNoPosition);
659
+ RecordSafepoint(&empty_pointers, deoptimization_index);
660
+ }
661
+
662
+
663
+ void LCodeGen::RecordSafepointWithRegisters(LPointerMap* pointers,
664
+ int arguments,
665
+ int deoptimization_index) {
666
+ RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments,
667
+ deoptimization_index);
668
+ }
669
+
670
+
671
+ void LCodeGen::RecordSafepointWithRegistersAndDoubles(
672
+ LPointerMap* pointers,
673
+ int arguments,
674
+ int deoptimization_index) {
675
+ RecordSafepoint(pointers, Safepoint::kWithRegistersAndDoubles, arguments,
676
+ deoptimization_index);
677
+ }
678
+
679
+
680
+ void LCodeGen::RecordPosition(int position) {
681
+ if (!FLAG_debug_info || position == RelocInfo::kNoPosition) return;
682
+ masm()->positions_recorder()->RecordPosition(position);
683
+ }
684
+
685
+
686
+ void LCodeGen::DoLabel(LLabel* label) {
687
+ if (label->is_loop_header()) {
688
+ Comment(";;; B%d - LOOP entry", label->block_id());
689
+ } else {
690
+ Comment(";;; B%d", label->block_id());
691
+ }
692
+ __ bind(label->label());
693
+ current_block_ = label->block_id();
694
+ LCodeGen::DoGap(label);
695
+ }
696
+
697
+
698
+ void LCodeGen::DoParallelMove(LParallelMove* move) {
699
+ resolver_.Resolve(move);
700
+ }
701
+
702
+
703
+ void LCodeGen::DoGap(LGap* gap) {
704
+ for (int i = LGap::FIRST_INNER_POSITION;
705
+ i <= LGap::LAST_INNER_POSITION;
706
+ i++) {
707
+ LGap::InnerPosition inner_pos = static_cast<LGap::InnerPosition>(i);
708
+ LParallelMove* move = gap->GetParallelMove(inner_pos);
709
+ if (move != NULL) DoParallelMove(move);
710
+ }
711
+
712
+ LInstruction* next = GetNextInstruction();
713
+ if (next != NULL && next->IsLazyBailout()) {
714
+ int pc = masm()->pc_offset();
715
+ safepoints_.SetPcAfterGap(pc);
716
+ }
717
+ }
718
+
719
+
720
+ void LCodeGen::DoParameter(LParameter* instr) {
721
+ // Nothing to do.
722
+ }
723
+
724
+
725
+ void LCodeGen::DoCallStub(LCallStub* instr) {
726
+ ASSERT(ToRegister(instr->result()).is(r0));
727
+ switch (instr->hydrogen()->major_key()) {
728
+ case CodeStub::RegExpConstructResult: {
729
+ RegExpConstructResultStub stub;
730
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
731
+ break;
732
+ }
733
+ case CodeStub::RegExpExec: {
734
+ RegExpExecStub stub;
735
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
736
+ break;
737
+ }
738
+ case CodeStub::SubString: {
739
+ SubStringStub stub;
740
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
741
+ break;
742
+ }
743
+ case CodeStub::StringCharAt: {
744
+ StringCharAtStub stub;
745
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
746
+ break;
747
+ }
748
+ case CodeStub::MathPow: {
749
+ Abort("MathPowStub unimplemented.");
750
+ break;
751
+ }
752
+ case CodeStub::NumberToString: {
753
+ NumberToStringStub stub;
754
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
755
+ break;
756
+ }
757
+ case CodeStub::StringAdd: {
758
+ StringAddStub stub(NO_STRING_ADD_FLAGS);
759
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
760
+ break;
761
+ }
762
+ case CodeStub::StringCompare: {
763
+ StringCompareStub stub;
764
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
765
+ break;
766
+ }
767
+ case CodeStub::TranscendentalCache: {
768
+ __ ldr(r0, MemOperand(sp, 0));
769
+ TranscendentalCacheStub stub(instr->transcendental_type());
770
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
771
+ break;
772
+ }
773
+ default:
774
+ UNREACHABLE();
775
+ }
776
+ }
777
+
778
+
779
+ void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
780
+ // Nothing to do.
781
+ }
782
+
783
+
784
+ void LCodeGen::DoModI(LModI* instr) {
785
+ class DeferredModI: public LDeferredCode {
786
+ public:
787
+ DeferredModI(LCodeGen* codegen, LModI* instr)
788
+ : LDeferredCode(codegen), instr_(instr) { }
789
+ virtual void Generate() {
790
+ codegen()->DoDeferredBinaryOpStub(instr_, Token::MOD);
791
+ }
792
+ private:
793
+ LModI* instr_;
794
+ };
795
+ // These registers hold untagged 32 bit values.
796
+ Register left = ToRegister(instr->InputAt(0));
797
+ Register right = ToRegister(instr->InputAt(1));
798
+ Register result = ToRegister(instr->result());
799
+ Register scratch = scratch0();
800
+
801
+ Label deoptimize, done;
802
+ // Check for x % 0.
803
+ if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
804
+ __ tst(right, Operand(right));
805
+ __ b(eq, &deoptimize);
806
+ }
807
+
808
+ // Check for (0 % -x) that will produce negative zero.
809
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
810
+ Label ok;
811
+ __ tst(left, Operand(left));
812
+ __ b(ne, &ok);
813
+ __ tst(right, Operand(right));
814
+ __ b(pl, &ok);
815
+ __ b(al, &deoptimize);
816
+ __ bind(&ok);
817
+ }
818
+
819
+ // Try a few common cases before using the stub.
820
+ Label call_stub;
821
+ const int kUnfolds = 3;
822
+ // Skip if either side is negative.
823
+ __ cmp(left, Operand(0));
824
+ __ cmp(right, Operand(0), NegateCondition(mi));
825
+ __ b(mi, &call_stub);
826
+ // If the right hand side is smaller than the (nonnegative)
827
+ // left hand side, it is the result. Else try a few subtractions
828
+ // of the left hand side.
829
+ __ mov(scratch, left);
830
+ for (int i = 0; i < kUnfolds; i++) {
831
+ // Check if the left hand side is less or equal than the
832
+ // the right hand side.
833
+ __ cmp(scratch, right);
834
+ __ mov(result, scratch, LeaveCC, lt);
835
+ __ b(lt, &done);
836
+ // If not, reduce the left hand side by the right hand
837
+ // side and check again.
838
+ if (i < kUnfolds - 1) __ sub(scratch, scratch, right);
839
+ }
840
+
841
+ // Check for power of two on the right hand side.
842
+ __ JumpIfNotPowerOfTwoOrZero(right, scratch, &call_stub);
843
+ // Perform modulo operation (scratch contains right - 1).
844
+ __ and_(result, scratch, Operand(left));
845
+
846
+ __ bind(&call_stub);
847
+ // Call the stub. The numbers in r0 and r1 have
848
+ // to be tagged to Smis. If that is not possible, deoptimize.
849
+ DeferredModI* deferred = new DeferredModI(this, instr);
850
+ __ TrySmiTag(left, &deoptimize, scratch);
851
+ __ TrySmiTag(right, &deoptimize, scratch);
852
+
853
+ __ b(al, deferred->entry());
854
+ __ bind(deferred->exit());
855
+
856
+ // If the result in r0 is a Smi, untag it, else deoptimize.
857
+ __ JumpIfNotSmi(result, &deoptimize);
858
+ __ SmiUntag(result);
859
+
860
+ __ b(al, &done);
861
+ __ bind(&deoptimize);
862
+ DeoptimizeIf(al, instr->environment());
863
+ __ bind(&done);
864
+ }
865
+
866
+
867
+ void LCodeGen::DoDivI(LDivI* instr) {
868
+ class DeferredDivI: public LDeferredCode {
869
+ public:
870
+ DeferredDivI(LCodeGen* codegen, LDivI* instr)
871
+ : LDeferredCode(codegen), instr_(instr) { }
872
+ virtual void Generate() {
873
+ codegen()->DoDeferredBinaryOpStub(instr_, Token::DIV);
874
+ }
875
+ private:
876
+ LDivI* instr_;
877
+ };
878
+
879
+ const Register left = ToRegister(instr->InputAt(0));
880
+ const Register right = ToRegister(instr->InputAt(1));
881
+ const Register scratch = scratch0();
882
+ const Register result = ToRegister(instr->result());
883
+
884
+ // Check for x / 0.
885
+ if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
886
+ __ tst(right, right);
887
+ DeoptimizeIf(eq, instr->environment());
888
+ }
889
+
890
+ // Check for (0 / -x) that will produce negative zero.
891
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
892
+ Label left_not_zero;
893
+ __ tst(left, Operand(left));
894
+ __ b(ne, &left_not_zero);
895
+ __ tst(right, Operand(right));
896
+ DeoptimizeIf(mi, instr->environment());
897
+ __ bind(&left_not_zero);
898
+ }
899
+
900
+ // Check for (-kMinInt / -1).
901
+ if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
902
+ Label left_not_min_int;
903
+ __ cmp(left, Operand(kMinInt));
904
+ __ b(ne, &left_not_min_int);
905
+ __ cmp(right, Operand(-1));
906
+ DeoptimizeIf(eq, instr->environment());
907
+ __ bind(&left_not_min_int);
908
+ }
909
+
910
+ Label done, deoptimize;
911
+ // Test for a few common cases first.
912
+ __ cmp(right, Operand(1));
913
+ __ mov(result, left, LeaveCC, eq);
914
+ __ b(eq, &done);
915
+
916
+ __ cmp(right, Operand(2));
917
+ __ tst(left, Operand(1), eq);
918
+ __ mov(result, Operand(left, ASR, 1), LeaveCC, eq);
919
+ __ b(eq, &done);
920
+
921
+ __ cmp(right, Operand(4));
922
+ __ tst(left, Operand(3), eq);
923
+ __ mov(result, Operand(left, ASR, 2), LeaveCC, eq);
924
+ __ b(eq, &done);
925
+
926
+ // Call the stub. The numbers in r0 and r1 have
927
+ // to be tagged to Smis. If that is not possible, deoptimize.
928
+ DeferredDivI* deferred = new DeferredDivI(this, instr);
929
+
930
+ __ TrySmiTag(left, &deoptimize, scratch);
931
+ __ TrySmiTag(right, &deoptimize, scratch);
932
+
933
+ __ b(al, deferred->entry());
934
+ __ bind(deferred->exit());
935
+
936
+ // If the result in r0 is a Smi, untag it, else deoptimize.
937
+ __ JumpIfNotSmi(result, &deoptimize);
938
+ __ SmiUntag(result);
939
+ __ b(&done);
940
+
941
+ __ bind(&deoptimize);
942
+ DeoptimizeIf(al, instr->environment());
943
+ __ bind(&done);
944
+ }
945
+
946
+
947
+ template<int T>
948
+ void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
949
+ Token::Value op) {
950
+ Register left = ToRegister(instr->InputAt(0));
951
+ Register right = ToRegister(instr->InputAt(1));
952
+
953
+ __ PushSafepointRegistersAndDoubles();
954
+ // Move left to r1 and right to r0 for the stub call.
955
+ if (left.is(r1)) {
956
+ __ Move(r0, right);
957
+ } else if (left.is(r0) && right.is(r1)) {
958
+ __ Swap(r0, r1, r2);
959
+ } else if (left.is(r0)) {
960
+ ASSERT(!right.is(r1));
961
+ __ mov(r1, r0);
962
+ __ mov(r0, right);
963
+ } else {
964
+ ASSERT(!left.is(r0) && !right.is(r0));
965
+ __ mov(r0, right);
966
+ __ mov(r1, left);
967
+ }
968
+ TypeRecordingBinaryOpStub stub(op, OVERWRITE_LEFT);
969
+ __ CallStub(&stub);
970
+ RecordSafepointWithRegistersAndDoubles(instr->pointer_map(),
971
+ 0,
972
+ Safepoint::kNoDeoptimizationIndex);
973
+ // Overwrite the stored value of r0 with the result of the stub.
974
+ __ StoreToSafepointRegistersAndDoublesSlot(r0, r0);
975
+ __ PopSafepointRegistersAndDoubles();
976
+ }
977
+
978
+
979
+ void LCodeGen::DoMulI(LMulI* instr) {
980
+ Register scratch = scratch0();
981
+ Register left = ToRegister(instr->InputAt(0));
982
+ Register right = EmitLoadRegister(instr->InputAt(1), scratch);
983
+
984
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero) &&
985
+ !instr->InputAt(1)->IsConstantOperand()) {
986
+ __ orr(ToRegister(instr->TempAt(0)), left, right);
987
+ }
988
+
989
+ if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
990
+ // scratch:left = left * right.
991
+ __ smull(left, scratch, left, right);
992
+ __ mov(ip, Operand(left, ASR, 31));
993
+ __ cmp(ip, Operand(scratch));
994
+ DeoptimizeIf(ne, instr->environment());
995
+ } else {
996
+ __ mul(left, left, right);
997
+ }
998
+
999
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1000
+ // Bail out if the result is supposed to be negative zero.
1001
+ Label done;
1002
+ __ tst(left, Operand(left));
1003
+ __ b(ne, &done);
1004
+ if (instr->InputAt(1)->IsConstantOperand()) {
1005
+ if (ToInteger32(LConstantOperand::cast(instr->InputAt(1))) <= 0) {
1006
+ DeoptimizeIf(al, instr->environment());
1007
+ }
1008
+ } else {
1009
+ // Test the non-zero operand for negative sign.
1010
+ __ cmp(ToRegister(instr->TempAt(0)), Operand(0));
1011
+ DeoptimizeIf(mi, instr->environment());
1012
+ }
1013
+ __ bind(&done);
1014
+ }
1015
+ }
1016
+
1017
+
1018
+ void LCodeGen::DoBitI(LBitI* instr) {
1019
+ LOperand* left = instr->InputAt(0);
1020
+ LOperand* right = instr->InputAt(1);
1021
+ ASSERT(left->Equals(instr->result()));
1022
+ ASSERT(left->IsRegister());
1023
+ Register result = ToRegister(left);
1024
+ Register right_reg = EmitLoadRegister(right, ip);
1025
+ switch (instr->op()) {
1026
+ case Token::BIT_AND:
1027
+ __ and_(result, ToRegister(left), Operand(right_reg));
1028
+ break;
1029
+ case Token::BIT_OR:
1030
+ __ orr(result, ToRegister(left), Operand(right_reg));
1031
+ break;
1032
+ case Token::BIT_XOR:
1033
+ __ eor(result, ToRegister(left), Operand(right_reg));
1034
+ break;
1035
+ default:
1036
+ UNREACHABLE();
1037
+ break;
1038
+ }
1039
+ }
1040
+
1041
+
1042
+ void LCodeGen::DoShiftI(LShiftI* instr) {
1043
+ Register scratch = scratch0();
1044
+ LOperand* left = instr->InputAt(0);
1045
+ LOperand* right = instr->InputAt(1);
1046
+ ASSERT(left->Equals(instr->result()));
1047
+ ASSERT(left->IsRegister());
1048
+ Register result = ToRegister(left);
1049
+ if (right->IsRegister()) {
1050
+ // Mask the right operand.
1051
+ __ and_(scratch, ToRegister(right), Operand(0x1F));
1052
+ switch (instr->op()) {
1053
+ case Token::SAR:
1054
+ __ mov(result, Operand(result, ASR, scratch));
1055
+ break;
1056
+ case Token::SHR:
1057
+ if (instr->can_deopt()) {
1058
+ __ mov(result, Operand(result, LSR, scratch), SetCC);
1059
+ DeoptimizeIf(mi, instr->environment());
1060
+ } else {
1061
+ __ mov(result, Operand(result, LSR, scratch));
1062
+ }
1063
+ break;
1064
+ case Token::SHL:
1065
+ __ mov(result, Operand(result, LSL, scratch));
1066
+ break;
1067
+ default:
1068
+ UNREACHABLE();
1069
+ break;
1070
+ }
1071
+ } else {
1072
+ int value = ToInteger32(LConstantOperand::cast(right));
1073
+ uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1074
+ switch (instr->op()) {
1075
+ case Token::SAR:
1076
+ if (shift_count != 0) {
1077
+ __ mov(result, Operand(result, ASR, shift_count));
1078
+ }
1079
+ break;
1080
+ case Token::SHR:
1081
+ if (shift_count == 0 && instr->can_deopt()) {
1082
+ __ tst(result, Operand(0x80000000));
1083
+ DeoptimizeIf(ne, instr->environment());
1084
+ } else {
1085
+ __ mov(result, Operand(result, LSR, shift_count));
1086
+ }
1087
+ break;
1088
+ case Token::SHL:
1089
+ if (shift_count != 0) {
1090
+ __ mov(result, Operand(result, LSL, shift_count));
1091
+ }
1092
+ break;
1093
+ default:
1094
+ UNREACHABLE();
1095
+ break;
1096
+ }
1097
+ }
1098
+ }
1099
+
1100
+
1101
+ void LCodeGen::DoSubI(LSubI* instr) {
1102
+ Register left = ToRegister(instr->InputAt(0));
1103
+ Register right = EmitLoadRegister(instr->InputAt(1), ip);
1104
+ ASSERT(instr->InputAt(0)->Equals(instr->result()));
1105
+ __ sub(left, left, right, SetCC);
1106
+ if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1107
+ DeoptimizeIf(vs, instr->environment());
1108
+ }
1109
+ }
1110
+
1111
+
1112
+ void LCodeGen::DoConstantI(LConstantI* instr) {
1113
+ ASSERT(instr->result()->IsRegister());
1114
+ __ mov(ToRegister(instr->result()), Operand(instr->value()));
1115
+ }
1116
+
1117
+
1118
+ void LCodeGen::DoConstantD(LConstantD* instr) {
1119
+ ASSERT(instr->result()->IsDoubleRegister());
1120
+ DwVfpRegister result = ToDoubleRegister(instr->result());
1121
+ double v = instr->value();
1122
+ __ vmov(result, v);
1123
+ }
1124
+
1125
+
1126
+ void LCodeGen::DoConstantT(LConstantT* instr) {
1127
+ ASSERT(instr->result()->IsRegister());
1128
+ __ mov(ToRegister(instr->result()), Operand(instr->value()));
1129
+ }
1130
+
1131
+
1132
+ void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1133
+ Register result = ToRegister(instr->result());
1134
+ Register array = ToRegister(instr->InputAt(0));
1135
+ __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset));
1136
+ }
1137
+
1138
+
1139
+ void LCodeGen::DoPixelArrayLength(LPixelArrayLength* instr) {
1140
+ Register result = ToRegister(instr->result());
1141
+ Register array = ToRegister(instr->InputAt(0));
1142
+ __ ldr(result, FieldMemOperand(array, PixelArray::kLengthOffset));
1143
+ }
1144
+
1145
+
1146
+ void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1147
+ Register result = ToRegister(instr->result());
1148
+ Register array = ToRegister(instr->InputAt(0));
1149
+ __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset));
1150
+ }
1151
+
1152
+
1153
+ void LCodeGen::DoValueOf(LValueOf* instr) {
1154
+ Register input = ToRegister(instr->InputAt(0));
1155
+ Register result = ToRegister(instr->result());
1156
+ Register map = ToRegister(instr->TempAt(0));
1157
+ ASSERT(input.is(result));
1158
+ Label done;
1159
+
1160
+ // If the object is a smi return the object.
1161
+ __ tst(input, Operand(kSmiTagMask));
1162
+ __ b(eq, &done);
1163
+
1164
+ // If the object is not a value type, return the object.
1165
+ __ CompareObjectType(input, map, map, JS_VALUE_TYPE);
1166
+ __ b(ne, &done);
1167
+ __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset));
1168
+
1169
+ __ bind(&done);
1170
+ }
1171
+
1172
+
1173
+ void LCodeGen::DoBitNotI(LBitNotI* instr) {
1174
+ LOperand* input = instr->InputAt(0);
1175
+ ASSERT(input->Equals(instr->result()));
1176
+ __ mvn(ToRegister(input), Operand(ToRegister(input)));
1177
+ }
1178
+
1179
+
1180
+ void LCodeGen::DoThrow(LThrow* instr) {
1181
+ Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1182
+ __ push(input_reg);
1183
+ CallRuntime(Runtime::kThrow, 1, instr);
1184
+
1185
+ if (FLAG_debug_code) {
1186
+ __ stop("Unreachable code.");
1187
+ }
1188
+ }
1189
+
1190
+
1191
+ void LCodeGen::DoAddI(LAddI* instr) {
1192
+ LOperand* left = instr->InputAt(0);
1193
+ LOperand* right = instr->InputAt(1);
1194
+ ASSERT(left->Equals(instr->result()));
1195
+
1196
+ Register right_reg = EmitLoadRegister(right, ip);
1197
+ __ add(ToRegister(left), ToRegister(left), Operand(right_reg), SetCC);
1198
+
1199
+ if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1200
+ DeoptimizeIf(vs, instr->environment());
1201
+ }
1202
+ }
1203
+
1204
+
1205
+ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1206
+ DoubleRegister left = ToDoubleRegister(instr->InputAt(0));
1207
+ DoubleRegister right = ToDoubleRegister(instr->InputAt(1));
1208
+ switch (instr->op()) {
1209
+ case Token::ADD:
1210
+ __ vadd(left, left, right);
1211
+ break;
1212
+ case Token::SUB:
1213
+ __ vsub(left, left, right);
1214
+ break;
1215
+ case Token::MUL:
1216
+ __ vmul(left, left, right);
1217
+ break;
1218
+ case Token::DIV:
1219
+ __ vdiv(left, left, right);
1220
+ break;
1221
+ case Token::MOD: {
1222
+ // Save r0-r3 on the stack.
1223
+ __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1224
+
1225
+ __ PrepareCallCFunction(4, scratch0());
1226
+ __ vmov(r0, r1, left);
1227
+ __ vmov(r2, r3, right);
1228
+ __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 4);
1229
+ // Move the result in the double result register.
1230
+ __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result()));
1231
+
1232
+ // Restore r0-r3.
1233
+ __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1234
+ break;
1235
+ }
1236
+ default:
1237
+ UNREACHABLE();
1238
+ break;
1239
+ }
1240
+ }
1241
+
1242
+
1243
+ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1244
+ ASSERT(ToRegister(instr->InputAt(0)).is(r1));
1245
+ ASSERT(ToRegister(instr->InputAt(1)).is(r0));
1246
+ ASSERT(ToRegister(instr->result()).is(r0));
1247
+
1248
+ TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
1249
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1250
+ }
1251
+
1252
+
1253
+ int LCodeGen::GetNextEmittedBlock(int block) {
1254
+ for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
1255
+ LLabel* label = chunk_->GetLabel(i);
1256
+ if (!label->HasReplacement()) return i;
1257
+ }
1258
+ return -1;
1259
+ }
1260
+
1261
+
1262
+ void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
1263
+ int next_block = GetNextEmittedBlock(current_block_);
1264
+ right_block = chunk_->LookupDestination(right_block);
1265
+ left_block = chunk_->LookupDestination(left_block);
1266
+
1267
+ if (right_block == left_block) {
1268
+ EmitGoto(left_block);
1269
+ } else if (left_block == next_block) {
1270
+ __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
1271
+ } else if (right_block == next_block) {
1272
+ __ b(cc, chunk_->GetAssemblyLabel(left_block));
1273
+ } else {
1274
+ __ b(cc, chunk_->GetAssemblyLabel(left_block));
1275
+ __ b(chunk_->GetAssemblyLabel(right_block));
1276
+ }
1277
+ }
1278
+
1279
+
1280
+ void LCodeGen::DoBranch(LBranch* instr) {
1281
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1282
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1283
+
1284
+ Representation r = instr->hydrogen()->representation();
1285
+ if (r.IsInteger32()) {
1286
+ Register reg = ToRegister(instr->InputAt(0));
1287
+ __ cmp(reg, Operand(0));
1288
+ EmitBranch(true_block, false_block, ne);
1289
+ } else if (r.IsDouble()) {
1290
+ DoubleRegister reg = ToDoubleRegister(instr->InputAt(0));
1291
+ Register scratch = scratch0();
1292
+
1293
+ // Test the double value. Zero and NaN are false.
1294
+ __ VFPCompareAndLoadFlags(reg, 0.0, scratch);
1295
+ __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit));
1296
+ EmitBranch(true_block, false_block, ne);
1297
+ } else {
1298
+ ASSERT(r.IsTagged());
1299
+ Register reg = ToRegister(instr->InputAt(0));
1300
+ if (instr->hydrogen()->type().IsBoolean()) {
1301
+ __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1302
+ __ cmp(reg, ip);
1303
+ EmitBranch(true_block, false_block, eq);
1304
+ } else {
1305
+ Label* true_label = chunk_->GetAssemblyLabel(true_block);
1306
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
1307
+
1308
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1309
+ __ cmp(reg, ip);
1310
+ __ b(eq, false_label);
1311
+ __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1312
+ __ cmp(reg, ip);
1313
+ __ b(eq, true_label);
1314
+ __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1315
+ __ cmp(reg, ip);
1316
+ __ b(eq, false_label);
1317
+ __ cmp(reg, Operand(0));
1318
+ __ b(eq, false_label);
1319
+ __ tst(reg, Operand(kSmiTagMask));
1320
+ __ b(eq, true_label);
1321
+
1322
+ // Test double values. Zero and NaN are false.
1323
+ Label call_stub;
1324
+ DoubleRegister dbl_scratch = d0;
1325
+ Register scratch = scratch0();
1326
+ __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1327
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
1328
+ __ cmp(scratch, Operand(ip));
1329
+ __ b(ne, &call_stub);
1330
+ __ sub(ip, reg, Operand(kHeapObjectTag));
1331
+ __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset);
1332
+ __ VFPCompareAndLoadFlags(dbl_scratch, 0.0, scratch);
1333
+ __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit));
1334
+ __ b(ne, false_label);
1335
+ __ b(true_label);
1336
+
1337
+ // The conversion stub doesn't cause garbage collections so it's
1338
+ // safe to not record a safepoint after the call.
1339
+ __ bind(&call_stub);
1340
+ ToBooleanStub stub(reg);
1341
+ RegList saved_regs = kJSCallerSaved | kCalleeSaved;
1342
+ __ stm(db_w, sp, saved_regs);
1343
+ __ CallStub(&stub);
1344
+ __ cmp(reg, Operand(0));
1345
+ __ ldm(ia_w, sp, saved_regs);
1346
+ EmitBranch(true_block, false_block, ne);
1347
+ }
1348
+ }
1349
+ }
1350
+
1351
+
1352
+ void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) {
1353
+ block = chunk_->LookupDestination(block);
1354
+ int next_block = GetNextEmittedBlock(current_block_);
1355
+ if (block != next_block) {
1356
+ // Perform stack overflow check if this goto needs it before jumping.
1357
+ if (deferred_stack_check != NULL) {
1358
+ __ LoadRoot(ip, Heap::kStackLimitRootIndex);
1359
+ __ cmp(sp, Operand(ip));
1360
+ __ b(hs, chunk_->GetAssemblyLabel(block));
1361
+ __ jmp(deferred_stack_check->entry());
1362
+ deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block));
1363
+ } else {
1364
+ __ jmp(chunk_->GetAssemblyLabel(block));
1365
+ }
1366
+ }
1367
+ }
1368
+
1369
+
1370
+ void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
1371
+ __ PushSafepointRegisters();
1372
+ __ CallRuntimeSaveDoubles(Runtime::kStackGuard);
1373
+ RecordSafepointWithRegisters(
1374
+ instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
1375
+ __ PopSafepointRegisters();
1376
+ }
1377
+
1378
+
1379
+ void LCodeGen::DoGoto(LGoto* instr) {
1380
+ class DeferredStackCheck: public LDeferredCode {
1381
+ public:
1382
+ DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
1383
+ : LDeferredCode(codegen), instr_(instr) { }
1384
+ virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
1385
+ private:
1386
+ LGoto* instr_;
1387
+ };
1388
+
1389
+ DeferredStackCheck* deferred = NULL;
1390
+ if (instr->include_stack_check()) {
1391
+ deferred = new DeferredStackCheck(this, instr);
1392
+ }
1393
+ EmitGoto(instr->block_id(), deferred);
1394
+ }
1395
+
1396
+
1397
+ Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
1398
+ Condition cond = kNoCondition;
1399
+ switch (op) {
1400
+ case Token::EQ:
1401
+ case Token::EQ_STRICT:
1402
+ cond = eq;
1403
+ break;
1404
+ case Token::LT:
1405
+ cond = is_unsigned ? lo : lt;
1406
+ break;
1407
+ case Token::GT:
1408
+ cond = is_unsigned ? hi : gt;
1409
+ break;
1410
+ case Token::LTE:
1411
+ cond = is_unsigned ? ls : le;
1412
+ break;
1413
+ case Token::GTE:
1414
+ cond = is_unsigned ? hs : ge;
1415
+ break;
1416
+ case Token::IN:
1417
+ case Token::INSTANCEOF:
1418
+ default:
1419
+ UNREACHABLE();
1420
+ }
1421
+ return cond;
1422
+ }
1423
+
1424
+
1425
+ void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) {
1426
+ __ cmp(ToRegister(left), ToRegister(right));
1427
+ }
1428
+
1429
+
1430
+ void LCodeGen::DoCmpID(LCmpID* instr) {
1431
+ LOperand* left = instr->InputAt(0);
1432
+ LOperand* right = instr->InputAt(1);
1433
+ LOperand* result = instr->result();
1434
+ Register scratch = scratch0();
1435
+
1436
+ Label unordered, done;
1437
+ if (instr->is_double()) {
1438
+ // Compare left and right as doubles and load the
1439
+ // resulting flags into the normal status register.
1440
+ __ VFPCompareAndSetFlags(ToDoubleRegister(left), ToDoubleRegister(right));
1441
+ // If a NaN is involved, i.e. the result is unordered (V set),
1442
+ // jump to unordered to return false.
1443
+ __ b(vs, &unordered);
1444
+ } else {
1445
+ EmitCmpI(left, right);
1446
+ }
1447
+
1448
+ Condition cc = TokenToCondition(instr->op(), instr->is_double());
1449
+ __ LoadRoot(ToRegister(result), Heap::kTrueValueRootIndex);
1450
+ __ b(cc, &done);
1451
+
1452
+ __ bind(&unordered);
1453
+ __ LoadRoot(ToRegister(result), Heap::kFalseValueRootIndex);
1454
+ __ bind(&done);
1455
+ }
1456
+
1457
+
1458
+ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1459
+ LOperand* left = instr->InputAt(0);
1460
+ LOperand* right = instr->InputAt(1);
1461
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1462
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1463
+
1464
+ if (instr->is_double()) {
1465
+ // Compare left and right as doubles and load the
1466
+ // resulting flags into the normal status register.
1467
+ __ VFPCompareAndSetFlags(ToDoubleRegister(left), ToDoubleRegister(right));
1468
+ // If a NaN is involved, i.e. the result is unordered (V set),
1469
+ // jump to false block label.
1470
+ __ b(vs, chunk_->GetAssemblyLabel(false_block));
1471
+ } else {
1472
+ EmitCmpI(left, right);
1473
+ }
1474
+
1475
+ Condition cc = TokenToCondition(instr->op(), instr->is_double());
1476
+ EmitBranch(true_block, false_block, cc);
1477
+ }
1478
+
1479
+
1480
+ void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
1481
+ Register left = ToRegister(instr->InputAt(0));
1482
+ Register right = ToRegister(instr->InputAt(1));
1483
+ Register result = ToRegister(instr->result());
1484
+
1485
+ __ cmp(left, Operand(right));
1486
+ __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1487
+ __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1488
+ }
1489
+
1490
+
1491
+ void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
1492
+ Register left = ToRegister(instr->InputAt(0));
1493
+ Register right = ToRegister(instr->InputAt(1));
1494
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1495
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1496
+
1497
+ __ cmp(left, Operand(right));
1498
+ EmitBranch(true_block, false_block, eq);
1499
+ }
1500
+
1501
+
1502
+ void LCodeGen::DoIsNull(LIsNull* instr) {
1503
+ Register reg = ToRegister(instr->InputAt(0));
1504
+ Register result = ToRegister(instr->result());
1505
+
1506
+ __ LoadRoot(ip, Heap::kNullValueRootIndex);
1507
+ __ cmp(reg, ip);
1508
+ if (instr->is_strict()) {
1509
+ __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1510
+ __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1511
+ } else {
1512
+ Label true_value, false_value, done;
1513
+ __ b(eq, &true_value);
1514
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1515
+ __ cmp(ip, reg);
1516
+ __ b(eq, &true_value);
1517
+ __ tst(reg, Operand(kSmiTagMask));
1518
+ __ b(eq, &false_value);
1519
+ // Check for undetectable objects by looking in the bit field in
1520
+ // the map. The object has already been smi checked.
1521
+ Register scratch = result;
1522
+ __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1523
+ __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
1524
+ __ tst(scratch, Operand(1 << Map::kIsUndetectable));
1525
+ __ b(ne, &true_value);
1526
+ __ bind(&false_value);
1527
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
1528
+ __ jmp(&done);
1529
+ __ bind(&true_value);
1530
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
1531
+ __ bind(&done);
1532
+ }
1533
+ }
1534
+
1535
+
1536
+ void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) {
1537
+ Register scratch = scratch0();
1538
+ Register reg = ToRegister(instr->InputAt(0));
1539
+
1540
+ // TODO(fsc): If the expression is known to be a smi, then it's
1541
+ // definitely not null. Jump to the false block.
1542
+
1543
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1544
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1545
+
1546
+ __ LoadRoot(ip, Heap::kNullValueRootIndex);
1547
+ __ cmp(reg, ip);
1548
+ if (instr->is_strict()) {
1549
+ EmitBranch(true_block, false_block, eq);
1550
+ } else {
1551
+ Label* true_label = chunk_->GetAssemblyLabel(true_block);
1552
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
1553
+ __ b(eq, true_label);
1554
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1555
+ __ cmp(reg, ip);
1556
+ __ b(eq, true_label);
1557
+ __ tst(reg, Operand(kSmiTagMask));
1558
+ __ b(eq, false_label);
1559
+ // Check for undetectable objects by looking in the bit field in
1560
+ // the map. The object has already been smi checked.
1561
+ __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1562
+ __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
1563
+ __ tst(scratch, Operand(1 << Map::kIsUndetectable));
1564
+ EmitBranch(true_block, false_block, ne);
1565
+ }
1566
+ }
1567
+
1568
+
1569
+ Condition LCodeGen::EmitIsObject(Register input,
1570
+ Register temp1,
1571
+ Register temp2,
1572
+ Label* is_not_object,
1573
+ Label* is_object) {
1574
+ __ JumpIfSmi(input, is_not_object);
1575
+
1576
+ __ LoadRoot(temp1, Heap::kNullValueRootIndex);
1577
+ __ cmp(input, temp1);
1578
+ __ b(eq, is_object);
1579
+
1580
+ // Load map.
1581
+ __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
1582
+ // Undetectable objects behave like undefined.
1583
+ __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset));
1584
+ __ tst(temp2, Operand(1 << Map::kIsUndetectable));
1585
+ __ b(ne, is_not_object);
1586
+
1587
+ // Load instance type and check that it is in object type range.
1588
+ __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset));
1589
+ __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE));
1590
+ __ b(lt, is_not_object);
1591
+ __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE));
1592
+ return le;
1593
+ }
1594
+
1595
+
1596
+ void LCodeGen::DoIsObject(LIsObject* instr) {
1597
+ Register reg = ToRegister(instr->InputAt(0));
1598
+ Register result = ToRegister(instr->result());
1599
+ Register temp = scratch0();
1600
+ Label is_false, is_true, done;
1601
+
1602
+ Condition true_cond = EmitIsObject(reg, result, temp, &is_false, &is_true);
1603
+ __ b(true_cond, &is_true);
1604
+
1605
+ __ bind(&is_false);
1606
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
1607
+ __ b(&done);
1608
+
1609
+ __ bind(&is_true);
1610
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
1611
+
1612
+ __ bind(&done);
1613
+ }
1614
+
1615
+
1616
+ void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1617
+ Register reg = ToRegister(instr->InputAt(0));
1618
+ Register temp1 = ToRegister(instr->TempAt(0));
1619
+ Register temp2 = scratch0();
1620
+
1621
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1622
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1623
+ Label* true_label = chunk_->GetAssemblyLabel(true_block);
1624
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
1625
+
1626
+ Condition true_cond =
1627
+ EmitIsObject(reg, temp1, temp2, false_label, true_label);
1628
+
1629
+ EmitBranch(true_block, false_block, true_cond);
1630
+ }
1631
+
1632
+
1633
+ void LCodeGen::DoIsSmi(LIsSmi* instr) {
1634
+ ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1635
+ Register result = ToRegister(instr->result());
1636
+ Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1637
+ __ tst(input_reg, Operand(kSmiTagMask));
1638
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
1639
+ Label done;
1640
+ __ b(eq, &done);
1641
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
1642
+ __ bind(&done);
1643
+ }
1644
+
1645
+
1646
+ void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1647
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1648
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1649
+
1650
+ Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1651
+ __ tst(input_reg, Operand(kSmiTagMask));
1652
+ EmitBranch(true_block, false_block, eq);
1653
+ }
1654
+
1655
+
1656
+ static InstanceType TestType(HHasInstanceType* instr) {
1657
+ InstanceType from = instr->from();
1658
+ InstanceType to = instr->to();
1659
+ if (from == FIRST_TYPE) return to;
1660
+ ASSERT(from == to || to == LAST_TYPE);
1661
+ return from;
1662
+ }
1663
+
1664
+
1665
+ static Condition BranchCondition(HHasInstanceType* instr) {
1666
+ InstanceType from = instr->from();
1667
+ InstanceType to = instr->to();
1668
+ if (from == to) return eq;
1669
+ if (to == LAST_TYPE) return hs;
1670
+ if (from == FIRST_TYPE) return ls;
1671
+ UNREACHABLE();
1672
+ return eq;
1673
+ }
1674
+
1675
+
1676
+ void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) {
1677
+ Register input = ToRegister(instr->InputAt(0));
1678
+ Register result = ToRegister(instr->result());
1679
+
1680
+ ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1681
+ Label done;
1682
+ __ tst(input, Operand(kSmiTagMask));
1683
+ __ LoadRoot(result, Heap::kFalseValueRootIndex, eq);
1684
+ __ b(eq, &done);
1685
+ __ CompareObjectType(input, result, result, TestType(instr->hydrogen()));
1686
+ Condition cond = BranchCondition(instr->hydrogen());
1687
+ __ LoadRoot(result, Heap::kTrueValueRootIndex, cond);
1688
+ __ LoadRoot(result, Heap::kFalseValueRootIndex, NegateCondition(cond));
1689
+ __ bind(&done);
1690
+ }
1691
+
1692
+
1693
+ void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1694
+ Register scratch = scratch0();
1695
+ Register input = ToRegister(instr->InputAt(0));
1696
+
1697
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1698
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1699
+
1700
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
1701
+
1702
+ __ tst(input, Operand(kSmiTagMask));
1703
+ __ b(eq, false_label);
1704
+
1705
+ __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
1706
+ EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1707
+ }
1708
+
1709
+
1710
+ void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1711
+ Register input = ToRegister(instr->InputAt(0));
1712
+ Register result = ToRegister(instr->result());
1713
+ Register scratch = scratch0();
1714
+
1715
+ __ ldr(scratch, FieldMemOperand(input, String::kHashFieldOffset));
1716
+ __ IndexFromHash(scratch, result);
1717
+ }
1718
+
1719
+
1720
+ void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1721
+ Register input = ToRegister(instr->InputAt(0));
1722
+ Register result = ToRegister(instr->result());
1723
+ Register scratch = scratch0();
1724
+
1725
+ ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1726
+ __ ldr(scratch,
1727
+ FieldMemOperand(input, String::kHashFieldOffset));
1728
+ __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
1729
+ __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1730
+ __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1731
+ }
1732
+
1733
+
1734
+ void LCodeGen::DoHasCachedArrayIndexAndBranch(
1735
+ LHasCachedArrayIndexAndBranch* instr) {
1736
+ Register input = ToRegister(instr->InputAt(0));
1737
+ Register scratch = scratch0();
1738
+
1739
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1740
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1741
+
1742
+ __ ldr(scratch,
1743
+ FieldMemOperand(input, String::kHashFieldOffset));
1744
+ __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
1745
+ EmitBranch(true_block, false_block, eq);
1746
+ }
1747
+
1748
+
1749
+ // Branches to a label or falls through with the answer in flags. Trashes
1750
+ // the temp registers, but not the input. Only input and temp2 may alias.
1751
+ void LCodeGen::EmitClassOfTest(Label* is_true,
1752
+ Label* is_false,
1753
+ Handle<String>class_name,
1754
+ Register input,
1755
+ Register temp,
1756
+ Register temp2) {
1757
+ ASSERT(!input.is(temp));
1758
+ ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1759
+ __ tst(input, Operand(kSmiTagMask));
1760
+ __ b(eq, is_false);
1761
+ __ CompareObjectType(input, temp, temp2, FIRST_JS_OBJECT_TYPE);
1762
+ __ b(lt, is_false);
1763
+
1764
+ // Map is now in temp.
1765
+ // Functions have class 'Function'.
1766
+ __ CompareInstanceType(temp, temp2, JS_FUNCTION_TYPE);
1767
+ if (class_name->IsEqualTo(CStrVector("Function"))) {
1768
+ __ b(eq, is_true);
1769
+ } else {
1770
+ __ b(eq, is_false);
1771
+ }
1772
+
1773
+ // Check if the constructor in the map is a function.
1774
+ __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
1775
+
1776
+ // As long as JS_FUNCTION_TYPE is the last instance type and it is
1777
+ // right after LAST_JS_OBJECT_TYPE, we can avoid checking for
1778
+ // LAST_JS_OBJECT_TYPE.
1779
+ ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1780
+ ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
1781
+
1782
+ // Objects with a non-function constructor have class 'Object'.
1783
+ __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
1784
+ if (class_name->IsEqualTo(CStrVector("Object"))) {
1785
+ __ b(ne, is_true);
1786
+ } else {
1787
+ __ b(ne, is_false);
1788
+ }
1789
+
1790
+ // temp now contains the constructor function. Grab the
1791
+ // instance class name from there.
1792
+ __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset));
1793
+ __ ldr(temp, FieldMemOperand(temp,
1794
+ SharedFunctionInfo::kInstanceClassNameOffset));
1795
+ // The class name we are testing against is a symbol because it's a literal.
1796
+ // The name in the constructor is a symbol because of the way the context is
1797
+ // booted. This routine isn't expected to work for random API-created
1798
+ // classes and it doesn't have to because you can't access it with natives
1799
+ // syntax. Since both sides are symbols it is sufficient to use an identity
1800
+ // comparison.
1801
+ __ cmp(temp, Operand(class_name));
1802
+ // End with the answer in flags.
1803
+ }
1804
+
1805
+
1806
+ void LCodeGen::DoClassOfTest(LClassOfTest* instr) {
1807
+ Register input = ToRegister(instr->InputAt(0));
1808
+ Register result = ToRegister(instr->result());
1809
+ ASSERT(input.is(result));
1810
+ Handle<String> class_name = instr->hydrogen()->class_name();
1811
+
1812
+ Label done, is_true, is_false;
1813
+
1814
+ EmitClassOfTest(&is_true, &is_false, class_name, input, scratch0(), input);
1815
+ __ b(ne, &is_false);
1816
+
1817
+ __ bind(&is_true);
1818
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
1819
+ __ jmp(&done);
1820
+
1821
+ __ bind(&is_false);
1822
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
1823
+ __ bind(&done);
1824
+ }
1825
+
1826
+
1827
+ void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1828
+ Register input = ToRegister(instr->InputAt(0));
1829
+ Register temp = scratch0();
1830
+ Register temp2 = ToRegister(instr->TempAt(0));
1831
+ Handle<String> class_name = instr->hydrogen()->class_name();
1832
+
1833
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1834
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1835
+
1836
+ Label* true_label = chunk_->GetAssemblyLabel(true_block);
1837
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
1838
+
1839
+ EmitClassOfTest(true_label, false_label, class_name, input, temp, temp2);
1840
+
1841
+ EmitBranch(true_block, false_block, eq);
1842
+ }
1843
+
1844
+
1845
+ void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1846
+ Register reg = ToRegister(instr->InputAt(0));
1847
+ Register temp = ToRegister(instr->TempAt(0));
1848
+ int true_block = instr->true_block_id();
1849
+ int false_block = instr->false_block_id();
1850
+
1851
+ __ ldr(temp, FieldMemOperand(reg, HeapObject::kMapOffset));
1852
+ __ cmp(temp, Operand(instr->map()));
1853
+ EmitBranch(true_block, false_block, eq);
1854
+ }
1855
+
1856
+
1857
+ void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1858
+ ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
1859
+ ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
1860
+
1861
+ InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1862
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1863
+
1864
+ Label true_value, done;
1865
+ __ tst(r0, r0);
1866
+ __ mov(r0, Operand(Factory::false_value()), LeaveCC, ne);
1867
+ __ mov(r0, Operand(Factory::true_value()), LeaveCC, eq);
1868
+ }
1869
+
1870
+
1871
+ void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
1872
+ ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
1873
+ ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
1874
+
1875
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
1876
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
1877
+
1878
+ InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1879
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1880
+ __ tst(r0, Operand(r0));
1881
+ EmitBranch(true_block, false_block, eq);
1882
+ }
1883
+
1884
+
1885
+ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1886
+ class DeferredInstanceOfKnownGlobal: public LDeferredCode {
1887
+ public:
1888
+ DeferredInstanceOfKnownGlobal(LCodeGen* codegen,
1889
+ LInstanceOfKnownGlobal* instr)
1890
+ : LDeferredCode(codegen), instr_(instr) { }
1891
+ virtual void Generate() {
1892
+ codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_);
1893
+ }
1894
+
1895
+ Label* map_check() { return &map_check_; }
1896
+
1897
+ private:
1898
+ LInstanceOfKnownGlobal* instr_;
1899
+ Label map_check_;
1900
+ };
1901
+
1902
+ DeferredInstanceOfKnownGlobal* deferred;
1903
+ deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1904
+
1905
+ Label done, false_result;
1906
+ Register object = ToRegister(instr->InputAt(0));
1907
+ Register temp = ToRegister(instr->TempAt(0));
1908
+ Register result = ToRegister(instr->result());
1909
+
1910
+ ASSERT(object.is(r0));
1911
+ ASSERT(result.is(r0));
1912
+
1913
+ // A Smi is not instance of anything.
1914
+ __ JumpIfSmi(object, &false_result);
1915
+
1916
+ // This is the inlined call site instanceof cache. The two occurences of the
1917
+ // hole value will be patched to the last map/result pair generated by the
1918
+ // instanceof stub.
1919
+ Label cache_miss;
1920
+ Register map = temp;
1921
+ __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
1922
+ __ bind(deferred->map_check()); // Label for calculating code patching.
1923
+ // We use Factory::the_hole_value() on purpose instead of loading from the
1924
+ // root array to force relocation to be able to later patch with
1925
+ // the cached map.
1926
+ __ mov(ip, Operand(Factory::the_hole_value()));
1927
+ __ cmp(map, Operand(ip));
1928
+ __ b(ne, &cache_miss);
1929
+ // We use Factory::the_hole_value() on purpose instead of loading from the
1930
+ // root array to force relocation to be able to later patch
1931
+ // with true or false.
1932
+ __ mov(result, Operand(Factory::the_hole_value()));
1933
+ __ b(&done);
1934
+
1935
+ // The inlined call site cache did not match. Check null and string before
1936
+ // calling the deferred code.
1937
+ __ bind(&cache_miss);
1938
+ // Null is not instance of anything.
1939
+ __ LoadRoot(ip, Heap::kNullValueRootIndex);
1940
+ __ cmp(object, Operand(ip));
1941
+ __ b(eq, &false_result);
1942
+
1943
+ // String values is not instance of anything.
1944
+ Condition is_string = masm_->IsObjectStringType(object, temp);
1945
+ __ b(is_string, &false_result);
1946
+
1947
+ // Go to the deferred code.
1948
+ __ b(deferred->entry());
1949
+
1950
+ __ bind(&false_result);
1951
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
1952
+
1953
+ // Here result has either true or false. Deferred code also produces true or
1954
+ // false object.
1955
+ __ bind(deferred->exit());
1956
+ __ bind(&done);
1957
+ }
1958
+
1959
+
1960
+ void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
1961
+ Label* map_check) {
1962
+ Register result = ToRegister(instr->result());
1963
+ ASSERT(result.is(r0));
1964
+
1965
+ InstanceofStub::Flags flags = InstanceofStub::kNoFlags;
1966
+ flags = static_cast<InstanceofStub::Flags>(
1967
+ flags | InstanceofStub::kArgsInRegisters);
1968
+ flags = static_cast<InstanceofStub::Flags>(
1969
+ flags | InstanceofStub::kCallSiteInlineCheck);
1970
+ flags = static_cast<InstanceofStub::Flags>(
1971
+ flags | InstanceofStub::kReturnTrueFalseObject);
1972
+ InstanceofStub stub(flags);
1973
+
1974
+ __ PushSafepointRegisters();
1975
+
1976
+ // Get the temp register reserved by the instruction. This needs to be r4 as
1977
+ // its slot of the pushing of safepoint registers is used to communicate the
1978
+ // offset to the location of the map check.
1979
+ Register temp = ToRegister(instr->TempAt(0));
1980
+ ASSERT(temp.is(r4));
1981
+ __ mov(InstanceofStub::right(), Operand(instr->function()));
1982
+ static const int kAdditionalDelta = 4;
1983
+ int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
1984
+ Label before_push_delta;
1985
+ __ bind(&before_push_delta);
1986
+ __ BlockConstPoolFor(kAdditionalDelta);
1987
+ __ mov(temp, Operand(delta * kPointerSize));
1988
+ __ StoreToSafepointRegisterSlot(temp, temp);
1989
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1990
+ // Put the result value into the result register slot and
1991
+ // restore all registers.
1992
+ __ StoreToSafepointRegisterSlot(result, result);
1993
+
1994
+ __ PopSafepointRegisters();
1995
+ }
1996
+
1997
+
1998
+ static Condition ComputeCompareCondition(Token::Value op) {
1999
+ switch (op) {
2000
+ case Token::EQ_STRICT:
2001
+ case Token::EQ:
2002
+ return eq;
2003
+ case Token::LT:
2004
+ return lt;
2005
+ case Token::GT:
2006
+ return gt;
2007
+ case Token::LTE:
2008
+ return le;
2009
+ case Token::GTE:
2010
+ return ge;
2011
+ default:
2012
+ UNREACHABLE();
2013
+ return kNoCondition;
2014
+ }
2015
+ }
2016
+
2017
+
2018
+ void LCodeGen::DoCmpT(LCmpT* instr) {
2019
+ Token::Value op = instr->op();
2020
+
2021
+ Handle<Code> ic = CompareIC::GetUninitialized(op);
2022
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2023
+ __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined.
2024
+
2025
+ Condition condition = ComputeCompareCondition(op);
2026
+ if (op == Token::GT || op == Token::LTE) {
2027
+ condition = ReverseCondition(condition);
2028
+ }
2029
+ __ LoadRoot(ToRegister(instr->result()),
2030
+ Heap::kTrueValueRootIndex,
2031
+ condition);
2032
+ __ LoadRoot(ToRegister(instr->result()),
2033
+ Heap::kFalseValueRootIndex,
2034
+ NegateCondition(condition));
2035
+ }
2036
+
2037
+
2038
+ void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
2039
+ Token::Value op = instr->op();
2040
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
2041
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
2042
+
2043
+ Handle<Code> ic = CompareIC::GetUninitialized(op);
2044
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2045
+
2046
+ // The compare stub expects compare condition and the input operands
2047
+ // reversed for GT and LTE.
2048
+ Condition condition = ComputeCompareCondition(op);
2049
+ if (op == Token::GT || op == Token::LTE) {
2050
+ condition = ReverseCondition(condition);
2051
+ }
2052
+ __ cmp(r0, Operand(0));
2053
+ EmitBranch(true_block, false_block, condition);
2054
+ }
2055
+
2056
+
2057
+ void LCodeGen::DoReturn(LReturn* instr) {
2058
+ if (FLAG_trace) {
2059
+ // Push the return value on the stack as the parameter.
2060
+ // Runtime::TraceExit returns its parameter in r0.
2061
+ __ push(r0);
2062
+ __ CallRuntime(Runtime::kTraceExit, 1);
2063
+ }
2064
+ int32_t sp_delta = (ParameterCount() + 1) * kPointerSize;
2065
+ __ mov(sp, fp);
2066
+ __ ldm(ia_w, sp, fp.bit() | lr.bit());
2067
+ __ add(sp, sp, Operand(sp_delta));
2068
+ __ Jump(lr);
2069
+ }
2070
+
2071
+
2072
+ void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) {
2073
+ Register result = ToRegister(instr->result());
2074
+ __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
2075
+ __ ldr(result, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
2076
+ if (instr->hydrogen()->check_hole_value()) {
2077
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2078
+ __ cmp(result, ip);
2079
+ DeoptimizeIf(eq, instr->environment());
2080
+ }
2081
+ }
2082
+
2083
+
2084
+ void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) {
2085
+ Register value = ToRegister(instr->InputAt(0));
2086
+ Register scratch = scratch0();
2087
+
2088
+ // Load the cell.
2089
+ __ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
2090
+
2091
+ // If the cell we are storing to contains the hole it could have
2092
+ // been deleted from the property dictionary. In that case, we need
2093
+ // to update the property details in the property dictionary to mark
2094
+ // it as no longer deleted.
2095
+ if (instr->hydrogen()->check_hole_value()) {
2096
+ Register scratch2 = ToRegister(instr->TempAt(0));
2097
+ __ ldr(scratch2,
2098
+ FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
2099
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2100
+ __ cmp(scratch2, ip);
2101
+ DeoptimizeIf(eq, instr->environment());
2102
+ }
2103
+
2104
+ // Store the value.
2105
+ __ str(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
2106
+ }
2107
+
2108
+
2109
+ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2110
+ Register context = ToRegister(instr->context());
2111
+ Register result = ToRegister(instr->result());
2112
+ __ ldr(result, ContextOperand(context, instr->slot_index()));
2113
+ }
2114
+
2115
+
2116
+ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2117
+ Register context = ToRegister(instr->context());
2118
+ Register value = ToRegister(instr->value());
2119
+ __ str(value, ContextOperand(context, instr->slot_index()));
2120
+ if (instr->needs_write_barrier()) {
2121
+ int offset = Context::SlotOffset(instr->slot_index());
2122
+ __ RecordWrite(context, Operand(offset), value, scratch0());
2123
+ }
2124
+ }
2125
+
2126
+
2127
+ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2128
+ Register object = ToRegister(instr->InputAt(0));
2129
+ Register result = ToRegister(instr->result());
2130
+ if (instr->hydrogen()->is_in_object()) {
2131
+ __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
2132
+ } else {
2133
+ __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2134
+ __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset()));
2135
+ }
2136
+ }
2137
+
2138
+
2139
+ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2140
+ ASSERT(ToRegister(instr->object()).is(r0));
2141
+ ASSERT(ToRegister(instr->result()).is(r0));
2142
+
2143
+ // Name is always in r2.
2144
+ __ mov(r2, Operand(instr->name()));
2145
+ Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
2146
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2147
+ }
2148
+
2149
+
2150
+ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2151
+ Register scratch = scratch0();
2152
+ Register function = ToRegister(instr->function());
2153
+ Register result = ToRegister(instr->result());
2154
+
2155
+ // Check that the function really is a function. Load map into the
2156
+ // result register.
2157
+ __ CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE);
2158
+ DeoptimizeIf(ne, instr->environment());
2159
+
2160
+ // Make sure that the function has an instance prototype.
2161
+ Label non_instance;
2162
+ __ ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
2163
+ __ tst(scratch, Operand(1 << Map::kHasNonInstancePrototype));
2164
+ __ b(ne, &non_instance);
2165
+
2166
+ // Get the prototype or initial map from the function.
2167
+ __ ldr(result,
2168
+ FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2169
+
2170
+ // Check that the function has a prototype or an initial map.
2171
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2172
+ __ cmp(result, ip);
2173
+ DeoptimizeIf(eq, instr->environment());
2174
+
2175
+ // If the function does not have an initial map, we're done.
2176
+ Label done;
2177
+ __ CompareObjectType(result, scratch, scratch, MAP_TYPE);
2178
+ __ b(ne, &done);
2179
+
2180
+ // Get the prototype from the initial map.
2181
+ __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
2182
+ __ jmp(&done);
2183
+
2184
+ // Non-instance prototype: Fetch prototype from constructor field
2185
+ // in initial map.
2186
+ __ bind(&non_instance);
2187
+ __ ldr(result, FieldMemOperand(result, Map::kConstructorOffset));
2188
+
2189
+ // All done.
2190
+ __ bind(&done);
2191
+ }
2192
+
2193
+
2194
+ void LCodeGen::DoLoadElements(LLoadElements* instr) {
2195
+ Register result = ToRegister(instr->result());
2196
+ Register input = ToRegister(instr->InputAt(0));
2197
+ Register scratch = scratch0();
2198
+
2199
+ __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset));
2200
+ if (FLAG_debug_code) {
2201
+ Label done;
2202
+ __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset));
2203
+ __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
2204
+ __ cmp(scratch, ip);
2205
+ __ b(eq, &done);
2206
+ __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex);
2207
+ __ cmp(scratch, ip);
2208
+ __ b(eq, &done);
2209
+ __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex);
2210
+ __ cmp(scratch, ip);
2211
+ __ Check(eq, "Check for fast elements failed.");
2212
+ __ bind(&done);
2213
+ }
2214
+ }
2215
+
2216
+
2217
+ void LCodeGen::DoLoadPixelArrayExternalPointer(
2218
+ LLoadPixelArrayExternalPointer* instr) {
2219
+ Register to_reg = ToRegister(instr->result());
2220
+ Register from_reg = ToRegister(instr->InputAt(0));
2221
+ __ ldr(to_reg, FieldMemOperand(from_reg, PixelArray::kExternalPointerOffset));
2222
+ }
2223
+
2224
+
2225
+ void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2226
+ Register arguments = ToRegister(instr->arguments());
2227
+ Register length = ToRegister(instr->length());
2228
+ Register index = ToRegister(instr->index());
2229
+ Register result = ToRegister(instr->result());
2230
+
2231
+ // Bailout index is not a valid argument index. Use unsigned check to get
2232
+ // negative check for free.
2233
+ __ sub(length, length, index, SetCC);
2234
+ DeoptimizeIf(ls, instr->environment());
2235
+
2236
+ // There are two words between the frame pointer and the last argument.
2237
+ // Subtracting from length accounts for one of them add one more.
2238
+ __ add(length, length, Operand(1));
2239
+ __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2));
2240
+ }
2241
+
2242
+
2243
+ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2244
+ Register elements = ToRegister(instr->elements());
2245
+ Register key = EmitLoadRegister(instr->key(), scratch0());
2246
+ Register result = ToRegister(instr->result());
2247
+ Register scratch = scratch0();
2248
+ ASSERT(result.is(elements));
2249
+
2250
+ // Load the result.
2251
+ __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
2252
+ __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
2253
+
2254
+ // Check for the hole value.
2255
+ __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
2256
+ __ cmp(result, scratch);
2257
+ DeoptimizeIf(eq, instr->environment());
2258
+ }
2259
+
2260
+
2261
+ void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) {
2262
+ Register external_elements = ToRegister(instr->external_pointer());
2263
+ Register key = ToRegister(instr->key());
2264
+ Register result = ToRegister(instr->result());
2265
+
2266
+ // Load the result.
2267
+ __ ldrb(result, MemOperand(external_elements, key));
2268
+ }
2269
+
2270
+
2271
+ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2272
+ ASSERT(ToRegister(instr->object()).is(r1));
2273
+ ASSERT(ToRegister(instr->key()).is(r0));
2274
+
2275
+ Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
2276
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2277
+ }
2278
+
2279
+
2280
+ void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2281
+ Register scratch = scratch0();
2282
+ Register result = ToRegister(instr->result());
2283
+
2284
+ // Check if the calling frame is an arguments adaptor frame.
2285
+ Label done, adapted;
2286
+ __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2287
+ __ ldr(result, MemOperand(scratch, StandardFrameConstants::kContextOffset));
2288
+ __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
2289
+
2290
+ // Result is the frame pointer for the frame if not adapted and for the real
2291
+ // frame below the adaptor frame if adapted.
2292
+ __ mov(result, fp, LeaveCC, ne);
2293
+ __ mov(result, scratch, LeaveCC, eq);
2294
+ }
2295
+
2296
+
2297
+ void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2298
+ Register elem = ToRegister(instr->InputAt(0));
2299
+ Register result = ToRegister(instr->result());
2300
+
2301
+ Label done;
2302
+
2303
+ // If no arguments adaptor frame the number of arguments is fixed.
2304
+ __ cmp(fp, elem);
2305
+ __ mov(result, Operand(scope()->num_parameters()));
2306
+ __ b(eq, &done);
2307
+
2308
+ // Arguments adaptor frame present. Get argument length from there.
2309
+ __ ldr(result, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2310
+ __ ldr(result,
2311
+ MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset));
2312
+ __ SmiUntag(result);
2313
+
2314
+ // Argument length is in result register.
2315
+ __ bind(&done);
2316
+ }
2317
+
2318
+
2319
+ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2320
+ Register receiver = ToRegister(instr->receiver());
2321
+ Register function = ToRegister(instr->function());
2322
+ Register length = ToRegister(instr->length());
2323
+ Register elements = ToRegister(instr->elements());
2324
+ Register scratch = scratch0();
2325
+ ASSERT(receiver.is(r0)); // Used for parameter count.
2326
+ ASSERT(function.is(r1)); // Required by InvokeFunction.
2327
+ ASSERT(ToRegister(instr->result()).is(r0));
2328
+
2329
+ // If the receiver is null or undefined, we have to pass the global object
2330
+ // as a receiver.
2331
+ Label global_object, receiver_ok;
2332
+ __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2333
+ __ cmp(receiver, scratch);
2334
+ __ b(eq, &global_object);
2335
+ __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2336
+ __ cmp(receiver, scratch);
2337
+ __ b(eq, &global_object);
2338
+
2339
+ // Deoptimize if the receiver is not a JS object.
2340
+ __ tst(receiver, Operand(kSmiTagMask));
2341
+ DeoptimizeIf(eq, instr->environment());
2342
+ __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE);
2343
+ DeoptimizeIf(lo, instr->environment());
2344
+ __ jmp(&receiver_ok);
2345
+
2346
+ __ bind(&global_object);
2347
+ __ ldr(receiver, GlobalObjectOperand());
2348
+ __ bind(&receiver_ok);
2349
+
2350
+ // Copy the arguments to this function possibly from the
2351
+ // adaptor frame below it.
2352
+ const uint32_t kArgumentsLimit = 1 * KB;
2353
+ __ cmp(length, Operand(kArgumentsLimit));
2354
+ DeoptimizeIf(hi, instr->environment());
2355
+
2356
+ // Push the receiver and use the register to keep the original
2357
+ // number of arguments.
2358
+ __ push(receiver);
2359
+ __ mov(receiver, length);
2360
+ // The arguments are at a one pointer size offset from elements.
2361
+ __ add(elements, elements, Operand(1 * kPointerSize));
2362
+
2363
+ // Loop through the arguments pushing them onto the execution
2364
+ // stack.
2365
+ Label invoke, loop;
2366
+ // length is a small non-negative integer, due to the test above.
2367
+ __ tst(length, Operand(length));
2368
+ __ b(eq, &invoke);
2369
+ __ bind(&loop);
2370
+ __ ldr(scratch, MemOperand(elements, length, LSL, 2));
2371
+ __ push(scratch);
2372
+ __ sub(length, length, Operand(1), SetCC);
2373
+ __ b(ne, &loop);
2374
+
2375
+ __ bind(&invoke);
2376
+ ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2377
+ LPointerMap* pointers = instr->pointer_map();
2378
+ LEnvironment* env = instr->deoptimization_environment();
2379
+ RecordPosition(pointers->position());
2380
+ RegisterEnvironmentForDeoptimization(env);
2381
+ SafepointGenerator safepoint_generator(this,
2382
+ pointers,
2383
+ env->deoptimization_index());
2384
+ // The number of arguments is stored in receiver which is r0, as expected
2385
+ // by InvokeFunction.
2386
+ v8::internal::ParameterCount actual(receiver);
2387
+ __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
2388
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2389
+ }
2390
+
2391
+
2392
+ void LCodeGen::DoPushArgument(LPushArgument* instr) {
2393
+ LOperand* argument = instr->InputAt(0);
2394
+ if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
2395
+ Abort("DoPushArgument not implemented for double type.");
2396
+ } else {
2397
+ Register argument_reg = EmitLoadRegister(argument, ip);
2398
+ __ push(argument_reg);
2399
+ }
2400
+ }
2401
+
2402
+
2403
+ void LCodeGen::DoContext(LContext* instr) {
2404
+ Register result = ToRegister(instr->result());
2405
+ __ mov(result, cp);
2406
+ }
2407
+
2408
+
2409
+ void LCodeGen::DoOuterContext(LOuterContext* instr) {
2410
+ Register context = ToRegister(instr->context());
2411
+ Register result = ToRegister(instr->result());
2412
+ __ ldr(result,
2413
+ MemOperand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
2414
+ __ ldr(result, FieldMemOperand(result, JSFunction::kContextOffset));
2415
+ }
2416
+
2417
+
2418
+ void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2419
+ Register context = ToRegister(instr->context());
2420
+ Register result = ToRegister(instr->result());
2421
+ __ ldr(result, ContextOperand(cp, Context::GLOBAL_INDEX));
2422
+ }
2423
+
2424
+
2425
+ void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2426
+ Register global = ToRegister(instr->global());
2427
+ Register result = ToRegister(instr->result());
2428
+ __ ldr(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset));
2429
+ }
2430
+
2431
+
2432
+ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2433
+ int arity,
2434
+ LInstruction* instr) {
2435
+ // Change context if needed.
2436
+ bool change_context =
2437
+ (graph()->info()->closure()->context() != function->context()) ||
2438
+ scope()->contains_with() ||
2439
+ (scope()->num_heap_slots() > 0);
2440
+ if (change_context) {
2441
+ __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
2442
+ }
2443
+
2444
+ // Set r0 to arguments count if adaption is not needed. Assumes that r0
2445
+ // is available to write to at this point.
2446
+ if (!function->NeedsArgumentsAdaption()) {
2447
+ __ mov(r0, Operand(arity));
2448
+ }
2449
+
2450
+ LPointerMap* pointers = instr->pointer_map();
2451
+ RecordPosition(pointers->position());
2452
+
2453
+ // Invoke function.
2454
+ __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
2455
+ __ Call(ip);
2456
+
2457
+ // Setup deoptimization.
2458
+ RegisterLazyDeoptimization(instr);
2459
+
2460
+ // Restore context.
2461
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2462
+ }
2463
+
2464
+
2465
+ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2466
+ ASSERT(ToRegister(instr->result()).is(r0));
2467
+ __ mov(r1, Operand(instr->function()));
2468
+ CallKnownFunction(instr->function(), instr->arity(), instr);
2469
+ }
2470
+
2471
+
2472
+ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2473
+ ASSERT(instr->InputAt(0)->Equals(instr->result()));
2474
+ Register input = ToRegister(instr->InputAt(0));
2475
+ Register scratch = scratch0();
2476
+
2477
+ // Deoptimize if not a heap number.
2478
+ __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
2479
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
2480
+ __ cmp(scratch, Operand(ip));
2481
+ DeoptimizeIf(ne, instr->environment());
2482
+
2483
+ Label done;
2484
+ Register exponent = scratch0();
2485
+ scratch = no_reg;
2486
+ __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset));
2487
+ // Check the sign of the argument. If the argument is positive, just
2488
+ // return it. We do not need to patch the stack since |input| and
2489
+ // |result| are the same register and |input| would be restored
2490
+ // unchanged by popping safepoint registers.
2491
+ __ tst(exponent, Operand(HeapNumber::kSignMask));
2492
+ __ b(eq, &done);
2493
+
2494
+ // Input is negative. Reverse its sign.
2495
+ // Preserve the value of all registers.
2496
+ __ PushSafepointRegisters();
2497
+
2498
+ // Registers were saved at the safepoint, so we can use
2499
+ // many scratch registers.
2500
+ Register tmp1 = input.is(r1) ? r0 : r1;
2501
+ Register tmp2 = input.is(r2) ? r0 : r2;
2502
+ Register tmp3 = input.is(r3) ? r0 : r3;
2503
+ Register tmp4 = input.is(r4) ? r0 : r4;
2504
+
2505
+ // exponent: floating point exponent value.
2506
+
2507
+ Label allocated, slow;
2508
+ __ LoadRoot(tmp4, Heap::kHeapNumberMapRootIndex);
2509
+ __ AllocateHeapNumber(tmp1, tmp2, tmp3, tmp4, &slow);
2510
+ __ b(&allocated);
2511
+
2512
+ // Slow case: Call the runtime system to do the number allocation.
2513
+ __ bind(&slow);
2514
+
2515
+ __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
2516
+ RecordSafepointWithRegisters(
2517
+ instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
2518
+ // Set the pointer to the new heap number in tmp.
2519
+ if (!tmp1.is(r0)) __ mov(tmp1, Operand(r0));
2520
+ // Restore input_reg after call to runtime.
2521
+ __ LoadFromSafepointRegisterSlot(input, input);
2522
+ __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset));
2523
+
2524
+ __ bind(&allocated);
2525
+ // exponent: floating point exponent value.
2526
+ // tmp1: allocated heap number.
2527
+ __ bic(exponent, exponent, Operand(HeapNumber::kSignMask));
2528
+ __ str(exponent, FieldMemOperand(tmp1, HeapNumber::kExponentOffset));
2529
+ __ ldr(tmp2, FieldMemOperand(input, HeapNumber::kMantissaOffset));
2530
+ __ str(tmp2, FieldMemOperand(tmp1, HeapNumber::kMantissaOffset));
2531
+
2532
+ __ StoreToSafepointRegisterSlot(tmp1, input);
2533
+ __ PopSafepointRegisters();
2534
+
2535
+ __ bind(&done);
2536
+ }
2537
+
2538
+
2539
+ void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2540
+ Register input = ToRegister(instr->InputAt(0));
2541
+ __ cmp(input, Operand(0));
2542
+ // We can make rsb conditional because the previous cmp instruction
2543
+ // will clear the V (overflow) flag and rsb won't set this flag
2544
+ // if input is positive.
2545
+ __ rsb(input, input, Operand(0), SetCC, mi);
2546
+ // Deoptimize on overflow.
2547
+ DeoptimizeIf(vs, instr->environment());
2548
+ }
2549
+
2550
+
2551
+ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2552
+ // Class for deferred case.
2553
+ class DeferredMathAbsTaggedHeapNumber: public LDeferredCode {
2554
+ public:
2555
+ DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen,
2556
+ LUnaryMathOperation* instr)
2557
+ : LDeferredCode(codegen), instr_(instr) { }
2558
+ virtual void Generate() {
2559
+ codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_);
2560
+ }
2561
+ private:
2562
+ LUnaryMathOperation* instr_;
2563
+ };
2564
+
2565
+ ASSERT(instr->InputAt(0)->Equals(instr->result()));
2566
+ Representation r = instr->hydrogen()->value()->representation();
2567
+ if (r.IsDouble()) {
2568
+ DwVfpRegister input = ToDoubleRegister(instr->InputAt(0));
2569
+ __ vabs(input, input);
2570
+ } else if (r.IsInteger32()) {
2571
+ EmitIntegerMathAbs(instr);
2572
+ } else {
2573
+ // Representation is tagged.
2574
+ DeferredMathAbsTaggedHeapNumber* deferred =
2575
+ new DeferredMathAbsTaggedHeapNumber(this, instr);
2576
+ Register input = ToRegister(instr->InputAt(0));
2577
+ // Smi check.
2578
+ __ JumpIfNotSmi(input, deferred->entry());
2579
+ // If smi, handle it directly.
2580
+ EmitIntegerMathAbs(instr);
2581
+ __ bind(deferred->exit());
2582
+ }
2583
+ }
2584
+
2585
+
2586
+ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2587
+ DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2588
+ Register result = ToRegister(instr->result());
2589
+ SwVfpRegister single_scratch = double_scratch0().low();
2590
+ Register scratch1 = scratch0();
2591
+ Register scratch2 = ToRegister(instr->TempAt(0));
2592
+
2593
+ __ EmitVFPTruncate(kRoundToMinusInf,
2594
+ single_scratch,
2595
+ input,
2596
+ scratch1,
2597
+ scratch2);
2598
+ DeoptimizeIf(ne, instr->environment());
2599
+
2600
+ // Move the result back to general purpose register r0.
2601
+ __ vmov(result, single_scratch);
2602
+
2603
+ // Test for -0.
2604
+ Label done;
2605
+ __ cmp(result, Operand(0));
2606
+ __ b(ne, &done);
2607
+ __ vmov(scratch1, input.high());
2608
+ __ tst(scratch1, Operand(HeapNumber::kSignMask));
2609
+ DeoptimizeIf(ne, instr->environment());
2610
+ __ bind(&done);
2611
+ }
2612
+
2613
+
2614
+ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2615
+ DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2616
+ Register result = ToRegister(instr->result());
2617
+ Register scratch1 = scratch0();
2618
+ Register scratch2 = result;
2619
+ __ EmitVFPTruncate(kRoundToNearest,
2620
+ double_scratch0().low(),
2621
+ input,
2622
+ scratch1,
2623
+ scratch2);
2624
+ DeoptimizeIf(ne, instr->environment());
2625
+ __ vmov(result, double_scratch0().low());
2626
+
2627
+ // Test for -0.
2628
+ Label done;
2629
+ __ cmp(result, Operand(0));
2630
+ __ b(ne, &done);
2631
+ __ vmov(scratch1, input.high());
2632
+ __ tst(scratch1, Operand(HeapNumber::kSignMask));
2633
+ DeoptimizeIf(ne, instr->environment());
2634
+ __ bind(&done);
2635
+ }
2636
+
2637
+
2638
+ void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2639
+ DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2640
+ ASSERT(ToDoubleRegister(instr->result()).is(input));
2641
+ __ vsqrt(input, input);
2642
+ }
2643
+
2644
+
2645
+ void LCodeGen::DoPower(LPower* instr) {
2646
+ LOperand* left = instr->InputAt(0);
2647
+ LOperand* right = instr->InputAt(1);
2648
+ Register scratch = scratch0();
2649
+ DoubleRegister result_reg = ToDoubleRegister(instr->result());
2650
+ Representation exponent_type = instr->hydrogen()->right()->representation();
2651
+ if (exponent_type.IsDouble()) {
2652
+ // Prepare arguments and call C function.
2653
+ __ PrepareCallCFunction(4, scratch);
2654
+ __ vmov(r0, r1, ToDoubleRegister(left));
2655
+ __ vmov(r2, r3, ToDoubleRegister(right));
2656
+ __ CallCFunction(ExternalReference::power_double_double_function(), 4);
2657
+ } else if (exponent_type.IsInteger32()) {
2658
+ ASSERT(ToRegister(right).is(r0));
2659
+ // Prepare arguments and call C function.
2660
+ __ PrepareCallCFunction(4, scratch);
2661
+ __ mov(r2, ToRegister(right));
2662
+ __ vmov(r0, r1, ToDoubleRegister(left));
2663
+ __ CallCFunction(ExternalReference::power_double_int_function(), 4);
2664
+ } else {
2665
+ ASSERT(exponent_type.IsTagged());
2666
+ ASSERT(instr->hydrogen()->left()->representation().IsDouble());
2667
+
2668
+ Register right_reg = ToRegister(right);
2669
+
2670
+ // Check for smi on the right hand side.
2671
+ Label non_smi, call;
2672
+ __ JumpIfNotSmi(right_reg, &non_smi);
2673
+
2674
+ // Untag smi and convert it to a double.
2675
+ __ SmiUntag(right_reg);
2676
+ SwVfpRegister single_scratch = double_scratch0().low();
2677
+ __ vmov(single_scratch, right_reg);
2678
+ __ vcvt_f64_s32(result_reg, single_scratch);
2679
+ __ jmp(&call);
2680
+
2681
+ // Heap number map check.
2682
+ __ bind(&non_smi);
2683
+ __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset));
2684
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
2685
+ __ cmp(scratch, Operand(ip));
2686
+ DeoptimizeIf(ne, instr->environment());
2687
+ int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag;
2688
+ __ add(scratch, right_reg, Operand(value_offset));
2689
+ __ vldr(result_reg, scratch, 0);
2690
+
2691
+ // Prepare arguments and call C function.
2692
+ __ bind(&call);
2693
+ __ PrepareCallCFunction(4, scratch);
2694
+ __ vmov(r0, r1, ToDoubleRegister(left));
2695
+ __ vmov(r2, r3, result_reg);
2696
+ __ CallCFunction(ExternalReference::power_double_double_function(), 4);
2697
+ }
2698
+ // Store the result in the result register.
2699
+ __ GetCFunctionDoubleResult(result_reg);
2700
+ }
2701
+
2702
+
2703
+ void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2704
+ switch (instr->op()) {
2705
+ case kMathAbs:
2706
+ DoMathAbs(instr);
2707
+ break;
2708
+ case kMathFloor:
2709
+ DoMathFloor(instr);
2710
+ break;
2711
+ case kMathRound:
2712
+ DoMathRound(instr);
2713
+ break;
2714
+ case kMathSqrt:
2715
+ DoMathSqrt(instr);
2716
+ break;
2717
+ default:
2718
+ Abort("Unimplemented type of LUnaryMathOperation.");
2719
+ UNREACHABLE();
2720
+ }
2721
+ }
2722
+
2723
+
2724
+ void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
2725
+ ASSERT(ToRegister(instr->result()).is(r0));
2726
+
2727
+ int arity = instr->arity();
2728
+ Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arity, NOT_IN_LOOP);
2729
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2730
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2731
+ }
2732
+
2733
+
2734
+ void LCodeGen::DoCallNamed(LCallNamed* instr) {
2735
+ ASSERT(ToRegister(instr->result()).is(r0));
2736
+
2737
+ int arity = instr->arity();
2738
+ Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP);
2739
+ __ mov(r2, Operand(instr->name()));
2740
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2741
+ // Restore context register.
2742
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2743
+ }
2744
+
2745
+
2746
+ void LCodeGen::DoCallFunction(LCallFunction* instr) {
2747
+ ASSERT(ToRegister(instr->result()).is(r0));
2748
+
2749
+ int arity = instr->arity();
2750
+ CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
2751
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2752
+ __ Drop(1);
2753
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2754
+ }
2755
+
2756
+
2757
+ void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
2758
+ ASSERT(ToRegister(instr->result()).is(r0));
2759
+
2760
+ int arity = instr->arity();
2761
+ Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP);
2762
+ __ mov(r2, Operand(instr->name()));
2763
+ CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2764
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2765
+ }
2766
+
2767
+
2768
+ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
2769
+ ASSERT(ToRegister(instr->result()).is(r0));
2770
+ __ mov(r1, Operand(instr->target()));
2771
+ CallKnownFunction(instr->target(), instr->arity(), instr);
2772
+ }
2773
+
2774
+
2775
+ void LCodeGen::DoCallNew(LCallNew* instr) {
2776
+ ASSERT(ToRegister(instr->InputAt(0)).is(r1));
2777
+ ASSERT(ToRegister(instr->result()).is(r0));
2778
+
2779
+ Handle<Code> builtin(Builtins::builtin(Builtins::JSConstructCall));
2780
+ __ mov(r0, Operand(instr->arity()));
2781
+ CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
2782
+ }
2783
+
2784
+
2785
+ void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
2786
+ CallRuntime(instr->function(), instr->arity(), instr);
2787
+ }
2788
+
2789
+
2790
+ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
2791
+ Register object = ToRegister(instr->object());
2792
+ Register value = ToRegister(instr->value());
2793
+ Register scratch = scratch0();
2794
+ int offset = instr->offset();
2795
+
2796
+ ASSERT(!object.is(value));
2797
+
2798
+ if (!instr->transition().is_null()) {
2799
+ __ mov(scratch, Operand(instr->transition()));
2800
+ __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
2801
+ }
2802
+
2803
+ // Do the store.
2804
+ if (instr->is_in_object()) {
2805
+ __ str(value, FieldMemOperand(object, offset));
2806
+ if (instr->needs_write_barrier()) {
2807
+ // Update the write barrier for the object for in-object properties.
2808
+ __ RecordWrite(object, Operand(offset), value, scratch);
2809
+ }
2810
+ } else {
2811
+ __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
2812
+ __ str(value, FieldMemOperand(scratch, offset));
2813
+ if (instr->needs_write_barrier()) {
2814
+ // Update the write barrier for the properties array.
2815
+ // object is used as a scratch register.
2816
+ __ RecordWrite(scratch, Operand(offset), value, object);
2817
+ }
2818
+ }
2819
+ }
2820
+
2821
+
2822
+ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
2823
+ ASSERT(ToRegister(instr->object()).is(r1));
2824
+ ASSERT(ToRegister(instr->value()).is(r0));
2825
+
2826
+ // Name is always in r2.
2827
+ __ mov(r2, Operand(instr->name()));
2828
+ Handle<Code> ic(Builtins::builtin(
2829
+ info_->is_strict() ? Builtins::StoreIC_Initialize_Strict
2830
+ : Builtins::StoreIC_Initialize));
2831
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2832
+ }
2833
+
2834
+
2835
+ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
2836
+ __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
2837
+ DeoptimizeIf(hs, instr->environment());
2838
+ }
2839
+
2840
+
2841
+ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
2842
+ Register value = ToRegister(instr->value());
2843
+ Register elements = ToRegister(instr->object());
2844
+ Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
2845
+ Register scratch = scratch0();
2846
+
2847
+ // Do the store.
2848
+ if (instr->key()->IsConstantOperand()) {
2849
+ ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
2850
+ LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
2851
+ int offset =
2852
+ ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize;
2853
+ __ str(value, FieldMemOperand(elements, offset));
2854
+ } else {
2855
+ __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
2856
+ __ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize));
2857
+ }
2858
+
2859
+ if (instr->hydrogen()->NeedsWriteBarrier()) {
2860
+ // Compute address of modified element and store it into key register.
2861
+ __ add(key, scratch, Operand(FixedArray::kHeaderSize));
2862
+ __ RecordWrite(elements, key, value);
2863
+ }
2864
+ }
2865
+
2866
+
2867
+ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
2868
+ ASSERT(ToRegister(instr->object()).is(r2));
2869
+ ASSERT(ToRegister(instr->key()).is(r1));
2870
+ ASSERT(ToRegister(instr->value()).is(r0));
2871
+
2872
+ Handle<Code> ic(Builtins::builtin(
2873
+ info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict
2874
+ : Builtins::KeyedStoreIC_Initialize));
2875
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
2876
+ }
2877
+
2878
+
2879
+ void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
2880
+ class DeferredStringCharCodeAt: public LDeferredCode {
2881
+ public:
2882
+ DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
2883
+ : LDeferredCode(codegen), instr_(instr) { }
2884
+ virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); }
2885
+ private:
2886
+ LStringCharCodeAt* instr_;
2887
+ };
2888
+
2889
+ Register scratch = scratch0();
2890
+ Register string = ToRegister(instr->string());
2891
+ Register index = no_reg;
2892
+ int const_index = -1;
2893
+ if (instr->index()->IsConstantOperand()) {
2894
+ const_index = ToInteger32(LConstantOperand::cast(instr->index()));
2895
+ STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
2896
+ if (!Smi::IsValid(const_index)) {
2897
+ // Guaranteed to be out of bounds because of the assert above.
2898
+ // So the bounds check that must dominate this instruction must
2899
+ // have deoptimized already.
2900
+ if (FLAG_debug_code) {
2901
+ __ Abort("StringCharCodeAt: out of bounds index.");
2902
+ }
2903
+ // No code needs to be generated.
2904
+ return;
2905
+ }
2906
+ } else {
2907
+ index = ToRegister(instr->index());
2908
+ }
2909
+ Register result = ToRegister(instr->result());
2910
+
2911
+ DeferredStringCharCodeAt* deferred =
2912
+ new DeferredStringCharCodeAt(this, instr);
2913
+
2914
+ Label flat_string, ascii_string, done;
2915
+
2916
+ // Fetch the instance type of the receiver into result register.
2917
+ __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
2918
+ __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
2919
+
2920
+ // We need special handling for non-flat strings.
2921
+ STATIC_ASSERT(kSeqStringTag == 0);
2922
+ __ tst(result, Operand(kStringRepresentationMask));
2923
+ __ b(eq, &flat_string);
2924
+
2925
+ // Handle non-flat strings.
2926
+ __ tst(result, Operand(kIsConsStringMask));
2927
+ __ b(eq, deferred->entry());
2928
+
2929
+ // ConsString.
2930
+ // Check whether the right hand side is the empty string (i.e. if
2931
+ // this is really a flat string in a cons string). If that is not
2932
+ // the case we would rather go to the runtime system now to flatten
2933
+ // the string.
2934
+ __ ldr(scratch, FieldMemOperand(string, ConsString::kSecondOffset));
2935
+ __ LoadRoot(ip, Heap::kEmptyStringRootIndex);
2936
+ __ cmp(scratch, ip);
2937
+ __ b(ne, deferred->entry());
2938
+ // Get the first of the two strings and load its instance type.
2939
+ __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset));
2940
+ __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
2941
+ __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
2942
+ // If the first cons component is also non-flat, then go to runtime.
2943
+ STATIC_ASSERT(kSeqStringTag == 0);
2944
+ __ tst(result, Operand(kStringRepresentationMask));
2945
+ __ b(ne, deferred->entry());
2946
+
2947
+ // Check for 1-byte or 2-byte string.
2948
+ __ bind(&flat_string);
2949
+ STATIC_ASSERT(kAsciiStringTag != 0);
2950
+ __ tst(result, Operand(kStringEncodingMask));
2951
+ __ b(ne, &ascii_string);
2952
+
2953
+ // 2-byte string.
2954
+ // Load the 2-byte character code into the result register.
2955
+ STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1);
2956
+ if (instr->index()->IsConstantOperand()) {
2957
+ __ ldrh(result,
2958
+ FieldMemOperand(string,
2959
+ SeqTwoByteString::kHeaderSize + 2 * const_index));
2960
+ } else {
2961
+ __ add(scratch,
2962
+ string,
2963
+ Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
2964
+ __ ldrh(result, MemOperand(scratch, index, LSL, 1));
2965
+ }
2966
+ __ jmp(&done);
2967
+
2968
+ // ASCII string.
2969
+ // Load the byte into the result register.
2970
+ __ bind(&ascii_string);
2971
+ if (instr->index()->IsConstantOperand()) {
2972
+ __ ldrb(result, FieldMemOperand(string,
2973
+ SeqAsciiString::kHeaderSize + const_index));
2974
+ } else {
2975
+ __ add(scratch,
2976
+ string,
2977
+ Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
2978
+ __ ldrb(result, MemOperand(scratch, index));
2979
+ }
2980
+ __ bind(&done);
2981
+ __ bind(deferred->exit());
2982
+ }
2983
+
2984
+
2985
+ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
2986
+ Register string = ToRegister(instr->string());
2987
+ Register result = ToRegister(instr->result());
2988
+ Register scratch = scratch0();
2989
+
2990
+ // TODO(3095996): Get rid of this. For now, we need to make the
2991
+ // result register contain a valid pointer because it is already
2992
+ // contained in the register pointer map.
2993
+ __ mov(result, Operand(0));
2994
+
2995
+ __ PushSafepointRegisters();
2996
+ __ push(string);
2997
+ // Push the index as a smi. This is safe because of the checks in
2998
+ // DoStringCharCodeAt above.
2999
+ if (instr->index()->IsConstantOperand()) {
3000
+ int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3001
+ __ mov(scratch, Operand(Smi::FromInt(const_index)));
3002
+ __ push(scratch);
3003
+ } else {
3004
+ Register index = ToRegister(instr->index());
3005
+ __ SmiTag(index);
3006
+ __ push(index);
3007
+ }
3008
+ __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt);
3009
+ RecordSafepointWithRegisters(
3010
+ instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex);
3011
+ if (FLAG_debug_code) {
3012
+ __ AbortIfNotSmi(r0);
3013
+ }
3014
+ __ SmiUntag(r0);
3015
+ __ StoreToSafepointRegisterSlot(r0, result);
3016
+ __ PopSafepointRegisters();
3017
+ }
3018
+
3019
+
3020
+ void LCodeGen::DoStringLength(LStringLength* instr) {
3021
+ Register string = ToRegister(instr->InputAt(0));
3022
+ Register result = ToRegister(instr->result());
3023
+ __ ldr(result, FieldMemOperand(string, String::kLengthOffset));
3024
+ }
3025
+
3026
+
3027
+ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3028
+ LOperand* input = instr->InputAt(0);
3029
+ ASSERT(input->IsRegister() || input->IsStackSlot());
3030
+ LOperand* output = instr->result();
3031
+ ASSERT(output->IsDoubleRegister());
3032
+ SwVfpRegister single_scratch = double_scratch0().low();
3033
+ if (input->IsStackSlot()) {
3034
+ Register scratch = scratch0();
3035
+ __ ldr(scratch, ToMemOperand(input));
3036
+ __ vmov(single_scratch, scratch);
3037
+ } else {
3038
+ __ vmov(single_scratch, ToRegister(input));
3039
+ }
3040
+ __ vcvt_f64_s32(ToDoubleRegister(output), single_scratch);
3041
+ }
3042
+
3043
+
3044
+ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3045
+ class DeferredNumberTagI: public LDeferredCode {
3046
+ public:
3047
+ DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
3048
+ : LDeferredCode(codegen), instr_(instr) { }
3049
+ virtual void Generate() { codegen()->DoDeferredNumberTagI(instr_); }
3050
+ private:
3051
+ LNumberTagI* instr_;
3052
+ };
3053
+
3054
+ LOperand* input = instr->InputAt(0);
3055
+ ASSERT(input->IsRegister() && input->Equals(instr->result()));
3056
+ Register reg = ToRegister(input);
3057
+
3058
+ DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
3059
+ __ SmiTag(reg, SetCC);
3060
+ __ b(vs, deferred->entry());
3061
+ __ bind(deferred->exit());
3062
+ }
3063
+
3064
+
3065
+ void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) {
3066
+ Label slow;
3067
+ Register reg = ToRegister(instr->InputAt(0));
3068
+ DoubleRegister dbl_scratch = d0;
3069
+ SwVfpRegister flt_scratch = s0;
3070
+
3071
+ // Preserve the value of all registers.
3072
+ __ PushSafepointRegisters();
3073
+
3074
+ // There was overflow, so bits 30 and 31 of the original integer
3075
+ // disagree. Try to allocate a heap number in new space and store
3076
+ // the value in there. If that fails, call the runtime system.
3077
+ Label done;
3078
+ __ SmiUntag(reg);
3079
+ __ eor(reg, reg, Operand(0x80000000));
3080
+ __ vmov(flt_scratch, reg);
3081
+ __ vcvt_f64_s32(dbl_scratch, flt_scratch);
3082
+ if (FLAG_inline_new) {
3083
+ __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
3084
+ __ AllocateHeapNumber(r5, r3, r4, r6, &slow);
3085
+ if (!reg.is(r5)) __ mov(reg, r5);
3086
+ __ b(&done);
3087
+ }
3088
+
3089
+ // Slow case: Call the runtime system to do the number allocation.
3090
+ __ bind(&slow);
3091
+
3092
+ // TODO(3095996): Put a valid pointer value in the stack slot where the result
3093
+ // register is stored, as this register is in the pointer map, but contains an
3094
+ // integer value.
3095
+ __ mov(ip, Operand(0));
3096
+ __ StoreToSafepointRegisterSlot(ip, reg);
3097
+ __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
3098
+ RecordSafepointWithRegisters(
3099
+ instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
3100
+ if (!reg.is(r0)) __ mov(reg, r0);
3101
+
3102
+ // Done. Put the value in dbl_scratch into the value of the allocated heap
3103
+ // number.
3104
+ __ bind(&done);
3105
+ __ sub(ip, reg, Operand(kHeapObjectTag));
3106
+ __ vstr(dbl_scratch, ip, HeapNumber::kValueOffset);
3107
+ __ StoreToSafepointRegisterSlot(reg, reg);
3108
+ __ PopSafepointRegisters();
3109
+ }
3110
+
3111
+
3112
+ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3113
+ class DeferredNumberTagD: public LDeferredCode {
3114
+ public:
3115
+ DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3116
+ : LDeferredCode(codegen), instr_(instr) { }
3117
+ virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); }
3118
+ private:
3119
+ LNumberTagD* instr_;
3120
+ };
3121
+
3122
+ DoubleRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3123
+ Register scratch = scratch0();
3124
+ Register reg = ToRegister(instr->result());
3125
+ Register temp1 = ToRegister(instr->TempAt(0));
3126
+ Register temp2 = ToRegister(instr->TempAt(1));
3127
+
3128
+ DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3129
+ if (FLAG_inline_new) {
3130
+ __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
3131
+ __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
3132
+ } else {
3133
+ __ jmp(deferred->entry());
3134
+ }
3135
+ __ bind(deferred->exit());
3136
+ __ sub(ip, reg, Operand(kHeapObjectTag));
3137
+ __ vstr(input_reg, ip, HeapNumber::kValueOffset);
3138
+ }
3139
+
3140
+
3141
+ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3142
+ // TODO(3095996): Get rid of this. For now, we need to make the
3143
+ // result register contain a valid pointer because it is already
3144
+ // contained in the register pointer map.
3145
+ Register reg = ToRegister(instr->result());
3146
+ __ mov(reg, Operand(0));
3147
+
3148
+ __ PushSafepointRegisters();
3149
+ __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
3150
+ RecordSafepointWithRegisters(
3151
+ instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
3152
+ __ StoreToSafepointRegisterSlot(r0, reg);
3153
+ __ PopSafepointRegisters();
3154
+ }
3155
+
3156
+
3157
+ void LCodeGen::DoSmiTag(LSmiTag* instr) {
3158
+ LOperand* input = instr->InputAt(0);
3159
+ ASSERT(input->IsRegister() && input->Equals(instr->result()));
3160
+ ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3161
+ __ SmiTag(ToRegister(input));
3162
+ }
3163
+
3164
+
3165
+ void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3166
+ LOperand* input = instr->InputAt(0);
3167
+ ASSERT(input->IsRegister() && input->Equals(instr->result()));
3168
+ if (instr->needs_check()) {
3169
+ __ tst(ToRegister(input), Operand(kSmiTagMask));
3170
+ DeoptimizeIf(ne, instr->environment());
3171
+ }
3172
+ __ SmiUntag(ToRegister(input));
3173
+ }
3174
+
3175
+
3176
+ void LCodeGen::EmitNumberUntagD(Register input_reg,
3177
+ DoubleRegister result_reg,
3178
+ LEnvironment* env) {
3179
+ Register scratch = scratch0();
3180
+ SwVfpRegister flt_scratch = s0;
3181
+ ASSERT(!result_reg.is(d0));
3182
+
3183
+ Label load_smi, heap_number, done;
3184
+
3185
+ // Smi check.
3186
+ __ tst(input_reg, Operand(kSmiTagMask));
3187
+ __ b(eq, &load_smi);
3188
+
3189
+ // Heap number map check.
3190
+ __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3191
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3192
+ __ cmp(scratch, Operand(ip));
3193
+ __ b(eq, &heap_number);
3194
+
3195
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3196
+ __ cmp(input_reg, Operand(ip));
3197
+ DeoptimizeIf(ne, env);
3198
+
3199
+ // Convert undefined to NaN.
3200
+ __ LoadRoot(ip, Heap::kNanValueRootIndex);
3201
+ __ sub(ip, ip, Operand(kHeapObjectTag));
3202
+ __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3203
+ __ jmp(&done);
3204
+
3205
+ // Heap number to double register conversion.
3206
+ __ bind(&heap_number);
3207
+ __ sub(ip, input_reg, Operand(kHeapObjectTag));
3208
+ __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3209
+ __ jmp(&done);
3210
+
3211
+ // Smi to double register conversion
3212
+ __ bind(&load_smi);
3213
+ __ SmiUntag(input_reg); // Untag smi before converting to float.
3214
+ __ vmov(flt_scratch, input_reg);
3215
+ __ vcvt_f64_s32(result_reg, flt_scratch);
3216
+ __ SmiTag(input_reg); // Retag smi.
3217
+ __ bind(&done);
3218
+ }
3219
+
3220
+
3221
+ class DeferredTaggedToI: public LDeferredCode {
3222
+ public:
3223
+ DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3224
+ : LDeferredCode(codegen), instr_(instr) { }
3225
+ virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); }
3226
+ private:
3227
+ LTaggedToI* instr_;
3228
+ };
3229
+
3230
+
3231
+ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3232
+ Label done;
3233
+ Register input_reg = ToRegister(instr->InputAt(0));
3234
+ Register scratch = scratch0();
3235
+ DoubleRegister dbl_scratch = d0;
3236
+ SwVfpRegister flt_scratch = s0;
3237
+ DoubleRegister dbl_tmp = ToDoubleRegister(instr->TempAt(0));
3238
+
3239
+ // Heap number map check.
3240
+ __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3241
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3242
+ __ cmp(scratch, Operand(ip));
3243
+
3244
+ if (instr->truncating()) {
3245
+ Label heap_number;
3246
+ __ b(eq, &heap_number);
3247
+ // Check for undefined. Undefined is converted to zero for truncating
3248
+ // conversions.
3249
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3250
+ __ cmp(input_reg, Operand(ip));
3251
+ DeoptimizeIf(ne, instr->environment());
3252
+ __ mov(input_reg, Operand(0));
3253
+ __ b(&done);
3254
+
3255
+ __ bind(&heap_number);
3256
+ __ sub(ip, input_reg, Operand(kHeapObjectTag));
3257
+ __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset);
3258
+ __ vcmp(dbl_tmp, 0.0); // Sets overflow bit in FPSCR flags if NaN.
3259
+ __ vcvt_s32_f64(flt_scratch, dbl_tmp);
3260
+ __ vmov(input_reg, flt_scratch); // 32-bit result of conversion.
3261
+ __ vmrs(pc); // Move vector status bits to normal status bits.
3262
+ // Overflow bit is set if dbl_tmp is Nan.
3263
+ __ cmn(input_reg, Operand(1), vc); // 0x7fffffff + 1 -> overflow.
3264
+ __ cmp(input_reg, Operand(1), vc); // 0x80000000 - 1 -> overflow.
3265
+ DeoptimizeIf(vs, instr->environment()); // Saturation may have occured.
3266
+
3267
+ } else {
3268
+ // Deoptimize if we don't have a heap number.
3269
+ DeoptimizeIf(ne, instr->environment());
3270
+
3271
+ __ sub(ip, input_reg, Operand(kHeapObjectTag));
3272
+ __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset);
3273
+ __ vcvt_s32_f64(flt_scratch, dbl_tmp);
3274
+ __ vmov(input_reg, flt_scratch); // 32-bit result of conversion.
3275
+ // Non-truncating conversion means that we cannot lose bits, so we convert
3276
+ // back to check; note that using non-overlapping s and d regs would be
3277
+ // slightly faster.
3278
+ __ vcvt_f64_s32(dbl_scratch, flt_scratch);
3279
+ __ VFPCompareAndSetFlags(dbl_scratch, dbl_tmp);
3280
+ DeoptimizeIf(ne, instr->environment()); // Not equal or unordered.
3281
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3282
+ __ tst(input_reg, Operand(input_reg));
3283
+ __ b(ne, &done);
3284
+ __ vmov(lr, ip, dbl_tmp);
3285
+ __ tst(ip, Operand(1 << 31)); // Test sign bit.
3286
+ DeoptimizeIf(ne, instr->environment());
3287
+ }
3288
+ }
3289
+ __ bind(&done);
3290
+ }
3291
+
3292
+
3293
+ void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3294
+ LOperand* input = instr->InputAt(0);
3295
+ ASSERT(input->IsRegister());
3296
+ ASSERT(input->Equals(instr->result()));
3297
+
3298
+ Register input_reg = ToRegister(input);
3299
+
3300
+ DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3301
+
3302
+ // Smi check.
3303
+ __ tst(input_reg, Operand(kSmiTagMask));
3304
+ __ b(ne, deferred->entry());
3305
+
3306
+ // Smi to int32 conversion
3307
+ __ SmiUntag(input_reg); // Untag smi.
3308
+
3309
+ __ bind(deferred->exit());
3310
+ }
3311
+
3312
+
3313
+ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3314
+ LOperand* input = instr->InputAt(0);
3315
+ ASSERT(input->IsRegister());
3316
+ LOperand* result = instr->result();
3317
+ ASSERT(result->IsDoubleRegister());
3318
+
3319
+ Register input_reg = ToRegister(input);
3320
+ DoubleRegister result_reg = ToDoubleRegister(result);
3321
+
3322
+ EmitNumberUntagD(input_reg, result_reg, instr->environment());
3323
+ }
3324
+
3325
+
3326
+ void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3327
+ LOperand* input = instr->InputAt(0);
3328
+ ASSERT(input->IsDoubleRegister());
3329
+ LOperand* result = instr->result();
3330
+ ASSERT(result->IsRegister());
3331
+
3332
+ DoubleRegister double_input = ToDoubleRegister(input);
3333
+ Register result_reg = ToRegister(result);
3334
+ SwVfpRegister single_scratch = double_scratch0().low();
3335
+ Register scratch1 = scratch0();
3336
+ Register scratch2 = ToRegister(instr->TempAt(0));
3337
+
3338
+ __ EmitVFPTruncate(kRoundToZero,
3339
+ single_scratch,
3340
+ double_input,
3341
+ scratch1,
3342
+ scratch2);
3343
+
3344
+ // Deoptimize if we had a vfp invalid exception.
3345
+ DeoptimizeIf(ne, instr->environment());
3346
+
3347
+ // Retrieve the result.
3348
+ __ vmov(result_reg, single_scratch);
3349
+
3350
+ if (!instr->truncating()) {
3351
+ // Convert result back to double and compare with input
3352
+ // to check if the conversion was exact.
3353
+ __ vmov(single_scratch, result_reg);
3354
+ __ vcvt_f64_s32(double_scratch0(), single_scratch);
3355
+ __ VFPCompareAndSetFlags(double_scratch0(), double_input);
3356
+ DeoptimizeIf(ne, instr->environment());
3357
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3358
+ Label done;
3359
+ __ cmp(result_reg, Operand(0));
3360
+ __ b(ne, &done);
3361
+ // Check for -0.
3362
+ __ vmov(scratch1, double_input.high());
3363
+ __ tst(scratch1, Operand(HeapNumber::kSignMask));
3364
+ DeoptimizeIf(ne, instr->environment());
3365
+
3366
+ __ bind(&done);
3367
+ }
3368
+ }
3369
+ }
3370
+
3371
+
3372
+ void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
3373
+ LOperand* input = instr->InputAt(0);
3374
+ ASSERT(input->IsRegister());
3375
+ __ tst(ToRegister(input), Operand(kSmiTagMask));
3376
+ DeoptimizeIf(instr->condition(), instr->environment());
3377
+ }
3378
+
3379
+
3380
+ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3381
+ Register input = ToRegister(instr->InputAt(0));
3382
+ Register scratch = scratch0();
3383
+ InstanceType first = instr->hydrogen()->first();
3384
+ InstanceType last = instr->hydrogen()->last();
3385
+
3386
+ __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
3387
+ __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
3388
+ __ cmp(scratch, Operand(first));
3389
+
3390
+ // If there is only one type in the interval check for equality.
3391
+ if (first == last) {
3392
+ DeoptimizeIf(ne, instr->environment());
3393
+ } else {
3394
+ DeoptimizeIf(lo, instr->environment());
3395
+ // Omit check for the last type.
3396
+ if (last != LAST_TYPE) {
3397
+ __ cmp(scratch, Operand(last));
3398
+ DeoptimizeIf(hi, instr->environment());
3399
+ }
3400
+ }
3401
+ }
3402
+
3403
+
3404
+ void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3405
+ ASSERT(instr->InputAt(0)->IsRegister());
3406
+ Register reg = ToRegister(instr->InputAt(0));
3407
+ __ cmp(reg, Operand(instr->hydrogen()->target()));
3408
+ DeoptimizeIf(ne, instr->environment());
3409
+ }
3410
+
3411
+
3412
+ void LCodeGen::DoCheckMap(LCheckMap* instr) {
3413
+ Register scratch = scratch0();
3414
+ LOperand* input = instr->InputAt(0);
3415
+ ASSERT(input->IsRegister());
3416
+ Register reg = ToRegister(input);
3417
+ __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
3418
+ __ cmp(scratch, Operand(instr->hydrogen()->map()));
3419
+ DeoptimizeIf(ne, instr->environment());
3420
+ }
3421
+
3422
+
3423
+ void LCodeGen::LoadHeapObject(Register result,
3424
+ Handle<HeapObject> object) {
3425
+ if (Heap::InNewSpace(*object)) {
3426
+ Handle<JSGlobalPropertyCell> cell =
3427
+ Factory::NewJSGlobalPropertyCell(object);
3428
+ __ mov(result, Operand(cell));
3429
+ __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset));
3430
+ } else {
3431
+ __ mov(result, Operand(object));
3432
+ }
3433
+ }
3434
+
3435
+
3436
+ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
3437
+ Register temp1 = ToRegister(instr->TempAt(0));
3438
+ Register temp2 = ToRegister(instr->TempAt(1));
3439
+
3440
+ Handle<JSObject> holder = instr->holder();
3441
+ Handle<JSObject> current_prototype = instr->prototype();
3442
+
3443
+ // Load prototype object.
3444
+ LoadHeapObject(temp1, current_prototype);
3445
+
3446
+ // Check prototype maps up to the holder.
3447
+ while (!current_prototype.is_identical_to(holder)) {
3448
+ __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
3449
+ __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
3450
+ DeoptimizeIf(ne, instr->environment());
3451
+ current_prototype =
3452
+ Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
3453
+ // Load next prototype object.
3454
+ LoadHeapObject(temp1, current_prototype);
3455
+ }
3456
+
3457
+ // Check the holder map.
3458
+ __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
3459
+ __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
3460
+ DeoptimizeIf(ne, instr->environment());
3461
+ }
3462
+
3463
+
3464
+ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
3465
+ __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3466
+ __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
3467
+ __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3468
+ __ mov(r1, Operand(instr->hydrogen()->constant_elements()));
3469
+ __ Push(r3, r2, r1);
3470
+
3471
+ // Pick the right runtime function or stub to call.
3472
+ int length = instr->hydrogen()->length();
3473
+ if (instr->hydrogen()->IsCopyOnWrite()) {
3474
+ ASSERT(instr->hydrogen()->depth() == 1);
3475
+ FastCloneShallowArrayStub::Mode mode =
3476
+ FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS;
3477
+ FastCloneShallowArrayStub stub(mode, length);
3478
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3479
+ } else if (instr->hydrogen()->depth() > 1) {
3480
+ CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
3481
+ } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
3482
+ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
3483
+ } else {
3484
+ FastCloneShallowArrayStub::Mode mode =
3485
+ FastCloneShallowArrayStub::CLONE_ELEMENTS;
3486
+ FastCloneShallowArrayStub stub(mode, length);
3487
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3488
+ }
3489
+ }
3490
+
3491
+
3492
+ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
3493
+ __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3494
+ __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
3495
+ __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3496
+ __ mov(r2, Operand(instr->hydrogen()->constant_properties()));
3497
+ __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0)));
3498
+ __ Push(r4, r3, r2, r1);
3499
+
3500
+ // Pick the right runtime function to call.
3501
+ if (instr->hydrogen()->depth() > 1) {
3502
+ CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
3503
+ } else {
3504
+ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
3505
+ }
3506
+ }
3507
+
3508
+
3509
+ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
3510
+ Label materialized;
3511
+ // Registers will be used as follows:
3512
+ // r3 = JS function.
3513
+ // r7 = literals array.
3514
+ // r1 = regexp literal.
3515
+ // r0 = regexp literal clone.
3516
+ // r2 and r4-r6 are used as temporaries.
3517
+ __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3518
+ __ ldr(r7, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
3519
+ int literal_offset = FixedArray::kHeaderSize +
3520
+ instr->hydrogen()->literal_index() * kPointerSize;
3521
+ __ ldr(r1, FieldMemOperand(r7, literal_offset));
3522
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3523
+ __ cmp(r1, ip);
3524
+ __ b(ne, &materialized);
3525
+
3526
+ // Create regexp literal using runtime function
3527
+ // Result will be in r0.
3528
+ __ mov(r6, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3529
+ __ mov(r5, Operand(instr->hydrogen()->pattern()));
3530
+ __ mov(r4, Operand(instr->hydrogen()->flags()));
3531
+ __ Push(r7, r6, r5, r4);
3532
+ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
3533
+ __ mov(r1, r0);
3534
+
3535
+ __ bind(&materialized);
3536
+ int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
3537
+ Label allocated, runtime_allocate;
3538
+
3539
+ __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT);
3540
+ __ jmp(&allocated);
3541
+
3542
+ __ bind(&runtime_allocate);
3543
+ __ mov(r0, Operand(Smi::FromInt(size)));
3544
+ __ Push(r1, r0);
3545
+ CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
3546
+ __ pop(r1);
3547
+
3548
+ __ bind(&allocated);
3549
+ // Copy the content into the newly allocated memory.
3550
+ // (Unroll copy loop once for better throughput).
3551
+ for (int i = 0; i < size - kPointerSize; i += 2 * kPointerSize) {
3552
+ __ ldr(r3, FieldMemOperand(r1, i));
3553
+ __ ldr(r2, FieldMemOperand(r1, i + kPointerSize));
3554
+ __ str(r3, FieldMemOperand(r0, i));
3555
+ __ str(r2, FieldMemOperand(r0, i + kPointerSize));
3556
+ }
3557
+ if ((size % (2 * kPointerSize)) != 0) {
3558
+ __ ldr(r3, FieldMemOperand(r1, size - kPointerSize));
3559
+ __ str(r3, FieldMemOperand(r0, size - kPointerSize));
3560
+ }
3561
+ }
3562
+
3563
+
3564
+ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
3565
+ // Use the fast case closure allocation code that allocates in new
3566
+ // space for nested functions that don't need literals cloning.
3567
+ Handle<SharedFunctionInfo> shared_info = instr->shared_info();
3568
+ bool pretenure = instr->hydrogen()->pretenure();
3569
+ if (shared_info->num_literals() == 0 && !pretenure) {
3570
+ FastNewClosureStub stub;
3571
+ __ mov(r1, Operand(shared_info));
3572
+ __ push(r1);
3573
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3574
+ } else {
3575
+ __ mov(r2, Operand(shared_info));
3576
+ __ mov(r1, Operand(pretenure
3577
+ ? Factory::true_value()
3578
+ : Factory::false_value()));
3579
+ __ Push(cp, r2, r1);
3580
+ CallRuntime(Runtime::kNewClosure, 3, instr);
3581
+ }
3582
+ }
3583
+
3584
+
3585
+ void LCodeGen::DoTypeof(LTypeof* instr) {
3586
+ Register input = ToRegister(instr->InputAt(0));
3587
+ __ push(input);
3588
+ CallRuntime(Runtime::kTypeof, 1, instr);
3589
+ }
3590
+
3591
+
3592
+ void LCodeGen::DoTypeofIs(LTypeofIs* instr) {
3593
+ Register input = ToRegister(instr->InputAt(0));
3594
+ Register result = ToRegister(instr->result());
3595
+ Label true_label;
3596
+ Label false_label;
3597
+ Label done;
3598
+
3599
+ Condition final_branch_condition = EmitTypeofIs(&true_label,
3600
+ &false_label,
3601
+ input,
3602
+ instr->type_literal());
3603
+ __ b(final_branch_condition, &true_label);
3604
+ __ bind(&false_label);
3605
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
3606
+ __ b(&done);
3607
+
3608
+ __ bind(&true_label);
3609
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
3610
+
3611
+ __ bind(&done);
3612
+ }
3613
+
3614
+
3615
+ void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
3616
+ Register input = ToRegister(instr->InputAt(0));
3617
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
3618
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
3619
+ Label* true_label = chunk_->GetAssemblyLabel(true_block);
3620
+ Label* false_label = chunk_->GetAssemblyLabel(false_block);
3621
+
3622
+ Condition final_branch_condition = EmitTypeofIs(true_label,
3623
+ false_label,
3624
+ input,
3625
+ instr->type_literal());
3626
+
3627
+ EmitBranch(true_block, false_block, final_branch_condition);
3628
+ }
3629
+
3630
+
3631
+ Condition LCodeGen::EmitTypeofIs(Label* true_label,
3632
+ Label* false_label,
3633
+ Register input,
3634
+ Handle<String> type_name) {
3635
+ Condition final_branch_condition = kNoCondition;
3636
+ Register scratch = scratch0();
3637
+ if (type_name->Equals(Heap::number_symbol())) {
3638
+ __ tst(input, Operand(kSmiTagMask));
3639
+ __ b(eq, true_label);
3640
+ __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
3641
+ __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3642
+ __ cmp(input, Operand(ip));
3643
+ final_branch_condition = eq;
3644
+
3645
+ } else if (type_name->Equals(Heap::string_symbol())) {
3646
+ __ tst(input, Operand(kSmiTagMask));
3647
+ __ b(eq, false_label);
3648
+ __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
3649
+ __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
3650
+ __ tst(ip, Operand(1 << Map::kIsUndetectable));
3651
+ __ b(ne, false_label);
3652
+ __ CompareInstanceType(input, scratch, FIRST_NONSTRING_TYPE);
3653
+ final_branch_condition = lo;
3654
+
3655
+ } else if (type_name->Equals(Heap::boolean_symbol())) {
3656
+ __ LoadRoot(ip, Heap::kTrueValueRootIndex);
3657
+ __ cmp(input, ip);
3658
+ __ b(eq, true_label);
3659
+ __ LoadRoot(ip, Heap::kFalseValueRootIndex);
3660
+ __ cmp(input, ip);
3661
+ final_branch_condition = eq;
3662
+
3663
+ } else if (type_name->Equals(Heap::undefined_symbol())) {
3664
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3665
+ __ cmp(input, ip);
3666
+ __ b(eq, true_label);
3667
+ __ tst(input, Operand(kSmiTagMask));
3668
+ __ b(eq, false_label);
3669
+ // Check for undetectable objects => true.
3670
+ __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
3671
+ __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
3672
+ __ tst(ip, Operand(1 << Map::kIsUndetectable));
3673
+ final_branch_condition = ne;
3674
+
3675
+ } else if (type_name->Equals(Heap::function_symbol())) {
3676
+ __ tst(input, Operand(kSmiTagMask));
3677
+ __ b(eq, false_label);
3678
+ __ CompareObjectType(input, input, scratch, JS_FUNCTION_TYPE);
3679
+ __ b(eq, true_label);
3680
+ // Regular expressions => 'function' (they are callable).
3681
+ __ CompareInstanceType(input, scratch, JS_REGEXP_TYPE);
3682
+ final_branch_condition = eq;
3683
+
3684
+ } else if (type_name->Equals(Heap::object_symbol())) {
3685
+ __ tst(input, Operand(kSmiTagMask));
3686
+ __ b(eq, false_label);
3687
+ __ LoadRoot(ip, Heap::kNullValueRootIndex);
3688
+ __ cmp(input, ip);
3689
+ __ b(eq, true_label);
3690
+ // Regular expressions => 'function', not 'object'.
3691
+ __ CompareObjectType(input, input, scratch, JS_REGEXP_TYPE);
3692
+ __ b(eq, false_label);
3693
+ // Check for undetectable objects => false.
3694
+ __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
3695
+ __ tst(ip, Operand(1 << Map::kIsUndetectable));
3696
+ __ b(ne, false_label);
3697
+ // Check for JS objects => true.
3698
+ __ CompareInstanceType(input, scratch, FIRST_JS_OBJECT_TYPE);
3699
+ __ b(lo, false_label);
3700
+ __ CompareInstanceType(input, scratch, LAST_JS_OBJECT_TYPE);
3701
+ final_branch_condition = ls;
3702
+
3703
+ } else {
3704
+ final_branch_condition = ne;
3705
+ __ b(false_label);
3706
+ // A dead branch instruction will be generated after this point.
3707
+ }
3708
+
3709
+ return final_branch_condition;
3710
+ }
3711
+
3712
+
3713
+ void LCodeGen::DoIsConstructCall(LIsConstructCall* instr) {
3714
+ Register result = ToRegister(instr->result());
3715
+ Label true_label;
3716
+ Label false_label;
3717
+ Label done;
3718
+
3719
+ EmitIsConstructCall(result, scratch0());
3720
+ __ b(eq, &true_label);
3721
+
3722
+ __ LoadRoot(result, Heap::kFalseValueRootIndex);
3723
+ __ b(&done);
3724
+
3725
+
3726
+ __ bind(&true_label);
3727
+ __ LoadRoot(result, Heap::kTrueValueRootIndex);
3728
+
3729
+ __ bind(&done);
3730
+ }
3731
+
3732
+
3733
+ void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
3734
+ Register temp1 = ToRegister(instr->TempAt(0));
3735
+ int true_block = chunk_->LookupDestination(instr->true_block_id());
3736
+ int false_block = chunk_->LookupDestination(instr->false_block_id());
3737
+
3738
+ EmitIsConstructCall(temp1, scratch0());
3739
+ EmitBranch(true_block, false_block, eq);
3740
+ }
3741
+
3742
+
3743
+ void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) {
3744
+ ASSERT(!temp1.is(temp2));
3745
+ // Get the frame pointer for the calling frame.
3746
+ __ ldr(temp1, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
3747
+
3748
+ // Skip the arguments adaptor frame if it exists.
3749
+ Label check_frame_marker;
3750
+ __ ldr(temp2, MemOperand(temp1, StandardFrameConstants::kContextOffset));
3751
+ __ cmp(temp2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3752
+ __ b(ne, &check_frame_marker);
3753
+ __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kCallerFPOffset));
3754
+
3755
+ // Check the marker in the calling frame.
3756
+ __ bind(&check_frame_marker);
3757
+ __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kMarkerOffset));
3758
+ __ cmp(temp1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
3759
+ }
3760
+
3761
+
3762
+ void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
3763
+ // No code for lazy bailout instruction. Used to capture environment after a
3764
+ // call for populating the safepoint data with deoptimization data.
3765
+ }
3766
+
3767
+
3768
+ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
3769
+ DeoptimizeIf(al, instr->environment());
3770
+ }
3771
+
3772
+
3773
+ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
3774
+ Register object = ToRegister(instr->object());
3775
+ Register key = ToRegister(instr->key());
3776
+ Register strict = scratch0();
3777
+ __ mov(strict, Operand(Smi::FromInt(strict_mode_flag())));
3778
+ __ Push(object, key, strict);
3779
+ ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
3780
+ LPointerMap* pointers = instr->pointer_map();
3781
+ LEnvironment* env = instr->deoptimization_environment();
3782
+ RecordPosition(pointers->position());
3783
+ RegisterEnvironmentForDeoptimization(env);
3784
+ SafepointGenerator safepoint_generator(this,
3785
+ pointers,
3786
+ env->deoptimization_index());
3787
+ __ InvokeBuiltin(Builtins::DELETE, CALL_JS, &safepoint_generator);
3788
+ }
3789
+
3790
+
3791
+ void LCodeGen::DoStackCheck(LStackCheck* instr) {
3792
+ // Perform stack overflow check.
3793
+ Label ok;
3794
+ __ LoadRoot(ip, Heap::kStackLimitRootIndex);
3795
+ __ cmp(sp, Operand(ip));
3796
+ __ b(hs, &ok);
3797
+ StackCheckStub stub;
3798
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3799
+ __ bind(&ok);
3800
+ }
3801
+
3802
+
3803
+ void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
3804
+ // This is a pseudo-instruction that ensures that the environment here is
3805
+ // properly registered for deoptimization and records the assembler's PC
3806
+ // offset.
3807
+ LEnvironment* environment = instr->environment();
3808
+ environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
3809
+ instr->SpilledDoubleRegisterArray());
3810
+
3811
+ // If the environment were already registered, we would have no way of
3812
+ // backpatching it with the spill slot operands.
3813
+ ASSERT(!environment->HasBeenRegistered());
3814
+ RegisterEnvironmentForDeoptimization(environment);
3815
+ ASSERT(osr_pc_offset_ == -1);
3816
+ osr_pc_offset_ = masm()->pc_offset();
3817
+ }
3818
+
3819
+
3820
+ #undef __
3821
+
3822
+ } } // namespace v8::internal