therubyracer 0.5.0-x86-linux → 0.11.0beta5-x86-linux

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 (721) hide show
  1. data/.gitignore +23 -11
  2. data/.travis.yml +10 -0
  3. data/Changelog.md +242 -0
  4. data/Gemfile +16 -0
  5. data/README.md +185 -0
  6. data/Rakefile +42 -51
  7. data/benchmarks.rb +217 -0
  8. data/ext/v8/accessor.cc +181 -0
  9. data/ext/v8/array.cc +26 -0
  10. data/ext/v8/backref.cc +56 -0
  11. data/ext/v8/build.rb +52 -0
  12. data/ext/v8/constants.cc +34 -0
  13. data/ext/v8/constraints.cc +52 -0
  14. data/ext/v8/context.cc +130 -0
  15. data/ext/v8/date.cc +18 -0
  16. data/ext/v8/exception.cc +38 -0
  17. data/ext/v8/extconf.rb +16 -29
  18. data/ext/v8/external.cc +43 -0
  19. data/ext/v8/function.cc +58 -0
  20. data/ext/v8/gc.cc +43 -0
  21. data/ext/v8/handles.cc +34 -0
  22. data/ext/v8/heap.cc +31 -0
  23. data/ext/v8/init.cc +39 -0
  24. data/ext/v8/init.so +0 -0
  25. data/ext/v8/invocation.cc +86 -0
  26. data/ext/v8/locker.cc +77 -0
  27. data/ext/v8/message.cc +51 -0
  28. data/ext/v8/object.cc +334 -0
  29. data/ext/v8/primitive.cc +8 -0
  30. data/ext/v8/rr.cc +83 -0
  31. data/ext/v8/rr.h +883 -0
  32. data/ext/v8/script.cc +80 -0
  33. data/ext/v8/signature.cc +18 -0
  34. data/ext/v8/stack.cc +75 -0
  35. data/ext/v8/string.cc +47 -0
  36. data/ext/v8/template.cc +175 -0
  37. data/ext/v8/trycatch.cc +86 -0
  38. data/ext/v8/v8.cc +87 -0
  39. data/ext/v8/value.cc +239 -0
  40. data/lib/v8.rb +30 -9
  41. data/lib/v8/access.rb +5 -0
  42. data/lib/v8/access/indices.rb +40 -0
  43. data/lib/v8/access/invocation.rb +47 -0
  44. data/lib/v8/access/names.rb +65 -0
  45. data/lib/v8/array.rb +26 -0
  46. data/lib/v8/context.rb +217 -75
  47. data/lib/v8/conversion.rb +35 -0
  48. data/lib/v8/conversion/array.rb +11 -0
  49. data/lib/v8/conversion/class.rb +120 -0
  50. data/lib/v8/conversion/code.rb +38 -0
  51. data/lib/v8/conversion/fundamental.rb +11 -0
  52. data/lib/v8/conversion/hash.rb +11 -0
  53. data/lib/v8/conversion/indentity.rb +31 -0
  54. data/lib/v8/conversion/method.rb +26 -0
  55. data/lib/v8/conversion/object.rb +28 -0
  56. data/lib/v8/conversion/primitive.rb +7 -0
  57. data/lib/v8/conversion/proc.rb +5 -0
  58. data/lib/v8/conversion/reference.rb +16 -0
  59. data/lib/v8/conversion/string.rb +12 -0
  60. data/lib/v8/conversion/symbol.rb +7 -0
  61. data/lib/v8/conversion/time.rb +13 -0
  62. data/lib/v8/error.rb +25 -0
  63. data/lib/v8/error/protect.rb +20 -0
  64. data/lib/v8/error/try.rb +15 -0
  65. data/lib/v8/function.rb +28 -0
  66. data/lib/v8/object.rb +69 -28
  67. data/lib/v8/util/weakcell.rb +29 -0
  68. data/lib/v8/version.rb +3 -0
  69. data/spec/c/array_spec.rb +17 -0
  70. data/spec/c/constants_spec.rb +20 -0
  71. data/spec/c/exception_spec.rb +26 -0
  72. data/spec/c/external_spec.rb +9 -0
  73. data/spec/c/function_spec.rb +46 -0
  74. data/spec/c/handles_spec.rb +35 -0
  75. data/spec/c/locker_spec.rb +38 -0
  76. data/spec/c/object_spec.rb +46 -0
  77. data/spec/c/script_spec.rb +28 -0
  78. data/spec/c/string_spec.rb +16 -0
  79. data/spec/c/template_spec.rb +30 -0
  80. data/spec/c/trycatch_spec.rb +51 -0
  81. data/spec/mem/blunt_spec.rb +42 -0
  82. data/spec/redjs_spec.rb +10 -0
  83. data/spec/spec_helper.rb +43 -12
  84. data/spec/threading_spec.rb +52 -0
  85. data/spec/v8/context_spec.rb +19 -0
  86. data/spec/v8/conversion_spec.rb +9 -0
  87. data/spec/v8/error_spec.rb +21 -0
  88. data/spec/v8/function_spec.rb +9 -0
  89. data/spec/v8/object_spec.rb +15 -0
  90. data/thefrontside.png +0 -0
  91. data/therubyracer.gemspec +15 -676
  92. metadata +146 -680
  93. data/.gitmodules +0 -3
  94. data/Doxyfile +0 -1514
  95. data/History.txt +0 -51
  96. data/README.rdoc +0 -158
  97. data/docs/data_conversion.txt +0 -18
  98. data/ext/v8/callbacks.cpp +0 -160
  99. data/ext/v8/callbacks.h +0 -14
  100. data/ext/v8/convert_ruby.cpp +0 -8
  101. data/ext/v8/convert_ruby.h +0 -99
  102. data/ext/v8/convert_string.cpp +0 -10
  103. data/ext/v8/convert_string.h +0 -73
  104. data/ext/v8/convert_v8.cpp +0 -9
  105. data/ext/v8/convert_v8.h +0 -121
  106. data/ext/v8/converters.cpp +0 -83
  107. data/ext/v8/converters.h +0 -23
  108. data/ext/v8/upstream/2.0.6/.gitignore +0 -26
  109. data/ext/v8/upstream/2.0.6/AUTHORS +0 -23
  110. data/ext/v8/upstream/2.0.6/ChangeLog +0 -1479
  111. data/ext/v8/upstream/2.0.6/LICENSE +0 -55
  112. data/ext/v8/upstream/2.0.6/SConstruct +0 -1028
  113. data/ext/v8/upstream/2.0.6/include/v8-debug.h +0 -275
  114. data/ext/v8/upstream/2.0.6/include/v8.h +0 -3236
  115. data/ext/v8/upstream/2.0.6/src/SConscript +0 -283
  116. data/ext/v8/upstream/2.0.6/src/accessors.cc +0 -695
  117. data/ext/v8/upstream/2.0.6/src/accessors.h +0 -114
  118. data/ext/v8/upstream/2.0.6/src/allocation.cc +0 -198
  119. data/ext/v8/upstream/2.0.6/src/allocation.h +0 -169
  120. data/ext/v8/upstream/2.0.6/src/api.cc +0 -3831
  121. data/ext/v8/upstream/2.0.6/src/api.h +0 -479
  122. data/ext/v8/upstream/2.0.6/src/apinatives.js +0 -110
  123. data/ext/v8/upstream/2.0.6/src/apiutils.h +0 -69
  124. data/ext/v8/upstream/2.0.6/src/arguments.h +0 -97
  125. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm-inl.h +0 -277
  126. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.cc +0 -1821
  127. data/ext/v8/upstream/2.0.6/src/arm/assembler-arm.h +0 -1027
  128. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2-inl.h +0 -267
  129. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.cc +0 -1821
  130. data/ext/v8/upstream/2.0.6/src/arm/assembler-thumb2.h +0 -1027
  131. data/ext/v8/upstream/2.0.6/src/arm/builtins-arm.cc +0 -1271
  132. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm-inl.h +0 -74
  133. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.cc +0 -6682
  134. data/ext/v8/upstream/2.0.6/src/arm/codegen-arm.h +0 -535
  135. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.cc +0 -112
  136. data/ext/v8/upstream/2.0.6/src/arm/constants-arm.h +0 -347
  137. data/ext/v8/upstream/2.0.6/src/arm/cpu-arm.cc +0 -132
  138. data/ext/v8/upstream/2.0.6/src/arm/debug-arm.cc +0 -213
  139. data/ext/v8/upstream/2.0.6/src/arm/disasm-arm.cc +0 -1166
  140. data/ext/v8/upstream/2.0.6/src/arm/fast-codegen-arm.cc +0 -1698
  141. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.cc +0 -123
  142. data/ext/v8/upstream/2.0.6/src/arm/frames-arm.h +0 -162
  143. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +0 -849
  144. data/ext/v8/upstream/2.0.6/src/arm/jump-target-arm.cc +0 -238
  145. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.cc +0 -1259
  146. data/ext/v8/upstream/2.0.6/src/arm/macro-assembler-arm.h +0 -423
  147. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.cc +0 -1266
  148. data/ext/v8/upstream/2.0.6/src/arm/regexp-macro-assembler-arm.h +0 -282
  149. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm-inl.h +0 -103
  150. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.cc +0 -59
  151. data/ext/v8/upstream/2.0.6/src/arm/register-allocator-arm.h +0 -43
  152. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.cc +0 -2264
  153. data/ext/v8/upstream/2.0.6/src/arm/simulator-arm.h +0 -306
  154. data/ext/v8/upstream/2.0.6/src/arm/stub-cache-arm.cc +0 -1516
  155. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +0 -412
  156. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.h +0 -532
  157. data/ext/v8/upstream/2.0.6/src/array.js +0 -1154
  158. data/ext/v8/upstream/2.0.6/src/assembler.cc +0 -772
  159. data/ext/v8/upstream/2.0.6/src/assembler.h +0 -525
  160. data/ext/v8/upstream/2.0.6/src/ast.cc +0 -512
  161. data/ext/v8/upstream/2.0.6/src/ast.h +0 -1820
  162. data/ext/v8/upstream/2.0.6/src/bootstrapper.cc +0 -1680
  163. data/ext/v8/upstream/2.0.6/src/bootstrapper.h +0 -103
  164. data/ext/v8/upstream/2.0.6/src/builtins.cc +0 -851
  165. data/ext/v8/upstream/2.0.6/src/builtins.h +0 -245
  166. data/ext/v8/upstream/2.0.6/src/bytecodes-irregexp.h +0 -104
  167. data/ext/v8/upstream/2.0.6/src/char-predicates-inl.h +0 -86
  168. data/ext/v8/upstream/2.0.6/src/char-predicates.h +0 -65
  169. data/ext/v8/upstream/2.0.6/src/checks.cc +0 -100
  170. data/ext/v8/upstream/2.0.6/src/checks.h +0 -284
  171. data/ext/v8/upstream/2.0.6/src/code-stubs.cc +0 -164
  172. data/ext/v8/upstream/2.0.6/src/code-stubs.h +0 -164
  173. data/ext/v8/upstream/2.0.6/src/code.h +0 -68
  174. data/ext/v8/upstream/2.0.6/src/codegen-inl.h +0 -88
  175. data/ext/v8/upstream/2.0.6/src/codegen.cc +0 -504
  176. data/ext/v8/upstream/2.0.6/src/codegen.h +0 -522
  177. data/ext/v8/upstream/2.0.6/src/compilation-cache.cc +0 -490
  178. data/ext/v8/upstream/2.0.6/src/compilation-cache.h +0 -98
  179. data/ext/v8/upstream/2.0.6/src/compiler.cc +0 -1132
  180. data/ext/v8/upstream/2.0.6/src/compiler.h +0 -107
  181. data/ext/v8/upstream/2.0.6/src/contexts.cc +0 -256
  182. data/ext/v8/upstream/2.0.6/src/contexts.h +0 -345
  183. data/ext/v8/upstream/2.0.6/src/conversions-inl.h +0 -95
  184. data/ext/v8/upstream/2.0.6/src/conversions.cc +0 -709
  185. data/ext/v8/upstream/2.0.6/src/conversions.h +0 -118
  186. data/ext/v8/upstream/2.0.6/src/counters.cc +0 -78
  187. data/ext/v8/upstream/2.0.6/src/counters.h +0 -239
  188. data/ext/v8/upstream/2.0.6/src/cpu.h +0 -65
  189. data/ext/v8/upstream/2.0.6/src/d8-debug.cc +0 -345
  190. data/ext/v8/upstream/2.0.6/src/d8-debug.h +0 -155
  191. data/ext/v8/upstream/2.0.6/src/d8-posix.cc +0 -675
  192. data/ext/v8/upstream/2.0.6/src/d8-readline.cc +0 -128
  193. data/ext/v8/upstream/2.0.6/src/d8-windows.cc +0 -42
  194. data/ext/v8/upstream/2.0.6/src/d8.cc +0 -776
  195. data/ext/v8/upstream/2.0.6/src/d8.h +0 -225
  196. data/ext/v8/upstream/2.0.6/src/d8.js +0 -1625
  197. data/ext/v8/upstream/2.0.6/src/date-delay.js +0 -1138
  198. data/ext/v8/upstream/2.0.6/src/dateparser-inl.h +0 -114
  199. data/ext/v8/upstream/2.0.6/src/dateparser.cc +0 -186
  200. data/ext/v8/upstream/2.0.6/src/dateparser.h +0 -240
  201. data/ext/v8/upstream/2.0.6/src/debug-agent.cc +0 -425
  202. data/ext/v8/upstream/2.0.6/src/debug-agent.h +0 -129
  203. data/ext/v8/upstream/2.0.6/src/debug-delay.js +0 -2073
  204. data/ext/v8/upstream/2.0.6/src/debug.cc +0 -2751
  205. data/ext/v8/upstream/2.0.6/src/debug.h +0 -866
  206. data/ext/v8/upstream/2.0.6/src/disasm.h +0 -77
  207. data/ext/v8/upstream/2.0.6/src/disassembler.cc +0 -318
  208. data/ext/v8/upstream/2.0.6/src/disassembler.h +0 -56
  209. data/ext/v8/upstream/2.0.6/src/dtoa-config.c +0 -91
  210. data/ext/v8/upstream/2.0.6/src/execution.cc +0 -701
  211. data/ext/v8/upstream/2.0.6/src/execution.h +0 -312
  212. data/ext/v8/upstream/2.0.6/src/factory.cc +0 -957
  213. data/ext/v8/upstream/2.0.6/src/factory.h +0 -393
  214. data/ext/v8/upstream/2.0.6/src/fast-codegen.cc +0 -725
  215. data/ext/v8/upstream/2.0.6/src/fast-codegen.h +0 -371
  216. data/ext/v8/upstream/2.0.6/src/flag-definitions.h +0 -426
  217. data/ext/v8/upstream/2.0.6/src/flags.cc +0 -555
  218. data/ext/v8/upstream/2.0.6/src/flags.h +0 -81
  219. data/ext/v8/upstream/2.0.6/src/frame-element.cc +0 -45
  220. data/ext/v8/upstream/2.0.6/src/frame-element.h +0 -235
  221. data/ext/v8/upstream/2.0.6/src/frames-inl.h +0 -215
  222. data/ext/v8/upstream/2.0.6/src/frames.cc +0 -749
  223. data/ext/v8/upstream/2.0.6/src/frames.h +0 -659
  224. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.cc +0 -76
  225. data/ext/v8/upstream/2.0.6/src/func-name-inferrer.h +0 -135
  226. data/ext/v8/upstream/2.0.6/src/global-handles.cc +0 -516
  227. data/ext/v8/upstream/2.0.6/src/global-handles.h +0 -180
  228. data/ext/v8/upstream/2.0.6/src/globals.h +0 -608
  229. data/ext/v8/upstream/2.0.6/src/handles-inl.h +0 -76
  230. data/ext/v8/upstream/2.0.6/src/handles.cc +0 -811
  231. data/ext/v8/upstream/2.0.6/src/handles.h +0 -367
  232. data/ext/v8/upstream/2.0.6/src/hashmap.cc +0 -226
  233. data/ext/v8/upstream/2.0.6/src/hashmap.h +0 -120
  234. data/ext/v8/upstream/2.0.6/src/heap-inl.h +0 -407
  235. data/ext/v8/upstream/2.0.6/src/heap-profiler.cc +0 -695
  236. data/ext/v8/upstream/2.0.6/src/heap-profiler.h +0 -277
  237. data/ext/v8/upstream/2.0.6/src/heap.cc +0 -4204
  238. data/ext/v8/upstream/2.0.6/src/heap.h +0 -1704
  239. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32-inl.h +0 -325
  240. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.cc +0 -2375
  241. data/ext/v8/upstream/2.0.6/src/ia32/assembler-ia32.h +0 -914
  242. data/ext/v8/upstream/2.0.6/src/ia32/builtins-ia32.cc +0 -1222
  243. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32-inl.h +0 -46
  244. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.cc +0 -9770
  245. data/ext/v8/upstream/2.0.6/src/ia32/codegen-ia32.h +0 -834
  246. data/ext/v8/upstream/2.0.6/src/ia32/cpu-ia32.cc +0 -79
  247. data/ext/v8/upstream/2.0.6/src/ia32/debug-ia32.cc +0 -208
  248. data/ext/v8/upstream/2.0.6/src/ia32/disasm-ia32.cc +0 -1357
  249. data/ext/v8/upstream/2.0.6/src/ia32/fast-codegen-ia32.cc +0 -1813
  250. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.cc +0 -111
  251. data/ext/v8/upstream/2.0.6/src/ia32/frames-ia32.h +0 -135
  252. data/ext/v8/upstream/2.0.6/src/ia32/ic-ia32.cc +0 -1490
  253. data/ext/v8/upstream/2.0.6/src/ia32/jump-target-ia32.cc +0 -432
  254. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.cc +0 -1517
  255. data/ext/v8/upstream/2.0.6/src/ia32/macro-assembler-ia32.h +0 -528
  256. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.cc +0 -1219
  257. data/ext/v8/upstream/2.0.6/src/ia32/regexp-macro-assembler-ia32.h +0 -230
  258. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32-inl.h +0 -82
  259. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.cc +0 -99
  260. data/ext/v8/upstream/2.0.6/src/ia32/register-allocator-ia32.h +0 -43
  261. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.cc +0 -30
  262. data/ext/v8/upstream/2.0.6/src/ia32/simulator-ia32.h +0 -62
  263. data/ext/v8/upstream/2.0.6/src/ia32/stub-cache-ia32.cc +0 -1961
  264. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.cc +0 -1105
  265. data/ext/v8/upstream/2.0.6/src/ia32/virtual-frame-ia32.h +0 -580
  266. data/ext/v8/upstream/2.0.6/src/ic-inl.h +0 -93
  267. data/ext/v8/upstream/2.0.6/src/ic.cc +0 -1426
  268. data/ext/v8/upstream/2.0.6/src/ic.h +0 -443
  269. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.cc +0 -646
  270. data/ext/v8/upstream/2.0.6/src/interpreter-irregexp.h +0 -48
  271. data/ext/v8/upstream/2.0.6/src/json-delay.js +0 -254
  272. data/ext/v8/upstream/2.0.6/src/jsregexp.cc +0 -5234
  273. data/ext/v8/upstream/2.0.6/src/jsregexp.h +0 -1439
  274. data/ext/v8/upstream/2.0.6/src/jump-target-inl.h +0 -49
  275. data/ext/v8/upstream/2.0.6/src/jump-target.cc +0 -383
  276. data/ext/v8/upstream/2.0.6/src/jump-target.h +0 -280
  277. data/ext/v8/upstream/2.0.6/src/list-inl.h +0 -166
  278. data/ext/v8/upstream/2.0.6/src/list.h +0 -158
  279. data/ext/v8/upstream/2.0.6/src/log-inl.h +0 -126
  280. data/ext/v8/upstream/2.0.6/src/log-utils.cc +0 -503
  281. data/ext/v8/upstream/2.0.6/src/log-utils.h +0 -292
  282. data/ext/v8/upstream/2.0.6/src/log.cc +0 -1457
  283. data/ext/v8/upstream/2.0.6/src/log.h +0 -371
  284. data/ext/v8/upstream/2.0.6/src/macro-assembler.h +0 -93
  285. data/ext/v8/upstream/2.0.6/src/macros.py +0 -137
  286. data/ext/v8/upstream/2.0.6/src/mark-compact.cc +0 -2007
  287. data/ext/v8/upstream/2.0.6/src/mark-compact.h +0 -442
  288. data/ext/v8/upstream/2.0.6/src/math.js +0 -263
  289. data/ext/v8/upstream/2.0.6/src/memory.h +0 -74
  290. data/ext/v8/upstream/2.0.6/src/messages.cc +0 -177
  291. data/ext/v8/upstream/2.0.6/src/messages.h +0 -112
  292. data/ext/v8/upstream/2.0.6/src/messages.js +0 -937
  293. data/ext/v8/upstream/2.0.6/src/mirror-delay.js +0 -2332
  294. data/ext/v8/upstream/2.0.6/src/mksnapshot.cc +0 -169
  295. data/ext/v8/upstream/2.0.6/src/natives.h +0 -63
  296. data/ext/v8/upstream/2.0.6/src/objects-debug.cc +0 -1317
  297. data/ext/v8/upstream/2.0.6/src/objects-inl.h +0 -3044
  298. data/ext/v8/upstream/2.0.6/src/objects.cc +0 -8306
  299. data/ext/v8/upstream/2.0.6/src/objects.h +0 -4960
  300. data/ext/v8/upstream/2.0.6/src/oprofile-agent.cc +0 -116
  301. data/ext/v8/upstream/2.0.6/src/oprofile-agent.h +0 -69
  302. data/ext/v8/upstream/2.0.6/src/parser.cc +0 -4810
  303. data/ext/v8/upstream/2.0.6/src/parser.h +0 -195
  304. data/ext/v8/upstream/2.0.6/src/platform-freebsd.cc +0 -645
  305. data/ext/v8/upstream/2.0.6/src/platform-linux.cc +0 -808
  306. data/ext/v8/upstream/2.0.6/src/platform-macos.cc +0 -643
  307. data/ext/v8/upstream/2.0.6/src/platform-nullos.cc +0 -454
  308. data/ext/v8/upstream/2.0.6/src/platform-openbsd.cc +0 -597
  309. data/ext/v8/upstream/2.0.6/src/platform-posix.cc +0 -380
  310. data/ext/v8/upstream/2.0.6/src/platform-win32.cc +0 -1908
  311. data/ext/v8/upstream/2.0.6/src/platform.h +0 -556
  312. data/ext/v8/upstream/2.0.6/src/prettyprinter.cc +0 -1511
  313. data/ext/v8/upstream/2.0.6/src/prettyprinter.h +0 -219
  314. data/ext/v8/upstream/2.0.6/src/property.cc +0 -96
  315. data/ext/v8/upstream/2.0.6/src/property.h +0 -327
  316. data/ext/v8/upstream/2.0.6/src/regexp-delay.js +0 -406
  317. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp-inl.h +0 -78
  318. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.cc +0 -464
  319. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-irregexp.h +0 -141
  320. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.cc +0 -356
  321. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler-tracer.h +0 -103
  322. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.cc +0 -240
  323. data/ext/v8/upstream/2.0.6/src/regexp-macro-assembler.h +0 -220
  324. data/ext/v8/upstream/2.0.6/src/regexp-stack.cc +0 -103
  325. data/ext/v8/upstream/2.0.6/src/regexp-stack.h +0 -123
  326. data/ext/v8/upstream/2.0.6/src/register-allocator-inl.h +0 -74
  327. data/ext/v8/upstream/2.0.6/src/register-allocator.cc +0 -100
  328. data/ext/v8/upstream/2.0.6/src/register-allocator.h +0 -295
  329. data/ext/v8/upstream/2.0.6/src/rewriter.cc +0 -855
  330. data/ext/v8/upstream/2.0.6/src/rewriter.h +0 -54
  331. data/ext/v8/upstream/2.0.6/src/runtime.cc +0 -8163
  332. data/ext/v8/upstream/2.0.6/src/runtime.h +0 -432
  333. data/ext/v8/upstream/2.0.6/src/runtime.js +0 -626
  334. data/ext/v8/upstream/2.0.6/src/scanner.cc +0 -1098
  335. data/ext/v8/upstream/2.0.6/src/scanner.h +0 -425
  336. data/ext/v8/upstream/2.0.6/src/scopeinfo.cc +0 -649
  337. data/ext/v8/upstream/2.0.6/src/scopeinfo.h +0 -236
  338. data/ext/v8/upstream/2.0.6/src/scopes.cc +0 -963
  339. data/ext/v8/upstream/2.0.6/src/scopes.h +0 -401
  340. data/ext/v8/upstream/2.0.6/src/serialize.cc +0 -1260
  341. data/ext/v8/upstream/2.0.6/src/serialize.h +0 -404
  342. data/ext/v8/upstream/2.0.6/src/shell.h +0 -55
  343. data/ext/v8/upstream/2.0.6/src/simulator.h +0 -41
  344. data/ext/v8/upstream/2.0.6/src/smart-pointer.h +0 -109
  345. data/ext/v8/upstream/2.0.6/src/snapshot-common.cc +0 -97
  346. data/ext/v8/upstream/2.0.6/src/snapshot-empty.cc +0 -40
  347. data/ext/v8/upstream/2.0.6/src/snapshot.h +0 -59
  348. data/ext/v8/upstream/2.0.6/src/spaces-inl.h +0 -372
  349. data/ext/v8/upstream/2.0.6/src/spaces.cc +0 -2864
  350. data/ext/v8/upstream/2.0.6/src/spaces.h +0 -2072
  351. data/ext/v8/upstream/2.0.6/src/string-stream.cc +0 -584
  352. data/ext/v8/upstream/2.0.6/src/string-stream.h +0 -189
  353. data/ext/v8/upstream/2.0.6/src/string.js +0 -901
  354. data/ext/v8/upstream/2.0.6/src/stub-cache.cc +0 -1108
  355. data/ext/v8/upstream/2.0.6/src/stub-cache.h +0 -578
  356. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/COPYING +0 -15
  357. data/ext/v8/upstream/2.0.6/src/third_party/dtoa/dtoa.c +0 -3330
  358. data/ext/v8/upstream/2.0.6/src/third_party/valgrind/valgrind.h +0 -3925
  359. data/ext/v8/upstream/2.0.6/src/token.cc +0 -56
  360. data/ext/v8/upstream/2.0.6/src/token.h +0 -270
  361. data/ext/v8/upstream/2.0.6/src/top.cc +0 -991
  362. data/ext/v8/upstream/2.0.6/src/top.h +0 -459
  363. data/ext/v8/upstream/2.0.6/src/unicode-inl.h +0 -238
  364. data/ext/v8/upstream/2.0.6/src/unicode.cc +0 -749
  365. data/ext/v8/upstream/2.0.6/src/unicode.h +0 -279
  366. data/ext/v8/upstream/2.0.6/src/uri.js +0 -415
  367. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +0 -426
  368. data/ext/v8/upstream/2.0.6/src/usage-analyzer.h +0 -40
  369. data/ext/v8/upstream/2.0.6/src/utils.cc +0 -322
  370. data/ext/v8/upstream/2.0.6/src/utils.h +0 -592
  371. data/ext/v8/upstream/2.0.6/src/v8-counters.cc +0 -55
  372. data/ext/v8/upstream/2.0.6/src/v8-counters.h +0 -198
  373. data/ext/v8/upstream/2.0.6/src/v8.cc +0 -193
  374. data/ext/v8/upstream/2.0.6/src/v8.h +0 -119
  375. data/ext/v8/upstream/2.0.6/src/v8natives.js +0 -846
  376. data/ext/v8/upstream/2.0.6/src/v8threads.cc +0 -450
  377. data/ext/v8/upstream/2.0.6/src/v8threads.h +0 -144
  378. data/ext/v8/upstream/2.0.6/src/variables.cc +0 -163
  379. data/ext/v8/upstream/2.0.6/src/variables.h +0 -235
  380. data/ext/v8/upstream/2.0.6/src/version.cc +0 -88
  381. data/ext/v8/upstream/2.0.6/src/version.h +0 -64
  382. data/ext/v8/upstream/2.0.6/src/virtual-frame.cc +0 -381
  383. data/ext/v8/upstream/2.0.6/src/virtual-frame.h +0 -44
  384. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64-inl.h +0 -352
  385. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.cc +0 -2539
  386. data/ext/v8/upstream/2.0.6/src/x64/assembler-x64.h +0 -1399
  387. data/ext/v8/upstream/2.0.6/src/x64/builtins-x64.cc +0 -1255
  388. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64-inl.h +0 -46
  389. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.cc +0 -8223
  390. data/ext/v8/upstream/2.0.6/src/x64/codegen-x64.h +0 -785
  391. data/ext/v8/upstream/2.0.6/src/x64/cpu-x64.cc +0 -79
  392. data/ext/v8/upstream/2.0.6/src/x64/debug-x64.cc +0 -202
  393. data/ext/v8/upstream/2.0.6/src/x64/disasm-x64.cc +0 -1596
  394. data/ext/v8/upstream/2.0.6/src/x64/fast-codegen-x64.cc +0 -1820
  395. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.cc +0 -109
  396. data/ext/v8/upstream/2.0.6/src/x64/frames-x64.h +0 -121
  397. data/ext/v8/upstream/2.0.6/src/x64/ic-x64.cc +0 -1392
  398. data/ext/v8/upstream/2.0.6/src/x64/jump-target-x64.cc +0 -432
  399. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.cc +0 -2409
  400. data/ext/v8/upstream/2.0.6/src/x64/macro-assembler-x64.h +0 -765
  401. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.cc +0 -1337
  402. data/ext/v8/upstream/2.0.6/src/x64/regexp-macro-assembler-x64.h +0 -295
  403. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64-inl.h +0 -86
  404. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.cc +0 -84
  405. data/ext/v8/upstream/2.0.6/src/x64/register-allocator-x64.h +0 -43
  406. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.cc +0 -27
  407. data/ext/v8/upstream/2.0.6/src/x64/simulator-x64.h +0 -63
  408. data/ext/v8/upstream/2.0.6/src/x64/stub-cache-x64.cc +0 -1884
  409. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.cc +0 -1089
  410. data/ext/v8/upstream/2.0.6/src/x64/virtual-frame-x64.h +0 -560
  411. data/ext/v8/upstream/2.0.6/src/zone-inl.h +0 -297
  412. data/ext/v8/upstream/2.0.6/src/zone.cc +0 -193
  413. data/ext/v8/upstream/2.0.6/src/zone.h +0 -305
  414. data/ext/v8/upstream/2.0.6/tools/codemap.js +0 -258
  415. data/ext/v8/upstream/2.0.6/tools/consarray.js +0 -93
  416. data/ext/v8/upstream/2.0.6/tools/csvparser.js +0 -98
  417. data/ext/v8/upstream/2.0.6/tools/gyp/v8.gyp +0 -620
  418. data/ext/v8/upstream/2.0.6/tools/js2c.py +0 -376
  419. data/ext/v8/upstream/2.0.6/tools/jsmin.py +0 -280
  420. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor +0 -24
  421. data/ext/v8/upstream/2.0.6/tools/linux-tick-processor.py +0 -78
  422. data/ext/v8/upstream/2.0.6/tools/logreader.js +0 -320
  423. data/ext/v8/upstream/2.0.6/tools/mac-nm +0 -18
  424. data/ext/v8/upstream/2.0.6/tools/mac-tick-processor +0 -6
  425. data/ext/v8/upstream/2.0.6/tools/oprofile/annotate +0 -7
  426. data/ext/v8/upstream/2.0.6/tools/oprofile/common +0 -19
  427. data/ext/v8/upstream/2.0.6/tools/oprofile/dump +0 -7
  428. data/ext/v8/upstream/2.0.6/tools/oprofile/report +0 -7
  429. data/ext/v8/upstream/2.0.6/tools/oprofile/reset +0 -7
  430. data/ext/v8/upstream/2.0.6/tools/oprofile/run +0 -14
  431. data/ext/v8/upstream/2.0.6/tools/oprofile/shutdown +0 -7
  432. data/ext/v8/upstream/2.0.6/tools/oprofile/start +0 -7
  433. data/ext/v8/upstream/2.0.6/tools/presubmit.py +0 -299
  434. data/ext/v8/upstream/2.0.6/tools/process-heap-prof.py +0 -120
  435. data/ext/v8/upstream/2.0.6/tools/profile.js +0 -621
  436. data/ext/v8/upstream/2.0.6/tools/profile_view.js +0 -224
  437. data/ext/v8/upstream/2.0.6/tools/run-valgrind.py +0 -77
  438. data/ext/v8/upstream/2.0.6/tools/splaytree.js +0 -322
  439. data/ext/v8/upstream/2.0.6/tools/splaytree.py +0 -226
  440. data/ext/v8/upstream/2.0.6/tools/stats-viewer.py +0 -456
  441. data/ext/v8/upstream/2.0.6/tools/test.py +0 -1370
  442. data/ext/v8/upstream/2.0.6/tools/tickprocessor-driver.js +0 -53
  443. data/ext/v8/upstream/2.0.6/tools/tickprocessor.js +0 -731
  444. data/ext/v8/upstream/2.0.6/tools/tickprocessor.py +0 -535
  445. data/ext/v8/upstream/2.0.6/tools/utils.py +0 -82
  446. data/ext/v8/upstream/2.0.6/tools/visual_studio/README.txt +0 -71
  447. data/ext/v8/upstream/2.0.6/tools/visual_studio/arm.vsprops +0 -14
  448. data/ext/v8/upstream/2.0.6/tools/visual_studio/common.vsprops +0 -35
  449. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8.vcproj +0 -199
  450. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_arm.vcproj +0 -199
  451. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8_x64.vcproj +0 -201
  452. data/ext/v8/upstream/2.0.6/tools/visual_studio/d8js2c.cmd +0 -6
  453. data/ext/v8/upstream/2.0.6/tools/visual_studio/debug.vsprops +0 -17
  454. data/ext/v8/upstream/2.0.6/tools/visual_studio/ia32.vsprops +0 -13
  455. data/ext/v8/upstream/2.0.6/tools/visual_studio/js2c.cmd +0 -6
  456. data/ext/v8/upstream/2.0.6/tools/visual_studio/release.vsprops +0 -24
  457. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.sln +0 -101
  458. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8.vcproj +0 -223
  459. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.sln +0 -74
  460. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_arm.vcproj +0 -223
  461. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base.vcproj +0 -971
  462. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_arm.vcproj +0 -983
  463. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_base_x64.vcproj +0 -959
  464. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest.vcproj +0 -255
  465. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_arm.vcproj +0 -243
  466. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
  467. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot.vcproj +0 -151
  468. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -151
  469. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample.vcproj +0 -151
  470. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_arm.vcproj +0 -151
  471. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_process_sample_x64.vcproj +0 -151
  472. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample.vcproj +0 -151
  473. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -151
  474. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -153
  475. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot.vcproj +0 -142
  476. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
  477. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
  478. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
  479. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.sln +0 -101
  480. data/ext/v8/upstream/2.0.6/tools/visual_studio/v8_x64.vcproj +0 -223
  481. data/ext/v8/upstream/2.0.6/tools/visual_studio/x64.vsprops +0 -13
  482. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +0 -5
  483. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.py +0 -137
  484. data/ext/v8/upstream/Makefile +0 -32
  485. data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
  486. data/ext/v8/upstream/no-strict-aliasing.patch +0 -13
  487. data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
  488. data/ext/v8/upstream/scons/LICENSE.txt +0 -20
  489. data/ext/v8/upstream/scons/MANIFEST +0 -202
  490. data/ext/v8/upstream/scons/PKG-INFO +0 -13
  491. data/ext/v8/upstream/scons/README.txt +0 -273
  492. data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
  493. data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
  494. data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
  495. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
  496. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
  497. data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
  498. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
  499. data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
  500. data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
  501. data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
  502. data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
  503. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
  504. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
  505. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
  506. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
  507. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
  508. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
  509. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
  510. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
  511. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
  512. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
  513. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
  514. data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
  515. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
  516. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
  517. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
  518. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
  519. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
  520. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
  521. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
  522. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
  523. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
  524. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
  525. data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
  526. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
  527. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
  528. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
  529. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
  530. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
  531. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
  532. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
  533. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
  534. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
  535. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
  536. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
  537. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
  538. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
  539. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
  540. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
  541. data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
  542. data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
  543. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
  544. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
  545. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
  546. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
  547. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
  548. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
  549. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
  550. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
  551. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
  552. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
  553. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
  554. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
  555. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
  556. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
  557. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
  558. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
  559. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
  560. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
  561. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
  562. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
  563. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
  564. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
  565. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
  566. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
  567. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
  568. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
  569. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
  570. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
  571. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
  572. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
  573. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
  574. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
  575. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
  576. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
  577. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
  578. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
  579. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
  580. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
  581. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
  582. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
  583. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
  584. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
  585. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
  586. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
  587. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
  588. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
  589. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
  590. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
  591. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
  592. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
  593. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
  594. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
  595. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
  596. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
  597. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
  598. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
  599. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
  600. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
  601. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
  602. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
  603. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
  604. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
  605. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
  606. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
  607. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
  608. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
  609. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
  610. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
  611. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
  612. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
  613. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
  614. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
  615. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
  616. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
  617. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
  618. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
  619. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
  620. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
  621. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
  622. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
  623. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
  624. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
  625. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
  626. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
  627. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
  628. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
  629. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
  630. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
  631. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
  632. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
  633. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
  634. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
  635. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
  636. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
  637. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
  638. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
  639. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
  640. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
  641. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
  642. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
  643. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
  644. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
  645. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
  646. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
  647. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
  648. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
  649. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
  650. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
  651. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
  652. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
  653. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
  654. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
  655. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
  656. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
  657. data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
  658. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
  659. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
  660. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
  661. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
  662. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
  663. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
  664. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
  665. data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
  666. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
  667. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
  668. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
  669. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
  670. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
  671. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
  672. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
  673. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
  674. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
  675. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
  676. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
  677. data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
  678. data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
  679. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
  680. data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
  681. data/ext/v8/upstream/scons/scons-time.1 +0 -1017
  682. data/ext/v8/upstream/scons/scons.1 +0 -15179
  683. data/ext/v8/upstream/scons/sconsign.1 +0 -208
  684. data/ext/v8/upstream/scons/script/scons +0 -184
  685. data/ext/v8/upstream/scons/script/scons-time +0 -1529
  686. data/ext/v8/upstream/scons/script/scons.bat +0 -31
  687. data/ext/v8/upstream/scons/script/sconsign +0 -508
  688. data/ext/v8/upstream/scons/setup.cfg +0 -6
  689. data/ext/v8/upstream/scons/setup.py +0 -427
  690. data/ext/v8/v8.cpp +0 -89
  691. data/ext/v8/v8_cxt.cpp +0 -92
  692. data/ext/v8/v8_cxt.h +0 -20
  693. data/ext/v8/v8_func.cpp +0 -10
  694. data/ext/v8/v8_func.h +0 -11
  695. data/ext/v8/v8_msg.cpp +0 -54
  696. data/ext/v8/v8_msg.h +0 -18
  697. data/ext/v8/v8_obj.cpp +0 -52
  698. data/ext/v8/v8_obj.h +0 -13
  699. data/ext/v8/v8_ref.cpp +0 -26
  700. data/ext/v8/v8_ref.h +0 -31
  701. data/ext/v8/v8_script.cpp +0 -20
  702. data/ext/v8/v8_script.h +0 -8
  703. data/ext/v8/v8_standalone.cpp +0 -69
  704. data/ext/v8/v8_standalone.h +0 -31
  705. data/ext/v8/v8_str.cpp +0 -17
  706. data/ext/v8/v8_str.h +0 -9
  707. data/ext/v8/v8_template.cpp +0 -53
  708. data/ext/v8/v8_template.h +0 -13
  709. data/lib/v8/to.rb +0 -33
  710. data/lib/v8/v8.so +0 -0
  711. data/script/console +0 -10
  712. data/script/destroy +0 -14
  713. data/script/generate +0 -14
  714. data/spec/ext/cxt_spec.rb +0 -25
  715. data/spec/ext/obj_spec.rb +0 -13
  716. data/spec/redjs/jsapi_spec.rb +0 -405
  717. data/spec/redjs/tap.rb +0 -8
  718. data/spec/redjs_helper.rb +0 -3
  719. data/spec/spec.opts +0 -1
  720. data/spec/v8/to_spec.rb +0 -15
  721. data/tasks/rspec.rake +0 -21
