therubyracer 0.6.3 → 0.7.0.pre

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 (520) hide show
  1. data/Rakefile +10 -9
  2. data/ext/v8/callbacks.cpp +15 -8
  3. data/ext/v8/converters.cpp +7 -8
  4. data/ext/v8/converters.h +0 -2
  5. data/ext/v8/extconf.rb +2 -0
  6. data/ext/v8/rr.cpp +169 -0
  7. data/ext/v8/rr.h +34 -0
  8. data/ext/v8/upstream/{2.0.6 → 2.1.10}/AUTHORS +8 -1
  9. data/ext/v8/upstream/{2.0.6 → 2.1.10}/ChangeLog +198 -0
  10. data/ext/v8/upstream/{2.0.6 → 2.1.10}/LICENSE +0 -0
  11. data/ext/v8/upstream/{2.0.6 → 2.1.10}/SConstruct +152 -38
  12. data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8-debug.h +52 -4
  13. data/ext/v8/upstream/2.1.10/include/v8-profiler.h +176 -0
  14. data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8.h +227 -48
  15. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/SConscript +60 -10
  16. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.cc +5 -39
  17. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.h +0 -0
  18. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.cc +0 -0
  19. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.h +0 -0
  20. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.cc +477 -57
  21. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.h +8 -4
  22. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apinatives.js +1 -1
  23. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apiutils.h +0 -0
  24. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arguments.h +5 -6
  25. data/ext/v8/upstream/{2.0.6/src/arm/assembler-thumb2-inl.h → 2.1.10/src/arm/assembler-arm-inl.h} +42 -27
  26. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.cc +430 -216
  27. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.h +199 -110
  28. data/ext/v8/upstream/{2.0.6/src/arm/assembler-arm-inl.h → 2.1.10/src/arm/assembler-thumb2-inl.h} +4 -18
  29. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.cc +142 -85
  30. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.h +18 -9
  31. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/builtins-arm.cc +127 -87
  32. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm-inl.h +3 -5
  33. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm.cc +4634 -1427
  34. data/ext/v8/upstream/2.1.10/src/arm/codegen-arm.h +946 -0
  35. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.cc +21 -3
  36. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.h +39 -13
  37. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/cpu-arm.cc +9 -3
  38. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/debug-arm.cc +34 -8
  39. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/disasm-arm.cc +262 -117
  40. data/ext/v8/upstream/2.1.10/src/arm/fast-codegen-arm.cc +238 -0
  41. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.cc +0 -0
  42. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.h +0 -0
  43. data/ext/v8/upstream/{2.0.6/src/arm/fast-codegen-arm.cc → 2.1.10/src/arm/full-codegen-arm.cc} +453 -283
  44. data/ext/v8/upstream/2.1.10/src/arm/ic-arm.cc +1833 -0
  45. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/jump-target-arm.cc +3 -29
  46. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.cc +564 -104
  47. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.h +255 -46
  48. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.cc +78 -104
  49. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.h +6 -22
  50. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm-inl.h +0 -3
  51. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.cc +0 -0
  52. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.h +2 -1
  53. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.cc +557 -180
  54. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.h +52 -4
  55. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/stub-cache-arm.cc +904 -240
  56. data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.cc +668 -0
  57. data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.h +503 -0
  58. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/array.js +82 -109
  59. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.cc +49 -13
  60. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.h +27 -5
  61. data/ext/v8/upstream/2.1.10/src/ast.cc +1138 -0
  62. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ast.h +354 -53
  63. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.cc +609 -501
  64. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.h +27 -8
  65. data/ext/v8/upstream/2.1.10/src/builtins.cc +1512 -0
  66. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/builtins.h +41 -25
  67. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bytecodes-irregexp.h +0 -0
  68. data/ext/v8/upstream/2.1.10/src/cached-powers.h +119 -0
  69. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates-inl.h +0 -0
  70. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates.h +0 -0
  71. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.cc +0 -0
  72. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.h +25 -1
  73. data/ext/v8/upstream/2.1.10/src/circular-queue-inl.h +101 -0
  74. data/ext/v8/upstream/2.1.10/src/circular-queue.cc +121 -0
  75. data/ext/v8/upstream/2.1.10/src/circular-queue.h +129 -0
  76. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.cc +23 -8
  77. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.h +16 -4
  78. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code.h +0 -0
  79. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen-inl.h +6 -34
  80. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.cc +73 -92
  81. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.h +164 -68
  82. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.cc +117 -73
  83. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.h +18 -17
  84. data/ext/v8/upstream/2.1.10/src/compiler.cc +623 -0
  85. data/ext/v8/upstream/2.1.10/src/compiler.h +299 -0
  86. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.cc +0 -0
  87. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.h +8 -11
  88. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions-inl.h +28 -13
  89. data/ext/v8/upstream/2.1.10/src/conversions.cc +1105 -0
  90. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions.h +9 -4
  91. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.cc +0 -0
  92. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.h +1 -1
  93. data/ext/v8/upstream/2.1.10/src/cpu-profiler-inl.h +99 -0
  94. data/ext/v8/upstream/2.1.10/src/cpu-profiler.cc +494 -0
  95. data/ext/v8/upstream/2.1.10/src/cpu-profiler.h +277 -0
  96. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/cpu.h +0 -0
  97. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.cc +15 -4
  98. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.h +0 -0
  99. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-posix.cc +18 -0
  100. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-readline.cc +2 -2
  101. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-windows.cc +0 -0
  102. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.cc +10 -6
  103. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.h +2 -0
  104. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.js +43 -38
  105. data/ext/v8/upstream/2.1.10/src/data-flow.cc +755 -0
  106. data/ext/v8/upstream/2.1.10/src/data-flow.h +278 -0
  107. data/ext/v8/upstream/{2.0.6/src/date-delay.js → 2.1.10/src/date.js} +100 -110
  108. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser-inl.h +11 -2
  109. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.cc +24 -26
  110. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.h +8 -4
  111. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.cc +3 -1
  112. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.h +0 -0
  113. data/ext/v8/upstream/{2.0.6/src/debug-delay.js → 2.1.10/src/debug-debugger.js} +111 -15
  114. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.cc +156 -96
  115. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.h +53 -5
  116. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disasm.h +0 -0
  117. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.cc +2 -8
  118. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.h +0 -0
  119. data/ext/v8/upstream/2.1.10/src/diy-fp.cc +58 -0
  120. data/ext/v8/upstream/2.1.10/src/diy-fp.h +117 -0
  121. data/ext/v8/upstream/2.1.10/src/double.h +169 -0
  122. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dtoa-config.c +4 -3
  123. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.cc +22 -22
  124. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.h +17 -4
  125. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.cc +70 -46
  126. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.h +27 -17
  127. data/ext/v8/upstream/2.1.10/src/fast-codegen.cc +746 -0
  128. data/ext/v8/upstream/2.1.10/src/fast-codegen.h +161 -0
  129. data/ext/v8/upstream/2.1.10/src/fast-dtoa.cc +512 -0
  130. data/ext/v8/upstream/2.1.10/src/fast-dtoa.h +59 -0
  131. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flag-definitions.h +32 -11
  132. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.cc +0 -0
  133. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.h +0 -0
  134. data/ext/v8/upstream/2.1.10/src/flow-graph.cc +763 -0
  135. data/ext/v8/upstream/2.1.10/src/flow-graph.h +180 -0
  136. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.cc +1 -4
  137. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.h +49 -11
  138. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames-inl.h +2 -0
  139. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.cc +91 -17
  140. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.h +24 -2
  141. data/ext/v8/upstream/{2.0.6/src/fast-codegen.cc → 2.1.10/src/full-codegen.cc} +549 -198
  142. data/ext/v8/upstream/{2.0.6/src/fast-codegen.h → 2.1.10/src/full-codegen.h} +109 -29
  143. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.cc +0 -0
  144. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.h +0 -0
  145. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.cc +0 -0
  146. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.h +0 -0
  147. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/globals.h +67 -43
  148. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles-inl.h +0 -0
  149. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.cc +124 -129
  150. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.h +33 -15
  151. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.cc +0 -0
  152. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.h +0 -0
  153. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-inl.h +56 -12
  154. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.cc +2 -2
  155. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.h +2 -0
  156. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.cc +413 -221
  157. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.h +192 -67
  158. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32-inl.h +6 -0
  159. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.cc +187 -32
  160. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.h +31 -4
  161. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/builtins-ia32.cc +160 -133
  162. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32-inl.h +0 -0
  163. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32.cc +5533 -2177
  164. data/ext/v8/upstream/{2.0.6/src/x64/codegen-x64.h → 2.1.10/src/ia32/codegen-ia32.h} +453 -134
  165. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/cpu-ia32.cc +0 -0
  166. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/debug-ia32.cc +63 -8
  167. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/disasm-ia32.cc +99 -16
  168. data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.cc +950 -0
  169. data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.h +155 -0
  170. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.cc +0 -0
  171. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.h +0 -0
  172. data/ext/v8/upstream/{2.0.6/src/ia32/fast-codegen-ia32.cc → 2.1.10/src/ia32/full-codegen-ia32.cc} +454 -253
  173. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/ic-ia32.cc +545 -390
  174. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/jump-target-ia32.cc +1 -0
  175. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.cc +330 -139
  176. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.h +96 -30
  177. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.cc +73 -89
  178. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.h +6 -21
  179. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32-inl.h +0 -0
  180. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.cc +59 -5
  181. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.h +0 -0
  182. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.cc +0 -0
  183. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.h +2 -2
  184. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/stub-cache-ia32.cc +745 -303
  185. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.cc +278 -71
  186. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.h +78 -22
  187. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic-inl.h +0 -0
  188. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.cc +172 -89
  189. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.h +51 -20
  190. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.cc +0 -0
  191. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.h +0 -0
  192. data/ext/v8/upstream/{2.0.6/src/json-delay.js → 2.1.10/src/json.js} +26 -12
  193. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.cc +151 -118
  194. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.h +31 -7
  195. data/ext/v8/upstream/2.1.10/src/jump-target-heavy-inl.h +51 -0
  196. data/ext/v8/upstream/{2.0.6/src/jump-target.cc → 2.1.10/src/jump-target-heavy.cc} +164 -184
  197. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target-inl.h +8 -9
  198. data/ext/v8/upstream/{2.0.6/src/usage-analyzer.h → 2.1.10/src/jump-target-light-inl.h} +9 -7
  199. data/ext/v8/upstream/2.1.10/src/jump-target-light.cc +86 -0
  200. data/ext/v8/upstream/2.1.10/src/jump-target.cc +155 -0
  201. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target.h +6 -0
  202. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list-inl.h +0 -0
  203. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list.h +2 -1
  204. data/ext/v8/upstream/2.1.10/src/liveedit-debugger.js +944 -0
  205. data/ext/v8/upstream/2.1.10/src/liveedit.cc +1468 -0
  206. data/ext/v8/upstream/2.1.10/src/liveedit.h +170 -0
  207. data/ext/v8/upstream/2.1.10/src/log-inl.h +59 -0
  208. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.cc +3 -9
  209. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.h +1 -4
  210. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.cc +198 -95
  211. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.h +50 -49
  212. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macro-assembler.h +9 -0
  213. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macros.py +30 -11
  214. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.cc +464 -152
  215. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.h +41 -20
  216. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/math.js +9 -8
  217. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/memory.h +0 -0
  218. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.cc +1 -0
  219. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.h +0 -0
  220. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.js +46 -9
  221. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips-inl.h +215 -0
  222. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.cc +1208 -0
  223. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.h +665 -0
  224. data/ext/v8/upstream/2.1.10/src/mips/builtins-mips.cc +202 -0
  225. data/ext/v8/upstream/2.1.10/src/mips/codegen-mips-inl.h +70 -0
  226. data/ext/v8/upstream/2.1.10/src/mips/codegen-mips.cc +1428 -0
  227. data/ext/v8/upstream/{2.0.6/src/arm/codegen-arm.h → 2.1.10/src/mips/codegen-mips.h} +103 -205
  228. data/ext/v8/upstream/2.1.10/src/mips/constants-mips.cc +323 -0
  229. data/ext/v8/upstream/2.1.10/src/mips/constants-mips.h +525 -0
  230. data/ext/v8/upstream/2.1.10/src/mips/cpu-mips.cc +69 -0
  231. data/ext/v8/upstream/2.1.10/src/mips/debug-mips.cc +128 -0
  232. data/ext/v8/upstream/2.1.10/src/mips/disasm-mips.cc +784 -0
  233. data/ext/v8/upstream/2.1.10/src/mips/fast-codegen-mips.cc +74 -0
  234. data/ext/v8/upstream/2.1.10/src/mips/frames-mips.cc +99 -0
  235. data/ext/v8/upstream/2.1.10/src/mips/frames-mips.h +164 -0
  236. data/ext/v8/upstream/2.1.10/src/mips/full-codegen-mips.cc +273 -0
  237. data/ext/v8/upstream/2.1.10/src/mips/ic-mips.cc +217 -0
  238. data/ext/v8/upstream/2.1.10/src/mips/jump-target-mips.cc +172 -0
  239. data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.cc +1323 -0
  240. data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.h +461 -0
  241. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips-inl.h +137 -0
  242. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.cc +60 -0
  243. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.h +46 -0
  244. data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.cc +1648 -0
  245. data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.h +311 -0
  246. data/ext/v8/upstream/2.1.10/src/mips/stub-cache-mips.cc +400 -0
  247. data/ext/v8/upstream/2.1.10/src/mips/virtual-frame-mips.cc +316 -0
  248. data/ext/v8/upstream/{2.0.6/src/arm/virtual-frame-arm.h → 2.1.10/src/mips/virtual-frame-mips.h} +87 -71
  249. data/ext/v8/upstream/{2.0.6/src/mirror-delay.js → 2.1.10/src/mirror-debugger.js} +51 -45
  250. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mksnapshot.cc +97 -10
  251. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/natives.h +6 -6
  252. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-debug.cc +47 -5
  253. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-inl.h +154 -38
  254. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.cc +528 -280
  255. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.h +302 -95
  256. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.cc +25 -33
  257. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.h +9 -1
  258. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.cc +444 -72
  259. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.h +4 -2
  260. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-freebsd.cc +32 -13
  261. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-linux.cc +59 -25
  262. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-macos.cc +30 -13
  263. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-nullos.cc +0 -0
  264. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-openbsd.cc +21 -2
  265. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-posix.cc +0 -18
  266. data/ext/v8/upstream/2.1.10/src/platform-solaris.cc +607 -0
  267. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-win32.cc +16 -17
  268. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform.h +25 -8
  269. data/ext/v8/upstream/2.1.10/src/powers-ten.h +2461 -0
  270. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.cc +49 -29
  271. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.h +3 -1
  272. data/ext/v8/upstream/2.1.10/src/profile-generator-inl.h +124 -0
  273. data/ext/v8/upstream/2.1.10/src/profile-generator.cc +583 -0
  274. data/ext/v8/upstream/2.1.10/src/profile-generator.h +364 -0
  275. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.cc +1 -1
  276. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.h +12 -24
  277. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp-inl.h +2 -2
  278. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.cc +2 -2
  279. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.h +2 -2
  280. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.cc +2 -2
  281. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.h +0 -0
  282. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.cc +33 -10
  283. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.h +12 -4
  284. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.cc +0 -0
  285. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.h +0 -0
  286. data/ext/v8/upstream/{2.0.6/src/regexp-delay.js → 2.1.10/src/regexp.js} +180 -58
  287. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator-inl.h +68 -1
  288. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.cc +5 -2
  289. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.h +42 -17
  290. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.cc +110 -4
  291. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.h +0 -0
  292. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.cc +2733 -623
  293. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.h +43 -20
  294. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.js +46 -35
  295. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.cc +278 -36
  296. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.h +97 -26
  297. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.cc +3 -3
  298. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.h +1 -0
  299. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.cc +11 -12
  300. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.h +0 -1
  301. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.cc +298 -175
  302. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.h +184 -40
  303. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/shell.h +0 -0
  304. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/simulator.h +2 -0
  305. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/smart-pointer.h +0 -0
  306. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot-common.cc +16 -31
  307. data/ext/v8/upstream/2.1.10/src/snapshot-empty.cc +50 -0
  308. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot.h +13 -1
  309. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces-inl.h +35 -27
  310. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.cc +256 -42
  311. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.h +136 -42
  312. data/ext/v8/upstream/{2.0.6/src/zone-inl.h → 2.1.10/src/splay-tree-inl.h} +102 -89
  313. data/ext/v8/upstream/2.1.10/src/splay-tree.h +203 -0
  314. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.cc +0 -0
  315. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.h +0 -0
  316. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string.js +260 -149
  317. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.cc +195 -69
  318. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.h +127 -12
  319. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/COPYING +0 -0
  320. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/dtoa.c +0 -0
  321. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/valgrind/valgrind.h +0 -0
  322. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.cc +0 -0
  323. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.h +0 -0
  324. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.cc +26 -31
  325. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.h +3 -4
  326. data/ext/v8/upstream/2.1.10/src/type-info.cc +53 -0
  327. data/ext/v8/upstream/2.1.10/src/type-info.h +244 -0
  328. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode-inl.h +0 -0
  329. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.cc +0 -0
  330. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.h +0 -0
  331. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/uri.js +6 -6
  332. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.cc +0 -37
  333. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.h +121 -50
  334. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.cc +0 -0
  335. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.h +130 -98
  336. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.cc +42 -11
  337. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.h +4 -2
  338. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8natives.js +202 -37
  339. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.cc +11 -0
  340. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.h +15 -0
  341. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.cc +7 -51
  342. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.h +5 -35
  343. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.cc +3 -3
  344. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.h +0 -0
  345. data/ext/v8/upstream/2.1.10/src/virtual-frame-heavy-inl.h +152 -0
  346. data/ext/v8/upstream/{2.0.6/src/virtual-frame.cc → 2.1.10/src/virtual-frame-heavy.cc} +107 -176
  347. data/ext/v8/upstream/2.1.10/src/virtual-frame-inl.h +39 -0
  348. data/ext/v8/upstream/2.1.10/src/virtual-frame-light-inl.h +69 -0
  349. data/ext/v8/upstream/2.1.10/src/virtual-frame-light.cc +49 -0
  350. data/ext/v8/upstream/2.1.10/src/virtual-frame.cc +49 -0
  351. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/virtual-frame.h +2 -0
  352. data/ext/v8/upstream/{2.0.6/src/log-inl.h → 2.1.10/src/vm-state-inl.h} +28 -20
  353. data/ext/v8/upstream/{2.0.6/src/snapshot-empty.cc → 2.1.10/src/vm-state.cc} +5 -6
  354. data/ext/v8/upstream/2.1.10/src/vm-state.h +75 -0
  355. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64-inl.h +11 -0
  356. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.cc +285 -93
  357. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.h +81 -78
  358. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/builtins-x64.cc +130 -87
  359. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64-inl.h +0 -0
  360. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64.cc +4520 -1317
  361. data/ext/v8/upstream/{2.0.6/src/ia32/codegen-ia32.h → 2.1.10/src/x64/codegen-x64.h} +362 -141
  362. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/cpu-x64.cc +0 -0
  363. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/debug-x64.cc +20 -4
  364. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/disasm-x64.cc +121 -44
  365. data/ext/v8/upstream/2.1.10/src/x64/fast-codegen-x64.cc +246 -0
  366. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.cc +0 -0
  367. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.h +0 -0
  368. data/ext/v8/upstream/{2.0.6/src/x64/fast-codegen-x64.cc → 2.1.10/src/x64/full-codegen-x64.cc} +404 -231
  369. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/ic-x64.cc +346 -117
  370. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/jump-target-x64.cc +1 -0
  371. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.cc +537 -181
  372. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.h +140 -34
  373. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.cc +74 -96
  374. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.h +8 -25
  375. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64-inl.h +1 -1
  376. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.cc +3 -0
  377. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.h +0 -0
  378. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.cc +0 -0
  379. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.h +2 -2
  380. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/stub-cache-x64.cc +785 -288
  381. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.cc +128 -52
  382. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.h +40 -19
  383. data/ext/v8/upstream/2.1.10/src/zone-inl.h +82 -0
  384. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.cc +1 -0
  385. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.h +6 -90
  386. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/codemap.js +12 -0
  387. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/consarray.js +0 -0
  388. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/csvparser.js +22 -37
  389. data/ext/v8/upstream/2.1.10/tools/generate-ten-powers.scm +286 -0
  390. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/gyp/v8.gyp +86 -24
  391. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/js2c.py +22 -22
  392. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/jsmin.py +0 -0
  393. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor +10 -1
  394. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor.py +0 -0
  395. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/logreader.js +34 -16
  396. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-nm +0 -0
  397. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-tick-processor +0 -0
  398. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/annotate +0 -0
  399. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/common +0 -0
  400. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/dump +0 -0
  401. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/report +0 -0
  402. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/reset +0 -0
  403. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/run +0 -0
  404. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/shutdown +0 -0
  405. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/start +0 -0
  406. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/presubmit.py +0 -0
  407. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/process-heap-prof.py +0 -0
  408. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile.js +70 -0
  409. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile_view.js +0 -0
  410. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/run-valgrind.py +0 -0
  411. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.js +0 -0
  412. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.py +0 -0
  413. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/stats-viewer.py +0 -0
  414. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/test.py +7 -7
  415. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor-driver.js +7 -1
  416. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.js +140 -9
  417. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.py +40 -4
  418. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/utils.py +6 -0
  419. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/README.txt +0 -0
  420. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/arm.vsprops +1 -1
  421. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/common.vsprops +1 -2
  422. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8.vcproj +0 -6
  423. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_arm.vcproj +193 -199
  424. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_x64.vcproj +16 -8
  425. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8js2c.cmd +0 -0
  426. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/debug.vsprops +0 -0
  427. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/ia32.vsprops +5 -1
  428. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/js2c.cmd +1 -1
  429. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/release.vsprops +0 -0
  430. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.sln +0 -0
  431. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.vcproj +11 -7
  432. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.sln +0 -0
  433. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.vcproj +227 -223
  434. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base.vcproj +137 -5
  435. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_arm.vcproj +116 -4
  436. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_x64.vcproj +125 -4
  437. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest.vcproj +12 -6
  438. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_arm.vcproj +12 -6
  439. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_x64.vcproj +11 -11
  440. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot.vcproj +0 -6
  441. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -6
  442. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample.vcproj +0 -6
  443. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_arm.vcproj +145 -151
  444. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_x64.vcproj +16 -6
  445. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample.vcproj +0 -6
  446. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_arm.vcproj +145 -151
  447. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_x64.vcproj +16 -8
  448. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  449. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  450. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  451. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  452. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.sln +0 -0
  453. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.vcproj +11 -7
  454. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/x64.vsprops +5 -1
  455. data/ext/v8/upstream/2.1.10/tools/windows-tick-processor.bat +29 -0
  456. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/windows-tick-processor.py +0 -0
  457. data/ext/v8/upstream/Makefile +8 -2
  458. data/ext/v8/v8.cpp +21 -73
  459. data/ext/v8/v8_array.cpp +56 -0
  460. data/ext/v8/v8_array.h +8 -0
  461. data/ext/v8/v8_callbacks.cpp +121 -0
  462. data/ext/v8/v8_callbacks.h +8 -0
  463. data/ext/v8/v8_cxt.cpp +74 -77
  464. data/ext/v8/v8_cxt.h +2 -9
  465. data/ext/v8/v8_date.cpp +26 -0
  466. data/ext/v8/v8_date.h +6 -0
  467. data/ext/v8/v8_exception.cpp +55 -0
  468. data/ext/v8/v8_exception.h +6 -0
  469. data/ext/v8/v8_external.cpp +50 -0
  470. data/ext/v8/v8_external.h +8 -0
  471. data/ext/v8/v8_func.cpp +76 -18
  472. data/ext/v8/v8_func.h +5 -4
  473. data/ext/v8/v8_msg.cpp +55 -46
  474. data/ext/v8/v8_msg.h +3 -11
  475. data/ext/v8/v8_obj.cpp +67 -36
  476. data/ext/v8/v8_obj.h +6 -8
  477. data/ext/v8/v8_ref.cpp +25 -9
  478. data/ext/v8/v8_ref.h +3 -5
  479. data/ext/v8/v8_script.cpp +17 -10
  480. data/ext/v8/v8_script.h +3 -3
  481. data/ext/v8/v8_str.cpp +34 -6
  482. data/ext/v8/v8_str.h +4 -2
  483. data/ext/v8/v8_template.cpp +195 -33
  484. data/ext/v8/v8_template.h +4 -5
  485. data/ext/v8/v8_try_catch.cpp +99 -0
  486. data/ext/v8/v8_try_catch.h +5 -0
  487. data/ext/v8/v8_value.cpp +164 -0
  488. data/ext/v8/v8_value.h +10 -0
  489. data/lib/v8.rb +3 -1
  490. data/lib/v8/access.rb +60 -0
  491. data/lib/v8/array.rb +15 -0
  492. data/lib/v8/callbacks.rb +88 -0
  493. data/lib/v8/cli.rb +1 -1
  494. data/lib/v8/context.rb +55 -66
  495. data/lib/v8/function.rb +20 -2
  496. data/lib/v8/object.rb +14 -12
  497. data/lib/v8/ruby_error.rb +3 -0
  498. data/lib/v8/to.rb +59 -7
  499. data/spec/ext/cxt_spec.rb +2 -15
  500. data/spec/ext/func_spec.rb +17 -10
  501. data/spec/ext/try_catch_spec.rb +32 -0
  502. data/spec/foo.rb +17 -0
  503. data/spec/redjs/jsapi_spec.rb +173 -96
  504. data/spec/spec_helper.rb +7 -0
  505. data/spec/v8/to_spec.rb +0 -1
  506. data/therubyracer.gemspec +6 -6
  507. metadata +493 -386
  508. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +0 -849
  509. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +0 -412
  510. data/ext/v8/upstream/2.0.6/src/ast.cc +0 -512
  511. data/ext/v8/upstream/2.0.6/src/builtins.cc +0 -851
  512. data/ext/v8/upstream/2.0.6/src/compiler.cc +0 -1132
  513. data/ext/v8/upstream/2.0.6/src/compiler.h +0 -107
  514. data/ext/v8/upstream/2.0.6/src/conversions.cc +0 -709
  515. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +0 -426
  516. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +0 -5
  517. data/ext/v8/upstream/no-strict-aliasing.patch +0 -13
  518. data/ext/v8/v8_standalone.cpp +0 -69
  519. data/ext/v8/v8_standalone.h +0 -31
  520. data/spec/ext/obj_spec.rb +0 -13
