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
@@ -47,6 +47,7 @@
47
47
  #include "v8memory.h"
48
48
  #include "factory.h"
49
49
  #include "incremental-marking.h"
50
+ #include "transitions-inl.h"
50
51
 
51
52
  namespace v8 {
52
53
  namespace internal {
@@ -133,6 +134,14 @@ bool Object::IsFixedArrayBase() {
133
134
  }
134
135
 
135
136
 
137
+ // External objects are not extensible, so the map check is enough.
138
+ bool Object::IsExternal() {
139
+ return Object::IsHeapObject() &&
140
+ HeapObject::cast(this)->map() ==
141
+ HeapObject::cast(this)->GetHeap()->external_map();
142
+ }
143
+
144
+
136
145
  bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
137
146
  // There is a constraint on the object; check.
138
147
  if (!this->IsJSObject()) return false;
@@ -220,10 +229,10 @@ bool Object::IsSeqString() {
220
229
  }
221
230
 
222
231
 
223
- bool Object::IsSeqAsciiString() {
232
+ bool Object::IsSeqOneByteString() {
224
233
  if (!IsString()) return false;
225
234
  return StringShape(String::cast(this)).IsSequential() &&
226
- String::cast(this)->IsAsciiRepresentation();
235
+ String::cast(this)->IsOneByteRepresentation();
227
236
  }
228
237
 
229
238
 
@@ -243,7 +252,7 @@ bool Object::IsExternalString() {
243
252
  bool Object::IsExternalAsciiString() {
244
253
  if (!IsString()) return false;
245
254
  return StringShape(String::cast(this)).IsExternal() &&
246
- String::cast(this)->IsAsciiRepresentation();
255
+ String::cast(this)->IsOneByteRepresentation();
247
256
  }
248
257
 
249
258
 
@@ -286,9 +295,9 @@ bool StringShape::IsSymbol() {
286
295
  }
287
296
 
288
297
 
289
- bool String::IsAsciiRepresentation() {
298
+ bool String::IsOneByteRepresentation() {
290
299
  uint32_t type = map()->instance_type();
291
- return (type & kStringEncodingMask) == kAsciiStringTag;
300
+ return (type & kStringEncodingMask) == kOneByteStringTag;
292
301
  }
293
302
 
294
303
 
@@ -298,18 +307,18 @@ bool String::IsTwoByteRepresentation() {
298
307
  }
299
308
 
300
309
 
301
- bool String::IsAsciiRepresentationUnderneath() {
310
+ bool String::IsOneByteRepresentationUnderneath() {
302
311
  uint32_t type = map()->instance_type();
303
312
  STATIC_ASSERT(kIsIndirectStringTag != 0);
304
313
  STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0);
305
314
  ASSERT(IsFlat());
306
315
  switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
307
- case kAsciiStringTag:
316
+ case kOneByteStringTag:
308
317
  return true;
309
318
  case kTwoByteStringTag:
310
319
  return false;
311
320
  default: // Cons or sliced string. Need to go deeper.
312
- return GetUnderlying()->IsAsciiRepresentation();
321
+ return GetUnderlying()->IsOneByteRepresentation();
313
322
  }
314
323
  }
315
324
 
@@ -320,7 +329,7 @@ bool String::IsTwoByteRepresentationUnderneath() {
320
329
  STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0);
321
330
  ASSERT(IsFlat());
322
331
  switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
323
- case kAsciiStringTag:
332
+ case kOneByteStringTag:
324
333
  return false;
325
334
  case kTwoByteStringTag:
326
335
  return true;
@@ -332,8 +341,17 @@ bool String::IsTwoByteRepresentationUnderneath() {
332
341
 
333
342
  bool String::HasOnlyAsciiChars() {
334
343
  uint32_t type = map()->instance_type();
335
- return (type & kStringEncodingMask) == kAsciiStringTag ||
344
+ #ifndef ENABLE_LATIN_1
345
+ return (type & kStringEncodingMask) == kOneByteStringTag ||
336
346
  (type & kAsciiDataHintMask) == kAsciiDataHintTag;
347
+ #else
348
+ return (type & kAsciiDataHintMask) == kAsciiDataHintTag;
349
+ #endif
350
+ }
351
+
352
+
353
+ bool String::IsOneByteConvertible() {
354
+ return HasOnlyAsciiChars() || IsOneByteRepresentation();
337
355
  }
338
356
 
339
357
 
@@ -381,9 +399,12 @@ uint32_t StringShape::full_representation_tag() {
381
399
  STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) ==
382
400
  Internals::kFullStringRepresentationMask);
383
401
 
402
+ STATIC_CHECK(static_cast<uint32_t>(kStringEncodingMask) ==
403
+ Internals::kStringEncodingMask);
404
+
384
405
 
385
406
  bool StringShape::IsSequentialAscii() {
386
- return full_representation_tag() == (kSeqStringTag | kAsciiStringTag);
407
+ return full_representation_tag() == (kSeqStringTag | kOneByteStringTag);
387
408
  }
388
409
 
389
410
 
@@ -393,10 +414,16 @@ bool StringShape::IsSequentialTwoByte() {
393
414
 
394
415
 
395
416
  bool StringShape::IsExternalAscii() {
396
- return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
417
+ return full_representation_tag() == (kExternalStringTag | kOneByteStringTag);
397
418
  }
398
419
 
399
420
 
421
+ STATIC_CHECK((kExternalStringTag | kOneByteStringTag) ==
422
+ Internals::kExternalAsciiRepresentationTag);
423
+
424
+ STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag);
425
+
426
+
400
427
  bool StringShape::IsExternalTwoByte() {
401
428
  return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
402
429
  }
@@ -405,6 +432,7 @@ bool StringShape::IsExternalTwoByte() {
405
432
  STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
406
433
  Internals::kExternalTwoByteRepresentationTag);
407
434
 
435
+ STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag);
408
436
 
409
437
  uc32 FlatStringReader::Get(int index) {
410
438
  ASSERT(0 <= index && index <= length_);
@@ -524,6 +552,11 @@ bool Object::IsDescriptorArray() {
524
552
  }
525
553
 
526
554
 
555
+ bool Object::IsTransitionArray() {
556
+ return IsFixedArray();
557
+ }
558
+
559
+
527
560
  bool Object::IsDeoptimizationInputData() {
528
561
  // Must be a fixed array.
529
562
  if (!IsFixedArray()) return false;
@@ -551,6 +584,14 @@ bool Object::IsDeoptimizationOutputData() {
551
584
  }
552
585
 
553
586
 
587
+ bool Object::IsDependentCodes() {
588
+ if (!IsFixedArray()) return false;
589
+ // There's actually no way to see the difference between a fixed array and
590
+ // a dependent codes array.
591
+ return true;
592
+ }
593
+
594
+
554
595
  bool Object::IsTypeFeedbackCells() {
555
596
  if (!IsFixedArray()) return false;
556
597
  // There's actually no way to see the difference between a fixed array and
@@ -562,31 +603,23 @@ bool Object::IsTypeFeedbackCells() {
562
603
 
563
604
 
564
605
  bool Object::IsContext() {
565
- if (Object::IsHeapObject()) {
566
- Map* map = HeapObject::cast(this)->map();
567
- Heap* heap = map->GetHeap();
568
- return (map == heap->function_context_map() ||
569
- map == heap->catch_context_map() ||
570
- map == heap->with_context_map() ||
571
- map == heap->global_context_map() ||
572
- map == heap->block_context_map() ||
573
- map == heap->module_context_map());
574
- }
575
- return false;
576
- }
577
-
578
-
579
- bool Object::IsGlobalContext() {
580
- return Object::IsHeapObject() &&
581
- HeapObject::cast(this)->map() ==
582
- HeapObject::cast(this)->GetHeap()->global_context_map();
606
+ if (!Object::IsHeapObject()) return false;
607
+ Map* map = HeapObject::cast(this)->map();
608
+ Heap* heap = map->GetHeap();
609
+ return (map == heap->function_context_map() ||
610
+ map == heap->catch_context_map() ||
611
+ map == heap->with_context_map() ||
612
+ map == heap->native_context_map() ||
613
+ map == heap->block_context_map() ||
614
+ map == heap->module_context_map() ||
615
+ map == heap->global_context_map());
583
616
  }
584
617
 
585
618
 
586
- bool Object::IsModuleContext() {
619
+ bool Object::IsNativeContext() {
587
620
  return Object::IsHeapObject() &&
588
621
  HeapObject::cast(this)->map() ==
589
- HeapObject::cast(this)->GetHeap()->module_context_map();
622
+ HeapObject::cast(this)->GetHeap()->native_context_map();
590
623
  }
591
624
 
592
625
 
@@ -652,8 +685,8 @@ bool Object::IsDictionary() {
652
685
 
653
686
 
654
687
  bool Object::IsSymbolTable() {
655
- return IsHashTable() && this ==
656
- HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table();
688
+ return IsHashTable() &&
689
+ this == HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table();
657
690
  }
658
691
 
659
692
 
@@ -666,7 +699,7 @@ bool Object::IsJSFunctionResultCache() {
666
699
  % JSFunctionResultCache::kEntrySize != 0) {
667
700
  return false;
668
701
  }
669
- #ifdef DEBUG
702
+ #ifdef VERIFY_HEAP
670
703
  if (FLAG_verify_heap) {
671
704
  reinterpret_cast<JSFunctionResultCache*>(this)->
672
705
  JSFunctionResultCacheVerify();
@@ -681,7 +714,7 @@ bool Object::IsNormalizedMapCache() {
681
714
  if (FixedArray::cast(this)->length() != NormalizedMapCache::kEntries) {
682
715
  return false;
683
716
  }
684
- #ifdef DEBUG
717
+ #ifdef VERIFY_HEAP
685
718
  if (FLAG_verify_heap) {
686
719
  reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
687
720
  }
@@ -710,6 +743,11 @@ bool Object::IsMapCache() {
710
743
  }
711
744
 
712
745
 
746
+ bool Object::IsObjectHashTable() {
747
+ return IsHashTable();
748
+ }
749
+
750
+
713
751
  bool Object::IsPrimitive() {
714
752
  return IsOddball() || IsNumber() || IsString();
715
753
  }
@@ -1018,8 +1056,8 @@ Failure* Failure::Exception() {
1018
1056
  }
1019
1057
 
1020
1058
 
1021
- Failure* Failure::OutOfMemoryException() {
1022
- return Construct(OUT_OF_MEMORY_EXCEPTION);
1059
+ Failure* Failure::OutOfMemoryException(intptr_t value) {
1060
+ return Construct(OUT_OF_MEMORY_EXCEPTION, value);
1023
1061
  }
1024
1062
 
1025
1063
 
@@ -1044,7 +1082,11 @@ Failure* Failure::Construct(Type type, intptr_t value) {
1044
1082
  uintptr_t info =
1045
1083
  (static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type;
1046
1084
  ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
1047
- return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag);
1085
+ // Fill the unused bits with a pattern that's easy to recognize in crash
1086
+ // dumps.
1087
+ static const int kFailureMagicPattern = 0x0BAD0000;
1088
+ return reinterpret_cast<Failure*>(
1089
+ (info << kFailureTagSize) | kFailureTag | kFailureMagicPattern);
1048
1090
  }
1049
1091
 
1050
1092
 
@@ -1102,13 +1144,13 @@ HeapObject* MapWord::ToForwardingAddress() {
1102
1144
  }
1103
1145
 
1104
1146
 
1105
- #ifdef DEBUG
1147
+ #ifdef VERIFY_HEAP
1106
1148
  void HeapObject::VerifyObjectField(int offset) {
1107
1149
  VerifyPointer(READ_FIELD(this, offset));
1108
1150
  }
1109
1151
 
1110
1152
  void HeapObject::VerifySmiField(int offset) {
1111
- ASSERT(READ_FIELD(this, offset)->IsSmi());
1153
+ CHECK(READ_FIELD(this, offset)->IsSmi());
1112
1154
  }
1113
1155
  #endif
1114
1156
 
@@ -1267,30 +1309,25 @@ MaybeObject* JSObject::EnsureCanContainElements(Object** objects,
1267
1309
  if (current_kind == FAST_HOLEY_ELEMENTS) return this;
1268
1310
  Heap* heap = GetHeap();
1269
1311
  Object* the_hole = heap->the_hole_value();
1270
- Object* heap_number_map = heap->heap_number_map();
1271
1312
  for (uint32_t i = 0; i < count; ++i) {
1272
1313
  Object* current = *objects++;
1273
1314
  if (current == the_hole) {
1274
1315
  is_holey = true;
1275
1316
  target_kind = GetHoleyElementsKind(target_kind);
1276
1317
  } else if (!current->IsSmi()) {
1277
- if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS &&
1278
- HeapObject::cast(current)->map() == heap_number_map &&
1279
- IsFastSmiElementsKind(target_kind)) {
1280
- if (is_holey) {
1281
- target_kind = FAST_HOLEY_DOUBLE_ELEMENTS;
1282
- } else {
1283
- target_kind = FAST_DOUBLE_ELEMENTS;
1284
- }
1285
- } else {
1286
- if (!current->IsNumber()) {
1318
+ if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) {
1319
+ if (IsFastSmiElementsKind(target_kind)) {
1287
1320
  if (is_holey) {
1288
- target_kind = FAST_HOLEY_ELEMENTS;
1289
- break;
1321
+ target_kind = FAST_HOLEY_DOUBLE_ELEMENTS;
1290
1322
  } else {
1291
- target_kind = FAST_ELEMENTS;
1323
+ target_kind = FAST_DOUBLE_ELEMENTS;
1292
1324
  }
1293
1325
  }
1326
+ } else if (is_holey) {
1327
+ target_kind = FAST_HOLEY_ELEMENTS;
1328
+ break;
1329
+ } else {
1330
+ target_kind = FAST_ELEMENTS;
1294
1331
  }
1295
1332
  }
1296
1333
  }
@@ -1338,8 +1375,8 @@ MaybeObject* JSObject::GetElementsTransitionMap(Isolate* isolate,
1338
1375
  ElementsKind from_kind = current_map->elements_kind();
1339
1376
  if (from_kind == to_kind) return current_map;
1340
1377
 
1341
- Context* global_context = isolate->context()->global_context();
1342
- Object* maybe_array_maps = global_context->js_array_maps();
1378
+ Context* native_context = isolate->context()->native_context();
1379
+ Object* maybe_array_maps = native_context->js_array_maps();
1343
1380
  if (maybe_array_maps->IsFixedArray()) {
1344
1381
  FixedArray* array_maps = FixedArray::cast(maybe_array_maps);
1345
1382
  if (array_maps->get(from_kind) == current_map) {
@@ -1397,20 +1434,70 @@ void JSObject::initialize_elements() {
1397
1434
 
1398
1435
 
1399
1436
  MaybeObject* JSObject::ResetElements() {
1400
- Object* obj;
1437
+ if (map()->is_observed()) {
1438
+ // Maintain invariant that observed elements are always in dictionary mode.
1439
+ SeededNumberDictionary* dictionary;
1440
+ MaybeObject* maybe = SeededNumberDictionary::Allocate(0);
1441
+ if (!maybe->To(&dictionary)) return maybe;
1442
+ if (map() == GetHeap()->non_strict_arguments_elements_map()) {
1443
+ FixedArray::cast(elements())->set(1, dictionary);
1444
+ } else {
1445
+ set_elements(dictionary);
1446
+ }
1447
+ return this;
1448
+ }
1449
+
1401
1450
  ElementsKind elements_kind = GetInitialFastElementsKind();
1402
1451
  if (!FLAG_smi_only_arrays) {
1403
1452
  elements_kind = FastSmiToObjectElementsKind(elements_kind);
1404
1453
  }
1405
- MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(),
1406
- elements_kind);
1407
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1408
- set_map(Map::cast(obj));
1454
+ MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind);
1455
+ Map* map;
1456
+ if (!maybe->To(&map)) return maybe;
1457
+ set_map(map);
1409
1458
  initialize_elements();
1459
+
1410
1460
  return this;
1411
1461
  }
1412
1462
 
1413
1463
 
1464
+ MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) {
1465
+ ASSERT(this->map()->NumberOfOwnDescriptors() + 1 ==
1466
+ map->NumberOfOwnDescriptors());
1467
+ if (this->map()->unused_property_fields() == 0) {
1468
+ int new_size = properties()->length() + map->unused_property_fields() + 1;
1469
+ FixedArray* new_properties;
1470
+ MaybeObject* maybe_properties = properties()->CopySize(new_size);
1471
+ if (!maybe_properties->To(&new_properties)) return maybe_properties;
1472
+ set_properties(new_properties);
1473
+ }
1474
+ set_map(map);
1475
+ return this;
1476
+ }
1477
+
1478
+
1479
+ bool JSObject::TryTransitionToField(Handle<JSObject> object,
1480
+ Handle<String> key) {
1481
+ if (!object->map()->HasTransitionArray()) return false;
1482
+ Handle<TransitionArray> transitions(object->map()->transitions());
1483
+ int transition = transitions->Search(*key);
1484
+ if (transition == TransitionArray::kNotFound) return false;
1485
+ PropertyDetails target_details = transitions->GetTargetDetails(transition);
1486
+ if (target_details.type() != FIELD) return false;
1487
+ if (target_details.attributes() != NONE) return false;
1488
+ Handle<Map> target(transitions->GetTarget(transition));
1489
+ JSObject::AddFastPropertyUsingMap(object, target);
1490
+ return true;
1491
+ }
1492
+
1493
+
1494
+ int JSObject::LastAddedFieldIndex() {
1495
+ Map* map = this->map();
1496
+ int last_added = map->LastAdded();
1497
+ return map->instance_descriptors()->GetFieldIndex(last_added);
1498
+ }
1499
+
1500
+
1414
1501
  ACCESSORS(Oddball, to_string, String, kToStringOffset)
1415
1502
  ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
1416
1503
 
@@ -1607,17 +1694,27 @@ void JSObject::InitializeBody(Map* map,
1607
1694
 
1608
1695
 
1609
1696
  bool JSObject::HasFastProperties() {
1697
+ ASSERT(properties()->IsDictionary() == map()->is_dictionary_map());
1610
1698
  return !properties()->IsDictionary();
1611
1699
  }
1612
1700
 
1613
1701
 
1614
- int JSObject::MaxFastProperties() {
1702
+ bool JSObject::TooManyFastProperties(int properties,
1703
+ JSObject::StoreFromKeyed store_mode) {
1615
1704
  // Allow extra fast properties if the object has more than
1616
- // kMaxFastProperties in-object properties. When this is the case,
1705
+ // kFastPropertiesSoftLimit in-object properties. When this is the case,
1617
1706
  // it is very unlikely that the object is being used as a dictionary
1618
1707
  // and there is a good chance that allowing more map transitions
1619
1708
  // will be worth it.
1620
- return Max(map()->inobject_properties(), kMaxFastProperties);
1709
+ int inobject = map()->inobject_properties();
1710
+
1711
+ int limit;
1712
+ if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) {
1713
+ limit = Max(inobject, kMaxFastProperties);
1714
+ } else {
1715
+ limit = Max(inobject, kFastPropertiesSoftLimit);
1716
+ }
1717
+ return properties > limit;
1621
1718
  }
1622
1719
 
1623
1720
 
@@ -1655,12 +1752,29 @@ bool Object::IsStringObjectWithCharacterAt(uint32_t index) {
1655
1752
  if (!js_value->value()->IsString()) return false;
1656
1753
 
1657
1754
  String* str = String::cast(js_value->value());
1658
- if (index >= (uint32_t)str->length()) return false;
1755
+ if (index >= static_cast<uint32_t>(str->length())) return false;
1659
1756
 
1660
1757
  return true;
1661
1758
  }
1662
1759
 
1663
1760
 
1761
+
1762
+ void Object::VerifyApiCallResultType() {
1763
+ #if ENABLE_EXTRA_CHECKS
1764
+ if (!(IsSmi() ||
1765
+ IsString() ||
1766
+ IsSpecObject() ||
1767
+ IsHeapNumber() ||
1768
+ IsUndefined() ||
1769
+ IsTrue() ||
1770
+ IsFalse() ||
1771
+ IsNull())) {
1772
+ FATAL("API call returned invalid object");
1773
+ }
1774
+ #endif // ENABLE_EXTRA_CHECKS
1775
+ }
1776
+
1777
+
1664
1778
  FixedArrayBase* FixedArrayBase::cast(Object* object) {
1665
1779
  ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray());
1666
1780
  return reinterpret_cast<FixedArrayBase*>(object);
@@ -1783,7 +1897,7 @@ void FixedArray::set(int index,
1783
1897
  void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array,
1784
1898
  int index,
1785
1899
  Object* value) {
1786
- ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
1900
+ ASSERT(array->map() != HEAP->fixed_cow_array_map());
1787
1901
  ASSERT(index >= 0 && index < array->length());
1788
1902
  int offset = kHeaderSize + index * kPointerSize;
1789
1903
  WRITE_FIELD(array, offset, value);
@@ -1797,7 +1911,7 @@ void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array,
1797
1911
  void FixedArray::NoWriteBarrierSet(FixedArray* array,
1798
1912
  int index,
1799
1913
  Object* value) {
1800
- ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
1914
+ ASSERT(array->map() != HEAP->fixed_cow_array_map());
1801
1915
  ASSERT(index >= 0 && index < array->length());
1802
1916
  ASSERT(!HEAP->InNewSpace(value));
1803
1917
  WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
@@ -1859,93 +1973,224 @@ void FixedArray::set_unchecked(Heap* heap,
1859
1973
 
1860
1974
  void FixedArray::set_null_unchecked(Heap* heap, int index) {
1861
1975
  ASSERT(index >= 0 && index < this->length());
1862
- ASSERT(!HEAP->InNewSpace(heap->null_value()));
1976
+ ASSERT(!heap->InNewSpace(heap->null_value()));
1863
1977
  WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value());
1864
1978
  }
1865
1979
 
1866
1980
 
1981
+ double* FixedDoubleArray::data_start() {
1982
+ return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
1983
+ }
1984
+
1985
+
1867
1986
  Object** FixedArray::data_start() {
1868
1987
  return HeapObject::RawField(this, kHeaderSize);
1869
1988
  }
1870
1989
 
1871
1990
 
1872
1991
  bool DescriptorArray::IsEmpty() {
1873
- ASSERT(this->IsSmi() ||
1874
- this->length() > kFirstIndex ||
1992
+ ASSERT(length() >= kFirstIndex ||
1875
1993
  this == HEAP->empty_descriptor_array());
1876
- return this->IsSmi() || length() <= kFirstIndex;
1994
+ return length() < kFirstIndex;
1877
1995
  }
1878
1996
 
1879
1997
 
1880
- int DescriptorArray::bit_field3_storage() {
1881
- Object* storage = READ_FIELD(this, kBitField3StorageOffset);
1882
- return Smi::cast(storage)->value();
1998
+ void DescriptorArray::SetNumberOfDescriptors(int number_of_descriptors) {
1999
+ WRITE_FIELD(
2000
+ this, kDescriptorLengthOffset, Smi::FromInt(number_of_descriptors));
1883
2001
  }
1884
2002
 
1885
- void DescriptorArray::set_bit_field3_storage(int value) {
1886
- ASSERT(!IsEmpty());
1887
- WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value));
2003
+
2004
+ // Perform a binary search in a fixed array. Low and high are entry indices. If
2005
+ // there are three entries in this array it should be called with low=0 and
2006
+ // high=2.
2007
+ template<SearchMode search_mode, typename T>
2008
+ int BinarySearch(T* array, String* name, int low, int high, int valid_entries) {
2009
+ uint32_t hash = name->Hash();
2010
+ int limit = high;
2011
+
2012
+ ASSERT(low <= high);
2013
+
2014
+ while (low != high) {
2015
+ int mid = (low + high) / 2;
2016
+ String* mid_name = array->GetSortedKey(mid);
2017
+ uint32_t mid_hash = mid_name->Hash();
2018
+
2019
+ if (mid_hash >= hash) {
2020
+ high = mid;
2021
+ } else {
2022
+ low = mid + 1;
2023
+ }
2024
+ }
2025
+
2026
+ for (; low <= limit; ++low) {
2027
+ int sort_index = array->GetSortedKeyIndex(low);
2028
+ String* entry = array->GetKey(sort_index);
2029
+ if (entry->Hash() != hash) break;
2030
+ if (entry->Equals(name)) {
2031
+ if (search_mode == ALL_ENTRIES || sort_index < valid_entries) {
2032
+ return sort_index;
2033
+ }
2034
+ return T::kNotFound;
2035
+ }
2036
+ }
2037
+
2038
+ return T::kNotFound;
1888
2039
  }
1889
2040
 
1890
2041
 
1891
- void DescriptorArray::NoIncrementalWriteBarrierSwap(FixedArray* array,
1892
- int first,
1893
- int second) {
1894
- Object* tmp = array->get(first);
1895
- NoIncrementalWriteBarrierSet(array, first, array->get(second));
1896
- NoIncrementalWriteBarrierSet(array, second, tmp);
2042
+ // Perform a linear search in this fixed array. len is the number of entry
2043
+ // indices that are valid.
2044
+ template<SearchMode search_mode, typename T>
2045
+ int LinearSearch(T* array, String* name, int len, int valid_entries) {
2046
+ uint32_t hash = name->Hash();
2047
+ if (search_mode == ALL_ENTRIES) {
2048
+ for (int number = 0; number < len; number++) {
2049
+ int sorted_index = array->GetSortedKeyIndex(number);
2050
+ String* entry = array->GetKey(sorted_index);
2051
+ uint32_t current_hash = entry->Hash();
2052
+ if (current_hash > hash) break;
2053
+ if (current_hash == hash && entry->Equals(name)) return sorted_index;
2054
+ }
2055
+ } else {
2056
+ ASSERT(len >= valid_entries);
2057
+ for (int number = 0; number < valid_entries; number++) {
2058
+ String* entry = array->GetKey(number);
2059
+ uint32_t current_hash = entry->Hash();
2060
+ if (current_hash == hash && entry->Equals(name)) return number;
2061
+ }
2062
+ }
2063
+ return T::kNotFound;
1897
2064
  }
1898
2065
 
1899
2066
 
1900
- int DescriptorArray::Search(String* name) {
1901
- SLOW_ASSERT(IsSortedNoDuplicates());
2067
+ template<SearchMode search_mode, typename T>
2068
+ int Search(T* array, String* name, int valid_entries) {
2069
+ if (search_mode == VALID_ENTRIES) {
2070
+ SLOW_ASSERT(array->IsSortedNoDuplicates(valid_entries));
2071
+ } else {
2072
+ SLOW_ASSERT(array->IsSortedNoDuplicates());
2073
+ }
1902
2074
 
1903
- // Check for empty descriptor array.
1904
- int nof = number_of_descriptors();
1905
- if (nof == 0) return kNotFound;
2075
+ int nof = array->number_of_entries();
2076
+ if (nof == 0) return T::kNotFound;
1906
2077
 
1907
2078
  // Fast case: do linear search for small arrays.
1908
2079
  const int kMaxElementsForLinearSearch = 8;
1909
- if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) {
1910
- return LinearSearch(name, nof);
2080
+ if ((search_mode == ALL_ENTRIES &&
2081
+ nof <= kMaxElementsForLinearSearch) ||
2082
+ (search_mode == VALID_ENTRIES &&
2083
+ valid_entries <= (kMaxElementsForLinearSearch * 3))) {
2084
+ return LinearSearch<search_mode>(array, name, nof, valid_entries);
1911
2085
  }
1912
2086
 
1913
2087
  // Slow case: perform binary search.
1914
- return BinarySearch(name, 0, nof - 1);
2088
+ return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries);
2089
+ }
2090
+
2091
+
2092
+ int DescriptorArray::Search(String* name, int valid_descriptors) {
2093
+ return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors);
1915
2094
  }
1916
2095
 
1917
2096
 
1918
- int DescriptorArray::SearchWithCache(String* name) {
1919
- int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name);
2097
+ int DescriptorArray::SearchWithCache(String* name, Map* map) {
2098
+ int number_of_own_descriptors = map->NumberOfOwnDescriptors();
2099
+ if (number_of_own_descriptors == 0) return kNotFound;
2100
+
2101
+ DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache();
2102
+ int number = cache->Lookup(map, name);
2103
+
1920
2104
  if (number == DescriptorLookupCache::kAbsent) {
1921
- number = Search(name);
1922
- GetIsolate()->descriptor_lookup_cache()->Update(this, name, number);
2105
+ number = Search(name, number_of_own_descriptors);
2106
+ cache->Update(map, name, number);
1923
2107
  }
2108
+
1924
2109
  return number;
1925
2110
  }
1926
2111
 
1927
2112
 
2113
+ void Map::LookupDescriptor(JSObject* holder,
2114
+ String* name,
2115
+ LookupResult* result) {
2116
+ DescriptorArray* descriptors = this->instance_descriptors();
2117
+ int number = descriptors->SearchWithCache(name, this);
2118
+ if (number == DescriptorArray::kNotFound) return result->NotFound();
2119
+ result->DescriptorResult(holder, descriptors->GetDetails(number), number);
2120
+ }
2121
+
2122
+
2123
+ void Map::LookupTransition(JSObject* holder,
2124
+ String* name,
2125
+ LookupResult* result) {
2126
+ if (HasTransitionArray()) {
2127
+ TransitionArray* transition_array = transitions();
2128
+ int number = transition_array->Search(name);
2129
+ if (number != TransitionArray::kNotFound) {
2130
+ return result->TransitionResult(holder, number);
2131
+ }
2132
+ }
2133
+ result->NotFound();
2134
+ }
2135
+
2136
+
2137
+ Object** DescriptorArray::GetKeySlot(int descriptor_number) {
2138
+ ASSERT(descriptor_number < number_of_descriptors());
2139
+ return HeapObject::RawField(
2140
+ reinterpret_cast<HeapObject*>(this),
2141
+ OffsetOfElementAt(ToKeyIndex(descriptor_number)));
2142
+ }
2143
+
2144
+
2145
+ Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) {
2146
+ return GetKeySlot(descriptor_number);
2147
+ }
2148
+
2149
+
2150
+ Object** DescriptorArray::GetDescriptorEndSlot(int descriptor_number) {
2151
+ return GetValueSlot(descriptor_number - 1) + 1;
2152
+ }
2153
+
2154
+
1928
2155
  String* DescriptorArray::GetKey(int descriptor_number) {
1929
2156
  ASSERT(descriptor_number < number_of_descriptors());
1930
2157
  return String::cast(get(ToKeyIndex(descriptor_number)));
1931
2158
  }
1932
2159
 
1933
2160
 
2161
+ int DescriptorArray::GetSortedKeyIndex(int descriptor_number) {
2162
+ return GetDetails(descriptor_number).pointer();
2163
+ }
2164
+
2165
+
2166
+ String* DescriptorArray::GetSortedKey(int descriptor_number) {
2167
+ return GetKey(GetSortedKeyIndex(descriptor_number));
2168
+ }
2169
+
2170
+
2171
+ void DescriptorArray::SetSortedKey(int descriptor_index, int pointer) {
2172
+ PropertyDetails details = GetDetails(descriptor_index);
2173
+ set(ToDetailsIndex(descriptor_index), details.set_pointer(pointer).AsSmi());
2174
+ }
2175
+
2176
+
1934
2177
  Object** DescriptorArray::GetValueSlot(int descriptor_number) {
1935
2178
  ASSERT(descriptor_number < number_of_descriptors());
1936
- return GetContentArray()->data_start() + ToValueIndex(descriptor_number);
2179
+ return HeapObject::RawField(
2180
+ reinterpret_cast<HeapObject*>(this),
2181
+ OffsetOfElementAt(ToValueIndex(descriptor_number)));
1937
2182
  }
1938
2183
 
1939
2184
 
1940
2185
  Object* DescriptorArray::GetValue(int descriptor_number) {
1941
2186
  ASSERT(descriptor_number < number_of_descriptors());
1942
- return GetContentArray()->get(ToValueIndex(descriptor_number));
2187
+ return get(ToValueIndex(descriptor_number));
1943
2188
  }
1944
2189
 
1945
2190
 
1946
2191
  PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
1947
2192
  ASSERT(descriptor_number < number_of_descriptors());
1948
- Object* details = GetContentArray()->get(ToDetailsIndex(descriptor_number));
2193
+ Object* details = get(ToDetailsIndex(descriptor_number));
1949
2194
  return PropertyDetails(Smi::cast(details));
1950
2195
  }
1951
2196
 
@@ -1978,42 +2223,6 @@ AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
1978
2223
  }
1979
2224
 
1980
2225
 
1981
- bool DescriptorArray::IsProperty(int descriptor_number) {
1982
- Entry entry(this, descriptor_number);
1983
- return IsPropertyDescriptor(&entry);
1984
- }
1985
-
1986
-
1987
- bool DescriptorArray::IsTransitionOnly(int descriptor_number) {
1988
- switch (GetType(descriptor_number)) {
1989
- case MAP_TRANSITION:
1990
- case CONSTANT_TRANSITION:
1991
- case ELEMENTS_TRANSITION:
1992
- return true;
1993
- case CALLBACKS: {
1994
- Object* value = GetValue(descriptor_number);
1995
- if (!value->IsAccessorPair()) return false;
1996
- AccessorPair* accessors = AccessorPair::cast(value);
1997
- return accessors->getter()->IsMap() && accessors->setter()->IsMap();
1998
- }
1999
- case NORMAL:
2000
- case FIELD:
2001
- case CONSTANT_FUNCTION:
2002
- case HANDLER:
2003
- case INTERCEPTOR:
2004
- case NULL_DESCRIPTOR:
2005
- return false;
2006
- }
2007
- UNREACHABLE(); // Keep the compiler happy.
2008
- return false;
2009
- }
2010
-
2011
-
2012
- bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
2013
- return GetType(descriptor_number) == NULL_DESCRIPTOR;
2014
- }
2015
-
2016
-
2017
2226
  void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
2018
2227
  desc->Init(GetKey(descriptor_number),
2019
2228
  GetValue(descriptor_number),
@@ -2026,40 +2235,89 @@ void DescriptorArray::Set(int descriptor_number,
2026
2235
  const WhitenessWitness&) {
2027
2236
  // Range check.
2028
2237
  ASSERT(descriptor_number < number_of_descriptors());
2238
+ ASSERT(desc->GetDetails().descriptor_index() <=
2239
+ number_of_descriptors());
2240
+ ASSERT(desc->GetDetails().descriptor_index() > 0);
2029
2241
 
2030
2242
  NoIncrementalWriteBarrierSet(this,
2031
2243
  ToKeyIndex(descriptor_number),
2032
2244
  desc->GetKey());
2033
- FixedArray* content_array = GetContentArray();
2034
- NoIncrementalWriteBarrierSet(content_array,
2245
+ NoIncrementalWriteBarrierSet(this,
2035
2246
  ToValueIndex(descriptor_number),
2036
2247
  desc->GetValue());
2037
- NoIncrementalWriteBarrierSet(content_array,
2248
+ NoIncrementalWriteBarrierSet(this,
2038
2249
  ToDetailsIndex(descriptor_number),
2039
2250
  desc->GetDetails().AsSmi());
2040
2251
  }
2041
2252
 
2042
2253
 
2043
- void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors(
2044
- int first, int second) {
2045
- NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second));
2046
- FixedArray* content_array = GetContentArray();
2047
- NoIncrementalWriteBarrierSwap(content_array,
2048
- ToValueIndex(first),
2049
- ToValueIndex(second));
2050
- NoIncrementalWriteBarrierSwap(content_array,
2051
- ToDetailsIndex(first),
2052
- ToDetailsIndex(second));
2254
+ void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
2255
+ // Range check.
2256
+ ASSERT(descriptor_number < number_of_descriptors());
2257
+ ASSERT(desc->GetDetails().descriptor_index() <=
2258
+ number_of_descriptors());
2259
+ ASSERT(desc->GetDetails().descriptor_index() > 0);
2260
+
2261
+ set(ToKeyIndex(descriptor_number), desc->GetKey());
2262
+ set(ToValueIndex(descriptor_number), desc->GetValue());
2263
+ set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi());
2264
+ }
2265
+
2266
+
2267
+ void DescriptorArray::Append(Descriptor* desc,
2268
+ const WhitenessWitness& witness) {
2269
+ int descriptor_number = number_of_descriptors();
2270
+ int enumeration_index = descriptor_number + 1;
2271
+ SetNumberOfDescriptors(descriptor_number + 1);
2272
+ desc->SetEnumerationIndex(enumeration_index);
2273
+ Set(descriptor_number, desc, witness);
2274
+
2275
+ uint32_t hash = desc->GetKey()->Hash();
2276
+
2277
+ int insertion;
2278
+
2279
+ for (insertion = descriptor_number; insertion > 0; --insertion) {
2280
+ String* key = GetSortedKey(insertion - 1);
2281
+ if (key->Hash() <= hash) break;
2282
+ SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1));
2283
+ }
2284
+
2285
+ SetSortedKey(insertion, descriptor_number);
2286
+ }
2287
+
2288
+
2289
+ void DescriptorArray::Append(Descriptor* desc) {
2290
+ int descriptor_number = number_of_descriptors();
2291
+ int enumeration_index = descriptor_number + 1;
2292
+ SetNumberOfDescriptors(descriptor_number + 1);
2293
+ desc->SetEnumerationIndex(enumeration_index);
2294
+ Set(descriptor_number, desc);
2295
+
2296
+ uint32_t hash = desc->GetKey()->Hash();
2297
+
2298
+ int insertion;
2299
+
2300
+ for (insertion = descriptor_number; insertion > 0; --insertion) {
2301
+ String* key = GetSortedKey(insertion - 1);
2302
+ if (key->Hash() <= hash) break;
2303
+ SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1));
2304
+ }
2305
+
2306
+ SetSortedKey(insertion, descriptor_number);
2307
+ }
2308
+
2309
+
2310
+ void DescriptorArray::SwapSortedKeys(int first, int second) {
2311
+ int first_key = GetSortedKeyIndex(first);
2312
+ SetSortedKey(first, GetSortedKeyIndex(second));
2313
+ SetSortedKey(second, first_key);
2053
2314
  }
2054
2315
 
2055
2316
 
2056
- DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array)
2317
+ DescriptorArray::WhitenessWitness::WhitenessWitness(FixedArray* array)
2057
2318
  : marking_(array->GetHeap()->incremental_marking()) {
2058
2319
  marking_->EnterNoMarkingScope();
2059
- if (array->number_of_descriptors() > 0) {
2060
- ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT);
2061
- ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT);
2062
- }
2320
+ ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT);
2063
2321
  }
2064
2322
 
2065
2323
 
@@ -2094,7 +2352,8 @@ int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
2094
2352
  // EnsureCapacity will guarantee the hash table is never full.
2095
2353
  while (true) {
2096
2354
  Object* element = KeyAt(entry);
2097
- // Empty entry.
2355
+ // Empty entry. Uses raw unchecked accessors because it is called by the
2356
+ // symbol table during bootstrapping.
2098
2357
  if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
2099
2358
  if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
2100
2359
  Shape::IsMatch(key, element)) return entry;
@@ -2133,6 +2392,7 @@ CAST_ACCESSOR(FixedDoubleArray)
2133
2392
  CAST_ACCESSOR(DescriptorArray)
2134
2393
  CAST_ACCESSOR(DeoptimizationInputData)
2135
2394
  CAST_ACCESSOR(DeoptimizationOutputData)
2395
+ CAST_ACCESSOR(DependentCodes)
2136
2396
  CAST_ACCESSOR(TypeFeedbackCells)
2137
2397
  CAST_ACCESSOR(SymbolTable)
2138
2398
  CAST_ACCESSOR(JSFunctionResultCache)
@@ -2144,7 +2404,7 @@ CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
2144
2404
  CAST_ACCESSOR(MapCache)
2145
2405
  CAST_ACCESSOR(String)
2146
2406
  CAST_ACCESSOR(SeqString)
2147
- CAST_ACCESSOR(SeqAsciiString)
2407
+ CAST_ACCESSOR(SeqOneByteString)
2148
2408
  CAST_ACCESSOR(SeqTwoByteString)
2149
2409
  CAST_ACCESSOR(SlicedString)
2150
2410
  CAST_ACCESSOR(ConsString)
@@ -2248,18 +2508,18 @@ String* String::TryFlattenGetString(PretenureFlag pretenure) {
2248
2508
  uint16_t String::Get(int index) {
2249
2509
  ASSERT(index >= 0 && index < length());
2250
2510
  switch (StringShape(this).full_representation_tag()) {
2251
- case kSeqStringTag | kAsciiStringTag:
2252
- return SeqAsciiString::cast(this)->SeqAsciiStringGet(index);
2511
+ case kSeqStringTag | kOneByteStringTag:
2512
+ return SeqOneByteString::cast(this)->SeqOneByteStringGet(index);
2253
2513
  case kSeqStringTag | kTwoByteStringTag:
2254
2514
  return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index);
2255
- case kConsStringTag | kAsciiStringTag:
2515
+ case kConsStringTag | kOneByteStringTag:
2256
2516
  case kConsStringTag | kTwoByteStringTag:
2257
2517
  return ConsString::cast(this)->ConsStringGet(index);
2258
- case kExternalStringTag | kAsciiStringTag:
2518
+ case kExternalStringTag | kOneByteStringTag:
2259
2519
  return ExternalAsciiString::cast(this)->ExternalAsciiStringGet(index);
2260
2520
  case kExternalStringTag | kTwoByteStringTag:
2261
2521
  return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index);
2262
- case kSlicedStringTag | kAsciiStringTag:
2522
+ case kSlicedStringTag | kOneByteStringTag:
2263
2523
  case kSlicedStringTag | kTwoByteStringTag:
2264
2524
  return SlicedString::cast(this)->SlicedStringGet(index);
2265
2525
  default:
@@ -2275,8 +2535,8 @@ void String::Set(int index, uint16_t value) {
2275
2535
  ASSERT(index >= 0 && index < length());
2276
2536
  ASSERT(StringShape(this).IsSequential());
2277
2537
 
2278
- return this->IsAsciiRepresentation()
2279
- ? SeqAsciiString::cast(this)->SeqAsciiStringSet(index, value)
2538
+ return this->IsOneByteRepresentation()
2539
+ ? SeqOneByteString::cast(this)->SeqOneByteStringSet(index, value)
2280
2540
  : SeqTwoByteString::cast(this)->SeqTwoByteStringSet(index, value);
2281
2541
  }
2282
2542
 
@@ -2298,26 +2558,90 @@ String* String::GetUnderlying() {
2298
2558
  }
2299
2559
 
2300
2560
 
2301
- uint16_t SeqAsciiString::SeqAsciiStringGet(int index) {
2561
+ template<class Visitor, class ConsOp>
2562
+ void String::Visit(
2563
+ String* string,
2564
+ unsigned offset,
2565
+ Visitor& visitor,
2566
+ ConsOp& cons_op,
2567
+ int32_t type,
2568
+ unsigned length) {
2569
+ ASSERT(length == static_cast<unsigned>(string->length()));
2570
+ ASSERT(offset <= length);
2571
+ unsigned slice_offset = offset;
2572
+ while (true) {
2573
+ ASSERT(type == string->map()->instance_type());
2574
+
2575
+ switch (type & (kStringRepresentationMask | kStringEncodingMask)) {
2576
+ case kSeqStringTag | kOneByteStringTag:
2577
+ visitor.VisitOneByteString(
2578
+ SeqOneByteString::cast(string)->GetChars() + slice_offset,
2579
+ length - offset);
2580
+ return;
2581
+
2582
+ case kSeqStringTag | kTwoByteStringTag:
2583
+ visitor.VisitTwoByteString(
2584
+ SeqTwoByteString::cast(string)->GetChars() + slice_offset,
2585
+ length - offset);
2586
+ return;
2587
+
2588
+ case kExternalStringTag | kOneByteStringTag:
2589
+ visitor.VisitOneByteString(
2590
+ ExternalAsciiString::cast(string)->GetChars() + slice_offset,
2591
+ length - offset);
2592
+ return;
2593
+
2594
+ case kExternalStringTag | kTwoByteStringTag:
2595
+ visitor.VisitTwoByteString(
2596
+ ExternalTwoByteString::cast(string)->GetChars() + slice_offset,
2597
+ length - offset);
2598
+ return;
2599
+
2600
+ case kSlicedStringTag | kOneByteStringTag:
2601
+ case kSlicedStringTag | kTwoByteStringTag: {
2602
+ SlicedString* slicedString = SlicedString::cast(string);
2603
+ slice_offset += slicedString->offset();
2604
+ string = slicedString->parent();
2605
+ type = string->map()->instance_type();
2606
+ continue;
2607
+ }
2608
+
2609
+ case kConsStringTag | kOneByteStringTag:
2610
+ case kConsStringTag | kTwoByteStringTag:
2611
+ string = cons_op.Operate(string, &offset, &type, &length);
2612
+ if (string == NULL) return;
2613
+ slice_offset = offset;
2614
+ ASSERT(length == static_cast<unsigned>(string->length()));
2615
+ continue;
2616
+
2617
+ default:
2618
+ UNREACHABLE();
2619
+ return;
2620
+ }
2621
+ }
2622
+ }
2623
+
2624
+
2625
+ uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
2302
2626
  ASSERT(index >= 0 && index < length());
2303
2627
  return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
2304
2628
  }
2305
2629
 
2306
2630
 
2307
- void SeqAsciiString::SeqAsciiStringSet(int index, uint16_t value) {
2308
- ASSERT(index >= 0 && index < length() && value <= kMaxAsciiCharCode);
2631
+ void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) {
2632
+ ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode);
2309
2633
  WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
2310
2634
  static_cast<byte>(value));
2311
2635
  }
2312
2636
 
2313
2637
 
2314
- Address SeqAsciiString::GetCharsAddress() {
2638
+ Address SeqOneByteString::GetCharsAddress() {
2315
2639
  return FIELD_ADDR(this, kHeaderSize);
2316
2640
  }
2317
2641
 
2318
2642
 
2319
- char* SeqAsciiString::GetChars() {
2320
- return reinterpret_cast<char*>(GetCharsAddress());
2643
+ uint8_t* SeqOneByteString::GetChars() {
2644
+ return reinterpret_cast<uint8_t*>(GetCharsAddress());
2321
2645
  }
2322
2646
 
2323
2647
 
@@ -2348,7 +2672,7 @@ int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) {
2348
2672
  }
2349
2673
 
2350
2674
 
2351
- int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) {
2675
+ int SeqOneByteString::SeqOneByteStringSize(InstanceType instance_type) {
2352
2676
  return SizeFor(length());
2353
2677
  }
2354
2678
 
@@ -2358,9 +2682,10 @@ String* SlicedString::parent() {
2358
2682
  }
2359
2683
 
2360
2684
 
2361
- void SlicedString::set_parent(String* parent) {
2685
+ void SlicedString::set_parent(String* parent, WriteBarrierMode mode) {
2362
2686
  ASSERT(parent->IsSeqString() || parent->IsExternalString());
2363
2687
  WRITE_FIELD(this, kParentOffset, parent);
2688
+ CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kParentOffset, parent, mode);
2364
2689
  }
2365
2690
 
2366
2691
 
@@ -2426,8 +2751,8 @@ void ExternalAsciiString::set_resource(
2426
2751
  }
2427
2752
 
2428
2753
 
2429
- const char* ExternalAsciiString::GetChars() {
2430
- return resource()->data();
2754
+ const uint8_t* ExternalAsciiString::GetChars() {
2755
+ return reinterpret_cast<const uint8_t*>(resource()->data());
2431
2756
  }
2432
2757
 
2433
2758
 
@@ -2475,6 +2800,135 @@ const uint16_t* ExternalTwoByteString::ExternalTwoByteStringGetData(
2475
2800
  }
2476
2801
 
2477
2802
 
2803
+ String* ConsStringNullOp::Operate(String*, unsigned*, int32_t*, unsigned*) {
2804
+ return NULL;
2805
+ }
2806
+
2807
+
2808
+ unsigned ConsStringIteratorOp::OffsetForDepth(unsigned depth) {
2809
+ return depth & kDepthMask;
2810
+ }
2811
+
2812
+
2813
+ void ConsStringIteratorOp::PushLeft(ConsString* string) {
2814
+ frames_[depth_++ & kDepthMask] = string;
2815
+ }
2816
+
2817
+
2818
+ void ConsStringIteratorOp::PushRight(ConsString* string) {
2819
+ // Inplace update.
2820
+ frames_[(depth_-1) & kDepthMask] = string;
2821
+ }
2822
+
2823
+
2824
+ void ConsStringIteratorOp::AdjustMaximumDepth() {
2825
+ if (depth_ > maximum_depth_) maximum_depth_ = depth_;
2826
+ }
2827
+
2828
+
2829
+ void ConsStringIteratorOp::Pop() {
2830
+ ASSERT(depth_ > 0);
2831
+ ASSERT(depth_ <= maximum_depth_);
2832
+ depth_--;
2833
+ }
2834
+
2835
+
2836
+ bool ConsStringIteratorOp::HasMore() {
2837
+ return depth_ != 0;
2838
+ }
2839
+
2840
+
2841
+ void ConsStringIteratorOp::Reset() {
2842
+ depth_ = 0;
2843
+ }
2844
+
2845
+
2846
+ String* ConsStringIteratorOp::ContinueOperation(int32_t* type_out,
2847
+ unsigned* length_out) {
2848
+ bool blew_stack = false;
2849
+ String* string = NextLeaf(&blew_stack, type_out, length_out);
2850
+ // String found.
2851
+ if (string != NULL) {
2852
+ // Verify output.
2853
+ ASSERT(*length_out == static_cast<unsigned>(string->length()));
2854
+ ASSERT(*type_out == string->map()->instance_type());
2855
+ return string;
2856
+ }
2857
+ // Traversal complete.
2858
+ if (!blew_stack) return NULL;
2859
+ // Restart search from root.
2860
+ unsigned offset_out;
2861
+ string = Search(&offset_out, type_out, length_out);
2862
+ // Verify output.
2863
+ ASSERT(string == NULL || offset_out == 0);
2864
+ ASSERT(string == NULL ||
2865
+ *length_out == static_cast<unsigned>(string->length()));
2866
+ ASSERT(string == NULL || *type_out == string->map()->instance_type());
2867
+ return string;
2868
+ }
2869
+
2870
+
2871
+ uint16_t StringCharacterStream::GetNext() {
2872
+ ASSERT(buffer8_ != NULL && end_ != NULL);
2873
+ // Advance cursor if needed.
2874
+ // TODO(dcarney): Ensure uses of the api call HasMore first and avoid this.
2875
+ if (buffer8_ == end_) HasMore();
2876
+ ASSERT(buffer8_ < end_);
2877
+ return is_one_byte_ ? *buffer8_++ : *buffer16_++;
2878
+ }
2879
+
2880
+
2881
+ StringCharacterStream::StringCharacterStream(String* string,
2882
+ ConsStringIteratorOp* op,
2883
+ unsigned offset)
2884
+ : is_one_byte_(false),
2885
+ op_(op) {
2886
+ Reset(string, offset);
2887
+ }
2888
+
2889
+
2890
+ void StringCharacterStream::Reset(String* string, unsigned offset) {
2891
+ op_->Reset();
2892
+ buffer8_ = NULL;
2893
+ end_ = NULL;
2894
+ int32_t type = string->map()->instance_type();
2895
+ unsigned length = string->length();
2896
+ String::Visit(string, offset, *this, *op_, type, length);
2897
+ }
2898
+
2899
+
2900
+ bool StringCharacterStream::HasMore() {
2901
+ if (buffer8_ != end_) return true;
2902
+ if (!op_->HasMore()) return false;
2903
+ unsigned length;
2904
+ int32_t type;
2905
+ String* string = op_->ContinueOperation(&type, &length);
2906
+ if (string == NULL) return false;
2907
+ ASSERT(!string->IsConsString());
2908
+ ASSERT(string->length() != 0);
2909
+ ConsStringNullOp null_op;
2910
+ String::Visit(string, 0, *this, null_op, type, length);
2911
+ ASSERT(buffer8_ != end_);
2912
+ return true;
2913
+ }
2914
+
2915
+
2916
+ void StringCharacterStream::VisitOneByteString(
2917
+ const uint8_t* chars, unsigned length) {
2918
+ is_one_byte_ = true;
2919
+ buffer8_ = chars;
2920
+ end_ = chars + length;
2921
+ }
2922
+
2923
+
2924
+ void StringCharacterStream::VisitTwoByteString(
2925
+ const uint16_t* chars, unsigned length) {
2926
+ is_one_byte_ = false;
2927
+ buffer16_ = chars;
2928
+ end_ = reinterpret_cast<const uint8_t*>(chars + length);
2929
+ }
2930
+
2931
+
2478
2932
  void JSFunctionResultCache::MakeZeroSize() {
2479
2933
  set_finger_index(kEntriesIndex);
2480
2934
  set_size(kEntriesIndex);
@@ -2765,8 +3219,8 @@ int HeapObject::SizeFromMap(Map* map) {
2765
3219
  return FixedArray::BodyDescriptor::SizeOf(map, this);
2766
3220
  }
2767
3221
  if (instance_type == ASCII_STRING_TYPE) {
2768
- return SeqAsciiString::SizeFor(
2769
- reinterpret_cast<SeqAsciiString*>(this)->length());
3222
+ return SeqOneByteString::SizeFor(
3223
+ reinterpret_cast<SeqOneByteString*>(this)->length());
2770
3224
  }
2771
3225
  if (instance_type == BYTE_ARRAY_TYPE) {
2772
3226
  return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
@@ -2864,16 +3318,12 @@ bool Map::has_non_instance_prototype() {
2864
3318
 
2865
3319
 
2866
3320
  void Map::set_function_with_prototype(bool value) {
2867
- if (value) {
2868
- set_bit_field3(bit_field3() | (1 << kFunctionWithPrototype));
2869
- } else {
2870
- set_bit_field3(bit_field3() & ~(1 << kFunctionWithPrototype));
2871
- }
3321
+ set_bit_field3(FunctionWithPrototype::update(bit_field3(), value));
2872
3322
  }
2873
3323
 
2874
3324
 
2875
3325
  bool Map::function_with_prototype() {
2876
- return ((1 << kFunctionWithPrototype) & bit_field3()) != 0;
3326
+ return FunctionWithPrototype::decode(bit_field3());
2877
3327
  }
2878
3328
 
2879
3329
 
@@ -2918,15 +3368,22 @@ bool Map::attached_to_shared_function_info() {
2918
3368
 
2919
3369
 
2920
3370
  void Map::set_is_shared(bool value) {
2921
- if (value) {
2922
- set_bit_field3(bit_field3() | (1 << kIsShared));
2923
- } else {
2924
- set_bit_field3(bit_field3() & ~(1 << kIsShared));
2925
- }
3371
+ set_bit_field3(IsShared::update(bit_field3(), value));
2926
3372
  }
2927
3373
 
3374
+
2928
3375
  bool Map::is_shared() {
2929
- return ((1 << kIsShared) & bit_field3()) != 0;
3376
+ return IsShared::decode(bit_field3());
3377
+ }
3378
+
3379
+
3380
+ void Map::set_dictionary_map(bool value) {
3381
+ set_bit_field3(DictionaryMap::update(bit_field3(), value));
3382
+ }
3383
+
3384
+
3385
+ bool Map::is_dictionary_map() {
3386
+ return DictionaryMap::decode(bit_field3());
2930
3387
  }
2931
3388
 
2932
3389
 
@@ -2940,6 +3397,75 @@ Code::Flags Code::flags() {
2940
3397
  }
2941
3398
 
2942
3399
 
3400
+ inline bool Map::CanTrackAllocationSite() {
3401
+ return instance_type() == JS_ARRAY_TYPE;
3402
+ }
3403
+
3404
+
3405
+ void Map::set_owns_descriptors(bool is_shared) {
3406
+ set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared));
3407
+ }
3408
+
3409
+
3410
+ bool Map::owns_descriptors() {
3411
+ return OwnsDescriptors::decode(bit_field3());
3412
+ }
3413
+
3414
+
3415
+ void Map::set_is_observed(bool is_observed) {
3416
+ ASSERT(instance_type() < FIRST_JS_OBJECT_TYPE ||
3417
+ instance_type() > LAST_JS_OBJECT_TYPE ||
3418
+ has_slow_elements_kind() || has_external_array_elements());
3419
+ set_bit_field3(IsObserved::update(bit_field3(), is_observed));
3420
+ }
3421
+
3422
+
3423
+ bool Map::is_observed() {
3424
+ return IsObserved::decode(bit_field3());
3425
+ }
3426
+
3427
+
3428
+ void Map::AddDependentCode(Handle<Code> code) {
3429
+ Handle<DependentCodes> codes =
3430
+ DependentCodes::Append(Handle<DependentCodes>(dependent_codes()), code);
3431
+ if (*codes != dependent_codes()) {
3432
+ set_dependent_codes(*codes);
3433
+ }
3434
+ }
3435
+
3436
+
3437
+ int DependentCodes::number_of_codes() {
3438
+ if (length() == 0) return 0;
3439
+ return Smi::cast(get(kNumberOfCodesIndex))->value();
3440
+ }
3441
+
3442
+
3443
+ void DependentCodes::set_number_of_codes(int value) {
3444
+ set(kNumberOfCodesIndex, Smi::FromInt(value));
3445
+ }
3446
+
3447
+
3448
+ Code* DependentCodes::code_at(int i) {
3449
+ return Code::cast(get(kCodesIndex + i));
3450
+ }
3451
+
3452
+
3453
+ void DependentCodes::set_code_at(int i, Code* value) {
3454
+ set(kCodesIndex + i, value);
3455
+ }
3456
+
3457
+
3458
+ Object** DependentCodes::code_slot_at(int i) {
3459
+ return HeapObject::RawField(
3460
+ this, FixedArray::OffsetOfElementAt(kCodesIndex + i));
3461
+ }
3462
+
3463
+
3464
+ void DependentCodes::clear_code_at(int i) {
3465
+ set_undefined(kCodesIndex + i);
3466
+ }
3467
+
3468
+
2943
3469
  void Code::set_flags(Code::Flags flags) {
2944
3470
  STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1);
2945
3471
  // Make sure that all call stubs have an arguments count.
@@ -2962,19 +3488,18 @@ InlineCacheState Code::ic_state() {
2962
3488
  // a call to code object has been replaced with a debug break call.
2963
3489
  ASSERT(is_inline_cache_stub() ||
2964
3490
  result == UNINITIALIZED ||
2965
- result == DEBUG_BREAK ||
2966
- result == DEBUG_PREPARE_STEP_IN);
3491
+ result == DEBUG_STUB);
2967
3492
  return result;
2968
3493
  }
2969
3494
 
2970
3495
 
2971
3496
  Code::ExtraICState Code::extra_ic_state() {
2972
- ASSERT(is_inline_cache_stub());
3497
+ ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
2973
3498
  return ExtractExtraICStateFromFlags(flags());
2974
3499
  }
2975
3500
 
2976
3501
 
2977
- PropertyType Code::type() {
3502
+ Code::StubType Code::type() {
2978
3503
  return ExtractTypeFromFlags(flags());
2979
3504
  }
2980
3505
 
@@ -2987,22 +3512,33 @@ int Code::arguments_count() {
2987
3512
 
2988
3513
  int Code::major_key() {
2989
3514
  ASSERT(kind() == STUB ||
3515
+ kind() == COMPILED_STUB ||
2990
3516
  kind() == UNARY_OP_IC ||
2991
3517
  kind() == BINARY_OP_IC ||
2992
3518
  kind() == COMPARE_IC ||
3519
+ kind() == LOAD_IC ||
3520
+ kind() == KEYED_LOAD_IC ||
2993
3521
  kind() == TO_BOOLEAN_IC);
2994
- return READ_BYTE_FIELD(this, kStubMajorKeyOffset);
3522
+ return StubMajorKeyField::decode(
3523
+ READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
2995
3524
  }
2996
3525
 
2997
3526
 
2998
3527
  void Code::set_major_key(int major) {
2999
3528
  ASSERT(kind() == STUB ||
3529
+ kind() == COMPILED_STUB ||
3000
3530
  kind() == UNARY_OP_IC ||
3001
3531
  kind() == BINARY_OP_IC ||
3002
3532
  kind() == COMPARE_IC ||
3533
+ kind() == LOAD_IC ||
3534
+ kind() == KEYED_LOAD_IC ||
3535
+ kind() == STORE_IC ||
3536
+ kind() == KEYED_STORE_IC ||
3003
3537
  kind() == TO_BOOLEAN_IC);
3004
3538
  ASSERT(0 <= major && major < 256);
3005
- WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major);
3539
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3540
+ int updated = StubMajorKeyField::update(previous, major);
3541
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3006
3542
  }
3007
3543
 
3008
3544
 
@@ -3103,40 +3639,51 @@ void Code::set_profiler_ticks(int ticks) {
3103
3639
 
3104
3640
 
3105
3641
  unsigned Code::stack_slots() {
3106
- ASSERT(kind() == OPTIMIZED_FUNCTION);
3107
- return READ_UINT32_FIELD(this, kStackSlotsOffset);
3642
+ ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
3643
+ return StackSlotsField::decode(
3644
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3108
3645
  }
3109
3646
 
3110
3647
 
3111
3648
  void Code::set_stack_slots(unsigned slots) {
3112
- ASSERT(kind() == OPTIMIZED_FUNCTION);
3113
- WRITE_UINT32_FIELD(this, kStackSlotsOffset, slots);
3649
+ CHECK(slots <= (1 << kStackSlotsBitCount));
3650
+ ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
3651
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3652
+ int updated = StackSlotsField::update(previous, slots);
3653
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3114
3654
  }
3115
3655
 
3116
3656
 
3117
3657
  unsigned Code::safepoint_table_offset() {
3118
- ASSERT(kind() == OPTIMIZED_FUNCTION);
3119
- return READ_UINT32_FIELD(this, kSafepointTableOffsetOffset);
3658
+ ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
3659
+ return SafepointTableOffsetField::decode(
3660
+ READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
3120
3661
  }
3121
3662
 
3122
3663
 
3123
3664
  void Code::set_safepoint_table_offset(unsigned offset) {
3124
- ASSERT(kind() == OPTIMIZED_FUNCTION);
3665
+ CHECK(offset <= (1 << kSafepointTableOffsetBitCount));
3666
+ ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
3125
3667
  ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
3126
- WRITE_UINT32_FIELD(this, kSafepointTableOffsetOffset, offset);
3668
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3669
+ int updated = SafepointTableOffsetField::update(previous, offset);
3670
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3127
3671
  }
3128
3672
 
3129
3673
 
3130
3674
  unsigned Code::stack_check_table_offset() {
3131
3675
  ASSERT_EQ(FUNCTION, kind());
3132
- return READ_UINT32_FIELD(this, kStackCheckTableOffsetOffset);
3676
+ return StackCheckTableOffsetField::decode(
3677
+ READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
3133
3678
  }
3134
3679
 
3135
3680
 
3136
3681
  void Code::set_stack_check_table_offset(unsigned offset) {
3137
3682
  ASSERT_EQ(FUNCTION, kind());
3138
3683
  ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
3139
- WRITE_UINT32_FIELD(this, kStackCheckTableOffsetOffset, offset);
3684
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3685
+ int updated = StackCheckTableOffsetField::update(previous, offset);
3686
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3140
3687
  }
3141
3688
 
3142
3689
 
@@ -3155,85 +3702,61 @@ void Code::set_check_type(CheckType value) {
3155
3702
 
3156
3703
  byte Code::unary_op_type() {
3157
3704
  ASSERT(is_unary_op_stub());
3158
- return READ_BYTE_FIELD(this, kUnaryOpTypeOffset);
3705
+ return UnaryOpTypeField::decode(
3706
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3159
3707
  }
3160
3708
 
3161
3709
 
3162
3710
  void Code::set_unary_op_type(byte value) {
3163
3711
  ASSERT(is_unary_op_stub());
3164
- WRITE_BYTE_FIELD(this, kUnaryOpTypeOffset, value);
3165
- }
3166
-
3167
-
3168
- byte Code::binary_op_type() {
3169
- ASSERT(is_binary_op_stub());
3170
- return READ_BYTE_FIELD(this, kBinaryOpTypeOffset);
3171
- }
3172
-
3173
-
3174
- void Code::set_binary_op_type(byte value) {
3175
- ASSERT(is_binary_op_stub());
3176
- WRITE_BYTE_FIELD(this, kBinaryOpTypeOffset, value);
3177
- }
3178
-
3179
-
3180
- byte Code::binary_op_result_type() {
3181
- ASSERT(is_binary_op_stub());
3182
- return READ_BYTE_FIELD(this, kBinaryOpReturnTypeOffset);
3183
- }
3184
-
3185
-
3186
- void Code::set_binary_op_result_type(byte value) {
3187
- ASSERT(is_binary_op_stub());
3188
- WRITE_BYTE_FIELD(this, kBinaryOpReturnTypeOffset, value);
3189
- }
3190
-
3191
-
3192
- byte Code::compare_state() {
3193
- ASSERT(is_compare_ic_stub());
3194
- return READ_BYTE_FIELD(this, kCompareStateOffset);
3195
- }
3196
-
3197
-
3198
- void Code::set_compare_state(byte value) {
3199
- ASSERT(is_compare_ic_stub());
3200
- WRITE_BYTE_FIELD(this, kCompareStateOffset, value);
3201
- }
3202
-
3203
-
3204
- byte Code::compare_operation() {
3205
- ASSERT(is_compare_ic_stub());
3206
- return READ_BYTE_FIELD(this, kCompareOperationOffset);
3207
- }
3208
-
3209
-
3210
- void Code::set_compare_operation(byte value) {
3211
- ASSERT(is_compare_ic_stub());
3212
- WRITE_BYTE_FIELD(this, kCompareOperationOffset, value);
3712
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3713
+ int updated = UnaryOpTypeField::update(previous, value);
3714
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3213
3715
  }
3214
3716
 
3215
3717
 
3216
3718
  byte Code::to_boolean_state() {
3217
3719
  ASSERT(is_to_boolean_ic_stub());
3218
- return READ_BYTE_FIELD(this, kToBooleanTypeOffset);
3720
+ return ToBooleanStateField::decode(
3721
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3219
3722
  }
3220
3723
 
3221
3724
 
3222
3725
  void Code::set_to_boolean_state(byte value) {
3223
3726
  ASSERT(is_to_boolean_ic_stub());
3224
- WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value);
3727
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3728
+ int updated = ToBooleanStateField::update(previous, value);
3729
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3225
3730
  }
3226
3731
 
3227
3732
 
3228
3733
  bool Code::has_function_cache() {
3229
3734
  ASSERT(kind() == STUB);
3230
- return READ_BYTE_FIELD(this, kHasFunctionCacheOffset) != 0;
3735
+ return HasFunctionCacheField::decode(
3736
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3231
3737
  }
3232
3738
 
3233
3739
 
3234
3740
  void Code::set_has_function_cache(bool flag) {
3235
3741
  ASSERT(kind() == STUB);
3236
- WRITE_BYTE_FIELD(this, kHasFunctionCacheOffset, flag);
3742
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3743
+ int updated = HasFunctionCacheField::update(previous, flag);
3744
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3745
+ }
3746
+
3747
+
3748
+ bool Code::marked_for_deoptimization() {
3749
+ ASSERT(kind() == OPTIMIZED_FUNCTION);
3750
+ return MarkedForDeoptimizationField::decode(
3751
+ READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3752
+ }
3753
+
3754
+
3755
+ void Code::set_marked_for_deoptimization(bool flag) {
3756
+ ASSERT(kind() == OPTIMIZED_FUNCTION);
3757
+ int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3758
+ int updated = MarkedForDeoptimizationField::update(previous, flag);
3759
+ WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3237
3760
  }
3238
3761
 
3239
3762
 
@@ -3243,10 +3766,15 @@ bool Code::is_inline_cache_stub() {
3243
3766
  }
3244
3767
 
3245
3768
 
3769
+ bool Code::is_debug_break() {
3770
+ return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK;
3771
+ }
3772
+
3773
+
3246
3774
  Code::Flags Code::ComputeFlags(Kind kind,
3247
3775
  InlineCacheState ic_state,
3248
3776
  ExtraICState extra_ic_state,
3249
- PropertyType type,
3777
+ StubType type,
3250
3778
  int argc,
3251
3779
  InlineCacheHolderFlag holder) {
3252
3780
  // Extra IC state is only allowed for call IC stubs or for store IC
@@ -3267,7 +3795,7 @@ Code::Flags Code::ComputeFlags(Kind kind,
3267
3795
 
3268
3796
 
3269
3797
  Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
3270
- PropertyType type,
3798
+ StubType type,
3271
3799
  ExtraICState extra_ic_state,
3272
3800
  InlineCacheHolderFlag holder,
3273
3801
  int argc) {
@@ -3290,7 +3818,7 @@ Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
3290
3818
  }
3291
3819
 
3292
3820
 
3293
- PropertyType Code::ExtractTypeFromFlags(Flags flags) {
3821
+ Code::StubType Code::ExtractTypeFromFlags(Flags flags) {
3294
3822
  return TypeField::decode(flags);
3295
3823
  }
3296
3824
 
@@ -3340,174 +3868,247 @@ void Map::set_prototype(Object* value, WriteBarrierMode mode) {
3340
3868
  }
3341
3869
 
3342
3870
 
3343
- DescriptorArray* Map::instance_descriptors() {
3344
- Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset);
3345
- if (object->IsSmi()) {
3346
- return GetHeap()->empty_descriptor_array();
3871
+ // If the descriptor is using the empty transition array, install a new empty
3872
+ // transition array that will have place for an element transition.
3873
+ static MaybeObject* EnsureHasTransitionArray(Map* map) {
3874
+ TransitionArray* transitions;
3875
+ MaybeObject* maybe_transitions;
3876
+ if (!map->HasTransitionArray()) {
3877
+ maybe_transitions = TransitionArray::Allocate(0);
3878
+ if (!maybe_transitions->To(&transitions)) return maybe_transitions;
3879
+ transitions->set_back_pointer_storage(map->GetBackPointer());
3880
+ } else if (!map->transitions()->IsFullTransitionArray()) {
3881
+ maybe_transitions = map->transitions()->ExtendToFullTransitionArray();
3882
+ if (!maybe_transitions->To(&transitions)) return maybe_transitions;
3347
3883
  } else {
3348
- return DescriptorArray::cast(object);
3884
+ return map;
3349
3885
  }
3886
+ map->set_transitions(transitions);
3887
+ return transitions;
3350
3888
  }
3351
3889
 
3352
3890
 
3353
- void Map::init_instance_descriptors() {
3354
- WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, Smi::FromInt(0));
3355
- }
3356
-
3357
-
3358
- void Map::clear_instance_descriptors() {
3359
- Object* object = READ_FIELD(this,
3360
- kInstanceDescriptorsOrBitField3Offset);
3361
- if (!object->IsSmi()) {
3891
+ void Map::InitializeDescriptors(DescriptorArray* descriptors) {
3892
+ int len = descriptors->number_of_descriptors();
3362
3893
  #ifdef DEBUG
3363
- ZapInstanceDescriptors();
3364
- #endif
3365
- WRITE_FIELD(
3366
- this,
3367
- kInstanceDescriptorsOrBitField3Offset,
3368
- Smi::FromInt(DescriptorArray::cast(object)->bit_field3_storage()));
3894
+ ASSERT(len <= DescriptorArray::kMaxNumberOfDescriptors);
3895
+
3896
+ bool used_indices[DescriptorArray::kMaxNumberOfDescriptors];
3897
+ for (int i = 0; i < len; ++i) used_indices[i] = false;
3898
+
3899
+ // Ensure that all enumeration indexes between 1 and length occur uniquely in
3900
+ // the descriptor array.
3901
+ for (int i = 0; i < len; ++i) {
3902
+ int enum_index = descriptors->GetDetails(i).descriptor_index() -
3903
+ PropertyDetails::kInitialIndex;
3904
+ ASSERT(0 <= enum_index && enum_index < len);
3905
+ ASSERT(!used_indices[enum_index]);
3906
+ used_indices[enum_index] = true;
3369
3907
  }
3908
+ #endif
3909
+
3910
+ set_instance_descriptors(descriptors);
3911
+ SetNumberOfOwnDescriptors(len);
3370
3912
  }
3371
3913
 
3372
3914
 
3373
- void Map::set_instance_descriptors(DescriptorArray* value,
3374
- WriteBarrierMode mode) {
3375
- Object* object = READ_FIELD(this,
3376
- kInstanceDescriptorsOrBitField3Offset);
3377
- Heap* heap = GetHeap();
3378
- if (value == heap->empty_descriptor_array()) {
3379
- clear_instance_descriptors();
3380
- return;
3381
- } else {
3382
- if (object->IsSmi()) {
3383
- value->set_bit_field3_storage(Smi::cast(object)->value());
3384
- } else {
3385
- value->set_bit_field3_storage(
3386
- DescriptorArray::cast(object)->bit_field3_storage());
3387
- }
3388
- }
3389
- ASSERT(!is_shared());
3390
- #ifdef DEBUG
3391
- if (value != instance_descriptors()) {
3392
- ZapInstanceDescriptors();
3393
- }
3394
- #endif
3395
- WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value);
3396
- CONDITIONAL_WRITE_BARRIER(
3397
- heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode);
3398
- }
3915
+ ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset)
3916
+ SMI_ACCESSORS(Map, bit_field3, kBitField3Offset)
3399
3917
 
3400
3918
 
3401
- int Map::bit_field3() {
3402
- Object* object = READ_FIELD(this,
3403
- kInstanceDescriptorsOrBitField3Offset);
3404
- if (object->IsSmi()) {
3405
- return Smi::cast(object)->value();
3406
- } else {
3407
- return DescriptorArray::cast(object)->bit_field3_storage();
3919
+ void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) {
3920
+ Object* back_pointer = GetBackPointer();
3921
+
3922
+ if (Heap::ShouldZapGarbage() && HasTransitionArray()) {
3923
+ ZapTransitions();
3408
3924
  }
3925
+
3926
+ WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer);
3927
+ CONDITIONAL_WRITE_BARRIER(
3928
+ heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode);
3409
3929
  }
3410
3930
 
3411
3931
 
3412
- void Map::set_bit_field3(int value) {
3413
- ASSERT(Smi::IsValid(value));
3414
- Object* object = READ_FIELD(this,
3415
- kInstanceDescriptorsOrBitField3Offset);
3416
- if (object->IsSmi()) {
3417
- WRITE_FIELD(this,
3418
- kInstanceDescriptorsOrBitField3Offset,
3419
- Smi::FromInt(value));
3420
- } else {
3421
- DescriptorArray::cast(object)->set_bit_field3_storage(value);
3422
- }
3932
+ void Map::AppendDescriptor(Descriptor* desc,
3933
+ const DescriptorArray::WhitenessWitness& witness) {
3934
+ DescriptorArray* descriptors = instance_descriptors();
3935
+ int number_of_own_descriptors = NumberOfOwnDescriptors();
3936
+ ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors);
3937
+ descriptors->Append(desc, witness);
3938
+ SetNumberOfOwnDescriptors(number_of_own_descriptors + 1);
3423
3939
  }
3424
3940
 
3425
3941
 
3426
3942
  Object* Map::GetBackPointer() {
3427
- Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset);
3428
- if (object->IsFixedArray()) {
3429
- return FixedArray::cast(object)->get(kProtoTransitionBackPointerOffset);
3943
+ Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset);
3944
+ if (object->IsDescriptorArray()) {
3945
+ return TransitionArray::cast(object)->back_pointer_storage();
3430
3946
  } else {
3947
+ ASSERT(object->IsMap() || object->IsUndefined());
3431
3948
  return object;
3432
3949
  }
3433
3950
  }
3434
3951
 
3435
3952
 
3436
- void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
3437
- Heap* heap = GetHeap();
3438
- ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE);
3439
- ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) ||
3440
- (value->IsMap() && GetBackPointer()->IsUndefined()));
3441
- Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset);
3442
- if (object->IsFixedArray()) {
3443
- FixedArray::cast(object)->set(
3444
- kProtoTransitionBackPointerOffset, value, mode);
3445
- } else {
3446
- WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value);
3447
- CONDITIONAL_WRITE_BARRIER(
3448
- heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode);
3449
- }
3953
+ bool Map::HasElementsTransition() {
3954
+ return HasTransitionArray() && transitions()->HasElementsTransition();
3450
3955
  }
3451
3956
 
3452
3957
 
3453
- FixedArray* Map::prototype_transitions() {
3454
- Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset);
3455
- if (object->IsFixedArray()) {
3456
- return FixedArray::cast(object);
3457
- } else {
3958
+ bool Map::HasTransitionArray() {
3959
+ Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset);
3960
+ return object->IsTransitionArray();
3961
+ }
3962
+
3963
+
3964
+ Map* Map::elements_transition_map() {
3965
+ return transitions()->elements_transition();
3966
+ }
3967
+
3968
+
3969
+ bool Map::CanHaveMoreTransitions() {
3970
+ if (!HasTransitionArray()) return true;
3971
+ return FixedArray::SizeFor(transitions()->length() +
3972
+ TransitionArray::kTransitionSize)
3973
+ <= Page::kMaxNonCodeHeapObjectSize;
3974
+ }
3975
+
3976
+
3977
+ MaybeObject* Map::AddTransition(String* key,
3978
+ Map* target,
3979
+ SimpleTransitionFlag flag) {
3980
+ if (HasTransitionArray()) return transitions()->CopyInsert(key, target);
3981
+ return TransitionArray::NewWith(flag, key, target, GetBackPointer());
3982
+ }
3983
+
3984
+
3985
+ void Map::SetTransition(int transition_index, Map* target) {
3986
+ transitions()->SetTarget(transition_index, target);
3987
+ }
3988
+
3989
+
3990
+ Map* Map::GetTransition(int transition_index) {
3991
+ return transitions()->GetTarget(transition_index);
3992
+ }
3993
+
3994
+
3995
+ MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) {
3996
+ MaybeObject* allow_elements = EnsureHasTransitionArray(this);
3997
+ if (allow_elements->IsFailure()) return allow_elements;
3998
+ transitions()->set_elements_transition(transitioned_map);
3999
+ return this;
4000
+ }
4001
+
4002
+
4003
+ FixedArray* Map::GetPrototypeTransitions() {
4004
+ if (!HasTransitionArray()) return GetHeap()->empty_fixed_array();
4005
+ if (!transitions()->HasPrototypeTransitions()) {
3458
4006
  return GetHeap()->empty_fixed_array();
3459
4007
  }
4008
+ return transitions()->GetPrototypeTransitions();
3460
4009
  }
3461
4010
 
3462
4011
 
3463
- void Map::set_prototype_transitions(FixedArray* value, WriteBarrierMode mode) {
3464
- Heap* heap = GetHeap();
3465
- ASSERT(value != heap->empty_fixed_array());
3466
- value->set(kProtoTransitionBackPointerOffset, GetBackPointer());
4012
+ MaybeObject* Map::SetPrototypeTransitions(FixedArray* proto_transitions) {
4013
+ MaybeObject* allow_prototype = EnsureHasTransitionArray(this);
4014
+ if (allow_prototype->IsFailure()) return allow_prototype;
3467
4015
  #ifdef DEBUG
3468
- if (value != prototype_transitions()) {
4016
+ if (HasPrototypeTransitions()) {
4017
+ ASSERT(GetPrototypeTransitions() != proto_transitions);
3469
4018
  ZapPrototypeTransitions();
3470
4019
  }
3471
4020
  #endif
3472
- WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value);
4021
+ transitions()->SetPrototypeTransitions(proto_transitions);
4022
+ return this;
4023
+ }
4024
+
4025
+
4026
+ bool Map::HasPrototypeTransitions() {
4027
+ return HasTransitionArray() && transitions()->HasPrototypeTransitions();
4028
+ }
4029
+
4030
+
4031
+ TransitionArray* Map::transitions() {
4032
+ ASSERT(HasTransitionArray());
4033
+ Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset);
4034
+ return TransitionArray::cast(object);
4035
+ }
4036
+
4037
+
4038
+ void Map::set_transitions(TransitionArray* transition_array,
4039
+ WriteBarrierMode mode) {
4040
+ // In release mode, only run this code if verify_heap is on.
4041
+ if (Heap::ShouldZapGarbage() && HasTransitionArray()) {
4042
+ CHECK(transitions() != transition_array);
4043
+ ZapTransitions();
4044
+ }
4045
+
4046
+ WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array);
3473
4047
  CONDITIONAL_WRITE_BARRIER(
3474
- heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode);
4048
+ GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode);
3475
4049
  }
3476
4050
 
3477
4051
 
3478
- void Map::init_prototype_transitions(Object* undefined) {
4052
+ void Map::init_back_pointer(Object* undefined) {
3479
4053
  ASSERT(undefined->IsUndefined());
3480
- WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, undefined);
4054
+ WRITE_FIELD(this, kTransitionsOrBackPointerOffset, undefined);
4055
+ }
4056
+
4057
+
4058
+ void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
4059
+ ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE);
4060
+ ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) ||
4061
+ (value->IsMap() && GetBackPointer()->IsUndefined()));
4062
+ Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset);
4063
+ if (object->IsTransitionArray()) {
4064
+ TransitionArray::cast(object)->set_back_pointer_storage(value);
4065
+ } else {
4066
+ WRITE_FIELD(this, kTransitionsOrBackPointerOffset, value);
4067
+ CONDITIONAL_WRITE_BARRIER(
4068
+ GetHeap(), this, kTransitionsOrBackPointerOffset, value, mode);
4069
+ }
4070
+ }
4071
+
4072
+
4073
+ // Can either be Smi (no transitions), normal transition array, or a transition
4074
+ // array with the header overwritten as a Smi (thus iterating).
4075
+ TransitionArray* Map::unchecked_transition_array() {
4076
+ Object* object = *HeapObject::RawField(this,
4077
+ Map::kTransitionsOrBackPointerOffset);
4078
+ TransitionArray* transition_array = static_cast<TransitionArray*>(object);
4079
+ return transition_array;
3481
4080
  }
3482
4081
 
3483
4082
 
3484
- HeapObject* Map::unchecked_prototype_transitions() {
3485
- Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset);
3486
- return reinterpret_cast<HeapObject*>(object);
4083
+ HeapObject* Map::UncheckedPrototypeTransitions() {
4084
+ ASSERT(HasTransitionArray());
4085
+ ASSERT(unchecked_transition_array()->HasPrototypeTransitions());
4086
+ return unchecked_transition_array()->UncheckedPrototypeTransitions();
3487
4087
  }
3488
4088
 
3489
4089
 
3490
4090
  ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
4091
+ ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset)
3491
4092
  ACCESSORS(Map, constructor, Object, kConstructorOffset)
3492
4093
 
3493
4094
  ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
3494
4095
  ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
3495
- ACCESSORS(JSFunction,
3496
- next_function_link,
3497
- Object,
3498
- kNextFunctionLinkOffset)
4096
+ ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
3499
4097
 
3500
4098
  ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
4099
+ ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
3501
4100
  ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
3502
4101
  ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
3503
4102
 
3504
- ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
4103
+ ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset)
3505
4104
 
3506
4105
  ACCESSORS(AccessorInfo, getter, Object, kGetterOffset)
3507
4106
  ACCESSORS(AccessorInfo, setter, Object, kSetterOffset)
3508
4107
  ACCESSORS(AccessorInfo, data, Object, kDataOffset)
3509
4108
  ACCESSORS(AccessorInfo, name, Object, kNameOffset)
3510
4109
  ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset)
4110
+ ACCESSORS(AccessorInfo, expected_receiver_type, Object,
4111
+ kExpectedReceiverTypeOffset)
3511
4112
 
3512
4113
  ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
3513
4114
  ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
@@ -3559,6 +4160,8 @@ ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
3559
4160
 
3560
4161
  ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
3561
4162
 
4163
+ ACCESSORS(AllocationSiteInfo, payload, Object, kPayloadOffset)
4164
+
3562
4165
  ACCESSORS(Script, source, Object, kSourceOffset)
3563
4166
  ACCESSORS(Script, name, Object, kNameOffset)
3564
4167
  ACCESSORS(Script, id, Object, kIdOffset)
@@ -3588,6 +4191,8 @@ ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
3588
4191
  #endif
3589
4192
 
3590
4193
  ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
4194
+ ACCESSORS(SharedFunctionInfo, optimized_code_map, Object,
4195
+ kOptimizedCodeMapOffset)
3591
4196
  ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
3592
4197
  ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset)
3593
4198
  ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
@@ -3598,9 +4203,10 @@ ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
3598
4203
  ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
3599
4204
  ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
3600
4205
  kThisPropertyAssignmentsOffset)
3601
- SMI_ACCESSORS(SharedFunctionInfo, ic_age, kICAgeOffset)
4206
+ SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
3602
4207
 
3603
4208
 
4209
+ SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset)
3604
4210
  BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
