therubyracer 0.4.9-x86-linux

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

Potentially problematic release.


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

Files changed (637) hide show
  1. data/.gitignore +11 -0
  2. data/.gitmodules +3 -0
  3. data/Doxyfile +1514 -0
  4. data/History.txt +43 -0
  5. data/README.rdoc +157 -0
  6. data/Rakefile +51 -0
  7. data/docs/data_conversion.txt +18 -0
  8. data/ext/v8/callbacks.cpp +160 -0
  9. data/ext/v8/callbacks.h +14 -0
  10. data/ext/v8/convert_ruby.cpp +8 -0
  11. data/ext/v8/convert_ruby.h +99 -0
  12. data/ext/v8/convert_string.cpp +10 -0
  13. data/ext/v8/convert_string.h +73 -0
  14. data/ext/v8/convert_v8.cpp +9 -0
  15. data/ext/v8/convert_v8.h +121 -0
  16. data/ext/v8/converters.cpp +83 -0
  17. data/ext/v8/converters.h +23 -0
  18. data/ext/v8/extconf.rb +36 -0
  19. data/ext/v8/upstream/2.0.6/.gitignore +26 -0
  20. data/ext/v8/upstream/2.0.6/AUTHORS +23 -0
  21. data/ext/v8/upstream/2.0.6/ChangeLog +1479 -0
  22. data/ext/v8/upstream/2.0.6/LICENSE +55 -0
  23. data/ext/v8/upstream/2.0.6/SConstruct +1028 -0
  24. data/ext/v8/upstream/2.0.6/include/v8-debug.h +275 -0
  25. data/ext/v8/upstream/2.0.6/include/v8.h +3236 -0
  26. data/ext/v8/upstream/2.0.6/src/SConscript +283 -0
  27. data/ext/v8/upstream/2.0.6/src/accessors.cc +695 -0
  28. data/ext/v8/upstream/2.0.6/src/accessors.h +114 -0
  29. data/ext/v8/upstream/2.0.6/src/allocation.cc +198 -0
  30. data/ext/v8/upstream/2.0.6/src/allocation.h +169 -0
  31. data/ext/v8/upstream/2.0.6/src/api.cc +3831 -0
  32. data/ext/v8/upstream/2.0.6/src/api.h +479 -0
  33. data/ext/v8/upstream/2.0.6/src/apinatives.js +110 -0
  34. data/ext/v8/upstream/2.0.6/src/apiutils.h +69 -0
  35. data/ext/v8/upstream/2.0.6/src/arguments.h +97 -0
  36. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm-inl.h +277 -0
  37. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.cc +1821 -0
  38. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.h +1027 -0
  39. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2-inl.h +267 -0
  40. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.cc +1821 -0
  41. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.h +1027 -0
  42. data/ext/v8/upstream/2.0.6/src/arm/builtins-arm.cc +1271 -0
  43. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm-inl.h +74 -0
  44. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.cc +6682 -0
  45. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.h +535 -0
  46. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.cc +112 -0
  47. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.h +347 -0
  48. data/ext/v8/upstream/2.0.6/src/arm/cpu-arm.cc +132 -0
  49. data/ext/v8/upstream/2.0.6/src/arm/debug-arm.cc +213 -0
  50. data/ext/v8/upstream/2.0.6/src/arm/disasm-arm.cc +1166 -0
  51. data/ext/v8/upstream/2.0.6/src/arm/fast-codegen-arm.cc +1698 -0
  52. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.cc +123 -0
  53. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.h +162 -0
  54. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +849 -0
  55. data/ext/v8/upstream/2.0.6/src/arm/jump-target-arm.cc +238 -0
  56. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.cc +1259 -0
  57. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.h +423 -0
  58. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.cc +1266 -0
  59. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.h +282 -0
  60. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm-inl.h +103 -0
  61. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.cc +59 -0
  62. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.h +43 -0
  63. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.cc +2264 -0
  64. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.h +306 -0
  65. data/ext/v8/upstream/2.0.6/src/arm/stub-cache-arm.cc +1516 -0
  66. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +412 -0
  67. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.h +532 -0
  68. data/ext/v8/upstream/2.0.6/src/array.js +1154 -0
  69. data/ext/v8/upstream/2.0.6/src/assembler.cc +772 -0
  70. data/ext/v8/upstream/2.0.6/src/assembler.h +525 -0
  71. data/ext/v8/upstream/2.0.6/src/ast.cc +512 -0
  72. data/ext/v8/upstream/2.0.6/src/ast.h +1820 -0
  73. data/ext/v8/upstream/2.0.6/src/bootstrapper.cc +1680 -0
  74. data/ext/v8/upstream/2.0.6/src/bootstrapper.h +103 -0
  75. data/ext/v8/upstream/2.0.6/src/builtins.cc +851 -0
  76. data/ext/v8/upstream/2.0.6/src/builtins.h +245 -0
  77. data/ext/v8/upstream/2.0.6/src/bytecodes-irregexp.h +104 -0
  78. data/ext/v8/upstream/2.0.6/src/char-predicates-inl.h +86 -0
  79. data/ext/v8/upstream/2.0.6/src/char-predicates.h +65 -0
  80. data/ext/v8/upstream/2.0.6/src/checks.cc +100 -0
  81. data/ext/v8/upstream/2.0.6/src/checks.h +284 -0
  82. data/ext/v8/upstream/2.0.6/src/code-stubs.cc +164 -0
  83. data/ext/v8/upstream/2.0.6/src/code-stubs.h +164 -0
  84. data/ext/v8/upstream/2.0.6/src/code.h +68 -0
  85. data/ext/v8/upstream/2.0.6/src/codegen-inl.h +88 -0
  86. data/ext/v8/upstream/2.0.6/src/codegen.cc +504 -0
  87. data/ext/v8/upstream/2.0.6/src/codegen.h +522 -0
  88. data/ext/v8/upstream/2.0.6/src/compilation-cache.cc +490 -0
  89. data/ext/v8/upstream/2.0.6/src/compilation-cache.h +98 -0
  90. data/ext/v8/upstream/2.0.6/src/compiler.cc +1132 -0
  91. data/ext/v8/upstream/2.0.6/src/compiler.h +107 -0
  92. data/ext/v8/upstream/2.0.6/src/contexts.cc +256 -0
  93. data/ext/v8/upstream/2.0.6/src/contexts.h +345 -0
  94. data/ext/v8/upstream/2.0.6/src/conversions-inl.h +95 -0
  95. data/ext/v8/upstream/2.0.6/src/conversions.cc +709 -0
  96. data/ext/v8/upstream/2.0.6/src/conversions.h +118 -0
  97. data/ext/v8/upstream/2.0.6/src/counters.cc +78 -0
  98. data/ext/v8/upstream/2.0.6/src/counters.h +239 -0
  99. data/ext/v8/upstream/2.0.6/src/cpu.h +65 -0
  100. data/ext/v8/upstream/2.0.6/src/d8-debug.cc +345 -0
  101. data/ext/v8/upstream/2.0.6/src/d8-debug.h +155 -0
  102. data/ext/v8/upstream/2.0.6/src/d8-posix.cc +675 -0
  103. data/ext/v8/upstream/2.0.6/src/d8-readline.cc +128 -0
  104. data/ext/v8/upstream/2.0.6/src/d8-windows.cc +42 -0
  105. data/ext/v8/upstream/2.0.6/src/d8.cc +776 -0
  106. data/ext/v8/upstream/2.0.6/src/d8.h +225 -0
  107. data/ext/v8/upstream/2.0.6/src/d8.js +1625 -0
  108. data/ext/v8/upstream/2.0.6/src/date-delay.js +1138 -0
  109. data/ext/v8/upstream/2.0.6/src/dateparser-inl.h +114 -0
  110. data/ext/v8/upstream/2.0.6/src/dateparser.cc +186 -0
  111. data/ext/v8/upstream/2.0.6/src/dateparser.h +240 -0
  112. data/ext/v8/upstream/2.0.6/src/debug-agent.cc +425 -0
  113. data/ext/v8/upstream/2.0.6/src/debug-agent.h +129 -0
  114. data/ext/v8/upstream/2.0.6/src/debug-delay.js +2073 -0
  115. data/ext/v8/upstream/2.0.6/src/debug.cc +2751 -0
  116. data/ext/v8/upstream/2.0.6/src/debug.h +866 -0
  117. data/ext/v8/upstream/2.0.6/src/disasm.h +77 -0
  118. data/ext/v8/upstream/2.0.6/src/disassembler.cc +318 -0
  119. data/ext/v8/upstream/2.0.6/src/disassembler.h +56 -0
  120. data/ext/v8/upstream/2.0.6/src/dtoa-config.c +91 -0
  121. data/ext/v8/upstream/2.0.6/src/execution.cc +701 -0
  122. data/ext/v8/upstream/2.0.6/src/execution.h +312 -0
  123. data/ext/v8/upstream/2.0.6/src/factory.cc +957 -0
  124. data/ext/v8/upstream/2.0.6/src/factory.h +393 -0
  125. data/ext/v8/upstream/2.0.6/src/fast-codegen.cc +725 -0
  126. data/ext/v8/upstream/2.0.6/src/fast-codegen.h +371 -0
  127. data/ext/v8/upstream/2.0.6/src/flag-definitions.h +426 -0
  128. data/ext/v8/upstream/2.0.6/src/flags.cc +555 -0
  129. data/ext/v8/upstream/2.0.6/src/flags.h +81 -0
  130. data/ext/v8/upstream/2.0.6/src/frame-element.cc +45 -0
  131. data/ext/v8/upstream/2.0.6/src/frame-element.h +235 -0
  132. data/ext/v8/upstream/2.0.6/src/frames-inl.h +215 -0
  133. data/ext/v8/upstream/2.0.6/src/frames.cc +749 -0
  134. data/ext/v8/upstream/2.0.6/src/frames.h +659 -0
  135. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.cc +76 -0
  136. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.h +135 -0
  137. data/ext/v8/upstream/2.0.6/src/global-handles.cc +516 -0
  138. data/ext/v8/upstream/2.0.6/src/global-handles.h +180 -0
  139. data/ext/v8/upstream/2.0.6/src/globals.h +608 -0
  140. data/ext/v8/upstream/2.0.6/src/handles-inl.h +76 -0
  141. data/ext/v8/upstream/2.0.6/src/handles.cc +811 -0
  142. data/ext/v8/upstream/2.0.6/src/handles.h +367 -0
  143. data/ext/v8/upstream/2.0.6/src/hashmap.cc +226 -0
  144. data/ext/v8/upstream/2.0.6/src/hashmap.h +120 -0
  145. data/ext/v8/upstream/2.0.6/src/heap-inl.h +407 -0
  146. data/ext/v8/upstream/2.0.6/src/heap-profiler.cc +695 -0
  147. data/ext/v8/upstream/2.0.6/src/heap-profiler.h +277 -0
  148. data/ext/v8/upstream/2.0.6/src/heap.cc +4204 -0
  149. data/ext/v8/upstream/2.0.6/src/heap.h +1704 -0
  150. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32-inl.h +325 -0
  151. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.cc +2375 -0
  152. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.h +914 -0
  153. data/ext/v8/upstream/2.0.6/src/ia32/builtins-ia32.cc +1222 -0
  154. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32-inl.h +46 -0
  155. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.cc +9770 -0
  156. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.h +834 -0
  157. data/ext/v8/upstream/2.0.6/src/ia32/cpu-ia32.cc +79 -0
  158. data/ext/v8/upstream/2.0.6/src/ia32/debug-ia32.cc +208 -0
  159. data/ext/v8/upstream/2.0.6/src/ia32/disasm-ia32.cc +1357 -0
  160. data/ext/v8/upstream/2.0.6/src/ia32/fast-codegen-ia32.cc +1813 -0
  161. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.cc +111 -0
  162. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.h +135 -0
  163. data/ext/v8/upstream/2.0.6/src/ia32/ic-ia32.cc +1490 -0
  164. data/ext/v8/upstream/2.0.6/src/ia32/jump-target-ia32.cc +432 -0
  165. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.cc +1517 -0
  166. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.h +528 -0
  167. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.cc +1219 -0
  168. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.h +230 -0
  169. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32-inl.h +82 -0
  170. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.cc +99 -0
  171. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.h +43 -0
  172. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.cc +30 -0
  173. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.h +62 -0
  174. data/ext/v8/upstream/2.0.6/src/ia32/stub-cache-ia32.cc +1961 -0
  175. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.cc +1105 -0
  176. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.h +580 -0
  177. data/ext/v8/upstream/2.0.6/src/ic-inl.h +93 -0
  178. data/ext/v8/upstream/2.0.6/src/ic.cc +1426 -0
  179. data/ext/v8/upstream/2.0.6/src/ic.h +443 -0
  180. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.cc +646 -0
  181. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.h +48 -0
  182. data/ext/v8/upstream/2.0.6/src/json-delay.js +254 -0
  183. data/ext/v8/upstream/2.0.6/src/jsregexp.cc +5234 -0
  184. data/ext/v8/upstream/2.0.6/src/jsregexp.h +1439 -0
  185. data/ext/v8/upstream/2.0.6/src/jump-target-inl.h +49 -0
  186. data/ext/v8/upstream/2.0.6/src/jump-target.cc +383 -0
  187. data/ext/v8/upstream/2.0.6/src/jump-target.h +280 -0
  188. data/ext/v8/upstream/2.0.6/src/list-inl.h +166 -0
  189. data/ext/v8/upstream/2.0.6/src/list.h +158 -0
  190. data/ext/v8/upstream/2.0.6/src/log-inl.h +126 -0
  191. data/ext/v8/upstream/2.0.6/src/log-utils.cc +503 -0
  192. data/ext/v8/upstream/2.0.6/src/log-utils.h +292 -0
  193. data/ext/v8/upstream/2.0.6/src/log.cc +1457 -0
  194. data/ext/v8/upstream/2.0.6/src/log.h +371 -0
  195. data/ext/v8/upstream/2.0.6/src/macro-assembler.h +93 -0
  196. data/ext/v8/upstream/2.0.6/src/macros.py +137 -0
  197. data/ext/v8/upstream/2.0.6/src/mark-compact.cc +2007 -0
  198. data/ext/v8/upstream/2.0.6/src/mark-compact.h +442 -0
  199. data/ext/v8/upstream/2.0.6/src/math.js +263 -0
  200. data/ext/v8/upstream/2.0.6/src/memory.h +74 -0
  201. data/ext/v8/upstream/2.0.6/src/messages.cc +177 -0
  202. data/ext/v8/upstream/2.0.6/src/messages.h +112 -0
  203. data/ext/v8/upstream/2.0.6/src/messages.js +937 -0
  204. data/ext/v8/upstream/2.0.6/src/mirror-delay.js +2332 -0
  205. data/ext/v8/upstream/2.0.6/src/mksnapshot.cc +169 -0
  206. data/ext/v8/upstream/2.0.6/src/natives.h +63 -0
  207. data/ext/v8/upstream/2.0.6/src/objects-debug.cc +1317 -0
  208. data/ext/v8/upstream/2.0.6/src/objects-inl.h +3044 -0
  209. data/ext/v8/upstream/2.0.6/src/objects.cc +8306 -0
  210. data/ext/v8/upstream/2.0.6/src/objects.h +4960 -0
  211. data/ext/v8/upstream/2.0.6/src/oprofile-agent.cc +116 -0
  212. data/ext/v8/upstream/2.0.6/src/oprofile-agent.h +69 -0
  213. data/ext/v8/upstream/2.0.6/src/parser.cc +4810 -0
  214. data/ext/v8/upstream/2.0.6/src/parser.h +195 -0
  215. data/ext/v8/upstream/2.0.6/src/platform-freebsd.cc +645 -0
  216. data/ext/v8/upstream/2.0.6/src/platform-linux.cc +808 -0
  217. data/ext/v8/upstream/2.0.6/src/platform-macos.cc +643 -0
  218. data/ext/v8/upstream/2.0.6/src/platform-nullos.cc +454 -0
  219. data/ext/v8/upstream/2.0.6/src/platform-openbsd.cc +597 -0
  220. data/ext/v8/upstream/2.0.6/src/platform-posix.cc +380 -0
  221. data/ext/v8/upstream/2.0.6/src/platform-win32.cc +1908 -0
  222. data/ext/v8/upstream/2.0.6/src/platform.h +556 -0
  223. data/ext/v8/upstream/2.0.6/src/prettyprinter.cc +1511 -0
  224. data/ext/v8/upstream/2.0.6/src/prettyprinter.h +219 -0
  225. data/ext/v8/upstream/2.0.6/src/property.cc +96 -0
  226. data/ext/v8/upstream/2.0.6/src/property.h +327 -0
  227. data/ext/v8/upstream/2.0.6/src/regexp-delay.js +406 -0
  228. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  229. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.cc +464 -0
  230. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.h +141 -0
  231. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.cc +356 -0
  232. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.h +103 -0
  233. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.cc +240 -0
  234. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.h +220 -0
  235. data/ext/v8/upstream/2.0.6/src/regexp-stack.cc +103 -0
  236. data/ext/v8/upstream/2.0.6/src/regexp-stack.h +123 -0
  237. data/ext/v8/upstream/2.0.6/src/register-allocator-inl.h +74 -0
  238. data/ext/v8/upstream/2.0.6/src/register-allocator.cc +100 -0
  239. data/ext/v8/upstream/2.0.6/src/register-allocator.h +295 -0
  240. data/ext/v8/upstream/2.0.6/src/rewriter.cc +855 -0
  241. data/ext/v8/upstream/2.0.6/src/rewriter.h +54 -0
  242. data/ext/v8/upstream/2.0.6/src/runtime.cc +8163 -0
  243. data/ext/v8/upstream/2.0.6/src/runtime.h +432 -0
  244. data/ext/v8/upstream/2.0.6/src/runtime.js +626 -0
  245. data/ext/v8/upstream/2.0.6/src/scanner.cc +1098 -0
  246. data/ext/v8/upstream/2.0.6/src/scanner.h +425 -0
  247. data/ext/v8/upstream/2.0.6/src/scopeinfo.cc +649 -0
  248. data/ext/v8/upstream/2.0.6/src/scopeinfo.h +236 -0
  249. data/ext/v8/upstream/2.0.6/src/scopes.cc +963 -0
  250. data/ext/v8/upstream/2.0.6/src/scopes.h +401 -0
  251. data/ext/v8/upstream/2.0.6/src/serialize.cc +1260 -0
  252. data/ext/v8/upstream/2.0.6/src/serialize.h +404 -0
  253. data/ext/v8/upstream/2.0.6/src/shell.h +55 -0
  254. data/ext/v8/upstream/2.0.6/src/simulator.h +41 -0
  255. data/ext/v8/upstream/2.0.6/src/smart-pointer.h +109 -0
  256. data/ext/v8/upstream/2.0.6/src/snapshot-common.cc +97 -0
  257. data/ext/v8/upstream/2.0.6/src/snapshot-empty.cc +40 -0
  258. data/ext/v8/upstream/2.0.6/src/snapshot.h +59 -0
  259. data/ext/v8/upstream/2.0.6/src/spaces-inl.h +372 -0
  260. data/ext/v8/upstream/2.0.6/src/spaces.cc +2864 -0
  261. data/ext/v8/upstream/2.0.6/src/spaces.h +2072 -0
  262. data/ext/v8/upstream/2.0.6/src/string-stream.cc +584 -0
  263. data/ext/v8/upstream/2.0.6/src/string-stream.h +189 -0
  264. data/ext/v8/upstream/2.0.6/src/string.js +901 -0
  265. data/ext/v8/upstream/2.0.6/src/stub-cache.cc +1108 -0
  266. data/ext/v8/upstream/2.0.6/src/stub-cache.h +578 -0
  267. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/COPYING +15 -0
  268. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/dtoa.c +3330 -0
  269. data/ext/v8/upstream/2.0.6/src/third_party/valgrind/valgrind.h +3925 -0
  270. data/ext/v8/upstream/2.0.6/src/token.cc +56 -0
  271. data/ext/v8/upstream/2.0.6/src/token.h +270 -0
  272. data/ext/v8/upstream/2.0.6/src/top.cc +991 -0
  273. data/ext/v8/upstream/2.0.6/src/top.h +459 -0
  274. data/ext/v8/upstream/2.0.6/src/unicode-inl.h +238 -0
  275. data/ext/v8/upstream/2.0.6/src/unicode.cc +749 -0
  276. data/ext/v8/upstream/2.0.6/src/unicode.h +279 -0
  277. data/ext/v8/upstream/2.0.6/src/uri.js +415 -0
  278. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +426 -0
  279. data/ext/v8/upstream/2.0.6/src/usage-analyzer.h +40 -0
  280. data/ext/v8/upstream/2.0.6/src/utils.cc +322 -0
  281. data/ext/v8/upstream/2.0.6/src/utils.h +592 -0
  282. data/ext/v8/upstream/2.0.6/src/v8-counters.cc +55 -0
  283. data/ext/v8/upstream/2.0.6/src/v8-counters.h +198 -0
  284. data/ext/v8/upstream/2.0.6/src/v8.cc +193 -0
  285. data/ext/v8/upstream/2.0.6/src/v8.h +119 -0
  286. data/ext/v8/upstream/2.0.6/src/v8natives.js +846 -0
  287. data/ext/v8/upstream/2.0.6/src/v8threads.cc +450 -0
  288. data/ext/v8/upstream/2.0.6/src/v8threads.h +144 -0
  289. data/ext/v8/upstream/2.0.6/src/variables.cc +163 -0
  290. data/ext/v8/upstream/2.0.6/src/variables.h +235 -0
  291. data/ext/v8/upstream/2.0.6/src/version.cc +88 -0
  292. data/ext/v8/upstream/2.0.6/src/version.h +64 -0
  293. data/ext/v8/upstream/2.0.6/src/virtual-frame.cc +381 -0
  294. data/ext/v8/upstream/2.0.6/src/virtual-frame.h +44 -0
  295. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64-inl.h +352 -0
  296. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.cc +2539 -0
  297. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.h +1399 -0
  298. data/ext/v8/upstream/2.0.6/src/x64/builtins-x64.cc +1255 -0
  299. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64-inl.h +46 -0
  300. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.cc +8223 -0
  301. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.h +785 -0
  302. data/ext/v8/upstream/2.0.6/src/x64/cpu-x64.cc +79 -0
  303. data/ext/v8/upstream/2.0.6/src/x64/debug-x64.cc +202 -0
  304. data/ext/v8/upstream/2.0.6/src/x64/disasm-x64.cc +1596 -0
  305. data/ext/v8/upstream/2.0.6/src/x64/fast-codegen-x64.cc +1820 -0
  306. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.cc +109 -0
  307. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.h +121 -0
  308. data/ext/v8/upstream/2.0.6/src/x64/ic-x64.cc +1392 -0
  309. data/ext/v8/upstream/2.0.6/src/x64/jump-target-x64.cc +432 -0
  310. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.cc +2409 -0
  311. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.h +765 -0
  312. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.cc +1337 -0
  313. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.h +295 -0
  314. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64-inl.h +86 -0
  315. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.cc +84 -0
  316. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.h +43 -0
  317. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.cc +27 -0
  318. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.h +63 -0
  319. data/ext/v8/upstream/2.0.6/src/x64/stub-cache-x64.cc +1884 -0
  320. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.cc +1089 -0
  321. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.h +560 -0
  322. data/ext/v8/upstream/2.0.6/src/zone-inl.h +297 -0
  323. data/ext/v8/upstream/2.0.6/src/zone.cc +193 -0
  324. data/ext/v8/upstream/2.0.6/src/zone.h +305 -0
  325. data/ext/v8/upstream/2.0.6/tools/codemap.js +258 -0
  326. data/ext/v8/upstream/2.0.6/tools/consarray.js +93 -0
  327. data/ext/v8/upstream/2.0.6/tools/csvparser.js +98 -0
  328. data/ext/v8/upstream/2.0.6/tools/gyp/v8.gyp +620 -0
  329. data/ext/v8/upstream/2.0.6/tools/js2c.py +376 -0
  330. data/ext/v8/upstream/2.0.6/tools/jsmin.py +280 -0
  331. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor +24 -0
  332. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor.py +78 -0
  333. data/ext/v8/upstream/2.0.6/tools/logreader.js +320 -0
  334. data/ext/v8/upstream/2.0.6/tools/mac-nm +18 -0
  335. data/ext/v8/upstream/2.0.6/tools/mac-tick-processor +6 -0
  336. data/ext/v8/upstream/2.0.6/tools/oprofile/annotate +7 -0
  337. data/ext/v8/upstream/2.0.6/tools/oprofile/common +19 -0
  338. data/ext/v8/upstream/2.0.6/tools/oprofile/dump +7 -0
  339. data/ext/v8/upstream/2.0.6/tools/oprofile/report +7 -0
  340. data/ext/v8/upstream/2.0.6/tools/oprofile/reset +7 -0
  341. data/ext/v8/upstream/2.0.6/tools/oprofile/run +14 -0
  342. data/ext/v8/upstream/2.0.6/tools/oprofile/shutdown +7 -0
  343. data/ext/v8/upstream/2.0.6/tools/oprofile/start +7 -0
  344. data/ext/v8/upstream/2.0.6/tools/presubmit.py +299 -0
  345. data/ext/v8/upstream/2.0.6/tools/process-heap-prof.py +120 -0
  346. data/ext/v8/upstream/2.0.6/tools/profile.js +621 -0
  347. data/ext/v8/upstream/2.0.6/tools/profile_view.js +224 -0
  348. data/ext/v8/upstream/2.0.6/tools/run-valgrind.py +77 -0
  349. data/ext/v8/upstream/2.0.6/tools/splaytree.js +322 -0
  350. data/ext/v8/upstream/2.0.6/tools/splaytree.py +226 -0
  351. data/ext/v8/upstream/2.0.6/tools/stats-viewer.py +456 -0
  352. data/ext/v8/upstream/2.0.6/tools/test.py +1370 -0
  353. data/ext/v8/upstream/2.0.6/tools/tickprocessor-driver.js +53 -0
  354. data/ext/v8/upstream/2.0.6/tools/tickprocessor.js +731 -0
  355. data/ext/v8/upstream/2.0.6/tools/tickprocessor.py +535 -0
  356. data/ext/v8/upstream/2.0.6/tools/utils.py +82 -0
  357. data/ext/v8/upstream/2.0.6/tools/visual_studio/README.txt +71 -0
  358. data/ext/v8/upstream/2.0.6/tools/visual_studio/arm.vsprops +14 -0
  359. data/ext/v8/upstream/2.0.6/tools/visual_studio/common.vsprops +35 -0
  360. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8.vcproj +199 -0
  361. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_arm.vcproj +199 -0
  362. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_x64.vcproj +201 -0
  363. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8js2c.cmd +6 -0
  364. data/ext/v8/upstream/2.0.6/tools/visual_studio/debug.vsprops +17 -0
  365. data/ext/v8/upstream/2.0.6/tools/visual_studio/ia32.vsprops +13 -0
  366. data/ext/v8/upstream/2.0.6/tools/visual_studio/js2c.cmd +6 -0
  367. data/ext/v8/upstream/2.0.6/tools/visual_studio/release.vsprops +24 -0
  368. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.sln +101 -0
  369. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.vcproj +223 -0
  370. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.sln +74 -0
  371. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.vcproj +223 -0
  372. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base.vcproj +971 -0
  373. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_arm.vcproj +983 -0
  374. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_x64.vcproj +959 -0
  375. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest.vcproj +255 -0
  376. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_arm.vcproj +243 -0
  377. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_x64.vcproj +257 -0
  378. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot.vcproj +151 -0
  379. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot_x64.vcproj +151 -0
  380. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample.vcproj +151 -0
  381. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_arm.vcproj +151 -0
  382. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_x64.vcproj +151 -0
  383. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample.vcproj +151 -0
  384. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_arm.vcproj +151 -0
  385. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_x64.vcproj +153 -0
  386. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot.vcproj +142 -0
  387. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc.vcproj +92 -0
  388. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc_x64.vcproj +92 -0
  389. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_x64.vcproj +142 -0
  390. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.sln +101 -0
  391. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.vcproj +223 -0
  392. data/ext/v8/upstream/2.0.6/tools/visual_studio/x64.vsprops +13 -0
  393. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +5 -0
  394. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.py +137 -0
  395. data/ext/v8/upstream/Makefile +31 -0
  396. data/ext/v8/upstream/no-strict-aliasing.patch +13 -0
  397. data/ext/v8/upstream/scons/CHANGES.txt +5183 -0
  398. data/ext/v8/upstream/scons/LICENSE.txt +20 -0
  399. data/ext/v8/upstream/scons/MANIFEST +202 -0
  400. data/ext/v8/upstream/scons/PKG-INFO +13 -0
  401. data/ext/v8/upstream/scons/README.txt +273 -0
  402. data/ext/v8/upstream/scons/RELEASE.txt +1040 -0
  403. data/ext/v8/upstream/scons/engine/SCons/Action.py +1256 -0
  404. data/ext/v8/upstream/scons/engine/SCons/Builder.py +868 -0
  405. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +217 -0
  406. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +794 -0
  407. data/ext/v8/upstream/scons/engine/SCons/Debug.py +237 -0
  408. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +485 -0
  409. data/ext/v8/upstream/scons/engine/SCons/Environment.py +2327 -0
  410. data/ext/v8/upstream/scons/engine/SCons/Errors.py +207 -0
  411. data/ext/v8/upstream/scons/engine/SCons/Executor.py +636 -0
  412. data/ext/v8/upstream/scons/engine/SCons/Job.py +435 -0
  413. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +292 -0
  414. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +153 -0
  415. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +3220 -0
  416. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +128 -0
  417. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +1341 -0
  418. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +50 -0
  419. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +50 -0
  420. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +50 -0
  421. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +50 -0
  422. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +76 -0
  423. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +74 -0
  424. data/ext/v8/upstream/scons/engine/SCons/PathList.py +232 -0
  425. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +236 -0
  426. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +70 -0
  427. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +55 -0
  428. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +46 -0
  429. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +46 -0
  430. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +44 -0
  431. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +58 -0
  432. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +264 -0
  433. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +50 -0
  434. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +386 -0
  435. data/ext/v8/upstream/scons/engine/SCons/SConf.py +1038 -0
  436. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +381 -0
  437. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +132 -0
  438. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +74 -0
  439. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +111 -0
  440. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +320 -0
  441. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +48 -0
  442. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +378 -0
  443. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +103 -0
  444. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +55 -0
  445. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +415 -0
  446. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +386 -0
  447. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +1360 -0
  448. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +944 -0
  449. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +642 -0
  450. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +414 -0
  451. data/ext/v8/upstream/scons/engine/SCons/Sig.py +63 -0
  452. data/ext/v8/upstream/scons/engine/SCons/Subst.py +911 -0
  453. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +1030 -0
  454. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +61 -0
  455. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +65 -0
  456. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +73 -0
  457. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +247 -0
  458. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +324 -0
  459. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  460. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  461. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +210 -0
  462. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +84 -0
  463. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +321 -0
  464. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +367 -0
  465. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +497 -0
  466. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +104 -0
  467. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +138 -0
  468. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +64 -0
  469. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +64 -0
  470. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +71 -0
  471. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +675 -0
  472. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +82 -0
  473. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +74 -0
  474. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +80 -0
  475. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +76 -0
  476. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +71 -0
  477. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +63 -0
  478. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +78 -0
  479. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +82 -0
  480. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +99 -0
  481. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +114 -0
  482. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +58 -0
  483. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +50 -0
  484. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +224 -0
  485. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +64 -0
  486. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +125 -0
  487. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +94 -0
  488. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +62 -0
  489. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +62 -0
  490. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +63 -0
  491. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +98 -0
  492. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +63 -0
  493. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +90 -0
  494. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +73 -0
  495. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +53 -0
  496. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +80 -0
  497. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +64 -0
  498. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +63 -0
  499. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +81 -0
  500. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +85 -0
  501. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +53 -0
  502. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +77 -0
  503. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +59 -0
  504. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +52 -0
  505. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +72 -0
  506. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +90 -0
  507. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +59 -0
  508. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +60 -0
  509. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +229 -0
  510. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +490 -0
  511. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +71 -0
  512. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +110 -0
  513. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +234 -0
  514. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +138 -0
  515. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +79 -0
  516. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +99 -0
  517. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +121 -0
  518. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +112 -0
  519. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +63 -0
  520. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +77 -0
  521. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +90 -0
  522. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +159 -0
  523. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +64 -0
  524. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +266 -0
  525. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +50 -0
  526. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +269 -0
  527. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +1439 -0
  528. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +208 -0
  529. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +107 -0
  530. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +72 -0
  531. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +314 -0
  532. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  533. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +526 -0
  534. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +367 -0
  535. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  536. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  537. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  538. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  539. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  540. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  541. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +78 -0
  542. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +83 -0
  543. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +108 -0
  544. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +336 -0
  545. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +121 -0
  546. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +70 -0
  547. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +132 -0
  548. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +68 -0
  549. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +58 -0
  550. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +53 -0
  551. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +63 -0
  552. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +67 -0
  553. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +142 -0
  554. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +58 -0
  555. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +63 -0
  556. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +64 -0
  557. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +64 -0
  558. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +77 -0
  559. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +186 -0
  560. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +73 -0
  561. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +805 -0
  562. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +175 -0
  563. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +53 -0
  564. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +100 -0
  565. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +131 -0
  566. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +100 -0
  567. data/ext/v8/upstream/scons/engine/SCons/Util.py +1645 -0
  568. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +91 -0
  569. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +107 -0
  570. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +139 -0
  571. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +109 -0
  572. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +147 -0
  573. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +317 -0
  574. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +228 -0
  575. data/ext/v8/upstream/scons/engine/SCons/__init__.py +49 -0
  576. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +302 -0
  577. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +98 -0
  578. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +91 -0
  579. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +124 -0
  580. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +1725 -0
  581. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +583 -0
  582. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +176 -0
  583. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +325 -0
  584. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +1296 -0
  585. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +382 -0
  586. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +187 -0
  587. data/ext/v8/upstream/scons/engine/SCons/cpp.py +598 -0
  588. data/ext/v8/upstream/scons/engine/SCons/dblite.py +248 -0
  589. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +77 -0
  590. data/ext/v8/upstream/scons/os_spawnv_fix.diff +83 -0
  591. data/ext/v8/upstream/scons/scons-time.1 +1017 -0
  592. data/ext/v8/upstream/scons/scons.1 +15179 -0
  593. data/ext/v8/upstream/scons/sconsign.1 +208 -0
  594. data/ext/v8/upstream/scons/script/scons +184 -0
  595. data/ext/v8/upstream/scons/script/scons-time +1529 -0
  596. data/ext/v8/upstream/scons/script/scons.bat +31 -0
  597. data/ext/v8/upstream/scons/script/sconsign +508 -0
  598. data/ext/v8/upstream/scons/setup.cfg +6 -0
  599. data/ext/v8/upstream/scons/setup.py +427 -0
  600. data/ext/v8/v8.cpp +89 -0
  601. data/ext/v8/v8_cxt.cpp +92 -0
  602. data/ext/v8/v8_cxt.h +20 -0
  603. data/ext/v8/v8_func.cpp +10 -0
  604. data/ext/v8/v8_func.h +11 -0
  605. data/ext/v8/v8_msg.cpp +54 -0
  606. data/ext/v8/v8_msg.h +18 -0
  607. data/ext/v8/v8_obj.cpp +52 -0
  608. data/ext/v8/v8_obj.h +13 -0
  609. data/ext/v8/v8_ref.cpp +26 -0
  610. data/ext/v8/v8_ref.h +31 -0
  611. data/ext/v8/v8_script.cpp +20 -0
  612. data/ext/v8/v8_script.h +8 -0
  613. data/ext/v8/v8_standalone.cpp +69 -0
  614. data/ext/v8/v8_standalone.h +31 -0
  615. data/ext/v8/v8_str.cpp +17 -0
  616. data/ext/v8/v8_str.h +9 -0
  617. data/ext/v8/v8_template.cpp +53 -0
  618. data/ext/v8/v8_template.h +13 -0
  619. data/lib/v8.rb +10 -0
  620. data/lib/v8/context.rb +101 -0
  621. data/lib/v8/object.rb +38 -0
  622. data/lib/v8/to.rb +33 -0
  623. data/lib/v8/v8.so +0 -0
  624. data/script/console +10 -0
  625. data/script/destroy +14 -0
  626. data/script/generate +14 -0
  627. data/spec/ext/cxt_spec.rb +25 -0
  628. data/spec/ext/obj_spec.rb +13 -0
  629. data/spec/redjs/jsapi_spec.rb +405 -0
  630. data/spec/redjs/tap.rb +8 -0
  631. data/spec/redjs_helper.rb +3 -0
  632. data/spec/spec.opts +1 -0
  633. data/spec/spec_helper.rb +14 -0
  634. data/spec/v8/to_spec.rb +15 -0
  635. data/tasks/rspec.rake +21 -0
  636. data/therubyracer.gemspec +680 -0
  637. metadata +697 -0