@@ -55,15 +55,16 @@ class SourceCodeCache BASE_EMBEDDED {
55
55
  }
56
56
 
57
57
  void Iterate(ObjectVisitor* v) {
58
- v->VisitPointer(bit_cast<Object**, FixedArray**>(&cache_));
58
+ v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_));
59
59
  }
60
60
 
61
61
 
62
- bool Lookup(Vector<const char> name, Handle<JSFunction>* handle) {
62
+ bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) {
63
63
  for (int i = 0; i < cache_->length(); i+=2) {
64
64
  SeqAsciiString* str = SeqAsciiString::cast(cache_->get(i));
65
65
  if (str->IsEqualTo(name)) {
66
- *handle = Handle<JSFunction>(JSFunction::cast(cache_->get(i + 1)));
66
+ *handle = Handle<SharedFunctionInfo>(
67
+ SharedFunctionInfo::cast(cache_->get(i + 1)));
67
68
  return true;
68
69
  }
69
70
  }
@@ -71,8 +72,7 @@ class SourceCodeCache BASE_EMBEDDED {
71
72
  }
72
73
 
73
74
 
74
- void Add(Vector<const char> name, Handle<JSFunction> fun) {
75
- ASSERT(fun->IsBoilerplate());
75
+ void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) {
76
76
  HandleScope scope;
77
77
  int length = cache_->length();
78
78
  Handle<FixedArray> new_array =
@@ -81,8 +81,8 @@ class SourceCodeCache BASE_EMBEDDED {
81
81
  cache_ = *new_array;
82
82
  Handle<String> str = Factory::NewStringFromAscii(name, TENURED);
83
83
  cache_->set(length, *str);
84
- cache_->set(length + 1, *fun);
85
- Script::cast(fun->shared()->script())->set_type(Smi::FromInt(type_));
84
+ cache_->set(length + 1, *shared);
85
+ Script::cast(shared->script())->set_type(Smi::FromInt(type_));
86
86
  }
87
87
 
88
88
  private:
@@ -91,7 +91,6 @@ class SourceCodeCache BASE_EMBEDDED {
91
91
  DISALLOW_COPY_AND_ASSIGN(SourceCodeCache);
92
92
  };
93
93
 
94
- static SourceCodeCache natives_cache(Script::TYPE_NATIVE);
95
94
  static SourceCodeCache extensions_cache(Script::TYPE_EXTENSION);
96
95
  // This is for delete, not delete[].
97
96
  static List<char*>* delete_these_non_arrays_on_tear_down = NULL;
@@ -134,20 +133,7 @@ Handle<String> Bootstrapper::NativesSourceLookup(int index) {
134
133
  }
135
134
 
136
135
 
137
- bool Bootstrapper::NativesCacheLookup(Vector<const char> name,
138
- Handle<JSFunction>* handle) {
139
- return natives_cache.Lookup(name, handle);
140
- }
141
-
142
-
143
- void Bootstrapper::NativesCacheAdd(Vector<const char> name,
144
- Handle<JSFunction> fun) {
145
- natives_cache.Add(name, fun);
146
- }
147
-
148
-
149
136
  void Bootstrapper::Initialize(bool create_heap_objects) {
150
- natives_cache.Initialize(create_heap_objects);
151
137
  extensions_cache.Initialize(create_heap_objects);
152
138
  }
153
139
 
@@ -187,120 +173,7 @@ void Bootstrapper::TearDown() {
187
173
  delete_these_arrays_on_tear_down = NULL;
188
174
  }
189
175
 
190
- natives_cache.Initialize(false); // Yes, symmetrical
191
- extensions_cache.Initialize(false);
192
- }
193
-
194
-
195
- // Pending fixups are code positions that refer to builtin code
196
- // objects that were not available at the time the code was generated.
197
- // The pending list is processed whenever an environment has been
198
- // created.
199
- class PendingFixups : public AllStatic {
200
- public:
201
- static void Add(Code* code, MacroAssembler* masm);
202
- static bool Process(Handle<JSBuiltinsObject> builtins);
203
-
204
- static void Iterate(ObjectVisitor* v);
205
-
206
- private:
207
- static List<Object*> code_;
208
- static List<const char*> name_;
209
- static List<int> pc_;
210
- static List<uint32_t> flags_;
211
-
212
- static void Clear();
213
- };
214
-
215
-
216
- List<Object*> PendingFixups::code_(0);
217
- List<const char*> PendingFixups::name_(0);
218
- List<int> PendingFixups::pc_(0);
219
- List<uint32_t> PendingFixups::flags_(0);
220
-
221
-
222
- void PendingFixups::Add(Code* code, MacroAssembler* masm) {
223
- // Note this code is not only called during bootstrapping.
224
- List<MacroAssembler::Unresolved>* unresolved = masm->unresolved();
225
- int n = unresolved->length();
226
- for (int i = 0; i < n; i++) {
227
- const char* name = unresolved->at(i).name;
228
- code_.Add(code);
229
- name_.Add(name);
230
- pc_.Add(unresolved->at(i).pc);
231
- flags_.Add(unresolved->at(i).flags);
232
- LOG(StringEvent("unresolved", name));
233
- }
234
- }
235
-
236
-
237
- bool PendingFixups::Process(Handle<JSBuiltinsObject> builtins) {
238
- HandleScope scope;
239
- // NOTE: Extra fixups may be added to the list during the iteration
240
- // due to lazy compilation of functions during the processing. Do not
241
- // cache the result of getting the length of the code list.
242
- for (int i = 0; i < code_.length(); i++) {
243
- const char* name = name_[i];
244
- uint32_t flags = flags_[i];
245
- Handle<String> symbol = Factory::LookupAsciiSymbol(name);
246
- Object* o = builtins->GetProperty(*symbol);
247
- #ifdef DEBUG
248
- if (!o->IsJSFunction()) {
249
- V8_Fatal(__FILE__, __LINE__, "Cannot resolve call to builtin %s", name);
250
- }
251
- #endif
252
- Handle<JSFunction> f = Handle<JSFunction>(JSFunction::cast(o));
253
- // Make sure the number of parameters match the formal parameter count.
254
- int argc = Bootstrapper::FixupFlagsArgumentsCount::decode(flags);
255
- USE(argc);
256
- ASSERT(f->shared()->formal_parameter_count() == argc);
257
- if (!f->is_compiled()) {
258
- // Do lazy compilation and check for stack overflows.
259
- if (!CompileLazy(f, CLEAR_EXCEPTION)) {
260
- Clear();
261
- return false;
262
- }
263
- }
264
- Code* code = Code::cast(code_[i]);
265
- Address pc = code->instruction_start() + pc_[i];
266
- RelocInfo target(pc, RelocInfo::CODE_TARGET, 0);
267
- bool use_code_object = Bootstrapper::FixupFlagsUseCodeObject::decode(flags);
268
- if (use_code_object) {
269
- target.set_target_object(f->code());
270
- } else {
271
- target.set_target_address(f->code()->instruction_start());
272
- }
273
- LOG(StringEvent("resolved", name));
274
- }
275
- Clear();
276
-
277
- // TODO(1240818): We should probably try to avoid doing this for all
278
- // the V8 builtin JS files. It should only happen after running
279
- // runtime.js - just like there shouldn't be any fixups left after
280
- // that.
281
- for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
282
- Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
283
- Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
284
- JSFunction* function = JSFunction::cast(builtins->GetProperty(*name));
285
- builtins->set_javascript_builtin(id, function);
286
- }
287
-
288
- return true;
289
- }
290
-
291
-
292
- void PendingFixups::Clear() {
293
- code_.Clear();
294
- name_.Clear();
295
- pc_.Clear();
296
- flags_.Clear();
297
- }
298
-
299
-
300
- void PendingFixups::Iterate(ObjectVisitor* v) {
301
- if (!code_.is_empty()) {
302
- v->VisitPointers(&code_[0], &code_[0] + code_.length());
303
- }
176
+ extensions_cache.Initialize(false); // Yes, symmetrical
304
177
  }