3605
4211
  kHiddenPrototypeBit)
3606
4212
  BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
@@ -3620,6 +4226,10 @@ BOOL_ACCESSORS(SharedFunctionInfo,
3620
4226
  compiler_hints,
3621
4227
  allows_lazy_compilation,
3622
4228
  kAllowLazyCompilation)
4229
+ BOOL_ACCESSORS(SharedFunctionInfo,
4230
+ compiler_hints,
4231
+ allows_lazy_compilation_without_context,
4232
+ kAllowLazyCompilationWithoutContext)
3623
4233
  BOOL_ACCESSORS(SharedFunctionInfo,
3624
4234
  compiler_hints,
3625
4235
  uses_arguments,
@@ -3647,8 +4257,10 @@ SMI_ACCESSORS(SharedFunctionInfo, compiler_hints,
3647
4257
  SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
3648
4258
  kThisPropertyAssignmentsCountOffset)
3649
4259
  SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
3650
- SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
3651
- SMI_ACCESSORS(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset)
4260
+ SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset)
4261
+ SMI_ACCESSORS(SharedFunctionInfo,
4262
+ stress_deopt_counter,
4263
+ kStressDeoptCounterOffset)
3652
4264
  #else
3653
4265
 
3654
4266
  #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
@@ -3700,8 +4312,10 @@ PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
3700
4312
  kThisPropertyAssignmentsCountOffset)
