libv8 3.3.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,1658 @@
1
+ // Copyright 2011 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "v8.h"
29
+
30
+ #if defined(V8_TARGET_ARCH_ARM)
31
+
32
+ #include "codegen.h"
33
+ #include "debug.h"
34
+ #include "deoptimizer.h"
35
+ #include "full-codegen.h"
36
+ #include "runtime.h"
37
+
38
+ namespace v8 {
39
+ namespace internal {
40
+
41
+
42
+ #define __ ACCESS_MASM(masm)
43
+
44
+
45
+ void Builtins::Generate_Adaptor(MacroAssembler* masm,
46
+ CFunctionId id,
47
+ BuiltinExtraArguments extra_args) {
48
+ // ----------- S t a t e -------------
49
+ // -- r0 : number of arguments excluding receiver
50
+ // -- r1 : called function (only guaranteed when
51
+ // extra_args requires it)
52
+ // -- cp : context
53
+ // -- sp[0] : last argument
54
+ // -- ...
55
+ // -- sp[4 * (argc - 1)] : first argument (argc == r0)
56
+ // -- sp[4 * argc] : receiver
57
+ // -----------------------------------
58
+
59
+ // Insert extra arguments.
60
+ int num_extra_args = 0;
61
+ if (extra_args == NEEDS_CALLED_FUNCTION) {
62
+ num_extra_args = 1;
63
+ __ push(r1);
64
+ } else {
65
+ ASSERT(extra_args == NO_EXTRA_ARGUMENTS);
66
+ }
67
+
68
+ // JumpToExternalReference expects r0 to contain the number of arguments
69
+ // including the receiver and the extra arguments.
70
+ __ add(r0, r0, Operand(num_extra_args + 1));
71
+ __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
72
+ }
73
+
74
+
75
+ // Load the built-in Array function from the current context.
76
+ static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
77
+ // Load the global context.
78
+
79
+ __ ldr(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
80
+ __ ldr(result,
81
+ FieldMemOperand(result, GlobalObject::kGlobalContextOffset));
82
+ // Load the Array function from the global context.
83
+ __ ldr(result,
84
+ MemOperand(result,
85
+ Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
86
+ }
87
+
88
+
89
+ // This constant has the same value as JSArray::kPreallocatedArrayElements and
90
+ // if JSArray::kPreallocatedArrayElements is changed handling of loop unfolding
91
+ // below should be reconsidered.
92
+ static const int kLoopUnfoldLimit = 4;
93
+
94
+
95
+ // Allocate an empty JSArray. The allocated array is put into the result
96
+ // register. An elements backing store is allocated with size initial_capacity
97
+ // and filled with the hole values.
98
+ static void AllocateEmptyJSArray(MacroAssembler* masm,
99
+ Register array_function,
100
+ Register result,
101
+ Register scratch1,
102
+ Register scratch2,
103
+ Register scratch3,
104
+ int initial_capacity,
105
+ Label* gc_required) {
106
+ ASSERT(initial_capacity > 0);
107
+ // Load the initial map from the array function.
108
+ __ ldr(scratch1, FieldMemOperand(array_function,
109
+ JSFunction::kPrototypeOrInitialMapOffset));
110
+
111
+ // Allocate the JSArray object together with space for a fixed array with the
112
+ // requested elements.
113
+ int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity);
114
+ __ AllocateInNewSpace(size,
115
+ result,
116
+ scratch2,
117
+ scratch3,
118
+ gc_required,
119
+ TAG_OBJECT);
120
+
121
+ // Allocated the JSArray. Now initialize the fields except for the elements
122
+ // array.
123
+ // result: JSObject
124
+ // scratch1: initial map
125
+ // scratch2: start of next object
126
+ __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset));
127
+ __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex);
128
+ __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset));
129
+ // Field JSArray::kElementsOffset is initialized later.
130
+ __ mov(scratch3, Operand(0, RelocInfo::NONE));
131
+ __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset));
132
+
133
+ // Calculate the location of the elements array and set elements array member
134
+ // of the JSArray.
135
+ // result: JSObject
136
+ // scratch2: start of next object
137
+ __ add(scratch1, result, Operand(JSArray::kSize));
138
+ __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
139
+
140
+ // Clear the heap tag on the elements array.
141
+ ASSERT(kSmiTag == 0);
142
+ __ sub(scratch1, scratch1, Operand(kHeapObjectTag));
143
+
144
+ // Initialize the FixedArray and fill it with holes. FixedArray length is
145
+ // stored as a smi.
146
+ // result: JSObject
147
+ // scratch1: elements array (untagged)
148
+ // scratch2: start of next object
149
+ __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex);
150
+ ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
151
+ __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
152
+ __ mov(scratch3, Operand(Smi::FromInt(initial_capacity)));
153
+ ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
154
+ __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
155
+
156
+ // Fill the FixedArray with the hole value.
157
+ ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
158
+ ASSERT(initial_capacity <= kLoopUnfoldLimit);
159
+ __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
160
+ for (int i = 0; i < initial_capacity; i++) {
161
+ __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
162
+ }
163
+ }
164
+
165
+ // Allocate a JSArray with the number of elements stored in a register. The
166
+ // register array_function holds the built-in Array function and the register
167
+ // array_size holds the size of the array as a smi. The allocated array is put
168
+ // into the result register and beginning and end of the FixedArray elements
169
+ // storage is put into registers elements_array_storage and elements_array_end
170
+ // (see below for when that is not the case). If the parameter fill_with_holes
171
+ // is true the allocated elements backing store is filled with the hole values
172
+ // otherwise it is left uninitialized. When the backing store is filled the
173
+ // register elements_array_storage is scratched.
174
+ static void AllocateJSArray(MacroAssembler* masm,
175
+ Register array_function, // Array function.
176
+ Register array_size, // As a smi.
177
+ Register result,
178
+ Register elements_array_storage,
179
+ Register elements_array_end,
180
+ Register scratch1,
181
+ Register scratch2,
182
+ bool fill_with_hole,
183
+ Label* gc_required) {
184
+ Label not_empty, allocated;
185
+
186
+ // Load the initial map from the array function.
187
+ __ ldr(elements_array_storage,
188
+ FieldMemOperand(array_function,
189
+ JSFunction::kPrototypeOrInitialMapOffset));
190
+
191
+ // Check whether an empty sized array is requested.
192
+ __ tst(array_size, array_size);
193
+ __ b(ne, &not_empty);
194
+
195
+ // If an empty array is requested allocate a small elements array anyway. This
196
+ // keeps the code below free of special casing for the empty array.
197
+ int size = JSArray::kSize +
198
+ FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
199
+ __ AllocateInNewSpace(size,
200
+ result,
201
+ elements_array_end,
202
+ scratch1,
203
+ gc_required,
204
+ TAG_OBJECT);
205
+ __ jmp(&allocated);
206
+
207
+ // Allocate the JSArray object together with space for a FixedArray with the
208
+ // requested number of elements.
209
+ __ bind(&not_empty);
210
+ ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
211
+ __ mov(elements_array_end,
212
+ Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize));
213
+ __ add(elements_array_end,
214
+ elements_array_end,
215
+ Operand(array_size, ASR, kSmiTagSize));
216
+ __ AllocateInNewSpace(
217
+ elements_array_end,
218
+ result,
219
+ scratch1,
220
+ scratch2,
221
+ gc_required,
222
+ static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
223
+
224
+ // Allocated the JSArray. Now initialize the fields except for the elements
225
+ // array.
226
+ // result: JSObject
227
+ // elements_array_storage: initial map
228
+ // array_size: size of array (smi)
229
+ __ bind(&allocated);
230
+ __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset));
231
+ __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex);
232
+ __ str(elements_array_storage,
233
+ FieldMemOperand(result, JSArray::kPropertiesOffset));
234
+ // Field JSArray::kElementsOffset is initialized later.
235
+ __ str(array_size, FieldMemOperand(result, JSArray::kLengthOffset));
236
+
237
+ // Calculate the location of the elements array and set elements array member
238
+ // of the JSArray.
239
+ // result: JSObject
240
+ // array_size: size of array (smi)
241
+ __ add(elements_array_storage, result, Operand(JSArray::kSize));
242
+ __ str(elements_array_storage,
243
+ FieldMemOperand(result, JSArray::kElementsOffset));
244
+
245
+ // Clear the heap tag on the elements array.
246
+ ASSERT(kSmiTag == 0);
247
+ __ sub(elements_array_storage,
248
+ elements_array_storage,
249
+ Operand(kHeapObjectTag));
250
+ // Initialize the fixed array and fill it with holes. FixedArray length is
251
+ // stored as a smi.
252
+ // result: JSObject
253
+ // elements_array_storage: elements array (untagged)
254
+ // array_size: size of array (smi)
255
+ __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex);
256
+ ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
257
+ __ str(scratch1, MemOperand(elements_array_storage, kPointerSize, PostIndex));
258
+ ASSERT(kSmiTag == 0);
259
+ __ tst(array_size, array_size);
260
+ // Length of the FixedArray is the number of pre-allocated elements if
261
+ // the actual JSArray has length 0 and the size of the JSArray for non-empty
262
+ // JSArrays. The length of a FixedArray is stored as a smi.
263
+ __ mov(array_size,
264
+ Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)),
265
+ LeaveCC,
266
+ eq);
267
+ ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
268
+ __ str(array_size,
269
+ MemOperand(elements_array_storage, kPointerSize, PostIndex));
270
+
271
+ // Calculate elements array and elements array end.
272
+ // result: JSObject
273
+ // elements_array_storage: elements array element storage
274
+ // array_size: smi-tagged size of elements array
275
+ ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
276
+ __ add(elements_array_end,
277
+ elements_array_storage,
278
+ Operand(array_size, LSL, kPointerSizeLog2 - kSmiTagSize));
279
+
280
+ // Fill the allocated FixedArray with the hole value if requested.
281
+ // result: JSObject
282
+ // elements_array_storage: elements array element storage
283
+ // elements_array_end: start of next object
284
+ if (fill_with_hole) {
285
+ Label loop, entry;
286
+ __ LoadRoot(scratch1, Heap::kTheHoleValueRootIndex);
287
+ __ jmp(&entry);
288
+ __ bind(&loop);
289
+ __ str(scratch1,
290
+ MemOperand(elements_array_storage, kPointerSize, PostIndex));
291
+ __ bind(&entry);
292
+ __ cmp(elements_array_storage, elements_array_end);
293
+ __ b(lt, &loop);
294
+ }
295
+ }
296
+
297
+ // Create a new array for the built-in Array function. This function allocates
298
+ // the JSArray object and the FixedArray elements array and initializes these.
299
+ // If the Array cannot be constructed in native code the runtime is called. This
300
+ // function assumes the following state:
301
+ // r0: argc
302
+ // r1: constructor (built-in Array function)
303
+ // lr: return address
304
+ // sp[0]: last argument
305
+ // This function is used for both construct and normal calls of Array. The only
306
+ // difference between handling a construct call and a normal call is that for a
307
+ // construct call the constructor function in r1 needs to be preserved for
308
+ // entering the generic code. In both cases argc in r0 needs to be preserved.
309
+ // Both registers are preserved by this code so no need to differentiate between
310
+ // construct call and normal call.
311
+ static void ArrayNativeCode(MacroAssembler* masm,
312
+ Label* call_generic_code) {
313
+ Counters* counters = masm->isolate()->counters();
314
+ Label argc_one_or_more, argc_two_or_more;
315
+
316
+ // Check for array construction with zero arguments or one.
317
+ __ cmp(r0, Operand(0, RelocInfo::NONE));
318
+ __ b(ne, &argc_one_or_more);
319
+
320
+ // Handle construction of an empty array.
321
+ AllocateEmptyJSArray(masm,
322
+ r1,
323
+ r2,
324
+ r3,
325
+ r4,
326
+ r5,
327
+ JSArray::kPreallocatedArrayElements,
328
+ call_generic_code);
329
+ __ IncrementCounter(counters->array_function_native(), 1, r3, r4);
330
+ // Setup return value, remove receiver from stack and return.
331
+ __ mov(r0, r2);
332
+ __ add(sp, sp, Operand(kPointerSize));
333
+ __ Jump(lr);
334
+
335
+ // Check for one argument. Bail out if argument is not smi or if it is
336
+ // negative.
337
+ __ bind(&argc_one_or_more);
338
+ __ cmp(r0, Operand(1));
339
+ __ b(ne, &argc_two_or_more);
340
+ ASSERT(kSmiTag == 0);
341
+ __ ldr(r2, MemOperand(sp)); // Get the argument from the stack.
342
+ __ and_(r3, r2, Operand(kIntptrSignBit | kSmiTagMask), SetCC);
343
+ __ b(ne, call_generic_code);
344
+
345
+ // Handle construction of an empty array of a certain size. Bail out if size
346
+ // is too large to actually allocate an elements array.
347
+ ASSERT(kSmiTag == 0);
348
+ __ cmp(r2, Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize));
349
+ __ b(ge, call_generic_code);
350
+
351
+ // r0: argc
352
+ // r1: constructor
353
+ // r2: array_size (smi)
354
+ // sp[0]: argument
355
+ AllocateJSArray(masm,
356
+ r1,
357
+ r2,
358
+ r3,
359
+ r4,
360
+ r5,
361
+ r6,
362
+ r7,
363
+ true,
364
+ call_generic_code);
365
+ __ IncrementCounter(counters->array_function_native(), 1, r2, r4);
366
+ // Setup return value, remove receiver and argument from stack and return.
367
+ __ mov(r0, r3);
368
+ __ add(sp, sp, Operand(2 * kPointerSize));
369
+ __ Jump(lr);
370
+
371
+ // Handle construction of an array from a list of arguments.
372
+ __ bind(&argc_two_or_more);
373
+ __ mov(r2, Operand(r0, LSL, kSmiTagSize)); // Convet argc to a smi.
374
+
375
+ // r0: argc
376
+ // r1: constructor
377
+ // r2: array_size (smi)
378
+ // sp[0]: last argument
379
+ AllocateJSArray(masm,
380
+ r1,
381
+ r2,
382
+ r3,
383
+ r4,
384
+ r5,
385
+ r6,
386
+ r7,
387
+ false,
388
+ call_generic_code);
389
+ __ IncrementCounter(counters->array_function_native(), 1, r2, r6);
390
+
391
+ // Fill arguments as array elements. Copy from the top of the stack (last
392
+ // element) to the array backing store filling it backwards. Note:
393
+ // elements_array_end points after the backing store therefore PreIndex is
394
+ // used when filling the backing store.
395
+ // r0: argc
396
+ // r3: JSArray
397
+ // r4: elements_array storage start (untagged)
398
+ // r5: elements_array_end (untagged)
399
+ // sp[0]: last argument
400
+ Label loop, entry;
401
+ __ jmp(&entry);
402
+ __ bind(&loop);
403
+ __ ldr(r2, MemOperand(sp, kPointerSize, PostIndex));
404
+ __ str(r2, MemOperand(r5, -kPointerSize, PreIndex));
405
+ __ bind(&entry);
406
+ __ cmp(r4, r5);
407
+ __ b(lt, &loop);
408
+
409
+ // Remove caller arguments and receiver from the stack, setup return value and
410
+ // return.
411
+ // r0: argc
412
+ // r3: JSArray
413
+ // sp[0]: receiver
414
+ __ add(sp, sp, Operand(kPointerSize));
415
+ __ mov(r0, r3);
416
+ __ Jump(lr);
417
+ }
418
+
419
+
420
+ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
421
+ // ----------- S t a t e -------------
422
+ // -- r0 : number of arguments
423
+ // -- lr : return address
424
+ // -- sp[...]: constructor arguments
425
+ // -----------------------------------
426
+ Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
427
+
428
+ // Get the Array function.
429
+ GenerateLoadArrayFunction(masm, r1);
430
+
431
+ if (FLAG_debug_code) {
432
+ // Initial map for the builtin Array functions should be maps.
433
+ __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
434
+ __ tst(r2, Operand(kSmiTagMask));
435
+ __ Assert(ne, "Unexpected initial map for Array function");
436
+ __ CompareObjectType(r2, r3, r4, MAP_TYPE);
437
+ __ Assert(eq, "Unexpected initial map for Array function");
438
+ }
439
+
440
+ // Run the native code for the Array function called as a normal function.
441
+ ArrayNativeCode(masm, &generic_array_code);
442
+
443
+ // Jump to the generic array code if the specialized code cannot handle
444
+ // the construction.
445
+ __ bind(&generic_array_code);
446
+
447
+ Handle<Code> array_code =
448
+ masm->isolate()->builtins()->ArrayCodeGeneric();
449
+ __ Jump(array_code, RelocInfo::CODE_TARGET);
450
+ }
451
+
452
+
453
+ void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
454
+ // ----------- S t a t e -------------
455
+ // -- r0 : number of arguments
456
+ // -- r1 : constructor function
457
+ // -- lr : return address
458
+ // -- sp[...]: constructor arguments
459
+ // -----------------------------------
460
+ Label generic_constructor;
461
+
462
+ if (FLAG_debug_code) {
463
+ // The array construct code is only set for the builtin and internal
464
+ // Array functions which always have a map.
465
+ // Initial map for the builtin Array function should be a map.
466
+ __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
467
+ __ tst(r2, Operand(kSmiTagMask));
468
+ __ Assert(ne, "Unexpected initial map for Array function");
469
+ __ CompareObjectType(r2, r3, r4, MAP_TYPE);
470
+ __ Assert(eq, "Unexpected initial map for Array function");
471
+ }
472
+
473
+ // Run the native code for the Array function called as a constructor.
474
+ ArrayNativeCode(masm, &generic_constructor);
475
+
476
+ // Jump to the generic construct code in case the specialized code cannot
477
+ // handle the construction.
478
+ __ bind(&generic_constructor);
479
+ Handle<Code> generic_construct_stub =
480
+ masm->isolate()->builtins()->JSConstructStubGeneric();
481
+ __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
482
+ }
483
+
484
+
485
+ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
486
+ // ----------- S t a t e -------------
487
+ // -- r0 : number of arguments
488
+ // -- r1 : constructor function
489
+ // -- lr : return address
490
+ // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
491
+ // -- sp[argc * 4] : receiver
492
+ // -----------------------------------
493
+ Counters* counters = masm->isolate()->counters();
494
+ __ IncrementCounter(counters->string_ctor_calls(), 1, r2, r3);
495
+
496
+ Register function = r1;
497
+ if (FLAG_debug_code) {
498
+ __ LoadGlobalFunction(Context::STRING_FUNCTION_INDEX, r2);
499
+ __ cmp(function, Operand(r2));
500
+ __ Assert(eq, "Unexpected String function");
501
+ }
502
+
503
+ // Load the first arguments in r0 and get rid of the rest.
504
+ Label no_arguments;
505
+ __ cmp(r0, Operand(0, RelocInfo::NONE));
506
+ __ b(eq, &no_arguments);
507
+ // First args = sp[(argc - 1) * 4].
508
+ __ sub(r0, r0, Operand(1));
509
+ __ ldr(r0, MemOperand(sp, r0, LSL, kPointerSizeLog2, PreIndex));
510
+ // sp now point to args[0], drop args[0] + receiver.
511
+ __ Drop(2);
512
+
513
+ Register argument = r2;
514
+ Label not_cached, argument_is_string;
515
+ NumberToStringStub::GenerateLookupNumberStringCache(
516
+ masm,
517
+ r0, // Input.
518
+ argument, // Result.
519
+ r3, // Scratch.
520
+ r4, // Scratch.
521
+ r5, // Scratch.
522
+ false, // Is it a Smi?
523
+ &not_cached);
524
+ __ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4);
525
+ __ bind(&argument_is_string);
526
+
527
+ // ----------- S t a t e -------------
528
+ // -- r2 : argument converted to string
529
+ // -- r1 : constructor function
530
+ // -- lr : return address
531
+ // -----------------------------------
532
+
533
+ Label gc_required;
534
+ __ AllocateInNewSpace(JSValue::kSize,
535
+ r0, // Result.
536
+ r3, // Scratch.
537
+ r4, // Scratch.
538
+ &gc_required,
539
+ TAG_OBJECT);
540
+
541
+ // Initialising the String Object.
542
+ Register map = r3;
543
+ __ LoadGlobalFunctionInitialMap(function, map, r4);
544
+ if (FLAG_debug_code) {
545
+ __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset));
546
+ __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2));
547
+ __ Assert(eq, "Unexpected string wrapper instance size");
548
+ __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset));
549
+ __ cmp(r4, Operand(0, RelocInfo::NONE));
550
+ __ Assert(eq, "Unexpected unused properties of string wrapper");
551
+ }
552
+ __ str(map, FieldMemOperand(r0, HeapObject::kMapOffset));
553
+
554
+ __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex);
555
+ __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset));
556
+ __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset));
557
+
558
+ __ str(argument, FieldMemOperand(r0, JSValue::kValueOffset));
559
+
560
+ // Ensure the object is fully initialized.
561
+ STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
562
+
563
+ __ Ret();
564
+
565
+ // The argument was not found in the number to string cache. Check
566
+ // if it's a string already before calling the conversion builtin.
567
+ Label convert_argument;
568
+ __ bind(&not_cached);
569
+ __ JumpIfSmi(r0, &convert_argument);
570
+
571
+ // Is it a String?
572
+ __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
573
+ __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceTypeOffset));
574
+ ASSERT(kNotStringTag != 0);
575
+ __ tst(r3, Operand(kIsNotStringMask));
576
+ __ b(ne, &convert_argument);
577
+ __ mov(argument, r0);
578
+ __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
579
+ __ b(&argument_is_string);
580
+
581
+ // Invoke the conversion builtin and put the result into r2.
582
+ __ bind(&convert_argument);
583
+ __ push(function); // Preserve the function.
584
+ __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
585
+ __ EnterInternalFrame();
586
+ __ push(r0);
587
+ __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION);
588
+ __ LeaveInternalFrame();
589
+ __ pop(function);
590
+ __ mov(argument, r0);
591
+ __ b(&argument_is_string);
592
+
593
+ // Load the empty string into r2, remove the receiver from the
594
+ // stack, and jump back to the case where the argument is a string.
595
+ __ bind(&no_arguments);
596
+ __ LoadRoot(argument, Heap::kEmptyStringRootIndex);
597
+ __ Drop(1);
598
+ __ b(&argument_is_string);
599
+
600
+ // At this point the argument is already a string. Call runtime to
601
+ // create a string wrapper.
602
+ __ bind(&gc_required);
603
+ __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4);
604
+ __ EnterInternalFrame();
605
+ __ push(argument);
606
+ __ CallRuntime(Runtime::kNewStringWrapper, 1);
607
+ __ LeaveInternalFrame();
608
+ __ Ret();
609
+ }
610
+
611
+
612
+ void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
613
+ // ----------- S t a t e -------------
614
+ // -- r0 : number of arguments
615
+ // -- r1 : constructor function
616
+ // -- lr : return address
617
+ // -- sp[...]: constructor arguments
618
+ // -----------------------------------
619
+
620
+ Label non_function_call;
621
+ // Check that the function is not a smi.
622
+ __ tst(r1, Operand(kSmiTagMask));
623
+ __ b(eq, &non_function_call);
624
+ // Check that the function is a JSFunction.
625
+ __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
626
+ __ b(ne, &non_function_call);
627
+
628
+ // Jump to the function-specific construct stub.
629
+ __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
630
+ __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset));
631
+ __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
632
+
633
+ // r0: number of arguments
634
+ // r1: called object
635
+ __ bind(&non_function_call);
636
+ // Set expected number of arguments to zero (not changing r0).
637
+ __ mov(r2, Operand(0, RelocInfo::NONE));
638
+ __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
639
+ __ SetCallKind(r5, CALL_AS_METHOD);
640
+ __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
641
+ RelocInfo::CODE_TARGET);
642
+ }
643
+
644
+
645
+ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
646
+ bool is_api_function,
647
+ bool count_constructions) {
648
+ // Should never count constructions for api objects.
649
+ ASSERT(!is_api_function || !count_constructions);
650
+
651
+ Isolate* isolate = masm->isolate();
652
+
653
+ // Enter a construct frame.
654
+ __ EnterConstructFrame();
655
+
656
+ // Preserve the two incoming parameters on the stack.
657
+ __ mov(r0, Operand(r0, LSL, kSmiTagSize));
658
+ __ push(r0); // Smi-tagged arguments count.
659
+ __ push(r1); // Constructor function.
660
+
661
+ // Try to allocate the object without transitioning into C code. If any of the
662
+ // preconditions is not met, the code bails out to the runtime call.
663
+ Label rt_call, allocated;
664
+ if (FLAG_inline_new) {
665
+ Label undo_allocation;
666
+ #ifdef ENABLE_DEBUGGER_SUPPORT
667
+ ExternalReference debug_step_in_fp =
668
+ ExternalReference::debug_step_in_fp_address(isolate);
669
+ __ mov(r2, Operand(debug_step_in_fp));
670
+ __ ldr(r2, MemOperand(r2));
671
+ __ tst(r2, r2);
672
+ __ b(ne, &rt_call);
673
+ #endif
674
+
675
+ // Load the initial map and verify that it is in fact a map.
676
+ // r1: constructor function
677
+ __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
678
+ __ tst(r2, Operand(kSmiTagMask));
679
+ __ b(eq, &rt_call);
680
+ __ CompareObjectType(r2, r3, r4, MAP_TYPE);
681
+ __ b(ne, &rt_call);
682
+
683
+ // Check that the constructor is not constructing a JSFunction (see comments
684
+ // in Runtime_NewObject in runtime.cc). In which case the initial map's
685
+ // instance type would be JS_FUNCTION_TYPE.
686
+ // r1: constructor function
687
+ // r2: initial map
688
+ __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE);
689
+ __ b(eq, &rt_call);
690
+
691
+ if (count_constructions) {
692
+ Label allocate;
693
+ // Decrease generous allocation count.
694
+ __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
695
+ MemOperand constructor_count =
696
+ FieldMemOperand(r3, SharedFunctionInfo::kConstructionCountOffset);
697
+ __ ldrb(r4, constructor_count);
698
+ __ sub(r4, r4, Operand(1), SetCC);
699
+ __ strb(r4, constructor_count);
700
+ __ b(ne, &allocate);
701
+
702
+ __ Push(r1, r2);
703
+
704
+ __ push(r1); // constructor
705
+ // The call will replace the stub, so the countdown is only done once.
706
+ __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
707
+
708
+ __ pop(r2);
709
+ __ pop(r1);
710
+
711
+ __ bind(&allocate);
712
+ }
713
+
714
+ // Now allocate the JSObject on the heap.
715
+ // r1: constructor function
716
+ // r2: initial map
717
+ __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset));
718
+ __ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS);
719
+
720
+ // Allocated the JSObject, now initialize the fields. Map is set to initial
721
+ // map and properties and elements are set to empty fixed array.
722
+ // r1: constructor function
723
+ // r2: initial map
724
+ // r3: object size
725
+ // r4: JSObject (not tagged)
726
+ __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
727
+ __ mov(r5, r4);
728
+ ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset);
729
+ __ str(r2, MemOperand(r5, kPointerSize, PostIndex));
730
+ ASSERT_EQ(1 * kPointerSize, JSObject::kPropertiesOffset);
731
+ __ str(r6, MemOperand(r5, kPointerSize, PostIndex));
732
+ ASSERT_EQ(2 * kPointerSize, JSObject::kElementsOffset);
733
+ __ str(r6, MemOperand(r5, kPointerSize, PostIndex));
734
+
735
+ // Fill all the in-object properties with the appropriate filler.
736
+ // r1: constructor function
737
+ // r2: initial map
738
+ // r3: object size (in words)
739
+ // r4: JSObject (not tagged)
740
+ // r5: First in-object property of JSObject (not tagged)
741
+ __ add(r6, r4, Operand(r3, LSL, kPointerSizeLog2)); // End of object.
742
+ ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize);
743
+ { Label loop, entry;
744
+ if (count_constructions) {
745
+ // To allow for truncation.
746
+ __ LoadRoot(r7, Heap::kOnePointerFillerMapRootIndex);
747
+ } else {
748
+ __ LoadRoot(r7, Heap::kUndefinedValueRootIndex);
749
+ }
750
+ __ b(&entry);
751
+ __ bind(&loop);
752
+ __ str(r7, MemOperand(r5, kPointerSize, PostIndex));
753
+ __ bind(&entry);
754
+ __ cmp(r5, r6);
755
+ __ b(lt, &loop);
756
+ }
757
+
758
+ // Add the object tag to make the JSObject real, so that we can continue and
759
+ // jump into the continuation code at any time from now on. Any failures
760
+ // need to undo the allocation, so that the heap is in a consistent state
761
+ // and verifiable.
762
+ __ add(r4, r4, Operand(kHeapObjectTag));
763
+
764
+ // Check if a non-empty properties array is needed. Continue with allocated
765
+ // object if not fall through to runtime call if it is.
766
+ // r1: constructor function
767
+ // r4: JSObject
768
+ // r5: start of next object (not tagged)
769
+ __ ldrb(r3, FieldMemOperand(r2, Map::kUnusedPropertyFieldsOffset));
770
+ // The field instance sizes contains both pre-allocated property fields and
771
+ // in-object properties.
772
+ __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset));
773
+ __ Ubfx(r6, r0, Map::kPreAllocatedPropertyFieldsByte * 8, 8);
774
+ __ add(r3, r3, Operand(r6));
775
+ __ Ubfx(r6, r0, Map::kInObjectPropertiesByte * 8, 8);
776
+ __ sub(r3, r3, Operand(r6), SetCC);
777
+
778
+ // Done if no extra properties are to be allocated.
779
+ __ b(eq, &allocated);
780
+ __ Assert(pl, "Property allocation count failed.");
781
+
782
+ // Scale the number of elements by pointer size and add the header for
783
+ // FixedArrays to the start of the next object calculation from above.
784
+ // r1: constructor
785
+ // r3: number of elements in properties array
786
+ // r4: JSObject
787
+ // r5: start of next object
788
+ __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize));
789
+ __ AllocateInNewSpace(
790
+ r0,
791
+ r5,
792
+ r6,
793
+ r2,
794
+ &undo_allocation,
795
+ static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS));
796
+
797
+ // Initialize the FixedArray.
798
+ // r1: constructor
799
+ // r3: number of elements in properties array
800
+ // r4: JSObject
801
+ // r5: FixedArray (not tagged)
802
+ __ LoadRoot(r6, Heap::kFixedArrayMapRootIndex);
803
+ __ mov(r2, r5);
804
+ ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset);
805
+ __ str(r6, MemOperand(r2, kPointerSize, PostIndex));
806
+ ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
807
+ __ mov(r0, Operand(r3, LSL, kSmiTagSize));
808
+ __ str(r0, MemOperand(r2, kPointerSize, PostIndex));
809
+
810
+ // Initialize the fields to undefined.
811
+ // r1: constructor function
812
+ // r2: First element of FixedArray (not tagged)
813
+ // r3: number of elements in properties array
814
+ // r4: JSObject
815
+ // r5: FixedArray (not tagged)
816
+ __ add(r6, r2, Operand(r3, LSL, kPointerSizeLog2)); // End of object.
817
+ ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
818
+ { Label loop, entry;
819
+ if (count_constructions) {
820
+ __ LoadRoot(r7, Heap::kUndefinedValueRootIndex);
821
+ } else if (FLAG_debug_code) {
822
+ __ LoadRoot(r8, Heap::kUndefinedValueRootIndex);
823
+ __ cmp(r7, r8);
824
+ __ Assert(eq, "Undefined value not loaded.");
825
+ }
826
+ __ b(&entry);
827
+ __ bind(&loop);
828
+ __ str(r7, MemOperand(r2, kPointerSize, PostIndex));
829
+ __ bind(&entry);
830
+ __ cmp(r2, r6);
831
+ __ b(lt, &loop);
832
+ }
833
+
834
+ // Store the initialized FixedArray into the properties field of
835
+ // the JSObject
836
+ // r1: constructor function
837
+ // r4: JSObject
838
+ // r5: FixedArray (not tagged)
839
+ __ add(r5, r5, Operand(kHeapObjectTag)); // Add the heap tag.
840
+ __ str(r5, FieldMemOperand(r4, JSObject::kPropertiesOffset));
841
+
842
+ // Continue with JSObject being successfully allocated
843
+ // r1: constructor function
844
+ // r4: JSObject
845
+ __ jmp(&allocated);
846
+
847
+ // Undo the setting of the new top so that the heap is verifiable. For
848
+ // example, the map's unused properties potentially do not match the
849
+ // allocated objects unused properties.
850
+ // r4: JSObject (previous new top)
851
+ __ bind(&undo_allocation);
852
+ __ UndoAllocationInNewSpace(r4, r5);
853
+ }
854
+
855
+ // Allocate the new receiver object using the runtime call.
856
+ // r1: constructor function
857
+ __ bind(&rt_call);
858
+ __ push(r1); // argument for Runtime_NewObject
859
+ __ CallRuntime(Runtime::kNewObject, 1);
860
+ __ mov(r4, r0);
861
+
862
+ // Receiver for constructor call allocated.
863
+ // r4: JSObject
864
+ __ bind(&allocated);
865
+ __ push(r4);
866
+
867
+ // Push the function and the allocated receiver from the stack.
868
+ // sp[0]: receiver (newly allocated object)
869
+ // sp[1]: constructor function
870
+ // sp[2]: number of arguments (smi-tagged)
871
+ __ ldr(r1, MemOperand(sp, kPointerSize));
872
+ __ push(r1); // Constructor function.
873
+ __ push(r4); // Receiver.
874
+
875
+ // Reload the number of arguments from the stack.
876
+ // r1: constructor function
877
+ // sp[0]: receiver
878
+ // sp[1]: constructor function
879
+ // sp[2]: receiver
880
+ // sp[3]: constructor function
881
+ // sp[4]: number of arguments (smi-tagged)
882
+ __ ldr(r3, MemOperand(sp, 4 * kPointerSize));
883
+
884
+ // Setup pointer to last argument.
885
+ __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
886
+
887
+ // Setup number of arguments for function call below
888
+ __ mov(r0, Operand(r3, LSR, kSmiTagSize));
889
+
890
+ // Copy arguments and receiver to the expression stack.
891
+ // r0: number of arguments
892
+ // r2: address of last argument (caller sp)
893
+ // r1: constructor function
894
+ // r3: number of arguments (smi-tagged)
895
+ // sp[0]: receiver
896
+ // sp[1]: constructor function
897
+ // sp[2]: receiver
898
+ // sp[3]: constructor function
899
+ // sp[4]: number of arguments (smi-tagged)
900
+ Label loop, entry;
901
+ __ b(&entry);
902
+ __ bind(&loop);
903
+ __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1));
904
+ __ push(ip);
905
+ __ bind(&entry);
906
+ __ sub(r3, r3, Operand(2), SetCC);
907
+ __ b(ge, &loop);
908
+
909
+ // Call the function.
910
+ // r0: number of arguments
911
+ // r1: constructor function
912
+ if (is_api_function) {
913
+ __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
914
+ Handle<Code> code =
915
+ masm->isolate()->builtins()->HandleApiCallConstruct();
916
+ ParameterCount expected(0);
917
+ __ InvokeCode(code, expected, expected,
918
+ RelocInfo::CODE_TARGET, CALL_FUNCTION);
919
+ } else {
920
+ ParameterCount actual(r0);
921
+ __ InvokeFunction(r1, actual, CALL_FUNCTION);
922
+ }
923
+
924
+ // Pop the function from the stack.
925
+ // sp[0]: constructor function
926
+ // sp[2]: receiver
927
+ // sp[3]: constructor function
928
+ // sp[4]: number of arguments (smi-tagged)
929
+ __ pop();
930
+
931
+ // Restore context from the frame.
932
+ // r0: result
933
+ // sp[0]: receiver
934
+ // sp[1]: constructor function
935
+ // sp[2]: number of arguments (smi-tagged)
936
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
937
+
938
+ // If the result is an object (in the ECMA sense), we should get rid
939
+ // of the receiver and use the result; see ECMA-262 section 13.2.2-7
940
+ // on page 74.
941
+ Label use_receiver, exit;
942
+
943
+ // If the result is a smi, it is *not* an object in the ECMA sense.
944
+ // r0: result
945
+ // sp[0]: receiver (newly allocated object)
946
+ // sp[1]: constructor function
947
+ // sp[2]: number of arguments (smi-tagged)
948
+ __ tst(r0, Operand(kSmiTagMask));
949
+ __ b(eq, &use_receiver);
950
+
951
+ // If the type of the result (stored in its map) is less than
952
+ // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense.
953
+ __ CompareObjectType(r0, r3, r3, FIRST_JS_OBJECT_TYPE);
954
+ __ b(ge, &exit);
955
+
956
+ // Throw away the result of the constructor invocation and use the
957
+ // on-stack receiver as the result.
958
+ __ bind(&use_receiver);
959
+ __ ldr(r0, MemOperand(sp));
960
+
961
+ // Remove receiver from the stack, remove caller arguments, and
962
+ // return.
963
+ __ bind(&exit);
964
+ // r0: result
965
+ // sp[0]: receiver (newly allocated object)
966
+ // sp[1]: constructor function
967
+ // sp[2]: number of arguments (smi-tagged)
968
+ __ ldr(r1, MemOperand(sp, 2 * kPointerSize));
969
+ __ LeaveConstructFrame();
970
+ __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1));
971
+ __ add(sp, sp, Operand(kPointerSize));
972
+ __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2);
973
+ __ Jump(lr);
974
+ }
975
+
976
+
977
+ void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) {
978
+ Generate_JSConstructStubHelper(masm, false, true);
979
+ }
980
+
981
+
982
+ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
983
+ Generate_JSConstructStubHelper(masm, false, false);
984
+ }
985
+
986
+
987
+ void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
988
+ Generate_JSConstructStubHelper(masm, true, false);
989
+ }
990
+
991
+
992
+ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
993
+ bool is_construct) {
994
+ // Called from Generate_JS_Entry
995
+ // r0: code entry
996
+ // r1: function
997
+ // r2: receiver
998
+ // r3: argc
999
+ // r4: argv
1000
+ // r5-r7, cp may be clobbered
1001
+
1002
+ // Clear the context before we push it when entering the JS frame.
1003
+ __ mov(cp, Operand(0, RelocInfo::NONE));
1004
+
1005
+ // Enter an internal frame.
1006
+ __ EnterInternalFrame();
1007
+
1008
+ // Set up the context from the function argument.
1009
+ __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1010
+
1011
+ // Set up the roots register.
1012
+ ExternalReference roots_address =
1013
+ ExternalReference::roots_address(masm->isolate());
1014
+ __ mov(r10, Operand(roots_address));
1015
+
1016
+ // Push the function and the receiver onto the stack.
1017
+ __ push(r1);
1018
+ __ push(r2);
1019
+
1020
+ // Copy arguments to the stack in a loop.
1021
+ // r1: function
1022
+ // r3: argc
1023
+ // r4: argv, i.e. points to first arg
1024
+ Label loop, entry;
1025
+ __ add(r2, r4, Operand(r3, LSL, kPointerSizeLog2));
1026
+ // r2 points past last arg.
1027
+ __ b(&entry);
1028
+ __ bind(&loop);
1029
+ __ ldr(r0, MemOperand(r4, kPointerSize, PostIndex)); // read next parameter
1030
+ __ ldr(r0, MemOperand(r0)); // dereference handle
1031
+ __ push(r0); // push parameter
1032
+ __ bind(&entry);
1033
+ __ cmp(r4, r2);
1034
+ __ b(ne, &loop);
1035
+
1036
+ // Initialize all JavaScript callee-saved registers, since they will be seen
1037
+ // by the garbage collector as part of handlers.
1038
+ __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
1039
+ __ mov(r5, Operand(r4));
1040
+ __ mov(r6, Operand(r4));
1041
+ __ mov(r7, Operand(r4));
1042
+ if (kR9Available == 1) {
1043
+ __ mov(r9, Operand(r4));
1044
+ }
1045
+
1046
+ // Invoke the code and pass argc as r0.
1047
+ __ mov(r0, Operand(r3));
1048
+ if (is_construct) {
1049
+ __ Call(masm->isolate()->builtins()->JSConstructCall(),
1050
+ RelocInfo::CODE_TARGET);
1051
+ } else {
1052
+ ParameterCount actual(r0);
1053
+ __ InvokeFunction(r1, actual, CALL_FUNCTION);
1054
+ }
1055
+
1056
+ // Exit the JS frame and remove the parameters (except function), and return.
1057
+ // Respect ABI stack constraint.
1058
+ __ LeaveInternalFrame();
1059
+ __ Jump(lr);
1060
+
1061
+ // r0: result
1062
+ }
1063
+
1064
+
1065
+ void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
1066
+ Generate_JSEntryTrampolineHelper(masm, false);
1067
+ }
1068
+
1069
+
1070
+ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
1071
+ Generate_JSEntryTrampolineHelper(masm, true);
1072
+ }
1073
+
1074
+
1075
+ void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
1076
+ // Enter an internal frame.
1077
+ __ EnterInternalFrame();
1078
+
1079
+ // Preserve the function.
1080
+ __ push(r1);
1081
+ // Push call kind information.
1082
+ __ push(r5);
1083
+
1084
+ // Push the function on the stack as the argument to the runtime function.
1085
+ __ push(r1);
1086
+ __ CallRuntime(Runtime::kLazyCompile, 1);
1087
+ // Calculate the entry point.
1088
+ __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
1089
+
1090
+ // Restore call kind information.
1091
+ __ pop(r5);
1092
+ // Restore saved function.
1093
+ __ pop(r1);
1094
+
1095
+ // Tear down temporary frame.
1096
+ __ LeaveInternalFrame();
1097
+
1098
+ // Do a tail-call of the compiled function.
1099
+ __ Jump(r2);
1100
+ }
1101
+
1102
+
1103
+ void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
1104
+ // Enter an internal frame.
1105
+ __ EnterInternalFrame();
1106
+
1107
+ // Preserve the function.
1108
+ __ push(r1);
1109
+ // Push call kind information.
1110
+ __ push(r5);
1111
+
1112
+ // Push the function on the stack as the argument to the runtime function.
1113
+ __ push(r1);
1114
+ __ CallRuntime(Runtime::kLazyRecompile, 1);
1115
+ // Calculate the entry point.
1116
+ __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
1117
+
1118
+ // Restore call kind information.
1119
+ __ pop(r5);
1120
+ // Restore saved function.
1121
+ __ pop(r1);
1122
+
1123
+ // Tear down temporary frame.
1124
+ __ LeaveInternalFrame();
1125
+
1126
+ // Do a tail-call of the compiled function.
1127
+ __ Jump(r2);
1128
+ }
1129
+
1130
+
1131
+ static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
1132
+ Deoptimizer::BailoutType type) {
1133
+ __ EnterInternalFrame();
1134
+ // Pass the function and deoptimization type to the runtime system.
1135
+ __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type))));
1136
+ __ push(r0);
1137
+ __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
1138
+ __ LeaveInternalFrame();
1139
+
1140
+ // Get the full codegen state from the stack and untag it -> r6.
1141
+ __ ldr(r6, MemOperand(sp, 0 * kPointerSize));
1142
+ __ SmiUntag(r6);
1143
+ // Switch on the state.
1144
+ Label with_tos_register, unknown_state;
1145
+ __ cmp(r6, Operand(FullCodeGenerator::NO_REGISTERS));
1146
+ __ b(ne, &with_tos_register);
1147
+ __ add(sp, sp, Operand(1 * kPointerSize)); // Remove state.
1148
+ __ Ret();
1149
+
1150
+ __ bind(&with_tos_register);
1151
+ __ ldr(r0, MemOperand(sp, 1 * kPointerSize));
1152
+ __ cmp(r6, Operand(FullCodeGenerator::TOS_REG));
1153
+ __ b(ne, &unknown_state);
1154
+ __ add(sp, sp, Operand(2 * kPointerSize)); // Remove state.
1155
+ __ Ret();
1156
+
1157
+ __ bind(&unknown_state);
1158
+ __ stop("no cases left");
1159
+ }
1160
+
1161
+
1162
+ void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) {
1163
+ Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
1164
+ }
1165
+
1166
+
1167
+ void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) {
1168
+ Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
1169
+ }
1170
+
1171
+
1172
+ void Builtins::Generate_NotifyOSR(MacroAssembler* masm) {
1173
+ // For now, we are relying on the fact that Runtime::NotifyOSR
1174
+ // doesn't do any garbage collection which allows us to save/restore
1175
+ // the registers without worrying about which of them contain
1176
+ // pointers. This seems a bit fragile.
1177
+ __ stm(db_w, sp, kJSCallerSaved | kCalleeSaved | lr.bit() | fp.bit());
1178
+ __ EnterInternalFrame();
1179
+ __ CallRuntime(Runtime::kNotifyOSR, 0);
1180
+ __ LeaveInternalFrame();
1181
+ __ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved | lr.bit() | fp.bit());
1182
+ __ Ret();
1183
+ }
1184
+
1185
+
1186
+ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1187
+ CpuFeatures::TryForceFeatureScope scope(VFP3);
1188
+ if (!CpuFeatures::IsSupported(VFP3)) {
1189
+ __ Abort("Unreachable code: Cannot optimize without VFP3 support.");
1190
+ return;
1191
+ }
1192
+
1193
+ // Lookup the function in the JavaScript frame and push it as an
1194
+ // argument to the on-stack replacement function.
1195
+ __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1196
+ __ EnterInternalFrame();
1197
+ __ push(r0);
1198
+ __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1199
+ __ LeaveInternalFrame();
1200
+
1201
+ // If the result was -1 it means that we couldn't optimize the
1202
+ // function. Just return and continue in the unoptimized version.
1203
+ Label skip;
1204
+ __ cmp(r0, Operand(Smi::FromInt(-1)));
1205
+ __ b(ne, &skip);
1206
+ __ Ret();
1207
+
1208
+ __ bind(&skip);
1209
+ // Untag the AST id and push it on the stack.
1210
+ __ SmiUntag(r0);
1211
+ __ push(r0);
1212
+
1213
+ // Generate the code for doing the frame-to-frame translation using
1214
+ // the deoptimizer infrastructure.
1215
+ Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1216
+ generator.Generate();
1217
+ }
1218
+
1219
+
1220
+ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
1221
+ // 1. Make sure we have at least one argument.
1222
+ // r0: actual number of arguments
1223
+ { Label done;
1224
+ __ tst(r0, Operand(r0));
1225
+ __ b(ne, &done);
1226
+ __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
1227
+ __ push(r2);
1228
+ __ add(r0, r0, Operand(1));
1229
+ __ bind(&done);
1230
+ }
1231
+
1232
+ // 2. Get the function to call (passed as receiver) from the stack, check
1233
+ // if it is a function.
1234
+ // r0: actual number of arguments
1235
+ Label non_function;
1236
+ __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1237
+ __ tst(r1, Operand(kSmiTagMask));
1238
+ __ b(eq, &non_function);
1239
+ __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
1240
+ __ b(ne, &non_function);
1241
+
1242
+ // 3a. Patch the first argument if necessary when calling a function.
1243
+ // r0: actual number of arguments
1244
+ // r1: function
1245
+ Label shift_arguments;
1246
+ { Label convert_to_object, use_global_receiver, patch_receiver;
1247
+ // Change context eagerly in case we need the global receiver.
1248
+ __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1249
+
1250
+ // Do not transform the receiver for strict mode functions.
1251
+ __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1252
+ __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
1253
+ __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1254
+ kSmiTagSize)));
1255
+ __ b(ne, &shift_arguments);
1256
+
1257
+ // Do not transform the receiver for native (Compilerhints already in r3).
1258
+ __ tst(r3, Operand(1 << (SharedFunctionInfo::kES5Native +
1259
+ kSmiTagSize)));
1260
+ __ b(ne, &shift_arguments);
1261
+
1262
+ // Compute the receiver in non-strict mode.
1263
+ __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1264
+ __ ldr(r2, MemOperand(r2, -kPointerSize));
1265
+ // r0: actual number of arguments
1266
+ // r1: function
1267
+ // r2: first argument
1268
+ __ tst(r2, Operand(kSmiTagMask));
1269
+ __ b(eq, &convert_to_object);
1270
+
1271
+ __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
1272
+ __ cmp(r2, r3);
1273
+ __ b(eq, &use_global_receiver);
1274
+ __ LoadRoot(r3, Heap::kNullValueRootIndex);
1275
+ __ cmp(r2, r3);
1276
+ __ b(eq, &use_global_receiver);
1277
+
1278
+ STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE);
1279
+ STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1280
+ __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE);
1281
+ __ b(ge, &shift_arguments);
1282
+
1283
+ __ bind(&convert_to_object);
1284
+ __ EnterInternalFrame(); // In order to preserve argument count.
1285
+ __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged.
1286
+ __ push(r0);
1287
+
1288
+ __ push(r2);
1289
+ __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1290
+ __ mov(r2, r0);
1291
+
1292
+ __ pop(r0);
1293
+ __ mov(r0, Operand(r0, ASR, kSmiTagSize));
1294
+ __ LeaveInternalFrame();
1295
+ // Restore the function to r1.
1296
+ __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1297
+ __ jmp(&patch_receiver);
1298
+
1299
+ // Use the global receiver object from the called function as the
1300
+ // receiver.
1301
+ __ bind(&use_global_receiver);
1302
+ const int kGlobalIndex =
1303
+ Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
1304
+ __ ldr(r2, FieldMemOperand(cp, kGlobalIndex));
1305
+ __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
1306
+ __ ldr(r2, FieldMemOperand(r2, kGlobalIndex));
1307
+ __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
1308
+
1309
+ __ bind(&patch_receiver);
1310
+ __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2));
1311
+ __ str(r2, MemOperand(r3, -kPointerSize));
1312
+
1313
+ __ jmp(&shift_arguments);
1314
+ }
1315
+
1316
+ // 3b. Patch the first argument when calling a non-function. The
1317
+ // CALL_NON_FUNCTION builtin expects the non-function callee as
1318
+ // receiver, so overwrite the first argument which will ultimately
1319
+ // become the receiver.
1320
+ // r0: actual number of arguments
1321
+ // r1: function
1322
+ __ bind(&non_function);
1323
+ __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1324
+ __ str(r1, MemOperand(r2, -kPointerSize));
1325
+ // Clear r1 to indicate a non-function being called.
1326
+ __ mov(r1, Operand(0, RelocInfo::NONE));
1327
+
1328
+ // 4. Shift arguments and return address one slot down on the stack
1329
+ // (overwriting the original receiver). Adjust argument count to make
1330
+ // the original first argument the new receiver.
1331
+ // r0: actual number of arguments
1332
+ // r1: function
1333
+ __ bind(&shift_arguments);
1334
+ { Label loop;
1335
+ // Calculate the copy start address (destination). Copy end address is sp.
1336
+ __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1337
+
1338
+ __ bind(&loop);
1339
+ __ ldr(ip, MemOperand(r2, -kPointerSize));
1340
+ __ str(ip, MemOperand(r2));
1341
+ __ sub(r2, r2, Operand(kPointerSize));
1342
+ __ cmp(r2, sp);
1343
+ __ b(ne, &loop);
1344
+ // Adjust the actual number of arguments and remove the top element
1345
+ // (which is a copy of the last argument).
1346
+ __ sub(r0, r0, Operand(1));
1347
+ __ pop();
1348
+ }
1349
+
1350
+ // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
1351
+ // r0: actual number of arguments
1352
+ // r1: function
1353
+ { Label function;
1354
+ __ tst(r1, r1);
1355
+ __ b(ne, &function);
1356
+ // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1357
+ __ mov(r2, Operand(0, RelocInfo::NONE));
1358
+ __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
1359
+ __ SetCallKind(r5, CALL_AS_METHOD);
1360
+ __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1361
+ RelocInfo::CODE_TARGET);
1362
+ __ bind(&function);
1363
+ }
1364
+
1365
+ // 5b. Get the code to call from the function and check that the number of
1366
+ // expected arguments matches what we're providing. If so, jump
1367
+ // (tail-call) to the code in register edx without checking arguments.
1368
+ // r0: actual number of arguments
1369
+ // r1: function
1370
+ __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1371
+ __ ldr(r2,
1372
+ FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1373
+ __ mov(r2, Operand(r2, ASR, kSmiTagSize));
1374
+ __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1375
+ __ SetCallKind(r5, CALL_AS_METHOD);
1376
+ __ cmp(r2, r0); // Check formal and actual parameter counts.
1377
+ __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1378
+ RelocInfo::CODE_TARGET,
1379
+ ne);
1380
+
1381
+ ParameterCount expected(0);
1382
+ __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1383
+ }
1384
+
1385
+
1386
+ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1387
+ const int kIndexOffset = -5 * kPointerSize;
1388
+ const int kLimitOffset = -4 * kPointerSize;
1389
+ const int kArgsOffset = 2 * kPointerSize;
1390
+ const int kRecvOffset = 3 * kPointerSize;
1391
+ const int kFunctionOffset = 4 * kPointerSize;
1392
+
1393
+ __ EnterInternalFrame();
1394
+
1395
+ __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function
1396
+ __ push(r0);
1397
+ __ ldr(r0, MemOperand(fp, kArgsOffset)); // get the args array
1398
+ __ push(r0);
1399
+ __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
1400
+
1401
+ // Check the stack for overflow. We are not trying need to catch
1402
+ // interruptions (e.g. debug break and preemption) here, so the "real stack
1403
+ // limit" is checked.
1404
+ Label okay;
1405
+ __ LoadRoot(r2, Heap::kRealStackLimitRootIndex);
1406
+ // Make r2 the space we have left. The stack might already be overflowed
1407
+ // here which will cause r2 to become negative.
1408
+ __ sub(r2, sp, r2);
1409
+ // Check if the arguments will overflow the stack.
1410
+ __ cmp(r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
1411
+ __ b(gt, &okay); // Signed comparison.
1412
+
1413
+ // Out of stack space.
1414
+ __ ldr(r1, MemOperand(fp, kFunctionOffset));
1415
+ __ push(r1);
1416
+ __ push(r0);
1417
+ __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
1418
+ // End of stack check.
1419
+
1420
+ // Push current limit and index.
1421
+ __ bind(&okay);
1422
+ __ push(r0); // limit
1423
+ __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index
1424
+ __ push(r1);
1425
+
1426
+ // Change context eagerly to get the right global object if necessary.
1427
+ __ ldr(r0, MemOperand(fp, kFunctionOffset));
1428
+ __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset));
1429
+ // Load the shared function info while the function is still in r0.
1430
+ __ ldr(r1, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset));
1431
+
1432
+ // Compute the receiver.
1433
+ Label call_to_object, use_global_receiver, push_receiver;
1434
+ __ ldr(r0, MemOperand(fp, kRecvOffset));
1435
+
1436
+ // Do not transform the receiver for strict mode functions.
1437
+ __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset));
1438
+ __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1439
+ kSmiTagSize)));
1440
+ __ b(ne, &push_receiver);
1441
+
1442
+ // Do not transform the receiver for strict mode functions.
1443
+ __ tst(r2, Operand(1 << (SharedFunctionInfo::kES5Native +
1444
+ kSmiTagSize)));
1445
+ __ b(ne, &push_receiver);
1446
+
1447
+ // Compute the receiver in non-strict mode.
1448
+ __ tst(r0, Operand(kSmiTagMask));
1449
+ __ b(eq, &call_to_object);
1450
+ __ LoadRoot(r1, Heap::kNullValueRootIndex);
1451
+ __ cmp(r0, r1);
1452
+ __ b(eq, &use_global_receiver);
1453
+ __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
1454
+ __ cmp(r0, r1);
1455
+ __ b(eq, &use_global_receiver);
1456
+
1457
+ // Check if the receiver is already a JavaScript object.
1458
+ // r0: receiver
1459
+ STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE);
1460
+ STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1461
+ __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE);
1462
+ __ b(ge, &push_receiver);
1463
+
1464
+ // Convert the receiver to a regular object.
1465
+ // r0: receiver
1466
+ __ bind(&call_to_object);
1467
+ __ push(r0);
1468
+ __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1469
+ __ b(&push_receiver);
1470
+
1471
+ // Use the current global receiver object as the receiver.
1472
+ __ bind(&use_global_receiver);
1473
+ const int kGlobalOffset =
1474
+ Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
1475
+ __ ldr(r0, FieldMemOperand(cp, kGlobalOffset));
1476
+ __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
1477
+ __ ldr(r0, FieldMemOperand(r0, kGlobalOffset));
1478
+ __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));
1479
+
1480
+ // Push the receiver.
1481
+ // r0: receiver
1482
+ __ bind(&push_receiver);
1483
+ __ push(r0);
1484
+
1485
+ // Copy all arguments from the array to the stack.
1486
+ Label entry, loop;
1487
+ __ ldr(r0, MemOperand(fp, kIndexOffset));
1488
+ __ b(&entry);
1489
+
1490
+ // Load the current argument from the arguments array and push it to the
1491
+ // stack.
1492
+ // r0: current argument index
1493
+ __ bind(&loop);
1494
+ __ ldr(r1, MemOperand(fp, kArgsOffset));
1495
+ __ push(r1);
1496
+ __ push(r0);
1497
+
1498
+ // Call the runtime to access the property in the arguments array.
1499
+ __ CallRuntime(Runtime::kGetProperty, 2);
1500
+ __ push(r0);
1501
+
1502
+ // Use inline caching to access the arguments.
1503
+ __ ldr(r0, MemOperand(fp, kIndexOffset));
1504
+ __ add(r0, r0, Operand(1 << kSmiTagSize));
1505
+ __ str(r0, MemOperand(fp, kIndexOffset));
1506
+
1507
+ // Test if the copy loop has finished copying all the elements from the
1508
+ // arguments object.
1509
+ __ bind(&entry);
1510
+ __ ldr(r1, MemOperand(fp, kLimitOffset));
1511
+ __ cmp(r0, r1);
1512
+ __ b(ne, &loop);
1513
+
1514
+ // Invoke the function.
1515
+ ParameterCount actual(r0);
1516
+ __ mov(r0, Operand(r0, ASR, kSmiTagSize));
1517
+ __ ldr(r1, MemOperand(fp, kFunctionOffset));
1518
+ __ InvokeFunction(r1, actual, CALL_FUNCTION);
1519
+
1520
+ // Tear down the internal frame and remove function, receiver and args.
1521
+ __ LeaveInternalFrame();
1522
+ __ add(sp, sp, Operand(3 * kPointerSize));
1523
+ __ Jump(lr);
1524
+ }
1525
+
1526
+
1527
+ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1528
+ __ mov(r0, Operand(r0, LSL, kSmiTagSize));
1529
+ __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1530
+ __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit());
1531
+ __ add(fp, sp, Operand(3 * kPointerSize));
1532
+ }
1533
+
1534
+
1535
+ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1536
+ // ----------- S t a t e -------------
1537
+ // -- r0 : result being passed through
1538
+ // -----------------------------------
1539
+ // Get the number of arguments passed (as a smi), tear down the frame and
1540
+ // then tear down the parameters.
1541
+ __ ldr(r1, MemOperand(fp, -3 * kPointerSize));
1542
+ __ mov(sp, fp);
1543
+ __ ldm(ia_w, sp, fp.bit() | lr.bit());
1544
+ __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize));
1545
+ __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver
1546
+ }
1547
+
1548
+
1549
+ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1550
+ // ----------- S t a t e -------------
1551
+ // -- r0 : actual number of arguments
1552
+ // -- r1 : function (passed through to callee)
1553
+ // -- r2 : expected number of arguments
1554
+ // -- r3 : code entry to call
1555
+ // -- r5 : call kind information
1556
+ // -----------------------------------
1557
+
1558
+ Label invoke, dont_adapt_arguments;
1559
+
1560
+ Label enough, too_few;
1561
+ __ cmp(r0, r2);
1562
+ __ b(lt, &too_few);
1563
+ __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1564
+ __ b(eq, &dont_adapt_arguments);
1565
+
1566
+ { // Enough parameters: actual >= expected
1567
+ __ bind(&enough);
1568
+ EnterArgumentsAdaptorFrame(masm);
1569
+
1570
+ // Calculate copy start address into r0 and copy end address into r2.
1571
+ // r0: actual number of arguments as a smi
1572
+ // r1: function
1573
+ // r2: expected number of arguments
1574
+ // r3: code entry to call
1575
+ __ add(r0, fp, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
1576
+ // adjust for return address and receiver
1577
+ __ add(r0, r0, Operand(2 * kPointerSize));
1578
+ __ sub(r2, r0, Operand(r2, LSL, kPointerSizeLog2));
1579
+
1580
+ // Copy the arguments (including the receiver) to the new stack frame.
1581
+ // r0: copy start address
1582
+ // r1: function
1583
+ // r2: copy end address
1584
+ // r3: code entry to call
1585
+
1586
+ Label copy;
1587
+ __ bind(&copy);
1588
+ __ ldr(ip, MemOperand(r0, 0));
1589
+ __ push(ip);
1590
+ __ cmp(r0, r2); // Compare before moving to next argument.
1591
+ __ sub(r0, r0, Operand(kPointerSize));
1592
+ __ b(ne, &copy);
1593
+
1594
+ __ b(&invoke);
1595
+ }
1596
+
1597
+ { // Too few parameters: Actual < expected
1598
+ __ bind(&too_few);
1599
+ EnterArgumentsAdaptorFrame(masm);
1600
+
1601
+ // Calculate copy start address into r0 and copy end address is fp.
1602
+ // r0: actual number of arguments as a smi
1603
+ // r1: function
1604
+ // r2: expected number of arguments
1605
+ // r3: code entry to call
1606
+ __ add(r0, fp, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
1607
+
1608
+ // Copy the arguments (including the receiver) to the new stack frame.
1609
+ // r0: copy start address
1610
+ // r1: function
1611
+ // r2: expected number of arguments
1612
+ // r3: code entry to call
1613
+ Label copy;
1614
+ __ bind(&copy);
1615
+ // Adjust load for return address and receiver.
1616
+ __ ldr(ip, MemOperand(r0, 2 * kPointerSize));
1617
+ __ push(ip);
1618
+ __ cmp(r0, fp); // Compare before moving to next argument.
1619
+ __ sub(r0, r0, Operand(kPointerSize));
1620
+ __ b(ne, &copy);
1621
+
1622
+ // Fill the remaining expected arguments with undefined.
1623
+ // r1: function
1624
+ // r2: expected number of arguments
1625
+ // r3: code entry to call
1626
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1627
+ __ sub(r2, fp, Operand(r2, LSL, kPointerSizeLog2));
1628
+ __ sub(r2, r2, Operand(4 * kPointerSize)); // Adjust for frame.
1629
+
1630
+ Label fill;
1631
+ __ bind(&fill);
1632
+ __ push(ip);
1633
+ __ cmp(sp, r2);
1634
+ __ b(ne, &fill);
1635
+ }
1636
+
1637
+ // Call the entry point.
1638
+ __ bind(&invoke);
1639
+ __ Call(r3);
1640
+
1641
+ // Exit frame and return.
1642
+ LeaveArgumentsAdaptorFrame(masm);
1643
+ __ Jump(lr);
1644
+
1645
+
1646
+ // -------------------------------------------
1647
+ // Dont adapt arguments.
1648
+ // -------------------------------------------
1649
+ __ bind(&dont_adapt_arguments);
1650
+ __ Jump(r3);
1651
+ }
1652
+
1653
+
1654
+ #undef __
1655
+
1656
+ } } // namespace v8::internal
1657
+
1658
+ #endif // V8_TARGET_ARCH_ARM