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
@@ -133,7 +133,8 @@ Object* Heap::AllocateRawMap() {
133
133
  #ifdef DEBUG
134
134
  if (!result->IsFailure()) {
135
135
  // Maps have their own alignment.
136
- CHECK((OffsetFrom(result) & kMapAlignmentMask) == kHeapObjectTag);
136
+ CHECK((reinterpret_cast<intptr_t>(result) & kMapAlignmentMask) ==
137
+ static_cast<intptr_t>(kHeapObjectTag));
137
138
  }
138
139
  #endif
139
140
  return result;
@@ -152,7 +153,11 @@ Object* Heap::AllocateRawCell() {
152
153
 
153
154
 
154
155
  bool Heap::InNewSpace(Object* object) {
155
- return new_space_.Contains(object);
156
+ bool result = new_space_.Contains(object);
157
+ ASSERT(!result || // Either not in new space
158
+ gc_state_ != NOT_IN_GC || // ... or in the middle of GC
159
+ InToSpace(object)); // ... or in to-space (where we allocate).
160
+ return result;
156
161
  }
157
162
 
158
163
 
@@ -183,6 +188,18 @@ void Heap::RecordWrite(Address address, int offset) {
183
188
  }
184
189
 
185
190
 
191
+ void Heap::RecordWrites(Address address, int start, int len) {
192
+ if (new_space_.Contains(address)) return;
193
+ ASSERT(!new_space_.FromSpaceContains(address));
194
+ for (int offset = start;
195
+ offset < start + len * kPointerSize;
196
+ offset += kPointerSize) {
197
+ SLOW_ASSERT(Contains(address + offset));
198
+ Page::SetRSet(address, offset);
199
+ }
200
+ }
201
+
202
+
186
203
  OldSpace* Heap::TargetSpace(HeapObject* object) {
187
204
  InstanceType type = object->map()->instance_type();
188
205
  AllocationSpace space = TargetSpaceId(type);
@@ -219,19 +236,27 @@ AllocationSpace Heap::TargetSpaceId(InstanceType type) {
219
236
 
220
237
  void Heap::CopyBlock(Object** dst, Object** src, int byte_size) {
221
238
  ASSERT(IsAligned(byte_size, kPointerSize));
239
+ CopyWords(dst, src, byte_size / kPointerSize);
240
+ }
222
241
 
223
- // Use block copying memcpy if the segment we're copying is
224
- // enough to justify the extra call/setup overhead.
225
- static const int kBlockCopyLimit = 16 * kPointerSize;
226
242
 
227
- if (byte_size >= kBlockCopyLimit) {
228
- memcpy(dst, src, byte_size);
229
- } else {
230
- int remaining = byte_size / kPointerSize;
231
- do {
232
- remaining--;
243
+ void Heap::MoveBlock(Object** dst, Object** src, int byte_size) {
244
+ ASSERT(IsAligned(byte_size, kPointerSize));
245
+
246
+ int size_in_words = byte_size / kPointerSize;
247
+
248
+ if ((dst < src) || (dst >= (src + size_in_words))) {
249
+ ASSERT((dst >= (src + size_in_words)) ||
250
+ ((OffsetFrom(reinterpret_cast<Address>(src)) -
251
+ OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize));
252
+
253
+ Object** end = src + size_in_words;
254
+
255
+ while (src != end) {
233
256
  *dst++ = *src++;
234
- } while (remaining > 0);
257
+ }
258
+ } else {
259
+ memmove(dst, src, byte_size);
235
260
  }
236
261
  }
237
262
 
@@ -257,6 +282,25 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
257
282
  }
258
283
 
259
284
 
285
+ Object* Heap::PrepareForCompare(String* str) {
286
+ // Always flatten small strings and force flattening of long strings
287
+ // after we have accumulated a certain amount we failed to flatten.
288
+ static const int kMaxAlwaysFlattenLength = 32;
289
+ static const int kFlattenLongThreshold = 16*KB;
290
+
291
+ const int length = str->length();
292
+ Object* obj = str->TryFlatten();
293
+ if (length <= kMaxAlwaysFlattenLength ||
294
+ unflattened_strings_length_ >= kFlattenLongThreshold) {
295
+ return obj;
296
+ }
297
+ if (obj->IsFailure()) {
298
+ unflattened_strings_length_ += length;
299
+ }
300
+ return str;
301
+ }
302
+
303
+
260
304
  int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
261
305
  ASSERT(HasBeenSetup());
262
306
  int amount = amount_of_external_allocated_memory_ + change_in_bytes;
@@ -31,6 +31,7 @@
31
31
  #include "frames-inl.h"
32
32
  #include "global-handles.h"
33
33
  #include "string-stream.h"
34
+ #include "zone-inl.h"
34
35
 
35
36
  namespace v8 {
36
37
  namespace internal {
@@ -625,8 +626,7 @@ void HeapProfiler::WriteSample() {
625
626
  ConstructorHeapProfile js_cons_profile;
626
627
  RetainerHeapProfile js_retainer_profile;
627
628
  HeapIterator iterator;
628
- while (iterator.has_next()) {
629
- HeapObject* obj = iterator.next();
629
+ for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
630
630
  CollectStats(obj, info);
631
631
  js_cons_profile.CollectStats(obj);
632
632
  js_retainer_profile.CollectStats(obj);
@@ -28,6 +28,8 @@
28
28
  #ifndef V8_HEAP_PROFILER_H_
29
29
  #define V8_HEAP_PROFILER_H_
30
30
 
31
+ #include "zone.h"
32
+
31
33
  namespace v8 {
32
34
  namespace internal {
33
35
 
@@ -41,11 +41,12 @@
41
41
  #include "scopeinfo.h"
42
42
  #include "snapshot.h"
43
43
  #include "v8threads.h"
44
- #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
44
+ #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP
45
45
  #include "regexp-macro-assembler.h"
46
46
  #include "arm/regexp-macro-assembler-arm.h"
47
47
  #endif
48
48
 
49
+
49
50
  namespace v8 {
50
51
  namespace internal {
51
52
 
@@ -76,8 +77,8 @@ int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0;
76
77
  // semispace_size_ should be a power of 2 and old_generation_size_ should be
77
78
  // a multiple of Page::kPageSize.
78
79
  #if defined(ANDROID)
79
- int Heap::max_semispace_size_ = 512*KB;
80
- int Heap::max_old_generation_size_ = 128*MB;
80
+ int Heap::max_semispace_size_ = 2*MB;
81
+ int Heap::max_old_generation_size_ = 192*MB;
81
82
  int Heap::initial_semispace_size_ = 128*KB;
82
83
  size_t Heap::code_range_size_ = 0;
83
84
  #elif defined(V8_TARGET_ARCH_X64)
@@ -97,6 +98,9 @@ size_t Heap::code_range_size_ = 0;
97
98
  // set up by ConfigureHeap otherwise.
98
99
  int Heap::reserved_semispace_size_ = Heap::max_semispace_size_;
99
100
 
101
+ List<Heap::GCPrologueCallbackPair> Heap::gc_prologue_callbacks_;
102
+ List<Heap::GCEpilogueCallbackPair> Heap::gc_epilogue_callbacks_;
103
+
100
104
  GCCallback Heap::global_gc_prologue_callback_ = NULL;
101
105
  GCCallback Heap::global_gc_epilogue_callback_ = NULL;
102
106
 
@@ -113,9 +117,11 @@ Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
113
117
  int Heap::mc_count_ = 0;
114
118
  int Heap::gc_count_ = 0;
115
119
 
120
+ int Heap::unflattened_strings_length_ = 0;
121
+
116
122
  int Heap::always_allocate_scope_depth_ = 0;
117
123
  int Heap::linear_allocation_scope_depth_ = 0;
118
- bool Heap::context_disposed_pending_ = false;
124
+ int Heap::contexts_disposed_ = 0;
119
125
 
120
126
  #ifdef DEBUG
121
127
  bool Heap::allocation_allowed_ = true;
@@ -300,7 +306,9 @@ void Heap::ReportStatisticsAfterGC() {
300
306
 
301
307
  void Heap::GarbageCollectionPrologue() {
302
308
  TranscendentalCache::Clear();
309
+ ClearJSFunctionResultCaches();
303
310
  gc_count_++;
311
+ unflattened_strings_length_ = 0;
304
312
  #ifdef DEBUG
305
313
  ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
306
314
  allow_allocation(false);
@@ -327,7 +335,7 @@ void Heap::GarbageCollectionPrologue() {
327
335
  int Heap::SizeOfObjects() {
328
336
  int total = 0;
329
337
  AllSpaces spaces;
330
- while (Space* space = spaces.next()) {
338
+ for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
331
339
  total += space->Size();
332
340
  }
333
341
  return total;
@@ -371,24 +379,6 @@ void Heap::CollectAllGarbage(bool force_compaction) {
371
379
  }
372
380
 
373
381
 
374
- void Heap::CollectAllGarbageIfContextDisposed() {
375
- // If the garbage collector interface is exposed through the global
376
- // gc() function, we avoid being clever about forcing GCs when
377
- // contexts are disposed and leave it to the embedder to make
378
- // informed decisions about when to force a collection.
379
- if (!FLAG_expose_gc && context_disposed_pending_) {
380
- HistogramTimerScope scope(&Counters::gc_context);
381
- CollectAllGarbage(false);
382
- }
383
- context_disposed_pending_ = false;
384
- }
385
-
386
-
387
- void Heap::NotifyContextDisposed() {
388
- context_disposed_pending_ = true;
389
- }
390
-
391
-
392
382
  bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
393
383
  // The VM is in the GC state until exiting this function.
394
384
  VMState state(GC);
@@ -552,16 +542,51 @@ void Heap::EnsureFromSpaceIsCommitted() {
552
542
  }
553
543
 
554
544
 
545
+ class ClearThreadJSFunctionResultCachesVisitor: public ThreadVisitor {
546
+ virtual void VisitThread(ThreadLocalTop* top) {
547
+ Context* context = top->context_;
548
+ if (context == NULL) return;
549
+
550
+ FixedArray* caches =
551
+ context->global()->global_context()->jsfunction_result_caches();
552
+ int length = caches->length();
553
+ for (int i = 0; i < length; i++) {
554
+ JSFunctionResultCache::cast(caches->get(i))->Clear();
555
+ }
556
+ }
557
+ };
558
+
559
+
560
+ void Heap::ClearJSFunctionResultCaches() {
561
+ if (Bootstrapper::IsActive()) return;
562
+ ClearThreadJSFunctionResultCachesVisitor visitor;
563
+ ThreadManager::IterateThreads(&visitor);
564
+ }
565
+
566
+
555
567
  void Heap::PerformGarbageCollection(AllocationSpace space,
556
568
  GarbageCollector collector,
557
569
  GCTracer* tracer) {
558
570
  VerifySymbolTable();
559
571
  if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
560
572
  ASSERT(!allocation_allowed_);
573
+ GCTracer::ExternalScope scope(tracer);
561
574
  global_gc_prologue_callback_();
562
575
  }
576
+
577
+ GCType gc_type =
578
+ collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge;
579
+
580
+ for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) {
581
+ if (gc_type & gc_prologue_callbacks_[i].gc_type) {
582
+ gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags);
583
+ }
584
+ }
585
+
563
586
  EnsureFromSpaceIsCommitted();
587
+
564
588
  if (collector == MARK_COMPACTOR) {
589
+ // Perform mark-sweep with optional compaction.
565
590
  MarkCompact(tracer);
566
591
 
567
592
  int old_gen_size = PromotedSpaceSize();
@@ -570,13 +595,15 @@ void Heap::PerformGarbageCollection(AllocationSpace space,
570
595
  old_gen_allocation_limit_ =
571
596
  old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2);
572
597
  old_gen_exhausted_ = false;
598
+ } else {
599
+ Scavenge();
573
600
  }
574
- Scavenge();
575
601
 
576
602
  Counters::objs_since_last_young.Set(0);
577
603
 
578
604
  if (collector == MARK_COMPACTOR) {
579
605
  DisableAssertNoAllocation allow_allocation;
606
+ GCTracer::ExternalScope scope(tracer);
580
607
  GlobalHandles::PostGarbageCollectionProcessing();
581
608
  }
582
609
 
@@ -589,8 +616,18 @@ void Heap::PerformGarbageCollection(AllocationSpace space,
589
616
  amount_of_external_allocated_memory_;
590
617
  }
591
618
 
619
+ GCCallbackFlags callback_flags = tracer->is_compacting()
620
+ ? kGCCallbackFlagCompacted
621
+ : kNoGCCallbackFlags;
622
+ for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) {
623
+ if (gc_type & gc_epilogue_callbacks_[i].gc_type) {
624
+ gc_epilogue_callbacks_[i].callback(gc_type, callback_flags);
625
+ }
626
+ }
627
+
592
628
  if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) {
593
629
  ASSERT(!allocation_allowed_);
630
+ GCTracer::ExternalScope scope(tracer);
594
631
  global_gc_epilogue_callback_();
595
632
  }
596
633
  VerifySymbolTable();
@@ -620,7 +657,8 @@ void Heap::MarkCompact(GCTracer* tracer) {
620
657
  Shrink();
621
658
 
622
659
  Counters::objs_since_last_full.Set(0);
623
- context_disposed_pending_ = false;
660
+
661
+ contexts_disposed_ = 0;
624
662
  }
625
663
 
626
664
 
@@ -732,17 +770,29 @@ static void VerifyNonPointerSpacePointers() {
732
770
  // do not expect them.
733
771
  VerifyNonPointerSpacePointersVisitor v;
734
772
  HeapObjectIterator code_it(Heap::code_space());
735
- while (code_it.has_next()) {
736
- HeapObject* object = code_it.next();
773
+ for (HeapObject* object = code_it.next();
774
+ object != NULL; object = code_it.next())
737
775
  object->Iterate(&v);
738
- }
739
776
 
740
777
  HeapObjectIterator data_it(Heap::old_data_space());
741
- while (data_it.has_next()) data_it.next()->Iterate(&v);
778
+ for (HeapObject* object = data_it.next();
779
+ object != NULL; object = data_it.next())
780
+ object->Iterate(&v);
742
781
  }
743
782
  #endif
744
783
 
745
784
 
785
+ void Heap::CheckNewSpaceExpansionCriteria() {
786
+ if (new_space_.Capacity() < new_space_.MaximumCapacity() &&
787
+ survived_since_last_expansion_ > new_space_.Capacity()) {
788
+ // Grow the size of new space if there is room to grow and enough
789
+ // data has survived scavenge since the last expansion.
790
+ new_space_.Grow();
791
+ survived_since_last_expansion_ = 0;
792
+ }
793
+ }
794
+
795
+
746
796
  void Heap::Scavenge() {
747
797
  #ifdef DEBUG
748
798
  if (FLAG_enable_slow_asserts) VerifyNonPointerSpacePointers();
@@ -759,13 +809,7 @@ void Heap::Scavenge() {
759
809
  // Used for updating survived_since_last_expansion_ at function end.
760
810
  int survived_watermark = PromotedSpaceSize();
761
811
 
762
- if (new_space_.Capacity() < new_space_.MaximumCapacity() &&
763
- survived_since_last_expansion_ > new_space_.Capacity()) {
764
- // Grow the size of new space if there is room to grow and enough
765
- // data has survived scavenge since the last expansion.
766
- new_space_.Grow();
767
- survived_since_last_expansion_ = 0;
768
- }
812
+ CheckNewSpaceExpansionCriteria();
769
813
 
770
814
  // Flip the semispaces. After flipping, to space is empty, from space has
771
815
  // live objects.
@@ -804,8 +848,8 @@ void Heap::Scavenge() {
804
848
 
805
849
  // Copy objects reachable from cells by scavenging cell values directly.
806
850
  HeapObjectIterator cell_iterator(cell_space_);
807
- while (cell_iterator.has_next()) {
808
- HeapObject* cell = cell_iterator.next();
851
+ for (HeapObject* cell = cell_iterator.next();
852
+ cell != NULL; cell = cell_iterator.next()) {
809
853
  if (cell->IsJSGlobalPropertyCell()) {
810
854
  Address value_address =
811
855
  reinterpret_cast<Address>(cell) +
@@ -816,15 +860,17 @@ void Heap::Scavenge() {
816
860
 
817
861
  new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
818
862
 
819
- ScavengeExternalStringTable();
863
+ UpdateNewSpaceReferencesInExternalStringTable(
864
+ &UpdateNewSpaceReferenceInExternalStringTableEntry);
865
+
820
866
  ASSERT(new_space_front == new_space_.top());
821
867
 
822
868
  // Set age mark.
823
869
  new_space_.set_age_mark(new_space_.top());
824
870
 
825
871
  // Update how much has survived scavenge.
826
- survived_since_last_expansion_ +=
827
- (PromotedSpaceSize() - survived_watermark) + new_space_.Size();
872
+ IncrementYoungSurvivorsCounter(
873
+ (PromotedSpaceSize() - survived_watermark) + new_space_.Size());
828
874
 
829
875
  LOG(ResourceEvent("scavenge", "end"));
830
876
 
@@ -832,7 +878,22 @@ void Heap::Scavenge() {
832
878
  }
833
879
 
834
880
 
835
- void Heap::ScavengeExternalStringTable() {
881
+ String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Object** p) {
882
+ MapWord first_word = HeapObject::cast(*p)->map_word();
883
+
884
+ if (!first_word.IsForwardingAddress()) {
885
+ // Unreachable external string can be finalized.
886
+ FinalizeExternalString(String::cast(*p));
887
+ return NULL;
888
+ }
889
+
890
+ // String is still reachable.
891
+ return String::cast(first_word.ToForwardingAddress());
892
+ }
893
+
894
+
895
+ void Heap::UpdateNewSpaceReferencesInExternalStringTable(
896
+ ExternalStringTableUpdaterCallback updater_func) {
836
897
  ExternalStringTable::Verify();
837
898
 
838
899
  if (ExternalStringTable::new_space_strings_.is_empty()) return;
@@ -843,16 +904,10 @@ void Heap::ScavengeExternalStringTable() {
843
904
 
844
905
  for (Object** p = start; p < end; ++p) {
845
906
  ASSERT(Heap::InFromSpace(*p));
846
- MapWord first_word = HeapObject::cast(*p)->map_word();
907
+ String* target = updater_func(p);
847
908
 
848
- if (!first_word.IsForwardingAddress()) {
849
- // Unreachable external string can be finalized.
850
- FinalizeExternalString(String::cast(*p));
851
- continue;
852
- }
909
+ if (target == NULL) continue;
853
910
 
854
- // String is still reachable.
855
- String* target = String::cast(first_word.ToForwardingAddress());
856
911
  ASSERT(target->IsExternalString());
857
912
 
858
913
  if (Heap::InNewSpace(target)) {
@@ -1013,13 +1068,15 @@ void Heap::RebuildRSets() {
1013
1068
 
1014
1069
  void Heap::RebuildRSets(PagedSpace* space) {
1015
1070
  HeapObjectIterator it(space);
1016
- while (it.has_next()) Heap::UpdateRSet(it.next());
1071
+ for (HeapObject* obj = it.next(); obj != NULL; obj = it.next())
1072
+ Heap::UpdateRSet(obj);
1017
1073
  }
1018
1074
 
1019
1075
 
1020
1076
  void Heap::RebuildRSets(LargeObjectSpace* space) {
1021
1077
  LargeObjectIterator it(space);
1022
- while (it.has_next()) Heap::UpdateRSet(it.next());
1078
+ for (HeapObject* obj = it.next(); obj != NULL; obj = it.next())
1079
+ Heap::UpdateRSet(obj);
1023
1080
  }
1024
1081
 
1025
1082
 
@@ -1182,7 +1239,10 @@ Object* Heap::AllocatePartialMap(InstanceType instance_type,
1182
1239
  reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
1183
1240
  reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
1184
1241
  reinterpret_cast<Map*>(result)->set_inobject_properties(0);
1242
+ reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0);
1185
1243
  reinterpret_cast<Map*>(result)->set_unused_property_fields(0);
1244
+ reinterpret_cast<Map*>(result)->set_bit_field(0);
1245
+ reinterpret_cast<Map*>(result)->set_bit_field2(0);
1186
1246
  return result;
1187
1247
  }
1188
1248
 
@@ -1203,7 +1263,7 @@ Object* Heap::AllocateMap(InstanceType instance_type, int instance_size) {
1203
1263
  map->set_code_cache(empty_fixed_array());
1204
1264
  map->set_unused_property_fields(0);
1205
1265
  map->set_bit_field(0);
1206
- map->set_bit_field2(0);
1266
+ map->set_bit_field2(1 << Map::kIsExtensible);
1207
1267
 
1208
1268
  // If the map object is aligned fill the padding area with Smi 0 objects.
1209
1269
  if (Map::kPadStart < Map::kSize) {
@@ -1215,6 +1275,16 @@ Object* Heap::AllocateMap(InstanceType instance_type, int instance_size) {
1215
1275
  }
1216
1276
 
1217
1277
 
1278
+ Object* Heap::AllocateCodeCache() {
1279
+ Object* result = AllocateStruct(CODE_CACHE_TYPE);
1280
+ if (result->IsFailure()) return result;
1281
+ CodeCache* code_cache = CodeCache::cast(result);
1282
+ code_cache->set_default_cache(empty_fixed_array());
1283
+ code_cache->set_normal_type_cache(undefined_value());
1284
+ return code_cache;
1285
+ }
1286
+
1287
+
1218
1288
  const Heap::StringTypeTable Heap::string_type_table[] = {
1219
1289
  #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \
1220
1290
  {type, size, k##camel_name##MapRootIndex},
@@ -1255,7 +1325,7 @@ bool Heap::CreateInitialMaps() {
1255
1325
  if (obj->IsFailure()) return false;
1256
1326
  set_oddball_map(Map::cast(obj));
1257
1327
 
1258
- // Allocate the empty array
1328
+ // Allocate the empty array.
1259
1329
  obj = AllocateEmptyFixedArray();
1260
1330
  if (obj->IsFailure()) return false;
1261
1331
  set_empty_fixed_array(FixedArray::cast(obj));
@@ -1397,11 +1467,8 @@ bool Heap::CreateInitialMaps() {
1397
1467
  if (obj->IsFailure()) return false;
1398
1468
  set_global_context_map(Map::cast(obj));
1399
1469
 
1400
- obj = AllocateMap(JS_FUNCTION_TYPE, JSFunction::kSize);
1401
- if (obj->IsFailure()) return false;
1402
- set_boilerplate_function_map(Map::cast(obj));
1403
-
1404
- obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, SharedFunctionInfo::kSize);
1470
+ obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
1471
+ SharedFunctionInfo::kAlignedSize);
1405
1472
  if (obj->IsFailure()) return false;
1406
1473
  set_shared_function_info_map(Map::cast(obj));
1407
1474
 
@@ -1450,10 +1517,9 @@ Object* Heap::AllocateJSGlobalPropertyCell(Object* value) {
1450
1517
  }
1451
1518
 
1452
1519
 
1453
- Object* Heap::CreateOddball(Map* map,
1454
- const char* to_string,
1520
+ Object* Heap::CreateOddball(const char* to_string,
1455
1521
  Object* to_number) {
1456
- Object* result = Allocate(map, OLD_DATA_SPACE);
1522
+ Object* result = Allocate(oddball_map(), OLD_DATA_SPACE);
1457
1523
  if (result->IsFailure()) return result;
1458
1524
  return Oddball::cast(result)->Initialize(to_string, to_number);
1459
1525
  }
@@ -1484,7 +1550,7 @@ void Heap::CreateCEntryStub() {
1484
1550
  }
1485
1551
 
1486
1552
 
1487
- #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
1553
+ #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP
1488
1554
  void Heap::CreateRegExpCEntryStub() {
1489
1555
  RegExpCEntryStub stub;
1490
1556
  set_re_c_entry_code(*stub.GetCode());
@@ -1492,12 +1558,6 @@ void Heap::CreateRegExpCEntryStub() {
1492
1558
  #endif
1493
1559
 
1494
1560
 
1495
- void Heap::CreateCEntryDebugBreakStub() {
1496
- CEntryDebugBreakStub stub;
1497
- set_c_entry_debug_break_code(*stub.GetCode());
1498
- }
1499
-
1500
-
1501
1561
  void Heap::CreateJSEntryStub() {
1502
1562
  JSEntryStub stub;
1503
1563
  set_js_entry_code(*stub.GetCode());
@@ -1520,15 +1580,14 @@ void Heap::CreateFixedStubs() {
1520
1580
  // { CEntryStub stub;
1521
1581
  // c_entry_code_ = *stub.GetCode();
1522
1582
  // }
1523
- // { CEntryDebugBreakStub stub;
1524
- // c_entry_debug_break_code_ = *stub.GetCode();
1583
+ // { DebuggerStatementStub stub;
1584
+ // debugger_statement_code_ = *stub.GetCode();
1525
1585
  // }
1526
1586
  // To workaround the problem, make separate functions without inlining.
1527
1587
  Heap::CreateCEntryStub();
1528
- Heap::CreateCEntryDebugBreakStub();
1529
1588
  Heap::CreateJSEntryStub();
1530
1589
  Heap::CreateJSConstructEntryStub();
1531
- #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
1590
+ #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP
1532
1591
  Heap::CreateRegExpCEntryStub();
1533
1592
  #endif
1534
1593
  }
@@ -1564,34 +1623,27 @@ bool Heap::CreateInitialObjects() {
1564
1623
  Oddball::cast(undefined_value())->set_to_string(String::cast(symbol));
1565
1624
  Oddball::cast(undefined_value())->set_to_number(nan_value());
1566
1625
 
1567
- // Assign the print strings for oddballs after creating symboltable.
1568
- symbol = LookupAsciiSymbol("null");
1569
- if (symbol->IsFailure()) return false;
1570
- Oddball::cast(null_value())->set_to_string(String::cast(symbol));
1571
- Oddball::cast(null_value())->set_to_number(Smi::FromInt(0));
1572
-
1573
1626
  // Allocate the null_value
1574
1627
  obj = Oddball::cast(null_value())->Initialize("null", Smi::FromInt(0));
1575
1628
  if (obj->IsFailure()) return false;
1576
1629
 
1577
- obj = CreateOddball(oddball_map(), "true", Smi::FromInt(1));
1630
+ obj = CreateOddball("true", Smi::FromInt(1));
1578
1631
  if (obj->IsFailure()) return false;
1579
1632
  set_true_value(obj);
1580
1633
 
1581
- obj = CreateOddball(oddball_map(), "false", Smi::FromInt(0));
1634
+ obj = CreateOddball("false", Smi::FromInt(0));
1582
1635
  if (obj->IsFailure()) return false;
1583
1636
  set_false_value(obj);
1584
1637
 
1585
- obj = CreateOddball(oddball_map(), "hole", Smi::FromInt(-1));
1638
+ obj = CreateOddball("hole", Smi::FromInt(-1));
1586
1639
  if (obj->IsFailure()) return false;
1587
1640
  set_the_hole_value(obj);
1588
1641
 
1589
- obj = CreateOddball(
1590
- oddball_map(), "no_interceptor_result_sentinel", Smi::FromInt(-2));
1642
+ obj = CreateOddball("no_interceptor_result_sentinel", Smi::FromInt(-2));
1591
1643
  if (obj->IsFailure()) return false;
1592
1644
  set_no_interceptor_result_sentinel(obj);
1593
1645
 
1594
- obj = CreateOddball(oddball_map(), "termination_exception", Smi::FromInt(-3));
1646
+ obj = CreateOddball("termination_exception", Smi::FromInt(-3));
1595
1647
  if (obj->IsFailure()) return false;
1596
1648
  set_termination_exception(obj);
1597
1649
 
@@ -1637,8 +1689,8 @@ bool Heap::CreateInitialObjects() {
1637
1689
 
1638
1690
  if (InitializeNumberStringCache()->IsFailure()) return false;
1639
1691
 
1640
- // Allocate cache for single character strings.
1641
- obj = AllocateFixedArray(String::kMaxAsciiCharCode+1);
1692
+ // Allocate cache for single character ASCII strings.
1693
+ obj = AllocateFixedArray(String::kMaxAsciiCharCode + 1, TENURED);
1642
1694
  if (obj->IsFailure()) return false;
1643
1695
  set_single_character_string_cache(FixedArray::cast(obj));
1644
1696
 
@@ -1672,7 +1724,7 @@ Object* Heap::InitializeNumberStringCache() {
1672
1724
  // max_semispace_size_ == 8 MB => number_string_cache_size = 16KB.
1673
1725
  int number_string_cache_size = max_semispace_size_ / 512;
1674
1726
  number_string_cache_size = Max(32, Min(16*KB, number_string_cache_size));
1675
- Object* obj = AllocateFixedArray(number_string_cache_size * 2);
1727
+ Object* obj = AllocateFixedArray(number_string_cache_size * 2, TENURED);
1676
1728
  if (!obj->IsFailure()) set_number_string_cache(FixedArray::cast(obj));
1677
1729
  return obj;
1678
1730
  }
@@ -1723,7 +1775,7 @@ void Heap::SetNumberStringCache(Object* number, String* string) {
1723
1775
  int mask = (number_string_cache()->length() >> 1) - 1;
1724
1776
  if (number->IsSmi()) {
1725
1777
  hash = smi_get_hash(Smi::cast(number)) & mask;
1726
- number_string_cache()->set(hash * 2, number, SKIP_WRITE_BARRIER);
1778
+ number_string_cache()->set(hash * 2, Smi::cast(number));
1727
1779
  } else {
1728
1780
  hash = double_get_hash(number->Number()) & mask;
1729
1781
  number_string_cache()->set(hash * 2, number);
@@ -1732,45 +1784,13 @@ void Heap::SetNumberStringCache(Object* number, String* string) {
1732
1784
  }
1733
1785
 
1734
1786
 
1735
- Object* Heap::SmiOrNumberFromDouble(double value,
1736
- bool new_object,
1737
- PretenureFlag pretenure) {
1738
- // We need to distinguish the minus zero value and this cannot be
1739
- // done after conversion to int. Doing this by comparing bit
1740
- // patterns is faster than using fpclassify() et al.
1741
- static const DoubleRepresentation plus_zero(0.0);
1742
- static const DoubleRepresentation minus_zero(-0.0);
1743
- static const DoubleRepresentation nan(OS::nan_value());
1744
- ASSERT(minus_zero_value() != NULL);
1745
- ASSERT(sizeof(plus_zero.value) == sizeof(plus_zero.bits));
1746
-
1747
- DoubleRepresentation rep(value);
1748
- if (rep.bits == plus_zero.bits) return Smi::FromInt(0); // not uncommon
1749
- if (rep.bits == minus_zero.bits) {
1750
- return new_object ? AllocateHeapNumber(-0.0, pretenure)
1751
- : minus_zero_value();
1752
- }
1753
- if (rep.bits == nan.bits) {
1754
- return new_object
1755
- ? AllocateHeapNumber(OS::nan_value(), pretenure)
1756
- : nan_value();
1757
- }
1758
-
1759
- // Try to represent the value as a tagged small integer.
1760
- int int_value = FastD2I(value);
1761
- if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
1762
- return Smi::FromInt(int_value);
1763
- }
1764
-
1765
- // Materialize the value in the heap.
1766
- return AllocateHeapNumber(value, pretenure);
1767
- }
1768
-
1769
-
1770
- Object* Heap::NumberToString(Object* number) {
1771
- Object* cached = GetNumberStringCache(number);
1772
- if (cached != undefined_value()) {
1773
- return cached;
1787
+ Object* Heap::NumberToString(Object* number, bool check_number_string_cache) {
1788
+ Counters::number_to_string_runtime.Increment();
1789
+ if (check_number_string_cache) {
1790
+ Object* cached = GetNumberStringCache(number);
1791
+ if (cached != undefined_value()) {
1792
+ return cached;
1793
+ }
1774
1794
  }
1775
1795
 
1776
1796
  char arr[100];
@@ -1821,17 +1841,24 @@ Heap::RootListIndex Heap::RootIndexForExternalArrayType(
1821
1841
  }
1822
1842
 
1823
1843
 
1824
- Object* Heap::NewNumberFromDouble(double value, PretenureFlag pretenure) {
1825
- return SmiOrNumberFromDouble(value,
1826
- true /* number object must be new */,
1827
- pretenure);
1828
- }
1844
+ Object* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
1845
+ // We need to distinguish the minus zero value and this cannot be
1846
+ // done after conversion to int. Doing this by comparing bit
1847
+ // patterns is faster than using fpclassify() et al.
1848
+ static const DoubleRepresentation minus_zero(-0.0);
1829
1849
 
1850
+ DoubleRepresentation rep(value);
1851
+ if (rep.bits == minus_zero.bits) {
1852
+ return AllocateHeapNumber(-0.0, pretenure);
1853
+ }
1830
1854
 
1831
- Object* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
1832
- return SmiOrNumberFromDouble(value,
1833
- false /* use preallocated NaN, -0.0 */,
1834
- pretenure);
1855
+ int int_value = FastD2I(value);
1856
+ if (value == int_value && Smi::IsValid(int_value)) {
1857
+ return Smi::FromInt(int_value);
1858
+ }
1859
+
1860
+ // Materialize the value in the heap.
1861
+ return AllocateHeapNumber(value, pretenure);
1835
1862
  }
1836
1863
 
1837
1864
 
@@ -1930,8 +1957,9 @@ Object* Heap::AllocateConsString(String* first, String* second) {
1930
1957
  return MakeOrFindTwoCharacterString(c1, c2);
1931
1958
  }
1932
1959
 
1933
- bool is_ascii = first->IsAsciiRepresentation()
1934
- && second->IsAsciiRepresentation();
1960
+ bool first_is_ascii = first->IsAsciiRepresentation();
1961
+ bool second_is_ascii = second->IsAsciiRepresentation();
1962
+ bool is_ascii = first_is_ascii && second_is_ascii;
1935
1963
 
1936
1964
  // Make sure that an out of memory exception is thrown if the length
1937
1965
  // of the new cons string is too large.
@@ -1966,6 +1994,25 @@ Object* Heap::AllocateConsString(String* first, String* second) {
1966
1994
  for (int i = 0; i < second_length; i++) *dest++ = src[i];
1967
1995
  return result;
1968
1996
  } else {
1997
+ // For short external two-byte strings we check whether they can
1998
+ // be represented using ascii.
1999
+ if (!first_is_ascii) {
2000
+ first_is_ascii = first->IsExternalTwoByteStringWithAsciiChars();
2001
+ }
2002
+ if (first_is_ascii && !second_is_ascii) {
2003
+ second_is_ascii = second->IsExternalTwoByteStringWithAsciiChars();
2004
+ }
2005
+ if (first_is_ascii && second_is_ascii) {
2006
+ Object* result = AllocateRawAsciiString(length);
2007
+ if (result->IsFailure()) return result;
2008
+ // Copy the characters into the new object.
2009
+ char* dest = SeqAsciiString::cast(result)->GetChars();
2010
+ String::WriteToFlat(first, dest, 0, first_length);
2011
+ String::WriteToFlat(second, dest + first_length, 0, second_length);
2012
+ Counters::string_add_runtime_ext_to_ascii.Increment();
2013
+ return result;
2014
+ }
2015
+
1969
2016
  Object* result = AllocateRawTwoByteString(length);
1970
2017
  if (result->IsFailure()) return result;
1971
2018
  // Copy the characters into the new object.
@@ -1980,8 +2027,10 @@ Object* Heap::AllocateConsString(String* first, String* second) {
1980
2027
 
1981
2028
  Object* result = Allocate(map, NEW_SPACE);
1982
2029
  if (result->IsFailure()) return result;
2030
+
2031
+ AssertNoAllocation no_gc;
1983
2032
  ConsString* cons_string = ConsString::cast(result);
1984
- WriteBarrierMode mode = cons_string->GetWriteBarrierMode();
2033
+ WriteBarrierMode mode = cons_string->GetWriteBarrierMode(no_gc);
1985
2034
  cons_string->set_length(length);
1986
2035
  cons_string->set_hash_field(String::kEmptyHashField);
1987
2036
  cons_string->set_first(first, mode);
@@ -1992,7 +2041,8 @@ Object* Heap::AllocateConsString(String* first, String* second) {
1992
2041
 
1993
2042
  Object* Heap::AllocateSubString(String* buffer,
1994
2043
  int start,
1995
- int end) {
2044
+ int end,
2045
+ PretenureFlag pretenure) {
1996
2046
  int length = end - start;
1997
2047
 
1998
2048
  if (length == 1) {
@@ -2008,16 +2058,13 @@ Object* Heap::AllocateSubString(String* buffer,
2008
2058
  }
2009
2059
 
2010
2060
  // Make an attempt to flatten the buffer to reduce access time.
2011
- if (!buffer->IsFlat()) {
2012
- buffer->TryFlatten();
2013
- }
2061
+ buffer->TryFlatten();
2014
2062
 
2015
2063
  Object* result = buffer->IsAsciiRepresentation()
2016
- ? AllocateRawAsciiString(length)
2017
- : AllocateRawTwoByteString(length);
2064
+ ? AllocateRawAsciiString(length, pretenure )
2065
+ : AllocateRawTwoByteString(length, pretenure);
2018
2066
  if (result->IsFailure()) return result;
2019
2067
  String* string_result = String::cast(result);
2020
-
2021
2068
  // Copy the characters into the new object.
2022
2069
  if (buffer->IsAsciiRepresentation()) {
2023
2070
  ASSERT(string_result->IsAsciiRepresentation());
@@ -2136,9 +2183,11 @@ void Heap::CreateFillerObjectAt(Address addr, int size) {
2136
2183
  if (size == 0) return;
2137
2184
  HeapObject* filler = HeapObject::FromAddress(addr);
2138
2185
  if (size == kPointerSize) {
2139
- filler->set_map(Heap::one_pointer_filler_map());
2186
+ filler->set_map(one_pointer_filler_map());
2187
+ } else if (size == 2 * kPointerSize) {
2188
+ filler->set_map(two_pointer_filler_map());
2140
2189
  } else {
2141
- filler->set_map(Heap::byte_array_map());
2190
+ filler->set_map(byte_array_map());
2142
2191
  ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
2143
2192
  }
2144
2193
  }
@@ -2252,6 +2301,56 @@ Object* Heap::CopyCode(Code* code) {
2252
2301
  }
2253
2302
 
2254
2303
 
2304
+ Object* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
2305
+ int new_body_size = RoundUp(code->instruction_size() + reloc_info.length(),
2306
+ kObjectAlignment);
2307
+
2308
+ int sinfo_size = code->sinfo_size();
2309
+
2310
+ int new_obj_size = Code::SizeFor(new_body_size, sinfo_size);
2311
+
2312
+ Address old_addr = code->address();
2313
+
2314
+ size_t relocation_offset =
2315
+ static_cast<size_t>(code->relocation_start() - old_addr);
2316
+
2317
+ Object* result;
2318
+ if (new_obj_size > MaxObjectSizeInPagedSpace()) {
2319
+ result = lo_space_->AllocateRawCode(new_obj_size);
2320
+ } else {
2321
+ result = code_space_->AllocateRaw(new_obj_size);
2322
+ }
2323
+
2324
+ if (result->IsFailure()) return result;
2325
+
2326
+ // Copy code object.
2327
+ Address new_addr = reinterpret_cast<HeapObject*>(result)->address();
2328
+
2329
+ // Copy header and instructions.
2330
+ memcpy(new_addr, old_addr, relocation_offset);
2331
+
2332
+ // Copy patched rinfo.
2333
+ memcpy(new_addr + relocation_offset,
2334
+ reloc_info.start(),
2335
+ reloc_info.length());
2336
+
2337
+ Code* new_code = Code::cast(result);
2338
+ new_code->set_relocation_size(reloc_info.length());
2339
+
2340
+ // Copy sinfo.
2341
+ memcpy(new_code->sinfo_start(), code->sinfo_start(), code->sinfo_size());
2342
+
2343
+ // Relocate the copy.
2344
+ ASSERT(!CodeRange::exists() || CodeRange::contains(code->address()));
2345
+ new_code->Relocate(new_addr - old_addr);
2346
+
2347
+ #ifdef DEBUG
2348
+ code->Verify();
2349
+ #endif
2350
+ return new_code;
2351
+ }
2352
+
2353
+
2255
2354
  Object* Heap::Allocate(Map* map, AllocationSpace space) {
2256
2355
  ASSERT(gc_state_ == NOT_IN_GC);
2257
2356
  ASSERT(map->instance_type() != MAP_TYPE);
@@ -2279,7 +2378,7 @@ Object* Heap::InitializeFunction(JSFunction* function,
2279
2378
  function->set_shared(shared);
2280
2379
  function->set_prototype_or_initial_map(prototype);
2281
2380
  function->set_context(undefined_value());
2282
- function->set_literals(empty_fixed_array(), SKIP_WRITE_BARRIER);
2381
+ function->set_literals(empty_fixed_array());
2283
2382
  return function;
2284
2383
  }
2285
2384
 
@@ -2381,12 +2480,13 @@ Object* Heap::AllocateInitialMap(JSFunction* fun) {
2381
2480
  map->set_unused_property_fields(in_object_properties);
2382
2481
  map->set_prototype(prototype);
2383
2482
 
2384
- // If the function has only simple this property assignments add field
2385
- // descriptors for these to the initial map as the object cannot be
2386
- // constructed without having these properties.
2483
+ // If the function has only simple this property assignments add
2484
+ // field descriptors for these to the initial map as the object
2485
+ // cannot be constructed without having these properties. Guard by
2486
+ // the inline_new flag so we only change the map if we generate a
2487
+ // specialized construct stub.
2387
2488
  ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields);
2388
- if (fun->shared()->has_only_simple_this_property_assignments() &&
2389
- fun->shared()->this_property_assignments_count() > 0) {
2489
+ if (fun->shared()->CanGenerateInlineConstructor(prototype)) {
2390
2490
  int count = fun->shared()->this_property_assignments_count();
2391
2491
  if (count > in_object_properties) {
2392
2492
  count = in_object_properties;
@@ -2398,8 +2498,10 @@ Object* Heap::AllocateInitialMap(JSFunction* fun) {
2398
2498
  String* name = fun->shared()->GetThisPropertyAssignmentName(i);
2399
2499
  ASSERT(name->IsSymbol());
2400
2500
  FieldDescriptor field(name, i, NONE);
2501
+ field.SetEnumerationIndex(i);
2401
2502
  descriptors->Set(i, &field);
2402
2503
  }
2504
+ descriptors->SetNextEnumerationIndex(count);
2403
2505
  descriptors->Sort();
2404
2506
  map->set_instance_descriptors(descriptors);
2405
2507
  map->set_pre_allocated_property_fields(count);
@@ -2563,11 +2665,9 @@ Object* Heap::CopyJSObject(JSObject* source) {
2563
2665
  reinterpret_cast<Object**>(source->address()),
2564
2666
  object_size);
2565
2667
  // Update write barrier for all fields that lie beyond the header.
2566
- for (int offset = JSObject::kHeaderSize;
2567
- offset < object_size;
2568
- offset += kPointerSize) {
2569
- RecordWrite(clone_address, offset);
2570
- }
2668
+ RecordWrites(clone_address,
2669
+ JSObject::kHeaderSize,
2670
+ (object_size - JSObject::kHeaderSize) / kPointerSize);
2571
2671
  } else {
2572
2672
  clone = new_space_.AllocateRaw(object_size);
2573
2673
  if (clone->IsFailure()) return clone;
@@ -2582,7 +2682,7 @@ Object* Heap::CopyJSObject(JSObject* source) {
2582
2682
  FixedArray* elements = FixedArray::cast(source->elements());
2583
2683
  FixedArray* properties = FixedArray::cast(source->properties());
2584
2684
  // Update elements if necessary.
2585
- if (elements->length()> 0) {
2685
+ if (elements->length() > 0) {
2586
2686
  Object* elem = CopyFixedArray(elements);
2587
2687
  if (elem->IsFailure()) return elem;
2588
2688
  JSObject::cast(clone)->set_elements(FixedArray::cast(elem));
@@ -2880,8 +2980,10 @@ Object* Heap::CopyFixedArray(FixedArray* src) {
2880
2980
  HeapObject::cast(obj)->set_map(src->map());
2881
2981
  FixedArray* result = FixedArray::cast(obj);
2882
2982
  result->set_length(len);
2983
+
2883
2984
  // Copy the content
2884
- WriteBarrierMode mode = result->GetWriteBarrierMode();
2985
+ AssertNoAllocation no_gc;
2986
+ WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
2885
2987
  for (int i = 0; i < len; i++) result->set(i, src->get(i), mode);
2886
2988
  return result;
2887
2989
  }
@@ -2896,23 +2998,18 @@ Object* Heap::AllocateFixedArray(int length) {
2896
2998
  reinterpret_cast<Array*>(result)->set_map(fixed_array_map());
2897
2999
  FixedArray* array = FixedArray::cast(result);
2898
3000
  array->set_length(length);
2899
- Object* value = undefined_value();
2900
3001
  // Initialize body.
2901
- for (int index = 0; index < length; index++) {
2902
- array->set(index, value, SKIP_WRITE_BARRIER);
2903
- }
3002
+ ASSERT(!Heap::InNewSpace(undefined_value()));
3003
+ MemsetPointer(array->data_start(), undefined_value(), length);
2904
3004
  }
2905
3005
  return result;
2906
3006
  }
2907
3007
 
2908
3008
 
2909
- Object* Heap::AllocateFixedArray(int length, PretenureFlag pretenure) {
2910
- ASSERT(length >= 0);
2911
- ASSERT(empty_fixed_array()->IsFixedArray());
3009
+ Object* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) {
2912
3010
  if (length < 0 || length > FixedArray::kMaxLength) {
2913
3011
  return Failure::OutOfMemoryException();
2914
3012
  }
2915
- if (length == 0) return empty_fixed_array();
2916
3013
 
2917
3014
  AllocationSpace space =
2918
3015
  (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE;
@@ -2946,40 +3043,53 @@ Object* Heap::AllocateFixedArray(int length, PretenureFlag pretenure) {
2946
3043
  ASSERT(space == LO_SPACE);
2947
3044
  result = lo_space_->AllocateRawFixedArray(size);
2948
3045
  }
3046
+ return result;
3047
+ }
3048
+
3049
+
3050
+ static Object* AllocateFixedArrayWithFiller(int length,
3051
+ PretenureFlag pretenure,
3052
+ Object* filler) {
3053
+ ASSERT(length >= 0);
3054
+ ASSERT(Heap::empty_fixed_array()->IsFixedArray());
3055
+ if (length == 0) return Heap::empty_fixed_array();
3056
+
3057
+ ASSERT(!Heap::InNewSpace(filler));
3058
+ Object* result = Heap::AllocateRawFixedArray(length, pretenure);
2949
3059
  if (result->IsFailure()) return result;
2950
3060
 
2951
- // Initialize the object.
2952
- reinterpret_cast<Array*>(result)->set_map(fixed_array_map());
3061
+ HeapObject::cast(result)->set_map(Heap::fixed_array_map());
2953
3062
  FixedArray* array = FixedArray::cast(result);
2954
3063
  array->set_length(length);
2955
- Object* value = undefined_value();
2956
- for (int index = 0; index < length; index++) {
2957
- array->set(index, value, SKIP_WRITE_BARRIER);
2958
- }
3064
+ MemsetPointer(array->data_start(), filler, length);
2959
3065
  return array;
2960
3066
  }
2961
3067
 
2962
3068
 
2963
- Object* Heap::AllocateFixedArrayWithHoles(int length) {
3069
+ Object* Heap::AllocateFixedArray(int length, PretenureFlag pretenure) {
3070
+ return AllocateFixedArrayWithFiller(length, pretenure, undefined_value());
3071
+ }
3072
+
3073
+
3074
+ Object* Heap::AllocateFixedArrayWithHoles(int length, PretenureFlag pretenure) {
3075
+ return AllocateFixedArrayWithFiller(length, pretenure, the_hole_value());
3076
+ }
3077
+
3078
+
3079
+ Object* Heap::AllocateUninitializedFixedArray(int length) {
2964
3080
  if (length == 0) return empty_fixed_array();
2965
- Object* result = AllocateRawFixedArray(length);
2966
- if (!result->IsFailure()) {
2967
- // Initialize header.
2968
- reinterpret_cast<Array*>(result)->set_map(fixed_array_map());
2969
- FixedArray* array = FixedArray::cast(result);
2970
- array->set_length(length);
2971
- // Initialize body.
2972
- Object* value = the_hole_value();
2973
- for (int index = 0; index < length; index++) {
2974
- array->set(index, value, SKIP_WRITE_BARRIER);
2975
- }
2976
- }
2977
- return result;
3081
+
3082
+ Object* obj = AllocateRawFixedArray(length);
3083
+ if (obj->IsFailure()) return obj;
3084
+
3085
+ reinterpret_cast<FixedArray*>(obj)->set_map(fixed_array_map());
3086
+ FixedArray::cast(obj)->set_length(length);
3087
+ return obj;
2978
3088
  }
2979
3089
 
2980
3090
 
2981
- Object* Heap::AllocateHashTable(int length) {
2982
- Object* result = Heap::AllocateFixedArray(length);
3091
+ Object* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
3092
+ Object* result = Heap::AllocateFixedArray(length, pretenure);
2983
3093
  if (result->IsFailure()) return result;
2984
3094
  reinterpret_cast<Array*>(result)->set_map(hash_table_map());
2985
3095
  ASSERT(result->IsHashTable());
@@ -3062,6 +3172,7 @@ bool Heap::IdleNotification() {
3062
3172
  static int number_idle_notifications = 0;
3063
3173
  static int last_gc_count = gc_count_;
3064
3174
 
3175
+ bool uncommit = true;
3065
3176
  bool finished = false;
3066
3177
 
3067
3178
  if (last_gc_count == gc_count_) {
@@ -3072,7 +3183,12 @@ bool Heap::IdleNotification() {
3072
3183
  }
3073
3184
 
3074
3185
  if (number_idle_notifications == kIdlesBeforeScavenge) {
3075
- CollectGarbage(0, NEW_SPACE);
3186
+ if (contexts_disposed_ > 0) {
3187
+ HistogramTimerScope scope(&Counters::gc_context);
3188
+ CollectAllGarbage(false);
3189
+ } else {
3190
+ CollectGarbage(0, NEW_SPACE);
3191
+ }
3076
3192
  new_space_.Shrink();
3077
3193
  last_gc_count = gc_count_;
3078
3194
 
@@ -3092,10 +3208,29 @@ bool Heap::IdleNotification() {
3092
3208
  last_gc_count = gc_count_;
3093
3209
  number_idle_notifications = 0;
3094
3210
  finished = true;
3211
+
3212
+ } else if (contexts_disposed_ > 0) {
3213
+ if (FLAG_expose_gc) {
3214
+ contexts_disposed_ = 0;
3215
+ } else {
3216
+ HistogramTimerScope scope(&Counters::gc_context);
3217
+ CollectAllGarbage(false);
3218
+ last_gc_count = gc_count_;
3219
+ }
3220
+ // If this is the first idle notification, we reset the
3221
+ // notification count to avoid letting idle notifications for
3222
+ // context disposal garbage collections start a potentially too
3223
+ // aggressive idle GC cycle.
3224
+ if (number_idle_notifications <= 1) {
3225
+ number_idle_notifications = 0;
3226
+ uncommit = false;
3227
+ }
3095
3228
  }
3096
3229
 
3097
- // Uncommit unused memory in new space.
3098
- Heap::UncommitFromSpace();
3230
+ // Make sure that we have no pending context disposals and
3231
+ // conditionally uncommit from space.
3232
+ ASSERT(contexts_disposed_ == 0);
3233
+ if (uncommit) Heap::UncommitFromSpace();
3099
3234
  return finished;
3100
3235
  }
3101
3236
 
@@ -3106,7 +3241,8 @@ void Heap::Print() {
3106
3241
  if (!HasBeenSetup()) return;
3107
3242
  Top::PrintStack();
3108
3243
  AllSpaces spaces;
3109
- while (Space* space = spaces.next()) space->Print();
3244
+ for (Space* space = spaces.next(); space != NULL; space = spaces.next())
3245
+ space->Print();
3110
3246
  }
3111
3247
 
3112
3248
 
@@ -3340,6 +3476,11 @@ void Heap::IterateRSet(PagedSpace* space, ObjectSlotCallback copy_object_func) {
3340
3476
 
3341
3477
  void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) {
3342
3478
  IterateStrongRoots(v, mode);
3479
+ IterateWeakRoots(v, mode);
3480
+ }
3481
+
3482
+
3483
+ void Heap::IterateWeakRoots(ObjectVisitor* v, VisitMode mode) {
3343
3484
  v->VisitPointer(reinterpret_cast<Object**>(&roots_[kSymbolTableRootIndex]));
3344
3485
  v->Synchronize("symbol_table");
3345
3486
  if (mode != VISIT_ALL_IN_SCAVENGE) {
@@ -3354,7 +3495,7 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
3354
3495
  v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]);
3355
3496
  v->Synchronize("strong_root_list");
3356
3497
 
3357
- v->VisitPointer(bit_cast<Object**, String**>(&hidden_symbol_));
3498
+ v->VisitPointer(BitCast<Object**, String**>(&hidden_symbol_));
3358
3499
  v->Synchronize("symbol");
3359
3500
 
3360
3501
  Bootstrapper::Iterate(v);
@@ -3394,6 +3535,20 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
3394
3535
  // Iterate over pointers being held by inactive threads.
3395
3536
  ThreadManager::Iterate(v);
3396
3537
  v->Synchronize("threadmanager");
3538
+
3539
+ // Iterate over the pointers the Serialization/Deserialization code is
3540
+ // holding.
3541
+ // During garbage collection this keeps the partial snapshot cache alive.
3542
+ // During deserialization of the startup snapshot this creates the partial
3543
+ // snapshot cache and deserializes the objects it refers to. During
3544
+ // serialization this does nothing, since the partial snapshot cache is
3545
+ // empty. However the next thing we do is create the partial snapshot,
3546
+ // filling up the partial snapshot cache with objects it needs as we go.
3547
+ SerializerDeserializer::Iterate(v);
3548
+ // We don't do a v->Synchronize call here, because in debug mode that will
3549
+ // output a flag to the snapshot. However at this point the serializer and
3550
+ // deserializer are deliberately a little unsynchronized (see above) so the
3551
+ // checking of the sync flag in the snapshot would fail.
3397
3552
  }
3398
3553
 
3399
3554
 
@@ -3648,7 +3803,8 @@ void Heap::TearDown() {
3648
3803
  void Heap::Shrink() {
3649
3804
  // Try to shrink all paged spaces.
3650
3805
  PagedSpaces spaces;
3651
- while (PagedSpace* space = spaces.next()) space->Shrink();
3806
+ for (PagedSpace* space = spaces.next(); space != NULL; space = spaces.next())
3807
+ space->Shrink();
3652
3808
  }
3653
3809
 
3654
3810
 
@@ -3657,7 +3813,8 @@ void Heap::Shrink() {
3657
3813
  void Heap::Protect() {
3658
3814
  if (HasBeenSetup()) {
3659
3815
  AllSpaces spaces;
3660
- while (Space* space = spaces.next()) space->Protect();
3816
+ for (Space* space = spaces.next(); space != NULL; space = spaces.next())
3817
+ space->Protect();
3661
3818
  }
3662
3819
  }
3663
3820
 
@@ -3665,13 +3822,54 @@ void Heap::Protect() {
3665
3822
  void Heap::Unprotect() {
3666
3823
  if (HasBeenSetup()) {
3667
3824
  AllSpaces spaces;
3668
- while (Space* space = spaces.next()) space->Unprotect();
3825
+ for (Space* space = spaces.next(); space != NULL; space = spaces.next())
3826
+ space->Unprotect();
3669
3827
  }
3670
3828
  }
3671
3829
 
3672
3830
  #endif
3673
3831
 
3674
3832
 
3833
+ void Heap::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
3834
+ ASSERT(callback != NULL);
3835
+ GCPrologueCallbackPair pair(callback, gc_type);
3836
+ ASSERT(!gc_prologue_callbacks_.Contains(pair));
3837
+ return gc_prologue_callbacks_.Add(pair);
3838
+ }
3839
+
3840
+
3841
+ void Heap::RemoveGCPrologueCallback(GCPrologueCallback callback) {
3842
+ ASSERT(callback != NULL);
3843
+ for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) {
3844
+ if (gc_prologue_callbacks_[i].callback == callback) {
3845
+ gc_prologue_callbacks_.Remove(i);
3846
+ return;
3847
+ }
3848
+ }
3849
+ UNREACHABLE();
3850
+ }
3851
+
3852
+
3853
+ void Heap::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) {
3854
+ ASSERT(callback != NULL);
3855
+ GCEpilogueCallbackPair pair(callback, gc_type);
3856
+ ASSERT(!gc_epilogue_callbacks_.Contains(pair));
3857
+ return gc_epilogue_callbacks_.Add(pair);
3858
+ }
3859
+
3860
+
3861
+ void Heap::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
3862
+ ASSERT(callback != NULL);
3863
+ for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) {
3864
+ if (gc_epilogue_callbacks_[i].callback == callback) {
3865
+ gc_epilogue_callbacks_.Remove(i);
3866
+ return;
3867
+ }
3868
+ }
3869
+ UNREACHABLE();
3870
+ }
3871
+
3872
+
3675
3873
  #ifdef DEBUG
3676
3874
 
3677
3875
  class PrintHandleVisitor: public ObjectVisitor {
@@ -3837,34 +4035,25 @@ void HeapIterator::Shutdown() {
3837
4035
  }
3838
4036
 
3839
4037
 
3840
- bool HeapIterator::has_next() {
4038
+ HeapObject* HeapIterator::next() {
3841
4039
  // No iterator means we are done.
3842
- if (object_iterator_ == NULL) return false;
4040
+ if (object_iterator_ == NULL) return NULL;
3843
4041
 
3844
- if (object_iterator_->has_next_object()) {
4042
+ if (HeapObject* obj = object_iterator_->next_object()) {
3845
4043
  // If the current iterator has more objects we are fine.
3846
- return true;
4044
+ return obj;
3847
4045
  } else {
3848
4046
  // Go though the spaces looking for one that has objects.
3849
4047
  while (space_iterator_->has_next()) {
3850
4048
  object_iterator_ = space_iterator_->next();
3851
- if (object_iterator_->has_next_object()) {
3852
- return true;
4049
+ if (HeapObject* obj = object_iterator_->next_object()) {
4050
+ return obj;
3853
4051
  }
3854
4052
  }
3855
4053
  }
3856
4054
  // Done with the last space.
3857
4055
  object_iterator_ = NULL;
3858
- return false;
3859
- }
3860
-
3861
-
3862
- HeapObject* HeapIterator::next() {
3863
- if (has_next()) {
3864
- return object_iterator_->next_object();
3865
- } else {
3866
- return NULL;
3867
- }
4056
+ return NULL;
3868
4057
  }
3869
4058
 
3870
4059
 
@@ -4043,6 +4232,7 @@ void Heap::TracePathToGlobal() {
4043
4232
  GCTracer::GCTracer()
4044
4233
  : start_time_(0.0),
4045
4234
  start_size_(0.0),
4235
+ external_time_(0.0),
4046
4236
  gc_count_(0),
4047
4237
  full_gc_count_(0),
4048
4238
  is_compacting_(false),
@@ -4060,10 +4250,12 @@ GCTracer::GCTracer()
4060
4250
  GCTracer::~GCTracer() {
4061
4251
  if (!FLAG_trace_gc) return;
4062
4252
  // Printf ONE line iff flag is set.
4063
- PrintF("%s %.1f -> %.1f MB, %d ms.\n",
4064
- CollectorString(),
4065
- start_size_, SizeOfHeapObjects(),
4066
- static_cast<int>(OS::TimeCurrentMillis() - start_time_));
4253
+ int time = static_cast<int>(OS::TimeCurrentMillis() - start_time_);
4254
+ int external_time = static_cast<int>(external_time_);
4255
+ PrintF("%s %.1f -> %.1f MB, ",
4256
+ CollectorString(), start_size_, SizeOfHeapObjects());
4257
+ if (external_time > 0) PrintF("%d / ", external_time);
4258
+ PrintF("%d ms.\n", time);
4067
4259
 
4068
4260
  #if defined(ENABLE_LOGGING_AND_PROFILING)
4069
4261
  Heap::PrintShortHeapStatistics();
@@ -4087,7 +4279,7 @@ int KeyedLookupCache::Hash(Map* map, String* name) {
4087
4279
  // Uses only lower 32 bits if pointers are larger.
4088
4280
  uintptr_t addr_hash =
4089
4281
  static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> kMapHashShift;
4090
- return (addr_hash ^ name->Hash()) & kCapacityMask;
4282
+ return static_cast<uint32_t>((addr_hash ^ name->Hash()) & kCapacityMask);
4091
4283
  }
4092
4284
 
4093
4285