@@ -1,2072 +0,0 @@
1
- // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #ifndef V8_SPACES_H_
29
- #define V8_SPACES_H_
30
-
31
- #include "list-inl.h"
32
- #include "log.h"
33
-
34
- namespace v8 {
35
- namespace internal {
36
-
37
- // -----------------------------------------------------------------------------
38
- // Heap structures:
39
- //
40
- // A JS heap consists of a young generation, an old generation, and a large
41
- // object space. The young generation is divided into two semispaces. A
42
- // scavenger implements Cheney's copying algorithm. The old generation is
43
- // separated into a map space and an old object space. The map space contains
44
- // all (and only) map objects, the rest of old objects go into the old space.
45
- // The old generation is collected by a mark-sweep-compact collector.
46
- //
47
- // The semispaces of the young generation are contiguous. The old and map
48
- // spaces consists of a list of pages. A page has a page header, a remembered
49
- // set area, and an object area. A page size is deliberately chosen as 8K
50
- // bytes. The first word of a page is an opaque page header that has the
51
- // address of the next page and its ownership information. The second word may
52
- // have the allocation top address of this page. The next 248 bytes are
53
- // remembered sets. Heap objects are aligned to the pointer size (4 bytes). A
54
- // remembered set bit corresponds to a pointer in the object area.
55
- //
56
- // There is a separate large object space for objects larger than
57
- // Page::kMaxHeapObjectSize, so that they do not have to move during
58
- // collection. The large object space is paged and uses the same remembered
59
- // set implementation. Pages in large object space may be larger than 8K.
60
- //
61
- // NOTE: The mark-compact collector rebuilds the remembered set after a
62
- // collection. It reuses first a few words of the remembered set for
63
- // bookkeeping relocation information.
64
-
65
-
66
- // Some assertion macros used in the debugging mode.
67
-
68
- #define ASSERT_PAGE_ALIGNED(address) \
69
- ASSERT((OffsetFrom(address) & Page::kPageAlignmentMask) == 0)
70
-
71
- #define ASSERT_OBJECT_ALIGNED(address) \
72
- ASSERT((OffsetFrom(address) & kObjectAlignmentMask) == 0)
73
-
74
- #define ASSERT_MAP_ALIGNED(address) \
75
- ASSERT((OffsetFrom(address) & kMapAlignmentMask) == 0)
76
-
77
- #define ASSERT_OBJECT_SIZE(size) \
78
- ASSERT((0 < size) && (size <= Page::kMaxHeapObjectSize))
79
-
80
- #define ASSERT_PAGE_OFFSET(offset) \
81
- ASSERT((Page::kObjectStartOffset <= offset) \
82
- && (offset <= Page::kPageSize))
83
-
84
- #define ASSERT_MAP_PAGE_INDEX(index) \
85
- ASSERT((0 <= index) && (index <= MapSpace::kMaxMapPageIndex))
86
-
87
-
88
- class PagedSpace;
89
- class MemoryAllocator;
90
- class AllocationInfo;
91
-
92
- // -----------------------------------------------------------------------------
93
- // A page normally has 8K bytes. Large object pages may be larger. A page
94
- // address is always aligned to the 8K page size. A page is divided into
95
- // three areas: the first two words are used for bookkeeping, the next 248
96
- // bytes are used as remembered set, and the rest of the page is the object
97
- // area.
98
- //
99
- // Pointers are aligned to the pointer size (4), only 1 bit is needed
100
- // for a pointer in the remembered set. Given an address, its remembered set
101
- // bit position (offset from the start of the page) is calculated by dividing
102
- // its page offset by 32. Therefore, the object area in a page starts at the
103
- // 256th byte (8K/32). Bytes 0 to 255 do not need the remembered set, so that
104
- // the first two words (64 bits) in a page can be used for other purposes.
105
- //
106
- // On the 64-bit platform, we add an offset to the start of the remembered set,
107
- // and pointers are aligned to 8-byte pointer size. This means that we need
108
- // only 128 bytes for the RSet, and only get two bytes free in the RSet's RSet.
109
- // For this reason we add an offset to get room for the Page data at the start.
110
- //
111
- // The mark-compact collector transforms a map pointer into a page index and a
112
- // page offset. The excact encoding is described in the comments for
113
- // class MapWord in objects.h.
114
- //
115
- // The only way to get a page pointer is by calling factory methods:
116
- // Page* p = Page::FromAddress(addr); or
117
- // Page* p = Page::FromAllocationTop(top);
118
- class Page {
119
- public:
120
- // Returns the page containing a given address. The address ranges
121
- // from [page_addr .. page_addr + kPageSize[
122
- //
123
- // Note that this function only works for addresses in normal paged
124
- // spaces and addresses in the first 8K of large object pages (i.e.,
125
- // the start of large objects but not necessarily derived pointers
126
- // within them).
127
- INLINE(static Page* FromAddress(Address a)) {
128
- return reinterpret_cast<Page*>(OffsetFrom(a) & ~kPageAlignmentMask);
129
- }
130
-
131
- // Returns the page containing an allocation top. Because an allocation
132
- // top address can be the upper bound of the page, we need to subtract
133
- // it with kPointerSize first. The address ranges from
134
- // [page_addr + kObjectStartOffset .. page_addr + kPageSize].
135
- INLINE(static Page* FromAllocationTop(Address top)) {
136
- Page* p = FromAddress(top - kPointerSize);
137
- ASSERT_PAGE_OFFSET(p->Offset(top));
138
- return p;
139
- }
140
-
141
- // Returns the start address of this page.
142
- Address address() { return reinterpret_cast<Address>(this); }
143
-
144
- // Checks whether this is a valid page address.
145
- bool is_valid() { return address() != NULL; }
146
-
147
- // Returns the next page of this page.
148
- inline Page* next_page();
149
-
150
- // Return the end of allocation in this page. Undefined for unused pages.
151
- inline Address AllocationTop();
152
-
153
- // Returns the start address of the object area in this page.
154
- Address ObjectAreaStart() { return address() + kObjectStartOffset; }
155
-
156
- // Returns the end address (exclusive) of the object area in this page.
157
- Address ObjectAreaEnd() { return address() + Page::kPageSize; }
158
-
159
- // Returns the start address of the remembered set area.
160
- Address RSetStart() { return address() + kRSetStartOffset; }
161
-
162
- // Returns the end address of the remembered set area (exclusive).
163
- Address RSetEnd() { return address() + kRSetEndOffset; }
164
-
165
- // Checks whether an address is page aligned.
166
- static bool IsAlignedToPageSize(Address a) {
167
- return 0 == (OffsetFrom(a) & kPageAlignmentMask);
168
- }
169
-
170
- // True if this page is a large object page.
171
- bool IsLargeObjectPage() { return (is_normal_page & 0x1) == 0; }
172
-
173
- // Returns the offset of a given address to this page.
174
- INLINE(int Offset(Address a)) {
175
- int offset = static_cast<int>(a - address());
176
- ASSERT_PAGE_OFFSET(offset);
177
- return offset;
178
- }
179
-
180
- // Returns the address for a given offset to the this page.
181
- Address OffsetToAddress(int offset) {
182
- ASSERT_PAGE_OFFSET(offset);
183
- return address() + offset;
184
- }
185
-
186
- // ---------------------------------------------------------------------
187
- // Remembered set support
188
-
189
- // Clears remembered set in this page.
190
- inline void ClearRSet();
191
-
192
- // Return the address of the remembered set word corresponding to an
193
- // object address/offset pair, and the bit encoded as a single-bit
194
- // mask in the output parameter 'bitmask'.
195
- INLINE(static Address ComputeRSetBitPosition(Address address, int offset,
196
- uint32_t* bitmask));
197
-
198
- // Sets the corresponding remembered set bit for a given address.
199
- INLINE(static void SetRSet(Address address, int offset));
200
-
201
- // Clears the corresponding remembered set bit for a given address.
202
- static inline void UnsetRSet(Address address, int offset);
203
-
204
- // Checks whether the remembered set bit for a given address is set.
205
- static inline bool IsRSetSet(Address address, int offset);
206
-
207
- #ifdef DEBUG
208
- // Use a state to mark whether remembered set space can be used for other
209
- // purposes.
210
- enum RSetState { IN_USE, NOT_IN_USE };
211
- static bool is_rset_in_use() { return rset_state_ == IN_USE; }
212
- static void set_rset_state(RSetState state) { rset_state_ = state; }
213
- #endif
214
-
215
- // Page size in bytes. This must be a multiple of the OS page size.
216
- static const int kPageSize = 1 << kPageSizeBits;
217
-
218
- // Page size mask.
219
- static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1;
220
-
221
- // The offset of the remembered set in a page, in addition to the empty bytes
222
- // formed as the remembered bits of the remembered set itself.
223
- #ifdef V8_TARGET_ARCH_X64
224
- static const int kRSetOffset = 4 * kPointerSize; // Room for four pointers.
225
- #else
226
- static const int kRSetOffset = 0;
227
- #endif
228
- // The end offset of the remembered set in a page
229
- // (heaps are aligned to pointer size).
230
- static const int kRSetEndOffset = kRSetOffset + kPageSize / kBitsPerPointer;
231
-
232
- // The start offset of the object area in a page.
233
- // This needs to be at least (bits per uint32_t) * kBitsPerPointer,
234
- // to align start of rset to a uint32_t address.
235
- static const int kObjectStartOffset = 256;
236
-
237
- // The start offset of the used part of the remembered set in a page.
238
- static const int kRSetStartOffset = kRSetOffset +
239
- kObjectStartOffset / kBitsPerPointer;
240
-
241
- // Object area size in bytes.
242
- static const int kObjectAreaSize = kPageSize - kObjectStartOffset;
243
-
244
- // Maximum object size that fits in a page.
245
- static const int kMaxHeapObjectSize = kObjectAreaSize;
246
-
247
- //---------------------------------------------------------------------------
248
- // Page header description.
249
- //
250
- // If a page is not in the large object space, the first word,
251
- // opaque_header, encodes the next page address (aligned to kPageSize 8K)
252
- // and the chunk number (0 ~ 8K-1). Only MemoryAllocator should use
253
- // opaque_header. The value range of the opaque_header is [0..kPageSize[,
254
- // or [next_page_start, next_page_end[. It cannot point to a valid address
255
- // in the current page. If a page is in the large object space, the first
256
- // word *may* (if the page start and large object chunk start are the
257
- // same) contain the address of the next large object chunk.
258
- intptr_t opaque_header;
259
-
260
- // If the page is not in the large object space, the low-order bit of the
261
- // second word is set. If the page is in the large object space, the
262
- // second word *may* (if the page start and large object chunk start are
263
- // the same) contain the large object chunk size. In either case, the
264
- // low-order bit for large object pages will be cleared.
265
- int is_normal_page;
266
-
267
- // The following fields may overlap with remembered set, they can only
268
- // be used in the mark-compact collector when remembered set is not
269
- // used.
270
-
271
- // The index of the page in its owner space.
272
- int mc_page_index;
273
-
274
- // The allocation pointer after relocating objects to this page.
275
- Address mc_relocation_top;
276
-
277
- // The forwarding address of the first live object in this page.
278
- Address mc_first_forwarded;
279
-
280
- #ifdef DEBUG
281
- private:
282
- static RSetState rset_state_; // state of the remembered set
283
- #endif
284
- };
285
-
286
-
287
- // ----------------------------------------------------------------------------
288
- // Space is the abstract superclass for all allocation spaces.
289
- class Space : public Malloced {
290
- public:
291
- Space(AllocationSpace id, Executability executable)
292
- : id_(id), executable_(executable) {}
293
-
294
- virtual ~Space() {}
295
-
296
- // Does the space need executable memory?
297
- Executability executable() { return executable_; }
298
-
299
- // Identity used in error reporting.
300
- AllocationSpace identity() { return id_; }
301
-
302
- virtual int Size() = 0;
303
-
304
- #ifdef DEBUG
305
- virtual void Print() = 0;
306
- #endif
307
-
308
- // After calling this we can allocate a certain number of bytes using only
309
- // linear allocation (with a LinearAllocationScope and an AlwaysAllocateScope)
310
- // without using freelists or causing a GC. This is used by partial
311
- // snapshots. It returns true of space was reserved or false if a GC is
312
- // needed. For paged spaces the space requested must include the space wasted
313
- // at the end of each when allocating linearly.
314
- virtual bool ReserveSpace(int bytes) = 0;
315
-
316
- private:
317
- AllocationSpace id_;
318
- Executability executable_;
319
- };
320
-
321
-
322
- // ----------------------------------------------------------------------------
323
- // All heap objects containing executable code (code objects) must be allocated
324
- // from a 2 GB range of memory, so that they can call each other using 32-bit
325
- // displacements. This happens automatically on 32-bit platforms, where 32-bit
326
- // displacements cover the entire 4GB virtual address space. On 64-bit
327
- // platforms, we support this using the CodeRange object, which reserves and
328
- // manages a range of virtual memory.
329
- class CodeRange : public AllStatic {
330
- public:
331
- // Reserves a range of virtual memory, but does not commit any of it.
332
- // Can only be called once, at heap initialization time.
333
- // Returns false on failure.
334
- static bool Setup(const size_t requested_size);
335
-
336
- // Frees the range of virtual memory, and frees the data structures used to
337
- // manage it.
338
- static void TearDown();
339
-
340
- static bool exists() { return code_range_ != NULL; }
341
- static bool contains(Address address) {
342
- if (code_range_ == NULL) return false;
343
- Address start = static_cast<Address>(code_range_->address());
344
- return start <= address && address < start + code_range_->size();
345
- }
346
-
347
- // Allocates a chunk of memory from the large-object portion of
348
- // the code range. On platforms with no separate code range, should
349
- // not be called.
350
- static void* AllocateRawMemory(const size_t requested, size_t* allocated);
351
- static void FreeRawMemory(void* buf, size_t length);
352
-
353
- private:
354
- // The reserved range of virtual memory that all code objects are put in.
355
- static VirtualMemory* code_range_;
356
- // Plain old data class, just a struct plus a constructor.
357
- class FreeBlock {
358
- public:
359
- FreeBlock(Address start_arg, size_t size_arg)
360
- : start(start_arg), size(size_arg) {}
361
- FreeBlock(void* start_arg, size_t size_arg)
362
- : start(static_cast<Address>(start_arg)), size(size_arg) {}
363
-
364
- Address start;
365
- size_t size;
366
- };
367
-
368
- // Freed blocks of memory are added to the free list. When the allocation
369
- // list is exhausted, the free list is sorted and merged to make the new
370
- // allocation list.
371
- static List<FreeBlock> free_list_;
372
- // Memory is allocated from the free blocks on the allocation list.
373
- // The block at current_allocation_block_index_ is the current block.
374
- static List<FreeBlock> allocation_list_;
375
- static int current_allocation_block_index_;
376
-
377
- // Finds a block on the allocation list that contains at least the
378
- // requested amount of memory. If none is found, sorts and merges
379
- // the existing free memory blocks, and searches again.
380
- // If none can be found, terminates V8 with FatalProcessOutOfMemory.
381
- static void GetNextAllocationBlock(size_t requested);
382
- // Compares the start addresses of two free blocks.
383
- static int CompareFreeBlockAddress(const FreeBlock* left,
384
- const FreeBlock* right);
385
- };
386
-
387
-
388
- // ----------------------------------------------------------------------------
389
- // A space acquires chunks of memory from the operating system. The memory
390
- // allocator manages chunks for the paged heap spaces (old space and map
391
- // space). A paged chunk consists of pages. Pages in a chunk have contiguous
392
- // addresses and are linked as a list.
393
- //
394
- // The allocator keeps an initial chunk which is used for the new space. The
395
- // leftover regions of the initial chunk are used for the initial chunks of
396
- // old space and map space if they are big enough to hold at least one page.
397
- // The allocator assumes that there is one old space and one map space, each
398
- // expands the space by allocating kPagesPerChunk pages except the last
399
- // expansion (before running out of space). The first chunk may contain fewer
400
- // than kPagesPerChunk pages as well.
401
- //
402
- // The memory allocator also allocates chunks for the large object space, but
403
- // they are managed by the space itself. The new space does not expand.
404
-
405
- class MemoryAllocator : public AllStatic {
406
- public:
407
- // Initializes its internal bookkeeping structures.
408
- // Max capacity of the total space.
409
- static bool Setup(int max_capacity);
410
-
411
- // Deletes valid chunks.
412
- static void TearDown();
413
-
414
- // Reserves an initial address range of virtual memory to be split between
415
- // the two new space semispaces, the old space, and the map space. The
416
- // memory is not yet committed or assigned to spaces and split into pages.
417
- // The initial chunk is unmapped when the memory allocator is torn down.
418
- // This function should only be called when there is not already a reserved
419
- // initial chunk (initial_chunk_ should be NULL). It returns the start
420
- // address of the initial chunk if successful, with the side effect of
421
- // setting the initial chunk, or else NULL if unsuccessful and leaves the
422
- // initial chunk NULL.
423
- static void* ReserveInitialChunk(const size_t requested);
424
-
425
- // Commits pages from an as-yet-unmanaged block of virtual memory into a
426
- // paged space. The block should be part of the initial chunk reserved via
427
- // a call to ReserveInitialChunk. The number of pages is always returned in
428
- // the output parameter num_pages. This function assumes that the start
429
- // address is non-null and that it is big enough to hold at least one
430
- // page-aligned page. The call always succeeds, and num_pages is always
431
- // greater than zero.
432
- static Page* CommitPages(Address start, size_t size, PagedSpace* owner,
433
- int* num_pages);
434
-
435
- // Commit a contiguous block of memory from the initial chunk. Assumes that
436
- // the address is not NULL, the size is greater than zero, and that the
437
- // block is contained in the initial chunk. Returns true if it succeeded
438
- // and false otherwise.
439
- static bool CommitBlock(Address start, size_t size, Executability executable);
440
-
441
-
442
- // Uncommit a contiguous block of memory [start..(start+size)[.
443
- // start is not NULL, the size is greater than zero, and the
444
- // block is contained in the initial chunk. Returns true if it succeeded
445
- // and false otherwise.
446
- static bool UncommitBlock(Address start, size_t size);
447
-
448
- // Attempts to allocate the requested (non-zero) number of pages from the
449
- // OS. Fewer pages might be allocated than requested. If it fails to
450
- // allocate memory for the OS or cannot allocate a single page, this
451
- // function returns an invalid page pointer (NULL). The caller must check
452
- // whether the returned page is valid (by calling Page::is_valid()). It is
453
- // guaranteed that allocated pages have contiguous addresses. The actual
454
- // number of allocated pages is returned in the output parameter
455
- // allocated_pages. If the PagedSpace owner is executable and there is
456
- // a code range, the pages are allocated from the code range.
457
- static Page* AllocatePages(int requested_pages, int* allocated_pages,
458
- PagedSpace* owner);
459
-
460
- // Frees pages from a given page and after. If 'p' is the first page
461
- // of a chunk, pages from 'p' are freed and this function returns an
462
- // invalid page pointer. Otherwise, the function searches a page
463
- // after 'p' that is the first page of a chunk. Pages after the
464
- // found page are freed and the function returns 'p'.
465
- static Page* FreePages(Page* p);
466
-
467
- // Allocates and frees raw memory of certain size.
468
- // These are just thin wrappers around OS::Allocate and OS::Free,
469
- // but keep track of allocated bytes as part of heap.
470
- // If the flag is EXECUTABLE and a code range exists, the requested
471
- // memory is allocated from the code range. If a code range exists
472
- // and the freed memory is in it, the code range manages the freed memory.
473
- static void* AllocateRawMemory(const size_t requested,
474
- size_t* allocated,
475
- Executability executable);
476
- static void FreeRawMemory(void* buf, size_t length);
477
-
478
- // Returns the maximum available bytes of heaps.
479
- static int Available() { return capacity_ < size_ ? 0 : capacity_ - size_; }
480
-
481
- // Returns allocated spaces in bytes.
482
- static int Size() { return size_; }
483
-
484
- // Returns maximum available bytes that the old space can have.
485
- static int MaxAvailable() {
486
- return (Available() / Page::kPageSize) * Page::kObjectAreaSize;
487
- }
488
-
489
- // Links two pages.
490
- static inline void SetNextPage(Page* prev, Page* next);
491
-
492
- // Returns the next page of a given page.
493
- static inline Page* GetNextPage(Page* p);
494
-
495
- // Checks whether a page belongs to a space.
496
- static inline bool IsPageInSpace(Page* p, PagedSpace* space);
497
-
498
- // Returns the space that owns the given page.
499
- static inline PagedSpace* PageOwner(Page* page);
500
-
501
- // Finds the first/last page in the same chunk as a given page.
502
- static Page* FindFirstPageInSameChunk(Page* p);
503
- static Page* FindLastPageInSameChunk(Page* p);
504
-
505
- #ifdef ENABLE_HEAP_PROTECTION
506
- // Protect/unprotect a block of memory by marking it read-only/writable.
507
- static inline void Protect(Address start, size_t size);
508
- static inline void Unprotect(Address start, size_t size,
509
- Executability executable);
510
-
511
- // Protect/unprotect a chunk given a page in the chunk.
512
- static inline void ProtectChunkFromPage(Page* page);
513
- static inline void UnprotectChunkFromPage(Page* page);
514
- #endif
515
-
516
- #ifdef DEBUG
517
- // Reports statistic info of the space.
518
- static void ReportStatistics();
519
- #endif
520
-
521
- // Due to encoding limitation, we can only have 8K chunks.
522
- static const int kMaxNofChunks = 1 << kPageSizeBits;
523
- // If a chunk has at least 16 pages, the maximum heap size is about
524
- // 8K * 8K * 16 = 1G bytes.
525
- #ifdef V8_TARGET_ARCH_X64
526
- static const int kPagesPerChunk = 32;
527
- #else
528
- static const int kPagesPerChunk = 16;
529
- #endif
530
- static const int kChunkSize = kPagesPerChunk * Page::kPageSize;
531
-
532
- private:
533
- // Maximum space size in bytes.
534
- static int capacity_;
535
-
536
- // Allocated space size in bytes.
537
- static int size_;
538
-
539
- // The initial chunk of virtual memory.
540
- static VirtualMemory* initial_chunk_;
541
-
542
- // Allocated chunk info: chunk start address, chunk size, and owning space.
543
- class ChunkInfo BASE_EMBEDDED {
544
- public:
545
- ChunkInfo() : address_(NULL), size_(0), owner_(NULL) {}
546
- void init(Address a, size_t s, PagedSpace* o) {
547
- address_ = a;
548
- size_ = s;
549
- owner_ = o;
550
- }
551
- Address address() { return address_; }
552
- size_t size() { return size_; }
553
- PagedSpace* owner() { return owner_; }
554
-
555
- private:
556
- Address address_;
557
- size_t size_;
558
- PagedSpace* owner_;
559
- };
560
-
561
- // Chunks_, free_chunk_ids_ and top_ act as a stack of free chunk ids.
562
- static List<ChunkInfo> chunks_;
563
- static List<int> free_chunk_ids_;
564
- static int max_nof_chunks_;
565
- static int top_;
566
-
567
- // Push/pop a free chunk id onto/from the stack.
568
- static void Push(int free_chunk_id);
569
- static int Pop();
570
- static bool OutOfChunkIds() { return top_ == 0; }
571
-
572
- // Frees a chunk.
573
- static void DeleteChunk(int chunk_id);
574
-
575
- // Basic check whether a chunk id is in the valid range.
576
- static inline bool IsValidChunkId(int chunk_id);
577
-
578
- // Checks whether a chunk id identifies an allocated chunk.
579
- static inline bool IsValidChunk(int chunk_id);
580
-
581
- // Returns the chunk id that a page belongs to.
582
- static inline int GetChunkId(Page* p);
583
-
584
- // True if the address lies in the initial chunk.
585
- static inline bool InInitialChunk(Address address);
586
-
587
- // Initializes pages in a chunk. Returns the first page address.
588
- // This function and GetChunkId() are provided for the mark-compact
589
- // collector to rebuild page headers in the from space, which is
590
- // used as a marking stack and its page headers are destroyed.
591
- static Page* InitializePagesInChunk(int chunk_id, int pages_in_chunk,
592
- PagedSpace* owner);
593
- };
594
-
595
-
596
- // -----------------------------------------------------------------------------
597
- // Interface for heap object iterator to be implemented by all object space
598
- // object iterators.
599
- //
600
- // NOTE: The space specific object iterators also implements the own has_next()
601
- // and next() methods which are used to avoid using virtual functions
602
- // iterating a specific space.
603
-
604
- class ObjectIterator : public Malloced {
605
- public:
606
- virtual ~ObjectIterator() { }
607
-
608
- virtual bool has_next_object() = 0;
609
- virtual HeapObject* next_object() = 0;
610
- };
611
-
612
-
613
- // -----------------------------------------------------------------------------
614
- // Heap object iterator in new/old/map spaces.
615
- //
616
- // A HeapObjectIterator iterates objects from a given address to the
617
- // top of a space. The given address must be below the current
618
- // allocation pointer (space top). There are some caveats.
619
- //
620
- // (1) If the space top changes upward during iteration (because of
621
- // allocating new objects), the iterator does not iterate objects
622
- // above the original space top. The caller must create a new
623
- // iterator starting from the old top in order to visit these new
624
- // objects.
625
- //
626
- // (2) If new objects are allocated below the original allocation top
627
- // (e.g., free-list allocation in paged spaces), the new objects
628
- // may or may not be iterated depending on their position with
629
- // respect to the current point of iteration.
630
- //
631
- // (3) The space top should not change downward during iteration,
632
- // otherwise the iterator will return not-necessarily-valid
633
- // objects.
634
-
635
- class HeapObjectIterator: public ObjectIterator {
636
- public:
637
- // Creates a new object iterator in a given space. If a start
638
- // address is not given, the iterator starts from the space bottom.
639
- // If the size function is not given, the iterator calls the default
640
- // Object::Size().
641
- explicit HeapObjectIterator(PagedSpace* space);
642
- HeapObjectIterator(PagedSpace* space, HeapObjectCallback size_func);
643
- HeapObjectIterator(PagedSpace* space, Address start);
644
- HeapObjectIterator(PagedSpace* space,
645
- Address start,
646
- HeapObjectCallback size_func);
647
-
648
- inline bool has_next();
649
- inline HeapObject* next();
650
-
651
- // implementation of ObjectIterator.
652
- virtual bool has_next_object() { return has_next(); }
653
- virtual HeapObject* next_object() { return next(); }
654
-
655
- private:
656
- Address cur_addr_; // current iteration point
657
- Address end_addr_; // end iteration point
658
- Address cur_limit_; // current page limit
659
- HeapObjectCallback size_func_; // size function
660
- Page* end_page_; // caches the page of the end address
661
-
662
- // Slow path of has_next, checks whether there are more objects in
663
- // the next page.
664
- bool HasNextInNextPage();
665
-
666
- // Initializes fields.
667
- void Initialize(Address start, Address end, HeapObjectCallback size_func);
668
-
669
- #ifdef DEBUG
670
- // Verifies whether fields have valid values.
671
- void Verify();
672
- #endif
673
- };
674
-
675
-
676
- // -----------------------------------------------------------------------------
677
- // A PageIterator iterates the pages in a paged space.
678
- //
679
- // The PageIterator class provides three modes for iterating pages in a space:
680
- // PAGES_IN_USE iterates pages containing allocated objects.
681
- // PAGES_USED_BY_MC iterates pages that hold relocated objects during a
682
- // mark-compact collection.
683
- // ALL_PAGES iterates all pages in the space.
684
- //
685
- // There are some caveats.
686
- //
687
- // (1) If the space expands during iteration, new pages will not be
688
- // returned by the iterator in any mode.
689
- //
690
- // (2) If new objects are allocated during iteration, they will appear
691
- // in pages returned by the iterator. Allocation may cause the
692
- // allocation pointer or MC allocation pointer in the last page to
693
- // change between constructing the iterator and iterating the last
694
- // page.
695
- //
696
- // (3) The space should not shrink during iteration, otherwise the
697
- // iterator will return deallocated pages.
698
-
699
- class PageIterator BASE_EMBEDDED {
700
- public:
701
- enum Mode {
702
- PAGES_IN_USE,
703
- PAGES_USED_BY_MC,
704
- ALL_PAGES
705
- };
706
-
707
- PageIterator(PagedSpace* space, Mode mode);
708
-
709
- inline bool has_next();
710
- inline Page* next();
711
-
712
- private:
713
- PagedSpace* space_;
714
- Page* prev_page_; // Previous page returned.
715
- Page* stop_page_; // Page to stop at (last page returned by the iterator).
716
- };
717
-
718
-
719
- // -----------------------------------------------------------------------------
720
- // A space has a list of pages. The next page can be accessed via
721
- // Page::next_page() call. The next page of the last page is an
722
- // invalid page pointer. A space can expand and shrink dynamically.
723
-
724
- // An abstraction of allocation and relocation pointers in a page-structured
725
- // space.
726
- class AllocationInfo {
727
- public:
728
- Address top; // current allocation top
729
- Address limit; // current allocation limit
730
-
731
- #ifdef DEBUG
732
- bool VerifyPagedAllocation() {
733
- return (Page::FromAllocationTop(top) == Page::FromAllocationTop(limit))
734
- && (top <= limit);
735
- }
736
- #endif
737
- };
738
-
739
-
740
- // An abstraction of the accounting statistics of a page-structured space.
741
- // The 'capacity' of a space is the number of object-area bytes (ie, not
742
- // including page bookkeeping structures) currently in the space. The 'size'
743
- // of a space is the number of allocated bytes, the 'waste' in the space is
744
- // the number of bytes that are not allocated and not available to
745
- // allocation without reorganizing the space via a GC (eg, small blocks due
746
- // to internal fragmentation, top of page areas in map space), and the bytes
747
- // 'available' is the number of unallocated bytes that are not waste. The
748
- // capacity is the sum of size, waste, and available.
749
- //
750
- // The stats are only set by functions that ensure they stay balanced. These
751
- // functions increase or decrease one of the non-capacity stats in
752
- // conjunction with capacity, or else they always balance increases and
753
- // decreases to the non-capacity stats.
754
- class AllocationStats BASE_EMBEDDED {
755
- public:
756
- AllocationStats() { Clear(); }
757
-
758
- // Zero out all the allocation statistics (ie, no capacity).
759
- void Clear() {
760
- capacity_ = 0;
761
- available_ = 0;
762
- size_ = 0;
763
- waste_ = 0;
764
- }
765
-
766
- // Reset the allocation statistics (ie, available = capacity with no
767
- // wasted or allocated bytes).
768
- void Reset() {
769
- available_ = capacity_;
770
- size_ = 0;
771
- waste_ = 0;
772
- }
773
-
774
- // Accessors for the allocation statistics.
775
- int Capacity() { return capacity_; }
776
- int Available() { return available_; }
777
- int Size() { return size_; }
778
- int Waste() { return waste_; }
779
-
780
- // Grow the space by adding available bytes.
781
- void ExpandSpace(int size_in_bytes) {
782
- capacity_ += size_in_bytes;
783
- available_ += size_in_bytes;
784
- }
785
-
786
- // Shrink the space by removing available bytes.
787
- void ShrinkSpace(int size_in_bytes) {
788
- capacity_ -= size_in_bytes;
789
- available_ -= size_in_bytes;
790
- }
791
-
792
- // Allocate from available bytes (available -> size).
793
- void AllocateBytes(int size_in_bytes) {
794
- available_ -= size_in_bytes;
795
- size_ += size_in_bytes;
796
- }
797
-
798
- // Free allocated bytes, making them available (size -> available).
799
- void DeallocateBytes(int size_in_bytes) {
800
- size_ -= size_in_bytes;
801
- available_ += size_in_bytes;
802
- }
803
-
804
- // Waste free bytes (available -> waste).
805
- void WasteBytes(int size_in_bytes) {
806
- available_ -= size_in_bytes;
807
- waste_ += size_in_bytes;
808
- }
809
-
810
- // Consider the wasted bytes to be allocated, as they contain filler
811
- // objects (waste -> size).
812
- void FillWastedBytes(int size_in_bytes) {
813
- waste_ -= size_in_bytes;
814
- size_ += size_in_bytes;
815
- }
816
-
817
- private:
818
- int capacity_;
819
- int available_;
820
- int size_;
821
- int waste_;
822
- };
823
-
824
-
825
- class PagedSpace : public Space {
826
- public:
827
- // Creates a space with a maximum capacity, and an id.
828
- PagedSpace(int max_capacity, AllocationSpace id, Executability executable);
829
-
830
- virtual ~PagedSpace() {}
831
-
832
- // Set up the space using the given address range of virtual memory (from
833
- // the memory allocator's initial chunk) if possible. If the block of
834
- // addresses is not big enough to contain a single page-aligned page, a
835
- // fresh chunk will be allocated.
836
- bool Setup(Address start, size_t size);
837
-
838
- // Returns true if the space has been successfully set up and not
839
- // subsequently torn down.
840
- bool HasBeenSetup();
841
-
842
- // Cleans up the space, frees all pages in this space except those belonging
843
- // to the initial chunk, uncommits addresses in the initial chunk.
844
- void TearDown();
845
-
846
- // Checks whether an object/address is in this space.
847
- inline bool Contains(Address a);
848
- bool Contains(HeapObject* o) { return Contains(o->address()); }
849
-
850
- // Given an address occupied by a live object, return that object if it is
851
- // in this space, or Failure::Exception() if it is not. The implementation
852
- // iterates over objects in the page containing the address, the cost is
853
- // linear in the number of objects in the page. It may be slow.
854
- Object* FindObject(Address addr);
855
-
856
- // Checks whether page is currently in use by this space.
857
- bool IsUsed(Page* page);
858
-
859
- // Clears remembered sets of pages in this space.
860
- void ClearRSet();
861
-
862
- // Prepares for a mark-compact GC.
863
- virtual void PrepareForMarkCompact(bool will_compact) = 0;
864
-
865
- virtual Address PageAllocationTop(Page* page) = 0;
866
-
867
- // Current capacity without growing (Size() + Available() + Waste()).
868
- int Capacity() { return accounting_stats_.Capacity(); }
869
-
870
- // Total amount of memory committed for this space. For paged
871
- // spaces this equals the capacity.
872
- int CommittedMemory() { return Capacity(); }
873
-
874
- // Available bytes without growing.
875
- int Available() { return accounting_stats_.Available(); }
876
-
877
- // Allocated bytes in this space.
878
- virtual int Size() { return accounting_stats_.Size(); }
879
-
880
- // Wasted bytes due to fragmentation and not recoverable until the
881
- // next GC of this space.
882
- int Waste() { return accounting_stats_.Waste(); }
883
-
884
- // Returns the address of the first object in this space.
885
- Address bottom() { return first_page_->ObjectAreaStart(); }
886
-
887
- // Returns the allocation pointer in this space.
888
- Address top() { return allocation_info_.top; }
889
-
890
- // Allocate the requested number of bytes in the space if possible, return a
891
- // failure object if not.
892
- inline Object* AllocateRaw(int size_in_bytes);
893
-
894
- // Allocate the requested number of bytes for relocation during mark-compact
895
- // collection.
896
- inline Object* MCAllocateRaw(int size_in_bytes);
897
-
898
- virtual bool ReserveSpace(int bytes);
899
-
900
- // Used by ReserveSpace.
901
- virtual void PutRestOfCurrentPageOnFreeList(Page* current_page) = 0;
902
-
903
- // ---------------------------------------------------------------------------
904
- // Mark-compact collection support functions
905
-
906
- // Set the relocation point to the beginning of the space.
907
- void MCResetRelocationInfo();
908
-
909
- // Writes relocation info to the top page.
910
- void MCWriteRelocationInfoToPage() {
911
- TopPageOf(mc_forwarding_info_)->mc_relocation_top = mc_forwarding_info_.top;
912
- }
913
-
914
- // Computes the offset of a given address in this space to the beginning
915
- // of the space.
916
- int MCSpaceOffsetForAddress(Address addr);
917
-
918
- // Updates the allocation pointer to the relocation top after a mark-compact
919
- // collection.
920
- virtual void MCCommitRelocationInfo() = 0;
921
-
922
- // Releases half of unused pages.
923
- void Shrink();
924
-
925
- // Ensures that the capacity is at least 'capacity'. Returns false on failure.
926
- bool EnsureCapacity(int capacity);
927
-
928
- #ifdef ENABLE_HEAP_PROTECTION
929
- // Protect/unprotect the space by marking it read-only/writable.
930
- void Protect();
931
- void Unprotect();
932
- #endif
933
-
934
- #ifdef DEBUG
935
- // Print meta info and objects in this space.
936
- virtual void Print();
937
-
938
- // Verify integrity of this space.
939
- virtual void Verify(ObjectVisitor* visitor);
940
-
941
- // Overridden by subclasses to verify space-specific object
942
- // properties (e.g., only maps or free-list nodes are in map space).
943
- virtual void VerifyObject(HeapObject* obj) {}
944
-
945
- // Report code object related statistics
946
- void CollectCodeStatistics();
947
- static void ReportCodeStatistics();
948
- static void ResetCodeStatistics();
949
- #endif
950
-
951
- protected:
952
- // Maximum capacity of this space.
953
- int max_capacity_;
954
-
955
- // Accounting information for this space.
956
- AllocationStats accounting_stats_;
957
-
958
- // The first page in this space.
959
- Page* first_page_;
960
-
961
- // The last page in this space. Initially set in Setup, updated in
962
- // Expand and Shrink.
963
- Page* last_page_;
964
-
965
- // Normal allocation information.
966
- AllocationInfo allocation_info_;
967
-
968
- // Relocation information during mark-compact collections.
969
- AllocationInfo mc_forwarding_info_;
970
-
971
- // Bytes of each page that cannot be allocated. Possibly non-zero
972
- // for pages in spaces with only fixed-size objects. Always zero
973
- // for pages in spaces with variable sized objects (those pages are
974
- // padded with free-list nodes).
975
- int page_extra_;
976
-
977
- // Sets allocation pointer to a page bottom.
978
- static void SetAllocationInfo(AllocationInfo* alloc_info, Page* p);
979
-
980
- // Returns the top page specified by an allocation info structure.
981
- static Page* TopPageOf(AllocationInfo alloc_info) {
982
- return Page::FromAllocationTop(alloc_info.limit);
983
- }
984
-
985
- int CountPagesToTop() {
986
- Page* p = Page::FromAllocationTop(allocation_info_.top);
987
- PageIterator it(this, PageIterator::ALL_PAGES);
988
- int counter = 1;
989
- while (it.has_next()) {
990
- if (it.next() == p) return counter;
991
- counter++;
992
- }
993
- UNREACHABLE();
994
- return -1;
995
- }
996
-
997
- // Expands the space by allocating a fixed number of pages. Returns false if
998
- // it cannot allocate requested number of pages from OS. Newly allocated
999
- // pages are append to the last_page;
1000
- bool Expand(Page* last_page);
1001
-
1002
- // Generic fast case allocation function that tries linear allocation in
1003
- // the top page of 'alloc_info'. Returns NULL on failure.
1004
- inline HeapObject* AllocateLinearly(AllocationInfo* alloc_info,
1005
- int size_in_bytes);
1006
-
1007
- // During normal allocation or deserialization, roll to the next page in
1008
- // the space (there is assumed to be one) and allocate there. This
1009
- // function is space-dependent.
1010
- virtual HeapObject* AllocateInNextPage(Page* current_page,
1011
- int size_in_bytes) = 0;
1012
-
1013
- // Slow path of AllocateRaw. This function is space-dependent.
1014
- virtual HeapObject* SlowAllocateRaw(int size_in_bytes) = 0;
1015
-
1016
- // Slow path of MCAllocateRaw.
1017
- HeapObject* SlowMCAllocateRaw(int size_in_bytes);
1018
-
1019
- #ifdef DEBUG
1020
- // Returns the number of total pages in this space.
1021
- int CountTotalPages();
1022
-
1023
- void DoPrintRSet(const char* space_name);
1024
- #endif
1025
- private:
1026
- // Returns the page of the allocation pointer.
1027
- Page* AllocationTopPage() { return TopPageOf(allocation_info_); }
1028
-
1029
- // Returns a pointer to the page of the relocation pointer.
1030
- Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); }
1031
-
1032
- friend class PageIterator;
1033
- };
1034
-
1035
-
1036
- #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1037
- class NumberAndSizeInfo BASE_EMBEDDED {
1038
- public:
1039
- NumberAndSizeInfo() : number_(0), bytes_(0) {}
1040
-
1041
- int number() const { return number_; }
1042
- void increment_number(int num) { number_ += num; }
1043
-
1044
- int bytes() const { return bytes_; }
1045
- void increment_bytes(int size) { bytes_ += size; }
1046
-
1047
- void clear() {
1048
- number_ = 0;
1049
- bytes_ = 0;
1050
- }
1051
-
1052
- private:
1053
- int number_;
1054
- int bytes_;
1055
- };
1056
-
1057
-
1058
- // HistogramInfo class for recording a single "bar" of a histogram. This
1059
- // class is used for collecting statistics to print to stdout (when compiled
1060
- // with DEBUG) or to the log file (when compiled with
1061
- // ENABLE_LOGGING_AND_PROFILING).
1062
- class HistogramInfo: public NumberAndSizeInfo {
1063
- public:
1064
- HistogramInfo() : NumberAndSizeInfo() {}
1065
-
1066
- const char* name() { return name_; }
1067
- void set_name(const char* name) { name_ = name; }
1068
-
1069
- private:
1070
- const char* name_;
1071
- };
1072
- #endif
1073
-
1074
-
1075
- // -----------------------------------------------------------------------------
1076
- // SemiSpace in young generation
1077
- //
1078
- // A semispace is a contiguous chunk of memory. The mark-compact collector
1079
- // uses the memory in the from space as a marking stack when tracing live
1080
- // objects.
1081
-
1082
- class SemiSpace : public Space {
1083
- public:
1084
- // Constructor.
1085
- SemiSpace() :Space(NEW_SPACE, NOT_EXECUTABLE) {
1086
- start_ = NULL;
1087
- age_mark_ = NULL;
1088
- }
1089
-
1090
- // Sets up the semispace using the given chunk.
1091
- bool Setup(Address start, int initial_capacity, int maximum_capacity);
1092
-
1093
- // Tear down the space. Heap memory was not allocated by the space, so it
1094
- // is not deallocated here.
1095
- void TearDown();
1096
-
1097
- // True if the space has been set up but not torn down.
1098
- bool HasBeenSetup() { return start_ != NULL; }
1099
-
1100
- // Grow the size of the semispace by committing extra virtual memory.
1101
- // Assumes that the caller has checked that the semispace has not reached
1102
- // its maximum capacity (and thus there is space available in the reserved
1103
- // address range to grow).
1104
- bool Grow();
1105
-
1106
- // Grow the semispace to the new capacity. The new capacity
1107
- // requested must be larger than the current capacity.
1108
- bool GrowTo(int new_capacity);
1109
-
1110
- // Shrinks the semispace to the new capacity. The new capacity
1111
- // requested must be more than the amount of used memory in the
1112
- // semispace and less than the current capacity.
1113
- bool ShrinkTo(int new_capacity);
1114
-
1115
- // Returns the start address of the space.
1116
- Address low() { return start_; }
1117
- // Returns one past the end address of the space.
1118
- Address high() { return low() + capacity_; }
1119
-
1120
- // Age mark accessors.
1121
- Address age_mark() { return age_mark_; }
1122
- void set_age_mark(Address mark) { age_mark_ = mark; }
1123
-
1124
- // True if the address is in the address range of this semispace (not
1125
- // necessarily below the allocation pointer).
1126
- bool Contains(Address a) {
1127
- return (reinterpret_cast<uintptr_t>(a) & address_mask_)
1128
- == reinterpret_cast<uintptr_t>(start_);
1129
- }
1130
-
1131
- // True if the object is a heap object in the address range of this
1132
- // semispace (not necessarily below the allocation pointer).
1133
- bool Contains(Object* o) {
1134
- return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_;
1135
- }
1136
-
1137
- // The offset of an address from the beginning of the space.
1138
- int SpaceOffsetForAddress(Address addr) {
1139
- return static_cast<int>(addr - low());
1140
- }
1141
-
1142
- // If we don't have these here then SemiSpace will be abstract. However
1143
- // they should never be called.
1144
- virtual int Size() {
1145
- UNREACHABLE();
1146
- return 0;
1147
- }
1148
-
1149
- virtual bool ReserveSpace(int bytes) {
1150
- UNREACHABLE();
1151
- return false;
1152
- }
1153
-
1154
- bool is_committed() { return committed_; }
1155
- bool Commit();
1156
- bool Uncommit();
1157
-
1158
- #ifdef DEBUG
1159
- virtual void Print();
1160
- virtual void Verify();
1161
- #endif
1162
-
1163
- // Returns the current capacity of the semi space.
1164
- int Capacity() { return capacity_; }
1165
-
1166
- // Returns the maximum capacity of the semi space.
1167
- int MaximumCapacity() { return maximum_capacity_; }
1168
-
1169
- // Returns the initial capacity of the semi space.
1170
- int InitialCapacity() { return initial_capacity_; }
1171
-
1172
- private:
1173
- // The current and maximum capacity of the space.
1174
- int capacity_;
1175
- int maximum_capacity_;
1176
- int initial_capacity_;
1177
-
1178
- // The start address of the space.
1179
- Address start_;
1180
- // Used to govern object promotion during mark-compact collection.
1181
- Address age_mark_;
1182
-
1183
- // Masks and comparison values to test for containment in this semispace.
1184
- uintptr_t address_mask_;
1185
- uintptr_t object_mask_;
1186
- uintptr_t object_expected_;
1187
-
1188
- bool committed_;
1189
-
1190
- public:
1191
- TRACK_MEMORY("SemiSpace")
1192
- };
1193
-
1194
-
1195
- // A SemiSpaceIterator is an ObjectIterator that iterates over the active
1196
- // semispace of the heap's new space. It iterates over the objects in the
1197
- // semispace from a given start address (defaulting to the bottom of the
1198
- // semispace) to the top of the semispace. New objects allocated after the
1199
- // iterator is created are not iterated.
1200
- class SemiSpaceIterator : public ObjectIterator {
1201
- public:
1202
- // Create an iterator over the objects in the given space. If no start
1203
- // address is given, the iterator starts from the bottom of the space. If
1204
- // no size function is given, the iterator calls Object::Size().
1205
- explicit SemiSpaceIterator(NewSpace* space);
1206
- SemiSpaceIterator(NewSpace* space, HeapObjectCallback size_func);
1207
- SemiSpaceIterator(NewSpace* space, Address start);
1208
-
1209
- bool has_next() {return current_ < limit_; }
1210
-
1211
- HeapObject* next() {
1212
- ASSERT(has_next());
1213
-
1214
- HeapObject* object = HeapObject::FromAddress(current_);
1215
- int size = (size_func_ == NULL) ? object->Size() : size_func_(object);
1216
-
1217
- current_ += size;
1218
- return object;
1219
- }
1220
-
1221
- // Implementation of the ObjectIterator functions.
1222
- virtual bool has_next_object() { return has_next(); }
1223
- virtual HeapObject* next_object() { return next(); }
1224
-
1225
- private:
1226
- void Initialize(NewSpace* space, Address start, Address end,
1227
- HeapObjectCallback size_func);
1228
-
1229
- // The semispace.
1230
- SemiSpace* space_;
1231
- // The current iteration point.
1232
- Address current_;
1233
- // The end of iteration.
1234
- Address limit_;
1235
- // The callback function.
1236
- HeapObjectCallback size_func_;
1237
- };
1238
-
1239
-
1240
- // -----------------------------------------------------------------------------
1241
- // The young generation space.
1242
- //
1243
- // The new space consists of a contiguous pair of semispaces. It simply
1244
- // forwards most functions to the appropriate semispace.
1245
-
1246
- class NewSpace : public Space {
1247
- public:
1248
- // Constructor.
1249
- NewSpace() : Space(NEW_SPACE, NOT_EXECUTABLE) {}
1250
-
1251
- // Sets up the new space using the given chunk.
1252
- bool Setup(Address start, int size);
1253
-
1254
- // Tears down the space. Heap memory was not allocated by the space, so it
1255
- // is not deallocated here.
1256
- void TearDown();
1257
-
1258
- // True if the space has been set up but not torn down.
1259
- bool HasBeenSetup() {
1260
- return to_space_.HasBeenSetup() && from_space_.HasBeenSetup();
1261
- }
1262
-
1263
- // Flip the pair of spaces.
1264
- void Flip();
1265
-
1266
- // Grow the capacity of the semispaces. Assumes that they are not at
1267
- // their maximum capacity.
1268
- void Grow();
1269
-
1270
- // Shrink the capacity of the semispaces.
1271
- void Shrink();
1272
-
1273
- // True if the address or object lies in the address range of either
1274
- // semispace (not necessarily below the allocation pointer).
1275
- bool Contains(Address a) {
1276
- return (reinterpret_cast<uintptr_t>(a) & address_mask_)
1277
- == reinterpret_cast<uintptr_t>(start_);
1278
- }
1279
- bool Contains(Object* o) {
1280
- return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_;
1281
- }
1282
-
1283
- // Return the allocated bytes in the active semispace.
1284
- virtual int Size() { return static_cast<int>(top() - bottom()); }
1285
-
1286
- // Return the current capacity of a semispace.
1287
- int Capacity() {
1288
- ASSERT(to_space_.Capacity() == from_space_.Capacity());
1289
- return to_space_.Capacity();
1290
- }
1291
-
1292
- // Return the total amount of memory committed for new space.
1293
- int CommittedMemory() {
1294
- if (from_space_.is_committed()) return 2 * Capacity();
1295
- return Capacity();
1296
- }
1297
-
1298
- // Return the available bytes without growing in the active semispace.
1299
- int Available() { return Capacity() - Size(); }
1300
-
1301
- // Return the maximum capacity of a semispace.
1302
- int MaximumCapacity() {
1303
- ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity());
1304
- return to_space_.MaximumCapacity();
1305
- }
1306
-
1307
- // Returns the initial capacity of a semispace.
1308
- int InitialCapacity() {
1309
- ASSERT(to_space_.InitialCapacity() == from_space_.InitialCapacity());
1310
- return to_space_.InitialCapacity();
1311
- }
1312
-
1313
- // Return the address of the allocation pointer in the active semispace.
1314
- Address top() { return allocation_info_.top; }
1315
- // Return the address of the first object in the active semispace.
1316
- Address bottom() { return to_space_.low(); }
1317
-
1318
- // Get the age mark of the inactive semispace.
1319
- Address age_mark() { return from_space_.age_mark(); }
1320
- // Set the age mark in the active semispace.
1321
- void set_age_mark(Address mark) { to_space_.set_age_mark(mark); }
1322
-
1323
- // The start address of the space and a bit mask. Anding an address in the
1324
- // new space with the mask will result in the start address.
1325
- Address start() { return start_; }
1326
- uintptr_t mask() { return address_mask_; }
1327
-
1328
- // The allocation top and limit addresses.
1329
- Address* allocation_top_address() { return &allocation_info_.top; }
1330
- Address* allocation_limit_address() { return &allocation_info_.limit; }
1331
-
1332
- Object* AllocateRaw(int size_in_bytes) {
1333
- return AllocateRawInternal(size_in_bytes, &allocation_info_);
1334
- }
1335
-
1336
- // Allocate the requested number of bytes for relocation during mark-compact
1337
- // collection.
1338
- Object* MCAllocateRaw(int size_in_bytes) {
1339
- return AllocateRawInternal(size_in_bytes, &mc_forwarding_info_);
1340
- }
1341
-
1342
- // Reset the allocation pointer to the beginning of the active semispace.
1343
- void ResetAllocationInfo();
1344
- // Reset the reloction pointer to the bottom of the inactive semispace in
1345
- // preparation for mark-compact collection.
1346
- void MCResetRelocationInfo();
1347
- // Update the allocation pointer in the active semispace after a
1348
- // mark-compact collection.
1349
- void MCCommitRelocationInfo();
1350
-
1351
- // Get the extent of the inactive semispace (for use as a marking stack).
1352
- Address FromSpaceLow() { return from_space_.low(); }
1353
- Address FromSpaceHigh() { return from_space_.high(); }
1354
-
1355
- // Get the extent of the active semispace (to sweep newly copied objects
1356
- // during a scavenge collection).
1357
- Address ToSpaceLow() { return to_space_.low(); }
1358
- Address ToSpaceHigh() { return to_space_.high(); }
1359
-
1360
- // Offsets from the beginning of the semispaces.
1361
- int ToSpaceOffsetForAddress(Address a) {
1362
- return to_space_.SpaceOffsetForAddress(a);
1363
- }
1364
- int FromSpaceOffsetForAddress(Address a) {
1365
- return from_space_.SpaceOffsetForAddress(a);
1366
- }
1367
-
1368
- // True if the object is a heap object in the address range of the
1369
- // respective semispace (not necessarily below the allocation pointer of the
1370
- // semispace).
1371
- bool ToSpaceContains(Object* o) { return to_space_.Contains(o); }
1372
- bool FromSpaceContains(Object* o) { return from_space_.Contains(o); }
1373
-
1374
- bool ToSpaceContains(Address a) { return to_space_.Contains(a); }
1375
- bool FromSpaceContains(Address a) { return from_space_.Contains(a); }
1376
-
1377
- virtual bool ReserveSpace(int bytes);
1378
-
1379
- #ifdef ENABLE_HEAP_PROTECTION
1380
- // Protect/unprotect the space by marking it read-only/writable.
1381
- virtual void Protect();
1382
- virtual void Unprotect();
1383
- #endif
1384
-
1385
- #ifdef DEBUG
1386
- // Verify the active semispace.
1387
- virtual void Verify();
1388
- // Print the active semispace.
1389
- virtual void Print() { to_space_.Print(); }
1390
- #endif
1391
-
1392
- #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1393
- // Iterates the active semispace to collect statistics.
1394
- void CollectStatistics();
1395
- // Reports previously collected statistics of the active semispace.
1396
- void ReportStatistics();
1397
- // Clears previously collected statistics.
1398
- void ClearHistograms();
1399
-
1400
- // Record the allocation or promotion of a heap object. Note that we don't
1401
- // record every single allocation, but only those that happen in the
1402
- // to space during a scavenge GC.
1403
- void RecordAllocation(HeapObject* obj);
1404
- void RecordPromotion(HeapObject* obj);
1405
- #endif
1406
-
1407
- // Return whether the operation succeded.
1408
- bool CommitFromSpaceIfNeeded() {
1409
- if (from_space_.is_committed()) return true;
1410
- return from_space_.Commit();
1411
- }
1412
-
1413
- bool UncommitFromSpace() {
1414
- if (!from_space_.is_committed()) return true;
1415
- return from_space_.Uncommit();
1416
- }
1417
-
1418
- private:
1419
- // The semispaces.
1420
- SemiSpace to_space_;
1421
- SemiSpace from_space_;
1422
-
1423
- // Start address and bit mask for containment testing.
1424
- Address start_;
1425
- uintptr_t address_mask_;
1426
- uintptr_t object_mask_;
1427
- uintptr_t object_expected_;
1428
-
1429
- // Allocation pointer and limit for normal allocation and allocation during
1430
- // mark-compact collection.
1431
- AllocationInfo allocation_info_;
1432
- AllocationInfo mc_forwarding_info_;
1433
-
1434
- #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1435
- HistogramInfo* allocated_histogram_;
1436
- HistogramInfo* promoted_histogram_;
1437
- #endif
1438
-
1439
- // Implementation of AllocateRaw and MCAllocateRaw.
1440
- inline Object* AllocateRawInternal(int size_in_bytes,
1441
- AllocationInfo* alloc_info);
1442
-
1443
- friend class SemiSpaceIterator;
1444
-
1445
- public:
1446
- TRACK_MEMORY("NewSpace")
1447
- };
1448
-
1449
-
1450
- // -----------------------------------------------------------------------------
1451
- // Free lists for old object spaces
1452
- //
1453
- // Free-list nodes are free blocks in the heap. They look like heap objects
1454
- // (free-list node pointers have the heap object tag, and they have a map like
1455
- // a heap object). They have a size and a next pointer. The next pointer is
1456
- // the raw address of the next free list node (or NULL).
1457
- class FreeListNode: public HeapObject {
1458
- public:
1459
- // Obtain a free-list node from a raw address. This is not a cast because
1460
- // it does not check nor require that the first word at the address is a map
1461
- // pointer.
1462
- static FreeListNode* FromAddress(Address address) {
1463
- return reinterpret_cast<FreeListNode*>(HeapObject::FromAddress(address));
1464
- }
1465
-
1466
- static inline bool IsFreeListNode(HeapObject* object);
1467
-
1468
- // Set the size in bytes, which can be read with HeapObject::Size(). This
1469
- // function also writes a map to the first word of the block so that it
1470
- // looks like a heap object to the garbage collector and heap iteration
1471
- // functions.
1472
- void set_size(int size_in_bytes);
1473
-
1474
- // Accessors for the next field.
1475
- inline Address next();
1476
- inline void set_next(Address next);
1477
-
1478
- private:
1479
- static const int kNextOffset = POINTER_SIZE_ALIGN(ByteArray::kHeaderSize);
1480
-
1481
- DISALLOW_IMPLICIT_CONSTRUCTORS(FreeListNode);
1482
- };
1483
-
1484
-
1485
- // The free list for the old space.
1486
- class OldSpaceFreeList BASE_EMBEDDED {
1487
- public:
1488
- explicit OldSpaceFreeList(AllocationSpace owner);
1489
-
1490
- // Clear the free list.
1491
- void Reset();
1492
-
1493
- // Return the number of bytes available on the free list.
1494
- int available() { return available_; }
1495
-
1496
- // Place a node on the free list. The block of size 'size_in_bytes'
1497
- // starting at 'start' is placed on the free list. The return value is the
1498
- // number of bytes that have been lost due to internal fragmentation by
1499
- // freeing the block. Bookkeeping information will be written to the block,
1500
- // ie, its contents will be destroyed. The start address should be word
1501
- // aligned, and the size should be a non-zero multiple of the word size.
1502
- int Free(Address start, int size_in_bytes);
1503
-
1504
- // Allocate a block of size 'size_in_bytes' from the free list. The block
1505
- // is unitialized. A failure is returned if no block is available. The
1506
- // number of bytes lost to fragmentation is returned in the output parameter
1507
- // 'wasted_bytes'. The size should be a non-zero multiple of the word size.
1508
- Object* Allocate(int size_in_bytes, int* wasted_bytes);
1509
-
1510
- private:
1511
- // The size range of blocks, in bytes. (Smaller allocations are allowed, but
1512
- // will always result in waste.)
1513
- static const int kMinBlockSize = 2 * kPointerSize;
1514
- static const int kMaxBlockSize = Page::kMaxHeapObjectSize;
1515
-
1516
- // The identity of the owning space, for building allocation Failure
1517
- // objects.
1518
- AllocationSpace owner_;
1519
-
1520
- // Total available bytes in all blocks on this free list.
1521
- int available_;
1522
-
1523
- // Blocks are put on exact free lists in an array, indexed by size in words.
1524
- // The available sizes are kept in an increasingly ordered list. Entries
1525
- // corresponding to sizes < kMinBlockSize always have an empty free list
1526
- // (but index kHead is used for the head of the size list).
1527
- struct SizeNode {
1528
- // Address of the head FreeListNode of the implied block size or NULL.
1529
- Address head_node_;
1530
- // Size (words) of the next larger available size if head_node_ != NULL.
1531
- int next_size_;
1532
- };
1533
- static const int kFreeListsLength = kMaxBlockSize / kPointerSize + 1;
1534
- SizeNode free_[kFreeListsLength];
1535
-
1536
- // Sentinel elements for the size list. Real elements are in ]kHead..kEnd[.
1537
- static const int kHead = kMinBlockSize / kPointerSize - 1;
1538
- static const int kEnd = kMaxInt;
1539
-
1540
- // We keep a "finger" in the size list to speed up a common pattern:
1541
- // repeated requests for the same or increasing sizes.
1542
- int finger_;
1543
-
1544
- // Starting from *prev, find and return the smallest size >= index (words),
1545
- // or kEnd. Update *prev to be the largest size < index, or kHead.
1546
- int FindSize(int index, int* prev) {
1547
- int cur = free_[*prev].next_size_;
1548
- while (cur < index) {
1549
- *prev = cur;
1550
- cur = free_[cur].next_size_;
1551
- }
1552
- return cur;
1553
- }
1554
-
1555
- // Remove an existing element from the size list.
1556
- void RemoveSize(int index) {
1557
- int prev = kHead;
1558
- int cur = FindSize(index, &prev);
1559
- ASSERT(cur == index);
1560
- free_[prev].next_size_ = free_[cur].next_size_;
1561
- finger_ = prev;
1562
- }
1563
-
1564
- // Insert a new element into the size list.
1565
- void InsertSize(int index) {
1566
- int prev = kHead;
1567
- int cur = FindSize(index, &prev);
1568
- ASSERT(cur != index);
1569
- free_[prev].next_size_ = index;
1570
- free_[index].next_size_ = cur;
1571
- }
1572
-
1573
- // The size list is not updated during a sequence of calls to Free, but is
1574
- // rebuilt before the next allocation.
1575
- void RebuildSizeList();
1576
- bool needs_rebuild_;
1577
-
1578
- #ifdef DEBUG
1579
- // Does this free list contain a free block located at the address of 'node'?
1580
- bool Contains(FreeListNode* node);
1581
- #endif
1582
-
1583
- DISALLOW_COPY_AND_ASSIGN(OldSpaceFreeList);
1584
- };
1585
-
1586
-
1587
- // The free list for the map space.
1588
- class FixedSizeFreeList BASE_EMBEDDED {
1589
- public:
1590
- FixedSizeFreeList(AllocationSpace owner, int object_size);
1591
-
1592
- // Clear the free list.
1593
- void Reset();
1594
-
1595
- // Return the number of bytes available on the free list.
1596
- int available() { return available_; }
1597
-
1598
- // Place a node on the free list. The block starting at 'start' (assumed to
1599
- // have size object_size_) is placed on the free list. Bookkeeping
1600
- // information will be written to the block, ie, its contents will be
1601
- // destroyed. The start address should be word aligned.
1602
- void Free(Address start);
1603
-
1604
- // Allocate a fixed sized block from the free list. The block is unitialized.
1605
- // A failure is returned if no block is available.
1606
- Object* Allocate();
1607
-
1608
- private:
1609
- // Available bytes on the free list.
1610
- int available_;
1611
-
1612
- // The head of the free list.
1613
- Address head_;
1614
-
1615
- // The identity of the owning space, for building allocation Failure
1616
- // objects.
1617
- AllocationSpace owner_;
1618
-
1619
- // The size of the objects in this space.
1620
- int object_size_;
1621
-
1622
- DISALLOW_COPY_AND_ASSIGN(FixedSizeFreeList);
1623
- };
1624
-
1625
-
1626
- // -----------------------------------------------------------------------------
1627
- // Old object space (excluding map objects)
1628
-
1629
- class OldSpace : public PagedSpace {
1630
- public:
1631
- // Creates an old space object with a given maximum capacity.
1632
- // The constructor does not allocate pages from OS.
1633
- explicit OldSpace(int max_capacity,
1634
- AllocationSpace id,
1635
- Executability executable)
1636
- : PagedSpace(max_capacity, id, executable), free_list_(id) {
1637
- page_extra_ = 0;
1638
- }
1639
-
1640
- // The bytes available on the free list (ie, not above the linear allocation
1641
- // pointer).
1642
- int AvailableFree() { return free_list_.available(); }
1643
-
1644
- // The top of allocation in a page in this space. Undefined if page is unused.
1645
- virtual Address PageAllocationTop(Page* page) {
1646
- return page == TopPageOf(allocation_info_) ? top() : page->ObjectAreaEnd();
1647
- }
1648
-
1649
- // Give a block of memory to the space's free list. It might be added to
1650
- // the free list or accounted as waste.
1651
- void Free(Address start, int size_in_bytes) {
1652
- int wasted_bytes = free_list_.Free(start, size_in_bytes);
1653
- accounting_stats_.DeallocateBytes(size_in_bytes);
1654
- accounting_stats_.WasteBytes(wasted_bytes);
1655
- }
1656
-
1657
- // Prepare for full garbage collection. Resets the relocation pointer and
1658
- // clears the free list.
1659
- virtual void PrepareForMarkCompact(bool will_compact);
1660
-
1661
- // Updates the allocation pointer to the relocation top after a mark-compact
1662
- // collection.
1663
- virtual void MCCommitRelocationInfo();
1664
-
1665
- virtual void PutRestOfCurrentPageOnFreeList(Page* current_page);
1666
-
1667
- #ifdef DEBUG
1668
- // Reports statistics for the space
1669
- void ReportStatistics();
1670
- // Dump the remembered sets in the space to stdout.
1671
- void PrintRSet();
1672
- #endif
1673
-
1674
- protected:
1675
- // Virtual function in the superclass. Slow path of AllocateRaw.
1676
- HeapObject* SlowAllocateRaw(int size_in_bytes);
1677
-
1678
- // Virtual function in the superclass. Allocate linearly at the start of
1679
- // the page after current_page (there is assumed to be one).
1680
- HeapObject* AllocateInNextPage(Page* current_page, int size_in_bytes);
1681
-
1682
- private:
1683
- // The space's free list.
1684
- OldSpaceFreeList free_list_;
1685
-
1686
- public:
1687
- TRACK_MEMORY("OldSpace")
1688
- };
1689
-
1690
-
1691
- // -----------------------------------------------------------------------------
1692
- // Old space for objects of a fixed size
1693
-
1694
- class FixedSpace : public PagedSpace {
1695
- public:
1696
- FixedSpace(int max_capacity,
1697
- AllocationSpace id,
1698
- int object_size_in_bytes,
1699
- const char* name)
1700
- : PagedSpace(max_capacity, id, NOT_EXECUTABLE),
1701
- object_size_in_bytes_(object_size_in_bytes),
1702
- name_(name),
1703
- free_list_(id, object_size_in_bytes) {
1704
- page_extra_ = Page::kObjectAreaSize % object_size_in_bytes;
1705
- }
1706
-
1707
- // The top of allocation in a page in this space. Undefined if page is unused.
1708
- virtual Address PageAllocationTop(Page* page) {
1709
- return page == TopPageOf(allocation_info_) ? top()
1710
- : page->ObjectAreaEnd() - page_extra_;
1711
- }
1712
-
1713
- int object_size_in_bytes() { return object_size_in_bytes_; }
1714
-
1715
- // Give a fixed sized block of memory to the space's free list.
1716
- void Free(Address start) {
1717
- free_list_.Free(start);
1718
- accounting_stats_.DeallocateBytes(object_size_in_bytes_);
1719
- }
1720
-
1721
- // Prepares for a mark-compact GC.
1722
- virtual void PrepareForMarkCompact(bool will_compact);
1723
-
1724
- // Updates the allocation pointer to the relocation top after a mark-compact
1725
- // collection.
1726
- virtual void MCCommitRelocationInfo();
1727
-
1728
- virtual void PutRestOfCurrentPageOnFreeList(Page* current_page);
1729
-
1730
- #ifdef DEBUG
1731
- // Reports statistic info of the space
1732
- void ReportStatistics();
1733
-
1734
- // Dump the remembered sets in the space to stdout.
1735
- void PrintRSet();
1736
- #endif
1737
-
1738
- protected:
1739
- // Virtual function in the superclass. Slow path of AllocateRaw.
1740
- HeapObject* SlowAllocateRaw(int size_in_bytes);
1741
-
1742
- // Virtual function in the superclass. Allocate linearly at the start of
1743
- // the page after current_page (there is assumed to be one).
1744
- HeapObject* AllocateInNextPage(Page* current_page, int size_in_bytes);
1745
-
1746
- void ResetFreeList() {
1747
- free_list_.Reset();
1748
- }
1749
-
1750
- private:
1751
- // The size of objects in this space.
1752
- int object_size_in_bytes_;
1753
-
1754
- // The name of this space.
1755
- const char* name_;
1756
-
1757
- // The space's free list.
1758
- FixedSizeFreeList free_list_;
1759
- };
1760
-
1761
-
1762
- // -----------------------------------------------------------------------------
1763
- // Old space for all map objects
1764
-
1765
- class MapSpace : public FixedSpace {
1766
- public:
1767
- // Creates a map space object with a maximum capacity.
1768
- MapSpace(int max_capacity, int max_map_space_pages, AllocationSpace id)
1769
- : FixedSpace(max_capacity, id, Map::kSize, "map"),
1770
- max_map_space_pages_(max_map_space_pages) {
1771
- ASSERT(max_map_space_pages < kMaxMapPageIndex);
1772
- }
1773
-
1774
- // Prepares for a mark-compact GC.
1775
- virtual void PrepareForMarkCompact(bool will_compact);
1776
-
1777
- // Given an index, returns the page address.
1778
- Address PageAddress(int page_index) { return page_addresses_[page_index]; }
1779
-
1780
- static const int kMaxMapPageIndex = 1 << MapWord::kMapPageIndexBits;
1781
-
1782
- // Are map pointers encodable into map word?
1783
- bool MapPointersEncodable() {
1784
- if (!FLAG_use_big_map_space) {
1785
- ASSERT(CountPagesToTop() <= kMaxMapPageIndex);
1786
- return true;
1787
- }
1788
- return CountPagesToTop() <= max_map_space_pages_;
1789
- }
1790
-
1791
- // Should be called after forced sweep to find out if map space needs
1792
- // compaction.
1793
- bool NeedsCompaction(int live_maps) {
1794
- return !MapPointersEncodable() && live_maps <= CompactionThreshold();
1795
- }
1796
-
1797
- Address TopAfterCompaction(int live_maps) {
1798
- ASSERT(NeedsCompaction(live_maps));
1799
-
1800
- int pages_left = live_maps / kMapsPerPage;
1801
- PageIterator it(this, PageIterator::ALL_PAGES);
1802
- while (pages_left-- > 0) {
1803
- it.has_next(); // Must be called for side-effects, see bug 586.
1804
- ASSERT(it.has_next());
1805
- it.next()->ClearRSet();
1806
- }
1807
- it.has_next(); // Must be called for side-effects, see bug 586.
1808
- ASSERT(it.has_next());
1809
- Page* top_page = it.next();
1810
- top_page->ClearRSet();
1811
- ASSERT(top_page->is_valid());
1812
-
1813
- int offset = live_maps % kMapsPerPage * Map::kSize;
1814
- Address top = top_page->ObjectAreaStart() + offset;
1815
- ASSERT(top < top_page->ObjectAreaEnd());
1816
- ASSERT(Contains(top));
1817
-
1818
- return top;
1819
- }
1820
-
1821
- void FinishCompaction(Address new_top, int live_maps) {
1822
- Page* top_page = Page::FromAddress(new_top);
1823
- ASSERT(top_page->is_valid());
1824
-
1825
- SetAllocationInfo(&allocation_info_, top_page);
1826
- allocation_info_.top = new_top;
1827
-
1828
- int new_size = live_maps * Map::kSize;
1829
- accounting_stats_.DeallocateBytes(accounting_stats_.Size());
1830
- accounting_stats_.AllocateBytes(new_size);
1831
-
1832
- #ifdef DEBUG
1833
- if (FLAG_enable_slow_asserts) {
1834
- int actual_size = 0;
1835
- for (Page* p = first_page_; p != top_page; p = p->next_page())
1836
- actual_size += kMapsPerPage * Map::kSize;
1837
- actual_size += (new_top - top_page->ObjectAreaStart());
1838
- ASSERT(accounting_stats_.Size() == actual_size);
1839
- }
1840
- #endif
1841
-
1842
- Shrink();
1843
- ResetFreeList();
1844
- }
1845
-
1846
- protected:
1847
- #ifdef DEBUG
1848
- virtual void VerifyObject(HeapObject* obj);
1849
- #endif
1850
-
1851
- private:
1852
- static const int kMapsPerPage = Page::kObjectAreaSize / Map::kSize;
1853
-
1854
- // Do map space compaction if there is a page gap.
1855
- int CompactionThreshold() {
1856
- return kMapsPerPage * (max_map_space_pages_ - 1);
1857
- }
1858
-
1859
- const int max_map_space_pages_;
1860
-
1861
- // An array of page start address in a map space.
1862
- Address page_addresses_[kMaxMapPageIndex];
1863
-
1864
- public:
1865
- TRACK_MEMORY("MapSpace")
1866
- };
1867
-
1868
-
1869
- // -----------------------------------------------------------------------------
1870
- // Old space for all global object property cell objects
1871
-
1872
- class CellSpace : public FixedSpace {
1873
- public:
1874
- // Creates a property cell space object with a maximum capacity.
1875
- CellSpace(int max_capacity, AllocationSpace id)
1876
- : FixedSpace(max_capacity, id, JSGlobalPropertyCell::kSize, "cell") {}
1877
-
1878
- protected:
1879
- #ifdef DEBUG
1880
- virtual void VerifyObject(HeapObject* obj);
1881
- #endif
1882
-
1883
- public:
1884
- TRACK_MEMORY("CellSpace")
1885
- };
1886
-
1887
-
1888
- // -----------------------------------------------------------------------------
1889
- // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by
1890
- // the large object space. A large object is allocated from OS heap with
1891
- // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset).
1892
- // A large object always starts at Page::kObjectStartOffset to a page.
1893
- // Large objects do not move during garbage collections.
1894
-
1895
- // A LargeObjectChunk holds exactly one large object page with exactly one
1896
- // large object.
1897
- class LargeObjectChunk {
1898
- public:
1899
- // Allocates a new LargeObjectChunk that contains a large object page
1900
- // (Page::kPageSize aligned) that has at least size_in_bytes (for a large
1901
- // object and possibly extra remembered set words) bytes after the object
1902
- // area start of that page. The allocated chunk size is set in the output
1903
- // parameter chunk_size.
1904
- static LargeObjectChunk* New(int size_in_bytes,
1905
- size_t* chunk_size,
1906
- Executability executable);
1907
-
1908
- // Interpret a raw address as a large object chunk.
1909
- static LargeObjectChunk* FromAddress(Address address) {
1910
- return reinterpret_cast<LargeObjectChunk*>(address);
1911
- }
1912
-
1913
- // Returns the address of this chunk.
1914
- Address address() { return reinterpret_cast<Address>(this); }
1915
-
1916
- // Accessors for the fields of the chunk.
1917
- LargeObjectChunk* next() { return next_; }
1918
- void set_next(LargeObjectChunk* chunk) { next_ = chunk; }
1919
-
1920
- size_t size() { return size_; }
1921
- void set_size(size_t size_in_bytes) { size_ = size_in_bytes; }
1922
-
1923
- // Returns the object in this chunk.
1924
- inline HeapObject* GetObject();
1925
-
1926
- // Given a requested size (including any extra remembered set words),
1927
- // returns the physical size of a chunk to be allocated.
1928
- static int ChunkSizeFor(int size_in_bytes);
1929
-
1930
- // Given a chunk size, returns the object size it can accommodate (not
1931
- // including any extra remembered set words). Used by
1932
- // LargeObjectSpace::Available. Note that this can overestimate the size
1933
- // of object that will fit in a chunk---if the object requires extra
1934
- // remembered set words (eg, for large fixed arrays), the actual object
1935
- // size for the chunk will be smaller than reported by this function.
1936
- static int ObjectSizeFor(int chunk_size) {
1937
- if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0;
1938
- return chunk_size - Page::kPageSize - Page::kObjectStartOffset;
1939
- }
1940
-
1941
- private:
1942
- // A pointer to the next large object chunk in the space or NULL.
1943
- LargeObjectChunk* next_;
1944
-
1945
- // The size of this chunk.
1946
- size_t size_;
1947
-
1948
- public:
1949
- TRACK_MEMORY("LargeObjectChunk")
1950
- };
1951
-
1952
-
1953
- class LargeObjectSpace : public Space {
1954
- public:
1955
- explicit LargeObjectSpace(AllocationSpace id);
1956
- virtual ~LargeObjectSpace() {}
1957
-
1958
- // Initializes internal data structures.
1959
- bool Setup();
1960
-
1961
- // Releases internal resources, frees objects in this space.
1962
- void TearDown();
1963
-
1964
- // Allocates a (non-FixedArray, non-Code) large object.
1965
- Object* AllocateRaw(int size_in_bytes);
1966
- // Allocates a large Code object.
1967
- Object* AllocateRawCode(int size_in_bytes);
1968
- // Allocates a large FixedArray.
1969
- Object* AllocateRawFixedArray(int size_in_bytes);
1970
-
1971
- // Available bytes for objects in this space, not including any extra
1972
- // remembered set words.
1973
- int Available() {
1974
- return LargeObjectChunk::ObjectSizeFor(MemoryAllocator::Available());
1975
- }
1976
-
1977
- virtual int Size() {
1978
- return size_;
1979
- }
1980
-
1981
- int PageCount() {
1982
- return page_count_;
1983
- }
1984
-
1985
- // Finds an object for a given address, returns Failure::Exception()
1986
- // if it is not found. The function iterates through all objects in this
1987
- // space, may be slow.
1988
- Object* FindObject(Address a);
1989
-
1990
- // Clears remembered sets.
1991
- void ClearRSet();
1992
-
1993
- // Iterates objects whose remembered set bits are set.
1994
- void IterateRSet(ObjectSlotCallback func);
1995
-
1996
- // Frees unmarked objects.
1997
- void FreeUnmarkedObjects();
1998
-
1999
- // Checks whether a heap object is in this space; O(1).
2000
- bool Contains(HeapObject* obj);
2001
-
2002
- // Checks whether the space is empty.
2003
- bool IsEmpty() { return first_chunk_ == NULL; }
2004
-
2005
- // See the comments for ReserveSpace in the Space class. This has to be
2006
- // called after ReserveSpace has been called on the paged spaces, since they
2007
- // may use some memory, leaving less for large objects.
2008
- virtual bool ReserveSpace(int bytes);
2009
-
2010
- #ifdef ENABLE_HEAP_PROTECTION
2011
- // Protect/unprotect the space by marking it read-only/writable.
2012
- void Protect();
2013
- void Unprotect();
2014
- #endif
2015
-
2016
- #ifdef DEBUG
2017
- virtual void Verify();
2018
- virtual void Print();
2019
- void ReportStatistics();
2020
- void CollectCodeStatistics();
2021
- // Dump the remembered sets in the space to stdout.
2022
- void PrintRSet();
2023
- #endif
2024
- // Checks whether an address is in the object area in this space. It
2025
- // iterates all objects in the space. May be slow.
2026
- bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); }
2027
-
2028
- private:
2029
- // The head of the linked list of large object chunks.
2030
- LargeObjectChunk* first_chunk_;
2031
- int size_; // allocated bytes
2032
- int page_count_; // number of chunks
2033
-
2034
-
2035
- // Shared implementation of AllocateRaw, AllocateRawCode and
2036
- // AllocateRawFixedArray.
2037
- Object* AllocateRawInternal(int requested_size,
2038
- int object_size,
2039
- Executability executable);
2040
-
2041
- // Returns the number of extra bytes (rounded up to the nearest full word)
2042
- // required for extra_object_bytes of extra pointers (in bytes).
2043
- static inline int ExtraRSetBytesFor(int extra_object_bytes);
2044
-
2045
- friend class LargeObjectIterator;
2046
-
2047
- public:
2048
- TRACK_MEMORY("LargeObjectSpace")
2049
- };
2050
-
2051
-
2052
- class LargeObjectIterator: public ObjectIterator {
2053
- public:
2054
- explicit LargeObjectIterator(LargeObjectSpace* space);
2055
- LargeObjectIterator(LargeObjectSpace* space, HeapObjectCallback size_func);
2056
-
2057
- bool has_next() { return current_ != NULL; }
2058
- HeapObject* next();
2059
-
2060
- // implementation of ObjectIterator.
2061
- virtual bool has_next_object() { return has_next(); }
2062
- virtual HeapObject* next_object() { return next(); }
2063
-
2064
- private:
2065
- LargeObjectChunk* current_;
2066
- HeapObjectCallback size_func_;
2067
- };
2068
-
2069
-
2070
- } } // namespace v8::internal
2071
-
2072
- #endif // V8_SPACES_H_