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,120 @@
1
+ // Copyright 2006-2009 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ // CPU specific code for arm independent of OS goes here.
29
+ #ifdef __arm__
30
+ #include <sys/syscall.h> // for cache flushing.
31
+ #endif
32
+
33
+ #include "v8.h"
34
+
35
+ #if defined(V8_TARGET_ARCH_ARM)
36
+
37
+ #include "cpu.h"
38
+ #include "macro-assembler.h"
39
+ #include "simulator.h" // for cache flushing.
40
+
41
+ namespace v8 {
42
+ namespace internal {
43
+
44
+ void CPU::Setup() {
45
+ CpuFeatures::Probe();
46
+ }
47
+
48
+
49
+ bool CPU::SupportsCrankshaft() {
50
+ return CpuFeatures::IsSupported(VFP3);
51
+ }
52
+
53
+
54
+ void CPU::FlushICache(void* start, size_t size) {
55
+ // Nothing to do flushing no instructions.
56
+ if (size == 0) {
57
+ return;
58
+ }
59
+
60
+ #if defined (USE_SIMULATOR)
61
+ // Not generating ARM instructions for C-code. This means that we are
62
+ // building an ARM emulator based target. We should notify the simulator
63
+ // that the Icache was flushed.
64
+ // None of this code ends up in the snapshot so there are no issues
65
+ // around whether or not to generate the code when building snapshots.
66
+ Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size);
67
+ #else
68
+ // Ideally, we would call
69
+ // syscall(__ARM_NR_cacheflush, start,
70
+ // reinterpret_cast<intptr_t>(start) + size, 0);
71
+ // however, syscall(int, ...) is not supported on all platforms, especially
72
+ // not when using EABI, so we call the __ARM_NR_cacheflush syscall directly.
73
+
74
+ register uint32_t beg asm("a1") = reinterpret_cast<uint32_t>(start);
75
+ register uint32_t end asm("a2") =
76
+ reinterpret_cast<uint32_t>(start) + size;
77
+ register uint32_t flg asm("a3") = 0;
78
+ #if defined (__arm__) && !defined(__thumb__)
79
+ // __arm__ may be defined in thumb mode.
80
+ register uint32_t scno asm("r7") = __ARM_NR_cacheflush;
81
+ asm volatile(
82
+ "svc 0x0"
83
+ : "=r" (beg)
84
+ : "0" (beg), "r" (end), "r" (flg), "r" (scno));
85
+ #else
86
+ // r7 is reserved by the EABI in thumb mode.
87
+ asm volatile(
88
+ "@ Enter ARM Mode \n\t"
89
+ "adr r3, 1f \n\t"
90
+ "bx r3 \n\t"
91
+ ".ALIGN 4 \n\t"
92
+ ".ARM \n"
93
+ "1: push {r7} \n\t"
94
+ "mov r7, %4 \n\t"
95
+ "svc 0x0 \n\t"
96
+ "pop {r7} \n\t"
97
+ "@ Enter THUMB Mode\n\t"
98
+ "adr r3, 2f+1 \n\t"
99
+ "bx r3 \n\t"
100
+ ".THUMB \n"
101
+ "2: \n\t"
102
+ : "=r" (beg)
103
+ : "0" (beg), "r" (end), "r" (flg), "r" (__ARM_NR_cacheflush)
104
+ : "r3");
105
+ #endif
106
+ #endif
107
+ }
108
+
109
+
110
+ void CPU::DebugBreak() {
111
+ #if !defined (__arm__) || !defined(CAN_USE_ARMV5_INSTRUCTIONS)
112
+ UNIMPLEMENTED(); // when building ARM emulator target
113
+ #else
114
+ asm volatile("bkpt 0");
115
+ #endif
116
+ }
117
+
118
+ } } // namespace v8::internal
119
+
120
+ #endif // V8_TARGET_ARCH_ARM
@@ -0,0 +1,317 @@
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_ARM)
31
+
32
+ #include "codegen.h"
33
+ #include "debug.h"
34
+
35
+ namespace v8 {
36
+ namespace internal {
37
+
38
+ #ifdef ENABLE_DEBUGGER_SUPPORT
39
+ bool BreakLocationIterator::IsDebugBreakAtReturn() {
40
+ return Debug::IsDebugBreakAtReturn(rinfo());
41
+ }
42
+
43
+
44
+ void BreakLocationIterator::SetDebugBreakAtReturn() {
45
+ // Patch the code changing the return from JS function sequence from
46
+ // mov sp, fp
47
+ // ldmia sp!, {fp, lr}
48
+ // add sp, sp, #4
49
+ // bx lr
50
+ // to a call to the debug break return code.
51
+ // #if USE_BLX
52
+ // ldr ip, [pc, #0]
53
+ // blx ip
54
+ // #else
55
+ // mov lr, pc
56
+ // ldr pc, [pc, #-4]
57
+ // #endif
58
+ // <debug break return code entry point address>
59
+ // bktp 0
60
+ CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions);
61
+ #ifdef USE_BLX
62
+ patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
63
+ patcher.masm()->blx(v8::internal::ip);
64
+ #else
65
+ patcher.masm()->mov(v8::internal::lr, v8::internal::pc);
66
+ patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4));
67
+ #endif
68
+ patcher.Emit(Isolate::Current()->debug()->debug_break_return()->entry());
69
+ patcher.masm()->bkpt(0);
70
+ }
71
+
72
+
73
+ // Restore the JS frame exit code.
74
+ void BreakLocationIterator::ClearDebugBreakAtReturn() {
75
+ rinfo()->PatchCode(original_rinfo()->pc(),
76
+ Assembler::kJSReturnSequenceInstructions);
77
+ }
78
+
79
+
80
+ // A debug break in the frame exit code is identified by the JS frame exit code
81
+ // having been patched with a call instruction.
82
+ bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
83
+ ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()));
84
+ return rinfo->IsPatchedReturnSequence();
85
+ }
86
+
87
+
88
+ bool BreakLocationIterator::IsDebugBreakAtSlot() {
89
+ ASSERT(IsDebugBreakSlot());
90
+ // Check whether the debug break slot instructions have been patched.
91
+ return rinfo()->IsPatchedDebugBreakSlotSequence();
92
+ }
93
+
94
+
95
+ void BreakLocationIterator::SetDebugBreakAtSlot() {
96
+ ASSERT(IsDebugBreakSlot());
97
+ // Patch the code changing the debug break slot code from
98
+ // mov r2, r2
99
+ // mov r2, r2
100
+ // mov r2, r2
101
+ // to a call to the debug break slot code.
102
+ // #if USE_BLX
103
+ // ldr ip, [pc, #0]
104
+ // blx ip
105
+ // #else
106
+ // mov lr, pc
107
+ // ldr pc, [pc, #-4]
108
+ // #endif
109
+ // <debug break slot code entry point address>
110
+ CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions);
111
+ #ifdef USE_BLX
112
+ patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
113
+ patcher.masm()->blx(v8::internal::ip);
114
+ #else
115
+ patcher.masm()->mov(v8::internal::lr, v8::internal::pc);
116
+ patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4));
117
+ #endif
118
+ patcher.Emit(Isolate::Current()->debug()->debug_break_slot()->entry());
119
+ }
120
+
121
+
122
+ void BreakLocationIterator::ClearDebugBreakAtSlot() {
123
+ ASSERT(IsDebugBreakSlot());
124
+ rinfo()->PatchCode(original_rinfo()->pc(),
125
+ Assembler::kDebugBreakSlotInstructions);
126
+ }
127
+
128
+
129
+ #define __ ACCESS_MASM(masm)
130
+
131
+
132
+ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
133
+ RegList object_regs,
134
+ RegList non_object_regs) {
135
+ __ EnterInternalFrame();
136
+
137
+ // Store the registers containing live values on the expression stack to
138
+ // make sure that these are correctly updated during GC. Non object values
139
+ // are stored as a smi causing it to be untouched by GC.
140
+ ASSERT((object_regs & ~kJSCallerSaved) == 0);
141
+ ASSERT((non_object_regs & ~kJSCallerSaved) == 0);
142
+ ASSERT((object_regs & non_object_regs) == 0);
143
+ if ((object_regs | non_object_regs) != 0) {
144
+ for (int i = 0; i < kNumJSCallerSaved; i++) {
145
+ int r = JSCallerSavedCode(i);
146
+ Register reg = { r };
147
+ if ((non_object_regs & (1 << r)) != 0) {
148
+ if (FLAG_debug_code) {
149
+ __ tst(reg, Operand(0xc0000000));
150
+ __ Assert(eq, "Unable to encode value as smi");
151
+ }
152
+ __ mov(reg, Operand(reg, LSL, kSmiTagSize));
153
+ }
154
+ }
155
+ __ stm(db_w, sp, object_regs | non_object_regs);
156
+ }
157
+
158
+ #ifdef DEBUG
159
+ __ RecordComment("// Calling from debug break to runtime - come in - over");
160
+ #endif
161
+ __ mov(r0, Operand(0, RelocInfo::NONE)); // no arguments
162
+ __ mov(r1, Operand(ExternalReference::debug_break(masm->isolate())));
163
+
164
+ CEntryStub ceb(1);
165
+ __ CallStub(&ceb);
166
+
167
+ // Restore the register values from the expression stack.
168
+ if ((object_regs | non_object_regs) != 0) {
169
+ __ ldm(ia_w, sp, object_regs | non_object_regs);
170
+ for (int i = 0; i < kNumJSCallerSaved; i++) {
171
+ int r = JSCallerSavedCode(i);
172
+ Register reg = { r };
173
+ if ((non_object_regs & (1 << r)) != 0) {
174
+ __ mov(reg, Operand(reg, LSR, kSmiTagSize));
175
+ }
176
+ if (FLAG_debug_code &&
177
+ (((object_regs |non_object_regs) & (1 << r)) == 0)) {
178
+ __ mov(reg, Operand(kDebugZapValue));
179
+ }
180
+ }
181
+ }
182
+
183
+ __ LeaveInternalFrame();
184
+
185
+ // Now that the break point has been handled, resume normal execution by
186
+ // jumping to the target address intended by the caller and that was
187
+ // overwritten by the address of DebugBreakXXX.
188
+ ExternalReference after_break_target =
189
+ ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
190
+ __ mov(ip, Operand(after_break_target));
191
+ __ ldr(ip, MemOperand(ip));
192
+ __ Jump(ip);
193
+ }
194
+
195
+
196
+ void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) {
197
+ // Calling convention for IC load (from ic-arm.cc).
198
+ // ----------- S t a t e -------------
199
+ // -- r2 : name
200
+ // -- lr : return address
201
+ // -- r0 : receiver
202
+ // -- [sp] : receiver
203
+ // -----------------------------------
204
+ // Registers r0 and r2 contain objects that need to be pushed on the
205
+ // expression stack of the fake JS frame.
206
+ Generate_DebugBreakCallHelper(masm, r0.bit() | r2.bit(), 0);
207
+ }
208
+
209
+
210
+ void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) {
211
+ // Calling convention for IC store (from ic-arm.cc).
212
+ // ----------- S t a t e -------------
213
+ // -- r0 : value
214
+ // -- r1 : receiver
215
+ // -- r2 : name
216
+ // -- lr : return address
217
+ // -----------------------------------
218
+ // Registers r0, r1, and r2 contain objects that need to be pushed on the
219
+ // expression stack of the fake JS frame.
220
+ Generate_DebugBreakCallHelper(masm, r0.bit() | r1.bit() | r2.bit(), 0);
221
+ }
222
+
223
+
224
+ void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) {
225
+ // ---------- S t a t e --------------
226
+ // -- lr : return address
227
+ // -- r0 : key
228
+ // -- r1 : receiver
229
+ Generate_DebugBreakCallHelper(masm, r0.bit() | r1.bit(), 0);
230
+ }
231
+
232
+
233
+ void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) {
234
+ // ---------- S t a t e --------------
235
+ // -- r0 : value
236
+ // -- r1 : key
237
+ // -- r2 : receiver
238
+ // -- lr : return address
239
+ Generate_DebugBreakCallHelper(masm, r0.bit() | r1.bit() | r2.bit(), 0);
240
+ }
241
+
242
+
243
+ void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) {
244
+ // Calling convention for IC call (from ic-arm.cc)
245
+ // ----------- S t a t e -------------
246
+ // -- r2 : name
247
+ // -----------------------------------
248
+ Generate_DebugBreakCallHelper(masm, r2.bit(), 0);
249
+ }
250
+
251
+
252
+ void Debug::GenerateConstructCallDebugBreak(MacroAssembler* masm) {
253
+ // Calling convention for construct call (from builtins-arm.cc)
254
+ // -- r0 : number of arguments (not smi)
255
+ // -- r1 : constructor function
256
+ Generate_DebugBreakCallHelper(masm, r1.bit(), r0.bit());
257
+ }
258
+
259
+
260
+ void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) {
261
+ // In places other than IC call sites it is expected that r0 is TOS which
262
+ // is an object - this is not generally the case so this should be used with
263
+ // care.
264
+ Generate_DebugBreakCallHelper(masm, r0.bit(), 0);
265
+ }
266
+
267
+
268
+ void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) {
269
+ // ----------- S t a t e -------------
270
+ // No registers used on entry.
271
+ // -----------------------------------
272
+ Generate_DebugBreakCallHelper(masm, 0, 0);
273
+ }
274
+
275
+
276
+ void Debug::GenerateSlot(MacroAssembler* masm) {
277
+ // Generate enough nop's to make space for a call instruction. Avoid emitting
278
+ // the constant pool in the debug break slot code.
279
+ Assembler::BlockConstPoolScope block_const_pool(masm);
280
+ Label check_codesize;
281
+ __ bind(&check_codesize);
282
+ __ RecordDebugBreakSlot();
283
+ for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
284
+ __ nop(MacroAssembler::DEBUG_BREAK_NOP);
285
+ }
286
+ ASSERT_EQ(Assembler::kDebugBreakSlotInstructions,
287
+ masm->InstructionsGeneratedSince(&check_codesize));
288
+ }
289
+
290
+
291
+ void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) {
292
+ // In the places where a debug break slot is inserted no registers can contain
293
+ // object pointers.
294
+ Generate_DebugBreakCallHelper(masm, 0, 0);
295
+ }
296
+
297
+
298
+ void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
299
+ masm->Abort("LiveEdit frame dropping is not supported on arm");
300
+ }
301
+
302
+
303
+ void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
304
+ masm->Abort("LiveEdit frame dropping is not supported on arm");
305
+ }
306
+
307
+ const bool Debug::kFrameDropperSupported = false;
308
+
309
+ #undef __
310
+
311
+
312
+
313
+ #endif // ENABLE_DEBUGGER_SUPPORT
314
+
315
+ } } // namespace v8::internal
316
+
317
+ #endif // V8_TARGET_ARCH_ARM
@@ -0,0 +1,754 @@
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
+ #include "codegen.h"
31
+ #include "deoptimizer.h"
32
+ #include "full-codegen.h"
33
+ #include "safepoint-table.h"
34
+
35
+ namespace v8 {
36
+ namespace internal {
37
+
38
+ int Deoptimizer::table_entry_size_ = 16;
39
+
40
+
41
+ int Deoptimizer::patch_size() {
42
+ const int kCallInstructionSizeInWords = 3;
43
+ return kCallInstructionSizeInWords * Assembler::kInstrSize;
44
+ }
45
+
46
+
47
+ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
48
+ // Nothing to do. No new relocation information is written for lazy
49
+ // deoptimization on ARM.
50
+ }
51
+
52
+
53
+ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
54
+ HandleScope scope;
55
+ AssertNoAllocation no_allocation;
56
+
57
+ if (!function->IsOptimized()) return;
58
+
59
+ // Get the optimized code.
60
+ Code* code = function->code();
61
+
62
+ // Invalidate the relocation information, as it will become invalid by the
63
+ // code patching below, and is not needed any more.
64
+ code->InvalidateRelocation();
65
+
66
+ // For each return after a safepoint insert an absolute call to the
67
+ // corresponding deoptimization entry.
68
+ ASSERT(patch_size() % Assembler::kInstrSize == 0);
69
+ int call_size_in_words = patch_size() / Assembler::kInstrSize;
70
+ unsigned last_pc_offset = 0;
71
+ SafepointTable table(function->code());
72
+ for (unsigned i = 0; i < table.length(); i++) {
73
+ unsigned pc_offset = table.GetPcOffset(i);
74
+ SafepointEntry safepoint_entry = table.GetEntry(i);
75
+ int deoptimization_index = safepoint_entry.deoptimization_index();
76
+ int gap_code_size = safepoint_entry.gap_code_size();
77
+ // Check that we did not shoot past next safepoint.
78
+ CHECK(pc_offset >= last_pc_offset);
79
+ #ifdef DEBUG
80
+ // Destroy the code which is not supposed to be run again.
81
+ int instructions = (pc_offset - last_pc_offset) / Assembler::kInstrSize;
82
+ CodePatcher destroyer(code->instruction_start() + last_pc_offset,
83
+ instructions);
84
+ for (int x = 0; x < instructions; x++) {
85
+ destroyer.masm()->bkpt(0);
86
+ }
87
+ #endif
88
+ last_pc_offset = pc_offset;
89
+ if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
90
+ last_pc_offset += gap_code_size;
91
+ CodePatcher patcher(code->instruction_start() + last_pc_offset,
92
+ call_size_in_words);
93
+ Address deoptimization_entry = Deoptimizer::GetDeoptimizationEntry(
94
+ deoptimization_index, Deoptimizer::LAZY);
95
+ patcher.masm()->Call(deoptimization_entry, RelocInfo::NONE);
96
+ last_pc_offset += patch_size();
97
+ }
98
+ }
99
+
100
+
101
+ #ifdef DEBUG
102
+ // Destroy the code which is not supposed to be run again.
103
+ int instructions =
104
+ (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize;
105
+ CodePatcher destroyer(code->instruction_start() + last_pc_offset,
106
+ instructions);
107
+ for (int x = 0; x < instructions; x++) {
108
+ destroyer.masm()->bkpt(0);
109
+ }
110
+ #endif
111
+
112
+ // Add the deoptimizing code to the list.
113
+ DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
114
+ DeoptimizerData* data = code->GetIsolate()->deoptimizer_data();
115
+ node->set_next(data->deoptimizing_code_list_);
116
+ data->deoptimizing_code_list_ = node;
117
+
118
+ // Set the code for the function to non-optimized version.
119
+ function->ReplaceCode(function->shared()->code());
120
+
121
+ if (FLAG_trace_deopt) {
122
+ PrintF("[forced deoptimization: ");
123
+ function->PrintName();
124
+ PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
125
+ #ifdef DEBUG
126
+ if (FLAG_print_code) {
127
+ code->PrintLn();
128
+ }
129
+ #endif
130
+ }
131
+ }
132
+
133
+
134
+ void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
135
+ Code* check_code,
136
+ Code* replacement_code) {
137
+ const int kInstrSize = Assembler::kInstrSize;
138
+ // The call of the stack guard check has the following form:
139
+ // e1 5d 00 0c cmp sp, <limit>
140
+ // 2a 00 00 01 bcs ok
141
+ // e5 9f c? ?? ldr ip, [pc, <stack guard address>]
142
+ // e1 2f ff 3c blx ip
143
+ ASSERT(Memory::int32_at(pc_after - kInstrSize) ==
144
+ (al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code()));
145
+ ASSERT(Assembler::IsLdrPcImmediateOffset(
146
+ Assembler::instr_at(pc_after - 2 * kInstrSize)));
147
+
148
+ // We patch the code to the following form:
149
+ // e1 5d 00 0c cmp sp, <limit>
150
+ // e1 a0 00 00 mov r0, r0 (NOP)
151
+ // e5 9f c? ?? ldr ip, [pc, <on-stack replacement address>]
152
+ // e1 2f ff 3c blx ip
153
+ // and overwrite the constant containing the
154
+ // address of the stack check stub.
155
+
156
+ // Replace conditional jump with NOP.
157
+ CodePatcher patcher(pc_after - 3 * kInstrSize, 1);
158
+ patcher.masm()->nop();
159
+
160
+ // Replace the stack check address in the constant pool
161
+ // with the entry address of the replacement code.
162
+ uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
163
+ 2 * kInstrSize) & 0xfff;
164
+ Address stack_check_address_pointer = pc_after + stack_check_address_offset;
165
+ ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
166
+ reinterpret_cast<uint32_t>(check_code->entry()));
167
+ Memory::uint32_at(stack_check_address_pointer) =
168
+ reinterpret_cast<uint32_t>(replacement_code->entry());
169
+ }
170
+
171
+
172
+ void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
173
+ Code* check_code,
174
+ Code* replacement_code) {
175
+ const int kInstrSize = Assembler::kInstrSize;
176
+ ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c);
177
+ ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5);
178
+ ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f);
179
+
180
+ // Replace NOP with conditional jump.
181
+ CodePatcher patcher(pc_after - 3 * kInstrSize, 1);
182
+ patcher.masm()->b(+4, cs);
183
+
184
+ // Replace the stack check address in the constant pool
185
+ // with the entry address of the replacement code.
186
+ uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
187
+ 2 * kInstrSize) & 0xfff;
188
+ Address stack_check_address_pointer = pc_after + stack_check_address_offset;
189
+ ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
190
+ reinterpret_cast<uint32_t>(replacement_code->entry()));
191
+ Memory::uint32_at(stack_check_address_pointer) =
192
+ reinterpret_cast<uint32_t>(check_code->entry());
193
+ }
194
+
195
+
196
+ static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
197
+ ByteArray* translations = data->TranslationByteArray();
198
+ int length = data->DeoptCount();
199
+ for (int i = 0; i < length; i++) {
200
+ if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
201
+ TranslationIterator it(translations, data->TranslationIndex(i)->value());
202
+ int value = it.Next();
203
+ ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
204
+ // Read the number of frames.
205
+ value = it.Next();
206
+ if (value == 1) return i;
207
+ }
208
+ }
209
+ UNREACHABLE();
210
+ return -1;
211
+ }
212
+
213
+
214
+ void Deoptimizer::DoComputeOsrOutputFrame() {
215
+ DeoptimizationInputData* data = DeoptimizationInputData::cast(
216
+ optimized_code_->deoptimization_data());
217
+ unsigned ast_id = data->OsrAstId()->value();
218
+
219
+ int bailout_id = LookupBailoutId(data, ast_id);
220
+ unsigned translation_index = data->TranslationIndex(bailout_id)->value();
221
+ ByteArray* translations = data->TranslationByteArray();
222
+
223
+ TranslationIterator iterator(translations, translation_index);
224
+ Translation::Opcode opcode =
225
+ static_cast<Translation::Opcode>(iterator.Next());
226
+ ASSERT(Translation::BEGIN == opcode);
227
+ USE(opcode);
228
+ int count = iterator.Next();
229
+ ASSERT(count == 1);
230
+ USE(count);
231
+
232
+ opcode = static_cast<Translation::Opcode>(iterator.Next());
233
+ USE(opcode);
234
+ ASSERT(Translation::FRAME == opcode);
235
+ unsigned node_id = iterator.Next();
236
+ USE(node_id);
237
+ ASSERT(node_id == ast_id);
238
+ JSFunction* function = JSFunction::cast(ComputeLiteral(iterator.Next()));
239
+ USE(function);
240
+ ASSERT(function == function_);
241
+ unsigned height = iterator.Next();
242
+ unsigned height_in_bytes = height * kPointerSize;
243
+ USE(height_in_bytes);
244
+
245
+ unsigned fixed_size = ComputeFixedSize(function_);
246
+ unsigned input_frame_size = input_->GetFrameSize();
247
+ ASSERT(fixed_size + height_in_bytes == input_frame_size);
248
+
249
+ unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize;
250
+ unsigned outgoing_height = data->ArgumentsStackHeight(bailout_id)->value();
251
+ unsigned outgoing_size = outgoing_height * kPointerSize;
252
+ unsigned output_frame_size = fixed_size + stack_slot_size + outgoing_size;
253
+ ASSERT(outgoing_size == 0); // OSR does not happen in the middle of a call.
254
+
255
+ if (FLAG_trace_osr) {
256
+ PrintF("[on-stack replacement: begin 0x%08" V8PRIxPTR " ",
257
+ reinterpret_cast<intptr_t>(function_));
258
+ function_->PrintName();
259
+ PrintF(" => node=%u, frame=%d->%d]\n",
260
+ ast_id,
261
+ input_frame_size,
262
+ output_frame_size);
263
+ }
264
+
265
+ // There's only one output frame in the OSR case.
266
+ output_count_ = 1;
267
+ output_ = new FrameDescription*[1];
268
+ output_[0] = new(output_frame_size) FrameDescription(
269
+ output_frame_size, function_);
270
+
271
+ // Clear the incoming parameters in the optimized frame to avoid
272
+ // confusing the garbage collector.
273
+ unsigned output_offset = output_frame_size - kPointerSize;
274
+ int parameter_count = function_->shared()->formal_parameter_count() + 1;
275
+ for (int i = 0; i < parameter_count; ++i) {
276
+ output_[0]->SetFrameSlot(output_offset, 0);
277
+ output_offset -= kPointerSize;
278
+ }
279
+
280
+ // Translate the incoming parameters. This may overwrite some of the
281
+ // incoming argument slots we've just cleared.
282
+ int input_offset = input_frame_size - kPointerSize;
283
+ bool ok = true;
284
+ int limit = input_offset - (parameter_count * kPointerSize);
285
+ while (ok && input_offset > limit) {
286
+ ok = DoOsrTranslateCommand(&iterator, &input_offset);
287
+ }
288
+
289
+ // There are no translation commands for the caller's pc and fp, the
290
+ // context, and the function. Set them up explicitly.
291
+ for (int i = StandardFrameConstants::kCallerPCOffset;
292
+ ok && i >= StandardFrameConstants::kMarkerOffset;
293
+ i -= kPointerSize) {
294
+ uint32_t input_value = input_->GetFrameSlot(input_offset);
295
+ if (FLAG_trace_osr) {
296
+ const char* name = "UNKNOWN";
297
+ switch (i) {
298
+ case StandardFrameConstants::kCallerPCOffset:
299
+ name = "caller's pc";
300
+ break;
301
+ case StandardFrameConstants::kCallerFPOffset:
302
+ name = "fp";
303
+ break;
304
+ case StandardFrameConstants::kContextOffset:
305
+ name = "context";
306
+ break;
307
+ case StandardFrameConstants::kMarkerOffset:
308
+ name = "function";
309
+ break;
310
+ }
311
+ PrintF(" [sp + %d] <- 0x%08x ; [sp + %d] (fixed part - %s)\n",
312
+ output_offset,
313
+ input_value,
314
+ input_offset,
315
+ name);
316
+ }
317
+
318
+ output_[0]->SetFrameSlot(output_offset, input_->GetFrameSlot(input_offset));
319
+ input_offset -= kPointerSize;
320
+ output_offset -= kPointerSize;
321
+ }
322
+
323
+ // Translate the rest of the frame.
324
+ while (ok && input_offset >= 0) {
325
+ ok = DoOsrTranslateCommand(&iterator, &input_offset);
326
+ }
327
+
328
+ // If translation of any command failed, continue using the input frame.
329
+ if (!ok) {
330
+ delete output_[0];
331
+ output_[0] = input_;
332
+ output_[0]->SetPc(reinterpret_cast<uint32_t>(from_));
333
+ } else {
334
+ // Setup the frame pointer and the context pointer.
335
+ output_[0]->SetRegister(fp.code(), input_->GetRegister(fp.code()));
336
+ output_[0]->SetRegister(cp.code(), input_->GetRegister(cp.code()));
337
+
338
+ unsigned pc_offset = data->OsrPcOffset()->value();
339
+ uint32_t pc = reinterpret_cast<uint32_t>(
340
+ optimized_code_->entry() + pc_offset);
341
+ output_[0]->SetPc(pc);
342
+ }
343
+ Code* continuation = isolate_->builtins()->builtin(Builtins::kNotifyOSR);
344
+ output_[0]->SetContinuation(
345
+ reinterpret_cast<uint32_t>(continuation->entry()));
346
+
347
+ if (FLAG_trace_osr) {
348
+ PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ",
349
+ ok ? "finished" : "aborted",
350
+ reinterpret_cast<intptr_t>(function));
351
+ function->PrintName();
352
+ PrintF(" => pc=0x%0x]\n", output_[0]->GetPc());
353
+ }
354
+ }
355
+
356
+
357
+ // This code is very similar to ia32 code, but relies on register names (fp, sp)
358
+ // and how the frame is laid out.
359
+ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
360
+ int frame_index) {
361
+ // Read the ast node id, function, and frame height for this output frame.
362
+ Translation::Opcode opcode =
363
+ static_cast<Translation::Opcode>(iterator->Next());
364
+ USE(opcode);
365
+ ASSERT(Translation::FRAME == opcode);
366
+ int node_id = iterator->Next();
367
+ JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
368
+ unsigned height = iterator->Next();
369
+ unsigned height_in_bytes = height * kPointerSize;
370
+ if (FLAG_trace_deopt) {
371
+ PrintF(" translating ");
372
+ function->PrintName();
373
+ PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes);
374
+ }
375
+
376
+ // The 'fixed' part of the frame consists of the incoming parameters and
377
+ // the part described by JavaScriptFrameConstants.
378
+ unsigned fixed_frame_size = ComputeFixedSize(function);
379
+ unsigned input_frame_size = input_->GetFrameSize();
380
+ unsigned output_frame_size = height_in_bytes + fixed_frame_size;
381
+
382
+ // Allocate and store the output frame description.
383
+ FrameDescription* output_frame =
384
+ new(output_frame_size) FrameDescription(output_frame_size, function);
385
+
386
+ bool is_bottommost = (0 == frame_index);
387
+ bool is_topmost = (output_count_ - 1 == frame_index);
388
+ ASSERT(frame_index >= 0 && frame_index < output_count_);
389
+ ASSERT(output_[frame_index] == NULL);
390
+ output_[frame_index] = output_frame;
391
+
392
+ // The top address for the bottommost output frame can be computed from
393
+ // the input frame pointer and the output frame's height. For all
394
+ // subsequent output frames, it can be computed from the previous one's
395
+ // top address and the current frame's size.
396
+ uint32_t top_address;
397
+ if (is_bottommost) {
398
+ // 2 = context and function in the frame.
399
+ top_address =
400
+ input_->GetRegister(fp.code()) - (2 * kPointerSize) - height_in_bytes;
401
+ } else {
402
+ top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
403
+ }
404
+ output_frame->SetTop(top_address);
405
+
406
+ // Compute the incoming parameter translation.
407
+ int parameter_count = function->shared()->formal_parameter_count() + 1;
408
+ unsigned output_offset = output_frame_size;
409
+ unsigned input_offset = input_frame_size;
410
+ for (int i = 0; i < parameter_count; ++i) {
411
+ output_offset -= kPointerSize;
412
+ DoTranslateCommand(iterator, frame_index, output_offset);
413
+ }
414
+ input_offset -= (parameter_count * kPointerSize);
415
+
416
+ // There are no translation commands for the caller's pc and fp, the
417
+ // context, and the function. Synthesize their values and set them up
418
+ // explicitly.
419
+ //
420
+ // The caller's pc for the bottommost output frame is the same as in the
421
+ // input frame. For all subsequent output frames, it can be read from the
422
+ // previous one. This frame's pc can be computed from the non-optimized
423
+ // function code and AST id of the bailout.
424
+ output_offset -= kPointerSize;
425
+ input_offset -= kPointerSize;
426
+ intptr_t value;
427
+ if (is_bottommost) {
428
+ value = input_->GetFrameSlot(input_offset);
429
+ } else {
430
+ value = output_[frame_index - 1]->GetPc();
431
+ }
432
+ output_frame->SetFrameSlot(output_offset, value);
433
+ if (FLAG_trace_deopt) {
434
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n",
435
+ top_address + output_offset, output_offset, value);
436
+ }
437
+
438
+ // The caller's frame pointer for the bottommost output frame is the same
439
+ // as in the input frame. For all subsequent output frames, it can be
440
+ // read from the previous one. Also compute and set this frame's frame
441
+ // pointer.
442
+ output_offset -= kPointerSize;
443
+ input_offset -= kPointerSize;
444
+ if (is_bottommost) {
445
+ value = input_->GetFrameSlot(input_offset);
446
+ } else {
447
+ value = output_[frame_index - 1]->GetFp();
448
+ }
449
+ output_frame->SetFrameSlot(output_offset, value);
450
+ intptr_t fp_value = top_address + output_offset;
451
+ ASSERT(!is_bottommost || input_->GetRegister(fp.code()) == fp_value);
452
+ output_frame->SetFp(fp_value);
453
+ if (is_topmost) {
454
+ output_frame->SetRegister(fp.code(), fp_value);
455
+ }
456
+ if (FLAG_trace_deopt) {
457
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
458
+ fp_value, output_offset, value);
459
+ }
460
+
461
+ // For the bottommost output frame the context can be gotten from the input
462
+ // frame. For all subsequent output frames it can be gotten from the function
463
+ // so long as we don't inline functions that need local contexts.
464
+ output_offset -= kPointerSize;
465
+ input_offset -= kPointerSize;
466
+ if (is_bottommost) {
467
+ value = input_->GetFrameSlot(input_offset);
468
+ } else {
469
+ value = reinterpret_cast<intptr_t>(function->context());
470
+ }
471
+ output_frame->SetFrameSlot(output_offset, value);
472
+ if (is_topmost) {
473
+ output_frame->SetRegister(cp.code(), value);
474
+ }
475
+ if (FLAG_trace_deopt) {
476
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
477
+ top_address + output_offset, output_offset, value);
478
+ }
479
+
480
+ // The function was mentioned explicitly in the BEGIN_FRAME.
481
+ output_offset -= kPointerSize;
482
+ input_offset -= kPointerSize;
483
+ value = reinterpret_cast<uint32_t>(function);
484
+ // The function for the bottommost output frame should also agree with the
485
+ // input frame.
486
+ ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
487
+ output_frame->SetFrameSlot(output_offset, value);
488
+ if (FLAG_trace_deopt) {
489
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function\n",
490
+ top_address + output_offset, output_offset, value);
491
+ }
492
+
493
+ // Translate the rest of the frame.
494
+ for (unsigned i = 0; i < height; ++i) {
495
+ output_offset -= kPointerSize;
496
+ DoTranslateCommand(iterator, frame_index, output_offset);
497
+ }
498
+ ASSERT(0 == output_offset);
499
+
500
+ // Compute this frame's PC, state, and continuation.
501
+ Code* non_optimized_code = function->shared()->code();
502
+ FixedArray* raw_data = non_optimized_code->deoptimization_data();
503
+ DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data);
504
+ Address start = non_optimized_code->instruction_start();
505
+ unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
506
+ unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
507
+ uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset);
508
+ output_frame->SetPc(pc_value);
509
+ if (is_topmost) {
510
+ output_frame->SetRegister(pc.code(), pc_value);
511
+ }
512
+
513
+ FullCodeGenerator::State state =
514
+ FullCodeGenerator::StateField::decode(pc_and_state);
515
+ output_frame->SetState(Smi::FromInt(state));
516
+
517
+
518
+ // Set the continuation for the topmost frame.
519
+ if (is_topmost) {
520
+ Builtins* builtins = isolate_->builtins();
521
+ Code* continuation = (bailout_type_ == EAGER)
522
+ ? builtins->builtin(Builtins::kNotifyDeoptimized)
523
+ : builtins->builtin(Builtins::kNotifyLazyDeoptimized);
524
+ output_frame->SetContinuation(
525
+ reinterpret_cast<uint32_t>(continuation->entry()));
526
+ }
527
+
528
+ if (output_count_ - 1 == frame_index) iterator->Done();
529
+ }
530
+
531
+
532
+ #define __ masm()->
533
+
534
+
535
+ // This code tries to be close to ia32 code so that any changes can be
536
+ // easily ported.
537
+ void Deoptimizer::EntryGenerator::Generate() {
538
+ GeneratePrologue();
539
+
540
+ Isolate* isolate = masm()->isolate();
541
+
542
+ CpuFeatures::Scope scope(VFP3);
543
+ // Save all general purpose registers before messing with them.
544
+ const int kNumberOfRegisters = Register::kNumRegisters;
545
+
546
+ // Everything but pc, lr and ip which will be saved but not restored.
547
+ RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit();
548
+
549
+ const int kDoubleRegsSize =
550
+ kDoubleSize * DwVfpRegister::kNumAllocatableRegisters;
551
+
552
+ // Save all VFP registers before messing with them.
553
+ DwVfpRegister first = DwVfpRegister::FromAllocationIndex(0);
554
+ DwVfpRegister last =
555
+ DwVfpRegister::FromAllocationIndex(
556
+ DwVfpRegister::kNumAllocatableRegisters - 1);
557
+ ASSERT(last.code() > first.code());
558
+ ASSERT((last.code() - first.code()) ==
559
+ (DwVfpRegister::kNumAllocatableRegisters - 1));
560
+ #ifdef DEBUG
561
+ for (int i = 0; i <= (DwVfpRegister::kNumAllocatableRegisters - 1); i++) {
562
+ ASSERT((DwVfpRegister::FromAllocationIndex(i).code() <= last.code()) &&
563
+ (DwVfpRegister::FromAllocationIndex(i).code() >= first.code()));
564
+ }
565
+ #endif
566
+ __ vstm(db_w, sp, first, last);
567
+
568
+ // Push all 16 registers (needed to populate FrameDescription::registers_).
569
+ __ stm(db_w, sp, restored_regs | sp.bit() | lr.bit() | pc.bit());
570
+
571
+ const int kSavedRegistersAreaSize =
572
+ (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize;
573
+
574
+ // Get the bailout id from the stack.
575
+ __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize));
576
+
577
+ // Get the address of the location in the code object if possible (r3) (return
578
+ // address for lazy deoptimization) and compute the fp-to-sp delta in
579
+ // register r4.
580
+ if (type() == EAGER) {
581
+ __ mov(r3, Operand(0));
582
+ // Correct one word for bailout id.
583
+ __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
584
+ } else if (type() == OSR) {
585
+ __ mov(r3, lr);
586
+ // Correct one word for bailout id.
587
+ __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
588
+ } else {
589
+ __ mov(r3, lr);
590
+ // Correct two words for bailout id and return address.
591
+ __ add(r4, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize)));
592
+ }
593
+ __ sub(r4, fp, r4);
594
+
595
+ // Allocate a new deoptimizer object.
596
+ // Pass four arguments in r0 to r3 and fifth argument on stack.
597
+ __ PrepareCallCFunction(6, r5);
598
+ __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
599
+ __ mov(r1, Operand(type())); // bailout type,
600
+ // r2: bailout id already loaded.
601
+ // r3: code address or 0 already loaded.
602
+ __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta.
603
+ __ mov(r5, Operand(ExternalReference::isolate_address()));
604
+ __ str(r5, MemOperand(sp, 1 * kPointerSize)); // Isolate.
605
+ // Call Deoptimizer::New().
606
+ __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);
607
+
608
+ // Preserve "deoptimizer" object in register r0 and get the input
609
+ // frame descriptor pointer to r1 (deoptimizer->input_);
610
+ __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset()));
611
+
612
+ // Copy core registers into FrameDescription::registers_[kNumRegisters].
613
+ ASSERT(Register::kNumRegisters == kNumberOfRegisters);
614
+ ASSERT(kNumberOfRegisters % 2 == 0);
615
+
616
+ Label arm_loop;
617
+ __ add(r6, r1, Operand(FrameDescription::registers_offset()));
618
+ __ mov(r5, Operand(sp));
619
+ __ mov(r4, Operand(kNumberOfRegisters / 2));
620
+
621
+ __ bind(&arm_loop);
622
+ __ Ldrd(r2, r3, MemOperand(r5, kPointerSize * 2, PostIndex));
623
+ __ sub(r4, r4, Operand(1), SetCC);
624
+ __ Strd(r2, r3, MemOperand(r6, kPointerSize * 2, PostIndex));
625
+ __ b(gt, &arm_loop);
626
+
627
+ // Copy VFP registers to
628
+ // double_registers_[DoubleRegister::kNumAllocatableRegisters]
629
+ Label vfp_loop;
630
+ __ add(r6, r1, Operand(FrameDescription::double_registers_offset()));
631
+ __ mov(r4, Operand(DwVfpRegister::kNumAllocatableRegisters));
632
+
633
+ __ bind(&vfp_loop);
634
+ __ Ldrd(r2, r3, MemOperand(r5, kDoubleSize, PostIndex));
635
+ __ sub(r4, r4, Operand(1), SetCC);
636
+ __ Strd(r2, r3, MemOperand(r6, kDoubleSize, PostIndex));
637
+ __ b(gt, &vfp_loop);
638
+
639
+ // Remove the bailout id, eventually return address, and the saved registers
640
+ // from the stack.
641
+ if (type() == EAGER || type() == OSR) {
642
+ __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
643
+ } else {
644
+ __ add(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize)));
645
+ }
646
+
647
+ // Compute a pointer to the unwinding limit in register r2; that is
648
+ // the first stack slot not part of the input frame.
649
+ __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset()));
650
+ __ add(r2, r2, sp);
651
+
652
+ // Unwind the stack down to - but not including - the unwinding
653
+ // limit and copy the contents of the activation frame to the input
654
+ // frame description.
655
+ __ add(r3, r1, Operand(FrameDescription::frame_content_offset()));
656
+ Label pop_loop;
657
+ __ bind(&pop_loop);
658
+ __ pop(r4);
659
+ __ str(r4, MemOperand(r3, 0));
660
+ __ add(r3, r3, Operand(sizeof(uint32_t)));
661
+ __ cmp(r2, sp);
662
+ __ b(ne, &pop_loop);
663
+
664
+ // Compute the output frame in the deoptimizer.
665
+ __ push(r0); // Preserve deoptimizer object across call.
666
+ // r0: deoptimizer object; r1: scratch.
667
+ __ PrepareCallCFunction(1, r1);
668
+ // Call Deoptimizer::ComputeOutputFrames().
669
+ __ CallCFunction(
670
+ ExternalReference::compute_output_frames_function(isolate), 1);
671
+ __ pop(r0); // Restore deoptimizer object (class Deoptimizer).
672
+
673
+ // Replace the current (input) frame with the output frames.
674
+ Label outer_push_loop, inner_push_loop;
675
+ // Outer loop state: r0 = current "FrameDescription** output_",
676
+ // r1 = one past the last FrameDescription**.
677
+ __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset()));
678
+ __ ldr(r0, MemOperand(r0, Deoptimizer::output_offset())); // r0 is output_.
679
+ __ add(r1, r0, Operand(r1, LSL, 2));
680
+ __ bind(&outer_push_loop);
681
+ // Inner loop state: r2 = current FrameDescription*, r3 = loop index.
682
+ __ ldr(r2, MemOperand(r0, 0)); // output_[ix]
683
+ __ ldr(r3, MemOperand(r2, FrameDescription::frame_size_offset()));
684
+ __ bind(&inner_push_loop);
685
+ __ sub(r3, r3, Operand(sizeof(uint32_t)));
686
+ // __ add(r6, r2, Operand(r3, LSL, 1));
687
+ __ add(r6, r2, Operand(r3));
688
+ __ ldr(r7, MemOperand(r6, FrameDescription::frame_content_offset()));
689
+ __ push(r7);
690
+ __ cmp(r3, Operand(0));
691
+ __ b(ne, &inner_push_loop); // test for gt?
692
+ __ add(r0, r0, Operand(kPointerSize));
693
+ __ cmp(r0, r1);
694
+ __ b(lt, &outer_push_loop);
695
+
696
+ // Push state, pc, and continuation from the last output frame.
697
+ if (type() != OSR) {
698
+ __ ldr(r6, MemOperand(r2, FrameDescription::state_offset()));
699
+ __ push(r6);
700
+ }
701
+
702
+ __ ldr(r6, MemOperand(r2, FrameDescription::pc_offset()));
703
+ __ push(r6);
704
+ __ ldr(r6, MemOperand(r2, FrameDescription::continuation_offset()));
705
+ __ push(r6);
706
+
707
+ // Push the registers from the last output frame.
708
+ for (int i = kNumberOfRegisters - 1; i >= 0; i--) {
709
+ int offset = (i * kPointerSize) + FrameDescription::registers_offset();
710
+ __ ldr(r6, MemOperand(r2, offset));
711
+ __ push(r6);
712
+ }
713
+
714
+ // Restore the registers from the stack.
715
+ __ ldm(ia_w, sp, restored_regs); // all but pc registers.
716
+ __ pop(ip); // remove sp
717
+ __ pop(ip); // remove lr
718
+
719
+ // Set up the roots register.
720
+ ExternalReference roots_address = ExternalReference::roots_address(isolate);
721
+ __ mov(r10, Operand(roots_address));
722
+
723
+ __ pop(ip); // remove pc
724
+ __ pop(r7); // get continuation, leave pc on stack
725
+ __ pop(lr);
726
+ __ Jump(r7);
727
+ __ stop("Unreachable.");
728
+ }
729
+
730
+
731
+ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
732
+ // Create a sequence of deoptimization entries. Note that any
733
+ // registers may be still live.
734
+ Label done;
735
+ for (int i = 0; i < count(); i++) {
736
+ int start = masm()->pc_offset();
737
+ USE(start);
738
+ if (type() == EAGER) {
739
+ __ nop();
740
+ } else {
741
+ // Emulate ia32 like call by pushing return address to stack.
742
+ __ push(lr);
743
+ }
744
+ __ mov(ip, Operand(i));
745
+ __ push(ip);
746
+ __ b(&done);
747
+ ASSERT(masm()->pc_offset() - start == table_entry_size_);
748
+ }
749
+ __ bind(&done);
750
+ }
751
+
752
+ #undef __
753
+
754
+ } } // namespace v8::internal