@@ -0,0 +1,423 @@
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
+ #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_
29
+ #define V8_ARM_MACRO_ASSEMBLER_ARM_H_
30
+
31
+ #include "assembler.h"
32
+
33
+ namespace v8 {
34
+ namespace internal {
35
+
36
+
37
+ // Give alias names to registers
38
+ const Register cp = { 8 }; // JavaScript context pointer
39
+
40
+
41
+ enum InvokeJSFlags {
42
+ CALL_JS,
43
+ JUMP_JS
44
+ };
45
+
46
+
47
+ // MacroAssembler implements a collection of frequently used macros.
48
+ class MacroAssembler: public Assembler {
49
+ public:
50
+ MacroAssembler(void* buffer, int size);
51
+
52
+ // ---------------------------------------------------------------------------
53
+ // Low-level helpers for compiler
54
+
55
+ // Jump, Call, and Ret pseudo instructions implementing inter-working
56
+ private:
57
+ void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
58
+ void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
59
+ public:
60
+ void Jump(Register target, Condition cond = al);
61
+ void Jump(byte* target, RelocInfo::Mode rmode, Condition cond = al);
62
+ void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
63
+ void Call(Register target, Condition cond = al);
64
+ void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al);
65
+ void Call(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
66
+ void Ret(Condition cond = al);
67
+
68
+ // Emit code to discard a non-negative number of pointer-sized elements
69
+ // from the stack, clobbering only the sp register.
70
+ void Drop(int count, Condition cond = al);
71
+
72
+ void Call(Label* target);
73
+ void Move(Register dst, Handle<Object> value);
74
+ // Jumps to the label at the index given by the Smi in "index".
75
+ void SmiJumpTable(Register index, Vector<Label*> targets);
76
+ // Load an object from the root table.
77
+ void LoadRoot(Register destination,
78
+ Heap::RootListIndex index,
79
+ Condition cond = al);
80
+
81
+ // Sets the remembered set bit for [address+offset], where address is the
82
+ // address of the heap object 'object'. The address must be in the first 8K
83
+ // of an allocated page. The 'scratch' register is used in the
84
+ // implementation and all 3 registers are clobbered by the operation, as
85
+ // well as the ip register.
86
+ void RecordWrite(Register object, Register offset, Register scratch);
87
+
88
+ // ---------------------------------------------------------------------------
89
+ // Stack limit support
90
+
91
+ void StackLimitCheck(Label* on_stack_limit_hit);
92
+
93
+ // ---------------------------------------------------------------------------
94
+ // Activation frames
95
+
96
+ void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); }
97
+ void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); }
98
+
99
+ void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
100
+ void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
101
+
102
+ // Enter specific kind of exit frame; either normal or debug mode.
103
+ // Expects the number of arguments in register r0 and
104
+ // the builtin function to call in register r1. Exits with argc in
105
+ // r4, argv in r6, and and the builtin function to call in r5.
106
+ void EnterExitFrame(ExitFrame::Mode mode);
107
+
108
+ // Leave the current exit frame. Expects the return value in r0.
109
+ void LeaveExitFrame(ExitFrame::Mode mode);
110
+
111
+ // Align the stack by optionally pushing a Smi zero.
112
+ void AlignStack(int offset);
113
+
114
+ void LoadContext(Register dst, int context_chain_length);
115
+
116
+ // ---------------------------------------------------------------------------
117
+ // JavaScript invokes
118
+
119
+ // Invoke the JavaScript function code by either calling or jumping.
120
+ void InvokeCode(Register code,
121
+ const ParameterCount& expected,
122
+ const ParameterCount& actual,
123
+ InvokeFlag flag);
124
+
125
+ void InvokeCode(Handle<Code> code,
126
+ const ParameterCount& expected,
127
+ const ParameterCount& actual,
128
+ RelocInfo::Mode rmode,
129
+ InvokeFlag flag);
130
+
131
+ // Invoke the JavaScript function in the given register. Changes the
132
+ // current context to the context in the function before invoking.
133
+ void InvokeFunction(Register function,
134
+ const ParameterCount& actual,
135
+ InvokeFlag flag);
136
+
137
+
138
+ #ifdef ENABLE_DEBUGGER_SUPPORT
139
+ // ---------------------------------------------------------------------------
140
+ // Debugger Support
141
+
142
+ void SaveRegistersToMemory(RegList regs);
143
+ void RestoreRegistersFromMemory(RegList regs);
144
+ void CopyRegistersFromMemoryToStack(Register base, RegList regs);
145
+ void CopyRegistersFromStackToMemory(Register base,
146
+ Register scratch,
147
+ RegList regs);
148
+ #endif
149
+
150
+ // ---------------------------------------------------------------------------
151
+ // Exception handling
152
+
153
+ // Push a new try handler and link into try handler chain.
154
+ // The return address must be passed in register lr.
155
+ // On exit, r0 contains TOS (code slot).
156
+ void PushTryHandler(CodeLocation try_location, HandlerType type);
157
+
158
+ // Unlink the stack handler on top of the stack from the try handler chain.
159
+ // Must preserve the result register.
160
+ void PopTryHandler();
161
+
162
+ // ---------------------------------------------------------------------------
163
+ // Inline caching support
164
+
165
+ // Generates code that verifies that the maps of objects in the
166
+ // prototype chain of object hasn't changed since the code was
167
+ // generated and branches to the miss label if any map has. If
168
+ // necessary the function also generates code for security check
169
+ // in case of global object holders. The scratch and holder
170
+ // registers are always clobbered, but the object register is only
171
+ // clobbered if it the same as the holder register. The function
172
+ // returns a register containing the holder - either object_reg or
173
+ // holder_reg.
174
+ Register CheckMaps(JSObject* object, Register object_reg,
175
+ JSObject* holder, Register holder_reg,
176
+ Register scratch, Label* miss);
177
+
178
+ // Generate code for checking access rights - used for security checks
179
+ // on access to global objects across environments. The holder register
180
+ // is left untouched, whereas both scratch registers are clobbered.
181
+ void CheckAccessGlobalProxy(Register holder_reg,
182
+ Register scratch,
183
+ Label* miss);
184
+
185
+
186
+ // ---------------------------------------------------------------------------
187
+ // Allocation support
188
+
189
+ // Allocate an object in new space. The object_size is specified in words (not
190
+ // bytes). If the new space is exhausted control continues at the gc_required
191
+ // label. The allocated object is returned in result. If the flag
192
+ // tag_allocated_object is true the result is tagged as as a heap object.
193
+ void AllocateInNewSpace(int object_size,
194
+ Register result,
195
+ Register scratch1,
196
+ Register scratch2,
197
+ Label* gc_required,
198
+ AllocationFlags flags);
199
+ void AllocateInNewSpace(Register object_size,
200
+ Register result,
201
+ Register scratch1,
202
+ Register scratch2,
203
+ Label* gc_required,
204
+ AllocationFlags flags);
205
+
206
+ // Undo allocation in new space. The object passed and objects allocated after
207
+ // it will no longer be allocated. The caller must make sure that no pointers
208
+ // are left to the object(s) no longer allocated as they would be invalid when
209
+ // allocation is undone.
210
+ void UndoAllocationInNewSpace(Register object, Register scratch);
211
+
212
+ // ---------------------------------------------------------------------------
213
+ // Support functions.
214
+
215
+ // Try to get function prototype of a function and puts the value in
216
+ // the result register. Checks that the function really is a
217
+ // function and jumps to the miss label if the fast checks fail. The
218
+ // function register will be untouched; the other registers may be
219
+ // clobbered.
220
+ void TryGetFunctionPrototype(Register function,
221
+ Register result,
222
+ Register scratch,
223
+ Label* miss);
224
+
225
+ // Compare object type for heap object. heap_object contains a non-Smi
226
+ // whose object type should be compared with the given type. This both
227
+ // sets the flags and leaves the object type in the type_reg register.
228
+ // It leaves the map in the map register (unless the type_reg and map register
229
+ // are the same register). It leaves the heap object in the heap_object
230
+ // register unless the heap_object register is the same register as one of the
231
+ // other registers.
232
+ void CompareObjectType(Register heap_object,
233
+ Register map,
234
+ Register type_reg,
235
+ InstanceType type);
236
+
237
+ // Compare instance type in a map. map contains a valid map object whose
238
+ // object type should be compared with the given type. This both
239
+ // sets the flags and leaves the object type in the type_reg register. It
240
+ // leaves the heap object in the heap_object register unless the heap_object
241
+ // register is the same register as type_reg.
242
+ void CompareInstanceType(Register map,
243
+ Register type_reg,
244
+ InstanceType type);
245
+
246
+ inline void BranchOnSmi(Register value, Label* smi_label) {
247
+ tst(value, Operand(kSmiTagMask));
248
+ b(eq, smi_label);
249
+ }
250
+
251
+ inline void BranchOnNotSmi(Register value, Label* not_smi_label) {
252
+ tst(value, Operand(kSmiTagMask));
253
+ b(ne, not_smi_label);
254
+ }
255
+
256
+ // Generates code for reporting that an illegal operation has
257
+ // occurred.
258
+ void IllegalOperation(int num_arguments);
259
+
260
+ // Uses VFP instructions to Convert a Smi to a double.
261
+ void IntegerToDoubleConversionWithVFP3(Register inReg,
262
+ Register outHighReg,
263
+ Register outLowReg);
264
+
265
+
266
+ // ---------------------------------------------------------------------------
267
+ // Runtime calls
268
+
269
+ // Call a code stub.
270
+ void CallStub(CodeStub* stub, Condition cond = al);
271
+
272
+ // Return from a code stub after popping its arguments.
273
+ void StubReturn(int argc);
274
+
275
+ // Call a runtime routine.
276
+ // Eventually this should be used for all C calls.
277
+ void CallRuntime(Runtime::Function* f, int num_arguments);
278
+
279
+ // Convenience function: Same as above, but takes the fid instead.
280
+ void CallRuntime(Runtime::FunctionId fid, int num_arguments);
281
+
282
+ // Tail call of a runtime routine (jump).
283
+ // Like JumpToRuntime, but also takes care of passing the number
284
+ // of parameters.
285
+ void TailCallRuntime(const ExternalReference& ext,
286
+ int num_arguments,
287
+ int result_size);
288
+
289
+ // Jump to a runtime routine.
290
+ void JumpToRuntime(const ExternalReference& builtin);
291
+
292
+ // Invoke specified builtin JavaScript function. Adds an entry to
293
+ // the unresolved list if the name does not resolve.
294
+ void InvokeBuiltin(Builtins::JavaScript id, InvokeJSFlags flags);
295
+
296
+ // Store the code object for the given builtin in the target register and
297
+ // setup the function in r1.
298
+ void GetBuiltinEntry(Register target, Builtins::JavaScript id);
299
+
300
+ struct Unresolved {
301
+ int pc;
302
+ uint32_t flags; // see Bootstrapper::FixupFlags decoders/encoders.
303
+ const char* name;
304
+ };
305
+ List<Unresolved>* unresolved() { return &unresolved_; }
306
+
307
+ Handle<Object> CodeObject() { return code_object_; }
308
+
309
+
310
+ // ---------------------------------------------------------------------------
311
+ // StatsCounter support
312
+
313
+ void SetCounter(StatsCounter* counter, int value,
314
+ Register scratch1, Register scratch2);
315
+ void IncrementCounter(StatsCounter* counter, int value,
316
+ Register scratch1, Register scratch2);
317
+ void DecrementCounter(StatsCounter* counter, int value,
318
+ Register scratch1, Register scratch2);
319
+
320
+
321
+ // ---------------------------------------------------------------------------
322
+ // Debugging
323
+
324
+ // Calls Abort(msg) if the condition cc is not satisfied.
325
+ // Use --debug_code to enable.
326
+ void Assert(Condition cc, const char* msg);
327
+
328
+ // Like Assert(), but always enabled.
329
+ void Check(Condition cc, const char* msg);
330
+
331
+ // Print a message to stdout and abort execution.
332
+ void Abort(const char* msg);
333
+
334
+ // Verify restrictions about code generated in stubs.
335
+ void set_generating_stub(bool value) { generating_stub_ = value; }
336
+ bool generating_stub() { return generating_stub_; }
337
+ void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
338
+ bool allow_stub_calls() { return allow_stub_calls_; }
339
+
340
+ private:
341
+ List<Unresolved> unresolved_;
342
+ bool generating_stub_;
343
+ bool allow_stub_calls_;
344
+ Handle<Object> code_object_; // This handle will be patched with the code
345
+ // object on installation.
346
+
347
+ // Helper functions for generating invokes.
348
+ void InvokePrologue(const ParameterCount& expected,
349
+ const ParameterCount& actual,
350
+ Handle<Code> code_constant,
351
+ Register code_reg,
352
+ Label* done,
353
+ InvokeFlag flag);
354
+
355
+ // Prepares for a call or jump to a builtin by doing two things:
356
+ // 1. Emits code that fetches the builtin's function object from the context
357
+ // at runtime, and puts it in the register rdi.
358
+ // 2. Fetches the builtin's code object, and returns it in a handle, at
359
+ // compile time, so that later code can emit instructions to jump or call
360
+ // the builtin directly. If the code object has not yet been created, it
361
+ // returns the builtin code object for IllegalFunction, and sets the
362
+ // output parameter "resolved" to false. Code that uses the return value
363
+ // should then add the address and the builtin name to the list of fixups
364
+ // called unresolved_, which is fixed up by the bootstrapper.
365
+ Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved);
366
+
367
+ // Activation support.
368
+ void EnterFrame(StackFrame::Type type);
369
+ void LeaveFrame(StackFrame::Type type);
370
+ };
371
+
372
+
373
+ #ifdef ENABLE_DEBUGGER_SUPPORT
374
+ // The code patcher is used to patch (typically) small parts of code e.g. for
375
+ // debugging and other types of instrumentation. When using the code patcher
376
+ // the exact number of bytes specified must be emitted. It is not legal to emit
377
+ // relocation information. If any of these constraints are violated it causes
378
+ // an assertion to fail.
379
+ class CodePatcher {
380
+ public:
381
+ CodePatcher(byte* address, int instructions);
382
+ virtual ~CodePatcher();
383
+
384
+ // Macro assembler to emit code.
385
+ MacroAssembler* masm() { return &masm_; }
386
+
387
+ // Emit an instruction directly.
388
+ void Emit(Instr x);
389
+
390
+ // Emit an address directly.
391
+ void Emit(Address addr);
392
+
393
+ private:
394
+ byte* address_; // The address of the code being patched.
395
+ int instructions_; // Number of instructions of the expected patch size.
396
+ int size_; // Number of bytes of the expected patch size.
397
+ MacroAssembler masm_; // Macro assembler used to generate the code.
398
+ };
399
+ #endif // ENABLE_DEBUGGER_SUPPORT
400
+
401
+
402
+ // -----------------------------------------------------------------------------
403
+ // Static helper functions.
404
+
405
+ // Generate a MemOperand for loading a field from an object.
406
+ static inline MemOperand FieldMemOperand(Register object, int offset) {
407
+ return MemOperand(object, offset - kHeapObjectTag);
408
+ }
409
+
410
+
411
+ #ifdef GENERATED_CODE_COVERAGE
412
+ #define CODE_COVERAGE_STRINGIFY(x) #x
413
+ #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
414
+ #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
415
+ #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
416
+ #else
417
+ #define ACCESS_MASM(masm) masm->
418
+ #endif
419
+
420
+
421
+ } } // namespace v8::internal
422
+
423
+ #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_
@@ -0,0 +1,1266 @@
1
+ // Copyright 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
+ #include "v8.h"
29
+ #include "unicode.h"
30
+ #include "log.h"
31
+ #include "ast.h"
32
+ #include "code-stubs.h"
33
+ #include "regexp-stack.h"
34
+ #include "macro-assembler.h"
35
+ #include "regexp-macro-assembler.h"
36
+ #include "arm/macro-assembler-arm.h"
37
+ #include "arm/regexp-macro-assembler-arm.h"
38
+
39
+ namespace v8 {
40
+ namespace internal {
41
+
42
+ #ifdef V8_NATIVE_REGEXP
43
+ /*
44
+ * This assembler uses the following register assignment convention
45
+ * - r5 : Pointer to current code object (Code*) including heap object tag.
46
+ * - r6 : Current position in input, as negative offset from end of string.
47
+ * Please notice that this is the byte offset, not the character offset!
48
+ * - r7 : Currently loaded character. Must be loaded using
49
+ * LoadCurrentCharacter before using any of the dispatch methods.
50
+ * - r8 : points to tip of backtrack stack
51
+ * - r9 : Unused, might be used by C code and expected unchanged.
52
+ * - r10 : End of input (points to byte after last character in input).
53
+ * - r11 : Frame pointer. Used to access arguments, local variables and
54
+ * RegExp registers.
55
+ * - r12 : IP register, used by assembler. Very volatile.
56
+ * - r13/sp : points to tip of C stack.
57
+ *
58
+ * The remaining registers are free for computations.
59
+ *
60
+ * Each call to a public method should retain this convention.
61
+ * The stack will have the following structure:
62
+ * - direct_call (if 1, direct call from JavaScript code, if 0 call
63
+ * through the runtime system)
64
+ * - stack_area_base (High end of the memory area to use as
65
+ * backtracking stack)
66
+ * - at_start (if 1, we are starting at the start of the
67
+ * string, otherwise 0)
68
+ * - int* capture_array (int[num_saved_registers_], for output).
69
+ * --- sp when called ---
70
+ * - link address
71
+ * - backup of registers r4..r11
72
+ * - end of input (Address of end of string)
73
+ * - start of input (Address of first character in string)
74
+ * - start index (character index of start)
75
+ * --- frame pointer ----
76
+ * - void* input_string (location of a handle containing the string)
77
+ * - Offset of location before start of input (effectively character
78
+ * position -1). Used to initialize capture registers to a non-position.
79
+ * - register 0 (Only positions must be stored in the first
80
+ * - register 1 num_saved_registers_ registers)
81
+ * - ...
82
+ * - register num_registers-1
83
+ * --- sp ---
84
+ *
85
+ * The first num_saved_registers_ registers are initialized to point to
86
+ * "character -1" in the string (i.e., char_size() bytes before the first
87
+ * character of the string). The remaining registers start out as garbage.
88
+ *
89
+ * The data up to the return address must be placed there by the calling
90
+ * code, by calling the code entry as cast to a function with the signature:
91
+ * int (*match)(String* input_string,
92
+ * int start_index,
93
+ * Address start,
94
+ * Address end,
95
+ * int* capture_output_array,
96
+ * bool at_start,
97
+ * byte* stack_area_base,
98
+ * bool direct_call)
99
+ * The call is performed by NativeRegExpMacroAssembler::Execute()
100
+ * (in regexp-macro-assembler.cc).
101
+ */
102
+
103
+ #define __ ACCESS_MASM(masm_)
104
+
105
+ RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(
106
+ Mode mode,
107
+ int registers_to_save)
108
+ : masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
109
+ mode_(mode),
110
+ num_registers_(registers_to_save),
111
+ num_saved_registers_(registers_to_save),
112
+ entry_label_(),
113
+ start_label_(),
114
+ success_label_(),
115
+ backtrack_label_(),
116
+ exit_label_() {
117
+ ASSERT_EQ(0, registers_to_save % 2);
118
+ __ jmp(&entry_label_); // We'll write the entry code later.
119
+ EmitBacktrackConstantPool();
120
+ __ bind(&start_label_); // And then continue from here.
121
+ }
122
+
123
+
124
+ RegExpMacroAssemblerARM::~RegExpMacroAssemblerARM() {
125
+ delete masm_;
126
+ // Unuse labels in case we throw away the assembler without calling GetCode.
127
+ entry_label_.Unuse();
128
+ start_label_.Unuse();
129
+ success_label_.Unuse();
130
+ backtrack_label_.Unuse();
131
+ exit_label_.Unuse();
132
+ check_preempt_label_.Unuse();
133
+ stack_overflow_label_.Unuse();
134
+ }
135
+
136
+
137
+ int RegExpMacroAssemblerARM::stack_limit_slack() {
138
+ return RegExpStack::kStackLimitSlack;
139
+ }
140
+
141
+
142
+ void RegExpMacroAssemblerARM::AdvanceCurrentPosition(int by) {
143
+ if (by != 0) {
144
+ Label inside_string;
145
+ __ add(current_input_offset(),
146
+ current_input_offset(), Operand(by * char_size()));
147
+ }
148
+ }
149
+
150
+
151
+ void RegExpMacroAssemblerARM::AdvanceRegister(int reg, int by) {
152
+ ASSERT(reg >= 0);
153
+ ASSERT(reg < num_registers_);
154
+ if (by != 0) {
155
+ __ ldr(r0, register_location(reg));
156
+ __ add(r0, r0, Operand(by));
157
+ __ str(r0, register_location(reg));
158
+ }
159
+ }
160
+
161
+
162
+ void RegExpMacroAssemblerARM::Backtrack() {
163
+ CheckPreemption();
164
+ // Pop Code* offset from backtrack stack, add Code* and jump to location.
165
+ Pop(r0);
166
+ __ add(pc, r0, Operand(r5));
167
+ }
168
+
169
+
170
+ void RegExpMacroAssemblerARM::Bind(Label* label) {
171
+ __ bind(label);
172
+ }
173
+
174
+
175
+ void RegExpMacroAssemblerARM::CheckCharacter(uint32_t c, Label* on_equal) {
176
+ __ cmp(current_character(), Operand(c));
177
+ BranchOrBacktrack(eq, on_equal);
178
+ }
179
+
180
+
181
+ void RegExpMacroAssemblerARM::CheckCharacterGT(uc16 limit, Label* on_greater) {
182
+ __ cmp(current_character(), Operand(limit));
183
+ BranchOrBacktrack(gt, on_greater);
184
+ }
185
+
186
+
187
+ void RegExpMacroAssemblerARM::CheckAtStart(Label* on_at_start) {
188
+ Label not_at_start;
189
+ // Did we start the match at the start of the string at all?
190
+ __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
191
+ __ cmp(r0, Operand(0));
192
+ BranchOrBacktrack(eq, &not_at_start);
193
+
194
+ // If we did, are we still at the start of the input?
195
+ __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
196
+ __ add(r0, end_of_input_address(), Operand(current_input_offset()));
197
+ __ cmp(r0, r1);
198
+ BranchOrBacktrack(eq, on_at_start);
199
+ __ bind(&not_at_start);
200
+ }
201
+
202
+
203
+ void RegExpMacroAssemblerARM::CheckNotAtStart(Label* on_not_at_start) {
204
+ // Did we start the match at the start of the string at all?
205
+ __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
206
+ __ cmp(r0, Operand(0));
207
+ BranchOrBacktrack(eq, on_not_at_start);
208
+ // If we did, are we still at the start of the input?
209
+ __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
210
+ __ add(r0, end_of_input_address(), Operand(current_input_offset()));
211
+ __ cmp(r0, r1);
212
+ BranchOrBacktrack(ne, on_not_at_start);
213
+ }
214
+
215
+
216
+ void RegExpMacroAssemblerARM::CheckCharacterLT(uc16 limit, Label* on_less) {
217
+ __ cmp(current_character(), Operand(limit));
218
+ BranchOrBacktrack(lt, on_less);
219
+ }
220
+
221
+
222
+ void RegExpMacroAssemblerARM::CheckCharacters(Vector<const uc16> str,
223
+ int cp_offset,
224
+ Label* on_failure,
225
+ bool check_end_of_string) {
226
+ if (on_failure == NULL) {
227
+ // Instead of inlining a backtrack for each test, (re)use the global
228
+ // backtrack target.
229
+ on_failure = &backtrack_label_;
230
+ }
231
+
232
+ if (check_end_of_string) {
233
+ // Is last character of required match inside string.
234
+ CheckPosition(cp_offset + str.length() - 1, on_failure);
235
+ }
236
+
237
+ __ add(r0, end_of_input_address(), Operand(current_input_offset()));
238
+ if (cp_offset != 0) {
239
+ int byte_offset = cp_offset * char_size();
240
+ __ add(r0, r0, Operand(byte_offset));
241
+ }
242
+
243
+ // r0 : Address of characters to match against str.
244
+ int stored_high_byte = 0;
245
+ for (int i = 0; i < str.length(); i++) {
246
+ if (mode_ == ASCII) {
247
+ __ ldrb(r1, MemOperand(r0, char_size(), PostIndex));
248
+ ASSERT(str[i] <= String::kMaxAsciiCharCode);
249
+ __ cmp(r1, Operand(str[i]));
250
+ } else {
251
+ __ ldrh(r1, MemOperand(r0, char_size(), PostIndex));
252
+ uc16 match_char = str[i];
253
+ int match_high_byte = (match_char >> 8);
254
+ if (match_high_byte == 0) {
255
+ __ cmp(r1, Operand(str[i]));
256
+ } else {
257
+ if (match_high_byte != stored_high_byte) {
258
+ __ mov(r2, Operand(match_high_byte));
259
+ stored_high_byte = match_high_byte;
260
+ }
261
+ __ add(r3, r2, Operand(match_char & 0xff));
262
+ __ cmp(r1, r3);
263
+ }
264
+ }
265
+ BranchOrBacktrack(ne, on_failure);
266
+ }
267
+ }
268
+
269
+
270
+ void RegExpMacroAssemblerARM::CheckGreedyLoop(Label* on_equal) {
271
+ __ ldr(r0, MemOperand(backtrack_stackpointer(), 0));
272
+ __ cmp(current_input_offset(), r0);
273
+ __ add(backtrack_stackpointer(),
274
+ backtrack_stackpointer(), Operand(kPointerSize), LeaveCC, eq);
275
+ BranchOrBacktrack(eq, on_equal);
276
+ }
277
+
278
+
279
+ void RegExpMacroAssemblerARM::CheckNotBackReferenceIgnoreCase(
280
+ int start_reg,
281
+ Label* on_no_match) {
282
+ Label fallthrough;
283
+ __ ldr(r0, register_location(start_reg)); // Index of start of capture
284
+ __ ldr(r1, register_location(start_reg + 1)); // Index of end of capture
285
+ __ sub(r1, r1, r0, SetCC); // Length of capture.
286
+
287
+ // If length is zero, either the capture is empty or it is not participating.
288
+ // In either case succeed immediately.
289
+ __ b(eq, &fallthrough);
290
+
291
+ // Check that there are enough characters left in the input.
292
+ __ cmn(r1, Operand(current_input_offset()));
293
+ BranchOrBacktrack(gt, on_no_match);
294
+
295
+ if (mode_ == ASCII) {
296
+ Label success;
297
+ Label fail;
298
+ Label loop_check;
299
+
300
+ // r0 - offset of start of capture
301
+ // r1 - length of capture
302
+ __ add(r0, r0, Operand(end_of_input_address()));
303
+ __ add(r2, end_of_input_address(), Operand(current_input_offset()));
304
+ __ add(r1, r0, Operand(r1));
305
+
306
+ // r0 - Address of start of capture.
307
+ // r1 - Address of end of capture
308
+ // r2 - Address of current input position.
309
+
310
+ Label loop;
311
+ __ bind(&loop);
312
+ __ ldrb(r3, MemOperand(r0, char_size(), PostIndex));
313
+ __ ldrb(r4, MemOperand(r2, char_size(), PostIndex));
314
+ __ cmp(r4, r3);
315
+ __ b(eq, &loop_check);
316
+
317
+ // Mismatch, try case-insensitive match (converting letters to lower-case).
318
+ __ orr(r3, r3, Operand(0x20)); // Convert capture character to lower-case.
319
+ __ orr(r4, r4, Operand(0x20)); // Also convert input character.
320
+ __ cmp(r4, r3);
321
+ __ b(ne, &fail);
322
+ __ sub(r3, r3, Operand('a'));
323
+ __ cmp(r3, Operand('z' - 'a')); // Is r3 a lowercase letter?
324
+ __ b(hi, &fail);
325
+
326
+
327
+ __ bind(&loop_check);
328
+ __ cmp(r0, r1);
329
+ __ b(lt, &loop);
330
+ __ jmp(&success);
331
+
332
+ __ bind(&fail);
333
+ BranchOrBacktrack(al, on_no_match);
334
+
335
+ __ bind(&success);
336
+ // Compute new value of character position after the matched part.
337
+ __ sub(current_input_offset(), r2, end_of_input_address());
338
+ } else {
339
+ ASSERT(mode_ == UC16);
340
+ int argument_count = 3;
341
+ FrameAlign(argument_count, r2);
342
+
343
+ // r0 - offset of start of capture
344
+ // r1 - length of capture
345
+
346
+ // Put arguments into arguments registers.
347
+ // Parameters are
348
+ // r0: Address byte_offset1 - Address captured substring's start.
349
+ // r1: Address byte_offset2 - Address of current character position.
350
+ // r2: size_t byte_length - length of capture in bytes(!)
351
+
352
+ // Address of start of capture.
353
+ __ add(r0, r0, Operand(end_of_input_address()));
354
+ // Length of capture.
355
+ __ mov(r2, Operand(r1));
356
+ // Save length in callee-save register for use on return.
357
+ __ mov(r4, Operand(r1));
358
+ // Address of current input position.
359
+ __ add(r1, current_input_offset(), Operand(end_of_input_address()));
360
+
361
+ ExternalReference function =
362
+ ExternalReference::re_case_insensitive_compare_uc16();
363
+ CallCFunction(function, argument_count);
364
+
365
+ // Check if function returned non-zero for success or zero for failure.
366
+ __ cmp(r0, Operand(0));
367
+ BranchOrBacktrack(eq, on_no_match);
368
+ // On success, increment position by length of capture.
369
+ __ add(current_input_offset(), current_input_offset(), Operand(r4));
370
+ }
371
+
372
+ __ bind(&fallthrough);
373
+ }
374
+
375
+
376
+ void RegExpMacroAssemblerARM::CheckNotBackReference(
377
+ int start_reg,
378
+ Label* on_no_match) {
379
+ Label fallthrough;
380
+ Label success;
381
+
382
+ // Find length of back-referenced capture.
383
+ __ ldr(r0, register_location(start_reg));
384
+ __ ldr(r1, register_location(start_reg + 1));
385
+ __ sub(r1, r1, r0, SetCC); // Length to check.
386
+ // Succeed on empty capture (including no capture).
387
+ __ b(eq, &fallthrough);
388
+
389
+ // Check that there are enough characters left in the input.
390
+ __ cmn(r1, Operand(current_input_offset()));
391
+ BranchOrBacktrack(gt, on_no_match);
392
+
393
+ // Compute pointers to match string and capture string
394
+ __ add(r0, r0, Operand(end_of_input_address()));
395
+ __ add(r2, end_of_input_address(), Operand(current_input_offset()));
396
+ __ add(r1, r1, Operand(r0));
397
+
398
+ Label loop;
399
+ __ bind(&loop);
400
+ if (mode_ == ASCII) {
401
+ __ ldrb(r3, MemOperand(r0, char_size(), PostIndex));
402
+ __ ldrb(r4, MemOperand(r2, char_size(), PostIndex));
403
+ } else {
404
+ ASSERT(mode_ == UC16);
405
+ __ ldrh(r3, MemOperand(r0, char_size(), PostIndex));
406
+ __ ldrh(r4, MemOperand(r2, char_size(), PostIndex));
407
+ }
408
+ __ cmp(r3, r4);
409
+ BranchOrBacktrack(ne, on_no_match);
410
+ __ cmp(r0, r1);
411
+ __ b(lt, &loop);
412
+
413
+ // Move current character position to position after match.
414
+ __ sub(current_input_offset(), r2, end_of_input_address());
415
+ __ bind(&fallthrough);
416
+ }
417
+
418
+
419
+ void RegExpMacroAssemblerARM::CheckNotRegistersEqual(int reg1,
420
+ int reg2,
421
+ Label* on_not_equal) {
422
+ __ ldr(r0, register_location(reg1));
423
+ __ ldr(r1, register_location(reg2));
424
+ __ cmp(r0, r1);
425
+ BranchOrBacktrack(ne, on_not_equal);
426
+ }
427
+
428
+
429
+ void RegExpMacroAssemblerARM::CheckNotCharacter(uint32_t c,
430
+ Label* on_not_equal) {
431
+ __ cmp(current_character(), Operand(c));
432
+ BranchOrBacktrack(ne, on_not_equal);
433
+ }
434
+
435
+
436
+ void RegExpMacroAssemblerARM::CheckCharacterAfterAnd(uint32_t c,
437
+ uint32_t mask,
438
+ Label* on_equal) {
439
+ __ and_(r0, current_character(), Operand(mask));
440
+ __ cmp(r0, Operand(c));
441
+ BranchOrBacktrack(eq, on_equal);
442
+ }
443
+
444
+
445
+ void RegExpMacroAssemblerARM::CheckNotCharacterAfterAnd(uint32_t c,
446
+ uint32_t mask,
447
+ Label* on_not_equal) {
448
+ __ and_(r0, current_character(), Operand(mask));
449
+ __ cmp(r0, Operand(c));
450
+ BranchOrBacktrack(ne, on_not_equal);
451
+ }
452
+
453
+
454
+ void RegExpMacroAssemblerARM::CheckNotCharacterAfterMinusAnd(
455
+ uc16 c,
456
+ uc16 minus,
457
+ uc16 mask,
458
+ Label* on_not_equal) {
459
+ ASSERT(minus < String::kMaxUC16CharCode);
460
+ __ sub(r0, current_character(), Operand(minus));
461
+ __ and_(r0, r0, Operand(mask));
462
+ __ cmp(r0, Operand(c));
463
+ BranchOrBacktrack(ne, on_not_equal);
464
+ }
465
+
466
+
467
+ bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type,
468
+ Label* on_no_match) {
469
+ // Range checks (c in min..max) are generally implemented by an unsigned
470
+ // (c - min) <= (max - min) check
471
+ switch (type) {
472
+ case 's':
473
+ // Match space-characters
474
+ if (mode_ == ASCII) {
475
+ // ASCII space characters are '\t'..'\r' and ' '.
476
+ Label success;
477
+ __ cmp(current_character(), Operand(' '));
478
+ __ b(eq, &success);
479
+ // Check range 0x09..0x0d
480
+ __ sub(r0, current_character(), Operand('\t'));
481
+ __ cmp(r0, Operand('\r' - '\t'));
482
+ BranchOrBacktrack(hi, on_no_match);
483
+ __ bind(&success);
484
+ return true;
485
+ }
486
+ return false;
487
+ case 'S':
488
+ // Match non-space characters.
489
+ if (mode_ == ASCII) {
490
+ // ASCII space characters are '\t'..'\r' and ' '.
491
+ __ cmp(current_character(), Operand(' '));
492
+ BranchOrBacktrack(eq, on_no_match);
493
+ __ sub(r0, current_character(), Operand('\t'));
494
+ __ cmp(r0, Operand('\r' - '\t'));
495
+ BranchOrBacktrack(ls, on_no_match);
496
+ return true;
497
+ }
498
+ return false;
499
+ case 'd':
500
+ // Match ASCII digits ('0'..'9')
501
+ __ sub(r0, current_character(), Operand('0'));
502
+ __ cmp(current_character(), Operand('9' - '0'));
503
+ BranchOrBacktrack(hi, on_no_match);
504
+ return true;
505
+ case 'D':
506
+ // Match non ASCII-digits
507
+ __ sub(r0, current_character(), Operand('0'));
508
+ __ cmp(r0, Operand('9' - '0'));
509
+ BranchOrBacktrack(ls, on_no_match);
510
+ return true;
511
+ case '.': {
512
+ // Match non-newlines (not 0x0a('\n'), 0x0d('\r'), 0x2028 and 0x2029)
513
+ __ eor(r0, current_character(), Operand(0x01));
514
+ // See if current character is '\n'^1 or '\r'^1, i.e., 0x0b or 0x0c
515
+ __ sub(r0, r0, Operand(0x0b));
516
+ __ cmp(r0, Operand(0x0c - 0x0b));
517
+ BranchOrBacktrack(ls, on_no_match);
518
+ if (mode_ == UC16) {
519
+ // Compare original value to 0x2028 and 0x2029, using the already
520
+ // computed (current_char ^ 0x01 - 0x0b). I.e., check for
521
+ // 0x201d (0x2028 - 0x0b) or 0x201e.
522
+ __ sub(r0, r0, Operand(0x2028 - 0x0b));
523
+ __ cmp(r0, Operand(1));
524
+ BranchOrBacktrack(ls, on_no_match);
525
+ }
526
+ return true;
527
+ }
528
+ case 'n': {
529
+ // Match newlines (0x0a('\n'), 0x0d('\r'), 0x2028 and 0x2029)
530
+ __ eor(r0, current_character(), Operand(0x01));
531
+ // See if current character is '\n'^1 or '\r'^1, i.e., 0x0b or 0x0c
532
+ __ sub(r0, r0, Operand(0x0b));
533
+ __ cmp(r0, Operand(0x0c - 0x0b));
534
+ if (mode_ == ASCII) {
535
+ BranchOrBacktrack(hi, on_no_match);
536
+ } else {
537
+ Label done;
538
+ __ b(ls, &done);
539
+ // Compare original value to 0x2028 and 0x2029, using the already
540
+ // computed (current_char ^ 0x01 - 0x0b). I.e., check for
541
+ // 0x201d (0x2028 - 0x0b) or 0x201e.
542
+ __ sub(r0, r0, Operand(0x2028 - 0x0b));
543
+ __ cmp(r0, Operand(1));
544
+ BranchOrBacktrack(hi, on_no_match);
545
+ __ bind(&done);
546
+ }
547
+ return true;
548
+ }
549
+ case 'w': {
550
+ // Match word character (0-9, A-Z, a-z and _).
551
+ Label digits, done;
552
+ __ cmp(current_character(), Operand('9'));
553
+ __ b(ls, &digits);
554
+ __ cmp(current_character(), Operand('_'));
555
+ __ b(eq, &done);
556
+ __ orr(r0, current_character(), Operand(0x20));
557
+ __ sub(r0, r0, Operand('a'));
558
+ __ cmp(r0, Operand('z' - 'a'));
559
+ BranchOrBacktrack(hi, on_no_match);
560
+ __ jmp(&done);
561
+
562
+ __ bind(&digits);
563
+ __ cmp(current_character(), Operand('0'));
564
+ BranchOrBacktrack(lo, on_no_match);
565
+ __ bind(&done);
566
+
567
+ return true;
568
+ }
569
+ case 'W': {
570
+ // Match non-word character (not 0-9, A-Z, a-z and _).
571
+ Label digits, done;
572
+ __ cmp(current_character(), Operand('9'));
573
+ __ b(ls, &digits);
574
+ __ cmp(current_character(), Operand('_'));
575
+ BranchOrBacktrack(eq, on_no_match);
576
+ __ orr(r0, current_character(), Operand(0x20));
577
+ __ sub(r0, r0, Operand('a'));
578
+ __ cmp(r0, Operand('z' - 'a'));
579
+ BranchOrBacktrack(ls, on_no_match);
580
+ __ jmp(&done);
581
+
582
+ __ bind(&digits);
583
+ __ cmp(current_character(), Operand('0'));
584
+ BranchOrBacktrack(hs, on_no_match);
585
+ __ bind(&done);
586
+
587
+ return true;
588
+ }
589
+ case '*':
590
+ // Match any character.
591
+ return true;
592
+ // No custom implementation (yet): s(UC16), S(UC16).
593
+ default:
594
+ return false;
595
+ }
596
+ }
597
+
598
+
599
+ void RegExpMacroAssemblerARM::Fail() {
600
+ __ mov(r0, Operand(FAILURE));
601
+ __ jmp(&exit_label_);
602
+ }
603
+
604
+
605
+ Handle<Object> RegExpMacroAssemblerARM::GetCode(Handle<String> source) {
606
+ // Finalize code - write the entry point code now we know how many
607
+ // registers we need.
608
+
609
+ // Entry code:
610
+ __ bind(&entry_label_);
611
+ // Push Link register.
612
+ // Push arguments
613
+ // Save callee-save registers.
614
+ // Start new stack frame.
615
+ // Order here should correspond to order of offset constants in header file.
616
+ RegList registers_to_retain = r4.bit() | r5.bit() | r6.bit() |
617
+ r7.bit() | r8.bit() | r9.bit() | r10.bit() | fp.bit();
618
+ RegList argument_registers = r0.bit() | r1.bit() | r2.bit() | r3.bit();
619
+ __ stm(db_w, sp, argument_registers | registers_to_retain | lr.bit());
620
+ // Set frame pointer just above the arguments.
621
+ __ add(frame_pointer(), sp, Operand(4 * kPointerSize));
622
+ __ push(r0); // Make room for "position - 1" constant (value is irrelevant).
623
+
624
+ // Check if we have space on the stack for registers.
625
+ Label stack_limit_hit;
626
+ Label stack_ok;
627
+
628
+ ExternalReference stack_limit =
629
+ ExternalReference::address_of_stack_limit();
630
+ __ mov(r0, Operand(stack_limit));
631
+ __ ldr(r0, MemOperand(r0));
632
+ __ sub(r0, sp, r0, SetCC);
633
+ // Handle it if the stack pointer is already below the stack limit.
634
+ __ b(ls, &stack_limit_hit);
635
+ // Check if there is room for the variable number of registers above
636
+ // the stack limit.
637
+ __ cmp(r0, Operand(num_registers_ * kPointerSize));
638
+ __ b(hs, &stack_ok);
639
+ // Exit with OutOfMemory exception. There is not enough space on the stack
640
+ // for our working registers.
641
+ __ mov(r0, Operand(EXCEPTION));
642
+ __ jmp(&exit_label_);
643
+
644
+ __ bind(&stack_limit_hit);
645
+ CallCheckStackGuardState(r0);
646
+ __ cmp(r0, Operand(0));
647
+ // If returned value is non-zero, we exit with the returned value as result.
648
+ __ b(ne, &exit_label_);
649
+
650
+ __ bind(&stack_ok);
651
+
652
+ // Allocate space on stack for registers.
653
+ __ sub(sp, sp, Operand(num_registers_ * kPointerSize));
654
+ // Load string end.
655
+ __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
656
+ // Load input start.
657
+ __ ldr(r0, MemOperand(frame_pointer(), kInputStart));
658
+ // Find negative length (offset of start relative to end).
659
+ __ sub(current_input_offset(), r0, end_of_input_address());
660
+ // Set r0 to address of char before start of input
661
+ // (effectively string position -1).
662
+ __ sub(r0, current_input_offset(), Operand(char_size()));
663
+ // Store this value in a local variable, for use when clearing
664
+ // position registers.
665
+ __ str(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
666
+ if (num_saved_registers_ > 0) { // Always is, if generated from a regexp.
667
+ // Fill saved registers with initial value = start offset - 1
668
+
669
+ // Address of register 0.
670
+ __ add(r1, frame_pointer(), Operand(kRegisterZero));
671
+ __ mov(r2, Operand(num_saved_registers_));
672
+ Label init_loop;
673
+ __ bind(&init_loop);
674
+ __ str(r0, MemOperand(r1, kPointerSize, NegPostIndex));
675
+ __ sub(r2, r2, Operand(1), SetCC);
676
+ __ b(ne, &init_loop);
677
+ }
678
+
679
+ // Initialize backtrack stack pointer.
680
+ __ ldr(backtrack_stackpointer(), MemOperand(frame_pointer(), kStackHighEnd));
681
+ // Initialize code pointer register
682
+ __ mov(code_pointer(), Operand(masm_->CodeObject()));
683
+ // Load previous char as initial value of current character register.
684
+ Label at_start;
685
+ __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
686
+ __ cmp(r0, Operand(0));
687
+ __ b(ne, &at_start);
688
+ LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
689
+ __ jmp(&start_label_);
690
+ __ bind(&at_start);
691
+ __ mov(current_character(), Operand('\n'));
692
+ __ jmp(&start_label_);
693
+
694
+
695
+ // Exit code:
696
+ if (success_label_.is_linked()) {
697
+ // Save captures when successful.
698
+ __ bind(&success_label_);
699
+ if (num_saved_registers_ > 0) {
700
+ // copy captures to output
701
+ __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
702
+ __ ldr(r0, MemOperand(frame_pointer(), kRegisterOutput));
703
+ __ sub(r1, end_of_input_address(), r1);
704
+ // r1 is length of input in bytes.
705
+ if (mode_ == UC16) {
706
+ __ mov(r1, Operand(r1, LSR, 1));
707
+ }
708
+ // r1 is length of input in characters.
709
+
710
+ ASSERT_EQ(0, num_saved_registers_ % 2);
711
+ // Always an even number of capture registers. This allows us to
712
+ // unroll the loop once to add an operation between a load of a register
713
+ // and the following use of that register.
714
+ for (int i = 0; i < num_saved_registers_; i += 2) {
715
+ __ ldr(r2, register_location(i));
716
+ __ ldr(r3, register_location(i + 1));
717
+ if (mode_ == UC16) {
718
+ __ add(r2, r1, Operand(r2, ASR, 1));
719
+ __ add(r3, r1, Operand(r3, ASR, 1));
720
+ } else {
721
+ __ add(r2, r1, Operand(r2));
722
+ __ add(r3, r1, Operand(r3));
723
+ }
724
+ __ str(r2, MemOperand(r0, kPointerSize, PostIndex));
725
+ __ str(r3, MemOperand(r0, kPointerSize, PostIndex));
726
+ }
727
+ }
728
+ __ mov(r0, Operand(SUCCESS));
729
+ }
730
+ // Exit and return r0
731
+ __ bind(&exit_label_);
732
+ // Skip sp past regexp registers and local variables..
733
+ __ mov(sp, frame_pointer());
734
+ // Restore registers r4..r11 and return (restoring lr to pc).
735
+ __ ldm(ia_w, sp, registers_to_retain | pc.bit());
736
+
737
+ // Backtrack code (branch target for conditional backtracks).
738
+ if (backtrack_label_.is_linked()) {
739
+ __ bind(&backtrack_label_);
740
+ Backtrack();
741
+ }
742
+
743
+ Label exit_with_exception;
744
+
745
+ // Preempt-code
746
+ if (check_preempt_label_.is_linked()) {
747
+ SafeCallTarget(&check_preempt_label_);
748
+
749
+ CallCheckStackGuardState(r0);
750
+ __ cmp(r0, Operand(0));
751
+ // If returning non-zero, we should end execution with the given
752
+ // result as return value.
753
+ __ b(ne, &exit_label_);
754
+
755
+ // String might have moved: Reload end of string from frame.
756
+ __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
757
+ SafeReturn();
758
+ }
759
+
760
+ // Backtrack stack overflow code.
761
+ if (stack_overflow_label_.is_linked()) {
762
+ SafeCallTarget(&stack_overflow_label_);
763
+ // Reached if the backtrack-stack limit has been hit.
764
+
765
+ Label grow_failed;
766
+
767
+ // Call GrowStack(backtrack_stackpointer())
768
+ int num_arguments = 2;
769
+ FrameAlign(num_arguments, r0);
770
+ __ mov(r0, backtrack_stackpointer());
771
+ __ add(r1, frame_pointer(), Operand(kStackHighEnd));
772
+ ExternalReference grow_stack =
773
+ ExternalReference::re_grow_stack();
774
+ CallCFunction(grow_stack, num_arguments);
775
+ // If return NULL, we have failed to grow the stack, and
776
+ // must exit with a stack-overflow exception.
777
+ __ cmp(r0, Operand(0));
778
+ __ b(eq, &exit_with_exception);
779
+ // Otherwise use return value as new stack pointer.
780
+ __ mov(backtrack_stackpointer(), r0);
781
+ // Restore saved registers and continue.
782
+ SafeReturn();
783
+ }
784
+
785
+ if (exit_with_exception.is_linked()) {
786
+ // If any of the code above needed to exit with an exception.
787
+ __ bind(&exit_with_exception);
788
+ // Exit with Result EXCEPTION(-1) to signal thrown exception.
789
+ __ mov(r0, Operand(EXCEPTION));
790
+ __ jmp(&exit_label_);
791
+ }
792
+
793
+ CodeDesc code_desc;
794
+ masm_->GetCode(&code_desc);
795
+ Handle<Code> code = Factory::NewCode(code_desc,
796
+ NULL,
797
+ Code::ComputeFlags(Code::REGEXP),
798
+ masm_->CodeObject());
799
+ LOG(RegExpCodeCreateEvent(*code, *source));
800
+ return Handle<Object>::cast(code);
801
+ }
802
+
803
+
804
+ void RegExpMacroAssemblerARM::GoTo(Label* to) {
805
+ BranchOrBacktrack(al, to);
806
+ }
807
+
808
+
809
+ void RegExpMacroAssemblerARM::IfRegisterGE(int reg,
810
+ int comparand,
811
+ Label* if_ge) {
812
+ __ ldr(r0, register_location(reg));
813
+ __ cmp(r0, Operand(comparand));
814
+ BranchOrBacktrack(ge, if_ge);
815
+ }
816
+
817
+
818
+ void RegExpMacroAssemblerARM::IfRegisterLT(int reg,
819
+ int comparand,
820
+ Label* if_lt) {
821
+ __ ldr(r0, register_location(reg));
822
+ __ cmp(r0, Operand(comparand));
823
+ BranchOrBacktrack(lt, if_lt);
824
+ }
825
+
826
+
827
+ void RegExpMacroAssemblerARM::IfRegisterEqPos(int reg,
828
+ Label* if_eq) {
829
+ __ ldr(r0, register_location(reg));
830
+ __ cmp(r0, Operand(current_input_offset()));
831
+ BranchOrBacktrack(eq, if_eq);
832
+ }
833
+
834
+
835
+ RegExpMacroAssembler::IrregexpImplementation
836
+ RegExpMacroAssemblerARM::Implementation() {
837
+ return kARMImplementation;
838
+ }
839
+
840
+
841
+ void RegExpMacroAssemblerARM::LoadCurrentCharacter(int cp_offset,
842
+ Label* on_end_of_input,
843
+ bool check_bounds,
844
+ int characters) {
845
+ ASSERT(cp_offset >= -1); // ^ and \b can look behind one character.
846
+ ASSERT(cp_offset < (1<<30)); // Be sane! (And ensure negation works)
847
+ if (check_bounds) {
848
+ CheckPosition(cp_offset + characters - 1, on_end_of_input);
849
+ }
850
+ LoadCurrentCharacterUnchecked(cp_offset, characters);
851
+ }
852
+
853
+
854
+ void RegExpMacroAssemblerARM::PopCurrentPosition() {
855
+ Pop(current_input_offset());
856
+ }
857
+
858
+
859
+ void RegExpMacroAssemblerARM::PopRegister(int register_index) {
860
+ Pop(r0);
861
+ __ str(r0, register_location(register_index));
862
+ }
863
+
864
+
865
+ static bool is_valid_memory_offset(int value) {
866
+ if (value < 0) value = -value;
867
+ return value < (1<<12);
868
+ }
869
+
870
+
871
+ void RegExpMacroAssemblerARM::PushBacktrack(Label* label) {
872
+ if (label->is_bound()) {
873
+ int target = label->pos();
874
+ __ mov(r0, Operand(target + Code::kHeaderSize - kHeapObjectTag));
875
+ } else {
876
+ int constant_offset = GetBacktrackConstantPoolEntry();
877
+ masm_->label_at_put(label, constant_offset);
878
+ // Reading pc-relative is based on the address 8 bytes ahead of
879
+ // the current opcode.
880
+ unsigned int offset_of_pc_register_read =
881
+ masm_->pc_offset() + Assembler::kPcLoadDelta;
882
+ int pc_offset_of_constant =
883
+ constant_offset - offset_of_pc_register_read;
884
+ ASSERT(pc_offset_of_constant < 0);
885
+ if (is_valid_memory_offset(pc_offset_of_constant)) {
886
+ masm_->BlockConstPoolBefore(masm_->pc_offset() + Assembler::kInstrSize);
887
+ __ ldr(r0, MemOperand(pc, pc_offset_of_constant));
888
+ } else {
889
+ // Not a 12-bit offset, so it needs to be loaded from the constant
890
+ // pool.
891
+ masm_->BlockConstPoolBefore(
892
+ masm_->pc_offset() + 2 * Assembler::kInstrSize);
893
+ __ mov(r0, Operand(pc_offset_of_constant + Assembler::kInstrSize));
894
+ __ ldr(r0, MemOperand(pc, r0));
895
+ }
896
+ }
897
+ Push(r0);
898
+ CheckStackLimit();
899
+ }
900
+
901
+
902
+ void RegExpMacroAssemblerARM::PushCurrentPosition() {
903
+ Push(current_input_offset());
904
+ }
905
+
906
+
907
+ void RegExpMacroAssemblerARM::PushRegister(int register_index,
908
+ StackCheckFlag check_stack_limit) {
909
+ __ ldr(r0, register_location(register_index));
910
+ Push(r0);
911
+ if (check_stack_limit) CheckStackLimit();
912
+ }
913
+
914
+
915
+ void RegExpMacroAssemblerARM::ReadCurrentPositionFromRegister(int reg) {
916
+ __ ldr(current_input_offset(), register_location(reg));
917
+ }
918
+
919
+
920
+ void RegExpMacroAssemblerARM::ReadStackPointerFromRegister(int reg) {
921
+ __ ldr(backtrack_stackpointer(), register_location(reg));
922
+ __ ldr(r0, MemOperand(frame_pointer(), kStackHighEnd));
923
+ __ add(backtrack_stackpointer(), backtrack_stackpointer(), Operand(r0));
924
+ }
925
+
926
+
927
+ void RegExpMacroAssemblerARM::SetRegister(int register_index, int to) {
928
+ ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
929
+ __ mov(r0, Operand(to));
930
+ __ str(r0, register_location(register_index));
931
+ }
932
+
933
+
934
+ void RegExpMacroAssemblerARM::Succeed() {
935
+ __ jmp(&success_label_);
936
+ }
937
+
938
+
939
+ void RegExpMacroAssemblerARM::WriteCurrentPositionToRegister(int reg,
940
+ int cp_offset) {
941
+ if (cp_offset == 0) {
942
+ __ str(current_input_offset(), register_location(reg));
943
+ } else {
944
+ __ add(r0, current_input_offset(), Operand(cp_offset * char_size()));
945
+ __ str(r0, register_location(reg));
946
+ }
947
+ }
948
+
949
+
950
+ void RegExpMacroAssemblerARM::ClearRegisters(int reg_from, int reg_to) {
951
+ ASSERT(reg_from <= reg_to);
952
+ __ ldr(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
953
+ for (int reg = reg_from; reg <= reg_to; reg++) {
954
+ __ str(r0, register_location(reg));
955
+ }
956
+ }
957
+
958
+
959
+ void RegExpMacroAssemblerARM::WriteStackPointerToRegister(int reg) {
960
+ __ ldr(r1, MemOperand(frame_pointer(), kStackHighEnd));
961
+ __ sub(r0, backtrack_stackpointer(), r1);
962
+ __ str(r0, register_location(reg));
963
+ }
964
+
965
+
966
+ // Private methods:
967
+
968
+ void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) {
969
+ int num_arguments = 3;
970
+ FrameAlign(num_arguments, scratch);
971
+ // RegExp code frame pointer.
972
+ __ mov(r2, frame_pointer());
973
+ // Code* of self.
974
+ __ mov(r1, Operand(masm_->CodeObject()));
975
+ // r0 becomes return address pointer.
976
+ ExternalReference stack_guard_check =
977
+ ExternalReference::re_check_stack_guard_state();
978
+ CallCFunctionUsingStub(stack_guard_check, num_arguments);
979
+ }
980
+
981
+
982
+ // Helper function for reading a value out of a stack frame.
983
+ template <typename T>
984
+ static T& frame_entry(Address re_frame, int frame_offset) {
985
+ return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
986
+ }
987
+
988
+
989
+ int RegExpMacroAssemblerARM::CheckStackGuardState(Address* return_address,
990
+ Code* re_code,
991
+ Address re_frame) {
992
+ if (StackGuard::IsStackOverflow()) {
993
+ Top::StackOverflow();
994
+ return EXCEPTION;
995
+ }
996
+
997
+ // If not real stack overflow the stack guard was used to interrupt
998
+ // execution for another purpose.
999
+
1000
+ // Prepare for possible GC.
1001
+ HandleScope handles;
1002
+ Handle<Code> code_handle(re_code);
1003
+
1004
+ Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
1005
+ // Current string.
1006
+ bool is_ascii = subject->IsAsciiRepresentation();
1007
+
1008
+ ASSERT(re_code->instruction_start() <= *return_address);
1009
+ ASSERT(*return_address <=
1010
+ re_code->instruction_start() + re_code->instruction_size());
1011
+
1012
+ Object* result = Execution::HandleStackGuardInterrupt();
1013
+
1014
+ if (*code_handle != re_code) { // Return address no longer valid
1015
+ int delta = *code_handle - re_code;
1016
+ // Overwrite the return address on the stack.
1017
+ *return_address += delta;
1018
+ }
1019
+
1020
+ if (result->IsException()) {
1021
+ return EXCEPTION;
1022
+ }
1023
+
1024
+ // String might have changed.
1025
+ if (subject->IsAsciiRepresentation() != is_ascii) {
1026
+ // If we changed between an ASCII and an UC16 string, the specialized
1027
+ // code cannot be used, and we need to restart regexp matching from
1028
+ // scratch (including, potentially, compiling a new version of the code).
1029
+ return RETRY;
1030
+ }
1031
+
1032
+ // Otherwise, the content of the string might have moved. It must still
1033
+ // be a sequential or external string with the same content.
1034
+ // Update the start and end pointers in the stack frame to the current
1035
+ // location (whether it has actually moved or not).
1036
+ ASSERT(StringShape(*subject).IsSequential() ||
1037
+ StringShape(*subject).IsExternal());
1038
+
1039
+ // The original start address of the characters to match.
1040
+ const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
1041
+
1042
+ // Find the current start address of the same character at the current string
1043
+ // position.
1044
+ int start_index = frame_entry<int>(re_frame, kStartIndex);
1045
+ const byte* new_address = StringCharacterPosition(*subject, start_index);
1046
+
1047
+ if (start_address != new_address) {
1048
+ // If there is a difference, update the object pointer and start and end
1049
+ // addresses in the RegExp stack frame to match the new value.
1050
+ const byte* end_address = frame_entry<const byte* >(re_frame, kInputEnd);
1051
+ int byte_length = end_address - start_address;
1052
+ frame_entry<const String*>(re_frame, kInputString) = *subject;
1053
+ frame_entry<const byte*>(re_frame, kInputStart) = new_address;
1054
+ frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length;
1055
+ }
1056
+
1057
+ return 0;
1058
+ }
1059
+
1060
+
1061
+ MemOperand RegExpMacroAssemblerARM::register_location(int register_index) {
1062
+ ASSERT(register_index < (1<<30));
1063
+ if (num_registers_ <= register_index) {
1064
+ num_registers_ = register_index + 1;
1065
+ }
1066
+ return MemOperand(frame_pointer(),
1067
+ kRegisterZero - register_index * kPointerSize);
1068
+ }
1069
+
1070
+
1071
+ void RegExpMacroAssemblerARM::CheckPosition(int cp_offset,
1072
+ Label* on_outside_input) {
1073
+ __ cmp(current_input_offset(), Operand(-cp_offset * char_size()));
1074
+ BranchOrBacktrack(ge, on_outside_input);
1075
+ }
1076
+
1077
+
1078
+ void RegExpMacroAssemblerARM::BranchOrBacktrack(Condition condition,
1079
+ Label* to) {
1080
+ if (condition == al) { // Unconditional.
1081
+ if (to == NULL) {
1082
+ Backtrack();
1083
+ return;
1084
+ }
1085
+ __ jmp(to);
1086
+ return;
1087
+ }
1088
+ if (to == NULL) {
1089
+ __ b(condition, &backtrack_label_);
1090
+ return;
1091
+ }
1092
+ __ b(condition, to);
1093
+ }
1094
+
1095
+
1096
+ void RegExpMacroAssemblerARM::SafeCall(Label* to, Condition cond) {
1097
+ __ bl(to, cond);
1098
+ }
1099
+
1100
+
1101
+ void RegExpMacroAssemblerARM::SafeReturn() {
1102
+ __ pop(lr);
1103
+ __ add(pc, lr, Operand(masm_->CodeObject()));
1104
+ }
1105
+
1106
+
1107
+ void RegExpMacroAssemblerARM::SafeCallTarget(Label* name) {
1108
+ __ bind(name);
1109
+ __ sub(lr, lr, Operand(masm_->CodeObject()));
1110
+ __ push(lr);
1111
+ }
1112
+
1113
+
1114
+ void RegExpMacroAssemblerARM::Push(Register source) {
1115
+ ASSERT(!source.is(backtrack_stackpointer()));
1116
+ __ str(source,
1117
+ MemOperand(backtrack_stackpointer(), kPointerSize, NegPreIndex));
1118
+ }
1119
+
1120
+
1121
+ void RegExpMacroAssemblerARM::Pop(Register target) {
1122
+ ASSERT(!target.is(backtrack_stackpointer()));
1123
+ __ ldr(target,
1124
+ MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex));
1125
+ }
1126
+
1127
+
1128
+ void RegExpMacroAssemblerARM::CheckPreemption() {
1129
+ // Check for preemption.
1130
+ ExternalReference stack_limit =
1131
+ ExternalReference::address_of_stack_limit();
1132
+ __ mov(r0, Operand(stack_limit));
1133
+ __ ldr(r0, MemOperand(r0));
1134
+ __ cmp(sp, r0);
1135
+ SafeCall(&check_preempt_label_, ls);
1136
+ }
1137
+
1138
+
1139
+ void RegExpMacroAssemblerARM::CheckStackLimit() {
1140
+ ExternalReference stack_limit =
1141
+ ExternalReference::address_of_regexp_stack_limit();
1142
+ __ mov(r0, Operand(stack_limit));
1143
+ __ ldr(r0, MemOperand(r0));
1144
+ __ cmp(backtrack_stackpointer(), Operand(r0));
1145
+ SafeCall(&stack_overflow_label_, ls);
1146
+ }
1147
+
1148
+
1149
+ void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() {
1150
+ __ CheckConstPool(false, false);
1151
+ __ BlockConstPoolBefore(
1152
+ masm_->pc_offset() + kBacktrackConstantPoolSize * Assembler::kInstrSize);
1153
+ backtrack_constant_pool_offset_ = masm_->pc_offset();
1154
+ for (int i = 0; i < kBacktrackConstantPoolSize; i++) {
1155
+ __ emit(0);
1156
+ }
1157
+
1158
+ backtrack_constant_pool_capacity_ = kBacktrackConstantPoolSize;
1159
+ }
1160
+
1161
+
1162
+ int RegExpMacroAssemblerARM::GetBacktrackConstantPoolEntry() {
1163
+ while (backtrack_constant_pool_capacity_ > 0) {
1164
+ int offset = backtrack_constant_pool_offset_;
1165
+ backtrack_constant_pool_offset_ += kPointerSize;
1166
+ backtrack_constant_pool_capacity_--;
1167
+ if (masm_->pc_offset() - offset < 2 * KB) {
1168
+ return offset;
1169
+ }
1170
+ }
1171
+ Label new_pool_skip;
1172
+ __ jmp(&new_pool_skip);
1173
+ EmitBacktrackConstantPool();
1174
+ __ bind(&new_pool_skip);
1175
+ int offset = backtrack_constant_pool_offset_;
1176
+ backtrack_constant_pool_offset_ += kPointerSize;
1177
+ backtrack_constant_pool_capacity_--;
1178
+ return offset;
1179
+ }
1180
+
1181
+
1182
+ void RegExpMacroAssemblerARM::FrameAlign(int num_arguments, Register scratch) {
1183
+ int frameAlignment = OS::ActivationFrameAlignment();
1184
+ // Up to four simple arguments are passed in registers r0..r3.
1185
+ int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4;
1186
+ if (frameAlignment != 0) {
1187
+ // Make stack end at alignment and make room for num_arguments - 4 words
1188
+ // and the original value of sp.
1189
+ __ mov(scratch, sp);
1190
+ __ sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
1191
+ ASSERT(IsPowerOf2(frameAlignment));
1192
+ __ and_(sp, sp, Operand(-frameAlignment));
1193
+ __ str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
1194
+ } else {
1195
+ __ sub(sp, sp, Operand(stack_passed_arguments * kPointerSize));
1196
+ }
1197
+ }
1198
+
1199
+
1200
+ void RegExpMacroAssemblerARM::CallCFunction(ExternalReference function,
1201
+ int num_arguments) {
1202
+ __ mov(r5, Operand(function));
1203
+ // Just call directly. The function called cannot cause a GC, or
1204
+ // allow preemption, so the return address in the link register
1205
+ // stays correct.
1206
+ __ Call(r5);
1207
+ int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4;
1208
+ if (OS::ActivationFrameAlignment() > kIntSize) {
1209
+ __ ldr(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
1210
+ } else {
1211
+ __ add(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize)));
1212
+ }
1213
+ __ mov(code_pointer(), Operand(masm_->CodeObject()));
1214
+ }
1215
+
1216
+
1217
+ void RegExpMacroAssemblerARM::CallCFunctionUsingStub(
1218
+ ExternalReference function,
1219
+ int num_arguments) {
1220
+ // Must pass all arguments in registers. The stub pushes on the stack.
1221
+ ASSERT(num_arguments <= 4);
1222
+ __ mov(r5, Operand(function));
1223
+ RegExpCEntryStub stub;
1224
+ __ CallStub(&stub);
1225
+ if (OS::ActivationFrameAlignment() != 0) {
1226
+ __ ldr(sp, MemOperand(sp, 0));
1227
+ }
1228
+ __ mov(code_pointer(), Operand(masm_->CodeObject()));
1229
+ }
1230
+
1231
+
1232
+ void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset,
1233
+ int characters) {
1234
+ Register offset = current_input_offset();
1235
+ if (cp_offset != 0) {
1236
+ __ add(r0, current_input_offset(), Operand(cp_offset * char_size()));
1237
+ offset = r0;
1238
+ }
1239
+ // We assume that we cannot do unaligned loads on ARM, so this function
1240
+ // must only be used to load a single character at a time.
1241
+ ASSERT(characters == 1);
1242
+ if (mode_ == ASCII) {
1243
+ __ ldrb(current_character(), MemOperand(end_of_input_address(), offset));
1244
+ } else {
1245
+ ASSERT(mode_ == UC16);
1246
+ __ ldrh(current_character(), MemOperand(end_of_input_address(), offset));
1247
+ }
1248
+ }
1249
+
1250
+
1251
+ void RegExpCEntryStub::Generate(MacroAssembler* masm_) {
1252
+ int stack_alignment = OS::ActivationFrameAlignment();
1253
+ if (stack_alignment < kPointerSize) stack_alignment = kPointerSize;
1254
+ // Stack is already aligned for call, so decrement by alignment
1255
+ // to make room for storing the link register.
1256
+ __ str(lr, MemOperand(sp, stack_alignment, NegPreIndex));
1257
+ __ mov(r0, sp);
1258
+ __ Call(r5);
1259
+ __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1260
+ }
1261
+
1262
+ #undef __
1263
+
1264
+ #endif // V8_NATIVE_REGEXP
1265
+
1266
+ }} // namespace v8::internal