libv8 3.11.8.17 → 3.16.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (754) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/Gemfile +1 -1
  4. data/Rakefile +6 -7
  5. data/lib/libv8/version.rb +1 -1
  6. data/vendor/v8/.gitignore +24 -3
  7. data/vendor/v8/AUTHORS +7 -0
  8. data/vendor/v8/ChangeLog +839 -0
  9. data/vendor/v8/DEPS +1 -1
  10. data/vendor/v8/Makefile.android +92 -0
  11. data/vendor/v8/OWNERS +11 -0
  12. data/vendor/v8/PRESUBMIT.py +71 -0
  13. data/vendor/v8/SConstruct +34 -39
  14. data/vendor/v8/build/android.gypi +56 -37
  15. data/vendor/v8/build/common.gypi +112 -30
  16. data/vendor/v8/build/gyp_v8 +1 -1
  17. data/vendor/v8/build/standalone.gypi +15 -11
  18. data/vendor/v8/include/v8-debug.h +9 -1
  19. data/vendor/v8/include/v8-preparser.h +4 -3
  20. data/vendor/v8/include/v8-profiler.h +25 -25
  21. data/vendor/v8/include/v8-testing.h +4 -3
  22. data/vendor/v8/include/v8.h +994 -540
  23. data/vendor/v8/preparser/preparser-process.cc +3 -3
  24. data/vendor/v8/samples/lineprocessor.cc +20 -27
  25. data/vendor/v8/samples/process.cc +18 -14
  26. data/vendor/v8/samples/shell.cc +16 -15
  27. data/vendor/v8/src/SConscript +15 -14
  28. data/vendor/v8/src/accessors.cc +169 -77
  29. data/vendor/v8/src/accessors.h +4 -0
  30. data/vendor/v8/src/allocation-inl.h +2 -2
  31. data/vendor/v8/src/allocation.h +7 -7
  32. data/vendor/v8/src/api.cc +810 -497
  33. data/vendor/v8/src/api.h +85 -60
  34. data/vendor/v8/src/arm/assembler-arm-inl.h +179 -22
  35. data/vendor/v8/src/arm/assembler-arm.cc +633 -264
  36. data/vendor/v8/src/arm/assembler-arm.h +264 -197
  37. data/vendor/v8/src/arm/builtins-arm.cc +117 -27
  38. data/vendor/v8/src/arm/code-stubs-arm.cc +1241 -700
  39. data/vendor/v8/src/arm/code-stubs-arm.h +35 -138
  40. data/vendor/v8/src/arm/codegen-arm.cc +285 -16
  41. data/vendor/v8/src/arm/codegen-arm.h +22 -0
  42. data/vendor/v8/src/arm/constants-arm.cc +5 -3
  43. data/vendor/v8/src/arm/constants-arm.h +24 -11
  44. data/vendor/v8/src/arm/debug-arm.cc +3 -3
  45. data/vendor/v8/src/arm/deoptimizer-arm.cc +382 -92
  46. data/vendor/v8/src/arm/disasm-arm.cc +61 -12
  47. data/vendor/v8/src/arm/frames-arm.h +0 -14
  48. data/vendor/v8/src/arm/full-codegen-arm.cc +332 -304
  49. data/vendor/v8/src/arm/ic-arm.cc +180 -259
  50. data/vendor/v8/src/arm/lithium-arm.cc +364 -316
  51. data/vendor/v8/src/arm/lithium-arm.h +512 -275
  52. data/vendor/v8/src/arm/lithium-codegen-arm.cc +1768 -809
  53. data/vendor/v8/src/arm/lithium-codegen-arm.h +97 -35
  54. data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +12 -5
  55. data/vendor/v8/src/arm/macro-assembler-arm.cc +439 -228
  56. data/vendor/v8/src/arm/macro-assembler-arm.h +116 -70
  57. data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +54 -44
  58. data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +3 -10
  59. data/vendor/v8/src/arm/simulator-arm.cc +272 -238
  60. data/vendor/v8/src/arm/simulator-arm.h +38 -8
  61. data/vendor/v8/src/arm/stub-cache-arm.cc +522 -895
  62. data/vendor/v8/src/array.js +101 -70
  63. data/vendor/v8/src/assembler.cc +270 -19
  64. data/vendor/v8/src/assembler.h +110 -15
  65. data/vendor/v8/src/ast.cc +79 -69
  66. data/vendor/v8/src/ast.h +255 -301
  67. data/vendor/v8/src/atomicops.h +7 -1
  68. data/vendor/v8/src/atomicops_internals_tsan.h +335 -0
  69. data/vendor/v8/src/bootstrapper.cc +481 -418
  70. data/vendor/v8/src/bootstrapper.h +4 -4
  71. data/vendor/v8/src/builtins.cc +498 -311
  72. data/vendor/v8/src/builtins.h +75 -47
  73. data/vendor/v8/src/checks.cc +2 -1
  74. data/vendor/v8/src/checks.h +8 -0
  75. data/vendor/v8/src/code-stubs-hydrogen.cc +253 -0
  76. data/vendor/v8/src/code-stubs.cc +249 -84
  77. data/vendor/v8/src/code-stubs.h +501 -169
  78. data/vendor/v8/src/codegen.cc +36 -18
  79. data/vendor/v8/src/codegen.h +25 -3
  80. data/vendor/v8/src/collection.js +54 -17
  81. data/vendor/v8/src/compilation-cache.cc +24 -16
  82. data/vendor/v8/src/compilation-cache.h +15 -6
  83. data/vendor/v8/src/compiler.cc +497 -195
  84. data/vendor/v8/src/compiler.h +246 -38
  85. data/vendor/v8/src/contexts.cc +64 -24
  86. data/vendor/v8/src/contexts.h +60 -29
  87. data/vendor/v8/src/conversions-inl.h +24 -14
  88. data/vendor/v8/src/conversions.h +7 -4
  89. data/vendor/v8/src/counters.cc +21 -12
  90. data/vendor/v8/src/counters.h +44 -16
  91. data/vendor/v8/src/cpu-profiler.h +1 -1
  92. data/vendor/v8/src/d8-debug.cc +2 -2
  93. data/vendor/v8/src/d8-readline.cc +13 -2
  94. data/vendor/v8/src/d8.cc +681 -273
  95. data/vendor/v8/src/d8.gyp +4 -4
  96. data/vendor/v8/src/d8.h +38 -18
  97. data/vendor/v8/src/d8.js +0 -617
  98. data/vendor/v8/src/data-flow.h +55 -0
  99. data/vendor/v8/src/date.js +1 -42
  100. data/vendor/v8/src/dateparser-inl.h +5 -1
  101. data/vendor/v8/src/debug-agent.cc +10 -15
  102. data/vendor/v8/src/debug-debugger.js +147 -149
  103. data/vendor/v8/src/debug.cc +323 -164
  104. data/vendor/v8/src/debug.h +26 -14
  105. data/vendor/v8/src/deoptimizer.cc +765 -290
  106. data/vendor/v8/src/deoptimizer.h +130 -28
  107. data/vendor/v8/src/disassembler.cc +10 -4
  108. data/vendor/v8/src/elements-kind.cc +7 -2
  109. data/vendor/v8/src/elements-kind.h +19 -0
  110. data/vendor/v8/src/elements.cc +607 -285
  111. data/vendor/v8/src/elements.h +36 -13
  112. data/vendor/v8/src/execution.cc +52 -31
  113. data/vendor/v8/src/execution.h +4 -4
  114. data/vendor/v8/src/extensions/externalize-string-extension.cc +5 -4
  115. data/vendor/v8/src/extensions/gc-extension.cc +5 -1
  116. data/vendor/v8/src/extensions/statistics-extension.cc +153 -0
  117. data/vendor/v8/src/{inspector.h → extensions/statistics-extension.h} +12 -23
  118. data/vendor/v8/src/factory.cc +101 -134
  119. data/vendor/v8/src/factory.h +36 -31
  120. data/vendor/v8/src/flag-definitions.h +102 -25
  121. data/vendor/v8/src/flags.cc +9 -5
  122. data/vendor/v8/src/frames-inl.h +10 -0
  123. data/vendor/v8/src/frames.cc +116 -26
  124. data/vendor/v8/src/frames.h +96 -12
  125. data/vendor/v8/src/full-codegen.cc +219 -74
  126. data/vendor/v8/src/full-codegen.h +63 -21
  127. data/vendor/v8/src/func-name-inferrer.cc +8 -7
  128. data/vendor/v8/src/func-name-inferrer.h +5 -3
  129. data/vendor/v8/src/gdb-jit.cc +71 -57
  130. data/vendor/v8/src/global-handles.cc +230 -101
  131. data/vendor/v8/src/global-handles.h +26 -27
  132. data/vendor/v8/src/globals.h +17 -19
  133. data/vendor/v8/src/handles-inl.h +59 -12
  134. data/vendor/v8/src/handles.cc +180 -200
  135. data/vendor/v8/src/handles.h +80 -11
  136. data/vendor/v8/src/hashmap.h +60 -40
  137. data/vendor/v8/src/heap-inl.h +107 -45
  138. data/vendor/v8/src/heap-profiler.cc +38 -19
  139. data/vendor/v8/src/heap-profiler.h +24 -14
  140. data/vendor/v8/src/heap.cc +1123 -738
  141. data/vendor/v8/src/heap.h +385 -146
  142. data/vendor/v8/src/hydrogen-instructions.cc +700 -217
  143. data/vendor/v8/src/hydrogen-instructions.h +1158 -472
  144. data/vendor/v8/src/hydrogen.cc +3319 -1662
  145. data/vendor/v8/src/hydrogen.h +411 -170
  146. data/vendor/v8/src/ia32/assembler-ia32-inl.h +46 -16
  147. data/vendor/v8/src/ia32/assembler-ia32.cc +131 -61
  148. data/vendor/v8/src/ia32/assembler-ia32.h +115 -57
  149. data/vendor/v8/src/ia32/builtins-ia32.cc +99 -5
  150. data/vendor/v8/src/ia32/code-stubs-ia32.cc +787 -495
  151. data/vendor/v8/src/ia32/code-stubs-ia32.h +10 -100
  152. data/vendor/v8/src/ia32/codegen-ia32.cc +227 -23
  153. data/vendor/v8/src/ia32/codegen-ia32.h +14 -0
  154. data/vendor/v8/src/ia32/deoptimizer-ia32.cc +428 -87
  155. data/vendor/v8/src/ia32/disasm-ia32.cc +28 -1
  156. data/vendor/v8/src/ia32/frames-ia32.h +6 -16
  157. data/vendor/v8/src/ia32/full-codegen-ia32.cc +280 -272
  158. data/vendor/v8/src/ia32/ic-ia32.cc +150 -250
  159. data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +1600 -517
  160. data/vendor/v8/src/ia32/lithium-codegen-ia32.h +90 -24
  161. data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +10 -6
  162. data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.h +2 -2
  163. data/vendor/v8/src/ia32/lithium-ia32.cc +405 -302
  164. data/vendor/v8/src/ia32/lithium-ia32.h +526 -271
  165. data/vendor/v8/src/ia32/macro-assembler-ia32.cc +378 -119
  166. data/vendor/v8/src/ia32/macro-assembler-ia32.h +62 -28
  167. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +43 -30
  168. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +2 -10
  169. data/vendor/v8/src/ia32/stub-cache-ia32.cc +492 -678
  170. data/vendor/v8/src/ic-inl.h +9 -4
  171. data/vendor/v8/src/ic.cc +836 -923
  172. data/vendor/v8/src/ic.h +228 -247
  173. data/vendor/v8/src/incremental-marking-inl.h +26 -30
  174. data/vendor/v8/src/incremental-marking.cc +276 -248
  175. data/vendor/v8/src/incremental-marking.h +29 -37
  176. data/vendor/v8/src/interface.cc +34 -25
  177. data/vendor/v8/src/interface.h +69 -25
  178. data/vendor/v8/src/interpreter-irregexp.cc +2 -2
  179. data/vendor/v8/src/isolate.cc +382 -76
  180. data/vendor/v8/src/isolate.h +109 -56
  181. data/vendor/v8/src/json-parser.h +217 -104
  182. data/vendor/v8/src/json-stringifier.h +745 -0
  183. data/vendor/v8/src/json.js +10 -132
  184. data/vendor/v8/src/jsregexp-inl.h +106 -0
  185. data/vendor/v8/src/jsregexp.cc +517 -285
  186. data/vendor/v8/src/jsregexp.h +145 -117
  187. data/vendor/v8/src/list-inl.h +35 -22
  188. data/vendor/v8/src/list.h +46 -19
  189. data/vendor/v8/src/lithium-allocator-inl.h +22 -2
  190. data/vendor/v8/src/lithium-allocator.cc +85 -70
  191. data/vendor/v8/src/lithium-allocator.h +21 -39
  192. data/vendor/v8/src/lithium.cc +259 -5
  193. data/vendor/v8/src/lithium.h +131 -32
  194. data/vendor/v8/src/liveedit-debugger.js +52 -3
  195. data/vendor/v8/src/liveedit.cc +393 -113
  196. data/vendor/v8/src/liveedit.h +7 -3
  197. data/vendor/v8/src/log-utils.cc +4 -2
  198. data/vendor/v8/src/log.cc +170 -140
  199. data/vendor/v8/src/log.h +62 -11
  200. data/vendor/v8/src/macro-assembler.h +17 -0
  201. data/vendor/v8/src/macros.py +2 -0
  202. data/vendor/v8/src/mark-compact-inl.h +3 -23
  203. data/vendor/v8/src/mark-compact.cc +801 -830
  204. data/vendor/v8/src/mark-compact.h +154 -47
  205. data/vendor/v8/src/marking-thread.cc +85 -0
  206. data/vendor/v8/src/{inspector.cc → marking-thread.h} +32 -24
  207. data/vendor/v8/src/math.js +12 -18
  208. data/vendor/v8/src/messages.cc +18 -8
  209. data/vendor/v8/src/messages.js +314 -261
  210. data/vendor/v8/src/mips/assembler-mips-inl.h +58 -6
  211. data/vendor/v8/src/mips/assembler-mips.cc +92 -75
  212. data/vendor/v8/src/mips/assembler-mips.h +54 -60
  213. data/vendor/v8/src/mips/builtins-mips.cc +116 -17
  214. data/vendor/v8/src/mips/code-stubs-mips.cc +919 -556
  215. data/vendor/v8/src/mips/code-stubs-mips.h +22 -131
  216. data/vendor/v8/src/mips/codegen-mips.cc +281 -6
  217. data/vendor/v8/src/mips/codegen-mips.h +22 -0
  218. data/vendor/v8/src/mips/constants-mips.cc +2 -0
  219. data/vendor/v8/src/mips/constants-mips.h +12 -2
  220. data/vendor/v8/src/mips/deoptimizer-mips.cc +286 -50
  221. data/vendor/v8/src/mips/disasm-mips.cc +13 -0
  222. data/vendor/v8/src/mips/full-codegen-mips.cc +297 -284
  223. data/vendor/v8/src/mips/ic-mips.cc +182 -263
  224. data/vendor/v8/src/mips/lithium-codegen-mips.cc +1208 -556
  225. data/vendor/v8/src/mips/lithium-codegen-mips.h +72 -19
  226. data/vendor/v8/src/mips/lithium-gap-resolver-mips.cc +9 -2
  227. data/vendor/v8/src/mips/lithium-mips.cc +290 -302
  228. data/vendor/v8/src/mips/lithium-mips.h +463 -266
  229. data/vendor/v8/src/mips/macro-assembler-mips.cc +208 -115
  230. data/vendor/v8/src/mips/macro-assembler-mips.h +67 -24
  231. data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +40 -25
  232. data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +3 -9
  233. data/vendor/v8/src/mips/simulator-mips.cc +112 -40
  234. data/vendor/v8/src/mips/simulator-mips.h +5 -0
  235. data/vendor/v8/src/mips/stub-cache-mips.cc +502 -884
  236. data/vendor/v8/src/mirror-debugger.js +157 -30
  237. data/vendor/v8/src/mksnapshot.cc +88 -14
  238. data/vendor/v8/src/object-observe.js +235 -0
  239. data/vendor/v8/src/objects-debug.cc +178 -176
  240. data/vendor/v8/src/objects-inl.h +1333 -486
  241. data/vendor/v8/src/objects-printer.cc +125 -43
  242. data/vendor/v8/src/objects-visiting-inl.h +578 -6
  243. data/vendor/v8/src/objects-visiting.cc +2 -2
  244. data/vendor/v8/src/objects-visiting.h +172 -79
  245. data/vendor/v8/src/objects.cc +3533 -2885
  246. data/vendor/v8/src/objects.h +1352 -1131
  247. data/vendor/v8/src/optimizing-compiler-thread.cc +152 -0
  248. data/vendor/v8/src/optimizing-compiler-thread.h +111 -0
  249. data/vendor/v8/src/parser.cc +390 -500
  250. data/vendor/v8/src/parser.h +45 -33
  251. data/vendor/v8/src/platform-cygwin.cc +10 -21
  252. data/vendor/v8/src/platform-freebsd.cc +36 -41
  253. data/vendor/v8/src/platform-linux.cc +160 -124
  254. data/vendor/v8/src/platform-macos.cc +30 -27
  255. data/vendor/v8/src/platform-nullos.cc +17 -1
  256. data/vendor/v8/src/platform-openbsd.cc +19 -50
  257. data/vendor/v8/src/platform-posix.cc +14 -0
  258. data/vendor/v8/src/platform-solaris.cc +20 -53
  259. data/vendor/v8/src/platform-win32.cc +49 -26
  260. data/vendor/v8/src/platform.h +40 -1
  261. data/vendor/v8/src/preparser.cc +8 -5
  262. data/vendor/v8/src/preparser.h +2 -2
  263. data/vendor/v8/src/prettyprinter.cc +16 -0
  264. data/vendor/v8/src/prettyprinter.h +2 -0
  265. data/vendor/v8/src/profile-generator-inl.h +1 -0
  266. data/vendor/v8/src/profile-generator.cc +209 -147
  267. data/vendor/v8/src/profile-generator.h +15 -12
  268. data/vendor/v8/src/property-details.h +46 -31
  269. data/vendor/v8/src/property.cc +27 -46
  270. data/vendor/v8/src/property.h +163 -83
  271. data/vendor/v8/src/proxy.js +7 -2
  272. data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +4 -13
  273. data/vendor/v8/src/regexp-macro-assembler-irregexp.h +1 -2
  274. data/vendor/v8/src/regexp-macro-assembler-tracer.cc +1 -11
  275. data/vendor/v8/src/regexp-macro-assembler-tracer.h +0 -1
  276. data/vendor/v8/src/regexp-macro-assembler.cc +31 -14
  277. data/vendor/v8/src/regexp-macro-assembler.h +14 -11
  278. data/vendor/v8/src/regexp-stack.cc +1 -0
  279. data/vendor/v8/src/regexp.js +9 -8
  280. data/vendor/v8/src/rewriter.cc +18 -7
  281. data/vendor/v8/src/runtime-profiler.cc +52 -43
  282. data/vendor/v8/src/runtime-profiler.h +0 -25
  283. data/vendor/v8/src/runtime.cc +2006 -2023
  284. data/vendor/v8/src/runtime.h +56 -49
  285. data/vendor/v8/src/safepoint-table.cc +12 -18
  286. data/vendor/v8/src/safepoint-table.h +11 -8
  287. data/vendor/v8/src/scanner.cc +1 -0
  288. data/vendor/v8/src/scanner.h +4 -10
  289. data/vendor/v8/src/scopeinfo.cc +35 -9
  290. data/vendor/v8/src/scopeinfo.h +64 -3
  291. data/vendor/v8/src/scopes.cc +251 -156
  292. data/vendor/v8/src/scopes.h +61 -27
  293. data/vendor/v8/src/serialize.cc +348 -396
  294. data/vendor/v8/src/serialize.h +125 -114
  295. data/vendor/v8/src/small-pointer-list.h +11 -11
  296. data/vendor/v8/src/{smart-array-pointer.h → smart-pointers.h} +64 -15
  297. data/vendor/v8/src/snapshot-common.cc +64 -15
  298. data/vendor/v8/src/snapshot-empty.cc +7 -1
  299. data/vendor/v8/src/snapshot.h +9 -2
  300. data/vendor/v8/src/spaces-inl.h +17 -0
  301. data/vendor/v8/src/spaces.cc +477 -183
  302. data/vendor/v8/src/spaces.h +238 -58
  303. data/vendor/v8/src/splay-tree-inl.h +8 -7
  304. data/vendor/v8/src/splay-tree.h +24 -10
  305. data/vendor/v8/src/store-buffer.cc +12 -5
  306. data/vendor/v8/src/store-buffer.h +2 -4
  307. data/vendor/v8/src/string-search.h +22 -6
  308. data/vendor/v8/src/string-stream.cc +11 -8
  309. data/vendor/v8/src/string.js +47 -15
  310. data/vendor/v8/src/stub-cache.cc +461 -224
  311. data/vendor/v8/src/stub-cache.h +164 -102
  312. data/vendor/v8/src/sweeper-thread.cc +105 -0
  313. data/vendor/v8/src/sweeper-thread.h +81 -0
  314. data/vendor/v8/src/token.h +1 -0
  315. data/vendor/v8/src/transitions-inl.h +220 -0
  316. data/vendor/v8/src/transitions.cc +160 -0
  317. data/vendor/v8/src/transitions.h +207 -0
  318. data/vendor/v8/src/type-info.cc +182 -181
  319. data/vendor/v8/src/type-info.h +31 -19
  320. data/vendor/v8/src/unicode-inl.h +62 -106
  321. data/vendor/v8/src/unicode.cc +57 -67
  322. data/vendor/v8/src/unicode.h +45 -91
  323. data/vendor/v8/src/uri.js +57 -29
  324. data/vendor/v8/src/utils.h +105 -5
  325. data/vendor/v8/src/v8-counters.cc +54 -11
  326. data/vendor/v8/src/v8-counters.h +134 -19
  327. data/vendor/v8/src/v8.cc +29 -29
  328. data/vendor/v8/src/v8.h +1 -0
  329. data/vendor/v8/src/v8conversions.cc +26 -22
  330. data/vendor/v8/src/v8globals.h +56 -43
  331. data/vendor/v8/src/v8natives.js +83 -30
  332. data/vendor/v8/src/v8threads.cc +42 -21
  333. data/vendor/v8/src/v8threads.h +4 -1
  334. data/vendor/v8/src/v8utils.cc +9 -93
  335. data/vendor/v8/src/v8utils.h +37 -33
  336. data/vendor/v8/src/variables.cc +6 -3
  337. data/vendor/v8/src/variables.h +6 -13
  338. data/vendor/v8/src/version.cc +2 -2
  339. data/vendor/v8/src/vm-state-inl.h +11 -0
  340. data/vendor/v8/src/x64/assembler-x64-inl.h +39 -8
  341. data/vendor/v8/src/x64/assembler-x64.cc +78 -64
  342. data/vendor/v8/src/x64/assembler-x64.h +38 -33
  343. data/vendor/v8/src/x64/builtins-x64.cc +105 -7
  344. data/vendor/v8/src/x64/code-stubs-x64.cc +790 -413
  345. data/vendor/v8/src/x64/code-stubs-x64.h +10 -106
  346. data/vendor/v8/src/x64/codegen-x64.cc +210 -8
  347. data/vendor/v8/src/x64/codegen-x64.h +20 -1
  348. data/vendor/v8/src/x64/deoptimizer-x64.cc +336 -75
  349. data/vendor/v8/src/x64/disasm-x64.cc +15 -0
  350. data/vendor/v8/src/x64/frames-x64.h +0 -14
  351. data/vendor/v8/src/x64/full-codegen-x64.cc +293 -270
  352. data/vendor/v8/src/x64/ic-x64.cc +153 -251
  353. data/vendor/v8/src/x64/lithium-codegen-x64.cc +1379 -531
  354. data/vendor/v8/src/x64/lithium-codegen-x64.h +67 -23
  355. data/vendor/v8/src/x64/lithium-gap-resolver-x64.cc +2 -2
  356. data/vendor/v8/src/x64/lithium-x64.cc +349 -289
  357. data/vendor/v8/src/x64/lithium-x64.h +460 -250
  358. data/vendor/v8/src/x64/macro-assembler-x64.cc +350 -177
  359. data/vendor/v8/src/x64/macro-assembler-x64.h +67 -49
  360. data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +46 -33
  361. data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +2 -3
  362. data/vendor/v8/src/x64/stub-cache-x64.cc +484 -653
  363. data/vendor/v8/src/zone-inl.h +9 -27
  364. data/vendor/v8/src/zone.cc +5 -5
  365. data/vendor/v8/src/zone.h +53 -27
  366. data/vendor/v8/test/benchmarks/testcfg.py +5 -0
  367. data/vendor/v8/test/cctest/cctest.cc +4 -0
  368. data/vendor/v8/test/cctest/cctest.gyp +3 -1
  369. data/vendor/v8/test/cctest/cctest.h +57 -9
  370. data/vendor/v8/test/cctest/cctest.status +15 -15
  371. data/vendor/v8/test/cctest/test-accessors.cc +26 -0
  372. data/vendor/v8/test/cctest/test-alloc.cc +22 -30
  373. data/vendor/v8/test/cctest/test-api.cc +1943 -314
  374. data/vendor/v8/test/cctest/test-assembler-arm.cc +133 -13
  375. data/vendor/v8/test/cctest/test-assembler-ia32.cc +1 -1
  376. data/vendor/v8/test/cctest/test-assembler-mips.cc +12 -0
  377. data/vendor/v8/test/cctest/test-ast.cc +4 -2
  378. data/vendor/v8/test/cctest/test-compiler.cc +61 -29
  379. data/vendor/v8/test/cctest/test-dataflow.cc +2 -2
  380. data/vendor/v8/test/cctest/test-debug.cc +212 -33
  381. data/vendor/v8/test/cctest/test-decls.cc +257 -11
  382. data/vendor/v8/test/cctest/test-dictionary.cc +24 -10
  383. data/vendor/v8/test/cctest/test-disasm-arm.cc +118 -1
  384. data/vendor/v8/test/cctest/test-disasm-ia32.cc +3 -2
  385. data/vendor/v8/test/cctest/test-flags.cc +14 -1
  386. data/vendor/v8/test/cctest/test-func-name-inference.cc +7 -4
  387. data/vendor/v8/test/cctest/test-global-object.cc +51 -0
  388. data/vendor/v8/test/cctest/test-hashing.cc +32 -23
  389. data/vendor/v8/test/cctest/test-heap-profiler.cc +131 -77
  390. data/vendor/v8/test/cctest/test-heap.cc +1084 -143
  391. data/vendor/v8/test/cctest/test-list.cc +1 -1
  392. data/vendor/v8/test/cctest/test-liveedit.cc +3 -2
  393. data/vendor/v8/test/cctest/test-lockers.cc +12 -13
  394. data/vendor/v8/test/cctest/test-log.cc +10 -8
  395. data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +2 -2
  396. data/vendor/v8/test/cctest/test-mark-compact.cc +44 -22
  397. data/vendor/v8/test/cctest/test-object-observe.cc +434 -0
  398. data/vendor/v8/test/cctest/test-parsing.cc +86 -39
  399. data/vendor/v8/test/cctest/test-platform-linux.cc +6 -0
  400. data/vendor/v8/test/cctest/test-platform-win32.cc +7 -0
  401. data/vendor/v8/test/cctest/test-random.cc +5 -4
  402. data/vendor/v8/test/cctest/test-regexp.cc +137 -101
  403. data/vendor/v8/test/cctest/test-serialize.cc +150 -230
  404. data/vendor/v8/test/cctest/test-sockets.cc +1 -1
  405. data/vendor/v8/test/cctest/test-spaces.cc +139 -0
  406. data/vendor/v8/test/cctest/test-strings.cc +736 -74
  407. data/vendor/v8/test/cctest/test-thread-termination.cc +10 -11
  408. data/vendor/v8/test/cctest/test-threads.cc +4 -4
  409. data/vendor/v8/test/cctest/test-utils.cc +16 -0
  410. data/vendor/v8/test/cctest/test-weakmaps.cc +7 -3
  411. data/vendor/v8/test/cctest/testcfg.py +64 -5
  412. data/vendor/v8/test/es5conform/testcfg.py +5 -0
  413. data/vendor/v8/test/message/message.status +1 -1
  414. data/vendor/v8/test/message/overwritten-builtins.out +3 -0
  415. data/vendor/v8/test/message/testcfg.py +89 -8
  416. data/vendor/v8/test/message/try-catch-finally-no-message.out +26 -26
  417. data/vendor/v8/test/mjsunit/accessor-map-sharing.js +18 -2
  418. data/vendor/v8/test/mjsunit/allocation-site-info.js +126 -0
  419. data/vendor/v8/test/mjsunit/array-bounds-check-removal.js +62 -1
  420. data/vendor/v8/test/mjsunit/array-iteration.js +1 -1
  421. data/vendor/v8/test/mjsunit/array-literal-transitions.js +2 -0
  422. data/vendor/v8/test/mjsunit/array-natives-elements.js +317 -0
  423. data/vendor/v8/test/mjsunit/array-reduce.js +8 -8
  424. data/vendor/v8/test/mjsunit/array-slice.js +12 -0
  425. data/vendor/v8/test/mjsunit/array-store-and-grow.js +4 -1
  426. data/vendor/v8/test/mjsunit/assert-opt-and-deopt.js +1 -1
  427. data/vendor/v8/test/mjsunit/bugs/bug-2337.js +53 -0
  428. data/vendor/v8/test/mjsunit/compare-known-objects-slow.js +69 -0
  429. data/vendor/v8/test/mjsunit/compiler/alloc-object-huge.js +3 -1
  430. data/vendor/v8/test/mjsunit/compiler/inline-accessors.js +368 -0
  431. data/vendor/v8/test/mjsunit/compiler/inline-arguments.js +87 -1
  432. data/vendor/v8/test/mjsunit/compiler/inline-closures.js +49 -0
  433. data/vendor/v8/test/mjsunit/compiler/inline-construct.js +55 -43
  434. data/vendor/v8/test/mjsunit/compiler/inline-literals.js +39 -0
  435. data/vendor/v8/test/mjsunit/compiler/multiply-add.js +69 -0
  436. data/vendor/v8/test/mjsunit/compiler/optimized-closures.js +57 -0
  437. data/vendor/v8/test/mjsunit/compiler/parallel-proto-change.js +44 -0
  438. data/vendor/v8/test/mjsunit/compiler/property-static.js +69 -0
  439. data/vendor/v8/test/mjsunit/compiler/proto-chain-constant.js +55 -0
  440. data/vendor/v8/test/mjsunit/compiler/proto-chain-load.js +44 -0
  441. data/vendor/v8/test/mjsunit/compiler/regress-gvn.js +3 -2
  442. data/vendor/v8/test/mjsunit/compiler/regress-or.js +6 -2
  443. data/vendor/v8/test/mjsunit/compiler/rotate.js +224 -0
  444. data/vendor/v8/test/mjsunit/compiler/uint32.js +173 -0
  445. data/vendor/v8/test/mjsunit/count-based-osr.js +2 -1
  446. data/vendor/v8/test/mjsunit/d8-os.js +3 -3
  447. data/vendor/v8/test/mjsunit/date-parse.js +3 -0
  448. data/vendor/v8/test/mjsunit/date.js +22 -0
  449. data/vendor/v8/test/mjsunit/debug-break-inline.js +1 -0
  450. data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized-double.js +22 -12
  451. data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized.js +21 -10
  452. data/vendor/v8/test/mjsunit/debug-liveedit-compile-error.js +60 -0
  453. data/vendor/v8/test/mjsunit/debug-liveedit-double-call.js +142 -0
  454. data/vendor/v8/test/mjsunit/debug-liveedit-literals.js +94 -0
  455. data/vendor/v8/test/mjsunit/debug-liveedit-restart-frame.js +153 -0
  456. data/vendor/v8/test/mjsunit/debug-multiple-breakpoints.js +1 -1
  457. data/vendor/v8/test/mjsunit/debug-script-breakpoints-closure.js +67 -0
  458. data/vendor/v8/test/mjsunit/debug-script-breakpoints-nested.js +82 -0
  459. data/vendor/v8/test/mjsunit/debug-script.js +4 -2
  460. data/vendor/v8/test/mjsunit/debug-set-variable-value.js +308 -0
  461. data/vendor/v8/test/mjsunit/debug-stepout-scope-part1.js +190 -0
  462. data/vendor/v8/test/mjsunit/debug-stepout-scope-part2.js +83 -0
  463. data/vendor/v8/test/mjsunit/debug-stepout-scope-part3.js +80 -0
  464. data/vendor/v8/test/mjsunit/debug-stepout-scope-part4.js +80 -0
  465. data/vendor/v8/test/mjsunit/debug-stepout-scope-part5.js +77 -0
  466. data/vendor/v8/test/mjsunit/debug-stepout-scope-part6.js +79 -0
  467. data/vendor/v8/test/mjsunit/debug-stepout-scope-part7.js +79 -0
  468. data/vendor/v8/test/mjsunit/{debug-stepout-scope.js → debug-stepout-scope-part8.js} +0 -189
  469. data/vendor/v8/test/mjsunit/delete-non-configurable.js +74 -0
  470. data/vendor/v8/test/mjsunit/deopt-minus-zero.js +56 -0
  471. data/vendor/v8/test/mjsunit/elements-kind.js +6 -4
  472. data/vendor/v8/test/mjsunit/elements-length-no-holey.js +33 -0
  473. data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +46 -19
  474. data/vendor/v8/test/mjsunit/error-accessors.js +54 -0
  475. data/vendor/v8/test/mjsunit/error-constructors.js +1 -14
  476. data/vendor/v8/test/mjsunit/error-tostring.js +8 -0
  477. data/vendor/v8/test/mjsunit/eval-stack-trace.js +204 -0
  478. data/vendor/v8/test/mjsunit/external-array.js +364 -1
  479. data/vendor/v8/test/mjsunit/fast-array-length.js +37 -0
  480. data/vendor/v8/test/mjsunit/fast-non-keyed.js +113 -0
  481. data/vendor/v8/test/mjsunit/fast-prototype.js +117 -0
  482. data/vendor/v8/test/mjsunit/function-call.js +14 -18
  483. data/vendor/v8/test/mjsunit/fuzz-natives-part1.js +230 -0
  484. data/vendor/v8/test/mjsunit/fuzz-natives-part2.js +229 -0
  485. data/vendor/v8/test/mjsunit/fuzz-natives-part3.js +229 -0
  486. data/vendor/v8/test/mjsunit/{fuzz-natives.js → fuzz-natives-part4.js} +12 -2
  487. data/vendor/v8/test/mjsunit/generated-transition-stub.js +218 -0
  488. data/vendor/v8/test/mjsunit/greedy.js +1 -1
  489. data/vendor/v8/test/mjsunit/harmony/block-conflicts.js +2 -1
  490. data/vendor/v8/test/mjsunit/harmony/block-let-crankshaft.js +1 -1
  491. data/vendor/v8/test/mjsunit/harmony/collections.js +69 -11
  492. data/vendor/v8/test/mjsunit/harmony/debug-blockscopes.js +2 -2
  493. data/vendor/v8/test/mjsunit/harmony/module-linking.js +180 -3
  494. data/vendor/v8/test/mjsunit/harmony/module-parsing.js +31 -0
  495. data/vendor/v8/test/mjsunit/harmony/module-recompile.js +87 -0
  496. data/vendor/v8/test/mjsunit/harmony/module-resolution.js +15 -2
  497. data/vendor/v8/test/mjsunit/harmony/object-observe.js +1056 -0
  498. data/vendor/v8/test/mjsunit/harmony/proxies-json.js +178 -0
  499. data/vendor/v8/test/mjsunit/harmony/proxies.js +25 -10
  500. data/vendor/v8/test/mjsunit/json-parser-recursive.js +33 -0
  501. data/vendor/v8/test/mjsunit/json-stringify-recursive.js +52 -0
  502. data/vendor/v8/test/mjsunit/json.js +38 -2
  503. data/vendor/v8/test/mjsunit/json2.js +153 -0
  504. data/vendor/v8/test/mjsunit/limit-locals.js +5 -4
  505. data/vendor/v8/test/mjsunit/manual-parallel-recompile.js +79 -0
  506. data/vendor/v8/test/mjsunit/math-exp-precision.js +64 -0
  507. data/vendor/v8/test/mjsunit/math-floor-negative.js +59 -0
  508. data/vendor/v8/test/mjsunit/math-floor-of-div-minus-zero.js +41 -0
  509. data/vendor/v8/test/mjsunit/math-floor-of-div-nosudiv.js +288 -0
  510. data/vendor/v8/test/mjsunit/math-floor-of-div.js +81 -9
  511. data/vendor/v8/test/mjsunit/{math-floor.js → math-floor-part1.js} +1 -72
  512. data/vendor/v8/test/mjsunit/math-floor-part2.js +76 -0
  513. data/vendor/v8/test/mjsunit/math-floor-part3.js +78 -0
  514. data/vendor/v8/test/mjsunit/math-floor-part4.js +76 -0
  515. data/vendor/v8/test/mjsunit/mirror-object.js +43 -9
  516. data/vendor/v8/test/mjsunit/mjsunit.js +1 -1
  517. data/vendor/v8/test/mjsunit/mjsunit.status +52 -27
  518. data/vendor/v8/test/mjsunit/mul-exhaustive-part1.js +491 -0
  519. data/vendor/v8/test/mjsunit/mul-exhaustive-part10.js +470 -0
  520. data/vendor/v8/test/mjsunit/mul-exhaustive-part2.js +525 -0
  521. data/vendor/v8/test/mjsunit/mul-exhaustive-part3.js +532 -0
  522. data/vendor/v8/test/mjsunit/mul-exhaustive-part4.js +509 -0
  523. data/vendor/v8/test/mjsunit/mul-exhaustive-part5.js +505 -0
  524. data/vendor/v8/test/mjsunit/mul-exhaustive-part6.js +554 -0
  525. data/vendor/v8/test/mjsunit/mul-exhaustive-part7.js +497 -0
  526. data/vendor/v8/test/mjsunit/mul-exhaustive-part8.js +526 -0
  527. data/vendor/v8/test/mjsunit/mul-exhaustive-part9.js +533 -0
  528. data/vendor/v8/test/mjsunit/new-function.js +34 -0
  529. data/vendor/v8/test/mjsunit/numops-fuzz-part1.js +1172 -0
  530. data/vendor/v8/test/mjsunit/numops-fuzz-part2.js +1178 -0
  531. data/vendor/v8/test/mjsunit/numops-fuzz-part3.js +1178 -0
  532. data/vendor/v8/test/mjsunit/numops-fuzz-part4.js +1177 -0
  533. data/vendor/v8/test/mjsunit/object-define-property.js +107 -2
  534. data/vendor/v8/test/mjsunit/override-read-only-property.js +6 -4
  535. data/vendor/v8/test/mjsunit/packed-elements.js +2 -2
  536. data/vendor/v8/test/mjsunit/parse-int-float.js +4 -4
  537. data/vendor/v8/test/mjsunit/pixel-array-rounding.js +1 -1
  538. data/vendor/v8/test/mjsunit/readonly.js +228 -0
  539. data/vendor/v8/test/mjsunit/regexp-capture-3.js +16 -18
  540. data/vendor/v8/test/mjsunit/regexp-capture.js +2 -0
  541. data/vendor/v8/test/mjsunit/regexp-global.js +122 -0
  542. data/vendor/v8/test/mjsunit/regexp-results-cache.js +78 -0
  543. data/vendor/v8/test/mjsunit/regress/regress-1117.js +12 -3
  544. data/vendor/v8/test/mjsunit/regress/regress-1118.js +1 -1
  545. data/vendor/v8/test/mjsunit/regress/regress-115100.js +36 -0
  546. data/vendor/v8/test/mjsunit/regress/regress-1199637.js +1 -3
  547. data/vendor/v8/test/mjsunit/regress/regress-121407.js +1 -1
  548. data/vendor/v8/test/mjsunit/regress/regress-131923.js +30 -0
  549. data/vendor/v8/test/mjsunit/regress/regress-131994.js +70 -0
  550. data/vendor/v8/test/mjsunit/regress/regress-133211.js +35 -0
  551. data/vendor/v8/test/mjsunit/regress/regress-133211b.js +39 -0
  552. data/vendor/v8/test/mjsunit/regress/regress-136048.js +34 -0
  553. data/vendor/v8/test/mjsunit/regress/regress-137768.js +73 -0
  554. data/vendor/v8/test/mjsunit/regress/regress-143967.js +34 -0
  555. data/vendor/v8/test/mjsunit/regress/regress-145201.js +107 -0
  556. data/vendor/v8/test/mjsunit/regress/regress-147497.js +45 -0
  557. data/vendor/v8/test/mjsunit/regress/regress-148378.js +38 -0
  558. data/vendor/v8/test/mjsunit/regress/regress-1563.js +1 -1
  559. data/vendor/v8/test/mjsunit/regress/regress-1591.js +48 -0
  560. data/vendor/v8/test/mjsunit/regress/regress-164442.js +45 -0
  561. data/vendor/v8/test/mjsunit/regress/regress-165637.js +61 -0
  562. data/vendor/v8/test/mjsunit/regress/regress-166379.js +39 -0
  563. data/vendor/v8/test/mjsunit/regress/regress-166553.js +33 -0
  564. data/vendor/v8/test/mjsunit/regress/regress-1692.js +1 -1
  565. data/vendor/v8/test/mjsunit/regress/regress-171641.js +40 -0
  566. data/vendor/v8/test/mjsunit/regress/regress-1980.js +1 -1
  567. data/vendor/v8/test/mjsunit/regress/regress-2073.js +99 -0
  568. data/vendor/v8/test/mjsunit/regress/regress-2119.js +36 -0
  569. data/vendor/v8/test/mjsunit/regress/regress-2156.js +39 -0
  570. data/vendor/v8/test/mjsunit/regress/regress-2163.js +70 -0
  571. data/vendor/v8/test/mjsunit/regress/regress-2170.js +58 -0
  572. data/vendor/v8/test/mjsunit/regress/regress-2172.js +35 -0
  573. data/vendor/v8/test/mjsunit/regress/regress-2185-2.js +145 -0
  574. data/vendor/v8/test/mjsunit/regress/regress-2185.js +38 -0
  575. data/vendor/v8/test/mjsunit/regress/regress-2186.js +49 -0
  576. data/vendor/v8/test/mjsunit/regress/regress-2193.js +58 -0
  577. data/vendor/v8/test/mjsunit/regress/regress-2219.js +32 -0
  578. data/vendor/v8/test/mjsunit/regress/regress-2225.js +65 -0
  579. data/vendor/v8/test/mjsunit/regress/regress-2226.js +36 -0
  580. data/vendor/v8/test/mjsunit/regress/regress-2234.js +41 -0
  581. data/vendor/v8/test/mjsunit/regress/regress-2243.js +31 -0
  582. data/vendor/v8/test/mjsunit/regress/regress-2249.js +33 -0
  583. data/vendor/v8/test/mjsunit/regress/regress-2250.js +68 -0
  584. data/vendor/v8/test/mjsunit/regress/regress-2261.js +113 -0
  585. data/vendor/v8/test/mjsunit/regress/regress-2263.js +30 -0
  586. data/vendor/v8/test/mjsunit/regress/regress-2284.js +32 -0
  587. data/vendor/v8/test/mjsunit/regress/regress-2285.js +32 -0
  588. data/vendor/v8/test/mjsunit/regress/regress-2286.js +32 -0
  589. data/vendor/v8/test/mjsunit/regress/regress-2289.js +34 -0
  590. data/vendor/v8/test/mjsunit/regress/regress-2291.js +36 -0
  591. data/vendor/v8/test/mjsunit/regress/regress-2294.js +70 -0
  592. data/vendor/v8/test/mjsunit/regress/regress-2296.js +40 -0
  593. data/vendor/v8/test/mjsunit/regress/regress-2315.js +40 -0
  594. data/vendor/v8/test/mjsunit/regress/regress-2318.js +66 -0
  595. data/vendor/v8/test/mjsunit/regress/regress-2322.js +36 -0
  596. data/vendor/v8/test/mjsunit/regress/regress-2326.js +54 -0
  597. data/vendor/v8/test/mjsunit/regress/regress-2336.js +53 -0
  598. data/vendor/v8/test/mjsunit/regress/regress-2339.js +59 -0
  599. data/vendor/v8/test/mjsunit/regress/regress-2346.js +123 -0
  600. data/vendor/v8/test/mjsunit/regress/regress-2373.js +29 -0
  601. data/vendor/v8/test/mjsunit/regress/regress-2374.js +33 -0
  602. data/vendor/v8/test/mjsunit/regress/regress-2398.js +41 -0
  603. data/vendor/v8/test/mjsunit/regress/regress-2410.js +36 -0
  604. data/vendor/v8/test/mjsunit/regress/regress-2416.js +75 -0
  605. data/vendor/v8/test/mjsunit/regress/regress-2419.js +37 -0
  606. data/vendor/v8/test/mjsunit/regress/regress-2433.js +36 -0
  607. data/vendor/v8/test/mjsunit/regress/regress-2437.js +156 -0
  608. data/vendor/v8/test/mjsunit/regress/regress-2438.js +52 -0
  609. data/vendor/v8/test/mjsunit/regress/regress-2443.js +129 -0
  610. data/vendor/v8/test/mjsunit/regress/regress-2444.js +120 -0
  611. data/vendor/v8/test/mjsunit/regress/regress-2489.js +50 -0
  612. data/vendor/v8/test/mjsunit/regress/regress-2499.js +40 -0
  613. data/vendor/v8/test/mjsunit/regress/regress-334.js +1 -1
  614. data/vendor/v8/test/mjsunit/regress/regress-492.js +39 -1
  615. data/vendor/v8/test/mjsunit/regress/regress-builtin-array-op.js +38 -0
  616. data/vendor/v8/test/mjsunit/regress/regress-cnlt-elements.js +43 -0
  617. data/vendor/v8/test/mjsunit/regress/regress-cnlt-enum-indices.js +45 -0
  618. data/vendor/v8/test/mjsunit/regress/regress-cntl-descriptors-enum.js +46 -0
  619. data/vendor/v8/test/mjsunit/regress/regress-convert-enum.js +60 -0
  620. data/vendor/v8/test/mjsunit/regress/regress-convert-enum2.js +46 -0
  621. data/vendor/v8/test/mjsunit/regress/regress-convert-transition.js +40 -0
  622. data/vendor/v8/test/mjsunit/regress/regress-crbug-119926.js +3 -1
  623. data/vendor/v8/test/mjsunit/regress/regress-crbug-125148.js +90 -0
  624. data/vendor/v8/test/mjsunit/regress/regress-crbug-134055.js +63 -0
  625. data/vendor/v8/test/mjsunit/regress/regress-crbug-134609.js +59 -0
  626. data/vendor/v8/test/mjsunit/regress/regress-crbug-135008.js +45 -0
  627. data/vendor/v8/test/mjsunit/regress/regress-crbug-135066.js +55 -0
  628. data/vendor/v8/test/mjsunit/regress/regress-crbug-137689.js +47 -0
  629. data/vendor/v8/test/mjsunit/regress/regress-crbug-138887.js +48 -0
  630. data/vendor/v8/test/mjsunit/regress/regress-crbug-140083.js +44 -0
  631. data/vendor/v8/test/mjsunit/regress/regress-crbug-142087.js +38 -0
  632. data/vendor/v8/test/mjsunit/regress/regress-crbug-142218.js +44 -0
  633. data/vendor/v8/test/mjsunit/regress/regress-crbug-145961.js +39 -0
  634. data/vendor/v8/test/mjsunit/regress/regress-crbug-146910.js +33 -0
  635. data/vendor/v8/test/mjsunit/regress/regress-crbug-147475.js +48 -0
  636. data/vendor/v8/test/mjsunit/regress/regress-crbug-148376.js +35 -0
  637. data/vendor/v8/test/mjsunit/regress/regress-crbug-150545.js +53 -0
  638. data/vendor/v8/test/mjsunit/regress/regress-crbug-150729.js +39 -0
  639. data/vendor/v8/test/mjsunit/regress/regress-crbug-157019.js +54 -0
  640. data/vendor/v8/test/mjsunit/regress/regress-crbug-157520.js +38 -0
  641. data/vendor/v8/test/mjsunit/regress/regress-crbug-158185.js +39 -0
  642. data/vendor/v8/test/mjsunit/regress/regress-crbug-160010.js +35 -0
  643. data/vendor/v8/test/mjsunit/regress/regress-crbug-162085.js +71 -0
  644. data/vendor/v8/test/mjsunit/regress/regress-crbug-168545.js +34 -0
  645. data/vendor/v8/test/mjsunit/regress/regress-crbug-170856.js +33 -0
  646. data/vendor/v8/test/mjsunit/regress/regress-crbug-172345.js +34 -0
  647. data/vendor/v8/test/mjsunit/regress/regress-crbug-173974.js +36 -0
  648. data/vendor/v8/test/mjsunit/regress/regress-crbug-18639.js +9 -5
  649. data/vendor/v8/test/mjsunit/regress/regress-debug-code-recompilation.js +2 -1
  650. data/vendor/v8/test/mjsunit/regress/regress-deep-proto.js +45 -0
  651. data/vendor/v8/test/mjsunit/regress/regress-delete-empty-double.js +40 -0
  652. data/vendor/v8/test/mjsunit/regress/regress-iteration-order.js +42 -0
  653. data/vendor/v8/test/mjsunit/regress/regress-json-stringify-gc.js +41 -0
  654. data/vendor/v8/test/mjsunit/regress/regress-latin-1.js +78 -0
  655. data/vendor/v8/test/mjsunit/regress/regress-load-elements.js +49 -0
  656. data/vendor/v8/test/mjsunit/regress/regress-observe-empty-double-array.js +38 -0
  657. data/vendor/v8/test/mjsunit/regress/regress-undefined-store-keyed-fast-element.js +37 -0
  658. data/vendor/v8/test/mjsunit/shift-for-integer-div.js +59 -0
  659. data/vendor/v8/test/mjsunit/stack-traces-gc.js +119 -0
  660. data/vendor/v8/test/mjsunit/stack-traces-overflow.js +122 -0
  661. data/vendor/v8/test/mjsunit/stack-traces.js +39 -1
  662. data/vendor/v8/test/mjsunit/str-to-num.js +7 -2
  663. data/vendor/v8/test/mjsunit/strict-mode.js +36 -11
  664. data/vendor/v8/test/mjsunit/string-charcodeat.js +3 -0
  665. data/vendor/v8/test/mjsunit/string-natives.js +72 -0
  666. data/vendor/v8/test/mjsunit/string-split.js +17 -0
  667. data/vendor/v8/test/mjsunit/testcfg.py +76 -6
  668. data/vendor/v8/test/mjsunit/tools/tickprocessor.js +4 -1
  669. data/vendor/v8/test/mjsunit/try-finally-continue.js +72 -0
  670. data/vendor/v8/test/mjsunit/typed-array-slice.js +61 -0
  671. data/vendor/v8/test/mjsunit/unbox-double-arrays.js +2 -0
  672. data/vendor/v8/test/mjsunit/uri.js +12 -0
  673. data/vendor/v8/test/mjsunit/with-readonly.js +4 -2
  674. data/vendor/v8/test/mozilla/mozilla.status +19 -113
  675. data/vendor/v8/test/mozilla/testcfg.py +122 -3
  676. data/vendor/v8/test/preparser/preparser.status +5 -0
  677. data/vendor/v8/test/preparser/strict-identifiers.pyt +1 -1
  678. data/vendor/v8/test/preparser/testcfg.py +101 -5
  679. data/vendor/v8/test/sputnik/sputnik.status +1 -1
  680. data/vendor/v8/test/sputnik/testcfg.py +5 -0
  681. data/vendor/v8/test/test262/README +2 -2
  682. data/vendor/v8/test/test262/test262.status +13 -36
  683. data/vendor/v8/test/test262/testcfg.py +102 -8
  684. data/vendor/v8/tools/android-build.sh +0 -0
  685. data/vendor/v8/tools/android-ll-prof.sh +69 -0
  686. data/vendor/v8/tools/android-run.py +109 -0
  687. data/vendor/v8/tools/android-sync.sh +105 -0
  688. data/vendor/v8/tools/bash-completion.sh +0 -0
  689. data/vendor/v8/tools/check-static-initializers.sh +0 -0
  690. data/vendor/v8/tools/common-includes.sh +15 -22
  691. data/vendor/v8/tools/disasm.py +4 -4
  692. data/vendor/v8/tools/fuzz-harness.sh +0 -0
  693. data/vendor/v8/tools/gen-postmortem-metadata.py +6 -8
  694. data/vendor/v8/tools/grokdump.py +404 -129
  695. data/vendor/v8/tools/gyp/v8.gyp +105 -43
  696. data/vendor/v8/tools/linux-tick-processor +5 -5
  697. data/vendor/v8/tools/ll_prof.py +75 -15
  698. data/vendor/v8/tools/merge-to-branch.sh +2 -2
  699. data/vendor/v8/tools/plot-timer-events +70 -0
  700. data/vendor/v8/tools/plot-timer-events.js +510 -0
  701. data/vendor/v8/tools/presubmit.py +1 -0
  702. data/vendor/v8/tools/push-to-trunk.sh +14 -4
  703. data/vendor/v8/tools/run-llprof.sh +69 -0
  704. data/vendor/v8/tools/run-tests.py +372 -0
  705. data/vendor/v8/tools/run-valgrind.py +1 -1
  706. data/vendor/v8/tools/status-file-converter.py +39 -0
  707. data/vendor/v8/tools/test-server.py +224 -0
  708. data/vendor/v8/tools/test-wrapper-gypbuild.py +13 -16
  709. data/vendor/v8/tools/test.py +10 -19
  710. data/vendor/v8/tools/testrunner/README +174 -0
  711. data/vendor/v8/tools/testrunner/__init__.py +26 -0
  712. data/vendor/v8/tools/testrunner/local/__init__.py +26 -0
  713. data/vendor/v8/tools/testrunner/local/commands.py +153 -0
  714. data/vendor/v8/tools/testrunner/local/execution.py +182 -0
  715. data/vendor/v8/tools/testrunner/local/old_statusfile.py +460 -0
  716. data/vendor/v8/tools/testrunner/local/progress.py +238 -0
  717. data/vendor/v8/tools/testrunner/local/statusfile.py +145 -0
  718. data/vendor/v8/tools/testrunner/local/testsuite.py +187 -0
  719. data/vendor/v8/tools/testrunner/local/utils.py +108 -0
  720. data/vendor/v8/tools/testrunner/local/verbose.py +99 -0
  721. data/vendor/v8/tools/testrunner/network/__init__.py +26 -0
  722. data/vendor/v8/tools/testrunner/network/distro.py +90 -0
  723. data/vendor/v8/tools/testrunner/network/endpoint.py +124 -0
  724. data/vendor/v8/tools/testrunner/network/network_execution.py +253 -0
  725. data/vendor/v8/tools/testrunner/network/perfdata.py +120 -0
  726. data/vendor/v8/tools/testrunner/objects/__init__.py +26 -0
  727. data/vendor/v8/tools/testrunner/objects/context.py +50 -0
  728. data/vendor/v8/tools/testrunner/objects/output.py +60 -0
  729. data/vendor/v8/tools/testrunner/objects/peer.py +80 -0
  730. data/vendor/v8/tools/testrunner/objects/testcase.py +83 -0
  731. data/vendor/v8/tools/testrunner/objects/workpacket.py +90 -0
  732. data/vendor/v8/tools/testrunner/server/__init__.py +26 -0
  733. data/vendor/v8/tools/testrunner/server/compression.py +111 -0
  734. data/vendor/v8/tools/testrunner/server/constants.py +51 -0
  735. data/vendor/v8/tools/testrunner/server/daemon.py +147 -0
  736. data/vendor/v8/tools/testrunner/server/local_handler.py +119 -0
  737. data/vendor/v8/tools/testrunner/server/main.py +245 -0
  738. data/vendor/v8/tools/testrunner/server/presence_handler.py +120 -0
  739. data/vendor/v8/tools/testrunner/server/signatures.py +63 -0
  740. data/vendor/v8/tools/testrunner/server/status_handler.py +112 -0
  741. data/vendor/v8/tools/testrunner/server/work_handler.py +150 -0
  742. data/vendor/v8/tools/tick-processor.html +168 -0
  743. data/vendor/v8/tools/tickprocessor-driver.js +5 -3
  744. data/vendor/v8/tools/tickprocessor.js +58 -15
  745. metadata +534 -30
  746. data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +0 -11
  747. data/patches/do-not-imply-vfp3-and-armv7.patch +0 -44
  748. data/patches/fPIC-on-x64.patch +0 -14
  749. data/vendor/v8/src/liveobjectlist-inl.h +0 -126
  750. data/vendor/v8/src/liveobjectlist.cc +0 -2631
  751. data/vendor/v8/src/liveobjectlist.h +0 -319
  752. data/vendor/v8/test/mjsunit/mul-exhaustive.js +0 -4629
  753. data/vendor/v8/test/mjsunit/numops-fuzz.js +0 -4609
  754. data/vendor/v8/test/mjsunit/regress/regress-1969.js +0 -5045