305
178
 
306
179
 
@@ -309,17 +182,11 @@ class Genesis BASE_EMBEDDED {
309
182
  Genesis(Handle<Object> global_object,
310
183
  v8::Handle<v8::ObjectTemplate> global_template,
311
184
  v8::ExtensionConfiguration* extensions);
312
- ~Genesis();
185
+ ~Genesis() { }
313
186
 
314
187
  Handle<Context> result() { return result_; }
315
188
 
316
189
  Genesis* previous() { return previous_; }
317
- static Genesis* current() { return current_; }
318
-
319
- // Support for thread preemption.
320
- static int ArchiveSpacePerThread();
321
- static char* ArchiveState(char* to);
322
- static char* RestoreState(char* from);
323
190
 
324
191
  private:
325
192
  Handle<Context> global_context_;
@@ -328,18 +195,48 @@ class Genesis BASE_EMBEDDED {
328
195
  // triggered during environment creation there may be weak handle
329
196
  // processing callbacks which may create new environments.
330
197
  Genesis* previous_;
331
- static Genesis* current_;
332
198
 
333
199
  Handle<Context> global_context() { return global_context_; }
334
200
 
335
- void CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
336
- Handle<Object> global_object);
201
+ // Creates some basic objects. Used for creating a context from scratch.
202
+ void CreateRoots();
203
+ // Creates the empty function. Used for creating a context from scratch.
204
+ Handle<JSFunction> CreateEmptyFunction();
205
+ // Creates the global objects using the global and the template passed in
206
+ // through the API. We call this regardless of whether we are building a
207
+ // context from scratch or using a deserialized one from the partial snapshot
208
+ // but in the latter case we don't use the objects it produces directly, as
209
+ // we have to used the deserialized ones that are linked together with the
210
+ // rest of the context snapshot.
211
+ Handle<JSGlobalProxy> CreateNewGlobals(
212
+ v8::Handle<v8::ObjectTemplate> global_template,
213
+ Handle<Object> global_object,
214
+ Handle<GlobalObject>* global_proxy_out);
215
+ // Hooks the given global proxy into the context. If the context was created
216
+ // by deserialization then this will unhook the global proxy that was
217
+ // deserialized, leaving the GC to pick it up.
218
+ void HookUpGlobalProxy(Handle<GlobalObject> inner_global,
219
+ Handle<JSGlobalProxy> global_proxy);
220
+ // Similarly, we want to use the inner global that has been created by the
221
+ // templates passed through the API. The inner global from the snapshot is
222
+ // detached from the other objects in the snapshot.
223
+ void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
224
+ // New context initialization. Used for creating a context from scratch.
225
+ void InitializeGlobal(Handle<GlobalObject> inner_global,
226
+ Handle<JSFunction> empty_function);
227
+ // Installs the contents of the native .js files on the global objects.
228
+ // Used for creating a context from scratch.
337
229
  void InstallNativeFunctions();
338
230
  bool InstallNatives();
339
- bool InstallExtensions(v8::ExtensionConfiguration* extensions);
340
- bool InstallExtension(const char* name);
341
- bool InstallExtension(v8::RegisteredExtension* current);
342
- bool InstallSpecialObjects();
231
+ void InstallJSFunctionResultCaches();
232
+ // Used both for deserialized and from-scratch contexts to add the extensions
233
+ // provided.
234
+ static bool InstallExtensions(Handle<Context> global_context,
235
+ v8::ExtensionConfiguration* extensions);
236
+ static bool InstallExtension(const char* name);
237
+ static bool InstallExtension(v8::RegisteredExtension* current);
238
+ static void InstallSpecialObjects(Handle<Context> global_context);
239
+ bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
343
240
  bool ConfigureApiObject(Handle<JSObject> object,
344
241
  Handle<ObjectTemplateInfo> object_template);
345
242
  bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template);
