libv8 3.3.10.4 → 3.5.10.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (538) hide show
  1. data/lib/libv8/scons/CHANGES.txt +24 -231
  2. data/lib/libv8/scons/LICENSE.txt +1 -1
  3. data/lib/libv8/scons/MANIFEST +0 -1
  4. data/lib/libv8/scons/PKG-INFO +1 -1
  5. data/lib/libv8/scons/README.txt +9 -9
  6. data/lib/libv8/scons/RELEASE.txt +75 -77
  7. data/lib/libv8/scons/engine/SCons/Action.py +6 -22
  8. data/lib/libv8/scons/engine/SCons/Builder.py +2 -2
  9. data/lib/libv8/scons/engine/SCons/CacheDir.py +2 -2
  10. data/lib/libv8/scons/engine/SCons/Debug.py +2 -2
  11. data/lib/libv8/scons/engine/SCons/Defaults.py +10 -24
  12. data/lib/libv8/scons/engine/SCons/Environment.py +19 -118
  13. data/lib/libv8/scons/engine/SCons/Errors.py +2 -2
  14. data/lib/libv8/scons/engine/SCons/Executor.py +2 -2
  15. data/lib/libv8/scons/engine/SCons/Job.py +2 -2
  16. data/lib/libv8/scons/engine/SCons/Memoize.py +2 -2
  17. data/lib/libv8/scons/engine/SCons/Node/Alias.py +2 -2
  18. data/lib/libv8/scons/engine/SCons/Node/FS.py +121 -281
  19. data/lib/libv8/scons/engine/SCons/Node/Python.py +2 -2
  20. data/lib/libv8/scons/engine/SCons/Node/__init__.py +5 -6
  21. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +2 -2
  22. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +2 -2
  23. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +2 -2
  24. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +2 -2
  25. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +2 -2
  26. data/lib/libv8/scons/engine/SCons/Options/__init__.py +2 -2
  27. data/lib/libv8/scons/engine/SCons/PathList.py +2 -2
  28. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +2 -2
  29. data/lib/libv8/scons/engine/SCons/Platform/aix.py +2 -2
  30. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +2 -2
  31. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +3 -27
  32. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +2 -2
  33. data/lib/libv8/scons/engine/SCons/Platform/irix.py +2 -2
  34. data/lib/libv8/scons/engine/SCons/Platform/os2.py +2 -2
  35. data/lib/libv8/scons/engine/SCons/Platform/posix.py +2 -2
  36. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +2 -2
  37. data/lib/libv8/scons/engine/SCons/Platform/win32.py +2 -2
  38. data/lib/libv8/scons/engine/SCons/SConf.py +2 -2
  39. data/lib/libv8/scons/engine/SCons/SConsign.py +3 -9
  40. data/lib/libv8/scons/engine/SCons/Scanner/C.py +2 -2
  41. data/lib/libv8/scons/engine/SCons/Scanner/D.py +2 -2
  42. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +2 -2
  43. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +2 -2
  44. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +2 -2
  45. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +2 -5
  46. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +2 -2
  47. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +3 -3
  48. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +2 -2
  49. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +2 -2
  50. data/lib/libv8/scons/engine/SCons/Script/Main.py +11 -82
  51. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +5 -5
  52. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +2 -2
  53. data/lib/libv8/scons/engine/SCons/Script/__init__.py +2 -2
  54. data/lib/libv8/scons/engine/SCons/Sig.py +2 -2
  55. data/lib/libv8/scons/engine/SCons/Subst.py +2 -2
  56. data/lib/libv8/scons/engine/SCons/Taskmaster.py +2 -10
  57. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +2 -2
  58. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +2 -2
  59. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +2 -2
  60. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +2 -19
  61. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +2 -2
  62. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +2 -2
  63. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +2 -2
  64. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +2 -2
  65. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +2 -2
  66. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +2 -2
  67. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +6 -9
  68. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +2 -29
  69. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +2 -2
  70. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +2 -2
  71. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +2 -2
  72. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +2 -2
  73. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +2 -2
  74. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +3 -3
  75. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +2 -2
  76. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +2 -2
  77. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +2 -2
  78. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +2 -2
  79. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +2 -2
  80. data/lib/libv8/scons/engine/SCons/Tool/ar.py +2 -2
  81. data/lib/libv8/scons/engine/SCons/Tool/as.py +2 -2
  82. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +2 -2
  83. data/lib/libv8/scons/engine/SCons/Tool/c++.py +2 -2
  84. data/lib/libv8/scons/engine/SCons/Tool/cc.py +2 -2
  85. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +2 -2
  86. data/lib/libv8/scons/engine/SCons/Tool/default.py +2 -2
  87. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +7 -24
  88. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +2 -2
  89. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +2 -3
  90. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +2 -3
  91. data/lib/libv8/scons/engine/SCons/Tool/f77.py +2 -2
  92. data/lib/libv8/scons/engine/SCons/Tool/f90.py +2 -2
  93. data/lib/libv8/scons/engine/SCons/Tool/f95.py +2 -2
  94. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +2 -2
  95. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +2 -2
  96. data/lib/libv8/scons/engine/SCons/Tool/g++.py +2 -2
  97. data/lib/libv8/scons/engine/SCons/Tool/g77.py +2 -2
  98. data/lib/libv8/scons/engine/SCons/Tool/gas.py +2 -2
  99. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +2 -2
  100. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +3 -3
  101. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +3 -2
  102. data/lib/libv8/scons/engine/SCons/Tool/gs.py +2 -2
  103. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +2 -2
  104. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +2 -2
  105. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +2 -2
  106. data/lib/libv8/scons/engine/SCons/Tool/icc.py +2 -2
  107. data/lib/libv8/scons/engine/SCons/Tool/icl.py +2 -2
  108. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +2 -2
  109. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +2 -2
  110. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +2 -2
  111. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +2 -2
  112. data/lib/libv8/scons/engine/SCons/Tool/install.py +3 -57
  113. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +25 -65
  114. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +2 -2
  115. data/lib/libv8/scons/engine/SCons/Tool/jar.py +3 -9
  116. data/lib/libv8/scons/engine/SCons/Tool/javac.py +2 -2
  117. data/lib/libv8/scons/engine/SCons/Tool/javah.py +2 -2
  118. data/lib/libv8/scons/engine/SCons/Tool/latex.py +2 -3
  119. data/lib/libv8/scons/engine/SCons/Tool/lex.py +2 -2
  120. data/lib/libv8/scons/engine/SCons/Tool/link.py +5 -6
  121. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +2 -2
  122. data/lib/libv8/scons/engine/SCons/Tool/m4.py +2 -2
  123. data/lib/libv8/scons/engine/SCons/Tool/masm.py +2 -2
  124. data/lib/libv8/scons/engine/SCons/Tool/midl.py +2 -2
  125. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +10 -31
  126. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +2 -2
  127. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +9 -61
  128. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +2 -2
  129. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +11 -21
  130. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +59 -477
  131. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +2 -2
  132. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +2 -2
  133. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +2 -2
  134. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +2 -2
  135. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +2 -2
  136. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +2 -2
  137. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +2 -2
  138. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +2 -2
  139. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +2 -2
  140. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +2 -2
  141. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +2 -2
  142. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +2 -2
  143. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +2 -2
  144. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +2 -2
  145. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +2 -3
  146. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +2 -3
  147. data/lib/libv8/scons/engine/SCons/Tool/qt.py +2 -2
  148. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +3 -9
  149. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +2 -2
  150. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +2 -2
  151. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +2 -2
  152. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +2 -2
  153. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +2 -2
  154. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +3 -2
  155. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +2 -2
  156. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +2 -2
  157. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +2 -2
  158. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +2 -2
  159. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +2 -2
  160. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +2 -2
  161. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +3 -2
  162. data/lib/libv8/scons/engine/SCons/Tool/swig.py +5 -6
  163. data/lib/libv8/scons/engine/SCons/Tool/tar.py +2 -2
  164. data/lib/libv8/scons/engine/SCons/Tool/tex.py +43 -96
  165. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +2 -2
  166. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +2 -2
  167. data/lib/libv8/scons/engine/SCons/Tool/wix.py +2 -2
  168. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +2 -12
  169. data/lib/libv8/scons/engine/SCons/Tool/zip.py +2 -2
  170. data/lib/libv8/scons/engine/SCons/Util.py +3 -3
  171. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +2 -2
  172. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +3 -3
  173. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +2 -2
  174. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +2 -2
  175. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +2 -2
  176. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +2 -2
  177. data/lib/libv8/scons/engine/SCons/Warnings.py +2 -2
  178. data/lib/libv8/scons/engine/SCons/__init__.py +6 -6
  179. data/lib/libv8/scons/engine/SCons/compat/__init__.py +2 -2
  180. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +2 -2
  181. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +2 -2
  182. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +2 -2
  183. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +2 -2
  184. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +2 -2
  185. data/lib/libv8/scons/engine/SCons/cpp.py +2 -2
  186. data/lib/libv8/scons/engine/SCons/dblite.py +1 -4
  187. data/lib/libv8/scons/engine/SCons/exitfuncs.py +2 -2
  188. data/lib/libv8/scons/scons-time.1 +3 -3
  189. data/lib/libv8/scons/scons.1 +1164 -1170
  190. data/lib/libv8/scons/sconsign.1 +3 -3
  191. data/lib/libv8/scons/script/scons +22 -22
  192. data/lib/libv8/scons/script/scons-time +2 -2
  193. data/lib/libv8/scons/script/scons.bat +4 -7
  194. data/lib/libv8/scons/script/sconsign +20 -21
  195. data/lib/libv8/scons/setup.cfg +1 -0
  196. data/lib/libv8/scons/setup.py +40 -38
  197. data/lib/libv8/v8/.gitignore +1 -1
  198. data/lib/libv8/v8/AUTHORS +2 -0
  199. data/lib/libv8/v8/ChangeLog +387 -0
  200. data/lib/libv8/v8/Makefile +171 -0
  201. data/lib/libv8/v8/SConstruct +124 -51
  202. data/lib/libv8/v8/build/README.txt +31 -14
  203. data/lib/libv8/v8/build/all.gyp +11 -4
  204. data/lib/libv8/v8/build/armu.gypi +6 -2
  205. data/lib/libv8/v8/build/common.gypi +240 -94
  206. data/lib/libv8/v8/build/gyp_v8 +32 -4
  207. data/lib/libv8/v8/build/standalone.gypi +200 -0
  208. data/lib/libv8/v8/include/v8-debug.h +0 -0
  209. data/lib/libv8/v8/include/v8-profiler.h +8 -11
  210. data/lib/libv8/v8/include/v8.h +191 -108
  211. data/lib/libv8/v8/preparser/SConscript +2 -2
  212. data/lib/libv8/v8/preparser/preparser-process.cc +3 -3
  213. data/lib/libv8/v8/preparser/preparser.gyp +42 -0
  214. data/lib/libv8/v8/src/SConscript +33 -8
  215. data/lib/libv8/v8/src/accessors.cc +77 -43
  216. data/lib/libv8/v8/src/api.cc +393 -191
  217. data/lib/libv8/v8/src/api.h +4 -8
  218. data/lib/libv8/v8/src/apinatives.js +15 -3
  219. data/lib/libv8/v8/src/arguments.h +8 -0
  220. data/lib/libv8/v8/src/arm/assembler-arm.cc +120 -120
  221. data/lib/libv8/v8/src/arm/assembler-arm.h +92 -43
  222. data/lib/libv8/v8/src/arm/builtins-arm.cc +32 -39
  223. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +572 -351
  224. data/lib/libv8/v8/src/arm/code-stubs-arm.h +8 -77
  225. data/lib/libv8/v8/src/arm/codegen-arm.h +0 -2
  226. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +50 -30
  227. data/lib/libv8/v8/src/arm/disasm-arm.cc +1 -1
  228. data/lib/libv8/v8/src/arm/frames-arm.h +9 -5
  229. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +331 -432
  230. data/lib/libv8/v8/src/arm/ic-arm.cc +192 -124
  231. data/lib/libv8/v8/src/arm/lithium-arm.cc +216 -232
  232. data/lib/libv8/v8/src/arm/lithium-arm.h +106 -259
  233. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +633 -642
  234. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +4 -4
  235. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +1 -3
  236. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +260 -185
  237. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +45 -25
  238. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +25 -13
  239. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +3 -0
  240. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +413 -226
  241. data/lib/libv8/v8/src/array.js +38 -18
  242. data/lib/libv8/v8/src/assembler.cc +12 -5
  243. data/lib/libv8/v8/src/assembler.h +15 -9
  244. data/lib/libv8/v8/src/ast-inl.h +34 -25
  245. data/lib/libv8/v8/src/ast.cc +141 -72
  246. data/lib/libv8/v8/src/ast.h +255 -181
  247. data/lib/libv8/v8/src/bignum.cc +3 -4
  248. data/lib/libv8/v8/src/bootstrapper.cc +55 -11
  249. data/lib/libv8/v8/src/bootstrapper.h +3 -2
  250. data/lib/libv8/v8/src/builtins.cc +8 -2
  251. data/lib/libv8/v8/src/builtins.h +4 -0
  252. data/lib/libv8/v8/src/cached-powers.cc +8 -4
  253. data/lib/libv8/v8/src/checks.h +3 -3
  254. data/lib/libv8/v8/src/code-stubs.cc +173 -28
  255. data/lib/libv8/v8/src/code-stubs.h +104 -148
  256. data/lib/libv8/v8/src/codegen.cc +8 -8
  257. data/lib/libv8/v8/src/compilation-cache.cc +2 -47
  258. data/lib/libv8/v8/src/compilation-cache.h +0 -10
  259. data/lib/libv8/v8/src/compiler.cc +27 -16
  260. data/lib/libv8/v8/src/compiler.h +13 -18
  261. data/lib/libv8/v8/src/contexts.cc +107 -72
  262. data/lib/libv8/v8/src/contexts.h +70 -34
  263. data/lib/libv8/v8/src/conversions-inl.h +572 -14
  264. data/lib/libv8/v8/src/conversions.cc +9 -707
  265. data/lib/libv8/v8/src/conversions.h +23 -12
  266. data/lib/libv8/v8/src/cpu-profiler-inl.h +2 -19
  267. data/lib/libv8/v8/src/cpu-profiler.cc +4 -21
  268. data/lib/libv8/v8/src/cpu-profiler.h +8 -17
  269. data/lib/libv8/v8/src/d8-debug.cc +5 -3
  270. data/lib/libv8/v8/src/d8-debug.h +6 -7
  271. data/lib/libv8/v8/src/d8-posix.cc +1 -10
  272. data/lib/libv8/v8/src/d8.cc +721 -219
  273. data/lib/libv8/v8/src/d8.gyp +37 -12
  274. data/lib/libv8/v8/src/d8.h +141 -19
  275. data/lib/libv8/v8/src/d8.js +17 -8
  276. data/lib/libv8/v8/src/date.js +16 -5
  277. data/lib/libv8/v8/src/dateparser-inl.h +242 -39
  278. data/lib/libv8/v8/src/dateparser.cc +38 -4
  279. data/lib/libv8/v8/src/dateparser.h +170 -28
  280. data/lib/libv8/v8/src/debug-agent.cc +5 -3
  281. data/lib/libv8/v8/src/debug-agent.h +11 -7
  282. data/lib/libv8/v8/src/debug-debugger.js +65 -34
  283. data/lib/libv8/v8/src/debug.cc +30 -60
  284. data/lib/libv8/v8/src/debug.h +5 -3
  285. data/lib/libv8/v8/src/deoptimizer.cc +227 -10
  286. data/lib/libv8/v8/src/deoptimizer.h +133 -9
  287. data/lib/libv8/v8/src/disassembler.cc +22 -14
  288. data/lib/libv8/v8/src/diy-fp.cc +4 -3
  289. data/lib/libv8/v8/src/diy-fp.h +3 -3
  290. data/lib/libv8/v8/src/elements.cc +634 -0
  291. data/lib/libv8/v8/src/elements.h +95 -0
  292. data/lib/libv8/v8/src/execution.cc +5 -21
  293. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +3 -1
  294. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +1 -1
  295. data/lib/libv8/v8/src/extensions/experimental/collator.cc +6 -2
  296. data/lib/libv8/v8/src/extensions/experimental/collator.h +1 -2
  297. data/lib/libv8/v8/src/extensions/experimental/datetime-format.cc +384 -0
  298. data/lib/libv8/v8/src/extensions/experimental/datetime-format.h +83 -0
  299. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +18 -7
  300. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +12 -16
  301. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +1 -1
  302. data/lib/libv8/v8/src/extensions/experimental/i18n-js2c.py +126 -0
  303. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +3 -4
  304. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +1 -1
  305. data/lib/libv8/v8/src/{shell.h → extensions/experimental/i18n-natives.h} +8 -20
  306. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +45 -1
  307. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +21 -1
  308. data/lib/libv8/v8/src/extensions/experimental/i18n.js +211 -11
  309. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +4 -3
  310. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +1 -1
  311. data/lib/libv8/v8/src/extensions/experimental/number-format.cc +374 -0
  312. data/lib/libv8/v8/src/extensions/experimental/number-format.h +71 -0
  313. data/lib/libv8/v8/src/factory.cc +89 -18
  314. data/lib/libv8/v8/src/factory.h +36 -8
  315. data/lib/libv8/v8/src/flag-definitions.h +11 -44
  316. data/lib/libv8/v8/src/frames-inl.h +8 -1
  317. data/lib/libv8/v8/src/frames.cc +39 -3
  318. data/lib/libv8/v8/src/frames.h +10 -3
  319. data/lib/libv8/v8/src/full-codegen.cc +311 -293
  320. data/lib/libv8/v8/src/full-codegen.h +183 -143
  321. data/lib/libv8/v8/src/func-name-inferrer.cc +29 -15
  322. data/lib/libv8/v8/src/func-name-inferrer.h +19 -9
  323. data/lib/libv8/v8/src/gdb-jit.cc +658 -55
  324. data/lib/libv8/v8/src/gdb-jit.h +6 -2
  325. data/lib/libv8/v8/src/global-handles.cc +368 -312
  326. data/lib/libv8/v8/src/global-handles.h +29 -36
  327. data/lib/libv8/v8/src/globals.h +3 -1
  328. data/lib/libv8/v8/src/handles.cc +43 -69
  329. data/lib/libv8/v8/src/handles.h +21 -16
  330. data/lib/libv8/v8/src/heap-inl.h +11 -13
  331. data/lib/libv8/v8/src/heap-profiler.cc +0 -999
  332. data/lib/libv8/v8/src/heap-profiler.h +0 -303
  333. data/lib/libv8/v8/src/heap.cc +366 -141
  334. data/lib/libv8/v8/src/heap.h +87 -26
  335. data/lib/libv8/v8/src/hydrogen-instructions.cc +192 -81
  336. data/lib/libv8/v8/src/hydrogen-instructions.h +711 -482
  337. data/lib/libv8/v8/src/hydrogen.cc +1146 -629
  338. data/lib/libv8/v8/src/hydrogen.h +100 -64
  339. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +19 -0
  340. data/lib/libv8/v8/src/ia32/assembler-ia32.h +15 -2
  341. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +34 -39
  342. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +675 -377
  343. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +8 -69
  344. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +1 -0
  345. data/lib/libv8/v8/src/ia32/codegen-ia32.h +0 -2
  346. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +3 -2
  347. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +28 -3
  348. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +21 -10
  349. data/lib/libv8/v8/src/ia32/frames-ia32.h +6 -5
  350. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +459 -465
  351. data/lib/libv8/v8/src/ia32/ic-ia32.cc +196 -147
  352. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +575 -650
  353. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +19 -21
  354. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +7 -2
  355. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +261 -256
  356. data/lib/libv8/v8/src/ia32/lithium-ia32.h +234 -335
  357. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +224 -67
  358. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +63 -19
  359. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +22 -8
  360. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +3 -0
  361. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +380 -239
  362. data/lib/libv8/v8/src/ic.cc +198 -234
  363. data/lib/libv8/v8/src/ic.h +32 -30
  364. data/lib/libv8/v8/src/interpreter-irregexp.cc +6 -4
  365. data/lib/libv8/v8/src/isolate.cc +112 -95
  366. data/lib/libv8/v8/src/isolate.h +55 -71
  367. data/lib/libv8/v8/src/json-parser.h +486 -48
  368. data/lib/libv8/v8/src/json.js +28 -23
  369. data/lib/libv8/v8/src/jsregexp.cc +163 -208
  370. data/lib/libv8/v8/src/jsregexp.h +0 -1
  371. data/lib/libv8/v8/src/lithium-allocator-inl.h +29 -27
  372. data/lib/libv8/v8/src/lithium-allocator.cc +22 -17
  373. data/lib/libv8/v8/src/lithium-allocator.h +8 -8
  374. data/lib/libv8/v8/src/lithium.cc +16 -11
  375. data/lib/libv8/v8/src/lithium.h +31 -34
  376. data/lib/libv8/v8/src/liveedit.cc +111 -15
  377. data/lib/libv8/v8/src/liveedit.h +3 -4
  378. data/lib/libv8/v8/src/liveobjectlist.cc +116 -80
  379. data/lib/libv8/v8/src/liveobjectlist.h +2 -2
  380. data/lib/libv8/v8/src/log-inl.h +0 -4
  381. data/lib/libv8/v8/src/log-utils.cc +25 -143
  382. data/lib/libv8/v8/src/log-utils.h +13 -92
  383. data/lib/libv8/v8/src/log.cc +26 -249
  384. data/lib/libv8/v8/src/log.h +6 -17
  385. data/lib/libv8/v8/src/macros.py +9 -6
  386. data/lib/libv8/v8/src/mark-compact.cc +276 -56
  387. data/lib/libv8/v8/src/mark-compact.h +20 -0
  388. data/lib/libv8/v8/src/messages.js +93 -39
  389. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +9 -3
  390. data/lib/libv8/v8/src/mips/assembler-mips.cc +297 -189
  391. data/lib/libv8/v8/src/mips/assembler-mips.h +121 -54
  392. data/lib/libv8/v8/src/mips/builtins-mips.cc +23 -24
  393. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +484 -263
  394. data/lib/libv8/v8/src/mips/code-stubs-mips.h +8 -83
  395. data/lib/libv8/v8/src/mips/codegen-mips.h +0 -2
  396. data/lib/libv8/v8/src/mips/constants-mips.h +37 -11
  397. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +6 -1
  398. data/lib/libv8/v8/src/mips/frames-mips.h +8 -7
  399. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +258 -419
  400. data/lib/libv8/v8/src/mips/ic-mips.cc +181 -121
  401. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +640 -382
  402. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +94 -89
  403. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +23 -10
  404. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +6 -1
  405. data/lib/libv8/v8/src/mips/simulator-mips.cc +249 -49
  406. data/lib/libv8/v8/src/mips/simulator-mips.h +25 -1
  407. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +373 -161
  408. data/lib/libv8/v8/src/mirror-debugger.js +55 -8
  409. data/lib/libv8/v8/src/misc-intrinsics.h +89 -0
  410. data/lib/libv8/v8/src/mksnapshot.cc +36 -4
  411. data/lib/libv8/v8/src/natives.h +5 -2
  412. data/lib/libv8/v8/src/objects-debug.cc +73 -6
  413. data/lib/libv8/v8/src/objects-inl.h +529 -164
  414. data/lib/libv8/v8/src/objects-printer.cc +67 -12
  415. data/lib/libv8/v8/src/objects-visiting.cc +13 -2
  416. data/lib/libv8/v8/src/objects-visiting.h +41 -1
  417. data/lib/libv8/v8/src/objects.cc +2200 -1177
  418. data/lib/libv8/v8/src/objects.h +912 -283
  419. data/lib/libv8/v8/src/parser.cc +566 -371
  420. data/lib/libv8/v8/src/parser.h +35 -33
  421. data/lib/libv8/v8/src/platform-cygwin.cc +10 -25
  422. data/lib/libv8/v8/src/platform-freebsd.cc +4 -29
  423. data/lib/libv8/v8/src/platform-linux.cc +60 -57
  424. data/lib/libv8/v8/src/platform-macos.cc +4 -27
  425. data/lib/libv8/v8/src/platform-nullos.cc +3 -16
  426. data/lib/libv8/v8/src/platform-openbsd.cc +247 -85
  427. data/lib/libv8/v8/src/platform-posix.cc +43 -1
  428. data/lib/libv8/v8/src/platform-solaris.cc +151 -112
  429. data/lib/libv8/v8/src/platform-tls.h +1 -1
  430. data/lib/libv8/v8/src/platform-win32.cc +65 -39
  431. data/lib/libv8/v8/src/platform.h +17 -14
  432. data/lib/libv8/v8/src/preparse-data-format.h +2 -2
  433. data/lib/libv8/v8/src/preparse-data.h +8 -2
  434. data/lib/libv8/v8/src/preparser-api.cc +2 -18
  435. data/lib/libv8/v8/src/preparser.cc +106 -65
  436. data/lib/libv8/v8/src/preparser.h +26 -5
  437. data/lib/libv8/v8/src/prettyprinter.cc +25 -43
  438. data/lib/libv8/v8/src/profile-generator-inl.h +0 -4
  439. data/lib/libv8/v8/src/profile-generator.cc +213 -34
  440. data/lib/libv8/v8/src/profile-generator.h +9 -9
  441. data/lib/libv8/v8/src/property.h +1 -0
  442. data/lib/libv8/v8/src/proxy.js +74 -4
  443. data/lib/libv8/v8/src/regexp-macro-assembler.cc +10 -6
  444. data/lib/libv8/v8/src/regexp.js +16 -11
  445. data/lib/libv8/v8/src/rewriter.cc +24 -133
  446. data/lib/libv8/v8/src/runtime-profiler.cc +27 -151
  447. data/lib/libv8/v8/src/runtime-profiler.h +5 -31
  448. data/lib/libv8/v8/src/runtime.cc +1450 -681
  449. data/lib/libv8/v8/src/runtime.h +47 -31
  450. data/lib/libv8/v8/src/runtime.js +2 -1
  451. data/lib/libv8/v8/src/scanner-base.cc +358 -220
  452. data/lib/libv8/v8/src/scanner-base.h +30 -138
  453. data/lib/libv8/v8/src/scanner.cc +0 -18
  454. data/lib/libv8/v8/src/scanner.h +0 -15
  455. data/lib/libv8/v8/src/scopeinfo.cc +3 -1
  456. data/lib/libv8/v8/src/scopeinfo.h +1 -6
  457. data/lib/libv8/v8/src/scopes.cc +243 -253
  458. data/lib/libv8/v8/src/scopes.h +58 -109
  459. data/lib/libv8/v8/src/serialize.cc +12 -54
  460. data/lib/libv8/v8/src/serialize.h +47 -0
  461. data/lib/libv8/v8/src/small-pointer-list.h +25 -0
  462. data/lib/libv8/v8/src/spaces-inl.h +4 -50
  463. data/lib/libv8/v8/src/spaces.cc +64 -131
  464. data/lib/libv8/v8/src/spaces.h +19 -70
  465. data/lib/libv8/v8/src/string-stream.cc +3 -1
  466. data/lib/libv8/v8/src/string.js +10 -6
  467. data/lib/libv8/v8/src/strtod.cc +7 -3
  468. data/lib/libv8/v8/src/stub-cache.cc +59 -129
  469. data/lib/libv8/v8/src/stub-cache.h +42 -54
  470. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +1447 -1339
  471. data/lib/libv8/v8/src/token.cc +4 -4
  472. data/lib/libv8/v8/src/token.h +6 -5
  473. data/lib/libv8/v8/src/type-info.cc +173 -129
  474. data/lib/libv8/v8/src/type-info.h +40 -22
  475. data/lib/libv8/v8/src/utils.cc +25 -304
  476. data/lib/libv8/v8/src/utils.h +118 -3
  477. data/lib/libv8/v8/src/v8-counters.h +3 -6
  478. data/lib/libv8/v8/src/v8.cc +34 -27
  479. data/lib/libv8/v8/src/v8.h +7 -7
  480. data/lib/libv8/v8/src/v8conversions.cc +129 -0
  481. data/lib/libv8/v8/src/v8conversions.h +60 -0
  482. data/lib/libv8/v8/src/v8globals.h +15 -6
  483. data/lib/libv8/v8/src/v8natives.js +300 -78
  484. data/lib/libv8/v8/src/v8threads.cc +14 -6
  485. data/lib/libv8/v8/src/v8threads.h +4 -1
  486. data/lib/libv8/v8/src/v8utils.cc +360 -0
  487. data/lib/libv8/v8/src/v8utils.h +17 -66
  488. data/lib/libv8/v8/src/variables.cc +7 -12
  489. data/lib/libv8/v8/src/variables.h +12 -10
  490. data/lib/libv8/v8/src/version.cc +2 -2
  491. data/lib/libv8/v8/src/vm-state-inl.h +0 -41
  492. data/lib/libv8/v8/src/vm-state.h +0 -11
  493. data/lib/libv8/v8/src/weakmap.js +103 -0
  494. data/lib/libv8/v8/src/x64/assembler-x64.h +6 -3
  495. data/lib/libv8/v8/src/x64/builtins-x64.cc +25 -22
  496. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +523 -250
  497. data/lib/libv8/v8/src/x64/code-stubs-x64.h +8 -71
  498. data/lib/libv8/v8/src/x64/codegen-x64.cc +1 -0
  499. data/lib/libv8/v8/src/x64/codegen-x64.h +0 -2
  500. data/lib/libv8/v8/src/x64/cpu-x64.cc +2 -1
  501. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +40 -8
  502. data/lib/libv8/v8/src/x64/disasm-x64.cc +12 -10
  503. data/lib/libv8/v8/src/x64/frames-x64.h +7 -6
  504. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +310 -415
  505. data/lib/libv8/v8/src/x64/ic-x64.cc +180 -117
  506. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +411 -523
  507. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +11 -6
  508. data/lib/libv8/v8/src/x64/lithium-x64.cc +191 -216
  509. data/lib/libv8/v8/src/x64/lithium-x64.h +112 -263
  510. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +177 -61
  511. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +23 -7
  512. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +21 -9
  513. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +6 -0
  514. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +273 -107
  515. data/lib/libv8/v8/src/zone.cc +31 -22
  516. data/lib/libv8/v8/src/zone.h +12 -6
  517. data/lib/libv8/v8/tools/codemap.js +8 -0
  518. data/lib/libv8/v8/tools/gcmole/Makefile +43 -0
  519. data/lib/libv8/v8/tools/gcmole/gcmole.lua +0 -2
  520. data/lib/libv8/v8/tools/gdb-v8-support.py +154 -0
  521. data/lib/libv8/v8/tools/grokdump.py +44 -35
  522. data/lib/libv8/v8/tools/gyp/v8.gyp +94 -248
  523. data/lib/libv8/v8/tools/js2c.py +83 -52
  524. data/lib/libv8/v8/tools/linux-tick-processor +4 -6
  525. data/lib/libv8/v8/tools/ll_prof.py +3 -3
  526. data/lib/libv8/v8/tools/oom_dump/README +3 -1
  527. data/lib/libv8/v8/tools/presubmit.py +11 -4
  528. data/lib/libv8/v8/tools/profile.js +46 -2
  529. data/lib/libv8/v8/tools/splaytree.js +11 -0
  530. data/lib/libv8/v8/tools/stats-viewer.py +15 -11
  531. data/lib/libv8/v8/tools/test-wrapper-gypbuild.py +227 -0
  532. data/lib/libv8/v8/tools/test.py +28 -8
  533. data/lib/libv8/v8/tools/tickprocessor.js +0 -16
  534. data/lib/libv8/version.rb +1 -1
  535. data/libv8.gemspec +2 -2
  536. metadata +31 -19
  537. data/lib/libv8/scons/engine/SCons/Tool/f03.py +0 -63
  538. data/lib/libv8/v8/src/json-parser.cc +0 -504
