therubyracer 0.8.1.pre2 → 0.8.1

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

Potentially problematic release.


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

Files changed (877) hide show
  1. data/Changelog.md +2 -1
  2. data/README.md +6 -3
  3. data/ext/v8/upstream/3.1.8/.gitignore +31 -0
  4. data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
  5. data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
  6. data/ext/v8/upstream/3.1.8/LICENSE +52 -0
  7. data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
  8. data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
  9. data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
  10. data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
  11. data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
  12. data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
  13. data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
  14. data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
  15. data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
  16. data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
  17. data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
  18. data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
  19. data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
  20. data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
  21. data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
  22. data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
  23. data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
  24. data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
  25. data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
  26. data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
  27. data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
  28. data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
  29. data/ext/v8/upstream/3.1.8/src/api.h +508 -0
  30. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
  31. data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
  32. data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
  33. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
  34. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
  35. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
  36. data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
  37. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
  38. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
  39. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
  40. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
  41. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
  42. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
  43. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
  44. data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
  45. data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
  46. data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
  47. data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
  48. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
  49. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
  50. data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
  51. data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
  52. data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
  53. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
  54. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
  55. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
  56. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
  57. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
  58. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
  59. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
  60. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
  61. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
  62. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
  63. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
  64. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
  65. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
  66. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
  67. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
  68. data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
  69. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
  70. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
  71. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
  72. data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
  73. data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
  74. data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
  75. data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
  76. data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
  77. data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
  78. data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
  79. data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
  80. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
  81. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
  82. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
  83. data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
  84. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
  85. data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
  86. data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
  87. data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
  88. data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
  89. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
  90. data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
  91. data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
  92. data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
  93. data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
  94. data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
  95. data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
  96. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
  97. data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
  98. data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
  99. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
  100. data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
  101. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
  102. data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
  103. data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
  104. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
  105. data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
  106. data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
  107. data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
  108. data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
  109. data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
  110. data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
  111. data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
  112. data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
  113. data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
  114. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
  115. data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
  116. data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
  117. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
  118. data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
  119. data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
  120. data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
  121. data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
  122. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
  123. data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
  124. data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
  125. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
  126. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
  127. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
  128. data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
  129. data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
  130. data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
  131. data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
  132. data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
  133. data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
  134. data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
  135. data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
  136. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
  137. data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
  138. data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
  139. data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
  140. data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
  141. data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
  142. data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
  143. data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
  144. data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
  145. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
  146. data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
  147. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
  148. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
  149. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
  150. data/ext/v8/upstream/3.1.8/src/double.h +238 -0
  151. data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
  152. data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
  153. data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
  154. data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
  155. data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
  156. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
  157. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
  158. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
  159. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
  160. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
  161. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
  162. data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
  163. data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
  164. data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
  165. data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
  166. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
  167. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
  168. data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
  169. data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
  170. data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
  171. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
  172. data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
  173. data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
  174. data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
  175. data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
  176. data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
  177. data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
  178. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
  179. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
  180. data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
  181. data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
  182. data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
  183. data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
  184. data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
  185. data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
  186. data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
  187. data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
  188. data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
  189. data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
  190. data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
  191. data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
  192. data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
  193. data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
  194. data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
  195. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
  196. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
  197. data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
  198. data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
  199. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
  200. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
  201. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
  202. data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
  203. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
  204. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
  205. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
  206. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
  207. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
  208. data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
  209. data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
  210. data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
  211. data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
  212. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
  213. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
  214. data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
  215. data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
  216. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
  217. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
  218. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
  219. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
  220. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  221. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
  222. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
  223. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
  224. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
  225. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
  226. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
  227. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
  228. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
  229. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
  230. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
  231. data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
  232. data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
  233. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
  234. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
  235. data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
  236. data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
  237. data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
  238. data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
  239. data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
  240. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
  241. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
  242. data/ext/v8/upstream/3.1.8/src/json.js +342 -0
  243. data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
  244. data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
  245. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
  246. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
  247. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
  248. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
  249. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
  250. data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
  251. data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
  252. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
  253. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
  254. data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
  255. data/ext/v8/upstream/3.1.8/src/list.h +164 -0
  256. data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
  257. data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
  258. data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
  259. data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
  260. data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
  261. data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
  262. data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
  263. data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
  264. data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
  265. data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
  266. data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
  267. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
  268. data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
  269. data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
  270. data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
  271. data/ext/v8/upstream/3.1.8/src/log.h +379 -0
  272. data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
  273. data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
  274. data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
  275. data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
  276. data/ext/v8/upstream/3.1.8/src/math.js +264 -0
  277. data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
  278. data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
  279. data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
  280. data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
  281. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
  282. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
  283. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
  284. data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
  285. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
  286. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
  287. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
  288. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
  289. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
  290. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
  291. data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
  292. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
  293. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
  294. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
  295. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
  296. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
  297. data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
  298. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
  299. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
  300. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
  301. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
  302. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
  303. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
  304. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
  305. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
  306. data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
  307. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
  308. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
  309. data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
  310. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
  311. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
  312. data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
  313. data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
  314. data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
  315. data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
  316. data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
  317. data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
  318. data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
  319. data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
  320. data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
  321. data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
  322. data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
  323. data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
  324. data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
  325. data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
  326. data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
  327. data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
  328. data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
  329. data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
  330. data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
  331. data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
  332. data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
  333. data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
  334. data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
  335. data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
  336. data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
  337. data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
  338. data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
  339. data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
  340. data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
  341. data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
  342. data/ext/v8/upstream/3.1.8/src/property.h +337 -0
  343. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  344. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
  345. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
  346. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
  347. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
  348. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
  349. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
  350. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
  351. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
  352. data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
  353. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
  354. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
  355. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
  356. data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
  357. data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
  358. data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
  359. data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
  360. data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
  361. data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
  362. data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
  363. data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
  364. data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
  365. data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
  366. data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
  367. data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
  368. data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
  369. data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
  370. data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
  371. data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
  372. data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
  373. data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
  374. data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
  375. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
  376. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
  377. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
  378. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
  379. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
  380. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
  381. data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
  382. data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
  383. data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
  384. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
  385. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
  386. data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
  387. data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
  388. data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
  389. data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
  390. data/ext/v8/upstream/3.1.8/src/string.js +915 -0
  391. data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
  392. data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
  393. data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
  394. data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
  395. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
  396. data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
  397. data/ext/v8/upstream/3.1.8/src/token.h +288 -0
  398. data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
  399. data/ext/v8/upstream/3.1.8/src/top.h +608 -0
  400. data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
  401. data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
  402. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
  403. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
  404. data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
  405. data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
  406. data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
  407. data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
  408. data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
  409. data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
  410. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
  411. data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
  412. data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
  413. data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
  414. data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
  415. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
  416. data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
  417. data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
  418. data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
  419. data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
  420. data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
  421. data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
  422. data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
  423. data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
  424. data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
  425. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
  426. data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
  427. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
  428. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
  429. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
  430. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
  431. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
  432. data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
  433. data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
  434. data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
  435. data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
  436. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
  437. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
  438. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
  439. data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
  440. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
  441. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
  442. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
  443. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
  444. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
  445. data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
  446. data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
  447. data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
  448. data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
  449. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
  450. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
  451. data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
  452. data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
  453. data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
  454. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
  455. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
  456. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  457. data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
  458. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
  459. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
  460. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
  461. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
  462. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
  463. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
  464. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
  465. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
  466. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
  467. data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
  468. data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
  469. data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
  470. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
  471. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
  472. data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
  473. data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
  474. data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
  475. data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
  476. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
  477. data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
  478. data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
  479. data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
  480. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
  481. data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
  482. data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
  483. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
  484. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
  485. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
  486. data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
  487. data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
  488. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
  489. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
  490. data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
  491. data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
  492. data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
  493. data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
  494. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
  495. data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
  496. data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
  497. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
  498. data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
  499. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
  500. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
  501. data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
  502. data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
  503. data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
  504. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
  505. data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
  506. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
  507. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
  508. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
  509. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
  510. data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
  511. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
  512. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
  513. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
  514. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
  515. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
  516. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
  517. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
  518. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
  519. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
  520. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
  521. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
  522. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  523. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  524. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  525. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  526. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  527. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  528. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  529. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
  530. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
  531. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
  532. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  533. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  534. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  535. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  536. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
  537. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
  538. data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
  539. data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
  540. data/ext/v8/upstream/Makefile +2 -1
  541. data/ext/v8/v8_template.cpp +2 -2
  542. data/lib/v8/version.rb +1 -1
  543. data/spec/redjs/jsapi_spec.rb +2 -2
  544. metadata +552 -490
  545. data/ext/v8/upstream/2.3.3/.gitignore +0 -26
  546. data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
  547. data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
  548. data/ext/v8/upstream/2.3.3/LICENSE +0 -55
  549. data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
  550. data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
  551. data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
  552. data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
  553. data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
  554. data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
  555. data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
  556. data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
  557. data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
  558. data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
  559. data/ext/v8/upstream/2.3.3/src/api.h +0 -485
  560. data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
  561. data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
  562. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
  563. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
  564. data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
  565. data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
  566. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
  567. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
  568. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
  569. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
  570. data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
  571. data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
  572. data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
  573. data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
  574. data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
  575. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
  576. data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
  577. data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
  578. data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
  579. data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
  580. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
  581. data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
  582. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
  583. data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
  584. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
  585. data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
  586. data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
  587. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
  588. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
  589. data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
  590. data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
  591. data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
  592. data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
  593. data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
  594. data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
  595. data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
  596. data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
  597. data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
  598. data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
  599. data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
  600. data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
  601. data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
  602. data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
  603. data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
  604. data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
  605. data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
  606. data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
  607. data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
  608. data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
  609. data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
  610. data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
  611. data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
  612. data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
  613. data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
  614. data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
  615. data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
  616. data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
  617. data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
  618. data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
  619. data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
  620. data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
  621. data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
  622. data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
  623. data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
  624. data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
  625. data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
  626. data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
  627. data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
  628. data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
  629. data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
  630. data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
  631. data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
  632. data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
  633. data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
  634. data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
  635. data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
  636. data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
  637. data/ext/v8/upstream/2.3.3/src/double.h +0 -169
  638. data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
  639. data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
  640. data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
  641. data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
  642. data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
  643. data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
  644. data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
  645. data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
  646. data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
  647. data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
  648. data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
  649. data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
  650. data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
  651. data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
  652. data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
  653. data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
  654. data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
  655. data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
  656. data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
  657. data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
  658. data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
  659. data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
  660. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
  661. data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
  662. data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
  663. data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
  664. data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
  665. data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
  666. data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
  667. data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
  668. data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
  669. data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
  670. data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
  671. data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
  672. data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
  673. data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
  674. data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
  675. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
  676. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
  677. data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
  678. data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
  679. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
  680. data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
  681. data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
  682. data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
  683. data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
  684. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
  685. data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
  686. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
  687. data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
  688. data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
  689. data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
  690. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
  691. data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
  692. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
  693. data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
  694. data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
  695. data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
  696. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
  697. data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
  698. data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
  699. data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
  700. data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
  701. data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
  702. data/ext/v8/upstream/2.3.3/src/json.js +0 -268
  703. data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
  704. data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
  705. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
  706. data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
  707. data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
  708. data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
  709. data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
  710. data/ext/v8/upstream/2.3.3/src/list.h +0 -159
  711. data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
  712. data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
  713. data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
  714. data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
  715. data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
  716. data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
  717. data/ext/v8/upstream/2.3.3/src/log.h +0 -384
  718. data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
  719. data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
  720. data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
  721. data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
  722. data/ext/v8/upstream/2.3.3/src/math.js +0 -264
  723. data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
  724. data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
  725. data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
  726. data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
  727. data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
  728. data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
  729. data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
  730. data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
  731. data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
  732. data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
  733. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
  734. data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
  735. data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
  736. data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
  737. data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
  738. data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
  739. data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
  740. data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
  741. data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
  742. data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
  743. data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
  744. data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
  745. data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
  746. data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
  747. data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
  748. data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
  749. data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
  750. data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
  751. data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
  752. data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
  753. data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
  754. data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
  755. data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
  756. data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
  757. data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
  758. data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
  759. data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
  760. data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
  761. data/ext/v8/upstream/2.3.3/src/property.h +0 -315
  762. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
  763. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
  764. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
  765. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
  766. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
  767. data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
  768. data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
  769. data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
  770. data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
  771. data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
  772. data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
  773. data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
  774. data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
  775. data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
  776. data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
  777. data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
  778. data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
  779. data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
  780. data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
  781. data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
  782. data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
  783. data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
  784. data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
  785. data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
  786. data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
  787. data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
  788. data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
  789. data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
  790. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
  791. data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
  792. data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
  793. data/ext/v8/upstream/2.3.3/src/token.h +0 -270
  794. data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
  795. data/ext/v8/upstream/2.3.3/src/top.h +0 -463
  796. data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
  797. data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
  798. data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
  799. data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
  800. data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
  801. data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
  802. data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
  803. data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
  804. data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
  805. data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
  806. data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
  807. data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
  808. data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
  809. data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
  810. data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
  811. data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
  812. data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
  813. data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
  814. data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
  815. data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
  816. data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
  817. data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
  818. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
  819. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
  820. data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
  821. data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
  822. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
  823. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
  824. data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
  825. data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
  826. data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
  827. data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
  828. data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
  829. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
  830. data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
  831. data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
  832. data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
  833. data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
  834. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
  835. data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
  836. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
  837. data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
  838. data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
  839. data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
  840. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
  841. data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
  842. data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
  843. data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
  844. data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
  845. data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
  846. data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
  847. data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
  848. data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
  849. data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
  850. data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
  851. data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
  852. data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
  853. data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
  854. data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
  855. data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
  856. data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
  857. data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
  858. data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
  859. data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
  860. data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
  861. data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
  862. data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
  863. data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
  864. data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
  865. data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
  866. data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
  867. data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
  868. data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
  869. data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
  870. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
  871. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
  872. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
  873. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
  874. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
  875. data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
  876. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
  877. data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -0,0 +1,140 @@
