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,3288 +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 <stdlib.h>
29
- #include <math.h>
30
- #include <cstdarg>
31
- #include "v8.h"
32
-
33
- #if defined(V8_TARGET_ARCH_ARM)
34
-
35
- #include "disasm.h"
36
- #include "assembler.h"
37
- #include "arm/constants-arm.h"
38
- #include "arm/simulator-arm.h"
39
-
40
- #if defined(USE_SIMULATOR)
41
-
42
- // Only build the simulator if not compiling for real ARM hardware.
43
- namespace v8 {
44
- namespace internal {
45
-
46
- // This macro provides a platform independent use of sscanf. The reason for
47
- // SScanF not being implemented in a platform independent way through
48
- // ::v8::internal::OS in the same way as SNPrintF is that the
49
- // Windows C Run-Time Library does not provide vsscanf.
50
- #define SScanF sscanf // NOLINT
51
-
52
- // The ArmDebugger class is used by the simulator while debugging simulated ARM
53
- // code.
54
- class ArmDebugger {
55
- public:
56
- explicit ArmDebugger(Simulator* sim);
57
- ~ArmDebugger();
58
-
59
- void Stop(Instruction* instr);
60
- void Debug();
61
-
62
- private:
63
- static const Instr kBreakpointInstr =
64
- (al | (7*B25) | (1*B24) | kBreakpoint);
65
- static const Instr kNopInstr = (al | (13*B21));
66
-
67
- Simulator* sim_;
68
-
69
- int32_t GetRegisterValue(int regnum);
70
- double GetVFPDoubleRegisterValue(int regnum);
71
- bool GetValue(const char* desc, int32_t* value);
72
- bool GetVFPSingleValue(const char* desc, float* value);
73
- bool GetVFPDoubleValue(const char* desc, double* value);
74
-
75
- // Set or delete a breakpoint. Returns true if successful.
76
- bool SetBreakpoint(Instruction* breakpc);
77
- bool DeleteBreakpoint(Instruction* breakpc);
78
-
79
- // Undo and redo all breakpoints. This is needed to bracket disassembly and
80
- // execution to skip past breakpoints when run from the debugger.
81
- void UndoBreakpoints();
82
- void RedoBreakpoints();
83
- };
84
-
85
-
86
- ArmDebugger::ArmDebugger(Simulator* sim) {
87
- sim_ = sim;
88
- }
89
-
90
-
91
- ArmDebugger::~ArmDebugger() {
92
- }
93
-
94
-
95
-
96
- #ifdef GENERATED_CODE_COVERAGE
97
- static FILE* coverage_log = NULL;
98
-
99
-
100
- static void InitializeCoverage() {
101
- char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG");
102
- if (file_name != NULL) {
103
- coverage_log = fopen(file_name, "aw+");
104
- }
105
- }
106
-
107
-
108
- void ArmDebugger::Stop(Instruction* instr) {
109
- // Get the stop code.
110
- uint32_t code = instr->SvcValue() & kStopCodeMask;
111
- // Retrieve the encoded address, which comes just after this stop.
112
- char** msg_address =
113
- reinterpret_cast<char**>(sim_->get_pc() + Instruction::kInstrSize);
114
- char* msg = *msg_address;
115
- ASSERT(msg != NULL);
116
-
117
- // Update this stop description.
118
- if (isWatchedStop(code) && !watched_stops[code].desc) {
119
- watched_stops[code].desc = msg;
120
- }
121
-
122
- if (strlen(msg) > 0) {
123
- if (coverage_log != NULL) {
124
- fprintf(coverage_log, "%s\n", msg);
125
- fflush(coverage_log);
126
- }
127
- // Overwrite the instruction and address with nops.
128
- instr->SetInstructionBits(kNopInstr);
129
- reinterpret_cast<Instruction*>(msg_address)->SetInstructionBits(kNopInstr);
130
- }
131
- sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize);
132
- }
133
-
134
- #else // ndef GENERATED_CODE_COVERAGE
135
-
136
- static void InitializeCoverage() {
137
- }
138
-
139
-
140
- void ArmDebugger::Stop(Instruction* instr) {
141
- // Get the stop code.
142
- uint32_t code = instr->SvcValue() & kStopCodeMask;
143
- // Retrieve the encoded address, which comes just after this stop.
144
- char* msg = *reinterpret_cast<char**>(sim_->get_pc()
145
- + Instruction::kInstrSize);
146
- // Update this stop description.
147
- if (sim_->isWatchedStop(code) && !sim_->watched_stops[code].desc) {
148
- sim_->watched_stops[code].desc = msg;
149
- }
150
- // Print the stop message and code if it is not the default code.
151
- if (code != kMaxStopCode) {
152
- PrintF("Simulator hit stop %u: %s\n", code, msg);
153
- } else {
154
- PrintF("Simulator hit %s\n", msg);
155
- }
156
- sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize);
157
- Debug();
158
- }
159
- #endif
160
-
161
-
162
- int32_t ArmDebugger::GetRegisterValue(int regnum) {
163
- if (regnum == kPCRegister) {
164
- return sim_->get_pc();
165
- } else {
166
- return sim_->get_register(regnum);
167
- }
168
- }
169
-
170
-
171
- double ArmDebugger::GetVFPDoubleRegisterValue(int regnum) {
172
- return sim_->get_double_from_d_register(regnum);
173
- }
174
-
175
-
176
- bool ArmDebugger::GetValue(const char* desc, int32_t* value) {
177
- int regnum = Registers::Number(desc);
178
- if (regnum != kNoRegister) {
179
- *value = GetRegisterValue(regnum);
180
- return true;
181
- } else {
182
- if (strncmp(desc, "0x", 2) == 0) {
183
- return SScanF(desc + 2, "%x", reinterpret_cast<uint32_t*>(value)) == 1;
184
- } else {
185
- return SScanF(desc, "%u", reinterpret_cast<uint32_t*>(value)) == 1;
186
- }
187
- }
188
- return false;
189
- }
190
-
191
-
192
- bool ArmDebugger::GetVFPSingleValue(const char* desc, float* value) {
193
- bool is_double;
194
- int regnum = VFPRegisters::Number(desc, &is_double);
195
- if (regnum != kNoRegister && !is_double) {
196
- *value = sim_->get_float_from_s_register(regnum);
197
- return true;
198
- }
199
- return false;
200
- }
201
-
202
-
203
- bool ArmDebugger::GetVFPDoubleValue(const char* desc, double* value) {
204
- bool is_double;
205
- int regnum = VFPRegisters::Number(desc, &is_double);
206
- if (regnum != kNoRegister && is_double) {
207
- *value = sim_->get_double_from_d_register(regnum);
208
- return true;
209
- }
210
- return false;
211
- }
212
-
213
-
214
- bool ArmDebugger::SetBreakpoint(Instruction* breakpc) {
215
- // Check if a breakpoint can be set. If not return without any side-effects.
216
- if (sim_->break_pc_ != NULL) {
217
- return false;
218
- }
219
-
220
- // Set the breakpoint.
221
- sim_->break_pc_ = breakpc;
222
- sim_->break_instr_ = breakpc->InstructionBits();
223
- // Not setting the breakpoint instruction in the code itself. It will be set
224
- // when the debugger shell continues.
225
- return true;
226
- }
227
-
228
-
229
- bool ArmDebugger::DeleteBreakpoint(Instruction* breakpc) {
230
- if (sim_->break_pc_ != NULL) {
231
- sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
232
- }
233
-
234
- sim_->break_pc_ = NULL;
235
- sim_->break_instr_ = 0;
236
- return true;
237
- }
238
-
239
-
240
- void ArmDebugger::UndoBreakpoints() {
241
- if (sim_->break_pc_ != NULL) {
242
- sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
243
- }
244
- }
245
-
246
-
247
- void ArmDebugger::RedoBreakpoints() {
248
- if (sim_->break_pc_ != NULL) {
249
- sim_->break_pc_->SetInstructionBits(kBreakpointInstr);
250
- }
251
- }
252
-
253
-
254
- void ArmDebugger::Debug() {
255
- intptr_t last_pc = -1;
256
- bool done = false;
257
-
258
- #define COMMAND_SIZE 63
259
- #define ARG_SIZE 255
260
-
261
- #define STR(a) #a
262
- #define XSTR(a) STR(a)
263
-
264
- char cmd[COMMAND_SIZE + 1];
265
- char arg1[ARG_SIZE + 1];
266
- char arg2[ARG_SIZE + 1];
267
- char* argv[3] = { cmd, arg1, arg2 };
268
-
269
- // make sure to have a proper terminating character if reaching the limit
270
- cmd[COMMAND_SIZE] = 0;
271
- arg1[ARG_SIZE] = 0;
272
- arg2[ARG_SIZE] = 0;
273
-
274
- // Undo all set breakpoints while running in the debugger shell. This will
275
- // make them invisible to all commands.
276
- UndoBreakpoints();
277
-
278
- while (!done) {
279
- if (last_pc != sim_->get_pc()) {
280
- disasm::NameConverter converter;
281
- disasm::Disassembler dasm(converter);
282
- // use a reasonably large buffer
283
- v8::internal::EmbeddedVector<char, 256> buffer;
284
- dasm.InstructionDecode(buffer,
285
- reinterpret_cast<byte*>(sim_->get_pc()));
286
- PrintF(" 0x%08x %s\n", sim_->get_pc(), buffer.start());
287
- last_pc = sim_->get_pc();
288
- }
289
- char* line = ReadLine("sim> ");
290
- if (line == NULL) {
291
- break;
292
- } else {
293
- // Use sscanf to parse the individual parts of the command line. At the
294
- // moment no command expects more than two parameters.
295
- int argc = SScanF(line,
296
- "%" XSTR(COMMAND_SIZE) "s "
297
- "%" XSTR(ARG_SIZE) "s "
298
- "%" XSTR(ARG_SIZE) "s",
299
- cmd, arg1, arg2);
300
- if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) {
301
- sim_->InstructionDecode(reinterpret_cast<Instruction*>(sim_->get_pc()));
302
- } else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
303
- // Execute the one instruction we broke at with breakpoints disabled.
304
- sim_->InstructionDecode(reinterpret_cast<Instruction*>(sim_->get_pc()));
305
- // Leave the debugger shell.
306
- done = true;
307
- } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
308
- if (argc == 2) {
309
- int32_t value;
310
- float svalue;
311
- double dvalue;
312
- if (strcmp(arg1, "all") == 0) {
313
- for (int i = 0; i < kNumRegisters; i++) {
314
- value = GetRegisterValue(i);
315
- PrintF("%3s: 0x%08x %10d\n", Registers::Name(i), value, value);
316
- }
317
- for (int i = 0; i < kNumVFPDoubleRegisters; i++) {
318
- dvalue = GetVFPDoubleRegisterValue(i);
319
- uint64_t as_words = BitCast<uint64_t>(dvalue);
320
- PrintF("%3s: %f 0x%08x %08x\n",
321
- VFPRegisters::Name(i, true),
322
- dvalue,
323
- static_cast<uint32_t>(as_words >> 32),
324
- static_cast<uint32_t>(as_words & 0xffffffff));
325
- }
326
- } else {
327
- if (GetValue(arg1, &value)) {
328
- PrintF("%s: 0x%08x %d \n", arg1, value, value);
329
- } else if (GetVFPSingleValue(arg1, &svalue)) {
330
- uint32_t as_word = BitCast<uint32_t>(svalue);
331
- PrintF("%s: %f 0x%08x\n", arg1, svalue, as_word);
332
- } else if (GetVFPDoubleValue(arg1, &dvalue)) {
333
- uint64_t as_words = BitCast<uint64_t>(dvalue);
334
- PrintF("%s: %f 0x%08x %08x\n",
335
- arg1,
336
- dvalue,
337
- static_cast<uint32_t>(as_words >> 32),
338
- static_cast<uint32_t>(as_words & 0xffffffff));
339
- } else {
340
- PrintF("%s unrecognized\n", arg1);
341
- }
342
- }
343
- } else {
344
- PrintF("print <register>\n");
345
- }
346
- } else if ((strcmp(cmd, "po") == 0)
347
- || (strcmp(cmd, "printobject") == 0)) {
348
- if (argc == 2) {
349
- int32_t value;
350
- if (GetValue(arg1, &value)) {
351
- Object* obj = reinterpret_cast<Object*>(value);
352
- PrintF("%s: \n", arg1);
353
- #ifdef DEBUG
354
- obj->PrintLn();
355
- #else
356
- obj->ShortPrint();
357
- PrintF("\n");
358
- #endif
359
- } else {
360
- PrintF("%s unrecognized\n", arg1);
361
- }
362
- } else {
363
- PrintF("printobject <value>\n");
364
- }
365
- } else if (strcmp(cmd, "stack") == 0 || strcmp(cmd, "mem") == 0) {
366
- int32_t* cur = NULL;
367
- int32_t* end = NULL;
368
- int next_arg = 1;
369
-
370
- if (strcmp(cmd, "stack") == 0) {
371
- cur = reinterpret_cast<int32_t*>(sim_->get_register(Simulator::sp));
372
- } else { // "mem"
373
- int32_t value;
374
- if (!GetValue(arg1, &value)) {
375
- PrintF("%s unrecognized\n", arg1);
376
- continue;
377
- }
378
- cur = reinterpret_cast<int32_t*>(value);
379
- next_arg++;
380
- }
381
-
382
- int32_t words;
383
- if (argc == next_arg) {
384
- words = 10;
385
- } else if (argc == next_arg + 1) {
386
- if (!GetValue(argv[next_arg], &words)) {
387
- words = 10;
388
- }
389
- }
390
- end = cur + words;
391
-
392
- while (cur < end) {
393
- PrintF(" 0x%08x: 0x%08x %10d",
394
- reinterpret_cast<intptr_t>(cur), *cur, *cur);
395
- HeapObject* obj = reinterpret_cast<HeapObject*>(*cur);
396
- int value = *cur;
397
- Heap* current_heap = v8::internal::Isolate::Current()->heap();
398
- if (current_heap->Contains(obj) || ((value & 1) == 0)) {
399
- PrintF(" (");
400
- if ((value & 1) == 0) {
401
- PrintF("smi %d", value / 2);
402
- } else {
403
- obj->ShortPrint();
404
- }
405
- PrintF(")");
406
- }
407
- PrintF("\n");
408
- cur++;
409
- }
410
- } else if (strcmp(cmd, "disasm") == 0 || strcmp(cmd, "di") == 0) {
411
- disasm::NameConverter converter;
412
- disasm::Disassembler dasm(converter);
413
- // use a reasonably large buffer
414
- v8::internal::EmbeddedVector<char, 256> buffer;
415
-
416
- byte* prev = NULL;
417
- byte* cur = NULL;
418
- byte* end = NULL;
419
-
420
- if (argc == 1) {
421
- cur = reinterpret_cast<byte*>(sim_->get_pc());
422
- end = cur + (10 * Instruction::kInstrSize);
423
- } else if (argc == 2) {
424
- int regnum = Registers::Number(arg1);
425
- if (regnum != kNoRegister || strncmp(arg1, "0x", 2) == 0) {
426
- // The argument is an address or a register name.
427
- int32_t value;
428
- if (GetValue(arg1, &value)) {
429
- cur = reinterpret_cast<byte*>(value);
430
- // Disassemble 10 instructions at <arg1>.
431
- end = cur + (10 * Instruction::kInstrSize);
432
- }
433
- } else {
434
- // The argument is the number of instructions.
435
- int32_t value;
436
- if (GetValue(arg1, &value)) {
437
- cur = reinterpret_cast<byte*>(sim_->get_pc());
438
- // Disassemble <arg1> instructions.
439
- end = cur + (value * Instruction::kInstrSize);
440
- }
441
- }
442
- } else {
443
- int32_t value1;
444
- int32_t value2;
445
- if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
446
- cur = reinterpret_cast<byte*>(value1);
447
- end = cur + (value2 * Instruction::kInstrSize);
448
- }
449
- }
450
-
451
- while (cur < end) {
452
- prev = cur;
453
- cur += dasm.InstructionDecode(buffer, cur);
454
- PrintF(" 0x%08x %s\n",
455
- reinterpret_cast<intptr_t>(prev), buffer.start());
456
- }
457
- } else if (strcmp(cmd, "gdb") == 0) {
458
- PrintF("relinquishing control to gdb\n");
459
- v8::internal::OS::DebugBreak();
460
- PrintF("regaining control from gdb\n");
461
- } else if (strcmp(cmd, "break") == 0) {
462
- if (argc == 2) {
463
- int32_t value;
464
- if (GetValue(arg1, &value)) {
465
- if (!SetBreakpoint(reinterpret_cast<Instruction*>(value))) {
466
- PrintF("setting breakpoint failed\n");
467
- }
468
- } else {
469
- PrintF("%s unrecognized\n", arg1);
470
- }
471
- } else {
472
- PrintF("break <address>\n");
473
- }
474
- } else if (strcmp(cmd, "del") == 0) {
475
- if (!DeleteBreakpoint(NULL)) {
476
- PrintF("deleting breakpoint failed\n");
477
- }
478
- } else if (strcmp(cmd, "flags") == 0) {
479
- PrintF("N flag: %d; ", sim_->n_flag_);
480
- PrintF("Z flag: %d; ", sim_->z_flag_);
481
- PrintF("C flag: %d; ", sim_->c_flag_);
482
- PrintF("V flag: %d\n", sim_->v_flag_);
483
- PrintF("INVALID OP flag: %d; ", sim_->inv_op_vfp_flag_);
484
- PrintF("DIV BY ZERO flag: %d; ", sim_->div_zero_vfp_flag_);
485
- PrintF("OVERFLOW flag: %d; ", sim_->overflow_vfp_flag_);
486
- PrintF("UNDERFLOW flag: %d; ", sim_->underflow_vfp_flag_);
487
- PrintF("INEXACT flag: %d;\n", sim_->inexact_vfp_flag_);
488
- } else if (strcmp(cmd, "stop") == 0) {
489
- int32_t value;
490
- intptr_t stop_pc = sim_->get_pc() - 2 * Instruction::kInstrSize;
491
- Instruction* stop_instr = reinterpret_cast<Instruction*>(stop_pc);
492
- Instruction* msg_address =
493
- reinterpret_cast<Instruction*>(stop_pc + Instruction::kInstrSize);
494
- if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) {
495
- // Remove the current stop.
496
- if (sim_->isStopInstruction(stop_instr)) {
497
- stop_instr->SetInstructionBits(kNopInstr);
498
- msg_address->SetInstructionBits(kNopInstr);
499
- } else {
500
- PrintF("Not at debugger stop.\n");
501
- }
502
- } else if (argc == 3) {
503
- // Print information about all/the specified breakpoint(s).
504
- if (strcmp(arg1, "info") == 0) {
505
- if (strcmp(arg2, "all") == 0) {
506
- PrintF("Stop information:\n");
507
- for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
508
- sim_->PrintStopInfo(i);
509
- }
510
- } else if (GetValue(arg2, &value)) {
511
- sim_->PrintStopInfo(value);
512
- } else {
513
- PrintF("Unrecognized argument.\n");
514
- }
515
- } else if (strcmp(arg1, "enable") == 0) {
516
- // Enable all/the specified breakpoint(s).
517
- if (strcmp(arg2, "all") == 0) {
518
- for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
519
- sim_->EnableStop(i);
520
- }
521
- } else if (GetValue(arg2, &value)) {
522
- sim_->EnableStop(value);
523
- } else {
524
- PrintF("Unrecognized argument.\n");
525
- }
526
- } else if (strcmp(arg1, "disable") == 0) {
527
- // Disable all/the specified breakpoint(s).
528
- if (strcmp(arg2, "all") == 0) {
529
- for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
530
- sim_->DisableStop(i);
531
- }
532
- } else if (GetValue(arg2, &value)) {
533
- sim_->DisableStop(value);
534
- } else {
535
- PrintF("Unrecognized argument.\n");
536
- }
537
- }
538
- } else {
539
- PrintF("Wrong usage. Use help command for more information.\n");
540
- }
541
- } else if ((strcmp(cmd, "t") == 0) || strcmp(cmd, "trace") == 0) {
542
- ::v8::internal::FLAG_trace_sim = !::v8::internal::FLAG_trace_sim;
543
- PrintF("Trace of executed instructions is %s\n",
544
- ::v8::internal::FLAG_trace_sim ? "on" : "off");
545
- } else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
546
- PrintF("cont\n");
547
- PrintF(" continue execution (alias 'c')\n");
548
- PrintF("stepi\n");
549
- PrintF(" step one instruction (alias 'si')\n");
550
- PrintF("print <register>\n");
551
- PrintF(" print register content (alias 'p')\n");
552
- PrintF(" use register name 'all' to print all registers\n");
553
- PrintF("printobject <register>\n");
554
- PrintF(" print an object from a register (alias 'po')\n");
555
- PrintF("flags\n");
556
- PrintF(" print flags\n");
557
- PrintF("stack [<words>]\n");
558
- PrintF(" dump stack content, default dump 10 words)\n");
559
- PrintF("mem <address> [<words>]\n");
560
- PrintF(" dump memory content, default dump 10 words)\n");
561
- PrintF("disasm [<instructions>]\n");
562
- PrintF("disasm [<address/register>]\n");
563
- PrintF("disasm [[<address/register>] <instructions>]\n");
564
- PrintF(" disassemble code, default is 10 instructions\n");
565
- PrintF(" from pc (alias 'di')\n");
566
- PrintF("gdb\n");
567
- PrintF(" enter gdb\n");
568
- PrintF("break <address>\n");
569
- PrintF(" set a break point on the address\n");
570
- PrintF("del\n");
571
- PrintF(" delete the breakpoint\n");
572
- PrintF("trace (alias 't')\n");
573
- PrintF(" toogle the tracing of all executed statements\n");
574
- PrintF("stop feature:\n");
575
- PrintF(" Description:\n");
576
- PrintF(" Stops are debug instructions inserted by\n");
577
- PrintF(" the Assembler::stop() function.\n");
578
- PrintF(" When hitting a stop, the Simulator will\n");
579
- PrintF(" stop and and give control to the ArmDebugger.\n");
580
- PrintF(" The first %d stop codes are watched:\n",
581
- Simulator::kNumOfWatchedStops);
582
- PrintF(" - They can be enabled / disabled: the Simulator\n");
583
- PrintF(" will / won't stop when hitting them.\n");
584
- PrintF(" - The Simulator keeps track of how many times they \n");
585
- PrintF(" are met. (See the info command.) Going over a\n");
586
- PrintF(" disabled stop still increases its counter. \n");
587
- PrintF(" Commands:\n");
588
- PrintF(" stop info all/<code> : print infos about number <code>\n");
589
- PrintF(" or all stop(s).\n");
590
- PrintF(" stop enable/disable all/<code> : enables / disables\n");
591
- PrintF(" all or number <code> stop(s)\n");
592
- PrintF(" stop unstop\n");
593
- PrintF(" ignore the stop instruction at the current location\n");
594
- PrintF(" from now on\n");
595
- } else {
596
- PrintF("Unknown command: %s\n", cmd);
597
- }
598
- }
599
- DeleteArray(line);
600
- }
601
-
602
- // Add all the breakpoints back to stop execution and enter the debugger
603
- // shell when hit.
604
- RedoBreakpoints();
605
-
606
- #undef COMMAND_SIZE
607
- #undef ARG_SIZE
608
-
609
- #undef STR
610
- #undef XSTR
611
- }
612
-
613
-
614
- static bool ICacheMatch(void* one, void* two) {
615
- ASSERT((reinterpret_cast<intptr_t>(one) & CachePage::kPageMask) == 0);
616
- ASSERT((reinterpret_cast<intptr_t>(two) & CachePage::kPageMask) == 0);
617
- return one == two;
618
- }
619
-
620
-
621
- static uint32_t ICacheHash(void* key) {
622
- return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)) >> 2;
623
- }
624
-
625
-
626
- static bool AllOnOnePage(uintptr_t start, int size) {
627
- intptr_t start_page = (start & ~CachePage::kPageMask);
628
- intptr_t end_page = ((start + size) & ~CachePage::kPageMask);
629
- return start_page == end_page;
630
- }
631
-
632
-
633
- void Simulator::FlushICache(v8::internal::HashMap* i_cache,
634
- void* start_addr,
635
- size_t size) {
636
- intptr_t start = reinterpret_cast<intptr_t>(start_addr);
637
- int intra_line = (start & CachePage::kLineMask);
638
- start -= intra_line;
639
- size += intra_line;
640
- size = ((size - 1) | CachePage::kLineMask) + 1;
641
- int offset = (start & CachePage::kPageMask);
642
- while (!AllOnOnePage(start, size - 1)) {
643
- int bytes_to_flush = CachePage::kPageSize - offset;
644
- FlushOnePage(i_cache, start, bytes_to_flush);
645
- start += bytes_to_flush;
646
- size -= bytes_to_flush;
647
- ASSERT_EQ(0, start & CachePage::kPageMask);
648
- offset = 0;
649
- }
650
- if (size != 0) {
651
- FlushOnePage(i_cache, start, size);
652
- }
653
- }
654
-
655
-
656
- CachePage* Simulator::GetCachePage(v8::internal::HashMap* i_cache, void* page) {
657
- v8::internal::HashMap::Entry* entry = i_cache->Lookup(page,
658
- ICacheHash(page),
659
- true);
660
- if (entry->value == NULL) {
661
- CachePage* new_page = new CachePage();
662
- entry->value = new_page;
663
- }
664
- return reinterpret_cast<CachePage*>(entry->value);
665
- }
666
-
667
-
668
- // Flush from start up to and not including start + size.
669
- void Simulator::FlushOnePage(v8::internal::HashMap* i_cache,
670
- intptr_t start,
671
- int size) {
672
- ASSERT(size <= CachePage::kPageSize);
673
- ASSERT(AllOnOnePage(start, size - 1));
674
- ASSERT((start & CachePage::kLineMask) == 0);
675
- ASSERT((size & CachePage::kLineMask) == 0);
676
- void* page = reinterpret_cast<void*>(start & (~CachePage::kPageMask));
677
- int offset = (start & CachePage::kPageMask);
678
- CachePage* cache_page = GetCachePage(i_cache, page);
679
- char* valid_bytemap = cache_page->ValidityByte(offset);
680
- memset(valid_bytemap, CachePage::LINE_INVALID, size >> CachePage::kLineShift);
681
- }
682
-
683
-
684
- void Simulator::CheckICache(v8::internal::HashMap* i_cache,
685
- Instruction* instr) {
686
- intptr_t address = reinterpret_cast<intptr_t>(instr);
687
- void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask));
688
- void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask));
689
- int offset = (address & CachePage::kPageMask);
690
- CachePage* cache_page = GetCachePage(i_cache, page);
691
- char* cache_valid_byte = cache_page->ValidityByte(offset);
692
- bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID);
693
- char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask);
694
- if (cache_hit) {
695
- // Check that the data in memory matches the contents of the I-cache.
696
- CHECK(memcmp(reinterpret_cast<void*>(instr),
697
- cache_page->CachedData(offset),
698
- Instruction::kInstrSize) == 0);
699
- } else {
700
- // Cache miss. Load memory into the cache.
701
- memcpy(cached_line, line, CachePage::kLineLength);
702
- *cache_valid_byte = CachePage::LINE_VALID;
703
- }
704
- }
705
-
706
-
707
- void Simulator::Initialize() {
708
- if (Isolate::Current()->simulator_initialized()) return;
709
- Isolate::Current()->set_simulator_initialized(true);
710
- ::v8::internal::ExternalReference::set_redirector(&RedirectExternalReference);
711
- }
712
-
713
-
714
- Simulator::Simulator() : isolate_(Isolate::Current()) {
715
- i_cache_ = isolate_->simulator_i_cache();
716
- if (i_cache_ == NULL) {
717
- i_cache_ = new v8::internal::HashMap(&ICacheMatch);
718
- isolate_->set_simulator_i_cache(i_cache_);
719
- }
720
- Initialize();
721
- // Setup simulator support first. Some of this information is needed to
722
- // setup the architecture state.
723
- size_t stack_size = 1 * 1024*1024; // allocate 1MB for stack
724
- stack_ = reinterpret_cast<char*>(malloc(stack_size));
725
- pc_modified_ = false;
726
- icount_ = 0;
727
- break_pc_ = NULL;
728
- break_instr_ = 0;
729
-
730
- // Setup architecture state.
731
- // All registers are initialized to zero to start with.
732
- for (int i = 0; i < num_registers; i++) {
733
- registers_[i] = 0;
734
- }
735
- n_flag_ = false;
736
- z_flag_ = false;
737
- c_flag_ = false;
738
- v_flag_ = false;
739
-
740
- // Initializing VFP registers.
741
- // All registers are initialized to zero to start with
742
- // even though s_registers_ & d_registers_ share the same
743
- // physical registers in the target.
744
- for (int i = 0; i < num_s_registers; i++) {
745
- vfp_register[i] = 0;
746
- }
747
- n_flag_FPSCR_ = false;
748
- z_flag_FPSCR_ = false;
749
- c_flag_FPSCR_ = false;
750
- v_flag_FPSCR_ = false;
751
- FPSCR_rounding_mode_ = RZ;
752
-
753
- inv_op_vfp_flag_ = false;
754
- div_zero_vfp_flag_ = false;
755
- overflow_vfp_flag_ = false;
756
- underflow_vfp_flag_ = false;
757
- inexact_vfp_flag_ = false;
758
-
759
- // The sp is initialized to point to the bottom (high address) of the
760
- // allocated stack area. To be safe in potential stack underflows we leave
761
- // some buffer below.
762
- registers_[sp] = reinterpret_cast<int32_t>(stack_) + stack_size - 64;
763
- // The lr and pc are initialized to a known bad value that will cause an
764
- // access violation if the simulator ever tries to execute it.
765
- registers_[pc] = bad_lr;
766
- registers_[lr] = bad_lr;
767
- InitializeCoverage();
768
- }
769
-
770
-
771
- // When the generated code calls an external reference we need to catch that in
772
- // the simulator. The external reference will be a function compiled for the
773
- // host architecture. We need to call that function instead of trying to
774
- // execute it with the simulator. We do that by redirecting the external
775
- // reference to a svc (Supervisor Call) instruction that is handled by
776
- // the simulator. We write the original destination of the jump just at a known
777
- // offset from the svc instruction so the simulator knows what to call.
778
- class Redirection {
779
- public:
780
- Redirection(void* external_function, ExternalReference::Type type)
781
- : external_function_(external_function),
782
- swi_instruction_(al | (0xf*B24) | kCallRtRedirected),
783
- type_(type),
784
- next_(NULL) {
785
- Isolate* isolate = Isolate::Current();
786
- next_ = isolate->simulator_redirection();
787
- Simulator::current(isolate)->
788
- FlushICache(isolate->simulator_i_cache(),
789
- reinterpret_cast<void*>(&swi_instruction_),
790
- Instruction::kInstrSize);
791
- isolate->set_simulator_redirection(this);
792
- }
793
-
794
- void* address_of_swi_instruction() {
795
- return reinterpret_cast<void*>(&swi_instruction_);
796
- }
797
-
798
- void* external_function() { return external_function_; }
799
- ExternalReference::Type type() { return type_; }
800
-
801
- static Redirection* Get(void* external_function,
802
- ExternalReference::Type type) {
803
- Isolate* isolate = Isolate::Current();
804
- Redirection* current = isolate->simulator_redirection();
805
- for (; current != NULL; current = current->next_) {
806
- if (current->external_function_ == external_function) return current;
807
- }
808
- return new Redirection(external_function, type);
809
- }
810
-
811
- static Redirection* FromSwiInstruction(Instruction* swi_instruction) {
812
- char* addr_of_swi = reinterpret_cast<char*>(swi_instruction);
813
- char* addr_of_redirection =
814
- addr_of_swi - OFFSET_OF(Redirection, swi_instruction_);
815
- return reinterpret_cast<Redirection*>(addr_of_redirection);
816
- }
817
-
818
- private:
819
- void* external_function_;
820
- uint32_t swi_instruction_;
821
- ExternalReference::Type type_;
822
- Redirection* next_;
823
- };
824
-
825
-
826
- void* Simulator::RedirectExternalReference(void* external_function,
827
- ExternalReference::Type type) {
828
- Redirection* redirection = Redirection::Get(external_function, type);
829
- return redirection->address_of_swi_instruction();
830
- }
831
-
832
-
833
- // Get the active Simulator for the current thread.
834
- Simulator* Simulator::current(Isolate* isolate) {
835
- v8::internal::Isolate::PerIsolateThreadData* isolate_data =
836
- Isolate::CurrentPerIsolateThreadData();
837
- if (isolate_data == NULL) {
838
- Isolate::EnterDefaultIsolate();
839
- isolate_data = Isolate::CurrentPerIsolateThreadData();
840
- }
841
- ASSERT(isolate_data != NULL);
842
-
843
- Simulator* sim = isolate_data->simulator();
844
- if (sim == NULL) {
845
- // TODO(146): delete the simulator object when a thread/isolate goes away.
846
- sim = new Simulator();
847
- isolate_data->set_simulator(sim);
848
- }
849
- return sim;
850
- }
851
-
852
-
853
- // Sets the register in the architecture state. It will also deal with updating
854
- // Simulator internal state for special registers such as PC.
855
- void Simulator::set_register(int reg, int32_t value) {
856
- ASSERT((reg >= 0) && (reg < num_registers));
857
- if (reg == pc) {
858
- pc_modified_ = true;
859
- }
860
- registers_[reg] = value;
861
- }
862
-
863
-
864
- // Get the register from the architecture state. This function does handle
865
- // the special case of accessing the PC register.
866
- int32_t Simulator::get_register(int reg) const {
867
- ASSERT((reg >= 0) && (reg < num_registers));
868
- // Stupid code added to avoid bug in GCC.
869
- // See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43949
870
- if (reg >= num_registers) return 0;
871
- // End stupid code.
872
- return registers_[reg] + ((reg == pc) ? Instruction::kPCReadOffset : 0);
873
- }
874
-
875
-
876
- void Simulator::set_dw_register(int dreg, const int* dbl) {
877
- ASSERT((dreg >= 0) && (dreg < num_d_registers));
878
- registers_[dreg] = dbl[0];
879
- registers_[dreg + 1] = dbl[1];
880
- }
881
-
882
-
883
- // Raw access to the PC register.
884
- void Simulator::set_pc(int32_t value) {
885
- pc_modified_ = true;
886
- registers_[pc] = value;
887
- }
888
-
889
-
890
- bool Simulator::has_bad_pc() const {
891
- return ((registers_[pc] == bad_lr) || (registers_[pc] == end_sim_pc));
892
- }
893
-
894
-
895
- // Raw access to the PC register without the special adjustment when reading.
896
- int32_t Simulator::get_pc() const {
897
- return registers_[pc];
898
- }
899
-
900
-
901
- // Getting from and setting into VFP registers.
902
- void Simulator::set_s_register(int sreg, unsigned int value) {
903
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
904
- vfp_register[sreg] = value;
905
- }
906
-
907
-
908
- unsigned int Simulator::get_s_register(int sreg) const {
909
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
910
- return vfp_register[sreg];
911
- }
912
-
913
-
914
- void Simulator::set_s_register_from_float(int sreg, const float flt) {
915
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
916
- // Read the bits from the single precision floating point value
917
- // into the unsigned integer element of vfp_register[] given by index=sreg.
918
- char buffer[sizeof(vfp_register[0])];
919
- memcpy(buffer, &flt, sizeof(vfp_register[0]));
920
- memcpy(&vfp_register[sreg], buffer, sizeof(vfp_register[0]));
921
- }
922
-
923
-
924
- void Simulator::set_s_register_from_sinteger(int sreg, const int sint) {
925
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
926
- // Read the bits from the integer value into the unsigned integer element of
927
- // vfp_register[] given by index=sreg.
928
- char buffer[sizeof(vfp_register[0])];
929
- memcpy(buffer, &sint, sizeof(vfp_register[0]));
930
- memcpy(&vfp_register[sreg], buffer, sizeof(vfp_register[0]));
931
- }
932
-
933
-
934
- void Simulator::set_d_register_from_double(int dreg, const double& dbl) {
935
- ASSERT((dreg >= 0) && (dreg < num_d_registers));
936
- // Read the bits from the double precision floating point value into the two
937
- // consecutive unsigned integer elements of vfp_register[] given by index
938
- // 2*sreg and 2*sreg+1.
939
- char buffer[2 * sizeof(vfp_register[0])];
940
- memcpy(buffer, &dbl, 2 * sizeof(vfp_register[0]));
941
- #ifndef BIG_ENDIAN_FLOATING_POINT
942
- memcpy(&vfp_register[dreg * 2], buffer, 2 * sizeof(vfp_register[0]));
943
- #else
944
- memcpy(&vfp_register[dreg * 2], &buffer[4], sizeof(vfp_register[0]));
945
- memcpy(&vfp_register[dreg * 2 + 1], &buffer[0], sizeof(vfp_register[0]));
946
- #endif
947
- }
948
-
949
-
950
- float Simulator::get_float_from_s_register(int sreg) {
951
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
952
-
953
- float sm_val = 0.0;
954
- // Read the bits from the unsigned integer vfp_register[] array
955
- // into the single precision floating point value and return it.
956
- char buffer[sizeof(vfp_register[0])];
957
- memcpy(buffer, &vfp_register[sreg], sizeof(vfp_register[0]));
958
- memcpy(&sm_val, buffer, sizeof(vfp_register[0]));
959
- return(sm_val);
960
- }
961
-
962
-
963
- int Simulator::get_sinteger_from_s_register(int sreg) {
964
- ASSERT((sreg >= 0) && (sreg < num_s_registers));
965
-
966
- int sm_val = 0;
967
- // Read the bits from the unsigned integer vfp_register[] array
968
- // into the single precision floating point value and return it.
969
- char buffer[sizeof(vfp_register[0])];
970
- memcpy(buffer, &vfp_register[sreg], sizeof(vfp_register[0]));
971
- memcpy(&sm_val, buffer, sizeof(vfp_register[0]));
972
- return(sm_val);
973
- }
974
-
975
-
976
- double Simulator::get_double_from_d_register(int dreg) {
977
- ASSERT((dreg >= 0) && (dreg < num_d_registers));
978
-
979
- double dm_val = 0.0;
980
- // Read the bits from the unsigned integer vfp_register[] array
981
- // into the double precision floating point value and return it.
982
- char buffer[2 * sizeof(vfp_register[0])];
983
- #ifdef BIG_ENDIAN_FLOATING_POINT
984
- memcpy(&buffer[0], &vfp_register[2 * dreg + 1], sizeof(vfp_register[0]));
985
- memcpy(&buffer[4], &vfp_register[2 * dreg], sizeof(vfp_register[0]));
986
- #else
987
- memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0]));
988
- #endif
989
- memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0]));
990
- return(dm_val);
991
- }
992
-
993
-
994
- // For use in calls that take two double values, constructed from r0, r1, r2
995
- // and r3.
996
- void Simulator::GetFpArgs(double* x, double* y) {
997
- // We use a char buffer to get around the strict-aliasing rules which
998
- // otherwise allow the compiler to optimize away the copy.
999
- char buffer[2 * sizeof(registers_[0])];
1000
- // Registers 0 and 1 -> x.
1001
- memcpy(buffer, registers_, sizeof(buffer));
1002
- memcpy(x, buffer, sizeof(buffer));
1003
- // Registers 2 and 3 -> y.
1004
- memcpy(buffer, registers_ + 2, sizeof(buffer));
1005
- memcpy(y, buffer, sizeof(buffer));
1006
- }
1007
-
1008
-
1009
- void Simulator::SetFpResult(const double& result) {
1010
- char buffer[2 * sizeof(registers_[0])];
1011
- memcpy(buffer, &result, sizeof(buffer));
1012
- // result -> registers 0 and 1.
1013
- memcpy(registers_, buffer, sizeof(buffer));
1014
- }
1015
-
1016
-
1017
- void Simulator::TrashCallerSaveRegisters() {
1018
- // We don't trash the registers with the return value.
1019
- registers_[2] = 0x50Bad4U;
1020
- registers_[3] = 0x50Bad4U;
1021
- registers_[12] = 0x50Bad4U;
1022
- }
1023
-
1024
- // Some Operating Systems allow unaligned access on ARMv7 targets. We
1025
- // assume that unaligned accesses are not allowed unless the v8 build system
1026
- // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero.
1027
- // The following statements below describes the behavior of the ARM CPUs
1028
- // that don't support unaligned access.
1029
- // Some ARM platforms raise an interrupt on detecting unaligned access.
1030
- // On others it does a funky rotation thing. For now we
1031
- // simply disallow unaligned reads. Note that simulator runs have the runtime
1032
- // system running directly on the host system and only generated code is
1033
- // executed in the simulator. Since the host is typically IA32 we will not
1034
- // get the correct ARM-like behaviour on unaligned accesses for those ARM
1035
- // targets that don't support unaligned loads and stores.
1036
-
1037
-
1038
- int Simulator::ReadW(int32_t addr, Instruction* instr) {
1039
- #if V8_TARGET_CAN_READ_UNALIGNED
1040
- intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1041
- return *ptr;
1042
- #else
1043
- if ((addr & 3) == 0) {
1044
- intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1045
- return *ptr;
1046
- }
1047
- PrintF("Unaligned read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1048
- addr,
1049
- reinterpret_cast<intptr_t>(instr));
1050
- UNIMPLEMENTED();
1051
- return 0;
1052
- #endif
1053
- }
1054
-
1055
-
1056
- void Simulator::WriteW(int32_t addr, int value, Instruction* instr) {
1057
- #if V8_TARGET_CAN_READ_UNALIGNED
1058
- intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1059
- *ptr = value;
1060
- return;
1061
- #else
1062
- if ((addr & 3) == 0) {
1063
- intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1064
- *ptr = value;
1065
- return;
1066
- }
1067
- PrintF("Unaligned write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1068
- addr,
1069
- reinterpret_cast<intptr_t>(instr));
1070
- UNIMPLEMENTED();
1071
- #endif
1072
- }
1073
-
1074
-
1075
- uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) {
1076
- #if V8_TARGET_CAN_READ_UNALIGNED
1077
- uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1078
- return *ptr;
1079
- #else
1080
- if ((addr & 1) == 0) {
1081
- uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1082
- return *ptr;
1083
- }
1084
- PrintF("Unaligned unsigned halfword read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1085
- addr,
1086
- reinterpret_cast<intptr_t>(instr));
1087
- UNIMPLEMENTED();
1088
- return 0;
1089
- #endif
1090
- }
1091
-
1092
-
1093
- int16_t Simulator::ReadH(int32_t addr, Instruction* instr) {
1094
- #if V8_TARGET_CAN_READ_UNALIGNED
1095
- int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1096
- return *ptr;
1097
- #else
1098
- if ((addr & 1) == 0) {
1099
- int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1100
- return *ptr;
1101
- }
1102
- PrintF("Unaligned signed halfword read at 0x%08x\n", addr);
1103
- UNIMPLEMENTED();
1104
- return 0;
1105
- #endif
1106
- }
1107
-
1108
-
1109
- void Simulator::WriteH(int32_t addr, uint16_t value, Instruction* instr) {
1110
- #if V8_TARGET_CAN_READ_UNALIGNED
1111
- uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1112
- *ptr = value;
1113
- return;
1114
- #else
1115
- if ((addr & 1) == 0) {
1116
- uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1117
- *ptr = value;
1118
- return;
1119
- }
1120
- PrintF("Unaligned unsigned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1121
- addr,
1122
- reinterpret_cast<intptr_t>(instr));
1123
- UNIMPLEMENTED();
1124
- #endif
1125
- }
1126
-
1127
-
1128
- void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) {
1129
- #if V8_TARGET_CAN_READ_UNALIGNED
1130
- int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1131
- *ptr = value;
1132
- return;
1133
- #else
1134
- if ((addr & 1) == 0) {
1135
- int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1136
- *ptr = value;
1137
- return;
1138
- }
1139
- PrintF("Unaligned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1140
- addr,
1141
- reinterpret_cast<intptr_t>(instr));
1142
- UNIMPLEMENTED();
1143
- #endif
1144
- }
1145
-
1146
-
1147
- uint8_t Simulator::ReadBU(int32_t addr) {
1148
- uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
1149
- return *ptr;
1150
- }
1151
-
1152
-
1153
- int8_t Simulator::ReadB(int32_t addr) {
1154
- int8_t* ptr = reinterpret_cast<int8_t*>(addr);
1155
- return *ptr;
1156
- }
1157
-
1158
-
1159
- void Simulator::WriteB(int32_t addr, uint8_t value) {
1160
- uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
1161
- *ptr = value;
1162
- }
1163
-
1164
-
1165
- void Simulator::WriteB(int32_t addr, int8_t value) {
1166
- int8_t* ptr = reinterpret_cast<int8_t*>(addr);
1167
- *ptr = value;
1168
- }
1169
-
1170
-
1171
- int32_t* Simulator::ReadDW(int32_t addr) {
1172
- #if V8_TARGET_CAN_READ_UNALIGNED
1173
- int32_t* ptr = reinterpret_cast<int32_t*>(addr);
1174
- return ptr;
1175
- #else
1176
- if ((addr & 3) == 0) {
1177
- int32_t* ptr = reinterpret_cast<int32_t*>(addr);
1178
- return ptr;
1179
- }
1180
- PrintF("Unaligned read at 0x%08x\n", addr);
1181
- UNIMPLEMENTED();
1182
- return 0;
1183
- #endif
1184
- }
1185
-
1186
-
1187
- void Simulator::WriteDW(int32_t addr, int32_t value1, int32_t value2) {
1188
- #if V8_TARGET_CAN_READ_UNALIGNED
1189
- int32_t* ptr = reinterpret_cast<int32_t*>(addr);
1190
- *ptr++ = value1;
1191
- *ptr = value2;
1192
- return;
1193
- #else
1194
- if ((addr & 3) == 0) {
1195
- int32_t* ptr = reinterpret_cast<int32_t*>(addr);
1196
- *ptr++ = value1;
1197
- *ptr = value2;
1198
- return;
1199
- }
1200
- PrintF("Unaligned write at 0x%08x\n", addr);
1201
- UNIMPLEMENTED();
1202
- #endif
1203
- }
1204
-
1205
-
1206
- // Returns the limit of the stack area to enable checking for stack overflows.
1207
- uintptr_t Simulator::StackLimit() const {
1208
- // Leave a safety margin of 256 bytes to prevent overrunning the stack when
1209
- // pushing values.
1210
- return reinterpret_cast<uintptr_t>(stack_) + 256;
1211
- }
1212
-
1213
-
1214
- // Unsupported instructions use Format to print an error and stop execution.
1215
- void Simulator::Format(Instruction* instr, const char* format) {
1216
- PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
1217
- reinterpret_cast<intptr_t>(instr), format);
1218
- UNIMPLEMENTED();
1219
- }
1220
-
1221
-
1222
- // Checks if the current instruction should be executed based on its
1223
- // condition bits.
1224
- bool Simulator::ConditionallyExecute(Instruction* instr) {
1225
- switch (instr->ConditionField()) {
1226
- case eq: return z_flag_;
1227
- case ne: return !z_flag_;
1228
- case cs: return c_flag_;
1229
- case cc: return !c_flag_;
1230
- case mi: return n_flag_;
1231
- case pl: return !n_flag_;
1232
- case vs: return v_flag_;
1233
- case vc: return !v_flag_;
1234
- case hi: return c_flag_ && !z_flag_;
1235
- case ls: return !c_flag_ || z_flag_;
1236
- case ge: return n_flag_ == v_flag_;
1237
- case lt: return n_flag_ != v_flag_;
1238
- case gt: return !z_flag_ && (n_flag_ == v_flag_);
1239
- case le: return z_flag_ || (n_flag_ != v_flag_);
1240
- case al: return true;
1241
- default: UNREACHABLE();
1242
- }
1243
- return false;
1244
- }
1245
-
1246
-
1247
- // Calculate and set the Negative and Zero flags.
1248
- void Simulator::SetNZFlags(int32_t val) {
1249
- n_flag_ = (val < 0);
1250
- z_flag_ = (val == 0);
1251
- }
1252
-
1253
-
1254
- // Set the Carry flag.
1255
- void Simulator::SetCFlag(bool val) {
1256
- c_flag_ = val;
1257
- }
1258
-
1259
-
1260
- // Set the oVerflow flag.
1261
- void Simulator::SetVFlag(bool val) {
1262
- v_flag_ = val;
1263
- }
1264
-
1265
-
1266
- // Calculate C flag value for additions.
1267
- bool Simulator::CarryFrom(int32_t left, int32_t right) {
1268
- uint32_t uleft = static_cast<uint32_t>(left);
1269
- uint32_t uright = static_cast<uint32_t>(right);
1270
- uint32_t urest = 0xffffffffU - uleft;
1271
-
1272
- return (uright > urest);
1273
- }
1274
-
1275
-
1276
- // Calculate C flag value for subtractions.
1277
- bool Simulator::BorrowFrom(int32_t left, int32_t right) {
1278
- uint32_t uleft = static_cast<uint32_t>(left);
1279
- uint32_t uright = static_cast<uint32_t>(right);
1280
-
1281
- return (uright > uleft);
1282
- }
1283
-
1284
-
1285
- // Calculate V flag value for additions and subtractions.
1286
- bool Simulator::OverflowFrom(int32_t alu_out,
1287
- int32_t left, int32_t right, bool addition) {
1288
- bool overflow;
1289
- if (addition) {
1290
- // operands have the same sign
1291
- overflow = ((left >= 0 && right >= 0) || (left < 0 && right < 0))
1292
- // and operands and result have different sign
1293
- && ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0));
1294
- } else {
1295
- // operands have different signs
1296
- overflow = ((left < 0 && right >= 0) || (left >= 0 && right < 0))
1297
- // and first operand and result have different signs
1298
- && ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0));
1299
- }
1300
- return overflow;
1301
- }
1302
-
1303
-
1304
- // Support for VFP comparisons.
1305
- void Simulator::Compute_FPSCR_Flags(double val1, double val2) {
1306
- if (isnan(val1) || isnan(val2)) {
1307
- n_flag_FPSCR_ = false;
1308
- z_flag_FPSCR_ = false;
1309
- c_flag_FPSCR_ = true;
1310
- v_flag_FPSCR_ = true;
1311
- // All non-NaN cases.
1312
- } else if (val1 == val2) {
1313
- n_flag_FPSCR_ = false;
1314
- z_flag_FPSCR_ = true;
1315
- c_flag_FPSCR_ = true;
1316
- v_flag_FPSCR_ = false;
1317
- } else if (val1 < val2) {
1318
- n_flag_FPSCR_ = true;
1319
- z_flag_FPSCR_ = false;
1320
- c_flag_FPSCR_ = false;
1321
- v_flag_FPSCR_ = false;
1322
- } else {
1323
- // Case when (val1 > val2).
1324
- n_flag_FPSCR_ = false;
1325
- z_flag_FPSCR_ = false;
1326
- c_flag_FPSCR_ = true;
1327
- v_flag_FPSCR_ = false;
1328
- }
1329
- }
1330
-
1331
-
1332
- void Simulator::Copy_FPSCR_to_APSR() {
1333
- n_flag_ = n_flag_FPSCR_;
1334
- z_flag_ = z_flag_FPSCR_;
1335
- c_flag_ = c_flag_FPSCR_;
1336
- v_flag_ = v_flag_FPSCR_;
1337
- }
1338
-
1339
-
1340
- // Addressing Mode 1 - Data-processing operands:
1341
- // Get the value based on the shifter_operand with register.
1342
- int32_t Simulator::GetShiftRm(Instruction* instr, bool* carry_out) {
1343
- ShiftOp shift = instr->ShiftField();
1344
- int shift_amount = instr->ShiftAmountValue();
1345
- int32_t result = get_register(instr->RmValue());
1346
- if (instr->Bit(4) == 0) {
1347
- // by immediate
1348
- if ((shift == ROR) && (shift_amount == 0)) {
1349
- UNIMPLEMENTED();
1350
- return result;
1351
- } else if (((shift == LSR) || (shift == ASR)) && (shift_amount == 0)) {
1352
- shift_amount = 32;
1353
- }
1354
- switch (shift) {
1355
- case ASR: {
1356
- if (shift_amount == 0) {
1357
- if (result < 0) {
1358
- result = 0xffffffff;
1359
- *carry_out = true;
1360
- } else {
1361
- result = 0;
1362
- *carry_out = false;
1363
- }
1364
- } else {
1365
- result >>= (shift_amount - 1);
1366
- *carry_out = (result & 1) == 1;
1367
- result >>= 1;
1368
- }
1369
- break;
1370
- }
1371
-
1372
- case LSL: {
1373
- if (shift_amount == 0) {
1374
- *carry_out = c_flag_;
1375
- } else {
1376
- result <<= (shift_amount - 1);
1377
- *carry_out = (result < 0);
1378
- result <<= 1;
1379
- }
1380
- break;
1381
- }
1382
-
1383
- case LSR: {
1384
- if (shift_amount == 0) {
1385
- result = 0;
1386
- *carry_out = c_flag_;
1387
- } else {
1388
- uint32_t uresult = static_cast<uint32_t>(result);
1389
- uresult >>= (shift_amount - 1);
1390
- *carry_out = (uresult & 1) == 1;
1391
- uresult >>= 1;
1392
- result = static_cast<int32_t>(uresult);
1393
- }
1394
- break;
1395
- }
1396
-
1397
- case ROR: {
1398
- UNIMPLEMENTED();
1399
- break;
1400
- }
1401
-
1402
- default: {
1403
- UNREACHABLE();
1404
- break;
1405
- }
1406
- }
1407
- } else {
1408
- // by register
1409
- int rs = instr->RsValue();
1410
- shift_amount = get_register(rs) &0xff;
1411
- switch (shift) {
1412
- case ASR: {
1413
- if (shift_amount == 0) {
1414
- *carry_out = c_flag_;
1415
- } else if (shift_amount < 32) {
1416
- result >>= (shift_amount - 1);
1417
- *carry_out = (result & 1) == 1;
1418
- result >>= 1;
1419
- } else {
1420
- ASSERT(shift_amount >= 32);
1421
- if (result < 0) {
1422
- *carry_out = true;
1423
- result = 0xffffffff;
1424
- } else {
1425
- *carry_out = false;
1426
- result = 0;
1427
- }
1428
- }
1429
- break;
1430
- }
1431
-
1432
- case LSL: {
1433
- if (shift_amount == 0) {
1434
- *carry_out = c_flag_;
1435
- } else if (shift_amount < 32) {
1436
- result <<= (shift_amount - 1);
1437
- *carry_out = (result < 0);
1438
- result <<= 1;
1439
- } else if (shift_amount == 32) {
1440
- *carry_out = (result & 1) == 1;
1441
- result = 0;
1442
- } else {
1443
- ASSERT(shift_amount > 32);
1444
- *carry_out = false;
1445
- result = 0;
1446
- }
1447
- break;
1448
- }
1449
-
1450
- case LSR: {
1451
- if (shift_amount == 0) {
1452
- *carry_out = c_flag_;
1453
- } else if (shift_amount < 32) {
1454
- uint32_t uresult = static_cast<uint32_t>(result);
1455
- uresult >>= (shift_amount - 1);
1456
- *carry_out = (uresult & 1) == 1;
1457
- uresult >>= 1;
1458
- result = static_cast<int32_t>(uresult);
1459
- } else if (shift_amount == 32) {
1460
- *carry_out = (result < 0);
1461
- result = 0;
1462
- } else {
1463
- *carry_out = false;
1464
- result = 0;
1465
- }
1466
- break;
1467
- }
1468
-
1469
- case ROR: {
1470
- UNIMPLEMENTED();
1471
- break;
1472
- }
1473
-
1474
- default: {
1475
- UNREACHABLE();
1476
- break;
1477
- }
1478
- }
1479
- }
1480
- return result;
1481
- }
1482
-
1483
-
1484
- // Addressing Mode 1 - Data-processing operands:
1485
- // Get the value based on the shifter_operand with immediate.
1486
- int32_t Simulator::GetImm(Instruction* instr, bool* carry_out) {
1487
- int rotate = instr->RotateValue() * 2;
1488
- int immed8 = instr->Immed8Value();
1489
- int imm = (immed8 >> rotate) | (immed8 << (32 - rotate));
1490
- *carry_out = (rotate == 0) ? c_flag_ : (imm < 0);
1491
- return imm;
1492
- }
1493
-
1494
-
1495
- static int count_bits(int bit_vector) {
1496
- int count = 0;
1497
- while (bit_vector != 0) {
1498
- if ((bit_vector & 1) != 0) {
1499
- count++;
1500
- }
1501
- bit_vector >>= 1;
1502
- }
1503
- return count;
1504
- }
1505
-
1506
-
1507
- void Simulator::ProcessPUW(Instruction* instr,
1508
- int num_regs,
1509
- int reg_size,
1510
- intptr_t* start_address,
1511
- intptr_t* end_address) {
1512
- int rn = instr->RnValue();
1513
- int32_t rn_val = get_register(rn);
1514
- switch (instr->PUField()) {
1515
- case da_x: {
1516
- UNIMPLEMENTED();
1517
- break;
1518
- }
1519
- case ia_x: {
1520
- *start_address = rn_val;
1521
- *end_address = rn_val + (num_regs * reg_size) - reg_size;
1522
- rn_val = rn_val + (num_regs * reg_size);
1523
- break;
1524
- }
1525
- case db_x: {
1526
- *start_address = rn_val - (num_regs * reg_size);
1527
- *end_address = rn_val - reg_size;
1528
- rn_val = *start_address;
1529
- break;
1530
- }
1531
- case ib_x: {
1532
- *start_address = rn_val + reg_size;
1533
- *end_address = rn_val + (num_regs * reg_size);
1534
- rn_val = *end_address;
1535
- break;
1536
- }
1537
- default: {
1538
- UNREACHABLE();
1539
- break;
1540
- }
1541
- }
1542
- if (instr->HasW()) {
1543
- set_register(rn, rn_val);
1544
- }
1545
- }
1546
-
1547
- // Addressing Mode 4 - Load and Store Multiple
1548
- void Simulator::HandleRList(Instruction* instr, bool load) {
1549
- int rlist = instr->RlistValue();
1550
- int num_regs = count_bits(rlist);
1551
-
1552
- intptr_t start_address = 0;
1553
- intptr_t end_address = 0;
1554
- ProcessPUW(instr, num_regs, kPointerSize, &start_address, &end_address);
1555
-
1556
- intptr_t* address = reinterpret_cast<intptr_t*>(start_address);
1557
- int reg = 0;
1558
- while (rlist != 0) {
1559
- if ((rlist & 1) != 0) {
1560
- if (load) {
1561
- set_register(reg, *address);
1562
- } else {
1563
- *address = get_register(reg);
1564
- }
1565
- address += 1;
1566
- }
1567
- reg++;
1568
- rlist >>= 1;
1569
- }
1570
- ASSERT(end_address == ((intptr_t)address) - 4);
1571
- }
1572
-
1573
-
1574
- // Addressing Mode 6 - Load and Store Multiple Coprocessor registers.
1575
- void Simulator::HandleVList(Instruction* instr) {
1576
- VFPRegPrecision precision =
1577
- (instr->SzValue() == 0) ? kSinglePrecision : kDoublePrecision;
1578
- int operand_size = (precision == kSinglePrecision) ? 4 : 8;
1579
-
1580
- bool load = (instr->VLValue() == 0x1);
1581
-
1582
- int vd;
1583
- int num_regs;
1584
- vd = instr->VFPDRegValue(precision);
1585
- if (precision == kSinglePrecision) {
1586
- num_regs = instr->Immed8Value();
1587
- } else {
1588
- num_regs = instr->Immed8Value() / 2;
1589
- }
1590
-
1591
- intptr_t start_address = 0;
1592
- intptr_t end_address = 0;
1593
- ProcessPUW(instr, num_regs, operand_size, &start_address, &end_address);
1594
-
1595
- intptr_t* address = reinterpret_cast<intptr_t*>(start_address);
1596
- for (int reg = vd; reg < vd + num_regs; reg++) {
1597
- if (precision == kSinglePrecision) {
1598
- if (load) {
1599
- set_s_register_from_sinteger(
1600
- reg, ReadW(reinterpret_cast<int32_t>(address), instr));
1601
- } else {
1602
- WriteW(reinterpret_cast<int32_t>(address),
1603
- get_sinteger_from_s_register(reg), instr);
1604
- }
1605
- address += 1;
1606
- } else {
1607
- if (load) {
1608
- set_s_register_from_sinteger(
1609
- 2 * reg, ReadW(reinterpret_cast<int32_t>(address), instr));
1610
- set_s_register_from_sinteger(
1611
- 2 * reg + 1, ReadW(reinterpret_cast<int32_t>(address + 1), instr));
1612
- } else {
1613
- WriteW(reinterpret_cast<int32_t>(address),
1614
- get_sinteger_from_s_register(2 * reg), instr);
1615
- WriteW(reinterpret_cast<int32_t>(address + 1),
1616
- get_sinteger_from_s_register(2 * reg + 1), instr);
1617
- }
1618
- address += 2;
1619
- }
1620
- }
1621
- ASSERT_EQ(((intptr_t)address) - operand_size, end_address);
1622
- }
1623
-
1624
-
1625
- // Calls into the V8 runtime are based on this very simple interface.
1626
- // Note: To be able to return two values from some calls the code in runtime.cc
1627
- // uses the ObjectPair which is essentially two 32-bit values stuffed into a
1628
- // 64-bit value. With the code below we assume that all runtime calls return
1629
- // 64 bits of result. If they don't, the r1 result register contains a bogus
1630
- // value, which is fine because it is caller-saved.
1631
- typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0,
1632
- int32_t arg1,
1633
- int32_t arg2,
1634
- int32_t arg3,
1635
- int32_t arg4,
1636
- int32_t arg5);
1637
- typedef double (*SimulatorRuntimeFPCall)(int32_t arg0,
1638
- int32_t arg1,
1639
- int32_t arg2,
1640
- int32_t arg3);
1641
-
1642
- // This signature supports direct call in to API function native callback
1643
- // (refer to InvocationCallback in v8.h).
1644
- typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1645
-
1646
- // This signature supports direct call to accessor getter callback.
1647
- typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0,
1648
- int32_t arg1);
1649
-
1650
- // Software interrupt instructions are used by the simulator to call into the
1651
- // C-based V8 runtime.
1652
- void Simulator::SoftwareInterrupt(Instruction* instr) {
1653
- int svc = instr->SvcValue();
1654
- switch (svc) {
1655
- case kCallRtRedirected: {
1656
- // Check if stack is aligned. Error if not aligned is reported below to
1657
- // include information on the function called.
1658
- bool stack_aligned =
1659
- (get_register(sp)
1660
- & (::v8::internal::FLAG_sim_stack_alignment - 1)) == 0;
1661
- Redirection* redirection = Redirection::FromSwiInstruction(instr);
1662
- int32_t arg0 = get_register(r0);
1663
- int32_t arg1 = get_register(r1);
1664
- int32_t arg2 = get_register(r2);
1665
- int32_t arg3 = get_register(r3);
1666
- int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp));
1667
- int32_t arg4 = stack_pointer[0];
1668
- int32_t arg5 = stack_pointer[1];
1669
- // This is dodgy but it works because the C entry stubs are never moved.
1670
- // See comment in codegen-arm.cc and bug 1242173.
1671
- int32_t saved_lr = get_register(lr);
1672
- intptr_t external =
1673
- reinterpret_cast<intptr_t>(redirection->external_function());
1674
- if (redirection->type() == ExternalReference::FP_RETURN_CALL) {
1675
- SimulatorRuntimeFPCall target =
1676
- reinterpret_cast<SimulatorRuntimeFPCall>(external);
1677
- if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1678
- double x, y;
1679
- GetFpArgs(&x, &y);
1680
- PrintF("Call to host function at %p with args %f, %f",
1681
- FUNCTION_ADDR(target), x, y);
1682
- if (!stack_aligned) {
1683
- PrintF(" with unaligned stack %08x\n", get_register(sp));
1684
- }
1685
- PrintF("\n");
1686
- }
1687
- CHECK(stack_aligned);
1688
- double result = target(arg0, arg1, arg2, arg3);
1689
- SetFpResult(result);
1690
- } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
1691
- SimulatorRuntimeDirectApiCall target =
1692
- reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
1693
- if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1694
- PrintF("Call to host function at %p args %08x",
1695
- FUNCTION_ADDR(target), arg0);
1696
- if (!stack_aligned) {
1697
- PrintF(" with unaligned stack %08x\n", get_register(sp));
1698
- }
1699
- PrintF("\n");
1700
- }
1701
- CHECK(stack_aligned);
1702
- v8::Handle<v8::Value> result = target(arg0);
1703
- if (::v8::internal::FLAG_trace_sim) {
1704
- PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1705
- }
1706
- set_register(r0, (int32_t) *result);
1707
- } else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
1708
- SimulatorRuntimeDirectGetterCall target =
1709
- reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
1710
- if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1711
- PrintF("Call to host function at %p args %08x %08x",
1712
- FUNCTION_ADDR(target), arg0, arg1);
1713
- if (!stack_aligned) {
1714
- PrintF(" with unaligned stack %08x\n", get_register(sp));
1715
- }
1716
- PrintF("\n");
1717
- }
1718
- CHECK(stack_aligned);
1719
- v8::Handle<v8::Value> result = target(arg0, arg1);
1720
- if (::v8::internal::FLAG_trace_sim) {
1721
- PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1722
- }
1723
- set_register(r0, (int32_t) *result);
1724
- } else {
1725
- // builtin call.
1726
- ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL);
1727
- SimulatorRuntimeCall target =
1728
- reinterpret_cast<SimulatorRuntimeCall>(external);
1729
- if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1730
- PrintF(
1731
- "Call to host function at %p"
1732
- "args %08x, %08x, %08x, %08x, %08x, %08x",
1733
- FUNCTION_ADDR(target),
1734
- arg0,
1735
- arg1,
1736
- arg2,
1737
- arg3,
1738
- arg4,
1739
- arg5);
1740
- if (!stack_aligned) {
1741
- PrintF(" with unaligned stack %08x\n", get_register(sp));
1742
- }
1743
- PrintF("\n");
1744
- }
1745
- CHECK(stack_aligned);
1746
- int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
1747
- int32_t lo_res = static_cast<int32_t>(result);
1748
- int32_t hi_res = static_cast<int32_t>(result >> 32);
1749
- if (::v8::internal::FLAG_trace_sim) {
1750
- PrintF("Returned %08x\n", lo_res);
1751
- }
1752
- set_register(r0, lo_res);
1753
- set_register(r1, hi_res);
1754
- }
1755
- set_register(lr, saved_lr);
1756
- set_pc(get_register(lr));
1757
- break;
1758
- }
1759
- case kBreakpoint: {
1760
- ArmDebugger dbg(this);
1761
- dbg.Debug();
1762
- break;
1763
- }
1764
- // stop uses all codes greater than 1 << 23.
1765
- default: {
1766
- if (svc >= (1 << 23)) {
1767
- uint32_t code = svc & kStopCodeMask;
1768
- if (isWatchedStop(code)) {
1769
- IncreaseStopCounter(code);
1770
- }
1771
- // Stop if it is enabled, otherwise go on jumping over the stop
1772
- // and the message address.
1773
- if (isEnabledStop(code)) {
1774
- ArmDebugger dbg(this);
1775
- dbg.Stop(instr);
1776
- } else {
1777
- set_pc(get_pc() + 2 * Instruction::kInstrSize);
1778
- }
1779
- } else {
1780
- // This is not a valid svc code.
1781
- UNREACHABLE();
1782
- break;
1783
- }
1784
- }
1785
- }
1786
- }
1787
-
1788
-
1789
- // Stop helper functions.
1790
- bool Simulator::isStopInstruction(Instruction* instr) {
1791
- return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode);
1792
- }
1793
-
1794
-
1795
- bool Simulator::isWatchedStop(uint32_t code) {
1796
- ASSERT(code <= kMaxStopCode);
1797
- return code < kNumOfWatchedStops;
1798
- }
1799
-
1800
-
1801
- bool Simulator::isEnabledStop(uint32_t code) {
1802
- ASSERT(code <= kMaxStopCode);
1803
- // Unwatched stops are always enabled.
1804
- return !isWatchedStop(code) ||
1805
- !(watched_stops[code].count & kStopDisabledBit);
1806
- }
1807
-
1808
-
1809
- void Simulator::EnableStop(uint32_t code) {
1810
- ASSERT(isWatchedStop(code));
1811
- if (!isEnabledStop(code)) {
1812
- watched_stops[code].count &= ~kStopDisabledBit;
1813
- }
1814
- }
1815
-
1816
-
1817
- void Simulator::DisableStop(uint32_t code) {
1818
- ASSERT(isWatchedStop(code));
1819
- if (isEnabledStop(code)) {
1820
- watched_stops[code].count |= kStopDisabledBit;
1821
- }
1822
- }
1823
-
1824
-
1825
- void Simulator::IncreaseStopCounter(uint32_t code) {
1826
- ASSERT(code <= kMaxStopCode);
1827
- ASSERT(isWatchedStop(code));
1828
- if ((watched_stops[code].count & ~(1 << 31)) == 0x7fffffff) {
1829
- PrintF("Stop counter for code %i has overflowed.\n"
1830
- "Enabling this code and reseting the counter to 0.\n", code);
1831
- watched_stops[code].count = 0;
1832
- EnableStop(code);
1833
- } else {
1834
- watched_stops[code].count++;
1835
- }
1836
- }
1837
-
1838
-
1839
- // Print a stop status.
1840
- void Simulator::PrintStopInfo(uint32_t code) {
1841
- ASSERT(code <= kMaxStopCode);
1842
- if (!isWatchedStop(code)) {
1843
- PrintF("Stop not watched.");
1844
- } else {
1845
- const char* state = isEnabledStop(code) ? "Enabled" : "Disabled";
1846
- int32_t count = watched_stops[code].count & ~kStopDisabledBit;
1847
- // Don't print the state of unused breakpoints.
1848
- if (count != 0) {
1849
- if (watched_stops[code].desc) {
1850
- PrintF("stop %i - 0x%x: \t%s, \tcounter = %i, \t%s\n",
1851
- code, code, state, count, watched_stops[code].desc);
1852
- } else {
1853
- PrintF("stop %i - 0x%x: \t%s, \tcounter = %i\n",
1854
- code, code, state, count);
1855
- }
1856
- }
1857
- }
1858
- }
1859
-
1860
-
1861
- // Handle execution based on instruction types.
1862
-
1863
- // Instruction types 0 and 1 are both rolled into one function because they
1864
- // only differ in the handling of the shifter_operand.
1865
- void Simulator::DecodeType01(Instruction* instr) {
1866
- int type = instr->TypeValue();
1867
- if ((type == 0) && instr->IsSpecialType0()) {
1868
- // multiply instruction or extra loads and stores
1869
- if (instr->Bits(7, 4) == 9) {
1870
- if (instr->Bit(24) == 0) {
1871
- // Raw field decoding here. Multiply instructions have their Rd in
1872
- // funny places.
1873
- int rn = instr->RnValue();
1874
- int rm = instr->RmValue();
1875
- int rs = instr->RsValue();
1876
- int32_t rs_val = get_register(rs);
1877
- int32_t rm_val = get_register(rm);
1878
- if (instr->Bit(23) == 0) {
1879
- if (instr->Bit(21) == 0) {
1880
- // The MUL instruction description (A 4.1.33) refers to Rd as being
1881
- // the destination for the operation, but it confusingly uses the
1882
- // Rn field to encode it.
1883
- // Format(instr, "mul'cond's 'rn, 'rm, 'rs");
1884
- int rd = rn; // Remap the rn field to the Rd register.
1885
- int32_t alu_out = rm_val * rs_val;
1886
- set_register(rd, alu_out);
1887
- if (instr->HasS()) {
1888
- SetNZFlags(alu_out);
1889
- }
1890
- } else {
1891
- // The MLA instruction description (A 4.1.28) refers to the order
1892
- // of registers as "Rd, Rm, Rs, Rn". But confusingly it uses the
1893
- // Rn field to encode the Rd register and the Rd field to encode
1894
- // the Rn register.
1895
- Format(instr, "mla'cond's 'rn, 'rm, 'rs, 'rd");
1896
- }
1897
- } else {
1898
- // The signed/long multiply instructions use the terms RdHi and RdLo
1899
- // when referring to the target registers. They are mapped to the Rn
1900
- // and Rd fields as follows:
1901
- // RdLo == Rd
1902
- // RdHi == Rn (This is confusingly stored in variable rd here
1903
- // because the mul instruction from above uses the
1904
- // Rn field to encode the Rd register. Good luck figuring
1905
- // this out without reading the ARM instruction manual
1906
- // at a very detailed level.)
1907
- // Format(instr, "'um'al'cond's 'rd, 'rn, 'rs, 'rm");
1908
- int rd_hi = rn; // Remap the rn field to the RdHi register.
1909
- int rd_lo = instr->RdValue();
1910
- int32_t hi_res = 0;
1911
- int32_t lo_res = 0;
1912
- if (instr->Bit(22) == 1) {
1913
- int64_t left_op = static_cast<int32_t>(rm_val);
1914
- int64_t right_op = static_cast<int32_t>(rs_val);
1915
- uint64_t result = left_op * right_op;
1916
- hi_res = static_cast<int32_t>(result >> 32);
1917
- lo_res = static_cast<int32_t>(result & 0xffffffff);
1918
- } else {
1919
- // unsigned multiply
1920
- uint64_t left_op = static_cast<uint32_t>(rm_val);
1921
- uint64_t right_op = static_cast<uint32_t>(rs_val);
1922
- uint64_t result = left_op * right_op;
1923
- hi_res = static_cast<int32_t>(result >> 32);
1924
- lo_res = static_cast<int32_t>(result & 0xffffffff);
1925
- }
1926
- set_register(rd_lo, lo_res);
1927
- set_register(rd_hi, hi_res);
1928
- if (instr->HasS()) {
1929
- UNIMPLEMENTED();
1930
- }
1931
- }
1932
- } else {
1933
- UNIMPLEMENTED(); // Not used by V8.
1934
- }
1935
- } else {
1936
- // extra load/store instructions
1937
- int rd = instr->RdValue();
1938
- int rn = instr->RnValue();
1939
- int32_t rn_val = get_register(rn);
1940
- int32_t addr = 0;
1941
- if (instr->Bit(22) == 0) {
1942
- int rm = instr->RmValue();
1943
- int32_t rm_val = get_register(rm);
1944
- switch (instr->PUField()) {
1945
- case da_x: {
1946
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm");
1947
- ASSERT(!instr->HasW());
1948
- addr = rn_val;
1949
- rn_val -= rm_val;
1950
- set_register(rn, rn_val);
1951
- break;
1952
- }
1953
- case ia_x: {
1954
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn], +'rm");
1955
- ASSERT(!instr->HasW());
1956
- addr = rn_val;
1957
- rn_val += rm_val;
1958
- set_register(rn, rn_val);
1959
- break;
1960
- }
1961
- case db_x: {
1962
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn, -'rm]'w");
1963
- rn_val -= rm_val;
1964
- addr = rn_val;
1965
- if (instr->HasW()) {
1966
- set_register(rn, rn_val);
1967
- }
1968
- break;
1969
- }
1970
- case ib_x: {
1971
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn, +'rm]'w");
1972
- rn_val += rm_val;
1973
- addr = rn_val;
1974
- if (instr->HasW()) {
1975
- set_register(rn, rn_val);
1976
- }
1977
- break;
1978
- }
1979
- default: {
1980
- // The PU field is a 2-bit field.
1981
- UNREACHABLE();
1982
- break;
1983
- }
1984
- }
1985
- } else {
1986
- int32_t imm_val = (instr->ImmedHValue() << 4) | instr->ImmedLValue();
1987
- switch (instr->PUField()) {
1988
- case da_x: {
1989
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn], #-'off8");
1990
- ASSERT(!instr->HasW());
1991
- addr = rn_val;
1992
- rn_val -= imm_val;
1993
- set_register(rn, rn_val);
1994
- break;
1995
- }
1996
- case ia_x: {
1997
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn], #+'off8");
1998
- ASSERT(!instr->HasW());
1999
- addr = rn_val;
2000
- rn_val += imm_val;
2001
- set_register(rn, rn_val);
2002
- break;
2003
- }
2004
- case db_x: {
2005
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn, #-'off8]'w");
2006
- rn_val -= imm_val;
2007
- addr = rn_val;
2008
- if (instr->HasW()) {
2009
- set_register(rn, rn_val);
2010
- }
2011
- break;
2012
- }
2013
- case ib_x: {
2014
- // Format(instr, "'memop'cond'sign'h 'rd, ['rn, #+'off8]'w");
2015
- rn_val += imm_val;
2016
- addr = rn_val;
2017
- if (instr->HasW()) {
2018
- set_register(rn, rn_val);
2019
- }
2020
- break;
2021
- }
2022
- default: {
2023
- // The PU field is a 2-bit field.
2024
- UNREACHABLE();
2025
- break;
2026
- }
2027
- }
2028
- }
2029
- if (((instr->Bits(7, 4) & 0xd) == 0xd) && (instr->Bit(20) == 0)) {
2030
- ASSERT((rd % 2) == 0);
2031
- if (instr->HasH()) {
2032
- // The strd instruction.
2033
- int32_t value1 = get_register(rd);
2034
- int32_t value2 = get_register(rd+1);
2035
- WriteDW(addr, value1, value2);
2036
- } else {
2037
- // The ldrd instruction.
2038
- int* rn_data = ReadDW(addr);
2039
- set_dw_register(rd, rn_data);
2040
- }
2041
- } else if (instr->HasH()) {
2042
- if (instr->HasSign()) {
2043
- if (instr->HasL()) {
2044
- int16_t val = ReadH(addr, instr);
2045
- set_register(rd, val);
2046
- } else {
2047
- int16_t val = get_register(rd);
2048
- WriteH(addr, val, instr);
2049
- }
2050
- } else {
2051
- if (instr->HasL()) {
2052
- uint16_t val = ReadHU(addr, instr);
2053
- set_register(rd, val);
2054
- } else {
2055
- uint16_t val = get_register(rd);
2056
- WriteH(addr, val, instr);
2057
- }
2058
- }
2059
- } else {
2060
- // signed byte loads
2061
- ASSERT(instr->HasSign());
2062
- ASSERT(instr->HasL());
2063
- int8_t val = ReadB(addr);
2064
- set_register(rd, val);
2065
- }
2066
- return;
2067
- }
2068
- } else if ((type == 0) && instr->IsMiscType0()) {
2069
- if (instr->Bits(22, 21) == 1) {
2070
- int rm = instr->RmValue();
2071
- switch (instr->BitField(7, 4)) {
2072
- case BX:
2073
- set_pc(get_register(rm));
2074
- break;
2075
- case BLX: {
2076
- uint32_t old_pc = get_pc();
2077
- set_pc(get_register(rm));
2078
- set_register(lr, old_pc + Instruction::kInstrSize);
2079
- break;
2080
- }
2081
- case BKPT: {
2082
- ArmDebugger dbg(this);
2083
- PrintF("Simulator hit BKPT.\n");
2084
- dbg.Debug();
2085
- break;
2086
- }
2087
- default:
2088
- UNIMPLEMENTED();
2089
- }
2090
- } else if (instr->Bits(22, 21) == 3) {
2091
- int rm = instr->RmValue();
2092
- int rd = instr->RdValue();
2093
- switch (instr->BitField(7, 4)) {
2094
- case CLZ: {
2095
- uint32_t bits = get_register(rm);
2096
- int leading_zeros = 0;
2097
- if (bits == 0) {
2098
- leading_zeros = 32;
2099
- } else {
2100
- while ((bits & 0x80000000u) == 0) {
2101
- bits <<= 1;
2102
- leading_zeros++;
2103
- }
2104
- }
2105
- set_register(rd, leading_zeros);
2106
- break;
2107
- }
2108
- default:
2109
- UNIMPLEMENTED();
2110
- }
2111
- } else {
2112
- PrintF("%08x\n", instr->InstructionBits());
2113
- UNIMPLEMENTED();
2114
- }
2115
- } else {
2116
- int rd = instr->RdValue();
2117
- int rn = instr->RnValue();
2118
- int32_t rn_val = get_register(rn);
2119
- int32_t shifter_operand = 0;
2120
- bool shifter_carry_out = 0;
2121
- if (type == 0) {
2122
- shifter_operand = GetShiftRm(instr, &shifter_carry_out);
2123
- } else {
2124
- ASSERT(instr->TypeValue() == 1);
2125
- shifter_operand = GetImm(instr, &shifter_carry_out);
2126
- }
2127
- int32_t alu_out;
2128
-
2129
- switch (instr->OpcodeField()) {
2130
- case AND: {
2131
- // Format(instr, "and'cond's 'rd, 'rn, 'shift_rm");
2132
- // Format(instr, "and'cond's 'rd, 'rn, 'imm");
2133
- alu_out = rn_val & shifter_operand;
2134
- set_register(rd, alu_out);
2135
- if (instr->HasS()) {
2136
- SetNZFlags(alu_out);
2137
- SetCFlag(shifter_carry_out);
2138
- }
2139
- break;
2140
- }
2141
-
2142
- case EOR: {
2143
- // Format(instr, "eor'cond's 'rd, 'rn, 'shift_rm");
2144
- // Format(instr, "eor'cond's 'rd, 'rn, 'imm");
2145
- alu_out = rn_val ^ shifter_operand;
2146
- set_register(rd, alu_out);
2147
- if (instr->HasS()) {
2148
- SetNZFlags(alu_out);
2149
- SetCFlag(shifter_carry_out);
2150
- }
2151
- break;
2152
- }
2153
-
2154
- case SUB: {
2155
- // Format(instr, "sub'cond's 'rd, 'rn, 'shift_rm");
2156
- // Format(instr, "sub'cond's 'rd, 'rn, 'imm");
2157
- alu_out = rn_val - shifter_operand;
2158
- set_register(rd, alu_out);
2159
- if (instr->HasS()) {
2160
- SetNZFlags(alu_out);
2161
- SetCFlag(!BorrowFrom(rn_val, shifter_operand));
2162
- SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false));
2163
- }
2164
- break;
2165
- }
2166
-
2167
- case RSB: {
2168
- // Format(instr, "rsb'cond's 'rd, 'rn, 'shift_rm");
2169
- // Format(instr, "rsb'cond's 'rd, 'rn, 'imm");
2170
- alu_out = shifter_operand - rn_val;
2171
- set_register(rd, alu_out);
2172
- if (instr->HasS()) {
2173
- SetNZFlags(alu_out);
2174
- SetCFlag(!BorrowFrom(shifter_operand, rn_val));
2175
- SetVFlag(OverflowFrom(alu_out, shifter_operand, rn_val, false));
2176
- }
2177
- break;
2178
- }
2179
-
2180
- case ADD: {
2181
- // Format(instr, "add'cond's 'rd, 'rn, 'shift_rm");
2182
- // Format(instr, "add'cond's 'rd, 'rn, 'imm");
2183
- alu_out = rn_val + shifter_operand;
2184
- set_register(rd, alu_out);
2185
- if (instr->HasS()) {
2186
- SetNZFlags(alu_out);
2187
- SetCFlag(CarryFrom(rn_val, shifter_operand));
2188
- SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, true));
2189
- }
2190
- break;
2191
- }
2192
-
2193
- case ADC: {
2194
- Format(instr, "adc'cond's 'rd, 'rn, 'shift_rm");
2195
- Format(instr, "adc'cond's 'rd, 'rn, 'imm");
2196
- break;
2197
- }
2198
-
2199
- case SBC: {
2200
- Format(instr, "sbc'cond's 'rd, 'rn, 'shift_rm");
2201
- Format(instr, "sbc'cond's 'rd, 'rn, 'imm");
2202
- break;
2203
- }
2204
-
2205
- case RSC: {
2206
- Format(instr, "rsc'cond's 'rd, 'rn, 'shift_rm");
2207
- Format(instr, "rsc'cond's 'rd, 'rn, 'imm");
2208
- break;
2209
- }
2210
-
2211
- case TST: {
2212
- if (instr->HasS()) {
2213
- // Format(instr, "tst'cond 'rn, 'shift_rm");
2214
- // Format(instr, "tst'cond 'rn, 'imm");
2215
- alu_out = rn_val & shifter_operand;
2216
- SetNZFlags(alu_out);
2217
- SetCFlag(shifter_carry_out);
2218
- } else {
2219
- // Format(instr, "movw'cond 'rd, 'imm").
2220
- alu_out = instr->ImmedMovwMovtValue();
2221
- set_register(rd, alu_out);
2222
- }
2223
- break;
2224
- }
2225
-
2226
- case TEQ: {
2227
- if (instr->HasS()) {
2228
- // Format(instr, "teq'cond 'rn, 'shift_rm");
2229
- // Format(instr, "teq'cond 'rn, 'imm");
2230
- alu_out = rn_val ^ shifter_operand;
2231
- SetNZFlags(alu_out);
2232
- SetCFlag(shifter_carry_out);
2233
- } else {
2234
- // Other instructions matching this pattern are handled in the
2235
- // miscellaneous instructions part above.
2236
- UNREACHABLE();
2237
- }
2238
- break;
2239
- }
2240
-
2241
- case CMP: {
2242
- if (instr->HasS()) {
2243
- // Format(instr, "cmp'cond 'rn, 'shift_rm");
2244
- // Format(instr, "cmp'cond 'rn, 'imm");
2245
- alu_out = rn_val - shifter_operand;
2246
- SetNZFlags(alu_out);
2247
- SetCFlag(!BorrowFrom(rn_val, shifter_operand));
2248
- SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false));
2249
- } else {
2250
- // Format(instr, "movt'cond 'rd, 'imm").
2251
- alu_out = (get_register(rd) & 0xffff) |
2252
- (instr->ImmedMovwMovtValue() << 16);
2253
- set_register(rd, alu_out);
2254
- }
2255
- break;
2256
- }
2257
-
2258
- case CMN: {
2259
- if (instr->HasS()) {
2260
- // Format(instr, "cmn'cond 'rn, 'shift_rm");
2261
- // Format(instr, "cmn'cond 'rn, 'imm");
2262
- alu_out = rn_val + shifter_operand;
2263
- SetNZFlags(alu_out);
2264
- SetCFlag(!CarryFrom(rn_val, shifter_operand));
2265
- SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, true));
2266
- } else {
2267
- // Other instructions matching this pattern are handled in the
2268
- // miscellaneous instructions part above.
2269
- UNREACHABLE();
2270
- }
2271
- break;
2272
- }
2273
-
2274
- case ORR: {
2275
- // Format(instr, "orr'cond's 'rd, 'rn, 'shift_rm");
2276
- // Format(instr, "orr'cond's 'rd, 'rn, 'imm");
2277
- alu_out = rn_val | shifter_operand;
2278
- set_register(rd, alu_out);
2279
- if (instr->HasS()) {
2280
- SetNZFlags(alu_out);
2281
- SetCFlag(shifter_carry_out);
2282
- }
2283
- break;
2284
- }
2285
-
2286
- case MOV: {
2287
- // Format(instr, "mov'cond's 'rd, 'shift_rm");
2288
- // Format(instr, "mov'cond's 'rd, 'imm");
2289
- alu_out = shifter_operand;
2290
- set_register(rd, alu_out);
2291
- if (instr->HasS()) {
2292
- SetNZFlags(alu_out);
2293
- SetCFlag(shifter_carry_out);
2294
- }
2295
- break;
2296
- }
2297
-
2298
- case BIC: {
2299
- // Format(instr, "bic'cond's 'rd, 'rn, 'shift_rm");
2300
- // Format(instr, "bic'cond's 'rd, 'rn, 'imm");
2301
- alu_out = rn_val & ~shifter_operand;
2302
- set_register(rd, alu_out);
2303
- if (instr->HasS()) {
2304
- SetNZFlags(alu_out);
2305
- SetCFlag(shifter_carry_out);
2306
- }
2307
- break;
2308
- }
2309
-
2310
- case MVN: {
2311
- // Format(instr, "mvn'cond's 'rd, 'shift_rm");
2312
- // Format(instr, "mvn'cond's 'rd, 'imm");
2313
- alu_out = ~shifter_operand;
2314
- set_register(rd, alu_out);
2315
- if (instr->HasS()) {
2316
- SetNZFlags(alu_out);
2317
- SetCFlag(shifter_carry_out);
2318
- }
2319
- break;
2320
- }
2321
-
2322
- default: {
2323
- UNREACHABLE();
2324
- break;
2325
- }
2326
- }
2327
- }
2328
- }
2329
-
2330
-
2331
- void Simulator::DecodeType2(Instruction* instr) {
2332
- int rd = instr->RdValue();
2333
- int rn = instr->RnValue();
2334
- int32_t rn_val = get_register(rn);
2335
- int32_t im_val = instr->Offset12Value();
2336
- int32_t addr = 0;
2337
- switch (instr->PUField()) {
2338
- case da_x: {
2339
- // Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12");
2340
- ASSERT(!instr->HasW());
2341
- addr = rn_val;
2342
- rn_val -= im_val;
2343
- set_register(rn, rn_val);
2344
- break;
2345
- }
2346
- case ia_x: {
2347
- // Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12");
2348
- ASSERT(!instr->HasW());
2349
- addr = rn_val;
2350
- rn_val += im_val;
2351
- set_register(rn, rn_val);
2352
- break;
2353
- }
2354
- case db_x: {
2355
- // Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
2356
- rn_val -= im_val;
2357
- addr = rn_val;
2358
- if (instr->HasW()) {
2359
- set_register(rn, rn_val);
2360
- }
2361
- break;
2362
- }
2363
- case ib_x: {
2364
- // Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
2365
- rn_val += im_val;
2366
- addr = rn_val;
2367
- if (instr->HasW()) {
2368
- set_register(rn, rn_val);
2369
- }
2370
- break;
2371
- }
2372
- default: {
2373
- UNREACHABLE();
2374
- break;
2375
- }
2376
- }
2377
- if (instr->HasB()) {
2378
- if (instr->HasL()) {
2379
- byte val = ReadBU(addr);
2380
- set_register(rd, val);
2381
- } else {
2382
- byte val = get_register(rd);
2383
- WriteB(addr, val);
2384
- }
2385
- } else {
2386
- if (instr->HasL()) {
2387
- set_register(rd, ReadW(addr, instr));
2388
- } else {
2389
- WriteW(addr, get_register(rd), instr);
2390
- }
2391
- }
2392
- }
2393
-
2394
-
2395
- void Simulator::DecodeType3(Instruction* instr) {
2396
- int rd = instr->RdValue();
2397
- int rn = instr->RnValue();
2398
- int32_t rn_val = get_register(rn);
2399
- bool shifter_carry_out = 0;
2400
- int32_t shifter_operand = GetShiftRm(instr, &shifter_carry_out);
2401
- int32_t addr = 0;
2402
- switch (instr->PUField()) {
2403
- case da_x: {
2404
- ASSERT(!instr->HasW());
2405
- Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm");
2406
- UNIMPLEMENTED();
2407
- break;
2408
- }
2409
- case ia_x: {
2410
- if (instr->HasW()) {
2411
- ASSERT(instr->Bits(5, 4) == 0x1);
2412
-
2413
- if (instr->Bit(22) == 0x1) { // USAT.
2414
- int32_t sat_pos = instr->Bits(20, 16);
2415
- int32_t sat_val = (1 << sat_pos) - 1;
2416
- int32_t shift = instr->Bits(11, 7);
2417
- int32_t shift_type = instr->Bit(6);
2418
- int32_t rm_val = get_register(instr->RmValue());
2419
- if (shift_type == 0) { // LSL
2420
- rm_val <<= shift;
2421
- } else { // ASR
2422
- rm_val >>= shift;
2423
- }
2424
- // If saturation occurs, the Q flag should be set in the CPSR.
2425
- // There is no Q flag yet, and no instruction (MRS) to read the
2426
- // CPSR directly.
2427
- if (rm_val > sat_val) {
2428
- rm_val = sat_val;
2429
- } else if (rm_val < 0) {
2430
- rm_val = 0;
2431
- }
2432
- set_register(rd, rm_val);
2433
- } else { // SSAT.
2434
- UNIMPLEMENTED();
2435
- }
2436
- return;
2437
- } else {
2438
- Format(instr, "'memop'cond'b 'rd, ['rn], +'shift_rm");
2439
- UNIMPLEMENTED();
2440
- }
2441
- break;
2442
- }
2443
- case db_x: {
2444
- // Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w");
2445
- addr = rn_val - shifter_operand;
2446
- if (instr->HasW()) {
2447
- set_register(rn, addr);
2448
- }
2449
- break;
2450
- }
2451
- case ib_x: {
2452
- if (instr->HasW() && (instr->Bits(6, 4) == 0x5)) {
2453
- uint32_t widthminus1 = static_cast<uint32_t>(instr->Bits(20, 16));
2454
- uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
2455
- uint32_t msbit = widthminus1 + lsbit;
2456
- if (msbit <= 31) {
2457
- if (instr->Bit(22)) {
2458
- // ubfx - unsigned bitfield extract.
2459
- uint32_t rm_val =
2460
- static_cast<uint32_t>(get_register(instr->RmValue()));
2461
- uint32_t extr_val = rm_val << (31 - msbit);
2462
- extr_val = extr_val >> (31 - widthminus1);
2463
- set_register(instr->RdValue(), extr_val);
2464
- } else {
2465
- // sbfx - signed bitfield extract.
2466
- int32_t rm_val = get_register(instr->RmValue());
2467
- int32_t extr_val = rm_val << (31 - msbit);
2468
- extr_val = extr_val >> (31 - widthminus1);
2469
- set_register(instr->RdValue(), extr_val);
2470
- }
2471
- } else {
2472
- UNREACHABLE();
2473
- }
2474
- return;
2475
- } else if (!instr->HasW() && (instr->Bits(6, 4) == 0x1)) {
2476
- uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
2477
- uint32_t msbit = static_cast<uint32_t>(instr->Bits(20, 16));
2478
- if (msbit >= lsbit) {
2479
- // bfc or bfi - bitfield clear/insert.
2480
- uint32_t rd_val =
2481
- static_cast<uint32_t>(get_register(instr->RdValue()));
2482
- uint32_t bitcount = msbit - lsbit + 1;
2483
- uint32_t mask = (1 << bitcount) - 1;
2484
- rd_val &= ~(mask << lsbit);
2485
- if (instr->RmValue() != 15) {
2486
- // bfi - bitfield insert.
2487
- uint32_t rm_val =
2488
- static_cast<uint32_t>(get_register(instr->RmValue()));
2489
- rm_val &= mask;
2490
- rd_val |= rm_val << lsbit;
2491
- }
2492
- set_register(instr->RdValue(), rd_val);
2493
- } else {
2494
- UNREACHABLE();
2495
- }
2496
- return;
2497
- } else {
2498
- // Format(instr, "'memop'cond'b 'rd, ['rn, +'shift_rm]'w");
2499
- addr = rn_val + shifter_operand;
2500
- if (instr->HasW()) {
2501
- set_register(rn, addr);
2502
- }
2503
- }
2504
- break;
2505
- }
2506
- default: {
2507
- UNREACHABLE();
2508
- break;
2509
- }
2510
- }
2511
- if (instr->HasB()) {
2512
- if (instr->HasL()) {
2513
- uint8_t byte = ReadB(addr);
2514
- set_register(rd, byte);
2515
- } else {
2516
- uint8_t byte = get_register(rd);
2517
- WriteB(addr, byte);
2518
- }
2519
- } else {
2520
- if (instr->HasL()) {
2521
- set_register(rd, ReadW(addr, instr));
2522
- } else {
2523
- WriteW(addr, get_register(rd), instr);
2524
- }
2525
- }
2526
- }
2527
-
2528
-
2529
- void Simulator::DecodeType4(Instruction* instr) {
2530
- ASSERT(instr->Bit(22) == 0); // only allowed to be set in privileged mode
2531
- if (instr->HasL()) {
2532
- // Format(instr, "ldm'cond'pu 'rn'w, 'rlist");
2533
- HandleRList(instr, true);
2534
- } else {
2535
- // Format(instr, "stm'cond'pu 'rn'w, 'rlist");
2536
- HandleRList(instr, false);
2537
- }
2538
- }
2539
-
2540
-
2541
- void Simulator::DecodeType5(Instruction* instr) {
2542
- // Format(instr, "b'l'cond 'target");
2543
- int off = (instr->SImmed24Value() << 2);
2544
- intptr_t pc_address = get_pc();
2545
- if (instr->HasLink()) {
2546
- set_register(lr, pc_address + Instruction::kInstrSize);
2547
- }
2548
- int pc_reg = get_register(pc);
2549
- set_pc(pc_reg + off);
2550
- }
2551
-
2552
-
2553
- void Simulator::DecodeType6(Instruction* instr) {
2554
- DecodeType6CoprocessorIns(instr);
2555
- }
2556
-
2557
-
2558
- void Simulator::DecodeType7(Instruction* instr) {
2559
- if (instr->Bit(24) == 1) {
2560
- SoftwareInterrupt(instr);
2561
- } else {
2562
- DecodeTypeVFP(instr);
2563
- }
2564
- }
2565
-
2566
-
2567
- // void Simulator::DecodeTypeVFP(Instruction* instr)
2568
- // The Following ARMv7 VFPv instructions are currently supported.
2569
- // vmov :Sn = Rt
2570
- // vmov :Rt = Sn
2571
- // vcvt: Dd = Sm
2572
- // vcvt: Sd = Dm
2573
- // Dd = vabs(Dm)
2574
- // Dd = vneg(Dm)
2575
- // Dd = vadd(Dn, Dm)
2576
- // Dd = vsub(Dn, Dm)
2577
- // Dd = vmul(Dn, Dm)
2578
- // Dd = vdiv(Dn, Dm)
2579
- // vcmp(Dd, Dm)
2580
- // vmrs
2581
- // Dd = vsqrt(Dm)
2582
- void Simulator::DecodeTypeVFP(Instruction* instr) {
2583
- ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) );
2584
- ASSERT(instr->Bits(11, 9) == 0x5);
2585
-
2586
- // Obtain double precision register codes.
2587
- int vm = instr->VFPMRegValue(kDoublePrecision);
2588
- int vd = instr->VFPDRegValue(kDoublePrecision);
2589
- int vn = instr->VFPNRegValue(kDoublePrecision);
2590
-
2591
- if (instr->Bit(4) == 0) {
2592
- if (instr->Opc1Value() == 0x7) {
2593
- // Other data processing instructions
2594
- if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x1)) {
2595
- // vmov register to register.
2596
- if (instr->SzValue() == 0x1) {
2597
- int m = instr->VFPMRegValue(kDoublePrecision);
2598
- int d = instr->VFPDRegValue(kDoublePrecision);
2599
- set_d_register_from_double(d, get_double_from_d_register(m));
2600
- } else {
2601
- int m = instr->VFPMRegValue(kSinglePrecision);
2602
- int d = instr->VFPDRegValue(kSinglePrecision);
2603
- set_s_register_from_float(d, get_float_from_s_register(m));
2604
- }
2605
- } else if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x3)) {
2606
- // vabs
2607
- double dm_value = get_double_from_d_register(vm);
2608
- double dd_value = fabs(dm_value);
2609
- set_d_register_from_double(vd, dd_value);
2610
- } else if ((instr->Opc2Value() == 0x1) && (instr->Opc3Value() == 0x1)) {
2611
- // vneg
2612
- double dm_value = get_double_from_d_register(vm);
2613
- double dd_value = -dm_value;
2614
- set_d_register_from_double(vd, dd_value);
2615
- } else if ((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3)) {
2616
- DecodeVCVTBetweenDoubleAndSingle(instr);
2617
- } else if ((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) {
2618
- DecodeVCVTBetweenFloatingPointAndInteger(instr);
2619
- } else if (((instr->Opc2Value() >> 1) == 0x6) &&
2620
- (instr->Opc3Value() & 0x1)) {
2621
- DecodeVCVTBetweenFloatingPointAndInteger(instr);
2622
- } else if (((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
2623
- (instr->Opc3Value() & 0x1)) {
2624
- DecodeVCMP(instr);
2625
- } else if (((instr->Opc2Value() == 0x1)) && (instr->Opc3Value() == 0x3)) {
2626
- // vsqrt
2627
- double dm_value = get_double_from_d_register(vm);
2628
- double dd_value = sqrt(dm_value);
2629
- set_d_register_from_double(vd, dd_value);
2630
- } else if (instr->Opc3Value() == 0x0) {
2631
- // vmov immediate.
2632
- if (instr->SzValue() == 0x1) {
2633
- set_d_register_from_double(vd, instr->DoubleImmedVmov());
2634
- } else {
2635
- UNREACHABLE(); // Not used by v8.
2636
- }
2637
- } else {
2638
- UNREACHABLE(); // Not used by V8.
2639
- }
2640
- } else if (instr->Opc1Value() == 0x3) {
2641
- if (instr->SzValue() != 0x1) {
2642
- UNREACHABLE(); // Not used by V8.
2643
- }
2644
-
2645
- if (instr->Opc3Value() & 0x1) {
2646
- // vsub
2647
- double dn_value = get_double_from_d_register(vn);
2648
- double dm_value = get_double_from_d_register(vm);
2649
- double dd_value = dn_value - dm_value;
2650
- set_d_register_from_double(vd, dd_value);
2651
- } else {
2652
- // vadd
2653
- double dn_value = get_double_from_d_register(vn);
2654
- double dm_value = get_double_from_d_register(vm);
2655
- double dd_value = dn_value + dm_value;
2656
- set_d_register_from_double(vd, dd_value);
2657
- }
2658
- } else if ((instr->Opc1Value() == 0x2) && !(instr->Opc3Value() & 0x1)) {
2659
- // vmul
2660
- if (instr->SzValue() != 0x1) {
2661
- UNREACHABLE(); // Not used by V8.
2662
- }
2663
-
2664
- double dn_value = get_double_from_d_register(vn);
2665
- double dm_value = get_double_from_d_register(vm);
2666
- double dd_value = dn_value * dm_value;
2667
- set_d_register_from_double(vd, dd_value);
2668
- } else if ((instr->Opc1Value() == 0x4) && !(instr->Opc3Value() & 0x1)) {
2669
- // vdiv
2670
- if (instr->SzValue() != 0x1) {
2671
- UNREACHABLE(); // Not used by V8.
2672
- }
2673
-
2674
- double dn_value = get_double_from_d_register(vn);
2675
- double dm_value = get_double_from_d_register(vm);
2676
- double dd_value = dn_value / dm_value;
2677
- div_zero_vfp_flag_ = (dm_value == 0);
2678
- set_d_register_from_double(vd, dd_value);
2679
- } else {
2680
- UNIMPLEMENTED(); // Not used by V8.
2681
- }
2682
- } else {
2683
- if ((instr->VCValue() == 0x0) &&
2684
- (instr->VAValue() == 0x0)) {
2685
- DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr);
2686
- } else if ((instr->VLValue() == 0x1) &&
2687
- (instr->VCValue() == 0x0) &&
2688
- (instr->VAValue() == 0x7) &&
2689
- (instr->Bits(19, 16) == 0x1)) {
2690
- // vmrs
2691
- uint32_t rt = instr->RtValue();
2692
- if (rt == 0xF) {
2693
- Copy_FPSCR_to_APSR();
2694
- } else {
2695
- // Emulate FPSCR from the Simulator flags.
2696
- uint32_t fpscr = (n_flag_FPSCR_ << 31) |
2697
- (z_flag_FPSCR_ << 30) |
2698
- (c_flag_FPSCR_ << 29) |
2699
- (v_flag_FPSCR_ << 28) |
2700
- (inexact_vfp_flag_ << 4) |
2701
- (underflow_vfp_flag_ << 3) |
2702
- (overflow_vfp_flag_ << 2) |
2703
- (div_zero_vfp_flag_ << 1) |
2704
- (inv_op_vfp_flag_ << 0) |
2705
- (FPSCR_rounding_mode_);
2706
- set_register(rt, fpscr);
2707
- }
2708
- } else if ((instr->VLValue() == 0x0) &&
2709
- (instr->VCValue() == 0x0) &&
2710
- (instr->VAValue() == 0x7) &&
2711
- (instr->Bits(19, 16) == 0x1)) {
2712
- // vmsr
2713
- uint32_t rt = instr->RtValue();
2714
- if (rt == pc) {
2715
- UNREACHABLE();
2716
- } else {
2717
- uint32_t rt_value = get_register(rt);
2718
- n_flag_FPSCR_ = (rt_value >> 31) & 1;
2719
- z_flag_FPSCR_ = (rt_value >> 30) & 1;
2720
- c_flag_FPSCR_ = (rt_value >> 29) & 1;
2721
- v_flag_FPSCR_ = (rt_value >> 28) & 1;
2722
- inexact_vfp_flag_ = (rt_value >> 4) & 1;
2723
- underflow_vfp_flag_ = (rt_value >> 3) & 1;
2724
- overflow_vfp_flag_ = (rt_value >> 2) & 1;
2725
- div_zero_vfp_flag_ = (rt_value >> 1) & 1;
2726
- inv_op_vfp_flag_ = (rt_value >> 0) & 1;
2727
- FPSCR_rounding_mode_ =
2728
- static_cast<VFPRoundingMode>((rt_value) & kVFPRoundingModeMask);
2729
- }
2730
- } else {
2731
- UNIMPLEMENTED(); // Not used by V8.
2732
- }
2733
- }
2734
- }
2735
-
2736
-
2737
- void Simulator::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(
2738
- Instruction* instr) {
2739
- ASSERT((instr->Bit(4) == 1) && (instr->VCValue() == 0x0) &&
2740
- (instr->VAValue() == 0x0));
2741
-
2742
- int t = instr->RtValue();
2743
- int n = instr->VFPNRegValue(kSinglePrecision);
2744
- bool to_arm_register = (instr->VLValue() == 0x1);
2745
-
2746
- if (to_arm_register) {
2747
- int32_t int_value = get_sinteger_from_s_register(n);
2748
- set_register(t, int_value);
2749
- } else {
2750
- int32_t rs_val = get_register(t);
2751
- set_s_register_from_sinteger(n, rs_val);
2752
- }
2753
- }
2754
-
2755
-
2756
- void Simulator::DecodeVCMP(Instruction* instr) {
2757
- ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
2758
- ASSERT(((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
2759
- (instr->Opc3Value() & 0x1));
2760
- // Comparison.
2761
-
2762
- VFPRegPrecision precision = kSinglePrecision;
2763
- if (instr->SzValue() == 1) {
2764
- precision = kDoublePrecision;
2765
- }
2766
-
2767
- int d = instr->VFPDRegValue(precision);
2768
- int m = 0;
2769
- if (instr->Opc2Value() == 0x4) {
2770
- m = instr->VFPMRegValue(precision);
2771
- }
2772
-
2773
- if (precision == kDoublePrecision) {
2774
- double dd_value = get_double_from_d_register(d);
2775
- double dm_value = 0.0;
2776
- if (instr->Opc2Value() == 0x4) {
2777
- dm_value = get_double_from_d_register(m);
2778
- }
2779
-
2780
- // Raise exceptions for quiet NaNs if necessary.
2781
- if (instr->Bit(7) == 1) {
2782
- if (isnan(dd_value)) {
2783
- inv_op_vfp_flag_ = true;
2784
- }
2785
- }
2786
-
2787
- Compute_FPSCR_Flags(dd_value, dm_value);
2788
- } else {
2789
- UNIMPLEMENTED(); // Not used by V8.
2790
- }
2791
- }
2792
-
2793
-
2794
- void Simulator::DecodeVCVTBetweenDoubleAndSingle(Instruction* instr) {
2795
- ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
2796
- ASSERT((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3));
2797
-
2798
- VFPRegPrecision dst_precision = kDoublePrecision;
2799
- VFPRegPrecision src_precision = kSinglePrecision;
2800
- if (instr->SzValue() == 1) {
2801
- dst_precision = kSinglePrecision;
2802
- src_precision = kDoublePrecision;
2803
- }
2804
-
2805
- int dst = instr->VFPDRegValue(dst_precision);
2806
- int src = instr->VFPMRegValue(src_precision);
2807
-
2808
- if (dst_precision == kSinglePrecision) {
2809
- double val = get_double_from_d_register(src);
2810
- set_s_register_from_float(dst, static_cast<float>(val));
2811
- } else {
2812
- float val = get_float_from_s_register(src);
2813
- set_d_register_from_double(dst, static_cast<double>(val));
2814
- }
2815
- }
2816
-
2817
- bool get_inv_op_vfp_flag(VFPRoundingMode mode,
2818
- double val,
2819
- bool unsigned_) {
2820
- ASSERT((mode == RN) || (mode == RM) || (mode == RZ));
2821
- double max_uint = static_cast<double>(0xffffffffu);
2822
- double max_int = static_cast<double>(kMaxInt);
2823
- double min_int = static_cast<double>(kMinInt);
2824
-
2825
- // Check for NaN.
2826
- if (val != val) {
2827
- return true;
2828
- }
2829
-
2830
- // Check for overflow. This code works because 32bit integers can be
2831
- // exactly represented by ieee-754 64bit floating-point values.
2832
- switch (mode) {
2833
- case RN:
2834
- return unsigned_ ? (val >= (max_uint + 0.5)) ||
2835
- (val < -0.5)
2836
- : (val >= (max_int + 0.5)) ||
2837
- (val < (min_int - 0.5));
2838
-
2839
- case RM:
2840
- return unsigned_ ? (val >= (max_uint + 1.0)) ||
2841
- (val < 0)
2842
- : (val >= (max_int + 1.0)) ||
2843
- (val < min_int);
2844
-
2845
- case RZ:
2846
- return unsigned_ ? (val >= (max_uint + 1.0)) ||
2847
- (val <= -1)
2848
- : (val >= (max_int + 1.0)) ||
2849
- (val <= (min_int - 1.0));
2850
- default:
2851
- UNREACHABLE();
2852
- return true;
2853
- }
2854
- }
2855
-
2856
-
2857
- // We call this function only if we had a vfp invalid exception.
2858
- // It returns the correct saturated value.
2859
- int VFPConversionSaturate(double val, bool unsigned_res) {
2860
- if (val != val) {
2861
- return 0;
2862
- } else {
2863
- if (unsigned_res) {
2864
- return (val < 0) ? 0 : 0xffffffffu;
2865
- } else {
2866
- return (val < 0) ? kMinInt : kMaxInt;
2867
- }
2868
- }
2869
- }
2870
-
2871
-
2872
- void Simulator::DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr) {
2873
- ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7) &&
2874
- (instr->Bits(27, 23) == 0x1D));
2875
- ASSERT(((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) ||
2876
- (((instr->Opc2Value() >> 1) == 0x6) && (instr->Opc3Value() & 0x1)));
2877
-
2878
- // Conversion between floating-point and integer.
2879
- bool to_integer = (instr->Bit(18) == 1);
2880
-
2881
- VFPRegPrecision src_precision = (instr->SzValue() == 1) ? kDoublePrecision
2882
- : kSinglePrecision;
2883
-
2884
- if (to_integer) {
2885
- // We are playing with code close to the C++ standard's limits below,
2886
- // hence the very simple code and heavy checks.
2887
- //
2888
- // Note:
2889
- // C++ defines default type casting from floating point to integer as
2890
- // (close to) rounding toward zero ("fractional part discarded").
2891
-
2892
- int dst = instr->VFPDRegValue(kSinglePrecision);
2893
- int src = instr->VFPMRegValue(src_precision);
2894
-
2895
- // Bit 7 in vcvt instructions indicates if we should use the FPSCR rounding
2896
- // mode or the default Round to Zero mode.
2897
- VFPRoundingMode mode = (instr->Bit(7) != 1) ? FPSCR_rounding_mode_
2898
- : RZ;
2899
- ASSERT((mode == RM) || (mode == RZ) || (mode == RN));
2900
-
2901
- bool unsigned_integer = (instr->Bit(16) == 0);
2902
- bool double_precision = (src_precision == kDoublePrecision);
2903
-
2904
- double val = double_precision ? get_double_from_d_register(src)
2905
- : get_float_from_s_register(src);
2906
-
2907
- int temp = unsigned_integer ? static_cast<uint32_t>(val)
2908
- : static_cast<int32_t>(val);
2909
-
2910
- inv_op_vfp_flag_ = get_inv_op_vfp_flag(mode, val, unsigned_integer);
2911
-
2912
- double abs_diff =
2913
- unsigned_integer ? fabs(val - static_cast<uint32_t>(temp))
2914
- : fabs(val - temp);
2915
-
2916
- inexact_vfp_flag_ = (abs_diff != 0);
2917
-
2918
- if (inv_op_vfp_flag_) {
2919
- temp = VFPConversionSaturate(val, unsigned_integer);
2920
- } else {
2921
- switch (mode) {
2922
- case RN: {
2923
- int val_sign = (val > 0) ? 1 : -1;
2924
- if (abs_diff > 0.5) {
2925
- temp += val_sign;
2926
- } else if (abs_diff == 0.5) {
2927
- // Round to even if exactly halfway.
2928
- temp = ((temp % 2) == 0) ? temp : temp + val_sign;
2929
- }
2930
- break;
2931
- }
2932
-
2933
- case RM:
2934
- temp = temp > val ? temp - 1 : temp;
2935
- break;
2936
-
2937
- case RZ:
2938
- // Nothing to do.
2939
- break;
2940
-
2941
- default:
2942
- UNREACHABLE();
2943
- }
2944
- }
2945
-
2946
- // Update the destination register.
2947
- set_s_register_from_sinteger(dst, temp);
2948
-
2949
- } else {
2950
- bool unsigned_integer = (instr->Bit(7) == 0);
2951
-
2952
- int dst = instr->VFPDRegValue(src_precision);
2953
- int src = instr->VFPMRegValue(kSinglePrecision);
2954
-
2955
- int val = get_sinteger_from_s_register(src);
2956
-
2957
- if (src_precision == kDoublePrecision) {
2958
- if (unsigned_integer) {
2959
- set_d_register_from_double(dst,
2960
- static_cast<double>((uint32_t)val));
2961
- } else {
2962
- set_d_register_from_double(dst, static_cast<double>(val));
2963
- }
2964
- } else {
2965
- if (unsigned_integer) {
2966
- set_s_register_from_float(dst,
2967
- static_cast<float>((uint32_t)val));
2968
- } else {
2969
- set_s_register_from_float(dst, static_cast<float>(val));
2970
- }
2971
- }
2972
- }
2973
- }
2974
-
2975
-
2976
- // void Simulator::DecodeType6CoprocessorIns(Instruction* instr)
2977
- // Decode Type 6 coprocessor instructions.
2978
- // Dm = vmov(Rt, Rt2)
2979
- // <Rt, Rt2> = vmov(Dm)
2980
- // Ddst = MEM(Rbase + 4*offset).
2981
- // MEM(Rbase + 4*offset) = Dsrc.
2982
- void Simulator::DecodeType6CoprocessorIns(Instruction* instr) {
2983
- ASSERT((instr->TypeValue() == 6));
2984
-
2985
- if (instr->CoprocessorValue() == 0xA) {
2986
- switch (instr->OpcodeValue()) {
2987
- case 0x8:
2988
- case 0xA:
2989
- case 0xC:
2990
- case 0xE: { // Load and store single precision float to memory.
2991
- int rn = instr->RnValue();
2992
- int vd = instr->VFPDRegValue(kSinglePrecision);
2993
- int offset = instr->Immed8Value();
2994
- if (!instr->HasU()) {
2995
- offset = -offset;
2996
- }
2997
-
2998
- int32_t address = get_register(rn) + 4 * offset;
2999
- if (instr->HasL()) {
3000
- // Load double from memory: vldr.
3001
- set_s_register_from_sinteger(vd, ReadW(address, instr));
3002
- } else {
3003
- // Store double to memory: vstr.
3004
- WriteW(address, get_sinteger_from_s_register(vd), instr);
3005
- }
3006
- break;
3007
- }
3008
- case 0x4:
3009
- case 0x5:
3010
- case 0x6:
3011
- case 0x7:
3012
- case 0x9:
3013
- case 0xB:
3014
- // Load/store multiple single from memory: vldm/vstm.
3015
- HandleVList(instr);
3016
- break;
3017
- default:
3018
- UNIMPLEMENTED(); // Not used by V8.
3019
- }
3020
- } else if (instr->CoprocessorValue() == 0xB) {
3021
- switch (instr->OpcodeValue()) {
3022
- case 0x2:
3023
- // Load and store double to two GP registers
3024
- if (instr->Bits(7, 4) != 0x1) {
3025
- UNIMPLEMENTED(); // Not used by V8.
3026
- } else {
3027
- int rt = instr->RtValue();
3028
- int rn = instr->RnValue();
3029
- int vm = instr->VmValue();
3030
- if (instr->HasL()) {
3031
- int32_t rt_int_value = get_sinteger_from_s_register(2*vm);
3032
- int32_t rn_int_value = get_sinteger_from_s_register(2*vm+1);
3033
-
3034
- set_register(rt, rt_int_value);
3035
- set_register(rn, rn_int_value);
3036
- } else {
3037
- int32_t rs_val = get_register(rt);
3038
- int32_t rn_val = get_register(rn);
3039
-
3040
- set_s_register_from_sinteger(2*vm, rs_val);
3041
- set_s_register_from_sinteger((2*vm+1), rn_val);
3042
- }
3043
- }
3044
- break;
3045
- case 0x8:
3046
- case 0xC: { // Load and store double to memory.
3047
- int rn = instr->RnValue();
3048
- int vd = instr->VdValue();
3049
- int offset = instr->Immed8Value();
3050
- if (!instr->HasU()) {
3051
- offset = -offset;
3052
- }
3053
- int32_t address = get_register(rn) + 4 * offset;
3054
- if (instr->HasL()) {
3055
- // Load double from memory: vldr.
3056
- set_s_register_from_sinteger(2*vd, ReadW(address, instr));
3057
- set_s_register_from_sinteger(2*vd + 1, ReadW(address + 4, instr));
3058
- } else {
3059
- // Store double to memory: vstr.
3060
- WriteW(address, get_sinteger_from_s_register(2*vd), instr);
3061
- WriteW(address + 4, get_sinteger_from_s_register(2*vd + 1), instr);
3062
- }
3063
- break;
3064
- }
3065
- case 0x4:
3066
- case 0x5:
3067
- case 0x9:
3068
- // Load/store multiple double from memory: vldm/vstm.
3069
- HandleVList(instr);
3070
- break;
3071
- default:
3072
- UNIMPLEMENTED(); // Not used by V8.
3073
- }
3074
- } else {
3075
- UNIMPLEMENTED(); // Not used by V8.
3076
- }
3077
- }
3078
-
3079
-
3080
- // Executes the current instruction.
3081
- void Simulator::InstructionDecode(Instruction* instr) {
3082
- if (v8::internal::FLAG_check_icache) {
3083
- CheckICache(isolate_->simulator_i_cache(), instr);
3084
- }
3085
- pc_modified_ = false;
3086
- if (::v8::internal::FLAG_trace_sim) {
3087
- disasm::NameConverter converter;
3088
- disasm::Disassembler dasm(converter);
3089
- // use a reasonably large buffer
3090
- v8::internal::EmbeddedVector<char, 256> buffer;
3091
- dasm.InstructionDecode(buffer,
3092
- reinterpret_cast<byte*>(instr));
3093
- PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr), buffer.start());
3094
- }
3095
- if (instr->ConditionField() == kSpecialCondition) {
3096
- UNIMPLEMENTED();
3097
- } else if (ConditionallyExecute(instr)) {
3098
- switch (instr->TypeValue()) {
3099
- case 0:
3100
- case 1: {
3101
- DecodeType01(instr);
3102
- break;
3103
- }
3104
- case 2: {
3105
- DecodeType2(instr);
3106
- break;
3107
- }
3108
- case 3: {
3109
- DecodeType3(instr);
3110
- break;
3111
- }
3112
- case 4: {
3113
- DecodeType4(instr);
3114
- break;
3115
- }
3116
- case 5: {
3117
- DecodeType5(instr);
3118
- break;
3119
- }
3120
- case 6: {
3121
- DecodeType6(instr);
3122
- break;
3123
- }
3124
- case 7: {
3125
- DecodeType7(instr);
3126
- break;
3127
- }
3128
- default: {
3129
- UNIMPLEMENTED();
3130
- break;
3131
- }
3132
- }
3133
- // If the instruction is a non taken conditional stop, we need to skip the
3134
- // inlined message address.
3135
- } else if (instr->IsStop()) {
3136
- set_pc(get_pc() + 2 * Instruction::kInstrSize);
3137
- }
3138
- if (!pc_modified_) {
3139
- set_register(pc, reinterpret_cast<int32_t>(instr)
3140
- + Instruction::kInstrSize);
3141
- }
3142
- }
3143
-
3144
-
3145
- void Simulator::Execute() {
3146
- // Get the PC to simulate. Cannot use the accessor here as we need the
3147
- // raw PC value and not the one used as input to arithmetic instructions.
3148
- int program_counter = get_pc();
3149
-
3150
- if (::v8::internal::FLAG_stop_sim_at == 0) {
3151
- // Fast version of the dispatch loop without checking whether the simulator
3152
- // should be stopping at a particular executed instruction.
3153
- while (program_counter != end_sim_pc) {
3154
- Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
3155
- icount_++;
3156
- InstructionDecode(instr);
3157
- program_counter = get_pc();
3158
- }
3159
- } else {
3160
- // FLAG_stop_sim_at is at the non-default value. Stop in the debugger when
3161
- // we reach the particular instuction count.
3162
- while (program_counter != end_sim_pc) {
3163
- Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
3164
- icount_++;
3165
- if (icount_ == ::v8::internal::FLAG_stop_sim_at) {
3166
- ArmDebugger dbg(this);
3167
- dbg.Debug();
3168
- } else {
3169
- InstructionDecode(instr);
3170
- }
3171
- program_counter = get_pc();
3172
- }
3173
- }
3174
- }
3175
-
3176
-
3177
- int32_t Simulator::Call(byte* entry, int argument_count, ...) {
3178
- va_list parameters;
3179
- va_start(parameters, argument_count);
3180
- // Setup arguments
3181
-
3182
- // First four arguments passed in registers.
3183
- ASSERT(argument_count >= 4);
3184
- set_register(r0, va_arg(parameters, int32_t));
3185
- set_register(r1, va_arg(parameters, int32_t));
3186
- set_register(r2, va_arg(parameters, int32_t));
3187
- set_register(r3, va_arg(parameters, int32_t));
3188
-
3189
- // Remaining arguments passed on stack.
3190
- int original_stack = get_register(sp);
3191
- // Compute position of stack on entry to generated code.
3192
- int entry_stack = (original_stack - (argument_count - 4) * sizeof(int32_t));
3193
- if (OS::ActivationFrameAlignment() != 0) {
3194
- entry_stack &= -OS::ActivationFrameAlignment();
3195
- }
3196
- // Store remaining arguments on stack, from low to high memory.
3197
- intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
3198
- for (int i = 4; i < argument_count; i++) {
3199
- stack_argument[i - 4] = va_arg(parameters, int32_t);
3200
- }
3201
- va_end(parameters);
3202
- set_register(sp, entry_stack);
3203
-
3204
- // Prepare to execute the code at entry
3205
- set_register(pc, reinterpret_cast<int32_t>(entry));
3206
- // Put down marker for end of simulation. The simulator will stop simulation
3207
- // when the PC reaches this value. By saving the "end simulation" value into
3208
- // the LR the simulation stops when returning to this call point.
3209
- set_register(lr, end_sim_pc);
3210
-
3211
- // Remember the values of callee-saved registers.
3212
- // The code below assumes that r9 is not used as sb (static base) in
3213
- // simulator code and therefore is regarded as a callee-saved register.
3214
- int32_t r4_val = get_register(r4);
3215
- int32_t r5_val = get_register(r5);
3216
- int32_t r6_val = get_register(r6);
3217
- int32_t r7_val = get_register(r7);
3218
- int32_t r8_val = get_register(r8);
3219
- int32_t r9_val = get_register(r9);
3220
- int32_t r10_val = get_register(r10);
3221
- int32_t r11_val = get_register(r11);
3222
-
3223
- // Setup the callee-saved registers with a known value. To be able to check
3224
- // that they are preserved properly across JS execution.
3225
- int32_t callee_saved_value = icount_;
3226
- set_register(r4, callee_saved_value);
3227
- set_register(r5, callee_saved_value);
3228
- set_register(r6, callee_saved_value);
3229
- set_register(r7, callee_saved_value);
3230
- set_register(r8, callee_saved_value);
3231
- set_register(r9, callee_saved_value);
3232
- set_register(r10, callee_saved_value);
3233
- set_register(r11, callee_saved_value);
3234
-
3235
- // Start the simulation
3236
- Execute();
3237
-
3238
- // Check that the callee-saved registers have been preserved.
3239
- CHECK_EQ(callee_saved_value, get_register(r4));
3240
- CHECK_EQ(callee_saved_value, get_register(r5));
3241
- CHECK_EQ(callee_saved_value, get_register(r6));
3242
- CHECK_EQ(callee_saved_value, get_register(r7));
3243
- CHECK_EQ(callee_saved_value, get_register(r8));
3244
- CHECK_EQ(callee_saved_value, get_register(r9));
3245
- CHECK_EQ(callee_saved_value, get_register(r10));
3246
- CHECK_EQ(callee_saved_value, get_register(r11));
3247
-
3248
- // Restore callee-saved registers with the original value.
3249
- set_register(r4, r4_val);
3250
- set_register(r5, r5_val);
3251
- set_register(r6, r6_val);
3252
- set_register(r7, r7_val);
3253
- set_register(r8, r8_val);
3254
- set_register(r9, r9_val);
3255
- set_register(r10, r10_val);
3256
- set_register(r11, r11_val);
3257
-
3258
- // Pop stack passed arguments.
3259
- CHECK_EQ(entry_stack, get_register(sp));
3260
- set_register(sp, original_stack);
3261
-
3262
- int32_t result = get_register(r0);
3263
- return result;
3264
- }
3265
-
3266
-
3267
- uintptr_t Simulator::PushAddress(uintptr_t address) {
3268
- int new_sp = get_register(sp) - sizeof(uintptr_t);
3269
- uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(new_sp);
3270
- *stack_slot = address;
3271
- set_register(sp, new_sp);
3272
- return new_sp;
3273
- }
3274
-
3275
-
3276
- uintptr_t Simulator::PopAddress() {
3277
- int current_sp = get_register(sp);
3278
- uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
3279
- uintptr_t address = *stack_slot;
3280
- set_register(sp, current_sp + sizeof(uintptr_t));
3281
- return address;
3282
- }
3283
-
3284
- } } // namespace v8::internal
3285
-
3286
- #endif // USE_SIMULATOR
3287
-
3288
- #endif // V8_TARGET_ARCH_ARM