@@ -351,50 +248,34 @@ class Genesis BASE_EMBEDDED {
351
248
  void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to);
352
249
  void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to);
353
250
 
251
+ enum PrototypePropertyMode {
252
+ DONT_ADD_PROTOTYPE,
253
+ ADD_READONLY_PROTOTYPE,
254
+ ADD_WRITEABLE_PROTOTYPE
255
+ };
354
256
  Handle<DescriptorArray> ComputeFunctionInstanceDescriptor(
355
- bool make_prototype_read_only,
356
- bool make_prototype_enumerable = false);
257
+ PrototypePropertyMode prototypeMode);
357
258
  void MakeFunctionInstancePrototypeWritable();
358
259
 
359
- void AddSpecialFunction(Handle<JSObject> prototype,
360
- const char* name,
361
- Handle<Code> code);
362
-
363
- void BuildSpecialFunctionTable();
364
-
365
260
  static bool CompileBuiltin(int index);
366
261
  static bool CompileNative(Vector<const char> name, Handle<String> source);
367
262
  static bool CompileScriptCached(Vector<const char> name,
368
263
  Handle<String> source,
369
264
  SourceCodeCache* cache,
370
265
  v8::Extension* extension,
266
+ Handle<Context> top_context,
371
267
  bool use_runtime_context);
372
268
 
373
269
  Handle<Context> result_;
270
+ Handle<JSFunction> empty_function_;
271
+ BootstrapperActive active_;
272
+ friend class Bootstrapper;
374
273
  };
375
274
 
376
- Genesis* Genesis::current_ = NULL;
377
-
378
275
 
379
276
  void Bootstrapper::Iterate(ObjectVisitor* v) {
380
- natives_cache.Iterate(v);
381
- v->Synchronize("NativesCache");
382
277
  extensions_cache.Iterate(v);
383
278
  v->Synchronize("Extensions");
384
- PendingFixups::Iterate(v);
385
- v->Synchronize("PendingFixups");
386
- }
387
-
388
-
389
- // While setting up the environment, we collect code positions that
390
- // need to be patched before we can run any code in the environment.
391
- void Bootstrapper::AddFixup(Code* code, MacroAssembler* masm) {
392
- PendingFixups::Add(code, masm);
393
- }
394
-
395
-
396
- bool Bootstrapper::IsActive() {
397
- return Genesis::current() != NULL;
398
279
  }
399
280
 
400
281
 
@@ -402,8 +283,16 @@ Handle<Context> Bootstrapper::CreateEnvironment(
402
283
  Handle<Object> global_object,
403
284
  v8::Handle<v8::ObjectTemplate> global_template,
404
285
  v8::ExtensionConfiguration* extensions) {
286
+ HandleScope scope;
287
+ Handle<Context> env;
405
288
  Genesis genesis(global_object, global_template, extensions);
406
- return genesis.result();
289
+ env = genesis.result();
290
+ if (!env.is_null()) {
291
+ if (InstallExtensions(env, extensions)) {
292
+ return env;
293
+ }
294
+ }
295
+ return Handle<Context>();
407
296
  }
408
297
 
409
298
 
@@ -425,9 +314,14 @@ void Bootstrapper::DetachGlobal(Handle<Context> env) {
425
314
  }
426
315
 
427
316
 
428
- Genesis::~Genesis() {
429
- ASSERT(current_ == this);
430
- current_ = previous_;
317
+ void Bootstrapper::ReattachGlobal(Handle<Context> env,
318
+ Handle<Object> global_object) {
319
+ ASSERT(global_object->IsJSGlobalProxy());
320
+ Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object);
321
+ env->global()->set_global_receiver(*global);
322
+ env->set_global_proxy(*global);
323
+ SetObjectPrototype(global, Handle<JSObject>(env->global()));
324
+ global->set_context(*env);
431
325
  }
432
326
 
433
327
 
@@ -440,7 +334,8 @@ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
440
334
  bool is_ecma_native) {
441
335
  Handle<String> symbol = Factory::LookupAsciiSymbol(name);
442
336
  Handle<Code> call_code = Handle<Code>(Builtins::builtin(call));
443
- Handle<JSFunction> function =
337
+ Handle<JSFunction> function = prototype.is_null() ?
338
+ Factory::NewFunctionWithoutPrototype(symbol, call_code) :
444
339
  Factory::NewFunctionWithPrototype(symbol,
445
340
  type,
446
341
  instance_size,
@@ -456,23 +351,23 @@ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
456
351
 
457
352
 
458
353
  Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
459
- bool make_prototype_read_only,
460
- bool make_prototype_enumerable) {
354
+ PrototypePropertyMode prototypeMode) {
461
355
  Handle<DescriptorArray> result = Factory::empty_descriptor_array();
462
356
 
463
- // Add prototype.
464
- PropertyAttributes attributes = static_cast<PropertyAttributes>(
465
- (make_prototype_enumerable ? 0 : DONT_ENUM)
466
- | DONT_DELETE
467
- | (make_prototype_read_only ? READ_ONLY : 0));
468
- result =
469
- Factory::CopyAppendProxyDescriptor(
470
- result,
471
- Factory::prototype_symbol(),
472
- Factory::NewProxy(&Accessors::FunctionPrototype),
473
- attributes);
357
+ if (prototypeMode != DONT_ADD_PROTOTYPE) {
358
+ PropertyAttributes attributes = static_cast<PropertyAttributes>(
359
+ DONT_ENUM |
360
+ DONT_DELETE |
361
+ (prototypeMode == ADD_READONLY_PROTOTYPE ? READ_ONLY : 0));
362
+ result =
363
+ Factory::CopyAppendProxyDescriptor(
364
+ result,
365
+ Factory::prototype_symbol(),
366
+ Factory::NewProxy(&Accessors::FunctionPrototype),
367
+ attributes);
368
+ }
474
369
 
475
- attributes =
370
+ PropertyAttributes attributes =
476
371
  static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
477
372
  // Add length.
478
373
  result =
@@ -510,36 +405,36 @@ Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
510
405
  }
511
406
 
512
407
 
513
- void Genesis::CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
514
- Handle<Object> global_object) {
515
- HandleScope scope;
516
- // Allocate the global context FixedArray first and then patch the
517
- // closure and extension object later (we need the empty function
518
- // and the global object, but in order to create those, we need the
519
- // global context).
520
- global_context_ =
521
- Handle<Context>::cast(
522
- GlobalHandles::Create(*Factory::NewGlobalContext()));
523
- Top::set_context(*global_context());
524
-
525
- // Allocate the message listeners object.
526
- v8::NeanderArray listeners;
527
- global_context()->set_message_listeners(*listeners.value());
528
-
408
+ Handle<JSFunction> Genesis::CreateEmptyFunction() {
529
409
  // Allocate the map for function instances.
530
410
  Handle<Map> fm = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
531
411
  global_context()->set_function_instance_map(*fm);
532
412
  // Please note that the prototype property for function instances must be
533
413
  // writable.
534
414
  Handle<DescriptorArray> function_map_descriptors =
535
- ComputeFunctionInstanceDescriptor(false, false);
415
+ ComputeFunctionInstanceDescriptor(ADD_WRITEABLE_PROTOTYPE);
536
416
  fm->set_instance_descriptors(*function_map_descriptors);
417
+ fm->set_function_with_prototype(true);
418
+
419
+ // Functions with this map will not have a 'prototype' property, and
420
+ // can not be used as constructors.
421
+ Handle<Map> function_without_prototype_map =
422
+ Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
423
+ global_context()->set_function_without_prototype_map(
424
+ *function_without_prototype_map);
425
+ Handle<DescriptorArray> function_without_prototype_map_descriptors =
426
+ ComputeFunctionInstanceDescriptor(DONT_ADD_PROTOTYPE);
427
+ function_without_prototype_map->set_instance_descriptors(
428
+ *function_without_prototype_map_descriptors);
429
+ function_without_prototype_map->set_function_with_prototype(false);
537
430
 
538
431
  // Allocate the function map first and then patch the prototype later
539
432
  fm = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
540
433
  global_context()->set_function_map(*fm);
541
- function_map_descriptors = ComputeFunctionInstanceDescriptor(true);
434
+ function_map_descriptors =
435
+ ComputeFunctionInstanceDescriptor(ADD_READONLY_PROTOTYPE);
542
436
  fm->set_instance_descriptors(*function_map_descriptors);
437
+ fm->set_function_with_prototype(true);
543
438
 
544
439
  Handle<String> object_name = Handle<String>(Heap::Object_symbol());
545
440
 
@@ -567,139 +462,201 @@ void Genesis::CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
567
462
  // 262 15.3.4.
568
463
  Handle<String> symbol = Factory::LookupAsciiSymbol("Empty");
569
464
  Handle<JSFunction> empty_function =
570
- Factory::NewFunction(symbol, Factory::null_value());
465
+ Factory::NewFunctionWithoutPrototype(symbol);
466
+
467
+ // --- E m p t y ---
468
+ Handle<Code> code =
469
+ Handle<Code>(Builtins::builtin(Builtins::EmptyFunction));
470
+ empty_function->set_code(*code);
471
+ Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}"));
472
+ Handle<Script> script = Factory::NewScript(source);
473
+ script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
474
+ empty_function->shared()->set_script(*script);
475
+ empty_function->shared()->set_start_position(0);
476
+ empty_function->shared()->set_end_position(source->length());
477
+ empty_function->shared()->DontAdaptArguments();
478
+ global_context()->function_map()->set_prototype(*empty_function);
479
+ global_context()->function_instance_map()->set_prototype(*empty_function);
480
+ global_context()->function_without_prototype_map()->
481
+ set_prototype(*empty_function);
571
482
 
572
- { // --- E m p t y ---
573
- Handle<Code> code =
574
- Handle<Code>(Builtins::builtin(Builtins::EmptyFunction));
575
- empty_function->set_code(*code);
576
- Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}"));
577
- Handle<Script> script = Factory::NewScript(source);
578
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
579
- empty_function->shared()->set_script(*script);
580
- empty_function->shared()->set_start_position(0);
581
- empty_function->shared()->set_end_position(source->length());
582
- empty_function->shared()->DontAdaptArguments();
583
- global_context()->function_map()->set_prototype(*empty_function);
584
- global_context()->function_instance_map()->set_prototype(*empty_function);
585
-
586
- // Allocate the function map first and then patch the prototype later
587
- Handle<Map> empty_fm = Factory::CopyMapDropDescriptors(fm);
588
- empty_fm->set_instance_descriptors(*function_map_descriptors);
589
- empty_fm->set_prototype(global_context()->object_function()->prototype());
590
- empty_function->set_map(*empty_fm);
591
- }
483
+ // Allocate the function map first and then patch the prototype later
484
+ Handle<Map> empty_fm = Factory::CopyMapDropDescriptors(
485
+ function_without_prototype_map);
486
+ empty_fm->set_instance_descriptors(
487
+ *function_without_prototype_map_descriptors);
488
+ empty_fm->set_prototype(global_context()->object_function()->prototype());
489
+ empty_function->set_map(*empty_fm);
490
+ return empty_function;
491
+ }
592
492
 
