libv8-sgonyea 3.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (500) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +76 -0
  5. data/Rakefile +113 -0
  6. data/ext/libv8/extconf.rb +28 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +30 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/v8/.gitignore +35 -0
  12. data/lib/libv8/v8/AUTHORS +44 -0
  13. data/lib/libv8/v8/ChangeLog +2839 -0
  14. data/lib/libv8/v8/LICENSE +52 -0
  15. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  16. data/lib/libv8/v8/LICENSE.v8 +26 -0
  17. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  18. data/lib/libv8/v8/SConstruct +1478 -0
  19. data/lib/libv8/v8/build/README.txt +49 -0
  20. data/lib/libv8/v8/build/all.gyp +18 -0
  21. data/lib/libv8/v8/build/armu.gypi +32 -0
  22. data/lib/libv8/v8/build/common.gypi +144 -0
  23. data/lib/libv8/v8/build/gyp_v8 +145 -0
  24. data/lib/libv8/v8/include/v8-debug.h +395 -0
  25. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  26. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  27. data/lib/libv8/v8/include/v8-testing.h +104 -0
  28. data/lib/libv8/v8/include/v8.h +4124 -0
  29. data/lib/libv8/v8/include/v8stdint.h +53 -0
  30. data/lib/libv8/v8/preparser/SConscript +38 -0
  31. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  32. data/lib/libv8/v8/src/SConscript +368 -0
  33. data/lib/libv8/v8/src/accessors.cc +767 -0
  34. data/lib/libv8/v8/src/accessors.h +123 -0
  35. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  36. data/lib/libv8/v8/src/allocation.cc +122 -0
  37. data/lib/libv8/v8/src/allocation.h +143 -0
  38. data/lib/libv8/v8/src/api.cc +5845 -0
  39. data/lib/libv8/v8/src/api.h +574 -0
  40. data/lib/libv8/v8/src/apinatives.js +110 -0
  41. data/lib/libv8/v8/src/apiutils.h +73 -0
  42. data/lib/libv8/v8/src/arguments.h +118 -0
  43. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  44. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  45. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  46. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  47. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  48. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  49. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  50. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  51. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  52. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  53. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  54. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  55. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  56. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  57. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  58. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  59. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  60. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  61. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  62. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  63. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  64. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  65. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  66. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  67. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  68. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  69. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  70. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  71. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  72. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  73. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  74. data/lib/libv8/v8/src/array.js +1366 -0
  75. data/lib/libv8/v8/src/assembler.cc +1207 -0
  76. data/lib/libv8/v8/src/assembler.h +858 -0
  77. data/lib/libv8/v8/src/ast-inl.h +112 -0
  78. data/lib/libv8/v8/src/ast.cc +1146 -0
  79. data/lib/libv8/v8/src/ast.h +2188 -0
  80. data/lib/libv8/v8/src/atomicops.h +167 -0
  81. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  82. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  83. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  84. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  85. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  86. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  87. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  88. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  89. data/lib/libv8/v8/src/bignum.cc +768 -0
  90. data/lib/libv8/v8/src/bignum.h +140 -0
  91. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  92. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  93. data/lib/libv8/v8/src/builtins.cc +1707 -0
  94. data/lib/libv8/v8/src/builtins.h +371 -0
  95. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  96. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  97. data/lib/libv8/v8/src/cached-powers.h +65 -0
  98. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  99. data/lib/libv8/v8/src/char-predicates.h +67 -0
  100. data/lib/libv8/v8/src/checks.cc +110 -0
  101. data/lib/libv8/v8/src/checks.h +296 -0
  102. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  103. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  104. data/lib/libv8/v8/src/circular-queue.h +103 -0
  105. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  106. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  107. data/lib/libv8/v8/src/code.h +70 -0
  108. data/lib/libv8/v8/src/codegen.cc +231 -0
  109. data/lib/libv8/v8/src/codegen.h +84 -0
  110. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  111. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  112. data/lib/libv8/v8/src/compiler.cc +786 -0
  113. data/lib/libv8/v8/src/compiler.h +312 -0
  114. data/lib/libv8/v8/src/contexts.cc +347 -0
  115. data/lib/libv8/v8/src/contexts.h +391 -0
  116. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  117. data/lib/libv8/v8/src/conversions.cc +1131 -0
  118. data/lib/libv8/v8/src/conversions.h +135 -0
  119. data/lib/libv8/v8/src/counters.cc +93 -0
  120. data/lib/libv8/v8/src/counters.h +254 -0
  121. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  122. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  123. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  124. data/lib/libv8/v8/src/cpu.h +69 -0
  125. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  126. data/lib/libv8/v8/src/d8-debug.h +158 -0
  127. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  128. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  129. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  130. data/lib/libv8/v8/src/d8.cc +803 -0
  131. data/lib/libv8/v8/src/d8.gyp +91 -0
  132. data/lib/libv8/v8/src/d8.h +235 -0
  133. data/lib/libv8/v8/src/d8.js +2798 -0
  134. data/lib/libv8/v8/src/data-flow.cc +66 -0
  135. data/lib/libv8/v8/src/data-flow.h +205 -0
  136. data/lib/libv8/v8/src/date.js +1103 -0
  137. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  138. data/lib/libv8/v8/src/dateparser.cc +178 -0
  139. data/lib/libv8/v8/src/dateparser.h +266 -0
  140. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  141. data/lib/libv8/v8/src/debug-agent.h +129 -0
  142. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  143. data/lib/libv8/v8/src/debug.cc +3165 -0
  144. data/lib/libv8/v8/src/debug.h +1057 -0
  145. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  146. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  147. data/lib/libv8/v8/src/disasm.h +80 -0
  148. data/lib/libv8/v8/src/disassembler.cc +343 -0
  149. data/lib/libv8/v8/src/disassembler.h +58 -0
  150. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  151. data/lib/libv8/v8/src/diy-fp.h +117 -0
  152. data/lib/libv8/v8/src/double.h +238 -0
  153. data/lib/libv8/v8/src/dtoa.cc +103 -0
  154. data/lib/libv8/v8/src/dtoa.h +85 -0
  155. data/lib/libv8/v8/src/execution.cc +849 -0
  156. data/lib/libv8/v8/src/execution.h +297 -0
  157. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  158. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  159. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  160. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  161. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  162. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  163. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  164. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  165. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  166. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  167. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  168. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  169. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  170. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  171. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  172. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  173. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  174. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  175. data/lib/libv8/v8/src/factory.cc +1222 -0
  176. data/lib/libv8/v8/src/factory.h +442 -0
  177. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  178. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  179. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  180. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  181. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  182. data/lib/libv8/v8/src/flags.cc +551 -0
  183. data/lib/libv8/v8/src/flags.h +79 -0
  184. data/lib/libv8/v8/src/frames-inl.h +247 -0
  185. data/lib/libv8/v8/src/frames.cc +1243 -0
  186. data/lib/libv8/v8/src/frames.h +870 -0
  187. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  188. data/lib/libv8/v8/src/full-codegen.h +771 -0
  189. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  190. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  191. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  192. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  193. data/lib/libv8/v8/src/global-handles.cc +665 -0
  194. data/lib/libv8/v8/src/global-handles.h +284 -0
  195. data/lib/libv8/v8/src/globals.h +325 -0
  196. data/lib/libv8/v8/src/handles-inl.h +177 -0
  197. data/lib/libv8/v8/src/handles.cc +987 -0
  198. data/lib/libv8/v8/src/handles.h +382 -0
  199. data/lib/libv8/v8/src/hashmap.cc +230 -0
  200. data/lib/libv8/v8/src/hashmap.h +123 -0
  201. data/lib/libv8/v8/src/heap-inl.h +704 -0
  202. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  203. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  204. data/lib/libv8/v8/src/heap.cc +5930 -0
  205. data/lib/libv8/v8/src/heap.h +2268 -0
  206. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  207. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  208. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  209. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  210. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  211. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  212. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  213. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  214. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  215. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  216. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  217. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  218. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  219. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  220. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  221. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  222. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  223. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  224. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  225. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  226. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  227. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  228. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  229. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  230. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  231. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  232. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  233. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  234. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  235. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  236. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  237. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  238. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  239. data/lib/libv8/v8/src/ic-inl.h +130 -0
  240. data/lib/libv8/v8/src/ic.cc +2577 -0
  241. data/lib/libv8/v8/src/ic.h +736 -0
  242. data/lib/libv8/v8/src/inspector.cc +63 -0
  243. data/lib/libv8/v8/src/inspector.h +62 -0
  244. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  245. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  246. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  247. data/lib/libv8/v8/src/isolate.cc +1869 -0
  248. data/lib/libv8/v8/src/isolate.h +1382 -0
  249. data/lib/libv8/v8/src/json-parser.cc +504 -0
  250. data/lib/libv8/v8/src/json-parser.h +161 -0
  251. data/lib/libv8/v8/src/json.js +342 -0
  252. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  253. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  254. data/lib/libv8/v8/src/list-inl.h +212 -0
  255. data/lib/libv8/v8/src/list.h +174 -0
  256. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  257. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  258. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  259. data/lib/libv8/v8/src/lithium.cc +190 -0
  260. data/lib/libv8/v8/src/lithium.h +597 -0
  261. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  262. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  263. data/lib/libv8/v8/src/liveedit.h +180 -0
  264. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  265. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  266. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  267. data/lib/libv8/v8/src/log-inl.h +59 -0
  268. data/lib/libv8/v8/src/log-utils.cc +428 -0
  269. data/lib/libv8/v8/src/log-utils.h +231 -0
  270. data/lib/libv8/v8/src/log.cc +1993 -0
  271. data/lib/libv8/v8/src/log.h +476 -0
  272. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  273. data/lib/libv8/v8/src/macros.py +178 -0
  274. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  275. data/lib/libv8/v8/src/mark-compact.h +506 -0
  276. data/lib/libv8/v8/src/math.js +264 -0
  277. data/lib/libv8/v8/src/messages.cc +179 -0
  278. data/lib/libv8/v8/src/messages.h +113 -0
  279. data/lib/libv8/v8/src/messages.js +1096 -0
  280. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  281. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  282. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  283. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  284. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  285. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  286. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  287. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  288. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  289. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  290. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  291. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  292. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  293. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  294. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  295. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  296. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  297. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  298. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  299. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  300. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  301. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  302. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  303. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  304. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  305. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  306. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  307. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  308. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  309. data/lib/libv8/v8/src/natives.h +64 -0
  310. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  311. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  312. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  313. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  314. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  315. data/lib/libv8/v8/src/objects.cc +10585 -0
  316. data/lib/libv8/v8/src/objects.h +6838 -0
  317. data/lib/libv8/v8/src/parser.cc +4997 -0
  318. data/lib/libv8/v8/src/parser.h +765 -0
  319. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  320. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  321. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  322. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  323. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  324. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  325. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  326. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  327. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  328. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  329. data/lib/libv8/v8/src/platform-tls.h +50 -0
  330. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  331. data/lib/libv8/v8/src/platform.h +667 -0
  332. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  333. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  334. data/lib/libv8/v8/src/preparse-data.h +225 -0
  335. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  336. data/lib/libv8/v8/src/preparser.cc +1450 -0
  337. data/lib/libv8/v8/src/preparser.h +493 -0
  338. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  339. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  340. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  341. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  342. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  343. data/lib/libv8/v8/src/property.cc +105 -0
  344. data/lib/libv8/v8/src/property.h +365 -0
  345. data/lib/libv8/v8/src/proxy.js +83 -0
  346. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  347. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  348. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  349. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  350. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  351. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  352. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  353. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  354. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  355. data/lib/libv8/v8/src/regexp.js +483 -0
  356. data/lib/libv8/v8/src/rewriter.cc +360 -0
  357. data/lib/libv8/v8/src/rewriter.h +50 -0
  358. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  359. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  360. data/lib/libv8/v8/src/runtime.cc +12227 -0
  361. data/lib/libv8/v8/src/runtime.h +652 -0
  362. data/lib/libv8/v8/src/runtime.js +649 -0
  363. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  364. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  365. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  366. data/lib/libv8/v8/src/scanner-base.h +670 -0
  367. data/lib/libv8/v8/src/scanner.cc +345 -0
  368. data/lib/libv8/v8/src/scanner.h +146 -0
  369. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  370. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  371. data/lib/libv8/v8/src/scopes.cc +1150 -0
  372. data/lib/libv8/v8/src/scopes.h +507 -0
  373. data/lib/libv8/v8/src/serialize.cc +1574 -0
  374. data/lib/libv8/v8/src/serialize.h +589 -0
  375. data/lib/libv8/v8/src/shell.h +55 -0
  376. data/lib/libv8/v8/src/simulator.h +43 -0
  377. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  378. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  379. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  380. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  381. data/lib/libv8/v8/src/snapshot.h +91 -0
  382. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  383. data/lib/libv8/v8/src/spaces.cc +3145 -0
  384. data/lib/libv8/v8/src/spaces.h +2369 -0
  385. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  386. data/lib/libv8/v8/src/splay-tree.h +205 -0
  387. data/lib/libv8/v8/src/string-search.cc +41 -0
  388. data/lib/libv8/v8/src/string-search.h +568 -0
  389. data/lib/libv8/v8/src/string-stream.cc +592 -0
  390. data/lib/libv8/v8/src/string-stream.h +191 -0
  391. data/lib/libv8/v8/src/string.js +994 -0
  392. data/lib/libv8/v8/src/strtod.cc +440 -0
  393. data/lib/libv8/v8/src/strtod.h +40 -0
  394. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  395. data/lib/libv8/v8/src/stub-cache.h +924 -0
  396. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  397. data/lib/libv8/v8/src/token.cc +63 -0
  398. data/lib/libv8/v8/src/token.h +288 -0
  399. data/lib/libv8/v8/src/type-info.cc +507 -0
  400. data/lib/libv8/v8/src/type-info.h +272 -0
  401. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  402. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  403. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  404. data/lib/libv8/v8/src/unicode.cc +1624 -0
  405. data/lib/libv8/v8/src/unicode.h +280 -0
  406. data/lib/libv8/v8/src/uri.js +408 -0
  407. data/lib/libv8/v8/src/utils-inl.h +48 -0
  408. data/lib/libv8/v8/src/utils.cc +371 -0
  409. data/lib/libv8/v8/src/utils.h +800 -0
  410. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  411. data/lib/libv8/v8/src/v8-counters.h +314 -0
  412. data/lib/libv8/v8/src/v8.cc +213 -0
  413. data/lib/libv8/v8/src/v8.h +131 -0
  414. data/lib/libv8/v8/src/v8checks.h +64 -0
  415. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  416. data/lib/libv8/v8/src/v8globals.h +512 -0
  417. data/lib/libv8/v8/src/v8memory.h +82 -0
  418. data/lib/libv8/v8/src/v8natives.js +1310 -0
  419. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  420. data/lib/libv8/v8/src/v8threads.cc +464 -0
  421. data/lib/libv8/v8/src/v8threads.h +165 -0
  422. data/lib/libv8/v8/src/v8utils.h +319 -0
  423. data/lib/libv8/v8/src/variables.cc +114 -0
  424. data/lib/libv8/v8/src/variables.h +167 -0
  425. data/lib/libv8/v8/src/version.cc +116 -0
  426. data/lib/libv8/v8/src/version.h +68 -0
  427. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  428. data/lib/libv8/v8/src/vm-state.h +71 -0
  429. data/lib/libv8/v8/src/win32-headers.h +96 -0
  430. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  431. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  432. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  433. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  434. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  435. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  436. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  437. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  438. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  439. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  440. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  441. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  442. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  443. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  444. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  445. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  446. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  447. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  448. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  449. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  450. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  451. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  452. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  453. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  454. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  455. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  456. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  457. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  458. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  459. data/lib/libv8/v8/src/zone-inl.h +140 -0
  460. data/lib/libv8/v8/src/zone.cc +196 -0
  461. data/lib/libv8/v8/src/zone.h +240 -0
  462. data/lib/libv8/v8/tools/codemap.js +265 -0
  463. data/lib/libv8/v8/tools/consarray.js +93 -0
  464. data/lib/libv8/v8/tools/csvparser.js +78 -0
  465. data/lib/libv8/v8/tools/disasm.py +92 -0
  466. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  467. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  468. data/lib/libv8/v8/tools/gcmole/README +62 -0
  469. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  470. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  471. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  472. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  473. data/lib/libv8/v8/tools/grokdump.py +841 -0
  474. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  475. data/lib/libv8/v8/tools/js2c.py +364 -0
  476. data/lib/libv8/v8/tools/jsmin.py +280 -0
  477. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  478. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  479. data/lib/libv8/v8/tools/logreader.js +185 -0
  480. data/lib/libv8/v8/tools/mac-nm +18 -0
  481. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  482. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  483. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  484. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  485. data/lib/libv8/v8/tools/presubmit.py +305 -0
  486. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  487. data/lib/libv8/v8/tools/profile.js +751 -0
  488. data/lib/libv8/v8/tools/profile_view.js +219 -0
  489. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  490. data/lib/libv8/v8/tools/splaytree.js +316 -0
  491. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  492. data/lib/libv8/v8/tools/test.py +1510 -0
  493. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  494. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  495. data/lib/libv8/v8/tools/utils.py +96 -0
  496. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  497. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  498. data/lib/libv8/version.rb +5 -0
  499. data/libv8.gemspec +36 -0
  500. metadata +578 -0