3701
4313
  PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset)
3702
4314
 
3703
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
3704
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset)
4315
+ PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, counters, kCountersOffset)
4316
+ PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
4317
+ stress_deopt_counter,
4318
+ kStressDeoptCounterOffset)
3705
4319
  #endif
3706
4320
 
3707
4321
 
@@ -3794,6 +4408,17 @@ BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
3794
4408
  BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize,
3795
4409
  kDontOptimize)
3796
4410
  BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline)
4411
+ BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache)
4412
+
4413
+ void SharedFunctionInfo::BeforeVisitingPointers() {
4414
+ if (IsInobjectSlackTrackingInProgress()) DetachInitialMap();
4415
+ }
4416
+
4417
+
4418
+ void SharedFunctionInfo::ClearOptimizedCodeMap() {
4419
+ set_optimized_code_map(Smi::FromInt(0));
4420
+ }
4421
+
3797
4422
 
3798
4423
  ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset)
3799
4424
  ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset)
@@ -3805,7 +4430,7 @@ bool Script::HasValidSource() {
3805
4430
  if (!src->IsString()) return true;
3806
4431
  String* src_str = String::cast(src);
3807
4432
  if (!StringShape(src_str).IsExternal()) return true;
3808
- if (src_str->IsAsciiRepresentation()) {
4433
+ if (src_str->IsOneByteRepresentation()) {
3809
4434
  return ExternalAsciiString::cast(src)->resource() != NULL;
3810
4435
  } else if (src_str->IsTwoByteRepresentation()) {
3811
4436
  return ExternalTwoByteString::cast(src)->resource() != NULL;
@@ -3847,6 +4472,19 @@ void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
3847
4472
  }
3848
4473
 
3849
4474
 
4475
+ void SharedFunctionInfo::ReplaceCode(Code* value) {
4476
+ // If the GC metadata field is already used then the function was
4477
+ // enqueued as a code flushing candidate and we remove it now.
4478
+ if (code()->gc_metadata() != NULL) {
4479
+ CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
4480
+ flusher->EvictCandidate(this);
4481
+ }
4482
+
4483
+ ASSERT(code()->gc_metadata() == NULL && value->gc_metadata() == NULL);
4484
+ set_code(value);
4485
+ }
4486
+
4487
+
3850
4488
  ScopeInfo* SharedFunctionInfo::scope_info() {
3851
4489
  return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset));
3852
4490
  }