@@ -163,29 +163,30 @@ class MacroAssembler: public Assembler {
163
163
  const ParameterCount& expected,
164
164
  const ParameterCount& actual,
165
165
  InvokeFlag flag,
166
- const CallWrapper& call_wrapper = NullCallWrapper(),
167
- CallKind call_kind = CALL_AS_METHOD);
166
+ const CallWrapper& call_wrapper,
167
+ CallKind call_kind);
168
168
 
169
169
  void InvokeCode(Handle<Code> code,
170
170
  const ParameterCount& expected,
171
171
  const ParameterCount& actual,
172
172
  RelocInfo::Mode rmode,
173
173
  InvokeFlag flag,
174
- const CallWrapper& call_wrapper = NullCallWrapper(),
175
- CallKind call_kind = CALL_AS_METHOD);
174
+ const CallWrapper& call_wrapper,
175
+ CallKind call_kind);
176
176
 
177
177
  // Invoke the JavaScript function in the given register. Changes the
178
178
  // current context to the context in the function before invoking.
179
179
  void InvokeFunction(Register function,
180
180
  const ParameterCount& actual,
181
181
  InvokeFlag flag,
182
- const CallWrapper& call_wrapper = NullCallWrapper(),
183
- CallKind call_kind = CALL_AS_METHOD);
182
+ const CallWrapper& call_wrapper,
183
+ CallKind call_kind);
184
184
 