@@ -0,0 +1,815 @@
1
+ // Copyright 2011 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "v8.h"
29
+
30
+ #if defined(V8_TARGET_ARCH_X64)
31
+
32
+ #include "codegen.h"
33
+ #include "deoptimizer.h"
34
+ #include "full-codegen.h"
35
+ #include "safepoint-table.h"
36
+
37
+ namespace v8 {
38
+ namespace internal {
39
+
40
+
41
+ int Deoptimizer::table_entry_size_ = 10;
42
+
43
+
44
+ int Deoptimizer::patch_size() {
45
+ return MacroAssembler::kCallInstructionLength;
46
+ }
47
+
48
+
49
+ #ifdef DEBUG
50
+ // Overwrites code with int3 instructions.
51
+ static void ZapCodeRange(Address from, Address to) {
52
+ CHECK(from <= to);
53
+ int length = static_cast<int>(to - from);
54
+ CodePatcher destroyer(from, length);
55
+ while (length-- > 0) {
56
+ destroyer.masm()->int3();
57
+ }
58
+ }
59
+ #endif
60
+
61
+
62
+ // Iterate through the entries of a SafepointTable that corresponds to
63
+ // deoptimization points.
64
+ class SafepointTableDeoptimiztionEntryIterator {
65
+ public:
66
+ explicit SafepointTableDeoptimiztionEntryIterator(Code* code)
67
+ : code_(code), table_(code), index_(-1), limit_(table_.length()) {
68
+ FindNextIndex();
69
+ }
70
+
71
+ SafepointEntry Next(Address* pc) {
72
+ if (index_ >= limit_) {
73
+ *pc = NULL;
74
+ return SafepointEntry(); // Invalid entry.
75
+ }
76
+ *pc = code_->instruction_start() + table_.GetPcOffset(index_);
77
+ SafepointEntry entry = table_.GetEntry(index_);
78
+ FindNextIndex();
79
+ return entry;
80
+ }
81
+
82
+ private:
83
+ void FindNextIndex() {
84
+ ASSERT(index_ < limit_);
85
+ while (++index_ < limit_) {
86
+ if (table_.GetEntry(index_).deoptimization_index() !=
87
+ Safepoint::kNoDeoptimizationIndex) {
88
+ return;
89
+ }
90
+ }
91
+ }
92
+
93
+ Code* code_;
94
+ SafepointTable table_;
95
+ // Index of next deoptimization entry. If negative after calling
96
+ // FindNextIndex, there are no more, and Next will return an invalid
97
+ // SafepointEntry.
98
+ int index_;
99
+ // Table length.
100
+ int limit_;
101
+ };
102
+
103
+
104
+ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
105
+ // TODO(1276): Implement.
106
+ }
107
+
108
+
109
+ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
110
+ HandleScope scope;
111
+ AssertNoAllocation no_allocation;
112
+
113
+ if (!function->IsOptimized()) return;
114
+
115
+ // Get the optimized code.
116
+ Code* code = function->code();
117
+
118
+ // Invalidate the relocation information, as it will become invalid by the
119
+ // code patching below, and is not needed any more.
120
+ code->InvalidateRelocation();
121
+
122
+ // For each return after a safepoint insert a absolute call to the
123
+ // corresponding deoptimization entry, or a short call to an absolute
124
+ // jump if space is short. The absolute jumps are put in a table just
125
+ // before the safepoint table (space was allocated there when the Code
126
+ // object was created, if necessary).
127
+
128
+ Address instruction_start = function->code()->instruction_start();
129
+ Address jump_table_address =
130
+ instruction_start + function->code()->safepoint_table_offset();
131
+ Address previous_pc = instruction_start;
132
+
133
+ SafepointTableDeoptimiztionEntryIterator deoptimizations(function->code());
134
+ Address entry_pc = NULL;
135
+
136
+ SafepointEntry current_entry = deoptimizations.Next(&entry_pc);
137
+ while (current_entry.is_valid()) {
138
+ int gap_code_size = current_entry.gap_code_size();
139
+ unsigned deoptimization_index = current_entry.deoptimization_index();
140
+
141
+ #ifdef DEBUG
142
+ // Destroy the code which is not supposed to run again.
143
+ ZapCodeRange(previous_pc, entry_pc);
144
+ #endif
145
+ // Position where Call will be patched in.
146
+ Address call_address = entry_pc + gap_code_size;
147
+ // End of call instruction, if using a direct call to a 64-bit address.
148
+ Address call_end_address =
149
+ call_address + MacroAssembler::kCallInstructionLength;
150
+
151
+ // Find next deoptimization entry, if any.
152
+ Address next_pc = NULL;
153
+ SafepointEntry next_entry = deoptimizations.Next(&next_pc);
154
+
155
+ if (!next_entry.is_valid() || next_pc >= call_end_address) {
156
+ // Room enough to write a long call instruction.
157
+ CodePatcher patcher(call_address, Assembler::kCallInstructionLength);
158
+ patcher.masm()->Call(GetDeoptimizationEntry(deoptimization_index, LAZY),
159
+ RelocInfo::NONE);
160
+ previous_pc = call_end_address;
161
+ } else {
162
+ // Not room enough for a long Call instruction. Write a short call
163
+ // instruction to a long jump placed elsewhere in the code.
164
+ Address short_call_end_address =
165
+ call_address + MacroAssembler::kShortCallInstructionLength;
166
+ ASSERT(next_pc >= short_call_end_address);
167
+
168
+ // Write jump in jump-table.
169
+ jump_table_address -= MacroAssembler::kJumpInstructionLength;
170
+ CodePatcher jump_patcher(jump_table_address,
171
+ MacroAssembler::kJumpInstructionLength);
172
+ jump_patcher.masm()->Jump(
173
+ GetDeoptimizationEntry(deoptimization_index, LAZY),
174
+ RelocInfo::NONE);
175
+
176
+ // Write call to jump at call_offset.
177
+ CodePatcher call_patcher(call_address,
178
+ MacroAssembler::kShortCallInstructionLength);
179
+ call_patcher.masm()->call(jump_table_address);
180
+ previous_pc = short_call_end_address;
181
+ }
182
+
183
+ // Continue with next deoptimization entry.
184
+ current_entry = next_entry;
185
+ entry_pc = next_pc;
186
+ }
187
+
188
+ #ifdef DEBUG
189
+ // Destroy the code which is not supposed to run again.
190
+ ZapCodeRange(previous_pc, jump_table_address);
191
+ #endif
192
+
193
+ // Add the deoptimizing code to the list.
194
+ DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
195
+ DeoptimizerData* data = code->GetIsolate()->deoptimizer_data();
196
+ node->set_next(data->deoptimizing_code_list_);
197
+ data->deoptimizing_code_list_ = node;
198
+
199
+ // Set the code for the function to non-optimized version.
200
+ function->ReplaceCode(function->shared()->code());
201
+
202
+ if (FLAG_trace_deopt) {
203
+ PrintF("[forced deoptimization: ");
204
+ function->PrintName();
205
+ PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
206
+ #ifdef DEBUG
207
+ if (FLAG_print_code) {
208
+ code->PrintLn();
209
+ }
210
+ #endif
211
+ }
212
+ }
213
+
214
+
215
+ void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
216
+ Code* check_code,
217
+ Code* replacement_code) {
218
+ Address call_target_address = pc_after - kIntSize;
219
+ ASSERT(check_code->entry() ==
220
+ Assembler::target_address_at(call_target_address));
221
+ // The stack check code matches the pattern:
222
+ //
223
+ // cmp rsp, <limit>
224
+ // jae ok
225
+ // call <stack guard>
226
+ // test rax, <loop nesting depth>
227
+ // ok: ...
228
+ //
229
+ // We will patch away the branch so the code is:
230
+ //
231
+ // cmp rsp, <limit> ;; Not changed
232
+ // nop
233
+ // nop
234
+ // call <on-stack replacment>
235
+ // test rax, <loop nesting depth>
236
+ // ok:
237
+ //
238
+ ASSERT(*(call_target_address - 3) == 0x73 && // jae
239
+ *(call_target_address - 2) == 0x07 && // offset
240
+ *(call_target_address - 1) == 0xe8); // call
241
+ *(call_target_address - 3) = 0x90; // nop
242
+ *(call_target_address - 2) = 0x90; // nop
243
+ Assembler::set_target_address_at(call_target_address,
244
+ replacement_code->entry());
245
+ }
246
+
247
+
248
+ void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
249
+ Code* check_code,
250
+ Code* replacement_code) {
251
+ Address call_target_address = pc_after - kIntSize;
252
+ ASSERT(replacement_code->entry() ==
253
+ Assembler::target_address_at(call_target_address));
254
+ // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
255
+ // restore the conditional branch.
256
+ ASSERT(*(call_target_address - 3) == 0x90 && // nop
257
+ *(call_target_address - 2) == 0x90 && // nop
258
+ *(call_target_address - 1) == 0xe8); // call
259
+ *(call_target_address - 3) = 0x73; // jae
260
+ *(call_target_address - 2) = 0x07; // offset
261
+ Assembler::set_target_address_at(call_target_address,
262
+ check_code->entry());
263
+ }
264
+
265
+
266
+ static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
267
+ ByteArray* translations = data->TranslationByteArray();
268
+ int length = data->DeoptCount();
269
+ for (int i = 0; i < length; i++) {
270
+ if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
271
+ TranslationIterator it(translations, data->TranslationIndex(i)->value());
272
+ int value = it.Next();
273
+ ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
274
+ // Read the number of frames.
275
+ value = it.Next();
276
+ if (value == 1) return i;
277
+ }
278
+ }
279
+ UNREACHABLE();
280
+ return -1;
281
+ }
282
+
283
+
284
+ void Deoptimizer::DoComputeOsrOutputFrame() {
285
+ DeoptimizationInputData* data = DeoptimizationInputData::cast(
286
+ optimized_code_->deoptimization_data());
287
+ unsigned ast_id = data->OsrAstId()->value();
288
+ // TODO(kasperl): This should not be the bailout_id_. It should be
289
+ // the ast id. Confusing.
290
+ ASSERT(bailout_id_ == ast_id);
291
+
292
+ int bailout_id = LookupBailoutId(data, ast_id);
293
+ unsigned translation_index = data->TranslationIndex(bailout_id)->value();
294
+ ByteArray* translations = data->TranslationByteArray();
295
+
296
+ TranslationIterator iterator(translations, translation_index);
297
+ Translation::Opcode opcode =
298
+ static_cast<Translation::Opcode>(iterator.Next());
299
+ ASSERT(Translation::BEGIN == opcode);
300
+ USE(opcode);
301
+ int count = iterator.Next();
302
+ ASSERT(count == 1);
303
+ USE(count);
304
+
305
+ opcode = static_cast<Translation::Opcode>(iterator.Next());
306
+ USE(opcode);
307
+ ASSERT(Translation::FRAME == opcode);
308
+ unsigned node_id = iterator.Next();
309
+ USE(node_id);
310
+ ASSERT(node_id == ast_id);
311
+ JSFunction* function = JSFunction::cast(ComputeLiteral(iterator.Next()));
312
+ USE(function);
313
+ ASSERT(function == function_);
314
+ unsigned height = iterator.Next();
315
+ unsigned height_in_bytes = height * kPointerSize;
316
+ USE(height_in_bytes);
317
+
318
+ unsigned fixed_size = ComputeFixedSize(function_);
319
+ unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize());
320
+ ASSERT(fixed_size + height_in_bytes == input_frame_size);
321
+
322
+ unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize;
323
+ unsigned outgoing_height = data->ArgumentsStackHeight(bailout_id)->value();
324
+ unsigned outgoing_size = outgoing_height * kPointerSize;
325
+ unsigned output_frame_size = fixed_size + stack_slot_size + outgoing_size;
326
+ ASSERT(outgoing_size == 0); // OSR does not happen in the middle of a call.
327
+
328
+ if (FLAG_trace_osr) {
329
+ PrintF("[on-stack replacement: begin 0x%08" V8PRIxPTR " ",
330
+ reinterpret_cast<intptr_t>(function_));
331
+ function_->PrintName();
332
+ PrintF(" => node=%u, frame=%d->%d]\n",
333
+ ast_id,
334
+ input_frame_size,
335
+ output_frame_size);
336
+ }
337
+
338
+ // There's only one output frame in the OSR case.
339
+ output_count_ = 1;
340
+ output_ = new FrameDescription*[1];
341
+ output_[0] = new(output_frame_size) FrameDescription(
342
+ output_frame_size, function_);
343
+
344
+ // Clear the incoming parameters in the optimized frame to avoid
345
+ // confusing the garbage collector.
346
+ unsigned output_offset = output_frame_size - kPointerSize;
347
+ int parameter_count = function_->shared()->formal_parameter_count() + 1;
348
+ for (int i = 0; i < parameter_count; ++i) {
349
+ output_[0]->SetFrameSlot(output_offset, 0);
350
+ output_offset -= kPointerSize;
351
+ }
352
+
353
+ // Translate the incoming parameters. This may overwrite some of the
354
+ // incoming argument slots we've just cleared.
355
+ int input_offset = input_frame_size - kPointerSize;
356
+ bool ok = true;
357
+ int limit = input_offset - (parameter_count * kPointerSize);
358
+ while (ok && input_offset > limit) {
359
+ ok = DoOsrTranslateCommand(&iterator, &input_offset);
360
+ }
361
+
362
+ // There are no translation commands for the caller's pc and fp, the
363
+ // context, and the function. Set them up explicitly.
364
+ for (int i = StandardFrameConstants::kCallerPCOffset;
365
+ ok && i >= StandardFrameConstants::kMarkerOffset;
366
+ i -= kPointerSize) {
367
+ intptr_t input_value = input_->GetFrameSlot(input_offset);
368
+ if (FLAG_trace_osr) {
369
+ const char* name = "UNKNOWN";
370
+ switch (i) {
371
+ case StandardFrameConstants::kCallerPCOffset:
372
+ name = "caller's pc";
373
+ break;
374
+ case StandardFrameConstants::kCallerFPOffset:
375
+ name = "fp";
376
+ break;
377
+ case StandardFrameConstants::kContextOffset:
378
+ name = "context";
379
+ break;
380
+ case StandardFrameConstants::kMarkerOffset:
381
+ name = "function";
382
+ break;
383
+ }
384
+ PrintF(" [rsp + %d] <- 0x%08" V8PRIxPTR " ; [rsp + %d] "
385
+ "(fixed part - %s)\n",
386
+ output_offset,
387
+ input_value,
388
+ input_offset,
389
+ name);
390
+ }
391
+ output_[0]->SetFrameSlot(output_offset, input_->GetFrameSlot(input_offset));
392
+ input_offset -= kPointerSize;
393
+ output_offset -= kPointerSize;
394
+ }
395
+
396
+ // Translate the rest of the frame.
397
+ while (ok && input_offset >= 0) {
398
+ ok = DoOsrTranslateCommand(&iterator, &input_offset);
399
+ }
400
+
401
+ // If translation of any command failed, continue using the input frame.
402
+ if (!ok) {
403
+ delete output_[0];
404
+ output_[0] = input_;
405
+ output_[0]->SetPc(reinterpret_cast<intptr_t>(from_));
406
+ } else {
407
+ // Setup the frame pointer and the context pointer.
408
+ output_[0]->SetRegister(rbp.code(), input_->GetRegister(rbp.code()));
409
+ output_[0]->SetRegister(rsi.code(), input_->GetRegister(rsi.code()));
410
+
411
+ unsigned pc_offset = data->OsrPcOffset()->value();
412
+ intptr_t pc = reinterpret_cast<intptr_t>(
413
+ optimized_code_->entry() + pc_offset);
414
+ output_[0]->SetPc(pc);
415
+ }
416
+ Code* continuation =
417
+ function->GetIsolate()->builtins()->builtin(Builtins::kNotifyOSR);
418
+ output_[0]->SetContinuation(
419
+ reinterpret_cast<intptr_t>(continuation->entry()));
420
+
421
+ if (FLAG_trace_osr) {
422
+ PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ",
423
+ ok ? "finished" : "aborted",
424
+ reinterpret_cast<intptr_t>(function));
425
+ function->PrintName();
426
+ PrintF(" => pc=0x%0" V8PRIxPTR "]\n", output_[0]->GetPc());
427
+ }
428
+ }
429
+
430
+
431
+ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
432
+ int frame_index) {
433
+ // Read the ast node id, function, and frame height for this output frame.
434
+ Translation::Opcode opcode =
435
+ static_cast<Translation::Opcode>(iterator->Next());
436
+ USE(opcode);
437
+ ASSERT(Translation::FRAME == opcode);
438
+ int node_id = iterator->Next();
439
+ JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
440
+ unsigned height = iterator->Next();
441
+ unsigned height_in_bytes = height * kPointerSize;
442
+ if (FLAG_trace_deopt) {
443
+ PrintF(" translating ");
444
+ function->PrintName();
445
+ PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes);
446
+ }
447
+
448
+ // The 'fixed' part of the frame consists of the incoming parameters and
449
+ // the part described by JavaScriptFrameConstants.
450
+ unsigned fixed_frame_size = ComputeFixedSize(function);
451
+ unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize());
452
+ unsigned output_frame_size = height_in_bytes + fixed_frame_size;
453
+
454
+ // Allocate and store the output frame description.
455
+ FrameDescription* output_frame =
456
+ new(output_frame_size) FrameDescription(output_frame_size, function);
457
+
458
+ bool is_bottommost = (0 == frame_index);
459
+ bool is_topmost = (output_count_ - 1 == frame_index);
460
+ ASSERT(frame_index >= 0 && frame_index < output_count_);
461
+ ASSERT(output_[frame_index] == NULL);
462
+ output_[frame_index] = output_frame;
463
+
464
+ // The top address for the bottommost output frame can be computed from
465
+ // the input frame pointer and the output frame's height. For all
466
+ // subsequent output frames, it can be computed from the previous one's
467
+ // top address and the current frame's size.
468
+ intptr_t top_address;
469
+ if (is_bottommost) {
470
+ // 2 = context and function in the frame.
471
+ top_address =
472
+ input_->GetRegister(rbp.code()) - (2 * kPointerSize) - height_in_bytes;
473
+ } else {
474
+ top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
475
+ }
476
+ output_frame->SetTop(top_address);
477
+
478
+ // Compute the incoming parameter translation.
479
+ int parameter_count = function->shared()->formal_parameter_count() + 1;
480
+ unsigned output_offset = output_frame_size;
481
+ unsigned input_offset = input_frame_size;
482
+ for (int i = 0; i < parameter_count; ++i) {
483
+ output_offset -= kPointerSize;
484
+ DoTranslateCommand(iterator, frame_index, output_offset);
485
+ }
486
+ input_offset -= (parameter_count * kPointerSize);
487
+
488
+ // There are no translation commands for the caller's pc and fp, the
489
+ // context, and the function. Synthesize their values and set them up
490
+ // explicitly.
491
+ //
492
+ // The caller's pc for the bottommost output frame is the same as in the
493
+ // input frame. For all subsequent output frames, it can be read from the
494
+ // previous one. This frame's pc can be computed from the non-optimized
495
+ // function code and AST id of the bailout.
496
+ output_offset -= kPointerSize;
497
+ input_offset -= kPointerSize;
498
+ intptr_t value;
499
+ if (is_bottommost) {
500
+ value = input_->GetFrameSlot(input_offset);
501
+ } else {
502
+ value = output_[frame_index - 1]->GetPc();
503
+ }
504
+ output_frame->SetFrameSlot(output_offset, value);
505
+ if (FLAG_trace_deopt) {
506
+ PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
507
+ V8PRIxPTR " ; caller's pc\n",
508
+ top_address + output_offset, output_offset, value);
509
+ }
510
+
511
+ // The caller's frame pointer for the bottommost output frame is the same
512
+ // as in the input frame. For all subsequent output frames, it can be
513
+ // read from the previous one. Also compute and set this frame's frame
514
+ // pointer.
515
+ output_offset -= kPointerSize;
516
+ input_offset -= kPointerSize;
517
+ if (is_bottommost) {
518
+ value = input_->GetFrameSlot(input_offset);
519
+ } else {
520
+ value = output_[frame_index - 1]->GetFp();
521
+ }
522
+ output_frame->SetFrameSlot(output_offset, value);
523
+ intptr_t fp_value = top_address + output_offset;
524
+ ASSERT(!is_bottommost || input_->GetRegister(rbp.code()) == fp_value);
525
+ output_frame->SetFp(fp_value);
526
+ if (is_topmost) output_frame->SetRegister(rbp.code(), fp_value);
527
+ if (FLAG_trace_deopt) {
528
+ PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
529
+ V8PRIxPTR " ; caller's fp\n",
530
+ fp_value, output_offset, value);
531
+ }
532
+
533
+ // For the bottommost output frame the context can be gotten from the input
534
+ // frame. For all subsequent output frames it can be gotten from the function
535
+ // so long as we don't inline functions that need local contexts.
536
+ output_offset -= kPointerSize;
537
+ input_offset -= kPointerSize;
538
+ if (is_bottommost) {
539
+ value = input_->GetFrameSlot(input_offset);
540
+ } else {
541
+ value = reinterpret_cast<intptr_t>(function->context());
542
+ }
543
+ output_frame->SetFrameSlot(output_offset, value);
544
+ if (is_topmost) output_frame->SetRegister(rsi.code(), value);
545
+ if (FLAG_trace_deopt) {
546
+ PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
547
+ V8PRIxPTR "; context\n",
548
+ top_address + output_offset, output_offset, value);
549
+ }
550
+
551
+ // The function was mentioned explicitly in the BEGIN_FRAME.
552
+ output_offset -= kPointerSize;
553
+ input_offset -= kPointerSize;
554
+ value = reinterpret_cast<intptr_t>(function);
555
+ // The function for the bottommost output frame should also agree with the
556
+ // input frame.
557
+ ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
558
+ output_frame->SetFrameSlot(output_offset, value);
559
+ if (FLAG_trace_deopt) {
560
+ PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
561
+ V8PRIxPTR "; function\n",
562
+ top_address + output_offset, output_offset, value);
563
+ }
564
+
565
+ // Translate the rest of the frame.
566
+ for (unsigned i = 0; i < height; ++i) {
567
+ output_offset -= kPointerSize;
568
+ DoTranslateCommand(iterator, frame_index, output_offset);
569
+ }
570
+ ASSERT(0 == output_offset);
571
+
572
+ // Compute this frame's PC, state, and continuation.
573
+ Code* non_optimized_code = function->shared()->code();
574
+ FixedArray* raw_data = non_optimized_code->deoptimization_data();
575
+ DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data);
576
+ Address start = non_optimized_code->instruction_start();
577
+ unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
578
+ unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
579
+ intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset);
580
+ output_frame->SetPc(pc_value);
581
+
582
+ FullCodeGenerator::State state =
583
+ FullCodeGenerator::StateField::decode(pc_and_state);
584
+ output_frame->SetState(Smi::FromInt(state));
585
+
586
+ // Set the continuation for the topmost frame.
587
+ if (is_topmost) {
588
+ Code* continuation = (bailout_type_ == EAGER)
589
+ ? isolate_->builtins()->builtin(Builtins::kNotifyDeoptimized)
590
+ : isolate_->builtins()->builtin(Builtins::kNotifyLazyDeoptimized);
591
+ output_frame->SetContinuation(
592
+ reinterpret_cast<intptr_t>(continuation->entry()));
593
+ }
594
+
595
+ if (output_count_ - 1 == frame_index) iterator->Done();
596
+ }
597
+
598
+
599
+ #define __ masm()->
600
+
601
+ void Deoptimizer::EntryGenerator::Generate() {
602
+ GeneratePrologue();
603
+
604
+ // Save all general purpose registers before messing with them.
605
+ const int kNumberOfRegisters = Register::kNumRegisters;
606
+
607
+ const int kDoubleRegsSize = kDoubleSize *
608
+ XMMRegister::kNumAllocatableRegisters;
609
+ __ subq(rsp, Immediate(kDoubleRegsSize));
610
+
611
+ for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
612
+ XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
613
+ int offset = i * kDoubleSize;
614
+ __ movsd(Operand(rsp, offset), xmm_reg);
615
+ }
616
+
617
+ // We push all registers onto the stack, even though we do not need
618
+ // to restore all later.
619
+ for (int i = 0; i < kNumberOfRegisters; i++) {
620
+ Register r = Register::toRegister(i);
621
+ __ push(r);
622
+ }
623
+
624
+ const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize +
625
+ kDoubleRegsSize;
626
+
627
+ // When calling new_deoptimizer_function we need to pass the last argument
628
+ // on the stack on windows and in r8 on linux. The remaining arguments are
629
+ // all passed in registers (different ones on linux and windows though).
630
+
631
+ #ifdef _WIN64
632
+ Register arg4 = r9;
633
+ Register arg3 = r8;
634
+ Register arg2 = rdx;
635
+ Register arg1 = rcx;
636
+ #else
637
+ Register arg4 = rcx;
638
+ Register arg3 = rdx;
639
+ Register arg2 = rsi;
640
+ Register arg1 = rdi;
641
+ #endif
642
+
643
+ // We use this to keep the value of the fifth argument temporarily.
644
+ // Unfortunately we can't store it directly in r8 (used for passing
645
+ // this on linux), since it is another parameter passing register on windows.
646
+ Register arg5 = r11;
647
+
648
+ // Get the bailout id from the stack.
649
+ __ movq(arg3, Operand(rsp, kSavedRegistersAreaSize));
650
+
651
+ // Get the address of the location in the code object if possible
652
+ // and compute the fp-to-sp delta in register arg5.
653
+ if (type() == EAGER) {
654
+ __ Set(arg4, 0);
655
+ __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize));
656
+ } else {
657
+ __ movq(arg4, Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize));
658
+ __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 2 * kPointerSize));
659
+ }
660
+
661
+ __ subq(arg5, rbp);
662
+ __ neg(arg5);
663
+
664
+ // Allocate a new deoptimizer object.
665
+ __ PrepareCallCFunction(6);
666
+ __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
667
+ __ movq(arg1, rax);
668
+ __ Set(arg2, type());
669
+ // Args 3 and 4 are already in the right registers.
670
+
671
+ // On windows put the arguments on the stack (PrepareCallCFunction
672
+ // has created space for this). On linux pass the arguments in r8 and r9.
673
+ #ifdef _WIN64
674
+ __ movq(Operand(rsp, 4 * kPointerSize), arg5);
675
+ __ LoadAddress(arg5, ExternalReference::isolate_address());
676
+ __ movq(Operand(rsp, 5 * kPointerSize), arg5);
677
+ #else
678
+ __ movq(r8, arg5);
679
+ __ LoadAddress(r9, ExternalReference::isolate_address());
680
+ #endif
681
+
682
+ Isolate* isolate = masm()->isolate();
683
+
684
+ __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);
685
+ // Preserve deoptimizer object in register rax and get the input
686
+ // frame descriptor pointer.
687
+ __ movq(rbx, Operand(rax, Deoptimizer::input_offset()));
688
+
689
+ // Fill in the input registers.
690
+ for (int i = kNumberOfRegisters -1; i >= 0; i--) {
691
+ int offset = (i * kPointerSize) + FrameDescription::registers_offset();
692
+ __ pop(Operand(rbx, offset));
693
+ }
694
+
695
+ // Fill in the double input registers.
696
+ int double_regs_offset = FrameDescription::double_registers_offset();
697
+ for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; i++) {
698
+ int dst_offset = i * kDoubleSize + double_regs_offset;
699
+ __ pop(Operand(rbx, dst_offset));
700
+ }
701
+
702
+ // Remove the bailout id from the stack.
703
+ if (type() == EAGER) {
704
+ __ addq(rsp, Immediate(kPointerSize));
705
+ } else {
706
+ __ addq(rsp, Immediate(2 * kPointerSize));
707
+ }
708
+
709
+ // Compute a pointer to the unwinding limit in register rcx; that is
710
+ // the first stack slot not part of the input frame.
711
+ __ movq(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
712
+ __ addq(rcx, rsp);
713
+
714
+ // Unwind the stack down to - but not including - the unwinding
715
+ // limit and copy the contents of the activation frame to the input
716
+ // frame description.
717
+ __ lea(rdx, Operand(rbx, FrameDescription::frame_content_offset()));
718
+ Label pop_loop;
719
+ __ bind(&pop_loop);
720
+ __ pop(Operand(rdx, 0));
721
+ __ addq(rdx, Immediate(sizeof(intptr_t)));
722
+ __ cmpq(rcx, rsp);
723
+ __ j(not_equal, &pop_loop);
724
+
725
+ // Compute the output frame in the deoptimizer.
726
+ __ push(rax);
727
+ __ PrepareCallCFunction(2);
728
+ __ movq(arg1, rax);
729
+ __ LoadAddress(arg2, ExternalReference::isolate_address());
730
+ __ CallCFunction(
731
+ ExternalReference::compute_output_frames_function(isolate), 2);
732
+ __ pop(rax);
733
+
734
+ // Replace the current frame with the output frames.
735
+ Label outer_push_loop, inner_push_loop;
736
+ // Outer loop state: rax = current FrameDescription**, rdx = one past the
737
+ // last FrameDescription**.
738
+ __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset()));
739
+ __ movq(rax, Operand(rax, Deoptimizer::output_offset()));
740
+ __ lea(rdx, Operand(rax, rdx, times_8, 0));
741
+ __ bind(&outer_push_loop);
742
+ // Inner loop state: rbx = current FrameDescription*, rcx = loop index.
743
+ __ movq(rbx, Operand(rax, 0));
744
+ __ movq(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
745
+ __ bind(&inner_push_loop);
746
+ __ subq(rcx, Immediate(sizeof(intptr_t)));
747
+ __ push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
748
+ __ testq(rcx, rcx);
749
+ __ j(not_zero, &inner_push_loop);
750
+ __ addq(rax, Immediate(kPointerSize));
751
+ __ cmpq(rax, rdx);
752
+ __ j(below, &outer_push_loop);
753
+
754
+ // In case of OSR, we have to restore the XMM registers.
755
+ if (type() == OSR) {
756
+ for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
757
+ XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
758
+ int src_offset = i * kDoubleSize + double_regs_offset;
759
+ __ movsd(xmm_reg, Operand(rbx, src_offset));
760
+ }
761
+ }
762
+
763
+ // Push state, pc, and continuation from the last output frame.
764
+ if (type() != OSR) {
765
+ __ push(Operand(rbx, FrameDescription::state_offset()));
766
+ }
767
+ __ push(Operand(rbx, FrameDescription::pc_offset()));
768
+ __ push(Operand(rbx, FrameDescription::continuation_offset()));
769
+
770
+ // Push the registers from the last output frame.
771
+ for (int i = 0; i < kNumberOfRegisters; i++) {
772
+ int offset = (i * kPointerSize) + FrameDescription::registers_offset();
773
+ __ push(Operand(rbx, offset));
774
+ }
775
+
776
+ // Restore the registers from the stack.
777
+ for (int i = kNumberOfRegisters - 1; i >= 0 ; i--) {
778
+ Register r = Register::toRegister(i);
779
+ // Do not restore rsp, simply pop the value into the next register
780
+ // and overwrite this afterwards.
781
+ if (r.is(rsp)) {
782
+ ASSERT(i > 0);
783
+ r = Register::toRegister(i - 1);
784
+ }
785
+ __ pop(r);
786
+ }
787
+
788
+ // Set up the roots register.
789
+ __ InitializeRootRegister();
790
+ __ InitializeSmiConstantRegister();
791
+
792
+ // Return to the continuation point.
793
+ __ ret(0);
794
+ }
795
+
796
+
797
+ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
798
+ // Create a sequence of deoptimization entries.
799
+ Label done;
800
+ for (int i = 0; i < count(); i++) {
801
+ int start = masm()->pc_offset();
802
+ USE(start);
803
+ __ push_imm32(i);
804
+ __ jmp(&done);
805
+ ASSERT(masm()->pc_offset() - start == table_entry_size_);
806
+ }
807
+ __ bind(&done);
808
+ }
809
+
810
+ #undef __
811
+
812
+
813
+ } } // namespace v8::internal
814
+
815
+ #endif // V8_TARGET_ARCH_X64