therubyracer 0.9.0beta4 → 0.9.0beta5

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

Potentially problematic release.


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

Files changed (771) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +0 -11
  3. data/ext/v8/extconf.rb +9 -9
  4. data/ext/v8/v8_external.cpp +40 -10
  5. data/lib/v8/cli.rb +2 -1
  6. data/lib/v8/version.rb +1 -1
  7. data/spec/redjs/.gitignore +1 -0
  8. data/therubyracer.gemspec +2 -3
  9. metadata +33 -779
  10. data/ext/v8/upstream/Makefile +0 -38
  11. data/ext/v8/upstream/detect_cpu.rb +0 -27
  12. data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
  13. data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
  14. data/ext/v8/upstream/scons/LICENSE.txt +0 -20
  15. data/ext/v8/upstream/scons/MANIFEST +0 -202
  16. data/ext/v8/upstream/scons/PKG-INFO +0 -13
  17. data/ext/v8/upstream/scons/README.txt +0 -273
  18. data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
  19. data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
  20. data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
  21. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
  22. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
  23. data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
  24. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
  25. data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
  26. data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
  27. data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
  28. data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
  29. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
  30. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
  31. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
  32. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
  33. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
  34. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
  35. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
  36. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
  37. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
  38. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
  39. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
  40. data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
  41. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
  42. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
  43. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
  44. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
  45. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
  46. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
  47. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
  48. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
  49. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
  50. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
  51. data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
  52. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
  53. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
  54. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
  55. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
  56. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
  57. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
  58. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
  59. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
  60. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
  61. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
  62. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
  63. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
  64. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
  65. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
  66. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
  67. data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
  68. data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
  69. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
  70. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
  71. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
  72. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
  73. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
  74. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
  75. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
  76. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
  77. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
  78. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
  79. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
  80. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
  81. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
  82. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
  83. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
  84. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
  85. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
  86. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
  87. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
  88. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
  89. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
  90. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
  91. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
  92. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
  93. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
  94. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
  95. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
  96. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
  97. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
  98. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
  99. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
  100. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
  101. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
  102. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
  103. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
  104. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
  105. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
  106. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
  107. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
  108. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
  109. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
  110. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
  111. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
  112. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
  113. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
  114. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
  115. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
  116. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
  117. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
  118. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
  119. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
  120. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
  121. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
  122. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
  123. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
  124. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
  125. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
  126. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
  127. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
  128. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
  129. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
  130. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
  131. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
  132. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
  133. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
  134. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
  135. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
  136. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
  137. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
  138. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
  139. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
  140. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
  141. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
  142. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
  143. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
  144. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
  145. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
  146. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
  147. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
  148. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
  149. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
  150. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
  151. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
  152. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
  153. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
  154. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
  155. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
  156. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
  157. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
  158. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
  159. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
  160. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
  161. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
  162. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
  163. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
  164. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
  165. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
  166. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
  167. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
  168. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
  169. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
  170. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
  171. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
  172. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
  173. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
  174. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
  175. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
  176. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
  177. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
  178. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
  179. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
  180. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
  181. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
  182. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
  183. data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
  184. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
  185. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
  186. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
  187. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
  188. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
  189. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
  190. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
  191. data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
  192. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
  193. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
  194. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
  195. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
  196. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
  197. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
  198. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
  199. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
  200. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
  201. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
  202. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
  203. data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
  204. data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
  205. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
  206. data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
  207. data/ext/v8/upstream/scons/scons-time.1 +0 -1017
  208. data/ext/v8/upstream/scons/scons.1 +0 -15179
  209. data/ext/v8/upstream/scons/sconsign.1 +0 -208
  210. data/ext/v8/upstream/scons/script/scons +0 -184
  211. data/ext/v8/upstream/scons/script/scons-time +0 -1529
  212. data/ext/v8/upstream/scons/script/scons.bat +0 -31
  213. data/ext/v8/upstream/scons/script/sconsign +0 -508
  214. data/ext/v8/upstream/scons/setup.cfg +0 -6
  215. data/ext/v8/upstream/scons/setup.py +0 -427
  216. data/ext/v8/upstream/v8/.gitignore +0 -33
  217. data/ext/v8/upstream/v8/AUTHORS +0 -42
  218. data/ext/v8/upstream/v8/ChangeLog +0 -2663
  219. data/ext/v8/upstream/v8/LICENSE +0 -52
  220. data/ext/v8/upstream/v8/LICENSE.strongtalk +0 -29
  221. data/ext/v8/upstream/v8/LICENSE.v8 +0 -26
  222. data/ext/v8/upstream/v8/LICENSE.valgrind +0 -45
  223. data/ext/v8/upstream/v8/SConstruct +0 -1473
  224. data/ext/v8/upstream/v8/build/README.txt +0 -25
  225. data/ext/v8/upstream/v8/build/all.gyp +0 -18
  226. data/ext/v8/upstream/v8/build/armu.gypi +0 -32
  227. data/ext/v8/upstream/v8/build/common.gypi +0 -82
  228. data/ext/v8/upstream/v8/build/gyp_v8 +0 -145
  229. data/ext/v8/upstream/v8/include/v8-debug.h +0 -394
  230. data/ext/v8/upstream/v8/include/v8-preparser.h +0 -116
  231. data/ext/v8/upstream/v8/include/v8-profiler.h +0 -505
  232. data/ext/v8/upstream/v8/include/v8-testing.h +0 -104
  233. data/ext/v8/upstream/v8/include/v8.h +0 -4000
  234. data/ext/v8/upstream/v8/include/v8stdint.h +0 -53
  235. data/ext/v8/upstream/v8/preparser/SConscript +0 -38
  236. data/ext/v8/upstream/v8/preparser/preparser-process.cc +0 -169
  237. data/ext/v8/upstream/v8/src/SConscript +0 -380
  238. data/ext/v8/upstream/v8/src/accessors.cc +0 -766
  239. data/ext/v8/upstream/v8/src/accessors.h +0 -121
  240. data/ext/v8/upstream/v8/src/allocation-inl.h +0 -49
  241. data/ext/v8/upstream/v8/src/allocation.cc +0 -122
  242. data/ext/v8/upstream/v8/src/allocation.h +0 -143
  243. data/ext/v8/upstream/v8/src/api.cc +0 -5678
  244. data/ext/v8/upstream/v8/src/api.h +0 -572
  245. data/ext/v8/upstream/v8/src/apinatives.js +0 -110
  246. data/ext/v8/upstream/v8/src/apiutils.h +0 -73
  247. data/ext/v8/upstream/v8/src/arguments.h +0 -116
  248. data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +0 -353
  249. data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +0 -2877
  250. data/ext/v8/upstream/v8/src/arm/assembler-arm.h +0 -1382
  251. data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +0 -1634
  252. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +0 -6917
  253. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +0 -623
  254. data/ext/v8/upstream/v8/src/arm/codegen-arm-inl.h +0 -48
  255. data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +0 -7437
  256. data/ext/v8/upstream/v8/src/arm/codegen-arm.h +0 -595
  257. data/ext/v8/upstream/v8/src/arm/constants-arm.cc +0 -152
  258. data/ext/v8/upstream/v8/src/arm/constants-arm.h +0 -778
  259. data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +0 -149
  260. data/ext/v8/upstream/v8/src/arm/debug-arm.cc +0 -317
  261. data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +0 -737
  262. data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +0 -1503
  263. data/ext/v8/upstream/v8/src/arm/frames-arm.cc +0 -45
  264. data/ext/v8/upstream/v8/src/arm/frames-arm.h +0 -168
  265. data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +0 -4374
  266. data/ext/v8/upstream/v8/src/arm/ic-arm.cc +0 -1793
  267. data/ext/v8/upstream/v8/src/arm/jump-target-arm.cc +0 -174
  268. data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +0 -2120
  269. data/ext/v8/upstream/v8/src/arm/lithium-arm.h +0 -2179
  270. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +0 -4132
  271. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +0 -329
  272. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +0 -305
  273. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.h +0 -84
  274. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +0 -2939
  275. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +0 -1071
  276. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +0 -1287
  277. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +0 -253
  278. data/ext/v8/upstream/v8/src/arm/register-allocator-arm-inl.h +0 -100
  279. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.cc +0 -63
  280. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.h +0 -44
  281. data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +0 -3288
  282. data/ext/v8/upstream/v8/src/arm/simulator-arm.h +0 -413
  283. data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +0 -4034
  284. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm-inl.h +0 -59
  285. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +0 -843
  286. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +0 -523
  287. data/ext/v8/upstream/v8/src/array.js +0 -1249
  288. data/ext/v8/upstream/v8/src/assembler.cc +0 -1067
  289. data/ext/v8/upstream/v8/src/assembler.h +0 -823
  290. data/ext/v8/upstream/v8/src/ast-inl.h +0 -112
  291. data/ext/v8/upstream/v8/src/ast.cc +0 -1078
  292. data/ext/v8/upstream/v8/src/ast.h +0 -2234
  293. data/ext/v8/upstream/v8/src/atomicops.h +0 -167
  294. data/ext/v8/upstream/v8/src/atomicops_internals_arm_gcc.h +0 -145
  295. data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +0 -169
  296. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.cc +0 -126
  297. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.h +0 -287
  298. data/ext/v8/upstream/v8/src/atomicops_internals_x86_macosx.h +0 -301
  299. data/ext/v8/upstream/v8/src/atomicops_internals_x86_msvc.h +0 -203
  300. data/ext/v8/upstream/v8/src/bignum-dtoa.cc +0 -655
  301. data/ext/v8/upstream/v8/src/bignum-dtoa.h +0 -81
  302. data/ext/v8/upstream/v8/src/bignum.cc +0 -768
  303. data/ext/v8/upstream/v8/src/bignum.h +0 -140
  304. data/ext/v8/upstream/v8/src/bootstrapper.cc +0 -2138
  305. data/ext/v8/upstream/v8/src/bootstrapper.h +0 -185
  306. data/ext/v8/upstream/v8/src/builtins.cc +0 -1708
  307. data/ext/v8/upstream/v8/src/builtins.h +0 -368
  308. data/ext/v8/upstream/v8/src/bytecodes-irregexp.h +0 -105
  309. data/ext/v8/upstream/v8/src/cached-powers.cc +0 -177
  310. data/ext/v8/upstream/v8/src/cached-powers.h +0 -65
  311. data/ext/v8/upstream/v8/src/char-predicates-inl.h +0 -94
  312. data/ext/v8/upstream/v8/src/char-predicates.h +0 -65
  313. data/ext/v8/upstream/v8/src/checks.cc +0 -110
  314. data/ext/v8/upstream/v8/src/checks.h +0 -296
  315. data/ext/v8/upstream/v8/src/circular-queue-inl.h +0 -53
  316. data/ext/v8/upstream/v8/src/circular-queue.cc +0 -122
  317. data/ext/v8/upstream/v8/src/circular-queue.h +0 -103
  318. data/ext/v8/upstream/v8/src/code-stubs.cc +0 -240
  319. data/ext/v8/upstream/v8/src/code-stubs.h +0 -971
  320. data/ext/v8/upstream/v8/src/code.h +0 -68
  321. data/ext/v8/upstream/v8/src/codegen-inl.h +0 -68
  322. data/ext/v8/upstream/v8/src/codegen.cc +0 -505
  323. data/ext/v8/upstream/v8/src/codegen.h +0 -245
  324. data/ext/v8/upstream/v8/src/compilation-cache.cc +0 -540
  325. data/ext/v8/upstream/v8/src/compilation-cache.h +0 -287
  326. data/ext/v8/upstream/v8/src/compiler.cc +0 -792
  327. data/ext/v8/upstream/v8/src/compiler.h +0 -307
  328. data/ext/v8/upstream/v8/src/contexts.cc +0 -327
  329. data/ext/v8/upstream/v8/src/contexts.h +0 -382
  330. data/ext/v8/upstream/v8/src/conversions-inl.h +0 -110
  331. data/ext/v8/upstream/v8/src/conversions.cc +0 -1125
  332. data/ext/v8/upstream/v8/src/conversions.h +0 -122
  333. data/ext/v8/upstream/v8/src/counters.cc +0 -93
  334. data/ext/v8/upstream/v8/src/counters.h +0 -254
  335. data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +0 -101
  336. data/ext/v8/upstream/v8/src/cpu-profiler.cc +0 -606
  337. data/ext/v8/upstream/v8/src/cpu-profiler.h +0 -305
  338. data/ext/v8/upstream/v8/src/cpu.h +0 -67
  339. data/ext/v8/upstream/v8/src/d8-debug.cc +0 -367
  340. data/ext/v8/upstream/v8/src/d8-debug.h +0 -158
  341. data/ext/v8/upstream/v8/src/d8-posix.cc +0 -695
  342. data/ext/v8/upstream/v8/src/d8-readline.cc +0 -128
  343. data/ext/v8/upstream/v8/src/d8-windows.cc +0 -42
  344. data/ext/v8/upstream/v8/src/d8.cc +0 -796
  345. data/ext/v8/upstream/v8/src/d8.gyp +0 -88
  346. data/ext/v8/upstream/v8/src/d8.h +0 -231
  347. data/ext/v8/upstream/v8/src/d8.js +0 -2798
  348. data/ext/v8/upstream/v8/src/data-flow.cc +0 -545
  349. data/ext/v8/upstream/v8/src/data-flow.h +0 -379
  350. data/ext/v8/upstream/v8/src/date.js +0 -1103
  351. data/ext/v8/upstream/v8/src/dateparser-inl.h +0 -125
  352. data/ext/v8/upstream/v8/src/dateparser.cc +0 -178
  353. data/ext/v8/upstream/v8/src/dateparser.h +0 -265
  354. data/ext/v8/upstream/v8/src/debug-agent.cc +0 -447
  355. data/ext/v8/upstream/v8/src/debug-agent.h +0 -129
  356. data/ext/v8/upstream/v8/src/debug-debugger.js +0 -2569
  357. data/ext/v8/upstream/v8/src/debug.cc +0 -3188
  358. data/ext/v8/upstream/v8/src/debug.h +0 -1055
  359. data/ext/v8/upstream/v8/src/deoptimizer.cc +0 -1296
  360. data/ext/v8/upstream/v8/src/deoptimizer.h +0 -629
  361. data/ext/v8/upstream/v8/src/disasm.h +0 -80
  362. data/ext/v8/upstream/v8/src/disassembler.cc +0 -339
  363. data/ext/v8/upstream/v8/src/disassembler.h +0 -56
  364. data/ext/v8/upstream/v8/src/diy-fp.cc +0 -58
  365. data/ext/v8/upstream/v8/src/diy-fp.h +0 -117
  366. data/ext/v8/upstream/v8/src/double.h +0 -238
  367. data/ext/v8/upstream/v8/src/dtoa.cc +0 -103
  368. data/ext/v8/upstream/v8/src/dtoa.h +0 -85
  369. data/ext/v8/upstream/v8/src/execution.cc +0 -791
  370. data/ext/v8/upstream/v8/src/execution.h +0 -291
  371. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +0 -250
  372. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +0 -89
  373. data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +0 -55
  374. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +0 -284
  375. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.h +0 -64
  376. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +0 -141
  377. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.h +0 -50
  378. data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +0 -58
  379. data/ext/v8/upstream/v8/src/extensions/gc-extension.h +0 -49
  380. data/ext/v8/upstream/v8/src/factory.cc +0 -1194
  381. data/ext/v8/upstream/v8/src/factory.h +0 -436
  382. data/ext/v8/upstream/v8/src/fast-dtoa.cc +0 -736
  383. data/ext/v8/upstream/v8/src/fast-dtoa.h +0 -83
  384. data/ext/v8/upstream/v8/src/fixed-dtoa.cc +0 -405
  385. data/ext/v8/upstream/v8/src/fixed-dtoa.h +0 -55
  386. data/ext/v8/upstream/v8/src/flag-definitions.h +0 -556
  387. data/ext/v8/upstream/v8/src/flags.cc +0 -551
  388. data/ext/v8/upstream/v8/src/flags.h +0 -79
  389. data/ext/v8/upstream/v8/src/frame-element.cc +0 -37
  390. data/ext/v8/upstream/v8/src/frame-element.h +0 -269
  391. data/ext/v8/upstream/v8/src/frames-inl.h +0 -236
  392. data/ext/v8/upstream/v8/src/frames.cc +0 -1273
  393. data/ext/v8/upstream/v8/src/frames.h +0 -854
  394. data/ext/v8/upstream/v8/src/full-codegen.cc +0 -1385
  395. data/ext/v8/upstream/v8/src/full-codegen.h +0 -753
  396. data/ext/v8/upstream/v8/src/func-name-inferrer.cc +0 -91
  397. data/ext/v8/upstream/v8/src/func-name-inferrer.h +0 -111
  398. data/ext/v8/upstream/v8/src/gdb-jit.cc +0 -1548
  399. data/ext/v8/upstream/v8/src/gdb-jit.h +0 -138
  400. data/ext/v8/upstream/v8/src/global-handles.cc +0 -596
  401. data/ext/v8/upstream/v8/src/global-handles.h +0 -239
  402. data/ext/v8/upstream/v8/src/globals.h +0 -325
  403. data/ext/v8/upstream/v8/src/handles-inl.h +0 -177
  404. data/ext/v8/upstream/v8/src/handles.cc +0 -965
  405. data/ext/v8/upstream/v8/src/handles.h +0 -372
  406. data/ext/v8/upstream/v8/src/hashmap.cc +0 -230
  407. data/ext/v8/upstream/v8/src/hashmap.h +0 -121
  408. data/ext/v8/upstream/v8/src/heap-inl.h +0 -703
  409. data/ext/v8/upstream/v8/src/heap-profiler.cc +0 -1173
  410. data/ext/v8/upstream/v8/src/heap-profiler.h +0 -396
  411. data/ext/v8/upstream/v8/src/heap.cc +0 -5856
  412. data/ext/v8/upstream/v8/src/heap.h +0 -2264
  413. data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +0 -1639
  414. data/ext/v8/upstream/v8/src/hydrogen-instructions.h +0 -3657
  415. data/ext/v8/upstream/v8/src/hydrogen.cc +0 -6011
  416. data/ext/v8/upstream/v8/src/hydrogen.h +0 -1137
  417. data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +0 -430
  418. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +0 -2846
  419. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +0 -1159
  420. data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +0 -1596
  421. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +0 -6549
  422. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +0 -495
  423. data/ext/v8/upstream/v8/src/ia32/codegen-ia32-inl.h +0 -46
  424. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +0 -10385
  425. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +0 -801
  426. data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +0 -88
  427. data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +0 -312
  428. data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +0 -774
  429. data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +0 -1620
  430. data/ext/v8/upstream/v8/src/ia32/frames-ia32.cc +0 -45
  431. data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +0 -140
  432. data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +0 -4357
  433. data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +0 -1779
  434. data/ext/v8/upstream/v8/src/ia32/jump-target-ia32.cc +0 -437
  435. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +0 -4158
  436. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +0 -318
  437. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +0 -466
  438. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.h +0 -110
  439. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +0 -2181
  440. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +0 -2235
  441. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +0 -2056
  442. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +0 -807
  443. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1264
  444. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +0 -216
  445. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32-inl.h +0 -82
  446. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +0 -157
  447. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.h +0 -43
  448. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.cc +0 -30
  449. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +0 -72
  450. data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +0 -3711
  451. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +0 -1366
  452. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +0 -650
  453. data/ext/v8/upstream/v8/src/ic-inl.h +0 -130
  454. data/ext/v8/upstream/v8/src/ic.cc +0 -2389
  455. data/ext/v8/upstream/v8/src/ic.h +0 -675
  456. data/ext/v8/upstream/v8/src/inspector.cc +0 -63
  457. data/ext/v8/upstream/v8/src/inspector.h +0 -62
  458. data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +0 -659
  459. data/ext/v8/upstream/v8/src/interpreter-irregexp.h +0 -49
  460. data/ext/v8/upstream/v8/src/isolate.cc +0 -883
  461. data/ext/v8/upstream/v8/src/isolate.h +0 -1306
  462. data/ext/v8/upstream/v8/src/json.js +0 -342
  463. data/ext/v8/upstream/v8/src/jsregexp.cc +0 -5371
  464. data/ext/v8/upstream/v8/src/jsregexp.h +0 -1483
  465. data/ext/v8/upstream/v8/src/jump-target-heavy-inl.h +0 -51
  466. data/ext/v8/upstream/v8/src/jump-target-heavy.cc +0 -427
  467. data/ext/v8/upstream/v8/src/jump-target-heavy.h +0 -238
  468. data/ext/v8/upstream/v8/src/jump-target-inl.h +0 -48
  469. data/ext/v8/upstream/v8/src/jump-target-light-inl.h +0 -56
  470. data/ext/v8/upstream/v8/src/jump-target-light.cc +0 -111
  471. data/ext/v8/upstream/v8/src/jump-target-light.h +0 -193
  472. data/ext/v8/upstream/v8/src/jump-target.cc +0 -91
  473. data/ext/v8/upstream/v8/src/jump-target.h +0 -90
  474. data/ext/v8/upstream/v8/src/list-inl.h +0 -206
  475. data/ext/v8/upstream/v8/src/list.h +0 -164
  476. data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +0 -142
  477. data/ext/v8/upstream/v8/src/lithium-allocator.cc +0 -2105
  478. data/ext/v8/upstream/v8/src/lithium-allocator.h +0 -630
  479. data/ext/v8/upstream/v8/src/lithium.cc +0 -169
  480. data/ext/v8/upstream/v8/src/lithium.h +0 -592
  481. data/ext/v8/upstream/v8/src/liveedit-debugger.js +0 -1082
  482. data/ext/v8/upstream/v8/src/liveedit.cc +0 -1693
  483. data/ext/v8/upstream/v8/src/liveedit.h +0 -179
  484. data/ext/v8/upstream/v8/src/liveobjectlist-inl.h +0 -126
  485. data/ext/v8/upstream/v8/src/liveobjectlist.cc +0 -2589
  486. data/ext/v8/upstream/v8/src/liveobjectlist.h +0 -322
  487. data/ext/v8/upstream/v8/src/log-inl.h +0 -59
  488. data/ext/v8/upstream/v8/src/log-utils.cc +0 -423
  489. data/ext/v8/upstream/v8/src/log-utils.h +0 -229
  490. data/ext/v8/upstream/v8/src/log.cc +0 -1666
  491. data/ext/v8/upstream/v8/src/log.h +0 -446
  492. data/ext/v8/upstream/v8/src/macro-assembler.h +0 -120
  493. data/ext/v8/upstream/v8/src/macros.py +0 -178
  494. data/ext/v8/upstream/v8/src/mark-compact.cc +0 -3092
  495. data/ext/v8/upstream/v8/src/mark-compact.h +0 -506
  496. data/ext/v8/upstream/v8/src/math.js +0 -264
  497. data/ext/v8/upstream/v8/src/messages.cc +0 -166
  498. data/ext/v8/upstream/v8/src/messages.h +0 -114
  499. data/ext/v8/upstream/v8/src/messages.js +0 -1090
  500. data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +0 -335
  501. data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +0 -2093
  502. data/ext/v8/upstream/v8/src/mips/assembler-mips.h +0 -1066
  503. data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +0 -148
  504. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +0 -752
  505. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +0 -511
  506. data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +0 -64
  507. data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +0 -1213
  508. data/ext/v8/upstream/v8/src/mips/codegen-mips.h +0 -633
  509. data/ext/v8/upstream/v8/src/mips/constants-mips.cc +0 -352
  510. data/ext/v8/upstream/v8/src/mips/constants-mips.h +0 -723
  511. data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +0 -90
  512. data/ext/v8/upstream/v8/src/mips/debug-mips.cc +0 -155
  513. data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +0 -91
  514. data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +0 -1023
  515. data/ext/v8/upstream/v8/src/mips/frames-mips.cc +0 -48
  516. data/ext/v8/upstream/v8/src/mips/frames-mips.h +0 -179
  517. data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +0 -727
  518. data/ext/v8/upstream/v8/src/mips/ic-mips.cc +0 -244
  519. data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +0 -80
  520. data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +0 -65
  521. data/ext/v8/upstream/v8/src/mips/lithium-mips.h +0 -304
  522. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +0 -3327
  523. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +0 -1058
  524. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +0 -478
  525. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +0 -250
  526. data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +0 -134
  527. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.cc +0 -63
  528. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +0 -47
  529. data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +0 -2438
  530. data/ext/v8/upstream/v8/src/mips/simulator-mips.h +0 -394
  531. data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +0 -601
  532. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +0 -58
  533. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +0 -307
  534. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +0 -530
  535. data/ext/v8/upstream/v8/src/mirror-debugger.js +0 -2381
  536. data/ext/v8/upstream/v8/src/mksnapshot.cc +0 -256
  537. data/ext/v8/upstream/v8/src/natives.h +0 -63
  538. data/ext/v8/upstream/v8/src/objects-debug.cc +0 -722
  539. data/ext/v8/upstream/v8/src/objects-inl.h +0 -4166
  540. data/ext/v8/upstream/v8/src/objects-printer.cc +0 -801
  541. data/ext/v8/upstream/v8/src/objects-visiting.cc +0 -142
  542. data/ext/v8/upstream/v8/src/objects-visiting.h +0 -422
  543. data/ext/v8/upstream/v8/src/objects.cc +0 -10296
  544. data/ext/v8/upstream/v8/src/objects.h +0 -6662
  545. data/ext/v8/upstream/v8/src/parser.cc +0 -5168
  546. data/ext/v8/upstream/v8/src/parser.h +0 -823
  547. data/ext/v8/upstream/v8/src/platform-cygwin.cc +0 -811
  548. data/ext/v8/upstream/v8/src/platform-freebsd.cc +0 -854
  549. data/ext/v8/upstream/v8/src/platform-linux.cc +0 -1120
  550. data/ext/v8/upstream/v8/src/platform-macos.cc +0 -865
  551. data/ext/v8/upstream/v8/src/platform-nullos.cc +0 -504
  552. data/ext/v8/upstream/v8/src/platform-openbsd.cc +0 -672
  553. data/ext/v8/upstream/v8/src/platform-posix.cc +0 -424
  554. data/ext/v8/upstream/v8/src/platform-solaris.cc +0 -796
  555. data/ext/v8/upstream/v8/src/platform-tls-mac.h +0 -62
  556. data/ext/v8/upstream/v8/src/platform-tls-win32.h +0 -62
  557. data/ext/v8/upstream/v8/src/platform-tls.h +0 -50
  558. data/ext/v8/upstream/v8/src/platform-win32.cc +0 -2072
  559. data/ext/v8/upstream/v8/src/platform.h +0 -693
  560. data/ext/v8/upstream/v8/src/preparse-data.cc +0 -185
  561. data/ext/v8/upstream/v8/src/preparse-data.h +0 -249
  562. data/ext/v8/upstream/v8/src/preparser-api.cc +0 -219
  563. data/ext/v8/upstream/v8/src/preparser.cc +0 -1205
  564. data/ext/v8/upstream/v8/src/preparser.h +0 -278
  565. data/ext/v8/upstream/v8/src/prettyprinter.cc +0 -1530
  566. data/ext/v8/upstream/v8/src/prettyprinter.h +0 -223
  567. data/ext/v8/upstream/v8/src/profile-generator-inl.h +0 -128
  568. data/ext/v8/upstream/v8/src/profile-generator.cc +0 -3095
  569. data/ext/v8/upstream/v8/src/profile-generator.h +0 -1125
  570. data/ext/v8/upstream/v8/src/property.cc +0 -102
  571. data/ext/v8/upstream/v8/src/property.h +0 -348
  572. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp-inl.h +0 -78
  573. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +0 -470
  574. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.h +0 -142
  575. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.cc +0 -373
  576. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.h +0 -104
  577. data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +0 -266
  578. data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +0 -236
  579. data/ext/v8/upstream/v8/src/regexp-stack.cc +0 -111
  580. data/ext/v8/upstream/v8/src/regexp-stack.h +0 -147
  581. data/ext/v8/upstream/v8/src/regexp.js +0 -483
  582. data/ext/v8/upstream/v8/src/register-allocator-inl.h +0 -141
  583. data/ext/v8/upstream/v8/src/register-allocator.cc +0 -98
  584. data/ext/v8/upstream/v8/src/register-allocator.h +0 -310
  585. data/ext/v8/upstream/v8/src/rewriter.cc +0 -1024
  586. data/ext/v8/upstream/v8/src/rewriter.h +0 -59
  587. data/ext/v8/upstream/v8/src/runtime-profiler.cc +0 -478
  588. data/ext/v8/upstream/v8/src/runtime-profiler.h +0 -192
  589. data/ext/v8/upstream/v8/src/runtime.cc +0 -11949
  590. data/ext/v8/upstream/v8/src/runtime.h +0 -643
  591. data/ext/v8/upstream/v8/src/runtime.js +0 -643
  592. data/ext/v8/upstream/v8/src/safepoint-table.cc +0 -256
  593. data/ext/v8/upstream/v8/src/safepoint-table.h +0 -269
  594. data/ext/v8/upstream/v8/src/scanner-base.cc +0 -964
  595. data/ext/v8/upstream/v8/src/scanner-base.h +0 -664
  596. data/ext/v8/upstream/v8/src/scanner.cc +0 -584
  597. data/ext/v8/upstream/v8/src/scanner.h +0 -196
  598. data/ext/v8/upstream/v8/src/scopeinfo.cc +0 -631
  599. data/ext/v8/upstream/v8/src/scopeinfo.h +0 -249
  600. data/ext/v8/upstream/v8/src/scopes.cc +0 -1093
  601. data/ext/v8/upstream/v8/src/scopes.h +0 -508
  602. data/ext/v8/upstream/v8/src/serialize.cc +0 -1574
  603. data/ext/v8/upstream/v8/src/serialize.h +0 -589
  604. data/ext/v8/upstream/v8/src/shell.h +0 -55
  605. data/ext/v8/upstream/v8/src/simulator.h +0 -43
  606. data/ext/v8/upstream/v8/src/small-pointer-list.h +0 -163
  607. data/ext/v8/upstream/v8/src/smart-pointer.h +0 -109
  608. data/ext/v8/upstream/v8/src/snapshot-common.cc +0 -82
  609. data/ext/v8/upstream/v8/src/snapshot-empty.cc +0 -50
  610. data/ext/v8/upstream/v8/src/snapshot.h +0 -73
  611. data/ext/v8/upstream/v8/src/spaces-inl.h +0 -529
  612. data/ext/v8/upstream/v8/src/spaces.cc +0 -3147
  613. data/ext/v8/upstream/v8/src/spaces.h +0 -2368
  614. data/ext/v8/upstream/v8/src/splay-tree-inl.h +0 -310
  615. data/ext/v8/upstream/v8/src/splay-tree.h +0 -203
  616. data/ext/v8/upstream/v8/src/string-search.cc +0 -41
  617. data/ext/v8/upstream/v8/src/string-search.h +0 -568
  618. data/ext/v8/upstream/v8/src/string-stream.cc +0 -592
  619. data/ext/v8/upstream/v8/src/string-stream.h +0 -191
  620. data/ext/v8/upstream/v8/src/string.js +0 -915
  621. data/ext/v8/upstream/v8/src/strtod.cc +0 -440
  622. data/ext/v8/upstream/v8/src/strtod.h +0 -40
  623. data/ext/v8/upstream/v8/src/stub-cache.cc +0 -1940
  624. data/ext/v8/upstream/v8/src/stub-cache.h +0 -866
  625. data/ext/v8/upstream/v8/src/third_party/valgrind/valgrind.h +0 -3925
  626. data/ext/v8/upstream/v8/src/token.cc +0 -63
  627. data/ext/v8/upstream/v8/src/token.h +0 -288
  628. data/ext/v8/upstream/v8/src/top.cc +0 -983
  629. data/ext/v8/upstream/v8/src/type-info.cc +0 -472
  630. data/ext/v8/upstream/v8/src/type-info.h +0 -290
  631. data/ext/v8/upstream/v8/src/unbound-queue-inl.h +0 -95
  632. data/ext/v8/upstream/v8/src/unbound-queue.h +0 -67
  633. data/ext/v8/upstream/v8/src/unicode-inl.h +0 -238
  634. data/ext/v8/upstream/v8/src/unicode.cc +0 -1624
  635. data/ext/v8/upstream/v8/src/unicode.h +0 -280
  636. data/ext/v8/upstream/v8/src/uri.js +0 -402
  637. data/ext/v8/upstream/v8/src/utils.cc +0 -371
  638. data/ext/v8/upstream/v8/src/utils.h +0 -796
  639. data/ext/v8/upstream/v8/src/v8-counters.cc +0 -62
  640. data/ext/v8/upstream/v8/src/v8-counters.h +0 -311
  641. data/ext/v8/upstream/v8/src/v8.cc +0 -215
  642. data/ext/v8/upstream/v8/src/v8.h +0 -130
  643. data/ext/v8/upstream/v8/src/v8checks.h +0 -64
  644. data/ext/v8/upstream/v8/src/v8dll-main.cc +0 -39
  645. data/ext/v8/upstream/v8/src/v8globals.h +0 -486
  646. data/ext/v8/upstream/v8/src/v8memory.h +0 -82
  647. data/ext/v8/upstream/v8/src/v8natives.js +0 -1293
  648. data/ext/v8/upstream/v8/src/v8preparserdll-main.cc +0 -39
  649. data/ext/v8/upstream/v8/src/v8threads.cc +0 -453
  650. data/ext/v8/upstream/v8/src/v8threads.h +0 -164
  651. data/ext/v8/upstream/v8/src/v8utils.h +0 -317
  652. data/ext/v8/upstream/v8/src/variables.cc +0 -132
  653. data/ext/v8/upstream/v8/src/variables.h +0 -212
  654. data/ext/v8/upstream/v8/src/version.cc +0 -116
  655. data/ext/v8/upstream/v8/src/version.h +0 -68
  656. data/ext/v8/upstream/v8/src/virtual-frame-heavy-inl.h +0 -190
  657. data/ext/v8/upstream/v8/src/virtual-frame-heavy.cc +0 -312
  658. data/ext/v8/upstream/v8/src/virtual-frame-inl.h +0 -39
  659. data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +0 -171
  660. data/ext/v8/upstream/v8/src/virtual-frame-light.cc +0 -52
  661. data/ext/v8/upstream/v8/src/virtual-frame.cc +0 -49
  662. data/ext/v8/upstream/v8/src/virtual-frame.h +0 -59
  663. data/ext/v8/upstream/v8/src/vm-state-inl.h +0 -138
  664. data/ext/v8/upstream/v8/src/vm-state.h +0 -70
  665. data/ext/v8/upstream/v8/src/win32-headers.h +0 -96
  666. data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +0 -456
  667. data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +0 -2954
  668. data/ext/v8/upstream/v8/src/x64/assembler-x64.h +0 -1630
  669. data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +0 -1493
  670. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +0 -5132
  671. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +0 -477
  672. data/ext/v8/upstream/v8/src/x64/codegen-x64-inl.h +0 -46
  673. data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +0 -8843
  674. data/ext/v8/upstream/v8/src/x64/codegen-x64.h +0 -753
  675. data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +0 -88
  676. data/ext/v8/upstream/v8/src/x64/debug-x64.cc +0 -318
  677. data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +0 -815
  678. data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +0 -1752
  679. data/ext/v8/upstream/v8/src/x64/frames-x64.cc +0 -45
  680. data/ext/v8/upstream/v8/src/x64/frames-x64.h +0 -130
  681. data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +0 -4339
  682. data/ext/v8/upstream/v8/src/x64/ic-x64.cc +0 -1752
  683. data/ext/v8/upstream/v8/src/x64/jump-target-x64.cc +0 -437
  684. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +0 -3970
  685. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +0 -318
  686. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.cc +0 -320
  687. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.h +0 -74
  688. data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +0 -2115
  689. data/ext/v8/upstream/v8/src/x64/lithium-x64.h +0 -2161
  690. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +0 -2911
  691. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +0 -1984
  692. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +0 -1398
  693. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +0 -282
  694. data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +0 -87
  695. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +0 -95
  696. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.h +0 -43
  697. data/ext/v8/upstream/v8/src/x64/simulator-x64.cc +0 -27
  698. data/ext/v8/upstream/v8/src/x64/simulator-x64.h +0 -71
  699. data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +0 -3460
  700. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +0 -1296
  701. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +0 -597
  702. data/ext/v8/upstream/v8/src/zone-inl.h +0 -129
  703. data/ext/v8/upstream/v8/src/zone.cc +0 -196
  704. data/ext/v8/upstream/v8/src/zone.h +0 -236
  705. data/ext/v8/upstream/v8/tools/codemap.js +0 -265
  706. data/ext/v8/upstream/v8/tools/consarray.js +0 -93
  707. data/ext/v8/upstream/v8/tools/csvparser.js +0 -78
  708. data/ext/v8/upstream/v8/tools/disasm.py +0 -92
  709. data/ext/v8/upstream/v8/tools/freebsd-tick-processor +0 -10
  710. data/ext/v8/upstream/v8/tools/gc-nvp-trace-processor.py +0 -328
  711. data/ext/v8/upstream/v8/tools/generate-ten-powers.scm +0 -286
  712. data/ext/v8/upstream/v8/tools/grokdump.py +0 -840
  713. data/ext/v8/upstream/v8/tools/gyp/v8.gyp +0 -844
  714. data/ext/v8/upstream/v8/tools/js2c.py +0 -380
  715. data/ext/v8/upstream/v8/tools/jsmin.py +0 -280
  716. data/ext/v8/upstream/v8/tools/linux-tick-processor +0 -35
  717. data/ext/v8/upstream/v8/tools/ll_prof.py +0 -919
  718. data/ext/v8/upstream/v8/tools/logreader.js +0 -185
  719. data/ext/v8/upstream/v8/tools/mac-nm +0 -18
  720. data/ext/v8/upstream/v8/tools/mac-tick-processor +0 -6
  721. data/ext/v8/upstream/v8/tools/oom_dump/README +0 -31
  722. data/ext/v8/upstream/v8/tools/oom_dump/SConstruct +0 -42
  723. data/ext/v8/upstream/v8/tools/oom_dump/oom_dump.cc +0 -288
  724. data/ext/v8/upstream/v8/tools/presubmit.py +0 -305
  725. data/ext/v8/upstream/v8/tools/process-heap-prof.py +0 -120
  726. data/ext/v8/upstream/v8/tools/profile.js +0 -751
  727. data/ext/v8/upstream/v8/tools/profile_view.js +0 -219
  728. data/ext/v8/upstream/v8/tools/run-valgrind.py +0 -77
  729. data/ext/v8/upstream/v8/tools/splaytree.js +0 -316
  730. data/ext/v8/upstream/v8/tools/stats-viewer.py +0 -468
  731. data/ext/v8/upstream/v8/tools/test.py +0 -1490
  732. data/ext/v8/upstream/v8/tools/tickprocessor-driver.js +0 -59
  733. data/ext/v8/upstream/v8/tools/tickprocessor.js +0 -877
  734. data/ext/v8/upstream/v8/tools/utils.py +0 -96
  735. data/ext/v8/upstream/v8/tools/visual_studio/README.txt +0 -70
  736. data/ext/v8/upstream/v8/tools/visual_studio/arm.vsprops +0 -14
  737. data/ext/v8/upstream/v8/tools/visual_studio/common.vsprops +0 -34
  738. data/ext/v8/upstream/v8/tools/visual_studio/d8.vcproj +0 -193
  739. data/ext/v8/upstream/v8/tools/visual_studio/d8_arm.vcproj +0 -193
  740. data/ext/v8/upstream/v8/tools/visual_studio/d8_x64.vcproj +0 -209
  741. data/ext/v8/upstream/v8/tools/visual_studio/d8js2c.cmd +0 -6
  742. data/ext/v8/upstream/v8/tools/visual_studio/debug.vsprops +0 -17
  743. data/ext/v8/upstream/v8/tools/visual_studio/ia32.vsprops +0 -17
  744. data/ext/v8/upstream/v8/tools/visual_studio/js2c.cmd +0 -6
  745. data/ext/v8/upstream/v8/tools/visual_studio/release.vsprops +0 -24
  746. data/ext/v8/upstream/v8/tools/visual_studio/v8.sln +0 -101
  747. data/ext/v8/upstream/v8/tools/visual_studio/v8.vcproj +0 -227
  748. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.sln +0 -74
  749. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.vcproj +0 -227
  750. data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +0 -1308
  751. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +0 -1238
  752. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +0 -1300
  753. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest.vcproj +0 -265
  754. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_arm.vcproj +0 -249
  755. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
  756. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot.vcproj +0 -145
  757. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -145
  758. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample.vcproj +0 -145
  759. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_arm.vcproj +0 -145
  760. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_x64.vcproj +0 -161
  761. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample.vcproj +0 -147
  762. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -147
  763. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -163
  764. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot.vcproj +0 -142
  765. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
  766. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
  767. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
  768. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.sln +0 -101
  769. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.vcproj +0 -227
  770. data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +0 -18
  771. data/ext/v8/upstream/v8/tools/windows-tick-processor.bat +0 -30