593
- { // --- G l o b a l ---
594
- // Step 1: create a fresh inner JSGlobalObject
595
- Handle<GlobalObject> object;
596
- {
597
- Handle<JSFunction> js_global_function;
598
- Handle<ObjectTemplateInfo> js_global_template;
599
- if (!global_template.IsEmpty()) {
600
- // Get prototype template of the global_template
601
- Handle<ObjectTemplateInfo> data =
602
- v8::Utils::OpenHandle(*global_template);
603
- Handle<FunctionTemplateInfo> global_constructor =
604
- Handle<FunctionTemplateInfo>(
605
- FunctionTemplateInfo::cast(data->constructor()));
606
- Handle<Object> proto_template(global_constructor->prototype_template());
607
- if (!proto_template->IsUndefined()) {
608
- js_global_template =
609
- Handle<ObjectTemplateInfo>::cast(proto_template);
610
- }
611
- }
612
493
 
613
- if (js_global_template.is_null()) {
614
- Handle<String> name = Handle<String>(Heap::empty_symbol());
615
- Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
616
- js_global_function =
617
- Factory::NewFunction(name, JS_GLOBAL_OBJECT_TYPE,
618
- JSGlobalObject::kSize, code, true);
619
- // Change the constructor property of the prototype of the
620
- // hidden global function to refer to the Object function.
621
- Handle<JSObject> prototype =
622
- Handle<JSObject>(
623
- JSObject::cast(js_global_function->instance_prototype()));
624
- SetProperty(prototype, Factory::constructor_symbol(),
625
- Top::object_function(), NONE);
626
- } else {
627
- Handle<FunctionTemplateInfo> js_global_constructor(
628
- FunctionTemplateInfo::cast(js_global_template->constructor()));
629
- js_global_function =
630
- Factory::CreateApiFunction(js_global_constructor,
631
- Factory::InnerGlobalObject);
632
- }
494
+ void Genesis::CreateRoots() {
495
+ // Allocate the global context FixedArray first and then patch the
496
+ // closure and extension object later (we need the empty function
497
+ // and the global object, but in order to create those, we need the
498
+ // global context).
499
+ global_context_ =
500
+ Handle<Context>::cast(
501
+ GlobalHandles::Create(*Factory::NewGlobalContext()));
502
+ Top::set_context(*global_context());
503
+
504
+ // Allocate the message listeners object.
505
+ {
506
+ v8::NeanderArray listeners;
507
+ global_context()->set_message_listeners(*listeners.value());
508
+ }
509
+ }
633
510
 
634
- js_global_function->initial_map()->set_is_hidden_prototype();
635
- object = Factory::NewGlobalObject(js_global_function);
511
+
512
+ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
513
+ v8::Handle<v8::ObjectTemplate> global_template,
514
+ Handle<Object> global_object,
515
+ Handle<GlobalObject>* inner_global_out) {
516
+ // The argument global_template aka data is an ObjectTemplateInfo.
517
+ // It has a constructor pointer that points at global_constructor which is a
518
+ // FunctionTemplateInfo.
519
+ // The global_constructor is used to create or reinitialize the global_proxy.
520
+ // The global_constructor also has a prototype_template pointer that points at
521
+ // js_global_template which is an ObjectTemplateInfo.
522
+ // That in turn has a constructor pointer that points at
523
+ // js_global_constructor which is a FunctionTemplateInfo.
524
+ // js_global_constructor is used to make js_global_function
525
+ // js_global_function is used to make the new inner_global.
526
+ //
527
+ // --- G l o b a l ---
528
+ // Step 1: Create a fresh inner JSGlobalObject.
529
+ Handle<JSFunction> js_global_function;
530
+ Handle<ObjectTemplateInfo> js_global_template;
531
+ if (!global_template.IsEmpty()) {
532
+ // Get prototype template of the global_template.
533
+ Handle<ObjectTemplateInfo> data =
534
+ v8::Utils::OpenHandle(*global_template);
535
+ Handle<FunctionTemplateInfo> global_constructor =
536
+ Handle<FunctionTemplateInfo>(
537
+ FunctionTemplateInfo::cast(data->constructor()));
538
+ Handle<Object> proto_template(global_constructor->prototype_template());
539
+ if (!proto_template->IsUndefined()) {
540
+ js_global_template =
541
+ Handle<ObjectTemplateInfo>::cast(proto_template);
636
542
  }
543
+ }
637
544
 
638
- // Set the global context for the global object.
639
- object->set_global_context(*global_context());
545
+ if (js_global_template.is_null()) {
546
+ Handle<String> name = Handle<String>(Heap::empty_symbol());
547
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
548
+ js_global_function =
549
+ Factory::NewFunction(name, JS_GLOBAL_OBJECT_TYPE,
550
+ JSGlobalObject::kSize, code, true);
551
+ // Change the constructor property of the prototype of the
552
+ // hidden global function to refer to the Object function.
553
+ Handle<JSObject> prototype =
554
+ Handle<JSObject>(
555
+ JSObject::cast(js_global_function->instance_prototype()));
556
+ SetProperty(prototype, Factory::constructor_symbol(),
557
+ Top::object_function(), NONE);
558
+ } else {
559
+ Handle<FunctionTemplateInfo> js_global_constructor(
560
+ FunctionTemplateInfo::cast(js_global_template->constructor()));
561
+ js_global_function =
562
+ Factory::CreateApiFunction(js_global_constructor,
563
+ Factory::InnerGlobalObject);
564
+ }
640
565
 
641
- // Step 2: create or re-initialize the global proxy object.
642
- Handle<JSGlobalProxy> global_proxy;
643
- {
644
- Handle<JSFunction> global_proxy_function;
645
- if (global_template.IsEmpty()) {
646
- Handle<String> name = Handle<String>(Heap::empty_symbol());
647
- Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
648
- global_proxy_function =
649
- Factory::NewFunction(name, JS_GLOBAL_PROXY_TYPE,
650
- JSGlobalProxy::kSize, code, true);
651
- } else {
652
- Handle<ObjectTemplateInfo> data =
653
- v8::Utils::OpenHandle(*global_template);
654
- Handle<FunctionTemplateInfo> global_constructor(
655
- FunctionTemplateInfo::cast(data->constructor()));
656
- global_proxy_function =
657
- Factory::CreateApiFunction(global_constructor,
658
- Factory::OuterGlobalObject);
659
- }
566
+ js_global_function->initial_map()->set_is_hidden_prototype();
567
+ Handle<GlobalObject> inner_global =
568
+ Factory::NewGlobalObject(js_global_function);
569
+ if (inner_global_out != NULL) {
570
+ *inner_global_out = inner_global;
571
+ }
660
572
 
661
- Handle<String> global_name = Factory::LookupAsciiSymbol("global");
662
- global_proxy_function->shared()->set_instance_class_name(*global_name);
663
- global_proxy_function->initial_map()->set_is_access_check_needed(true);
664
-
665
- // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
666
-
667
- if (global_object.location() != NULL) {
668
- ASSERT(global_object->IsJSGlobalProxy());
669
- global_proxy =
670
- ReinitializeJSGlobalProxy(
671
- global_proxy_function,
672
- Handle<JSGlobalProxy>::cast(global_object));
673
- } else {
674
- global_proxy = Handle<JSGlobalProxy>::cast(
675
- Factory::NewJSObject(global_proxy_function, TENURED));
676
- }
573
+ // Step 2: create or re-initialize the global proxy object.
574
+ Handle<JSFunction> global_proxy_function;
575
+ if (global_template.IsEmpty()) {
576
+ Handle<String> name = Handle<String>(Heap::empty_symbol());
577
+ Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::Illegal));
578
+ global_proxy_function =
579
+ Factory::NewFunction(name, JS_GLOBAL_PROXY_TYPE,
580
+ JSGlobalProxy::kSize, code, true);
581
+ } else {
582
+ Handle<ObjectTemplateInfo> data =
583
+ v8::Utils::OpenHandle(*global_template);
584
+ Handle<FunctionTemplateInfo> global_constructor(
585
+ FunctionTemplateInfo::cast(data->constructor()));
586
+ global_proxy_function =
587
+ Factory::CreateApiFunction(global_constructor,
588
+ Factory::OuterGlobalObject);
589
+ }
677
590
 
678
- // Security setup: Set the security token of the global object to
679
- // its the inner global. This makes the security check between two
680
- // different contexts fail by default even in case of global
681
- // object reinitialization.
682
- object->set_global_receiver(*global_proxy);
683
- global_proxy->set_context(*global_context());
684
- }
591
+ Handle<String> global_name = Factory::LookupAsciiSymbol("global");
592
+ global_proxy_function->shared()->set_instance_class_name(*global_name);
593
+ global_proxy_function->initial_map()->set_is_access_check_needed(true);
685
594
 
686
- { // --- G l o b a l C o n t e x t ---
687
- // use the empty function as closure (no scope info)
688
- global_context()->set_closure(*empty_function);
689
- global_context()->set_fcontext(*global_context());
690
- global_context()->set_previous(NULL);
691
-
692
- // set extension and global object
693
- global_context()->set_extension(*object);
694
- global_context()->set_global(*object);
695
- global_context()->set_global_proxy(*global_proxy);
696
- // use inner global object as security token by default
697
- global_context()->set_security_token(*object);
698
- }
595
+ // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
596
+ // Return the global proxy.
699
597
 