@@ -3902,14 +4540,66 @@ void SharedFunctionInfo::set_code_age(int code_age) {
3902
4540
  }
3903
4541
 
3904
4542
 
4543
+ int SharedFunctionInfo::ic_age() {
4544
+ return ICAgeBits::decode(counters());
4545
+ }
4546
+
4547
+
4548
+ void SharedFunctionInfo::set_ic_age(int ic_age) {
4549
+ set_counters(ICAgeBits::update(counters(), ic_age));
4550
+ }
4551
+
4552
+
4553
+ int SharedFunctionInfo::deopt_count() {
4554
+ return DeoptCountBits::decode(counters());
4555
+ }
4556
+
4557
+
4558
+ void SharedFunctionInfo::set_deopt_count(int deopt_count) {
4559
+ set_counters(DeoptCountBits::update(counters(), deopt_count));
4560
+ }
4561
+
4562
+
4563
+ void SharedFunctionInfo::increment_deopt_count() {
4564
+ int value = counters();
4565
+ int deopt_count = DeoptCountBits::decode(value);
4566
+ deopt_count = (deopt_count + 1) & DeoptCountBits::kMax;
4567
+ set_counters(DeoptCountBits::update(value, deopt_count));
4568
+ }
4569
+
4570
+
4571
+ int SharedFunctionInfo::opt_reenable_tries() {
4572
+ return OptReenableTriesBits::decode(counters());
4573
+ }
4574
+
4575
+
4576
+ void SharedFunctionInfo::set_opt_reenable_tries(int tries) {
4577
+ set_counters(OptReenableTriesBits::update(counters(), tries));
4578
+ }
4579
+
4580
+
3905
4581
  bool SharedFunctionInfo::has_deoptimization_support() {
3906
4582
  Code* code = this->code();
3907
4583
  return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
3908
4584
  }