@@ -1,4132 +0,0 @@
1
- // Copyright 2011 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #include "v8.h"
29
-
30
- #include "arm/lithium-codegen-arm.h"
31
- #include "arm/lithium-gap-resolver-arm.h"
32
- #include "code-stubs.h"
33
- #include "stub-cache.h"
34
-
35
- namespace v8 {
36
- namespace internal {
37
-
38
-
39
- class SafepointGenerator : public CallWrapper {
40
- public:
41
- SafepointGenerator(LCodeGen* codegen,
42
- LPointerMap* pointers,
43
- int deoptimization_index)
44
- : codegen_(codegen),
45
- pointers_(pointers),
46
- deoptimization_index_(deoptimization_index) { }
47
- virtual ~SafepointGenerator() { }
48
-
49
- virtual void BeforeCall(int call_size) {
50
- ASSERT(call_size >= 0);
51
- // Ensure that we have enough space after the previous safepoint position
52
- // for the generated code there.
53
- int call_end = codegen_->masm()->pc_offset() + call_size;
54
- int prev_jump_end =
55
- codegen_->LastSafepointEnd() + Deoptimizer::patch_size();
56
- if (call_end < prev_jump_end) {
57
- int padding_size = prev_jump_end - call_end;
58
- ASSERT_EQ(0, padding_size % Assembler::kInstrSize);
59
- while (padding_size > 0) {
60
- codegen_->masm()->nop();
61
- padding_size -= Assembler::kInstrSize;
62
- }
63
- }
64
- }
65
-
66
- virtual void AfterCall() {
67
- codegen_->RecordSafepoint(pointers_, deoptimization_index_);
68
- }
69
-
70
- private:
71
- LCodeGen* codegen_;
72
- LPointerMap* pointers_;
73
- int deoptimization_index_;
74
- };
75
-
76
-
77
- #define __ masm()->
78
-
79
- bool LCodeGen::GenerateCode() {
80
- HPhase phase("Code generation", chunk());
81
- ASSERT(is_unused());
82
- status_ = GENERATING;
83
- CpuFeatures::Scope scope1(VFP3);
84
- CpuFeatures::Scope scope2(ARMv7);
85
- return GeneratePrologue() &&
86
- GenerateBody() &&
87
- GenerateDeferredCode() &&
88
- GenerateSafepointTable();
89
- }
90
-
91
-
92
- void LCodeGen::FinishCode(Handle<Code> code) {
93
- ASSERT(is_done());
94
- code->set_stack_slots(StackSlotCount());
95
- code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
96
- PopulateDeoptimizationData(code);
97
- Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
98
- }
99
-
100
-
101
- void LCodeGen::Abort(const char* format, ...) {
102
- if (FLAG_trace_bailout) {
103
- SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
104
- PrintF("Aborting LCodeGen in @\"%s\": ", *name);
105
- va_list arguments;
106
- va_start(arguments, format);
107
- OS::VPrint(format, arguments);
108
- va_end(arguments);
109
- PrintF("\n");
110
- }
111
- status_ = ABORTED;
112
- }
113
-
114
-
115
- void LCodeGen::Comment(const char* format, ...) {
116
- if (!FLAG_code_comments) return;
117
- char buffer[4 * KB];
118
- StringBuilder builder(buffer, ARRAY_SIZE(buffer));
119
- va_list arguments;
120
- va_start(arguments, format);
121
- builder.AddFormattedList(format, arguments);
122
- va_end(arguments);
123
-
124
- // Copy the string before recording it in the assembler to avoid
125
- // issues when the stack allocated buffer goes out of scope.
126
- size_t length = builder.position();
127
- Vector<char> copy = Vector<char>::New(length + 1);
128
- memcpy(copy.start(), builder.Finalize(), copy.length());
129
- masm()->RecordComment(copy.start());
130
- }
131
-
132
-
133
- bool LCodeGen::GeneratePrologue() {
134
- ASSERT(is_generating());
135
-
136
- #ifdef DEBUG
137
- if (strlen(FLAG_stop_at) > 0 &&
138
- info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
139
- __ stop("stop_at");
140
- }
141
- #endif
142
-
143
- // r1: Callee's JS function.
144
- // cp: Callee's context.
145
- // fp: Caller's frame pointer.
146
- // lr: Caller's pc.
147
-
148
- __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
149
- __ add(fp, sp, Operand(2 * kPointerSize)); // Adjust FP to point to saved FP.
150
-
151
- // Reserve space for the stack slots needed by the code.
152
- int slots = StackSlotCount();
153
- if (slots > 0) {
154
- if (FLAG_debug_code) {
155
- __ mov(r0, Operand(slots));
156
- __ mov(r2, Operand(kSlotsZapValue));
157
- Label loop;
158
- __ bind(&loop);
159
- __ push(r2);
160
- __ sub(r0, r0, Operand(1), SetCC);
161
- __ b(ne, &loop);
162
- } else {
163
- __ sub(sp, sp, Operand(slots * kPointerSize));
164
- }
165
- }
166
-
167
- // Possibly allocate a local context.
168
- int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
169
- if (heap_slots > 0) {
170
- Comment(";;; Allocate local context");
171
- // Argument to NewContext is the function, which is in r1.
172
- __ push(r1);
173
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
174
- FastNewContextStub stub(heap_slots);
175
- __ CallStub(&stub);
176
- } else {
177
- __ CallRuntime(Runtime::kNewContext, 1);
178
- }
179
- RecordSafepoint(Safepoint::kNoDeoptimizationIndex);
180
- // Context is returned in both r0 and cp. It replaces the context
181
- // passed to us. It's saved in the stack and kept live in cp.
182
- __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
183
- // Copy any necessary parameters into the context.
184
- int num_parameters = scope()->num_parameters();
185
- for (int i = 0; i < num_parameters; i++) {
186
- Slot* slot = scope()->parameter(i)->AsSlot();
187
- if (slot != NULL && slot->type() == Slot::CONTEXT) {
188
- int parameter_offset = StandardFrameConstants::kCallerSPOffset +
189
- (num_parameters - 1 - i) * kPointerSize;
190
- // Load parameter from stack.
191
- __ ldr(r0, MemOperand(fp, parameter_offset));
192
- // Store it in the context.
193
- __ mov(r1, Operand(Context::SlotOffset(slot->index())));
194
- __ str(r0, MemOperand(cp, r1));
195
- // Update the write barrier. This clobbers all involved
196
- // registers, so we have to use two more registers to avoid
197
- // clobbering cp.
198
- __ mov(r2, Operand(cp));
199
- __ RecordWrite(r2, Operand(r1), r3, r0);
200
- }
201
- }
202
- Comment(";;; End allocate local context");
203
- }
204
-
205
- // Trace the call.
206
- if (FLAG_trace) {
207
- __ CallRuntime(Runtime::kTraceEnter, 0);
208
- }
209
- return !is_aborted();
210
- }
211
-
212
-
213
- bool LCodeGen::GenerateBody() {
214
- ASSERT(is_generating());
215
- bool emit_instructions = true;
216
- for (current_instruction_ = 0;
217
- !is_aborted() && current_instruction_ < instructions_->length();
218
- current_instruction_++) {
219
- LInstruction* instr = instructions_->at(current_instruction_);
220
- if (instr->IsLabel()) {
221
- LLabel* label = LLabel::cast(instr);
222
- emit_instructions = !label->HasReplacement();
223
- }
224
-
225
- if (emit_instructions) {
226
- Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
227
- instr->CompileToNative(this);
228
- }
229
- }
230
- return !is_aborted();
231
- }
232
-
233
-
234
- LInstruction* LCodeGen::GetNextInstruction() {
235
- if (current_instruction_ < instructions_->length() - 1) {
236
- return instructions_->at(current_instruction_ + 1);
237
- } else {
238
- return NULL;
239
- }
240
- }
241
-
242
-
243
- bool LCodeGen::GenerateDeferredCode() {
244
- ASSERT(is_generating());
245
- for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
246
- LDeferredCode* code = deferred_[i];
247
- __ bind(code->entry());
248
- code->Generate();
249
- __ jmp(code->exit());
250
- }
251
-
252
- // Force constant pool emission at the end of deferred code to make
253
- // sure that no constant pools are emitted after the official end of
254
- // the instruction sequence.
255
- masm()->CheckConstPool(true, false);
256
-
257
- // Deferred code is the last part of the instruction sequence. Mark
258
- // the generated code as done unless we bailed out.
259
- if (!is_aborted()) status_ = DONE;
260
- return !is_aborted();
261
- }
262
-
263
-
264
- bool LCodeGen::GenerateSafepointTable() {
265
- ASSERT(is_done());
266
- safepoints_.Emit(masm(), StackSlotCount());
267
- return !is_aborted();
268
- }
269
-
270
-
271
- Register LCodeGen::ToRegister(int index) const {
272
- return Register::FromAllocationIndex(index);
273
- }
274
-
275
-
276
- DoubleRegister LCodeGen::ToDoubleRegister(int index) const {
277
- return DoubleRegister::FromAllocationIndex(index);
278
- }
279
-
280
-
281
- Register LCodeGen::ToRegister(LOperand* op) const {
282
- ASSERT(op->IsRegister());
283
- return ToRegister(op->index());
284
- }
285
-
286
-
287
- Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) {
288
- if (op->IsRegister()) {
289
- return ToRegister(op->index());
290
- } else if (op->IsConstantOperand()) {
291
- __ mov(scratch, ToOperand(op));
292
- return scratch;
293
- } else if (op->IsStackSlot() || op->IsArgument()) {
294
- __ ldr(scratch, ToMemOperand(op));
295
- return scratch;
296
- }
297
- UNREACHABLE();
298
- return scratch;
299
- }
300
-
301
-
302
- DoubleRegister LCodeGen::ToDoubleRegister(LOperand* op) const {
303
- ASSERT(op->IsDoubleRegister());
304
- return ToDoubleRegister(op->index());
305
- }
306
-
307
-
308
- DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op,
309
- SwVfpRegister flt_scratch,
310
- DoubleRegister dbl_scratch) {
311
- if (op->IsDoubleRegister()) {
312
- return ToDoubleRegister(op->index());
313
- } else if (op->IsConstantOperand()) {
314
- LConstantOperand* const_op = LConstantOperand::cast(op);
315
- Handle<Object> literal = chunk_->LookupLiteral(const_op);
316
- Representation r = chunk_->LookupLiteralRepresentation(const_op);
317
- if (r.IsInteger32()) {
318
- ASSERT(literal->IsNumber());
319
- __ mov(ip, Operand(static_cast<int32_t>(literal->Number())));
320
- __ vmov(flt_scratch, ip);
321
- __ vcvt_f64_s32(dbl_scratch, flt_scratch);
322
- return dbl_scratch;
323
- } else if (r.IsDouble()) {
324
- Abort("unsupported double immediate");
325
- } else if (r.IsTagged()) {
326
- Abort("unsupported tagged immediate");
327
- }
328
- } else if (op->IsStackSlot() || op->IsArgument()) {
329
- // TODO(regis): Why is vldr not taking a MemOperand?
330
- // __ vldr(dbl_scratch, ToMemOperand(op));
331
- MemOperand mem_op = ToMemOperand(op);
332
- __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset());
333
- return dbl_scratch;
334
- }
335
- UNREACHABLE();
336
- return dbl_scratch;
337
- }
338
-
339
-
340
- int LCodeGen::ToInteger32(LConstantOperand* op) const {
341
- Handle<Object> value = chunk_->LookupLiteral(op);
342
- ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32());
343
- ASSERT(static_cast<double>(static_cast<int32_t>(value->Number())) ==
344
- value->Number());
345
- return static_cast<int32_t>(value->Number());
346
- }
347
-
348
-
349
- Operand LCodeGen::ToOperand(LOperand* op) {
350
- if (op->IsConstantOperand()) {
351
- LConstantOperand* const_op = LConstantOperand::cast(op);
352
- Handle<Object> literal = chunk_->LookupLiteral(const_op);
353
- Representation r = chunk_->LookupLiteralRepresentation(const_op);
354
- if (r.IsInteger32()) {
355
- ASSERT(literal->IsNumber());
356
- return Operand(static_cast<int32_t>(literal->Number()));
357
- } else if (r.IsDouble()) {
358
- Abort("ToOperand Unsupported double immediate.");
359
- }
360
- ASSERT(r.IsTagged());
361
- return Operand(literal);
362
- } else if (op->IsRegister()) {
363
- return Operand(ToRegister(op));
364
- } else if (op->IsDoubleRegister()) {
365
- Abort("ToOperand IsDoubleRegister unimplemented");
366
- return Operand(0);
367
- }
368
- // Stack slots not implemented, use ToMemOperand instead.
369
- UNREACHABLE();
370
- return Operand(0);
371
- }
372
-
373
-
374
- MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
375
- ASSERT(!op->IsRegister());
376
- ASSERT(!op->IsDoubleRegister());
377
- ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
378
- int index = op->index();
379
- if (index >= 0) {
380
- // Local or spill slot. Skip the frame pointer, function, and
381
- // context in the fixed part of the frame.
382
- return MemOperand(fp, -(index + 3) * kPointerSize);
383
- } else {
384
- // Incoming parameter. Skip the return address.
385
- return MemOperand(fp, -(index - 1) * kPointerSize);
386
- }
387
- }
388
-
389
-
390
- MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
391
- ASSERT(op->IsDoubleStackSlot());
392
- int index = op->index();
393
- if (index >= 0) {
394
- // Local or spill slot. Skip the frame pointer, function, context,
395
- // and the first word of the double in the fixed part of the frame.
396
- return MemOperand(fp, -(index + 3) * kPointerSize + kPointerSize);
397
- } else {
398
- // Incoming parameter. Skip the return address and the first word of
399
- // the double.
400
- return MemOperand(fp, -(index - 1) * kPointerSize + kPointerSize);
401
- }
402
- }
403
-
404
-
405
- void LCodeGen::WriteTranslation(LEnvironment* environment,
406
- Translation* translation) {
407
- if (environment == NULL) return;
408
-
409
- // The translation includes one command per value in the environment.
410
- int translation_size = environment->values()->length();
411
- // The output frame height does not include the parameters.
412
- int height = translation_size - environment->parameter_count();
413
-
414
- WriteTranslation(environment->outer(), translation);
415
- int closure_id = DefineDeoptimizationLiteral(environment->closure());
416
- translation->BeginFrame(environment->ast_id(), closure_id, height);
417
- for (int i = 0; i < translation_size; ++i) {
418
- LOperand* value = environment->values()->at(i);
419
- // spilled_registers_ and spilled_double_registers_ are either
420
- // both NULL or both set.
421
- if (environment->spilled_registers() != NULL && value != NULL) {
422
- if (value->IsRegister() &&
423
- environment->spilled_registers()[value->index()] != NULL) {
424
- translation->MarkDuplicate();
425
- AddToTranslation(translation,
426
- environment->spilled_registers()[value->index()],
427
- environment->HasTaggedValueAt(i));
428
- } else if (
429
- value->IsDoubleRegister() &&
430
- environment->spilled_double_registers()[value->index()] != NULL) {
431
- translation->MarkDuplicate();
432
- AddToTranslation(
433
- translation,
434
- environment->spilled_double_registers()[value->index()],
435
- false);
436
- }
437
- }
438
-
439
- AddToTranslation(translation, value, environment->HasTaggedValueAt(i));
440
- }
441
- }
442
-
443
-
444
- void LCodeGen::AddToTranslation(Translation* translation,
445
- LOperand* op,
446
- bool is_tagged) {
447
- if (op == NULL) {
448
- // TODO(twuerthinger): Introduce marker operands to indicate that this value
449
- // is not present and must be reconstructed from the deoptimizer. Currently
450
- // this is only used for the arguments object.
451
- translation->StoreArgumentsObject();
452
- } else if (op->IsStackSlot()) {
453
- if (is_tagged) {
454
- translation->StoreStackSlot(op->index());
455
- } else {
456
- translation->StoreInt32StackSlot(op->index());
457
- }
458
- } else if (op->IsDoubleStackSlot()) {
459
- translation->StoreDoubleStackSlot(op->index());
460
- } else if (op->IsArgument()) {
461
- ASSERT(is_tagged);
462
- int src_index = StackSlotCount() + op->index();
463
- translation->StoreStackSlot(src_index);
464
- } else if (op->IsRegister()) {
465
- Register reg = ToRegister(op);
466
- if (is_tagged) {
467
- translation->StoreRegister(reg);
468
- } else {
469
- translation->StoreInt32Register(reg);
470
- }
471
- } else if (op->IsDoubleRegister()) {
472
- DoubleRegister reg = ToDoubleRegister(op);
473
- translation->StoreDoubleRegister(reg);
474
- } else if (op->IsConstantOperand()) {
475
- Handle<Object> literal = chunk()->LookupLiteral(LConstantOperand::cast(op));
476
- int src_index = DefineDeoptimizationLiteral(literal);
477
- translation->StoreLiteral(src_index);
478
- } else {
479
- UNREACHABLE();
480
- }
481
- }
482
-
483
-
484
- void LCodeGen::CallCode(Handle<Code> code,
485
- RelocInfo::Mode mode,
486
- LInstruction* instr) {
487
- ASSERT(instr != NULL);
488
- LPointerMap* pointers = instr->pointer_map();
489
- RecordPosition(pointers->position());
490
- __ Call(code, mode);
491
- RegisterLazyDeoptimization(instr);
492
- }
493
-
494
-
495
- void LCodeGen::CallRuntime(const Runtime::Function* function,
496
- int num_arguments,
497
- LInstruction* instr) {
498
- ASSERT(instr != NULL);
499
- LPointerMap* pointers = instr->pointer_map();
500
- ASSERT(pointers != NULL);
501
- RecordPosition(pointers->position());
502
-
503
- __ CallRuntime(function, num_arguments);
504
- RegisterLazyDeoptimization(instr);
505
- }
506
-
507
-
508
- void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) {
509
- // Create the environment to bailout to. If the call has side effects
510
- // execution has to continue after the call otherwise execution can continue
511
- // from a previous bailout point repeating the call.
512
- LEnvironment* deoptimization_environment;
513
- if (instr->HasDeoptimizationEnvironment()) {
514
- deoptimization_environment = instr->deoptimization_environment();
515
- } else {
516
- deoptimization_environment = instr->environment();
517
- }
518
-
519
- RegisterEnvironmentForDeoptimization(deoptimization_environment);
520
- RecordSafepoint(instr->pointer_map(),
521
- deoptimization_environment->deoptimization_index());
522
- }
523
-
524
-
525
- void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment) {
526
- if (!environment->HasBeenRegistered()) {
527
- // Physical stack frame layout:
528
- // -x ............. -4 0 ..................................... y
529
- // [incoming arguments] [spill slots] [pushed outgoing arguments]
530
-
531
- // Layout of the environment:
532
- // 0 ..................................................... size-1
533
- // [parameters] [locals] [expression stack including arguments]
534
-
535
- // Layout of the translation:
536
- // 0 ........................................................ size - 1 + 4
537
- // [expression stack including arguments] [locals] [4 words] [parameters]
538
- // |>------------ translation_size ------------<|
539
-
540
- int frame_count = 0;
541
- for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
542
- ++frame_count;
543
- }
544
- Translation translation(&translations_, frame_count);
545
- WriteTranslation(environment, &translation);
546
- int deoptimization_index = deoptimizations_.length();
547
- environment->Register(deoptimization_index, translation.index());
548
- deoptimizations_.Add(environment);
549
- }
550
- }
551
-
552
-
553
- void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
554
- RegisterEnvironmentForDeoptimization(environment);
555
- ASSERT(environment->HasBeenRegistered());
556
- int id = environment->deoptimization_index();
557
- Address entry = Deoptimizer::GetDeoptimizationEntry(id, Deoptimizer::EAGER);
558
- ASSERT(entry != NULL);
559
- if (entry == NULL) {
560
- Abort("bailout was not prepared");
561
- return;
562
- }
563
-
564
- ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM.
565
-
566
- if (FLAG_deopt_every_n_times == 1 &&
567
- info_->shared_info()->opt_count() == id) {
568
- __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
569
- return;
570
- }
571
-
572
- if (cc == al) {
573
- if (FLAG_trap_on_deopt) __ stop("trap_on_deopt");
574
- __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
575
- } else {
576
- if (FLAG_trap_on_deopt) {
577
- Label done;
578
- __ b(&done, NegateCondition(cc));
579
- __ stop("trap_on_deopt");
580
- __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
581
- __ bind(&done);
582
- } else {
583
- __ Jump(entry, RelocInfo::RUNTIME_ENTRY, cc);
584
- }
585
- }
586
- }
587
-
588
-
589
- void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
590
- int length = deoptimizations_.length();
591
- if (length == 0) return;
592
- ASSERT(FLAG_deopt);
593
- Handle<DeoptimizationInputData> data =
594
- factory()->NewDeoptimizationInputData(length, TENURED);
595
-
596
- Handle<ByteArray> translations = translations_.CreateByteArray();
597
- data->SetTranslationByteArray(*translations);
598
- data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
599
-
600
- Handle<FixedArray> literals =
601
- factory()->NewFixedArray(deoptimization_literals_.length(), TENURED);
602
- for (int i = 0; i < deoptimization_literals_.length(); i++) {
603
- literals->set(i, *deoptimization_literals_[i]);
604
- }
605
- data->SetLiteralArray(*literals);
606
-
607
- data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id()));
608
- data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
609
-
610
- // Populate the deoptimization entries.
611
- for (int i = 0; i < length; i++) {
612
- LEnvironment* env = deoptimizations_[i];
613
- data->SetAstId(i, Smi::FromInt(env->ast_id()));
614
- data->SetTranslationIndex(i, Smi::FromInt(env->translation_index()));
615
- data->SetArgumentsStackHeight(i,
616
- Smi::FromInt(env->arguments_stack_height()));
617
- }
618
- code->set_deoptimization_data(*data);
619
- }
620
-
621
-
622
- int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
623
- int result = deoptimization_literals_.length();
624
- for (int i = 0; i < deoptimization_literals_.length(); ++i) {
625
- if (deoptimization_literals_[i].is_identical_to(literal)) return i;
626
- }
627
- deoptimization_literals_.Add(literal);
628
- return result;
629
- }
630
-
631
-
632
- void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
633
- ASSERT(deoptimization_literals_.length() == 0);
634
-
635
- const ZoneList<Handle<JSFunction> >* inlined_closures =
636
- chunk()->inlined_closures();
637
-
638
- for (int i = 0, length = inlined_closures->length();
639
- i < length;
640
- i++) {
641
- DefineDeoptimizationLiteral(inlined_closures->at(i));
642
- }
643
-
644
- inlined_function_count_ = deoptimization_literals_.length();
645
- }
646
-
647
-
648
- void LCodeGen::RecordSafepoint(
649
- LPointerMap* pointers,
650
- Safepoint::Kind kind,
651
- int arguments,
652
- int deoptimization_index) {
653
- const ZoneList<LOperand*>* operands = pointers->operands();
654
- Safepoint safepoint = safepoints_.DefineSafepoint(masm(),
655
- kind, arguments, deoptimization_index);
656
- for (int i = 0; i < operands->length(); i++) {
657
- LOperand* pointer = operands->at(i);
658
- if (pointer->IsStackSlot()) {
659
- safepoint.DefinePointerSlot(pointer->index());
660
- } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) {
661
- safepoint.DefinePointerRegister(ToRegister(pointer));
662
- }
663
- }
664
- if (kind & Safepoint::kWithRegisters) {
665
- // Register cp always contains a pointer to the context.
666
- safepoint.DefinePointerRegister(cp);
667
- }
668
- }
669
-
670
-
671
- void LCodeGen::RecordSafepoint(LPointerMap* pointers,
672
- int deoptimization_index) {
673
- RecordSafepoint(pointers, Safepoint::kSimple, 0, deoptimization_index);
674
- }
675
-
676
-
677
- void LCodeGen::RecordSafepoint(int deoptimization_index) {
678
- LPointerMap empty_pointers(RelocInfo::kNoPosition);
679
- RecordSafepoint(&empty_pointers, deoptimization_index);
680
- }
681
-
682
-
683
- void LCodeGen::RecordSafepointWithRegisters(LPointerMap* pointers,
684
- int arguments,
685
- int deoptimization_index) {
686
- RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments,
687
- deoptimization_index);
688
- }
689
-
690
-
691
- void LCodeGen::RecordSafepointWithRegistersAndDoubles(
692
- LPointerMap* pointers,
693
- int arguments,
694
- int deoptimization_index) {
695
- RecordSafepoint(pointers, Safepoint::kWithRegistersAndDoubles, arguments,
696
- deoptimization_index);
697
- }
698
-
699
-
700
- void LCodeGen::RecordPosition(int position) {
701
- if (!FLAG_debug_info || position == RelocInfo::kNoPosition) return;
702
- masm()->positions_recorder()->RecordPosition(position);
703
- }
704
-
705
-
706
- void LCodeGen::DoLabel(LLabel* label) {
707
- if (label->is_loop_header()) {
708
- Comment(";;; B%d - LOOP entry", label->block_id());
709
- } else {
710
- Comment(";;; B%d", label->block_id());
711
- }
712
- __ bind(label->label());
713
- current_block_ = label->block_id();
714
- LCodeGen::DoGap(label);
715
- }
716
-
717
-
718
- void LCodeGen::DoParallelMove(LParallelMove* move) {
719
- resolver_.Resolve(move);
720
- }
721
-
722
-
723
- void LCodeGen::DoGap(LGap* gap) {
724
- for (int i = LGap::FIRST_INNER_POSITION;
725
- i <= LGap::LAST_INNER_POSITION;
726
- i++) {
727
- LGap::InnerPosition inner_pos = static_cast<LGap::InnerPosition>(i);
728
- LParallelMove* move = gap->GetParallelMove(inner_pos);
729
- if (move != NULL) DoParallelMove(move);
730
- }
731
-
732
- LInstruction* next = GetNextInstruction();
733
- if (next != NULL && next->IsLazyBailout()) {
734
- int pc = masm()->pc_offset();
735
- safepoints_.SetPcAfterGap(pc);
736
- }
737
- }
738
-
739
-
740
- void LCodeGen::DoParameter(LParameter* instr) {
741
- // Nothing to do.
742
- }
743
-
744
-
745
- void LCodeGen::DoCallStub(LCallStub* instr) {
746
- ASSERT(ToRegister(instr->result()).is(r0));
747
- switch (instr->hydrogen()->major_key()) {
748
- case CodeStub::RegExpConstructResult: {
749
- RegExpConstructResultStub stub;
750
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
751
- break;
752
- }
753
- case CodeStub::RegExpExec: {
754
- RegExpExecStub stub;
755
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
756
- break;
757
- }
758
- case CodeStub::SubString: {
759
- SubStringStub stub;
760
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
761
- break;
762
- }
763
- case CodeStub::NumberToString: {
764
- NumberToStringStub stub;
765
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
766
- break;
767
- }
768
- case CodeStub::StringAdd: {
769
- StringAddStub stub(NO_STRING_ADD_FLAGS);
770
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
771
- break;
772
- }
773
- case CodeStub::StringCompare: {
774
- StringCompareStub stub;
775
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
776
- break;
777
- }
778
- case CodeStub::TranscendentalCache: {
779
- __ ldr(r0, MemOperand(sp, 0));
780
- TranscendentalCacheStub stub(instr->transcendental_type(),
781
- TranscendentalCacheStub::TAGGED);
782
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
783
- break;
784
- }
785
- default:
786
- UNREACHABLE();
787
- }
788
- }
789
-
790
-
791
- void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
792
- // Nothing to do.
793
- }
794
-
795
-
796
- void LCodeGen::DoModI(LModI* instr) {
797
- if (instr->hydrogen()->HasPowerOf2Divisor()) {
798
- Register dividend = ToRegister(instr->InputAt(0));
799
-
800
- int32_t divisor =
801
- HConstant::cast(instr->hydrogen()->right())->Integer32Value();
802
-
803
- if (divisor < 0) divisor = -divisor;
804
-
805
- Label positive_dividend, done;
806
- __ cmp(dividend, Operand(0));
807
- __ b(pl, &positive_dividend);
808
- __ rsb(dividend, dividend, Operand(0));
809
- __ and_(dividend, dividend, Operand(divisor - 1));
810
- __ rsb(dividend, dividend, Operand(0), SetCC);
811
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
812
- __ b(ne, &done);
813
- DeoptimizeIf(al, instr->environment());
814
- }
815
- __ bind(&positive_dividend);
816
- __ and_(dividend, dividend, Operand(divisor - 1));
817
- __ bind(&done);
818
- return;
819
- }
820
-
821
- // These registers hold untagged 32 bit values.
822
- Register left = ToRegister(instr->InputAt(0));
823
- Register right = ToRegister(instr->InputAt(1));
824
- Register result = ToRegister(instr->result());
825
-
826
- Register scratch = scratch0();
827
- Register scratch2 = ToRegister(instr->TempAt(0));
828
- DwVfpRegister dividend = ToDoubleRegister(instr->TempAt(1));
829
- DwVfpRegister divisor = ToDoubleRegister(instr->TempAt(2));
830
- DwVfpRegister quotient = double_scratch0();
831
-
832
- ASSERT(result.is(left));
833
-
834
- ASSERT(!dividend.is(divisor));
835
- ASSERT(!dividend.is(quotient));
836
- ASSERT(!divisor.is(quotient));
837
- ASSERT(!scratch.is(left));
838
- ASSERT(!scratch.is(right));
839
- ASSERT(!scratch.is(result));
840
-
841
- Label done, vfp_modulo, both_positive, right_negative;
842
-
843
- // Check for x % 0.
844
- if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
845
- __ cmp(right, Operand(0));
846
- DeoptimizeIf(eq, instr->environment());
847
- }
848
-
849
- // (0 % x) must yield 0 (if x is finite, which is the case here).
850
- __ cmp(left, Operand(0));
851
- __ b(eq, &done);
852
- // Preload right in a vfp register.
853
- __ vmov(divisor.low(), right);
854
- __ b(lt, &vfp_modulo);
855
-
856
- __ cmp(left, Operand(right));
857
- __ b(lt, &done);
858
-
859
- // Check for (positive) power of two on the right hand side.
860
- __ JumpIfNotPowerOfTwoOrZeroAndNeg(right,
861
- scratch,
862
- &right_negative,
863
- &both_positive);
864
- // Perform modulo operation (scratch contains right - 1).
865
- __ and_(result, scratch, Operand(left));
866
- __ b(&done);
867
-
868
- __ bind(&right_negative);
869
- // Negate right. The sign of the divisor does not matter.
870
- __ rsb(right, right, Operand(0));
871
-
872
- __ bind(&both_positive);
873
- const int kUnfolds = 3;
874
- // If the right hand side is smaller than the (nonnegative)
875
- // left hand side, the left hand side is the result.
876
- // Else try a few subtractions of the left hand side.
877
- __ mov(scratch, left);
878
- for (int i = 0; i < kUnfolds; i++) {
879
- // Check if the left hand side is less or equal than the
880
- // the right hand side.
881
- __ cmp(scratch, Operand(right));
882
- __ mov(result, scratch, LeaveCC, lt);
883
- __ b(lt, &done);
884
- // If not, reduce the left hand side by the right hand
885
- // side and check again.
886
- if (i < kUnfolds - 1) __ sub(scratch, scratch, right);
887
- }
888
-
889
- __ bind(&vfp_modulo);
890
- // Load the arguments in VFP registers.
891
- // The divisor value is preloaded before. Be careful that 'right' is only live
892
- // on entry.
893
- __ vmov(dividend.low(), left);
894
- // From here on don't use right as it may have been reallocated (for example
895
- // to scratch2).
896
- right = no_reg;
897
-
898
- __ vcvt_f64_s32(dividend, dividend.low());
899
- __ vcvt_f64_s32(divisor, divisor.low());
900
-
901
- // We do not care about the sign of the divisor.
902
- __ vabs(divisor, divisor);
903
- // Compute the quotient and round it to a 32bit integer.
904
- __ vdiv(quotient, dividend, divisor);
905
- __ vcvt_s32_f64(quotient.low(), quotient);
906
- __ vcvt_f64_s32(quotient, quotient.low());
907
-
908
- // Compute the remainder in result.
909
- DwVfpRegister double_scratch = dividend;
910
- __ vmul(double_scratch, divisor, quotient);
911
- __ vcvt_s32_f64(double_scratch.low(), double_scratch);
912
- __ vmov(scratch, double_scratch.low());
913
-
914
- if (!instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
915
- __ sub(result, left, scratch);
916
- } else {
917
- Label ok;
918
- // Check for -0.
919
- __ sub(scratch2, left, scratch, SetCC);
920
- __ b(ne, &ok);
921
- __ cmp(left, Operand(0));
922
- DeoptimizeIf(mi, instr->environment());
923
- __ bind(&ok);
924
- // Load the result and we are done.
925
- __ mov(result, scratch2);
926
- }
927
-
928
- __ bind(&done);
929
- }
930
-
931
-
932
- void LCodeGen::DoDivI(LDivI* instr) {
933
- class DeferredDivI: public LDeferredCode {
934
- public:
935
- DeferredDivI(LCodeGen* codegen, LDivI* instr)
936
- : LDeferredCode(codegen), instr_(instr) { }
937
- virtual void Generate() {
938
- codegen()->DoDeferredBinaryOpStub(instr_, Token::DIV);
939
- }
940
- private:
941
- LDivI* instr_;
942
- };
943
-
944
- const Register left = ToRegister(instr->InputAt(0));
945
- const Register right = ToRegister(instr->InputAt(1));
946
- const Register scratch = scratch0();
947
- const Register result = ToRegister(instr->result());
948
-
949
- // Check for x / 0.
950
- if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
951
- __ cmp(right, Operand(0));
952
- DeoptimizeIf(eq, instr->environment());
953
- }
954
-
955
- // Check for (0 / -x) that will produce negative zero.
956
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
957
- Label left_not_zero;
958
- __ cmp(left, Operand(0));
959
- __ b(ne, &left_not_zero);
960
- __ cmp(right, Operand(0));
961
- DeoptimizeIf(mi, instr->environment());
962
- __ bind(&left_not_zero);
963
- }
964
-
965
- // Check for (-kMinInt / -1).
966
- if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
967
- Label left_not_min_int;
968
- __ cmp(left, Operand(kMinInt));
969
- __ b(ne, &left_not_min_int);
970
- __ cmp(right, Operand(-1));
971
- DeoptimizeIf(eq, instr->environment());
972
- __ bind(&left_not_min_int);
973
- }
974
-
975
- Label done, deoptimize;
976
- // Test for a few common cases first.
977
- __ cmp(right, Operand(1));
978
- __ mov(result, left, LeaveCC, eq);
979
- __ b(eq, &done);
980
-
981
- __ cmp(right, Operand(2));
982
- __ tst(left, Operand(1), eq);
983
- __ mov(result, Operand(left, ASR, 1), LeaveCC, eq);
984
- __ b(eq, &done);
985
-
986
- __ cmp(right, Operand(4));
987
- __ tst(left, Operand(3), eq);
988
- __ mov(result, Operand(left, ASR, 2), LeaveCC, eq);
989
- __ b(eq, &done);
990
-
991
- // Call the stub. The numbers in r0 and r1 have
992
- // to be tagged to Smis. If that is not possible, deoptimize.
993
- DeferredDivI* deferred = new DeferredDivI(this, instr);
994
-
995
- __ TrySmiTag(left, &deoptimize, scratch);
996
- __ TrySmiTag(right, &deoptimize, scratch);
997
-
998
- __ b(al, deferred->entry());
999
- __ bind(deferred->exit());
1000
-
1001
- // If the result in r0 is a Smi, untag it, else deoptimize.
1002
- __ JumpIfNotSmi(result, &deoptimize);
1003
- __ SmiUntag(result);
1004
- __ b(&done);
1005
-
1006
- __ bind(&deoptimize);
1007
- DeoptimizeIf(al, instr->environment());
1008
- __ bind(&done);
1009
- }
1010
-
1011
-
1012
- template<int T>
1013
- void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
1014
- Token::Value op) {
1015
- Register left = ToRegister(instr->InputAt(0));
1016
- Register right = ToRegister(instr->InputAt(1));
1017
-
1018
- __ PushSafepointRegistersAndDoubles();
1019
- // Move left to r1 and right to r0 for the stub call.
1020
- if (left.is(r1)) {
1021
- __ Move(r0, right);
1022
- } else if (left.is(r0) && right.is(r1)) {
1023
- __ Swap(r0, r1, r2);
1024
- } else if (left.is(r0)) {
1025
- ASSERT(!right.is(r1));
1026
- __ mov(r1, r0);
1027
- __ mov(r0, right);
1028
- } else {
1029
- ASSERT(!left.is(r0) && !right.is(r0));
1030
- __ mov(r0, right);
1031
- __ mov(r1, left);
1032
- }
1033
- TypeRecordingBinaryOpStub stub(op, OVERWRITE_LEFT);
1034
- __ CallStub(&stub);
1035
- RecordSafepointWithRegistersAndDoubles(instr->pointer_map(),
1036
- 0,
1037
- Safepoint::kNoDeoptimizationIndex);
1038
- // Overwrite the stored value of r0 with the result of the stub.
1039
- __ StoreToSafepointRegistersAndDoublesSlot(r0, r0);
1040
- __ PopSafepointRegistersAndDoubles();
1041
- }
1042
-
1043
-
1044
- void LCodeGen::DoMulI(LMulI* instr) {
1045
- Register scratch = scratch0();
1046
- Register left = ToRegister(instr->InputAt(0));
1047
- Register right = EmitLoadRegister(instr->InputAt(1), scratch);
1048
-
1049
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero) &&
1050
- !instr->InputAt(1)->IsConstantOperand()) {
1051
- __ orr(ToRegister(instr->TempAt(0)), left, right);
1052
- }
1053
-
1054
- if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1055
- // scratch:left = left * right.
1056
- __ smull(left, scratch, left, right);
1057
- __ mov(ip, Operand(left, ASR, 31));
1058
- __ cmp(ip, Operand(scratch));
1059
- DeoptimizeIf(ne, instr->environment());
1060
- } else {
1061
- __ mul(left, left, right);
1062
- }
1063
-
1064
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1065
- // Bail out if the result is supposed to be negative zero.
1066
- Label done;
1067
- __ cmp(left, Operand(0));
1068
- __ b(ne, &done);
1069
- if (instr->InputAt(1)->IsConstantOperand()) {
1070
- if (ToInteger32(LConstantOperand::cast(instr->InputAt(1))) <= 0) {
1071
- DeoptimizeIf(al, instr->environment());
1072
- }
1073
- } else {
1074
- // Test the non-zero operand for negative sign.
1075
- __ cmp(ToRegister(instr->TempAt(0)), Operand(0));
1076
- DeoptimizeIf(mi, instr->environment());
1077
- }
1078
- __ bind(&done);
1079
- }
1080
- }
1081
-
1082
-
1083
- void LCodeGen::DoBitI(LBitI* instr) {
1084
- LOperand* left = instr->InputAt(0);
1085
- LOperand* right = instr->InputAt(1);
1086
- ASSERT(left->Equals(instr->result()));
1087
- ASSERT(left->IsRegister());
1088
- Register result = ToRegister(left);
1089
- Operand right_operand(no_reg);
1090
-
1091
- if (right->IsStackSlot() || right->IsArgument()) {
1092
- Register right_reg = EmitLoadRegister(right, ip);
1093
- right_operand = Operand(right_reg);
1094
- } else {
1095
- ASSERT(right->IsRegister() || right->IsConstantOperand());
1096
- right_operand = ToOperand(right);
1097
- }
1098
-
1099
- switch (instr->op()) {
1100
- case Token::BIT_AND:
1101
- __ and_(result, ToRegister(left), right_operand);
1102
- break;
1103
- case Token::BIT_OR:
1104
- __ orr(result, ToRegister(left), right_operand);
1105
- break;
1106
- case Token::BIT_XOR:
1107
- __ eor(result, ToRegister(left), right_operand);
1108
- break;
1109
- default:
1110
- UNREACHABLE();
1111
- break;
1112
- }
1113
- }
1114
-
1115
-
1116
- void LCodeGen::DoShiftI(LShiftI* instr) {
1117
- Register scratch = scratch0();
1118
- LOperand* left = instr->InputAt(0);
1119
- LOperand* right = instr->InputAt(1);
1120
- ASSERT(left->Equals(instr->result()));
1121
- ASSERT(left->IsRegister());
1122
- Register result = ToRegister(left);
1123
- if (right->IsRegister()) {
1124
- // Mask the right operand.
1125
- __ and_(scratch, ToRegister(right), Operand(0x1F));
1126
- switch (instr->op()) {
1127
- case Token::SAR:
1128
- __ mov(result, Operand(result, ASR, scratch));
1129
- break;
1130
- case Token::SHR:
1131
- if (instr->can_deopt()) {
1132
- __ mov(result, Operand(result, LSR, scratch), SetCC);
1133
- DeoptimizeIf(mi, instr->environment());
1134
- } else {
1135
- __ mov(result, Operand(result, LSR, scratch));
1136
- }
1137
- break;
1138
- case Token::SHL:
1139
- __ mov(result, Operand(result, LSL, scratch));
1140
- break;
1141
- default:
1142
- UNREACHABLE();
1143
- break;
1144
- }
1145
- } else {
1146
- int value = ToInteger32(LConstantOperand::cast(right));
1147
- uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1148
- switch (instr->op()) {
1149
- case Token::SAR:
1150
- if (shift_count != 0) {
1151
- __ mov(result, Operand(result, ASR, shift_count));
1152
- }
1153
- break;
1154
- case Token::SHR:
1155
- if (shift_count == 0 && instr->can_deopt()) {
1156
- __ tst(result, Operand(0x80000000));
1157
- DeoptimizeIf(ne, instr->environment());
1158
- } else {
1159
- __ mov(result, Operand(result, LSR, shift_count));
1160
- }
1161
- break;
1162
- case Token::SHL:
1163
- if (shift_count != 0) {
1164
- __ mov(result, Operand(result, LSL, shift_count));
1165
- }
1166
- break;
1167
- default:
1168
- UNREACHABLE();
1169
- break;
1170
- }
1171
- }
1172
- }
1173
-
1174
-
1175
- void LCodeGen::DoSubI(LSubI* instr) {
1176
- LOperand* left = instr->InputAt(0);
1177
- LOperand* right = instr->InputAt(1);
1178
- ASSERT(left->Equals(instr->result()));
1179
- bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1180
- SBit set_cond = can_overflow ? SetCC : LeaveCC;
1181
-
1182
- if (right->IsStackSlot() || right->IsArgument()) {
1183
- Register right_reg = EmitLoadRegister(right, ip);
1184
- __ sub(ToRegister(left), ToRegister(left), Operand(right_reg), set_cond);
1185
- } else {
1186
- ASSERT(right->IsRegister() || right->IsConstantOperand());
1187
- __ sub(ToRegister(left), ToRegister(left), ToOperand(right), set_cond);
1188
- }
1189
-
1190
- if (can_overflow) {
1191
- DeoptimizeIf(vs, instr->environment());
1192
- }
1193
- }
1194
-
1195
-
1196
- void LCodeGen::DoConstantI(LConstantI* instr) {
1197
- ASSERT(instr->result()->IsRegister());
1198
- __ mov(ToRegister(instr->result()), Operand(instr->value()));
1199
- }
1200
-
1201
-
1202
- void LCodeGen::DoConstantD(LConstantD* instr) {
1203
- ASSERT(instr->result()->IsDoubleRegister());
1204
- DwVfpRegister result = ToDoubleRegister(instr->result());
1205
- double v = instr->value();
1206
- __ vmov(result, v);
1207
- }
1208
-
1209
-
1210
- void LCodeGen::DoConstantT(LConstantT* instr) {
1211
- ASSERT(instr->result()->IsRegister());
1212
- __ mov(ToRegister(instr->result()), Operand(instr->value()));
1213
- }
1214
-
1215
-
1216
- void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1217
- Register result = ToRegister(instr->result());
1218
- Register array = ToRegister(instr->InputAt(0));
1219
- __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset));
1220
- }
1221
-
1222
-
1223
- void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1224
- Register result = ToRegister(instr->result());
1225
- Register array = ToRegister(instr->InputAt(0));
1226
- __ ldr(result, FieldMemOperand(array, ExternalArray::kLengthOffset));
1227
- }
1228
-
1229
-
1230
- void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1231
- Register result = ToRegister(instr->result());
1232
- Register array = ToRegister(instr->InputAt(0));
1233
- __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset));
1234
- }
1235
-
1236
-
1237
- void LCodeGen::DoValueOf(LValueOf* instr) {
1238
- Register input = ToRegister(instr->InputAt(0));
1239
- Register result = ToRegister(instr->result());
1240
- Register map = ToRegister(instr->TempAt(0));
1241
- ASSERT(input.is(result));
1242
- Label done;
1243
-
1244
- // If the object is a smi return the object.
1245
- __ tst(input, Operand(kSmiTagMask));
1246
- __ b(eq, &done);
1247
-
1248
- // If the object is not a value type, return the object.
1249
- __ CompareObjectType(input, map, map, JS_VALUE_TYPE);
1250
- __ b(ne, &done);
1251
- __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset));
1252
-
1253
- __ bind(&done);
1254
- }
1255
-
1256
-
1257
- void LCodeGen::DoBitNotI(LBitNotI* instr) {
1258
- LOperand* input = instr->InputAt(0);
1259
- ASSERT(input->Equals(instr->result()));
1260
- __ mvn(ToRegister(input), Operand(ToRegister(input)));
1261
- }
1262
-
1263
-
1264
- void LCodeGen::DoThrow(LThrow* instr) {
1265
- Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1266
- __ push(input_reg);
1267
- CallRuntime(Runtime::kThrow, 1, instr);
1268
-
1269
- if (FLAG_debug_code) {
1270
- __ stop("Unreachable code.");
1271
- }
1272
- }
1273
-
1274
-
1275
- void LCodeGen::DoAddI(LAddI* instr) {
1276
- LOperand* left = instr->InputAt(0);
1277
- LOperand* right = instr->InputAt(1);
1278
- ASSERT(left->Equals(instr->result()));
1279
- bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1280
- SBit set_cond = can_overflow ? SetCC : LeaveCC;
1281
-
1282
- if (right->IsStackSlot() || right->IsArgument()) {
1283
- Register right_reg = EmitLoadRegister(right, ip);
1284
- __ add(ToRegister(left), ToRegister(left), Operand(right_reg), set_cond);
1285
- } else {
1286
- ASSERT(right->IsRegister() || right->IsConstantOperand());
1287
- __ add(ToRegister(left), ToRegister(left), ToOperand(right), set_cond);
1288
- }
1289
-
1290
- if (can_overflow) {
1291
- DeoptimizeIf(vs, instr->environment());
1292
- }
1293
- }
1294
-
1295
-
1296
- void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1297
- DoubleRegister left = ToDoubleRegister(instr->InputAt(0));
1298
- DoubleRegister right = ToDoubleRegister(instr->InputAt(1));
1299
- switch (instr->op()) {
1300
- case Token::ADD:
1301
- __ vadd(left, left, right);
1302
- break;
1303
- case Token::SUB:
1304
- __ vsub(left, left, right);
1305
- break;
1306
- case Token::MUL:
1307
- __ vmul(left, left, right);
1308
- break;
1309
- case Token::DIV:
1310
- __ vdiv(left, left, right);
1311
- break;
1312
- case Token::MOD: {
1313
- // Save r0-r3 on the stack.
1314
- __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1315
-
1316
- __ PrepareCallCFunction(4, scratch0());
1317
- __ vmov(r0, r1, left);
1318
- __ vmov(r2, r3, right);
1319
- __ CallCFunction(
1320
- ExternalReference::double_fp_operation(Token::MOD, isolate()), 4);
1321
- // Move the result in the double result register.
1322
- __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result()));
1323
-
1324
- // Restore r0-r3.
1325
- __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1326
- break;
1327
- }
1328
- default:
1329
- UNREACHABLE();
1330
- break;
1331
- }
1332
- }
1333
-
1334
-
1335
- void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1336
- ASSERT(ToRegister(instr->InputAt(0)).is(r1));
1337
- ASSERT(ToRegister(instr->InputAt(1)).is(r0));
1338
- ASSERT(ToRegister(instr->result()).is(r0));
1339
-
1340
- TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
1341
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1342
- }
1343
-
1344
-
1345
- int LCodeGen::GetNextEmittedBlock(int block) {
1346
- for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
1347
- LLabel* label = chunk_->GetLabel(i);
1348
- if (!label->HasReplacement()) return i;
1349
- }
1350
- return -1;
1351
- }
1352
-
1353
-
1354
- void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
1355
- int next_block = GetNextEmittedBlock(current_block_);
1356
- right_block = chunk_->LookupDestination(right_block);
1357
- left_block = chunk_->LookupDestination(left_block);
1358
-
1359
- if (right_block == left_block) {
1360
- EmitGoto(left_block);
1361
- } else if (left_block == next_block) {
1362
- __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
1363
- } else if (right_block == next_block) {
1364
- __ b(cc, chunk_->GetAssemblyLabel(left_block));
1365
- } else {
1366
- __ b(cc, chunk_->GetAssemblyLabel(left_block));
1367
- __ b(chunk_->GetAssemblyLabel(right_block));
1368
- }
1369
- }
1370
-
1371
-
1372
- void LCodeGen::DoBranch(LBranch* instr) {
1373
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1374
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1375
-
1376
- Representation r = instr->hydrogen()->representation();
1377
- if (r.IsInteger32()) {
1378
- Register reg = ToRegister(instr->InputAt(0));
1379
- __ cmp(reg, Operand(0));
1380
- EmitBranch(true_block, false_block, ne);
1381
- } else if (r.IsDouble()) {
1382
- DoubleRegister reg = ToDoubleRegister(instr->InputAt(0));
1383
- Register scratch = scratch0();
1384
-
1385
- // Test the double value. Zero and NaN are false.
1386
- __ VFPCompareAndLoadFlags(reg, 0.0, scratch);
1387
- __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit));
1388
- EmitBranch(true_block, false_block, ne);
1389
- } else {
1390
- ASSERT(r.IsTagged());
1391
- Register reg = ToRegister(instr->InputAt(0));
1392
- if (instr->hydrogen()->type().IsBoolean()) {
1393
- __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1394
- __ cmp(reg, ip);
1395
- EmitBranch(true_block, false_block, eq);
1396
- } else {
1397
- Label* true_label = chunk_->GetAssemblyLabel(true_block);
1398
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
1399
-
1400
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1401
- __ cmp(reg, ip);
1402
- __ b(eq, false_label);
1403
- __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1404
- __ cmp(reg, ip);
1405
- __ b(eq, true_label);
1406
- __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1407
- __ cmp(reg, ip);
1408
- __ b(eq, false_label);
1409
- __ cmp(reg, Operand(0));
1410
- __ b(eq, false_label);
1411
- __ tst(reg, Operand(kSmiTagMask));
1412
- __ b(eq, true_label);
1413
-
1414
- // Test double values. Zero and NaN are false.
1415
- Label call_stub;
1416
- DoubleRegister dbl_scratch = d0;
1417
- Register scratch = scratch0();
1418
- __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1419
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
1420
- __ cmp(scratch, Operand(ip));
1421
- __ b(ne, &call_stub);
1422
- __ sub(ip, reg, Operand(kHeapObjectTag));
1423
- __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset);
1424
- __ VFPCompareAndLoadFlags(dbl_scratch, 0.0, scratch);
1425
- __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit));
1426
- __ b(ne, false_label);
1427
- __ b(true_label);
1428
-
1429
- // The conversion stub doesn't cause garbage collections so it's
1430
- // safe to not record a safepoint after the call.
1431
- __ bind(&call_stub);
1432
- ToBooleanStub stub(reg);
1433
- RegList saved_regs = kJSCallerSaved | kCalleeSaved;
1434
- __ stm(db_w, sp, saved_regs);
1435
- __ CallStub(&stub);
1436
- __ cmp(reg, Operand(0));
1437
- __ ldm(ia_w, sp, saved_regs);
1438
- EmitBranch(true_block, false_block, ne);
1439
- }
1440
- }
1441
- }
1442
-
1443
-
1444
- void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) {
1445
- block = chunk_->LookupDestination(block);
1446
- int next_block = GetNextEmittedBlock(current_block_);
1447
- if (block != next_block) {
1448
- // Perform stack overflow check if this goto needs it before jumping.
1449
- if (deferred_stack_check != NULL) {
1450
- __ LoadRoot(ip, Heap::kStackLimitRootIndex);
1451
- __ cmp(sp, Operand(ip));
1452
- __ b(hs, chunk_->GetAssemblyLabel(block));
1453
- __ jmp(deferred_stack_check->entry());
1454
- deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block));
1455
- } else {
1456
- __ jmp(chunk_->GetAssemblyLabel(block));
1457
- }
1458
- }
1459
- }
1460
-
1461
-
1462
- void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
1463
- __ PushSafepointRegisters();
1464
- __ CallRuntimeSaveDoubles(Runtime::kStackGuard);
1465
- RecordSafepointWithRegisters(
1466
- instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
1467
- __ PopSafepointRegisters();
1468
- }
1469
-
1470
-
1471
- void LCodeGen::DoGoto(LGoto* instr) {
1472
- class DeferredStackCheck: public LDeferredCode {
1473
- public:
1474
- DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
1475
- : LDeferredCode(codegen), instr_(instr) { }
1476
- virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
1477
- private:
1478
- LGoto* instr_;
1479
- };
1480
-
1481
- DeferredStackCheck* deferred = NULL;
1482
- if (instr->include_stack_check()) {
1483
- deferred = new DeferredStackCheck(this, instr);
1484
- }
1485
- EmitGoto(instr->block_id(), deferred);
1486
- }
1487
-
1488
-
1489
- Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
1490
- Condition cond = kNoCondition;
1491
- switch (op) {
1492
- case Token::EQ:
1493
- case Token::EQ_STRICT:
1494
- cond = eq;
1495
- break;
1496
- case Token::LT:
1497
- cond = is_unsigned ? lo : lt;
1498
- break;
1499
- case Token::GT:
1500
- cond = is_unsigned ? hi : gt;
1501
- break;
1502
- case Token::LTE:
1503
- cond = is_unsigned ? ls : le;
1504
- break;
1505
- case Token::GTE:
1506
- cond = is_unsigned ? hs : ge;
1507
- break;
1508
- case Token::IN:
1509
- case Token::INSTANCEOF:
1510
- default:
1511
- UNREACHABLE();
1512
- }
1513
- return cond;
1514
- }
1515
-
1516
-
1517
- void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) {
1518
- __ cmp(ToRegister(left), ToRegister(right));
1519
- }
1520
-
1521
-
1522
- void LCodeGen::DoCmpID(LCmpID* instr) {
1523
- LOperand* left = instr->InputAt(0);
1524
- LOperand* right = instr->InputAt(1);
1525
- LOperand* result = instr->result();
1526
- Register scratch = scratch0();
1527
-
1528
- Label unordered, done;
1529
- if (instr->is_double()) {
1530
- // Compare left and right as doubles and load the
1531
- // resulting flags into the normal status register.
1532
- __ VFPCompareAndSetFlags(ToDoubleRegister(left), ToDoubleRegister(right));
1533
- // If a NaN is involved, i.e. the result is unordered (V set),
1534
- // jump to unordered to return false.
1535
- __ b(vs, &unordered);
1536
- } else {
1537
- EmitCmpI(left, right);
1538
- }
1539
-
1540
- Condition cc = TokenToCondition(instr->op(), instr->is_double());
1541
- __ LoadRoot(ToRegister(result), Heap::kTrueValueRootIndex);
1542
- __ b(cc, &done);
1543
-
1544
- __ bind(&unordered);
1545
- __ LoadRoot(ToRegister(result), Heap::kFalseValueRootIndex);
1546
- __ bind(&done);
1547
- }
1548
-
1549
-
1550
- void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1551
- LOperand* left = instr->InputAt(0);
1552
- LOperand* right = instr->InputAt(1);
1553
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1554
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1555
-
1556
- if (instr->is_double()) {
1557
- // Compare left and right as doubles and load the
1558
- // resulting flags into the normal status register.
1559
- __ VFPCompareAndSetFlags(ToDoubleRegister(left), ToDoubleRegister(right));
1560
- // If a NaN is involved, i.e. the result is unordered (V set),
1561
- // jump to false block label.
1562
- __ b(vs, chunk_->GetAssemblyLabel(false_block));
1563
- } else {
1564
- EmitCmpI(left, right);
1565
- }
1566
-
1567
- Condition cc = TokenToCondition(instr->op(), instr->is_double());
1568
- EmitBranch(true_block, false_block, cc);
1569
- }
1570
-
1571
-
1572
- void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
1573
- Register left = ToRegister(instr->InputAt(0));
1574
- Register right = ToRegister(instr->InputAt(1));
1575
- Register result = ToRegister(instr->result());
1576
-
1577
- __ cmp(left, Operand(right));
1578
- __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1579
- __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1580
- }
1581
-
1582
-
1583
- void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
1584
- Register left = ToRegister(instr->InputAt(0));
1585
- Register right = ToRegister(instr->InputAt(1));
1586
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1587
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1588
-
1589
- __ cmp(left, Operand(right));
1590
- EmitBranch(true_block, false_block, eq);
1591
- }
1592
-
1593
-
1594
- void LCodeGen::DoIsNull(LIsNull* instr) {
1595
- Register reg = ToRegister(instr->InputAt(0));
1596
- Register result = ToRegister(instr->result());
1597
-
1598
- __ LoadRoot(ip, Heap::kNullValueRootIndex);
1599
- __ cmp(reg, ip);
1600
- if (instr->is_strict()) {
1601
- __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1602
- __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1603
- } else {
1604
- Label true_value, false_value, done;
1605
- __ b(eq, &true_value);
1606
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1607
- __ cmp(ip, reg);
1608
- __ b(eq, &true_value);
1609
- __ tst(reg, Operand(kSmiTagMask));
1610
- __ b(eq, &false_value);
1611
- // Check for undetectable objects by looking in the bit field in
1612
- // the map. The object has already been smi checked.
1613
- Register scratch = result;
1614
- __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1615
- __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
1616
- __ tst(scratch, Operand(1 << Map::kIsUndetectable));
1617
- __ b(ne, &true_value);
1618
- __ bind(&false_value);
1619
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
1620
- __ jmp(&done);
1621
- __ bind(&true_value);
1622
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
1623
- __ bind(&done);
1624
- }
1625
- }
1626
-
1627
-
1628
- void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) {
1629
- Register scratch = scratch0();
1630
- Register reg = ToRegister(instr->InputAt(0));
1631
-
1632
- // TODO(fsc): If the expression is known to be a smi, then it's
1633
- // definitely not null. Jump to the false block.
1634
-
1635
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1636
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1637
-
1638
- __ LoadRoot(ip, Heap::kNullValueRootIndex);
1639
- __ cmp(reg, ip);
1640
- if (instr->is_strict()) {
1641
- EmitBranch(true_block, false_block, eq);
1642
- } else {
1643
- Label* true_label = chunk_->GetAssemblyLabel(true_block);
1644
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
1645
- __ b(eq, true_label);
1646
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1647
- __ cmp(reg, ip);
1648
- __ b(eq, true_label);
1649
- __ tst(reg, Operand(kSmiTagMask));
1650
- __ b(eq, false_label);
1651
- // Check for undetectable objects by looking in the bit field in
1652
- // the map. The object has already been smi checked.
1653
- __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1654
- __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
1655
- __ tst(scratch, Operand(1 << Map::kIsUndetectable));
1656
- EmitBranch(true_block, false_block, ne);
1657
- }
1658
- }
1659
-
1660
-
1661
- Condition LCodeGen::EmitIsObject(Register input,
1662
- Register temp1,
1663
- Register temp2,
1664
- Label* is_not_object,
1665
- Label* is_object) {
1666
- __ JumpIfSmi(input, is_not_object);
1667
-
1668
- __ LoadRoot(temp1, Heap::kNullValueRootIndex);
1669
- __ cmp(input, temp1);
1670
- __ b(eq, is_object);
1671
-
1672
- // Load map.
1673
- __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
1674
- // Undetectable objects behave like undefined.
1675
- __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset));
1676
- __ tst(temp2, Operand(1 << Map::kIsUndetectable));
1677
- __ b(ne, is_not_object);
1678
-
1679
- // Load instance type and check that it is in object type range.
1680
- __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset));
1681
- __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE));
1682
- __ b(lt, is_not_object);
1683
- __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE));
1684
- return le;
1685
- }
1686
-
1687
-
1688
- void LCodeGen::DoIsObject(LIsObject* instr) {
1689
- Register reg = ToRegister(instr->InputAt(0));
1690
- Register result = ToRegister(instr->result());
1691
- Register temp = scratch0();
1692
- Label is_false, is_true, done;
1693
-
1694
- Condition true_cond = EmitIsObject(reg, result, temp, &is_false, &is_true);
1695
- __ b(true_cond, &is_true);
1696
-
1697
- __ bind(&is_false);
1698
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
1699
- __ b(&done);
1700
-
1701
- __ bind(&is_true);
1702
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
1703
-
1704
- __ bind(&done);
1705
- }
1706
-
1707
-
1708
- void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1709
- Register reg = ToRegister(instr->InputAt(0));
1710
- Register temp1 = ToRegister(instr->TempAt(0));
1711
- Register temp2 = scratch0();
1712
-
1713
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1714
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1715
- Label* true_label = chunk_->GetAssemblyLabel(true_block);
1716
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
1717
-
1718
- Condition true_cond =
1719
- EmitIsObject(reg, temp1, temp2, false_label, true_label);
1720
-
1721
- EmitBranch(true_block, false_block, true_cond);
1722
- }
1723
-
1724
-
1725
- void LCodeGen::DoIsSmi(LIsSmi* instr) {
1726
- ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1727
- Register result = ToRegister(instr->result());
1728
- Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1729
- __ tst(input_reg, Operand(kSmiTagMask));
1730
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
1731
- Label done;
1732
- __ b(eq, &done);
1733
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
1734
- __ bind(&done);
1735
- }
1736
-
1737
-
1738
- void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1739
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1740
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1741
-
1742
- Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1743
- __ tst(input_reg, Operand(kSmiTagMask));
1744
- EmitBranch(true_block, false_block, eq);
1745
- }
1746
-
1747
-
1748
- static InstanceType TestType(HHasInstanceType* instr) {
1749
- InstanceType from = instr->from();
1750
- InstanceType to = instr->to();
1751
- if (from == FIRST_TYPE) return to;
1752
- ASSERT(from == to || to == LAST_TYPE);
1753
- return from;
1754
- }
1755
-
1756
-
1757
- static Condition BranchCondition(HHasInstanceType* instr) {
1758
- InstanceType from = instr->from();
1759
- InstanceType to = instr->to();
1760
- if (from == to) return eq;
1761
- if (to == LAST_TYPE) return hs;
1762
- if (from == FIRST_TYPE) return ls;
1763
- UNREACHABLE();
1764
- return eq;
1765
- }
1766
-
1767
-
1768
- void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) {
1769
- Register input = ToRegister(instr->InputAt(0));
1770
- Register result = ToRegister(instr->result());
1771
-
1772
- ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1773
- Label done;
1774
- __ tst(input, Operand(kSmiTagMask));
1775
- __ LoadRoot(result, Heap::kFalseValueRootIndex, eq);
1776
- __ b(eq, &done);
1777
- __ CompareObjectType(input, result, result, TestType(instr->hydrogen()));
1778
- Condition cond = BranchCondition(instr->hydrogen());
1779
- __ LoadRoot(result, Heap::kTrueValueRootIndex, cond);
1780
- __ LoadRoot(result, Heap::kFalseValueRootIndex, NegateCondition(cond));
1781
- __ bind(&done);
1782
- }
1783
-
1784
-
1785
- void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1786
- Register scratch = scratch0();
1787
- Register input = ToRegister(instr->InputAt(0));
1788
-
1789
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1790
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1791
-
1792
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
1793
-
1794
- __ tst(input, Operand(kSmiTagMask));
1795
- __ b(eq, false_label);
1796
-
1797
- __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
1798
- EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1799
- }
1800
-
1801
-
1802
- void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1803
- Register input = ToRegister(instr->InputAt(0));
1804
- Register result = ToRegister(instr->result());
1805
-
1806
- if (FLAG_debug_code) {
1807
- __ AbortIfNotString(input);
1808
- }
1809
-
1810
- __ ldr(result, FieldMemOperand(input, String::kHashFieldOffset));
1811
- __ IndexFromHash(result, result);
1812
- }
1813
-
1814
-
1815
- void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1816
- Register input = ToRegister(instr->InputAt(0));
1817
- Register result = ToRegister(instr->result());
1818
- Register scratch = scratch0();
1819
-
1820
- ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1821
- __ ldr(scratch,
1822
- FieldMemOperand(input, String::kHashFieldOffset));
1823
- __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
1824
- __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1825
- __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1826
- }
1827
-
1828
-
1829
- void LCodeGen::DoHasCachedArrayIndexAndBranch(
1830
- LHasCachedArrayIndexAndBranch* instr) {
1831
- Register input = ToRegister(instr->InputAt(0));
1832
- Register scratch = scratch0();
1833
-
1834
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1835
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1836
-
1837
- __ ldr(scratch,
1838
- FieldMemOperand(input, String::kHashFieldOffset));
1839
- __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
1840
- EmitBranch(true_block, false_block, eq);
1841
- }
1842
-
1843
-
1844
- // Branches to a label or falls through with the answer in flags. Trashes
1845
- // the temp registers, but not the input. Only input and temp2 may alias.
1846
- void LCodeGen::EmitClassOfTest(Label* is_true,
1847
- Label* is_false,
1848
- Handle<String>class_name,
1849
- Register input,
1850
- Register temp,
1851
- Register temp2) {
1852
- ASSERT(!input.is(temp));
1853
- ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1854
- __ tst(input, Operand(kSmiTagMask));
1855
- __ b(eq, is_false);
1856
- __ CompareObjectType(input, temp, temp2, FIRST_JS_OBJECT_TYPE);
1857
- __ b(lt, is_false);
1858
-
1859
- // Map is now in temp.
1860
- // Functions have class 'Function'.
1861
- __ CompareInstanceType(temp, temp2, JS_FUNCTION_TYPE);
1862
- if (class_name->IsEqualTo(CStrVector("Function"))) {
1863
- __ b(eq, is_true);
1864
- } else {
1865
- __ b(eq, is_false);
1866
- }
1867
-
1868
- // Check if the constructor in the map is a function.
1869
- __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
1870
-
1871
- // As long as JS_FUNCTION_TYPE is the last instance type and it is
1872
- // right after LAST_JS_OBJECT_TYPE, we can avoid checking for
1873
- // LAST_JS_OBJECT_TYPE.
1874
- ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1875
- ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
1876
-
1877
- // Objects with a non-function constructor have class 'Object'.
1878
- __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
1879
- if (class_name->IsEqualTo(CStrVector("Object"))) {
1880
- __ b(ne, is_true);
1881
- } else {
1882
- __ b(ne, is_false);
1883
- }
1884
-
1885
- // temp now contains the constructor function. Grab the
1886
- // instance class name from there.
1887
- __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset));
1888
- __ ldr(temp, FieldMemOperand(temp,
1889
- SharedFunctionInfo::kInstanceClassNameOffset));
1890
- // The class name we are testing against is a symbol because it's a literal.
1891
- // The name in the constructor is a symbol because of the way the context is
1892
- // booted. This routine isn't expected to work for random API-created
1893
- // classes and it doesn't have to because you can't access it with natives
1894
- // syntax. Since both sides are symbols it is sufficient to use an identity
1895
- // comparison.
1896
- __ cmp(temp, Operand(class_name));
1897
- // End with the answer in flags.
1898
- }
1899
-
1900
-
1901
- void LCodeGen::DoClassOfTest(LClassOfTest* instr) {
1902
- Register input = ToRegister(instr->InputAt(0));
1903
- Register result = ToRegister(instr->result());
1904
- ASSERT(input.is(result));
1905
- Handle<String> class_name = instr->hydrogen()->class_name();
1906
-
1907
- Label done, is_true, is_false;
1908
-
1909
- EmitClassOfTest(&is_true, &is_false, class_name, input, scratch0(), input);
1910
- __ b(ne, &is_false);
1911
-
1912
- __ bind(&is_true);
1913
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
1914
- __ jmp(&done);
1915
-
1916
- __ bind(&is_false);
1917
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
1918
- __ bind(&done);
1919
- }
1920
-
1921
-
1922
- void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1923
- Register input = ToRegister(instr->InputAt(0));
1924
- Register temp = scratch0();
1925
- Register temp2 = ToRegister(instr->TempAt(0));
1926
- Handle<String> class_name = instr->hydrogen()->class_name();
1927
-
1928
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1929
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1930
-
1931
- Label* true_label = chunk_->GetAssemblyLabel(true_block);
1932
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
1933
-
1934
- EmitClassOfTest(true_label, false_label, class_name, input, temp, temp2);
1935
-
1936
- EmitBranch(true_block, false_block, eq);
1937
- }
1938
-
1939
-
1940
- void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1941
- Register reg = ToRegister(instr->InputAt(0));
1942
- Register temp = ToRegister(instr->TempAt(0));
1943
- int true_block = instr->true_block_id();
1944
- int false_block = instr->false_block_id();
1945
-
1946
- __ ldr(temp, FieldMemOperand(reg, HeapObject::kMapOffset));
1947
- __ cmp(temp, Operand(instr->map()));
1948
- EmitBranch(true_block, false_block, eq);
1949
- }
1950
-
1951
-
1952
- void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1953
- ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
1954
- ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
1955
-
1956
- InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1957
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1958
-
1959
- __ cmp(r0, Operand(0));
1960
- __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne);
1961
- __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq);
1962
- }
1963
-
1964
-
1965
- void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
1966
- ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
1967
- ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
1968
-
1969
- int true_block = chunk_->LookupDestination(instr->true_block_id());
1970
- int false_block = chunk_->LookupDestination(instr->false_block_id());
1971
-
1972
- InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1973
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1974
- __ cmp(r0, Operand(0));
1975
- EmitBranch(true_block, false_block, eq);
1976
- }
1977
-
1978
-
1979
- void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1980
- class DeferredInstanceOfKnownGlobal: public LDeferredCode {
1981
- public:
1982
- DeferredInstanceOfKnownGlobal(LCodeGen* codegen,
1983
- LInstanceOfKnownGlobal* instr)
1984
- : LDeferredCode(codegen), instr_(instr) { }
1985
- virtual void Generate() {
1986
- codegen()->DoDeferredLInstanceOfKnownGlobal(instr_, &map_check_);
1987
- }
1988
-
1989
- Label* map_check() { return &map_check_; }
1990
-
1991
- private:
1992
- LInstanceOfKnownGlobal* instr_;
1993
- Label map_check_;
1994
- };
1995
-
1996
- DeferredInstanceOfKnownGlobal* deferred;
1997
- deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1998
-
1999
- Label done, false_result;
2000
- Register object = ToRegister(instr->InputAt(0));
2001
- Register temp = ToRegister(instr->TempAt(0));
2002
- Register result = ToRegister(instr->result());
2003
-
2004
- ASSERT(object.is(r0));
2005
- ASSERT(result.is(r0));
2006
-
2007
- // A Smi is not instance of anything.
2008
- __ JumpIfSmi(object, &false_result);
2009
-
2010
- // This is the inlined call site instanceof cache. The two occurences of the
2011
- // hole value will be patched to the last map/result pair generated by the
2012
- // instanceof stub.
2013
- Label cache_miss;
2014
- Register map = temp;
2015
- __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
2016
- __ bind(deferred->map_check()); // Label for calculating code patching.
2017
- // We use Factory::the_hole_value() on purpose instead of loading from the
2018
- // root array to force relocation to be able to later patch with
2019
- // the cached map.
2020
- __ mov(ip, Operand(factory()->the_hole_value()));
2021
- __ cmp(map, Operand(ip));
2022
- __ b(ne, &cache_miss);
2023
- // We use Factory::the_hole_value() on purpose instead of loading from the
2024
- // root array to force relocation to be able to later patch
2025
- // with true or false.
2026
- __ mov(result, Operand(factory()->the_hole_value()));
2027
- __ b(&done);
2028
-
2029
- // The inlined call site cache did not match. Check null and string before
2030
- // calling the deferred code.
2031
- __ bind(&cache_miss);
2032
- // Null is not instance of anything.
2033
- __ LoadRoot(ip, Heap::kNullValueRootIndex);
2034
- __ cmp(object, Operand(ip));
2035
- __ b(eq, &false_result);
2036
-
2037
- // String values is not instance of anything.
2038
- Condition is_string = masm_->IsObjectStringType(object, temp);
2039
- __ b(is_string, &false_result);
2040
-
2041
- // Go to the deferred code.
2042
- __ b(deferred->entry());
2043
-
2044
- __ bind(&false_result);
2045
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
2046
-
2047
- // Here result has either true or false. Deferred code also produces true or
2048
- // false object.
2049
- __ bind(deferred->exit());
2050
- __ bind(&done);
2051
- }
2052
-
2053
-
2054
- void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2055
- Label* map_check) {
2056
- Register result = ToRegister(instr->result());
2057
- ASSERT(result.is(r0));
2058
-
2059
- InstanceofStub::Flags flags = InstanceofStub::kNoFlags;
2060
- flags = static_cast<InstanceofStub::Flags>(
2061
- flags | InstanceofStub::kArgsInRegisters);
2062
- flags = static_cast<InstanceofStub::Flags>(
2063
- flags | InstanceofStub::kCallSiteInlineCheck);
2064
- flags = static_cast<InstanceofStub::Flags>(
2065
- flags | InstanceofStub::kReturnTrueFalseObject);
2066
- InstanceofStub stub(flags);
2067
-
2068
- __ PushSafepointRegisters();
2069
-
2070
- // Get the temp register reserved by the instruction. This needs to be r4 as
2071
- // its slot of the pushing of safepoint registers is used to communicate the
2072
- // offset to the location of the map check.
2073
- Register temp = ToRegister(instr->TempAt(0));
2074
- ASSERT(temp.is(r4));
2075
- __ mov(InstanceofStub::right(), Operand(instr->function()));
2076
- static const int kAdditionalDelta = 4;
2077
- int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
2078
- Label before_push_delta;
2079
- __ bind(&before_push_delta);
2080
- __ BlockConstPoolFor(kAdditionalDelta);
2081
- __ mov(temp, Operand(delta * kPointerSize));
2082
- __ StoreToSafepointRegisterSlot(temp, temp);
2083
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2084
- // Put the result value into the result register slot and
2085
- // restore all registers.
2086
- __ StoreToSafepointRegisterSlot(result, result);
2087
-
2088
- __ PopSafepointRegisters();
2089
- }
2090
-
2091
-
2092
- static Condition ComputeCompareCondition(Token::Value op) {
2093
- switch (op) {
2094
- case Token::EQ_STRICT:
2095
- case Token::EQ:
2096
- return eq;
2097
- case Token::LT:
2098
- return lt;
2099
- case Token::GT:
2100
- return gt;
2101
- case Token::LTE:
2102
- return le;
2103
- case Token::GTE:
2104
- return ge;
2105
- default:
2106
- UNREACHABLE();
2107
- return kNoCondition;
2108
- }
2109
- }
2110
-
2111
-
2112
- void LCodeGen::DoCmpT(LCmpT* instr) {
2113
- Token::Value op = instr->op();
2114
-
2115
- Handle<Code> ic = CompareIC::GetUninitialized(op);
2116
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2117
- __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined.
2118
-
2119
- Condition condition = ComputeCompareCondition(op);
2120
- if (op == Token::GT || op == Token::LTE) {
2121
- condition = ReverseCondition(condition);
2122
- }
2123
- __ LoadRoot(ToRegister(instr->result()),
2124
- Heap::kTrueValueRootIndex,
2125
- condition);
2126
- __ LoadRoot(ToRegister(instr->result()),
2127
- Heap::kFalseValueRootIndex,
2128
- NegateCondition(condition));
2129
- }
2130
-
2131
-
2132
- void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
2133
- Token::Value op = instr->op();
2134
- int true_block = chunk_->LookupDestination(instr->true_block_id());
2135
- int false_block = chunk_->LookupDestination(instr->false_block_id());
2136
-
2137
- Handle<Code> ic = CompareIC::GetUninitialized(op);
2138
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2139
-
2140
- // The compare stub expects compare condition and the input operands
2141
- // reversed for GT and LTE.
2142
- Condition condition = ComputeCompareCondition(op);
2143
- if (op == Token::GT || op == Token::LTE) {
2144
- condition = ReverseCondition(condition);
2145
- }
2146
- __ cmp(r0, Operand(0));
2147
- EmitBranch(true_block, false_block, condition);
2148
- }
2149
-
2150
-
2151
- void LCodeGen::DoReturn(LReturn* instr) {
2152
- if (FLAG_trace) {
2153
- // Push the return value on the stack as the parameter.
2154
- // Runtime::TraceExit returns its parameter in r0.
2155
- __ push(r0);
2156
- __ CallRuntime(Runtime::kTraceExit, 1);
2157
- }
2158
- int32_t sp_delta = (ParameterCount() + 1) * kPointerSize;
2159
- __ mov(sp, fp);
2160
- __ ldm(ia_w, sp, fp.bit() | lr.bit());
2161
- __ add(sp, sp, Operand(sp_delta));
2162
- __ Jump(lr);
2163
- }
2164
-
2165
-
2166
- void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2167
- Register result = ToRegister(instr->result());
2168
- __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
2169
- __ ldr(result, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
2170
- if (instr->hydrogen()->check_hole_value()) {
2171
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2172
- __ cmp(result, ip);
2173
- DeoptimizeIf(eq, instr->environment());
2174
- }
2175
- }
2176
-
2177
-
2178
- void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2179
- ASSERT(ToRegister(instr->global_object()).is(r0));
2180
- ASSERT(ToRegister(instr->result()).is(r0));
2181
-
2182
- __ mov(r2, Operand(instr->name()));
2183
- RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET
2184
- : RelocInfo::CODE_TARGET_CONTEXT;
2185
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2186
- CallCode(ic, mode, instr);
2187
- }
2188
-
2189
-
2190
- void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2191
- Register value = ToRegister(instr->InputAt(0));
2192
- Register scratch = scratch0();
2193
-
2194
- // Load the cell.
2195
- __ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
2196
-
2197
- // If the cell we are storing to contains the hole it could have
2198
- // been deleted from the property dictionary. In that case, we need
2199
- // to update the property details in the property dictionary to mark
2200
- // it as no longer deleted.
2201
- if (instr->hydrogen()->check_hole_value()) {
2202
- Register scratch2 = ToRegister(instr->TempAt(0));
2203
- __ ldr(scratch2,
2204
- FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
2205
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2206
- __ cmp(scratch2, ip);
2207
- DeoptimizeIf(eq, instr->environment());
2208
- }
2209
-
2210
- // Store the value.
2211
- __ str(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
2212
- }
2213
-
2214
-
2215
- void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2216
- ASSERT(ToRegister(instr->global_object()).is(r1));
2217
- ASSERT(ToRegister(instr->value()).is(r0));
2218
-
2219
- __ mov(r2, Operand(instr->name()));
2220
- Handle<Code> ic = isolate()->builtins()->StoreIC_Initialize();
2221
- CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2222
- }
2223
-
2224
-
2225
- void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2226
- Register context = ToRegister(instr->context());
2227
- Register result = ToRegister(instr->result());
2228
- __ ldr(result, ContextOperand(context, instr->slot_index()));
2229
- }
2230
-
2231
-
2232
- void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2233
- Register context = ToRegister(instr->context());
2234
- Register value = ToRegister(instr->value());
2235
- __ str(value, ContextOperand(context, instr->slot_index()));
2236
- if (instr->needs_write_barrier()) {
2237
- int offset = Context::SlotOffset(instr->slot_index());
2238
- __ RecordWrite(context, Operand(offset), value, scratch0());
2239
- }
2240
- }
2241
-
2242
-
2243
- void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2244
- Register object = ToRegister(instr->InputAt(0));
2245
- Register result = ToRegister(instr->result());
2246
- if (instr->hydrogen()->is_in_object()) {
2247
- __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
2248
- } else {
2249
- __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2250
- __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset()));
2251
- }
2252
- }
2253
-
2254
-
2255
- void LCodeGen::EmitLoadField(Register result,
2256
- Register object,
2257
- Handle<Map> type,
2258
- Handle<String> name) {
2259
- LookupResult lookup;
2260
- type->LookupInDescriptors(NULL, *name, &lookup);
2261
- ASSERT(lookup.IsProperty() && lookup.type() == FIELD);
2262
- int index = lookup.GetLocalFieldIndexFromMap(*type);
2263
- int offset = index * kPointerSize;
2264
- if (index < 0) {
2265
- // Negative property indices are in-object properties, indexed
2266
- // from the end of the fixed part of the object.
2267
- __ ldr(result, FieldMemOperand(object, offset + type->instance_size()));
2268
- } else {
2269
- // Non-negative property indices are in the properties array.
2270
- __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2271
- __ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
2272
- }
2273
- }
2274
-
2275
-
2276
- void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2277
- Register object = ToRegister(instr->object());
2278
- Register result = ToRegister(instr->result());
2279
- Register scratch = scratch0();
2280
- int map_count = instr->hydrogen()->types()->length();
2281
- Handle<String> name = instr->hydrogen()->name();
2282
- if (map_count == 0) {
2283
- ASSERT(instr->hydrogen()->need_generic());
2284
- __ mov(r2, Operand(name));
2285
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2286
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2287
- } else {
2288
- Label done;
2289
- __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
2290
- for (int i = 0; i < map_count - 1; ++i) {
2291
- Handle<Map> map = instr->hydrogen()->types()->at(i);
2292
- Label next;
2293
- __ cmp(scratch, Operand(map));
2294
- __ b(ne, &next);
2295
- EmitLoadField(result, object, map, name);
2296
- __ b(&done);
2297
- __ bind(&next);
2298
- }
2299
- Handle<Map> map = instr->hydrogen()->types()->last();
2300
- __ cmp(scratch, Operand(map));
2301
- if (instr->hydrogen()->need_generic()) {
2302
- Label generic;
2303
- __ b(ne, &generic);
2304
- EmitLoadField(result, object, map, name);
2305
- __ b(&done);
2306
- __ bind(&generic);
2307
- __ mov(r2, Operand(name));
2308
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2309
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2310
- } else {
2311
- DeoptimizeIf(ne, instr->environment());
2312
- EmitLoadField(result, object, map, name);
2313
- }
2314
- __ bind(&done);
2315
- }
2316
- }
2317
-
2318
-
2319
- void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2320
- ASSERT(ToRegister(instr->object()).is(r0));
2321
- ASSERT(ToRegister(instr->result()).is(r0));
2322
-
2323
- // Name is always in r2.
2324
- __ mov(r2, Operand(instr->name()));
2325
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2326
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2327
- }
2328
-
2329
-
2330
- void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2331
- Register scratch = scratch0();
2332
- Register function = ToRegister(instr->function());
2333
- Register result = ToRegister(instr->result());
2334
-
2335
- // Check that the function really is a function. Load map into the
2336
- // result register.
2337
- __ CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE);
2338
- DeoptimizeIf(ne, instr->environment());
2339
-
2340
- // Make sure that the function has an instance prototype.
2341
- Label non_instance;
2342
- __ ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
2343
- __ tst(scratch, Operand(1 << Map::kHasNonInstancePrototype));
2344
- __ b(ne, &non_instance);
2345
-
2346
- // Get the prototype or initial map from the function.
2347
- __ ldr(result,
2348
- FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2349
-
2350
- // Check that the function has a prototype or an initial map.
2351
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2352
- __ cmp(result, ip);
2353
- DeoptimizeIf(eq, instr->environment());
2354
-
2355
- // If the function does not have an initial map, we're done.
2356
- Label done;
2357
- __ CompareObjectType(result, scratch, scratch, MAP_TYPE);
2358
- __ b(ne, &done);
2359
-
2360
- // Get the prototype from the initial map.
2361
- __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
2362
- __ jmp(&done);
2363
-
2364
- // Non-instance prototype: Fetch prototype from constructor field
2365
- // in initial map.
2366
- __ bind(&non_instance);
2367
- __ ldr(result, FieldMemOperand(result, Map::kConstructorOffset));
2368
-
2369
- // All done.
2370
- __ bind(&done);
2371
- }
2372
-
2373
-
2374
- void LCodeGen::DoLoadElements(LLoadElements* instr) {
2375
- Register result = ToRegister(instr->result());
2376
- Register input = ToRegister(instr->InputAt(0));
2377
- Register scratch = scratch0();
2378
-
2379
- __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset));
2380
- if (FLAG_debug_code) {
2381
- Label done;
2382
- __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset));
2383
- __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
2384
- __ cmp(scratch, ip);
2385
- __ b(eq, &done);
2386
- __ LoadRoot(ip, Heap::kExternalPixelArrayMapRootIndex);
2387
- __ cmp(scratch, ip);
2388
- __ b(eq, &done);
2389
- __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex);
2390
- __ cmp(scratch, ip);
2391
- __ Check(eq, "Check for fast elements failed.");
2392
- __ bind(&done);
2393
- }
2394
- }
2395
-
2396
-
2397
- void LCodeGen::DoLoadExternalArrayPointer(
2398
- LLoadExternalArrayPointer* instr) {
2399
- Register to_reg = ToRegister(instr->result());
2400
- Register from_reg = ToRegister(instr->InputAt(0));
2401
- __ ldr(to_reg, FieldMemOperand(from_reg,
2402
- ExternalArray::kExternalPointerOffset));
2403
- }
2404
-
2405
-
2406
- void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2407
- Register arguments = ToRegister(instr->arguments());
2408
- Register length = ToRegister(instr->length());
2409
- Register index = ToRegister(instr->index());
2410
- Register result = ToRegister(instr->result());
2411
-
2412
- // Bailout index is not a valid argument index. Use unsigned check to get
2413
- // negative check for free.
2414
- __ sub(length, length, index, SetCC);
2415
- DeoptimizeIf(ls, instr->environment());
2416
-
2417
- // There are two words between the frame pointer and the last argument.
2418
- // Subtracting from length accounts for one of them add one more.
2419
- __ add(length, length, Operand(1));
2420
- __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2));
2421
- }
2422
-
2423
-
2424
- void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2425
- Register elements = ToRegister(instr->elements());
2426
- Register key = EmitLoadRegister(instr->key(), scratch0());
2427
- Register result = ToRegister(instr->result());
2428
- Register scratch = scratch0();
2429
- ASSERT(result.is(elements));
2430
-
2431
- // Load the result.
2432
- __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
2433
- __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
2434
-
2435
- // Check for the hole value.
2436
- __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
2437
- __ cmp(result, scratch);
2438
- DeoptimizeIf(eq, instr->environment());
2439
- }
2440
-
2441
-
2442
- void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2443
- LLoadKeyedSpecializedArrayElement* instr) {
2444
- ASSERT(instr->array_type() == kExternalPixelArray);
2445
-
2446
- Register external_pointer = ToRegister(instr->external_pointer());
2447
- Register key = ToRegister(instr->key());
2448
- Register result = ToRegister(instr->result());
2449
-
2450
- // Load the result.
2451
- __ ldrb(result, MemOperand(external_pointer, key));
2452
- }
2453
-
2454
-
2455
- void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2456
- ASSERT(ToRegister(instr->object()).is(r1));
2457
- ASSERT(ToRegister(instr->key()).is(r0));
2458
-
2459
- Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2460
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2461
- }
2462
-
2463
-
2464
- void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2465
- Register scratch = scratch0();
2466
- Register result = ToRegister(instr->result());
2467
-
2468
- // Check if the calling frame is an arguments adaptor frame.
2469
- Label done, adapted;
2470
- __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2471
- __ ldr(result, MemOperand(scratch, StandardFrameConstants::kContextOffset));
2472
- __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
2473
-
2474
- // Result is the frame pointer for the frame if not adapted and for the real
2475
- // frame below the adaptor frame if adapted.
2476
- __ mov(result, fp, LeaveCC, ne);
2477
- __ mov(result, scratch, LeaveCC, eq);
2478
- }
2479
-
2480
-
2481
- void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2482
- Register elem = ToRegister(instr->InputAt(0));
2483
- Register result = ToRegister(instr->result());
2484
-
2485
- Label done;
2486
-
2487
- // If no arguments adaptor frame the number of arguments is fixed.
2488
- __ cmp(fp, elem);
2489
- __ mov(result, Operand(scope()->num_parameters()));
2490
- __ b(eq, &done);
2491
-
2492
- // Arguments adaptor frame present. Get argument length from there.
2493
- __ ldr(result, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2494
- __ ldr(result,
2495
- MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset));
2496
- __ SmiUntag(result);
2497
-
2498
- // Argument length is in result register.
2499
- __ bind(&done);
2500
- }
2501
-
2502
-
2503
- void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2504
- Register receiver = ToRegister(instr->receiver());
2505
- Register function = ToRegister(instr->function());
2506
- Register length = ToRegister(instr->length());
2507
- Register elements = ToRegister(instr->elements());
2508
- Register scratch = scratch0();
2509
- ASSERT(receiver.is(r0)); // Used for parameter count.
2510
- ASSERT(function.is(r1)); // Required by InvokeFunction.
2511
- ASSERT(ToRegister(instr->result()).is(r0));
2512
-
2513
- // If the receiver is null or undefined, we have to pass the global object
2514
- // as a receiver.
2515
- Label global_object, receiver_ok;
2516
- __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2517
- __ cmp(receiver, scratch);
2518
- __ b(eq, &global_object);
2519
- __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2520
- __ cmp(receiver, scratch);
2521
- __ b(eq, &global_object);
2522
-
2523
- // Deoptimize if the receiver is not a JS object.
2524
- __ tst(receiver, Operand(kSmiTagMask));
2525
- DeoptimizeIf(eq, instr->environment());
2526
- __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE);
2527
- DeoptimizeIf(lo, instr->environment());
2528
- __ jmp(&receiver_ok);
2529
-
2530
- __ bind(&global_object);
2531
- __ ldr(receiver, GlobalObjectOperand());
2532
- __ bind(&receiver_ok);
2533
-
2534
- // Copy the arguments to this function possibly from the
2535
- // adaptor frame below it.
2536
- const uint32_t kArgumentsLimit = 1 * KB;
2537
- __ cmp(length, Operand(kArgumentsLimit));
2538
- DeoptimizeIf(hi, instr->environment());
2539
-
2540
- // Push the receiver and use the register to keep the original
2541
- // number of arguments.
2542
- __ push(receiver);
2543
- __ mov(receiver, length);
2544
- // The arguments are at a one pointer size offset from elements.
2545
- __ add(elements, elements, Operand(1 * kPointerSize));
2546
-
2547
- // Loop through the arguments pushing them onto the execution
2548
- // stack.
2549
- Label invoke, loop;
2550
- // length is a small non-negative integer, due to the test above.
2551
- __ cmp(length, Operand(0));
2552
- __ b(eq, &invoke);
2553
- __ bind(&loop);
2554
- __ ldr(scratch, MemOperand(elements, length, LSL, 2));
2555
- __ push(scratch);
2556
- __ sub(length, length, Operand(1), SetCC);
2557
- __ b(ne, &loop);
2558
-
2559
- __ bind(&invoke);
2560
- ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2561
- LPointerMap* pointers = instr->pointer_map();
2562
- LEnvironment* env = instr->deoptimization_environment();
2563
- RecordPosition(pointers->position());
2564
- RegisterEnvironmentForDeoptimization(env);
2565
- SafepointGenerator safepoint_generator(this,
2566
- pointers,
2567
- env->deoptimization_index());
2568
- // The number of arguments is stored in receiver which is r0, as expected
2569
- // by InvokeFunction.
2570
- v8::internal::ParameterCount actual(receiver);
2571
- __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
2572
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2573
- }
2574
-
2575
-
2576
- void LCodeGen::DoPushArgument(LPushArgument* instr) {
2577
- LOperand* argument = instr->InputAt(0);
2578
- if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
2579
- Abort("DoPushArgument not implemented for double type.");
2580
- } else {
2581
- Register argument_reg = EmitLoadRegister(argument, ip);
2582
- __ push(argument_reg);
2583
- }
2584
- }
2585
-
2586
-
2587
- void LCodeGen::DoContext(LContext* instr) {
2588
- Register result = ToRegister(instr->result());
2589
- __ mov(result, cp);
2590
- }
2591
-
2592
-
2593
- void LCodeGen::DoOuterContext(LOuterContext* instr) {
2594
- Register context = ToRegister(instr->context());
2595
- Register result = ToRegister(instr->result());
2596
- __ ldr(result,
2597
- MemOperand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
2598
- __ ldr(result, FieldMemOperand(result, JSFunction::kContextOffset));
2599
- }
2600
-
2601
-
2602
- void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2603
- Register context = ToRegister(instr->context());
2604
- Register result = ToRegister(instr->result());
2605
- __ ldr(result, ContextOperand(cp, Context::GLOBAL_INDEX));
2606
- }
2607
-
2608
-
2609
- void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2610
- Register global = ToRegister(instr->global());
2611
- Register result = ToRegister(instr->result());
2612
- __ ldr(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset));
2613
- }
2614
-
2615
-
2616
- void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2617
- int arity,
2618
- LInstruction* instr) {
2619
- // Change context if needed.
2620
- bool change_context =
2621
- (info()->closure()->context() != function->context()) ||
2622
- scope()->contains_with() ||
2623
- (scope()->num_heap_slots() > 0);
2624
- if (change_context) {
2625
- __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
2626
- }
2627
-
2628
- // Set r0 to arguments count if adaption is not needed. Assumes that r0
2629
- // is available to write to at this point.
2630
- if (!function->NeedsArgumentsAdaption()) {
2631
- __ mov(r0, Operand(arity));
2632
- }
2633
-
2634
- LPointerMap* pointers = instr->pointer_map();
2635
- RecordPosition(pointers->position());
2636
-
2637
- // Invoke function.
2638
- __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
2639
- __ Call(ip);
2640
-
2641
- // Setup deoptimization.
2642
- RegisterLazyDeoptimization(instr);
2643
-
2644
- // Restore context.
2645
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2646
- }
2647
-
2648
-
2649
- void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2650
- ASSERT(ToRegister(instr->result()).is(r0));
2651
- __ mov(r1, Operand(instr->function()));
2652
- CallKnownFunction(instr->function(), instr->arity(), instr);
2653
- }
2654
-
2655
-
2656
- void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2657
- ASSERT(instr->InputAt(0)->Equals(instr->result()));
2658
- Register input = ToRegister(instr->InputAt(0));
2659
- Register scratch = scratch0();
2660
-
2661
- // Deoptimize if not a heap number.
2662
- __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
2663
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
2664
- __ cmp(scratch, Operand(ip));
2665
- DeoptimizeIf(ne, instr->environment());
2666
-
2667
- Label done;
2668
- Register exponent = scratch0();
2669
- scratch = no_reg;
2670
- __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset));
2671
- // Check the sign of the argument. If the argument is positive, just
2672
- // return it. We do not need to patch the stack since |input| and
2673
- // |result| are the same register and |input| would be restored
2674
- // unchanged by popping safepoint registers.
2675
- __ tst(exponent, Operand(HeapNumber::kSignMask));
2676
- __ b(eq, &done);
2677
-
2678
- // Input is negative. Reverse its sign.
2679
- // Preserve the value of all registers.
2680
- __ PushSafepointRegisters();
2681
-
2682
- // Registers were saved at the safepoint, so we can use
2683
- // many scratch registers.
2684
- Register tmp1 = input.is(r1) ? r0 : r1;
2685
- Register tmp2 = input.is(r2) ? r0 : r2;
2686
- Register tmp3 = input.is(r3) ? r0 : r3;
2687
- Register tmp4 = input.is(r4) ? r0 : r4;
2688
-
2689
- // exponent: floating point exponent value.
2690
-
2691
- Label allocated, slow;
2692
- __ LoadRoot(tmp4, Heap::kHeapNumberMapRootIndex);
2693
- __ AllocateHeapNumber(tmp1, tmp2, tmp3, tmp4, &slow);
2694
- __ b(&allocated);
2695
-
2696
- // Slow case: Call the runtime system to do the number allocation.
2697
- __ bind(&slow);
2698
-
2699
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
2700
- RecordSafepointWithRegisters(
2701
- instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
2702
- // Set the pointer to the new heap number in tmp.
2703
- if (!tmp1.is(r0)) __ mov(tmp1, Operand(r0));
2704
- // Restore input_reg after call to runtime.
2705
- __ LoadFromSafepointRegisterSlot(input, input);
2706
- __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset));
2707
-
2708
- __ bind(&allocated);
2709
- // exponent: floating point exponent value.
2710
- // tmp1: allocated heap number.
2711
- __ bic(exponent, exponent, Operand(HeapNumber::kSignMask));
2712
- __ str(exponent, FieldMemOperand(tmp1, HeapNumber::kExponentOffset));
2713
- __ ldr(tmp2, FieldMemOperand(input, HeapNumber::kMantissaOffset));
2714
- __ str(tmp2, FieldMemOperand(tmp1, HeapNumber::kMantissaOffset));
2715
-
2716
- __ StoreToSafepointRegisterSlot(tmp1, input);
2717
- __ PopSafepointRegisters();
2718
-
2719
- __ bind(&done);
2720
- }
2721
-
2722
-
2723
- void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2724
- Register input = ToRegister(instr->InputAt(0));
2725
- __ cmp(input, Operand(0));
2726
- // We can make rsb conditional because the previous cmp instruction
2727
- // will clear the V (overflow) flag and rsb won't set this flag
2728
- // if input is positive.
2729
- __ rsb(input, input, Operand(0), SetCC, mi);
2730
- // Deoptimize on overflow.
2731
- DeoptimizeIf(vs, instr->environment());
2732
- }
2733
-
2734
-
2735
- void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2736
- // Class for deferred case.
2737
- class DeferredMathAbsTaggedHeapNumber: public LDeferredCode {
2738
- public:
2739
- DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen,
2740
- LUnaryMathOperation* instr)
2741
- : LDeferredCode(codegen), instr_(instr) { }
2742
- virtual void Generate() {
2743
- codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_);
2744
- }
2745
- private:
2746
- LUnaryMathOperation* instr_;
2747
- };
2748
-
2749
- ASSERT(instr->InputAt(0)->Equals(instr->result()));
2750
- Representation r = instr->hydrogen()->value()->representation();
2751
- if (r.IsDouble()) {
2752
- DwVfpRegister input = ToDoubleRegister(instr->InputAt(0));
2753
- __ vabs(input, input);
2754
- } else if (r.IsInteger32()) {
2755
- EmitIntegerMathAbs(instr);
2756
- } else {
2757
- // Representation is tagged.
2758
- DeferredMathAbsTaggedHeapNumber* deferred =
2759
- new DeferredMathAbsTaggedHeapNumber(this, instr);
2760
- Register input = ToRegister(instr->InputAt(0));
2761
- // Smi check.
2762
- __ JumpIfNotSmi(input, deferred->entry());
2763
- // If smi, handle it directly.
2764
- EmitIntegerMathAbs(instr);
2765
- __ bind(deferred->exit());
2766
- }
2767
- }
2768
-
2769
-
2770
- void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2771
- DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2772
- Register result = ToRegister(instr->result());
2773
- SwVfpRegister single_scratch = double_scratch0().low();
2774
- Register scratch1 = scratch0();
2775
- Register scratch2 = ToRegister(instr->TempAt(0));
2776
-
2777
- __ EmitVFPTruncate(kRoundToMinusInf,
2778
- single_scratch,
2779
- input,
2780
- scratch1,
2781
- scratch2);
2782
- DeoptimizeIf(ne, instr->environment());
2783
-
2784
- // Move the result back to general purpose register r0.
2785
- __ vmov(result, single_scratch);
2786
-
2787
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2788
- // Test for -0.
2789
- Label done;
2790
- __ cmp(result, Operand(0));
2791
- __ b(ne, &done);
2792
- __ vmov(scratch1, input.high());
2793
- __ tst(scratch1, Operand(HeapNumber::kSignMask));
2794
- DeoptimizeIf(ne, instr->environment());
2795
- __ bind(&done);
2796
- }
2797
- }
2798
-
2799
-
2800
- void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2801
- DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2802
- Register result = ToRegister(instr->result());
2803
- Register scratch1 = scratch0();
2804
- Register scratch2 = result;
2805
- __ EmitVFPTruncate(kRoundToNearest,
2806
- double_scratch0().low(),
2807
- input,
2808
- scratch1,
2809
- scratch2);
2810
- DeoptimizeIf(ne, instr->environment());
2811
- __ vmov(result, double_scratch0().low());
2812
-
2813
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2814
- // Test for -0.
2815
- Label done;
2816
- __ cmp(result, Operand(0));
2817
- __ b(ne, &done);
2818
- __ vmov(scratch1, input.high());
2819
- __ tst(scratch1, Operand(HeapNumber::kSignMask));
2820
- DeoptimizeIf(ne, instr->environment());
2821
- __ bind(&done);
2822
- }
2823
- }
2824
-
2825
-
2826
- void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2827
- DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2828
- ASSERT(ToDoubleRegister(instr->result()).is(input));
2829
- __ vsqrt(input, input);
2830
- }
2831
-
2832
-
2833
- void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
2834
- DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2835
- Register scratch = scratch0();
2836
- SwVfpRegister single_scratch = double_scratch0().low();
2837
- DoubleRegister double_scratch = double_scratch0();
2838
- ASSERT(ToDoubleRegister(instr->result()).is(input));
2839
-
2840
- // Add +0 to convert -0 to +0.
2841
- __ mov(scratch, Operand(0));
2842
- __ vmov(single_scratch, scratch);
2843
- __ vcvt_f64_s32(double_scratch, single_scratch);
2844
- __ vadd(input, input, double_scratch);
2845
- __ vsqrt(input, input);
2846
- }
2847
-
2848
-
2849
- void LCodeGen::DoPower(LPower* instr) {
2850
- LOperand* left = instr->InputAt(0);
2851
- LOperand* right = instr->InputAt(1);
2852
- Register scratch = scratch0();
2853
- DoubleRegister result_reg = ToDoubleRegister(instr->result());
2854
- Representation exponent_type = instr->hydrogen()->right()->representation();
2855
- if (exponent_type.IsDouble()) {
2856
- // Prepare arguments and call C function.
2857
- __ PrepareCallCFunction(4, scratch);
2858
- __ vmov(r0, r1, ToDoubleRegister(left));
2859
- __ vmov(r2, r3, ToDoubleRegister(right));
2860
- __ CallCFunction(
2861
- ExternalReference::power_double_double_function(isolate()), 4);
2862
- } else if (exponent_type.IsInteger32()) {
2863
- ASSERT(ToRegister(right).is(r0));
2864
- // Prepare arguments and call C function.
2865
- __ PrepareCallCFunction(4, scratch);
2866
- __ mov(r2, ToRegister(right));
2867
- __ vmov(r0, r1, ToDoubleRegister(left));
2868
- __ CallCFunction(
2869
- ExternalReference::power_double_int_function(isolate()), 4);
2870
- } else {
2871
- ASSERT(exponent_type.IsTagged());
2872
- ASSERT(instr->hydrogen()->left()->representation().IsDouble());
2873
-
2874
- Register right_reg = ToRegister(right);
2875
-
2876
- // Check for smi on the right hand side.
2877
- Label non_smi, call;
2878
- __ JumpIfNotSmi(right_reg, &non_smi);
2879
-
2880
- // Untag smi and convert it to a double.
2881
- __ SmiUntag(right_reg);
2882
- SwVfpRegister single_scratch = double_scratch0().low();
2883
- __ vmov(single_scratch, right_reg);
2884
- __ vcvt_f64_s32(result_reg, single_scratch);
2885
- __ jmp(&call);
2886
-
2887
- // Heap number map check.
2888
- __ bind(&non_smi);
2889
- __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset));
2890
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
2891
- __ cmp(scratch, Operand(ip));
2892
- DeoptimizeIf(ne, instr->environment());
2893
- int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag;
2894
- __ add(scratch, right_reg, Operand(value_offset));
2895
- __ vldr(result_reg, scratch, 0);
2896
-
2897
- // Prepare arguments and call C function.
2898
- __ bind(&call);
2899
- __ PrepareCallCFunction(4, scratch);
2900
- __ vmov(r0, r1, ToDoubleRegister(left));
2901
- __ vmov(r2, r3, result_reg);
2902
- __ CallCFunction(
2903
- ExternalReference::power_double_double_function(isolate()), 4);
2904
- }
2905
- // Store the result in the result register.
2906
- __ GetCFunctionDoubleResult(result_reg);
2907
- }
2908
-
2909
-
2910
- void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
2911
- ASSERT(ToDoubleRegister(instr->result()).is(d2));
2912
- TranscendentalCacheStub stub(TranscendentalCache::LOG,
2913
- TranscendentalCacheStub::UNTAGGED);
2914
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2915
- }
2916
-
2917
-
2918
- void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
2919
- ASSERT(ToDoubleRegister(instr->result()).is(d2));
2920
- TranscendentalCacheStub stub(TranscendentalCache::COS,
2921
- TranscendentalCacheStub::UNTAGGED);
2922
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2923
- }
2924
-
2925
-
2926
- void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
2927
- ASSERT(ToDoubleRegister(instr->result()).is(d2));
2928
- TranscendentalCacheStub stub(TranscendentalCache::SIN,
2929
- TranscendentalCacheStub::UNTAGGED);
2930
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2931
- }
2932
-
2933
-
2934
- void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2935
- switch (instr->op()) {
2936
- case kMathAbs:
2937
- DoMathAbs(instr);
2938
- break;
2939
- case kMathFloor:
2940
- DoMathFloor(instr);
2941
- break;
2942
- case kMathRound:
2943
- DoMathRound(instr);
2944
- break;
2945
- case kMathSqrt:
2946
- DoMathSqrt(instr);
2947
- break;
2948
- case kMathPowHalf:
2949
- DoMathPowHalf(instr);
2950
- break;
2951
- case kMathCos:
2952
- DoMathCos(instr);
2953
- break;
2954
- case kMathSin:
2955
- DoMathSin(instr);
2956
- break;
2957
- case kMathLog:
2958
- DoMathLog(instr);
2959
- break;
2960
- default:
2961
- Abort("Unimplemented type of LUnaryMathOperation.");
2962
- UNREACHABLE();
2963
- }
2964
- }
2965
-
2966
-
2967
- void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
2968
- ASSERT(ToRegister(instr->result()).is(r0));
2969
-
2970
- int arity = instr->arity();
2971
- Handle<Code> ic =
2972
- isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP);
2973
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2974
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2975
- }
2976
-
2977
-
2978
- void LCodeGen::DoCallNamed(LCallNamed* instr) {
2979
- ASSERT(ToRegister(instr->result()).is(r0));
2980
-
2981
- int arity = instr->arity();
2982
- Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(
2983
- arity, NOT_IN_LOOP);
2984
- __ mov(r2, Operand(instr->name()));
2985
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
2986
- // Restore context register.
2987
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2988
- }
2989
-
2990
-
2991
- void LCodeGen::DoCallFunction(LCallFunction* instr) {
2992
- ASSERT(ToRegister(instr->result()).is(r0));
2993
-
2994
- int arity = instr->arity();
2995
- CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
2996
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2997
- __ Drop(1);
2998
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2999
- }
3000
-
3001
-
3002
- void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3003
- ASSERT(ToRegister(instr->result()).is(r0));
3004
-
3005
- int arity = instr->arity();
3006
- Handle<Code> ic =
3007
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_IN_LOOP);
3008
- __ mov(r2, Operand(instr->name()));
3009
- CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
3010
- __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3011
- }
3012
-
3013
-
3014
- void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3015
- ASSERT(ToRegister(instr->result()).is(r0));
3016
- __ mov(r1, Operand(instr->target()));
3017
- CallKnownFunction(instr->target(), instr->arity(), instr);
3018
- }
3019
-
3020
-
3021
- void LCodeGen::DoCallNew(LCallNew* instr) {
3022
- ASSERT(ToRegister(instr->InputAt(0)).is(r1));
3023
- ASSERT(ToRegister(instr->result()).is(r0));
3024
-
3025
- Handle<Code> builtin = isolate()->builtins()->JSConstructCall();
3026
- __ mov(r0, Operand(instr->arity()));
3027
- CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
3028
- }
3029
-
3030
-
3031
- void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3032
- CallRuntime(instr->function(), instr->arity(), instr);
3033
- }
3034
-
3035
-
3036
- void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3037
- Register object = ToRegister(instr->object());
3038
- Register value = ToRegister(instr->value());
3039
- Register scratch = scratch0();
3040
- int offset = instr->offset();
3041
-
3042
- ASSERT(!object.is(value));
3043
-
3044
- if (!instr->transition().is_null()) {
3045
- __ mov(scratch, Operand(instr->transition()));
3046
- __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
3047
- }
3048
-
3049
- // Do the store.
3050
- if (instr->is_in_object()) {
3051
- __ str(value, FieldMemOperand(object, offset));
3052
- if (instr->needs_write_barrier()) {
3053
- // Update the write barrier for the object for in-object properties.
3054
- __ RecordWrite(object, Operand(offset), value, scratch);
3055
- }
3056
- } else {
3057
- __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
3058
- __ str(value, FieldMemOperand(scratch, offset));
3059
- if (instr->needs_write_barrier()) {
3060
- // Update the write barrier for the properties array.
3061
- // object is used as a scratch register.
3062
- __ RecordWrite(scratch, Operand(offset), value, object);
3063
- }
3064
- }
3065
- }
3066
-
3067
-
3068
- void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3069
- ASSERT(ToRegister(instr->object()).is(r1));
3070
- ASSERT(ToRegister(instr->value()).is(r0));
3071
-
3072
- // Name is always in r2.
3073
- __ mov(r2, Operand(instr->name()));
3074
- Handle<Code> ic = info_->is_strict()
3075
- ? isolate()->builtins()->StoreIC_Initialize_Strict()
3076
- : isolate()->builtins()->StoreIC_Initialize();
3077
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
3078
- }
3079
-
3080
-
3081
- void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3082
- __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
3083
- DeoptimizeIf(hs, instr->environment());
3084
- }
3085
-
3086
-
3087
- void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3088
- Register value = ToRegister(instr->value());
3089
- Register elements = ToRegister(instr->object());
3090
- Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3091
- Register scratch = scratch0();
3092
-
3093
- // Do the store.
3094
- if (instr->key()->IsConstantOperand()) {
3095
- ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3096
- LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3097
- int offset =
3098
- ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize;
3099
- __ str(value, FieldMemOperand(elements, offset));
3100
- } else {
3101
- __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
3102
- __ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize));
3103
- }
3104
-
3105
- if (instr->hydrogen()->NeedsWriteBarrier()) {
3106
- // Compute address of modified element and store it into key register.
3107
- __ add(key, scratch, Operand(FixedArray::kHeaderSize));
3108
- __ RecordWrite(elements, key, value);
3109
- }
3110
- }
3111
-
3112
-
3113
- void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3114
- LStoreKeyedSpecializedArrayElement* instr) {
3115
- ASSERT(instr->array_type() == kExternalPixelArray);
3116
-
3117
- Register external_pointer = ToRegister(instr->external_pointer());
3118
- Register key = ToRegister(instr->key());
3119
- Register value = ToRegister(instr->value());
3120
-
3121
- // Clamp the value to [0..255].
3122
- __ Usat(value, 8, Operand(value));
3123
- __ strb(value, MemOperand(external_pointer, key, LSL, 0));
3124
- }
3125
-
3126
-
3127
- void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3128
- ASSERT(ToRegister(instr->object()).is(r2));
3129
- ASSERT(ToRegister(instr->key()).is(r1));
3130
- ASSERT(ToRegister(instr->value()).is(r0));
3131
-
3132
- Handle<Code> ic = info_->is_strict()
3133
- ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
3134
- : isolate()->builtins()->KeyedStoreIC_Initialize();
3135
- CallCode(ic, RelocInfo::CODE_TARGET, instr);
3136
- }
3137
-
3138
-
3139
- void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3140
- class DeferredStringCharCodeAt: public LDeferredCode {
3141
- public:
3142
- DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3143
- : LDeferredCode(codegen), instr_(instr) { }
3144
- virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); }
3145
- private:
3146
- LStringCharCodeAt* instr_;
3147
- };
3148
-
3149
- Register scratch = scratch0();
3150
- Register string = ToRegister(instr->string());
3151
- Register index = no_reg;
3152
- int const_index = -1;
3153
- if (instr->index()->IsConstantOperand()) {
3154
- const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3155
- STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
3156
- if (!Smi::IsValid(const_index)) {
3157
- // Guaranteed to be out of bounds because of the assert above.
3158
- // So the bounds check that must dominate this instruction must
3159
- // have deoptimized already.
3160
- if (FLAG_debug_code) {
3161
- __ Abort("StringCharCodeAt: out of bounds index.");
3162
- }
3163
- // No code needs to be generated.
3164
- return;
3165
- }
3166
- } else {
3167
- index = ToRegister(instr->index());
3168
- }
3169
- Register result = ToRegister(instr->result());
3170
-
3171
- DeferredStringCharCodeAt* deferred =
3172
- new DeferredStringCharCodeAt(this, instr);
3173
-
3174
- Label flat_string, ascii_string, done;
3175
-
3176
- // Fetch the instance type of the receiver into result register.
3177
- __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
3178
- __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
3179
-
3180
- // We need special handling for non-flat strings.
3181
- STATIC_ASSERT(kSeqStringTag == 0);
3182
- __ tst(result, Operand(kStringRepresentationMask));
3183
- __ b(eq, &flat_string);
3184
-
3185
- // Handle non-flat strings.
3186
- __ tst(result, Operand(kIsConsStringMask));
3187
- __ b(eq, deferred->entry());
3188
-
3189
- // ConsString.
3190
- // Check whether the right hand side is the empty string (i.e. if
3191
- // this is really a flat string in a cons string). If that is not
3192
- // the case we would rather go to the runtime system now to flatten
3193
- // the string.
3194
- __ ldr(scratch, FieldMemOperand(string, ConsString::kSecondOffset));
3195
- __ LoadRoot(ip, Heap::kEmptyStringRootIndex);
3196
- __ cmp(scratch, ip);
3197
- __ b(ne, deferred->entry());
3198
- // Get the first of the two strings and load its instance type.
3199
- __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset));
3200
- __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
3201
- __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
3202
- // If the first cons component is also non-flat, then go to runtime.
3203
- STATIC_ASSERT(kSeqStringTag == 0);
3204
- __ tst(result, Operand(kStringRepresentationMask));
3205
- __ b(ne, deferred->entry());
3206
-
3207
- // Check for 1-byte or 2-byte string.
3208
- __ bind(&flat_string);
3209
- STATIC_ASSERT(kAsciiStringTag != 0);
3210
- __ tst(result, Operand(kStringEncodingMask));
3211
- __ b(ne, &ascii_string);
3212
-
3213
- // 2-byte string.
3214
- // Load the 2-byte character code into the result register.
3215
- STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1);
3216
- if (instr->index()->IsConstantOperand()) {
3217
- __ ldrh(result,
3218
- FieldMemOperand(string,
3219
- SeqTwoByteString::kHeaderSize + 2 * const_index));
3220
- } else {
3221
- __ add(scratch,
3222
- string,
3223
- Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
3224
- __ ldrh(result, MemOperand(scratch, index, LSL, 1));
3225
- }
3226
- __ jmp(&done);
3227
-
3228
- // ASCII string.
3229
- // Load the byte into the result register.
3230
- __ bind(&ascii_string);
3231
- if (instr->index()->IsConstantOperand()) {
3232
- __ ldrb(result, FieldMemOperand(string,
3233
- SeqAsciiString::kHeaderSize + const_index));
3234
- } else {
3235
- __ add(scratch,
3236
- string,
3237
- Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
3238
- __ ldrb(result, MemOperand(scratch, index));
3239
- }
3240
- __ bind(&done);
3241
- __ bind(deferred->exit());
3242
- }
3243
-
3244
-
3245
- void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3246
- Register string = ToRegister(instr->string());
3247
- Register result = ToRegister(instr->result());
3248
- Register scratch = scratch0();
3249
-
3250
- // TODO(3095996): Get rid of this. For now, we need to make the
3251
- // result register contain a valid pointer because it is already
3252
- // contained in the register pointer map.
3253
- __ mov(result, Operand(0));
3254
-
3255
- __ PushSafepointRegisters();
3256
- __ push(string);
3257
- // Push the index as a smi. This is safe because of the checks in
3258
- // DoStringCharCodeAt above.
3259
- if (instr->index()->IsConstantOperand()) {
3260
- int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3261
- __ mov(scratch, Operand(Smi::FromInt(const_index)));
3262
- __ push(scratch);
3263
- } else {
3264
- Register index = ToRegister(instr->index());
3265
- __ SmiTag(index);
3266
- __ push(index);
3267
- }
3268
- __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt);
3269
- RecordSafepointWithRegisters(
3270
- instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex);
3271
- if (FLAG_debug_code) {
3272
- __ AbortIfNotSmi(r0);
3273
- }
3274
- __ SmiUntag(r0);
3275
- __ StoreToSafepointRegisterSlot(r0, result);
3276
- __ PopSafepointRegisters();
3277
- }
3278
-
3279
-
3280
- void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3281
- class DeferredStringCharFromCode: public LDeferredCode {
3282
- public:
3283
- DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3284
- : LDeferredCode(codegen), instr_(instr) { }
3285
- virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); }
3286
- private:
3287
- LStringCharFromCode* instr_;
3288
- };
3289
-
3290
- DeferredStringCharFromCode* deferred =
3291
- new DeferredStringCharFromCode(this, instr);
3292
-
3293
- ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3294
- Register char_code = ToRegister(instr->char_code());
3295
- Register result = ToRegister(instr->result());
3296
- ASSERT(!char_code.is(result));
3297
-
3298
- __ cmp(char_code, Operand(String::kMaxAsciiCharCode));
3299
- __ b(hi, deferred->entry());
3300
- __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex);
3301
- __ add(result, result, Operand(char_code, LSL, kPointerSizeLog2));
3302
- __ ldr(result, FieldMemOperand(result, FixedArray::kHeaderSize));
3303
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3304
- __ cmp(result, ip);
3305
- __ b(eq, deferred->entry());
3306
- __ bind(deferred->exit());
3307
- }
3308
-
3309
-
3310
- void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3311
- Register char_code = ToRegister(instr->char_code());
3312
- Register result = ToRegister(instr->result());
3313
-
3314
- // TODO(3095996): Get rid of this. For now, we need to make the
3315
- // result register contain a valid pointer because it is already
3316
- // contained in the register pointer map.
3317
- __ mov(result, Operand(0));
3318
-
3319
- __ PushSafepointRegisters();
3320
- __ SmiTag(char_code);
3321
- __ push(char_code);
3322
- __ CallRuntimeSaveDoubles(Runtime::kCharFromCode);
3323
- RecordSafepointWithRegisters(
3324
- instr->pointer_map(), 1, Safepoint::kNoDeoptimizationIndex);
3325
- __ StoreToSafepointRegisterSlot(r0, result);
3326
- __ PopSafepointRegisters();
3327
- }
3328
-
3329
-
3330
- void LCodeGen::DoStringLength(LStringLength* instr) {
3331
- Register string = ToRegister(instr->InputAt(0));
3332
- Register result = ToRegister(instr->result());
3333
- __ ldr(result, FieldMemOperand(string, String::kLengthOffset));
3334
- }
3335
-
3336
-
3337
- void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3338
- LOperand* input = instr->InputAt(0);
3339
- ASSERT(input->IsRegister() || input->IsStackSlot());
3340
- LOperand* output = instr->result();
3341
- ASSERT(output->IsDoubleRegister());
3342
- SwVfpRegister single_scratch = double_scratch0().low();
3343
- if (input->IsStackSlot()) {
3344
- Register scratch = scratch0();
3345
- __ ldr(scratch, ToMemOperand(input));
3346
- __ vmov(single_scratch, scratch);
3347
- } else {
3348
- __ vmov(single_scratch, ToRegister(input));
3349
- }
3350
- __ vcvt_f64_s32(ToDoubleRegister(output), single_scratch);
3351
- }
3352
-
3353
-
3354
- void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3355
- class DeferredNumberTagI: public LDeferredCode {
3356
- public:
3357
- DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
3358
- : LDeferredCode(codegen), instr_(instr) { }
3359
- virtual void Generate() { codegen()->DoDeferredNumberTagI(instr_); }
3360
- private:
3361
- LNumberTagI* instr_;
3362
- };
3363
-
3364
- LOperand* input = instr->InputAt(0);
3365
- ASSERT(input->IsRegister() && input->Equals(instr->result()));
3366
- Register reg = ToRegister(input);
3367
-
3368
- DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
3369
- __ SmiTag(reg, SetCC);
3370
- __ b(vs, deferred->entry());
3371
- __ bind(deferred->exit());
3372
- }
3373
-
3374
-
3375
- void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) {
3376
- Label slow;
3377
- Register reg = ToRegister(instr->InputAt(0));
3378
- DoubleRegister dbl_scratch = d0;
3379
- SwVfpRegister flt_scratch = s0;
3380
-
3381
- // Preserve the value of all registers.
3382
- __ PushSafepointRegisters();
3383
-
3384
- // There was overflow, so bits 30 and 31 of the original integer
3385
- // disagree. Try to allocate a heap number in new space and store
3386
- // the value in there. If that fails, call the runtime system.
3387
- Label done;
3388
- __ SmiUntag(reg);
3389
- __ eor(reg, reg, Operand(0x80000000));
3390
- __ vmov(flt_scratch, reg);
3391
- __ vcvt_f64_s32(dbl_scratch, flt_scratch);
3392
- if (FLAG_inline_new) {
3393
- __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
3394
- __ AllocateHeapNumber(r5, r3, r4, r6, &slow);
3395
- if (!reg.is(r5)) __ mov(reg, r5);
3396
- __ b(&done);
3397
- }
3398
-
3399
- // Slow case: Call the runtime system to do the number allocation.
3400
- __ bind(&slow);
3401
-
3402
- // TODO(3095996): Put a valid pointer value in the stack slot where the result
3403
- // register is stored, as this register is in the pointer map, but contains an
3404
- // integer value.
3405
- __ mov(ip, Operand(0));
3406
- __ StoreToSafepointRegisterSlot(ip, reg);
3407
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
3408
- RecordSafepointWithRegisters(
3409
- instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
3410
- if (!reg.is(r0)) __ mov(reg, r0);
3411
-
3412
- // Done. Put the value in dbl_scratch into the value of the allocated heap
3413
- // number.
3414
- __ bind(&done);
3415
- __ sub(ip, reg, Operand(kHeapObjectTag));
3416
- __ vstr(dbl_scratch, ip, HeapNumber::kValueOffset);
3417
- __ StoreToSafepointRegisterSlot(reg, reg);
3418
- __ PopSafepointRegisters();
3419
- }
3420
-
3421
-
3422
- void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3423
- class DeferredNumberTagD: public LDeferredCode {
3424
- public:
3425
- DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3426
- : LDeferredCode(codegen), instr_(instr) { }
3427
- virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); }
3428
- private:
3429
- LNumberTagD* instr_;
3430
- };
3431
-
3432
- DoubleRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3433
- Register scratch = scratch0();
3434
- Register reg = ToRegister(instr->result());
3435
- Register temp1 = ToRegister(instr->TempAt(0));
3436
- Register temp2 = ToRegister(instr->TempAt(1));
3437
-
3438
- DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3439
- if (FLAG_inline_new) {
3440
- __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
3441
- __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
3442
- } else {
3443
- __ jmp(deferred->entry());
3444
- }
3445
- __ bind(deferred->exit());
3446
- __ sub(ip, reg, Operand(kHeapObjectTag));
3447
- __ vstr(input_reg, ip, HeapNumber::kValueOffset);
3448
- }
3449
-
3450
-
3451
- void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3452
- // TODO(3095996): Get rid of this. For now, we need to make the
3453
- // result register contain a valid pointer because it is already
3454
- // contained in the register pointer map.
3455
- Register reg = ToRegister(instr->result());
3456
- __ mov(reg, Operand(0));
3457
-
3458
- __ PushSafepointRegisters();
3459
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
3460
- RecordSafepointWithRegisters(
3461
- instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
3462
- __ StoreToSafepointRegisterSlot(r0, reg);
3463
- __ PopSafepointRegisters();
3464
- }
3465
-
3466
-
3467
- void LCodeGen::DoSmiTag(LSmiTag* instr) {
3468
- LOperand* input = instr->InputAt(0);
3469
- ASSERT(input->IsRegister() && input->Equals(instr->result()));
3470
- ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3471
- __ SmiTag(ToRegister(input));
3472
- }
3473
-
3474
-
3475
- void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3476
- LOperand* input = instr->InputAt(0);
3477
- ASSERT(input->IsRegister() && input->Equals(instr->result()));
3478
- if (instr->needs_check()) {
3479
- __ tst(ToRegister(input), Operand(kSmiTagMask));
3480
- DeoptimizeIf(ne, instr->environment());
3481
- }
3482
- __ SmiUntag(ToRegister(input));
3483
- }
3484
-
3485
-
3486
- void LCodeGen::EmitNumberUntagD(Register input_reg,
3487
- DoubleRegister result_reg,
3488
- LEnvironment* env) {
3489
- Register scratch = scratch0();
3490
- SwVfpRegister flt_scratch = s0;
3491
- ASSERT(!result_reg.is(d0));
3492
-
3493
- Label load_smi, heap_number, done;
3494
-
3495
- // Smi check.
3496
- __ tst(input_reg, Operand(kSmiTagMask));
3497
- __ b(eq, &load_smi);
3498
-
3499
- // Heap number map check.
3500
- __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3501
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3502
- __ cmp(scratch, Operand(ip));
3503
- __ b(eq, &heap_number);
3504
-
3505
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3506
- __ cmp(input_reg, Operand(ip));
3507
- DeoptimizeIf(ne, env);
3508
-
3509
- // Convert undefined to NaN.
3510
- __ LoadRoot(ip, Heap::kNanValueRootIndex);
3511
- __ sub(ip, ip, Operand(kHeapObjectTag));
3512
- __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3513
- __ jmp(&done);
3514
-
3515
- // Heap number to double register conversion.
3516
- __ bind(&heap_number);
3517
- __ sub(ip, input_reg, Operand(kHeapObjectTag));
3518
- __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3519
- __ jmp(&done);
3520
-
3521
- // Smi to double register conversion
3522
- __ bind(&load_smi);
3523
- __ SmiUntag(input_reg); // Untag smi before converting to float.
3524
- __ vmov(flt_scratch, input_reg);
3525
- __ vcvt_f64_s32(result_reg, flt_scratch);
3526
- __ SmiTag(input_reg); // Retag smi.
3527
- __ bind(&done);
3528
- }
3529
-
3530
-
3531
- class DeferredTaggedToI: public LDeferredCode {
3532
- public:
3533
- DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3534
- : LDeferredCode(codegen), instr_(instr) { }
3535
- virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); }
3536
- private:
3537
- LTaggedToI* instr_;
3538
- };
3539
-
3540
-
3541
- void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3542
- Register input_reg = ToRegister(instr->InputAt(0));
3543
- Register scratch1 = scratch0();
3544
- Register scratch2 = ToRegister(instr->TempAt(0));
3545
- DwVfpRegister double_scratch = double_scratch0();
3546
- SwVfpRegister single_scratch = double_scratch.low();
3547
-
3548
- ASSERT(!scratch1.is(input_reg) && !scratch1.is(scratch2));
3549
- ASSERT(!scratch2.is(input_reg) && !scratch2.is(scratch1));
3550
-
3551
- Label done;
3552
-
3553
- // Heap number map check.
3554
- __ ldr(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3555
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3556
- __ cmp(scratch1, Operand(ip));
3557
-
3558
- if (instr->truncating()) {
3559
- Register scratch3 = ToRegister(instr->TempAt(1));
3560
- DwVfpRegister double_scratch2 = ToDoubleRegister(instr->TempAt(2));
3561
- ASSERT(!scratch3.is(input_reg) &&
3562
- !scratch3.is(scratch1) &&
3563
- !scratch3.is(scratch2));
3564
- // Performs a truncating conversion of a floating point number as used by
3565
- // the JS bitwise operations.
3566
- Label heap_number;
3567
- __ b(eq, &heap_number);
3568
- // Check for undefined. Undefined is converted to zero for truncating
3569
- // conversions.
3570
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3571
- __ cmp(input_reg, Operand(ip));
3572
- DeoptimizeIf(ne, instr->environment());
3573
- __ mov(input_reg, Operand(0));
3574
- __ b(&done);
3575
-
3576
- __ bind(&heap_number);
3577
- __ sub(scratch1, input_reg, Operand(kHeapObjectTag));
3578
- __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset);
3579
-
3580
- __ EmitECMATruncate(input_reg,
3581
- double_scratch2,
3582
- single_scratch,
3583
- scratch1,
3584
- scratch2,
3585
- scratch3);
3586
-
3587
- } else {
3588
- CpuFeatures::Scope scope(VFP3);
3589
- // Deoptimize if we don't have a heap number.
3590
- DeoptimizeIf(ne, instr->environment());
3591
-
3592
- __ sub(ip, input_reg, Operand(kHeapObjectTag));
3593
- __ vldr(double_scratch, ip, HeapNumber::kValueOffset);
3594
- __ EmitVFPTruncate(kRoundToZero,
3595
- single_scratch,
3596
- double_scratch,
3597
- scratch1,
3598
- scratch2,
3599
- kCheckForInexactConversion);
3600
- DeoptimizeIf(ne, instr->environment());
3601
- // Load the result.
3602
- __ vmov(input_reg, single_scratch);
3603
-
3604
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3605
- __ cmp(input_reg, Operand(0));
3606
- __ b(ne, &done);
3607
- __ vmov(scratch1, double_scratch.high());
3608
- __ tst(scratch1, Operand(HeapNumber::kSignMask));
3609
- DeoptimizeIf(ne, instr->environment());
3610
- }
3611
- }
3612
- __ bind(&done);
3613
- }
3614
-
3615
-
3616
- void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3617
- LOperand* input = instr->InputAt(0);
3618
- ASSERT(input->IsRegister());
3619
- ASSERT(input->Equals(instr->result()));
3620
-
3621
- Register input_reg = ToRegister(input);
3622
-
3623
- DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3624
-
3625
- // Smi check.
3626
- __ tst(input_reg, Operand(kSmiTagMask));
3627
- __ b(ne, deferred->entry());
3628
-
3629
- // Smi to int32 conversion
3630
- __ SmiUntag(input_reg); // Untag smi.
3631
-
3632
- __ bind(deferred->exit());
3633
- }
3634
-
3635
-
3636
- void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3637
- LOperand* input = instr->InputAt(0);
3638
- ASSERT(input->IsRegister());
3639
- LOperand* result = instr->result();
3640
- ASSERT(result->IsDoubleRegister());
3641
-
3642
- Register input_reg = ToRegister(input);
3643
- DoubleRegister result_reg = ToDoubleRegister(result);
3644
-
3645
- EmitNumberUntagD(input_reg, result_reg, instr->environment());
3646
- }
3647
-
3648
-
3649
- void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3650
- Register result_reg = ToRegister(instr->result());
3651
- Register scratch1 = scratch0();
3652
- Register scratch2 = ToRegister(instr->TempAt(0));
3653
- DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0));
3654
- DwVfpRegister double_scratch = double_scratch0();
3655
- SwVfpRegister single_scratch = double_scratch0().low();
3656
-
3657
- Label done;
3658
-
3659
- if (instr->truncating()) {
3660
- Register scratch3 = ToRegister(instr->TempAt(1));
3661
- __ EmitECMATruncate(result_reg,
3662
- double_input,
3663
- single_scratch,
3664
- scratch1,
3665
- scratch2,
3666
- scratch3);
3667
- } else {
3668
- VFPRoundingMode rounding_mode = kRoundToMinusInf;
3669
- __ EmitVFPTruncate(rounding_mode,
3670
- single_scratch,
3671
- double_input,
3672
- scratch1,
3673
- scratch2,
3674
- kCheckForInexactConversion);
3675
- // Deoptimize if we had a vfp invalid exception,
3676
- // including inexact operation.
3677
- DeoptimizeIf(ne, instr->environment());
3678
- // Retrieve the result.
3679
- __ vmov(result_reg, single_scratch);
3680
- }
3681
- __ bind(&done);
3682
- }
3683
-
3684
-
3685
- void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
3686
- LOperand* input = instr->InputAt(0);
3687
- __ tst(ToRegister(input), Operand(kSmiTagMask));
3688
- DeoptimizeIf(ne, instr->environment());
3689
- }
3690
-
3691
-
3692
- void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
3693
- LOperand* input = instr->InputAt(0);
3694
- __ tst(ToRegister(input), Operand(kSmiTagMask));
3695
- DeoptimizeIf(eq, instr->environment());
3696
- }
3697
-
3698
-
3699
- void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3700
- Register input = ToRegister(instr->InputAt(0));
3701
- Register scratch = scratch0();
3702
- InstanceType first = instr->hydrogen()->first();
3703
- InstanceType last = instr->hydrogen()->last();
3704
-
3705
- __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
3706
- __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
3707
- __ cmp(scratch, Operand(first));
3708
-
3709
- // If there is only one type in the interval check for equality.
3710
- if (first == last) {
3711
- DeoptimizeIf(ne, instr->environment());
3712
- } else {
3713
- DeoptimizeIf(lo, instr->environment());
3714
- // Omit check for the last type.
3715
- if (last != LAST_TYPE) {
3716
- __ cmp(scratch, Operand(last));
3717
- DeoptimizeIf(hi, instr->environment());
3718
- }
3719
- }
3720
- }
3721
-
3722
-
3723
- void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3724
- ASSERT(instr->InputAt(0)->IsRegister());
3725
- Register reg = ToRegister(instr->InputAt(0));
3726
- __ cmp(reg, Operand(instr->hydrogen()->target()));
3727
- DeoptimizeIf(ne, instr->environment());
3728
- }
3729
-
3730
-
3731
- void LCodeGen::DoCheckMap(LCheckMap* instr) {
3732
- Register scratch = scratch0();
3733
- LOperand* input = instr->InputAt(0);
3734
- ASSERT(input->IsRegister());
3735
- Register reg = ToRegister(input);
3736
- __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
3737
- __ cmp(scratch, Operand(instr->hydrogen()->map()));
3738
- DeoptimizeIf(ne, instr->environment());
3739
- }
3740
-
3741
-
3742
- void LCodeGen::LoadHeapObject(Register result,
3743
- Handle<HeapObject> object) {
3744
- if (heap()->InNewSpace(*object)) {
3745
- Handle<JSGlobalPropertyCell> cell =
3746
- factory()->NewJSGlobalPropertyCell(object);
3747
- __ mov(result, Operand(cell));
3748
- __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset));
3749
- } else {
3750
- __ mov(result, Operand(object));
3751
- }
3752
- }
3753
-
3754
-
3755
- void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
3756
- Register temp1 = ToRegister(instr->TempAt(0));
3757
- Register temp2 = ToRegister(instr->TempAt(1));
3758
-
3759
- Handle<JSObject> holder = instr->holder();
3760
- Handle<JSObject> current_prototype = instr->prototype();
3761
-
3762
- // Load prototype object.
3763
- LoadHeapObject(temp1, current_prototype);
3764
-
3765
- // Check prototype maps up to the holder.
3766
- while (!current_prototype.is_identical_to(holder)) {
3767
- __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
3768
- __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
3769
- DeoptimizeIf(ne, instr->environment());
3770
- current_prototype =
3771
- Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
3772
- // Load next prototype object.
3773
- LoadHeapObject(temp1, current_prototype);
3774
- }
3775
-
3776
- // Check the holder map.
3777
- __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
3778
- __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
3779
- DeoptimizeIf(ne, instr->environment());
3780
- }
3781
-
3782
-
3783
- void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
3784
- __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3785
- __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
3786
- __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3787
- __ mov(r1, Operand(instr->hydrogen()->constant_elements()));
3788
- __ Push(r3, r2, r1);
3789
-
3790
- // Pick the right runtime function or stub to call.
3791
- int length = instr->hydrogen()->length();
3792
- if (instr->hydrogen()->IsCopyOnWrite()) {
3793
- ASSERT(instr->hydrogen()->depth() == 1);
3794
- FastCloneShallowArrayStub::Mode mode =
3795
- FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS;
3796
- FastCloneShallowArrayStub stub(mode, length);
3797
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3798
- } else if (instr->hydrogen()->depth() > 1) {
3799
- CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
3800
- } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
3801
- CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
3802
- } else {
3803
- FastCloneShallowArrayStub::Mode mode =
3804
- FastCloneShallowArrayStub::CLONE_ELEMENTS;
3805
- FastCloneShallowArrayStub stub(mode, length);
3806
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3807
- }
3808
- }
3809
-
3810
-
3811
- void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
3812
- __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3813
- __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
3814
- __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3815
- __ mov(r2, Operand(instr->hydrogen()->constant_properties()));
3816
- __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0)));
3817
- __ Push(r4, r3, r2, r1);
3818
-
3819
- // Pick the right runtime function to call.
3820
- if (instr->hydrogen()->depth() > 1) {
3821
- CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
3822
- } else {
3823
- CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
3824
- }
3825
- }
3826
-
3827
-
3828
- void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
3829
- ASSERT(ToRegister(instr->InputAt(0)).is(r0));
3830
- __ push(r0);
3831
- CallRuntime(Runtime::kToFastProperties, 1, instr);
3832
- }
3833
-
3834
-
3835
- void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
3836
- Label materialized;
3837
- // Registers will be used as follows:
3838
- // r3 = JS function.
3839
- // r7 = literals array.
3840
- // r1 = regexp literal.
3841
- // r0 = regexp literal clone.
3842
- // r2 and r4-r6 are used as temporaries.
3843
- __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3844
- __ ldr(r7, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
3845
- int literal_offset = FixedArray::kHeaderSize +
3846
- instr->hydrogen()->literal_index() * kPointerSize;
3847
- __ ldr(r1, FieldMemOperand(r7, literal_offset));
3848
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3849
- __ cmp(r1, ip);
3850
- __ b(ne, &materialized);
3851
-
3852
- // Create regexp literal using runtime function
3853
- // Result will be in r0.
3854
- __ mov(r6, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3855
- __ mov(r5, Operand(instr->hydrogen()->pattern()));
3856
- __ mov(r4, Operand(instr->hydrogen()->flags()));
3857
- __ Push(r7, r6, r5, r4);
3858
- CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
3859
- __ mov(r1, r0);
3860
-
3861
- __ bind(&materialized);
3862
- int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
3863
- Label allocated, runtime_allocate;
3864
-
3865
- __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT);
3866
- __ jmp(&allocated);
3867
-
3868
- __ bind(&runtime_allocate);
3869
- __ mov(r0, Operand(Smi::FromInt(size)));
3870
- __ Push(r1, r0);
3871
- CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
3872
- __ pop(r1);
3873
-
3874
- __ bind(&allocated);
3875
- // Copy the content into the newly allocated memory.
3876
- // (Unroll copy loop once for better throughput).
3877
- for (int i = 0; i < size - kPointerSize; i += 2 * kPointerSize) {
3878
- __ ldr(r3, FieldMemOperand(r1, i));
3879
- __ ldr(r2, FieldMemOperand(r1, i + kPointerSize));
3880
- __ str(r3, FieldMemOperand(r0, i));
3881
- __ str(r2, FieldMemOperand(r0, i + kPointerSize));
3882
- }
3883
- if ((size % (2 * kPointerSize)) != 0) {
3884
- __ ldr(r3, FieldMemOperand(r1, size - kPointerSize));
3885
- __ str(r3, FieldMemOperand(r0, size - kPointerSize));
3886
- }
3887
- }
3888
-
3889
-
3890
- void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
3891
- // Use the fast case closure allocation code that allocates in new
3892
- // space for nested functions that don't need literals cloning.
3893
- Handle<SharedFunctionInfo> shared_info = instr->shared_info();
3894
- bool pretenure = instr->hydrogen()->pretenure();
3895
- if (!pretenure && shared_info->num_literals() == 0) {
3896
- FastNewClosureStub stub(
3897
- shared_info->strict_mode() ? kStrictMode : kNonStrictMode);
3898
- __ mov(r1, Operand(shared_info));
3899
- __ push(r1);
3900
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3901
- } else {
3902
- __ mov(r2, Operand(shared_info));
3903
- __ mov(r1, Operand(pretenure
3904
- ? factory()->true_value()
3905
- : factory()->false_value()));
3906
- __ Push(cp, r2, r1);
3907
- CallRuntime(Runtime::kNewClosure, 3, instr);
3908
- }
3909
- }
3910
-
3911
-
3912
- void LCodeGen::DoTypeof(LTypeof* instr) {
3913
- Register input = ToRegister(instr->InputAt(0));
3914
- __ push(input);
3915
- CallRuntime(Runtime::kTypeof, 1, instr);
3916
- }
3917
-
3918
-
3919
- void LCodeGen::DoTypeofIs(LTypeofIs* instr) {
3920
- Register input = ToRegister(instr->InputAt(0));
3921
- Register result = ToRegister(instr->result());
3922
- Label true_label;
3923
- Label false_label;
3924
- Label done;
3925
-
3926
- Condition final_branch_condition = EmitTypeofIs(&true_label,
3927
- &false_label,
3928
- input,
3929
- instr->type_literal());
3930
- __ b(final_branch_condition, &true_label);
3931
- __ bind(&false_label);
3932
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
3933
- __ b(&done);
3934
-
3935
- __ bind(&true_label);
3936
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
3937
-
3938
- __ bind(&done);
3939
- }
3940
-
3941
-
3942
- void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
3943
- Register input = ToRegister(instr->InputAt(0));
3944
- int true_block = chunk_->LookupDestination(instr->true_block_id());
3945
- int false_block = chunk_->LookupDestination(instr->false_block_id());
3946
- Label* true_label = chunk_->GetAssemblyLabel(true_block);
3947
- Label* false_label = chunk_->GetAssemblyLabel(false_block);
3948
-
3949
- Condition final_branch_condition = EmitTypeofIs(true_label,
3950
- false_label,
3951
- input,
3952
- instr->type_literal());
3953
-
3954
- EmitBranch(true_block, false_block, final_branch_condition);
3955
- }
3956
-
3957
-
3958
- Condition LCodeGen::EmitTypeofIs(Label* true_label,
3959
- Label* false_label,
3960
- Register input,
3961
- Handle<String> type_name) {
3962
- Condition final_branch_condition = kNoCondition;
3963
- Register scratch = scratch0();
3964
- if (type_name->Equals(heap()->number_symbol())) {
3965
- __ JumpIfSmi(input, true_label);
3966
- __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
3967
- __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3968
- __ cmp(input, Operand(ip));
3969
- final_branch_condition = eq;
3970
-
3971
- } else if (type_name->Equals(heap()->string_symbol())) {
3972
- __ JumpIfSmi(input, false_label);
3973
- __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE);
3974
- __ b(ge, false_label);
3975
- __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
3976
- __ tst(ip, Operand(1 << Map::kIsUndetectable));
3977
- final_branch_condition = eq;
3978
-
3979
- } else if (type_name->Equals(heap()->boolean_symbol())) {
3980
- __ CompareRoot(input, Heap::kTrueValueRootIndex);
3981
- __ b(eq, true_label);
3982
- __ CompareRoot(input, Heap::kFalseValueRootIndex);
3983
- final_branch_condition = eq;
3984
-
3985
- } else if (type_name->Equals(heap()->undefined_symbol())) {
3986
- __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
3987
- __ b(eq, true_label);
3988
- __ JumpIfSmi(input, false_label);
3989
- // Check for undetectable objects => true.
3990
- __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
3991
- __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
3992
- __ tst(ip, Operand(1 << Map::kIsUndetectable));
3993
- final_branch_condition = ne;
3994
-
3995
- } else if (type_name->Equals(heap()->function_symbol())) {
3996
- __ JumpIfSmi(input, false_label);
3997
- __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE);
3998
- final_branch_condition = ge;
3999
-
4000
- } else if (type_name->Equals(heap()->object_symbol())) {
4001
- __ JumpIfSmi(input, false_label);
4002
- __ CompareRoot(input, Heap::kNullValueRootIndex);
4003
- __ b(eq, true_label);
4004
- __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE);
4005
- __ b(lo, false_label);
4006
- __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE);
4007
- __ b(hs, false_label);
4008
- // Check for undetectable objects => false.
4009
- __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4010
- __ tst(ip, Operand(1 << Map::kIsUndetectable));
4011
- final_branch_condition = eq;
4012
-
4013
- } else {
4014
- final_branch_condition = ne;
4015
- __ b(false_label);
4016
- // A dead branch instruction will be generated after this point.
4017
- }
4018
-
4019
- return final_branch_condition;
4020
- }
4021
-
4022
-
4023
- void LCodeGen::DoIsConstructCall(LIsConstructCall* instr) {
4024
- Register result = ToRegister(instr->result());
4025
- Label true_label;
4026
- Label false_label;
4027
- Label done;
4028
-
4029
- EmitIsConstructCall(result, scratch0());
4030
- __ b(eq, &true_label);
4031
-
4032
- __ LoadRoot(result, Heap::kFalseValueRootIndex);
4033
- __ b(&done);
4034
-
4035
-
4036
- __ bind(&true_label);
4037
- __ LoadRoot(result, Heap::kTrueValueRootIndex);
4038
-
4039
- __ bind(&done);
4040
- }
4041
-
4042
-
4043
- void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
4044
- Register temp1 = ToRegister(instr->TempAt(0));
4045
- int true_block = chunk_->LookupDestination(instr->true_block_id());
4046
- int false_block = chunk_->LookupDestination(instr->false_block_id());
4047
-
4048
- EmitIsConstructCall(temp1, scratch0());
4049
- EmitBranch(true_block, false_block, eq);
4050
- }
4051
-
4052
-
4053
- void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) {
4054
- ASSERT(!temp1.is(temp2));
4055
- // Get the frame pointer for the calling frame.
4056
- __ ldr(temp1, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4057
-
4058
- // Skip the arguments adaptor frame if it exists.
4059
- Label check_frame_marker;
4060
- __ ldr(temp2, MemOperand(temp1, StandardFrameConstants::kContextOffset));
4061
- __ cmp(temp2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4062
- __ b(ne, &check_frame_marker);
4063
- __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kCallerFPOffset));
4064
-
4065
- // Check the marker in the calling frame.
4066
- __ bind(&check_frame_marker);
4067
- __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kMarkerOffset));
4068
- __ cmp(temp1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
4069
- }
4070
-
4071
-
4072
- void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
4073
- // No code for lazy bailout instruction. Used to capture environment after a
4074
- // call for populating the safepoint data with deoptimization data.
4075
- }
4076
-
4077
-
4078
- void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
4079
- DeoptimizeIf(al, instr->environment());
4080
- }
4081
-
4082
-
4083
- void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
4084
- Register object = ToRegister(instr->object());
4085
- Register key = ToRegister(instr->key());
4086
- Register strict = scratch0();
4087
- __ mov(strict, Operand(Smi::FromInt(strict_mode_flag())));
4088
- __ Push(object, key, strict);
4089
- ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4090
- LPointerMap* pointers = instr->pointer_map();
4091
- LEnvironment* env = instr->deoptimization_environment();
4092
- RecordPosition(pointers->position());
4093
- RegisterEnvironmentForDeoptimization(env);
4094
- SafepointGenerator safepoint_generator(this,
4095
- pointers,
4096
- env->deoptimization_index());
4097
- __ InvokeBuiltin(Builtins::DELETE, CALL_JS, &safepoint_generator);
4098
- }
4099
-
4100
-
4101
- void LCodeGen::DoStackCheck(LStackCheck* instr) {
4102
- // Perform stack overflow check.
4103
- Label ok;
4104
- __ LoadRoot(ip, Heap::kStackLimitRootIndex);
4105
- __ cmp(sp, Operand(ip));
4106
- __ b(hs, &ok);
4107
- StackCheckStub stub;
4108
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4109
- __ bind(&ok);
4110
- }
4111
-
4112
-
4113
- void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4114
- // This is a pseudo-instruction that ensures that the environment here is
4115
- // properly registered for deoptimization and records the assembler's PC
4116
- // offset.
4117
- LEnvironment* environment = instr->environment();
4118
- environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4119
- instr->SpilledDoubleRegisterArray());
4120
-
4121
- // If the environment were already registered, we would have no way of
4122
- // backpatching it with the spill slot operands.
4123
- ASSERT(!environment->HasBeenRegistered());
4124
- RegisterEnvironmentForDeoptimization(environment);
4125
- ASSERT(osr_pc_offset_ == -1);
4126
- osr_pc_offset_ = masm()->pc_offset();
4127
- }
4128
-
4129
-
4130
- #undef __
4131
-
4132
- } } // namespace v8::internal