700
- Handle<JSObject> global = Handle<JSObject>(global_context()->global());
701
- SetProperty(global, object_name, Top::object_function(), DONT_ENUM);
598
+ if (global_object.location() != NULL) {
599
+ ASSERT(global_object->IsJSGlobalProxy());
600
+ return ReinitializeJSGlobalProxy(
601
+ global_proxy_function,
602
+ Handle<JSGlobalProxy>::cast(global_object));
603
+ } else {
604
+ return Handle<JSGlobalProxy>::cast(
605
+ Factory::NewJSObject(global_proxy_function, TENURED));
702
606
  }
607
+ }
608
+
609
+
610
+ void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global,
611
+ Handle<JSGlobalProxy> global_proxy) {
612
+ // Set the global context for the global object.
613
+ inner_global->set_global_context(*global_context());
614
+ inner_global->set_global_receiver(*global_proxy);
615
+ global_proxy->set_context(*global_context());
616
+ global_context()->set_global_proxy(*global_proxy);
617
+ }
618
+
619
+
620
+ void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
621
+ Handle<GlobalObject> inner_global_from_snapshot(
622
+ GlobalObject::cast(global_context_->extension()));
623
+ Handle<JSBuiltinsObject> builtins_global(global_context_->builtins());
624
+ global_context_->set_extension(*inner_global);
625
+ global_context_->set_global(*inner_global);
626
+ global_context_->set_security_token(*inner_global);
627
+ static const PropertyAttributes attributes =
628
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
629
+ ForceSetProperty(builtins_global,
630
+ Factory::LookupAsciiSymbol("global"),
631
+ inner_global,
632
+ attributes);
633
+ // Setup the reference from the global object to the builtins object.
634
+ JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
635
+ TransferNamedProperties(inner_global_from_snapshot, inner_global);
636
+ TransferIndexedProperties(inner_global_from_snapshot, inner_global);
637
+ }
638
+
639
+
640
+ // This is only called if we are not using snapshots. The equivalent
641
+ // work in the snapshot case is done in HookUpInnerGlobal.
642
+ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
643
+ Handle<JSFunction> empty_function) {
644
+ // --- G l o b a l C o n t e x t ---
645
+ // Use the empty function as closure (no scope info).
646
+ global_context()->set_closure(*empty_function);
647
+ global_context()->set_fcontext(*global_context());
648
+ global_context()->set_previous(NULL);
649
+ // Set extension and global object.
650
+ global_context()->set_extension(*inner_global);
651
+ global_context()->set_global(*inner_global);
652
+ // Security setup: Set the security token of the global object to
653
+ // its the inner global. This makes the security check between two
654
+ // different contexts fail by default even in case of global
655
+ // object reinitialization.
656
+ global_context()->set_security_token(*inner_global);
657
+
658
+ Handle<String> object_name = Handle<String>(Heap::Object_symbol());
659
+ SetProperty(inner_global, object_name, Top::object_function(), DONT_ENUM);
703
660
 
704
661
  Handle<JSObject> global = Handle<JSObject>(global_context()->global());
705
662
 
@@ -791,8 +748,68 @@ void Genesis::CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
791
748
  InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
792
749
  Top::initial_object_prototype(), Builtins::Illegal,
793
750
  true);
794
-
795
751
  global_context()->set_regexp_function(*regexp_fun);
752
+
753
+ ASSERT(regexp_fun->has_initial_map());
754
+ Handle<Map> initial_map(regexp_fun->initial_map());
755
+
756
+ ASSERT_EQ(0, initial_map->inobject_properties());
757
+
758
+ Handle<DescriptorArray> descriptors = Factory::NewDescriptorArray(5);
759
+ PropertyAttributes final =
760
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
761
+ int enum_index = 0;
762
+ {
763
+ // ECMA-262, section 15.10.7.1.
764
+ FieldDescriptor field(Heap::source_symbol(),
765
+ JSRegExp::kSourceFieldIndex,
766
+ final,
767
+ enum_index++);
768
+ descriptors->Set(0, &field);
769
+ }
770
+ {
771
+ // ECMA-262, section 15.10.7.2.
772
+ FieldDescriptor field(Heap::global_symbol(),
773
+ JSRegExp::kGlobalFieldIndex,
774
+ final,
775
+ enum_index++);
776
+ descriptors->Set(1, &field);
777
+ }
778
+ {
779
+ // ECMA-262, section 15.10.7.3.
780
+ FieldDescriptor field(Heap::ignore_case_symbol(),
781
+ JSRegExp::kIgnoreCaseFieldIndex,
782
+ final,
783
+ enum_index++);
784
+ descriptors->Set(2, &field);
785
+ }
786
+ {
787
+ // ECMA-262, section 15.10.7.4.
788
+ FieldDescriptor field(Heap::multiline_symbol(),
789
+ JSRegExp::kMultilineFieldIndex,
790
+ final,
791
+ enum_index++);
792
+ descriptors->Set(3, &field);
793
+ }
794
+ {
795
+ // ECMA-262, section 15.10.7.5.
796
+ PropertyAttributes writable =
797
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
798
+ FieldDescriptor field(Heap::last_index_symbol(),
799
+ JSRegExp::kLastIndexFieldIndex,
800
+ writable,
801
+ enum_index++);
802
+ descriptors->Set(4, &field);
803
+ }
804
+ descriptors->SetNextEnumerationIndex(enum_index);
805
+ descriptors->Sort();
806
+
807
+ initial_map->set_inobject_properties(5);
808
+ initial_map->set_pre_allocated_property_fields(5);
809
+ initial_map->set_unused_property_fields(0);
810
+ initial_map->set_instance_size(
811
+ initial_map->instance_size() + 5 * kPointerSize);
812
+ initial_map->set_instance_descriptors(*descriptors);
796
813
  }
797
814
 
798
815
  { // -- J S O N
@@ -843,11 +860,11 @@ void Genesis::CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
843
860
  #ifdef DEBUG
844
861
  LookupResult lookup;
845
862
  result->LocalLookup(Heap::callee_symbol(), &lookup);
846
- ASSERT(lookup.IsValid() && (lookup.type() == FIELD));
863
+ ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
847
864
  ASSERT(lookup.GetFieldIndex() == Heap::arguments_callee_index);
848
865
 
849
866
  result->LocalLookup(Heap::length_symbol(), &lookup);
850
- ASSERT(lookup.IsValid() && (lookup.type() == FIELD));
867
+ ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
851
868
  ASSERT(lookup.GetFieldIndex() == Heap::arguments_length_index);
852
869
 
853
870
  ASSERT(result->map()->inobject_properties() > Heap::arguments_callee_index);
@@ -897,8 +914,6 @@ void Genesis::CreateRoots(v8::Handle<v8::ObjectTemplate> global_template,
897
914
  delegate->shared()->DontAdaptArguments();
898
915
  }
899
916
 
900
- global_context()->set_special_function_table(Heap::empty_fixed_array());
901
-
902
917
  // Initialize the out of memory slot.
903
918
  global_context()->set_out_of_memory(Heap::false_value());
904
919
 
@@ -919,8 +934,12 @@ bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) {
919
934
  #ifdef ENABLE_DEBUGGER_SUPPORT
920
935
  Debugger::set_compiling_natives(true);
921
936
  #endif
922
- bool result =
923
- CompileScriptCached(name, source, &natives_cache, NULL, true);
937
+ bool result = CompileScriptCached(name,
938
+ source,
939
+ NULL,
940
+ NULL,
941
+ Handle<Context>(Top::context()),
942
+ true);
924
943
  ASSERT(Top::has_pending_exception() != result);
925
944
  if (!result) Top::clear_pending_exception();
926
945
  #ifdef ENABLE_DEBUGGER_SUPPORT
@@ -934,44 +953,51 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
934
953
  Handle<String> source,
935
954
  SourceCodeCache* cache,
936
955
  v8::Extension* extension,
956
+ Handle<Context> top_context,
937
957
  bool use_runtime_context) {
938
958
  HandleScope scope;
939
- Handle<JSFunction> boilerplate;
959
+ Handle<SharedFunctionInfo> function_info;
940
960
 
941
961
  // If we can't find the function in the cache, we compile a new
942
962
  // function and insert it into the cache.
943
- if (!cache->Lookup(name, &boilerplate)) {
963
+ if (cache == NULL || !cache->Lookup(name, &function_info)) {
944
964
  ASSERT(source->IsAsciiRepresentation());
945
965
  Handle<String> script_name = Factory::NewStringFromUtf8(name);
946
- boilerplate =
947
- Compiler::Compile(source, script_name, 0, 0, extension, NULL);
948
- if (boilerplate.is_null()) return false;
949
- cache->Add(name, boilerplate);
966
+ function_info = Compiler::Compile(
967
+ source,
968
+ script_name,
969
+ 0,
970
+ 0,
971
+ extension,
972
+ NULL,
973
+ Handle<String>::null(),
974
+ use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
975
+ if (function_info.is_null()) return false;
976
+ if (cache != NULL) cache->Add(name, function_info);
950
977
  }
951
978
 
952
979
  // Setup the function context. Conceptually, we should clone the
953
980
  // function before overwriting the context but since we're in a
954
981
  // single-threaded environment it is not strictly necessary.
955
- ASSERT(Top::context()->IsGlobalContext());
982
+ ASSERT(top_context->IsGlobalContext());
956
983
  Handle<Context> context =
957
984
  Handle<Context>(use_runtime_context
958
- ? Top::context()->runtime_context()
959
- : Top::context());
985
+ ? Handle<Context>(top_context->runtime_context())
986
+ : top_context);
960
987
  Handle<JSFunction> fun =
961
- Factory::NewFunctionFromBoilerplate(boilerplate, context);
988
+ Factory::NewFunctionFromSharedFunctionInfo(function_info, context);
962
989
 
963
- // Call function using the either the runtime object or the global
990
+ // Call function using either the runtime object or the global
964
991
  // object as the receiver. Provide no parameters.
965
992
  Handle<Object> receiver =
966
993
  Handle<Object>(use_runtime_context
967
- ? Top::context()->builtins()
968
- : Top::context()->global());
994
+ ? top_context->builtins()
995
+ : top_context->global());
969
996
  bool has_pending_exception;
970
997
  Handle<Object> result =
971
998
  Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
972
999
  if (has_pending_exception) return false;
973
- return PendingFixups::Process(
974
- Handle<JSBuiltinsObject>(Top::context()->builtins()));
1000
+ return true;
975
1001
  }
976
1002
 
977
1003
 
@@ -991,7 +1017,6 @@ void Genesis::InstallNativeFunctions() {
991
1017
  INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
992
1018
  INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
993
1019
  INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
994
- INSTALL_NATIVE(JSFunction, "ToBoolean", to_boolean_fun);
995
1020
  INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
996
1021
  INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
997
1022
  INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
@@ -1169,47 +1194,39 @@ bool Genesis::InstallNatives() {
1169
1194
  // Allocate the empty script.
1170
1195
  Handle<Script> script = Factory::NewScript(Factory::empty_string());
1171
1196
  script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1172
- global_context()->set_empty_script(*script);
1197
+ Heap::public_set_empty_script(*script);
1198
+ }
1199
+ {
1200
+ // Builtin function for OpaqueReference -- a JSValue-based object,
1201
+ // that keeps its field isolated from JavaScript code. It may store
1202
+ // objects, that JavaScript code may not access.
1203
+ Handle<JSFunction> opaque_reference_fun =
1204
+ InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE,
1205
+ JSValue::kSize, Top::initial_object_prototype(),
1206
+ Builtins::Illegal, false);
1207
+ Handle<JSObject> prototype =
1208
+ Factory::NewJSObject(Top::object_function(), TENURED);
1209
+ SetPrototype(opaque_reference_fun, prototype);
1210
+ global_context()->set_opaque_reference_function(*opaque_reference_fun);
1173
1211
  }
1174
1212
 