3909
4585
 
3910
4586
 
4587
+ void SharedFunctionInfo::TryReenableOptimization() {
4588
+ int tries = opt_reenable_tries();
4589
+ set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax);
4590
+ // We reenable optimization whenever the number of tries is a large
4591
+ // enough power of 2.
4592
+ if (tries >= 16 && (((tries - 1) & tries) == 0)) {
4593
+ set_optimization_disabled(false);
4594
+ set_opt_count(0);
4595
+ set_deopt_count(0);
4596
+ code()->set_optimizable(true);
4597
+ }
4598
+ }
4599
+
4600
+
3911
4601
  bool JSFunction::IsBuiltin() {
3912
- return context()->global()->IsJSBuiltinsObject();
4602
+ return context()->global_object()->IsJSBuiltinsObject();
3913
4603
  }
3914
4604
 
3915
4605
 
@@ -3934,6 +4624,18 @@ bool JSFunction::IsMarkedForLazyRecompilation() {
3934
4624
  }
3935
4625
 
3936
4626
 
4627
+ bool JSFunction::IsMarkedForParallelRecompilation() {
4628
+ return code() ==
4629
+ GetIsolate()->builtins()->builtin(Builtins::kParallelRecompile);
4630
+ }
4631
+
4632
+
4633
+ bool JSFunction::IsInRecompileQueue() {
4634
+ return code() == GetIsolate()->builtins()->builtin(
4635
+ Builtins::kInRecompileQueue);
4636
+ }
4637
+
4638
+
3937
4639
  Code* JSFunction::code() {
3938
4640
  return Code::cast(unchecked_code());
3939
4641
  }