@@ -33,7 +33,7 @@
33
33
  #include "elements-kind.h"
34
34
  #include "list.h"
35
35
  #include "property-details.h"
36
- #include "smart-array-pointer.h"
36
+ #include "smart-pointers.h"
37
37
  #include "unicode-inl.h"
38
38
  #if V8_TARGET_ARCH_ARM
39
39
  #include "arm/constants-arm.h"
@@ -41,6 +41,7 @@
41
41
  #include "mips/constants-mips.h"
42
42
  #endif
43
43
  #include "v8checks.h"
44
+ #include "zone.h"
44
45
 
45
46
 
46
47
  //
@@ -83,6 +84,7 @@
83
84
  // - Context
84
85
  // - JSFunctionResultCache
85
86
  // - ScopeInfo
87
+ // - TransitionArray
86
88
  // - FixedDoubleArray
87
89
  // - ExternalArray
88
90
  // - ExternalPixelArray
@@ -95,7 +97,7 @@
95
97
  // - ExternalFloatArray
96
98
  // - String
97
99
  // - SeqString
98
- // - SeqAsciiString
100
+ // - SeqOneByteString
99
101
  // - SeqTwoByteString
100
102
  // - SlicedString
101
103
  // - ConsString
@@ -169,9 +171,53 @@ enum CreationFlag {
169
171
  };
170
172
 
171
173
 
174
+ // Indicates whether transitions can be added to a source map or not.
175
+ enum TransitionFlag {
176
+ INSERT_TRANSITION,
177
+ OMIT_TRANSITION
178
+ };
179
+
180
+
181
+ enum DebugExtraICState {
182
+ DEBUG_BREAK,
183
+ DEBUG_PREPARE_STEP_IN
184
+ };
185
+
186
+
187
+ // Indicates whether the transition is simple: the target map of the transition
188
+ // either extends the current map with a new property, or it modifies the
189
+ // property that was added last to the current map.
190
+ enum SimpleTransitionFlag {
191
+ SIMPLE_TRANSITION,
192
+ FULL_TRANSITION
193
+ };
194
+
195
+
196
+ // Indicates whether we are only interested in the descriptors of a particular
197
+ // map, or in all descriptors in the descriptor array.
198
+ enum DescriptorFlag {
199
+ ALL_DESCRIPTORS,
200
+ OWN_DESCRIPTORS
201
+ };
202
+
203
+ // The GC maintains a bit of information, the MarkingParity, which toggles
204
+ // from odd to even and back every time marking is completed. Incremental
205
+ // marking can visit an object twice during a marking phase, so algorithms that
206
+ // that piggy-back on marking can use the parity to ensure that they only
207
+ // perform an operation on an object once per marking phase: they record the
208
+ // MarkingParity when they visit an object, and only re-visit the object when it
209
+ // is marked again and the MarkingParity changes.
210
+ enum MarkingParity {
211
+ NO_MARKING_PARITY,
212
+ ODD_MARKING_PARITY,
213
+ EVEN_MARKING_PARITY
214
+ };
215
+
172
216
  // Instance size sentinel for objects of variable size.
173
217
  const int kVariableSizeSentinel = 0;
174
218
 
219
+ const int kStubMajorKeyBits = 6;
220
+ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
175
221
 
176
222
  // All Maps have a field instance_type containing a InstanceType.
177
223
  // It describes the type of the instances.
@@ -251,6 +297,7 @@ const int kVariableSizeSentinel = 0;
251
297
  V(OBJECT_TEMPLATE_INFO_TYPE) \
252
298
  V(SIGNATURE_INFO_TYPE) \
253
299
  V(TYPE_SWITCH_INFO_TYPE) \
300
+ V(ALLOCATION_SITE_INFO_TYPE) \
254
301
  V(SCRIPT_TYPE) \
255
302
  V(CODE_CACHE_TYPE) \
256
303
  V(POLYMORPHIC_CODE_CACHE_TYPE) \
@@ -404,6 +451,7 @@ const int kVariableSizeSentinel = 0;
404
451
  V(SIGNATURE_INFO, SignatureInfo, signature_info) \
405
452
  V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
406
453
  V(SCRIPT, Script, script) \
454
+ V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \
407
455
  V(CODE_CACHE, CodeCache, code_cache) \
408
456
  V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \
409
457
  V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \
@@ -439,7 +487,7 @@ const uint32_t kSymbolTag = 0x40;
439
487
  // two-byte characters or one-byte characters.
440
488
  const uint32_t kStringEncodingMask = 0x4;
441
489
  const uint32_t kTwoByteStringTag = 0x0;
442
- const uint32_t kAsciiStringTag = 0x4;
490
+ const uint32_t kOneByteStringTag = 0x4;
443
491
 
444
492
  // If bit 7 is clear, the low-order 2 bits indicate the representation
445
493
  // of the string.