1175
- if (FLAG_natives_file == NULL) {
1176
- // Without natives file, install default natives.
1177
- for (int i = Natives::GetDelayCount();
1178
- i < Natives::GetBuiltinsCount();
1179
- i++) {
1180
- if (!CompileBuiltin(i)) return false;
1181
- }
1182
-
1183
- // Setup natives with lazy loading.
1184
- SetupLazy(Handle<JSFunction>(global_context()->date_function()),
1185
- Natives::GetIndex("date"),
1186
- Top::global_context(),
1187
- Handle<Context>(Top::context()->runtime_context()));
1188
- SetupLazy(Handle<JSFunction>(global_context()->regexp_function()),
1189
- Natives::GetIndex("regexp"),
1190
- Top::global_context(),
1191
- Handle<Context>(Top::context()->runtime_context()));
1192
- SetupLazy(Handle<JSObject>(global_context()->json_object()),
1193
- Natives::GetIndex("json"),
1194
- Top::global_context(),
1195
- Handle<Context>(Top::context()->runtime_context()));
1196
-
1197
- } else if (strlen(FLAG_natives_file) != 0) {
1198
- // Otherwise install natives from natives file if file exists and
1199
- // compiles.
1200
- bool exists;
1201
- Vector<const char> source = ReadFile(FLAG_natives_file, &exists);
1202
- Handle<String> source_string = Factory::NewStringFromAscii(source);
1203
- if (source.is_empty()) return false;
1204
- bool result = CompileNative(CStrVector(FLAG_natives_file), source_string);
1205
- if (!result) return false;
1206
-
1207
- } else {
1208
- // Empty natives file name - do not install any natives.
1213
+ if (FLAG_disable_native_files) {
1209
1214
  PrintF("Warning: Running without installed natives!\n");
1210
1215
  return true;
1211
1216
  }
1212
1217
 
1218
+ // Install natives.
1219
+ for (int i = Natives::GetDebuggerCount();
1220
+ i < Natives::GetBuiltinsCount();
1221
+ i++) {
1222
+ Vector<const char> name = Natives::GetScriptName(i);
1223
+ if (!CompileBuiltin(i)) return false;
1224
+ // TODO(ager): We really only need to install the JS builtin
1225
+ // functions on the builtins object after compiling and running
1226
+ // runtime.js.
1227
+ if (!InstallJSBuiltins(builtins)) return false;
1228
+ }
1229
+
1213
1230
  InstallNativeFunctions();
1214
1231
 
1215
1232
  // Install Function.prototype.call and apply.
@@ -1222,12 +1239,12 @@ bool Genesis::InstallNatives() {
1222
1239
  // Install the call and the apply functions.
1223
1240
  Handle<JSFunction> call =
1224
1241
  InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize,
1225
- Factory::NewJSObject(Top::object_function(), TENURED),
1242
+ Handle<JSObject>::null(),
1226
1243
  Builtins::FunctionCall,
1227
1244
  false);
1228
1245
  Handle<JSFunction> apply =
1229
1246
  InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
1230
- Factory::NewJSObject(Top::object_function(), TENURED),
1247
+ Handle<JSObject>::null(),
1231
1248
  Builtins::FunctionApply,
1232
1249
  false);
1233
1250
 
@@ -1245,17 +1262,124 @@ bool Genesis::InstallNatives() {
1245
1262
  apply->shared()->set_length(2);
1246
1263
  }
1247
1264
 
1265
+ // Create a constructor for RegExp results (a variant of Array that
1266
+ // predefines the two properties index and match).
1267
+ {
1268
+ // RegExpResult initial map.
1269
+
1270
+ // Find global.Array.prototype to inherit from.
1271
+ Handle<JSFunction> array_constructor(global_context()->array_function());
1272
+ Handle<JSObject> array_prototype(
1273
+ JSObject::cast(array_constructor->instance_prototype()));
1274
+
1275
+ // Add initial map.
1276
+ Handle<Map> initial_map =
1277
+ Factory::NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize);
1278
+ initial_map->set_constructor(*array_constructor);
1279
+
1280
+ // Set prototype on map.
1281
+ initial_map->set_non_instance_prototype(false);
1282
+ initial_map->set_prototype(*array_prototype);
1283
+
1284
+ // Update map with length accessor from Array and add "index" and "input".
1285
+ Handle<Map> array_map(global_context()->js_array_map());
1286
+ Handle<DescriptorArray> array_descriptors(
1287
+ array_map->instance_descriptors());
1288
+ ASSERT_EQ(1, array_descriptors->number_of_descriptors());
1289
+
1290
+ Handle<DescriptorArray> reresult_descriptors =
1291
+ Factory::NewDescriptorArray(3);
1292
+
1293
+ reresult_descriptors->CopyFrom(0, *array_descriptors, 0);
1294
+
1295
+ int enum_index = 0;
1296
+ {
1297
+ FieldDescriptor index_field(Heap::index_symbol(),
1298
+ JSRegExpResult::kIndexIndex,
1299
+ NONE,
1300
+ enum_index++);
1301
+ reresult_descriptors->Set(1, &index_field);
1302
+ }
1303
+
1304
+ {
1305
+ FieldDescriptor input_field(Heap::input_symbol(),
1306
+ JSRegExpResult::kInputIndex,
1307
+ NONE,
1308
+ enum_index++);
1309
+ reresult_descriptors->Set(2, &input_field);
1310
+ }
1311
+ reresult_descriptors->Sort();
1312
+
1313
+ initial_map->set_inobject_properties(2);
1314
+ initial_map->set_pre_allocated_property_fields(2);
1315
+ initial_map->set_unused_property_fields(0);
1316
+ initial_map->set_instance_descriptors(*reresult_descriptors);
1317
+
1318
+ global_context()->set_regexp_result_map(*initial_map);
1319
+ }
1320
+
1248
1321
  #ifdef DEBUG
1249
1322
  builtins->Verify();
1250
1323
  #endif
1324
+
1325
+ return true;
1326
+ }
1327
+
1328
+
1329
+ // Do not forget to update macros.py with named constant
1330
+ // of cache id.
1331
+ #define JSFUNCTION_RESULT_CACHE_LIST(F) \
1332
+ F(16, global_context()->regexp_function())
1333
+
1334
+
1335
+ static FixedArray* CreateCache(int size, JSFunction* factory) {
1336
+ // Caches are supposed to live for a long time, allocate in old space.
1337
+ int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size;
1338
+ // Cannot use cast as object is not fully initialized yet.
1339
+ JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>(
1340
+ *Factory::NewFixedArrayWithHoles(array_size, TENURED));
1341
+ cache->set(JSFunctionResultCache::kFactoryIndex, factory);
1342
+ cache->MakeZeroSize();
1343
+ return cache;
1344
+ }
1345
+
1346
+
1347
+ void Genesis::InstallJSFunctionResultCaches() {
1348
+ const int kNumberOfCaches = 0 +
1349
+ #define F(size, func) + 1
1350
+ JSFUNCTION_RESULT_CACHE_LIST(F)
1351
+ #undef F
1352
+ ;
1353
+
1354
+ Handle<FixedArray> caches = Factory::NewFixedArray(kNumberOfCaches, TENURED);
1355
+
1356
+ int index = 0;
1357
+ #define F(size, func) caches->set(index++, CreateCache(size, func));
1358
+ JSFUNCTION_RESULT_CACHE_LIST(F)
1359
+ #undef F
1360
+
1361
+ global_context()->set_jsfunction_result_caches(*caches);
1362
+ }
1363
+
1364
+
1365
+ int BootstrapperActive::nesting_ = 0;
1366
+
1367
+
1368
+ bool Bootstrapper::InstallExtensions(Handle<Context> global_context,
1369
+ v8::ExtensionConfiguration* extensions) {
1370
+ BootstrapperActive active;
1371
+ SaveContext saved_context;
1372
+ Top::set_context(*global_context);
1373
+ if (!Genesis::InstallExtensions(global_context, extensions)) return false;
1374
+ Genesis::InstallSpecialObjects(global_context);
1251
1375
  return true;
1252
1376
  }
1253
1377
 
1254
1378
 
1255
- bool Genesis::InstallSpecialObjects() {
1379
+ void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
1256
1380
  HandleScope scope;
1257
1381
  Handle<JSGlobalObject> js_global(
1258
- JSGlobalObject::cast(global_context()->global()));
1382
+ JSGlobalObject::cast(global_context->global()));
1259
1383
  // Expose the natives in global if a name for it is specified.
1260
1384
  if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
1261
1385
  Handle<String> natives_string =
@@ -1278,13 +1402,12 @@ bool Genesis::InstallSpecialObjects() {
1278
1402
  if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
1279
1403
  // If loading fails we just bail out without installing the
1280
1404
  // debugger but without tanking the whole context.
1281
- if (!Debug::Load())
1282
- return true;
1405
+ if (!Debug::Load()) return;
1283
1406
  // Set the security token for the debugger context to the same as
1284
1407
  // the shell global context to allow calling between these (otherwise
1285
1408
  // exposing debug global object doesn't make much sense).
1286
1409
  Debug::debug_context()->set_security_token(
1287
- global_context()->security_token());
1410
+ global_context->security_token());
1288
1411
 
1289
1412
  Handle<String> debug_string =
1290
1413
  Factory::LookupAsciiSymbol(FLAG_expose_debug_as);
@@ -1292,19 +1415,18 @@ bool Genesis::InstallSpecialObjects() {
1292
1415
  Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM);
1293
1416
  }
1294
1417
  #endif
1295
-
1296
- return true;
1297
1418
  }
1298
1419
 
1299
1420
 