@@ -3965,10 +4667,10 @@ void JSFunction::ReplaceCode(Code* code) {
3965
4667
  // Add/remove the function from the list of optimized functions for this
3966
4668
  // context based on the state change.
3967
4669
  if (!was_optimized && is_optimized) {
3968
- context()->global_context()->AddOptimizedFunction(this);
4670
+ context()->native_context()->AddOptimizedFunction(this);
3969
4671
  }
3970
4672
  if (was_optimized && !is_optimized) {
3971
- context()->global_context()->RemoveOptimizedFunction(this);
4673
+ context()->native_context()->RemoveOptimizedFunction(this);
3972
4674
  }
3973
4675
  }
3974
4676
 
@@ -4009,45 +4711,6 @@ void JSFunction::set_initial_map(Map* value) {
4009
4711
  }
4010
4712
 
4011
4713
 
4012
- MaybeObject* JSFunction::set_initial_map_and_cache_transitions(
4013
- Map* initial_map) {
4014
- Context* global_context = context()->global_context();
4015
- Object* array_function =
4016
- global_context->get(Context::ARRAY_FUNCTION_INDEX);
4017
- if (array_function->IsJSFunction() &&
4018
- this == JSFunction::cast(array_function)) {
4019
- // Replace all of the cached initial array maps in the global context with
4020
- // the appropriate transitioned elements kind maps.
4021
- Heap* heap = GetHeap();
4022
- MaybeObject* maybe_maps =
4023
- heap->AllocateFixedArrayWithHoles(kElementsKindCount);
4024
- FixedArray* maps;
4025
- if (!maybe_maps->To(&maps)) return maybe_maps;
4026
-
4027
- Map* current_map = initial_map;
4028
- ElementsKind kind = current_map->elements_kind();
4029
- ASSERT(kind == GetInitialFastElementsKind());
4030
- maps->set(kind, current_map);
4031
- for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1;
4032
- i < kFastElementsKindCount; ++i) {
4033
- ElementsKind transitioned_kind = GetFastElementsKindFromSequenceIndex(i);
4034
- MaybeObject* maybe_new_map = current_map->CopyDropTransitions();
4035
- Map* new_map = NULL;
4036
- if (!maybe_new_map->To<Map>(&new_map)) return maybe_new_map;
4037
- new_map->set_elements_kind(transitioned_kind);
4038
- maybe_new_map = current_map->AddElementsTransition(transitioned_kind,
4039
- new_map);
4040
- if (maybe_new_map->IsFailure()) return maybe_new_map;
4041
- maps->set(transitioned_kind, new_map);
4042
- current_map = new_map;
4043
- }
4044
- global_context->set_js_array_maps(maps);
4045
- }
4046
- set_initial_map(initial_map);
4047
- return this;
4048
- }
4049
-
4050
-
4051
4714
  bool JSFunction::has_initial_map() {
4052
4715
  return prototype_or_initial_map()->IsMap();
4053
4716
  }