185
185
  void InvokeFunction(JSFunction* function,
186
186
  const ParameterCount& actual,
187
187
  InvokeFlag flag,
188
- const CallWrapper& call_wrapper = NullCallWrapper());
188
+ const CallWrapper& call_wrapper,
189
+ CallKind call_kind);
189
190
 
190
191
  // Invoke specified builtin JavaScript function. Adds an entry to
191
192
  // the unresolved list if the name does not resolve.
@@ -208,6 +209,9 @@ class MacroAssembler: public Assembler {
208
209
  void SafeSet(Register dst, const Immediate& x);
209
210
  void SafePush(const Immediate& x);
210
211
 
212
+ // Compare a register against a known root, e.g. undefined, null, true, ...
213
+ void CompareRoot(Register with, Heap::RootListIndex index);
214
+
211
215
  // Compare object type for heap object.
212
216
  // Incoming register is heap_object and outgoing register is map.
213
217
  void CmpObjectType(Register heap_object, InstanceType type, Register map);
@@ -215,6 +219,12 @@ class MacroAssembler: public Assembler {
215
219
  // Compare instance type for map.
216
220
  void CmpInstanceType(Register map, InstanceType type);
217
221
 
222
+ // Check if a map for a JSObject indicates that the object has fast elements.
223
+ // Jump to the specified label if it does not.
224
+ void CheckFastElements(Register map,
225
+ Label* fail,
226
+ Label::Distance distance = Label::kFar);
227
+
218
228
  // Check if the map of an object is equal to a specified map and branch to
219
229
  // label if not. Skip the smi check if not required (object is known to be a
220
230
  // heap object)
@@ -265,8 +275,8 @@ class MacroAssembler: public Assembler {
265
275
 
266
276
  // Smi tagging support.
267
277
  void SmiTag(Register reg) {
268
- ASSERT(kSmiTag == 0);
269
- ASSERT(kSmiTagSize == 1);
278
+ STATIC_ASSERT(kSmiTag == 0);
279
+ STATIC_ASSERT(kSmiTagSize == 1);
270
280
  add(reg, Operand(reg));
271
281
  }
272
282
  void SmiUntag(Register reg) {
@@ -275,21 +285,32 @@ class MacroAssembler: public Assembler {
275
285
 
276
286
  // Modifies the register even if it does not contain a Smi!
277
287
  void SmiUntag(Register reg, Label* is_smi) {
278
- ASSERT(kSmiTagSize == 1);
288
+ STATIC_ASSERT(kSmiTagSize == 1);
279
289
  sar(reg, kSmiTagSize);
280
- ASSERT(kSmiTag == 0);
290
+ STATIC_ASSERT(kSmiTag == 0);
281
291
  j(not_carry, is_smi);
282
292
  }
283
293
 
284
294
  // Jump the register contains a smi.
285
- inline void JumpIfSmi(Register value, Label* smi_label) {
295
+ inline void JumpIfSmi(Register value,
296
+ Label* smi_label,
297
+ Label::Distance distance = Label::kFar) {
298
+ test(value, Immediate(kSmiTagMask));
299
+ j(zero, smi_label, distance);
300
+ }
301
+ // Jump if the operand is a smi.
302
+ inline void JumpIfSmi(Operand value,
303
+ Label* smi_label,
304
+ Label::Distance distance = Label::kFar) {
286
305
  test(value, Immediate(kSmiTagMask));
287
- j(zero, smi_label);
306
+ j(zero, smi_label, distance);
288
307
  }
289
308
  // Jump if register contain a non-smi.
290
- inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
309
+ inline void JumpIfNotSmi(Register value,
310
+ Label* not_smi_label,
311
+ Label::Distance distance = Label::kFar) {
291
312
  test(value, Immediate(kSmiTagMask));
292
- j(not_zero, not_smi_label);
313
+ j(not_zero, not_smi_label, distance);
293
314
  }
294
315
 
295
316
  void LoadInstanceDescriptors(Register map, Register descriptors);
@@ -334,6 +355,15 @@ class MacroAssembler: public Assembler {
334
355
  Label* miss);
335
356
 
336
357
 
358
+ void LoadFromNumberDictionary(Label* miss,
359
+ Register elements,
360
+ Register key,
361
+ Register r0,
362
+ Register r1,
363
+ Register r2,
364
+ Register result);
365
+
366
+
337
367
  // ---------------------------------------------------------------------------
338
368
  // Allocation support
339
369
 
@@ -416,6 +446,17 @@ class MacroAssembler: public Assembler {
416
446
  Register scratch2,
417
447
  Label* gc_required);
418
448
 
449
+ // Allocate a raw sliced string object. Only the map field of the result is
450
+ // initialized.
451
+ void AllocateSlicedString(Register result,
452
+ Register scratch1,
453
+ Register scratch2,
454
+ Label* gc_required);
455
+ void AllocateAsciiSlicedString(Register result,
456
+ Register scratch1,
457
+ Register scratch2,
458
+ Label* gc_required);
459
+
419
460
  // Copy memory, byte-by-byte, from source to destination. Not optimized for
420
461
  // long or aligned copies.
421
462
  // The contents of index and scratch are destroyed.
@@ -540,10 +581,10 @@ class MacroAssembler: public Assembler {
540
581
 
541
582
  // Prepares stack to put arguments (aligns and so on). Reserves
542
583
  // space for return value if needed (assumes the return value is a handle).
543
- // Uses callee-saved esi to restore stack state after call. Arguments must be
544
- // stored in ApiParameterOperand(0), ApiParameterOperand(1) etc. Saves
545
- // context (esi).
546
- void PrepareCallApiFunction(int argc, Register scratch);
584
+ // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1)
585
+ // etc. Saves context (esi). If space was reserved for return value then
586
+ // stores the pointer to the reserved slot into esi.
587
+ void PrepareCallApiFunction(int argc);
547
588
 
548
589
  // Calls an API function. Allocates HandleScope, extracts
549
590
  // returned value from handle and propagates exceptions.
@@ -584,6 +625,9 @@ class MacroAssembler: public Assembler {
584
625
 
585
626
  void Move(Register target, Handle<Object> value);
586
627
 
628
+ // Push a handle value.
629
+ void Push(Handle<Object> handle) { push(handle); }
630
+
587
631
  Handle<Object> CodeObject() {
588
632
  ASSERT(!code_object_.is_null());
589
633
  return code_object_;
@@ -1065,12 +1065,13 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
1065
1065
  }
1066
1066
 
1067
1067
  // Prepare for possible GC.
1068
- HandleScope handles;
1068
+ HandleScope handles(isolate);
1069
1069
  Handle<Code> code_handle(re_code);
1070
1070
 
1071
1071
  Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
1072
+
1072
1073
  // Current string.
1073
- bool is_ascii = subject->IsAsciiRepresentation();
1074
+ bool is_ascii = subject->IsAsciiRepresentationUnderneath();
1074
1075
 
1075
1076
  ASSERT(re_code->instruction_start() <= *return_address);
1076
1077
  ASSERT(*return_address <=
@@ -1079,7 +1080,7 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
1079
1080
  MaybeObject* result = Execution::HandleStackGuardInterrupt();
1080
1081
 
1081
1082
  if (*code_handle != re_code) { // Return address no longer valid
1082
- int delta = *code_handle - re_code;
1083
+ int delta = code_handle->address() - re_code->address();
1083
1084
  // Overwrite the return address on the stack.
1084
1085
  *return_address += delta;
1085
1086
  }
@@ -1088,8 +1089,20 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
1088
1089
  return EXCEPTION;
1089
1090
  }
1090
1091
 
1092
+ Handle<String> subject_tmp = subject;
1093
+ int slice_offset = 0;
1094
+
1095
+ // Extract the underlying string and the slice offset.
1096
+ if (StringShape(*subject_tmp).IsCons()) {
1097
+ subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first());
1098
+ } else if (StringShape(*subject_tmp).IsSliced()) {
1099
+ SlicedString* slice = SlicedString::cast(*subject_tmp);
1100
+ subject_tmp = Handle<String>(slice->parent());
1101
+ slice_offset = slice->offset();
1102
+ }
1103
+
1091
1104
  // String might have changed.
1092
- if (subject->IsAsciiRepresentation() != is_ascii) {
1105
+ if (subject_tmp->IsAsciiRepresentation() != is_ascii) {
1093
1106
  // If we changed between an ASCII and an UC16 string, the specialized
1094
1107
  // code cannot be used, and we need to restart regexp matching from
1095
1108
  // scratch (including, potentially, compiling a new version of the code).
@@ -1100,8 +1113,8 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
1100
1113
  // be a sequential or external string with the same content.
1101
1114
  // Update the start and end pointers in the stack frame to the current
1102
1115
  // location (whether it has actually moved or not).
1103
- ASSERT(StringShape(*subject).IsSequential() ||
1104
- StringShape(*subject).IsExternal());
1116
+ ASSERT(StringShape(*subject_tmp).IsSequential() ||
1117
+ StringShape(*subject_tmp).IsExternal());
1105
1118
 
1106
1119
  // The original start address of the characters to match.
1107
1120
  const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
@@ -1109,13 +1122,14 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
1109
1122
  // Find the current start address of the same character at the current string
1110
1123
  // position.
1111
1124
  int start_index = frame_entry<int>(re_frame, kStartIndex);
1112
- const byte* new_address = StringCharacterPosition(*subject, start_index);
1125
+ const byte* new_address = StringCharacterPosition(*subject_tmp,
1126
+ start_index + slice_offset);
1113
1127
 
1114
1128
  if (start_address != new_address) {
1115
1129
  // If there is a difference, update the object pointer and start and end
1116
1130
  // addresses in the RegExp stack frame to match the new value.
1117
1131
  const byte* end_address = frame_entry<const byte* >(re_frame, kInputEnd);
1118
- int byte_length = end_address - start_address;
1132
+ int byte_length = static_cast<int>(end_address - start_address);
1119
1133
  frame_entry<const String*>(re_frame, kInputString) = *subject;
1120
1134
  frame_entry<const byte*>(re_frame, kInputStart) = new_address;
1121
1135
  frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length;
@@ -28,6 +28,9 @@
28
28
  #ifndef V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
29
29
  #define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
30
30
 
31
+ #include "ia32/assembler-ia32.h"
32
+ #include "ia32/assembler-ia32-inl.h"
33
+
31
34
  namespace v8 {
32
35
  namespace internal {
33
36
 
@@ -129,7 +129,7 @@ static MaybeObject* GenerateDictionaryNegativeLookup(MacroAssembler* masm,
129
129
  __ j(not_zero, miss_label);
130
130
 
131
131
  // Check that receiver is a JSObject.
132
- __ CmpInstanceType(r0, FIRST_JS_OBJECT_TYPE);
132
+ __ CmpInstanceType(r0, FIRST_SPEC_OBJECT_TYPE);
133
133
  __ j(below, miss_label);
134
134
 
135
135
  // Load properties array.
@@ -188,8 +188,7 @@ void StubCache::GenerateProbe(MacroAssembler* masm,
188
188
  ASSERT(extra2.is(no_reg));
189
189
 
190
190
  // Check that the receiver isn't a smi.
191
- __ test(receiver, Immediate(kSmiTagMask));
192
- __ j(zero, &miss);
191
+ __ JumpIfSmi(receiver, &miss);
193
192
 
194
193
  // Get the map of the receiver and compute the hash.
195
194
  __ mov(scratch, FieldOperand(name, String::kHashFieldOffset));
@@ -249,8 +248,7 @@ void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
249
248
  Register scratch,
250
249
  Label* miss_label) {
251
250
  // Check that the receiver isn't a smi.
252
- __ test(receiver, Immediate(kSmiTagMask));
253
- __ j(zero, miss_label);
251
+ __ JumpIfSmi(receiver, miss_label);
254
252
 
255
253
  // Check that the object is a JS array.
256
254
  __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
@@ -270,13 +268,12 @@ static void GenerateStringCheck(MacroAssembler* masm,
270
268
  Label* smi,
271
269
  Label* non_string_object) {
272
270
  // Check that the object isn't a smi.
273
- __ test(receiver, Immediate(kSmiTagMask));
274
- __ j(zero, smi);
271
+ __ JumpIfSmi(receiver, smi);
275
272
 
276
273
  // Check that the object is a string.
277
274
  __ mov(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
278
275
  __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
279
- ASSERT(kNotStringTag != 0);
276
+ STATIC_ASSERT(kNotStringTag != 0);
280
277
  __ test(scratch, Immediate(kNotStringTag));
281
278
  __ j(not_zero, non_string_object);
282
279
  }
@@ -462,7 +459,7 @@ static MaybeObject* GenerateFastApiCall(MacroAssembler* masm,
462
459
  // it's not controlled by GC.
463
460
  const int kApiStackSpace = 4;
464
461
 
465
- __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, ebx);
462
+ __ PrepareCallApiFunction(kApiArgc + kApiStackSpace);
466
463
 
467
464
  __ mov(ApiParameterOperand(1), eax); // v8::Arguments::implicit_args_.
468
465
  __ add(Operand(eax), Immediate(argc * kPointerSize));
@@ -488,10 +485,12 @@ class CallInterceptorCompiler BASE_EMBEDDED {
488
485
  public:
489
486
  CallInterceptorCompiler(StubCompiler* stub_compiler,
490
487
  const ParameterCount& arguments,
491
- Register name)
488
+ Register name,
489
+ Code::ExtraICState extra_ic_state)
492
490
  : stub_compiler_(stub_compiler),
493
491
  arguments_(arguments),
494
- name_(name) {}
492
+ name_(name),
493
+ extra_ic_state_(extra_ic_state) {}
495
494
 
496
495
  MaybeObject* Compile(MacroAssembler* masm,
497
496
  JSObject* object,
@@ -507,8 +506,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
507
506
  ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
508
507
 
509
508
  // Check that the receiver isn't a smi.
510
- __ test(receiver, Immediate(kSmiTagMask));
511
- __ j(zero, miss);
509
+ __ JumpIfSmi(receiver, miss);
512
510
 
513
511
  CallOptimization optimization(lookup);
514
512
 
@@ -616,8 +614,11 @@ class CallInterceptorCompiler BASE_EMBEDDED {
616
614
  GenerateFastApiCall(masm, optimization, arguments_.immediate());
617
615
  if (result->IsFailure()) return result;
618
616
  } else {
617
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
618
+ ? CALL_AS_FUNCTION
619
+ : CALL_AS_METHOD;
619
620
  __ InvokeFunction(optimization.constant_function(), arguments_,
620
- JUMP_FUNCTION);
621
+ JUMP_FUNCTION, NullCallWrapper(), call_kind);
621
622
  }
622
623
 
623
624
  // Deferred code for fast API call case---clean preallocated space.
@@ -696,6 +697,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
696
697
  StubCompiler* stub_compiler_;
697
698
  const ParameterCount& arguments_;
698
699
  Register name_;
700
+ Code::ExtraICState extra_ic_state_;
699
701
  };
700
702
 
701
703
 
@@ -732,8 +734,7 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
732
734
  Register scratch,
733
735
  Label* miss_label) {
734
736
  // Check that the object isn't a smi.
735
- __ test(receiver_reg, Immediate(kSmiTagMask));
736
- __ j(zero, miss_label);
737
+ __ JumpIfSmi(receiver_reg, miss_label);
737
738
 
738
739
  // Check that the map of the object hasn't changed.
739
740
  __ cmp(FieldOperand(receiver_reg, HeapObject::kMapOffset),
@@ -1014,8 +1015,7 @@ void StubCompiler::GenerateLoadField(JSObject* object,
1014
1015
  String* name,
1015
1016
  Label* miss) {
1016
1017
  // Check that the receiver isn't a smi.
1017
- __ test(receiver, Immediate(kSmiTagMask));
1018
- __ j(zero, miss);
1018
+ __ JumpIfSmi(receiver, miss);
1019
1019
 
1020
1020
  // Check the prototype chain.
1021
1021
  Register reg =
@@ -1039,8 +1039,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
1039
1039
  String* name,
1040
1040
  Label* miss) {
1041
1041
  // Check that the receiver isn't a smi.
1042
- __ test(receiver, Immediate(kSmiTagMask));
1043
- __ j(zero, miss);
1042
+ __ JumpIfSmi(receiver, miss);
1044
1043
 
1045
1044
  // Check that the maps haven't changed.
1046
1045
  Register reg =
@@ -1083,7 +1082,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
1083
1082
  const int kStackSpace = 5;
1084
1083
  const int kApiArgc = 2;
1085
1084
 
1086
- __ PrepareCallApiFunction(kApiArgc, eax);
1085
+ __ PrepareCallApiFunction(kApiArgc);
1087
1086
  __ mov(ApiParameterOperand(0), ebx); // name.
1088
1087
  __ add(Operand(ebx), Immediate(kPointerSize));
1089
1088
  __ mov(ApiParameterOperand(1), ebx); // arguments pointer.
@@ -1106,8 +1105,7 @@ void StubCompiler::GenerateLoadConstant(JSObject* object,
1106
1105
  String* name,
1107
1106
  Label* miss) {
1108
1107
  // Check that the receiver isn't a smi.
1109
- __ test(receiver, Immediate(kSmiTagMask));
1110
- __ j(zero, miss);
1108
+ __ JumpIfSmi(receiver, miss);
1111
1109
 
1112
1110
  // Check that the maps haven't changed.
1113
1111
  CheckPrototypes(object, receiver, holder,
@@ -1133,8 +1131,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
1133
1131
  ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
1134
1132
 
1135
1133
  // Check that the receiver isn't a smi.
1136
- __ test(receiver, Immediate(kSmiTagMask));
1137
- __ j(zero, miss);
1134
+ __ JumpIfSmi(receiver, miss);
1138
1135
 
1139
1136
  // So far the most popular follow ups for interceptor loads are FIELD
1140
1137
  // and CALLBACKS, so inline only them, other cases may be added
@@ -1284,8 +1281,7 @@ void CallStubCompiler::GenerateGlobalReceiverCheck(JSObject* object,
1284
1281
  // object which can only happen for contextual calls. In this case,
1285
1282
  // the receiver cannot be a smi.
1286
1283
  if (object != holder) {
1287
- __ test(edx, Immediate(kSmiTagMask));
1288
- __ j(zero, miss);
1284
+ __ JumpIfSmi(edx, miss);
1289
1285
  }
1290
1286
 
1291
1287
  // Check that the maps haven't changed.
@@ -1311,8 +1307,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
1311
1307
  // the nice side effect that multiple closures based on the same
1312
1308
  // function can all use this call IC. Before we load through the
1313
1309
  // function, we have to verify that it still is a function.
1314
- __ test(edi, Immediate(kSmiTagMask));
1315
- __ j(zero, miss);
1310
+ __ JumpIfSmi(edi, miss);
1316
1311
  __ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx);
1317
1312
  __ j(not_equal, miss);
1318
1313
 
@@ -1360,8 +1355,7 @@ MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1360
1355
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1361
1356
 
1362
1357
  // Check that the receiver isn't a smi.
1363
- __ test(edx, Immediate(kSmiTagMask));
1364
- __ j(zero, &miss);
1358
+ __ JumpIfSmi(edx, &miss);
1365
1359
 
1366
1360
  // Do the right check and compute the holder register.
1367
1361
  Register reg = CheckPrototypes(object, edx, holder, ebx, eax, edi,
@@ -1370,8 +1364,7 @@ MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1370
1364
  GenerateFastPropertyLoad(masm(), edi, reg, holder, index);
1371
1365
 
1372
1366
  // Check that the function really is a function.
1373
- __ test(edi, Immediate(kSmiTagMask));
1374
- __ j(zero, &miss);
1367
+ __ JumpIfSmi(edi, &miss);
1375
1368
  __ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx);
1376
1369
  __ j(not_equal, &miss);
1377
1370
 
@@ -1383,7 +1376,11 @@ MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1383
1376
  }
1384
1377
 
1385
1378
  // Invoke the function.
1386
- __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
1379
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
1380
+ ? CALL_AS_FUNCTION
1381
+ : CALL_AS_METHOD;
1382
+ __ InvokeFunction(edi, arguments(), JUMP_FUNCTION,
1383
+ NullCallWrapper(), call_kind);
1387
1384
 
1388
1385
  // Handle call cache miss.
1389
1386
  __ bind(&miss);
@@ -1422,8 +1419,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
1422
1419
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1423
1420
 
1424
1421
  // Check that the receiver isn't a smi.
1425
- __ test(edx, Immediate(kSmiTagMask));
1426
- __ j(zero, &miss);
1422
+ __ JumpIfSmi(edx, &miss);
1427
1423
 
1428
1424
  CheckPrototypes(JSObject::cast(object), edx,
1429
1425
  holder, ebx,
@@ -1471,8 +1467,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
1471
1467
  __ mov(Operand(edx, 0), ecx);
1472
1468
 
1473
1469
  // Check if value is a smi.
1474
- __ test(ecx, Immediate(kSmiTagMask));
1475
- __ j(not_zero, &with_write_barrier);
1470
+ __ JumpIfNotSmi(ecx, &with_write_barrier);
1476
1471
 
1477
1472
  __ bind(&exit);
1478
1473
  __ ret((argc + 1) * kPointerSize);
@@ -1575,8 +1570,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
1575
1570
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1576
1571
 
1577
1572
  // Check that the receiver isn't a smi.
1578
- __ test(edx, Immediate(kSmiTagMask));
1579
- __ j(zero, &miss);
1573
+ __ JumpIfSmi(edx, &miss);
1580
1574
  CheckPrototypes(JSObject::cast(object), edx,
1581
1575
  holder, ebx,
1582
1576
  eax, edi, name, &miss);
@@ -1835,8 +1829,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
1835
1829
  __ mov(edx, Operand(esp, 2 * kPointerSize));
1836
1830
 
1837
1831
  STATIC_ASSERT(kSmiTag == 0);
1838
- __ test(edx, Immediate(kSmiTagMask));
1839
- __ j(zero, &miss);
1832
+ __ JumpIfSmi(edx, &miss);
1840
1833
 
1841
1834
  CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
1842
1835
  &miss);
@@ -1853,8 +1846,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
1853
1846
  // Check the code is a smi.
1854
1847
  Label slow;
1855
1848
  STATIC_ASSERT(kSmiTag == 0);
1856
- __ test(code, Immediate(kSmiTagMask));
1857
- __ j(not_zero, &slow);
1849
+ __ JumpIfNotSmi(code, &slow);
1858
1850
 
1859
1851
  // Convert the smi code to uint16.
1860
1852
  __ and_(code, Immediate(Smi::FromInt(0xffff)));
@@ -1869,7 +1861,11 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
1869
1861
  // Tail call the full function. We do not have to patch the receiver
1870
1862
  // because the function makes no use of it.
1871
1863
  __ bind(&slow);
1872
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1864
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
1865
+ ? CALL_AS_FUNCTION
1866
+ : CALL_AS_METHOD;
1867
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION,
1868
+ NullCallWrapper(), call_kind);
1873
1869
 
1874
1870
  __ bind(&miss);
1875
1871
  // ecx: function name.
@@ -1915,8 +1911,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
1915
1911
  __ mov(edx, Operand(esp, 2 * kPointerSize));
1916
1912
 
1917
1913
  STATIC_ASSERT(kSmiTag == 0);
1918
- __ test(edx, Immediate(kSmiTagMask));
1919
- __ j(zero, &miss);
1914
+ __ JumpIfSmi(edx, &miss);
1920
1915
 
1921
1916
  CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
1922
1917
  &miss);
@@ -1932,8 +1927,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
1932
1927
  // Check if the argument is a smi.
1933
1928
  Label smi;
1934
1929
  STATIC_ASSERT(kSmiTag == 0);
1935
- __ test(eax, Immediate(kSmiTagMask));
1936
- __ j(zero, &smi);
1930
+ __ JumpIfSmi(eax, &smi);
1937
1931
 
1938
1932
  // Check if the argument is a heap number and load its value into xmm0.
1939
1933
  Label slow;
@@ -1999,7 +1993,8 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
1999
1993
  // Tail call the full function. We do not have to patch the receiver
2000
1994
  // because the function makes no use of it.
2001
1995
  __ bind(&slow);
2002
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1996
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION,
1997
+ NullCallWrapper(), CALL_AS_METHOD);
2003
1998
 
2004
1999
  __ bind(&miss);
2005
2000
  // ecx: function name.
@@ -2039,8 +2034,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
2039
2034
  __ mov(edx, Operand(esp, 2 * kPointerSize));
2040
2035
 
2041
2036
  STATIC_ASSERT(kSmiTag == 0);
2042
- __ test(edx, Immediate(kSmiTagMask));
2043
- __ j(zero, &miss);
2037
+ __ JumpIfSmi(edx, &miss);
2044
2038
 
2045
2039
  CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
2046
2040
  &miss);
@@ -2056,8 +2050,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
2056
2050
  // Check if the argument is a smi.
2057
2051
  Label not_smi;
2058
2052
  STATIC_ASSERT(kSmiTag == 0);
2059
- __ test(eax, Immediate(kSmiTagMask));
2060
- __ j(not_zero, &not_smi);
2053
+ __ JumpIfNotSmi(eax, &not_smi);
2061
2054
 
2062
2055
  // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0
2063
2056
  // otherwise.
@@ -2104,7 +2097,8 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
2104
2097
  // Tail call the full function. We do not have to patch the receiver
2105
2098
  // because the function makes no use of it.
2106
2099
  __ bind(&slow);
2107
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
2100
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION,
2101
+ NullCallWrapper(), CALL_AS_METHOD);
2108
2102
 
2109
2103
  __ bind(&miss);
2110
2104
  // ecx: function name.
@@ -2142,8 +2136,7 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
2142
2136
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
2143
2137
 
2144
2138
  // Check that the receiver isn't a smi.
2145
- __ test(edx, Immediate(kSmiTagMask));
2146
- __ j(zero, &miss_before_stack_reserved);
2139
+ __ JumpIfSmi(edx, &miss_before_stack_reserved);
2147
2140
 
2148
2141
  Counters* counters = isolate()->counters();
2149
2142
  __ IncrementCounter(counters->call_const(), 1);
@@ -2178,11 +2171,12 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
2178
2171
  }
2179
2172
 
2180
2173
 
2181
- MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
2182
- JSObject* holder,
2183
- JSFunction* function,
2184
- String* name,
2185
- CheckType check) {
2174
+ MaybeObject* CallStubCompiler::CompileCallConstant(
2175
+ Object* object,
2176
+ JSObject* holder,
2177
+ JSFunction* function,
2178
+ String* name,
2179
+ CheckType check) {
2186
2180
  // ----------- S t a t e -------------
2187
2181
  // -- ecx : name
2188
2182
  // -- esp[0] : return address
@@ -2210,8 +2204,7 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
2210
2204
 
2211
2205
  // Check that the receiver isn't a smi.
2212
2206
  if (check != NUMBER_CHECK) {
2213
- __ test(edx, Immediate(kSmiTagMask));
2214
- __ j(zero, &miss);
2207
+ __ JumpIfSmi(edx, &miss);
2215
2208
  }
2216
2209
 
2217
2210
  // Make sure that it's okay not to patch the on stack receiver
@@ -2260,8 +2253,7 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
2260
2253
  } else {
2261
2254
  Label fast;
2262
2255
  // Check that the object is a smi or a heap number.
2263
- __ test(edx, Immediate(kSmiTagMask));
2264
- __ j(zero, &fast);
2256
+ __ JumpIfSmi(edx, &fast);
2265
2257
  __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax);
2266
2258
  __ j(not_equal, &miss);
2267
2259
  __ bind(&fast);
@@ -2300,7 +2292,11 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
2300
2292
  UNREACHABLE();
2301
2293
  }
2302
2294
 
2303
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
2295
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
2296
+ ? CALL_AS_FUNCTION
2297
+ : CALL_AS_METHOD;
2298
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION,
2299
+ NullCallWrapper(), call_kind);
2304
2300
 
2305
2301
  // Handle call cache miss.
2306
2302
  __ bind(&miss);
@@ -2335,7 +2331,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
2335
2331
  // Get the receiver from the stack.
2336
2332
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
2337
2333
 
2338
- CallInterceptorCompiler compiler(this, arguments(), ecx);
2334
+ CallInterceptorCompiler compiler(this, arguments(), ecx, extra_ic_state_);
2339
2335
  MaybeObject* result = compiler.Compile(masm(),
2340
2336
  object,
2341
2337
  holder,
@@ -2352,8 +2348,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
2352
2348
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
2353
2349
 
2354
2350
  // Check that the function really is a function.
2355
- __ test(eax, Immediate(kSmiTagMask));
2356
- __ j(zero, &miss);
2351
+ __ JumpIfSmi(eax, &miss);
2357
2352
  __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
2358
2353
  __ j(not_equal, &miss);
2359
2354
 
@@ -2366,7 +2361,11 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
2366
2361
 
2367
2362
  // Invoke the function.
2368
2363
  __ mov(edi, eax);
2369
- __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
2364
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
2365
+ ? CALL_AS_FUNCTION
2366
+ : CALL_AS_METHOD;
2367
+ __ InvokeFunction(edi, arguments(), JUMP_FUNCTION,
2368
+ NullCallWrapper(), call_kind);
2370
2369
 
2371
2370
  // Handle load cache miss.
2372
2371
  __ bind(&miss);
@@ -2383,8 +2382,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(
2383
2382
  GlobalObject* holder,
2384
2383
  JSGlobalPropertyCell* cell,
2385
2384
  JSFunction* function,
2386
- String* name,
2387
- Code::ExtraICState extra_ic_state) {
2385
+ String* name) {
2388
2386
  // ----------- S t a t e -------------
2389
2387
  // -- ecx : name
2390
2388
  // -- esp[0] : return address
@@ -2427,7 +2425,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(
2427
2425
  __ IncrementCounter(counters->call_global_inline(), 1);
2428
2426
  ASSERT(function->is_compiled());
2429
2427
  ParameterCount expected(function->shared()->formal_parameter_count());
2430
- CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state)
2428
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_)
2431
2429
  ? CALL_AS_FUNCTION
2432
2430
  : CALL_AS_METHOD;
2433
2431
  if (V8::UseCrankshaft()) {
@@ -2498,8 +2496,7 @@ MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object,
2498
2496
  Label miss;
2499
2497
 
2500
2498
  // Check that the object isn't a smi.
2501
- __ test(edx, Immediate(kSmiTagMask));
2502
- __ j(zero, &miss);
2499
+ __ JumpIfSmi(edx, &miss);
2503
2500
 
2504
2501
  // Check that the map of the object hasn't changed.
2505
2502
  __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
@@ -2548,8 +2545,7 @@ MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
2548
2545
  Label miss;
2549
2546
 
2550
2547
  // Check that the object isn't a smi.
2551
- __ test(edx, Immediate(kSmiTagMask));
2552
- __ j(zero, &miss);
2548
+ __ JumpIfSmi(edx, &miss);
2553
2549
 
2554
2550
  // Check that the map of the object hasn't changed.
2555
2551
  __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
@@ -2675,18 +2671,18 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
2675
2671
  }
2676
2672
 
2677
2673
 
2678
- MaybeObject* KeyedStoreStubCompiler::CompileStoreFastElement(
2679
- Map* receiver_map) {
2674
+ MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) {
2680
2675
  // ----------- S t a t e -------------
2681
2676
  // -- eax : value
2682
2677
  // -- ecx : key
2683
2678
  // -- edx : receiver
2684
2679
  // -- esp[0] : return address
2685
2680
  // -----------------------------------
2686
- bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
2687
- MaybeObject* maybe_stub =
2688
- KeyedStoreFastElementStub(is_js_array).TryGetCode();
2689
2681
  Code* stub;
2682
+ JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
2683
+ bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
2684
+ MaybeObject* maybe_stub =
2685
+ KeyedStoreElementStub(is_jsarray, elements_kind).TryGetCode();
2690
2686
  if (!maybe_stub->To(&stub)) return maybe_stub;
2691
2687
  __ DispatchMap(edx,
2692
2688
  Handle<Map>(receiver_map),
@@ -2741,8 +2737,7 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
2741
2737
  Label miss;
2742
2738
 
2743
2739
  // Check that the receiver isn't a smi.
2744
- __ test(eax, Immediate(kSmiTagMask));
2745
- __ j(zero, &miss);
2740
+ __ JumpIfSmi(eax, &miss);
2746
2741
 
2747
2742
  ASSERT(last->IsGlobalObject() || last->HasFastProperties());
2748
2743
 
@@ -2894,8 +2889,7 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
2894
2889
  // object which can only happen for contextual loads. In this case,
2895
2890
  // the receiver cannot be a smi.
2896
2891
  if (object != holder) {
2897
- __ test(eax, Immediate(kSmiTagMask));
2898
- __ j(zero, &miss);
2892
+ __ JumpIfSmi(eax, &miss);
2899
2893
  }
2900
2894
 
2901
2895
  // Check that the maps haven't changed.
@@ -3139,14 +3133,15 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
3139
3133
  }
3140
3134
 
3141
3135
 
3142
- MaybeObject* KeyedLoadStubCompiler::CompileLoadFastElement(Map* receiver_map) {
3136
+ MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) {
3143
3137
  // ----------- S t a t e -------------
3144
3138
  // -- eax : key
3145
3139
  // -- edx : receiver
3146
3140
  // -- esp[0] : return address
3147
3141
  // -----------------------------------
3148
- MaybeObject* maybe_stub = KeyedLoadFastElementStub().TryGetCode();
3149
3142
  Code* stub;
3143
+ JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
3144
+ MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode();
3150
3145
  if (!maybe_stub->To(&stub)) return maybe_stub;
3151
3146
  __ DispatchMap(edx,
3152
3147
  Handle<Map>(receiver_map),
@@ -3211,8 +3206,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
3211
3206
  // Load the initial map and verify that it is in fact a map.
3212
3207
  __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
3213
3208
  // Will both indicate a NULL and a Smi.
3214
- __ test(ebx, Immediate(kSmiTagMask));
3215
- __ j(zero, &generic_stub_call);
3209
+ __ JumpIfSmi(ebx, &generic_stub_call);
3216
3210
  __ CmpObjectType(ebx, MAP_TYPE, ecx);
3217
3211
  __ j(not_equal, &generic_stub_call);
3218
3212
 
@@ -3327,61 +3321,71 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
3327
3321
  }
3328
3322
 
3329
3323
 
3330
- MaybeObject* ExternalArrayLoadStubCompiler::CompileLoad(
3331
- JSObject*receiver, ExternalArrayType array_type) {
3324
+ #undef __
3325
+ #define __ ACCESS_MASM(masm)
3326
+
3327
+
3328
+ void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
3329
+ MacroAssembler* masm) {
3332
3330
  // ----------- S t a t e -------------
3333
3331
  // -- eax : key
3334
3332
  // -- edx : receiver
3335
3333
  // -- esp[0] : return address
3336
3334
  // -----------------------------------
3337
- MaybeObject* maybe_stub =
3338
- KeyedLoadExternalArrayStub(array_type).TryGetCode();
3339
- Code* stub;
3340
- if (!maybe_stub->To(&stub)) return maybe_stub;
3341
- __ DispatchMap(edx,
3342
- Handle<Map>(receiver->map()),
3343
- Handle<Code>(stub),
3344
- DO_SMI_CHECK);
3335
+ Label slow, miss_force_generic;
3345
3336
 
3346
- Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss();
3347
- __ jmp(ic, RelocInfo::CODE_TARGET);
3337
+ // This stub is meant to be tail-jumped to, the receiver must already
3338
+ // have been verified by the caller to not be a smi.
3339
+ __ JumpIfNotSmi(eax, &miss_force_generic);
3340
+ __ mov(ebx, eax);
3341
+ __ SmiUntag(ebx);
3342
+ __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
3348
3343
 
3349
- // Return the generated code.
3350
- return GetCode();
3351
- }
3344
+ // Push receiver on the stack to free up a register for the dictionary
3345
+ // probing.
3346
+ __ push(edx);
3347
+ __ LoadFromNumberDictionary(&slow,
3348
+ ecx,
3349
+ eax,
3350
+ ebx,
3351
+ edx,
3352
+ edi,
3353
+ eax);
3354
+ // Pop receiver before returning.
3355
+ __ pop(edx);
3356
+ __ ret(0);
3352
3357
 
3358
+ __ bind(&slow);
3359
+ __ pop(edx);
3353
3360
 
3354
- MaybeObject* ExternalArrayStoreStubCompiler::CompileStore(
3355
- JSObject* receiver, ExternalArrayType array_type) {
3356
3361
  // ----------- S t a t e -------------
3357
3362
  // -- eax : value
3358
3363
  // -- ecx : key
3359
3364
  // -- edx : receiver
3360
3365
  // -- esp[0] : return address
3361
3366
  // -----------------------------------
3362
- MaybeObject* maybe_stub =
3363
- KeyedStoreExternalArrayStub(array_type).TryGetCode();
3364
- Code* stub;
3365
- if (!maybe_stub->To(&stub)) return maybe_stub;
3366
- __ DispatchMap(edx,
3367
- Handle<Map>(receiver->map()),
3368
- Handle<Code>(stub),
3369
- DO_SMI_CHECK);
3370
3367
 
3371
- Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
3372
- __ jmp(ic, RelocInfo::CODE_TARGET);
3373
-
3374
- return GetCode();
3375
- }
3368
+ Handle<Code> slow_ic =
3369
+ masm->isolate()->builtins()->KeyedLoadIC_Slow();
3370
+ __ jmp(slow_ic, RelocInfo::CODE_TARGET);
3376
3371
 
3372
+ __ bind(&miss_force_generic);
3373
+ // ----------- S t a t e -------------
3374
+ // -- eax : value
3375
+ // -- ecx : key
3376
+ // -- edx : receiver
3377
+ // -- esp[0] : return address
3378
+ // -----------------------------------
3377
3379
 
3378
- #undef __
3379
- #define __ ACCESS_MASM(masm)
3380
+ Handle<Code> miss_force_generic_ic =
3381
+ masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3382
+ __ jmp(miss_force_generic_ic, RelocInfo::CODE_TARGET);
3383
+ }
3380
3384
 
3381
3385
 
3382
3386
  void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3383
3387
  MacroAssembler* masm,
3384
- ExternalArrayType array_type) {
3388
+ JSObject::ElementsKind elements_kind) {
3385
3389
  // ----------- S t a t e -------------
3386
3390
  // -- eax : key
3387
3391
  // -- edx : receiver
@@ -3393,41 +3397,40 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3393
3397
  // have been verified by the caller to not be a smi.
3394
3398
 
3395
3399
  // Check that the key is a smi.
3396
- __ test(eax, Immediate(kSmiTagMask));
3397
- __ j(not_zero, &miss_force_generic);
3400
+ __ JumpIfNotSmi(eax, &miss_force_generic);
3398
3401
 
3399
3402
  // Check that the index is in range.
3400
- __ mov(ecx, eax);
3401
- __ SmiUntag(ecx); // Untag the index.
3402
3403
  __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset));
3403
- __ cmp(ecx, FieldOperand(ebx, ExternalArray::kLengthOffset));
3404
+ __ cmp(eax, FieldOperand(ebx, ExternalArray::kLengthOffset));
3404
3405
  // Unsigned comparison catches both negative and too-large values.
3405
3406
  __ j(above_equal, &miss_force_generic);
3406
3407
  __ mov(ebx, FieldOperand(ebx, ExternalArray::kExternalPointerOffset));
3407
3408
  // ebx: base pointer of external storage
3408
- switch (array_type) {
3409
- case kExternalByteArray:
3410
- __ movsx_b(eax, Operand(ebx, ecx, times_1, 0));
3409
+ switch (elements_kind) {
3410
+ case JSObject::EXTERNAL_BYTE_ELEMENTS:
3411
+ __ SmiUntag(eax); // Untag the index.
3412
+ __ movsx_b(eax, Operand(ebx, eax, times_1, 0));
3411
3413
  break;
3412
- case kExternalUnsignedByteArray:
3413
- case kExternalPixelArray:
3414
- __ movzx_b(eax, Operand(ebx, ecx, times_1, 0));
3414
+ case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3415
+ case JSObject::EXTERNAL_PIXEL_ELEMENTS:
3416
+ __ SmiUntag(eax); // Untag the index.
3417
+ __ movzx_b(eax, Operand(ebx, eax, times_1, 0));
3415
3418
  break;
3416
- case kExternalShortArray:
3417
- __ movsx_w(eax, Operand(ebx, ecx, times_2, 0));
3419
+ case JSObject::EXTERNAL_SHORT_ELEMENTS:
3420
+ __ movsx_w(eax, Operand(ebx, eax, times_1, 0));
3418
3421
  break;
3419
- case kExternalUnsignedShortArray:
3420
- __ movzx_w(eax, Operand(ebx, ecx, times_2, 0));
3422
+ case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3423
+ __ movzx_w(eax, Operand(ebx, eax, times_1, 0));
3421
3424
  break;
3422
- case kExternalIntArray:
3423
- case kExternalUnsignedIntArray:
3424
- __ mov(ecx, Operand(ebx, ecx, times_4, 0));
3425
+ case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
3426
+ case JSObject::EXTERNAL_INT_ELEMENTS:
3427
+ __ mov(ecx, Operand(ebx, eax, times_2, 0));
3425
3428
  break;
3426
- case kExternalFloatArray:
3427
- __ fld_s(Operand(ebx, ecx, times_4, 0));
3429
+ case JSObject::EXTERNAL_FLOAT_ELEMENTS:
3430
+ __ fld_s(Operand(ebx, eax, times_2, 0));
3428
3431
  break;
3429
- case kExternalDoubleArray:
3430
- __ fld_d(Operand(ebx, ecx, times_8, 0));
3432
+ case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
3433
+ __ fld_d(Operand(ebx, eax, times_4, 0));
3431
3434
  break;
3432
3435
  default:
3433
3436
  UNREACHABLE();
@@ -3439,17 +3442,17 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3439
3442
  // For floating-point array type:
3440
3443
  // FP(0): value
3441
3444
 
3442
- if (array_type == kExternalIntArray ||
3443
- array_type == kExternalUnsignedIntArray) {
3445
+ if (elements_kind == JSObject::EXTERNAL_INT_ELEMENTS ||
3446
+ elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) {
3444
3447
  // For the Int and UnsignedInt array types, we need to see whether
3445
3448
  // the value can be represented in a Smi. If not, we need to convert
3446
3449
  // it to a HeapNumber.
3447
3450
  Label box_int;
3448
- if (array_type == kExternalIntArray) {
3451
+ if (elements_kind == JSObject::EXTERNAL_INT_ELEMENTS) {
3449
3452
  __ cmp(ecx, 0xC0000000);
3450
3453
  __ j(sign, &box_int);
3451
3454
  } else {
3452
- ASSERT_EQ(array_type, kExternalUnsignedIntArray);
3455
+ ASSERT_EQ(JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS, elements_kind);
3453
3456
  // The test is different for unsigned int values. Since we need
3454
3457
  // the value to be in the range of a positive smi, we can't
3455
3458
  // handle either of the top two bits being set in the value.
@@ -3465,12 +3468,12 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3465
3468
 
3466
3469
  // Allocate a HeapNumber for the int and perform int-to-double
3467
3470
  // conversion.
3468
- if (array_type == kExternalIntArray) {
3471
+ if (elements_kind == JSObject::EXTERNAL_INT_ELEMENTS) {
3469
3472
  __ push(ecx);
3470
3473
  __ fild_s(Operand(esp, 0));
3471
3474
  __ pop(ecx);
3472
3475
  } else {
3473
- ASSERT(array_type == kExternalUnsignedIntArray);
3476
+ ASSERT_EQ(JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS, elements_kind);
3474
3477
  // Need to zero-extend the value.
3475
3478
  // There's no fild variant for unsigned values, so zero-extend
3476
3479
  // to a 64-bit int manually.
@@ -3486,8 +3489,8 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3486
3489
  __ mov(eax, ecx);
3487
3490
  __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
3488
3491
  __ ret(0);
3489
- } else if (array_type == kExternalFloatArray ||
3490
- array_type == kExternalDoubleArray) {
3492
+ } else if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS ||
3493
+ elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3491
3494
  // For the floating-point array type, we need to always allocate a
3492
3495
  // HeapNumber.
3493
3496
  __ AllocateHeapNumber(ecx, ebx, edi, &failed_allocation);
@@ -3537,7 +3540,7 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3537
3540
 
3538
3541
  void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3539
3542
  MacroAssembler* masm,
3540
- ExternalArrayType array_type) {
3543
+ JSObject::ElementsKind elements_kind) {
3541
3544
  // ----------- S t a t e -------------
3542
3545
  // -- eax : key
3543
3546
  // -- edx : receiver
@@ -3549,14 +3552,11 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3549
3552
  // have been verified by the caller to not be a smi.
3550
3553
 
3551
3554
  // Check that the key is a smi.
3552
- __ test(ecx, Immediate(kSmiTagMask));
3553
- __ j(not_zero, &miss_force_generic);
3555
+ __ JumpIfNotSmi(ecx, &miss_force_generic);
3554
3556
 
3555
3557
  // Check that the index is in range.
3556
3558
  __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3557
- __ mov(ebx, ecx);
3558
- __ SmiUntag(ebx);
3559
- __ cmp(ebx, FieldOperand(edi, ExternalArray::kLengthOffset));
3559
+ __ cmp(ecx, FieldOperand(edi, ExternalArray::kLengthOffset));
3560
3560
  // Unsigned comparison catches both negative and too-large values.
3561
3561
  __ j(above_equal, &slow);
3562
3562
 
@@ -3566,52 +3566,46 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3566
3566
  // edx: receiver
3567
3567
  // ecx: key
3568
3568
  // edi: elements array
3569
- // ebx: untagged index
3570
- __ test(eax, Immediate(kSmiTagMask));
3571
- if (array_type == kExternalPixelArray)
3572
- __ j(not_equal, &slow);
3573
- else
3574
- __ j(not_equal, &check_heap_number);
3569
+ if (elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) {
3570
+ __ JumpIfNotSmi(eax, &slow);
3571
+ } else {
3572
+ __ JumpIfNotSmi(eax, &check_heap_number);
3573
+ }
3575
3574
 
3576
3575
  // smi case
3577
- __ mov(ecx, eax); // Preserve the value in eax. Key is no longer needed.
3578
- __ SmiUntag(ecx);
3576
+ __ mov(ebx, eax); // Preserve the value in eax as the return value.
3577
+ __ SmiUntag(ebx);
3579
3578
  __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
3580
- // ecx: base pointer of external storage
3581
- switch (array_type) {
3582
- case kExternalPixelArray:
3583
- { // Clamp the value to [0..255].
3584
- Label done;
3585
- __ test(ecx, Immediate(0xFFFFFF00));
3586
- __ j(zero, &done, Label::kNear);
3587
- __ setcc(negative, ecx); // 1 if negative, 0 if positive.
3588
- __ dec_b(ecx); // 0 if negative, 255 if positive.
3589
- __ bind(&done);
3590
- }
3591
- __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3579
+ // edi: base pointer of external storage
3580
+ switch (elements_kind) {
3581
+ case JSObject::EXTERNAL_PIXEL_ELEMENTS:
3582
+ __ ClampUint8(ebx);
3583
+ __ SmiUntag(ecx);
3584
+ __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3592
3585
  break;
3593
- case kExternalByteArray:
3594
- case kExternalUnsignedByteArray:
3595
- __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3586
+ case JSObject::EXTERNAL_BYTE_ELEMENTS:
3587
+ case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3588
+ __ SmiUntag(ecx);
3589
+ __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3596
3590
  break;
3597
- case kExternalShortArray:
3598
- case kExternalUnsignedShortArray:
3599
- __ mov_w(Operand(edi, ebx, times_2, 0), ecx);
3591
+ case JSObject::EXTERNAL_SHORT_ELEMENTS:
3592
+ case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3593
+ __ mov_w(Operand(edi, ecx, times_1, 0), ebx);
3600
3594
  break;
3601
- case kExternalIntArray:
3602
- case kExternalUnsignedIntArray:
3603
- __ mov(Operand(edi, ebx, times_4, 0), ecx);
3595
+ case JSObject::EXTERNAL_INT_ELEMENTS:
3596
+ case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
3597
+ __ mov(Operand(edi, ecx, times_2, 0), ebx);
3604
3598
  break;
3605
- case kExternalFloatArray:
3606
- case kExternalDoubleArray:
3599
+ case JSObject::EXTERNAL_FLOAT_ELEMENTS:
3600
+ case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
3607
3601
  // Need to perform int-to-float conversion.
3608
- __ push(ecx);
3602
+ __ push(ebx);
3609
3603
  __ fild_s(Operand(esp, 0));
3610
- __ pop(ecx);
3611
- if (array_type == kExternalFloatArray) {
3612
- __ fstp_s(Operand(edi, ebx, times_4, 0));
3613
- } else { // array_type == kExternalDoubleArray.
3614
- __ fstp_d(Operand(edi, ebx, times_8, 0));
3604
+ __ pop(ebx);
3605
+ if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3606
+ __ fstp_s(Operand(edi, ecx, times_2, 0));
3607
+ } else { // elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS.
3608
+ __ fstp_d(Operand(edi, ecx, times_4, 0));
3615
3609
  }
3616
3610
  break;
3617
3611
  default:
@@ -3621,13 +3615,12 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3621
3615
  __ ret(0); // Return the original value.
3622
3616
 
3623
3617
  // TODO(danno): handle heap number -> pixel array conversion
3624
- if (array_type != kExternalPixelArray) {
3618
+ if (elements_kind != JSObject::EXTERNAL_PIXEL_ELEMENTS) {
3625
3619
  __ bind(&check_heap_number);
3626
3620
  // eax: value
3627
3621
  // edx: receiver
3628
3622
  // ecx: key
3629
3623
  // edi: elements array
3630
- // ebx: untagged index
3631
3624
  __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
3632
3625
  Immediate(masm->isolate()->factory()->heap_number_map()));
3633
3626
  __ j(not_equal, &slow);
@@ -3636,15 +3629,14 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3636
3629
  // +/-Infinity into integer arrays basically undefined. For more
3637
3630
  // reproducible behavior, convert these to zero.
3638
3631
  __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
3639
- // ebx: untagged index
3640
3632
  // edi: base pointer of external storage
3641
- if (array_type == kExternalFloatArray) {
3633
+ if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3642
3634
  __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3643
- __ fstp_s(Operand(edi, ebx, times_4, 0));
3635
+ __ fstp_s(Operand(edi, ecx, times_2, 0));
3644
3636
  __ ret(0);
3645
- } else if (array_type == kExternalDoubleArray) {
3637
+ } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3646
3638
  __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3647
- __ fstp_d(Operand(edi, ebx, times_8, 0));
3639
+ __ fstp_d(Operand(edi, ecx, times_4, 0));
3648
3640
  __ ret(0);
3649
3641
  } else {
3650
3642
  // Perform float-to-int conversion with truncation (round-to-zero)
@@ -3655,31 +3647,24 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3655
3647
  // (code-stubs-ia32.cc) is roughly what is needed here though the
3656
3648
  // conversion failure case does not need to be handled.
3657
3649
  if (CpuFeatures::IsSupported(SSE2)) {
3658
- if (array_type != kExternalIntArray &&
3659
- array_type != kExternalUnsignedIntArray) {
3650
+ if (elements_kind != JSObject::EXTERNAL_INT_ELEMENTS &&
3651
+ elements_kind != JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) {
3660
3652
  ASSERT(CpuFeatures::IsSupported(SSE2));
3661
3653
  CpuFeatures::Scope scope(SSE2);
3662
- __ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset));
3654
+ __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset));
3663
3655
  // ecx: untagged integer value
3664
- switch (array_type) {
3665
- case kExternalPixelArray:
3666
- { // Clamp the value to [0..255].
3667
- Label done;
3668
- __ test(ecx, Immediate(0xFFFFFF00));
3669
- __ j(zero, &done, Label::kNear);
3670
- __ setcc(negative, ecx); // 1 if negative, 0 if positive.
3671
- __ dec_b(ecx); // 0 if negative, 255 if positive.
3672
- __ bind(&done);
3673
- }
3674
- __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3675
- break;
3676
- case kExternalByteArray:
3677
- case kExternalUnsignedByteArray:
3678
- __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3656
+ switch (elements_kind) {
3657
+ case JSObject::EXTERNAL_PIXEL_ELEMENTS:
3658
+ __ ClampUint8(ebx);
3659
+ // Fall through.
3660
+ case JSObject::EXTERNAL_BYTE_ELEMENTS:
3661
+ case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3662
+ __ SmiUntag(ecx);
3663
+ __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3679
3664
  break;
3680
- case kExternalShortArray:
3681
- case kExternalUnsignedShortArray:
3682
- __ mov_w(Operand(edi, ebx, times_2, 0), ecx);
3665
+ case JSObject::EXTERNAL_SHORT_ELEMENTS:
3666
+ case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3667
+ __ mov_w(Operand(edi, ecx, times_1, 0), ebx);
3683
3668
  break;
3684
3669
  default:
3685
3670
  UNREACHABLE();
@@ -3696,7 +3681,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3696
3681
  __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3697
3682
  __ sub(Operand(esp), Immediate(2 * kPointerSize));
3698
3683
  __ fisttp_d(Operand(esp, 0));
3699
- __ pop(ecx);
3684
+ __ pop(ebx);
3700
3685
  __ add(Operand(esp), Immediate(kPointerSize));
3701
3686
  } else {
3702
3687
  ASSERT(CpuFeatures::IsSupported(SSE2));
@@ -3707,15 +3692,15 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3707
3692
  // Note: we could do better for signed int arrays.
3708
3693
  __ movd(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
3709
3694
  // We will need the key if we have to make the slow runtime call.
3710
- __ push(ecx);
3711
- __ LoadPowerOf2(xmm1, ecx, 31);
3712
- __ pop(ecx);
3695
+ __ push(ebx);
3696
+ __ LoadPowerOf2(xmm1, ebx, 31);
3697
+ __ pop(ebx);
3713
3698
  __ ucomisd(xmm1, xmm0);
3714
3699
  __ j(above_equal, &slow);
3715
- __ cvttsd2si(ecx, Operand(xmm0));
3700
+ __ cvttsd2si(ebx, Operand(xmm0));
3716
3701
  }
3717
- // ecx: untagged integer value
3718
- __ mov(Operand(edi, ebx, times_4, 0), ecx);
3702
+ // ebx: untagged integer value
3703
+ __ mov(Operand(edi, ecx, times_2, 0), ebx);
3719
3704
  }
3720
3705
  __ ret(0); // Return original value.
3721
3706
  }
@@ -3751,8 +3736,6 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3751
3736
  }
3752
3737
 
3753
3738
 
3754
-
3755
-
3756
3739
  void KeyedLoadStubCompiler::GenerateLoadFastElement(MacroAssembler* masm) {
3757
3740
  // ----------- S t a t e -------------
3758
3741
  // -- eax : key
@@ -3765,8 +3748,7 @@ void KeyedLoadStubCompiler::GenerateLoadFastElement(MacroAssembler* masm) {
3765
3748
  // have been verified by the caller to not be a smi.
3766
3749
 
3767
3750
  // Check that the key is a smi.
3768
- __ test(eax, Immediate(kSmiTagMask));
3769
- __ j(not_zero, &miss_force_generic);
3751
+ __ JumpIfNotSmi(eax, &miss_force_generic);
3770
3752
 
3771
3753
  // Get the elements array.
3772
3754
  __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
@@ -3791,10 +3773,76 @@ void KeyedLoadStubCompiler::GenerateLoadFastElement(MacroAssembler* masm) {
3791
3773
  }
3792
3774
 
3793
3775
 
3776
+ void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(
3777
+ MacroAssembler* masm) {
3778
+ // ----------- S t a t e -------------
3779
+ // -- eax : key
3780
+ // -- edx : receiver
3781
+ // -- esp[0] : return address
3782
+ // -----------------------------------
3783
+ Label miss_force_generic, slow_allocate_heapnumber;
3784
+
3785
+ // This stub is meant to be tail-jumped to, the receiver must already
3786
+ // have been verified by the caller to not be a smi.
3787
+
3788
+ // Check that the key is a smi.
3789
+ __ JumpIfNotSmi(eax, &miss_force_generic);
3790
+
3791
+ // Get the elements array.
3792
+ __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
3793
+ __ AssertFastElements(ecx);
3794
+
3795
+ // Check that the key is within bounds.
3796
+ __ cmp(eax, FieldOperand(ecx, FixedDoubleArray::kLengthOffset));
3797
+ __ j(above_equal, &miss_force_generic);
3798
+
3799
+ // Check for the hole
3800
+ uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
3801
+ __ cmp(FieldOperand(ecx, eax, times_4, offset), Immediate(kHoleNanUpper32));
3802
+ __ j(equal, &miss_force_generic);
3803
+
3804
+ // Always allocate a heap number for the result.
3805
+ if (CpuFeatures::IsSupported(SSE2)) {
3806
+ CpuFeatures::Scope use_sse2(SSE2);
3807
+ __ movdbl(xmm0, FieldOperand(ecx, eax, times_4,
3808
+ FixedDoubleArray::kHeaderSize));
3809
+ } else {
3810
+ __ fld_d(FieldOperand(ecx, eax, times_4, FixedDoubleArray::kHeaderSize));
3811
+ }
3812
+ __ AllocateHeapNumber(ecx, ebx, edi, &slow_allocate_heapnumber);
3813
+ // Set the value.
3814
+ if (CpuFeatures::IsSupported(SSE2)) {
3815
+ CpuFeatures::Scope use_sse2(SSE2);
3816
+ __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm0);
3817
+ } else {
3818
+ __ fstp_d(FieldOperand(ecx, HeapNumber::kValueOffset));
3819
+ }
3820
+ __ mov(eax, ecx);
3821
+ __ ret(0);
3822
+
3823
+ __ bind(&slow_allocate_heapnumber);
3824
+ // A value was pushed on the floating point stack before the allocation, if
3825
+ // the allocation fails it needs to be removed.
3826
+ if (!CpuFeatures::IsSupported(SSE2)) {
3827
+ __ ffree();
3828
+ __ fincstp();
3829
+ }
3830
+ Handle<Code> slow_ic =
3831
+ masm->isolate()->builtins()->KeyedLoadIC_Slow();
3832
+ __ jmp(slow_ic, RelocInfo::CODE_TARGET);
3833
+
3834
+ __ bind(&miss_force_generic);
3835
+ Handle<Code> miss_ic =
3836
+ masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3837
+ __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3838
+ }
3839
+
3840
+
3794
3841
  void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm,
3795
3842
  bool is_js_array) {
3796
3843
  // ----------- S t a t e -------------
3797
- // -- eax : key
3844
+ // -- eax : value
3845
+ // -- ecx : key
3798
3846
  // -- edx : receiver
3799
3847
  // -- esp[0] : return address
3800
3848
  // -----------------------------------
@@ -3804,8 +3852,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm,
3804
3852
  // have been verified by the caller to not be a smi.
3805
3853
 
3806
3854
  // Check that the key is a smi.
3807
- __ test(ecx, Immediate(kSmiTagMask));
3808
- __ j(not_zero, &miss_force_generic);
3855
+ __ JumpIfNotSmi(ecx, &miss_force_generic);
3809
3856
 
3810
3857
  // Get the elements array and make sure it is a fast element array, not 'cow'.
3811
3858
  __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
@@ -3840,6 +3887,100 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm,
3840
3887
  }
3841
3888
 
3842
3889
 
3890
+ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
3891
+ MacroAssembler* masm,
3892
+ bool is_js_array) {
3893
+ // ----------- S t a t e -------------
3894
+ // -- eax : value
3895
+ // -- ecx : key
3896
+ // -- edx : receiver
3897
+ // -- esp[0] : return address
3898
+ // -----------------------------------
3899
+ Label miss_force_generic, smi_value, is_nan, maybe_nan;
3900
+ Label have_double_value, not_nan;
3901
+
3902
+ // This stub is meant to be tail-jumped to, the receiver must already
3903
+ // have been verified by the caller to not be a smi.
3904
+
3905
+ // Check that the key is a smi.
3906
+ __ JumpIfNotSmi(ecx, &miss_force_generic);
3907
+
3908
+ // Get the elements array.
3909
+ __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3910
+ __ AssertFastElements(edi);
3911
+
3912
+ if (is_js_array) {
3913
+ // Check that the key is within bounds.
3914
+ __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis.
3915
+ } else {
3916
+ // Check that the key is within bounds.
3917
+ __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis.
3918
+ }
3919
+ __ j(above_equal, &miss_force_generic);
3920
+
3921
+ __ JumpIfSmi(eax, &smi_value, Label::kNear);
3922
+
3923
+ __ CheckMap(eax,
3924
+ masm->isolate()->factory()->heap_number_map(),
3925
+ &miss_force_generic,
3926
+ DONT_DO_SMI_CHECK);
3927
+
3928
+ // Double value, canonicalize NaN.
3929
+ uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32);
3930
+ __ cmp(FieldOperand(eax, offset), Immediate(kNaNOrInfinityLowerBoundUpper32));
3931
+ __ j(greater_equal, &maybe_nan, Label::kNear);
3932
+
3933
+ __ bind(&not_nan);
3934
+ ExternalReference canonical_nan_reference =
3935
+ ExternalReference::address_of_canonical_non_hole_nan();
3936
+ if (CpuFeatures::IsSupported(SSE2)) {
3937
+ CpuFeatures::Scope use_sse2(SSE2);
3938
+ __ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
3939
+ __ bind(&have_double_value);
3940
+ __ movdbl(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize),
3941
+ xmm0);
3942
+ __ ret(0);
3943
+ } else {
3944
+ __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3945
+ __ bind(&have_double_value);
3946
+ __ fstp_d(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize));
3947
+ __ ret(0);
3948
+ }
3949
+
3950
+ __ bind(&maybe_nan);
3951
+ // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
3952
+ // it's an Infinity, and the non-NaN code path applies.
3953
+ __ j(greater, &is_nan, Label::kNear);
3954
+ __ cmp(FieldOperand(eax, HeapNumber::kValueOffset), Immediate(0));
3955
+ __ j(zero, &not_nan);
3956
+ __ bind(&is_nan);
3957
+ if (CpuFeatures::IsSupported(SSE2)) {
3958
+ CpuFeatures::Scope use_sse2(SSE2);
3959
+ __ movdbl(xmm0, Operand::StaticVariable(canonical_nan_reference));
3960
+ } else {
3961
+ __ fld_d(Operand::StaticVariable(canonical_nan_reference));
3962
+ }
3963
+ __ jmp(&have_double_value, Label::kNear);
3964
+
3965
+ __ bind(&smi_value);
3966
+ // Value is a smi. convert to a double and store.
3967
+ // Preserve original value.
3968
+ __ mov(edx, eax);
3969
+ __ SmiUntag(edx);
3970
+ __ push(edx);
3971
+ __ fild_s(Operand(esp, 0));
3972
+ __ pop(edx);
3973
+ __ fstp_d(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize));
3974
+ __ ret(0);
3975
+
3976
+ // Handle store cache miss, replacing the ic with the generic stub.
3977
+ __ bind(&miss_force_generic);
3978
+ Handle<Code> ic_force_generic =
3979
+ masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3980
+ __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3981
+ }
3982
+
3983
+
3843
3984
  #undef __
3844
3985
 
3845
3986
  } } // namespace v8::internal