libv8 3.3.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,82 @@
1
+ // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #ifndef V8_MEMORY_H_
29
+ #define V8_MEMORY_H_
30
+
31
+ namespace v8 {
32
+ namespace internal {
33
+
34
+ // Memory provides an interface to 'raw' memory. It encapsulates the casts
35
+ // that typically are needed when incompatible pointer types are used.
36
+
37
+ class Memory {
38
+ public:
39
+ static uint8_t& uint8_at(Address addr) {
40
+ return *reinterpret_cast<uint8_t*>(addr);
41
+ }
42
+
43
+ static uint16_t& uint16_at(Address addr) {
44
+ return *reinterpret_cast<uint16_t*>(addr);
45
+ }
46
+
47
+ static uint32_t& uint32_at(Address addr) {
48
+ return *reinterpret_cast<uint32_t*>(addr);
49
+ }
50
+
51
+ static int32_t& int32_at(Address addr) {
52
+ return *reinterpret_cast<int32_t*>(addr);
53
+ }
54
+
55
+ static uint64_t& uint64_at(Address addr) {
56
+ return *reinterpret_cast<uint64_t*>(addr);
57
+ }
58
+
59
+ static int& int_at(Address addr) {
60
+ return *reinterpret_cast<int*>(addr);
61
+ }
62
+
63
+ static double& double_at(Address addr) {
64
+ return *reinterpret_cast<double*>(addr);
65
+ }
66
+
67
+ static Address& Address_at(Address addr) {
68
+ return *reinterpret_cast<Address*>(addr);
69
+ }
70
+
71
+ static Object*& Object_at(Address addr) {
72
+ return *reinterpret_cast<Object**>(addr);
73
+ }
74
+
75
+ static Handle<Object>& Object_Handle_at(Address addr) {
76
+ return *reinterpret_cast<Handle<Object>*>(addr);
77
+ }
78
+ };
79
+
80
+ } } // namespace v8::internal
81
+
82
+ #endif // V8_MEMORY_H_
@@ -0,0 +1,1310 @@
1
+ // Copyright 2006-2008 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
+ // This file relies on the fact that the following declarations have been made
29
+ //
30
+ // in runtime.js:
31
+ // const $Object = global.Object;
32
+ // const $Boolean = global.Boolean;
33
+ // const $Number = global.Number;
34
+ // const $Function = global.Function;
35
+ // const $Array = global.Array;
36
+ // const $NaN = 0/0;
37
+ //
38
+ // in math.js:
39
+ // const $floor = MathFloor
40
+
41
+ const $isNaN = GlobalIsNaN;
42
+ const $isFinite = GlobalIsFinite;
43
+
44
+
45
+ // ----------------------------------------------------------------------------
46
+
47
+
48
+ // Helper function used to install functions on objects.
49
+ function InstallFunctions(object, attributes, functions) {
50
+ if (functions.length >= 8) {
51
+ %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1);
52
+ }
53
+ for (var i = 0; i < functions.length; i += 2) {
54
+ var key = functions[i];
55
+ var f = functions[i + 1];
56
+ %FunctionSetName(f, key);
57
+ %FunctionRemovePrototype(f);
58
+ %SetProperty(object, key, f, attributes);
59
+ %SetES5Flag(f);
60
+ }
61
+ %ToFastProperties(object);
62
+ }
63
+
64
+ // Emulates JSC by installing functions on a hidden prototype that
65
+ // lies above the current object/prototype. This lets you override
66
+ // functions on String.prototype etc. and then restore the old function
67
+ // with delete. See http://code.google.com/p/chromium/issues/detail?id=1717
68
+ function InstallFunctionsOnHiddenPrototype(object, attributes, functions) {
69
+ var hidden_prototype = new $Object();
70
+ %SetHiddenPrototype(object, hidden_prototype);
71
+ InstallFunctions(hidden_prototype, attributes, functions);
72
+ }
73
+
74
+
75
+ // ----------------------------------------------------------------------------
76
+
77
+
78
+ // ECMA 262 - 15.1.4
79
+ function GlobalIsNaN(number) {
80
+ var n = ToNumber(number);
81
+ return NUMBER_IS_NAN(n);
82
+ }
83
+
84
+
85
+ // ECMA 262 - 15.1.5
86
+ function GlobalIsFinite(number) {
87
+ if (!IS_NUMBER(number)) number = NonNumberToNumber(number);
88
+
89
+ // NaN - NaN == NaN, Infinity - Infinity == NaN, -Infinity - -Infinity == NaN.
90
+ return %_IsSmi(number) || number - number == 0;
91
+ }
92
+
93
+
94
+ // ECMA-262 - 15.1.2.2
95
+ function GlobalParseInt(string, radix) {
96
+ if (IS_UNDEFINED(radix) || radix === 10 || radix === 0) {
97
+ // Some people use parseInt instead of Math.floor. This
98
+ // optimization makes parseInt on a Smi 12 times faster (60ns
99
+ // vs 800ns). The following optimization makes parseInt on a
100
+ // non-Smi number 9 times faster (230ns vs 2070ns). Together
101
+ // they make parseInt on a string 1.4% slower (274ns vs 270ns).
102
+ if (%_IsSmi(string)) return string;
103
+ if (IS_NUMBER(string) &&
104
+ ((0.01 < string && string < 1e9) ||
105
+ (-1e9 < string && string < -0.01))) {
106
+ // Truncate number.
107
+ return string | 0;
108
+ }
109
+ if (IS_UNDEFINED(radix)) radix = 0;
110
+ } else {
111
+ radix = TO_INT32(radix);
112
+ if (!(radix == 0 || (2 <= radix && radix <= 36)))
113
+ return $NaN;
114
+ }
115
+ string = TO_STRING_INLINE(string);
116
+ if (%_HasCachedArrayIndex(string) &&
117
+ (radix == 0 || radix == 10)) {
118
+ return %_GetCachedArrayIndex(string);
119
+ }
120
+ return %StringParseInt(string, radix);
121
+ }
122
+
123
+
124
+ // ECMA-262 - 15.1.2.3
125
+ function GlobalParseFloat(string) {
126
+ string = TO_STRING_INLINE(string);
127
+ if (%_HasCachedArrayIndex(string)) return %_GetCachedArrayIndex(string);
128
+ return %StringParseFloat(string);
129
+ }
130
+
131
+
132
+ function GlobalEval(x) {
133
+ if (!IS_STRING(x)) return x;
134
+
135
+ var global_receiver = %GlobalReceiver(global);
136
+ var this_is_global_receiver = (this === global_receiver);
137
+ var global_is_detached = (global === global_receiver);
138
+
139
+ if (!this_is_global_receiver || global_is_detached) {
140
+ throw new $EvalError('The "this" object passed to eval must ' +
141
+ 'be the global object from which eval originated');
142
+ }
143
+
144
+ var f = %CompileString(x);
145
+ if (!IS_FUNCTION(f)) return f;
146
+
147
+ return %_CallFunction(this, f);
148
+ }
149
+
150
+
151
+ // ----------------------------------------------------------------------------
152
+
153
+
154
+ function SetupGlobal() {
155
+ // ECMA 262 - 15.1.1.1.
156
+ %SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE);
157
+
158
+ // ECMA-262 - 15.1.1.2.
159
+ %SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE);
160
+
161
+ // ECMA-262 - 15.1.1.3.
162
+ %SetProperty(global, "undefined", void 0, DONT_ENUM | DONT_DELETE);
163
+
164
+ // Setup non-enumerable function on the global object.
165
+ InstallFunctions(global, DONT_ENUM, $Array(
166
+ "isNaN", GlobalIsNaN,
167
+ "isFinite", GlobalIsFinite,
168
+ "parseInt", GlobalParseInt,
169
+ "parseFloat", GlobalParseFloat,
170
+ "eval", GlobalEval
171
+ ));
172
+ }
173
+
174
+ SetupGlobal();
175
+
176
+
177
+ // ----------------------------------------------------------------------------
178
+ // Boolean (first part of definition)
179
+
180
+
181
+ %SetCode($Boolean, function(x) {
182
+ if (%_IsConstructCall()) {
183
+ %_SetValueOf(this, ToBoolean(x));
184
+ } else {
185
+ return ToBoolean(x);
186
+ }
187
+ });
188
+
189
+ %FunctionSetPrototype($Boolean, new $Boolean(false));
190
+
191
+ %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
192
+
193
+ // ----------------------------------------------------------------------------
194
+ // Object
195
+
196
+ $Object.prototype.constructor = $Object;
197
+
198
+ // ECMA-262 - 15.2.4.2
199
+ function ObjectToString() {
200
+ if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
201
+ return '[object Undefined]';
202
+ }
203
+ if (IS_NULL(this)) return '[object Null]';
204
+ return "[object " + %_ClassOf(ToObject(this)) + "]";
205
+ }
206
+
207
+
208
+ // ECMA-262 - 15.2.4.3
209
+ function ObjectToLocaleString() {
210
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
211
+ throw MakeTypeError("called_on_null_or_undefined",
212
+ ["Object.prototype.toLocaleString"]);
213
+ }
214
+ return this.toString();
215
+ }
216
+
217
+
218
+ // ECMA-262 - 15.2.4.4
219
+ function ObjectValueOf() {
220
+ return ToObject(this);
221
+ }
222
+
223
+
224
+ // ECMA-262 - 15.2.4.5
225
+ function ObjectHasOwnProperty(V) {
226
+ return %HasLocalProperty(TO_OBJECT_INLINE(this), TO_STRING_INLINE(V));
227
+ }
228
+
229
+
230
+ // ECMA-262 - 15.2.4.6
231
+ function ObjectIsPrototypeOf(V) {
232
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
233
+ throw MakeTypeError("called_on_null_or_undefined",
234
+ ["Object.prototype.isPrototypeOf"]);
235
+ }
236
+ if (!IS_SPEC_OBJECT(V)) return false;
237
+ return %IsInPrototypeChain(this, V);
238
+ }
239
+
240
+
241
+ // ECMA-262 - 15.2.4.6
242
+ function ObjectPropertyIsEnumerable(V) {
243
+ return %IsPropertyEnumerable(ToObject(this), ToString(V));
244
+ }
245
+
246
+
247
+ // Extensions for providing property getters and setters.
248
+ function ObjectDefineGetter(name, fun) {
249
+ if (this == null && !IS_UNDETECTABLE(this)) {
250
+ throw new $TypeError('Object.prototype.__defineGetter__: this is Null');
251
+ }
252
+ if (!IS_FUNCTION(fun)) {
253
+ throw new $TypeError('Object.prototype.__defineGetter__: Expecting function');
254
+ }
255
+ var desc = new PropertyDescriptor();
256
+ desc.setGet(fun);
257
+ desc.setEnumerable(true);
258
+ desc.setConfigurable(true);
259
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
260
+ }
261
+
262
+
263
+ function ObjectLookupGetter(name) {
264
+ if (this == null && !IS_UNDETECTABLE(this)) {
265
+ throw new $TypeError('Object.prototype.__lookupGetter__: this is Null');
266
+ }
267
+ return %LookupAccessor(ToObject(this), ToString(name), GETTER);
268
+ }
269
+
270
+
271
+ function ObjectDefineSetter(name, fun) {
272
+ if (this == null && !IS_UNDETECTABLE(this)) {
273
+ throw new $TypeError('Object.prototype.__defineSetter__: this is Null');
274
+ }
275
+ if (!IS_FUNCTION(fun)) {
276
+ throw new $TypeError(
277
+ 'Object.prototype.__defineSetter__: Expecting function');
278
+ }
279
+ var desc = new PropertyDescriptor();
280
+ desc.setSet(fun);
281
+ desc.setEnumerable(true);
282
+ desc.setConfigurable(true);
283
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
284
+ }
285
+
286
+
287
+ function ObjectLookupSetter(name) {
288
+ if (this == null && !IS_UNDETECTABLE(this)) {
289
+ throw new $TypeError('Object.prototype.__lookupSetter__: this is Null');
290
+ }
291
+ return %LookupAccessor(ToObject(this), ToString(name), SETTER);
292
+ }
293
+
294
+
295
+ function ObjectKeys(obj) {
296
+ if (!IS_SPEC_OBJECT(obj))
297
+ throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
298
+ return %LocalKeys(obj);
299
+ }
300
+
301
+
302
+ // ES5 8.10.1.
303
+ function IsAccessorDescriptor(desc) {
304
+ if (IS_UNDEFINED(desc)) return false;
305
+ return desc.hasGetter_ || desc.hasSetter_;
306
+ }
307
+
308
+
309
+ // ES5 8.10.2.
310
+ function IsDataDescriptor(desc) {
311
+ if (IS_UNDEFINED(desc)) return false;
312
+ return desc.hasValue_ || desc.hasWritable_;
313
+ }
314
+
315
+
316
+ // ES5 8.10.3.
317
+ function IsGenericDescriptor(desc) {
318
+ return !(IsAccessorDescriptor(desc) || IsDataDescriptor(desc));
319
+ }
320
+
321
+
322
+ function IsInconsistentDescriptor(desc) {
323
+ return IsAccessorDescriptor(desc) && IsDataDescriptor(desc);
324
+ }
325
+
326
+ // ES5 8.10.4
327
+ function FromPropertyDescriptor(desc) {
328
+ if (IS_UNDEFINED(desc)) return desc;
329
+ var obj = new $Object();
330
+ if (IsDataDescriptor(desc)) {
331
+ obj.value = desc.getValue();
332
+ obj.writable = desc.isWritable();
333
+ }
334
+ if (IsAccessorDescriptor(desc)) {
335
+ obj.get = desc.getGet();
336
+ obj.set = desc.getSet();
337
+ }
338
+ obj.enumerable = desc.isEnumerable();
339
+ obj.configurable = desc.isConfigurable();
340
+ return obj;
341
+ }
342
+
343
+ // ES5 8.10.5.
344
+ function ToPropertyDescriptor(obj) {
345
+ if (!IS_SPEC_OBJECT(obj)) {
346
+ throw MakeTypeError("property_desc_object", [obj]);
347
+ }
348
+ var desc = new PropertyDescriptor();
349
+
350
+ if ("enumerable" in obj) {
351
+ desc.setEnumerable(ToBoolean(obj.enumerable));
352
+ }
353
+
354
+ if ("configurable" in obj) {
355
+ desc.setConfigurable(ToBoolean(obj.configurable));
356
+ }
357
+
358
+ if ("value" in obj) {
359
+ desc.setValue(obj.value);
360
+ }
361
+
362
+ if ("writable" in obj) {
363
+ desc.setWritable(ToBoolean(obj.writable));
364
+ }
365
+
366
+ if ("get" in obj) {
367
+ var get = obj.get;
368
+ if (!IS_UNDEFINED(get) && !IS_FUNCTION(get)) {
369
+ throw MakeTypeError("getter_must_be_callable", [get]);
370
+ }
371
+ desc.setGet(get);
372
+ }
373
+
374
+ if ("set" in obj) {
375
+ var set = obj.set;
376
+ if (!IS_UNDEFINED(set) && !IS_FUNCTION(set)) {
377
+ throw MakeTypeError("setter_must_be_callable", [set]);
378
+ }
379
+ desc.setSet(set);
380
+ }
381
+
382
+ if (IsInconsistentDescriptor(desc)) {
383
+ throw MakeTypeError("value_and_accessor", [obj]);
384
+ }
385
+ return desc;
386
+ }
387
+
388
+
389
+ function PropertyDescriptor() {
390
+ // Initialize here so they are all in-object and have the same map.
391
+ // Default values from ES5 8.6.1.
392
+ this.value_ = void 0;
393
+ this.hasValue_ = false;
394
+ this.writable_ = false;
395
+ this.hasWritable_ = false;
396
+ this.enumerable_ = false;
397
+ this.hasEnumerable_ = false;
398
+ this.configurable_ = false;
399
+ this.hasConfigurable_ = false;
400
+ this.get_ = void 0;
401
+ this.hasGetter_ = false;
402
+ this.set_ = void 0;
403
+ this.hasSetter_ = false;
404
+ }
405
+
406
+ PropertyDescriptor.prototype.__proto__ = null;
407
+ PropertyDescriptor.prototype.toString = function() {
408
+ return "[object PropertyDescriptor]";
409
+ };
410
+
411
+ PropertyDescriptor.prototype.setValue = function(value) {
412
+ this.value_ = value;
413
+ this.hasValue_ = true;
414
+ }
415
+
416
+
417
+ PropertyDescriptor.prototype.getValue = function() {
418
+ return this.value_;
419
+ }
420
+
421
+
422
+ PropertyDescriptor.prototype.hasValue = function() {
423
+ return this.hasValue_;
424
+ }
425
+
426
+
427
+ PropertyDescriptor.prototype.setEnumerable = function(enumerable) {
428
+ this.enumerable_ = enumerable;
429
+ this.hasEnumerable_ = true;
430
+ }
431
+
432
+
433
+ PropertyDescriptor.prototype.isEnumerable = function () {
434
+ return this.enumerable_;
435
+ }
436
+
437
+
438
+ PropertyDescriptor.prototype.hasEnumerable = function() {
439
+ return this.hasEnumerable_;
440
+ }
441
+
442
+
443
+ PropertyDescriptor.prototype.setWritable = function(writable) {
444
+ this.writable_ = writable;
445
+ this.hasWritable_ = true;
446
+ }
447
+
448
+
449
+ PropertyDescriptor.prototype.isWritable = function() {
450
+ return this.writable_;
451
+ }
452
+
453
+
454
+ PropertyDescriptor.prototype.hasWritable = function() {
455
+ return this.hasWritable_;
456
+ }
457
+
458
+
459
+ PropertyDescriptor.prototype.setConfigurable = function(configurable) {
460
+ this.configurable_ = configurable;
461
+ this.hasConfigurable_ = true;
462
+ }
463
+
464
+
465
+ PropertyDescriptor.prototype.hasConfigurable = function() {
466
+ return this.hasConfigurable_;
467
+ }
468
+
469
+
470
+ PropertyDescriptor.prototype.isConfigurable = function() {
471
+ return this.configurable_;
472
+ }
473
+
474
+
475
+ PropertyDescriptor.prototype.setGet = function(get) {
476
+ this.get_ = get;
477
+ this.hasGetter_ = true;
478
+ }
479
+
480
+
481
+ PropertyDescriptor.prototype.getGet = function() {
482
+ return this.get_;
483
+ }
484
+
485
+
486
+ PropertyDescriptor.prototype.hasGetter = function() {
487
+ return this.hasGetter_;
488
+ }
489
+
490
+
491
+ PropertyDescriptor.prototype.setSet = function(set) {
492
+ this.set_ = set;
493
+ this.hasSetter_ = true;
494
+ }
495
+
496
+
497
+ PropertyDescriptor.prototype.getSet = function() {
498
+ return this.set_;
499
+ }
500
+
501
+
502
+ PropertyDescriptor.prototype.hasSetter = function() {
503
+ return this.hasSetter_;
504
+ }
505
+
506
+
507
+ // Converts an array returned from Runtime_GetOwnProperty to an actual
508
+ // property descriptor. For a description of the array layout please
509
+ // see the runtime.cc file.
510
+ function ConvertDescriptorArrayToDescriptor(desc_array) {
511
+ if (desc_array === false) {
512
+ throw 'Internal error: invalid desc_array';
513
+ }
514
+
515
+ if (IS_UNDEFINED(desc_array)) {
516
+ return void 0;
517
+ }
518
+
519
+ var desc = new PropertyDescriptor();
520
+ // This is an accessor.
521
+ if (desc_array[IS_ACCESSOR_INDEX]) {
522
+ desc.setGet(desc_array[GETTER_INDEX]);
523
+ desc.setSet(desc_array[SETTER_INDEX]);
524
+ } else {
525
+ desc.setValue(desc_array[VALUE_INDEX]);
526
+ desc.setWritable(desc_array[WRITABLE_INDEX]);
527
+ }
528
+ desc.setEnumerable(desc_array[ENUMERABLE_INDEX]);
529
+ desc.setConfigurable(desc_array[CONFIGURABLE_INDEX]);
530
+
531
+ return desc;
532
+ }
533
+
534
+
535
+ // ES5 section 8.12.2.
536
+ function GetProperty(obj, p) {
537
+ var prop = GetOwnProperty(obj);
538
+ if (!IS_UNDEFINED(prop)) return prop;
539
+ var proto = obj.__proto__;
540
+ if (IS_NULL(proto)) return void 0;
541
+ return GetProperty(proto, p);
542
+ }
543
+
544
+
545
+ // ES5 section 8.12.6
546
+ function HasProperty(obj, p) {
547
+ var desc = GetProperty(obj, p);
548
+ return IS_UNDEFINED(desc) ? false : true;
549
+ }
550
+
551
+
552
+ // ES5 section 8.12.1.
553
+ function GetOwnProperty(obj, p) {
554
+ // GetOwnProperty returns an array indexed by the constants
555
+ // defined in macros.py.
556
+ // If p is not a property on obj undefined is returned.
557
+ var props = %GetOwnProperty(ToObject(obj), ToString(p));
558
+
559
+ // A false value here means that access checks failed.
560
+ if (props === false) return void 0;
561
+
562
+ return ConvertDescriptorArrayToDescriptor(props);
563
+ }
564
+
565
+
566
+ // ES5 8.12.9.
567
+ function DefineOwnProperty(obj, p, desc, should_throw) {
568
+ var current_or_access = %GetOwnProperty(ToObject(obj), ToString(p));
569
+ // A false value here means that access checks failed.
570
+ if (current_or_access === false) return void 0;
571
+
572
+ var current = ConvertDescriptorArrayToDescriptor(current_or_access);
573
+ var extensible = %IsExtensible(ToObject(obj));
574
+
575
+ // Error handling according to spec.
576
+ // Step 3
577
+ if (IS_UNDEFINED(current) && !extensible) {
578
+ if (should_throw) {
579
+ throw MakeTypeError("define_disallowed", ["defineProperty"]);
580
+ } else {
581
+ return;
582
+ }
583
+ }
584
+
585
+ if (!IS_UNDEFINED(current)) {
586
+ // Step 5 and 6
587
+ if ((IsGenericDescriptor(desc) ||
588
+ IsDataDescriptor(desc) == IsDataDescriptor(current)) &&
589
+ (!desc.hasEnumerable() ||
590
+ SameValue(desc.isEnumerable(), current.isEnumerable())) &&
591
+ (!desc.hasConfigurable() ||
592
+ SameValue(desc.isConfigurable(), current.isConfigurable())) &&
593
+ (!desc.hasWritable() ||
594
+ SameValue(desc.isWritable(), current.isWritable())) &&
595
+ (!desc.hasValue() ||
596
+ SameValue(desc.getValue(), current.getValue())) &&
597
+ (!desc.hasGetter() ||
598
+ SameValue(desc.getGet(), current.getGet())) &&
599
+ (!desc.hasSetter() ||
600
+ SameValue(desc.getSet(), current.getSet()))) {
601
+ return true;
602
+ }
603
+ if (!current.isConfigurable()) {
604
+ // Step 7
605
+ if (desc.isConfigurable() ||
606
+ (desc.hasEnumerable() &&
607
+ desc.isEnumerable() != current.isEnumerable())) {
608
+ if (should_throw) {
609
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
610
+ } else {
611
+ return;
612
+ }
613
+ }
614
+ // Step 8
615
+ if (!IsGenericDescriptor(desc)) {
616
+ // Step 9a
617
+ if (IsDataDescriptor(current) != IsDataDescriptor(desc)) {
618
+ if (should_throw) {
619
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
620
+ } else {
621
+ return;
622
+ }
623
+ }
624
+ // Step 10a
625
+ if (IsDataDescriptor(current) && IsDataDescriptor(desc)) {
626
+ if (!current.isWritable() && desc.isWritable()) {
627
+ if (should_throw) {
628
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
629
+ } else {
630
+ return;
631
+ }
632
+ }
633
+ if (!current.isWritable() && desc.hasValue() &&
634
+ !SameValue(desc.getValue(), current.getValue())) {
635
+ if (should_throw) {
636
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
637
+ } else {
638
+ return;
639
+ }
640
+ }
641
+ }
642
+ // Step 11
643
+ if (IsAccessorDescriptor(desc) && IsAccessorDescriptor(current)) {
644
+ if (desc.hasSetter() && !SameValue(desc.getSet(), current.getSet())) {
645
+ if (should_throw) {
646
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
647
+ } else {
648
+ return;
649
+ }
650
+ }
651
+ if (desc.hasGetter() && !SameValue(desc.getGet(),current.getGet())) {
652
+ if (should_throw) {
653
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
654
+ } else {
655
+ return;
656
+ }
657
+ }
658
+ }
659
+ }
660
+ }
661
+ }
662
+
663
+ // Send flags - enumerable and configurable are common - writable is
664
+ // only send to the data descriptor.
665
+ // Take special care if enumerable and configurable is not defined on
666
+ // desc (we need to preserve the existing values from current).
667
+ var flag = NONE;
668
+ if (desc.hasEnumerable()) {
669
+ flag |= desc.isEnumerable() ? 0 : DONT_ENUM;
670
+ } else if (!IS_UNDEFINED(current)) {
671
+ flag |= current.isEnumerable() ? 0 : DONT_ENUM;
672
+ } else {
673
+ flag |= DONT_ENUM;
674
+ }
675
+
676
+ if (desc.hasConfigurable()) {
677
+ flag |= desc.isConfigurable() ? 0 : DONT_DELETE;
678
+ } else if (!IS_UNDEFINED(current)) {
679
+ flag |= current.isConfigurable() ? 0 : DONT_DELETE;
680
+ } else
681
+ flag |= DONT_DELETE;
682
+
683
+ if (IsDataDescriptor(desc) ||
684
+ (IsGenericDescriptor(desc) &&
685
+ (IS_UNDEFINED(current) || IsDataDescriptor(current)))) {
686
+ // There are 3 cases that lead here:
687
+ // Step 4a - defining a new data property.
688
+ // Steps 9b & 12 - replacing an existing accessor property with a data
689
+ // property.
690
+ // Step 12 - updating an existing data property with a data or generic
691
+ // descriptor.
692
+
693
+ if (desc.hasWritable()) {
694
+ flag |= desc.isWritable() ? 0 : READ_ONLY;
695
+ } else if (!IS_UNDEFINED(current)) {
696
+ flag |= current.isWritable() ? 0 : READ_ONLY;
697
+ } else {
698
+ flag |= READ_ONLY;
699
+ }
700
+
701
+ var value = void 0; // Default value is undefined.
702
+ if (desc.hasValue()) {
703
+ value = desc.getValue();
704
+ } else if (!IS_UNDEFINED(current) && IsDataDescriptor(current)) {
705
+ value = current.getValue();
706
+ }
707
+
708
+ %DefineOrRedefineDataProperty(obj, p, value, flag);
709
+ } else if (IsGenericDescriptor(desc)) {
710
+ // Step 12 - updating an existing accessor property with generic
711
+ // descriptor. Changing flags only.
712
+ %DefineOrRedefineAccessorProperty(obj, p, GETTER, current.getGet(), flag);
713
+ } else {
714
+ // There are 3 cases that lead here:
715
+ // Step 4b - defining a new accessor property.
716
+ // Steps 9c & 12 - replacing an existing data property with an accessor
717
+ // property.
718
+ // Step 12 - updating an existing accessor property with an accessor
719
+ // descriptor.
720
+ if (desc.hasGetter()) {
721
+ %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag);
722
+ }
723
+ if (desc.hasSetter()) {
724
+ %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag);
725
+ }
726
+ }
727
+ return true;
728
+ }
729
+
730
+
731
+ // ES5 section 15.2.3.2.
732
+ function ObjectGetPrototypeOf(obj) {
733
+ if (!IS_SPEC_OBJECT(obj))
734
+ throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]);
735
+ return obj.__proto__;
736
+ }
737
+
738
+
739
+ // ES5 section 15.2.3.3
740
+ function ObjectGetOwnPropertyDescriptor(obj, p) {
741
+ if (!IS_SPEC_OBJECT(obj))
742
+ throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyDescriptor"]);
743
+ var desc = GetOwnProperty(obj, p);
744
+ return FromPropertyDescriptor(desc);
745
+ }
746
+
747
+
748
+ // ES5 section 15.2.3.4.
749
+ function ObjectGetOwnPropertyNames(obj) {
750
+ if (!IS_SPEC_OBJECT(obj))
751
+ throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]);
752
+
753
+ // Find all the indexed properties.
754
+
755
+ // Get the local element names.
756
+ var propertyNames = %GetLocalElementNames(obj);
757
+
758
+ // Get names for indexed interceptor properties.
759
+ if (%GetInterceptorInfo(obj) & 1) {
760
+ var indexedInterceptorNames =
761
+ %GetIndexedInterceptorElementNames(obj);
762
+ if (indexedInterceptorNames)
763
+ propertyNames = propertyNames.concat(indexedInterceptorNames);
764
+ }
765
+
766
+ // Find all the named properties.
767
+
768
+ // Get the local property names.
769
+ propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj));
770
+
771
+ // Get names for named interceptor properties if any.
772
+
773
+ if (%GetInterceptorInfo(obj) & 2) {
774
+ var namedInterceptorNames =
775
+ %GetNamedInterceptorPropertyNames(obj);
776
+ if (namedInterceptorNames) {
777
+ propertyNames = propertyNames.concat(namedInterceptorNames);
778
+ }
779
+ }
780
+
781
+ // Property names are expected to be unique strings.
782
+ var propertySet = {};
783
+ var j = 0;
784
+ for (var i = 0; i < propertyNames.length; ++i) {
785
+ var name = ToString(propertyNames[i]);
786
+ // We need to check for the exact property value since for intrinsic
787
+ // properties like toString if(propertySet["toString"]) will always
788
+ // succeed.
789
+ if (propertySet[name] === true)
790
+ continue;
791
+ propertySet[name] = true;
792
+ propertyNames[j++] = name;
793
+ }
794
+ propertyNames.length = j;
795
+
796
+ return propertyNames;
797
+ }
798
+
799
+
800
+ // ES5 section 15.2.3.5.
801
+ function ObjectCreate(proto, properties) {
802
+ if (!IS_SPEC_OBJECT(proto) && proto !== null) {
803
+ throw MakeTypeError("proto_object_or_null", [proto]);
804
+ }
805
+ var obj = new $Object();
806
+ obj.__proto__ = proto;
807
+ if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties);
808
+ return obj;
809
+ }
810
+
811
+
812
+ // ES5 section 15.2.3.6.
813
+ function ObjectDefineProperty(obj, p, attributes) {
814
+ if (!IS_SPEC_OBJECT(obj)) {
815
+ throw MakeTypeError("obj_ctor_property_non_object", ["defineProperty"]);
816
+ }
817
+ var name = ToString(p);
818
+ var desc = ToPropertyDescriptor(attributes);
819
+ DefineOwnProperty(obj, name, desc, true);
820
+ return obj;
821
+ }
822
+
823
+
824
+ // ES5 section 15.2.3.7.
825
+ function ObjectDefineProperties(obj, properties) {
826
+ if (!IS_SPEC_OBJECT(obj))
827
+ throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]);
828
+ var props = ToObject(properties);
829
+ var key_values = [];
830
+ for (var key in props) {
831
+ if (%HasLocalProperty(props, key)) {
832
+ key_values.push(key);
833
+ var value = props[key];
834
+ var desc = ToPropertyDescriptor(value);
835
+ key_values.push(desc);
836
+ }
837
+ }
838
+ for (var i = 0; i < key_values.length; i += 2) {
839
+ var key = key_values[i];
840
+ var desc = key_values[i + 1];
841
+ DefineOwnProperty(obj, key, desc, true);
842
+ }
843
+ return obj;
844
+ }
845
+
846
+
847
+ // ES5 section 15.2.3.8.
848
+ function ObjectSeal(obj) {
849
+ if (!IS_SPEC_OBJECT(obj)) {
850
+ throw MakeTypeError("obj_ctor_property_non_object", ["seal"]);
851
+ }
852
+ var names = ObjectGetOwnPropertyNames(obj);
853
+ for (var i = 0; i < names.length; i++) {
854
+ var name = names[i];
855
+ var desc = GetOwnProperty(obj, name);
856
+ if (desc.isConfigurable()) desc.setConfigurable(false);
857
+ DefineOwnProperty(obj, name, desc, true);
858
+ }
859
+ return ObjectPreventExtension(obj);
860
+ }
861
+
862
+
863
+ // ES5 section 15.2.3.9.
864
+ function ObjectFreeze(obj) {
865
+ if (!IS_SPEC_OBJECT(obj)) {
866
+ throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]);
867
+ }
868
+ var names = ObjectGetOwnPropertyNames(obj);
869
+ for (var i = 0; i < names.length; i++) {
870
+ var name = names[i];
871
+ var desc = GetOwnProperty(obj, name);
872
+ if (IsDataDescriptor(desc)) desc.setWritable(false);
873
+ if (desc.isConfigurable()) desc.setConfigurable(false);
874
+ DefineOwnProperty(obj, name, desc, true);
875
+ }
876
+ return ObjectPreventExtension(obj);
877
+ }
878
+
879
+
880
+ // ES5 section 15.2.3.10
881
+ function ObjectPreventExtension(obj) {
882
+ if (!IS_SPEC_OBJECT(obj)) {
883
+ throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]);
884
+ }
885
+ %PreventExtensions(obj);
886
+ return obj;
887
+ }
888
+
889
+
890
+ // ES5 section 15.2.3.11
891
+ function ObjectIsSealed(obj) {
892
+ if (!IS_SPEC_OBJECT(obj)) {
893
+ throw MakeTypeError("obj_ctor_property_non_object", ["isSealed"]);
894
+ }
895
+ var names = ObjectGetOwnPropertyNames(obj);
896
+ for (var i = 0; i < names.length; i++) {
897
+ var name = names[i];
898
+ var desc = GetOwnProperty(obj, name);
899
+ if (desc.isConfigurable()) return false;
900
+ }
901
+ if (!ObjectIsExtensible(obj)) {
902
+ return true;
903
+ }
904
+ return false;
905
+ }
906
+
907
+
908
+ // ES5 section 15.2.3.12
909
+ function ObjectIsFrozen(obj) {
910
+ if (!IS_SPEC_OBJECT(obj)) {
911
+ throw MakeTypeError("obj_ctor_property_non_object", ["isFrozen"]);
912
+ }
913
+ var names = ObjectGetOwnPropertyNames(obj);
914
+ for (var i = 0; i < names.length; i++) {
915
+ var name = names[i];
916
+ var desc = GetOwnProperty(obj, name);
917
+ if (IsDataDescriptor(desc) && desc.isWritable()) return false;
918
+ if (desc.isConfigurable()) return false;
919
+ }
920
+ if (!ObjectIsExtensible(obj)) {
921
+ return true;
922
+ }
923
+ return false;
924
+ }
925
+
926
+
927
+ // ES5 section 15.2.3.13
928
+ function ObjectIsExtensible(obj) {
929
+ if (!IS_SPEC_OBJECT(obj)) {
930
+ throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]);
931
+ }
932
+ return %IsExtensible(obj);
933
+ }
934
+
935
+
936
+ %SetCode($Object, function(x) {
937
+ if (%_IsConstructCall()) {
938
+ if (x == null) return this;
939
+ return ToObject(x);
940
+ } else {
941
+ if (x == null) return { };
942
+ return ToObject(x);
943
+ }
944
+ });
945
+
946
+ %SetExpectedNumberOfProperties($Object, 4);
947
+
948
+ // ----------------------------------------------------------------------------
949
+
950
+
951
+ function SetupObject() {
952
+ // Setup non-enumerable functions on the Object.prototype object.
953
+ InstallFunctions($Object.prototype, DONT_ENUM, $Array(
954
+ "toString", ObjectToString,
955
+ "toLocaleString", ObjectToLocaleString,
956
+ "valueOf", ObjectValueOf,
957
+ "hasOwnProperty", ObjectHasOwnProperty,
958
+ "isPrototypeOf", ObjectIsPrototypeOf,
959
+ "propertyIsEnumerable", ObjectPropertyIsEnumerable,
960
+ "__defineGetter__", ObjectDefineGetter,
961
+ "__lookupGetter__", ObjectLookupGetter,
962
+ "__defineSetter__", ObjectDefineSetter,
963
+ "__lookupSetter__", ObjectLookupSetter
964
+ ));
965
+ InstallFunctions($Object, DONT_ENUM, $Array(
966
+ "keys", ObjectKeys,
967
+ "create", ObjectCreate,
968
+ "defineProperty", ObjectDefineProperty,
969
+ "defineProperties", ObjectDefineProperties,
970
+ "freeze", ObjectFreeze,
971
+ "getPrototypeOf", ObjectGetPrototypeOf,
972
+ "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor,
973
+ "getOwnPropertyNames", ObjectGetOwnPropertyNames,
974
+ "isExtensible", ObjectIsExtensible,
975
+ "isFrozen", ObjectIsFrozen,
976
+ "isSealed", ObjectIsSealed,
977
+ "preventExtensions", ObjectPreventExtension,
978
+ "seal", ObjectSeal
979
+ ));
980
+ }
981
+
982
+ SetupObject();
983
+
984
+
985
+ // ----------------------------------------------------------------------------
986
+ // Boolean
987
+
988
+ function BooleanToString() {
989
+ // NOTE: Both Boolean objects and values can enter here as
990
+ // 'this'. This is not as dictated by ECMA-262.
991
+ var b = this;
992
+ if (!IS_BOOLEAN(b)) {
993
+ if (!IS_BOOLEAN_WRAPPER(b)) {
994
+ throw new $TypeError('Boolean.prototype.toString is not generic');
995
+ }
996
+ b = %_ValueOf(b);
997
+ }
998
+ return b ? 'true' : 'false';
999
+ }
1000
+
1001
+
1002
+ function BooleanValueOf() {
1003
+ // NOTE: Both Boolean objects and values can enter here as
1004
+ // 'this'. This is not as dictated by ECMA-262.
1005
+ if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this))
1006
+ throw new $TypeError('Boolean.prototype.valueOf is not generic');
1007
+ return %_ValueOf(this);
1008
+ }
1009
+
1010
+
1011
+ // ----------------------------------------------------------------------------
1012
+
1013
+
1014
+ function SetupBoolean() {
1015
+ InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
1016
+ "toString", BooleanToString,
1017
+ "valueOf", BooleanValueOf
1018
+ ));
1019
+ }
1020
+
1021
+ SetupBoolean();
1022
+
1023
+ // ----------------------------------------------------------------------------
1024
+ // Number
1025
+
1026
+ // Set the Number function and constructor.
1027
+ %SetCode($Number, function(x) {
1028
+ var value = %_ArgumentsLength() == 0 ? 0 : ToNumber(x);
1029
+ if (%_IsConstructCall()) {
1030
+ %_SetValueOf(this, value);
1031
+ } else {
1032
+ return value;
1033
+ }
1034
+ });
1035
+
1036
+ %FunctionSetPrototype($Number, new $Number(0));
1037
+
1038
+ // ECMA-262 section 15.7.4.2.
1039
+ function NumberToString(radix) {
1040
+ // NOTE: Both Number objects and values can enter here as
1041
+ // 'this'. This is not as dictated by ECMA-262.
1042
+ var number = this;
1043
+ if (!IS_NUMBER(this)) {
1044
+ if (!IS_NUMBER_WRAPPER(this))
1045
+ throw new $TypeError('Number.prototype.toString is not generic');
1046
+ // Get the value of this number in case it's an object.
1047
+ number = %_ValueOf(this);
1048
+ }
1049
+ // Fast case: Convert number in radix 10.
1050
+ if (IS_UNDEFINED(radix) || radix === 10) {
1051
+ return %_NumberToString(number);
1052
+ }
1053
+
1054
+ // Convert the radix to an integer and check the range.
1055
+ radix = TO_INTEGER(radix);
1056
+ if (radix < 2 || radix > 36) {
1057
+ throw new $RangeError('toString() radix argument must be between 2 and 36');
1058
+ }
1059
+ // Convert the number to a string in the given radix.
1060
+ return %NumberToRadixString(number, radix);
1061
+ }
1062
+
1063
+
1064
+ // ECMA-262 section 15.7.4.3
1065
+ function NumberToLocaleString() {
1066
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1067
+ throw MakeTypeError("called_on_null_or_undefined",
1068
+ ["Number.prototype.toLocaleString"]);
1069
+ }
1070
+ return this.toString();
1071
+ }
1072
+
1073
+
1074
+ // ECMA-262 section 15.7.4.4
1075
+ function NumberValueOf() {
1076
+ // NOTE: Both Number objects and values can enter here as
1077
+ // 'this'. This is not as dictated by ECMA-262.
1078
+ if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this))
1079
+ throw new $TypeError('Number.prototype.valueOf is not generic');
1080
+ return %_ValueOf(this);
1081
+ }
1082
+
1083
+
1084
+ // ECMA-262 section 15.7.4.5
1085
+ function NumberToFixed(fractionDigits) {
1086
+ var f = TO_INTEGER(fractionDigits);
1087
+ if (f < 0 || f > 20) {
1088
+ throw new $RangeError("toFixed() digits argument must be between 0 and 20");
1089
+ }
1090
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1091
+ throw MakeTypeError("called_on_null_or_undefined",
1092
+ ["Number.prototype.toFixed"]);
1093
+ }
1094
+ var x = ToNumber(this);
1095
+ return %NumberToFixed(x, f);
1096
+ }
1097
+
1098
+
1099
+ // ECMA-262 section 15.7.4.6
1100
+ function NumberToExponential(fractionDigits) {
1101
+ var f = -1;
1102
+ if (!IS_UNDEFINED(fractionDigits)) {
1103
+ f = TO_INTEGER(fractionDigits);
1104
+ if (f < 0 || f > 20) {
1105
+ throw new $RangeError("toExponential() argument must be between 0 and 20");
1106
+ }
1107
+ }
1108
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1109
+ throw MakeTypeError("called_on_null_or_undefined",
1110
+ ["Number.prototype.toExponential"]);
1111
+ }
1112
+ var x = ToNumber(this);
1113
+ return %NumberToExponential(x, f);
1114
+ }
1115
+
1116
+
1117
+ // ECMA-262 section 15.7.4.7
1118
+ function NumberToPrecision(precision) {
1119
+ if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1120
+ throw MakeTypeError("called_on_null_or_undefined",
1121
+ ["Number.prototype.toPrecision"]);
1122
+ }
1123
+ if (IS_UNDEFINED(precision)) return ToString(%_ValueOf(this));
1124
+ var p = TO_INTEGER(precision);
1125
+ if (p < 1 || p > 21) {
1126
+ throw new $RangeError("toPrecision() argument must be between 1 and 21");
1127
+ }
1128
+ var x = ToNumber(this);
1129
+ return %NumberToPrecision(x, p);
1130
+ }
1131
+
1132
+
1133
+ // ----------------------------------------------------------------------------
1134
+
1135
+ function SetupNumber() {
1136
+ %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
1137
+ // Setup the constructor property on the Number prototype object.
1138
+ %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
1139
+
1140
+ %OptimizeObjectForAddingMultipleProperties($Number, 5);
1141
+ // ECMA-262 section 15.7.3.1.
1142
+ %SetProperty($Number,
1143
+ "MAX_VALUE",
1144
+ 1.7976931348623157e+308,
1145
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
1146
+
1147
+ // ECMA-262 section 15.7.3.2.
1148
+ %SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY);
1149
+
1150
+ // ECMA-262 section 15.7.3.3.
1151
+ %SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
1152
+
1153
+ // ECMA-262 section 15.7.3.4.
1154
+ %SetProperty($Number,
1155
+ "NEGATIVE_INFINITY",
1156
+ -1/0,
1157
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
1158
+
1159
+ // ECMA-262 section 15.7.3.5.
1160
+ %SetProperty($Number,
1161
+ "POSITIVE_INFINITY",
1162
+ 1/0,
1163
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
1164
+ %ToFastProperties($Number);
1165
+
1166
+ // Setup non-enumerable functions on the Number prototype object.
1167
+ InstallFunctions($Number.prototype, DONT_ENUM, $Array(
1168
+ "toString", NumberToString,
1169
+ "toLocaleString", NumberToLocaleString,
1170
+ "valueOf", NumberValueOf,
1171
+ "toFixed", NumberToFixed,
1172
+ "toExponential", NumberToExponential,
1173
+ "toPrecision", NumberToPrecision
1174
+ ));
1175
+ }
1176
+
1177
+ SetupNumber();
1178
+
1179
+
1180
+ // ----------------------------------------------------------------------------
1181
+ // Function
1182
+
1183
+ $Function.prototype.constructor = $Function;
1184
+
1185
+ function FunctionSourceString(func) {
1186
+ if (!IS_FUNCTION(func)) {
1187
+ throw new $TypeError('Function.prototype.toString is not generic');
1188
+ }
1189
+
1190
+ var source = %FunctionGetSourceCode(func);
1191
+ if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
1192
+ var name = %FunctionGetName(func);
1193
+ if (name) {
1194
+ // Mimic what KJS does.
1195
+ return 'function ' + name + '() { [native code] }';
1196
+ } else {
1197
+ return 'function () { [native code] }';
1198
+ }
1199
+ }
1200
+
1201
+ var name = %FunctionGetName(func);
1202
+ return 'function ' + name + source;
1203
+ }
1204
+
1205
+
1206
+ function FunctionToString() {
1207
+ return FunctionSourceString(this);
1208
+ }
1209
+
1210
+
1211
+ // ES5 15.3.4.5
1212
+ function FunctionBind(this_arg) { // Length is 1.
1213
+ if (!IS_FUNCTION(this)) {
1214
+ throw new $TypeError('Bind must be called on a function');
1215
+ }
1216
+ // this_arg is not an argument that should be bound.
1217
+ var argc_bound = (%_ArgumentsLength() || 1) - 1;
1218
+ var fn = this;
1219
+ if (argc_bound == 0) {
1220
+ var result = function() {
1221
+ if (%_IsConstructCall()) {
1222
+ // %NewObjectFromBound implicitly uses arguments passed to this
1223
+ // function. We do not pass the arguments object explicitly to avoid
1224
+ // materializing it and guarantee that this function will be optimized.
1225
+ return %NewObjectFromBound(fn, null);
1226
+ }
1227
+
1228
+ return fn.apply(this_arg, arguments);
1229
+ };
1230
+ } else {
1231
+ var bound_args = new InternalArray(argc_bound);
1232
+ for(var i = 0; i < argc_bound; i++) {
1233
+ bound_args[i] = %_Arguments(i+1);
1234
+ }
1235
+
1236
+ var result = function() {
1237
+ // If this is a construct call we use a special runtime method
1238
+ // to generate the actual object using the bound function.
1239
+ if (%_IsConstructCall()) {
1240
+ // %NewObjectFromBound implicitly uses arguments passed to this
1241
+ // function. We do not pass the arguments object explicitly to avoid
1242
+ // materializing it and guarantee that this function will be optimized.
1243
+ return %NewObjectFromBound(fn, bound_args);
1244
+ }
1245
+
1246
+ // Combine the args we got from the bind call with the args
1247
+ // given as argument to the invocation.
1248
+ var argc = %_ArgumentsLength();
1249
+ var args = new InternalArray(argc + argc_bound);
1250
+ // Add bound arguments.
1251
+ for (var i = 0; i < argc_bound; i++) {
1252
+ args[i] = bound_args[i];
1253
+ }
1254
+ // Add arguments from call.
1255
+ for (var i = 0; i < argc; i++) {
1256
+ args[argc_bound + i] = %_Arguments(i);
1257
+ }
1258
+ return fn.apply(this_arg, args);
1259
+ };
1260
+ }
1261
+
1262
+ // We already have caller and arguments properties on functions,
1263
+ // which are non-configurable. It therefore makes no sence to
1264
+ // try to redefine these as defined by the spec. The spec says
1265
+ // that bind should make these throw a TypeError if get or set
1266
+ // is called and make them non-enumerable and non-configurable.
1267
+ // To be consistent with our normal functions we leave this as it is.
1268
+
1269
+ // Set the correct length.
1270
+ var length = (this.length - argc_bound) > 0 ? this.length - argc_bound : 0;
1271
+ %FunctionSetLength(result, length);
1272
+
1273
+ return result;
1274
+ }
1275
+
1276
+
1277
+ function NewFunction(arg1) { // length == 1
1278
+ var n = %_ArgumentsLength();
1279
+ var p = '';
1280
+ if (n > 1) {
1281
+ p = new InternalArray(n - 1);
1282
+ for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i);
1283
+ p = Join(p, n - 1, ',', NonStringToString);
1284
+ // If the formal parameters string include ) - an illegal
1285
+ // character - it may make the combined function expression
1286
+ // compile. We avoid this problem by checking for this early on.
1287
+ if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]);
1288
+ }
1289
+ var body = (n > 0) ? ToString(%_Arguments(n - 1)) : '';
1290
+ var source = '(function(' + p + ') {\n' + body + '\n})';
1291
+
1292
+ // The call to SetNewFunctionAttributes will ensure the prototype
1293
+ // property of the resulting function is enumerable (ECMA262, 15.3.5.2).
1294
+ var f = %CompileString(source)();
1295
+ %FunctionSetName(f, "anonymous");
1296
+ return %SetNewFunctionAttributes(f);
1297
+ }
1298
+
1299
+ %SetCode($Function, NewFunction);
1300
+
1301
+ // ----------------------------------------------------------------------------
1302
+
1303
+ function SetupFunction() {
1304
+ InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1305
+ "bind", FunctionBind,
1306
+ "toString", FunctionToString
1307
+ ));
1308
+ }
1309
+
1310
+ SetupFunction();