@@ -4080,6 +4743,7 @@ Object* JSFunction::prototype() {
4080
4743
  return instance_prototype();
4081
4744
  }
4082
4745
 
4746
+
4083
4747
  bool JSFunction::should_have_prototype() {
4084
4748
  return map()->function_with_prototype();
4085
4749
  }
@@ -4183,6 +4847,7 @@ void Foreign::set_foreign_address(Address value) {
4183
4847
 
4184
4848
 
4185
4849
  ACCESSORS(JSModule, context, Object, kContextOffset)
4850
+ ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset)
4186
4851
 
4187
4852
 
4188
4853
  JSModule* JSModule::cast(Object* obj) {
@@ -4237,13 +4902,66 @@ JSMessageObject* JSMessageObject::cast(Object* obj) {
4237
4902
 
4238
4903
 
4239
4904
  INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
4905
+ INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
4240
4906
  ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
4241
4907
  ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset)
4242
4908
  ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
4243
- ACCESSORS(Code, type_feedback_info, Object, kTypeFeedbackInfoOffset)
4909
+
4910
+
4911
+ // Type feedback slot: type_feedback_info for FUNCTIONs, stub_info for STUBs.
4912
+ void Code::InitializeTypeFeedbackInfoNoWriteBarrier(Object* value) {
4913
+ WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
4914
+ }
4915
+
4916
+
4917
+ Object* Code::type_feedback_info() {
4918
+ ASSERT(kind() == FUNCTION);
4919
+ return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset));
4920
+ }
4921
+
4922
+
4923
+ void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
4924
+ ASSERT(kind() == FUNCTION);
4925
+ WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
4926
+ CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
4927
+ value, mode);
4928
+ }
4929
+
4930
+
4931
+ int Code::stub_info() {
4932
+ ASSERT(kind() == COMPARE_IC || kind() == BINARY_OP_IC || kind() == LOAD_IC);
4933
+ Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset);
4934
+ return Smi::cast(value)->value();
4935
+ }
4936
+
4937
+
4938
+ void Code::set_stub_info(int value) {
4939
+ ASSERT(kind() == COMPARE_IC ||
4940
+ kind() == BINARY_OP_IC ||
4941
+ kind() == LOAD_IC ||
4942
+ kind() == KEYED_LOAD_IC ||
4943
+ kind() == STORE_IC ||
4944
+ kind() == KEYED_STORE_IC);
4945
+ WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value));
4946
+ }
4947
+
4948
+
4949
+ void Code::set_deoptimizing_functions(Object* value) {
4950
+ ASSERT(kind() == OPTIMIZED_FUNCTION);
4951
+ WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
4952
+ }
4953
+
4954
+
4955
+ Object* Code::deoptimizing_functions() {
4956
+ ASSERT(kind() == OPTIMIZED_FUNCTION);
4957
+ return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset));
4958
+ }
4959
+
4960
+
4244
4961
  ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset)
4245
4962
  INT_ACCESSORS(Code, ic_age, kICAgeOffset)
4246
4963
 
4964
+
4247
4965
  byte* Code::instruction_start() {
4248
4966
  return FIELD_ADDR(this, kHeaderSize);
4249
4967
  }
@@ -4424,6 +5142,11 @@ bool JSObject::HasFastHoleyElements() {
4424
5142
  }
4425
5143
 
4426
5144
 
5145
+ bool JSObject::HasFastElements() {
5146
+ return IsFastElementsKind(GetElementsKind());
5147
+ }
5148
+
5149
+
4427
5150
  bool JSObject::HasDictionaryElements() {
4428
5151
  return GetElementsKind() == DICTIONARY_ELEMENTS;
4429
5152
  }
@@ -4530,8 +5253,7 @@ StringHasher::StringHasher(int length, uint32_t seed)
4530
5253
  raw_running_hash_(seed),
4531
5254
  array_index_(0),
4532
5255
  is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