1300
- bool Genesis::InstallExtensions(v8::ExtensionConfiguration* extensions) {
1421
+ bool Genesis::InstallExtensions(Handle<Context> global_context,
1422
+ v8::ExtensionConfiguration* extensions) {
1301
1423
  // Clear coloring of extension list
1302
1424
  v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
1303
1425
  while (current != NULL) {
1304
1426
  current->set_state(v8::UNVISITED);
1305
1427
  current = current->next();
1306
1428
  }
1307
- // Install auto extensions
1429
+ // Install auto extensions.
1308
1430
  current = v8::RegisteredExtension::first_extension();
1309
1431
  while (current != NULL) {
1310
1432
  if (current->extension()->auto_enable())
@@ -1368,7 +1490,9 @@ bool Genesis::InstallExtension(v8::RegisteredExtension* current) {
1368
1490
  Handle<String> source_code = Factory::NewStringFromAscii(source);
1369
1491
  bool result = CompileScriptCached(CStrVector(extension->name()),
1370
1492
  source_code,
1371
- &extensions_cache, extension,
1493
+ &extensions_cache,
1494
+ extension,
1495
+ Handle<Context>(Top::context()),
1372
1496
  false);
1373
1497
  ASSERT(Top::has_pending_exception() != result);
1374
1498
  if (!result) {
@@ -1379,11 +1503,28 @@ bool Genesis::InstallExtension(v8::RegisteredExtension* current) {
1379
1503
  }
1380
1504
 
1381
1505
 
1506
+ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
1507
+ HandleScope scope;
1508
+ for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
1509
+ Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
1510
+ Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
1511
+ Handle<JSFunction> function
1512
+ = Handle<JSFunction>(JSFunction::cast(builtins->GetProperty(*name)));
1513
+ builtins->set_javascript_builtin(id, *function);
1514
+ Handle<SharedFunctionInfo> shared
1515
+ = Handle<SharedFunctionInfo>(function->shared());
1516
+ if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1517
+ builtins->set_javascript_builtin_code(id, shared->code());
1518
+ }
1519
+ return true;
1520
+ }
1521
+
1522
+
1382
1523
  bool Genesis::ConfigureGlobalObjects(
1383
1524
  v8::Handle<v8::ObjectTemplate> global_proxy_template) {
1384
1525
  Handle<JSObject> global_proxy(
1385
1526
  JSObject::cast(global_context()->global_proxy()));
1386
- Handle<JSObject> js_global(JSObject::cast(global_context()->global()));
1527
+ Handle<JSObject> inner_global(JSObject::cast(global_context()->global()));
1387
1528
 
1388
1529
  if (!global_proxy_template.IsEmpty()) {
1389
1530
  // Configure the global proxy object.
@@ -1397,11 +1538,11 @@ bool Genesis::ConfigureGlobalObjects(
1397
1538
  if (!proxy_constructor->prototype_template()->IsUndefined()) {
1398
1539
  Handle<ObjectTemplateInfo> inner_data(
1399
1540
  ObjectTemplateInfo::cast(proxy_constructor->prototype_template()));
1400
- if (!ConfigureApiObject(js_global, inner_data)) return false;
1541
+ if (!ConfigureApiObject(inner_global, inner_data)) return false;
1401
1542
  }
1402
1543
  }
1403
1544
 
1404
- SetObjectPrototype(global_proxy, js_global);
1545
+ SetObjectPrototype(global_proxy, inner_global);
1405
1546
  return true;
1406
1547
  }
1407
1548
 
@@ -1453,17 +1594,15 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
1453
1594
  LookupResult result;
1454
1595
  to->LocalLookup(descs->GetKey(i), &result);
1455
1596
  // If the property is already there we skip it
1456
- if (result.IsValid()) continue;
1597
+ if (result.IsProperty()) continue;
1457
1598
  HandleScope inner;
1458
- Handle<DescriptorArray> inst_descs =
1459
- Handle<DescriptorArray>(to->map()->instance_descriptors());
1599
+ ASSERT(!to->HasFastProperties());
1600
+ // Add to dictionary.
1460
1601
  Handle<String> key = Handle<String>(descs->GetKey(i));
1461
- Handle<Object> entry = Handle<Object>(descs->GetCallbacksObject(i));
1462
- inst_descs = Factory::CopyAppendProxyDescriptor(inst_descs,
1463
- key,
1464
- entry,
1465
- details.attributes());
1466
- to->map()->set_instance_descriptors(*inst_descs);
1602
+ Handle<Object> callbacks(descs->GetCallbacksObject(i));
1603
+ PropertyDetails d =
1604
+ PropertyDetails(details.attributes(), CALLBACKS, details.index());
1605
+ SetNormalizedProperty(to, key, callbacks, d);
1467
1606
  break;
1468
1607
  }
1469
1608
  case MAP_TRANSITION:
@@ -1490,7 +1629,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
1490
1629
  // If the property is already there we skip it.
1491
1630
  LookupResult result;
1492
1631
  to->LocalLookup(String::cast(raw_key), &result);
1493
- if (result.IsValid()) continue;
1632
+ if (result.IsProperty()) continue;
1494
1633
  // Set the property.
1495
1634
  Handle<String> key = Handle<String>(String::cast(raw_key));
1496
1635
  Handle<Object> value = Handle<Object>(properties->ValueAt(i));
@@ -1538,94 +1677,63 @@ void Genesis::MakeFunctionInstancePrototypeWritable() {
1538
1677
  HandleScope scope;
1539
1678
 
1540
1679
  Handle<DescriptorArray> function_map_descriptors =
1541
- ComputeFunctionInstanceDescriptor(false);
1680
+ ComputeFunctionInstanceDescriptor(ADD_WRITEABLE_PROTOTYPE);
1542
1681
  Handle<Map> fm = Factory::CopyMapDropDescriptors(Top::function_map());
1543
1682
  fm->set_instance_descriptors(*function_map_descriptors);
1683
+ fm->set_function_with_prototype(true);
1544
1684
  Top::context()->global_context()->set_function_map(*fm);
1545
1685
  }
1546
1686
 
1547
1687
 
1548
- void Genesis::AddSpecialFunction(Handle<JSObject> prototype,
1549
- const char* name,
1550
- Handle<Code> code) {
1551
- Handle<String> key = Factory::LookupAsciiSymbol(name);
1552
- Handle<Object> value = Handle<Object>(prototype->GetProperty(*key));
1553
- if (value->IsJSFunction()) {
1554
- Handle<JSFunction> optimized = Factory::NewFunction(key,
1555
- JS_OBJECT_TYPE,
1556
- JSObject::kHeaderSize,
1557
- code,
1558
- false);
1559
- optimized->shared()->DontAdaptArguments();
1560
- int len = global_context()->special_function_table()->length();
1561
- Handle<FixedArray> new_array = Factory::NewFixedArray(len + 3);
1562
- for (int index = 0; index < len; index++) {
1563
- new_array->set(index,
1564
- global_context()->special_function_table()->get(index));
1565
- }
1566
- new_array->set(len+0, *prototype);
1567
- new_array->set(len+1, *value);
1568
- new_array->set(len+2, *optimized);
1569
- global_context()->set_special_function_table(*new_array);
1570
- }
1571
- }
1572
-
1573
-
1574
- void Genesis::BuildSpecialFunctionTable() {
1575
- HandleScope scope;
1576
- Handle<JSObject> global = Handle<JSObject>(global_context()->global());
1577
- // Add special versions for Array.prototype.pop and push.
1578
- Handle<JSFunction> function =
1579
- Handle<JSFunction>(
1580
- JSFunction::cast(global->GetProperty(Heap::Array_symbol())));
1581
- Handle<JSObject> visible_prototype =
1582
- Handle<JSObject>(JSObject::cast(function->prototype()));
1583
- // Remember to put push and pop on the hidden prototype if it's there.
1584
- Handle<JSObject> push_and_pop_prototype;
1585
- Handle<Object> superproto(visible_prototype->GetPrototype());
1586
- if (superproto->IsJSObject() &&
1587
- JSObject::cast(*superproto)->map()->is_hidden_prototype()) {
1588
- push_and_pop_prototype = Handle<JSObject>::cast(superproto);
1589
- } else {
1590
- push_and_pop_prototype = visible_prototype;
1591
- }
1592
- AddSpecialFunction(push_and_pop_prototype, "pop",
1593
- Handle<Code>(Builtins::builtin(Builtins::ArrayPop)));
1594
- AddSpecialFunction(push_and_pop_prototype, "push",
1595
- Handle<Code>(Builtins::builtin(Builtins::ArrayPush)));
1596
- }
1597
-
1598
-
1599
1688
  Genesis::Genesis(Handle<Object> global_object,
1600
1689
  v8::Handle<v8::ObjectTemplate> global_template,
1601
1690
  v8::ExtensionConfiguration* extensions) {
1602
- // Link this genesis object into the stacked genesis chain. This
1603
- // must be done before any early exits because the destructor
1604
- // will always do unlinking.
1605
- previous_ = current_;
1606
- current_ = this;
1607
1691
  result_ = Handle<Context>::null();
1608
-
1609
1692
  // If V8 isn't running and cannot be initialized, just return.
1610
1693
  if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
1611
1694
 
1612
1695
  // Before creating the roots we must save the context and restore it
1613
1696
  // on all function exits.
1614
1697
  HandleScope scope;
1615
- SaveContext context;
1616
-
1617
- CreateRoots(global_template, global_object);
1618
-
1619
- if (!InstallNatives()) return;
1620
-
1621
- MakeFunctionInstancePrototypeWritable();
1622
- BuildSpecialFunctionTable();
1623
-
1624
- if (!ConfigureGlobalObjects(global_template)) return;
1625
-
1626
- if (!InstallExtensions(extensions)) return;
1627
-
1628
- if (!InstallSpecialObjects()) return;
1698
+ SaveContext saved_context;
1699
+
1700
+ Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
1701
+ if (!new_context.is_null()) {
1702
+ global_context_ =
1703
+ Handle<Context>::cast(GlobalHandles::Create(*new_context));
1704
+ Top::set_context(*global_context_);
1705
+ i::Counters::contexts_created_by_snapshot.Increment();
1706
+ result_ = global_context_;
1707
+ JSFunction* empty_function =
1708
+ JSFunction::cast(result_->function_map()->prototype());
1709
+ empty_function_ = Handle<JSFunction>(empty_function);
1710
+ Handle<GlobalObject> inner_global;
1711
+ Handle<JSGlobalProxy> global_proxy =
1712
+ CreateNewGlobals(global_template,
1713
+ global_object,
1714
+ &inner_global);
1715
+
1716
+ HookUpGlobalProxy(inner_global, global_proxy);
1717
+ HookUpInnerGlobal(inner_global);
1718
+
1719
+ if (!ConfigureGlobalObjects(global_template)) return;
1720
+ } else {
1721
+ // We get here if there was no context snapshot.
1722
+ CreateRoots();
1723
+ Handle<JSFunction> empty_function = CreateEmptyFunction();
1724
+ Handle<GlobalObject> inner_global;
1725
+ Handle<JSGlobalProxy> global_proxy =
1726
+ CreateNewGlobals(global_template, global_object, &inner_global);
1727
+ HookUpGlobalProxy(inner_global, global_proxy);
1728
+ InitializeGlobal(inner_global, empty_function);
1729
+ if (!InstallNatives()) return;
1730
+ InstallJSFunctionResultCaches();
1731
+
1732
+ MakeFunctionInstancePrototypeWritable();
1733
+
1734
+ if (!ConfigureGlobalObjects(global_template)) return;
1735
+ i::Counters::contexts_created_from_scratch.Increment();
1736
+ }
1629
1737
 
1630
1738
  result_ = global_context_;
1631
1739
  }
@@ -1635,46 +1743,46 @@ Genesis::Genesis(Handle<Object> global_object,
1635
1743
 
1636
1744
  // Reserve space for statics needing saving and restoring.
1637
1745
  int Bootstrapper::ArchiveSpacePerThread() {
1638
- return Genesis::ArchiveSpacePerThread();
1746
+ return BootstrapperActive::ArchiveSpacePerThread();
1639
1747
  }
1640
1748
 
1641
1749
 
1642
1750
  // Archive statics that are thread local.
1643
1751
  char* Bootstrapper::ArchiveState(char* to) {
1644
- return Genesis::ArchiveState(to);
1752
+ return BootstrapperActive::ArchiveState(to);
1645
1753
  }
1646
1754
 
1647
1755
 
1648
1756
  // Restore statics that are thread local.
1649
1757
  char* Bootstrapper::RestoreState(char* from) {
1650
- return Genesis::RestoreState(from);
1758
+ return BootstrapperActive::RestoreState(from);
1651
1759
  }
1652
1760
 
1653
1761
 
1654
1762
  // Called when the top-level V8 mutex is destroyed.
1655
1763
  void Bootstrapper::FreeThreadResources() {
1656
- ASSERT(Genesis::current() == NULL);
1764
+ ASSERT(!BootstrapperActive::IsActive());
1657
1765
  }
1658
1766
 
1659
1767
 
1660
1768
  // Reserve space for statics needing saving and restoring.
1661
- int Genesis::ArchiveSpacePerThread() {
1662
- return sizeof(current_);
1769
+ int BootstrapperActive::ArchiveSpacePerThread() {
1770
+ return sizeof(nesting_);
1663
1771
  }
1664
1772
 
1665
1773
 
1666
1774
  // Archive statics that are thread local.
1667
- char* Genesis::ArchiveState(char* to) {
1668
- *reinterpret_cast<Genesis**>(to) = current_;
1669
- current_ = NULL;
1670
- return to + sizeof(current_);
1775
+ char* BootstrapperActive::ArchiveState(char* to) {
1776
+ *reinterpret_cast<int*>(to) = nesting_;
1777
+ nesting_ = 0;
1778
+ return to + sizeof(nesting_);
1671
1779
  }
1672
1780
 
1673
1781
 
1674
1782
  // Restore statics that are thread local.
1675
- char* Genesis::RestoreState(char* from) {
1676
- current_ = *reinterpret_cast<Genesis**>(from);
1677
- return from + sizeof(current_);
1783
+ char* BootstrapperActive::RestoreState(char* from) {
1784
+ nesting_ = *reinterpret_cast<int*>(from);
1785
+ return from + sizeof(nesting_);
1678
1786
  }
1679
1787
 
1680
1788
  } } // namespace v8::internal