1
+ // Copyright 2010 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_BIGNUM_H_
29
+ #define V8_BIGNUM_H_
30
+
31
+ namespace v8 {
32
+ namespace internal {
33
+
34
+ class Bignum {
35
+ public:
36
+ // 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately.
37
+ // This bignum can encode much bigger numbers, since it contains an
38
+ // exponent.
39
+ static const int kMaxSignificantBits = 3584;
40
+
41
+ Bignum();
42
+ void AssignUInt16(uint16_t value);
43
+ void AssignUInt64(uint64_t value);
44
+ void AssignBignum(const Bignum& other);
45
+
46
+ void AssignDecimalString(Vector<const char> value);
47
+ void AssignHexString(Vector<const char> value);
48
+
49
+ void AssignPowerUInt16(uint16_t base, int exponent);
50
+
51
+ void AddUInt16(uint16_t operand);
52
+ void AddUInt64(uint64_t operand);
53
+ void AddBignum(const Bignum& other);
54
+ // Precondition: this >= other.
55
+ void SubtractBignum(const Bignum& other);
56
+
57
+ void Square();
58
+ void ShiftLeft(int shift_amount);
59
+ void MultiplyByUInt32(uint32_t factor);
60
+ void MultiplyByUInt64(uint64_t factor);
61
+ void MultiplyByPowerOfTen(int exponent);
62
+ void Times10() { return MultiplyByUInt32(10); }
63
+ // Pseudocode:
64
+ // int result = this / other;
65
+ // this = this % other;
66
+ // In the worst case this function is in O(this/other).
67
+ uint16_t DivideModuloIntBignum(const Bignum& other);
68
+
69
+ bool ToHexString(char* buffer, int buffer_size) const;
70
+
71
+ static int Compare(const Bignum& a, const Bignum& b);
72
+ static bool Equal(const Bignum& a, const Bignum& b) {
73
+ return Compare(a, b) == 0;
74
+ }
75
+ static bool LessEqual(const Bignum& a, const Bignum& b) {
76
+ return Compare(a, b) <= 0;
77
+ }
78
+ static bool Less(const Bignum& a, const Bignum& b) {
79
+ return Compare(a, b) < 0;
80
+ }
81
+ // Returns Compare(a + b, c);
82
+ static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c);
83
+ // Returns a + b == c
84
+ static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
85
+ return PlusCompare(a, b, c) == 0;
86
+ }
87
+ // Returns a + b <= c
88
+ static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
89
+ return PlusCompare(a, b, c) <= 0;
90
+ }
91
+ // Returns a + b < c
92
+ static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) {
93
+ return PlusCompare(a, b, c) < 0;
94
+ }
95
+ private:
96
+ typedef uint32_t Chunk;
97
+ typedef uint64_t DoubleChunk;
98
+
99
+ static const int kChunkSize = sizeof(Chunk) * 8;
100
+ static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8;
101
+ // With bigit size of 28 we loose some bits, but a double still fits easily
102
+ // into two chunks, and more importantly we can use the Comba multiplication.
103
+ static const int kBigitSize = 28;
104
+ static const Chunk kBigitMask = (1 << kBigitSize) - 1;
105
+ // Every instance allocates kBigitLength chunks on the stack. Bignums cannot
106
+ // grow. There are no checks if the stack-allocated space is sufficient.
107
+ static const int kBigitCapacity = kMaxSignificantBits / kBigitSize;
108
+
109
+ void EnsureCapacity(int size) {
110
+ if (size > kBigitCapacity) {
111
+ UNREACHABLE();
112
+ }
113
+ }
114
+ void Align(const Bignum& other);
115
+ void Clamp();
116
+ bool IsClamped() const;
117
+ void Zero();
118
+ // Requires this to have enough capacity (no tests done).
119
+ // Updates used_digits_ if necessary.
120
+ // by must be < kBigitSize.
121
+ void BigitsShiftLeft(int shift_amount);
122
+ // BigitLength includes the "hidden" digits encoded in the exponent.
123
+ int BigitLength() const { return used_digits_ + exponent_; }
124
+ Chunk BigitAt(int index) const;
125
+ void SubtractTimes(const Bignum& other, int factor);
126
+
127
+ Chunk bigits_buffer_[kBigitCapacity];
128
+ // A vector backed by bigits_buffer_. This way accesses to the array are
129
+ // checked for out-of-bounds errors.
130
+ Vector<Chunk> bigits_;
131
+ int used_digits_;
132
+ // The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize).
133
+ int exponent_;
134
+
135
+ DISALLOW_COPY_AND_ASSIGN(Bignum);
136
+ };
137
+
138
+ } } // namespace v8::internal
139
+
140
+ #endif // V8_BIGNUM_H_
@@ -0,0 +1,1888 @@
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
+ #include "v8.h"
29
+
30
+ #include "accessors.h"
31
+ #include "api.h"
32
+ #include "bootstrapper.h"
33
+ #include "compiler.h"
34
+ #include "debug.h"
35
+ #include "execution.h"
36
+ #include "global-handles.h"
37
+ #include "macro-assembler.h"
38
+ #include "natives.h"
39
+ #include "objects-visiting.h"
40
+ #include "snapshot.h"
41
+ #include "extensions/externalize-string-extension.h"
42
+ #include "extensions/gc-extension.h"
43
+
44
+ namespace v8 {
45
+ namespace internal {
46
+
47
+ // A SourceCodeCache uses a FixedArray to store pairs of
48
+ // (AsciiString*, JSFunction*), mapping names of native code files
49
+ // (runtime.js, etc.) to precompiled functions. Instead of mapping
50
+ // names to functions it might make sense to let the JS2C tool
51
+ // generate an index for each native JS file.
52
+ class SourceCodeCache BASE_EMBEDDED {
53
+ public:
54
+ explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { }
55
+
56
+ void Initialize(bool create_heap_objects) {
57
+ cache_ = create_heap_objects ? Heap::empty_fixed_array() : NULL;
58
+ }
59
+
60
+ void Iterate(ObjectVisitor* v) {
61
+ v->VisitPointer(BitCast<Object**>(&cache_));
62
+ }
63
+
64
+
65
+ bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) {
66
+ for (int i = 0; i < cache_->length(); i+=2) {
67
+ SeqAsciiString* str = SeqAsciiString::cast(cache_->get(i));
68
+ if (str->IsEqualTo(name)) {
69
+ *handle = Handle<SharedFunctionInfo>(
70
+ SharedFunctionInfo::cast(cache_->get(i + 1)));
71
+ return true;
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+
77
+
78
+ void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) {
79
+ HandleScope scope;
80
+ int length = cache_->length();
81
+ Handle<FixedArray> new_array =
82
+ Factory::NewFixedArray(length + 2, TENURED);
83
+ cache_->CopyTo(0, *new_array, 0, cache_->length());
84
+ cache_ = *new_array;
85
+ Handle<String> str = Factory::NewStringFromAscii(name, TENURED);
86
+ cache_->set(length, *str);
87
+ cache_->set(length + 1, *shared);
88
+ Script::cast(shared->script())->set_type(Smi::FromInt(type_));
89
+ }
90
+
91
+ private:
92
+ Script::Type type_;
93
+ FixedArray* cache_;
94
+ DISALLOW_COPY_AND_ASSIGN(SourceCodeCache);
95
+ };
96
+
97
+ static SourceCodeCache extensions_cache(Script::TYPE_EXTENSION);
98
+ // This is for delete, not delete[].
99
+ static List<char*>* delete_these_non_arrays_on_tear_down = NULL;
100
+ // This is for delete[]
101
+ static List<char*>* delete_these_arrays_on_tear_down = NULL;
102
+
103
+
104
+ NativesExternalStringResource::NativesExternalStringResource(const char* source)
105
+ : data_(source), length_(StrLength(source)) {
106
+ if (delete_these_non_arrays_on_tear_down == NULL) {
107
+ delete_these_non_arrays_on_tear_down = new List<char*>(2);
108
+ }
109
+ // The resources are small objects and we only make a fixed number of
110
+ // them, but let's clean them up on exit for neatness.
111
+ delete_these_non_arrays_on_tear_down->
112
+ Add(reinterpret_cast<char*>(this));
113
+ }
114
+
115
+
116
+ Handle<String> Bootstrapper::NativesSourceLookup(int index) {
117
+ ASSERT(0 <= index && index < Natives::GetBuiltinsCount());
118
+ if (Heap::natives_source_cache()->get(index)->IsUndefined()) {
119
+ if (!Snapshot::IsEnabled() || FLAG_new_snapshot) {
120
+ // We can use external strings for the natives.
121
+ NativesExternalStringResource* resource =
122
+ new NativesExternalStringResource(
123
+ Natives::GetScriptSource(index).start());
124
+ Handle<String> source_code =
125
+ Factory::NewExternalStringFromAscii(resource);
126
+ Heap::natives_source_cache()->set(index, *source_code);
127
+ } else {
128
+ // Old snapshot code can't cope with external strings at all.
129
+ Handle<String> source_code =
130
+ Factory::NewStringFromAscii(Natives::GetScriptSource(index));
131
+ Heap::natives_source_cache()->set(index, *source_code);
132
+ }
133
+ }
134
+ Handle<Object> cached_source(Heap::natives_source_cache()->get(index));
135
+ return Handle<String>::cast(cached_source);
136
+ }
137
+
138
+
139
+ void Bootstrapper::Initialize(bool create_heap_objects) {
140
+ extensions_cache.Initialize(create_heap_objects);
141
+ GCExtension::Register();
142
+ ExternalizeStringExtension::Register();
143
+ }
144
+
145
+
146
+ char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
147
+ char* memory = new char[bytes];
148
+ if (memory != NULL) {
149
+ if (delete_these_arrays_on_tear_down == NULL) {
150
+ delete_these_arrays_on_tear_down = new List<char*>(2);
151
+ }
152
+ delete_these_arrays_on_tear_down->Add(memory);
153
+ }
154
+ return memory;
155
+ }
156
+
157
+
158
+ void Bootstrapper::TearDown() {
159
+ if (delete_these_non_arrays_on_tear_down != NULL) {
160
+ int len = delete_these_non_arrays_on_tear_down->length();
161
+ ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
162
+ for (int i = 0; i < len; i++) {
163
+ delete delete_these_non_arrays_on_tear_down->at(i);
164
+ delete_these_non_arrays_on_tear_down->at(i) = NULL;
165
+ }
166
+ delete delete_these_non_arrays_on_tear_down;
167
+ delete_these_non_arrays_on_tear_down = NULL;
168
+ }
169
+
170
+ if (delete_these_arrays_on_tear_down != NULL) {
171
+ int len = delete_these_arrays_on_tear_down->length();
172
+ ASSERT(len < 1000); // Don't use this mechanism for unbounded allocations.
173
+ for (int i = 0; i < len; i++) {
174
+ delete[] delete_these_arrays_on_tear_down->at(i);
175
+ delete_these_arrays_on_tear_down->at(i) = NULL;
176
+ }
177
+ delete delete_these_arrays_on_tear_down;
178
+ delete_these_arrays_on_tear_down = NULL;
179
+ }
180
+
181
+ extensions_cache.Initialize(false); // Yes, symmetrical
182
+ }
183
+
184
+
185
+ class Genesis BASE_EMBEDDED {
186
+ public:
187
+ Genesis(Handle<Object> global_object,
188
+ v8::Handle<v8::ObjectTemplate> global_template,
189
+ v8::ExtensionConfiguration* extensions);
190
+ ~Genesis() { }
191
+
192
+ Handle<Context> result() { return result_; }
193
+
194
+ Genesis* previous() { return previous_; }
195
+
196
+ private:
197
+ Handle<Context> global_context_;
198
+
199
+ // There may be more than one active genesis object: When GC is
200
+ // triggered during environment creation there may be weak handle
201
+ // processing callbacks which may create new environments.
202
+ Genesis* previous_;
203
+
204
+ Handle<Context> global_context() { return global_context_; }
205
+
206
+ // Creates some basic objects. Used for creating a context from scratch.
207
+ void CreateRoots();
208
+ // Creates the empty function. Used for creating a context from scratch.
209
+ Handle<JSFunction> CreateEmptyFunction();
210
+ // Creates the global objects using the global and the template passed in
211
+ // through the API. We call this regardless of whether we are building a
212
+ // context from scratch or using a deserialized one from the partial snapshot
213
+ // but in the latter case we don't use the objects it produces directly, as
214
+ // we have to used the deserialized ones that are linked together with the
215
+ // rest of the context snapshot.
216
+ Handle<JSGlobalProxy> CreateNewGlobals(
217
+ v8::Handle<v8::ObjectTemplate> global_template,
218
+ Handle<Object> global_object,
219
+ Handle<GlobalObject>* global_proxy_out);
220
+ // Hooks the given global proxy into the context. If the context was created
221
+ // by deserialization then this will unhook the global proxy that was
222
+ // deserialized, leaving the GC to pick it up.
223
+ void HookUpGlobalProxy(Handle<GlobalObject> inner_global,
224
+ Handle<JSGlobalProxy> global_proxy);
225
+ // Similarly, we want to use the inner global that has been created by the
226
+ // templates passed through the API. The inner global from the snapshot is
227
+ // detached from the other objects in the snapshot.
228
+ void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
229
+ // New context initialization. Used for creating a context from scratch.
230
+ void InitializeGlobal(Handle<GlobalObject> inner_global,
231
+ Handle<JSFunction> empty_function);
232
+ // Installs the contents of the native .js files on the global objects.
233
+ // Used for creating a context from scratch.
234
+ void InstallNativeFunctions();
235
+ bool InstallNatives();
236
+ void InstallBuiltinFunctionIds();
237
+ void InstallJSFunctionResultCaches();
238
+ void InitializeNormalizedMapCaches();
239
+ // Used both for deserialized and from-scratch contexts to add the extensions
240
+ // provided.
241
+ static bool InstallExtensions(Handle<Context> global_context,
242
+ v8::ExtensionConfiguration* extensions);
243
+ static bool InstallExtension(const char* name);
244
+ static bool InstallExtension(v8::RegisteredExtension* current);
245
+ static void InstallSpecialObjects(Handle<Context> global_context);
246
+ bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
247
+ bool ConfigureApiObject(Handle<JSObject> object,
248
+ Handle<ObjectTemplateInfo> object_template);
249
+ bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template);
250
+
251
+ // Migrates all properties from the 'from' object to the 'to'
252
+ // object and overrides the prototype in 'to' with the one from
253
+ // 'from'.
254
+ void TransferObject(Handle<JSObject> from, Handle<JSObject> to);
255
+ void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to);
256
+ void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to);
257
+
258
+ enum PrototypePropertyMode {
259
+ DONT_ADD_PROTOTYPE,
260
+ ADD_READONLY_PROTOTYPE,
261
+ ADD_WRITEABLE_PROTOTYPE
262
+ };
263
+ Handle<DescriptorArray> ComputeFunctionInstanceDescriptor(
264
+ PrototypePropertyMode prototypeMode);
265
+ void MakeFunctionInstancePrototypeWritable();
266
+
267
+ static bool CompileBuiltin(int index);
268
+ static bool CompileNative(Vector<const char> name, Handle<String> source);
269
+ static bool CompileScriptCached(Vector<const char> name,
270
+ Handle<String> source,
271
+ SourceCodeCache* cache,
272
+ v8::Extension* extension,
273
+ Handle<Context> top_context,
274
+ bool use_runtime_context);
275
+
276
+ Handle<Context> result_;
277
+ Handle<JSFunction> empty_function_;
278
+ BootstrapperActive active_;
279
+ friend class Bootstrapper;
280
+ };
281
+
282
+
283
+ void Bootstrapper::Iterate(ObjectVisitor* v) {
284
+ extensions_cache.Iterate(v);
285
+ v->Synchronize("Extensions");
286
+ }
287
+
288
+
289
+ Handle<Context> Bootstrapper::CreateEnvironment(
290
+ Handle<Object> global_object,
291
+ v8::Handle<v8::ObjectTemplate> global_template,
292
+ v8::ExtensionConfiguration* extensions) {
293
+ HandleScope scope;
294
+ Handle<Context> env;
295
+ Genesis genesis(global_object, global_template, extensions);
296
+ env = genesis.result();
297
+ if (!env.is_null()) {
298
+ if (InstallExtensions(env, extensions)) {
299
+ return env;
300
+ }
301
+ }
302
+ return Handle<Context>();
303
+ }
304
+
305
+
306
+ static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) {
307
+ // object.__proto__ = proto;
308
+ Handle<Map> old_to_map = Handle<Map>(object->map());
309
+ Handle<Map> new_to_map = Factory::CopyMapDropTransitions(old_to_map);
310
+ new_to_map->set_prototype(*proto);
311
+ object->set_map(*new_to_map);
312
+ }
313
+
314
+
315
+ void Bootstrapper::DetachGlobal(Handle<Context> env) {
316
+ JSGlobalProxy::cast(env->global_proxy())->set_context(*Factory::null_value());
317
+ SetObjectPrototype(Handle<JSObject>(env->global_proxy()),
318
+ Factory::null_value());
319
+ env->set_global_proxy(env->global());
320
+ env->global()->set_global_receiver(env->global());
321
+ }
322
+
323
+
324
+ void Bootstrapper::ReattachGlobal(Handle<Context> env,
325
+ Handle<Object> global_object) {
326
+ ASSERT(global_object->IsJSGlobalProxy());
327
+ Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object);
328
+ env->global()->set_global_receiver(*global);
329
+ env->set_global_proxy(*global);
330
+ SetObjectPrototype(global, Handle<JSObject>(env->global()));
331
+ global->set_context(*env);
332
+ }
333
+
334
+
335
+ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
336
+ const char* name,
337
+ InstanceType type,
338
+ int instance_size,
339
+ Handle<JSObject> prototype,
340
+ Builtins::Name call,
341
+ bool is_ecma_native) {
342
+ Handle<String> symbol = Factory::LookupAsciiSymbol(name);
343
+ Handle<Code> call_code = Handle<Code>(Builtins::builtin(call));
344
+ Handle<JSFunction> function = prototype.is_null() ?
345
+ Factory::NewFunctionWithoutPrototype(symbol, call_code) :
346
+ Factory::NewFunctionWithPrototype(symbol,
347
+ type,
348
+ instance_size,
349
+ prototype,
350
+ call_code,
351
+ is_ecma_native);
352
+ SetLocalPropertyNoThrow(target, symbol, function, DONT_ENUM);
353
+ if (is_ecma_native) {
354
+ function->shared()->set_instance_class_name(*symbol);
355
+ }
356
+ return function;
357
+ }
358
+
359
+
360
+ Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
361
+ PrototypePropertyMode prototypeMode) {
362
+ Handle<DescriptorArray> result = Factory::empty_descriptor_array();
363
+
364
+ if (prototypeMode != DONT_ADD_PROTOTYPE) {
365
+ PropertyAttributes attributes = static_cast<PropertyAttributes>(
366
+ DONT_ENUM |
367
+ DONT_DELETE |
368
+ (prototypeMode == ADD_READONLY_PROTOTYPE ? READ_ONLY : 0));
369
+ result =
370
+ Factory::CopyAppendProxyDescriptor(
371
+ result,
372
+ Factory::prototype_symbol(),
373
+ Factory::NewProxy(&Accessors::FunctionPrototype),
374
+ attributes);
375
+ }
376
+
377
+ PropertyAttributes attributes =
378
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
379
+ // Add length.
380
+ result =
381
+ Factory::CopyAppendProxyDescriptor(
382
+ result,
383
+ Factory::length_symbol(),
384
+ Factory::NewProxy(&Accessors::FunctionLength),
385
+ attributes);
386
+
387
+ // Add name.
388
+ result =
389
+ Factory::CopyAppendProxyDescriptor(
390
+ result,
391
+ Factory::name_symbol(),
392
+ Factory::NewProxy(&Accessors::FunctionName),
393
+ attributes);
394
+
395
+ // Add arguments.
396
+ result =
397
+ Factory::CopyAppendProxyDescriptor(
398
+ result,
399
+ Factory::arguments_symbol(),
400
+ Factory::NewProxy(&Accessors::FunctionArguments),
401
+ attributes);
402
+
403
+ // Add caller.
404
+ result =
405
+ Factory::CopyAppendProxyDescriptor(
406
+ result,
407
+ Factory::caller_symbol(),
408
+ Factory::NewProxy(&Accessors::FunctionCaller),
409
+ attributes);
410
+
411
+ return result;
412
+ }
413
+
414
+
415
+ Handle<JSFunction> Genesis::CreateEmptyFunction() {
416
+ // Allocate the map for function instances.
417
+ Handle<Map> fm = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
418
+ global_context()->set_function_instance_map(*fm);
419
+ // Please note that the prototype property for function instances must be
420
+ // writable.
421
+ Handle<DescriptorArray> function_map_descriptors =
422
+ ComputeFunctionInstanceDescriptor(ADD_WRITEABLE_PROTOTYPE);
423
+ fm->set_instance_descriptors(*function_map_descriptors);
424
+ fm->set_function_with_prototype(true);
425
+
426
+ // Functions with this map will not have a 'prototype' property, and
427
+ // can not be used as constructors.
428
+ Handle<Map> function_without_prototype_map =
429
+ Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
430
+ global_context()->set_function_without_prototype_map(
431
+ *function_without_prototype_map);
432
+ Handle<DescriptorArray> function_without_prototype_map_descriptors =
433
+ ComputeFunctionInstanceDescriptor(DONT_ADD_PROTOTYPE);
434
+ function_without_prototype_map->set_instance_descriptors(
435
+ *function_without_prototype_map_descriptors);
436
+ function_without_prototype_map->set_function_with_prototype(false);
437
+
438
+ // Allocate the function map first and then patch the prototype later
439
+ fm = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
440
+ global_context()->set_function_map(*fm);
441
+ function_map_descriptors =
442
+ ComputeFunctionInstanceDescriptor(ADD_READONLY_PROTOTYPE);
443
+ fm->set_instance_descriptors(*function_map_descriptors);
444
+ fm->set_function_with_prototype(true);
445
+
446
+ Handle<String> object_name = Handle<String>(Heap::Object_symbol());
447
+
448
+ { // --- O b j e c t ---
449
+ Handle<JSFunction> object_fun =
450
+ Factory::NewFunction(object_name, Factory::null_value());
451
+ Handle<Map> object_function_map =
452
+ Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
453
+ object_fun->set_initial_map(*object_function_map);
454
+ object_function_map->set_constructor(*object_fun);
455
+
456
+ global_context()->set_object_function(*object_fun);
457
+
458
+ // Allocate a new prototype for the object function.
459
+ Handle<JSObject> prototype = Factory::NewJSObject(Top::object_function(),
460
+ TENURED);
461
+
462
+ global_context()->set_initial_object_prototype(*prototype);
463
+ SetPrototype(object_fun, prototype);
464
+ object_function_map->
465
+ set_instance_descriptors(Heap::empty_descriptor_array());
466
+ }
467
+
468
+ // Allocate the empty function as the prototype for function ECMAScript
469
+ // 262 15.3.4.
470
+ Handle<String> symbol = Factory::LookupAsciiSymbol("Empty");
471
+ Handle<JSFunction> empty_function =
472
+ Factory::NewFunctionWithoutPrototype(symbol);
473
+
474
+ // --- E m p t y ---
475
+ Handle<Code> code =
476
+ Handle<Code>(Builtins::builtin(Builtins::EmptyFunction));
477
+ empty_function->set_code(*code);
478
+ empty_function->shared()->set_code(*code);
479
+ Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}"));
480
+ Handle<Script> script = Factory::NewScript(source);
481
+ script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
482
+ empty_function->shared()->set_script(*script);
483
+ empty_function->shared()->set_start_position(0);
484
+ empty_function->shared()->set_end_position(source->length());
485
+ empty_function->shared()->DontAdaptArguments();
486
+ global_context()->function_map()->set_prototype(*empty_function);
487
+ global_context()->function_instance_map()->set_prototype(*empty_function);
488
+ global_context()->function_without_prototype_map()->
489
+ set_prototype(*empty_function);
490
+
491
+ // Allocate the function map first and then patch the prototype later
492
+ Handle<Map> empty_fm = Factory::CopyMapDropDescriptors(
493
+ function_without_prototype_map);
494
+ empty_fm->set_instance_descriptors(
495
+ *function_without_prototype_map_descriptors);
496
+ empty_fm->set_prototype(global_context()->object_function()->prototype());
497
+ empty_function->set_map(*empty_fm);
498
+ return empty_function;
499
+ }
500
+
501
+
502
+ static void AddToWeakGlobalContextList(Context* context) {
503
+ ASSERT(context->IsGlobalContext());
504
+ #ifdef DEBUG
505
+ { // NOLINT
506
+ ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined());
507
+ // Check that context is not in the list yet.
508
+ for (Object* current = Heap::global_contexts_list();
509
+ !current->IsUndefined();
510
+ current = Context::cast(current)->get(Context::NEXT_CONTEXT_LINK)) {
511
+ ASSERT(current != context);
512
+ }
513
+ }
514
+ #endif
515
+ context->set(Context::NEXT_CONTEXT_LINK, Heap::global_contexts_list());
516
+ Heap::set_global_contexts_list(context);
517
+ }
518
+
519
+
520
+ void Genesis::CreateRoots() {
521
+ // Allocate the global context FixedArray first and then patch the
522
+ // closure and extension object later (we need the empty function
523
+ // and the global object, but in order to create those, we need the
524
+ // global context).
525
+ global_context_ =
526
+ Handle<Context>::cast(
527
+ GlobalHandles::Create(*Factory::NewGlobalContext()));
528
+ AddToWeakGlobalContextList(*global_context_);
529
+ Top::set_context(*global_context());
530
+
531
+ // Allocate the message listeners object.
532
+ {
533
+ v8::NeanderArray listeners;
534
+ global_context()->set_message_listeners(*listeners.value());
535
+ }
536
+ }
537
+
538
+
539
+ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
540
+ v8::Handle<v8::ObjectTemplate> global_template,
541
+ Handle<Object> global_object,
542
+ Handle<GlobalObject>* inner_global_out) {
543
+ // The argument global_template aka data is an ObjectTemplateInfo.
544
+ // It has a constructor pointer that points at global_constructor which is a
545
+ // FunctionTemplateInfo.
546
+ // The global_constructor is used to create or reinitialize the global_proxy.
547
+ // The global_constructor also has a prototype_template pointer that points at
548
+ // js_global_template which is an ObjectTemplateInfo.
549
+ // That in turn has a constructor pointer that points at
550
+ // js_global_constructor which is a FunctionTemplateInfo.
551
+ // js_global_constructor is used to make js_global_function
552
+ // js_global_function is used to make the new inner_global.
553
+ //
554
+ // --- G l o b a l ---
555
+ // Step 1: Create a fresh inner JSGlobalObject.
556
+ Handle<JSFunction> js_global_function;
557
+ Handle<ObjectTemplateInfo> js_global_template;
558
+ if (!global_template.IsEmpty()) {
559
+ // Get prototype template of the global_template.
560
+ Handle<ObjectTemplateInfo> data =
561
+ v8::Utils::OpenHandle(*global_template);
562
+ Handle<FunctionTemplateInfo> global_constructor =
563
+ Handle<FunctionTemplateInfo>(
564
+ FunctionTemplateInfo::cast(data->constructor()));
565
+ Handle<Object> proto_template(global_constructor->prototype_template());
566
+ if (!proto_template->IsUndefined()) {
567
+ js_global_template =
568
+ Handle<ObjectTemplateInfo>::cast(proto_template);
569
+ }
570
+ }
571
+
572
+ if (js_global_template.is_null()) {
573
+ Handle<String> name = Handle<String>(Heap::empty_symbol());
574
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
575
+ js_global_function =
576
+ Factory::NewFunction(name, JS_GLOBAL_OBJECT_TYPE,
577
+ JSGlobalObject::kSize, code, true);
578
+ // Change the constructor property of the prototype of the
579
+ // hidden global function to refer to the Object function.
580
+ Handle<JSObject> prototype =
581
+ Handle<JSObject>(
582
+ JSObject::cast(js_global_function->instance_prototype()));
583
+ SetLocalPropertyNoThrow(
584
+ prototype, Factory::constructor_symbol(), Top::object_function(), NONE);
585
+ } else {
586
+ Handle<FunctionTemplateInfo> js_global_constructor(
587
+ FunctionTemplateInfo::cast(js_global_template->constructor()));
588
+ js_global_function =
589
+ Factory::CreateApiFunction(js_global_constructor,
590
+ Factory::InnerGlobalObject);
591
+ }
592
+
593
+ js_global_function->initial_map()->set_is_hidden_prototype();
594
+ Handle<GlobalObject> inner_global =
595
+ Factory::NewGlobalObject(js_global_function);
596
+ if (inner_global_out != NULL) {
597
+ *inner_global_out = inner_global;
598
+ }
599
+
600
+ // Step 2: create or re-initialize the global proxy object.
601
+ Handle<JSFunction> global_proxy_function;
602
+ if (global_template.IsEmpty()) {
603
+ Handle<String> name = Handle<String>(Heap::empty_symbol());
604
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
605
+ global_proxy_function =
606
+ Factory::NewFunction(name, JS_GLOBAL_PROXY_TYPE,
607
+ JSGlobalProxy::kSize, code, true);
608
+ } else {
609
+ Handle<ObjectTemplateInfo> data =
610
+ v8::Utils::OpenHandle(*global_template);
611
+ Handle<FunctionTemplateInfo> global_constructor(
612
+ FunctionTemplateInfo::cast(data->constructor()));
613
+ global_proxy_function =
614
+ Factory::CreateApiFunction(global_constructor,
615
+ Factory::OuterGlobalObject);
616
+ }
617
+
618
+ Handle<String> global_name = Factory::LookupAsciiSymbol("global");
619
+ global_proxy_function->shared()->set_instance_class_name(*global_name);
620
+ global_proxy_function->initial_map()->set_is_access_check_needed(true);
621
+
622
+ // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
623
+ // Return the global proxy.
624
+
625
+ if (global_object.location() != NULL) {
626
+ ASSERT(global_object->IsJSGlobalProxy());
627
+ return ReinitializeJSGlobalProxy(
628
+ global_proxy_function,
629
+ Handle<JSGlobalProxy>::cast(global_object));
630
+ } else {
631
+ return Handle<JSGlobalProxy>::cast(
632
+ Factory::NewJSObject(global_proxy_function, TENURED));
633
+ }
634
+ }
635
+
636
+
637
+ void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global,
638
+ Handle<JSGlobalProxy> global_proxy) {
639
+ // Set the global context for the global object.
640
+ inner_global->set_global_context(*global_context());
641
+ inner_global->set_global_receiver(*global_proxy);
642
+ global_proxy->set_context(*global_context());
643
+ global_context()->set_global_proxy(*global_proxy);
644
+ }
645
+
646
+
647
+ void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
648
+ Handle<GlobalObject> inner_global_from_snapshot(
649
+ GlobalObject::cast(global_context_->extension()));
650
+ Handle<JSBuiltinsObject> builtins_global(global_context_->builtins());
651
+ global_context_->set_extension(*inner_global);
652
+ global_context_->set_global(*inner_global);
653
+ global_context_->set_security_token(*inner_global);
654
+ static const PropertyAttributes attributes =
655
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
656
+ ForceSetProperty(builtins_global,
657
+ Factory::LookupAsciiSymbol("global"),
658
+ inner_global,
659
+ attributes);
660
+ // Setup the reference from the global object to the builtins object.
661
+ JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
662
+ TransferNamedProperties(inner_global_from_snapshot, inner_global);
663
+ TransferIndexedProperties(inner_global_from_snapshot, inner_global);
664
+ }
665
+
666
+
667
+ // This is only called if we are not using snapshots. The equivalent
668
+ // work in the snapshot case is done in HookUpInnerGlobal.
669
+ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
670
+ Handle<JSFunction> empty_function) {
671
+ // --- G l o b a l C o n t e x t ---
672
+ // Use the empty function as closure (no scope info).
673
+ global_context()->set_closure(*empty_function);
674
+ global_context()->set_fcontext(*global_context());
675
+ global_context()->set_previous(NULL);
676
+ // Set extension and global object.
677
+ global_context()->set_extension(*inner_global);
678
+ global_context()->set_global(*inner_global);
679
+ // Security setup: Set the security token of the global object to
680
+ // its the inner global. This makes the security check between two
681
+ // different contexts fail by default even in case of global
682
+ // object reinitialization.
683
+ global_context()->set_security_token(*inner_global);
684
+
685
+ Handle<String> object_name = Handle<String>(Heap::Object_symbol());
686
+ SetLocalPropertyNoThrow(inner_global, object_name,
687
+ Top::object_function(), DONT_ENUM);
688
+
689
+ Handle<JSObject> global = Handle<JSObject>(global_context()->global());
690
+
691
+ // Install global Function object
692
+ InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
693
+ empty_function, Builtins::Illegal, true); // ECMA native.
694
+
695
+ { // --- A r r a y ---
696
+ Handle<JSFunction> array_function =
697
+ InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
698
+ Top::initial_object_prototype(), Builtins::ArrayCode,
699
+ true);
700
+ array_function->shared()->set_construct_stub(
701
+ Builtins::builtin(Builtins::ArrayConstructCode));
702
+ array_function->shared()->DontAdaptArguments();
703
+
704
+ // This seems a bit hackish, but we need to make sure Array.length
705
+ // is 1.
706
+ array_function->shared()->set_length(1);
707
+ Handle<DescriptorArray> array_descriptors =
708
+ Factory::CopyAppendProxyDescriptor(
709
+ Factory::empty_descriptor_array(),
710
+ Factory::length_symbol(),
711
+ Factory::NewProxy(&Accessors::ArrayLength),
712
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
713
+
714
+ // Cache the fast JavaScript array map
715
+ global_context()->set_js_array_map(array_function->initial_map());
716
+ global_context()->js_array_map()->set_instance_descriptors(
717
+ *array_descriptors);
718
+ // array_function is used internally. JS code creating array object should
719
+ // search for the 'Array' property on the global object and use that one
720
+ // as the constructor. 'Array' property on a global object can be
721
+ // overwritten by JS code.
722
+ global_context()->set_array_function(*array_function);
723
+ }
724
+
725
+ { // --- N u m b e r ---
726
+ Handle<JSFunction> number_fun =
727
+ InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize,
728
+ Top::initial_object_prototype(), Builtins::Illegal,
729
+ true);
730
+ global_context()->set_number_function(*number_fun);
731
+ }
732
+
733
+ { // --- B o o l e a n ---
734
+ Handle<JSFunction> boolean_fun =
735
+ InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
736
+ Top::initial_object_prototype(), Builtins::Illegal,
737
+ true);
738
+ global_context()->set_boolean_function(*boolean_fun);
739
+ }
740
+
741
+ { // --- S t r i n g ---
742
+ Handle<JSFunction> string_fun =
743
+ InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize,
744
+ Top::initial_object_prototype(), Builtins::Illegal,
745
+ true);
746
+ string_fun->shared()->set_construct_stub(
747
+ Builtins::builtin(Builtins::StringConstructCode));
748
+ global_context()->set_string_function(*string_fun);
749
+ // Add 'length' property to strings.
750
+ Handle<DescriptorArray> string_descriptors =
751
+ Factory::CopyAppendProxyDescriptor(
752
+ Factory::empty_descriptor_array(),
753
+ Factory::length_symbol(),
754
+ Factory::NewProxy(&Accessors::StringLength),
755
+ static_cast<PropertyAttributes>(DONT_ENUM |
756
+ DONT_DELETE |
757
+ READ_ONLY));
758
+
759
+ Handle<Map> string_map =
760
+ Handle<Map>(global_context()->string_function()->initial_map());
761
+ string_map->set_instance_descriptors(*string_descriptors);
762
+ }
763
+
764
+ { // --- D a t e ---
765
+ // Builtin functions for Date.prototype.
766
+ Handle<JSFunction> date_fun =
767
+ InstallFunction(global, "Date", JS_VALUE_TYPE, JSValue::kSize,
768
+ Top::initial_object_prototype(), Builtins::Illegal,
769
+ true);
770
+
771
+ global_context()->set_date_function(*date_fun);
772
+ }
773
+
774
+
775
+ { // -- R e g E x p
776
+ // Builtin functions for RegExp.prototype.
777
+ Handle<JSFunction> regexp_fun =
778
+ InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
779
+ Top::initial_object_prototype(), Builtins::Illegal,
780
+ true);
781
+ global_context()->set_regexp_function(*regexp_fun);
782
+
783
+ ASSERT(regexp_fun->has_initial_map());
784
+ Handle<Map> initial_map(regexp_fun->initial_map());
785
+
786
+ ASSERT_EQ(0, initial_map->inobject_properties());
787
+
788
+ Handle<DescriptorArray> descriptors = Factory::NewDescriptorArray(5);
789
+ PropertyAttributes final =
790
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
791
+ int enum_index = 0;
792
+ {
793
+ // ECMA-262, section 15.10.7.1.
794
+ FieldDescriptor field(Heap::source_symbol(),
795
+ JSRegExp::kSourceFieldIndex,
796
+ final,
797
+ enum_index++);
798
+ descriptors->Set(0, &field);
799
+ }
800
+ {
801
+ // ECMA-262, section 15.10.7.2.
802
+ FieldDescriptor field(Heap::global_symbol(),
803
+ JSRegExp::kGlobalFieldIndex,
804
+ final,
805
+ enum_index++);
806
+ descriptors->Set(1, &field);
807
+ }
808
+ {
809
+ // ECMA-262, section 15.10.7.3.
810
+ FieldDescriptor field(Heap::ignore_case_symbol(),
811
+ JSRegExp::kIgnoreCaseFieldIndex,
812
+ final,
813
+ enum_index++);
814
+ descriptors->Set(2, &field);
815
+ }
816
+ {
817
+ // ECMA-262, section 15.10.7.4.
818
+ FieldDescriptor field(Heap::multiline_symbol(),
819
+ JSRegExp::kMultilineFieldIndex,
820
+ final,
821
+ enum_index++);
822
+ descriptors->Set(3, &field);
823
+ }
824
+ {
825
+ // ECMA-262, section 15.10.7.5.
826
+ PropertyAttributes writable =
827
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
828
+ FieldDescriptor field(Heap::last_index_symbol(),
829
+ JSRegExp::kLastIndexFieldIndex,
830
+ writable,
831
+ enum_index++);
832
+ descriptors->Set(4, &field);
833
+ }
834
+ descriptors->SetNextEnumerationIndex(enum_index);
835
+ descriptors->Sort();
836
+
837
+ initial_map->set_inobject_properties(5);
838
+ initial_map->set_pre_allocated_property_fields(5);
839
+ initial_map->set_unused_property_fields(0);
840
+ initial_map->set_instance_size(
841
+ initial_map->instance_size() + 5 * kPointerSize);
842
+ initial_map->set_instance_descriptors(*descriptors);
843
+ initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
844
+ }
845
+
846
+ { // -- J S O N
847
+ Handle<String> name = Factory::NewStringFromAscii(CStrVector("JSON"));
848
+ Handle<JSFunction> cons = Factory::NewFunction(
849
+ name,
850
+ Factory::the_hole_value());
851
+ cons->SetInstancePrototype(global_context()->initial_object_prototype());
852
+ cons->SetInstanceClassName(*name);
853
+ Handle<JSObject> json_object = Factory::NewJSObject(cons, TENURED);
854
+ ASSERT(json_object->IsJSObject());
855
+ SetLocalPropertyNoThrow(global, name, json_object, DONT_ENUM);
856
+ global_context()->set_json_object(*json_object);
857
+ }
858
+
859
+ { // --- arguments_boilerplate_
860
+ // Make sure we can recognize argument objects at runtime.
861
+ // This is done by introducing an anonymous function with
862
+ // class_name equals 'Arguments'.
863
+ Handle<String> symbol = Factory::LookupAsciiSymbol("Arguments");
864
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
865
+ Handle<JSObject> prototype =
866
+ Handle<JSObject>(
867
+ JSObject::cast(global_context()->object_function()->prototype()));
868
+
869
+ Handle<JSFunction> function =
870
+ Factory::NewFunctionWithPrototype(symbol,
871
+ JS_OBJECT_TYPE,
872
+ JSObject::kHeaderSize,
873
+ prototype,
874
+ code,
875
+ false);
876
+ ASSERT(!function->has_initial_map());
877
+ function->shared()->set_instance_class_name(*symbol);
878
+ function->shared()->set_expected_nof_properties(2);
879
+ Handle<JSObject> result = Factory::NewJSObject(function);
880
+
881
+ global_context()->set_arguments_boilerplate(*result);
882
+ // Note: callee must be added as the first property and
883
+ // length must be added as the second property.
884
+ SetLocalPropertyNoThrow(result, Factory::callee_symbol(),
885
+ Factory::undefined_value(),
886
+ DONT_ENUM);
887
+ SetLocalPropertyNoThrow(result, Factory::length_symbol(),
888
+ Factory::undefined_value(),
889
+ DONT_ENUM);
890
+
891
+ #ifdef DEBUG
892
+ LookupResult lookup;
893
+ result->LocalLookup(Heap::callee_symbol(), &lookup);
894
+ ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
895
+ ASSERT(lookup.GetFieldIndex() == Heap::arguments_callee_index);
896
+
897
+ result->LocalLookup(Heap::length_symbol(), &lookup);
898
+ ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
899
+ ASSERT(lookup.GetFieldIndex() == Heap::arguments_length_index);
900
+
901
+ ASSERT(result->map()->inobject_properties() > Heap::arguments_callee_index);
902
+ ASSERT(result->map()->inobject_properties() > Heap::arguments_length_index);
903
+
904
+ // Check the state of the object.
905
+ ASSERT(result->HasFastProperties());
906
+ ASSERT(result->HasFastElements());
907
+ #endif
908
+ }
909
+
910
+ { // --- context extension
911
+ // Create a function for the context extension objects.
912
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
913
+ Handle<JSFunction> context_extension_fun =
914
+ Factory::NewFunction(Factory::empty_symbol(),
915
+ JS_CONTEXT_EXTENSION_OBJECT_TYPE,
916
+ JSObject::kHeaderSize,
917
+ code,
918
+ true);
919
+
920
+ Handle<String> name = Factory::LookupAsciiSymbol("context_extension");
921
+ context_extension_fun->shared()->set_instance_class_name(*name);
922
+ global_context()->set_context_extension_function(*context_extension_fun);
923
+ }
924
+
925
+
926
+ {
927
+ // Setup the call-as-function delegate.
928
+ Handle<Code> code =
929
+ Handle<Code>(Builtins::builtin(Builtins::HandleApiCallAsFunction));
930
+ Handle<JSFunction> delegate =
931
+ Factory::NewFunction(Factory::empty_symbol(), JS_OBJECT_TYPE,
932
+ JSObject::kHeaderSize, code, true);
933
+ global_context()->set_call_as_function_delegate(*delegate);
934
+ delegate->shared()->DontAdaptArguments();
935
+ }
936
+
937
+ {
938
+ // Setup the call-as-constructor delegate.
939
+ Handle<Code> code =
940
+ Handle<Code>(Builtins::builtin(Builtins::HandleApiCallAsConstructor));
941
+ Handle<JSFunction> delegate =
942
+ Factory::NewFunction(Factory::empty_symbol(), JS_OBJECT_TYPE,
943
+ JSObject::kHeaderSize, code, true);
944
+ global_context()->set_call_as_constructor_delegate(*delegate);
945
+ delegate->shared()->DontAdaptArguments();
946
+ }
947
+
948
+ // Initialize the out of memory slot.
949
+ global_context()->set_out_of_memory(Heap::false_value());
950
+
951
+ // Initialize the data slot.
952
+ global_context()->set_data(Heap::undefined_value());
953
+ }
954
+
955
+
956
+ bool Genesis::CompileBuiltin(int index) {
957
+ Vector<const char> name = Natives::GetScriptName(index);
958
+ Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
959
+ return CompileNative(name, source_code);
960
+ }
961
+
962
+
963
+ bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) {
964
+ HandleScope scope;
965
+ #ifdef ENABLE_DEBUGGER_SUPPORT
966
+ Debugger::set_compiling_natives(true);
967
+ #endif
968
+ bool result = CompileScriptCached(name,
969
+ source,
970
+ NULL,
971
+ NULL,
972
+ Handle<Context>(Top::context()),
973
+ true);
974
+ ASSERT(Top::has_pending_exception() != result);
975
+ if (!result) Top::clear_pending_exception();
976
+ #ifdef ENABLE_DEBUGGER_SUPPORT
977
+ Debugger::set_compiling_natives(false);
978
+ #endif
979
+ return result;
980
+ }
981
+
982
+
983
+ bool Genesis::CompileScriptCached(Vector<const char> name,
984
+ Handle<String> source,
985
+ SourceCodeCache* cache,
986
+ v8::Extension* extension,
987
+ Handle<Context> top_context,
988
+ bool use_runtime_context) {
989
+ HandleScope scope;
990
+ Handle<SharedFunctionInfo> function_info;
991
+
992
+ // If we can't find the function in the cache, we compile a new
993
+ // function and insert it into the cache.
994
+ if (cache == NULL || !cache->Lookup(name, &function_info)) {
995
+ ASSERT(source->IsAsciiRepresentation());
996
+ Handle<String> script_name = Factory::NewStringFromUtf8(name);
997
+ function_info = Compiler::Compile(
998
+ source,
999
+ script_name,
1000
+ 0,
1001
+ 0,
1002
+ extension,
1003
+ NULL,
1004
+ Handle<String>::null(),
1005
+ use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
1006
+ if (function_info.is_null()) return false;
1007
+ if (cache != NULL) cache->Add(name, function_info);
1008
+ }
1009
+
1010
+ // Setup the function context. Conceptually, we should clone the
1011
+ // function before overwriting the context but since we're in a
1012
+ // single-threaded environment it is not strictly necessary.
1013
+ ASSERT(top_context->IsGlobalContext());
1014
+ Handle<Context> context =
1015
+ Handle<Context>(use_runtime_context
1016
+ ? Handle<Context>(top_context->runtime_context())
1017
+ : top_context);
1018
+ Handle<JSFunction> fun =
1019
+ Factory::NewFunctionFromSharedFunctionInfo(function_info, context);
1020
+
1021
+ // Call function using either the runtime object or the global
1022
+ // object as the receiver. Provide no parameters.
1023
+ Handle<Object> receiver =
1024
+ Handle<Object>(use_runtime_context
1025
+ ? top_context->builtins()
1026
+ : top_context->global());
1027
+ bool has_pending_exception;
1028
+ Handle<Object> result =
1029
+ Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
1030
+ if (has_pending_exception) return false;
1031
+ return true;
1032
+ }
1033
+
1034
+
1035
+ #define INSTALL_NATIVE(Type, name, var) \
1036
+ Handle<String> var##_name = Factory::LookupAsciiSymbol(name); \
1037
+ global_context()->set_##var(Type::cast( \
1038
+ global_context()->builtins()->GetPropertyNoExceptionThrown(*var##_name)));
1039
+
1040
+ void Genesis::InstallNativeFunctions() {
1041
+ HandleScope scope;
1042
+ INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1043
+ INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1044
+ INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1045
+ INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1046
+ INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1047
+ INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1048
+ INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1049
+ INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1050
+ INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1051
+ INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
1052
+ INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
1053
+ configure_instance_fun);
1054
+ INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1055
+ INSTALL_NATIVE(JSObject, "functionCache", function_cache);
1056
+ }
1057
+
1058
+ #undef INSTALL_NATIVE
1059
+
1060
+
1061
+ bool Genesis::InstallNatives() {
1062
+ HandleScope scope;
1063
+
1064
+ // Create a function for the builtins object. Allocate space for the
1065
+ // JavaScript builtins, a reference to the builtins object
1066
+ // (itself) and a reference to the global_context directly in the object.
1067
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
1068
+ Handle<JSFunction> builtins_fun =
1069
+ Factory::NewFunction(Factory::empty_symbol(), JS_BUILTINS_OBJECT_TYPE,
1070
+ JSBuiltinsObject::kSize, code, true);
1071
+
1072
+ Handle<String> name = Factory::LookupAsciiSymbol("builtins");
1073
+ builtins_fun->shared()->set_instance_class_name(*name);
1074
+
1075
+ // Allocate the builtins object.
1076
+ Handle<JSBuiltinsObject> builtins =
1077
+ Handle<JSBuiltinsObject>::cast(Factory::NewGlobalObject(builtins_fun));
1078
+ builtins->set_builtins(*builtins);
1079
+ builtins->set_global_context(*global_context());
1080
+ builtins->set_global_receiver(*builtins);
1081
+
1082
+ // Setup the 'global' properties of the builtins object. The
1083
+ // 'global' property that refers to the global object is the only
1084
+ // way to get from code running in the builtins context to the
1085
+ // global object.
1086
+ static const PropertyAttributes attributes =
1087
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
1088
+ Handle<String> global_symbol = Factory::LookupAsciiSymbol("global");
1089
+ Handle<Object> global_obj(global_context()->global());
1090
+ SetLocalPropertyNoThrow(builtins, global_symbol, global_obj, attributes);
1091
+
1092
+ // Setup the reference from the global object to the builtins object.
1093
+ JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins);
1094
+
1095
+ // Create a bridge function that has context in the global context.
1096
+ Handle<JSFunction> bridge =
1097
+ Factory::NewFunction(Factory::empty_symbol(), Factory::undefined_value());
1098
+ ASSERT(bridge->context() == *Top::global_context());
1099
+
1100
+ // Allocate the builtins context.
1101
+ Handle<Context> context =
1102
+ Factory::NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge);
1103
+ context->set_global(*builtins); // override builtins global object
1104
+
1105
+ global_context()->set_runtime_context(*context);
1106
+
1107
+ { // -- S c r i p t
1108
+ // Builtin functions for Script.
1109
+ Handle<JSFunction> script_fun =
1110
+ InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
1111
+ Top::initial_object_prototype(), Builtins::Illegal,
1112
+ false);
1113
+ Handle<JSObject> prototype =
1114
+ Factory::NewJSObject(Top::object_function(), TENURED);
1115
+ SetPrototype(script_fun, prototype);
1116
+ global_context()->set_script_function(*script_fun);
1117
+
1118
+ // Add 'source' and 'data' property to scripts.
1119
+ PropertyAttributes common_attributes =
1120
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1121
+ Handle<Proxy> proxy_source = Factory::NewProxy(&Accessors::ScriptSource);
1122
+ Handle<DescriptorArray> script_descriptors =
1123
+ Factory::CopyAppendProxyDescriptor(
1124
+ Factory::empty_descriptor_array(),
1125
+ Factory::LookupAsciiSymbol("source"),
1126
+ proxy_source,
1127
+ common_attributes);
1128
+ Handle<Proxy> proxy_name = Factory::NewProxy(&Accessors::ScriptName);
1129
+ script_descriptors =
1130
+ Factory::CopyAppendProxyDescriptor(
1131
+ script_descriptors,
1132
+ Factory::LookupAsciiSymbol("name"),
1133
+ proxy_name,
1134
+ common_attributes);
1135
+ Handle<Proxy> proxy_id = Factory::NewProxy(&Accessors::ScriptId);
1136
+ script_descriptors =
1137
+ Factory::CopyAppendProxyDescriptor(
1138
+ script_descriptors,
1139
+ Factory::LookupAsciiSymbol("id"),
1140
+ proxy_id,
1141
+ common_attributes);
1142
+ Handle<Proxy> proxy_line_offset =
1143
+ Factory::NewProxy(&Accessors::ScriptLineOffset);
1144
+ script_descriptors =
1145
+ Factory::CopyAppendProxyDescriptor(
1146
+ script_descriptors,
1147
+ Factory::LookupAsciiSymbol("line_offset"),
1148
+ proxy_line_offset,
1149
+ common_attributes);
1150
+ Handle<Proxy> proxy_column_offset =
1151
+ Factory::NewProxy(&Accessors::ScriptColumnOffset);
1152
+ script_descriptors =
1153
+ Factory::CopyAppendProxyDescriptor(
1154
+ script_descriptors,
1155
+ Factory::LookupAsciiSymbol("column_offset"),
1156
+ proxy_column_offset,
1157
+ common_attributes);
1158
+ Handle<Proxy> proxy_data = Factory::NewProxy(&Accessors::ScriptData);
1159
+ script_descriptors =
1160
+ Factory::CopyAppendProxyDescriptor(
1161
+ script_descriptors,
1162
+ Factory::LookupAsciiSymbol("data"),
1163
+ proxy_data,
1164
+ common_attributes);
1165
+ Handle<Proxy> proxy_type = Factory::NewProxy(&Accessors::ScriptType);
1166
+ script_descriptors =
1167
+ Factory::CopyAppendProxyDescriptor(
1168
+ script_descriptors,
1169
+ Factory::LookupAsciiSymbol("type"),
1170
+ proxy_type,
1171
+ common_attributes);
1172
+ Handle<Proxy> proxy_compilation_type =
1173
+ Factory::NewProxy(&Accessors::ScriptCompilationType);
1174
+ script_descriptors =
1175
+ Factory::CopyAppendProxyDescriptor(
1176
+ script_descriptors,
1177
+ Factory::LookupAsciiSymbol("compilation_type"),
1178
+ proxy_compilation_type,
1179
+ common_attributes);
1180
+ Handle<Proxy> proxy_line_ends =
1181
+ Factory::NewProxy(&Accessors::ScriptLineEnds);
1182
+ script_descriptors =
1183
+ Factory::CopyAppendProxyDescriptor(
1184
+ script_descriptors,
1185
+ Factory::LookupAsciiSymbol("line_ends"),
1186
+ proxy_line_ends,
1187
+ common_attributes);
1188
+ Handle<Proxy> proxy_context_data =
1189
+ Factory::NewProxy(&Accessors::ScriptContextData);
1190
+ script_descriptors =
1191
+ Factory::CopyAppendProxyDescriptor(
1192
+ script_descriptors,
1193
+ Factory::LookupAsciiSymbol("context_data"),
1194
+ proxy_context_data,
1195
+ common_attributes);
1196
+ Handle<Proxy> proxy_eval_from_script =
1197
+ Factory::NewProxy(&Accessors::ScriptEvalFromScript);
1198
+ script_descriptors =
1199
+ Factory::CopyAppendProxyDescriptor(
1200
+ script_descriptors,
1201
+ Factory::LookupAsciiSymbol("eval_from_script"),
1202
+ proxy_eval_from_script,
1203
+ common_attributes);
1204
+ Handle<Proxy> proxy_eval_from_script_position =
1205
+ Factory::NewProxy(&Accessors::ScriptEvalFromScriptPosition);
1206
+ script_descriptors =
1207
+ Factory::CopyAppendProxyDescriptor(
1208
+ script_descriptors,
1209
+ Factory::LookupAsciiSymbol("eval_from_script_position"),
1210
+ proxy_eval_from_script_position,
1211
+ common_attributes);
1212
+ Handle<Proxy> proxy_eval_from_function_name =
1213
+ Factory::NewProxy(&Accessors::ScriptEvalFromFunctionName);
1214
+ script_descriptors =
1215
+ Factory::CopyAppendProxyDescriptor(
1216
+ script_descriptors,
1217
+ Factory::LookupAsciiSymbol("eval_from_function_name"),
1218
+ proxy_eval_from_function_name,
1219
+ common_attributes);
1220
+
1221
+ Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1222
+ script_map->set_instance_descriptors(*script_descriptors);
1223
+
1224
+ // Allocate the empty script.
1225
+ Handle<Script> script = Factory::NewScript(Factory::empty_string());
1226
+ script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1227
+ Heap::public_set_empty_script(*script);
1228
+ }
1229
+ {
1230
+ // Builtin function for OpaqueReference -- a JSValue-based object,
1231
+ // that keeps its field isolated from JavaScript code. It may store
1232
+ // objects, that JavaScript code may not access.
1233
+ Handle<JSFunction> opaque_reference_fun =
1234
+ InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE,
1235
+ JSValue::kSize, Top::initial_object_prototype(),
1236
+ Builtins::Illegal, false);
1237
+ Handle<JSObject> prototype =
1238
+ Factory::NewJSObject(Top::object_function(), TENURED);
1239
+ SetPrototype(opaque_reference_fun, prototype);
1240
+ global_context()->set_opaque_reference_function(*opaque_reference_fun);
1241
+ }
1242
+
1243
+ if (FLAG_disable_native_files) {
1244
+ PrintF("Warning: Running without installed natives!\n");
1245
+ return true;
1246
+ }
1247
+
1248
+ // Install natives.
1249
+ for (int i = Natives::GetDebuggerCount();
1250
+ i < Natives::GetBuiltinsCount();
1251
+ i++) {
1252
+ Vector<const char> name = Natives::GetScriptName(i);
1253
+ if (!CompileBuiltin(i)) return false;
1254
+ // TODO(ager): We really only need to install the JS builtin
1255
+ // functions on the builtins object after compiling and running
1256
+ // runtime.js.
1257
+ if (!InstallJSBuiltins(builtins)) return false;
1258
+ }
1259
+
1260
+ InstallNativeFunctions();
1261
+
1262
+ // Store the map for the string prototype after the natives has been compiled
1263
+ // and the String function has been setup.
1264
+ Handle<JSFunction> string_function(global_context()->string_function());
1265
+ ASSERT(JSObject::cast(
1266
+ string_function->initial_map()->prototype())->HasFastProperties());
1267
+ global_context()->set_string_function_prototype_map(
1268
+ HeapObject::cast(string_function->initial_map()->prototype())->map());
1269
+
1270
+ InstallBuiltinFunctionIds();
1271
+
1272
+ // Install Function.prototype.call and apply.
1273
+ { Handle<String> key = Factory::function_class_symbol();
1274
+ Handle<JSFunction> function =
1275
+ Handle<JSFunction>::cast(GetProperty(Top::global(), key));
1276
+ Handle<JSObject> proto =
1277
+ Handle<JSObject>(JSObject::cast(function->instance_prototype()));
1278
+
1279
+ // Install the call and the apply functions.
1280
+ Handle<JSFunction> call =
1281
+ InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize,
1282
+ Handle<JSObject>::null(),
1283
+ Builtins::FunctionCall,
1284
+ false);
1285
+ Handle<JSFunction> apply =
1286
+ InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
1287
+ Handle<JSObject>::null(),
1288
+ Builtins::FunctionApply,
1289
+ false);
1290
+
1291
+ // Make sure that Function.prototype.call appears to be compiled.
1292
+ // The code will never be called, but inline caching for call will
1293
+ // only work if it appears to be compiled.
1294
+ call->shared()->DontAdaptArguments();
1295
+ ASSERT(call->is_compiled());
1296
+
1297
+ // Set the expected parameters for apply to 2; required by builtin.
1298
+ apply->shared()->set_formal_parameter_count(2);
1299
+
1300
+ // Set the lengths for the functions to satisfy ECMA-262.
1301
+ call->shared()->set_length(1);
1302
+ apply->shared()->set_length(2);
1303
+ }
1304
+
1305
+ // Create a constructor for RegExp results (a variant of Array that
1306
+ // predefines the two properties index and match).
1307
+ {
1308
+ // RegExpResult initial map.
1309
+
1310
+ // Find global.Array.prototype to inherit from.
1311
+ Handle<JSFunction> array_constructor(global_context()->array_function());
1312
+ Handle<JSObject> array_prototype(
1313
+ JSObject::cast(array_constructor->instance_prototype()));
1314
+
1315
+ // Add initial map.
1316
+ Handle<Map> initial_map =
1317
+ Factory::NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize);
1318
+ initial_map->set_constructor(*array_constructor);
1319
+
1320
+ // Set prototype on map.
1321
+ initial_map->set_non_instance_prototype(false);
1322
+ initial_map->set_prototype(*array_prototype);
1323
+
1324
+ // Update map with length accessor from Array and add "index" and "input".
1325
+ Handle<Map> array_map(global_context()->js_array_map());
1326
+ Handle<DescriptorArray> array_descriptors(
1327
+ array_map->instance_descriptors());
1328
+ ASSERT_EQ(1, array_descriptors->number_of_descriptors());
1329
+
1330
+ Handle<DescriptorArray> reresult_descriptors =
1331
+ Factory::NewDescriptorArray(3);
1332
+
1333
+ reresult_descriptors->CopyFrom(0, *array_descriptors, 0);
1334
+
1335
+ int enum_index = 0;
1336
+ {
1337
+ FieldDescriptor index_field(Heap::index_symbol(),
1338
+ JSRegExpResult::kIndexIndex,
1339
+ NONE,
1340
+ enum_index++);
1341
+ reresult_descriptors->Set(1, &index_field);
1342
+ }
1343
+
1344
+ {
1345
+ FieldDescriptor input_field(Heap::input_symbol(),
1346
+ JSRegExpResult::kInputIndex,
1347
+ NONE,
1348
+ enum_index++);
1349
+ reresult_descriptors->Set(2, &input_field);
1350
+ }
1351
+ reresult_descriptors->Sort();
1352
+
1353
+ initial_map->set_inobject_properties(2);
1354
+ initial_map->set_pre_allocated_property_fields(2);
1355
+ initial_map->set_unused_property_fields(0);
1356
+ initial_map->set_instance_descriptors(*reresult_descriptors);
1357
+
1358
+ global_context()->set_regexp_result_map(*initial_map);
1359
+ }
1360
+
1361
+ #ifdef DEBUG
1362
+ builtins->Verify();
1363
+ #endif
1364
+
1365
+ return true;
1366
+ }
1367
+
1368
+
1369
+ static Handle<JSObject> ResolveBuiltinIdHolder(
1370
+ Handle<Context> global_context,
1371
+ const char* holder_expr) {
1372
+ Handle<GlobalObject> global(global_context->global());
1373
+ const char* period_pos = strchr(holder_expr, '.');
1374
+ if (period_pos == NULL) {
1375
+ return Handle<JSObject>::cast(
1376
+ GetProperty(global, Factory::LookupAsciiSymbol(holder_expr)));
1377
+ }
1378
+ ASSERT_EQ(".prototype", period_pos);
1379
+ Vector<const char> property(holder_expr,
1380
+ static_cast<int>(period_pos - holder_expr));
1381
+ Handle<JSFunction> function = Handle<JSFunction>::cast(
1382
+ GetProperty(global, Factory::LookupSymbol(property)));
1383
+ return Handle<JSObject>(JSObject::cast(function->prototype()));
1384
+ }
1385
+
1386
+
1387
+ static void InstallBuiltinFunctionId(Handle<JSObject> holder,
1388
+ const char* function_name,
1389
+ BuiltinFunctionId id) {
1390
+ Handle<String> name = Factory::LookupAsciiSymbol(function_name);
1391
+ Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
1392
+ Handle<JSFunction> function(JSFunction::cast(function_object));
1393
+ function->shared()->set_function_data(Smi::FromInt(id));
1394
+ }
1395
+
1396
+
1397
+ void Genesis::InstallBuiltinFunctionIds() {
1398
+ HandleScope scope;
1399
+ #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
1400
+ { \
1401
+ Handle<JSObject> holder = ResolveBuiltinIdHolder( \
1402
+ global_context(), #holder_expr); \
1403
+ BuiltinFunctionId id = k##name; \
1404
+ InstallBuiltinFunctionId(holder, #fun_name, id); \
1405
+ }
1406
+ FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
1407
+ #undef INSTALL_BUILTIN_ID
1408
+ }
1409
+
1410
+
1411
+ // Do not forget to update macros.py with named constant
1412
+ // of cache id.
1413
+ #define JSFUNCTION_RESULT_CACHE_LIST(F) \
1414
+ F(16, global_context()->regexp_function())
1415
+
1416
+
1417
+ static FixedArray* CreateCache(int size, JSFunction* factory) {
1418
+ // Caches are supposed to live for a long time, allocate in old space.
1419
+ int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size;
1420
+ // Cannot use cast as object is not fully initialized yet.
1421
+ JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>(
1422
+ *Factory::NewFixedArrayWithHoles(array_size, TENURED));
1423
+ cache->set(JSFunctionResultCache::kFactoryIndex, factory);
1424
+ cache->MakeZeroSize();
1425
+ return cache;
1426
+ }
1427
+
1428
+
1429
+ void Genesis::InstallJSFunctionResultCaches() {
1430
+ const int kNumberOfCaches = 0 +
1431
+ #define F(size, func) + 1
1432
+ JSFUNCTION_RESULT_CACHE_LIST(F)
1433
+ #undef F
1434
+ ;
1435
+
1436
+ Handle<FixedArray> caches = Factory::NewFixedArray(kNumberOfCaches, TENURED);
1437
+
1438
+ int index = 0;
1439
+
1440
+ #define F(size, func) do { \
1441
+ FixedArray* cache = CreateCache((size), (func)); \
1442
+ caches->set(index++, cache); \
1443
+ } while (false)
1444
+
1445
+ JSFUNCTION_RESULT_CACHE_LIST(F);
1446
+
1447
+ #undef F
1448
+
1449
+ global_context()->set_jsfunction_result_caches(*caches);
1450
+ }
1451
+
1452
+
1453
+ void Genesis::InitializeNormalizedMapCaches() {
1454
+ Handle<FixedArray> array(
1455
+ Factory::NewFixedArray(NormalizedMapCache::kEntries, TENURED));
1456
+ global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
1457
+ }
1458
+
1459
+
1460
+ int BootstrapperActive::nesting_ = 0;
1461
+
1462
+
1463
+ bool Bootstrapper::InstallExtensions(Handle<Context> global_context,
1464
+ v8::ExtensionConfiguration* extensions) {
1465
+ BootstrapperActive active;
1466
+ SaveContext saved_context;
1467
+ Top::set_context(*global_context);
1468
+ if (!Genesis::InstallExtensions(global_context, extensions)) return false;
1469
+ Genesis::InstallSpecialObjects(global_context);
1470
+ return true;
1471
+ }
1472
+
1473
+
1474
+ void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
1475
+ HandleScope scope;
1476
+ Handle<JSGlobalObject> js_global(
1477
+ JSGlobalObject::cast(global_context->global()));
1478
+ // Expose the natives in global if a name for it is specified.
1479
+ if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
1480
+ Handle<String> natives_string =
1481
+ Factory::LookupAsciiSymbol(FLAG_expose_natives_as);
1482
+ SetLocalPropertyNoThrow(js_global, natives_string,
1483
+ Handle<JSObject>(js_global->builtins()), DONT_ENUM);
1484
+ }
1485
+
1486
+ Handle<Object> Error = GetProperty(js_global, "Error");
1487
+ if (Error->IsJSObject()) {
1488
+ Handle<String> name = Factory::LookupAsciiSymbol("stackTraceLimit");
1489
+ SetLocalPropertyNoThrow(Handle<JSObject>::cast(Error),
1490
+ name,
1491
+ Handle<Smi>(Smi::FromInt(FLAG_stack_trace_limit)),
1492
+ NONE);
1493
+ }
1494
+
1495
+ #ifdef ENABLE_DEBUGGER_SUPPORT
1496
+ // Expose the debug global object in global if a name for it is specified.
1497
+ if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
1498
+ // If loading fails we just bail out without installing the
1499
+ // debugger but without tanking the whole context.
1500
+ if (!Debug::Load()) return;
1501
+ // Set the security token for the debugger context to the same as
1502
+ // the shell global context to allow calling between these (otherwise
1503
+ // exposing debug global object doesn't make much sense).
1504
+ Debug::debug_context()->set_security_token(
1505
+ global_context->security_token());
1506
+
1507
+ Handle<String> debug_string =
1508
+ Factory::LookupAsciiSymbol(FLAG_expose_debug_as);
1509
+ Handle<Object> global_proxy(Debug::debug_context()->global_proxy());
1510
+ SetLocalPropertyNoThrow(js_global, debug_string, global_proxy, DONT_ENUM);
1511
+ }
1512
+ #endif
1513
+ }
1514
+
1515
+
1516
+ bool Genesis::InstallExtensions(Handle<Context> global_context,
1517
+ v8::ExtensionConfiguration* extensions) {
1518
+ // Clear coloring of extension list
1519
+ v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
1520
+ while (current != NULL) {
1521
+ current->set_state(v8::UNVISITED);
1522
+ current = current->next();
1523
+ }
1524
+ // Install auto extensions.
1525
+ current = v8::RegisteredExtension::first_extension();
1526
+ while (current != NULL) {
1527
+ if (current->extension()->auto_enable())
1528
+ InstallExtension(current);
1529
+ current = current->next();
1530
+ }
1531
+
1532
+ if (FLAG_expose_gc) InstallExtension("v8/gc");
1533
+ if (FLAG_expose_externalize_string) InstallExtension("v8/externalize");
1534
+
1535
+ if (extensions == NULL) return true;
1536
+ // Install required extensions
1537
+ int count = v8::ImplementationUtilities::GetNameCount(extensions);
1538
+ const char** names = v8::ImplementationUtilities::GetNames(extensions);
1539
+ for (int i = 0; i < count; i++) {
1540
+ if (!InstallExtension(names[i]))
1541
+ return false;
1542
+ }
1543
+
1544
+ return true;
1545
+ }
1546
+
1547
+
1548
+ // Installs a named extension. This methods is unoptimized and does
1549
+ // not scale well if we want to support a large number of extensions.
1550
+ bool Genesis::InstallExtension(const char* name) {
1551
+ v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
1552
+ // Loop until we find the relevant extension
1553
+ while (current != NULL) {
1554
+ if (strcmp(name, current->extension()->name()) == 0) break;
1555
+ current = current->next();
1556
+ }
1557
+ // Didn't find the extension; fail.
1558
+ if (current == NULL) {
1559
+ v8::Utils::ReportApiFailure(
1560
+ "v8::Context::New()", "Cannot find required extension");
1561
+ return false;
1562
+ }
1563
+ return InstallExtension(current);
1564
+ }
1565
+
1566
+
1567
+ bool Genesis::InstallExtension(v8::RegisteredExtension* current) {
1568
+ HandleScope scope;
1569
+
1570
+ if (current->state() == v8::INSTALLED) return true;
1571
+ // The current node has already been visited so there must be a
1572
+ // cycle in the dependency graph; fail.
1573
+ if (current->state() == v8::VISITED) {
1574
+ v8::Utils::ReportApiFailure(
1575
+ "v8::Context::New()", "Circular extension dependency");
1576
+ return false;
1577
+ }
1578
+ ASSERT(current->state() == v8::UNVISITED);
1579
+ current->set_state(v8::VISITED);
1580
+ v8::Extension* extension = current->extension();
1581
+ // Install the extension's dependencies
1582
+ for (int i = 0; i < extension->dependency_count(); i++) {
1583
+ if (!InstallExtension(extension->dependencies()[i])) return false;
1584
+ }
1585
+ Vector<const char> source = CStrVector(extension->source());
1586
+ Handle<String> source_code = Factory::NewStringFromAscii(source);
1587
+ bool result = CompileScriptCached(CStrVector(extension->name()),
1588
+ source_code,
1589
+ &extensions_cache,
1590
+ extension,
1591
+ Handle<Context>(Top::context()),
1592
+ false);
1593
+ ASSERT(Top::has_pending_exception() != result);
1594
+ if (!result) {
1595
+ Top::clear_pending_exception();
1596
+ }
1597
+ current->set_state(v8::INSTALLED);
1598
+ return result;
1599
+ }
1600
+
1601
+
1602
+ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
1603
+ HandleScope scope;
1604
+ for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
1605
+ Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
1606
+ Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
1607
+ Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
1608
+ Handle<JSFunction> function
1609
+ = Handle<JSFunction>(JSFunction::cast(function_object));
1610
+ builtins->set_javascript_builtin(id, *function);
1611
+ Handle<SharedFunctionInfo> shared
1612
+ = Handle<SharedFunctionInfo>(function->shared());
1613
+ if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1614
+ // Set the code object on the function object.
1615
+ function->ReplaceCode(function->shared()->code());
1616
+ builtins->set_javascript_builtin_code(id, shared->code());
1617
+ }
1618
+ return true;
1619
+ }
1620
+
1621
+
1622
+ bool Genesis::ConfigureGlobalObjects(
1623
+ v8::Handle<v8::ObjectTemplate> global_proxy_template) {
1624
+ Handle<JSObject> global_proxy(
1625
+ JSObject::cast(global_context()->global_proxy()));
1626
+ Handle<JSObject> inner_global(JSObject::cast(global_context()->global()));
1627
+
1628
+ if (!global_proxy_template.IsEmpty()) {
1629
+ // Configure the global proxy object.
1630
+ Handle<ObjectTemplateInfo> proxy_data =
1631
+ v8::Utils::OpenHandle(*global_proxy_template);
1632
+ if (!ConfigureApiObject(global_proxy, proxy_data)) return false;
1633
+
1634
+ // Configure the inner global object.
1635
+ Handle<FunctionTemplateInfo> proxy_constructor(
1636
+ FunctionTemplateInfo::cast(proxy_data->constructor()));
1637
+ if (!proxy_constructor->prototype_template()->IsUndefined()) {
1638
+ Handle<ObjectTemplateInfo> inner_data(
1639
+ ObjectTemplateInfo::cast(proxy_constructor->prototype_template()));
1640
+ if (!ConfigureApiObject(inner_global, inner_data)) return false;
1641
+ }
1642
+ }
1643
+
1644
+ SetObjectPrototype(global_proxy, inner_global);
1645
+ return true;
1646
+ }
1647
+
1648
+
1649
+ bool Genesis::ConfigureApiObject(Handle<JSObject> object,
1650
+ Handle<ObjectTemplateInfo> object_template) {
1651
+ ASSERT(!object_template.is_null());
1652
+ ASSERT(object->IsInstanceOf(
1653
+ FunctionTemplateInfo::cast(object_template->constructor())));
1654
+
1655
+ bool pending_exception = false;
1656
+ Handle<JSObject> obj =
1657
+ Execution::InstantiateObject(object_template, &pending_exception);
1658
+ if (pending_exception) {
1659
+ ASSERT(Top::has_pending_exception());
1660
+ Top::clear_pending_exception();
1661
+ return false;
1662
+ }
1663
+ TransferObject(obj, object);
1664
+ return true;
1665
+ }
1666
+
1667
+
1668
+ void Genesis::TransferNamedProperties(Handle<JSObject> from,
1669
+ Handle<JSObject> to) {
1670
+ if (from->HasFastProperties()) {
1671
+ Handle<DescriptorArray> descs =
1672
+ Handle<DescriptorArray>(from->map()->instance_descriptors());
1673
+ for (int i = 0; i < descs->number_of_descriptors(); i++) {
1674
+ PropertyDetails details = PropertyDetails(descs->GetDetails(i));
1675
+ switch (details.type()) {
1676
+ case FIELD: {
1677
+ HandleScope inner;
1678
+ Handle<String> key = Handle<String>(descs->GetKey(i));
1679
+ int index = descs->GetFieldIndex(i);
1680
+ Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
1681
+ SetLocalPropertyNoThrow(to, key, value, details.attributes());
1682
+ break;
1683
+ }
1684
+ case CONSTANT_FUNCTION: {
1685
+ HandleScope inner;
1686
+ Handle<String> key = Handle<String>(descs->GetKey(i));
1687
+ Handle<JSFunction> fun =
1688
+ Handle<JSFunction>(descs->GetConstantFunction(i));
1689
+ SetLocalPropertyNoThrow(to, key, fun, details.attributes());
1690
+ break;
1691
+ }
1692
+ case CALLBACKS: {
1693
+ LookupResult result;
1694
+ to->LocalLookup(descs->GetKey(i), &result);
1695
+ // If the property is already there we skip it
1696
+ if (result.IsProperty()) continue;
1697
+ HandleScope inner;
1698
+ ASSERT(!to->HasFastProperties());
1699
+ // Add to dictionary.
1700
+ Handle<String> key = Handle<String>(descs->GetKey(i));
1701
+ Handle<Object> callbacks(descs->GetCallbacksObject(i));
1702
+ PropertyDetails d =
1703
+ PropertyDetails(details.attributes(), CALLBACKS, details.index());
1704
+ SetNormalizedProperty(to, key, callbacks, d);
1705
+ break;
1706
+ }
1707
+ case MAP_TRANSITION:
1708
+ case CONSTANT_TRANSITION:
1709
+ case NULL_DESCRIPTOR:
1710
+ // Ignore non-properties.
1711
+ break;
1712
+ case NORMAL:
1713
+ // Do not occur since the from object has fast properties.
1714
+ case INTERCEPTOR:
1715
+ // No element in instance descriptors have interceptor type.
1716
+ UNREACHABLE();
1717
+ break;
1718
+ }
1719
+ }
1720
+ } else {
1721
+ Handle<StringDictionary> properties =
1722
+ Handle<StringDictionary>(from->property_dictionary());
1723
+ int capacity = properties->Capacity();
1724
+ for (int i = 0; i < capacity; i++) {
1725
+ Object* raw_key(properties->KeyAt(i));
1726
+ if (properties->IsKey(raw_key)) {
1727
+ ASSERT(raw_key->IsString());
1728
+ // If the property is already there we skip it.
1729
+ LookupResult result;
1730
+ to->LocalLookup(String::cast(raw_key), &result);
1731
+ if (result.IsProperty()) continue;
1732
+ // Set the property.
1733
+ Handle<String> key = Handle<String>(String::cast(raw_key));
1734
+ Handle<Object> value = Handle<Object>(properties->ValueAt(i));
1735
+ if (value->IsJSGlobalPropertyCell()) {
1736
+ value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value());
1737
+ }
1738
+ PropertyDetails details = properties->DetailsAt(i);
1739
+ SetLocalPropertyNoThrow(to, key, value, details.attributes());
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+
1745
+
1746
+ void Genesis::TransferIndexedProperties(Handle<JSObject> from,
1747
+ Handle<JSObject> to) {
1748
+ // Cloning the elements array is sufficient.
1749
+ Handle<FixedArray> from_elements =
1750
+ Handle<FixedArray>(FixedArray::cast(from->elements()));
1751
+ Handle<FixedArray> to_elements = Factory::CopyFixedArray(from_elements);
1752
+ to->set_elements(*to_elements);
1753
+ }
1754
+
1755
+
1756
+ void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) {
1757
+ HandleScope outer;
1758
+
1759
+ ASSERT(!from->IsJSArray());
1760
+ ASSERT(!to->IsJSArray());
1761
+
1762
+ TransferNamedProperties(from, to);
1763
+ TransferIndexedProperties(from, to);
1764
+
1765
+ // Transfer the prototype (new map is needed).
1766
+ Handle<Map> old_to_map = Handle<Map>(to->map());
1767
+ Handle<Map> new_to_map = Factory::CopyMapDropTransitions(old_to_map);
1768
+ new_to_map->set_prototype(from->map()->prototype());
1769
+ to->set_map(*new_to_map);
1770
+ }
1771
+
1772
+
1773
+ void Genesis::MakeFunctionInstancePrototypeWritable() {
1774
+ // Make a new function map so all future functions
1775
+ // will have settable and enumerable prototype properties.
1776
+ HandleScope scope;
1777
+
1778
+ Handle<DescriptorArray> function_map_descriptors =
1779
+ ComputeFunctionInstanceDescriptor(ADD_WRITEABLE_PROTOTYPE);
1780
+ Handle<Map> fm = Factory::CopyMapDropDescriptors(Top::function_map());
1781
+ fm->set_instance_descriptors(*function_map_descriptors);
1782
+ fm->set_function_with_prototype(true);
1783
+ Top::context()->global_context()->set_function_map(*fm);
1784
+ }
1785
+
1786
+
1787
+ Genesis::Genesis(Handle<Object> global_object,
1788
+ v8::Handle<v8::ObjectTemplate> global_template,
1789
+ v8::ExtensionConfiguration* extensions) {
1790
+ result_ = Handle<Context>::null();
1791
+ // If V8 isn't running and cannot be initialized, just return.
1792
+ if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
1793
+
1794
+ // Before creating the roots we must save the context and restore it
1795
+ // on all function exits.
1796
+ HandleScope scope;
1797
+ SaveContext saved_context;
1798
+
1799
+ Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
1800
+ if (!new_context.is_null()) {
1801
+ global_context_ =
1802
+ Handle<Context>::cast(GlobalHandles::Create(*new_context));
1803
+ AddToWeakGlobalContextList(*global_context_);
1804
+ Top::set_context(*global_context_);
1805
+ i::Counters::contexts_created_by_snapshot.Increment();
1806
+ JSFunction* empty_function =
1807
+ JSFunction::cast(global_context_->function_map()->prototype());
1808
+ empty_function_ = Handle<JSFunction>(empty_function);
1809
+ Handle<GlobalObject> inner_global;
1810
+ Handle<JSGlobalProxy> global_proxy =
1811
+ CreateNewGlobals(global_template,
1812
+ global_object,
1813
+ &inner_global);
1814
+
1815
+ HookUpGlobalProxy(inner_global, global_proxy);
1816
+ HookUpInnerGlobal(inner_global);
1817
+
1818
+ if (!ConfigureGlobalObjects(global_template)) return;
1819
+ } else {
1820
+ // We get here if there was no context snapshot.
1821
+ CreateRoots();
1822
+ Handle<JSFunction> empty_function = CreateEmptyFunction();
1823
+ Handle<GlobalObject> inner_global;
1824
+ Handle<JSGlobalProxy> global_proxy =
1825
+ CreateNewGlobals(global_template, global_object, &inner_global);
1826
+ HookUpGlobalProxy(inner_global, global_proxy);
1827
+ InitializeGlobal(inner_global, empty_function);
1828
+ InstallJSFunctionResultCaches();
1829
+ InitializeNormalizedMapCaches();
1830
+ if (!InstallNatives()) return;
1831
+
1832
+ MakeFunctionInstancePrototypeWritable();
1833
+
1834
+ if (!ConfigureGlobalObjects(global_template)) return;
1835
+ i::Counters::contexts_created_from_scratch.Increment();
1836
+ }
1837
+
1838
+ result_ = global_context_;
1839
+ }
1840
+
1841
+
1842
+ // Support for thread preemption.
1843
+
1844
+ // Reserve space for statics needing saving and restoring.
1845
+ int Bootstrapper::ArchiveSpacePerThread() {
1846
+ return BootstrapperActive::ArchiveSpacePerThread();
1847
+ }
1848
+
1849
+
1850
+ // Archive statics that are thread local.
1851
+ char* Bootstrapper::ArchiveState(char* to) {
1852
+ return BootstrapperActive::ArchiveState(to);
1853
+ }
1854
+
1855
+
1856
+ // Restore statics that are thread local.
1857
+ char* Bootstrapper::RestoreState(char* from) {
1858
+ return BootstrapperActive::RestoreState(from);
1859
+ }
1860
+
1861
+
1862
+ // Called when the top-level V8 mutex is destroyed.
1863
+ void Bootstrapper::FreeThreadResources() {
1864
+ ASSERT(!BootstrapperActive::IsActive());
1865
+ }
1866
+
1867
+
1868
+ // Reserve space for statics needing saving and restoring.
1869
+ int BootstrapperActive::ArchiveSpacePerThread() {
1870
+ return sizeof(nesting_);
1871
+ }
1872
+
1873
+
1874
+ // Archive statics that are thread local.
1875
+ char* BootstrapperActive::ArchiveState(char* to) {
1876
+ *reinterpret_cast<int*>(to) = nesting_;
1877
+ nesting_ = 0;
1878
+ return to + sizeof(nesting_);
1879
+ }
1880
+
1881
+
1882
+ // Restore statics that are thread local.
1883
+ char* BootstrapperActive::RestoreState(char* from) {
1884
+ nesting_ = *reinterpret_cast<int*>(from);
1885
+ return from + sizeof(nesting_);
1886
+ }
1887
+
1888
+ } } // namespace v8::internal