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,1207 @@
1
+ // Copyright (c) 1994-2006 Sun Microsystems Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // - Redistributions of source code must retain the above copyright notice,
9
+ // this list of conditions and the following disclaimer.
10
+ //
11
+ // - Redistribution in binary form must reproduce the above copyright
12
+ // notice, this list of conditions and the following disclaimer in the
13
+ // documentation and/or other materials provided with the distribution.
14
+ //
15
+ // - Neither the name of Sun Microsystems or the names of contributors may
16
+ // be used to endorse or promote products derived from this software without
17
+ // specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // The original source code covered by the above license above has been
32
+ // modified significantly by Google Inc.
33
+ // Copyright 2011 the V8 project authors. All rights reserved.
34
+
35
+ #include "v8.h"
36
+
37
+ #include "arguments.h"
38
+ #include "deoptimizer.h"
39
+ #include "execution.h"
40
+ #include "ic-inl.h"
41
+ #include "factory.h"
42
+ #include "runtime.h"
43
+ #include "runtime-profiler.h"
44
+ #include "serialize.h"
45
+ #include "stub-cache.h"
46
+ #include "regexp-stack.h"
47
+ #include "ast.h"
48
+ #include "regexp-macro-assembler.h"
49
+ #include "platform.h"
50
+ // Include native regexp-macro-assembler.
51
+ #ifndef V8_INTERPRETED_REGEXP
52
+ #if V8_TARGET_ARCH_IA32
53
+ #include "ia32/regexp-macro-assembler-ia32.h"
54
+ #elif V8_TARGET_ARCH_X64
55
+ #include "x64/regexp-macro-assembler-x64.h"
56
+ #elif V8_TARGET_ARCH_ARM
57
+ #include "arm/regexp-macro-assembler-arm.h"
58
+ #elif V8_TARGET_ARCH_MIPS
59
+ #include "mips/regexp-macro-assembler-mips.h"
60
+ #else // Unknown architecture.
61
+ #error "Unknown architecture."
62
+ #endif // Target architecture.
63
+ #endif // V8_INTERPRETED_REGEXP
64
+
65
+ namespace v8 {
66
+ namespace internal {
67
+
68
+
69
+ const double DoubleConstant::min_int = kMinInt;
70
+ const double DoubleConstant::one_half = 0.5;
71
+ const double DoubleConstant::minus_zero = -0.0;
72
+ const double DoubleConstant::uint8_max_value = 255;
73
+ const double DoubleConstant::zero = 0.0;
74
+ const double DoubleConstant::nan = OS::nan_value();
75
+ const double DoubleConstant::negative_infinity = -V8_INFINITY;
76
+ const char* RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
77
+
78
+ // -----------------------------------------------------------------------------
79
+ // Implementation of AssemblerBase
80
+
81
+ AssemblerBase::AssemblerBase(Isolate* isolate)
82
+ : isolate_(isolate),
83
+ jit_cookie_(0) {
84
+ if (FLAG_mask_constants_with_cookie && isolate != NULL) {
85
+ jit_cookie_ = V8::RandomPrivate(isolate);
86
+ }
87
+ }
88
+
89
+
90
+ // -----------------------------------------------------------------------------
91
+ // Implementation of Label
92
+
93
+ int Label::pos() const {
94
+ if (pos_ < 0) return -pos_ - 1;
95
+ if (pos_ > 0) return pos_ - 1;
96
+ UNREACHABLE();
97
+ return 0;
98
+ }
99
+
100
+
101
+ // -----------------------------------------------------------------------------
102
+ // Implementation of RelocInfoWriter and RelocIterator
103
+ //
104
+ // Relocation information is written backwards in memory, from high addresses
105
+ // towards low addresses, byte by byte. Therefore, in the encodings listed
106
+ // below, the first byte listed it at the highest address, and successive
107
+ // bytes in the record are at progressively lower addresses.
108
+ //
109
+ // Encoding
110
+ //
111
+ // The most common modes are given single-byte encodings. Also, it is
112
+ // easy to identify the type of reloc info and skip unwanted modes in
113
+ // an iteration.
114
+ //
115
+ // The encoding relies on the fact that there are fewer than 14
116
+ // different non-compactly encoded relocation modes.
117
+ //
118
+ // The first byte of a relocation record has a tag in its low 2 bits:
119
+ // Here are the record schemes, depending on the low tag and optional higher
120
+ // tags.
121
+ //
122
+ // Low tag:
123
+ // 00: embedded_object: [6-bit pc delta] 00
124
+ //
125
+ // 01: code_target: [6-bit pc delta] 01
126
+ //
127
+ // 10: short_data_record: [6-bit pc delta] 10 followed by
128
+ // [6-bit data delta] [2-bit data type tag]
129
+ //
130
+ // 11: long_record [2-bit high tag][4 bit middle_tag] 11
131
+ // followed by variable data depending on type.
132
+ //
133
+ // 2-bit data type tags, used in short_data_record and data_jump long_record:
134
+ // code_target_with_id: 00
135
+ // position: 01
136
+ // statement_position: 10
137
+ // comment: 11 (not used in short_data_record)
138
+ //
139
+ // Long record format:
140
+ // 4-bit middle_tag:
141
+ // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2
142
+ // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM,
143
+ // and is between 0000 and 1100)
144
+ // The format is:
145
+ // 00 [4 bit middle_tag] 11 followed by
146
+ // 00 [6 bit pc delta]
147
+ //
148
+ // 1101: not used (would allow one more relocation mode to be added)
149
+ // 1110: long_data_record
150
+ // The format is: [2-bit data_type_tag] 1110 11
151
+ // signed intptr_t, lowest byte written first
152
+ // (except data_type code_target_with_id, which
153
+ // is followed by a signed int, not intptr_t.)
154
+ //
155
+ // 1111: long_pc_jump
156
+ // The format is:
157
+ // pc-jump: 00 1111 11,
158
+ // 00 [6 bits pc delta]
159
+ // or
160
+ // pc-jump (variable length):
161
+ // 01 1111 11,
162
+ // [7 bits data] 0
163
+ // ...
164
+ // [7 bits data] 1
165
+ // (Bits 6..31 of pc delta, with leading zeroes
166
+ // dropped, and last non-zero chunk tagged with 1.)
167
+
168
+
169
+ const int kMaxRelocModes = 14;
170
+
171
+ const int kTagBits = 2;
172
+ const int kTagMask = (1 << kTagBits) - 1;
173
+ const int kExtraTagBits = 4;
174
+ const int kLocatableTypeTagBits = 2;
175
+ const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits;
176
+
177
+ const int kEmbeddedObjectTag = 0;
178
+ const int kCodeTargetTag = 1;
179
+ const int kLocatableTag = 2;
180
+ const int kDefaultTag = 3;
181
+
182
+ const int kPCJumpExtraTag = (1 << kExtraTagBits) - 1;
183
+
184
+ const int kSmallPCDeltaBits = kBitsPerByte - kTagBits;
185
+ const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1;
186
+ const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask;
187
+
188
+ const int kVariableLengthPCJumpTopTag = 1;
189
+ const int kChunkBits = 7;
190
+ const int kChunkMask = (1 << kChunkBits) - 1;
191
+ const int kLastChunkTagBits = 1;
192
+ const int kLastChunkTagMask = 1;
193
+ const int kLastChunkTag = 1;
194
+
195
+
196
+ const int kDataJumpExtraTag = kPCJumpExtraTag - 1;
197
+
198
+ const int kCodeWithIdTag = 0;
199
+ const int kNonstatementPositionTag = 1;
200
+ const int kStatementPositionTag = 2;
201
+ const int kCommentTag = 3;
202
+
203
+
204
+ uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) {
205
+ // Return if the pc_delta can fit in kSmallPCDeltaBits bits.
206
+ // Otherwise write a variable length PC jump for the bits that do
207
+ // not fit in the kSmallPCDeltaBits bits.
208
+ if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta;
209
+ WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag);
210
+ uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits;
211
+ ASSERT(pc_jump > 0);
212
+ // Write kChunkBits size chunks of the pc_jump.
213
+ for (; pc_jump > 0; pc_jump = pc_jump >> kChunkBits) {
214
+ byte b = pc_jump & kChunkMask;
215
+ *--pos_ = b << kLastChunkTagBits;
216
+ }
217
+ // Tag the last chunk so it can be identified.
218
+ *pos_ = *pos_ | kLastChunkTag;
219
+ // Return the remaining kSmallPCDeltaBits of the pc_delta.
220
+ return pc_delta & kSmallPCDeltaMask;
221
+ }
222
+
223
+
224
+ void RelocInfoWriter::WriteTaggedPC(uint32_t pc_delta, int tag) {
225
+ // Write a byte of tagged pc-delta, possibly preceded by var. length pc-jump.
226
+ pc_delta = WriteVariableLengthPCJump(pc_delta);
227
+ *--pos_ = pc_delta << kTagBits | tag;
228
+ }
229
+
230
+
231
+ void RelocInfoWriter::WriteTaggedData(intptr_t data_delta, int tag) {
232
+ *--pos_ = static_cast<byte>(data_delta << kLocatableTypeTagBits | tag);
233
+ }
234
+
235
+
236
+ void RelocInfoWriter::WriteExtraTag(int extra_tag, int top_tag) {
237
+ *--pos_ = static_cast<int>(top_tag << (kTagBits + kExtraTagBits) |
238
+ extra_tag << kTagBits |
239
+ kDefaultTag);
240
+ }
241
+
242
+
243
+ void RelocInfoWriter::WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag) {
244
+ // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump.
245
+ pc_delta = WriteVariableLengthPCJump(pc_delta);
246
+ WriteExtraTag(extra_tag, 0);
247
+ *--pos_ = pc_delta;
248
+ }
249
+
250
+
251
+ void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) {
252
+ WriteExtraTag(kDataJumpExtraTag, top_tag);
253
+ for (int i = 0; i < kIntSize; i++) {
254
+ *--pos_ = static_cast<byte>(data_delta);
255
+ // Signed right shift is arithmetic shift. Tested in test-utils.cc.
256
+ data_delta = data_delta >> kBitsPerByte;
257
+ }
258
+ }
259
+
260
+ void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) {
261
+ WriteExtraTag(kDataJumpExtraTag, top_tag);
262
+ for (int i = 0; i < kIntptrSize; i++) {
263
+ *--pos_ = static_cast<byte>(data_delta);
264
+ // Signed right shift is arithmetic shift. Tested in test-utils.cc.
265
+ data_delta = data_delta >> kBitsPerByte;
266
+ }
267
+ }
268
+
269
+
270
+ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
271
+ #ifdef DEBUG
272
+ byte* begin_pos = pos_;
273
+ #endif
274
+ ASSERT(rinfo->pc() - last_pc_ >= 0);
275
+ ASSERT(RelocInfo::NUMBER_OF_MODES - RelocInfo::LAST_COMPACT_ENUM <=
276
+ kMaxRelocModes);
277
+ // Use unsigned delta-encoding for pc.
278
+ uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
279
+ RelocInfo::Mode rmode = rinfo->rmode();
280
+
281
+ // The two most common modes are given small tags, and usually fit in a byte.
282
+ if (rmode == RelocInfo::EMBEDDED_OBJECT) {
283
+ WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
284
+ } else if (rmode == RelocInfo::CODE_TARGET) {
285
+ WriteTaggedPC(pc_delta, kCodeTargetTag);
286
+ ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize);
287
+ } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
288
+ // Use signed delta-encoding for id.
289
+ ASSERT(static_cast<int>(rinfo->data()) == rinfo->data());
290
+ int id_delta = static_cast<int>(rinfo->data()) - last_id_;
291
+ // Check if delta is small enough to fit in a tagged byte.
292
+ if (is_intn(id_delta, kSmallDataBits)) {
293
+ WriteTaggedPC(pc_delta, kLocatableTag);
294
+ WriteTaggedData(id_delta, kCodeWithIdTag);
295
+ } else {
296
+ // Otherwise, use costly encoding.
297
+ WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
298
+ WriteExtraTaggedIntData(id_delta, kCodeWithIdTag);
299
+ }
300
+ last_id_ = static_cast<int>(rinfo->data());
301
+ } else if (RelocInfo::IsPosition(rmode)) {
302
+ // Use signed delta-encoding for position.
303
+ ASSERT(static_cast<int>(rinfo->data()) == rinfo->data());
304
+ int pos_delta = static_cast<int>(rinfo->data()) - last_position_;
305
+ int pos_type_tag = (rmode == RelocInfo::POSITION) ? kNonstatementPositionTag
306
+ : kStatementPositionTag;
307
+ // Check if delta is small enough to fit in a tagged byte.
308
+ if (is_intn(pos_delta, kSmallDataBits)) {
309
+ WriteTaggedPC(pc_delta, kLocatableTag);
310
+ WriteTaggedData(pos_delta, pos_type_tag);
311
+ } else {
312
+ // Otherwise, use costly encoding.
313
+ WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
314
+ WriteExtraTaggedIntData(pos_delta, pos_type_tag);
315
+ }
316
+ last_position_ = static_cast<int>(rinfo->data());
317
+ } else if (RelocInfo::IsComment(rmode)) {
318
+ // Comments are normally not generated, so we use the costly encoding.
319
+ WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
320
+ WriteExtraTaggedData(rinfo->data(), kCommentTag);
321
+ ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize);
322
+ } else {
323
+ ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM);
324
+ int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM;
325
+ // For all other modes we simply use the mode as the extra tag.
326
+ // None of these modes need a data component.
327
+ ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag);
328
+ WriteExtraTaggedPC(pc_delta, saved_mode);
329
+ }
330
+ last_pc_ = rinfo->pc();
331
+ #ifdef DEBUG
332
+ ASSERT(begin_pos - pos_ <= kMaxSize);
333
+ #endif
334
+ }
335
+
336
+
337
+ inline int RelocIterator::AdvanceGetTag() {
338
+ return *--pos_ & kTagMask;
339
+ }
340
+
341
+
342
+ inline int RelocIterator::GetExtraTag() {
343
+ return (*pos_ >> kTagBits) & ((1 << kExtraTagBits) - 1);
344
+ }
345
+
346
+
347
+ inline int RelocIterator::GetTopTag() {
348
+ return *pos_ >> (kTagBits + kExtraTagBits);
349
+ }
350
+
351
+
352
+ inline void RelocIterator::ReadTaggedPC() {
353
+ rinfo_.pc_ += *pos_ >> kTagBits;
354
+ }
355
+
356
+
357
+ inline void RelocIterator::AdvanceReadPC() {
358
+ rinfo_.pc_ += *--pos_;
359
+ }
360
+
361
+
362
+ void RelocIterator::AdvanceReadId() {
363
+ int x = 0;
364
+ for (int i = 0; i < kIntSize; i++) {
365
+ x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
366
+ }
367
+ last_id_ += x;
368
+ rinfo_.data_ = last_id_;
369
+ }
370
+
371
+
372
+ void RelocIterator::AdvanceReadPosition() {
373
+ int x = 0;
374
+ for (int i = 0; i < kIntSize; i++) {
375
+ x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
376
+ }
377
+ last_position_ += x;
378
+ rinfo_.data_ = last_position_;
379
+ }
380
+
381
+
382
+ void RelocIterator::AdvanceReadData() {
383
+ intptr_t x = 0;
384
+ for (int i = 0; i < kIntptrSize; i++) {
385
+ x |= static_cast<intptr_t>(*--pos_) << i * kBitsPerByte;
386
+ }
387
+ rinfo_.data_ = x;
388
+ }
389
+
390
+
391
+ void RelocIterator::AdvanceReadVariableLengthPCJump() {
392
+ // Read the 32-kSmallPCDeltaBits most significant bits of the
393
+ // pc jump in kChunkBits bit chunks and shift them into place.
394
+ // Stop when the last chunk is encountered.
395
+ uint32_t pc_jump = 0;
396
+ for (int i = 0; i < kIntSize; i++) {
397
+ byte pc_jump_part = *--pos_;
398
+ pc_jump |= (pc_jump_part >> kLastChunkTagBits) << i * kChunkBits;
399
+ if ((pc_jump_part & kLastChunkTagMask) == 1) break;
400
+ }
401
+ // The least significant kSmallPCDeltaBits bits will be added
402
+ // later.
403
+ rinfo_.pc_ += pc_jump << kSmallPCDeltaBits;
404
+ }
405
+
406
+
407
+ inline int RelocIterator::GetLocatableTypeTag() {
408
+ return *pos_ & ((1 << kLocatableTypeTagBits) - 1);
409
+ }
410
+
411
+
412
+ inline void RelocIterator::ReadTaggedId() {
413
+ int8_t signed_b = *pos_;
414
+ // Signed right shift is arithmetic shift. Tested in test-utils.cc.
415
+ last_id_ += signed_b >> kLocatableTypeTagBits;
416
+ rinfo_.data_ = last_id_;
417
+ }
418
+
419
+
420
+ inline void RelocIterator::ReadTaggedPosition() {
421
+ int8_t signed_b = *pos_;
422
+ // Signed right shift is arithmetic shift. Tested in test-utils.cc.
423
+ last_position_ += signed_b >> kLocatableTypeTagBits;
424
+ rinfo_.data_ = last_position_;
425
+ }
426
+
427
+
428
+ static inline RelocInfo::Mode GetPositionModeFromTag(int tag) {
429
+ ASSERT(tag == kNonstatementPositionTag ||
430
+ tag == kStatementPositionTag);
431
+ return (tag == kNonstatementPositionTag) ?
432
+ RelocInfo::POSITION :
433
+ RelocInfo::STATEMENT_POSITION;
434
+ }
435
+
436
+
437
+ void RelocIterator::next() {
438
+ ASSERT(!done());
439
+ // Basically, do the opposite of RelocInfoWriter::Write.
440
+ // Reading of data is as far as possible avoided for unwanted modes,
441
+ // but we must always update the pc.
442
+ //
443
+ // We exit this loop by returning when we find a mode we want.
444
+ while (pos_ > end_) {
445
+ int tag = AdvanceGetTag();
446
+ if (tag == kEmbeddedObjectTag) {
447
+ ReadTaggedPC();
448
+ if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return;
449
+ } else if (tag == kCodeTargetTag) {
450
+ ReadTaggedPC();
451
+ if (SetMode(RelocInfo::CODE_TARGET)) return;
452
+ } else if (tag == kLocatableTag) {
453
+ ReadTaggedPC();
454
+ Advance();
455
+ int locatable_tag = GetLocatableTypeTag();
456
+ if (locatable_tag == kCodeWithIdTag) {
457
+ if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) {
458
+ ReadTaggedId();
459
+ return;
460
+ }
461
+ } else {
462
+ // Compact encoding is never used for comments,
463
+ // so it must be a position.
464
+ ASSERT(locatable_tag == kNonstatementPositionTag ||
465
+ locatable_tag == kStatementPositionTag);
466
+ if (mode_mask_ & RelocInfo::kPositionMask) {
467
+ ReadTaggedPosition();
468
+ if (SetMode(GetPositionModeFromTag(locatable_tag))) return;
469
+ }
470
+ }
471
+ } else {
472
+ ASSERT(tag == kDefaultTag);
473
+ int extra_tag = GetExtraTag();
474
+ if (extra_tag == kPCJumpExtraTag) {
475
+ int top_tag = GetTopTag();
476
+ if (top_tag == kVariableLengthPCJumpTopTag) {
477
+ AdvanceReadVariableLengthPCJump();
478
+ } else {
479
+ AdvanceReadPC();
480
+ }
481
+ } else if (extra_tag == kDataJumpExtraTag) {
482
+ int locatable_tag = GetTopTag();
483
+ if (locatable_tag == kCodeWithIdTag) {
484
+ if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) {
485
+ AdvanceReadId();
486
+ return;
487
+ }
488
+ Advance(kIntSize);
489
+ } else if (locatable_tag != kCommentTag) {
490
+ ASSERT(locatable_tag == kNonstatementPositionTag ||
491
+ locatable_tag == kStatementPositionTag);
492
+ if (mode_mask_ & RelocInfo::kPositionMask) {
493
+ AdvanceReadPosition();
494
+ if (SetMode(GetPositionModeFromTag(locatable_tag))) return;
495
+ } else {
496
+ Advance(kIntSize);
497
+ }
498
+ } else {
499
+ ASSERT(locatable_tag == kCommentTag);
500
+ if (SetMode(RelocInfo::COMMENT)) {
501
+ AdvanceReadData();
502
+ return;
503
+ }
504
+ Advance(kIntptrSize);
505
+ }
506
+ } else {
507
+ AdvanceReadPC();
508
+ int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM;
509
+ if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return;
510
+ }
511
+ }
512
+ }
513
+ done_ = true;
514
+ }
515
+
516
+
517
+ RelocIterator::RelocIterator(Code* code, int mode_mask) {
518
+ rinfo_.pc_ = code->instruction_start();
519
+ rinfo_.data_ = 0;
520
+ // Relocation info is read backwards.
521
+ pos_ = code->relocation_start() + code->relocation_size();
522
+ end_ = code->relocation_start();
523
+ done_ = false;
524
+ mode_mask_ = mode_mask;
525
+ last_id_ = 0;
526
+ last_position_ = 0;
527
+ if (mode_mask_ == 0) pos_ = end_;
528
+ next();
529
+ }
530
+
531
+
532
+ RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
533
+ rinfo_.pc_ = desc.buffer;
534
+ rinfo_.data_ = 0;
535
+ // Relocation info is read backwards.
536
+ pos_ = desc.buffer + desc.buffer_size;
537
+ end_ = pos_ - desc.reloc_size;
538
+ done_ = false;
539
+ mode_mask_ = mode_mask;
540
+ last_id_ = 0;
541
+ last_position_ = 0;
542
+ if (mode_mask_ == 0) pos_ = end_;
543
+ next();
544
+ }
545
+
546
+
547
+ // -----------------------------------------------------------------------------
548
+ // Implementation of RelocInfo
549
+
550
+
551
+ #ifdef ENABLE_DISASSEMBLER
552
+ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
553
+ switch (rmode) {
554
+ case RelocInfo::NONE:
555
+ return "no reloc";
556
+ case RelocInfo::EMBEDDED_OBJECT:
557
+ return "embedded object";
558
+ case RelocInfo::CONSTRUCT_CALL:
559
+ return "code target (js construct call)";
560
+ case RelocInfo::CODE_TARGET_CONTEXT:
561
+ return "code target (context)";
562
+ case RelocInfo::DEBUG_BREAK:
563
+ #ifndef ENABLE_DEBUGGER_SUPPORT
564
+ UNREACHABLE();
565
+ #endif
566
+ return "debug break";
567
+ case RelocInfo::CODE_TARGET:
568
+ return "code target";
569
+ case RelocInfo::CODE_TARGET_WITH_ID:
570
+ return "code target with id";
571
+ case RelocInfo::GLOBAL_PROPERTY_CELL:
572
+ return "global property cell";
573
+ case RelocInfo::RUNTIME_ENTRY:
574
+ return "runtime entry";
575
+ case RelocInfo::JS_RETURN:
576
+ return "js return";
577
+ case RelocInfo::COMMENT:
578
+ return "comment";
579
+ case RelocInfo::POSITION:
580
+ return "position";
581
+ case RelocInfo::STATEMENT_POSITION:
582
+ return "statement position";
583
+ case RelocInfo::EXTERNAL_REFERENCE:
584
+ return "external reference";
585
+ case RelocInfo::INTERNAL_REFERENCE:
586
+ return "internal reference";
587
+ case RelocInfo::DEBUG_BREAK_SLOT:
588
+ #ifndef ENABLE_DEBUGGER_SUPPORT
589
+ UNREACHABLE();
590
+ #endif
591
+ return "debug break slot";
592
+ case RelocInfo::NUMBER_OF_MODES:
593
+ UNREACHABLE();
594
+ return "number_of_modes";
595
+ }
596
+ return "unknown relocation type";
597
+ }
598
+
599
+
600
+ void RelocInfo::Print(FILE* out) {
601
+ PrintF(out, "%p %s", pc_, RelocModeName(rmode_));
602
+ if (IsComment(rmode_)) {
603
+ PrintF(out, " (%s)", reinterpret_cast<char*>(data_));
604
+ } else if (rmode_ == EMBEDDED_OBJECT) {
605
+ PrintF(out, " (");
606
+ target_object()->ShortPrint(out);
607
+ PrintF(out, ")");
608
+ } else if (rmode_ == EXTERNAL_REFERENCE) {
609
+ ExternalReferenceEncoder ref_encoder;
610
+ PrintF(out, " (%s) (%p)",
611
+ ref_encoder.NameOfAddress(*target_reference_address()),
612
+ *target_reference_address());
613
+ } else if (IsCodeTarget(rmode_)) {
614
+ Code* code = Code::GetCodeFromTargetAddress(target_address());
615
+ PrintF(out, " (%s) (%p)", Code::Kind2String(code->kind()),
616
+ target_address());
617
+ if (rmode_ == CODE_TARGET_WITH_ID) {
618
+ PrintF(" (id=%d)", static_cast<int>(data_));
619
+ }
620
+ } else if (IsPosition(rmode_)) {
621
+ PrintF(out, " (%" V8_PTR_PREFIX "d)", data());
622
+ } else if (rmode_ == RelocInfo::RUNTIME_ENTRY &&
623
+ Isolate::Current()->deoptimizer_data() != NULL) {
624
+ // Depotimization bailouts are stored as runtime entries.
625
+ int id = Deoptimizer::GetDeoptimizationId(
626
+ target_address(), Deoptimizer::EAGER);
627
+ if (id != Deoptimizer::kNotDeoptimizationEntry) {
628
+ PrintF(out, " (deoptimization bailout %d)", id);
629
+ }
630
+ }
631
+
632
+ PrintF(out, "\n");
633
+ }
634
+ #endif // ENABLE_DISASSEMBLER
635
+
636
+
637
+ #ifdef DEBUG
638
+ void RelocInfo::Verify() {
639
+ switch (rmode_) {
640
+ case EMBEDDED_OBJECT:
641
+ Object::VerifyPointer(target_object());
642
+ break;
643
+ case GLOBAL_PROPERTY_CELL:
644
+ Object::VerifyPointer(target_cell());
645
+ break;
646
+ case DEBUG_BREAK:
647
+ #ifndef ENABLE_DEBUGGER_SUPPORT
648
+ UNREACHABLE();
649
+ break;
650
+ #endif
651
+ case CONSTRUCT_CALL:
652
+ case CODE_TARGET_CONTEXT:
653
+ case CODE_TARGET_WITH_ID:
654
+ case CODE_TARGET: {
655
+ // convert inline target address to code object
656
+ Address addr = target_address();
657
+ ASSERT(addr != NULL);
658
+ // Check that we can find the right code object.
659
+ Code* code = Code::GetCodeFromTargetAddress(addr);
660
+ Object* found = HEAP->FindCodeObject(addr);
661
+ ASSERT(found->IsCode());
662
+ ASSERT(code->address() == HeapObject::cast(found)->address());
663
+ break;
664
+ }
665
+ case RUNTIME_ENTRY:
666
+ case JS_RETURN:
667
+ case COMMENT:
668
+ case POSITION:
669
+ case STATEMENT_POSITION:
670
+ case EXTERNAL_REFERENCE:
671
+ case INTERNAL_REFERENCE:
672
+ case DEBUG_BREAK_SLOT:
673
+ case NONE:
674
+ break;
675
+ case NUMBER_OF_MODES:
676
+ UNREACHABLE();
677
+ break;
678
+ }
679
+ }
680
+ #endif // DEBUG
681
+
682
+
683
+ // -----------------------------------------------------------------------------
684
+ // Implementation of ExternalReference
685
+
686
+ ExternalReference::ExternalReference(Builtins::CFunctionId id, Isolate* isolate)
687
+ : address_(Redirect(isolate, Builtins::c_function_address(id))) {}
688
+
689
+
690
+ ExternalReference::ExternalReference(
691
+ ApiFunction* fun,
692
+ Type type = ExternalReference::BUILTIN_CALL,
693
+ Isolate* isolate = NULL)
694
+ : address_(Redirect(isolate, fun->address(), type)) {}
695
+
696
+
697
+ ExternalReference::ExternalReference(Builtins::Name name, Isolate* isolate)
698
+ : address_(isolate->builtins()->builtin_address(name)) {}
699
+
700
+
701
+ ExternalReference::ExternalReference(Runtime::FunctionId id,
702
+ Isolate* isolate)
703
+ : address_(Redirect(isolate, Runtime::FunctionForId(id)->entry)) {}
704
+
705
+
706
+ ExternalReference::ExternalReference(const Runtime::Function* f,
707
+ Isolate* isolate)
708
+ : address_(Redirect(isolate, f->entry)) {}
709
+
710
+
711
+ ExternalReference ExternalReference::isolate_address() {
712
+ return ExternalReference(Isolate::Current());
713
+ }
714
+
715
+
716
+ ExternalReference::ExternalReference(const IC_Utility& ic_utility,
717
+ Isolate* isolate)
718
+ : address_(Redirect(isolate, ic_utility.address())) {}
719
+
720
+ #ifdef ENABLE_DEBUGGER_SUPPORT
721
+ ExternalReference::ExternalReference(const Debug_Address& debug_address,
722
+ Isolate* isolate)
723
+ : address_(debug_address.address(isolate)) {}
724
+ #endif
725
+
726
+ ExternalReference::ExternalReference(StatsCounter* counter)
727
+ : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}
728
+
729
+
730
+ ExternalReference::ExternalReference(Isolate::AddressId id, Isolate* isolate)
731
+ : address_(isolate->get_address_from_id(id)) {}
732
+
733
+
734
+ ExternalReference::ExternalReference(const SCTableReference& table_ref)
735
+ : address_(table_ref.address()) {}
736
+
737
+
738
+ ExternalReference ExternalReference::perform_gc_function(Isolate* isolate) {
739
+ return ExternalReference(Redirect(isolate,
740
+ FUNCTION_ADDR(Runtime::PerformGC)));
741
+ }
742
+
743
+
744
+ ExternalReference ExternalReference::fill_heap_number_with_random_function(
745
+ Isolate* isolate) {
746
+ return ExternalReference(Redirect(
747
+ isolate,
748
+ FUNCTION_ADDR(V8::FillHeapNumberWithRandom)));
749
+ }
750
+
751
+
752
+ ExternalReference ExternalReference::delete_handle_scope_extensions(
753
+ Isolate* isolate) {
754
+ return ExternalReference(Redirect(
755
+ isolate,
756
+ FUNCTION_ADDR(HandleScope::DeleteExtensions)));
757
+ }
758
+
759
+
760
+ ExternalReference ExternalReference::random_uint32_function(
761
+ Isolate* isolate) {
762
+ return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random)));
763
+ }
764
+
765
+
766
+ ExternalReference ExternalReference::transcendental_cache_array_address(
767
+ Isolate* isolate) {
768
+ return ExternalReference(
769
+ isolate->transcendental_cache()->cache_array_address());
770
+ }
771
+
772
+
773
+ ExternalReference ExternalReference::new_deoptimizer_function(
774
+ Isolate* isolate) {
775
+ return ExternalReference(
776
+ Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New)));
777
+ }
778
+
779
+
780
+ ExternalReference ExternalReference::compute_output_frames_function(
781
+ Isolate* isolate) {
782
+ return ExternalReference(
783
+ Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
784
+ }
785
+
786
+
787
+ ExternalReference ExternalReference::global_contexts_list(Isolate* isolate) {
788
+ return ExternalReference(isolate->heap()->global_contexts_list_address());
789
+ }
790
+
791
+
792
+ ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate* isolate) {
793
+ return ExternalReference(isolate->keyed_lookup_cache()->keys_address());
794
+ }
795
+
796
+
797
+ ExternalReference ExternalReference::keyed_lookup_cache_field_offsets(
798
+ Isolate* isolate) {
799
+ return ExternalReference(
800
+ isolate->keyed_lookup_cache()->field_offsets_address());
801
+ }
802
+
803
+
804
+ ExternalReference ExternalReference::the_hole_value_location(Isolate* isolate) {
805
+ return ExternalReference(isolate->factory()->the_hole_value().location());
806
+ }
807
+
808
+
809
+ ExternalReference ExternalReference::arguments_marker_location(
810
+ Isolate* isolate) {
811
+ return ExternalReference(isolate->factory()->arguments_marker().location());
812
+ }
813
+
814
+
815
+ ExternalReference ExternalReference::roots_address(Isolate* isolate) {
816
+ return ExternalReference(isolate->heap()->roots_address());
817
+ }
818
+
819
+
820
+ ExternalReference ExternalReference::address_of_stack_limit(Isolate* isolate) {
821
+ return ExternalReference(isolate->stack_guard()->address_of_jslimit());
822
+ }
823
+
824
+
825
+ ExternalReference ExternalReference::address_of_real_stack_limit(
826
+ Isolate* isolate) {
827
+ return ExternalReference(isolate->stack_guard()->address_of_real_jslimit());
828
+ }
829
+
830
+
831
+ ExternalReference ExternalReference::address_of_regexp_stack_limit(
832
+ Isolate* isolate) {
833
+ return ExternalReference(isolate->regexp_stack()->limit_address());
834
+ }
835
+
836
+
837
+ ExternalReference ExternalReference::new_space_start(Isolate* isolate) {
838
+ return ExternalReference(isolate->heap()->NewSpaceStart());
839
+ }
840
+
841
+
842
+ ExternalReference ExternalReference::new_space_mask(Isolate* isolate) {
843
+ Address mask = reinterpret_cast<Address>(isolate->heap()->NewSpaceMask());
844
+ return ExternalReference(mask);
845
+ }
846
+
847
+
848
+ ExternalReference ExternalReference::new_space_allocation_top_address(
849
+ Isolate* isolate) {
850
+ return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress());
851
+ }
852
+
853
+
854
+ ExternalReference ExternalReference::heap_always_allocate_scope_depth(
855
+ Isolate* isolate) {
856
+ Heap* heap = isolate->heap();
857
+ return ExternalReference(heap->always_allocate_scope_depth_address());
858
+ }
859
+
860
+
861
+ ExternalReference ExternalReference::new_space_allocation_limit_address(
862
+ Isolate* isolate) {
863
+ return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress());
864
+ }
865
+
866
+
867
+ ExternalReference ExternalReference::handle_scope_level_address() {
868
+ return ExternalReference(HandleScope::current_level_address());
869
+ }
870
+
871
+
872
+ ExternalReference ExternalReference::handle_scope_next_address() {
873
+ return ExternalReference(HandleScope::current_next_address());
874
+ }
875
+
876
+
877
+ ExternalReference ExternalReference::handle_scope_limit_address() {
878
+ return ExternalReference(HandleScope::current_limit_address());
879
+ }
880
+
881
+
882
+ ExternalReference ExternalReference::scheduled_exception_address(
883
+ Isolate* isolate) {
884
+ return ExternalReference(isolate->scheduled_exception_address());
885
+ }
886
+
887
+
888
+ ExternalReference ExternalReference::address_of_min_int() {
889
+ return ExternalReference(reinterpret_cast<void*>(
890
+ const_cast<double*>(&DoubleConstant::min_int)));
891
+ }
892
+
893
+
894
+ ExternalReference ExternalReference::address_of_one_half() {
895
+ return ExternalReference(reinterpret_cast<void*>(
896
+ const_cast<double*>(&DoubleConstant::one_half)));
897
+ }
898
+
899
+
900
+ ExternalReference ExternalReference::address_of_minus_zero() {
901
+ return ExternalReference(reinterpret_cast<void*>(
902
+ const_cast<double*>(&DoubleConstant::minus_zero)));
903
+ }
904
+
905
+
906
+ ExternalReference ExternalReference::address_of_zero() {
907
+ return ExternalReference(reinterpret_cast<void*>(
908
+ const_cast<double*>(&DoubleConstant::zero)));
909
+ }
910
+
911
+
912
+ ExternalReference ExternalReference::address_of_uint8_max_value() {
913
+ return ExternalReference(reinterpret_cast<void*>(
914
+ const_cast<double*>(&DoubleConstant::uint8_max_value)));
915
+ }
916
+
917
+
918
+ ExternalReference ExternalReference::address_of_negative_infinity() {
919
+ return ExternalReference(reinterpret_cast<void*>(
920
+ const_cast<double*>(&DoubleConstant::negative_infinity)));
921
+ }
922
+
923
+
924
+ ExternalReference ExternalReference::address_of_nan() {
925
+ return ExternalReference(reinterpret_cast<void*>(
926
+ const_cast<double*>(&DoubleConstant::nan)));
927
+ }
928
+
929
+
930
+ #ifndef V8_INTERPRETED_REGEXP
931
+
932
+ ExternalReference ExternalReference::re_check_stack_guard_state(
933
+ Isolate* isolate) {
934
+ Address function;
935
+ #ifdef V8_TARGET_ARCH_X64
936
+ function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState);
937
+ #elif V8_TARGET_ARCH_IA32
938
+ function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState);
939
+ #elif V8_TARGET_ARCH_ARM
940
+ function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState);
941
+ #elif V8_TARGET_ARCH_MIPS
942
+ function = FUNCTION_ADDR(RegExpMacroAssemblerMIPS::CheckStackGuardState);
943
+ #else
944
+ UNREACHABLE();
945
+ #endif
946
+ return ExternalReference(Redirect(isolate, function));
947
+ }
948
+
949
+ ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) {
950
+ return ExternalReference(
951
+ Redirect(isolate, FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack)));
952
+ }
953
+
954
+ ExternalReference ExternalReference::re_case_insensitive_compare_uc16(
955
+ Isolate* isolate) {
956
+ return ExternalReference(Redirect(
957
+ isolate,
958
+ FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
959
+ }
960
+
961
+ ExternalReference ExternalReference::re_word_character_map() {
962
+ return ExternalReference(
963
+ NativeRegExpMacroAssembler::word_character_map_address());
964
+ }
965
+
966
+ ExternalReference ExternalReference::address_of_static_offsets_vector(
967
+ Isolate* isolate) {
968
+ return ExternalReference(
969
+ OffsetsVector::static_offsets_vector_address(isolate));
970
+ }
971
+
972
+ ExternalReference ExternalReference::address_of_regexp_stack_memory_address(
973
+ Isolate* isolate) {
974
+ return ExternalReference(
975
+ isolate->regexp_stack()->memory_address());
976
+ }
977
+
978
+ ExternalReference ExternalReference::address_of_regexp_stack_memory_size(
979
+ Isolate* isolate) {
980
+ return ExternalReference(isolate->regexp_stack()->memory_size_address());
981
+ }
982
+
983
+ #endif // V8_INTERPRETED_REGEXP
984
+
985
+
986
+ static double add_two_doubles(double x, double y) {
987
+ return x + y;
988
+ }
989
+
990
+
991
+ static double sub_two_doubles(double x, double y) {
992
+ return x - y;
993
+ }
994
+
995
+
996
+ static double mul_two_doubles(double x, double y) {
997
+ return x * y;
998
+ }
999
+
1000
+
1001
+ static double div_two_doubles(double x, double y) {
1002
+ return x / y;
1003
+ }
1004
+
1005
+
1006
+ static double mod_two_doubles(double x, double y) {
1007
+ return modulo(x, y);
1008
+ }
1009
+
1010
+
1011
+ static double math_sin_double(double x) {
1012
+ return sin(x);
1013
+ }
1014
+
1015
+
1016
+ static double math_cos_double(double x) {
1017
+ return cos(x);
1018
+ }
1019
+
1020
+
1021
+ static double math_log_double(double x) {
1022
+ return log(x);
1023
+ }
1024
+
1025
+
1026
+ ExternalReference ExternalReference::math_sin_double_function(
1027
+ Isolate* isolate) {
1028
+ return ExternalReference(Redirect(isolate,
1029
+ FUNCTION_ADDR(math_sin_double),
1030
+ BUILTIN_FP_CALL));
1031
+ }
1032
+
1033
+
1034
+ ExternalReference ExternalReference::math_cos_double_function(
1035
+ Isolate* isolate) {
1036
+ return ExternalReference(Redirect(isolate,
1037
+ FUNCTION_ADDR(math_cos_double),
1038
+ BUILTIN_FP_CALL));
1039
+ }
1040
+
1041
+
1042
+ ExternalReference ExternalReference::math_log_double_function(
1043
+ Isolate* isolate) {
1044
+ return ExternalReference(Redirect(isolate,
1045
+ FUNCTION_ADDR(math_log_double),
1046
+ BUILTIN_FP_CALL));
1047
+ }
1048
+
1049
+
1050
+ // Helper function to compute x^y, where y is known to be an
1051
+ // integer. Uses binary decomposition to limit the number of
1052
+ // multiplications; see the discussion in "Hacker's Delight" by Henry
1053
+ // S. Warren, Jr., figure 11-6, page 213.
1054
+ double power_double_int(double x, int y) {
1055
+ double m = (y < 0) ? 1 / x : x;
1056
+ unsigned n = (y < 0) ? -y : y;
1057
+ double p = 1;
1058
+ while (n != 0) {
1059
+ if ((n & 1) != 0) p *= m;
1060
+ m *= m;
1061
+ if ((n & 2) != 0) p *= m;
1062
+ m *= m;
1063
+ n >>= 2;
1064
+ }
1065
+ return p;
1066
+ }
1067
+
1068
+
1069
+ double power_double_double(double x, double y) {
1070
+ int y_int = static_cast<int>(y);
1071
+ if (y == y_int) {
1072
+ return power_double_int(x, y_int); // Returns 1.0 for exponent 0.
1073
+ }
1074
+ if (!isinf(x)) {
1075
+ if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0.
1076
+ if (y == -0.5) return 1.0 / sqrt(x + 0.0);
1077
+ }
1078
+ if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) {
1079
+ return OS::nan_value();
1080
+ }
1081
+ return pow(x, y);
1082
+ }
1083
+
1084
+
1085
+ ExternalReference ExternalReference::power_double_double_function(
1086
+ Isolate* isolate) {
1087
+ return ExternalReference(Redirect(isolate,
1088
+ FUNCTION_ADDR(power_double_double),
1089
+ BUILTIN_FP_FP_CALL));
1090
+ }
1091
+
1092
+
1093
+ ExternalReference ExternalReference::power_double_int_function(
1094
+ Isolate* isolate) {
1095
+ return ExternalReference(Redirect(isolate,
1096
+ FUNCTION_ADDR(power_double_int),
1097
+ BUILTIN_FP_INT_CALL));
1098
+ }
1099
+
1100
+
1101
+ static int native_compare_doubles(double y, double x) {
1102
+ if (x == y) return EQUAL;
1103
+ return x < y ? LESS : GREATER;
1104
+ }
1105
+
1106
+
1107
+ ExternalReference ExternalReference::double_fp_operation(
1108
+ Token::Value operation, Isolate* isolate) {
1109
+ typedef double BinaryFPOperation(double x, double y);
1110
+ BinaryFPOperation* function = NULL;
1111
+ switch (operation) {
1112
+ case Token::ADD:
1113
+ function = &add_two_doubles;
1114
+ break;
1115
+ case Token::SUB:
1116
+ function = &sub_two_doubles;
1117
+ break;
1118
+ case Token::MUL:
1119
+ function = &mul_two_doubles;
1120
+ break;
1121
+ case Token::DIV:
1122
+ function = &div_two_doubles;
1123
+ break;
1124
+ case Token::MOD:
1125
+ function = &mod_two_doubles;
1126
+ break;
1127
+ default:
1128
+ UNREACHABLE();
1129
+ }
1130
+ return ExternalReference(Redirect(isolate,
1131
+ FUNCTION_ADDR(function),
1132
+ BUILTIN_FP_FP_CALL));
1133
+ }
1134
+
1135
+
1136
+ ExternalReference ExternalReference::compare_doubles(Isolate* isolate) {
1137
+ return ExternalReference(Redirect(isolate,
1138
+ FUNCTION_ADDR(native_compare_doubles),
1139
+ BUILTIN_COMPARE_CALL));
1140
+ }
1141
+
1142
+
1143
+ #ifdef ENABLE_DEBUGGER_SUPPORT
1144
+ ExternalReference ExternalReference::debug_break(Isolate* isolate) {
1145
+ return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug_Break)));
1146
+ }
1147
+
1148
+
1149
+ ExternalReference ExternalReference::debug_step_in_fp_address(
1150
+ Isolate* isolate) {
1151
+ return ExternalReference(isolate->debug()->step_in_fp_addr());
1152
+ }
1153
+ #endif
1154
+
1155
+
1156
+ void PositionsRecorder::RecordPosition(int pos) {
1157
+ ASSERT(pos != RelocInfo::kNoPosition);
1158
+ ASSERT(pos >= 0);
1159
+ state_.current_position = pos;
1160
+ #ifdef ENABLE_GDB_JIT_INTERFACE
1161
+ if (gdbjit_lineinfo_ != NULL) {
1162
+ gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, false);
1163
+ }
1164
+ #endif
1165
+ }
1166
+
1167
+
1168
+ void PositionsRecorder::RecordStatementPosition(int pos) {
1169
+ ASSERT(pos != RelocInfo::kNoPosition);
1170
+ ASSERT(pos >= 0);
1171
+ state_.current_statement_position = pos;
1172
+ #ifdef ENABLE_GDB_JIT_INTERFACE
1173
+ if (gdbjit_lineinfo_ != NULL) {
1174
+ gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, true);
1175
+ }
1176
+ #endif
1177
+ }
1178
+
1179
+
1180
+ bool PositionsRecorder::WriteRecordedPositions() {
1181
+ bool written = false;
1182
+
1183
+ // Write the statement position if it is different from what was written last
1184
+ // time.
1185
+ if (state_.current_statement_position != state_.written_statement_position) {
1186
+ EnsureSpace ensure_space(assembler_);
1187
+ assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION,
1188
+ state_.current_statement_position);
1189
+ state_.written_statement_position = state_.current_statement_position;
1190
+ written = true;
1191
+ }
1192
+
1193
+ // Write the position if it is different from what was written last time and
1194
+ // also different from the written statement position.
1195
+ if (state_.current_position != state_.written_position &&
1196
+ state_.current_position != state_.written_statement_position) {
1197
+ EnsureSpace ensure_space(assembler_);
1198
+ assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1199
+ state_.written_position = state_.current_position;
1200
+ written = true;
1201
+ }
1202
+
1203
+ // Return whether something was written.
1204
+ return written;
1205
+ }
1206
+
1207
+ } } // namespace v8::internal