4533
- is_first_char_(true),
4534
- is_valid_(true) {
5256
+ is_first_char_(true) {
4535
5257
  ASSERT(FLAG_randomize_hashes || raw_running_hash_ == 0);
4536
5258
  }
4537
5259
 
@@ -4541,77 +5263,81 @@ bool StringHasher::has_trivial_hash() {
4541
5263
  }
4542
5264
 
4543
5265
 
4544
- void StringHasher::AddCharacter(uint32_t c) {
4545
- if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) {
4546
- AddSurrogatePair(c); // Not inlined.
4547
- return;
5266
+ uint32_t StringHasher::AddCharacterCore(uint32_t running_hash, uint16_t c) {
5267
+ running_hash += c;
5268
+ running_hash += (running_hash << 10);
5269
+ running_hash ^= (running_hash >> 6);
5270
+ return running_hash;
5271
+ }
5272
+
5273
+
5274
+ uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
5275
+ running_hash += (running_hash << 3);
5276
+ running_hash ^= (running_hash >> 11);
5277
+ running_hash += (running_hash << 15);
5278
+ if ((running_hash & String::kHashBitMask) == 0) {
5279
+ return kZeroHash;
4548
5280
  }
5281
+ return running_hash;
5282
+ }
5283
+
5284
+
5285
+ void StringHasher::AddCharacter(uint16_t c) {
4549
5286
  // Use the Jenkins one-at-a-time hash function to update the hash
4550
5287
  // for the given character.
4551
- raw_running_hash_ += c;
4552
- raw_running_hash_ += (raw_running_hash_ << 10);
4553
- raw_running_hash_ ^= (raw_running_hash_ >> 6);
4554
- // Incremental array index computation.
4555
- if (is_array_index_) {
4556
- if (c < '0' || c > '9') {
4557
- is_array_index_ = false;
4558
- } else {
4559
- int d = c - '0';
4560
- if (is_first_char_) {
4561
- is_first_char_ = false;
4562
- if (c == '0' && length_ > 1) {
4563
- is_array_index_ = false;
4564
- return;
4565
- }
4566
- }
4567
- if (array_index_ > 429496729U - ((d + 2) >> 3)) {
4568
- is_array_index_ = false;
4569
- } else {
4570
- array_index_ = array_index_ * 10 + d;
4571
- }
4572
- }
4573
- }
5288
+ raw_running_hash_ = AddCharacterCore(raw_running_hash_, c);
4574
5289
  }
4575
5290
 
4576
5291
 
4577
- void StringHasher::AddCharacterNoIndex(uint32_t c) {
4578
- ASSERT(!is_array_index());
4579
- if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) {
4580
- AddSurrogatePairNoIndex(c); // Not inlined.
4581
- return;
5292
+ bool StringHasher::UpdateIndex(uint16_t c) {
5293
+ ASSERT(is_array_index_);
5294
+ if (c < '0' || c > '9') {
5295
+ is_array_index_ = false;
5296
+ return false;
5297
+ }
5298
+ int d = c - '0';
5299
+ if (is_first_char_) {
5300
+ is_first_char_ = false;
5301
+ if (c == '0' && length_ > 1) {
5302
+ is_array_index_ = false;
5303
+ return false;
5304
+ }
5305
+ }
5306
+ if (array_index_ > 429496729U - ((d + 2) >> 3)) {
5307
+ is_array_index_ = false;
5308
+ return false;
4582
5309
  }
4583
- raw_running_hash_ += c;
4584
- raw_running_hash_ += (raw_running_hash_ << 10);
4585
- raw_running_hash_ ^= (raw_running_hash_ >> 6);
5310
+ array_index_ = array_index_ * 10 + d;
5311
+ return true;
4586
5312
  }
4587
5313
 
4588
5314
 
4589
- uint32_t StringHasher::GetHash() {
4590
- // Get the calculated raw hash value and do some more bit ops to distribute
4591
- // the hash further. Ensure that we never return zero as the hash value.
4592
- uint32_t result = raw_running_hash_;
4593
- result += (result << 3);
4594
- result ^= (result >> 11);
4595
- result += (result << 15);
4596
- if ((result & String::kHashBitMask) == 0) {
4597
- result = 27;
5315
+ template<typename Char>
5316
+ inline void StringHasher::AddCharacters(const Char* chars, int length) {
5317
+ ASSERT(sizeof(Char) == 1 || sizeof(Char) == 2);
5318
+ int i = 0;
5319
+ if (is_array_index_) {
5320
+ for (; i < length; i++) {
5321
+ AddCharacter(chars[i]);
5322
+ if (!UpdateIndex(chars[i])) {
5323
+ i++;
5324
+ break;
5325
+ }
5326
+ }
5327
+ }
5328
+ for (; i < length; i++) {
5329
+ ASSERT(!is_array_index_);
5330
+ AddCharacter(chars[i]);
4598
5331
  }
4599
- return result;
4600
5332
  }
4601
5333
 
4602
5334
 
4603
5335
  template <typename schar>
4604
- uint32_t HashSequentialString(const schar* chars, int length, uint32_t seed) {
5336
+ uint32_t StringHasher::HashSequentialString(const schar* chars,
5337
+ int length,
5338
+ uint32_t seed) {
4605
5339
  StringHasher hasher(length, seed);
4606
- if (!hasher.has_trivial_hash()) {
4607
- int i;
4608
- for (i = 0; hasher.is_array_index() && (i < length); i++) {
4609
- hasher.AddCharacter(chars[i]);
4610
- }
4611
- for (; i < length; i++) {
4612
- hasher.AddCharacterNoIndex(chars[i]);
4613
- }
4614
- }
5340
+ if (!hasher.has_trivial_hash()) hasher.AddCharacters(chars, length);
4615
5341
  return hasher.GetHashField();
4616
5342
  }
4617
5343
 
@@ -4626,7 +5352,12 @@ bool String::AsArrayIndex(uint32_t* index) {
4626
5352
 
4627
5353
 
4628
5354
  Object* JSReceiver::GetPrototype() {
4629
- return HeapObject::cast(this)->map()->prototype();
5355
+ return map()->prototype();
5356
+ }
5357
+
5358
+
5359
+ Object* JSReceiver::GetConstructor() {
5360
+ return map()->constructor();
4630
5361
  }
4631
5362
 
4632
5363
 
@@ -4647,9 +5378,23 @@ bool JSReceiver::HasLocalProperty(String* name) {
4647
5378
 
4648
5379
 
4649
5380
  PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) {
5381
+ uint32_t index;
5382
+ if (IsJSObject() && key->AsArrayIndex(&index)) {
5383
+ return GetElementAttribute(index);
5384
+ }
4650
5385
  return GetPropertyAttributeWithReceiver(this, key);
4651
5386
  }
4652
5387
 
5388
+
5389
+ PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) {
5390
+ if (IsJSProxy()) {
5391
+ return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index);
5392
+ }
5393
+ return JSObject::cast(this)->GetElementAttributeWithReceiver(
5394
+ this, index, true);
5395
+ }
5396
+
5397
+
4653
5398
  // TODO(504): this may be useful in other places too where JSGlobalProxy
4654
5399
  // is used.
4655
5400
  Object* JSObject::BypassGlobalProxy() {
@@ -4674,7 +5419,26 @@ bool JSReceiver::HasElement(uint32_t index) {
4674
5419
  if (IsJSProxy()) {
4675
5420
  return JSProxy::cast(this)->HasElementWithHandler(index);
4676
5421
  }
4677
- return JSObject::cast(this)->HasElementWithReceiver(this, index);
5422
+ return JSObject::cast(this)->GetElementAttributeWithReceiver(
5423
+ this, index, true) != ABSENT;
5424
+ }
5425
+
5426
+
5427
+ bool JSReceiver::HasLocalElement(uint32_t index) {
5428
+ if (IsJSProxy()) {
5429
+ return JSProxy::cast(this)->HasElementWithHandler(index);
5430
+ }
5431
+ return JSObject::cast(this)->GetElementAttributeWithReceiver(
5432
+ this, index, false) != ABSENT;
5433
+ }
5434
+
5435
+
5436
+ PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) {
5437
+ if (IsJSProxy()) {
5438
+ return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index);
5439
+ }
5440
+ return JSObject::cast(this)->GetElementAttributeWithReceiver(
5441
+ this, index, false);
4678
5442
  }
4679
5443
 
4680
5444
 
@@ -4718,6 +5482,13 @@ void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
4718
5482
  }
4719
5483
 
4720
5484
 
5485
+ bool AccessorInfo::IsCompatibleReceiver(Object* receiver) {
5486
+ Object* function_template = expected_receiver_type();
5487
+ if (!function_template->IsFunctionTemplateInfo()) return true;
5488
+ return receiver->IsInstanceOf(FunctionTemplateInfo::cast(function_template));
5489
+ }
5490
+
5491
+
4721
5492
  template<typename Shape, typename Key>
4722
5493
  void Dictionary<Shape, Key>::SetEntry(int entry,
4723
5494
  Object* key,
@@ -4731,7 +5502,9 @@ void Dictionary<Shape, Key>::SetEntry(int entry,
4731
5502
  Object* key,
4732
5503
  Object* value,
4733
5504
  PropertyDetails details) {
4734
- ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0);
5505
+ ASSERT(!key->IsString() ||
5506
+ details.IsDeleted() ||
5507
+ details.dictionary_index() > 0);
4735
5508
  int index = HashTable<Shape, Key>::EntryToIndex(entry);
4736
5509
  AssertNoAllocation no_gc;
4737
5510
  WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
@@ -4829,8 +5602,8 @@ void Map::ClearCodeCache(Heap* heap) {
4829
5602
  // Please note this function is used during marking:
4830
5603
  // - MarkCompactCollector::MarkUnmarkedObject
4831
5604
  // - IncrementalMarking::Step
4832
- ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array()));
4833
- WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array());
5605
+ ASSERT(!heap->InNewSpace(heap->empty_fixed_array()));
5606
+ WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array());
4834
5607
  }
4835
5608
 
4836
5609
 
@@ -4893,13 +5666,13 @@ MaybeObject* FixedDoubleArray::Copy() {
4893
5666
  }
4894
5667
 
4895
5668
 
4896
- void TypeFeedbackCells::SetAstId(int index, Smi* id) {
4897
- set(1 + index * 2, id);
5669
+ void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) {
5670
+ set(1 + index * 2, Smi::FromInt(id.ToInt()));
4898
5671
  }
4899
5672
 
4900
5673
 
4901
- Smi* TypeFeedbackCells::AstId(int index) {
4902
- return Smi::cast(get(1 + index * 2));
5674
+ TypeFeedbackId TypeFeedbackCells::AstId(int index) {
5675
+ return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value());
4903
5676
  }
4904
5677
 
4905
5678
 
@@ -4924,13 +5697,88 @@ Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) {
4924
5697
 
4925
5698
 
4926
5699
  Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) {
4927
- return heap->raw_unchecked_the_hole_value();
5700
+ return heap->the_hole_value();
5701
+ }
5702
+
5703
+
5704
+ int TypeFeedbackInfo::ic_total_count() {
5705
+ int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
5706
+ return ICTotalCountField::decode(current);
5707
+ }
5708
+
5709
+
5710
+ void TypeFeedbackInfo::set_ic_total_count(int count) {
5711
+ int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
5712
+ value = ICTotalCountField::update(value,
5713
+ ICTotalCountField::decode(count));
5714
+ WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value));
5715
+ }
5716
+
5717
+
5718
+ int TypeFeedbackInfo::ic_with_type_info_count() {
5719
+ int current = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
5720
+ return ICsWithTypeInfoCountField::decode(current);
5721
+ }
5722
+
5723
+
5724
+ void TypeFeedbackInfo::change_ic_with_type_info_count(int delta) {
5725
+ int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
5726
+ int new_count = ICsWithTypeInfoCountField::decode(value) + delta;
5727
+ // We can get negative count here when the type-feedback info is
5728
+ // shared between two code objects. The can only happen when
5729
+ // the debugger made a shallow copy of code object (see Heap::CopyCode).
5730
+ // Since we do not optimize when the debugger is active, we can skip
5731
+ // this counter update.
5732
+ if (new_count >= 0) {
5733
+ new_count &= ICsWithTypeInfoCountField::kMask;
5734
+ value = ICsWithTypeInfoCountField::update(value, new_count);
5735
+ WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value));
5736
+ }
5737
+ }
5738
+
5739
+
5740
+ void TypeFeedbackInfo::initialize_storage() {
5741
+ WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(0));
5742
+ WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(0));
5743
+ }
5744
+
5745
+
5746
+ void TypeFeedbackInfo::change_own_type_change_checksum() {
5747
+ int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
5748
+ int checksum = OwnTypeChangeChecksum::decode(value);
5749
+ checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits);
5750
+ value = OwnTypeChangeChecksum::update(value, checksum);
5751
+ // Ensure packed bit field is in Smi range.
5752
+ if (value > Smi::kMaxValue) value |= Smi::kMinValue;
5753
+ if (value < Smi::kMinValue) value &= ~Smi::kMinValue;
5754
+ WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value));
5755
+ }
5756
+
5757
+
5758
+ void TypeFeedbackInfo::set_inlined_type_change_checksum(int checksum) {
5759
+ int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
5760
+ int mask = (1 << kTypeChangeChecksumBits) - 1;
5761
+ value = InlinedTypeChangeChecksum::update(value, checksum & mask);
5762
+ // Ensure packed bit field is in Smi range.
5763
+ if (value > Smi::kMaxValue) value |= Smi::kMinValue;
5764
+ if (value < Smi::kMinValue) value &= ~Smi::kMinValue;
5765
+ WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value));
5766
+ }
5767
+
5768
+
5769
+ int TypeFeedbackInfo::own_type_change_checksum() {
5770
+ int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
5771
+ return OwnTypeChangeChecksum::decode(value);
5772
+ }
5773
+
5774
+
5775
+ bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) {
5776
+ int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
5777
+ int mask = (1 << kTypeChangeChecksumBits) - 1;
5778
+ return InlinedTypeChangeChecksum::decode(value) == (checksum & mask);
4928
5779
  }
4929
5780
 
4930
5781
 
4931
- SMI_ACCESSORS(TypeFeedbackInfo, ic_total_count, kIcTotalCountOffset)
4932
- SMI_ACCESSORS(TypeFeedbackInfo, ic_with_type_info_count,
4933
- kIcWithTypeinfoCountOffset)
4934
5782
  ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells,
4935
5783
  kTypeFeedbackCellsOffset)
4936
5784
 
@@ -5000,14 +5848,13 @@ void ExternalTwoByteString::ExternalTwoByteStringIterateBody() {
5000
5848
  reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
5001
5849
  }
5002
5850
 
5003
- #define SLOT_ADDR(obj, offset) \
5004
- reinterpret_cast<Object**>((obj)->address() + offset)
5005
5851
 
5006
5852
  template<int start_offset, int end_offset, int size>
5007
5853
  void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody(
5008
5854
  HeapObject* obj,
5009
5855
  ObjectVisitor* v) {
5010
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, end_offset));
5856
+ v->VisitPointers(HeapObject::RawField(obj, start_offset),
5857
+ HeapObject::RawField(obj, end_offset));
5011
5858
  }
5012
5859
 
5013
5860
 
@@ -5015,10 +5862,10 @@ template<int start_offset>
5015
5862
  void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
5016
5863
  int object_size,
5017
5864
  ObjectVisitor* v) {
5018
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, object_size));
5865
+ v->VisitPointers(HeapObject::RawField(obj, start_offset),
5866
+ HeapObject::RawField(obj, object_size));
5019
5867
  }
5020
5868
 
5021
- #undef SLOT_ADDR
5022
5869
 
5023
5870
  #undef TYPE_CHECKER
5024
5871
  #undef CAST_ACCESSOR