@@ -490,39 +538,39 @@ const uint32_t kShortcutTypeTag = kConsStringTag;
490
538
  enum InstanceType {
491
539
  // String types.
492
540
  SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag,
493
- ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag,
541
+ ASCII_SYMBOL_TYPE = kOneByteStringTag | kSymbolTag | kSeqStringTag,
494
542
  CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag,
495
- CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag,
543
+ CONS_ASCII_SYMBOL_TYPE = kOneByteStringTag | kSymbolTag | kConsStringTag,
496
544
  SHORT_EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag |
497
545
  kExternalStringTag | kShortExternalStringTag,
498
546
  SHORT_EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE =
499
547
  kTwoByteStringTag | kSymbolTag | kExternalStringTag |
500
548
  kAsciiDataHintTag | kShortExternalStringTag,
501
- SHORT_EXTERNAL_ASCII_SYMBOL_TYPE = kAsciiStringTag | kExternalStringTag |
549
+ SHORT_EXTERNAL_ASCII_SYMBOL_TYPE = kOneByteStringTag | kExternalStringTag |
502
550
  kSymbolTag | kShortExternalStringTag,
503
551
  EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag,
504
552
  EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE =
505
553
  kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag,
506
554
  EXTERNAL_ASCII_SYMBOL_TYPE =
507
- kAsciiStringTag | kSymbolTag | kExternalStringTag,
555
+ kOneByteStringTag | kSymbolTag | kExternalStringTag,
508
556
  STRING_TYPE = kTwoByteStringTag | kSeqStringTag,
509
- ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag,
557
+ ASCII_STRING_TYPE = kOneByteStringTag | kSeqStringTag,
510
558
  CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag,
511
- CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag,
559
+ CONS_ASCII_STRING_TYPE = kOneByteStringTag | kConsStringTag,
512
560
  SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag,
513
- SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag,
561
+ SLICED_ASCII_STRING_TYPE = kOneByteStringTag | kSlicedStringTag,
514
562
  SHORT_EXTERNAL_STRING_TYPE =
515
563
  kTwoByteStringTag | kExternalStringTag | kShortExternalStringTag,
516
564
  SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE =
517
565
  kTwoByteStringTag | kExternalStringTag |
518
566
  kAsciiDataHintTag | kShortExternalStringTag,
519
567
  SHORT_EXTERNAL_ASCII_STRING_TYPE =
520
- kAsciiStringTag | kExternalStringTag | kShortExternalStringTag,
568
+ kOneByteStringTag | kExternalStringTag | kShortExternalStringTag,
521
569
  EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag,
522
570
  EXTERNAL_STRING_WITH_ASCII_DATA_TYPE =
523
571
  kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag,
524
572
  // LAST_STRING_TYPE
525
- EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag,
573
+ EXTERNAL_ASCII_STRING_TYPE = kOneByteStringTag | kExternalStringTag,
526
574
  PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE,
527
575
 
528
576
  // Objects allocated in their own spaces (never in new space).
@@ -559,6 +607,7 @@ enum InstanceType {
559
607
  OBJECT_TEMPLATE_INFO_TYPE,
560
608
  SIGNATURE_INFO_TYPE,
561
609
  TYPE_SWITCH_INFO_TYPE,
610
+ ALLOCATION_SITE_INFO_TYPE,
562
611
  SCRIPT_TYPE,
563
612
  CODE_CACHE_TYPE,
564
613
  POLYMORPHIC_CODE_CACHE_TYPE,
@@ -644,6 +693,25 @@ STATIC_CHECK(ODDBALL_TYPE == Internals::kOddballType);
644
693
  STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType);
645
694
 
646
695
 
696
+ #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \
697
+ V(FAST_ELEMENTS_SUB_TYPE) \
698
+ V(DICTIONARY_ELEMENTS_SUB_TYPE) \
699
+ V(FAST_PROPERTIES_SUB_TYPE) \
700
+ V(DICTIONARY_PROPERTIES_SUB_TYPE) \
701
+ V(MAP_CODE_CACHE_SUB_TYPE) \
702
+ V(SCOPE_INFO_SUB_TYPE) \
703
+ V(SYMBOL_TABLE_SUB_TYPE) \
704
+ V(DESCRIPTOR_ARRAY_SUB_TYPE) \
705
+ V(TRANSITION_ARRAY_SUB_TYPE)
706
+
707
+ enum FixedArraySubInstanceType {
708
+ #define DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE(name) name,
709
+ FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE)
710
+ #undef DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE
711
+ LAST_FIXED_ARRAY_SUB_TYPE = TRANSITION_ARRAY_SUB_TYPE
712
+ };
713
+
714
+
647
715
  enum CompareResult {
648
716
  LESS = -1,
649
717
  EQUAL = 0,
@@ -684,6 +752,17 @@ struct ValueInfo : public Malloced {
684
752
  // A template-ized version of the IsXXX functions.
685
753
  template <class C> static inline bool Is(Object* obj);
686
754
 
755
+ #ifdef VERIFY_HEAP
756
+ #define DECLARE_VERIFIER(Name) void Name##Verify();
757
+ #else
758
+ #define DECLARE_VERIFIER(Name)
759
+ #endif
760
+
761
+ #ifdef OBJECT_PRINT
762
+ #define DECLARE_PRINTER(Name) void Name##Print(FILE* out = stdout);
763
+ #else
764
+ #define DECLARE_PRINTER(Name)
765
+ #endif
687
766
 
688
767
  class MaybeObject BASE_EMBEDDED {
689
768
  public:
@@ -702,7 +781,9 @@ class MaybeObject BASE_EMBEDDED {
702
781
  return reinterpret_cast<Failure*>(this);
703
782
  }
704
783
  inline Object* ToObjectUnchecked() {
705
- ASSERT(!IsFailure());
784
+ // TODO(jkummerow): Turn this back into an ASSERT when we can be certain
785
+ // that it never fires in Release mode in the wild.
786
+ CHECK(!IsFailure());
706
787
  return reinterpret_cast<Object*>(this);
707
788
  }
708
789
  inline Object* ToObjectChecked() {
@@ -717,6 +798,13 @@ class MaybeObject BASE_EMBEDDED {
717
798
  return true;
718
799
  }
719
800
 
801
+ template<typename T>
802
+ inline bool ToHandle(Handle<T>* obj, Isolate* isolate) {
803
+ if (IsFailure()) return false;
804
+ *obj = handle(T::cast(reinterpret_cast<Object*>(this)), isolate);
805
+ return true;
806
+ }
807
+
720
808
  #ifdef OBJECT_PRINT
721
809
  // Prints this object with details.
722
810
  inline void Print() {
@@ -728,7 +816,7 @@ class MaybeObject BASE_EMBEDDED {
728
816
  void Print(FILE* out);
729
817
  void PrintLn(FILE* out);
730
818
  #endif
731
- #ifdef DEBUG
819
+ #ifdef VERIFY_HEAP
732
820
  // Verifies the object.
733
821
  void Verify();
734
822
  #endif
@@ -751,7 +839,7 @@ class MaybeObject BASE_EMBEDDED {
751
839
  V(ExternalTwoByteString) \
752
840
  V(ExternalAsciiString) \
753
841
  V(SeqTwoByteString) \
754
- V(SeqAsciiString) \
842
+ V(SeqOneByteString) \
755
843
  \
756
844
  V(ExternalArray) \
757
845
  V(ExternalByteArray) \
@@ -771,14 +859,15 @@ class MaybeObject BASE_EMBEDDED {
771
859
  V(JSModule) \
772
860
  V(Map) \
773
861
  V(DescriptorArray) \
862
+ V(TransitionArray) \
774
863
  V(DeoptimizationInputData) \
775
864
  V(DeoptimizationOutputData) \
865
+ V(DependentCodes) \
776
866
  V(TypeFeedbackCells) \
777
867
  V(FixedArray) \
778
868
  V(FixedDoubleArray) \
779
869
  V(Context) \
780
- V(GlobalContext) \
781
- V(ModuleContext) \
870
+ V(NativeContext) \
782
871
  V(ScopeInfo) \
783
872
  V(JSFunction) \
784
873
  V(Code) \
@@ -814,6 +903,7 @@ class MaybeObject BASE_EMBEDDED {
814
903
  V(UndetectableObject) \
815
904
  V(AccessCheckNeeded) \
816
905
  V(JSGlobalPropertyCell) \
906
+ V(ObjectHashTable) \
817
907
 
818
908
 
819
909
  class JSReceiver;
@@ -835,6 +925,7 @@ class Object : public MaybeObject {
835
925
  #undef IS_TYPE_FUNCTION_DECL
836
926
 
837
927
  inline bool IsFixedArrayBase();
928
+ inline bool IsExternal();
838
929
 
839
930
  // Returns true if this object is an instance of the specified
840
931
  // function template.
@@ -874,8 +965,8 @@ class Object : public MaybeObject {
874
965
  Object* ToBoolean(); // ECMA-262 9.2.
875
966
 
876
967
  // Convert to a JSObject if needed.
877
- // global_context is used when creating wrapper object.
878
- MUST_USE_RESULT MaybeObject* ToObject(Context* global_context);
968
+ // native_context is used when creating wrapper object.
969
+ MUST_USE_RESULT MaybeObject* ToObject(Context* native_context);
879
970
 
880
971
  // Converts this to a Smi if possible.
881
972
  // Failure is returned otherwise.
@@ -893,6 +984,7 @@ class Object : public MaybeObject {
893
984
  String* key,
894
985
  PropertyAttributes* attributes);
895
986
 
987
+ static Handle<Object> GetProperty(Handle<Object> object, Handle<String> key);
896
988
  static Handle<Object> GetProperty(Handle<Object> object,
897
989
  Handle<Object> receiver,
898
990
  LookupResult* result,
@@ -935,11 +1027,13 @@ class Object : public MaybeObject {
935
1027
  // < the length of the string. Used to implement [] on strings.
936
1028
  inline bool IsStringObjectWithCharacterAt(uint32_t index);
937
1029
 
938
- #ifdef DEBUG
1030
+ #ifdef VERIFY_HEAP
939
1031
  // Verify a pointer is a valid object pointer.
940
1032
  static void VerifyPointer(Object* p);
941
1033
  #endif
942
1034
 
1035
+ inline void VerifyApiCallResultType();
1036
+
943
1037
  // Prints this object without details.
944
1038
  inline void ShortPrint() {
945
1039
  ShortPrint(stdout);
@@ -988,9 +1082,8 @@ class Smi: public Object {
988
1082
  }
989
1083
  void SmiPrint(FILE* out);
990
1084
  void SmiPrint(StringStream* accumulator);
991
- #ifdef DEBUG
992
- void SmiVerify();
993
- #endif
1085
+
1086
+ DECLARE_VERIFIER(Smi)
994
1087
 
995
1088
  static const int kMinValue =
996
1089
  (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
@@ -1051,7 +1144,9 @@ class Failure: public MaybeObject {
1051
1144
  static inline Failure* RetryAfterGC(); // NEW_SPACE
1052
1145
  static inline Failure* Exception();
1053
1146
  static inline Failure* InternalError();
1054
- static inline Failure* OutOfMemoryException();
1147
+ // TODO(jkummerow): The value is temporary instrumentation. Remove it
1148
+ // when it has served its purpose.
1149
+ static inline Failure* OutOfMemoryException(intptr_t value);
1055
1150
  // Casting.
1056
1151
  static inline Failure* cast(MaybeObject* object);
1057
1152
 
@@ -1061,9 +1156,8 @@ class Failure: public MaybeObject {
1061
1156
  }
1062
1157
  void FailurePrint(FILE* out);
1063
1158
  void FailurePrint(StringStream* accumulator);
1064
- #ifdef DEBUG
1065
- void FailureVerify();
1066
- #endif
1159
+
1160
+ DECLARE_VERIFIER(Failure)
1067
1161
 
1068
1162
  private:
1069
1163
  inline intptr_t value() const;
@@ -1194,9 +1288,8 @@ class HeapObject: public Object {
1194
1288
  void HeapObjectPrint(FILE* out);
1195
1289
  void PrintHeader(FILE* out, const char* id);
1196
1290
  #endif
1197
-
1198
- #ifdef DEBUG
1199
- void HeapObjectVerify();
1291
+ DECLARE_VERIFIER(HeapObject)
1292
+ #ifdef VERIFY_HEAP
1200
1293
  inline void VerifyObjectField(int offset);
1201
1294
  inline void VerifySmiField(int offset);
1202
1295
 
@@ -1224,9 +1317,6 @@ class HeapObject: public Object {
1224
1317
  };
1225
1318
 
1226
1319
 
1227
- #define SLOT_ADDR(obj, offset) \
1228
- reinterpret_cast<Object**>((obj)->address() + offset)
1229
-
1230
1320
  // This class describes a body of an object of a fixed size
1231
1321
  // in which all pointer fields are located in the [start_offset, end_offset)
1232
1322
  // interval.
@@ -1241,8 +1331,8 @@ class FixedBodyDescriptor {
1241
1331
 
1242
1332
  template<typename StaticVisitor>
1243
1333
  static inline void IterateBody(HeapObject* obj) {
1244
- StaticVisitor::VisitPointers(SLOT_ADDR(obj, start_offset),
1245
- SLOT_ADDR(obj, end_offset));
1334
+ StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset),
1335
+ HeapObject::RawField(obj, end_offset));
1246
1336
  }
1247
1337
  };
1248
1338
 
@@ -1261,13 +1351,11 @@ class FlexibleBodyDescriptor {
1261
1351
 
1262
1352
  template<typename StaticVisitor>
1263
1353
  static inline void IterateBody(HeapObject* obj, int object_size) {
1264
- StaticVisitor::VisitPointers(SLOT_ADDR(obj, start_offset),
1265
- SLOT_ADDR(obj, object_size));
1354
+ StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset),
1355
+ HeapObject::RawField(obj, object_size));
1266
1356
  }
1267
1357
  };
1268
1358
 
1269
- #undef SLOT_ADDR
1270
-
1271
1359
 
1272
1360
  // The HeapNumber class describes heap allocated numbers that cannot be
1273
1361
  // represented in a Smi (small integer)
@@ -1287,9 +1375,7 @@ class HeapNumber: public HeapObject {
1287
1375
  }
1288
1376
  void HeapNumberPrint(FILE* out);
1289
1377
  void HeapNumberPrint(StringStream* accumulator);
1290
- #ifdef DEBUG
1291
- void HeapNumberVerify();
1292
- #endif
1378
+ DECLARE_VERIFIER(HeapNumber)
1293
1379
 
1294
1380
  inline int get_exponent();
1295
1381
  inline int get_sign();
@@ -1353,6 +1439,20 @@ class JSReceiver: public HeapObject {
1353
1439
  FORCE_DELETION
1354
1440
  };
1355
1441
 
1442
+ // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
1443
+ // a keyed store is of the form a[expression] = foo.
1444
+ enum StoreFromKeyed {
1445
+ MAY_BE_STORE_FROM_KEYED,
1446
+ CERTAINLY_NOT_STORE_FROM_KEYED
1447
+ };
1448
+
1449
+ // Internal properties (e.g. the hidden properties dictionary) might
1450
+ // be added even though the receiver is non-extensible.
1451
+ enum ExtensibilityCheck {
1452
+ PERFORM_EXTENSIBILITY_CHECK,
1453
+ OMIT_EXTENSIBILITY_CHECK
1454
+ };
1455
+
1356
1456
  // Casting.
1357
1457
  static inline JSReceiver* cast(Object* obj);
1358
1458
 
@@ -1362,15 +1462,19 @@ class JSReceiver: public HeapObject {
1362
1462
  PropertyAttributes attributes,
1363
1463
  StrictModeFlag strict_mode);
1364
1464
  // Can cause GC.
1365
- MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1366
- Object* value,
1367
- PropertyAttributes attributes,
1368
- StrictModeFlag strict_mode);
1369
- MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1370
- String* key,
1371
- Object* value,
1372
- PropertyAttributes attributes,
1373
- StrictModeFlag strict_mode);
1465
+ MUST_USE_RESULT MaybeObject* SetProperty(
1466
+ String* key,
1467
+ Object* value,
1468
+ PropertyAttributes attributes,
1469
+ StrictModeFlag strict_mode,
1470
+ StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED);
1471
+ MUST_USE_RESULT MaybeObject* SetProperty(
1472
+ LookupResult* result,
1473
+ String* key,
1474
+ Object* value,
1475
+ PropertyAttributes attributes,
1476
+ StrictModeFlag strict_mode,
1477
+ StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED);
1374
1478
  MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter,
1375
1479
  Object* value);
1376
1480
 
@@ -1400,14 +1504,21 @@ class JSReceiver: public HeapObject {
1400
1504
  String* name);
1401
1505
  PropertyAttributes GetLocalPropertyAttribute(String* name);
1402
1506
 
1507
+ inline PropertyAttributes GetElementAttribute(uint32_t index);
1508
+ inline PropertyAttributes GetLocalElementAttribute(uint32_t index);
1509
+
1403
1510
  // Can cause a GC.
1404
1511
  inline bool HasProperty(String* name);
1405
1512
  inline bool HasLocalProperty(String* name);
1406
1513
  inline bool HasElement(uint32_t index);
1514
+ inline bool HasLocalElement(uint32_t index);
1407
1515
 
1408
1516
  // Return the object's prototype (might be Heap::null_value()).
1409
1517
  inline Object* GetPrototype();
1410
1518
 
1519
+ // Return the constructor function (may be Heap::null_value()).
1520
+ inline Object* GetConstructor();
1521
+
1411
1522
  // Set the object's prototype (only JSReceiver and null are allowed).
1412
1523
  MUST_USE_RESULT MaybeObject* SetPrototype(Object* value,
1413
1524
  bool skip_hidden_prototypes);
@@ -1418,17 +1529,18 @@ class JSReceiver: public HeapObject {
1418
1529
 
1419
1530
  // Lookup a property. If found, the result is valid and has
1420
1531
  // detailed information.
1421
- void LocalLookup(String* name, LookupResult* result);
1532
+ void LocalLookup(String* name, LookupResult* result,
1533
+ bool search_hidden_prototypes = false);
1422
1534
  void Lookup(String* name, LookupResult* result);
1423
1535
 
1424
1536
  protected:
1425
1537
  Smi* GenerateIdentityHash();
1426
1538
 
1427
1539
  private:
1428
- PropertyAttributes GetPropertyAttribute(JSReceiver* receiver,
1429
- LookupResult* result,
1430
- String* name,
1431
- bool continue_search);
1540
+ PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver,
1541
+ LookupResult* result,
1542
+ String* name,
1543
+ bool continue_search);
1432
1544
 
1433
1545
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
1434
1546
  };
@@ -1477,6 +1589,8 @@ class JSObject: public JSReceiver {
1477
1589
  // Returns true if an object has elements of FAST_ELEMENTS or
1478
1590
  // FAST_SMI_ONLY_ELEMENTS.
1479
1591
  inline bool HasFastSmiOrObjectElements();
1592
+ // Returns true if an object has any of the fast elements kinds.
1593
+ inline bool HasFastElements();
1480
1594
  // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
1481
1595
  // ElementsKind.
1482
1596
  inline bool HasFastDoubleElements();
@@ -1524,7 +1638,8 @@ class JSObject: public JSReceiver {
1524
1638
  String* key,
1525
1639
  Object* value,
1526
1640
  PropertyAttributes attributes,
1527
- StrictModeFlag strict_mode);
1641
+ StrictModeFlag strict_mode,
1642
+ StoreFromKeyed store_mode);
1528
1643
  MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck(
1529
1644
  LookupResult* result,
1530
1645
  String* name,
@@ -1546,7 +1661,8 @@ class JSObject: public JSReceiver {
1546
1661
  String* name,
1547
1662
  Object* value,
1548
1663
  PropertyAttributes attributes,
1549
- StrictModeFlag strict_mode);
1664
+ StrictModeFlag strict_mode,
1665
+ ExtensibilityCheck extensibility_check);
1550
1666
 
1551
1667
  static Handle<Object> SetLocalPropertyIgnoreAttributes(
1552
1668
  Handle<JSObject> object,
@@ -1554,6 +1670,18 @@ class JSObject: public JSReceiver {
1554
1670
  Handle<Object> value,
1555
1671
  PropertyAttributes attributes);
1556
1672
 
1673
+ // Try to follow an existing transition to a field with attributes NONE. The
1674
+ // return value indicates whether the transition was successful.
1675
+ static inline bool TryTransitionToField(Handle<JSObject> object,
1676
+ Handle<String> key);
1677
+
1678
+ inline int LastAddedFieldIndex();
1679
+
1680
+ // Extend the receiver with a single fast property appeared first in the
1681
+ // passed map. This also extends the property backing store if necessary.
1682
+ static void AddFastPropertyUsingMap(Handle<JSObject> object, Handle<Map> map);
1683
+ inline MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(Map* map);
1684
+
1557
1685
  // Can cause GC.
1558
1686
  MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
1559
1687
  String* key,
@@ -1583,6 +1711,8 @@ class JSObject: public JSReceiver {
1583
1711
  MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name,
1584
1712
  DeleteMode mode);
1585
1713
 
1714
+ MUST_USE_RESULT MaybeObject* OptimizeAsPrototype();
1715
+
1586
1716
  // Retrieve interceptors.
1587
1717
  InterceptorInfo* GetNamedInterceptor();
1588
1718
  InterceptorInfo* GetIndexedInterceptor();
@@ -1599,12 +1729,16 @@ class JSObject: public JSReceiver {
1599
1729
  LookupResult* result,
1600
1730
  String* name,
1601
1731
  bool continue_search);
1732
+ PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver,
1733
+ uint32_t index,
1734
+ bool continue_search);
1602
1735
 
1603
1736
  static void DefineAccessor(Handle<JSObject> object,
1604
1737
  Handle<String> name,
1605
1738
  Handle<Object> getter,
1606
1739
  Handle<Object> setter,
1607
1740
  PropertyAttributes attributes);
1741
+ // Can cause GC.
1608
1742
  MUST_USE_RESULT MaybeObject* DefineAccessor(String* name,
1609
1743
  Object* getter,
1610
1744
  Object* setter,
@@ -1628,15 +1762,15 @@ class JSObject: public JSReceiver {
1628
1762
  String* name,
1629
1763
  PropertyAttributes* attributes);
1630
1764
  MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor(
1631
- JSReceiver* receiver,
1765
+ Object* receiver,
1632
1766
  String* name,
1633
1767
  PropertyAttributes* attributes);
1634
1768
  MUST_USE_RESULT MaybeObject* GetPropertyPostInterceptor(
1635
- JSReceiver* receiver,
1769
+ Object* receiver,
1636
1770
  String* name,
1637
1771
  PropertyAttributes* attributes);
1638
1772
  MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor(
1639
- JSReceiver* receiver,
1773
+ Object* receiver,
1640
1774
  String* name,
1641
1775
  PropertyAttributes* attributes);
1642
1776
 
@@ -1676,10 +1810,11 @@ class JSObject: public JSReceiver {
1676
1810
 
1677
1811
  static int GetIdentityHash(Handle<JSObject> obj);
1678
1812
  MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
1679
- MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag);
1813
+ MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag);
1680
1814
 
1681
1815
  static Handle<Object> DeleteProperty(Handle<JSObject> obj,
1682
1816
  Handle<String> name);
1817
+ // Can cause GC.
1683
1818
  MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1684
1819
 
1685
1820
  static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index);
@@ -1718,36 +1853,18 @@ class JSObject: public JSReceiver {
1718
1853
  // be represented as a double and not a Smi.
1719
1854
  bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements);
1720
1855
 
1721
- // Tells whether the index'th element is present.
1722
- bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index);
1723
-
1724
1856
  // Computes the new capacity when expanding the elements of a JSObject.
1725
1857
  static int NewElementsCapacity(int old_capacity) {
1726
1858
  // (old_capacity + 50%) + 16
1727
1859
  return old_capacity + (old_capacity >> 1) + 16;
1728
1860
  }
1729
1861
 
1730
- // Tells whether the index'th element is present and how it is stored.
1731
- enum LocalElementType {
1732
- // There is no element with given index.
1733
- UNDEFINED_ELEMENT,
1862
+ PropertyType GetLocalPropertyType(String* name);
1863
+ PropertyType GetLocalElementType(uint32_t index);
1734
1864
 
1735
- // Element with given index is handled by interceptor.
1736
- INTERCEPTED_ELEMENT,
1737
-
1738
- // Element with given index is character in string.
1739
- STRING_CHARACTER_ELEMENT,
1740
-
1741
- // Element with given index is stored in fast backing store.
1742
- FAST_ELEMENT,
1743
-
1744
- // Element with given index is stored in slow backing store.
1745
- DICTIONARY_ELEMENT
1746
- };
1747
-
1748
- LocalElementType HasLocalElement(uint32_t index);
1749
-
1750
- bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index);
1865
+ // These methods do not perform access checks!
1866
+ AccessorPair* GetLocalPropertyAccessorPair(String* name);
1867
+ AccessorPair* GetLocalElementAccessorPair(uint32_t index);
1751
1868
 
1752
1869
  MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index,
1753
1870
  Object* value,
@@ -1774,7 +1891,7 @@ class JSObject: public JSReceiver {
1774
1891
  StrictModeFlag strict_mode);
1775
1892
 
1776
1893
  // Empty handle is returned if the element cannot be set to the given value.
1777
- static MUST_USE_RESULT Handle<Object> SetElement(
1894
+ static Handle<Object> SetElement(
1778
1895
  Handle<JSObject> object,
1779
1896
  uint32_t index,
1780
1897
  Handle<Object> value,
@@ -1837,10 +1954,9 @@ class JSObject: public JSReceiver {
1837
1954
  void LocalLookupRealNamedProperty(String* name, LookupResult* result);
1838
1955
  void LookupRealNamedProperty(String* name, LookupResult* result);
1839
1956
  void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1840
- void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1841
1957
  MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes(
1842
1958
  uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode);
1843
- void LookupCallback(String* name, LookupResult* result);
1959
+ void LookupCallbackProperty(String* name, LookupResult* result);
1844
1960
 
1845
1961
  // Returns the number of properties on this object filtering out properties
1846
1962
  // with the specified attributes (ignoring interceptors).
@@ -1868,7 +1984,8 @@ class JSObject: public JSReceiver {
1868
1984
  // new_map.
1869
1985
  MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(Map* new_map,
1870
1986
  String* name,
1871
- Object* value);
1987
+ Object* value,
1988
+ int field_index);
1872
1989
 
1873
1990
  // Add a constant function property to a fast-case object.
1874
1991
  // This leaves a CONSTANT_TRANSITION in the old map, and
@@ -1900,40 +2017,43 @@ class JSObject: public JSReceiver {
1900
2017
  ElementsKind to_kind);
1901
2018
 
1902
2019
  MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2020
+ MUST_USE_RESULT MaybeObject* PossiblyTransitionArrayBoilerplate(
2021
+ ElementsKind to_kind);
1903
2022
 
1904
- // Converts a descriptor of any other type to a real field,
1905
- // backed by the properties array. Descriptors of visible
1906
- // types, such as CONSTANT_FUNCTION, keep their enumeration order.
1907
- // Converts the descriptor on the original object's map to a
1908
- // map transition, and the the new field is on the object's new map.
1909
- MUST_USE_RESULT MaybeObject* ConvertDescriptorToFieldAndMapTransition(
2023
+ // Replaces an existing transition with a transition to a map with a FIELD.
2024
+ MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition(
2025
+ int transition_index,
1910
2026
  String* name,
1911
2027
  Object* new_value,
1912
2028
  PropertyAttributes attributes);
1913
2029
 
1914
- // Converts a descriptor of any other type to a real field,
1915
- // backed by the properties array. Descriptors of visible
1916
- // types, such as CONSTANT_FUNCTION, keep their enumeration order.
2030
+ // Converts a descriptor of any other type to a real field, backed by the
2031
+ // properties array.
1917
2032
  MUST_USE_RESULT MaybeObject* ConvertDescriptorToField(
1918
2033
  String* name,
1919
2034
  Object* new_value,
1920
2035
  PropertyAttributes attributes);
1921
2036
 
1922
2037
  // Add a property to a fast-case object.
1923
- MUST_USE_RESULT MaybeObject* AddFastProperty(String* name,
1924
- Object* value,
1925
- PropertyAttributes attributes);
2038
+ MUST_USE_RESULT MaybeObject* AddFastProperty(
2039
+ String* name,
2040
+ Object* value,
2041
+ PropertyAttributes attributes,
2042
+ StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
1926
2043
 
1927
2044
  // Add a property to a slow-case object.
1928
2045
  MUST_USE_RESULT MaybeObject* AddSlowProperty(String* name,
1929
2046
  Object* value,
1930
2047
  PropertyAttributes attributes);
1931
2048
 
1932
- // Add a property to an object.
1933
- MUST_USE_RESULT MaybeObject* AddProperty(String* name,
1934
- Object* value,
1935
- PropertyAttributes attributes,
1936
- StrictModeFlag strict_mode);
2049
+ // Add a property to an object. May cause GC.
2050
+ MUST_USE_RESULT MaybeObject* AddProperty(
2051
+ String* name,
2052
+ Object* value,
2053
+ PropertyAttributes attributes,
2054
+ StrictModeFlag strict_mode,
2055
+ StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
2056
+ ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
1937
2057
 
1938
2058
  // Convert the object to use the canonical dictionary
1939
2059
  // representation. If the object is expected to have additional properties
@@ -2002,15 +2122,8 @@ class JSObject: public JSReceiver {
2002
2122
 
2003
2123
  // Dispatched behavior.
2004
2124
  void JSObjectShortPrint(StringStream* accumulator);
2005
- #ifdef OBJECT_PRINT
2006
- inline void JSObjectPrint() {
2007
- JSObjectPrint(stdout);
2008
- }
2009
- void JSObjectPrint(FILE* out);
2010
- #endif
2011
- #ifdef DEBUG
2012
- void JSObjectVerify();
2013
- #endif
2125
+ DECLARE_PRINTER(JSObject)
2126
+ DECLARE_VERIFIER(JSObject)
2014
2127
  #ifdef OBJECT_PRINT
2015
2128
  inline void PrintProperties() {
2016
2129
  PrintProperties(stdout);
@@ -2021,6 +2134,10 @@ class JSObject: public JSReceiver {
2021
2134
  PrintElements(stdout);
2022
2135
  }
2023
2136
  void PrintElements(FILE* out);
2137
+ inline void PrintTransitions() {
2138
+ PrintTransitions(stdout);
2139
+ }
2140
+ void PrintTransitions(FILE* out);
2024
2141
  #endif
2025
2142
 
2026
2143
  void PrintElementsTransition(
@@ -2053,7 +2170,7 @@ class JSObject: public JSReceiver {
2053
2170
  // Maximal number of fast properties for the JSObject. Used to
2054
2171
  // restrict the number of map transitions to avoid an explosion in
2055
2172
  // the number of maps for objects used as dictionaries.
2056
- inline int MaxFastProperties();
2173
+ inline bool TooManyFastProperties(int properties, StoreFromKeyed store_mode);
2057
2174
 
2058
2175
  // Maximal number of elements (numbered 0 .. kMaxElementCount - 1).
2059
2176
  // Also maximal value of JSArray's length property.
@@ -2075,7 +2192,8 @@ class JSObject: public JSReceiver {
2075
2192
  static const int kMaxUncheckedOldFastElementsLength = 500;
2076
2193
 
2077
2194
  static const int kInitialMaxFastElementArray = 100000;
2078
- static const int kMaxFastProperties = 12;
2195
+ static const int kFastPropertiesSoftLimit = 12;
2196
+ static const int kMaxFastProperties = 64;
2079
2197
  static const int kMaxInstanceSize = 255 * kPointerSize;
2080
2198
  // When extending the backing storage for property values, we increase
2081
2199
  // its size by more than the 1 entry necessary, so sequentially adding fields
@@ -2094,6 +2212,15 @@ class JSObject: public JSReceiver {
2094
2212
  static inline int SizeOf(Map* map, HeapObject* object);
2095
2213
  };
2096
2214
 
2215
+ // Enqueue change record for Object.observe. May cause GC.
2216
+ static void EnqueueChangeRecord(Handle<JSObject> object,
2217
+ const char* type,
2218
+ Handle<String> name,
2219
+ Handle<Object> old_value);
2220
+
2221
+ // Deliver change records to observers. May cause GC.
2222
+ static void DeliverChangeRecords(Isolate* isolate);
2223
+
2097
2224
  private:
2098
2225
  friend class DictionaryElementsAccessor;
2099
2226
 
@@ -2101,6 +2228,14 @@ class JSObject: public JSReceiver {
2101
2228
  Object* structure,
2102
2229
  uint32_t index,
2103
2230
  Object* holder);
2231
+ MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor(
2232
+ JSReceiver* receiver,
2233
+ uint32_t index,
2234
+ bool continue_search);
2235
+ MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor(
2236
+ JSReceiver* receiver,
2237
+ uint32_t index,
2238
+ bool continue_search);
2104
2239
  MUST_USE_RESULT MaybeObject* SetElementWithCallback(
2105
2240
  Object* structure,
2106
2241
  uint32_t index,
@@ -2122,17 +2257,16 @@ class JSObject: public JSReceiver {
2122
2257
  bool check_prototype,
2123
2258
  SetPropertyMode set_mode);
2124
2259
 
2125
- // Searches the prototype chain for a callback setter and sets the property
2126
- // with the setter if it finds one. The '*found' flag indicates whether
2127
- // a setter was found or not.
2128
- // This function can cause GC and can return a failure result with
2129
- // '*found==true'.
2130
- MUST_USE_RESULT MaybeObject* SetPropertyWithCallbackSetterInPrototypes(
2260
+ // Searches the prototype chain for property 'name'. If it is found and
2261
+ // has a setter, invoke it and set '*done' to true. If it is found and is
2262
+ // read-only, reject and set '*done' to true. Otherwise, set '*done' to
2263
+ // false. Can cause GC and can return a failure result with '*done==true'.
2264
+ MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes(
2131
2265
  String* name,
2132
2266
  Object* value,
2133
2267
  PropertyAttributes attributes,
2134
- bool* found,
2135
- StrictModeFlag strict_mode);
2268
+ StrictModeFlag strict_mode,
2269
+ bool* done);
2136
2270
 
2137
2271
  MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
2138
2272
  DeleteMode mode);
@@ -2174,18 +2308,23 @@ class JSObject: public JSReceiver {
2174
2308
  Object* getter,
2175
2309
  Object* setter,
2176
2310
  PropertyAttributes attributes);
2177
- void LookupInDescriptor(String* name, LookupResult* result);
2178
-
2179
- // Returns the hidden properties backing store object, currently
2180
- // a StringDictionary, stored on this object.
2181
- // If no hidden properties object has been put on this object,
2182
- // return undefined, unless create_if_absent is true, in which case
2183
- // a new dictionary is created, added to this object, and returned.
2184
- MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary(
2185
- bool create_if_absent);
2186
- // Updates the existing hidden properties dictionary.
2187
- MUST_USE_RESULT MaybeObject* SetHiddenPropertiesDictionary(
2188
- StringDictionary* dictionary);
2311
+
2312
+
2313
+ enum InitializeHiddenProperties {
2314
+ CREATE_NEW_IF_ABSENT,
2315
+ ONLY_RETURN_INLINE_VALUE
2316
+ };
2317
+
2318
+ // If create_if_absent is true, return the hash table backing store
2319
+ // for hidden properties. If there is no backing store, allocate one.
2320
+ // If create_if_absent is false, return the hash table backing store
2321
+ // or the inline stored identity hash, whatever is found.
2322
+ MUST_USE_RESULT MaybeObject* GetHiddenPropertiesHashTable(
2323
+ InitializeHiddenProperties init_option);
2324
+ // Set the hidden property backing store to either a hash table or
2325
+ // the inline-stored identity hash.
2326
+ MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable(
2327
+ Object* value);
2189
2328
 
2190
2329
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
2191
2330
  };
@@ -2209,6 +2348,8 @@ class FixedArrayBase: public HeapObject {
2209
2348
 
2210
2349
 
2211
2350
  class FixedDoubleArray;
2351
+ class IncrementalMarking;
2352
+
2212
2353
 
2213
2354
  // FixedArray describes fixed-sized arrays with element type Object*.
2214
2355
  class FixedArray: public FixedArrayBase {
@@ -2239,12 +2380,12 @@ class FixedArray: public FixedArrayBase {
2239
2380
  inline void set_unchecked(Heap* heap, int index, Object* value,
2240
2381
  WriteBarrierMode mode);
2241
2382
 
2242
- // Gives access to raw memory which stores the array's data.
2243
- inline Object** data_start();
2244
-
2245
2383
  inline Object** GetFirstElementAddress();
2246
2384
  inline bool ContainsOnlySmisOrHoles();
2247
2385
 
2386
+ // Gives access to raw memory which stores the array's data.
2387
+ inline Object** data_start();
2388
+
2248
2389
  // Copy operations.
2249
2390
  MUST_USE_RESULT inline MaybeObject* Copy();
2250
2391
  MUST_USE_RESULT MaybeObject* CopySize(int new_length);
@@ -2275,14 +2416,9 @@ class FixedArray: public FixedArrayBase {
2275
2416
  static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize;
2276
2417
 
2277
2418
  // Dispatched behavior.
2278
- #ifdef OBJECT_PRINT
2279
- inline void FixedArrayPrint() {
2280
- FixedArrayPrint(stdout);
2281
- }
2282
- void FixedArrayPrint(FILE* out);
2283
- #endif
2419
+ DECLARE_PRINTER(FixedArray)
2420
+ DECLARE_VERIFIER(FixedArray)
2284
2421
  #ifdef DEBUG
2285
- void FixedArrayVerify();
2286
2422
  // Checks if two FixedArrays have identical contents.
2287
2423
  bool IsEqualTo(FixedArray* other);
2288
2424
  #endif
@@ -2319,6 +2455,8 @@ class FixedArray: public FixedArrayBase {
2319
2455
  Object* value);
2320
2456
 
2321
2457
  private:
2458
+ STATIC_CHECK(kHeaderSize == Internals::kFixedArrayHeaderSize);
2459
+
2322
2460
  DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray);
2323
2461
  };
2324
2462
 
@@ -2344,6 +2482,9 @@ class FixedDoubleArray: public FixedArrayBase {
2344
2482
  return kHeaderSize + length * kDoubleSize;
2345
2483
  }
2346
2484
 
2485
+ // Gives access to raw memory which stores the array's data.
2486
+ inline double* data_start();
2487
+
2347
2488
  // Code Generation support.
2348
2489
  static int OffsetOfElementAt(int index) { return SizeFor(index); }
2349
2490
 
@@ -2362,40 +2503,41 @@ class FixedDoubleArray: public FixedArrayBase {
2362
2503
  static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize;
2363
2504
 
2364
2505
  // Dispatched behavior.
2365
- #ifdef OBJECT_PRINT
2366
- inline void FixedDoubleArrayPrint() {
2367
- FixedDoubleArrayPrint(stdout);
2368
- }
2369
- void FixedDoubleArrayPrint(FILE* out);
2370
- #endif
2371
-
2372
- #ifdef DEBUG
2373
- void FixedDoubleArrayVerify();
2374
- #endif
2506
+ DECLARE_PRINTER(FixedDoubleArray)
2507
+ DECLARE_VERIFIER(FixedDoubleArray)
2375
2508
 
2376
2509
  private:
2377
2510
  DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
2378
2511
  };
2379
2512
 
2380
2513
 
2381
- class IncrementalMarking;
2382
-
2383
-
2384
2514
  // DescriptorArrays are fixed arrays used to hold instance descriptors.
2385
2515
  // The format of the these objects is:
2386
- // TODO(1399): It should be possible to make room for bit_field3 in the map
2387
- // without overloading the instance descriptors field in the map
2388
- // (and storing it in the DescriptorArray when the map has one).
2389
- // [0]: storage for bit_field3 for Map owning this object (Smi)
2390
- // [1]: point to a fixed array with (value, detail) pairs.
2391
- // [2]: next enumeration index (Smi), or pointer to small fixed array:
2392
- // [0]: next enumeration index (Smi)
2393
- // [1]: pointer to fixed array with enum cache
2394
- // [3]: first key
2395
- // [length() - 1]: last key
2396
- //
2516
+ // [0]: Number of descriptors
2517
+ // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array:
2518
+ // [0]: pointer to fixed array with enum cache
2519
+ // [1]: either Smi(0) or pointer to fixed array with indices
2520
+ // [2]: first key
2521
+ // [2 + number of descriptors * kDescriptorSize]: start of slack
2397
2522
  class DescriptorArray: public FixedArray {
2398
2523
  public:
2524
+ // WhitenessWitness is used to prove that a descriptor array is white
2525
+ // (unmarked), so incremental write barriers can be skipped because the
2526
+ // marking invariant cannot be broken and slots pointing into evacuation
2527
+ // candidates will be discovered when the object is scanned. A witness is
2528
+ // always stack-allocated right after creating an array. By allocating a
2529
+ // witness, incremental marking is globally disabled. The witness is then
2530
+ // passed along wherever needed to statically prove that the array is known to
2531
+ // be white.
2532
+ class WhitenessWitness {
2533
+ public:
2534
+ inline explicit WhitenessWitness(FixedArray* array);
2535
+ inline ~WhitenessWitness();
2536
+
2537
+ private:
2538
+ IncrementalMarking* marking_;
2539
+ };
2540
+
2399
2541
  // Returns true for both shared empty_descriptor_array and for smis, which the
2400
2542
  // map uses to encode additional bit fields when the descriptor array is not
2401
2543
  // yet used.
@@ -2403,43 +2545,58 @@ class DescriptorArray: public FixedArray {
2403
2545
 
2404
2546
  // Returns the number of descriptors in the array.
2405
2547
  int number_of_descriptors() {
2406
- ASSERT(length() > kFirstIndex || IsEmpty());
2548
+ ASSERT(length() >= kFirstIndex || IsEmpty());
2407
2549
  int len = length();
2408
- return len <= kFirstIndex ? 0 : len - kFirstIndex;
2550
+ return len == 0 ? 0 : Smi::cast(get(kDescriptorLengthIndex))->value();
2409
2551
  }
2410
2552
 
2411
- int NextEnumerationIndex() {
2412
- if (IsEmpty()) return PropertyDetails::kInitialIndex;
2413
- Object* obj = get(kEnumerationIndexIndex);
2414
- if (obj->IsSmi()) {
2415
- return Smi::cast(obj)->value();
2416
- } else {
2417
- Object* index = FixedArray::cast(obj)->get(kEnumCacheBridgeEnumIndex);
2418
- return Smi::cast(index)->value();
2419
- }
2553
+ int number_of_descriptors_storage() {
2554
+ int len = length();
2555
+ return len == 0 ? 0 : (len - kFirstIndex) / kDescriptorSize;
2420
2556
  }
2421
2557
 
2422
- // Set next enumeration index and flush any enum cache.
2423
- void SetNextEnumerationIndex(int value) {
2424
- if (!IsEmpty()) {
2425
- set(kEnumerationIndexIndex, Smi::FromInt(value));
2426
- }
2558
+ int NumberOfSlackDescriptors() {
2559
+ return number_of_descriptors_storage() - number_of_descriptors();
2427
2560
  }
2561
+
2562
+ inline void SetNumberOfDescriptors(int number_of_descriptors);
2563
+ inline int number_of_entries() { return number_of_descriptors(); }
2564
+
2428
2565
  bool HasEnumCache() {
2429
- return !IsEmpty() && !get(kEnumerationIndexIndex)->IsSmi();
2566
+ return !IsEmpty() && !get(kEnumCacheIndex)->IsSmi();
2567
+ }
2568
+
2569
+ void CopyEnumCacheFrom(DescriptorArray* array) {
2570
+ set(kEnumCacheIndex, array->get(kEnumCacheIndex));
2571
+ }
2572
+
2573
+ FixedArray* GetEnumCache() {
2574
+ ASSERT(HasEnumCache());
2575
+ FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex));
2576
+ return FixedArray::cast(bridge->get(kEnumCacheBridgeCacheIndex));
2577
+ }
2578
+
2579
+ bool HasEnumIndicesCache() {
2580
+ if (IsEmpty()) return false;
2581
+ Object* object = get(kEnumCacheIndex);
2582
+ if (object->IsSmi()) return false;
2583
+ FixedArray* bridge = FixedArray::cast(object);
2584
+ return !bridge->get(kEnumCacheBridgeIndicesCacheIndex)->IsSmi();
2585
+ }
2586
+
2587
+ FixedArray* GetEnumIndicesCache() {
2588
+ ASSERT(HasEnumIndicesCache());
2589
+ FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex));
2590
+ return FixedArray::cast(bridge->get(kEnumCacheBridgeIndicesCacheIndex));
2430
2591
  }
2431
2592
 
2432
- Object* GetEnumCache() {
2593
+ Object** GetEnumCacheSlot() {
2433
2594
  ASSERT(HasEnumCache());
2434
- FixedArray* bridge = FixedArray::cast(get(kEnumerationIndexIndex));
2435
- return bridge->get(kEnumCacheBridgeCacheIndex);
2595
+ return HeapObject::RawField(reinterpret_cast<HeapObject*>(this),
2596
+ kEnumCacheOffset);
2436
2597
  }
2437
2598
 
2438
- // TODO(1399): It should be possible to make room for bit_field3 in the map
2439
- // without overloading the instance descriptors field in the map
2440
- // (and storing it in the DescriptorArray when the map has one).
2441
- inline int bit_field3_storage();
2442
- inline void set_bit_field3_storage(int value);
2599
+ void ClearEnumCache();
2443
2600
 
2444
2601
  // Initialize or change the enum cache,
2445
2602
  // using the supplied storage for the small "bridge".
@@ -2449,101 +2606,58 @@ class DescriptorArray: public FixedArray {
2449
2606
 
2450
2607
  // Accessors for fetching instance descriptor at descriptor number.
2451
2608
  inline String* GetKey(int descriptor_number);
2609
+ inline Object** GetKeySlot(int descriptor_number);
2452
2610
  inline Object* GetValue(int descriptor_number);
2453
2611
  inline Object** GetValueSlot(int descriptor_number);
2612
+ inline Object** GetDescriptorStartSlot(int descriptor_number);
2613
+ inline Object** GetDescriptorEndSlot(int descriptor_number);
2454
2614
  inline PropertyDetails GetDetails(int descriptor_number);
2455
2615
  inline PropertyType GetType(int descriptor_number);
2456
2616
  inline int GetFieldIndex(int descriptor_number);
2457
2617
  inline JSFunction* GetConstantFunction(int descriptor_number);
2458
2618
  inline Object* GetCallbacksObject(int descriptor_number);
2459
2619
  inline AccessorDescriptor* GetCallbacks(int descriptor_number);
2460
- inline bool IsProperty(int descriptor_number);
2461
- inline bool IsTransitionOnly(int descriptor_number);
2462
- inline bool IsNullDescriptor(int descriptor_number);
2463
2620
 
2464
- // WhitenessWitness is used to prove that a specific descriptor array is white
2465
- // (unmarked), so incremental write barriers can be skipped because the
2466
- // marking invariant cannot be broken and slots pointing into evacuation
2467
- // candidates will be discovered when the object is scanned. A witness is
2468
- // always stack-allocated right after creating a descriptor array. By
2469
- // allocating a witness, incremental marking is globally disabled. The witness
2470
- // is then passed along wherever needed to statically prove that the
2471
- // descriptor array is known to be white.
2472
- class WhitenessWitness {
2473
- public:
2474
- inline explicit WhitenessWitness(DescriptorArray* array);
2475
- inline ~WhitenessWitness();
2476
-
2477
- private:
2478
- IncrementalMarking* marking_;
2479
- };
2621
+ inline String* GetSortedKey(int descriptor_number);
2622
+ inline int GetSortedKeyIndex(int descriptor_number);
2623
+ inline void SetSortedKey(int pointer, int descriptor_number);
2480
2624
 
2481
2625
  // Accessor for complete descriptor.
2482
2626
  inline void Get(int descriptor_number, Descriptor* desc);
2483
2627
  inline void Set(int descriptor_number,
2484
2628
  Descriptor* desc,
2485
2629
  const WhitenessWitness&);
2630
+ inline void Set(int descriptor_number, Descriptor* desc);
2486
2631
 
2487
- // Transfer a complete descriptor from the src descriptor array to the dst
2488
- // one, dropping map transitions in CALLBACKS.
2489
- static void CopyFrom(Handle<DescriptorArray> dst,
2490
- int dst_index,
2491
- Handle<DescriptorArray> src,
2492
- int src_index,
2493
- const WhitenessWitness& witness);
2632
+ // Append automatically sets the enumeration index. This should only be used
2633
+ // to add descriptors in bulk at the end, followed by sorting the descriptor
2634
+ // array.
2635
+ inline void Append(Descriptor* desc, const WhitenessWitness&);
2636
+ inline void Append(Descriptor* desc);
2494
2637
 
2495
2638
  // Transfer a complete descriptor from the src descriptor array to this
2496
- // descriptor array, dropping map transitions in CALLBACKS.
2497
- MUST_USE_RESULT MaybeObject* CopyFrom(int dst_index,
2498
- DescriptorArray* src,
2499
- int src_index,
2500
- const WhitenessWitness&);
2501
-
2502
- // Copy the descriptor array, insert a new descriptor and optionally
2503
- // remove map transitions. If the descriptor is already present, it is
2504
- // replaced. If a replaced descriptor is a real property (not a transition
2505
- // or null), its enumeration index is kept as is.
2506
- // If adding a real property, map transitions must be removed. If adding
2507
- // a transition, they must not be removed. All null descriptors are removed.
2508
- MUST_USE_RESULT MaybeObject* CopyInsert(Descriptor* descriptor,
2509
- TransitionFlag transition_flag);
2510
-
2511
- // Return a copy of the array with all transitions and null descriptors
2512
- // removed. Return a Failure object in case of an allocation failure.
2513
- MUST_USE_RESULT MaybeObject* RemoveTransitions();
2639
+ // descriptor array.
2640
+ void CopyFrom(int dst_index,
2641
+ DescriptorArray* src,
2642
+ int src_index,
2643
+ const WhitenessWitness&);
2514
2644
 
2515
- // Sort the instance descriptors by the hash codes of their keys.
2516
- // Does not check for duplicates.
2517
- void SortUnchecked(const WhitenessWitness&);
2645
+ MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index);
2518
2646
 
2519
2647
  // Sort the instance descriptors by the hash codes of their keys.
2520
- // Checks the result for duplicates.
2521
- void Sort(const WhitenessWitness&);
2648
+ void Sort();
2522
2649
 
2523
2650
  // Search the instance descriptors for given name.
2524
- inline int Search(String* name);
2651
+ INLINE(int Search(String* name, int number_of_own_descriptors));
2525
2652
 
2526
2653
  // As the above, but uses DescriptorLookupCache and updates it when
2527
2654
  // necessary.
2528
- inline int SearchWithCache(String* name);
2529
-
2530
- // Tells whether the name is present int the array.
2531
- bool Contains(String* name) { return kNotFound != Search(name); }
2532
-
2533
- // Perform a binary search in the instance descriptors represented
2534
- // by this fixed array. low and high are descriptor indices. If there
2535
- // are three instance descriptors in this array it should be called
2536
- // with low=0 and high=2.
2537
- int BinarySearch(String* name, int low, int high);
2538
-
2539
- // Perform a linear search in the instance descriptors represented
2540
- // by this fixed array. len is the number of descriptor indices that are
2541
- // valid. Does not require the descriptors to be sorted.
2542
- int LinearSearch(String* name, int len);
2655
+ INLINE(int SearchWithCache(String* name, Map* map));
2543
2656
 
2544
2657
  // Allocates a DescriptorArray, but returns the singleton
2545
2658
  // empty descriptor array object if number_of_descriptors is 0.
2546
- MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors);
2659
+ MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors,
2660
+ int slack = 0);
2547
2661
 
2548
2662
  // Casting.
2549
2663
  static inline DescriptorArray* cast(Object* obj);
@@ -2551,27 +2665,28 @@ class DescriptorArray: public FixedArray {
2551
2665
  // Constant for denoting key was not found.
2552
2666
  static const int kNotFound = -1;
2553
2667
 
2554
- static const int kBitField3StorageIndex = 0;
2555
- static const int kContentArrayIndex = 1;
2556
- static const int kEnumerationIndexIndex = 2;
2557
- static const int kFirstIndex = 3;
2668
+ static const int kDescriptorLengthIndex = 0;
2669
+ static const int kEnumCacheIndex = 1;
2670
+ static const int kFirstIndex = 2;
2558
2671
 
2559
2672
  // The length of the "bridge" to the enum cache.
2560
- static const int kEnumCacheBridgeLength = 3;
2561
- static const int kEnumCacheBridgeEnumIndex = 0;
2562
- static const int kEnumCacheBridgeCacheIndex = 1;
2563
- static const int kEnumCacheBridgeIndicesCacheIndex = 2;
2673
+ static const int kEnumCacheBridgeLength = 2;
2674
+ static const int kEnumCacheBridgeCacheIndex = 0;
2675
+ static const int kEnumCacheBridgeIndicesCacheIndex = 1;
2564
2676
 
2565
2677
  // Layout description.
2566
- static const int kBitField3StorageOffset = FixedArray::kHeaderSize;
2567
- static const int kContentArrayOffset = kBitField3StorageOffset + kPointerSize;
2568
- static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize;
2569
- static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize;
2678
+ static const int kDescriptorLengthOffset = FixedArray::kHeaderSize;
2679
+ static const int kEnumCacheOffset = kDescriptorLengthOffset + kPointerSize;
2680
+ static const int kFirstOffset = kEnumCacheOffset + kPointerSize;
2570
2681
 
2571
2682
  // Layout description for the bridge array.
2572
- static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize;
2573
- static const int kEnumCacheBridgeCacheOffset =
2574
- kEnumCacheBridgeEnumOffset + kPointerSize;
2683
+ static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize;
2684
+
2685
+ // Layout of descriptor.
2686
+ static const int kDescriptorKey = 0;
2687
+ static const int kDescriptorDetails = 1;
2688
+ static const int kDescriptorValue = 2;
2689
+ static const int kDescriptorSize = 3;
2575
2690
 
2576
2691
  #ifdef OBJECT_PRINT
2577
2692
  // Print all the descriptors.
@@ -2583,7 +2698,7 @@ class DescriptorArray: public FixedArray {
2583
2698
 
2584
2699
  #ifdef DEBUG
2585
2700
  // Is the descriptor array sorted and without duplicates?
2586
- bool IsSortedNoDuplicates();
2701
+ bool IsSortedNoDuplicates(int valid_descriptors = -1);
2587
2702
 
2588
2703
  // Is the descriptor array consistent with the back pointers in targets?
2589
2704
  bool IsConsistentWithBackPointers(Map* current_map);
@@ -2596,9 +2711,13 @@ class DescriptorArray: public FixedArray {
2596
2711
  // fit in a page).
2597
2712
  static const int kMaxNumberOfDescriptors = 1024 + 512;
2598
2713
 
2599
- private:
2600
- friend class IntrusiveMapTransitionIterator;
2714
+ // Returns the fixed array length required to hold number_of_descriptors
2715
+ // descriptors.
2716
+ static int LengthFor(int number_of_descriptors) {
2717
+ return ToKeyIndex(number_of_descriptors);
2718
+ }
2601
2719
 
2720
+ private:
2602
2721
  // An entry in a DescriptorArray, represented as an (array, index) pair.
2603
2722
  class Entry {
2604
2723
  public:
@@ -2615,33 +2734,40 @@ class DescriptorArray: public FixedArray {
2615
2734
 
2616
2735
  // Conversion from descriptor number to array indices.
2617
2736
  static int ToKeyIndex(int descriptor_number) {
2618
- return descriptor_number+kFirstIndex;
2737
+ return kFirstIndex +
2738
+ (descriptor_number * kDescriptorSize) +
2739
+ kDescriptorKey;
2619
2740
  }
2620
2741
 
2621
2742
  static int ToDetailsIndex(int descriptor_number) {
2622
- return (descriptor_number << 1) + 1;
2743
+ return kFirstIndex +
2744
+ (descriptor_number * kDescriptorSize) +
2745
+ kDescriptorDetails;
2623
2746
  }
2624
2747
 
2625
2748
  static int ToValueIndex(int descriptor_number) {
2626
- return descriptor_number << 1;
2749
+ return kFirstIndex +
2750
+ (descriptor_number * kDescriptorSize) +
2751
+ kDescriptorValue;
2627
2752
  }
2628
2753
 
2629
- // Swap operation on FixedArray without using write barriers.
2630
- static inline void NoIncrementalWriteBarrierSwap(
2631
- FixedArray* array, int first, int second);
2632
-
2633
- // Swap descriptor first and second.
2634
- inline void NoIncrementalWriteBarrierSwapDescriptors(
2635
- int first, int second);
2636
-
2637
- FixedArray* GetContentArray() {
2638
- return FixedArray::cast(get(kContentArrayIndex));
2639
- }
2754
+ // Swap first and second descriptor.
2755
+ inline void SwapSortedKeys(int first, int second);
2640
2756
 
2641
2757
  DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray);
2642
2758
  };
2643
2759
 
2644
2760
 
2761
+ enum SearchMode { ALL_ENTRIES, VALID_ENTRIES };
2762
+
2763
+ template<SearchMode search_mode, typename T>
2764
+ inline int LinearSearch(T* array, String* name, int len, int valid_entries);
2765
+
2766
+
2767
+ template<SearchMode search_mode, typename T>
2768
+ inline int Search(T* array, String* name, int valid_entries = 0);
2769
+
2770
+
2645
2771
  // HashTable is a subclass of FixedArray that implements a hash table
2646
2772
  // that uses open addressing and quadratic probing.
2647
2773
  //
@@ -2694,6 +2820,11 @@ class BaseShape {
2694
2820
  template<typename Shape, typename Key>
2695
2821
  class HashTable: public FixedArray {
2696
2822
  public:
2823
+ enum MinimumCapacity {
2824
+ USE_DEFAULT_MINIMUM_CAPACITY,
2825
+ USE_CUSTOM_MINIMUM_CAPACITY
2826
+ };
2827
+
2697
2828
  // Wrapper methods
2698
2829
  inline uint32_t Hash(Key key) {
2699
2830
  if (Shape::UsesSeed) {
@@ -2746,6 +2877,7 @@ class HashTable: public FixedArray {
2746
2877
  // Returns a new HashTable object. Might return Failure.
2747
2878
  MUST_USE_RESULT static MaybeObject* Allocate(
2748
2879
  int at_least_space_for,
2880
+ MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY,
2749
2881
  PretenureFlag pretenure = NOT_TENURED);
2750
2882
 
2751
2883
  // Computes the required capacity for a table holding the given
@@ -2835,11 +2967,12 @@ class HashTable: public FixedArray {
2835
2967
  return (hash + GetProbeOffset(number)) & (size - 1);
2836
2968
  }
2837
2969
 
2838
- static uint32_t FirstProbe(uint32_t hash, uint32_t size) {
2970
+ inline static uint32_t FirstProbe(uint32_t hash, uint32_t size) {
2839
2971
  return hash & (size - 1);
2840
2972
  }
2841
2973
 
2842
- static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) {
2974
+ inline static uint32_t NextProbe(
2975
+ uint32_t last, uint32_t number, uint32_t size) {
2843
2976
  return (last + number) & (size - 1);
2844
2977
  }
2845
2978
 
@@ -2890,7 +3023,7 @@ class SymbolTableShape : public BaseShape<HashTableKey*> {
2890
3023
  static const int kEntrySize = 1;
2891
3024
  };
2892
3025
 
2893
- class SeqAsciiString;
3026
+ class SeqOneByteString;
2894
3027
 
2895
3028
  // SymbolTable.
2896
3029
  //
@@ -2902,11 +3035,12 @@ class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> {
2902
3035
  // added. The return value is the symbol table which might have
2903
3036
  // been enlarged. If the return value is not a failure, the symbol
2904
3037
  // pointer *s is set to the symbol found.
2905
- MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str, Object** s);
2906
- MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str,
2907
- Object** s);
2908
- MUST_USE_RESULT MaybeObject* LookupSubStringAsciiSymbol(
2909
- Handle<SeqAsciiString> str,
3038
+ MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str,
3039
+ Object** s);
3040
+ MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const uint8_t> str,
3041
+ Object** s);
3042
+ MUST_USE_RESULT MaybeObject* LookupSubStringOneByteSymbol(
3043
+ Handle<SeqOneByteString> str,
2910
3044
  int from,
2911
3045
  int length,
2912
3046
  Object** s);
@@ -2918,7 +3052,7 @@ class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> {
2918
3052
  // true if it is found, assigning the symbol to the given output
2919
3053
  // parameter.
2920
3054
  bool LookupSymbolIfExists(String* str, String** symbol);
2921
- bool LookupTwoCharsSymbolIfExists(uint32_t c1, uint32_t c2, String** symbol);
3055
+ bool LookupTwoCharsSymbolIfExists(uint16_t c1, uint16_t c2, String** symbol);
2922
3056
 
2923
3057
  // Casting.
2924
3058
  static inline SymbolTable* cast(Object* obj);
@@ -2926,6 +3060,8 @@ class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> {
2926
3060
  private:
2927
3061
  MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s);
2928
3062
 
3063
+ template <bool seq_ascii> friend class JsonParser;
3064
+
2929
3065
  DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable);
2930
3066
  };
2931
3067
 
@@ -3023,6 +3159,7 @@ class Dictionary: public HashTable<Shape, Key> {
3023
3159
 
3024
3160
  // Accessors for next enumeration index.
3025
3161
  void SetNextEnumerationIndex(int index) {
3162
+ ASSERT(index != 0);
3026
3163
  this->set(kNextEnumerationIndexIndex, Smi::FromInt(index));
3027
3164
  }
3028
3165
 
@@ -3096,7 +3233,9 @@ class StringDictionary: public Dictionary<StringDictionaryShape, String*> {
3096
3233
  }
3097
3234
 
3098
3235
  // Copies enumerable keys to preallocated fixed array.
3099
- void CopyEnumKeysTo(FixedArray* storage, FixedArray* sort_array);
3236
+ FixedArray* CopyEnumKeysTo(FixedArray* storage);
3237
+ static void DoGenerateNewEnumerationIndices(
3238
+ Handle<StringDictionary> dictionary);
3100
3239
 
3101
3240
  // For transforming properties of a JSObject.
3102
3241
  MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor(
@@ -3106,8 +3245,6 @@ class StringDictionary: public Dictionary<StringDictionaryShape, String*> {
3106
3245
  // Find entry for key, otherwise return kNotFound. Optimized version of
3107
3246
  // HashTable::FindEntry.
3108
3247
  int FindEntry(String* key);
3109
-
3110
- bool ContainsTransition(int entry);
3111
3248
  };
3112
3249
 
3113
3250
 
@@ -3253,12 +3390,12 @@ class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> {
3253
3390
  return reinterpret_cast<ObjectHashTable*>(obj);
3254
3391
  }
3255
3392
 
3256
- // Looks up the value associated with the given key. The undefined value is
3393
+ // Looks up the value associated with the given key. The hole value is
3257
3394
  // returned in case the key is not present.
3258
3395
  Object* Lookup(Object* key);
3259
3396
 
3260
3397
  // Adds (or overwrites) the value associated with the given key. Mapping a
3261
- // key to the undefined value causes removal of the whole entry.
3398
+ // key to the hole value causes removal of the whole entry.
3262
3399
  MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value);
3263
3400
 
3264
3401
  private:
@@ -3306,9 +3443,7 @@ class JSFunctionResultCache: public FixedArray {
3306
3443
  // Casting
3307
3444
  static inline JSFunctionResultCache* cast(Object* obj);
3308
3445
 
3309
- #ifdef DEBUG
3310
- void JSFunctionResultCacheVerify();
3311
- #endif
3446
+ DECLARE_VERIFIER(JSFunctionResultCache)
3312
3447
  };
3313
3448
 
3314
3449
 
@@ -3412,7 +3547,7 @@ class ScopeInfo : public FixedArray {
3412
3547
  // must be a symbol (canonicalized).
3413
3548
  int FunctionContextSlotIndex(String* name, VariableMode* mode);
3414
3549
 
3415
- static Handle<ScopeInfo> Create(Scope* scope);
3550
+ static Handle<ScopeInfo> Create(Scope* scope, Zone* zone);
3416
3551
 
3417
3552
  // Serializes empty scope info.
3418
3553
  static ScopeInfo* Empty();
@@ -3455,7 +3590,7 @@ class ScopeInfo : public FixedArray {
3455
3590
  FOR_EACH_NUMERIC_FIELD(DECL_INDEX)
3456
3591
  #undef DECL_INDEX
3457
3592
  #undef FOR_EACH_NUMERIC_FIELD
3458
- kVariablePartIndex
3593
+ kVariablePartIndex
3459
3594
  };
3460
3595
 
3461
3596
  // The layout of the variable part of a ScopeInfo is as follows:
@@ -3528,9 +3663,7 @@ class NormalizedMapCache: public FixedArray {
3528
3663
  // Casting
3529
3664
  static inline NormalizedMapCache* cast(Object* obj);
3530
3665
 
3531
- #ifdef DEBUG
3532
- void NormalizedMapCacheVerify();
3533
- #endif
3666
+ DECLARE_VERIFIER(NormalizedMapCache)
3534
3667
  };
3535
3668
 
3536
3669
 
@@ -3573,15 +3706,8 @@ class ByteArray: public FixedArrayBase {
3573
3706
  inline int ByteArraySize() {
3574
3707
  return SizeFor(this->length());
3575
3708
  }
3576
- #ifdef OBJECT_PRINT
3577
- inline void ByteArrayPrint() {
3578
- ByteArrayPrint(stdout);
3579
- }
3580
- void ByteArrayPrint(FILE* out);
3581
- #endif
3582
- #ifdef DEBUG
3583
- void ByteArrayVerify();
3584
- #endif
3709
+ DECLARE_PRINTER(ByteArray)
3710
+ DECLARE_VERIFIER(ByteArray)
3585
3711
 
3586
3712
  // Layout description.
3587
3713
  static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
@@ -3609,15 +3735,9 @@ class FreeSpace: public HeapObject {
3609
3735
  // Casting.
3610
3736
  static inline FreeSpace* cast(Object* obj);
3611
3737
 
3612
- #ifdef OBJECT_PRINT
3613
- inline void FreeSpacePrint() {
3614
- FreeSpacePrint(stdout);
3615
- }
3616
- void FreeSpacePrint(FILE* out);
3617
- #endif
3618
- #ifdef DEBUG
3619
- void FreeSpaceVerify();
3620
- #endif
3738
+ // Dispatched behavior.
3739
+ DECLARE_PRINTER(FreeSpace)
3740
+ DECLARE_VERIFIER(FreeSpace)
3621
3741
 
3622
3742
  // Layout description.
3623
3743
  // Size is smi tagged when it is stored.
@@ -3691,15 +3811,9 @@ class ExternalPixelArray: public ExternalArray {
3691
3811
  // Casting.
3692
3812
  static inline ExternalPixelArray* cast(Object* obj);
3693
3813
 
3694
- #ifdef OBJECT_PRINT
3695
- inline void ExternalPixelArrayPrint() {
3696
- ExternalPixelArrayPrint(stdout);
3697
- }
3698
- void ExternalPixelArrayPrint(FILE* out);
3699
- #endif
3700
- #ifdef DEBUG
3701
- void ExternalPixelArrayVerify();
3702
- #endif // DEBUG
3814
+ // Dispatched behavior.
3815
+ DECLARE_PRINTER(ExternalPixelArray)
3816
+ DECLARE_VERIFIER(ExternalPixelArray)
3703
3817
 
3704
3818
  private:
3705
3819
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
@@ -3720,15 +3834,9 @@ class ExternalByteArray: public ExternalArray {
3720
3834
  // Casting.
3721
3835
  static inline ExternalByteArray* cast(Object* obj);
3722
3836
 
3723
- #ifdef OBJECT_PRINT
3724
- inline void ExternalByteArrayPrint() {
3725
- ExternalByteArrayPrint(stdout);
3726
- }
3727
- void ExternalByteArrayPrint(FILE* out);
3728
- #endif
3729
- #ifdef DEBUG
3730
- void ExternalByteArrayVerify();
3731
- #endif // DEBUG
3837
+ // Dispatched behavior.
3838
+ DECLARE_PRINTER(ExternalByteArray)
3839
+ DECLARE_VERIFIER(ExternalByteArray)
3732
3840
 
3733
3841
  private:
3734
3842
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
@@ -3749,15 +3857,9 @@ class ExternalUnsignedByteArray: public ExternalArray {
3749
3857
  // Casting.
3750
3858
  static inline ExternalUnsignedByteArray* cast(Object* obj);
3751
3859
 
3752
- #ifdef OBJECT_PRINT
3753
- inline void ExternalUnsignedByteArrayPrint() {
3754
- ExternalUnsignedByteArrayPrint(stdout);
3755
- }
3756
- void ExternalUnsignedByteArrayPrint(FILE* out);
3757
- #endif
3758
- #ifdef DEBUG
3759
- void ExternalUnsignedByteArrayVerify();
3760
- #endif // DEBUG
3860
+ // Dispatched behavior.
3861
+ DECLARE_PRINTER(ExternalUnsignedByteArray)
3862
+ DECLARE_VERIFIER(ExternalUnsignedByteArray)
3761
3863
 
3762
3864
  private:
3763
3865
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
@@ -3778,15 +3880,9 @@ class ExternalShortArray: public ExternalArray {
3778
3880
  // Casting.
3779
3881
  static inline ExternalShortArray* cast(Object* obj);
3780
3882
 
3781
- #ifdef OBJECT_PRINT
3782
- inline void ExternalShortArrayPrint() {
3783
- ExternalShortArrayPrint(stdout);
3784
- }
3785
- void ExternalShortArrayPrint(FILE* out);
3786
- #endif
3787
- #ifdef DEBUG
3788
- void ExternalShortArrayVerify();
3789
- #endif // DEBUG
3883
+ // Dispatched behavior.
3884
+ DECLARE_PRINTER(ExternalShortArray)
3885
+ DECLARE_VERIFIER(ExternalShortArray)
3790
3886
 
3791
3887
  private:
3792
3888
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
@@ -3807,15 +3903,9 @@ class ExternalUnsignedShortArray: public ExternalArray {
3807
3903
  // Casting.
3808
3904
  static inline ExternalUnsignedShortArray* cast(Object* obj);
3809
3905
 
3810
- #ifdef OBJECT_PRINT
3811
- inline void ExternalUnsignedShortArrayPrint() {
3812
- ExternalUnsignedShortArrayPrint(stdout);
3813
- }
3814
- void ExternalUnsignedShortArrayPrint(FILE* out);
3815
- #endif
3816
- #ifdef DEBUG
3817
- void ExternalUnsignedShortArrayVerify();
3818
- #endif // DEBUG
3906
+ // Dispatched behavior.
3907
+ DECLARE_PRINTER(ExternalUnsignedShortArray)
3908
+ DECLARE_VERIFIER(ExternalUnsignedShortArray)
3819
3909
 
3820
3910
  private:
3821
3911
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
@@ -3836,15 +3926,9 @@ class ExternalIntArray: public ExternalArray {
3836
3926
  // Casting.
3837
3927
  static inline ExternalIntArray* cast(Object* obj);
3838
3928
 
3839
- #ifdef OBJECT_PRINT
3840
- inline void ExternalIntArrayPrint() {
3841
- ExternalIntArrayPrint(stdout);
3842
- }
3843
- void ExternalIntArrayPrint(FILE* out);
3844
- #endif
3845
- #ifdef DEBUG
3846
- void ExternalIntArrayVerify();
3847
- #endif // DEBUG
3929
+ // Dispatched behavior.
3930
+ DECLARE_PRINTER(ExternalIntArray)
3931
+ DECLARE_VERIFIER(ExternalIntArray)
3848
3932
 
3849
3933
  private:
3850
3934
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
@@ -3865,15 +3949,9 @@ class ExternalUnsignedIntArray: public ExternalArray {
3865
3949
  // Casting.
3866
3950
  static inline ExternalUnsignedIntArray* cast(Object* obj);
3867
3951
 
3868
- #ifdef OBJECT_PRINT
3869
- inline void ExternalUnsignedIntArrayPrint() {
3870
- ExternalUnsignedIntArrayPrint(stdout);
3871
- }
3872
- void ExternalUnsignedIntArrayPrint(FILE* out);
3873
- #endif
3874
- #ifdef DEBUG
3875
- void ExternalUnsignedIntArrayVerify();
3876
- #endif // DEBUG
3952
+ // Dispatched behavior.
3953
+ DECLARE_PRINTER(ExternalUnsignedIntArray)
3954
+ DECLARE_VERIFIER(ExternalUnsignedIntArray)
3877
3955
 
3878
3956
  private:
3879
3957
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
@@ -3894,15 +3972,9 @@ class ExternalFloatArray: public ExternalArray {
3894
3972
  // Casting.
3895
3973
  static inline ExternalFloatArray* cast(Object* obj);
3896
3974
 
3897
- #ifdef OBJECT_PRINT
3898
- inline void ExternalFloatArrayPrint() {
3899
- ExternalFloatArrayPrint(stdout);
3900
- }
3901
- void ExternalFloatArrayPrint(FILE* out);
3902
- #endif
3903
- #ifdef DEBUG
3904
- void ExternalFloatArrayVerify();
3905
- #endif // DEBUG
3975
+ // Dispatched behavior.
3976
+ DECLARE_PRINTER(ExternalFloatArray)
3977
+ DECLARE_VERIFIER(ExternalFloatArray)
3906
3978
 
3907
3979
  private:
3908
3980
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
@@ -3923,15 +3995,9 @@ class ExternalDoubleArray: public ExternalArray {
3923
3995
  // Casting.
3924
3996
  static inline ExternalDoubleArray* cast(Object* obj);
3925
3997
 
3926
- #ifdef OBJECT_PRINT
3927
- inline void ExternalDoubleArrayPrint() {
3928
- ExternalDoubleArrayPrint(stdout);
3929
- }
3930
- void ExternalDoubleArrayPrint(FILE* out);
3931
- #endif // OBJECT_PRINT
3932
- #ifdef DEBUG
3933
- void ExternalDoubleArrayVerify();
3934
- #endif // DEBUG
3998
+ // Dispatched behavior.
3999
+ DECLARE_PRINTER(ExternalDoubleArray)
4000
+ DECLARE_VERIFIER(ExternalDoubleArray)
3935
4001
 
3936
4002
  private:
3937
4003
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray);
@@ -3956,7 +4022,7 @@ class DeoptimizationInputData: public FixedArray {
3956
4022
  static const int kFirstDeoptEntryIndex = 5;
3957
4023
 
3958
4024
  // Offsets of deopt entry elements relative to the start of the entry.
3959
- static const int kAstIdOffset = 0;
4025
+ static const int kAstIdRawOffset = 0;
3960
4026
  static const int kTranslationIndexOffset = 1;
3961
4027
  static const int kArgumentsStackHeightOffset = 2;
3962
4028
  static const int kPcOffset = 3;
@@ -3988,13 +4054,21 @@ class DeoptimizationInputData: public FixedArray {
3988
4054
  set(IndexForEntry(i) + k##name##Offset, value); \
3989
4055
  }
3990
4056
 
3991
- DEFINE_ENTRY_ACCESSORS(AstId, Smi)
4057
+ DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi)
3992
4058
  DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi)
3993
4059
  DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi)
3994
4060
  DEFINE_ENTRY_ACCESSORS(Pc, Smi)
3995
4061
 
3996
4062
  #undef DEFINE_ENTRY_ACCESSORS
3997
4063
 
4064
+ BailoutId AstId(int i) {
4065
+ return BailoutId(AstIdRaw(i)->value());
4066
+ }
4067
+
4068
+ void SetAstId(int i, BailoutId value) {
4069
+ SetAstIdRaw(i, Smi::FromInt(value.ToInt()));
4070
+ }
4071
+
3998
4072
  int DeoptCount() {
3999
4073
  return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize;
4000
4074
  }
@@ -4029,8 +4103,15 @@ class DeoptimizationInputData: public FixedArray {
4029
4103
  class DeoptimizationOutputData: public FixedArray {
4030
4104
  public:
4031
4105
  int DeoptPoints() { return length() / 2; }
4032
- Smi* AstId(int index) { return Smi::cast(get(index * 2)); }
4033
- void SetAstId(int index, Smi* id) { set(index * 2, id); }
4106
+
4107
+ BailoutId AstId(int index) {
4108
+ return BailoutId(Smi::cast(get(index * 2))->value());
4109
+ }
4110
+
4111
+ void SetAstId(int index, BailoutId id) {
4112
+ set(index * 2, Smi::FromInt(id.ToInt()));
4113
+ }
4114
+
4034
4115
  Smi* PcAndState(int index) { return Smi::cast(get(1 + index * 2)); }
4035
4116
  void SetPcAndState(int index, Smi* offset) { set(1 + index * 2, offset); }
4036
4117
 
@@ -4065,8 +4146,8 @@ class TypeFeedbackCells: public FixedArray {
4065
4146
  static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
4066
4147
 
4067
4148
  // Accessors for AST ids associated with cache values.
4068
- inline Smi* AstId(int index);
4069
- inline void SetAstId(int index, Smi* id);
4149
+ inline TypeFeedbackId AstId(int index);
4150
+ inline void SetAstId(int index, TypeFeedbackId id);
4070
4151
 
4071
4152
  // Accessors for global property cells holding the cache values.
4072
4153
  inline JSGlobalPropertyCell* Cell(int index);
@@ -4106,30 +4187,52 @@ class Code: public HeapObject {
4106
4187
  FLAGS_MAX_VALUE = kMaxInt
4107
4188
  };
4108
4189
 
4190
+ #define CODE_KIND_LIST(V) \
4191
+ V(FUNCTION) \
4192
+ V(OPTIMIZED_FUNCTION) \
4193
+ V(STUB) \
4194
+ V(COMPILED_STUB) \
4195
+ V(BUILTIN) \
4196
+ V(LOAD_IC) \
4197
+ V(KEYED_LOAD_IC) \
4198
+ V(CALL_IC) \
4199
+ V(KEYED_CALL_IC) \
4200
+ V(STORE_IC) \
4201
+ V(KEYED_STORE_IC) \
4202
+ V(UNARY_OP_IC) \
4203
+ V(BINARY_OP_IC) \
4204
+ V(COMPARE_IC) \
4205
+ V(TO_BOOLEAN_IC)
4206
+
4109
4207
  enum Kind {
4110
- FUNCTION,
4111
- OPTIMIZED_FUNCTION,
4112
- STUB,
4113
- BUILTIN,
4114
- LOAD_IC,
4115
- KEYED_LOAD_IC,
4116
- CALL_IC,
4117
- KEYED_CALL_IC,
4118
- STORE_IC,
4119
- KEYED_STORE_IC,
4120
- UNARY_OP_IC,
4121
- BINARY_OP_IC,
4122
- COMPARE_IC,
4123
- TO_BOOLEAN_IC,
4124
- // No more than 16 kinds. The value currently encoded in four bits in
4125
- // Flags.
4208
+ #define DEFINE_CODE_KIND_ENUM(name) name,
4209
+ CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
4210
+ #undef DEFINE_CODE_KIND_ENUM
4126
4211
 
4127
4212
  // Pseudo-kinds.
4213
+ LAST_CODE_KIND = TO_BOOLEAN_IC,
4128
4214
  REGEXP = BUILTIN,
4129
4215
  FIRST_IC_KIND = LOAD_IC,
4130
4216
  LAST_IC_KIND = TO_BOOLEAN_IC
4131
4217
  };
4132
4218
 
4219
+ // No more than 16 kinds. The value is currently encoded in four bits in
4220
+ // Flags.
4221
+ STATIC_ASSERT(LAST_CODE_KIND < 16);
4222
+
4223
+ static const char* Kind2String(Kind kind);
4224
+
4225
+ // Types of stubs.
4226
+ enum StubType {
4227
+ NORMAL,
4228
+ FIELD,
4229
+ CONSTANT_FUNCTION,
4230
+ CALLBACKS,
4231
+ INTERCEPTOR,
4232
+ MAP_TRANSITION,
4233
+ NONEXISTENT
4234
+ };
4235
+
4133
4236
  enum {
4134
4237
  NUMBER_OF_KINDS = LAST_IC_KIND + 1
4135
4238
  };
@@ -4140,9 +4243,8 @@ class Code: public HeapObject {
4140
4243
 
4141
4244
  #ifdef ENABLE_DISASSEMBLER
4142
4245
  // Printing
4143
- static const char* Kind2String(Kind kind);
4144
4246
  static const char* ICState2String(InlineCacheState state);
4145
- static const char* PropertyType2String(PropertyType type);
4247
+ static const char* StubType2String(StubType type);
4146
4248
  static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra);
4147
4249
  inline void Disassemble(const char* name) {
4148
4250
  Disassemble(name, stdout);
@@ -4164,9 +4266,18 @@ class Code: public HeapObject {
4164
4266
  // [deoptimization_data]: Array containing data for deopt.
4165
4267
  DECL_ACCESSORS(deoptimization_data, FixedArray)
4166
4268
 
4167
- // [type_feedback_info]: Struct containing type feedback information.
4168
- // Will contain either a TypeFeedbackInfo object, or undefined.
4269
+ // [type_feedback_info]: Struct containing type feedback information for
4270
+ // unoptimized code. Optimized code can temporarily store the head of
4271
+ // the list of the dependent optimized functions during deoptimization.
4272
+ // STUBs can use this slot to store arbitrary information as a Smi.
4273
+ // Will contain either a TypeFeedbackInfo object, or JSFunction object,
4274
+ // or undefined, or a Smi.
4169
4275
  DECL_ACCESSORS(type_feedback_info, Object)
4276
+ inline void InitializeTypeFeedbackInfoNoWriteBarrier(Object* value);
4277
+ inline int stub_info();
4278
+ inline void set_stub_info(int info);
4279
+ inline Object* deoptimizing_functions();
4280
+ inline void set_deoptimizing_functions(Object* value);
4170
4281
 
4171
4282
  // [gc_metadata]: Field used to hold GC related metadata. The contents of this
4172
4283
  // field does not have to be traced during garbage collection since
@@ -4178,6 +4289,11 @@ class Code: public HeapObject {
4178
4289
  inline void set_ic_age(int count);
4179
4290
  inline int ic_age();
4180
4291
 
4292
+ // [prologue_offset]: Offset of the function prologue, used for aging
4293
+ // FUNCTIONs and OPTIMIZED_FUNCTIONs.
4294
+ inline int prologue_offset();
4295
+ inline void set_prologue_offset(int offset);
4296
+
4181
4297
  // Unchecked accessors to be used during GC.
4182
4298
  inline ByteArray* unchecked_relocation_info();
4183
4299
  inline FixedArray* unchecked_deoptimization_data();
@@ -4192,11 +4308,12 @@ class Code: public HeapObject {
4192
4308
  inline Kind kind();
4193
4309
  inline InlineCacheState ic_state(); // Only valid for IC stubs.
4194
4310
  inline ExtraICState extra_ic_state(); // Only valid for IC stubs.
4195
- inline PropertyType type(); // Only valid for monomorphic IC stubs.
4311
+ inline StubType type(); // Only valid for monomorphic IC stubs.
4196
4312
  inline int arguments_count(); // Only valid for call IC stubs.
4197
4313
 
4198
4314
  // Testers for IC stub kinds.
4199
4315
  inline bool is_inline_cache_stub();
4316
+ inline bool is_debug_break();
4200
4317
  inline bool is_load_stub() { return kind() == LOAD_IC; }
4201
4318
  inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
4202
4319
  inline bool is_store_stub() { return kind() == STORE_IC; }
@@ -4272,21 +4389,6 @@ class Code: public HeapObject {
4272
4389
  inline byte unary_op_type();
4273
4390
  inline void set_unary_op_type(byte value);
4274
4391
 
4275
- // [type-recording binary op type]: For kind BINARY_OP_IC.
4276
- inline byte binary_op_type();
4277
- inline void set_binary_op_type(byte value);
4278
- inline byte binary_op_result_type();
4279
- inline void set_binary_op_result_type(byte value);
4280
-
4281
- // [compare state]: For kind COMPARE_IC, tells what state the stub is in.
4282
- inline byte compare_state();
4283
- inline void set_compare_state(byte value);
4284
-
4285
- // [compare_operation]: For kind COMPARE_IC tells what compare operation the
4286
- // stub was generated for.
4287
- inline byte compare_operation();
4288
- inline void set_compare_operation(byte value);
4289
-
4290
4392
  // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
4291
4393
  inline byte to_boolean_state();
4292
4394
  inline void set_to_boolean_state(byte value);
@@ -4296,6 +4398,14 @@ class Code: public HeapObject {
4296
4398
  inline bool has_function_cache();
4297
4399
  inline void set_has_function_cache(bool flag);
4298
4400
 
4401
+
4402
+ // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether
4403
+ // the code is going to be deoptimized because of dead embedded maps.
4404
+ inline bool marked_for_deoptimization();
4405
+ inline void set_marked_for_deoptimization(bool flag);
4406
+
4407
+ bool allowed_in_shared_map_code_cache();
4408
+
4299
4409
  // Get the safepoint entry for the given pc.
4300
4410
  SafepointEntry GetSafepointEntry(Address pc);
4301
4411
 
@@ -4333,19 +4443,19 @@ class Code: public HeapObject {
4333
4443
  Kind kind,
4334
4444
  InlineCacheState ic_state = UNINITIALIZED,
4335
4445
  ExtraICState extra_ic_state = kNoExtraICState,
4336
- PropertyType type = NORMAL,
4446
+ StubType type = NORMAL,
4337
4447
  int argc = -1,
4338
4448
  InlineCacheHolderFlag holder = OWN_MAP);
4339
4449
 
4340
4450
  static inline Flags ComputeMonomorphicFlags(
4341
4451
  Kind kind,
4342
- PropertyType type,
4452
+ StubType type,
4343
4453
  ExtraICState extra_ic_state = kNoExtraICState,
4344
4454
  InlineCacheHolderFlag holder = OWN_MAP,
4345
4455
  int argc = -1);
4346
4456
 
4347
4457
  static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
4348
- static inline PropertyType ExtractTypeFromFlags(Flags flags);
4458
+ static inline StubType ExtractTypeFromFlags(Flags flags);
4349
4459
  static inline Kind ExtractKindFromFlags(Flags flags);
4350
4460
  static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
4351
4461
  static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
@@ -4412,18 +4522,35 @@ class Code: public HeapObject {
4412
4522
 
4413
4523
  template<typename StaticVisitor>
4414
4524
  inline void CodeIterateBody(Heap* heap);
4415
- #ifdef OBJECT_PRINT
4416
- inline void CodePrint() {
4417
- CodePrint(stdout);
4418
- }
4419
- void CodePrint(FILE* out);
4420
- #endif
4421
- #ifdef DEBUG
4422
- void CodeVerify();
4423
- #endif
4525
+
4526
+ DECLARE_PRINTER(Code)
4527
+ DECLARE_VERIFIER(Code)
4528
+
4424
4529
  void ClearInlineCaches();
4425
4530
  void ClearTypeFeedbackCells(Heap* heap);
4426
4531
 
4532
+ #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
4533
+ enum Age {
4534
+ kNoAge = 0,
4535
+ CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM)
4536
+ kAfterLastCodeAge,
4537
+ kLastCodeAge = kAfterLastCodeAge - 1,
4538
+ kCodeAgeCount = kAfterLastCodeAge - 1
4539
+ };
4540
+ #undef DECLARE_CODE_AGE_ENUM
4541
+
4542
+ // Code aging
4543
+ static void MakeCodeAgeSequenceYoung(byte* sequence);
4544
+ void MakeOlder(MarkingParity);
4545
+ static bool IsYoungSequence(byte* sequence);
4546
+ bool IsOld();
4547
+
4548
+ void PrintDeoptLocation(int bailout_id);
4549
+
4550
+ #ifdef VERIFY_HEAP
4551
+ void VerifyEmbeddedMapsDependency();
4552
+ #endif
4553
+
4427
4554
  // Max loop nesting marker used to postpose OSR. We don't take loop
4428
4555
  // nesting that is deeper than 5 levels into account.
4429
4556
  static const int kMaxLoopNestingMarker = 6;
@@ -4440,28 +4567,22 @@ class Code: public HeapObject {
4440
4567
  static const int kICAgeOffset =
4441
4568
  kGCMetadataOffset + kPointerSize;
4442
4569
  static const int kFlagsOffset = kICAgeOffset + kIntSize;
4443
- static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize;
4444
- static const int kKindSpecificFlagsSize = 2 * kIntSize;
4570
+ static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize;
4571
+ static const int kKindSpecificFlags2Offset =
4572
+ kKindSpecificFlags1Offset + kIntSize;
4573
+ // Note: We might be able to squeeze this into the flags above.
4574
+ static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize;
4445
4575
 
4446
- static const int kHeaderPaddingStart = kKindSpecificFlagsOffset +
4447
- kKindSpecificFlagsSize;
4576
+ static const int kHeaderPaddingStart = kPrologueOffset + kIntSize;
4448
4577
 
4449
4578
  // Add padding to align the instruction start following right after
4450
4579
  // the Code object header.
4451
4580
  static const int kHeaderSize =
4452
4581
  (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask;
4453
4582
 
4454
- // Byte offsets within kKindSpecificFlagsOffset.
4455
- static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset;
4456
- static const int kOptimizableOffset = kKindSpecificFlagsOffset;
4457
- static const int kStackSlotsOffset = kKindSpecificFlagsOffset;
4458
- static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
4459
-
4460
- static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1;
4461
- static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
4462
- static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
4463
- static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1;
4464
- static const int kHasFunctionCacheOffset = kStubMajorKeyOffset + 1;
4583
+ // Byte offsets within kKindSpecificFlags1Offset.
4584
+ static const int kOptimizableOffset = kKindSpecificFlags1Offset;
4585
+ static const int kCheckTypeOffset = kKindSpecificFlags1Offset;
4465
4586
 
4466
4587
  static const int kFullCodeFlags = kOptimizableOffset + 1;
4467
4588
  class FullCodeFlagsHasDeoptimizationSupportField:
@@ -4469,26 +4590,73 @@ class Code: public HeapObject {
4469
4590
  class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
4470
4591
  class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
4471
4592
 
4472
- static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
4473
-
4474
- static const int kCompareOperationOffset = kCompareStateOffset + 1;
4475
-
4476
4593
  static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
4477
4594
  static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1;
4478
4595
 
4479
- static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
4480
- static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize;
4481
-
4482
4596
  // Flags layout. BitField<type, shift, size>.
4483
4597
  class ICStateField: public BitField<InlineCacheState, 0, 3> {};
4484
- class TypeField: public BitField<PropertyType, 3, 4> {};
4485
- class CacheHolderField: public BitField<InlineCacheHolderFlag, 7, 1> {};
4486
- class KindField: public BitField<Kind, 8, 4> {};
4487
- class ExtraICStateField: public BitField<ExtraICState, 12, 2> {};
4488
- class IsPregeneratedField: public BitField<bool, 14, 1> {};
4598
+ class TypeField: public BitField<StubType, 3, 3> {};
4599
+ class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {};
4600
+ class KindField: public BitField<Kind, 7, 4> {};
4601
+ class ExtraICStateField: public BitField<ExtraICState, 11, 2> {};
4602
+ class IsPregeneratedField: public BitField<bool, 13, 1> {};
4603
+
4604
+ // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION)
4605
+ static const int kStackSlotsFirstBit = 0;
4606
+ static const int kStackSlotsBitCount = 24;
4607
+ static const int kUnaryOpTypeFirstBit =
4608
+ kStackSlotsFirstBit + kStackSlotsBitCount;
4609
+ static const int kUnaryOpTypeBitCount = 3;
4610
+ static const int kToBooleanStateFirstBit =
4611
+ kStackSlotsFirstBit + kStackSlotsBitCount;
4612
+ static const int kToBooleanStateBitCount = 8;
4613
+ static const int kHasFunctionCacheFirstBit =
4614
+ kStackSlotsFirstBit + kStackSlotsBitCount;
4615
+ static const int kHasFunctionCacheBitCount = 1;
4616
+ static const int kMarkedForDeoptimizationFirstBit =
4617
+ kStackSlotsFirstBit + kStackSlotsBitCount + 1;
4618
+ static const int kMarkedForDeoptimizationBitCount = 1;
4619
+
4620
+ STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32);
4621
+ STATIC_ASSERT(kUnaryOpTypeFirstBit + kUnaryOpTypeBitCount <= 32);
4622
+ STATIC_ASSERT(kToBooleanStateFirstBit + kToBooleanStateBitCount <= 32);
4623
+ STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32);
4624
+ STATIC_ASSERT(kMarkedForDeoptimizationFirstBit +
4625
+ kMarkedForDeoptimizationBitCount <= 32);
4626
+
4627
+ class StackSlotsField: public BitField<int,
4628
+ kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT
4629
+ class UnaryOpTypeField: public BitField<int,
4630
+ kUnaryOpTypeFirstBit, kUnaryOpTypeBitCount> {}; // NOLINT
4631
+ class ToBooleanStateField: public BitField<int,
4632
+ kToBooleanStateFirstBit, kToBooleanStateBitCount> {}; // NOLINT
4633
+ class HasFunctionCacheField: public BitField<bool,
4634
+ kHasFunctionCacheFirstBit, kHasFunctionCacheBitCount> {}; // NOLINT
4635
+ class MarkedForDeoptimizationField: public BitField<bool,
4636
+ kMarkedForDeoptimizationFirstBit,
4637
+ kMarkedForDeoptimizationBitCount> {}; // NOLINT
4638
+
4639
+ // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
4640
+ static const int kStubMajorKeyFirstBit = 0;
4641
+ static const int kSafepointTableOffsetFirstBit =
4642
+ kStubMajorKeyFirstBit + kStubMajorKeyBits;
4643
+ static const int kSafepointTableOffsetBitCount = 26;
4644
+
4645
+ STATIC_ASSERT(kStubMajorKeyFirstBit + kStubMajorKeyBits <= 32);
4646
+ STATIC_ASSERT(kSafepointTableOffsetFirstBit +
4647
+ kSafepointTableOffsetBitCount <= 32);
4648
+
4649
+ class SafepointTableOffsetField: public BitField<int,
4650
+ kSafepointTableOffsetFirstBit,
4651
+ kSafepointTableOffsetBitCount> {}; // NOLINT
4652
+ class StubMajorKeyField: public BitField<int,
4653
+ kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT
4654
+
4655
+ // KindSpecificFlags2 layout (FUNCTION)
4656
+ class StackCheckTableOffsetField: public BitField<int, 0, 31> {};
4489
4657
 
4490
4658
  // Signed field cannot be encoded using the BitField class.
4491
- static const int kArgumentsCountShift = 15;
4659
+ static const int kArgumentsCountShift = 14;
4492
4660
  static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1);
4493
4661
 
4494
4662
  // This constant should be encodable in an ARM instruction.
@@ -4496,10 +4664,46 @@ class Code: public HeapObject {
4496
4664
  TypeField::kMask | CacheHolderField::kMask;
4497
4665
 
4498
4666
  private:
4667
+ friend class RelocIterator;
4668
+
4669
+ // Code aging
4670
+ byte* FindCodeAgeSequence();
4671
+ static void GetCodeAgeAndParity(Code* code, Age* age,
4672
+ MarkingParity* parity);
4673
+ static void GetCodeAgeAndParity(byte* sequence, Age* age,
4674
+ MarkingParity* parity);
4675
+ static Code* GetCodeAgeStub(Age age, MarkingParity parity);
4676
+
4677
+ // Code aging -- platform-specific
4678
+ static void PatchPlatformCodeAge(byte* sequence, Age age,
4679
+ MarkingParity parity);
4680
+
4499
4681
  DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
4500
4682
  };
4501
4683
 
4502
4684
 
4685
+ // This class describes the layout of dependent codes array of a map. The
4686
+ // first element contains the number of codes as a Smi. The subsequent
4687
+ // elements contain code objects. The suffix of the array can be filled with the
4688
+ // undefined value if the number of codes is less than the length of the array.
4689
+ class DependentCodes: public FixedArray {
4690
+ public:
4691
+ inline int number_of_codes();
4692
+ inline void set_number_of_codes(int value);
4693
+ inline Code* code_at(int i);
4694
+ inline void set_code_at(int i, Code* value);
4695
+ inline Object** code_slot_at(int i);
4696
+ inline void clear_code_at(int i);
4697
+ static Handle<DependentCodes> Append(Handle<DependentCodes> codes,
4698
+ Handle<Code> value);
4699
+ static inline DependentCodes* cast(Object* object);
4700
+ bool Contains(Code* code);
4701
+ private:
4702
+ static const int kNumberOfCodesIndex = 0;
4703
+ static const int kCodesIndex = 1;
4704
+ };
4705
+
4706
+
4503
4707
  // All heap objects have a Map that describes their structure.
4504
4708
  // A Map contains information about:
4505
4709
  // - Size information about the object
@@ -4538,12 +4742,17 @@ class Map: public HeapObject {
4538
4742
  inline void set_bit_field2(byte value);
4539
4743
 
4540
4744
  // Bit field 3.
4541
- // TODO(1399): It should be possible to make room for bit_field3 in the map
4542
- // without overloading the instance descriptors field (and storing it in the
4543
- // DescriptorArray when the map has one).
4544
4745
  inline int bit_field3();
4545
4746
  inline void set_bit_field3(int value);
4546
4747
 
4748
+ class EnumLengthBits: public BitField<int, 0, 11> {};
4749
+ class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {};
4750
+ class IsShared: public BitField<bool, 22, 1> {};
4751
+ class FunctionWithPrototype: public BitField<bool, 23, 1> {};
4752
+ class DictionaryMap: public BitField<bool, 24, 1> {};
4753
+ class OwnsDescriptors: public BitField<bool, 25, 1> {};
4754
+ class IsObserved: public BitField<bool, 26, 1> {};
4755
+
4547
4756
  // Tells whether the object in the prototype property will be used
4548
4757
  // for instances created from this function. If the prototype
4549
4758
  // property is set to a value that is not a JSObject, the prototype
@@ -4615,6 +4824,10 @@ class Map: public HeapObject {
4615
4824
  inline void set_elements_kind(ElementsKind elements_kind) {
4616
4825
  ASSERT(elements_kind < kElementsKindCount);
4617
4826
  ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount));
4827
+ ASSERT(!is_observed() ||
4828
+ elements_kind == DICTIONARY_ELEMENTS ||
4829
+ elements_kind == NON_STRICT_ARGUMENTS_ELEMENTS ||
4830
+ IsExternalArrayElementsKind(elements_kind));
4618
4831
  set_bit_field2((bit_field2() & ~kElementsKindMask) |
4619
4832
  (elements_kind << kElementsKindShift));
4620
4833
  ASSERT(this->elements_kind() == elements_kind);
@@ -4643,18 +4856,20 @@ class Map: public HeapObject {
4643
4856
  return IsFastDoubleElementsKind(elements_kind());
4644
4857
  }
4645
4858
 
4859
+ inline bool has_fast_elements() {
4860
+ return IsFastElementsKind(elements_kind());
4861
+ }
4862
+
4646
4863
  inline bool has_non_strict_arguments_elements() {
4647
4864
  return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
4648
4865
  }
4649
4866
 
4650
4867
  inline bool has_external_array_elements() {
4651
- ElementsKind kind(elements_kind());
4652
- return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
4653
- kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND;
4868
+ return IsExternalArrayElementsKind(elements_kind());
4654
4869
  }
4655
4870
 
4656
4871
  inline bool has_dictionary_elements() {
4657
- return elements_kind() == DICTIONARY_ELEMENTS;
4872
+ return IsDictionaryElementsKind(elements_kind());
4658
4873
  }
4659
4874
 
4660
4875
  inline bool has_slow_elements_kind() {
@@ -4665,6 +4880,20 @@ class Map: public HeapObject {
4665
4880
  static bool IsValidElementsTransition(ElementsKind from_kind,
4666
4881
  ElementsKind to_kind);
4667
4882
 
4883
+ inline bool HasTransitionArray();
4884
+ inline bool HasElementsTransition();
4885
+ inline Map* elements_transition_map();
4886
+ MUST_USE_RESULT inline MaybeObject* set_elements_transition_map(
4887
+ Map* transitioned_map);
4888
+ inline void SetTransition(int transition_index, Map* target);
4889
+ inline Map* GetTransition(int transition_index);
4890
+ MUST_USE_RESULT inline MaybeObject* AddTransition(String* key,
4891
+ Map* target,
4892
+ SimpleTransitionFlag flag);
4893
+ DECL_ACCESSORS(transitions, TransitionArray)
4894
+ inline void ClearTransitions(Heap* heap,
4895
+ WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
4896
+
4668
4897
  // Tells whether the map is attached to SharedFunctionInfo
4669
4898
  // (for inobject slack tracking).
4670
4899
  inline void set_attached_to_shared_function_info(bool value);
@@ -4675,9 +4904,15 @@ class Map: public HeapObject {
4675
4904
  // behavior. If true, the map should never be modified, instead a clone
4676
4905
  // should be created and modified.
4677
4906
  inline void set_is_shared(bool value);
4678
-
4679
4907
  inline bool is_shared();
4680
4908
 
4909
+ // Tells whether the map is used for JSObjects in dictionary mode (ie
4910
+ // normalized objects, ie objects for which HasFastProperties returns false).
4911
+ // A map can never be used for both dictionary mode and fast mode JSObjects.
4912
+ // False by default and for HeapObjects that are not JSObjects.
4913
+ inline void set_dictionary_map(bool value);
4914
+ inline bool is_dictionary_map();
4915
+
4681
4916
  // Tells whether the instance needs security checks when accessing its
4682
4917
  // properties.
4683
4918
  inline void set_is_access_check_needed(bool access_check_needed);
@@ -4691,20 +4926,16 @@ class Map: public HeapObject {
4691
4926
 
4692
4927
  inline JSFunction* unchecked_constructor();
4693
4928
 
4694
- // Should only be called by the code that initializes map to set initial valid
4695
- // value of the instance descriptor member.
4696
- inline void init_instance_descriptors();
4697
-
4698
4929
  // [instance descriptors]: describes the object.
4699
4930
  DECL_ACCESSORS(instance_descriptors, DescriptorArray)
4700
-
4701
- // Sets the instance descriptor array for the map to be an empty descriptor
4702
- // array.
4703
- inline void clear_instance_descriptors();
4931
+ inline void InitializeDescriptors(DescriptorArray* descriptors);
4704
4932
 
4705
4933
  // [stub cache]: contains stubs compiled for this map.
4706
4934
  DECL_ACCESSORS(code_cache, Object)
4707
4935
 
4936
+ // [dependent codes]: list of optimized codes that have this map embedded.
4937
+ DECL_ACCESSORS(dependent_codes, DependentCodes)
4938
+
4708
4939
  // [back pointer]: points back to the parent map from which a transition
4709
4940
  // leads to this map. The field overlaps with prototype transitions and the
4710
4941
  // back pointer will be moved into the prototype transitions array if
@@ -4712,6 +4943,7 @@ class Map: public HeapObject {
4712
4943
  inline Object* GetBackPointer();
4713
4944
  inline void SetBackPointer(Object* value,
4714
4945
  WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
4946
+ inline void init_back_pointer(Object* undefined);
4715
4947
 
4716
4948
  // [prototype transitions]: cache of prototype transitions.
4717
4949
  // Prototype transition is a transition that happens
@@ -4721,27 +4953,29 @@ class Map: public HeapObject {
4721
4953
  // 1: back pointer that overlaps with prototype transitions field.
4722
4954
  // 2 + 2 * i: prototype
4723
4955
  // 3 + 2 * i: target map
4724
- DECL_ACCESSORS(prototype_transitions, FixedArray)
4956
+ inline FixedArray* GetPrototypeTransitions();
4957
+ MUST_USE_RESULT inline MaybeObject* SetPrototypeTransitions(
4958
+ FixedArray* prototype_transitions);
4959
+ inline bool HasPrototypeTransitions();
4725
4960
 
4726
- inline void init_prototype_transitions(Object* undefined);
4727
- inline HeapObject* unchecked_prototype_transitions();
4961
+ inline HeapObject* UncheckedPrototypeTransitions();
4962
+ inline TransitionArray* unchecked_transition_array();
4728
4963
 
4729
- static const int kProtoTransitionHeaderSize = 2;
4964
+ static const int kProtoTransitionHeaderSize = 1;
4730
4965
  static const int kProtoTransitionNumberOfEntriesOffset = 0;
4731
- static const int kProtoTransitionBackPointerOffset = 1;
4732
4966
  static const int kProtoTransitionElementsPerEntry = 2;
4733
4967
  static const int kProtoTransitionPrototypeOffset = 0;
4734
4968
  static const int kProtoTransitionMapOffset = 1;
4735
4969
 
4736
4970
  inline int NumberOfProtoTransitions() {
4737
- FixedArray* cache = prototype_transitions();
4971
+ FixedArray* cache = GetPrototypeTransitions();
4738
4972
  if (cache->length() == 0) return 0;
4739
4973
  return
4740
4974
  Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value();
4741
4975
  }
4742
4976
 
4743
4977
  inline void SetNumberOfProtoTransitions(int value) {
4744
- FixedArray* cache = prototype_transitions();
4978
+ FixedArray* cache = GetPrototypeTransitions();
4745
4979
  ASSERT(cache->length() != 0);
4746
4980
  cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset,
4747
4981
  Smi::FromInt(value));
@@ -4750,18 +4984,86 @@ class Map: public HeapObject {
4750
4984
  // Lookup in the map's instance descriptors and fill out the result
4751
4985
  // with the given holder if the name is found. The holder may be
4752
4986
  // NULL when this function is used from the compiler.
4753
- void LookupInDescriptors(JSObject* holder,
4754
- String* name,
4755
- LookupResult* result);
4987
+ inline void LookupDescriptor(JSObject* holder,
4988
+ String* name,
4989
+ LookupResult* result);
4990
+
4991
+ inline void LookupTransition(JSObject* holder,
4992
+ String* name,
4993
+ LookupResult* result);
4994
+
4995
+ // The size of transition arrays are limited so they do not end up in large
4996
+ // object space. Otherwise ClearNonLiveTransitions would leak memory while
4997
+ // applying in-place right trimming.
4998
+ inline bool CanHaveMoreTransitions();
4999
+
5000
+ int LastAdded() {
5001
+ int number_of_own_descriptors = NumberOfOwnDescriptors();
5002
+ ASSERT(number_of_own_descriptors > 0);
5003
+ return number_of_own_descriptors - 1;
5004
+ }
5005
+
5006
+ int NumberOfOwnDescriptors() {
5007
+ return NumberOfOwnDescriptorsBits::decode(bit_field3());
5008
+ }
4756
5009
 
5010
+ void SetNumberOfOwnDescriptors(int number) {
5011
+ ASSERT(number <= instance_descriptors()->number_of_descriptors());
5012
+ set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
5013
+ }
5014
+
5015
+ inline JSGlobalPropertyCell* RetrieveDescriptorsPointer();
5016
+
5017
+ int EnumLength() {
5018
+ return EnumLengthBits::decode(bit_field3());
5019
+ }
5020
+
5021
+ void SetEnumLength(int length) {
5022
+ if (length != kInvalidEnumCache) {
5023
+ ASSERT(length >= 0);
5024
+ ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
5025
+ ASSERT(length <= NumberOfOwnDescriptors());
5026
+ }
5027
+ set_bit_field3(EnumLengthBits::update(bit_field3(), length));
5028
+ }
5029
+
5030
+ inline bool CanTrackAllocationSite();
5031
+ inline bool owns_descriptors();
5032
+ inline void set_owns_descriptors(bool is_shared);
5033
+ inline bool is_observed();
5034
+ inline void set_is_observed(bool is_observed);
5035
+
5036
+ MUST_USE_RESULT MaybeObject* RawCopy(int instance_size);
5037
+ MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors();
4757
5038
  MUST_USE_RESULT MaybeObject* CopyDropDescriptors();
5039
+ MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors(
5040
+ DescriptorArray* descriptors,
5041
+ String* name,
5042
+ TransitionFlag flag,
5043
+ int descriptor_index);
5044
+ MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors,
5045
+ Descriptor* descriptor);
5046
+ MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor,
5047
+ TransitionFlag flag);
5048
+ MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor,
5049
+ TransitionFlag flag);
5050
+ MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor(
5051
+ DescriptorArray* descriptors,
5052
+ Descriptor* descriptor,
5053
+ int index,
5054
+ TransitionFlag flag);
5055
+ MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind,
5056
+ TransitionFlag flag);
4758
5057
 
4759
5058
  MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode,
4760
5059
  NormalizedMapSharingMode sharing);
4761
5060
 
5061
+ inline void AppendDescriptor(Descriptor* desc,
5062
+ const DescriptorArray::WhitenessWitness&);
5063
+
4762
5064
  // Returns a copy of the map, with all transitions dropped from the
4763
5065
  // instance descriptors.
4764
- MUST_USE_RESULT MaybeObject* CopyDropTransitions();
5066
+ MUST_USE_RESULT MaybeObject* Copy();
4765
5067
 
4766
5068
  // Returns the property index for name (only valid for FAST MODE).
4767
5069
  int PropertyIndexFor(String* name);
@@ -4771,7 +5073,8 @@ class Map: public HeapObject {
4771
5073
 
4772
5074
  // Returns the number of properties described in instance_descriptors
4773
5075
  // filtering out properties with the specified attributes.
4774
- int NumberOfDescribedProperties(PropertyAttributes filter = NONE);
5076
+ int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS,
5077
+ PropertyAttributes filter = NONE);
4775
5078
 
4776
5079
  // Casting.
4777
5080
  static inline Map* cast(Object* obj);
@@ -4790,6 +5093,13 @@ class Map: public HeapObject {
4790
5093
  Handle<Code> code);
4791
5094
  MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code);
4792
5095
 
5096
+ // Extend the descriptor array of the map with the list of descriptors.
5097
+ // In case of duplicates, the latest descriptor is used.
5098
+ static void AppendCallbackDescriptors(Handle<Map> map,
5099
+ Handle<Object> descriptors);
5100
+
5101
+ static void EnsureDescriptorSlack(Handle<Map> map, int slack);
5102
+
4793
5103
  // Returns the found code or undefined if absent.
4794
5104
  Object* FindInCodeCache(String* name, Code::Flags flags);
4795
5105
 
@@ -4814,23 +5124,11 @@ class Map: public HeapObject {
4814
5124
  // The "shared" flags of both this map and |other| are ignored.
4815
5125
  bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode);
4816
5126
 
4817
- // Returns the contents of this map's descriptor array for the given string.
4818
- // May return NULL. |safe_to_add_transition| is set to false and NULL
4819
- // is returned if adding transitions is not allowed.
4820
- Object* GetDescriptorContents(String* sentinel_name,
4821
- bool* safe_to_add_transitions);
4822
-
4823
5127
  // Returns the map that this map transitions to if its elements_kind
4824
5128
  // is changed to |elements_kind|, or NULL if no such map is cached yet.
4825
5129
  // |safe_to_add_transitions| is set to false if adding transitions is not
4826
5130
  // allowed.
4827
- Map* LookupElementsTransitionMap(ElementsKind elements_kind,
4828
- bool* safe_to_add_transition);
4829
-
4830
- // Adds an entry to this map's descriptor array for a transition to
4831
- // |transitioned_map| when its elements_kind is changed to |elements_kind|.
4832
- MUST_USE_RESULT MaybeObject* AddElementsTransition(
4833
- ElementsKind elements_kind, Map* transitioned_map);
5131
+ Map* LookupElementsTransitionMap(ElementsKind elements_kind);
4834
5132
 
4835
5133
  // Returns the transitioned map for this map with the most generic
4836
5134
  // elements_kind that's found in |candidates|, or null handle if no match is
@@ -4838,24 +5136,28 @@ class Map: public HeapObject {
4838
5136
  Handle<Map> FindTransitionedMap(MapHandleList* candidates);
4839
5137
  Map* FindTransitionedMap(MapList* candidates);
4840
5138
 
4841
- // Zaps the contents of backing data structures in debug mode. Note that the
5139
+ // Zaps the contents of backing data structures. Note that the
4842
5140
  // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
4843
5141
  // holding weak references when incremental marking is used, because it also
4844
5142
  // iterates over objects that are otherwise unreachable.
4845
- #ifdef DEBUG
4846
- void ZapInstanceDescriptors();
5143
+ // In general we only want to call these functions in release mode when
5144
+ // heap verification is turned on.
4847
5145
  void ZapPrototypeTransitions();
4848
- #endif
5146
+ void ZapTransitions();
4849
5147
 
4850
- // Dispatched behavior.
4851
- #ifdef OBJECT_PRINT
4852
- inline void MapPrint() {
4853
- MapPrint(stdout);
5148
+ bool CanTransition() {
5149
+ // Only JSObject and subtypes have map transitions and back pointers.
5150
+ STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE);
5151
+ return instance_type() >= FIRST_JS_OBJECT_TYPE;
4854
5152
  }
4855
- void MapPrint(FILE* out);
4856
- #endif
4857
- #ifdef DEBUG
4858
- void MapVerify();
5153
+
5154
+ inline void AddDependentCode(Handle<Code> code);
5155
+
5156
+ // Dispatched behavior.
5157
+ DECLARE_PRINTER(Map)
5158
+ DECLARE_VERIFIER(Map)
5159
+
5160
+ #ifdef VERIFY_HEAP
4859
5161
  void SharedMapVerify();
4860
5162
  #endif
4861
5163
 
@@ -4866,44 +5168,47 @@ class Map: public HeapObject {
4866
5168
 
4867
5169
  void TraverseTransitionTree(TraverseCallback callback, void* data);
4868
5170
 
5171
+ // When you set the prototype of an object using the __proto__ accessor you
5172
+ // need a new map for the object (the prototype is stored in the map). In
5173
+ // order not to multiply maps unnecessarily we store these as transitions in
5174
+ // the original map. That way we can transition to the same map if the same
5175
+ // prototype is set, rather than creating a new map every time. The
5176
+ // transitions are in the form of a map where the keys are prototype objects
5177
+ // and the values are the maps the are transitioned to.
4869
5178
  static const int kMaxCachedPrototypeTransitions = 256;
4870
5179
 
4871
- Object* GetPrototypeTransition(Object* prototype);
5180
+ Map* GetPrototypeTransition(Object* prototype);
4872
5181
 
4873
5182
  MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype,
4874
5183
  Map* map);
4875
5184
 
4876
5185
  static const int kMaxPreAllocatedPropertyFields = 255;
4877
5186
 
5187
+ // Constant for denoting that the enum cache is not yet initialized.
5188
+ static const int kInvalidEnumCache = EnumLengthBits::kMax;
5189
+
4878
5190
  // Layout description.
4879
5191
  static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
4880
5192
  static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
4881
5193
  static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
4882
5194
  static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
4883
- // Storage for instance descriptors is overloaded to also contain additional
4884
- // map flags when unused (bit_field3). When the map has instance descriptors,
4885
- // the flags are transferred to the instance descriptor array and accessed
4886
- // through an extra indirection.
4887
- // TODO(1399): It should be possible to make room for bit_field3 in the map
4888
- // without overloading the instance descriptors field, but the map is
4889
- // currently perfectly aligned to 32 bytes and extending it at all would
4890
- // double its size. After the increment GC work lands, this size restriction
4891
- // could be loosened and bit_field3 moved directly back in the map.
4892
- static const int kInstanceDescriptorsOrBitField3Offset =
5195
+ // Storage for the transition array is overloaded to directly contain a back
5196
+ // pointer if unused. When the map has transitions, the back pointer is
5197
+ // transferred to the transition array and accessed through an extra
5198
+ // indirection.
5199
+ static const int kTransitionsOrBackPointerOffset =
4893
5200
  kConstructorOffset + kPointerSize;
4894
- static const int kCodeCacheOffset =
4895
- kInstanceDescriptorsOrBitField3Offset + kPointerSize;
4896
- static const int kPrototypeTransitionsOrBackPointerOffset =
4897
- kCodeCacheOffset + kPointerSize;
4898
- static const int kPadStart =
4899
- kPrototypeTransitionsOrBackPointerOffset + kPointerSize;
4900
- static const int kSize = MAP_POINTER_ALIGN(kPadStart);
5201
+ static const int kDescriptorsOffset =
5202
+ kTransitionsOrBackPointerOffset + kPointerSize;
5203
+ static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
5204
+ static const int kDependentCodesOffset = kCodeCacheOffset + kPointerSize;
5205
+ static const int kBitField3Offset = kDependentCodesOffset + kPointerSize;
5206
+ static const int kSize = kBitField3Offset + kPointerSize;
4901
5207
 
4902
5208
  // Layout of pointer fields. Heap iteration code relies on them
4903
5209
  // being continuously allocated.
4904
5210
  static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
4905
- static const int kPointerFieldsEndOffset =
4906
- kPrototypeTransitionsOrBackPointerOffset + kPointerSize;
5211
+ static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize;
4907
5212
 
4908
5213
  // Byte offsets within kInstanceSizesOffset.
4909
5214
  static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
@@ -4958,21 +5263,11 @@ class Map: public HeapObject {
4958
5263
  static_cast<int8_t>((FAST_HOLEY_SMI_ELEMENTS + 1) <<
4959
5264
  Map::kElementsKindShift) - 1;
4960
5265
 
4961
- // Bit positions for bit field 3
4962
- static const int kIsShared = 0;
4963
- static const int kFunctionWithPrototype = 1;
4964
-
4965
- // Layout of the default cache. It holds alternating name and code objects.
4966
- static const int kCodeCacheEntrySize = 2;
4967
- static const int kCodeCacheEntryNameOffset = 0;
4968
- static const int kCodeCacheEntryCodeOffset = 1;
4969
-
4970
5266
  typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
4971
5267
  kPointerFieldsEndOffset,
4972
5268
  kSize> BodyDescriptor;
4973
5269
 
4974
5270
  private:
4975
- String* elements_transition_sentinel_name();
4976
5271
  DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
4977
5272
  };
4978
5273
 
@@ -5060,15 +5355,9 @@ class Script: public Struct {
5060
5355
  // resource is accessible. Otherwise, always return true.
5061
5356
  inline bool HasValidSource();
5062
5357
 
5063
- #ifdef OBJECT_PRINT
5064
- inline void ScriptPrint() {
5065
- ScriptPrint(stdout);
5066
- }
5067
- void ScriptPrint(FILE* out);
5068
- #endif
5069
- #ifdef DEBUG
5070
- void ScriptVerify();
5071
- #endif
5358
+ // Dispatched behavior.
5359
+ DECLARE_PRINTER(Script)
5360
+ DECLARE_VERIFIER(Script)
5072
5361
 
5073
5362
  static const int kSourceOffset = HeapObject::kHeaderSize;
5074
5363
  static const int kNameOffset = kSourceOffset + kPointerSize;
@@ -5152,6 +5441,30 @@ class SharedFunctionInfo: public HeapObject {
5152
5441
 
5153
5442
  // [code]: Function code.
5154
5443
  DECL_ACCESSORS(code, Code)
5444
+ inline void ReplaceCode(Code* code);
5445
+
5446
+ // [optimized_code_map]: Map from native context to optimized code
5447
+ // and a shared literals array or Smi 0 if none.
5448
+ DECL_ACCESSORS(optimized_code_map, Object)
5449
+
5450
+ // Returns index i of the entry with the specified context. At position
5451
+ // i - 1 is the context, position i the code, and i + 1 the literals array.
5452
+ // Returns -1 when no matching entry is found.
5453
+ int SearchOptimizedCodeMap(Context* native_context);
5454
+
5455
+ // Installs optimized code from the code map on the given closure. The
5456
+ // index has to be consistent with a search result as defined above.
5457
+ void InstallFromOptimizedCodeMap(JSFunction* function, int index);
5458
+
5459
+ // Clear optimized code map.
5460
+ inline void ClearOptimizedCodeMap();
5461
+
5462
+ // Add a new entry to the optimized code map.
5463
+ static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
5464
+ Handle<Context> native_context,
5465
+ Handle<Code> code,
5466
+ Handle<FixedArray> literals);
5467
+ static const int kEntryLength = 3;
5155
5468
 
5156
5469
  // [scope_info]: Scope info.
5157
5470
  DECL_ACCESSORS(scope_info, ScopeInfo)
@@ -5260,6 +5573,10 @@ class SharedFunctionInfo: public HeapObject {
5260
5573
  // IsInobjectSlackTrackingInProgress is false after this call.
5261
5574
  void CompleteInobjectSlackTracking();
5262
5575
 
5576
+ // Invoked before pointers in SharedFunctionInfo are being marked.
5577
+ // Also clears the optimized code map.
5578
+ inline void BeforeVisitingPointers();
5579
+
5263
5580
  // Clears the initial_map before the GC marking phase to ensure the reference
5264
5581
  // is weak. IsInobjectSlackTrackingInProgress is false after this call.
5265
5582
  void DetachInitialMap();
@@ -5345,8 +5662,8 @@ class SharedFunctionInfo: public HeapObject {
5345
5662
 
5346
5663
  // A counter used to determine when to stress the deoptimizer with a
5347
5664
  // deopt.
5348
- inline int deopt_counter();
5349
- inline void set_deopt_counter(int counter);
5665
+ inline int stress_deopt_counter();
5666
+ inline void set_stress_deopt_counter(int counter);
5350
5667
 
5351
5668
  inline int profiler_ticks();
5352
5669
 
@@ -5372,6 +5689,12 @@ class SharedFunctionInfo: public HeapObject {
5372
5689
  // when doing GC if we expect that the function will no longer be used.
5373
5690
  DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation)
5374
5691
 
5692
+ // Indicates if this function can be lazy compiled without a context.
5693
+ // This is used to determine if we can force compilation without reaching
5694
+ // the function through program execution but through other means (e.g. heap
5695
+ // iteration by the debugger).
5696
+ DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context)
5697
+
5375
5698
  // Indicates how many full GCs this function has survived with assigned
5376
5699
  // code object. Used to determine when it is relatively safe to flush
5377
5700
  // this code object and replace it with lazy compilation stub.
@@ -5436,6 +5759,9 @@ class SharedFunctionInfo: public HeapObject {
5436
5759
  // Indicates that the function cannot be inlined.
5437
5760
  DECL_BOOLEAN_ACCESSORS(dont_inline)
5438
5761
 
5762
+ // Indicates that code for this function cannot be cached.
5763
+ DECL_BOOLEAN_ACCESSORS(dont_cache)
5764
+
5439
5765
  // Indicates whether or not the code in the shared function support
5440
5766
  // deoptimization.
5441
5767
  inline bool has_deoptimization_support();
@@ -5445,12 +5771,12 @@ class SharedFunctionInfo: public HeapObject {
5445
5771
 
5446
5772
  // Disable (further) attempted optimization of all functions sharing this
5447
5773
  // shared function info.
5448
- void DisableOptimization();
5774
+ void DisableOptimization(const char* reason);
5449
5775
 
5450
5776
  // Lookup the bailout ID and ASSERT that it exists in the non-optimized
5451
5777
  // code, returns whether it asserted (i.e., always true if assertions are
5452
5778
  // disabled).
5453
- bool VerifyBailoutId(int id);
5779
+ bool VerifyBailoutId(BailoutId id);
5454
5780
 
5455
5781
  // Check whether a inlined constructor can be generated with the given
5456
5782
  // prototype.
@@ -5474,9 +5800,26 @@ class SharedFunctionInfo: public HeapObject {
5474
5800
  bool HasSourceCode();
5475
5801
  Handle<Object> GetSourceCode();
5476
5802
 
5803
+ // Number of times the function was optimized.
5477
5804
  inline int opt_count();
5478
5805
  inline void set_opt_count(int opt_count);
5479
5806
 
5807
+ // Number of times the function was deoptimized.
5808
+ inline void set_deopt_count(int value);
5809
+ inline int deopt_count();
5810
+ inline void increment_deopt_count();
5811
+
5812
+ // Number of time we tried to re-enable optimization after it
5813
+ // was disabled due to high number of deoptimizations.
5814
+ inline void set_opt_reenable_tries(int value);
5815
+ inline int opt_reenable_tries();
5816
+
5817
+ inline void TryReenableOptimization();
5818
+
5819
+ // Stores deopt_count, opt_reenable_tries and ic_age as bit-fields.
5820
+ inline void set_counters(int value);
5821
+ inline int counters();
5822
+
5480
5823
  // Source size of this function.
5481
5824
  int SourceSize();
5482
5825
 
@@ -5489,27 +5832,17 @@ class SharedFunctionInfo: public HeapObject {
5489
5832
  // Dispatched behavior.
5490
5833
  // Set max_length to -1 for unlimited length.
5491
5834
  void SourceCodePrint(StringStream* accumulator, int max_length);
5492
- #ifdef OBJECT_PRINT
5493
- inline void SharedFunctionInfoPrint() {
5494
- SharedFunctionInfoPrint(stdout);
5495
- }
5496
- void SharedFunctionInfoPrint(FILE* out);
5497
- #endif
5498
- #ifdef DEBUG
5499
- void SharedFunctionInfoVerify();
5500
- #endif
5835
+ DECLARE_PRINTER(SharedFunctionInfo)
5836
+ DECLARE_VERIFIER(SharedFunctionInfo)
5501
5837
 
5502
5838
  void ResetForNewContext(int new_ic_age);
5503
5839
 
5504
- // Helpers to compile the shared code. Returns true on success, false on
5505
- // failure (e.g., stack overflow during compilation).
5506
- static bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
5507
- ClearExceptionFlag flag);
5840
+ // Helper to compile the shared code. Returns true on success, false on
5841
+ // failure (e.g., stack overflow during compilation). This is only used by
5842
+ // the debugger, it is not possible to compile without a context otherwise.
5508
5843
  static bool CompileLazy(Handle<SharedFunctionInfo> shared,
5509
5844
  ClearExceptionFlag flag);
5510
5845
 
5511
- void SharedFunctionInfoIterateBody(ObjectVisitor* v);
5512
-
5513
5846
  // Casting.
5514
5847
  static inline SharedFunctionInfo* cast(Object* obj);
5515
5848
 
@@ -5520,7 +5853,8 @@ class SharedFunctionInfo: public HeapObject {
5520
5853
  // Pointer fields.
5521
5854
  static const int kNameOffset = HeapObject::kHeaderSize;
5522
5855
  static const int kCodeOffset = kNameOffset + kPointerSize;
5523
- static const int kScopeInfoOffset = kCodeOffset + kPointerSize;
5856
+ static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize;
5857
+ static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize;
5524
5858
  static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize;
5525
5859
  static const int kInstanceClassNameOffset =
5526
5860
  kConstructStubOffset + kPointerSize;
@@ -5533,13 +5867,14 @@ class SharedFunctionInfo: public HeapObject {
5533
5867
  kInferredNameOffset + kPointerSize;
5534
5868
  static const int kThisPropertyAssignmentsOffset =
5535
5869
  kInitialMapOffset + kPointerSize;
5536
- // ic_age is a Smi field. It could be grouped with another Smi field into a
5537
- // PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available.
5538
- static const int kICAgeOffset = kThisPropertyAssignmentsOffset + kPointerSize;
5870
+ // ast_node_count is a Smi field. It could be grouped with another Smi field
5871
+ // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available.
5872
+ static const int kAstNodeCountOffset =
5873
+ kThisPropertyAssignmentsOffset + kPointerSize;
5539
5874
  #if V8_HOST_ARCH_32_BIT
5540
5875
  // Smi fields.
5541
5876
  static const int kLengthOffset =
5542
- kICAgeOffset + kPointerSize;
5877
+ kAstNodeCountOffset + kPointerSize;
5543
5878
  static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize;
5544
5879
  static const int kExpectedNofPropertiesOffset =
5545
5880
  kFormalParameterCountOffset + kPointerSize;
@@ -5557,12 +5892,11 @@ class SharedFunctionInfo: public HeapObject {
5557
5892
  kCompilerHintsOffset + kPointerSize;
5558
5893
  static const int kOptCountOffset =
5559
5894
  kThisPropertyAssignmentsCountOffset + kPointerSize;
5560
- static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize;
5561
- static const int kDeoptCounterOffset = kAstNodeCountOffset + kPointerSize;
5562
-
5895
+ static const int kCountersOffset = kOptCountOffset + kPointerSize;
5896
+ static const int kStressDeoptCounterOffset = kCountersOffset + kPointerSize;
5563
5897
 
5564
5898
  // Total size.
5565
- static const int kSize = kDeoptCounterOffset + kPointerSize;
5899
+ static const int kSize = kStressDeoptCounterOffset + kPointerSize;
5566
5900
  #else
5567
5901
  // The only reason to use smi fields instead of int fields
5568
5902
  // is to allow iteration without maps decoding during
@@ -5574,7 +5908,7 @@ class SharedFunctionInfo: public HeapObject {
5574
5908
  // word is not set and thus this word cannot be treated as pointer
5575
5909
  // to HeapObject during old space traversal.
5576
5910
  static const int kLengthOffset =
5577
- kICAgeOffset + kPointerSize;
5911
+ kAstNodeCountOffset + kPointerSize;
5578
5912
  static const int kFormalParameterCountOffset =
5579
5913
  kLengthOffset + kIntSize;
5580
5914
 
@@ -5598,11 +5932,11 @@ class SharedFunctionInfo: public HeapObject {
5598
5932
  static const int kOptCountOffset =
5599
5933
  kThisPropertyAssignmentsCountOffset + kIntSize;
5600
5934
 
5601
- static const int kAstNodeCountOffset = kOptCountOffset + kIntSize;
5602
- static const int kDeoptCounterOffset = kAstNodeCountOffset + kIntSize;
5935
+ static const int kCountersOffset = kOptCountOffset + kIntSize;
5936
+ static const int kStressDeoptCounterOffset = kCountersOffset + kIntSize;
5603
5937
 
5604
5938
  // Total size.
5605
- static const int kSize = kDeoptCounterOffset + kIntSize;
5939
+ static const int kSize = kStressDeoptCounterOffset + kIntSize;
5606
5940
 
5607
5941
  #endif
5608
5942
 
@@ -5638,6 +5972,7 @@ class SharedFunctionInfo: public HeapObject {
5638
5972
  enum CompilerHints {
5639
5973
  kHasOnlySimpleThisPropertyAssignments,
5640
5974
  kAllowLazyCompilation,
5975
+ kAllowLazyCompilationWithoutContext,
5641
5976
  kLiveObjectsMayExist,
5642
5977
  kCodeAgeShift,
5643
5978
  kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
@@ -5652,9 +5987,14 @@ class SharedFunctionInfo: public HeapObject {
5652
5987
  kIsFunction,
5653
5988
  kDontOptimize,
5654
5989
  kDontInline,
5990
+ kDontCache,
5655
5991
  kCompilerHintsCount // Pseudo entry
5656
5992
  };
5657
5993
 
5994
+ class DeoptCountBits: public BitField<int, 0, 4> {};
5995
+ class OptReenableTriesBits: public BitField<int, 4, 18> {};
5996
+ class ICAgeBits: public BitField<int, 22, 8> {};
5997
+
5658
5998
  private:
5659
5999
  #if V8_HOST_ARCH_32_BIT
5660
6000
  // On 32 bit platforms, compiler hints is a smi.
@@ -5714,23 +6054,20 @@ class JSModule: public JSObject {
5714
6054
  // [context]: the context holding the module's locals, or undefined if none.
5715
6055
  DECL_ACCESSORS(context, Object)
5716
6056
 
6057
+ // [scope_info]: Scope info.
6058
+ DECL_ACCESSORS(scope_info, ScopeInfo)
6059
+
5717
6060
  // Casting.
5718
6061
  static inline JSModule* cast(Object* obj);
5719
6062
 
5720
6063
  // Dispatched behavior.
5721
- #ifdef OBJECT_PRINT
5722
- inline void JSModulePrint() {
5723
- JSModulePrint(stdout);
5724
- }
5725
- void JSModulePrint(FILE* out);
5726
- #endif
5727
- #ifdef DEBUG
5728
- void JSModuleVerify();
5729
- #endif
6064
+ DECLARE_PRINTER(JSModule)
6065
+ DECLARE_VERIFIER(JSModule)
5730
6066
 
5731
6067
  // Layout description.
5732
6068
  static const int kContextOffset = JSObject::kHeaderSize;
5733
- static const int kSize = kContextOffset + kPointerSize;
6069
+ static const int kScopeInfoOffset = kContextOffset + kPointerSize;
6070
+ static const int kSize = kScopeInfoOffset + kPointerSize;
5734
6071
 
5735
6072
  private:
5736
6073
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule);
@@ -5779,18 +6116,26 @@ class JSFunction: public JSObject {
5779
6116
  // Mark this function for lazy recompilation. The function will be
5780
6117
  // recompiled the next time it is executed.
5781
6118
  void MarkForLazyRecompilation();
6119
+ void MarkForParallelRecompilation();
5782
6120
 
5783
6121
  // Helpers to compile this function. Returns true on success, false on
5784
6122
  // failure (e.g., stack overflow during compilation).
6123
+ static bool EnsureCompiled(Handle<JSFunction> function,
6124
+ ClearExceptionFlag flag);
5785
6125
  static bool CompileLazy(Handle<JSFunction> function,
5786
6126
  ClearExceptionFlag flag);
5787
6127
  static bool CompileOptimized(Handle<JSFunction> function,
5788
- int osr_ast_id,
6128
+ BailoutId osr_ast_id,
5789
6129
  ClearExceptionFlag flag);
5790
6130
 
5791
6131
  // Tells whether or not the function is already marked for lazy
5792
6132
  // recompilation.
5793
6133
  inline bool IsMarkedForLazyRecompilation();
6134
+ inline bool IsMarkedForParallelRecompilation();
6135
+
6136
+ // Tells whether or not the function is on the parallel
6137
+ // recompilation queue.
6138
+ inline bool IsInRecompileQueue();
5794
6139
 
5795
6140
  // Check whether or not this function is inlineable.
5796
6141
  bool IsInlineable();
@@ -5820,8 +6165,6 @@ class JSFunction: public JSObject {
5820
6165
  // The initial map for an object created by this constructor.
5821
6166
  inline Map* initial_map();
5822
6167
  inline void set_initial_map(Map* value);
5823
- MUST_USE_RESULT inline MaybeObject* set_initial_map_and_cache_transitions(
5824
- Map* value);
5825
6168
  inline bool has_initial_map();
5826
6169
 
5827
6170
  // Get and set the prototype property on a JSFunction. If the
@@ -5837,7 +6180,7 @@ class JSFunction: public JSObject {
5837
6180
 
5838
6181
  // After prototype is removed, it will not be created when accessed, and
5839
6182
  // [[Construct]] from this function will not be allowed.
5840
- Object* RemovePrototype();
6183
+ void RemovePrototype();
5841
6184
  inline bool should_have_prototype();
5842
6185
 
5843
6186
  // Accessor for this function's initial map's [[class]]
@@ -5849,7 +6192,7 @@ class JSFunction: public JSObject {
5849
6192
  // Instances created afterwards will have a map whose [[class]] is
5850
6193
  // set to 'value', but there is no guarantees on instances created
5851
6194
  // before.
5852
- Object* SetInstanceClassName(String* name);
6195
+ void SetInstanceClassName(String* name);
5853
6196
 
5854
6197
  // Returns if this function has been compiled to native code yet.
5855
6198
  inline bool is_compiled();
@@ -5872,21 +6215,26 @@ class JSFunction: public JSObject {
5872
6215
  void JSFunctionIterateBody(int object_size, ObjectVisitor* v);
5873
6216
 
5874
6217
  // Dispatched behavior.
5875
- #ifdef OBJECT_PRINT
5876
- inline void JSFunctionPrint() {
5877
- JSFunctionPrint(stdout);
5878
- }
5879
- void JSFunctionPrint(FILE* out);
5880
- #endif
5881
- #ifdef DEBUG
5882
- void JSFunctionVerify();
5883
- #endif
6218
+ DECLARE_PRINTER(JSFunction)
6219
+ DECLARE_VERIFIER(JSFunction)
5884
6220
 
5885
6221
  // Returns the number of allocated literals.
5886
6222
  inline int NumberOfLiterals();
5887
6223
 
5888
- // Retrieve the global context from a function's literal array.
5889
- static Context* GlobalContextFromLiterals(FixedArray* literals);
6224
+ // Retrieve the native context from a function's literal array.
6225
+ static Context* NativeContextFromLiterals(FixedArray* literals);
6226
+
6227
+ #ifdef DEBUG
6228
+ bool FunctionsInFunctionListShareSameCode() {
6229
+ Object* current = this;
6230
+ while (!current->IsUndefined()) {
6231
+ JSFunction* function = JSFunction::cast(current);
6232
+ current = function->next_function_link();
6233
+ if (function->code() != this->code()) return false;
6234
+ }
6235
+ return true;
6236
+ }
6237
+ #endif
5890
6238
 
5891
6239
  // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to
5892
6240
  // kSize) is weak and has special handling during garbage collection.
@@ -5903,7 +6251,7 @@ class JSFunction: public JSObject {
5903
6251
 
5904
6252
  // Layout of the literals array.
5905
6253
  static const int kLiteralsPrefixSize = 1;
5906
- static const int kLiteralGlobalContextIndex = 0;
6254
+ static const int kLiteralNativeContextIndex = 0;
5907
6255
 
5908
6256
  // Layout of the bound-function binding array.
5909
6257
  static const int kBoundFunctionIndex = 0;
@@ -5925,27 +6273,20 @@ class JSFunction: public JSObject {
5925
6273
 
5926
6274
  class JSGlobalProxy : public JSObject {
5927
6275
  public:
5928
- // [context]: the owner global context of this global proxy object.
6276
+ // [native_context]: the owner native context of this global proxy object.
5929
6277
  // It is null value if this object is not used by any context.
5930
- DECL_ACCESSORS(context, Object)
6278
+ DECL_ACCESSORS(native_context, Object)
5931
6279
 
5932
6280
  // Casting.
5933
6281
  static inline JSGlobalProxy* cast(Object* obj);
5934
6282
 
5935
6283
  // Dispatched behavior.
5936
- #ifdef OBJECT_PRINT
5937
- inline void JSGlobalProxyPrint() {
5938
- JSGlobalProxyPrint(stdout);
5939
- }
5940
- void JSGlobalProxyPrint(FILE* out);
5941
- #endif
5942
- #ifdef DEBUG
5943
- void JSGlobalProxyVerify();
5944
- #endif
6284
+ DECLARE_PRINTER(JSGlobalProxy)
6285
+ DECLARE_VERIFIER(JSGlobalProxy)
5945
6286
 
5946
6287
  // Layout description.
5947
- static const int kContextOffset = JSObject::kHeaderSize;
5948
- static const int kSize = kContextOffset + kPointerSize;
6288
+ static const int kNativeContextOffset = JSObject::kHeaderSize;
6289
+ static const int kSize = kNativeContextOffset + kPointerSize;
5949
6290
 
5950
6291
  private:
5951
6292
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
@@ -5962,7 +6303,10 @@ class GlobalObject: public JSObject {
5962
6303
  // [builtins]: the object holding the runtime routines written in JS.
5963
6304
  DECL_ACCESSORS(builtins, JSBuiltinsObject)
5964
6305
 
5965
- // [global context]: the global context corresponding to this global object.
6306
+ // [native context]: the natives corresponding to this global object.
6307
+ DECL_ACCESSORS(native_context, Context)
6308
+
6309
+ // [global context]: the most recent (i.e. innermost) global context.
5966
6310
  DECL_ACCESSORS(global_context, Context)
5967
6311
 
5968
6312
  // [global receiver]: the global receiver object of the context
@@ -5985,7 +6329,7 @@ class GlobalObject: public JSObject {
5985
6329
  Handle<GlobalObject> global,
5986
6330
  Handle<String> name);
5987
6331
  // TODO(kmillikin): This function can be eliminated once the stub cache is
5988
- // full handlified (and the static helper can be written directly).
6332
+ // fully handlified (and the static helper can be written directly).
5989
6333
  MUST_USE_RESULT MaybeObject* EnsurePropertyCell(String* name);
5990
6334
 
5991
6335
  // Casting.
@@ -5993,7 +6337,8 @@ class GlobalObject: public JSObject {
5993
6337
 
5994
6338
  // Layout description.
5995
6339
  static const int kBuiltinsOffset = JSObject::kHeaderSize;
5996
- static const int kGlobalContextOffset = kBuiltinsOffset + kPointerSize;
6340
+ static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize;
6341
+ static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize;
5997
6342
  static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize;
5998
6343
  static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize;
5999
6344
 
@@ -6009,15 +6354,8 @@ class JSGlobalObject: public GlobalObject {
6009
6354
  static inline JSGlobalObject* cast(Object* obj);
6010
6355
 
6011
6356
  // Dispatched behavior.
6012
- #ifdef OBJECT_PRINT
6013
- inline void JSGlobalObjectPrint() {
6014
- JSGlobalObjectPrint(stdout);
6015
- }
6016
- void JSGlobalObjectPrint(FILE* out);
6017
- #endif
6018
- #ifdef DEBUG
6019
- void JSGlobalObjectVerify();
6020
- #endif
6357
+ DECLARE_PRINTER(JSGlobalObject)
6358
+ DECLARE_VERIFIER(JSGlobalObject)
6021
6359
 
6022
6360
  // Layout description.
6023
6361
  static const int kSize = GlobalObject::kHeaderSize;
@@ -6043,15 +6381,8 @@ class JSBuiltinsObject: public GlobalObject {
6043
6381
  static inline JSBuiltinsObject* cast(Object* obj);
6044
6382
 
6045
6383
  // Dispatched behavior.
6046
- #ifdef OBJECT_PRINT
6047
- inline void JSBuiltinsObjectPrint() {
6048
- JSBuiltinsObjectPrint(stdout);
6049
- }
6050
- void JSBuiltinsObjectPrint(FILE* out);
6051
- #endif
6052
- #ifdef DEBUG
6053
- void JSBuiltinsObjectVerify();
6054
- #endif
6384
+ DECLARE_PRINTER(JSBuiltinsObject)
6385
+ DECLARE_VERIFIER(JSBuiltinsObject)
6055
6386
 
6056
6387
  // Layout description. The size of the builtins object includes
6057
6388
  // room for two pointers per runtime routine written in javascript
@@ -6086,15 +6417,8 @@ class JSValue: public JSObject {
6086
6417
  static inline JSValue* cast(Object* obj);
6087
6418
 
6088
6419
  // Dispatched behavior.
6089
- #ifdef OBJECT_PRINT
6090
- inline void JSValuePrint() {
6091
- JSValuePrint(stdout);
6092
- }
6093
- void JSValuePrint(FILE* out);
6094
- #endif
6095
- #ifdef DEBUG
6096
- void JSValueVerify();
6097
- #endif
6420
+ DECLARE_PRINTER(JSValue)
6421
+ DECLARE_VERIFIER(JSValue)
6098
6422
 
6099
6423
  // Layout description.
6100
6424
  static const int kValueOffset = JSObject::kHeaderSize;
@@ -6142,15 +6466,9 @@ class JSDate: public JSObject {
6142
6466
 
6143
6467
 
6144
6468
  // Dispatched behavior.
6145
- #ifdef OBJECT_PRINT
6146
- inline void JSDatePrint() {
6147
- JSDatePrint(stdout);
6148
- }
6149
- void JSDatePrint(FILE* out);
6150
- #endif
6151
- #ifdef DEBUG
6152
- void JSDateVerify();
6153
- #endif
6469
+ DECLARE_PRINTER(JSDate)
6470
+ DECLARE_VERIFIER(JSDate)
6471
+
6154
6472
  // The order is important. It must be kept in sync with date macros
6155
6473
  // in macros.py.
6156
6474
  enum FieldIndex {
@@ -6240,15 +6558,8 @@ class JSMessageObject: public JSObject {
6240
6558
  static inline JSMessageObject* cast(Object* obj);
6241
6559
 
6242
6560
  // Dispatched behavior.
6243
- #ifdef OBJECT_PRINT
6244
- inline void JSMessageObjectPrint() {
6245
- JSMessageObjectPrint(stdout);
6246
- }
6247
- void JSMessageObjectPrint(FILE* out);
6248
- #endif
6249
- #ifdef DEBUG
6250
- void JSMessageObjectVerify();
6251
- #endif
6561
+ DECLARE_PRINTER(JSMessageObject)
6562
+ DECLARE_VERIFIER(JSMessageObject)
6252
6563
 
6253
6564
  // Layout description.
6254
6565
  static const int kTypeOffset = JSObject::kHeaderSize;
@@ -6337,9 +6648,7 @@ class JSRegExp: public JSObject {
6337
6648
  static inline JSRegExp* cast(Object* obj);
6338
6649
 
6339
6650
  // Dispatched behavior.
6340
- #ifdef DEBUG
6341
- void JSRegExpVerify();
6342
- #endif
6651
+ DECLARE_VERIFIER(JSRegExp)
6343
6652
 
6344
6653
  static const int kDataOffset = JSObject::kHeaderSize;
6345
6654
  static const int kSize = kDataOffset + kPointerSize;
@@ -6439,13 +6748,15 @@ class CompilationCacheTable: public HashTable<CompilationCacheShape,
6439
6748
  HashTableKey*> {
6440
6749
  public:
6441
6750
  // Find cached value for a string key, otherwise return null.
6442
- Object* Lookup(String* src);
6751
+ Object* Lookup(String* src, Context* context);
6443
6752
  Object* LookupEval(String* src,
6444
6753
  Context* context,
6445
6754
  LanguageMode language_mode,
6446
6755
  int scope_position);
6447
6756
  Object* LookupRegExp(String* source, JSRegExp::Flags flags);
6448
- MUST_USE_RESULT MaybeObject* Put(String* src, Object* value);
6757
+ MUST_USE_RESULT MaybeObject* Put(String* src,
6758
+ Context* context,
6759
+ Object* value);
6449
6760
  MUST_USE_RESULT MaybeObject* PutEval(String* src,
6450
6761
  Context* context,
6451
6762
  SharedFunctionInfo* value,
@@ -6487,15 +6798,9 @@ class CodeCache: public Struct {
6487
6798
 
6488
6799
  static inline CodeCache* cast(Object* obj);
6489
6800
 
6490
- #ifdef OBJECT_PRINT
6491
- inline void CodeCachePrint() {
6492
- CodeCachePrint(stdout);
6493
- }
6494
- void CodeCachePrint(FILE* out);
6495
- #endif
6496
- #ifdef DEBUG
6497
- void CodeCacheVerify();
6498
- #endif
6801
+ // Dispatched behavior.
6802
+ DECLARE_PRINTER(CodeCache)
6803
+ DECLARE_VERIFIER(CodeCache)
6499
6804
 
6500
6805
  static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
6501
6806
  static const int kNormalTypeCacheOffset =
@@ -6578,15 +6883,9 @@ class PolymorphicCodeCache: public Struct {
6578
6883
 
6579
6884
  static inline PolymorphicCodeCache* cast(Object* obj);
6580
6885
 
6581
- #ifdef OBJECT_PRINT
6582
- inline void PolymorphicCodeCachePrint() {
6583
- PolymorphicCodeCachePrint(stdout);
6584
- }
6585
- void PolymorphicCodeCachePrint(FILE* out);
6586
- #endif
6587
- #ifdef DEBUG
6588
- void PolymorphicCodeCacheVerify();
6589
- #endif
6886
+ // Dispatched behavior.
6887
+ DECLARE_PRINTER(PolymorphicCodeCache)
6888
+ DECLARE_VERIFIER(PolymorphicCodeCache)
6590
6889
 
6591
6890
  static const int kCacheOffset = HeapObject::kHeaderSize;
6592
6891
  static const int kSize = kCacheOffset + kPointerSize;
@@ -6619,34 +6918,77 @@ class TypeFeedbackInfo: public Struct {
6619
6918
  inline void set_ic_total_count(int count);
6620
6919
 
6621
6920
  inline int ic_with_type_info_count();
6622
- inline void set_ic_with_type_info_count(int count);
6921
+ inline void change_ic_with_type_info_count(int count);
6922
+
6923
+ inline void initialize_storage();
6924
+
6925
+ inline void change_own_type_change_checksum();
6926
+ inline int own_type_change_checksum();
6927
+
6928
+ inline void set_inlined_type_change_checksum(int checksum);
6929
+ inline bool matches_inlined_type_change_checksum(int checksum);
6623
6930
 
6624
6931
  DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells)
6625
6932
 
6626
6933
  static inline TypeFeedbackInfo* cast(Object* obj);
6627
6934
 
6628
- #ifdef OBJECT_PRINT
6629
- inline void TypeFeedbackInfoPrint() {
6630
- TypeFeedbackInfoPrint(stdout);
6631
- }
6632
- void TypeFeedbackInfoPrint(FILE* out);
6633
- #endif
6634
- #ifdef DEBUG
6635
- void TypeFeedbackInfoVerify();
6636
- #endif
6935
+ // Dispatched behavior.
6936
+ DECLARE_PRINTER(TypeFeedbackInfo)
6937
+ DECLARE_VERIFIER(TypeFeedbackInfo)
6637
6938
 
6638
- static const int kIcTotalCountOffset = HeapObject::kHeaderSize;
6639
- static const int kIcWithTypeinfoCountOffset =
6640
- kIcTotalCountOffset + kPointerSize;
6641
- static const int kTypeFeedbackCellsOffset =
6642
- kIcWithTypeinfoCountOffset + kPointerSize;
6939
+ static const int kStorage1Offset = HeapObject::kHeaderSize;
6940
+ static const int kStorage2Offset = kStorage1Offset + kPointerSize;
6941
+ static const int kTypeFeedbackCellsOffset = kStorage2Offset + kPointerSize;
6643
6942
  static const int kSize = kTypeFeedbackCellsOffset + kPointerSize;
6644
6943
 
6645
6944
  private:
6945
+ static const int kTypeChangeChecksumBits = 7;
6946
+
6947
+ class ICTotalCountField: public BitField<int, 0,
6948
+ kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT
6949
+ class OwnTypeChangeChecksum: public BitField<int,
6950
+ kSmiValueSize - kTypeChangeChecksumBits,
6951
+ kTypeChangeChecksumBits> {}; // NOLINT
6952
+ class ICsWithTypeInfoCountField: public BitField<int, 0,
6953
+ kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT
6954
+ class InlinedTypeChangeChecksum: public BitField<int,
6955
+ kSmiValueSize - kTypeChangeChecksumBits,
6956
+ kTypeChangeChecksumBits> {}; // NOLINT
6957
+
6646
6958
  DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackInfo);
6647
6959
  };
6648
6960
 
6649
6961
 
6962
+ enum AllocationSiteMode {
6963
+ DONT_TRACK_ALLOCATION_SITE,
6964
+ TRACK_ALLOCATION_SITE,
6965
+ LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE
6966
+ };
6967
+
6968
+
6969
+ class AllocationSiteInfo: public Struct {
6970
+ public:
6971
+ DECL_ACCESSORS(payload, Object)
6972
+
6973
+ static inline AllocationSiteInfo* cast(Object* obj);
6974
+
6975
+ DECLARE_PRINTER(AllocationSiteInfo)
6976
+ DECLARE_VERIFIER(AllocationSiteInfo)
6977
+
6978
+ // Returns NULL if no AllocationSiteInfo is available for object.
6979
+ static AllocationSiteInfo* FindForJSObject(JSObject* object);
6980
+
6981
+ static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind);
6982
+ static AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
6983
+
6984
+ static const int kPayloadOffset = HeapObject::kHeaderSize;
6985
+ static const int kSize = kPayloadOffset + kPointerSize;
6986
+
6987
+ private:
6988
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo);
6989
+ };
6990
+
6991
+
6650
6992
  // Representation of a slow alias as part of a non-strict arguments objects.
6651
6993
  // For fast aliases (if HasNonStrictArgumentsElements()):
6652
6994
  // - the parameter map contains an index into the context
@@ -6662,15 +7004,9 @@ class AliasedArgumentsEntry: public Struct {
6662
7004
 
6663
7005
  static inline AliasedArgumentsEntry* cast(Object* obj);
6664
7006
 
6665
- #ifdef OBJECT_PRINT
6666
- inline void AliasedArgumentsEntryPrint() {
6667
- AliasedArgumentsEntryPrint(stdout);
6668
- }
6669
- void AliasedArgumentsEntryPrint(FILE* out);
6670
- #endif
6671
- #ifdef DEBUG
6672
- void AliasedArgumentsEntryVerify();
6673
- #endif
7007
+ // Dispatched behavior.
7008
+ DECLARE_PRINTER(AliasedArgumentsEntry)
7009
+ DECLARE_VERIFIER(AliasedArgumentsEntry)
6674
7010
 
6675
7011
  static const int kAliasedContextSlot = HeapObject::kHeaderSize;
6676
7012
  static const int kSize = kAliasedContextSlot + kPointerSize;
@@ -6688,34 +7024,15 @@ class StringHasher {
6688
7024
  public:
6689
7025
  explicit inline StringHasher(int length, uint32_t seed);
6690
7026
 
6691
- // Returns true if the hash of this string can be computed without
6692
- // looking at the contents.
6693
- inline bool has_trivial_hash();
6694
-
6695
- // Add a character to the hash and update the array index calculation.
6696
- inline void AddCharacter(uint32_t c);
6697
-
6698
- // Adds a character to the hash but does not update the array index
6699
- // calculation. This can only be called when it has been verified
6700
- // that the input is not an array index.
6701
- inline void AddCharacterNoIndex(uint32_t c);
6702
-
6703
- // Add a character above 0xffff as a surrogate pair. These can get into
6704
- // the hasher through the routines that take a UTF-8 string and make a symbol.
6705
- void AddSurrogatePair(uc32 c);
6706
- void AddSurrogatePairNoIndex(uc32 c);
6707
-
6708
- // Returns the value to store in the hash field of a string with
6709
- // the given length and contents.
6710
- uint32_t GetHashField();
6711
-
6712
- // Returns true if the characters seen so far make up a legal array
6713
- // index.
6714
- bool is_array_index() { return is_array_index_; }
7027
+ template <typename schar>
7028
+ static inline uint32_t HashSequentialString(const schar* chars,
7029
+ int length,
7030
+ uint32_t seed);
6715
7031
 
6716
- bool is_valid() { return is_valid_; }
6717
-
6718
- void invalidate() { is_valid_ = false; }
7032
+ // Reads all the data, even for long strings and computes the utf16 length.
7033
+ static uint32_t ComputeUtf8Hash(Vector<const char> chars,
7034
+ uint32_t seed,
7035
+ int* utf16_length_out);
6719
7036
 
6720
7037
  // Calculated hash value for a string consisting of 1 to
6721
7038
  // String::kMaxArrayIndexSize digits with no leading zeros (except "0").
@@ -6727,31 +7044,36 @@ class StringHasher {
6727
7044
  // use 27 instead.
6728
7045
  static const int kZeroHash = 27;
6729
7046
 
6730
- private:
6731
- uint32_t array_index() {
6732
- ASSERT(is_array_index());
6733
- return array_index_;
6734
- }
7047
+ // Reusable parts of the hashing algorithm.
7048
+ INLINE(static uint32_t AddCharacterCore(uint32_t running_hash, uint16_t c));
7049
+ INLINE(static uint32_t GetHashCore(uint32_t running_hash));
6735
7050
 
6736
- inline uint32_t GetHash();
7051
+ protected:
7052
+ // Returns the value to store in the hash field of a string with
7053
+ // the given length and contents.
7054
+ uint32_t GetHashField();
7055
+ // Returns true if the hash of this string can be computed without
7056
+ // looking at the contents.
7057
+ inline bool has_trivial_hash();
7058
+ // Adds a block of characters to the hash.
7059
+ template<typename Char>
7060
+ inline void AddCharacters(const Char* chars, int len);
7061
+
7062
+ private:
7063
+ // Add a character to the hash.
7064
+ inline void AddCharacter(uint16_t c);
7065
+ // Update index. Returns true if string is still an index.
7066
+ inline bool UpdateIndex(uint16_t c);
6737
7067
 
6738
7068
  int length_;
6739
7069
  uint32_t raw_running_hash_;
6740
7070
  uint32_t array_index_;
6741
7071
  bool is_array_index_;
6742
7072
  bool is_first_char_;
6743
- bool is_valid_;
6744
- friend class TwoCharHashTableKey;
7073
+ DISALLOW_COPY_AND_ASSIGN(StringHasher);
6745
7074
  };
6746
7075
 
6747
7076
 
6748
- // Calculates string hash.
6749
- template <typename schar>
6750
- inline uint32_t HashSequentialString(const schar* chars,
6751
- int length,
6752
- uint32_t seed);
6753
-
6754
-
6755
7077
  // The characteristics of a string are stored in its map. Retrieving these
6756
7078
  // few bits of information is moderately expensive, involving two memory
6757
7079
  // loads where the second is dependent on the first. To improve efficiency
@@ -6811,6 +7133,8 @@ class StringShape BASE_EMBEDDED {
6811
7133
  // All string values have a length field.
6812
7134
  class String: public HeapObject {
6813
7135
  public:
7136
+ enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING };
7137
+
6814
7138
  // Representation of the flat content of a String.
6815
7139
  // A non-flat string doesn't have flat content.
6816
7140
  // A flat string has content that's encoded as a sequence of either
@@ -6825,11 +7149,11 @@ class String: public HeapObject {
6825
7149
  // Returns true if the structure contains two-byte content.
6826
7150
  bool IsTwoByte() { return state_ == TWO_BYTE; }
6827
7151
 
6828
- // Return the ASCII content of the string. Only use if IsAscii() returns
7152
+ // Return the one byte content of the string. Only use if IsAscii() returns
6829
7153
  // true.
6830
- Vector<const char> ToAsciiVector() {
7154
+ Vector<const uint8_t> ToOneByteVector() {
6831
7155
  ASSERT_EQ(ASCII, state_);
6832
- return Vector<const char>::cast(buffer_);
7156
+ return buffer_;
6833
7157
  }
6834
7158
  // Return the two-byte content of the string. Only use if IsTwoByte()
6835
7159
  // returns true.
@@ -6842,15 +7166,15 @@ class String: public HeapObject {
6842
7166
  enum State { NON_FLAT, ASCII, TWO_BYTE };
6843
7167
 
6844
7168
  // Constructors only used by String::GetFlatContent().
6845
- explicit FlatContent(Vector<const char> chars)
6846
- : buffer_(Vector<const byte>::cast(chars)),
7169
+ explicit FlatContent(Vector<const uint8_t> chars)
7170
+ : buffer_(chars),
6847
7171
  state_(ASCII) { }
6848
7172
  explicit FlatContent(Vector<const uc16> chars)
6849
7173
  : buffer_(Vector<const byte>::cast(chars)),
6850
7174
  state_(TWO_BYTE) { }
6851
7175
  FlatContent() : buffer_(), state_(NON_FLAT) { }
6852
7176
 
6853
- Vector<const byte> buffer_;
7177
+ Vector<const uint8_t> buffer_;
6854
7178
  State state_;
6855
7179
 
6856
7180
  friend class String;
@@ -6868,19 +7192,21 @@ class String: public HeapObject {
6868
7192
  // be ASCII encoded. This might be the case even if the string is
6869
7193
  // two-byte. Such strings may appear when the embedder prefers
6870
7194
  // two-byte external representations even for ASCII data.
6871
- inline bool IsAsciiRepresentation();
7195
+ inline bool IsOneByteRepresentation();
6872
7196
  inline bool IsTwoByteRepresentation();
6873
7197
 
6874
7198
  // Cons and slices have an encoding flag that may not represent the actual
6875
7199
  // encoding of the underlying string. This is taken into account here.
6876
7200
  // Requires: this->IsFlat()
6877
- inline bool IsAsciiRepresentationUnderneath();
7201
+ inline bool IsOneByteRepresentationUnderneath();
6878
7202
  inline bool IsTwoByteRepresentationUnderneath();
6879
7203
 
6880
7204
  // NOTE: this should be considered only a hint. False negatives are
6881
7205
  // possible.
6882
7206
  inline bool HasOnlyAsciiChars();
6883
7207
 
7208
+ inline bool IsOneByteConvertible();
7209
+
6884
7210
  // Get and set individual two byte chars in the string.
6885
7211
  inline void Set(int index, uint16_t value);
6886
7212
  // Get individual two byte char in the string. Repeated calls
@@ -6931,8 +7257,8 @@ class String: public HeapObject {
6931
7257
 
6932
7258
  // String equality operations.
6933
7259
  inline bool Equals(String* other);
6934
- bool IsEqualTo(Vector<const char> str);
6935
- bool IsAsciiEqualTo(Vector<const char> str);
7260
+ bool IsUtf8EqualTo(Vector<const char> str);
7261
+ bool IsOneByteEqualTo(Vector<const uint8_t> str);
6936
7262
  bool IsTwoByteEqualTo(Vector<const uc16> str);
6937
7263
 
6938
7264
  // Return a UTF8 representation of the string. The string is null
@@ -6968,13 +7294,7 @@ class String: public HeapObject {
6968
7294
  // Returns a hash value used for the property table
6969
7295
  inline uint32_t Hash();
6970
7296
 
6971
- static uint32_t ComputeHashField(unibrow::CharacterStream* buffer,
6972
- int length,
6973
- uint32_t seed);
6974
-
6975
- static bool ComputeArrayIndex(unibrow::CharacterStream* buffer,
6976
- uint32_t* index,
6977
- int length);
7297
+ bool ComputeArrayIndex(uint32_t* index);
6978
7298
 
6979
7299
  // Externalization.
6980
7300
  bool MakeExternal(v8::String::ExternalStringResource* resource);
@@ -7001,9 +7321,8 @@ class String: public HeapObject {
7001
7321
 
7002
7322
  char* ToAsciiArray();
7003
7323
  #endif
7004
- #ifdef DEBUG
7005
- void StringVerify();
7006
- #endif
7324
+ DECLARE_VERIFIER(String)
7325
+
7007
7326
  inline bool IsFlat();
7008
7327
 
7009
7328
  // Layout description.
@@ -7015,9 +7334,9 @@ class String: public HeapObject {
7015
7334
  // value into an array index.
7016
7335
  static const int kMaxArrayIndexSize = 10;
7017
7336
 
7018
- // Max ASCII char code.
7019
- static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar;
7020
- static const unsigned kMaxAsciiCharCodeU = unibrow::Utf8::kMaxOneByteChar;
7337
+ // Max char codes.
7338
+ static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar;
7339
+ static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar;
7021
7340
  static const int kMaxUtf16CodeUnit = 0xffff;
7022
7341
 
7023
7342
  // Mask constant for checking if a string has a computed hash code
@@ -7072,7 +7391,7 @@ class String: public HeapObject {
7072
7391
  kIsNotArrayIndexMask | kHashNotComputedMask;
7073
7392
 
7074
7393
  // Value of hash field containing computed hash equal to zero.
7075
- static const int kZeroHash = kIsNotArrayIndexMask;
7394
+ static const int kEmptyStringHash = kIsNotArrayIndexMask;
7076
7395
 
7077
7396
  // Maximal string length.
7078
7397
  static const int kMaxLength = (1 << (32 - 2)) - 1;
@@ -7088,18 +7407,6 @@ class String: public HeapObject {
7088
7407
  const uc16* GetTwoByteData();
7089
7408
  const uc16* GetTwoByteData(unsigned start);
7090
7409
 
7091
- // Support for StringInputBuffer
7092
- static const unibrow::byte* ReadBlock(String* input,
7093
- unibrow::byte* util_buffer,
7094
- unsigned capacity,
7095
- unsigned* remaining,
7096
- unsigned* offset);
7097
- static const unibrow::byte* ReadBlock(String** input,
7098
- unibrow::byte* util_buffer,
7099
- unsigned capacity,
7100
- unsigned* remaining,
7101
- unsigned* offset);
7102
-
7103
7410
  // Helper function for flattening strings.
7104
7411
  template <typename sinkchar>
7105
7412
  static void WriteToFlat(String* source,
@@ -7107,60 +7414,61 @@ class String: public HeapObject {
7107
7414
  int from,
7108
7415
  int to);
7109
7416
 
7110
- static inline bool IsAscii(const char* chars, int length) {
7417
+ // The return value may point to the first aligned word containing the
7418
+ // first non-ascii character, rather than directly to the non-ascii character.
7419
+ // If the return value is >= the passed length, the entire string was ASCII.
7420
+ static inline int NonAsciiStart(const char* chars, int length) {
7421
+ const char* start = chars;
7111
7422
  const char* limit = chars + length;
7112
7423
  #ifdef V8_HOST_CAN_READ_UNALIGNED
7113
- ASSERT(kMaxAsciiCharCode == 0x7F);
7424
+ ASSERT(unibrow::Utf8::kMaxOneByteChar == 0x7F);
7114
7425
  const uintptr_t non_ascii_mask = kUintptrAllBitsSet / 0xFF * 0x80;
7115
- while (chars <= limit - sizeof(uintptr_t)) {
7426
+ while (chars + sizeof(uintptr_t) <= limit) {
7116
7427
  if (*reinterpret_cast<const uintptr_t*>(chars) & non_ascii_mask) {
7117
- return false;
7428
+ return static_cast<int>(chars - start);
7118
7429
  }
7119
7430
  chars += sizeof(uintptr_t);
7120
7431
  }
7121
7432
  #endif
7122
7433
  while (chars < limit) {
7123
- if (static_cast<uint8_t>(*chars) > kMaxAsciiCharCodeU) return false;
7434
+ if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) {
7435
+ return static_cast<int>(chars - start);
7436
+ }
7124
7437
  ++chars;
7125
7438
  }
7126
- return true;
7439
+ return static_cast<int>(chars - start);
7127
7440
  }
7128
7441
 
7129
- static inline bool IsAscii(const uc16* chars, int length) {
7442
+ static inline bool IsAscii(const char* chars, int length) {
7443
+ return NonAsciiStart(chars, length) >= length;
7444
+ }
7445
+
7446
+ static inline bool IsAscii(const uint8_t* chars, int length) {
7447
+ return
7448
+ NonAsciiStart(reinterpret_cast<const char*>(chars), length) >= length;
7449
+ }
7450
+
7451
+ static inline int NonOneByteStart(const uc16* chars, int length) {
7130
7452
  const uc16* limit = chars + length;
7453
+ const uc16* start = chars;
7131
7454
  while (chars < limit) {
7132
- if (*chars > kMaxAsciiCharCodeU) return false;
7455
+ if (*chars > kMaxOneByteCharCodeU) return static_cast<int>(chars - start);
7133
7456
  ++chars;
7134
7457
  }
7135
- return true;
7458
+ return static_cast<int>(chars - start);
7136
7459
  }
7137
7460
 
7138
- protected:
7139
- class ReadBlockBuffer {
7140
- public:
7141
- ReadBlockBuffer(unibrow::byte* util_buffer_,
7142
- unsigned cursor_,
7143
- unsigned capacity_,
7144
- unsigned remaining_) :
7145
- util_buffer(util_buffer_),
7146
- cursor(cursor_),
7147
- capacity(capacity_),
7148
- remaining(remaining_) {
7149
- }
7150
- unibrow::byte* util_buffer;
7151
- unsigned cursor;
7152
- unsigned capacity;
7153
- unsigned remaining;
7154
- };
7461
+ static inline bool IsOneByte(const uc16* chars, int length) {
7462
+ return NonOneByteStart(chars, length) >= length;
7463
+ }
7155
7464
 
7156
- static inline const unibrow::byte* ReadBlock(String* input,
7157
- ReadBlockBuffer* buffer,
7158
- unsigned* offset,
7159
- unsigned max_chars);
7160
- static void ReadBlockIntoBuffer(String* input,
7161
- ReadBlockBuffer* buffer,
7162
- unsigned* offset_ptr,
7163
- unsigned max_chars);
7465
+ template<class Visitor, class ConsOp>
7466
+ static inline void Visit(String* string,
7467
+ unsigned offset,
7468
+ Visitor& visitor,
7469
+ ConsOp& cons_op,
7470
+ int32_t type,
7471
+ unsigned length);
7164
7472
 
7165
7473
  private:
7166
7474
  // Try to flatten the top level ConsString that is hiding behind this
@@ -7193,6 +7501,11 @@ class SeqString: public String {
7193
7501
  // Layout description.
7194
7502
  static const int kHeaderSize = String::kSize;
7195
7503
 
7504
+ // Truncate the string in-place if possible and return the result.
7505
+ // In case of new_length == 0, the empty string is returned without
7506
+ // truncating the original string.
7507
+ MUST_USE_RESULT String* Truncate(int new_length);
7508
+
7196
7509
  private:
7197
7510
  DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
7198
7511
  };
@@ -7200,26 +7513,26 @@ class SeqString: public String {
7200
7513
 
7201
7514
  // The AsciiString class captures sequential ASCII string objects.
7202
7515
  // Each character in the AsciiString is an ASCII character.
7203
- class SeqAsciiString: public SeqString {
7516
+ class SeqOneByteString: public SeqString {
7204
7517
  public:
7205
7518
  static const bool kHasAsciiEncoding = true;
7206
7519
 
7207
7520
  // Dispatched behavior.
7208
- inline uint16_t SeqAsciiStringGet(int index);
7209
- inline void SeqAsciiStringSet(int index, uint16_t value);
7521
+ inline uint16_t SeqOneByteStringGet(int index);
7522
+ inline void SeqOneByteStringSet(int index, uint16_t value);
7210
7523
 
7211
7524
  // Get the address of the characters in this string.
7212
7525
  inline Address GetCharsAddress();
7213
7526
 
7214
- inline char* GetChars();
7527
+ inline uint8_t* GetChars();
7215
7528
 
7216
7529
  // Casting
7217
- static inline SeqAsciiString* cast(Object* obj);
7530
+ static inline SeqOneByteString* cast(Object* obj);
7218
7531
 
7219
7532
  // Garbage collection support. This method is called by the
7220
7533
  // garbage collector to compute the actual size of an AsciiString
7221
7534
  // instance.
7222
- inline int SeqAsciiStringSize(InstanceType instance_type);
7535
+ inline int SeqOneByteStringSize(InstanceType instance_type);
7223
7536
 
7224
7537
  // Computes the size for an AsciiString instance of a given length.
7225
7538
  static int SizeFor(int length) {
@@ -7232,20 +7545,10 @@ class SeqAsciiString: public SeqString {
7232
7545
  // Q.v. String::kMaxLength which is the maximal size of concatenated strings.
7233
7546
  static const int kMaxLength = (kMaxSize - kHeaderSize);
7234
7547
 
7235
- // Support for StringInputBuffer.
7236
- inline void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7237
- unsigned* offset,
7238
- unsigned chars);
7239
- inline const unibrow::byte* SeqAsciiStringReadBlock(unsigned* remaining,
7240
- unsigned* offset,
7241
- unsigned chars);
7242
-
7243
- #ifdef DEBUG
7244
- void SeqAsciiStringVerify();
7245
- #endif
7548
+ DECLARE_VERIFIER(SeqOneByteString)
7246
7549
 
7247
7550
  private:
7248
- DISALLOW_IMPLICIT_CONSTRUCTORS(SeqAsciiString);
7551
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString);
7249
7552
  };
7250
7553
 
7251
7554
 
@@ -7286,11 +7589,6 @@ class SeqTwoByteString: public SeqString {
7286
7589
  // Q.v. String::kMaxLength which is the maximal size of concatenated strings.
7287
7590
  static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t);
7288
7591
 
7289
- // Support for StringInputBuffer.
7290
- inline void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7291
- unsigned* offset_ptr,
7292
- unsigned chars);
7293
-
7294
7592
  private:
7295
7593
  DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString);
7296
7594
  };
@@ -7333,23 +7631,13 @@ class ConsString: public String {
7333
7631
  static const int kSecondOffset = kFirstOffset + kPointerSize;
7334
7632
  static const int kSize = kSecondOffset + kPointerSize;
7335
7633
 
7336
- // Support for StringInputBuffer.
7337
- inline const unibrow::byte* ConsStringReadBlock(ReadBlockBuffer* buffer,
7338
- unsigned* offset_ptr,
7339
- unsigned chars);
7340
- inline void ConsStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7341
- unsigned* offset_ptr,
7342
- unsigned chars);
7343
-
7344
7634
  // Minimum length for a cons string.
7345
7635
  static const int kMinLength = 13;
7346
7636
 
7347
7637
  typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize>
7348
7638
  BodyDescriptor;
7349
7639
 
7350
- #ifdef DEBUG
7351
- void ConsStringVerify();
7352
- #endif
7640
+ DECLARE_VERIFIER(ConsString)
7353
7641
 
7354
7642
  private:
7355
7643
  DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString);
@@ -7371,7 +7659,8 @@ class ConsString: public String {
7371
7659
  class SlicedString: public String {
7372
7660
  public:
7373
7661
  inline String* parent();
7374
- inline void set_parent(String* parent);
7662
+ inline void set_parent(String* parent,
7663
+ WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
7375
7664
  inline int offset();
7376
7665
  inline void set_offset(int offset);
7377
7666
 
@@ -7386,13 +7675,6 @@ class SlicedString: public String {
7386
7675
  static const int kOffsetOffset = kParentOffset + kPointerSize;
7387
7676
  static const int kSize = kOffsetOffset + kPointerSize;
7388
7677
 
7389
- // Support for StringInputBuffer
7390
- inline const unibrow::byte* SlicedStringReadBlock(ReadBlockBuffer* buffer,
7391
- unsigned* offset_ptr,
7392
- unsigned chars);
7393
- inline void SlicedStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7394
- unsigned* offset_ptr,
7395
- unsigned chars);
7396
7678
  // Minimum length for a sliced string.
7397
7679
  static const int kMinLength = 13;
7398
7680
 
@@ -7400,9 +7682,7 @@ class SlicedString: public String {
7400
7682
  kOffsetOffset + kPointerSize, kSize>
7401
7683
  BodyDescriptor;
7402
7684
 
7403
- #ifdef DEBUG
7404
- void SlicedStringVerify();
7405
- #endif
7685
+ DECLARE_VERIFIER(SlicedString)
7406
7686
 
7407
7687
  private:
7408
7688
  DISALLOW_IMPLICIT_CONSTRUCTORS(SlicedString);
@@ -7457,7 +7737,7 @@ class ExternalAsciiString: public ExternalString {
7457
7737
  // which the pointer cache has to be refreshed.
7458
7738
  inline void update_data_cache();
7459
7739
 
7460
- inline const char* GetChars();
7740
+ inline const uint8_t* GetChars();
7461
7741
 
7462
7742
  // Dispatched behavior.
7463
7743
  inline uint16_t ExternalAsciiStringGet(int index);
@@ -7471,14 +7751,6 @@ class ExternalAsciiString: public ExternalString {
7471
7751
  template<typename StaticVisitor>
7472
7752
  inline void ExternalAsciiStringIterateBody();
7473
7753
 
7474
- // Support for StringInputBuffer.
7475
- const unibrow::byte* ExternalAsciiStringReadBlock(unsigned* remaining,
7476
- unsigned* offset,
7477
- unsigned chars);
7478
- inline void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7479
- unsigned* offset,
7480
- unsigned chars);
7481
-
7482
7754
  private:
7483
7755
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString);
7484
7756
  };
@@ -7519,12 +7791,6 @@ class ExternalTwoByteString: public ExternalString {
7519
7791
  template<typename StaticVisitor>
7520
7792
  inline void ExternalTwoByteStringIterateBody();
7521
7793
 
7522
-
7523
- // Support for StringInputBuffer.
7524
- void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
7525
- unsigned* offset_ptr,
7526
- unsigned chars);
7527
-
7528
7794
  private:
7529
7795
  DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString);
7530
7796
  };
@@ -7571,32 +7837,82 @@ class FlatStringReader : public Relocatable {
7571
7837
  };
7572
7838
 
7573
7839
 
7574
- // Note that StringInputBuffers are not valid across a GC! To fix this
7575
- // it would have to store a String Handle instead of a String* and
7576
- // AsciiStringReadBlock would have to be modified to use memcpy.
7577
- //
7578
- // StringInputBuffer is able to traverse any string regardless of how
7579
- // deeply nested a sequence of ConsStrings it is made of. However,
7580
- // performance will be better if deep strings are flattened before they
7581
- // are traversed. Since flattening requires memory allocation this is
7582
- // not always desirable, however (esp. in debugging situations).
7583
- class StringInputBuffer: public unibrow::InputBuffer<String, String*, 1024> {
7840
+ // A ConsStringOp that returns null.
7841
+ // Useful when the operation to apply on a ConsString
7842
+ // requires an expensive data structure.
7843
+ class ConsStringNullOp {
7584
7844
  public:
7585
- virtual void Seek(unsigned pos);
7586
- inline StringInputBuffer(): unibrow::InputBuffer<String, String*, 1024>() {}
7587
- explicit inline StringInputBuffer(String* backing):
7588
- unibrow::InputBuffer<String, String*, 1024>(backing) {}
7845
+ inline ConsStringNullOp() {}
7846
+ static inline String* Operate(String*, unsigned*, int32_t*, unsigned*);
7847
+ private:
7848
+ DISALLOW_COPY_AND_ASSIGN(ConsStringNullOp);
7589
7849
  };
7590
7850
 
7591
7851
 
7592
- class SafeStringInputBuffer
7593
- : public unibrow::InputBuffer<String, String**, 256> {
7852
+ // This maintains an off-stack representation of the stack frames required
7853
+ // to traverse a ConsString, allowing an entirely iterative and restartable
7854
+ // traversal of the entire string
7855
+ // Note: this class is not GC-safe.
7856
+ class ConsStringIteratorOp {
7857
+ public:
7858
+ inline ConsStringIteratorOp() {}
7859
+ String* Operate(String* string,
7860
+ unsigned* offset_out,
7861
+ int32_t* type_out,
7862
+ unsigned* length_out);
7863
+ inline String* ContinueOperation(int32_t* type_out, unsigned* length_out);
7864
+ inline void Reset();
7865
+ inline bool HasMore();
7866
+
7867
+ private:
7868
+ // TODO(dcarney): Templatize this out for different stack sizes.
7869
+ static const unsigned kStackSize = 32;
7870
+ // Use a mask instead of doing modulo operations for stack wrapping.
7871
+ static const unsigned kDepthMask = kStackSize-1;
7872
+ STATIC_ASSERT(IS_POWER_OF_TWO(kStackSize));
7873
+ static inline unsigned OffsetForDepth(unsigned depth);
7874
+
7875
+ inline void PushLeft(ConsString* string);
7876
+ inline void PushRight(ConsString* string);
7877
+ inline void AdjustMaximumDepth();
7878
+ inline void Pop();
7879
+ String* NextLeaf(bool* blew_stack, int32_t* type_out, unsigned* length_out);
7880
+ String* Search(unsigned* offset_out,
7881
+ int32_t* type_out,
7882
+ unsigned* length_out);
7883
+
7884
+ unsigned depth_;
7885
+ unsigned maximum_depth_;
7886
+ // Stack must always contain only frames for which right traversal
7887
+ // has not yet been performed.
7888
+ ConsString* frames_[kStackSize];
7889
+ unsigned consumed_;
7890
+ ConsString* root_;
7891
+ DISALLOW_COPY_AND_ASSIGN(ConsStringIteratorOp);
7892
+ };
7893
+
7894
+
7895
+ // Note: this class is not GC-safe.
7896
+ class StringCharacterStream {
7594
7897
  public:
7595
- virtual void Seek(unsigned pos);
7596
- inline SafeStringInputBuffer()
7597
- : unibrow::InputBuffer<String, String**, 256>() {}
7598
- explicit inline SafeStringInputBuffer(String** backing)
7599
- : unibrow::InputBuffer<String, String**, 256>(backing) {}
7898
+ inline StringCharacterStream(String* string,
7899
+ ConsStringIteratorOp* op,
7900
+ unsigned offset = 0);
7901
+ inline uint16_t GetNext();
7902
+ inline bool HasMore();
7903
+ inline void Reset(String* string, unsigned offset = 0);
7904
+ inline void VisitOneByteString(const uint8_t* chars, unsigned length);
7905
+ inline void VisitTwoByteString(const uint16_t* chars, unsigned length);
7906
+
7907
+ private:
7908
+ bool is_one_byte_;
7909
+ union {
7910
+ const uint8_t* buffer8_;
7911
+ const uint16_t* buffer16_;
7912
+ };
7913
+ const uint8_t* end_;
7914
+ ConsStringIteratorOp* op_;
7915
+ DISALLOW_COPY_AND_ASSIGN(StringCharacterStream);
7600
7916
  };
7601
7917
 
7602
7918
 
@@ -7629,9 +7945,7 @@ class Oddball: public HeapObject {
7629
7945
  static inline Oddball* cast(Object* obj);
7630
7946
 
7631
7947
  // Dispatched behavior.
7632
- #ifdef DEBUG
7633
- void OddballVerify();
7634
- #endif
7948
+ DECLARE_VERIFIER(Oddball)
7635
7949
 
7636
7950
  // Initialize the fields.
7637
7951
  MUST_USE_RESULT MaybeObject* Initialize(const char* to_string,
@@ -7674,15 +7988,17 @@ class JSGlobalPropertyCell: public HeapObject {
7674
7988
  // Casting.
7675
7989
  static inline JSGlobalPropertyCell* cast(Object* obj);
7676
7990
 
7677
- #ifdef DEBUG
7678
- void JSGlobalPropertyCellVerify();
7679
- #endif
7680
- #ifdef OBJECT_PRINT
7681
- inline void JSGlobalPropertyCellPrint() {
7682
- JSGlobalPropertyCellPrint(stdout);
7991
+ static inline JSGlobalPropertyCell* FromValueAddress(Address value) {
7992
+ return cast(FromAddress(value - kValueOffset));
7683
7993
  }
7684
- void JSGlobalPropertyCellPrint(FILE* out);
7685
- #endif
7994
+
7995
+ inline Address ValueAddress() {
7996
+ return address() + kValueOffset;
7997
+ }
7998
+
7999
+ // Dispatched behavior.
8000
+ DECLARE_PRINTER(JSGlobalPropertyCell)
8001
+ DECLARE_VERIFIER(JSGlobalPropertyCell)
7686
8002
 
7687
8003
  // Layout description.
7688
8004
  static const int kValueOffset = HeapObject::kHeaderSize;
@@ -7731,15 +8047,17 @@ class JSProxy: public JSReceiver {
7731
8047
  Object* value,
7732
8048
  StrictModeFlag strict_mode);
7733
8049
 
7734
- // If the handler defines an accessor property, invoke its setter
7735
- // (or throw if only a getter exists) and set *found to true. Otherwise false.
7736
- MUST_USE_RESULT MaybeObject* SetPropertyWithHandlerIfDefiningSetter(
8050
+ // If the handler defines an accessor property with a setter, invoke it.
8051
+ // If it defines an accessor property without a setter, or a data property
8052
+ // that is read-only, throw. In all these cases set '*done' to true,
8053
+ // otherwise set it to false.
8054
+ MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler(
7737
8055
  JSReceiver* receiver,
7738
8056
  String* name,
7739
8057
  Object* value,
7740
8058
  PropertyAttributes attributes,
7741
8059
  StrictModeFlag strict_mode,
7742
- bool* found);
8060
+ bool* done);
7743
8061
 
7744
8062
  MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler(
7745
8063
  String* name,
@@ -7771,15 +8089,8 @@ class JSProxy: public JSReceiver {
7771
8089
  Handle<Object> args[]);
7772
8090
 
7773
8091
  // Dispatched behavior.
7774
- #ifdef OBJECT_PRINT
7775
- inline void JSProxyPrint() {
7776
- JSProxyPrint(stdout);
7777
- }
7778
- void JSProxyPrint(FILE* out);
7779
- #endif
7780
- #ifdef DEBUG
7781
- void JSProxyVerify();
7782
- #endif
8092
+ DECLARE_PRINTER(JSProxy)
8093
+ DECLARE_VERIFIER(JSProxy)
7783
8094
 
7784
8095
  // Layout description. We add padding so that a proxy has the same
7785
8096
  // size as a virgin JSObject. This is essential for becoming a JSObject
@@ -7814,15 +8125,8 @@ class JSFunctionProxy: public JSProxy {
7814
8125
  static inline JSFunctionProxy* cast(Object* obj);
7815
8126
 
7816
8127
  // Dispatched behavior.
7817
- #ifdef OBJECT_PRINT
7818
- inline void JSFunctionProxyPrint() {
7819
- JSFunctionProxyPrint(stdout);
7820
- }
7821
- void JSFunctionProxyPrint(FILE* out);
7822
- #endif
7823
- #ifdef DEBUG
7824
- void JSFunctionProxyVerify();
7825
- #endif
8128
+ DECLARE_PRINTER(JSFunctionProxy)
8129
+ DECLARE_VERIFIER(JSFunctionProxy)
7826
8130
 
7827
8131
  // Layout description.
7828
8132
  static const int kCallTrapOffset = JSProxy::kPaddingOffset;
@@ -7851,15 +8155,9 @@ class JSSet: public JSObject {
7851
8155
  // Casting.
7852
8156
  static inline JSSet* cast(Object* obj);
7853
8157
 
7854
- #ifdef OBJECT_PRINT
7855
- inline void JSSetPrint() {
7856
- JSSetPrint(stdout);
7857
- }
7858
- void JSSetPrint(FILE* out);
7859
- #endif
7860
- #ifdef DEBUG
7861
- void JSSetVerify();
7862
- #endif
8158
+ // Dispatched behavior.
8159
+ DECLARE_PRINTER(JSSet)
8160
+ DECLARE_VERIFIER(JSSet)
7863
8161
 
7864
8162
  static const int kTableOffset = JSObject::kHeaderSize;
7865
8163
  static const int kSize = kTableOffset + kPointerSize;
@@ -7878,15 +8176,9 @@ class JSMap: public JSObject {
7878
8176
  // Casting.
7879
8177
  static inline JSMap* cast(Object* obj);
7880
8178
 
7881
- #ifdef OBJECT_PRINT
7882
- inline void JSMapPrint() {
7883
- JSMapPrint(stdout);
7884
- }
7885
- void JSMapPrint(FILE* out);
7886
- #endif
7887
- #ifdef DEBUG
7888
- void JSMapVerify();
7889
- #endif
8179
+ // Dispatched behavior.
8180
+ DECLARE_PRINTER(JSMap)
8181
+ DECLARE_VERIFIER(JSMap)
7890
8182
 
7891
8183
  static const int kTableOffset = JSObject::kHeaderSize;
7892
8184
  static const int kSize = kTableOffset + kPointerSize;
@@ -7908,15 +8200,9 @@ class JSWeakMap: public JSObject {
7908
8200
  // Casting.
7909
8201
  static inline JSWeakMap* cast(Object* obj);
7910
8202
 
7911
- #ifdef OBJECT_PRINT
7912
- inline void JSWeakMapPrint() {
7913
- JSWeakMapPrint(stdout);
7914
- }
7915
- void JSWeakMapPrint(FILE* out);
7916
- #endif
7917
- #ifdef DEBUG
7918
- void JSWeakMapVerify();
7919
- #endif
8203
+ // Dispatched behavior.
8204
+ DECLARE_PRINTER(JSWeakMap)
8205
+ DECLARE_VERIFIER(JSWeakMap)
7920
8206
 
7921
8207
  static const int kTableOffset = JSObject::kHeaderSize;
7922
8208
  static const int kNextOffset = kTableOffset + kPointerSize;
@@ -7945,15 +8231,9 @@ class Foreign: public HeapObject {
7945
8231
  template<typename StaticVisitor>
7946
8232
  inline void ForeignIterateBody();
7947
8233
 
7948
- #ifdef OBJECT_PRINT
7949
- inline void ForeignPrint() {
7950
- ForeignPrint(stdout);
7951
- }
7952
- void ForeignPrint(FILE* out);
7953
- #endif
7954
- #ifdef DEBUG
7955
- void ForeignVerify();
7956
- #endif
8234
+ // Dispatched behavior.
8235
+ DECLARE_PRINTER(Foreign)
8236
+ DECLARE_VERIFIER(Foreign)
7957
8237
 
7958
8238
  // Layout description.
7959
8239
 
@@ -7991,6 +8271,7 @@ class JSArray: public JSObject {
7991
8271
 
7992
8272
  // Initializes the array to a certain length.
7993
8273
  inline bool AllowsSetElementsLength();
8274
+ // Can cause GC.
7994
8275
  MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length);
7995
8276
 
7996
8277
  // Set the content of the array to the content of storage.
@@ -8004,15 +8285,8 @@ class JSArray: public JSObject {
8004
8285
  inline void EnsureSize(int minimum_size_of_backing_fixed_array);
8005
8286
 
8006
8287
  // Dispatched behavior.
8007
- #ifdef OBJECT_PRINT
8008
- inline void JSArrayPrint() {
8009
- JSArrayPrint(stdout);
8010
- }
8011
- void JSArrayPrint(FILE* out);
8012
- #endif
8013
- #ifdef DEBUG
8014
- void JSArrayVerify();
8015
- #endif
8288
+ DECLARE_PRINTER(JSArray)
8289
+ DECLARE_VERIFIER(JSArray)
8016
8290
 
8017
8291
  // Number of element slots to pre-allocate for an empty array.
8018
8292
  static const int kPreallocatedArrayElements = 4;
@@ -8066,6 +8340,7 @@ class AccessorInfo: public Struct {
8066
8340
  DECL_ACCESSORS(data, Object)
8067
8341
  DECL_ACCESSORS(name, Object)
8068
8342
  DECL_ACCESSORS(flag, Smi)
8343
+ DECL_ACCESSORS(expected_receiver_type, Object)
8069
8344
 
8070
8345
  inline bool all_can_read();
8071
8346
  inline void set_all_can_read(bool value);
@@ -8079,24 +8354,22 @@ class AccessorInfo: public Struct {
8079
8354
  inline PropertyAttributes property_attributes();
8080
8355
  inline void set_property_attributes(PropertyAttributes attributes);
8081
8356
 
8357
+ // Checks whether the given receiver is compatible with this accessor.
8358
+ inline bool IsCompatibleReceiver(Object* receiver);
8359
+
8082
8360
  static inline AccessorInfo* cast(Object* obj);
8083
8361
 
8084
- #ifdef OBJECT_PRINT
8085
- inline void AccessorInfoPrint() {
8086
- AccessorInfoPrint(stdout);
8087
- }
8088
- void AccessorInfoPrint(FILE* out);
8089
- #endif
8090
- #ifdef DEBUG
8091
- void AccessorInfoVerify();
8092
- #endif
8362
+ // Dispatched behavior.
8363
+ DECLARE_PRINTER(AccessorInfo)
8364
+ DECLARE_VERIFIER(AccessorInfo)
8093
8365
 
8094
8366
  static const int kGetterOffset = HeapObject::kHeaderSize;
8095
8367
  static const int kSetterOffset = kGetterOffset + kPointerSize;
8096
8368
  static const int kDataOffset = kSetterOffset + kPointerSize;
8097
8369
  static const int kNameOffset = kDataOffset + kPointerSize;
8098
8370
  static const int kFlagOffset = kNameOffset + kPointerSize;
8099
- static const int kSize = kFlagOffset + kPointerSize;
8371
+ static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize;
8372
+ static const int kSize = kExpectedReceiverTypeOffset + kPointerSize;
8100
8373
 
8101
8374
  private:
8102
8375
  // Bit positions in flag.
@@ -8122,7 +8395,7 @@ class AccessorPair: public Struct {
8122
8395
 
8123
8396
  static inline AccessorPair* cast(Object* obj);
8124
8397
 
8125
- MUST_USE_RESULT MaybeObject* CopyWithoutTransitions();
8398
+ MUST_USE_RESULT MaybeObject* Copy();
8126
8399
 
8127
8400
  Object* get(AccessorComponent component) {
8128
8401
  return component == ACCESSOR_GETTER ? getter() : setter();
@@ -8149,12 +8422,9 @@ class AccessorPair: public Struct {
8149
8422
  return IsJSAccessor(getter()) || IsJSAccessor(setter());
8150
8423
  }
8151
8424
 
8152
- #ifdef OBJECT_PRINT
8153
- void AccessorPairPrint(FILE* out = stdout);
8154
- #endif
8155
- #ifdef DEBUG
8156
- void AccessorPairVerify();
8157
- #endif
8425
+ // Dispatched behavior.
8426
+ DECLARE_PRINTER(AccessorPair)
8427
+ DECLARE_VERIFIER(AccessorPair)
8158
8428
 
8159
8429
  static const int kGetterOffset = HeapObject::kHeaderSize;
8160
8430
  static const int kSetterOffset = kGetterOffset + kPointerSize;
@@ -8182,15 +8452,9 @@ class AccessCheckInfo: public Struct {
8182
8452
 
8183
8453
  static inline AccessCheckInfo* cast(Object* obj);
8184
8454
 
8185
- #ifdef OBJECT_PRINT
8186
- inline void AccessCheckInfoPrint() {
8187
- AccessCheckInfoPrint(stdout);
8188
- }
8189
- void AccessCheckInfoPrint(FILE* out);
8190
- #endif
8191
- #ifdef DEBUG
8192
- void AccessCheckInfoVerify();
8193
- #endif
8455
+ // Dispatched behavior.
8456
+ DECLARE_PRINTER(AccessCheckInfo)
8457
+ DECLARE_VERIFIER(AccessCheckInfo)
8194
8458
 
8195
8459
  static const int kNamedCallbackOffset = HeapObject::kHeaderSize;
8196
8460
  static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize;
@@ -8213,15 +8477,9 @@ class InterceptorInfo: public Struct {
8213
8477
 
8214
8478
  static inline InterceptorInfo* cast(Object* obj);
8215
8479
 
8216
- #ifdef OBJECT_PRINT
8217
- inline void InterceptorInfoPrint() {
8218
- InterceptorInfoPrint(stdout);
8219
- }
8220
- void InterceptorInfoPrint(FILE* out);
8221
- #endif
8222
- #ifdef DEBUG
8223
- void InterceptorInfoVerify();
8224
- #endif
8480
+ // Dispatched behavior.
8481
+ DECLARE_PRINTER(InterceptorInfo)
8482
+ DECLARE_VERIFIER(InterceptorInfo)
8225
8483
 
8226
8484
  static const int kGetterOffset = HeapObject::kHeaderSize;
8227
8485
  static const int kSetterOffset = kGetterOffset + kPointerSize;
@@ -8243,15 +8501,9 @@ class CallHandlerInfo: public Struct {
8243
8501
 
8244
8502
  static inline CallHandlerInfo* cast(Object* obj);
8245
8503
 
8246
- #ifdef OBJECT_PRINT
8247
- inline void CallHandlerInfoPrint() {
8248
- CallHandlerInfoPrint(stdout);
8249
- }
8250
- void CallHandlerInfoPrint(FILE* out);
8251
- #endif
8252
- #ifdef DEBUG
8253
- void CallHandlerInfoVerify();
8254
- #endif
8504
+ // Dispatched behavior.
8505
+ DECLARE_PRINTER(CallHandlerInfo)
8506
+ DECLARE_VERIFIER(CallHandlerInfo)
8255
8507
 
8256
8508
  static const int kCallbackOffset = HeapObject::kHeaderSize;
8257
8509
  static const int kDataOffset = kCallbackOffset + kPointerSize;
@@ -8267,9 +8519,7 @@ class TemplateInfo: public Struct {
8267
8519
  DECL_ACCESSORS(tag, Object)
8268
8520
  DECL_ACCESSORS(property_list, Object)
8269
8521
 
8270
- #ifdef DEBUG
8271
- void TemplateInfoVerify();
8272
- #endif
8522
+ DECLARE_VERIFIER(TemplateInfo)
8273
8523
 
8274
8524
  static const int kTagOffset = HeapObject::kHeaderSize;
8275
8525
  static const int kPropertyListOffset = kTagOffset + kPointerSize;
@@ -8296,6 +8546,9 @@ class FunctionTemplateInfo: public TemplateInfo {
8296
8546
  DECL_ACCESSORS(access_check_info, Object)
8297
8547
  DECL_ACCESSORS(flag, Smi)
8298
8548
 
8549
+ inline int length();
8550
+ inline void set_length(int value);
8551
+
8299
8552
  // Following properties use flag bits.
8300
8553
  DECL_BOOLEAN_ACCESSORS(hidden_prototype)
8301
8554
  DECL_BOOLEAN_ACCESSORS(undetectable)
@@ -8306,15 +8559,9 @@ class FunctionTemplateInfo: public TemplateInfo {
8306
8559
 
8307
8560
  static inline FunctionTemplateInfo* cast(Object* obj);
8308
8561
 
8309
- #ifdef OBJECT_PRINT
8310
- inline void FunctionTemplateInfoPrint() {
8311
- FunctionTemplateInfoPrint(stdout);
8312
- }
8313
- void FunctionTemplateInfoPrint(FILE* out);
8314
- #endif
8315
- #ifdef DEBUG
8316
- void FunctionTemplateInfoVerify();
8317
- #endif
8562
+ // Dispatched behavior.
8563
+ DECLARE_PRINTER(FunctionTemplateInfo)
8564
+ DECLARE_VERIFIER(FunctionTemplateInfo)
8318
8565
 
8319
8566
  static const int kSerialNumberOffset = TemplateInfo::kHeaderSize;
8320
8567
  static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize;
@@ -8335,7 +8582,8 @@ class FunctionTemplateInfo: public TemplateInfo {
8335
8582
  static const int kAccessCheckInfoOffset =
8336
8583
  kInstanceCallHandlerOffset + kPointerSize;
8337
8584
  static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
8338
- static const int kSize = kFlagOffset + kPointerSize;
8585
+ static const int kLengthOffset = kFlagOffset + kPointerSize;
8586
+ static const int kSize = kLengthOffset + kPointerSize;
8339
8587
 
8340
8588
  private:
8341
8589
  // Bit position in the flag, from least significant bit position.
@@ -8355,15 +8603,9 @@ class ObjectTemplateInfo: public TemplateInfo {
8355
8603
 
8356
8604
  static inline ObjectTemplateInfo* cast(Object* obj);
8357
8605
 
8358
- #ifdef OBJECT_PRINT
8359
- inline void ObjectTemplateInfoPrint() {
8360
- ObjectTemplateInfoPrint(stdout);
8361
- }
8362
- void ObjectTemplateInfoPrint(FILE* out);
8363
- #endif
8364
- #ifdef DEBUG
8365
- void ObjectTemplateInfoVerify();
8366
- #endif
8606
+ // Dispatched behavior.
8607
+ DECLARE_PRINTER(ObjectTemplateInfo)
8608
+ DECLARE_VERIFIER(ObjectTemplateInfo)
8367
8609
 
8368
8610
  static const int kConstructorOffset = TemplateInfo::kHeaderSize;
8369
8611
  static const int kInternalFieldCountOffset =
@@ -8379,15 +8621,9 @@ class SignatureInfo: public Struct {
8379
8621
 
8380
8622
  static inline SignatureInfo* cast(Object* obj);
8381
8623
 
8382
- #ifdef OBJECT_PRINT
8383
- inline void SignatureInfoPrint() {
8384
- SignatureInfoPrint(stdout);
8385
- }
8386
- void SignatureInfoPrint(FILE* out);
8387
- #endif
8388
- #ifdef DEBUG
8389
- void SignatureInfoVerify();
8390
- #endif
8624
+ // Dispatched behavior.
8625
+ DECLARE_PRINTER(SignatureInfo)
8626
+ DECLARE_VERIFIER(SignatureInfo)
8391
8627
 
8392
8628
  static const int kReceiverOffset = Struct::kHeaderSize;
8393
8629
  static const int kArgsOffset = kReceiverOffset + kPointerSize;
@@ -8404,15 +8640,9 @@ class TypeSwitchInfo: public Struct {
8404
8640
 
8405
8641
  static inline TypeSwitchInfo* cast(Object* obj);
8406
8642
 
8407
- #ifdef OBJECT_PRINT
8408
- inline void TypeSwitchInfoPrint() {
8409
- TypeSwitchInfoPrint(stdout);
8410
- }
8411
- void TypeSwitchInfoPrint(FILE* out);
8412
- #endif
8413
- #ifdef DEBUG
8414
- void TypeSwitchInfoVerify();
8415
- #endif
8643
+ // Dispatched behavior.
8644
+ DECLARE_PRINTER(TypeSwitchInfo)
8645
+ DECLARE_VERIFIER(TypeSwitchInfo)
8416
8646
 
8417
8647
  static const int kTypesOffset = Struct::kHeaderSize;
8418
8648
  static const int kSize = kTypesOffset + kPointerSize;
@@ -8456,15 +8686,9 @@ class DebugInfo: public Struct {
8456
8686
 
8457
8687
  static inline DebugInfo* cast(Object* obj);
8458
8688
 
8459
- #ifdef OBJECT_PRINT
8460
- inline void DebugInfoPrint() {
8461
- DebugInfoPrint(stdout);
8462
- }
8463
- void DebugInfoPrint(FILE* out);
8464
- #endif
8465
- #ifdef DEBUG
8466
- void DebugInfoVerify();
8467
- #endif
8689
+ // Dispatched behavior.
8690
+ DECLARE_PRINTER(DebugInfo)
8691
+ DECLARE_VERIFIER(DebugInfo)
8468
8692
 
8469
8693
  static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
8470
8694
  static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize;
@@ -8514,15 +8738,9 @@ class BreakPointInfo: public Struct {
8514
8738
 
8515
8739
  static inline BreakPointInfo* cast(Object* obj);
8516
8740
 
8517
- #ifdef OBJECT_PRINT
8518
- inline void BreakPointInfoPrint() {
8519
- BreakPointInfoPrint(stdout);
8520
- }
8521
- void BreakPointInfoPrint(FILE* out);
8522
- #endif
8523
- #ifdef DEBUG
8524
- void BreakPointInfoVerify();
8525
- #endif
8741
+ // Dispatched behavior.
8742
+ DECLARE_PRINTER(BreakPointInfo)
8743
+ DECLARE_VERIFIER(BreakPointInfo)
8526
8744
 
8527
8745
  static const int kCodePositionIndex = Struct::kHeaderSize;
8528
8746
  static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize;
@@ -8540,6 +8758,7 @@ class BreakPointInfo: public Struct {
8540
8758
 
8541
8759
  #undef DECL_BOOLEAN_ACCESSORS
8542
8760
  #undef DECL_ACCESSORS
8761
+ #undef DECLARE_VERIFIER
8543
8762
 
8544
8763
  #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \
8545
8764
  V(kSymbolTable, "symbol_table", "(Symbols)") \
@@ -8604,14 +8823,16 @@ class ObjectVisitor BASE_EMBEDDED {
8604
8823
  // Visits a debug call target in the instruction stream.
8605
8824
  virtual void VisitDebugTarget(RelocInfo* rinfo);
8606
8825
 
8826
+ // Visits the byte sequence in a function's prologue that contains information
8827
+ // about the code's age.
8828
+ virtual void VisitCodeAgeSequence(RelocInfo* rinfo);
8829
+
8607
8830
  // Handy shorthand for visiting a single pointer.
8608
8831
  virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
8609
8832
 
8610
8833
  // Visit pointer embedded into a code object.
8611
8834
  virtual void VisitEmbeddedPointer(RelocInfo* rinfo);
8612
8835
 
8613
- virtual void VisitSharedFunctionInfo(SharedFunctionInfo* shared) {}
8614
-
8615
8836
  // Visits a contiguous arrays of external references (references to the C++
8616
8837
  // heap) in the half-open range [start, end). Any or all of the values
8617
8838
  // may be modified on return.