mustang 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (560) hide show
  1. data/.rspec +1 -0
  2. data/Isolate +9 -0
  3. data/README.md +6 -12
  4. data/Rakefile +30 -4
  5. data/TODO.md +9 -0
  6. data/ext/v8/extconf.rb +56 -0
  7. data/ext/v8/v8.cpp +37 -0
  8. data/ext/v8/v8_array.cpp +161 -0
  9. data/ext/v8/v8_array.h +17 -0
  10. data/ext/v8/v8_base.cpp +147 -0
  11. data/ext/v8/v8_base.h +23 -0
  12. data/ext/v8/v8_cast.cpp +151 -0
  13. data/ext/v8/v8_cast.h +64 -0
  14. data/ext/v8/v8_context.cpp +174 -0
  15. data/ext/v8/v8_context.h +12 -0
  16. data/ext/v8/v8_date.cpp +61 -0
  17. data/ext/v8/v8_date.h +16 -0
  18. data/ext/v8/v8_errors.cpp +147 -0
  19. data/ext/v8/v8_errors.h +19 -0
  20. data/ext/v8/v8_external.cpp +66 -0
  21. data/ext/v8/v8_external.h +16 -0
  22. data/ext/v8/v8_function.cpp +182 -0
  23. data/ext/v8/v8_function.h +14 -0
  24. data/ext/v8/v8_integer.cpp +70 -0
  25. data/ext/v8/v8_integer.h +16 -0
  26. data/ext/v8/v8_macros.h +30 -0
  27. data/ext/v8/v8_main.cpp +53 -0
  28. data/ext/v8/v8_main.h +13 -0
  29. data/ext/v8/v8_number.cpp +62 -0
  30. data/ext/v8/v8_number.h +16 -0
  31. data/ext/v8/v8_object.cpp +172 -0
  32. data/ext/v8/v8_object.h +17 -0
  33. data/ext/v8/v8_ref.cpp +72 -0
  34. data/ext/v8/v8_ref.h +43 -0
  35. data/ext/v8/v8_regexp.cpp +148 -0
  36. data/ext/v8/v8_regexp.h +16 -0
  37. data/ext/v8/v8_string.cpp +78 -0
  38. data/ext/v8/v8_string.h +16 -0
  39. data/ext/v8/v8_value.cpp +370 -0
  40. data/ext/v8/v8_value.h +19 -0
  41. data/gemspec.yml +2 -1
  42. data/lib/core_ext/class.rb +14 -0
  43. data/lib/core_ext/object.rb +12 -0
  44. data/lib/core_ext/symbol.rb +23 -0
  45. data/lib/mustang.rb +44 -0
  46. data/lib/mustang/context.rb +69 -0
  47. data/lib/mustang/errors.rb +36 -0
  48. data/lib/support/delegated.rb +25 -0
  49. data/lib/v8/array.rb +21 -0
  50. data/lib/v8/context.rb +13 -0
  51. data/lib/v8/date.rb +20 -0
  52. data/lib/v8/error.rb +15 -0
  53. data/lib/v8/external.rb +16 -0
  54. data/lib/v8/function.rb +11 -0
  55. data/lib/v8/integer.rb +16 -0
  56. data/lib/v8/number.rb +16 -0
  57. data/lib/v8/object.rb +66 -0
  58. data/lib/v8/regexp.rb +23 -0
  59. data/lib/v8/string.rb +27 -0
  60. data/mustang.gemspec +3 -0
  61. data/spec/core_ext/class_spec.rb +19 -0
  62. data/spec/core_ext/object_spec.rb +19 -0
  63. data/spec/core_ext/symbol_spec.rb +27 -0
  64. data/spec/fixtures/test1.js +2 -0
  65. data/spec/fixtures/test2.js +2 -0
  66. data/spec/spec_helper.rb +20 -0
  67. data/spec/v8/array_spec.rb +88 -0
  68. data/spec/v8/cast_spec.rb +151 -0
  69. data/spec/v8/context_spec.rb +78 -0
  70. data/spec/v8/data_spec.rb +39 -0
  71. data/spec/v8/date_spec.rb +45 -0
  72. data/spec/v8/empty_spec.rb +27 -0
  73. data/spec/v8/errors_spec.rb +142 -0
  74. data/spec/v8/external_spec.rb +44 -0
  75. data/spec/v8/function_spec.rb +170 -0
  76. data/spec/v8/integer_spec.rb +41 -0
  77. data/spec/v8/main_spec.rb +18 -0
  78. data/spec/v8/null_spec.rb +27 -0
  79. data/spec/v8/number_spec.rb +40 -0
  80. data/spec/v8/object_spec.rb +79 -0
  81. data/spec/v8/primitive_spec.rb +9 -0
  82. data/spec/v8/regexp_spec.rb +65 -0
  83. data/spec/v8/string_spec.rb +48 -0
  84. data/spec/v8/undefined_spec.rb +27 -0
  85. data/spec/v8/value_spec.rb +215 -0
  86. data/vendor/v8/.gitignore +2 -0
  87. data/vendor/v8/AUTHORS +3 -1
  88. data/vendor/v8/ChangeLog +117 -0
  89. data/vendor/v8/SConstruct +334 -53
  90. data/vendor/v8/include/v8-debug.h +21 -11
  91. data/vendor/v8/include/v8-preparser.h +1 -1
  92. data/vendor/v8/include/v8-profiler.h +122 -43
  93. data/vendor/v8/include/v8-testing.h +5 -0
  94. data/vendor/v8/include/v8.h +171 -17
  95. data/vendor/v8/preparser/SConscript +38 -0
  96. data/vendor/v8/preparser/preparser-process.cc +77 -114
  97. data/vendor/v8/samples/shell.cc +232 -46
  98. data/vendor/v8/src/SConscript +29 -5
  99. data/vendor/v8/src/accessors.cc +70 -211
  100. data/vendor/v8/{test/cctest/test-mips.cc → src/allocation-inl.h} +15 -18
  101. data/vendor/v8/src/allocation.cc +0 -82
  102. data/vendor/v8/src/allocation.h +9 -42
  103. data/vendor/v8/src/api.cc +1645 -1156
  104. data/vendor/v8/src/api.h +76 -12
  105. data/vendor/v8/src/apiutils.h +0 -7
  106. data/vendor/v8/src/arguments.h +15 -4
  107. data/vendor/v8/src/arm/assembler-arm-inl.h +10 -9
  108. data/vendor/v8/src/arm/assembler-arm.cc +62 -23
  109. data/vendor/v8/src/arm/assembler-arm.h +76 -11
  110. data/vendor/v8/src/arm/builtins-arm.cc +39 -33
  111. data/vendor/v8/src/arm/code-stubs-arm.cc +1182 -402
  112. data/vendor/v8/src/arm/code-stubs-arm.h +20 -54
  113. data/vendor/v8/src/arm/codegen-arm.cc +159 -106
  114. data/vendor/v8/src/arm/codegen-arm.h +6 -6
  115. data/vendor/v8/src/arm/constants-arm.h +16 -1
  116. data/vendor/v8/src/arm/cpu-arm.cc +7 -5
  117. data/vendor/v8/src/arm/debug-arm.cc +6 -4
  118. data/vendor/v8/src/arm/deoptimizer-arm.cc +51 -14
  119. data/vendor/v8/src/arm/disasm-arm.cc +47 -15
  120. data/vendor/v8/src/arm/frames-arm.h +1 -1
  121. data/vendor/v8/src/arm/full-codegen-arm.cc +724 -408
  122. data/vendor/v8/src/arm/ic-arm.cc +90 -85
  123. data/vendor/v8/src/arm/lithium-arm.cc +140 -69
  124. data/vendor/v8/src/arm/lithium-arm.h +161 -46
  125. data/vendor/v8/src/arm/lithium-codegen-arm.cc +567 -297
  126. data/vendor/v8/src/arm/lithium-codegen-arm.h +21 -9
  127. data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +2 -0
  128. data/vendor/v8/src/arm/macro-assembler-arm.cc +457 -96
  129. data/vendor/v8/src/arm/macro-assembler-arm.h +115 -18
  130. data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +20 -13
  131. data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +1 -0
  132. data/vendor/v8/src/arm/simulator-arm.cc +184 -101
  133. data/vendor/v8/src/arm/simulator-arm.h +26 -21
  134. data/vendor/v8/src/arm/stub-cache-arm.cc +450 -467
  135. data/vendor/v8/src/arm/virtual-frame-arm.cc +14 -12
  136. data/vendor/v8/src/arm/virtual-frame-arm.h +11 -8
  137. data/vendor/v8/src/array.js +35 -18
  138. data/vendor/v8/src/assembler.cc +186 -92
  139. data/vendor/v8/src/assembler.h +106 -69
  140. data/vendor/v8/src/ast-inl.h +5 -0
  141. data/vendor/v8/src/ast.cc +46 -35
  142. data/vendor/v8/src/ast.h +107 -50
  143. data/vendor/v8/src/atomicops.h +2 -0
  144. data/vendor/v8/src/atomicops_internals_mips_gcc.h +169 -0
  145. data/vendor/v8/src/bootstrapper.cc +649 -399
  146. data/vendor/v8/src/bootstrapper.h +94 -27
  147. data/vendor/v8/src/builtins.cc +359 -227
  148. data/vendor/v8/src/builtins.h +157 -123
  149. data/vendor/v8/src/checks.cc +2 -2
  150. data/vendor/v8/src/checks.h +4 -0
  151. data/vendor/v8/src/code-stubs.cc +27 -17
  152. data/vendor/v8/src/code-stubs.h +38 -17
  153. data/vendor/v8/src/codegen-inl.h +5 -1
  154. data/vendor/v8/src/codegen.cc +27 -17
  155. data/vendor/v8/src/codegen.h +9 -9
  156. data/vendor/v8/src/compilation-cache.cc +92 -206
  157. data/vendor/v8/src/compilation-cache.h +205 -30
  158. data/vendor/v8/src/compiler.cc +107 -120
  159. data/vendor/v8/src/compiler.h +17 -2
  160. data/vendor/v8/src/contexts.cc +22 -15
  161. data/vendor/v8/src/contexts.h +14 -8
  162. data/vendor/v8/src/conversions.cc +86 -30
  163. data/vendor/v8/src/counters.cc +19 -4
  164. data/vendor/v8/src/counters.h +28 -16
  165. data/vendor/v8/src/cpu-profiler-inl.h +4 -3
  166. data/vendor/v8/src/cpu-profiler.cc +123 -72
  167. data/vendor/v8/src/cpu-profiler.h +33 -19
  168. data/vendor/v8/src/cpu.h +2 -0
  169. data/vendor/v8/src/d8-debug.cc +3 -3
  170. data/vendor/v8/src/d8-debug.h +7 -6
  171. data/vendor/v8/src/d8-posix.cc +2 -0
  172. data/vendor/v8/src/d8.cc +22 -12
  173. data/vendor/v8/src/d8.gyp +3 -0
  174. data/vendor/v8/src/d8.js +618 -0
  175. data/vendor/v8/src/data-flow.h +3 -3
  176. data/vendor/v8/src/dateparser.h +4 -2
  177. data/vendor/v8/src/debug-agent.cc +10 -9
  178. data/vendor/v8/src/debug-agent.h +9 -11
  179. data/vendor/v8/src/debug-debugger.js +121 -0
  180. data/vendor/v8/src/debug.cc +331 -227
  181. data/vendor/v8/src/debug.h +248 -219
  182. data/vendor/v8/src/deoptimizer.cc +173 -62
  183. data/vendor/v8/src/deoptimizer.h +119 -19
  184. data/vendor/v8/src/disasm.h +3 -0
  185. data/vendor/v8/src/disassembler.cc +10 -9
  186. data/vendor/v8/src/execution.cc +185 -129
  187. data/vendor/v8/src/execution.h +47 -78
  188. data/vendor/v8/src/extensions/experimental/break-iterator.cc +250 -0
  189. data/vendor/v8/src/extensions/experimental/break-iterator.h +89 -0
  190. data/vendor/v8/src/extensions/experimental/experimental.gyp +2 -0
  191. data/vendor/v8/src/extensions/experimental/i18n-extension.cc +22 -2
  192. data/vendor/v8/src/extensions/externalize-string-extension.cc +2 -2
  193. data/vendor/v8/src/extensions/gc-extension.cc +1 -1
  194. data/vendor/v8/src/factory.cc +261 -154
  195. data/vendor/v8/src/factory.h +162 -158
  196. data/vendor/v8/src/flag-definitions.h +17 -11
  197. data/vendor/v8/src/frame-element.cc +0 -5
  198. data/vendor/v8/src/frame-element.h +9 -13
  199. data/vendor/v8/src/frames-inl.h +7 -0
  200. data/vendor/v8/src/frames.cc +56 -46
  201. data/vendor/v8/src/frames.h +36 -25
  202. data/vendor/v8/src/full-codegen.cc +15 -24
  203. data/vendor/v8/src/full-codegen.h +13 -41
  204. data/vendor/v8/src/func-name-inferrer.cc +7 -6
  205. data/vendor/v8/src/func-name-inferrer.h +1 -1
  206. data/vendor/v8/src/gdb-jit.cc +1 -0
  207. data/vendor/v8/src/global-handles.cc +118 -56
  208. data/vendor/v8/src/global-handles.h +98 -40
  209. data/vendor/v8/src/globals.h +2 -2
  210. data/vendor/v8/src/handles-inl.h +106 -9
  211. data/vendor/v8/src/handles.cc +220 -157
  212. data/vendor/v8/src/handles.h +38 -59
  213. data/vendor/v8/src/hashmap.h +3 -3
  214. data/vendor/v8/src/heap-inl.h +141 -25
  215. data/vendor/v8/src/heap-profiler.cc +117 -63
  216. data/vendor/v8/src/heap-profiler.h +38 -21
  217. data/vendor/v8/src/heap.cc +805 -564
  218. data/vendor/v8/src/heap.h +640 -594
  219. data/vendor/v8/src/hydrogen-instructions.cc +216 -73
  220. data/vendor/v8/src/hydrogen-instructions.h +259 -124
  221. data/vendor/v8/src/hydrogen.cc +996 -1171
  222. data/vendor/v8/src/hydrogen.h +163 -144
  223. data/vendor/v8/src/ia32/assembler-ia32-inl.h +12 -11
  224. data/vendor/v8/src/ia32/assembler-ia32.cc +85 -39
  225. data/vendor/v8/src/ia32/assembler-ia32.h +82 -16
  226. data/vendor/v8/src/ia32/builtins-ia32.cc +64 -58
  227. data/vendor/v8/src/ia32/code-stubs-ia32.cc +248 -324
  228. data/vendor/v8/src/ia32/code-stubs-ia32.h +3 -44
  229. data/vendor/v8/src/ia32/codegen-ia32.cc +217 -165
  230. data/vendor/v8/src/ia32/codegen-ia32.h +3 -0
  231. data/vendor/v8/src/ia32/cpu-ia32.cc +6 -5
  232. data/vendor/v8/src/ia32/debug-ia32.cc +8 -5
  233. data/vendor/v8/src/ia32/deoptimizer-ia32.cc +124 -14
  234. data/vendor/v8/src/ia32/disasm-ia32.cc +85 -62
  235. data/vendor/v8/src/ia32/frames-ia32.h +1 -1
  236. data/vendor/v8/src/ia32/full-codegen-ia32.cc +348 -435
  237. data/vendor/v8/src/ia32/ic-ia32.cc +91 -91
  238. data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +500 -255
  239. data/vendor/v8/src/ia32/lithium-codegen-ia32.h +13 -4
  240. data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +6 -0
  241. data/vendor/v8/src/ia32/lithium-ia32.cc +122 -45
  242. data/vendor/v8/src/ia32/lithium-ia32.h +128 -41
  243. data/vendor/v8/src/ia32/macro-assembler-ia32.cc +109 -84
  244. data/vendor/v8/src/ia32/macro-assembler-ia32.h +18 -9
  245. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +26 -15
  246. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +1 -0
  247. data/vendor/v8/src/ia32/register-allocator-ia32.cc +30 -30
  248. data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
  249. data/vendor/v8/src/ia32/stub-cache-ia32.cc +383 -400
  250. data/vendor/v8/src/ia32/virtual-frame-ia32.cc +36 -13
  251. data/vendor/v8/src/ia32/virtual-frame-ia32.h +11 -5
  252. data/vendor/v8/src/ic-inl.h +12 -2
  253. data/vendor/v8/src/ic.cc +304 -221
  254. data/vendor/v8/src/ic.h +115 -58
  255. data/vendor/v8/src/interpreter-irregexp.cc +25 -21
  256. data/vendor/v8/src/interpreter-irregexp.h +2 -1
  257. data/vendor/v8/src/isolate.cc +883 -0
  258. data/vendor/v8/src/isolate.h +1304 -0
  259. data/vendor/v8/src/json.js +10 -10
  260. data/vendor/v8/src/jsregexp.cc +111 -80
  261. data/vendor/v8/src/jsregexp.h +6 -7
  262. data/vendor/v8/src/jump-target-heavy.cc +5 -8
  263. data/vendor/v8/src/jump-target-heavy.h +0 -6
  264. data/vendor/v8/src/jump-target-inl.h +1 -1
  265. data/vendor/v8/src/jump-target-light.cc +3 -3
  266. data/vendor/v8/src/lithium-allocator-inl.h +2 -0
  267. data/vendor/v8/src/lithium-allocator.cc +42 -30
  268. data/vendor/v8/src/lithium-allocator.h +8 -22
  269. data/vendor/v8/src/lithium.cc +1 -0
  270. data/vendor/v8/src/liveedit.cc +141 -99
  271. data/vendor/v8/src/liveedit.h +7 -2
  272. data/vendor/v8/src/liveobjectlist-inl.h +90 -0
  273. data/vendor/v8/src/liveobjectlist.cc +2537 -1
  274. data/vendor/v8/src/liveobjectlist.h +245 -35
  275. data/vendor/v8/src/log-utils.cc +122 -35
  276. data/vendor/v8/src/log-utils.h +33 -36
  277. data/vendor/v8/src/log.cc +299 -241
  278. data/vendor/v8/src/log.h +177 -110
  279. data/vendor/v8/src/mark-compact.cc +612 -470
  280. data/vendor/v8/src/mark-compact.h +153 -80
  281. data/vendor/v8/src/messages.cc +16 -14
  282. data/vendor/v8/src/messages.js +30 -7
  283. data/vendor/v8/src/mips/assembler-mips-inl.h +155 -35
  284. data/vendor/v8/src/mips/assembler-mips.cc +1093 -219
  285. data/vendor/v8/src/mips/assembler-mips.h +552 -153
  286. data/vendor/v8/src/mips/builtins-mips.cc +43 -100
  287. data/vendor/v8/src/mips/code-stubs-mips.cc +752 -0
  288. data/vendor/v8/src/mips/code-stubs-mips.h +511 -0
  289. data/vendor/v8/src/mips/codegen-mips-inl.h +8 -14
  290. data/vendor/v8/src/mips/codegen-mips.cc +672 -896
  291. data/vendor/v8/src/mips/codegen-mips.h +271 -69
  292. data/vendor/v8/src/mips/constants-mips.cc +44 -20
  293. data/vendor/v8/src/mips/constants-mips.h +238 -40
  294. data/vendor/v8/src/mips/cpu-mips.cc +20 -3
  295. data/vendor/v8/src/mips/debug-mips.cc +35 -7
  296. data/vendor/v8/src/mips/deoptimizer-mips.cc +91 -0
  297. data/vendor/v8/src/mips/disasm-mips.cc +329 -93
  298. data/vendor/v8/src/mips/frames-mips.cc +2 -50
  299. data/vendor/v8/src/mips/frames-mips.h +24 -9
  300. data/vendor/v8/src/mips/full-codegen-mips.cc +473 -23
  301. data/vendor/v8/src/mips/ic-mips.cc +81 -45
  302. data/vendor/v8/src/mips/jump-target-mips.cc +11 -106
  303. data/vendor/v8/src/mips/lithium-codegen-mips.h +65 -0
  304. data/vendor/v8/src/mips/lithium-mips.h +304 -0
  305. data/vendor/v8/src/mips/macro-assembler-mips.cc +2391 -390
  306. data/vendor/v8/src/mips/macro-assembler-mips.h +718 -121
  307. data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +478 -0
  308. data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +250 -0
  309. data/vendor/v8/src/mips/register-allocator-mips-inl.h +0 -3
  310. data/vendor/v8/src/mips/register-allocator-mips.h +3 -2
  311. data/vendor/v8/src/mips/simulator-mips.cc +1009 -221
  312. data/vendor/v8/src/mips/simulator-mips.h +119 -36
  313. data/vendor/v8/src/mips/stub-cache-mips.cc +331 -148
  314. data/vendor/v8/src/mips/{fast-codegen-mips.cc → virtual-frame-mips-inl.h} +11 -30
  315. data/vendor/v8/src/mips/virtual-frame-mips.cc +137 -149
  316. data/vendor/v8/src/mips/virtual-frame-mips.h +294 -312
  317. data/vendor/v8/src/mirror-debugger.js +9 -8
  318. data/vendor/v8/src/mksnapshot.cc +2 -2
  319. data/vendor/v8/src/objects-debug.cc +16 -16
  320. data/vendor/v8/src/objects-inl.h +421 -195
  321. data/vendor/v8/src/objects-printer.cc +7 -7
  322. data/vendor/v8/src/objects-visiting.cc +1 -1
  323. data/vendor/v8/src/objects-visiting.h +33 -12
  324. data/vendor/v8/src/objects.cc +935 -658
  325. data/vendor/v8/src/objects.h +234 -139
  326. data/vendor/v8/src/parser.cc +484 -439
  327. data/vendor/v8/src/parser.h +35 -14
  328. data/vendor/v8/src/platform-cygwin.cc +173 -107
  329. data/vendor/v8/src/platform-freebsd.cc +224 -72
  330. data/vendor/v8/src/platform-linux.cc +234 -95
  331. data/vendor/v8/src/platform-macos.cc +215 -82
  332. data/vendor/v8/src/platform-nullos.cc +9 -3
  333. data/vendor/v8/src/platform-openbsd.cc +22 -7
  334. data/vendor/v8/src/platform-posix.cc +30 -5
  335. data/vendor/v8/src/platform-solaris.cc +120 -38
  336. data/vendor/v8/src/platform-tls-mac.h +62 -0
  337. data/vendor/v8/src/platform-tls-win32.h +62 -0
  338. data/vendor/v8/src/platform-tls.h +50 -0
  339. data/vendor/v8/src/platform-win32.cc +195 -97
  340. data/vendor/v8/src/platform.h +72 -15
  341. data/vendor/v8/src/preparse-data.cc +2 -0
  342. data/vendor/v8/src/preparser-api.cc +8 -2
  343. data/vendor/v8/src/preparser.cc +1 -1
  344. data/vendor/v8/src/prettyprinter.cc +43 -52
  345. data/vendor/v8/src/prettyprinter.h +1 -1
  346. data/vendor/v8/src/profile-generator-inl.h +0 -28
  347. data/vendor/v8/src/profile-generator.cc +942 -685
  348. data/vendor/v8/src/profile-generator.h +210 -176
  349. data/vendor/v8/src/property.cc +6 -0
  350. data/vendor/v8/src/property.h +14 -3
  351. data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +1 -1
  352. data/vendor/v8/src/regexp-macro-assembler.cc +28 -19
  353. data/vendor/v8/src/regexp-macro-assembler.h +11 -6
  354. data/vendor/v8/src/regexp-stack.cc +18 -10
  355. data/vendor/v8/src/regexp-stack.h +45 -21
  356. data/vendor/v8/src/regexp.js +3 -3
  357. data/vendor/v8/src/register-allocator-inl.h +3 -3
  358. data/vendor/v8/src/register-allocator.cc +1 -7
  359. data/vendor/v8/src/register-allocator.h +5 -15
  360. data/vendor/v8/src/rewriter.cc +2 -1
  361. data/vendor/v8/src/runtime-profiler.cc +158 -128
  362. data/vendor/v8/src/runtime-profiler.h +131 -15
  363. data/vendor/v8/src/runtime.cc +2409 -1692
  364. data/vendor/v8/src/runtime.h +93 -17
  365. data/vendor/v8/src/safepoint-table.cc +3 -0
  366. data/vendor/v8/src/safepoint-table.h +9 -3
  367. data/vendor/v8/src/scanner-base.cc +21 -28
  368. data/vendor/v8/src/scanner-base.h +22 -11
  369. data/vendor/v8/src/scanner.cc +3 -5
  370. data/vendor/v8/src/scanner.h +4 -2
  371. data/vendor/v8/src/scopeinfo.cc +11 -16
  372. data/vendor/v8/src/scopeinfo.h +26 -15
  373. data/vendor/v8/src/scopes.cc +67 -37
  374. data/vendor/v8/src/scopes.h +26 -12
  375. data/vendor/v8/src/serialize.cc +193 -154
  376. data/vendor/v8/src/serialize.h +41 -36
  377. data/vendor/v8/src/small-pointer-list.h +163 -0
  378. data/vendor/v8/src/snapshot-common.cc +1 -1
  379. data/vendor/v8/src/snapshot.h +3 -1
  380. data/vendor/v8/src/spaces-inl.h +30 -25
  381. data/vendor/v8/src/spaces.cc +263 -370
  382. data/vendor/v8/src/spaces.h +178 -166
  383. data/vendor/v8/src/string-search.cc +4 -3
  384. data/vendor/v8/src/string-search.h +21 -20
  385. data/vendor/v8/src/string-stream.cc +32 -24
  386. data/vendor/v8/src/string.js +7 -7
  387. data/vendor/v8/src/stub-cache.cc +324 -248
  388. data/vendor/v8/src/stub-cache.h +181 -155
  389. data/vendor/v8/src/token.cc +3 -3
  390. data/vendor/v8/src/token.h +3 -3
  391. data/vendor/v8/src/top.cc +218 -390
  392. data/vendor/v8/src/type-info.cc +98 -32
  393. data/vendor/v8/src/type-info.h +10 -3
  394. data/vendor/v8/src/unicode.cc +1 -1
  395. data/vendor/v8/src/unicode.h +1 -1
  396. data/vendor/v8/src/utils.h +3 -0
  397. data/vendor/v8/src/v8-counters.cc +18 -11
  398. data/vendor/v8/src/v8-counters.h +34 -13
  399. data/vendor/v8/src/v8.cc +66 -121
  400. data/vendor/v8/src/v8.h +7 -4
  401. data/vendor/v8/src/v8globals.h +18 -12
  402. data/vendor/v8/src/{memory.h → v8memory.h} +0 -0
  403. data/vendor/v8/src/v8natives.js +59 -18
  404. data/vendor/v8/src/v8threads.cc +127 -114
  405. data/vendor/v8/src/v8threads.h +42 -35
  406. data/vendor/v8/src/v8utils.h +2 -39
  407. data/vendor/v8/src/variables.h +1 -1
  408. data/vendor/v8/src/version.cc +26 -5
  409. data/vendor/v8/src/version.h +4 -0
  410. data/vendor/v8/src/virtual-frame-heavy-inl.h +2 -4
  411. data/vendor/v8/src/virtual-frame-light-inl.h +5 -4
  412. data/vendor/v8/src/vm-state-inl.h +21 -17
  413. data/vendor/v8/src/vm-state.h +7 -5
  414. data/vendor/v8/src/win32-headers.h +1 -0
  415. data/vendor/v8/src/x64/assembler-x64-inl.h +12 -11
  416. data/vendor/v8/src/x64/assembler-x64.cc +80 -40
  417. data/vendor/v8/src/x64/assembler-x64.h +67 -17
  418. data/vendor/v8/src/x64/builtins-x64.cc +34 -33
  419. data/vendor/v8/src/x64/code-stubs-x64.cc +636 -377
  420. data/vendor/v8/src/x64/code-stubs-x64.h +14 -48
  421. data/vendor/v8/src/x64/codegen-x64-inl.h +1 -1
  422. data/vendor/v8/src/x64/codegen-x64.cc +158 -136
  423. data/vendor/v8/src/x64/codegen-x64.h +4 -1
  424. data/vendor/v8/src/x64/cpu-x64.cc +7 -5
  425. data/vendor/v8/src/x64/debug-x64.cc +8 -6
  426. data/vendor/v8/src/x64/deoptimizer-x64.cc +195 -20
  427. data/vendor/v8/src/x64/disasm-x64.cc +42 -23
  428. data/vendor/v8/src/x64/frames-x64.cc +1 -1
  429. data/vendor/v8/src/x64/frames-x64.h +2 -2
  430. data/vendor/v8/src/x64/full-codegen-x64.cc +780 -218
  431. data/vendor/v8/src/x64/ic-x64.cc +77 -79
  432. data/vendor/v8/src/x64/jump-target-x64.cc +1 -1
  433. data/vendor/v8/src/x64/lithium-codegen-x64.cc +698 -181
  434. data/vendor/v8/src/x64/lithium-codegen-x64.h +31 -6
  435. data/vendor/v8/src/x64/lithium-x64.cc +136 -54
  436. data/vendor/v8/src/x64/lithium-x64.h +142 -51
  437. data/vendor/v8/src/x64/macro-assembler-x64.cc +456 -187
  438. data/vendor/v8/src/x64/macro-assembler-x64.h +166 -34
  439. data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +44 -28
  440. data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +8 -4
  441. data/vendor/v8/src/x64/register-allocator-x64-inl.h +3 -3
  442. data/vendor/v8/src/x64/register-allocator-x64.cc +12 -8
  443. data/vendor/v8/src/x64/simulator-x64.h +5 -5
  444. data/vendor/v8/src/x64/stub-cache-x64.cc +299 -344
  445. data/vendor/v8/src/x64/virtual-frame-x64.cc +37 -13
  446. data/vendor/v8/src/x64/virtual-frame-x64.h +13 -7
  447. data/vendor/v8/src/zone-inl.h +49 -3
  448. data/vendor/v8/src/zone.cc +42 -41
  449. data/vendor/v8/src/zone.h +37 -34
  450. data/vendor/v8/test/benchmarks/testcfg.py +100 -0
  451. data/vendor/v8/test/cctest/SConscript +5 -4
  452. data/vendor/v8/test/cctest/cctest.h +3 -2
  453. data/vendor/v8/test/cctest/cctest.status +6 -11
  454. data/vendor/v8/test/cctest/test-accessors.cc +3 -3
  455. data/vendor/v8/test/cctest/test-alloc.cc +39 -33
  456. data/vendor/v8/test/cctest/test-api.cc +1092 -205
  457. data/vendor/v8/test/cctest/test-assembler-arm.cc +39 -25
  458. data/vendor/v8/test/cctest/test-assembler-ia32.cc +36 -37
  459. data/vendor/v8/test/cctest/test-assembler-mips.cc +1098 -40
  460. data/vendor/v8/test/cctest/test-assembler-x64.cc +32 -25
  461. data/vendor/v8/test/cctest/test-ast.cc +1 -0
  462. data/vendor/v8/test/cctest/test-circular-queue.cc +8 -5
  463. data/vendor/v8/test/cctest/test-compiler.cc +24 -24
  464. data/vendor/v8/test/cctest/test-cpu-profiler.cc +140 -5
  465. data/vendor/v8/test/cctest/test-dataflow.cc +1 -0
  466. data/vendor/v8/test/cctest/test-debug.cc +136 -77
  467. data/vendor/v8/test/cctest/test-decls.cc +1 -1
  468. data/vendor/v8/test/cctest/test-deoptimization.cc +25 -24
  469. data/vendor/v8/test/cctest/test-disasm-arm.cc +9 -4
  470. data/vendor/v8/test/cctest/test-disasm-ia32.cc +10 -8
  471. data/vendor/v8/test/cctest/test-func-name-inference.cc +10 -4
  472. data/vendor/v8/test/cctest/test-heap-profiler.cc +226 -164
  473. data/vendor/v8/test/cctest/test-heap.cc +240 -217
  474. data/vendor/v8/test/cctest/test-liveedit.cc +1 -0
  475. data/vendor/v8/test/cctest/test-log-stack-tracer.cc +18 -20
  476. data/vendor/v8/test/cctest/test-log.cc +114 -108
  477. data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +247 -177
  478. data/vendor/v8/test/cctest/test-mark-compact.cc +129 -90
  479. data/vendor/v8/test/cctest/test-parsing.cc +15 -14
  480. data/vendor/v8/test/cctest/test-platform-linux.cc +1 -0
  481. data/vendor/v8/test/cctest/test-platform-tls.cc +66 -0
  482. data/vendor/v8/test/cctest/test-platform-win32.cc +1 -0
  483. data/vendor/v8/test/cctest/test-profile-generator.cc +1 -1
  484. data/vendor/v8/test/cctest/test-regexp.cc +53 -41
  485. data/vendor/v8/test/cctest/test-reloc-info.cc +18 -11
  486. data/vendor/v8/test/cctest/test-serialize.cc +44 -43
  487. data/vendor/v8/test/cctest/test-sockets.cc +8 -3
  488. data/vendor/v8/test/cctest/test-spaces.cc +47 -29
  489. data/vendor/v8/test/cctest/test-strings.cc +20 -20
  490. data/vendor/v8/test/cctest/test-thread-termination.cc +8 -3
  491. data/vendor/v8/test/cctest/test-threads.cc +5 -3
  492. data/vendor/v8/test/cctest/test-utils.cc +5 -4
  493. data/vendor/v8/test/cctest/testcfg.py +7 -3
  494. data/vendor/v8/test/es5conform/es5conform.status +2 -77
  495. data/vendor/v8/test/es5conform/testcfg.py +1 -1
  496. data/vendor/v8/test/message/testcfg.py +1 -1
  497. data/vendor/v8/test/mjsunit/accessors-on-global-object.js +3 -3
  498. data/vendor/v8/test/mjsunit/array-concat.js +43 -1
  499. data/vendor/v8/test/mjsunit/array-join.js +25 -0
  500. data/vendor/v8/test/mjsunit/bitops-info.js +7 -1
  501. data/vendor/v8/test/mjsunit/compiler/array-length.js +2 -2
  502. data/vendor/v8/test/mjsunit/compiler/global-accessors.js +47 -0
  503. data/vendor/v8/test/mjsunit/compiler/pic.js +1 -1
  504. data/vendor/v8/test/mjsunit/compiler/regress-loadfield.js +65 -0
  505. data/vendor/v8/test/mjsunit/math-sqrt.js +5 -1
  506. data/vendor/v8/test/mjsunit/mjsunit.js +59 -8
  507. data/vendor/v8/test/mjsunit/mjsunit.status +0 -12
  508. data/vendor/v8/test/mjsunit/mul-exhaustive.js +129 -11
  509. data/vendor/v8/test/mjsunit/negate-zero.js +1 -1
  510. data/vendor/v8/test/mjsunit/object-freeze.js +5 -13
  511. data/vendor/v8/test/mjsunit/object-prevent-extensions.js +9 -50
  512. data/vendor/v8/test/mjsunit/object-seal.js +4 -13
  513. data/vendor/v8/test/mjsunit/override-eval-with-non-function.js +36 -0
  514. data/vendor/v8/test/mjsunit/regress/regress-1145.js +54 -0
  515. data/vendor/v8/test/mjsunit/regress/regress-1172-bis.js +37 -0
  516. data/vendor/v8/test/mjsunit/regress/regress-1181.js +54 -0
  517. data/vendor/v8/test/mjsunit/regress/regress-1207.js +35 -0
  518. data/vendor/v8/test/mjsunit/regress/regress-1209.js +34 -0
  519. data/vendor/v8/test/mjsunit/regress/regress-1210.js +48 -0
  520. data/vendor/v8/test/mjsunit/regress/regress-1213.js +43 -0
  521. data/vendor/v8/test/mjsunit/regress/regress-1218.js +29 -0
  522. data/vendor/v8/test/mjsunit/regress/regress-1229.js +79 -0
  523. data/vendor/v8/test/mjsunit/regress/regress-1233.js +47 -0
  524. data/vendor/v8/test/mjsunit/regress/regress-1236.js +34 -0
  525. data/vendor/v8/test/mjsunit/regress/regress-1237.js +36 -0
  526. data/vendor/v8/test/mjsunit/regress/regress-1240.js +39 -0
  527. data/vendor/v8/test/mjsunit/regress/regress-1257.js +58 -0
  528. data/vendor/v8/test/mjsunit/regress/regress-1278.js +69 -0
  529. data/vendor/v8/test/mjsunit/regress/regress-create-exception.js +1 -0
  530. data/vendor/v8/test/mjsunit/regress/regress-lazy-deopt-reloc.js +52 -0
  531. data/vendor/v8/test/mjsunit/sin-cos.js +15 -10
  532. data/vendor/v8/test/mjsunit/smi-negative-zero.js +2 -2
  533. data/vendor/v8/test/mjsunit/str-to-num.js +1 -1
  534. data/vendor/v8/test/mjsunit/strict-mode.js +435 -0
  535. data/vendor/v8/test/mjsunit/testcfg.py +23 -6
  536. data/vendor/v8/test/mozilla/mozilla.status +0 -2
  537. data/vendor/v8/test/mozilla/testcfg.py +1 -1
  538. data/vendor/v8/test/preparser/empty.js +28 -0
  539. data/vendor/v8/test/preparser/functions-only.js +38 -0
  540. data/vendor/v8/test/preparser/non-alphanum.js +34 -0
  541. data/vendor/v8/test/preparser/symbols-only.js +49 -0
  542. data/vendor/v8/test/preparser/testcfg.py +90 -0
  543. data/vendor/v8/test/sputnik/testcfg.py +1 -1
  544. data/vendor/v8/test/test262/README +16 -0
  545. data/vendor/v8/test/test262/harness-adapt.js +80 -0
  546. data/vendor/v8/test/test262/test262.status +1506 -0
  547. data/vendor/v8/test/test262/testcfg.py +123 -0
  548. data/vendor/v8/tools/freebsd-tick-processor +10 -0
  549. data/vendor/v8/tools/gyp/v8.gyp +8 -33
  550. data/vendor/v8/tools/linux-tick-processor +5 -3
  551. data/vendor/v8/tools/test.py +37 -14
  552. data/vendor/v8/tools/tickprocessor.js +22 -8
  553. data/vendor/v8/tools/visual_studio/v8_base.vcproj +13 -1
  554. data/vendor/v8/tools/visual_studio/v8_base_arm.vcproj +5 -1
  555. data/vendor/v8/tools/visual_studio/v8_base_x64.vcproj +5 -1
  556. data/vendor/v8/tools/visual_studio/x64.vsprops +1 -0
  557. metadata +1495 -1341
  558. data/ext/extconf.rb +0 -22
  559. data/ext/mustang.cpp +0 -58
  560. data/vendor/v8/src/top.h +0 -608
@@ -501,7 +501,7 @@ void VirtualFrame::AllocateStackSlots() {
501
501
  // them later. First sync everything above the stack pointer so we can
502
502
  // use pushes to allocate and initialize the locals.
503
503
  SyncRange(stack_pointer_ + 1, element_count() - 1);
504
- Handle<Object> undefined = Factory::undefined_value();
504
+ Handle<Object> undefined = FACTORY->undefined_value();
505
505
  FrameElement initial_value =
506
506
  FrameElement::ConstantElement(undefined, FrameElement::SYNCED);
507
507
  if (count == 1) {
@@ -824,7 +824,7 @@ void VirtualFrame::UntaggedPushFrameSlotAt(int index) {
824
824
  __ bind(&not_smi);
825
825
  if (!original.type_info().IsNumber()) {
826
826
  __ cmp(FieldOperand(fresh_reg, HeapObject::kMapOffset),
827
- Factory::heap_number_map());
827
+ FACTORY->heap_number_map());
828
828
  cgen()->unsafe_bailout_->Branch(not_equal);
829
829
  }
830
830
 
@@ -931,7 +931,7 @@ Result VirtualFrame::CallJSFunction(int arg_count) {
931
931
  }
932
932
 
933
933
 
934
- Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) {
934
+ Result VirtualFrame::CallRuntime(const Runtime::Function* f, int arg_count) {
935
935
  PrepareForCall(arg_count, arg_count);
936
936
  ASSERT(cgen()->HasValidEntryRegisters());
937
937
  __ CallRuntime(f, arg_count);
@@ -1016,7 +1016,8 @@ Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) {
1016
1016
  PrepareForCall(0, 0); // No stack arguments.
1017
1017
  MoveResultsToRegisters(&name, &receiver, ecx, eax);
1018
1018
 
1019
- Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
1019
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1020
+ Builtins::kLoadIC_Initialize));
1020
1021
  return RawCallCodeObject(ic, mode);
1021
1022
  }
1022
1023
 
@@ -1028,7 +1029,8 @@ Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) {
1028
1029
  PrepareForCall(0, 0);
1029
1030
  MoveResultsToRegisters(&key, &receiver, eax, edx);
1030
1031
 
1031
- Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1032
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1033
+ Builtins::kKeyedLoadIC_Initialize));
1032
1034
  return RawCallCodeObject(ic, mode);
1033
1035
  }
1034
1036
 
@@ -1038,9 +1040,9 @@ Result VirtualFrame::CallStoreIC(Handle<String> name,
1038
1040
  StrictModeFlag strict_mode) {
1039
1041
  // Value and (if not contextual) receiver are on top of the frame.
1040
1042
  // The IC expects name in ecx, value in eax, and receiver in edx.
1041
- Handle<Code> ic(Builtins::builtin(strict_mode == kStrictMode
1042
- ? Builtins::StoreIC_Initialize_Strict
1043
- : Builtins::StoreIC_Initialize));
1043
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1044
+ (strict_mode == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict
1045
+ : Builtins::kStoreIC_Initialize));
1044
1046
 
1045
1047
  Result value = Pop();
1046
1048
  RelocInfo::Mode mode;
@@ -1061,7 +1063,7 @@ Result VirtualFrame::CallStoreIC(Handle<String> name,
1061
1063
  }
1062
1064
 
1063
1065
 
1064
- Result VirtualFrame::CallKeyedStoreIC() {
1066
+ Result VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) {
1065
1067
  // Value, key, and receiver are on the top of the frame. The IC
1066
1068
  // expects value in eax, key in ecx, and receiver in edx.
1067
1069
  Result value = Pop();
@@ -1105,7 +1107,9 @@ Result VirtualFrame::CallKeyedStoreIC() {
1105
1107
  receiver.Unuse();
1106
1108
  }
1107
1109
 
1108
- Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
1110
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1111
+ (strict_mode == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict
1112
+ : Builtins::kKeyedStoreIC_Initialize));
1109
1113
  return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
1110
1114
  }
1111
1115
 
@@ -1117,7 +1121,8 @@ Result VirtualFrame::CallCallIC(RelocInfo::Mode mode,
1117
1121
  // The IC expects the name in ecx and the rest on the stack and
1118
1122
  // drops them all.
1119
1123
  InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1120
- Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop);
1124
+ Handle<Code> ic = Isolate::Current()->stub_cache()->ComputeCallInitialize(
1125
+ arg_count, in_loop);
1121
1126
  // Spill args, receiver, and function. The call will drop args and
1122
1127
  // receiver.
1123
1128
  Result name = Pop();
@@ -1135,7 +1140,9 @@ Result VirtualFrame::CallKeyedCallIC(RelocInfo::Mode mode,
1135
1140
  // The IC expects the name in ecx and the rest on the stack and
1136
1141
  // drops them all.
1137
1142
  InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1138
- Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
1143
+ Handle<Code> ic =
1144
+ Isolate::Current()->stub_cache()->ComputeKeyedCallInitialize(arg_count,
1145
+ in_loop);
1139
1146
  // Spill args, receiver, and function. The call will drop args and
1140
1147
  // receiver.
1141
1148
  Result name = Pop();
@@ -1150,7 +1157,8 @@ Result VirtualFrame::CallConstructor(int arg_count) {
1150
1157
  // Arguments, receiver, and function are on top of the frame. The
1151
1158
  // IC expects arg count in eax, function in edi, and the arguments
1152
1159
  // and receiver on the stack.
1153
- Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall));
1160
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1161
+ Builtins::kJSConstructCall));
1154
1162
  // Duplicate the function before preparing the frame.
1155
1163
  PushElementAt(arg_count);
1156
1164
  Result function = Pop();
@@ -1306,6 +1314,7 @@ void VirtualFrame::EmitPush(Immediate immediate, TypeInfo info) {
1306
1314
 
1307
1315
 
1308
1316
  void VirtualFrame::PushUntaggedElement(Handle<Object> value) {
1317
+ ASSERT(!ConstantPoolOverflowed());
1309
1318
  elements_.Add(FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED));
1310
1319
  elements_[element_count() - 1].set_untagged_int32(true);
1311
1320
  }
@@ -1336,6 +1345,20 @@ void VirtualFrame::Push(Expression* expr) {
1336
1345
  }
1337
1346
 
1338
1347
 
1348
+ void VirtualFrame::Push(Handle<Object> value) {
1349
+ if (ConstantPoolOverflowed()) {
1350
+ Result temp = cgen()->allocator()->Allocate();
1351
+ ASSERT(temp.is_valid());
1352
+ __ Set(temp.reg(), Immediate(value));
1353
+ Push(&temp);
1354
+ } else {
1355
+ FrameElement element =
1356
+ FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED);
1357
+ elements_.Add(element);
1358
+ }
1359
+ }
1360
+
1361
+
1339
1362
  #undef __
1340
1363
 
1341
1364
  } } // namespace v8::internal
@@ -67,7 +67,9 @@ class VirtualFrame: public ZoneObject {
67
67
  private:
68
68
  bool previous_state_;
69
69
 
70
- CodeGenerator* cgen() {return CodeGeneratorScope::Current();}
70
+ CodeGenerator* cgen() {
71
+ return CodeGeneratorScope::Current(Isolate::Current());
72
+ }
71
73
  };
72
74
 
73
75
  // An illegal index into the virtual frame.
@@ -79,7 +81,9 @@ class VirtualFrame: public ZoneObject {
79
81
  // Construct a virtual frame as a clone of an existing one.
80
82
  explicit inline VirtualFrame(VirtualFrame* original);
81
83
 
82
- CodeGenerator* cgen() { return CodeGeneratorScope::Current(); }
84
+ CodeGenerator* cgen() {
85
+ return CodeGeneratorScope::Current(Isolate::Current());
86
+ }
83
87
 
84
88
  MacroAssembler* masm() { return cgen()->masm(); }
85
89
 
@@ -344,7 +348,7 @@ class VirtualFrame: public ZoneObject {
344
348
 
345
349
  // Call runtime given the number of arguments expected on (and
346
350
  // removed from) the stack.
347
- Result CallRuntime(Runtime::Function* f, int arg_count);
351
+ Result CallRuntime(const Runtime::Function* f, int arg_count);
348
352
  Result CallRuntime(Runtime::FunctionId id, int arg_count);
349
353
 
350
354
  #ifdef ENABLE_DEBUGGER_SUPPORT
@@ -370,7 +374,7 @@ class VirtualFrame: public ZoneObject {
370
374
 
371
375
  // Call keyed store IC. Value, key, and receiver are found on top
372
376
  // of the frame. All three are dropped.
373
- Result CallKeyedStoreIC();
377
+ Result CallKeyedStoreIC(StrictModeFlag strict_mode);
374
378
 
375
379
  // Call call IC. Function name, arguments, and receiver are found on top
376
380
  // of the frame and dropped by the call. The argument count does not
@@ -419,9 +423,11 @@ class VirtualFrame: public ZoneObject {
419
423
  void EmitPush(Immediate immediate,
420
424
  TypeInfo info = TypeInfo::Unknown());
421
425
 
426
+ inline bool ConstantPoolOverflowed();
427
+
422
428
  // Push an element on the virtual frame.
429
+ void Push(Handle<Object> value);
423
430
  inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown());
424
- inline void Push(Handle<Object> value);
425
431
  inline void Push(Smi* value);
426
432
 
427
433
  void PushUntaggedElement(Handle<Object> value);
@@ -41,13 +41,14 @@ Address IC::address() {
41
41
  Address result = pc() - Assembler::kCallTargetAddressOffset;
42
42
 
43
43
  #ifdef ENABLE_DEBUGGER_SUPPORT
44
+ Debug* debug = Isolate::Current()->debug();
44
45
  // First check if any break points are active if not just return the address
45
46
  // of the call.
46
- if (!Debug::has_break_points()) return result;
47
+ if (!debug->has_break_points()) return result;
47
48
 
48
49
  // At least one break point is active perform additional test to ensure that
49
50
  // break point locations are updated correctly.
50
- if (Debug::IsDebugBreak(Assembler::target_address_at(result))) {
51
+ if (debug->IsDebugBreak(Assembler::target_address_at(result))) {
51
52
  // If the call site is a call to debug break then return the address in
52
53
  // the original code instead of the address in the running code. This will
53
54
  // cause the original code to be updated and keeps the breakpoint active in
@@ -76,6 +77,15 @@ Code* IC::GetTargetAtAddress(Address address) {
76
77
 
77
78
  void IC::SetTargetAtAddress(Address address, Code* target) {
78
79
  ASSERT(target->is_inline_cache_stub() || target->is_compare_ic_stub());
80
+ #ifdef DEBUG
81
+ // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark
82
+ // ICs as strict mode. The strict-ness of the IC must be preserved.
83
+ Code* old_target = GetTargetAtAddress(address);
84
+ if (old_target->kind() == Code::STORE_IC ||
85
+ old_target->kind() == Code::KEYED_STORE_IC) {
86
+ ASSERT(old_target->extra_ic_state() == target->extra_ic_state());
87
+ }
88
+ #endif
79
89
  Assembler::set_target_address_at(address, target->instruction_start());
80
90
  }
81
91
 
data/vendor/v8/src/ic.cc CHANGED
@@ -65,8 +65,8 @@ void IC::TraceIC(const char* type,
65
65
  const char* extra_info) {
66
66
  if (FLAG_trace_ic) {
67
67
  State new_state = StateFrom(new_target,
68
- Heap::undefined_value(),
69
- Heap::undefined_value());
68
+ HEAP->undefined_value(),
69
+ HEAP->undefined_value());
70
70
  PrintF("[%s (%c->%c)%s", type,
71
71
  TransitionMarkFromState(old_state),
72
72
  TransitionMarkFromState(new_state),
@@ -78,11 +78,13 @@ void IC::TraceIC(const char* type,
78
78
  #endif
79
79
 
80
80
 
81
- IC::IC(FrameDepth depth) {
81
+ IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) {
82
+ ASSERT(isolate == Isolate::Current());
82
83
  // To improve the performance of the (much used) IC code, we unfold
83
84
  // a few levels of the stack frame iteration code. This yields a
84
85
  // ~35% speedup when running DeltaBlue with the '--nouse-ic' flag.
85
- const Address entry = Top::c_entry_fp(Top::GetCurrentThread());
86
+ const Address entry =
87
+ Isolate::c_entry_fp(isolate->thread_local_top());
86
88
  Address* pc_address =
87
89
  reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
88
90
  Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
@@ -136,9 +138,11 @@ Address IC::OriginalCodeAddress() {
136
138
  #endif
137
139
 
138
140
 
139
- static bool HasNormalObjectsInPrototypeChain(LookupResult* lookup,
141
+ static bool HasNormalObjectsInPrototypeChain(Isolate* isolate,
142
+ LookupResult* lookup,
140
143
  Object* receiver) {
141
- Object* end = lookup->IsProperty() ? lookup->holder() : Heap::null_value();
144
+ Object* end = lookup->IsProperty()
145
+ ? lookup->holder() : isolate->heap()->null_value();
142
146
  for (Object* current = receiver;
143
147
  current != end;
144
148
  current = current->GetPrototype()) {
@@ -231,7 +235,7 @@ IC::State IC::StateFrom(Code* target, Object* receiver, Object* name) {
231
235
 
232
236
  RelocInfo::Mode IC::ComputeMode() {
233
237
  Address addr = address();
234
- Code* code = Code::cast(Heap::FindCodeObject(addr));
238
+ Code* code = Code::cast(isolate()->heap()->FindCodeObject(addr));
235
239
  for (RelocIterator it(code, RelocInfo::kCodeTargetMask);
236
240
  !it.done(); it.next()) {
237
241
  RelocInfo* info = it.rinfo();
@@ -245,18 +249,19 @@ RelocInfo::Mode IC::ComputeMode() {
245
249
  Failure* IC::TypeError(const char* type,
246
250
  Handle<Object> object,
247
251
  Handle<Object> key) {
248
- HandleScope scope;
252
+ HandleScope scope(isolate());
249
253
  Handle<Object> args[2] = { key, object };
250
- Handle<Object> error = Factory::NewTypeError(type, HandleVector(args, 2));
251
- return Top::Throw(*error);
254
+ Handle<Object> error = isolate()->factory()->NewTypeError(
255
+ type, HandleVector(args, 2));
256
+ return isolate()->Throw(*error);
252
257
  }
253
258
 
254
259
 
255
260
  Failure* IC::ReferenceError(const char* type, Handle<String> name) {
256
- HandleScope scope;
257
- Handle<Object> error =
258
- Factory::NewReferenceError(type, HandleVector(&name, 1));
259
- return Top::Throw(*error);
261
+ HandleScope scope(isolate());
262
+ Handle<Object> error = isolate()->factory()->NewReferenceError(
263
+ type, HandleVector(&name, 1));
264
+ return isolate()->Throw(*error);
260
265
  }
261
266
 
262
267
 
@@ -268,9 +273,13 @@ void IC::Clear(Address address) {
268
273
 
269
274
  switch (target->kind()) {
270
275
  case Code::LOAD_IC: return LoadIC::Clear(address, target);
271
- case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target);
276
+ case Code::KEYED_LOAD_IC:
277
+ case Code::KEYED_EXTERNAL_ARRAY_LOAD_IC:
278
+ return KeyedLoadIC::Clear(address, target);
272
279
  case Code::STORE_IC: return StoreIC::Clear(address, target);
273
- case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target);
280
+ case Code::KEYED_STORE_IC:
281
+ case Code::KEYED_EXTERNAL_ARRAY_STORE_IC:
282
+ return KeyedStoreIC::Clear(address, target);
274
283
  case Code::CALL_IC: return CallIC::Clear(address, target);
275
284
  case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target);
276
285
  case Code::BINARY_OP_IC:
@@ -288,9 +297,10 @@ void CallICBase::Clear(Address address, Code* target) {
288
297
  State state = target->ic_state();
289
298
  if (state == UNINITIALIZED) return;
290
299
  Code* code =
291
- StubCache::FindCallInitialize(target->arguments_count(),
292
- target->ic_in_loop(),
293
- target->kind());
300
+ Isolate::Current()->stub_cache()->FindCallInitialize(
301
+ target->arguments_count(),
302
+ target->ic_in_loop(),
303
+ target->kind());
294
304
  SetTargetAtAddress(address, code);
295
305
  }
296
306
 
@@ -298,7 +308,7 @@ void CallICBase::Clear(Address address, Code* target) {
298
308
  void KeyedLoadIC::ClearInlinedVersion(Address address) {
299
309
  // Insert null as the map to check for to make sure the map check fails
300
310
  // sending control flow to the IC instead of the inlined version.
301
- PatchInlinedLoad(address, Heap::null_value());
311
+ PatchInlinedLoad(address, HEAP->null_value());
302
312
  }
303
313
 
304
314
 
@@ -316,10 +326,11 @@ void LoadIC::ClearInlinedVersion(Address address) {
316
326
  // Reset the map check of the inlined inobject property load (if
317
327
  // present) to guarantee failure by holding an invalid map (the null
318
328
  // value). The offset can be patched to anything.
319
- PatchInlinedLoad(address, Heap::null_value(), 0);
329
+ Heap* heap = HEAP;
330
+ PatchInlinedLoad(address, heap->null_value(), 0);
320
331
  PatchInlinedContextualLoad(address,
321
- Heap::null_value(),
322
- Heap::null_value(),
332
+ heap->null_value(),
333
+ heap->null_value(),
323
334
  true);
324
335
  }
325
336
 
@@ -335,7 +346,7 @@ void StoreIC::ClearInlinedVersion(Address address) {
335
346
  // Reset the map check of the inlined inobject property store (if
336
347
  // present) to guarantee failure by holding an invalid map (the null
337
348
  // value). The offset can be patched to anything.
338
- PatchInlinedStore(address, Heap::null_value(), 0);
349
+ PatchInlinedStore(address, HEAP->null_value(), 0);
339
350
  }
340
351
 
341
352
 
@@ -343,7 +354,7 @@ void StoreIC::Clear(Address address, Code* target) {
343
354
  if (target->ic_state() == UNINITIALIZED) return;
344
355
  ClearInlinedVersion(address);
345
356
  SetTargetAtAddress(address,
346
- target->extra_ic_state() == kStoreICStrict
357
+ (target->extra_ic_state() == kStrictMode)
347
358
  ? initialize_stub_strict()
348
359
  : initialize_stub());
349
360
  }
@@ -353,20 +364,23 @@ void KeyedStoreIC::ClearInlinedVersion(Address address) {
353
364
  // Insert null as the elements map to check for. This will make
354
365
  // sure that the elements fast-case map check fails so that control
355
366
  // flows to the IC instead of the inlined version.
356
- PatchInlinedStore(address, Heap::null_value());
367
+ PatchInlinedStore(address, HEAP->null_value());
357
368
  }
358
369
 
359
370
 
360
371
  void KeyedStoreIC::RestoreInlinedVersion(Address address) {
361
372
  // Restore the fast-case elements map check so that the inlined
362
373
  // version can be used again.
363
- PatchInlinedStore(address, Heap::fixed_array_map());
374
+ PatchInlinedStore(address, HEAP->fixed_array_map());
364
375
  }
365
376
 
366
377
 
367
378
  void KeyedStoreIC::Clear(Address address, Code* target) {
368
379
  if (target->ic_state() == UNINITIALIZED) return;
369
- SetTargetAtAddress(address, initialize_stub());
380
+ SetTargetAtAddress(address,
381
+ (target->extra_ic_state() == kStrictMode)
382
+ ? initialize_stub_strict()
383
+ : initialize_stub());
370
384
  }
371
385
 
372
386
 
@@ -416,8 +430,8 @@ static void LookupForRead(Object* object,
416
430
 
417
431
 
418
432
  Object* CallICBase::TryCallAsFunction(Object* object) {
419
- HandleScope scope;
420
- Handle<Object> target(object);
433
+ HandleScope scope(isolate());
434
+ Handle<Object> target(object, isolate());
421
435
  Handle<Object> delegate = Execution::GetFunctionDelegate(target);
422
436
 
423
437
  if (delegate->IsJSFunction()) {
@@ -452,7 +466,7 @@ void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
452
466
  StackFrameLocator locator;
453
467
  JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
454
468
  int index = frame->ComputeExpressionsCount() - (argc + 1);
455
- frame->SetExpression(index, *Factory::ToObject(object));
469
+ frame->SetExpression(index, *isolate()->factory()->ToObject(object));
456
470
  }
457
471
  }
458
472
 
@@ -524,7 +538,7 @@ MaybeObject* CallICBase::LoadFunction(State state,
524
538
 
525
539
  ASSERT(!result->IsTheHole());
526
540
 
527
- HandleScope scope;
541
+ HandleScope scope(isolate());
528
542
  // Wrap result in a handle because ReceiverToObjectIfRequired may allocate
529
543
  // new object and cause GC.
530
544
  Handle<Object> result_handle(result);
@@ -536,11 +550,12 @@ MaybeObject* CallICBase::LoadFunction(State state,
536
550
  if (result_handle->IsJSFunction()) {
537
551
  #ifdef ENABLE_DEBUGGER_SUPPORT
538
552
  // Handle stepping into a function if step into is active.
539
- if (Debug::StepInActive()) {
553
+ Debug* debug = isolate()->debug();
554
+ if (debug->StepInActive()) {
540
555
  // Protect the result in a handle as the debugger can allocate and might
541
556
  // cause GC.
542
- Handle<JSFunction> function(JSFunction::cast(*result_handle));
543
- Debug::HandleStepIn(function, object, fp(), false);
557
+ Handle<JSFunction> function(JSFunction::cast(*result_handle), isolate());
558
+ debug->HandleStepIn(function, object, fp(), false);
544
559
  return *function;
545
560
  }
546
561
  #endif
@@ -566,7 +581,7 @@ bool CallICBase::TryUpdateExtraICState(LookupResult* lookup,
566
581
 
567
582
  // Fetch the arguments passed to the called function.
568
583
  const int argc = target()->arguments_count();
569
- Address entry = Top::c_entry_fp(Top::GetCurrentThread());
584
+ Address entry = isolate()->c_entry_fp(isolate()->thread_local_top());
570
585
  Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
571
586
  Arguments args(argc + 1,
572
587
  &Memory::Object_at(fp +
@@ -616,13 +631,13 @@ MaybeObject* CallICBase::ComputeMonomorphicStub(
616
631
  switch (lookup->type()) {
617
632
  case FIELD: {
618
633
  int index = lookup->GetFieldIndex();
619
- maybe_code = StubCache::ComputeCallField(argc,
620
- in_loop,
621
- kind_,
622
- *name,
623
- *object,
624
- lookup->holder(),
625
- index);
634
+ maybe_code = isolate()->stub_cache()->ComputeCallField(argc,
635
+ in_loop,
636
+ kind_,
637
+ *name,
638
+ *object,
639
+ lookup->holder(),
640
+ index);
626
641
  break;
627
642
  }
628
643
  case CONSTANT_FUNCTION: {
@@ -630,14 +645,15 @@ MaybeObject* CallICBase::ComputeMonomorphicStub(
630
645
  // call; used for rewriting to monomorphic state and making sure
631
646
  // that the code stub is in the stub cache.
632
647
  JSFunction* function = lookup->GetConstantFunction();
633
- maybe_code = StubCache::ComputeCallConstant(argc,
634
- in_loop,
635
- kind_,
636
- extra_ic_state,
637
- *name,
638
- *object,
639
- lookup->holder(),
640
- function);
648
+ maybe_code =
649
+ isolate()->stub_cache()->ComputeCallConstant(argc,
650
+ in_loop,
651
+ kind_,
652
+ extra_ic_state,
653
+ *name,
654
+ *object,
655
+ lookup->holder(),
656
+ function);
641
657
  break;
642
658
  }
643
659
  case NORMAL: {
@@ -650,35 +666,36 @@ MaybeObject* CallICBase::ComputeMonomorphicStub(
650
666
  JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
651
667
  if (!cell->value()->IsJSFunction()) return NULL;
652
668
  JSFunction* function = JSFunction::cast(cell->value());
653
- maybe_code = StubCache::ComputeCallGlobal(argc,
654
- in_loop,
655
- kind_,
656
- *name,
657
- *receiver,
658
- global,
659
- cell,
660
- function);
669
+ maybe_code = isolate()->stub_cache()->ComputeCallGlobal(argc,
670
+ in_loop,
671
+ kind_,
672
+ *name,
673
+ *receiver,
674
+ global,
675
+ cell,
676
+ function);
661
677
  } else {
662
678
  // There is only one shared stub for calling normalized
663
679
  // properties. It does not traverse the prototype chain, so the
664
680
  // property must be found in the receiver for the stub to be
665
681
  // applicable.
666
682
  if (lookup->holder() != *receiver) return NULL;
667
- maybe_code = StubCache::ComputeCallNormal(argc,
668
- in_loop,
669
- kind_,
670
- *name,
671
- *receiver);
683
+ maybe_code = isolate()->stub_cache()->ComputeCallNormal(argc,
684
+ in_loop,
685
+ kind_,
686
+ *name,
687
+ *receiver);
672
688
  }
673
689
  break;
674
690
  }
675
691
  case INTERCEPTOR: {
676
692
  ASSERT(HasInterceptorGetter(lookup->holder()));
677
- maybe_code = StubCache::ComputeCallInterceptor(argc,
678
- kind_,
679
- *name,
680
- *object,
681
- lookup->holder());
693
+ maybe_code = isolate()->stub_cache()->ComputeCallInterceptor(
694
+ argc,
695
+ kind_,
696
+ *name,
697
+ *object,
698
+ lookup->holder());
682
699
  break;
683
700
  }
684
701
  default:
@@ -698,7 +715,8 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
698
715
  if (!lookup->IsProperty() || !lookup->IsCacheable()) return;
699
716
 
700
717
  if (lookup->holder() != *object &&
701
- HasNormalObjectsInPrototypeChain(lookup, object->GetPrototype())) {
718
+ HasNormalObjectsInPrototypeChain(
719
+ isolate(), lookup, object->GetPrototype())) {
702
720
  // Suppress optimization for prototype chains with slow properties objects
703
721
  // in the middle.
704
722
  return;
@@ -713,7 +731,9 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
713
731
  // This is the first time we execute this inline cache.
714
732
  // Set the target to the pre monomorphic stub to delay
715
733
  // setting the monomorphic state.
716
- maybe_code = StubCache::ComputeCallPreMonomorphic(argc, in_loop, kind_);
734
+ maybe_code = isolate()->stub_cache()->ComputeCallPreMonomorphic(argc,
735
+ in_loop,
736
+ kind_);
717
737
  } else if (state == MONOMORPHIC) {
718
738
  if (kind_ == Code::CALL_IC &&
719
739
  TryUpdateExtraICState(lookup, object, &extra_ic_state)) {
@@ -733,7 +753,9 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
733
753
  object,
734
754
  name);
735
755
  } else {
736
- maybe_code = StubCache::ComputeCallMegamorphic(argc, in_loop, kind_);
756
+ maybe_code = isolate()->stub_cache()->ComputeCallMegamorphic(argc,
757
+ in_loop,
758
+ kind_);
737
759
  }
738
760
  } else {
739
761
  maybe_code = ComputeMonomorphicStub(lookup,
@@ -761,7 +783,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
761
783
  object->GetPrototype())->map();
762
784
 
763
785
  // Update the stub cache.
764
- StubCache::Set(*name, map, Code::cast(code));
786
+ isolate()->stub_cache()->Set(*name, map, Code::cast(code));
765
787
  }
766
788
 
767
789
  USE(had_proto_failure);
@@ -790,7 +812,7 @@ MaybeObject* KeyedCallIC::LoadFunction(State state,
790
812
  if (FLAG_use_ic && state != MEGAMORPHIC && !object->IsAccessCheckNeeded()) {
791
813
  int argc = target()->arguments_count();
792
814
  InLoopFlag in_loop = target()->ic_in_loop();
793
- MaybeObject* maybe_code = StubCache::ComputeCallMegamorphic(
815
+ MaybeObject* maybe_code = isolate()->stub_cache()->ComputeCallMegamorphic(
794
816
  argc, in_loop, Code::KEYED_CALL_IC);
795
817
  Object* code;
796
818
  if (maybe_code->ToObject(&code)) {
@@ -802,8 +824,9 @@ MaybeObject* KeyedCallIC::LoadFunction(State state,
802
824
  }
803
825
  }
804
826
 
805
- HandleScope scope;
827
+ HandleScope scope(isolate());
806
828
  Handle<Object> result = GetProperty(object, key);
829
+ RETURN_IF_EMPTY_HANDLE(isolate(), result);
807
830
 
808
831
  // Make receiver an object if the callee requires it. Strict mode or builtin
809
832
  // functions do not wrap the receiver, non-strict functions and objects
@@ -844,8 +867,8 @@ MaybeObject* LoadIC::Load(State state,
844
867
  // objects is read-only and therefore always returns the length of
845
868
  // the underlying string value. See ECMA-262 15.5.5.1.
846
869
  if ((object->IsString() || object->IsStringWrapper()) &&
847
- name->Equals(Heap::length_symbol())) {
848
- HandleScope scope;
870
+ name->Equals(isolate()->heap()->length_symbol())) {
871
+ HandleScope scope(isolate());
849
872
  #ifdef DEBUG
850
873
  if (FLAG_trace_ic) PrintF("[LoadIC : +#length /string]\n");
851
874
  #endif
@@ -854,24 +877,29 @@ MaybeObject* LoadIC::Load(State state,
854
877
  Map* map = HeapObject::cast(*object)->map();
855
878
  const int offset = String::kLengthOffset;
856
879
  PatchInlinedLoad(address(), map, offset);
857
- set_target(Builtins::builtin(Builtins::LoadIC_StringLength));
880
+ set_target(isolate()->builtins()->builtin(
881
+ Builtins::kLoadIC_StringLength));
858
882
  } else {
859
- set_target(Builtins::builtin(Builtins::LoadIC_StringWrapperLength));
883
+ set_target(isolate()->builtins()->builtin(
884
+ Builtins::kLoadIC_StringWrapperLength));
860
885
  }
861
886
  } else if (state == MONOMORPHIC && object->IsStringWrapper()) {
862
- set_target(Builtins::builtin(Builtins::LoadIC_StringWrapperLength));
887
+ set_target(isolate()->builtins()->builtin(
888
+ Builtins::kLoadIC_StringWrapperLength));
863
889
  } else {
864
890
  set_target(non_monomorphic_stub);
865
891
  }
866
892
  // Get the string if we have a string wrapper object.
867
893
  if (object->IsJSValue()) {
868
- object = Handle<Object>(Handle<JSValue>::cast(object)->value());
894
+ object = Handle<Object>(Handle<JSValue>::cast(object)->value(),
895
+ isolate());
869
896
  }
870
897
  return Smi::FromInt(String::cast(*object)->length());
871
898
  }
872
899
 
873
900
  // Use specialized code for getting the length of arrays.
874
- if (object->IsJSArray() && name->Equals(Heap::length_symbol())) {
901
+ if (object->IsJSArray() &&
902
+ name->Equals(isolate()->heap()->length_symbol())) {
875
903
  #ifdef DEBUG
876
904
  if (FLAG_trace_ic) PrintF("[LoadIC : +#length /array]\n");
877
905
  #endif
@@ -879,7 +907,8 @@ MaybeObject* LoadIC::Load(State state,
879
907
  Map* map = HeapObject::cast(*object)->map();
880
908
  const int offset = JSArray::kLengthOffset;
881
909
  PatchInlinedLoad(address(), map, offset);
882
- set_target(Builtins::builtin(Builtins::LoadIC_ArrayLength));
910
+ set_target(isolate()->builtins()->builtin(
911
+ Builtins::kLoadIC_ArrayLength));
883
912
  } else {
884
913
  set_target(non_monomorphic_stub);
885
914
  }
@@ -887,13 +916,15 @@ MaybeObject* LoadIC::Load(State state,
887
916
  }
888
917
 
889
918
  // Use specialized code for getting prototype of functions.
890
- if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol()) &&
919
+ if (object->IsJSFunction() &&
920
+ name->Equals(isolate()->heap()->prototype_symbol()) &&
891
921
  JSFunction::cast(*object)->should_have_prototype()) {
892
922
  #ifdef DEBUG
893
923
  if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n");
894
924
  #endif
895
925
  if (state == PREMONOMORPHIC) {
896
- set_target(Builtins::builtin(Builtins::LoadIC_FunctionPrototype));
926
+ set_target(isolate()->builtins()->builtin(
927
+ Builtins::kLoadIC_FunctionPrototype));
897
928
  } else {
898
929
  set_target(non_monomorphic_stub);
899
930
  }
@@ -915,7 +946,7 @@ MaybeObject* LoadIC::Load(State state,
915
946
  if (FLAG_strict || IsContextual(object)) {
916
947
  return ReferenceError("not_defined", name);
917
948
  }
918
- LOG(SuspectReadEvent(*name, *object));
949
+ LOG(isolate(), SuspectReadEvent(*name, *object));
919
950
  }
920
951
 
921
952
  bool can_be_inlined_precheck =
@@ -966,7 +997,7 @@ MaybeObject* LoadIC::Load(State state,
966
997
  lookup.IsDontDelete())) {
967
998
  set_target(megamorphic_stub());
968
999
  TRACE_IC_NAMED("[LoadIC : inline contextual patch %s]\n", name);
969
- ASSERT(cell->value() != Heap::the_hole_value());
1000
+ ASSERT(cell->value() != isolate()->heap()->the_hole_value());
970
1001
  return cell->value();
971
1002
  }
972
1003
  } else {
@@ -1013,7 +1044,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1013
1044
  if (!object->IsJSObject()) return;
1014
1045
  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1015
1046
 
1016
- if (HasNormalObjectsInPrototypeChain(lookup, *object)) return;
1047
+ if (HasNormalObjectsInPrototypeChain(isolate(), lookup, *object)) return;
1017
1048
 
1018
1049
  // Compute the code stub for this load.
1019
1050
  MaybeObject* maybe_code = NULL;
@@ -1025,20 +1056,23 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1025
1056
  maybe_code = pre_monomorphic_stub();
1026
1057
  } else if (!lookup->IsProperty()) {
1027
1058
  // Nonexistent property. The result is undefined.
1028
- maybe_code = StubCache::ComputeLoadNonexistent(*name, *receiver);
1059
+ maybe_code = isolate()->stub_cache()->ComputeLoadNonexistent(*name,
1060
+ *receiver);
1029
1061
  } else {
1030
1062
  // Compute monomorphic stub.
1031
1063
  switch (lookup->type()) {
1032
1064
  case FIELD: {
1033
- maybe_code = StubCache::ComputeLoadField(*name, *receiver,
1034
- lookup->holder(),
1035
- lookup->GetFieldIndex());
1065
+ maybe_code = isolate()->stub_cache()->ComputeLoadField(
1066
+ *name,
1067
+ *receiver,
1068
+ lookup->holder(),
1069
+ lookup->GetFieldIndex());
1036
1070
  break;
1037
1071
  }
1038
1072
  case CONSTANT_FUNCTION: {
1039
1073
  Object* constant = lookup->GetConstantFunction();
1040
- maybe_code = StubCache::ComputeLoadConstant(*name, *receiver,
1041
- lookup->holder(), constant);
1074
+ maybe_code = isolate()->stub_cache()->ComputeLoadConstant(
1075
+ *name, *receiver, lookup->holder(), constant);
1042
1076
  break;
1043
1077
  }
1044
1078
  case NORMAL: {
@@ -1046,7 +1080,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1046
1080
  GlobalObject* global = GlobalObject::cast(lookup->holder());
1047
1081
  JSGlobalPropertyCell* cell =
1048
1082
  JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
1049
- maybe_code = StubCache::ComputeLoadGlobal(*name,
1083
+ maybe_code = isolate()->stub_cache()->ComputeLoadGlobal(*name,
1050
1084
  *receiver,
1051
1085
  global,
1052
1086
  cell,
@@ -1057,7 +1091,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1057
1091
  // property must be found in the receiver for the stub to be
1058
1092
  // applicable.
1059
1093
  if (lookup->holder() != *receiver) return;
1060
- maybe_code = StubCache::ComputeLoadNormal();
1094
+ maybe_code = isolate()->stub_cache()->ComputeLoadNormal();
1061
1095
  }
1062
1096
  break;
1063
1097
  }
@@ -1066,14 +1100,14 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1066
1100
  AccessorInfo* callback =
1067
1101
  AccessorInfo::cast(lookup->GetCallbackObject());
1068
1102
  if (v8::ToCData<Address>(callback->getter()) == 0) return;
1069
- maybe_code = StubCache::ComputeLoadCallback(*name, *receiver,
1070
- lookup->holder(), callback);
1103
+ maybe_code = isolate()->stub_cache()->ComputeLoadCallback(
1104
+ *name, *receiver, lookup->holder(), callback);
1071
1105
  break;
1072
1106
  }
1073
1107
  case INTERCEPTOR: {
1074
1108
  ASSERT(HasInterceptorGetter(lookup->holder()));
1075
- maybe_code = StubCache::ComputeLoadInterceptor(*name, *receiver,
1076
- lookup->holder());
1109
+ maybe_code = isolate()->stub_cache()->ComputeLoadInterceptor(
1110
+ *name, *receiver, lookup->holder());
1077
1111
  break;
1078
1112
  }
1079
1113
  default:
@@ -1097,7 +1131,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1097
1131
  Map* map = JSObject::cast(object->IsJSObject() ? *object :
1098
1132
  object->GetPrototype())->map();
1099
1133
 
1100
- StubCache::Set(*name, map, Code::cast(code));
1134
+ isolate()->stub_cache()->Set(*name, map, Code::cast(code));
1101
1135
  }
1102
1136
 
1103
1137
  #ifdef DEBUG
@@ -1109,6 +1143,16 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
1109
1143
  MaybeObject* KeyedLoadIC::Load(State state,
1110
1144
  Handle<Object> object,
1111
1145
  Handle<Object> key) {
1146
+ // Check for values that can be converted into a symbol.
1147
+ // TODO(1295): Remove this code.
1148
+ HandleScope scope(isolate());
1149
+ if (key->IsHeapNumber() &&
1150
+ isnan(HeapNumber::cast(*key)->value())) {
1151
+ key = isolate()->factory()->nan_symbol();
1152
+ } else if (key->IsUndefined()) {
1153
+ key = isolate()->factory()->undefined_symbol();
1154
+ }
1155
+
1112
1156
  if (key->IsSymbol()) {
1113
1157
  Handle<String> name = Handle<String>::cast(key);
1114
1158
 
@@ -1122,11 +1166,13 @@ MaybeObject* KeyedLoadIC::Load(State state,
1122
1166
  // TODO(1073): don't ignore the current stub state.
1123
1167
 
1124
1168
  // Use specialized code for getting the length of strings.
1125
- if (object->IsString() && name->Equals(Heap::length_symbol())) {
1169
+ if (object->IsString() &&
1170
+ name->Equals(isolate()->heap()->length_symbol())) {
1126
1171
  Handle<String> string = Handle<String>::cast(object);
1127
1172
  Object* code = NULL;
1128
1173
  { MaybeObject* maybe_code =
1129
- StubCache::ComputeKeyedLoadStringLength(*name, *string);
1174
+ isolate()->stub_cache()->ComputeKeyedLoadStringLength(*name,
1175
+ *string);
1130
1176
  if (!maybe_code->ToObject(&code)) return maybe_code;
1131
1177
  }
1132
1178
  set_target(Code::cast(code));
@@ -1137,11 +1183,13 @@ MaybeObject* KeyedLoadIC::Load(State state,
1137
1183
  }
1138
1184
 
1139
1185
  // Use specialized code for getting the length of arrays.
1140
- if (object->IsJSArray() && name->Equals(Heap::length_symbol())) {
1186
+ if (object->IsJSArray() &&
1187
+ name->Equals(isolate()->heap()->length_symbol())) {
1141
1188
  Handle<JSArray> array = Handle<JSArray>::cast(object);
1142
1189
  Object* code;
1143
1190
  { MaybeObject* maybe_code =
1144
- StubCache::ComputeKeyedLoadArrayLength(*name, *array);
1191
+ isolate()->stub_cache()->ComputeKeyedLoadArrayLength(*name,
1192
+ *array);
1145
1193
  if (!maybe_code->ToObject(&code)) return maybe_code;
1146
1194
  }
1147
1195
  set_target(Code::cast(code));
@@ -1152,12 +1200,14 @@ MaybeObject* KeyedLoadIC::Load(State state,
1152
1200
  }
1153
1201
 
1154
1202
  // Use specialized code for getting prototype of functions.
1155
- if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol()) &&
1203
+ if (object->IsJSFunction() &&
1204
+ name->Equals(isolate()->heap()->prototype_symbol()) &&
1156
1205
  JSFunction::cast(*object)->should_have_prototype()) {
1157
1206
  Handle<JSFunction> function = Handle<JSFunction>::cast(object);
1158
1207
  Object* code;
1159
1208
  { MaybeObject* maybe_code =
1160
- StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function);
1209
+ isolate()->stub_cache()->ComputeKeyedLoadFunctionPrototype(
1210
+ *name, *function);
1161
1211
  if (!maybe_code->ToObject(&code)) return maybe_code;
1162
1212
  }
1163
1213
  set_target(Code::cast(code));
@@ -1172,10 +1222,10 @@ MaybeObject* KeyedLoadIC::Load(State state,
1172
1222
  // the element or char if so.
1173
1223
  uint32_t index = 0;
1174
1224
  if (name->AsArrayIndex(&index)) {
1175
- HandleScope scope;
1225
+ HandleScope scope(isolate());
1176
1226
  // Rewrite to the generic keyed load stub.
1177
1227
  if (FLAG_use_ic) set_target(generic_stub());
1178
- return Runtime::GetElementOrCharAt(object, index);
1228
+ return Runtime::GetElementOrCharAt(isolate(), object, index);
1179
1229
  }
1180
1230
 
1181
1231
  // Named lookup.
@@ -1225,21 +1275,16 @@ MaybeObject* KeyedLoadIC::Load(State state,
1225
1275
  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1226
1276
  if (receiver->HasExternalArrayElements()) {
1227
1277
  MaybeObject* probe =
1228
- StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver,
1229
- false);
1278
+ isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray(
1279
+ *receiver, false, kNonStrictMode);
1230
1280
  stub = probe->IsFailure() ?
1231
1281
  NULL : Code::cast(probe->ToObjectUnchecked());
1232
1282
  } else if (receiver->HasIndexedInterceptor()) {
1233
1283
  stub = indexed_interceptor_stub();
1234
- } else if (receiver->HasPixelElements()) {
1235
- MaybeObject* probe =
1236
- StubCache::ComputeKeyedLoadPixelArray(*receiver);
1237
- stub = probe->IsFailure() ?
1238
- NULL : Code::cast(probe->ToObjectUnchecked());
1239
1284
  } else if (key->IsSmi() &&
1240
1285
  receiver->map()->has_fast_elements()) {
1241
1286
  MaybeObject* probe =
1242
- StubCache::ComputeKeyedLoadSpecialized(*receiver);
1287
+ isolate()->stub_cache()->ComputeKeyedLoadSpecialized(*receiver);
1243
1288
  stub = probe->IsFailure() ?
1244
1289
  NULL : Code::cast(probe->ToObjectUnchecked());
1245
1290
  }
@@ -1265,7 +1310,7 @@ MaybeObject* KeyedLoadIC::Load(State state,
1265
1310
  }
1266
1311
 
1267
1312
  // Get the property.
1268
- return Runtime::GetObjectProperty(object, key);
1313
+ return Runtime::GetObjectProperty(isolate(), object, key);
1269
1314
  }
1270
1315
 
1271
1316
 
@@ -1277,7 +1322,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state,
1277
1322
  if (!object->IsJSObject()) return;
1278
1323
  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1279
1324
 
1280
- if (HasNormalObjectsInPrototypeChain(lookup, *object)) return;
1325
+ if (HasNormalObjectsInPrototypeChain(isolate(), lookup, *object)) return;
1281
1326
 
1282
1327
  // Compute the code stub for this load.
1283
1328
  MaybeObject* maybe_code = NULL;
@@ -1292,17 +1337,14 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state,
1292
1337
  // Compute a monomorphic stub.
1293
1338
  switch (lookup->type()) {
1294
1339
  case FIELD: {
1295
- maybe_code = StubCache::ComputeKeyedLoadField(*name, *receiver,
1296
- lookup->holder(),
1297
- lookup->GetFieldIndex());
1340
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadField(
1341
+ *name, *receiver, lookup->holder(), lookup->GetFieldIndex());
1298
1342
  break;
1299
1343
  }
1300
1344
  case CONSTANT_FUNCTION: {
1301
1345
  Object* constant = lookup->GetConstantFunction();
1302
- maybe_code = StubCache::ComputeKeyedLoadConstant(*name,
1303
- *receiver,
1304
- lookup->holder(),
1305
- constant);
1346
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadConstant(
1347
+ *name, *receiver, lookup->holder(), constant);
1306
1348
  break;
1307
1349
  }
1308
1350
  case CALLBACKS: {
@@ -1310,16 +1352,14 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state,
1310
1352
  AccessorInfo* callback =
1311
1353
  AccessorInfo::cast(lookup->GetCallbackObject());
1312
1354
  if (v8::ToCData<Address>(callback->getter()) == 0) return;
1313
- maybe_code = StubCache::ComputeKeyedLoadCallback(*name,
1314
- *receiver,
1315
- lookup->holder(),
1316
- callback);
1355
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadCallback(
1356
+ *name, *receiver, lookup->holder(), callback);
1317
1357
  break;
1318
1358
  }
1319
1359
  case INTERCEPTOR: {
1320
1360
  ASSERT(HasInterceptorGetter(lookup->holder()));
1321
- maybe_code = StubCache::ComputeKeyedLoadInterceptor(*name, *receiver,
1322
- lookup->holder());
1361
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor(
1362
+ *name, *receiver, lookup->holder());
1323
1363
  break;
1324
1364
  }
1325
1365
  default: {
@@ -1382,7 +1422,7 @@ static bool LookupForWrite(JSObject* object,
1382
1422
 
1383
1423
 
1384
1424
  MaybeObject* StoreIC::Store(State state,
1385
- Code::ExtraICState extra_ic_state,
1425
+ StrictModeFlag strict_mode,
1386
1426
  Handle<Object> object,
1387
1427
  Handle<String> name,
1388
1428
  Handle<Object> value) {
@@ -1392,31 +1432,39 @@ MaybeObject* StoreIC::Store(State state,
1392
1432
  return TypeError("non_object_property_store", object, name);
1393
1433
  }
1394
1434
 
1395
- // Ignore stores where the receiver is not a JSObject.
1396
- if (!object->IsJSObject()) return *value;
1435
+ if (!object->IsJSObject()) {
1436
+ // The length property of string values is read-only. Throw in strict mode.
1437
+ if (strict_mode == kStrictMode && object->IsString() &&
1438
+ name->Equals(isolate()->heap()->length_symbol())) {
1439
+ return TypeError("strict_read_only_property", object, name);
1440
+ }
1441
+ // Ignore stores where the receiver is not a JSObject.
1442
+ return *value;
1443
+ }
1444
+
1397
1445
  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1398
1446
 
1399
1447
  // Check if the given name is an array index.
1400
1448
  uint32_t index;
1401
1449
  if (name->AsArrayIndex(&index)) {
1402
- HandleScope scope;
1403
- Handle<Object> result = SetElement(receiver, index, value);
1450
+ HandleScope scope(isolate());
1451
+ Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1404
1452
  if (result.is_null()) return Failure::Exception();
1405
1453
  return *value;
1406
1454
  }
1407
1455
 
1408
1456
  // Use specialized code for setting the length of arrays.
1409
1457
  if (receiver->IsJSArray()
1410
- && name->Equals(Heap::length_symbol())
1458
+ && name->Equals(isolate()->heap()->length_symbol())
1411
1459
  && receiver->AllowsSetElementsLength()) {
1412
1460
  #ifdef DEBUG
1413
1461
  if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n");
1414
1462
  #endif
1415
- Builtins::Name target = (extra_ic_state == kStoreICStrict)
1416
- ? Builtins::StoreIC_ArrayLength_Strict
1417
- : Builtins::StoreIC_ArrayLength;
1418
- set_target(Builtins::builtin(target));
1419
- return receiver->SetProperty(*name, *value, NONE);
1463
+ Builtins::Name target = (strict_mode == kStrictMode)
1464
+ ? Builtins::kStoreIC_ArrayLength_Strict
1465
+ : Builtins::kStoreIC_ArrayLength;
1466
+ set_target(isolate()->builtins()->builtin(target));
1467
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1420
1468
  }
1421
1469
 
1422
1470
  // Lookup the property locally in the receiver.
@@ -1440,13 +1488,15 @@ MaybeObject* StoreIC::Store(State state,
1440
1488
  // Index is an offset from the end of the object.
1441
1489
  int offset = map->instance_size() + (index * kPointerSize);
1442
1490
  if (PatchInlinedStore(address(), map, offset)) {
1443
- set_target(megamorphic_stub());
1491
+ set_target((strict_mode == kStrictMode)
1492
+ ? megamorphic_stub_strict()
1493
+ : megamorphic_stub());
1444
1494
  #ifdef DEBUG
1445
1495
  if (FLAG_trace_ic) {
1446
1496
  PrintF("[StoreIC : inline patch %s]\n", *name->ToCString());
1447
1497
  }
1448
1498
  #endif
1449
- return receiver->SetProperty(*name, *value, NONE);
1499
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1450
1500
  #ifdef DEBUG
1451
1501
 
1452
1502
  } else {
@@ -1473,11 +1523,16 @@ MaybeObject* StoreIC::Store(State state,
1473
1523
 
1474
1524
  // If no inlined store ic was patched, generate a stub for this
1475
1525
  // store.
1476
- UpdateCaches(&lookup, state, extra_ic_state, receiver, name, value);
1526
+ UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1477
1527
  } else {
1478
- // Strict mode doesn't allow setting non-existent global property.
1479
- if (extra_ic_state == kStoreICStrict && IsContextual(object)) {
1480
- return ReferenceError("not_defined", name);
1528
+ // Strict mode doesn't allow setting non-existent global property
1529
+ // or an assignment to a read only property.
1530
+ if (strict_mode == kStrictMode) {
1531
+ if (lookup.IsFound() && lookup.IsReadOnly()) {
1532
+ return TypeError("strict_read_only_property", object, name);
1533
+ } else if (IsContextual(object)) {
1534
+ return ReferenceError("not_defined", name);
1535
+ }
1481
1536
  }
1482
1537
  }
1483
1538
  }
@@ -1485,7 +1540,7 @@ MaybeObject* StoreIC::Store(State state,
1485
1540
  if (receiver->IsJSGlobalProxy()) {
1486
1541
  // Generate a generic stub that goes to the runtime when we see a global
1487
1542
  // proxy as receiver.
1488
- Code* stub = (extra_ic_state == kStoreICStrict)
1543
+ Code* stub = (strict_mode == kStrictMode)
1489
1544
  ? global_proxy_stub_strict()
1490
1545
  : global_proxy_stub();
1491
1546
  if (target() != stub) {
@@ -1497,13 +1552,13 @@ MaybeObject* StoreIC::Store(State state,
1497
1552
  }
1498
1553
 
1499
1554
  // Set the property.
1500
- return receiver->SetProperty(*name, *value, NONE);
1555
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1501
1556
  }
1502
1557
 
1503
1558
 
1504
1559
  void StoreIC::UpdateCaches(LookupResult* lookup,
1505
1560
  State state,
1506
- Code::ExtraICState extra_ic_state,
1561
+ StrictModeFlag strict_mode,
1507
1562
  Handle<JSObject> receiver,
1508
1563
  Handle<String> name,
1509
1564
  Handle<Object> value) {
@@ -1524,18 +1579,18 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
1524
1579
  Object* code = NULL;
1525
1580
  switch (type) {
1526
1581
  case FIELD: {
1527
- maybe_code = StubCache::ComputeStoreField(
1528
- *name, *receiver, lookup->GetFieldIndex(), NULL, extra_ic_state);
1582
+ maybe_code = isolate()->stub_cache()->ComputeStoreField(
1583
+ *name, *receiver, lookup->GetFieldIndex(), NULL, strict_mode);
1529
1584
  break;
1530
1585
  }
1531
1586
  case MAP_TRANSITION: {
1532
1587
  if (lookup->GetAttributes() != NONE) return;
1533
- HandleScope scope;
1588
+ HandleScope scope(isolate());
1534
1589
  ASSERT(type == MAP_TRANSITION);
1535
1590
  Handle<Map> transition(lookup->GetTransitionMap());
1536
1591
  int index = transition->PropertyIndexFor(*name);
1537
- maybe_code = StubCache::ComputeStoreField(
1538
- *name, *receiver, index, *transition, extra_ic_state);
1592
+ maybe_code = isolate()->stub_cache()->ComputeStoreField(
1593
+ *name, *receiver, index, *transition, strict_mode);
1539
1594
  break;
1540
1595
  }
1541
1596
  case NORMAL: {
@@ -1546,11 +1601,11 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
1546
1601
  Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
1547
1602
  JSGlobalPropertyCell* cell =
1548
1603
  JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
1549
- maybe_code = StubCache::ComputeStoreGlobal(
1550
- *name, *global, cell, extra_ic_state);
1604
+ maybe_code = isolate()->stub_cache()->ComputeStoreGlobal(
1605
+ *name, *global, cell, strict_mode);
1551
1606
  } else {
1552
1607
  if (lookup->holder() != *receiver) return;
1553
- maybe_code = StubCache::ComputeStoreNormal(extra_ic_state);
1608
+ maybe_code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode);
1554
1609
  }
1555
1610
  break;
1556
1611
  }
@@ -1558,14 +1613,14 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
1558
1613
  if (!lookup->GetCallbackObject()->IsAccessorInfo()) return;
1559
1614
  AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject());
1560
1615
  if (v8::ToCData<Address>(callback->setter()) == 0) return;
1561
- maybe_code = StubCache::ComputeStoreCallback(
1562
- *name, *receiver, callback, extra_ic_state);
1616
+ maybe_code = isolate()->stub_cache()->ComputeStoreCallback(
1617
+ *name, *receiver, callback, strict_mode);
1563
1618
  break;
1564
1619
  }
1565
1620
  case INTERCEPTOR: {
1566
1621
  ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined());
1567
- maybe_code = StubCache::ComputeStoreInterceptor(
1568
- *name, *receiver, extra_ic_state);
1622
+ maybe_code = isolate()->stub_cache()->ComputeStoreInterceptor(
1623
+ *name, *receiver, strict_mode);
1569
1624
  break;
1570
1625
  }
1571
1626
  default:
@@ -1582,13 +1637,15 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
1582
1637
  } else if (state == MONOMORPHIC) {
1583
1638
  // Only move to megamorphic if the target changes.
1584
1639
  if (target() != Code::cast(code)) {
1585
- set_target(extra_ic_state == kStoreICStrict
1640
+ set_target((strict_mode == kStrictMode)
1586
1641
  ? megamorphic_stub_strict()
1587
1642
  : megamorphic_stub());
1588
1643
  }
1589
1644
  } else if (state == MEGAMORPHIC) {
1590
1645
  // Update the stub cache.
1591
- StubCache::Set(*name, receiver->map(), Code::cast(code));
1646
+ isolate()->stub_cache()->Set(*name,
1647
+ receiver->map(),
1648
+ Code::cast(code));
1592
1649
  }
1593
1650
 
1594
1651
  #ifdef DEBUG
@@ -1598,6 +1655,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
1598
1655
 
1599
1656
 
1600
1657
  MaybeObject* KeyedStoreIC::Store(State state,
1658
+ StrictModeFlag strict_mode,
1601
1659
  Handle<Object> object,
1602
1660
  Handle<Object> key,
1603
1661
  Handle<Object> value) {
@@ -1617,8 +1675,8 @@ MaybeObject* KeyedStoreIC::Store(State state,
1617
1675
  // Check if the given name is an array index.
1618
1676
  uint32_t index;
1619
1677
  if (name->AsArrayIndex(&index)) {
1620
- HandleScope scope;
1621
- Handle<Object> result = SetElement(receiver, index, value);
1678
+ HandleScope scope(isolate());
1679
+ Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1622
1680
  if (result.is_null()) return Failure::Exception();
1623
1681
  return *value;
1624
1682
  }
@@ -1629,11 +1687,11 @@ MaybeObject* KeyedStoreIC::Store(State state,
1629
1687
 
1630
1688
  // Update inline cache and stub cache.
1631
1689
  if (FLAG_use_ic) {
1632
- UpdateCaches(&lookup, state, receiver, name, value);
1690
+ UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1633
1691
  }
1634
1692
 
1635
1693
  // Set the property.
1636
- return receiver->SetProperty(*name, *value, NONE);
1694
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1637
1695
  }
1638
1696
 
1639
1697
  // Do not use ICs for objects that require access checks (including
@@ -1642,23 +1700,21 @@ MaybeObject* KeyedStoreIC::Store(State state,
1642
1700
  ASSERT(!(use_ic && object->IsJSGlobalProxy()));
1643
1701
 
1644
1702
  if (use_ic) {
1645
- Code* stub = generic_stub();
1703
+ Code* stub =
1704
+ (strict_mode == kStrictMode) ? generic_stub_strict() : generic_stub();
1646
1705
  if (state == UNINITIALIZED) {
1647
1706
  if (object->IsJSObject()) {
1648
1707
  Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1649
1708
  if (receiver->HasExternalArrayElements()) {
1650
1709
  MaybeObject* probe =
1651
- StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, true);
1652
- stub = probe->IsFailure() ?
1653
- NULL : Code::cast(probe->ToObjectUnchecked());
1654
- } else if (receiver->HasPixelElements()) {
1655
- MaybeObject* probe =
1656
- StubCache::ComputeKeyedStorePixelArray(*receiver);
1710
+ isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray(
1711
+ *receiver, true, strict_mode);
1657
1712
  stub = probe->IsFailure() ?
1658
1713
  NULL : Code::cast(probe->ToObjectUnchecked());
1659
1714
  } else if (key->IsSmi() && receiver->map()->has_fast_elements()) {
1660
1715
  MaybeObject* probe =
1661
- StubCache::ComputeKeyedStoreSpecialized(*receiver);
1716
+ isolate()->stub_cache()->ComputeKeyedStoreSpecialized(
1717
+ *receiver, strict_mode);
1662
1718
  stub = probe->IsFailure() ?
1663
1719
  NULL : Code::cast(probe->ToObjectUnchecked());
1664
1720
  }
@@ -1668,12 +1724,14 @@ MaybeObject* KeyedStoreIC::Store(State state,
1668
1724
  }
1669
1725
 
1670
1726
  // Set the property.
1671
- return Runtime::SetObjectProperty(object, key, value, NONE);
1727
+ return Runtime::SetObjectProperty(
1728
+ isolate(), object , key, value, NONE, strict_mode);
1672
1729
  }
1673
1730
 
1674
1731
 
1675
1732
  void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1676
1733
  State state,
1734
+ StrictModeFlag strict_mode,
1677
1735
  Handle<JSObject> receiver,
1678
1736
  Handle<String> name,
1679
1737
  Handle<Object> value) {
@@ -1700,18 +1758,18 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1700
1758
 
1701
1759
  switch (type) {
1702
1760
  case FIELD: {
1703
- maybe_code = StubCache::ComputeKeyedStoreField(*name, *receiver,
1704
- lookup->GetFieldIndex());
1761
+ maybe_code = isolate()->stub_cache()->ComputeKeyedStoreField(
1762
+ *name, *receiver, lookup->GetFieldIndex(), NULL, strict_mode);
1705
1763
  break;
1706
1764
  }
1707
1765
  case MAP_TRANSITION: {
1708
1766
  if (lookup->GetAttributes() == NONE) {
1709
- HandleScope scope;
1767
+ HandleScope scope(isolate());
1710
1768
  ASSERT(type == MAP_TRANSITION);
1711
1769
  Handle<Map> transition(lookup->GetTransitionMap());
1712
1770
  int index = transition->PropertyIndexFor(*name);
1713
- maybe_code = StubCache::ComputeKeyedStoreField(*name, *receiver,
1714
- index, *transition);
1771
+ maybe_code = isolate()->stub_cache()->ComputeKeyedStoreField(
1772
+ *name, *receiver, index, *transition, strict_mode);
1715
1773
  break;
1716
1774
  }
1717
1775
  // fall through.
@@ -1719,7 +1777,9 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1719
1777
  default: {
1720
1778
  // Always rewrite to the generic case so that we do not
1721
1779
  // repeatedly try to rewrite.
1722
- maybe_code = generic_stub();
1780
+ maybe_code = (strict_mode == kStrictMode)
1781
+ ? generic_stub_strict()
1782
+ : generic_stub();
1723
1783
  break;
1724
1784
  }
1725
1785
  }
@@ -1734,7 +1794,9 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1734
1794
  if (state == UNINITIALIZED || state == PREMONOMORPHIC) {
1735
1795
  set_target(Code::cast(code));
1736
1796
  } else if (state == MONOMORPHIC) {
1737
- set_target(megamorphic_stub());
1797
+ set_target((strict_mode == kStrictMode)
1798
+ ? megamorphic_stub_strict()
1799
+ : megamorphic_stub());
1738
1800
  }
1739
1801
 
1740
1802
  #ifdef DEBUG
@@ -1747,11 +1809,12 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1747
1809
  // Static IC stub generators.
1748
1810
  //
1749
1811
 
1750
- static JSFunction* CompileFunction(JSFunction* function,
1812
+ static JSFunction* CompileFunction(Isolate* isolate,
1813
+ JSFunction* function,
1751
1814
  InLoopFlag in_loop) {
1752
1815
  // Compile now with optimization.
1753
- HandleScope scope;
1754
- Handle<JSFunction> function_handle(function);
1816
+ HandleScope scope(isolate);
1817
+ Handle<JSFunction> function_handle(function, isolate);
1755
1818
  if (in_loop == IN_LOOP) {
1756
1819
  CompileLazyInLoop(function_handle, CLEAR_EXCEPTION);
1757
1820
  } else {
@@ -1762,10 +1825,10 @@ static JSFunction* CompileFunction(JSFunction* function,
1762
1825
 
1763
1826
 
1764
1827
  // Used from ic-<arch>.cc.
1765
- MUST_USE_RESULT MaybeObject* CallIC_Miss(Arguments args) {
1828
+ RUNTIME_FUNCTION(MaybeObject*, CallIC_Miss) {
1766
1829
  NoHandleAllocation na;
1767
1830
  ASSERT(args.length() == 2);
1768
- CallIC ic;
1831
+ CallIC ic(isolate);
1769
1832
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1770
1833
  Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1771
1834
  MaybeObject* maybe_result = ic.LoadFunction(state,
@@ -1785,15 +1848,17 @@ MUST_USE_RESULT MaybeObject* CallIC_Miss(Arguments args) {
1785
1848
  if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
1786
1849
  return result;
1787
1850
  }
1788
- return CompileFunction(JSFunction::cast(result), ic.target()->ic_in_loop());
1851
+ return CompileFunction(isolate,
1852
+ JSFunction::cast(result),
1853
+ ic.target()->ic_in_loop());
1789
1854
  }
1790
1855
 
1791
1856
 
1792
1857
  // Used from ic-<arch>.cc.
1793
- MUST_USE_RESULT MaybeObject* KeyedCallIC_Miss(Arguments args) {
1858
+ RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_Miss) {
1794
1859
  NoHandleAllocation na;
1795
1860
  ASSERT(args.length() == 2);
1796
- KeyedCallIC ic;
1861
+ KeyedCallIC ic(isolate);
1797
1862
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1798
1863
  Object* result;
1799
1864
  { MaybeObject* maybe_result =
@@ -1804,43 +1869,48 @@ MUST_USE_RESULT MaybeObject* KeyedCallIC_Miss(Arguments args) {
1804
1869
  if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
1805
1870
  return result;
1806
1871
  }
1807
- return CompileFunction(JSFunction::cast(result), ic.target()->ic_in_loop());
1872
+ return CompileFunction(isolate,
1873
+ JSFunction::cast(result),
1874
+ ic.target()->ic_in_loop());
1808
1875
  }
1809
1876
 
1810
1877
 
1811
1878
  // Used from ic-<arch>.cc.
1812
- MUST_USE_RESULT MaybeObject* LoadIC_Miss(Arguments args) {
1879
+ RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
1813
1880
  NoHandleAllocation na;
1814
1881
  ASSERT(args.length() == 2);
1815
- LoadIC ic;
1882
+ LoadIC ic(isolate);
1816
1883
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1817
1884
  return ic.Load(state, args.at<Object>(0), args.at<String>(1));
1818
1885
  }
1819
1886
 
1820
1887
 
1821
1888
  // Used from ic-<arch>.cc
1822
- MUST_USE_RESULT MaybeObject* KeyedLoadIC_Miss(Arguments args) {
1889
+ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
1823
1890
  NoHandleAllocation na;
1824
1891
  ASSERT(args.length() == 2);
1825
- KeyedLoadIC ic;
1892
+ KeyedLoadIC ic(isolate);
1826
1893
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1827
1894
  return ic.Load(state, args.at<Object>(0), args.at<Object>(1));
1828
1895
  }
1829
1896
 
1830
1897
 
1831
1898
  // Used from ic-<arch>.cc.
1832
- MUST_USE_RESULT MaybeObject* StoreIC_Miss(Arguments args) {
1899
+ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) {
1833
1900
  NoHandleAllocation na;
1834
1901
  ASSERT(args.length() == 3);
1835
- StoreIC ic;
1902
+ StoreIC ic(isolate);
1836
1903
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1837
1904
  Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1838
- return ic.Store(state, extra_ic_state, args.at<Object>(0),
1839
- args.at<String>(1), args.at<Object>(2));
1905
+ return ic.Store(state,
1906
+ static_cast<StrictModeFlag>(extra_ic_state & kStrictMode),
1907
+ args.at<Object>(0),
1908
+ args.at<String>(1),
1909
+ args.at<Object>(2));
1840
1910
  }
1841
1911
 
1842
1912
 
1843
- MUST_USE_RESULT MaybeObject* StoreIC_ArrayLength(Arguments args) {
1913
+ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
1844
1914
  NoHandleAllocation nha;
1845
1915
 
1846
1916
  ASSERT(args.length() == 2);
@@ -1861,7 +1931,7 @@ MUST_USE_RESULT MaybeObject* StoreIC_ArrayLength(Arguments args) {
1861
1931
  // Extend storage is called in a store inline cache when
1862
1932
  // it is necessary to extend the properties array of a
1863
1933
  // JSObject.
1864
- MUST_USE_RESULT MaybeObject* SharedStoreIC_ExtendStorage(Arguments args) {
1934
+ RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) {
1865
1935
  NoHandleAllocation na;
1866
1936
  ASSERT(args.length() == 3);
1867
1937
 
@@ -1895,12 +1965,16 @@ MUST_USE_RESULT MaybeObject* SharedStoreIC_ExtendStorage(Arguments args) {
1895
1965
 
1896
1966
 
1897
1967
  // Used from ic-<arch>.cc.
1898
- MUST_USE_RESULT MaybeObject* KeyedStoreIC_Miss(Arguments args) {
1968
+ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Miss) {
1899
1969
  NoHandleAllocation na;
1900
1970
  ASSERT(args.length() == 3);
1901
- KeyedStoreIC ic;
1971
+ KeyedStoreIC ic(isolate);
1902
1972
  IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1903
- return ic.Store(state, args.at<Object>(0), args.at<Object>(1),
1973
+ Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1974
+ return ic.Store(state,
1975
+ static_cast<StrictModeFlag>(extra_ic_state & kStrictMode),
1976
+ args.at<Object>(0),
1977
+ args.at<Object>(1),
1904
1978
  args.at<Object>(2));
1905
1979
  }
1906
1980
 
@@ -1964,10 +2038,10 @@ BinaryOpIC::TypeInfo BinaryOpIC::GetTypeInfo(Object* left,
1964
2038
  Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info);
1965
2039
 
1966
2040
 
1967
- MUST_USE_RESULT MaybeObject* BinaryOp_Patch(Arguments args) {
2041
+ RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) {
1968
2042
  ASSERT(args.length() == 5);
1969
2043
 
1970
- HandleScope scope;
2044
+ HandleScope scope(isolate);
1971
2045
  Handle<Object> left = args.at<Object>(0);
1972
2046
  Handle<Object> right = args.at<Object>(1);
1973
2047
  int key = Smi::cast(args[2])->value();
@@ -1978,7 +2052,7 @@ MUST_USE_RESULT MaybeObject* BinaryOp_Patch(Arguments args) {
1978
2052
  BinaryOpIC::TypeInfo type = BinaryOpIC::GetTypeInfo(*left, *right);
1979
2053
  Handle<Code> code = GetBinaryOpStub(key, type);
1980
2054
  if (!code.is_null()) {
1981
- BinaryOpIC ic;
2055
+ BinaryOpIC ic(isolate);
1982
2056
  ic.patch(*code);
1983
2057
  if (FLAG_trace_ic) {
1984
2058
  PrintF("[BinaryOpIC (%s->%s)#%s]\n",
@@ -1988,7 +2062,8 @@ MUST_USE_RESULT MaybeObject* BinaryOp_Patch(Arguments args) {
1988
2062
  }
1989
2063
  }
1990
2064
 
1991
- Handle<JSBuiltinsObject> builtins = Top::builtins();
2065
+ Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2066
+ isolate->thread_local_top()->context_->builtins(), isolate);
1992
2067
  Object* builtin = NULL; // Initialization calms down the compiler.
1993
2068
  switch (op) {
1994
2069
  case Token::ADD:
@@ -2028,7 +2103,8 @@ MUST_USE_RESULT MaybeObject* BinaryOp_Patch(Arguments args) {
2028
2103
  UNREACHABLE();
2029
2104
  }
2030
2105
 
2031
- Handle<JSFunction> builtin_function(JSFunction::cast(builtin));
2106
+ Handle<JSFunction> builtin_function(JSFunction::cast(builtin),
2107
+ isolate);
2032
2108
 
2033
2109
  bool caught_exception;
2034
2110
  Object** builtin_args[] = { right.location() };
@@ -2055,6 +2131,7 @@ const char* TRBinaryOpIC::GetName(TypeInfo type_info) {
2055
2131
  case SMI: return "SMI";
2056
2132
  case INT32: return "Int32s";
2057
2133
  case HEAP_NUMBER: return "HeapNumbers";
2134
+ case ODDBALL: return "Oddball";
2058
2135
  case STRING: return "Strings";
2059
2136
  case GENERIC: return "Generic";
2060
2137
  default: return "Invalid";
@@ -2069,6 +2146,7 @@ TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) {
2069
2146
  case SMI:
2070
2147
  case INT32:
2071
2148
  case HEAP_NUMBER:
2149
+ case ODDBALL:
2072
2150
  case STRING:
2073
2151
  return MONOMORPHIC;
2074
2152
  case GENERIC:
@@ -2116,6 +2194,10 @@ TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left,
2116
2194
  return STRING;
2117
2195
  }
2118
2196
 
2197
+ // Check for oddball objects.
2198
+ if (left->IsUndefined() && right->IsNumber()) return ODDBALL;
2199
+ if (left->IsNumber() && right->IsUndefined()) return ODDBALL;
2200
+
2119
2201
  return GENERIC;
2120
2202
  }
2121
2203
 
@@ -2127,10 +2209,10 @@ Handle<Code> GetTypeRecordingBinaryOpStub(int key,
2127
2209
  TRBinaryOpIC::TypeInfo result_type);
2128
2210
 
2129
2211
 
2130
- MaybeObject* TypeRecordingBinaryOp_Patch(Arguments args) {
2212
+ RUNTIME_FUNCTION(MaybeObject*, TypeRecordingBinaryOp_Patch) {
2131
2213
  ASSERT(args.length() == 5);
2132
2214
 
2133
- HandleScope scope;
2215
+ HandleScope scope(isolate);
2134
2216
  Handle<Object> left = args.at<Object>(0);
2135
2217
  Handle<Object> right = args.at<Object>(1);
2136
2218
  int key = Smi::cast(args[2])->value();
@@ -2172,7 +2254,7 @@ MaybeObject* TypeRecordingBinaryOp_Patch(Arguments args) {
2172
2254
  TRBinaryOpIC::GetName(result_type),
2173
2255
  Token::Name(op));
2174
2256
  }
2175
- TRBinaryOpIC ic;
2257
+ TRBinaryOpIC ic(isolate);
2176
2258
  ic.patch(*code);
2177
2259
 
2178
2260
  // Activate inlined smi code.
@@ -2181,7 +2263,8 @@ MaybeObject* TypeRecordingBinaryOp_Patch(Arguments args) {
2181
2263
  }
2182
2264
  }
2183
2265
 
2184
- Handle<JSBuiltinsObject> builtins = Top::builtins();
2266
+ Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2267
+ isolate->thread_local_top()->context_->builtins(), isolate);
2185
2268
  Object* builtin = NULL; // Initialization calms down the compiler.
2186
2269
  switch (op) {
2187
2270
  case Token::ADD:
@@ -2221,7 +2304,7 @@ MaybeObject* TypeRecordingBinaryOp_Patch(Arguments args) {
2221
2304
  UNREACHABLE();
2222
2305
  }
2223
2306
 
2224
- Handle<JSFunction> builtin_function(JSFunction::cast(builtin));
2307
+ Handle<JSFunction> builtin_function(JSFunction::cast(builtin), isolate);
2225
2308
 
2226
2309
  bool caught_exception;
2227
2310
  Object** builtin_args[] = { right.location() };
@@ -2281,16 +2364,16 @@ CompareIC::State CompareIC::TargetState(State state,
2281
2364
 
2282
2365
 
2283
2366
  // Used from ic_<arch>.cc.
2284
- Code* CompareIC_Miss(Arguments args) {
2367
+ RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2285
2368
  NoHandleAllocation na;
2286
2369
  ASSERT(args.length() == 3);
2287
- CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value()));
2370
+ CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value()));
2288
2371
  ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2289
2372
  return ic.target();
2290
2373
  }
2291
2374
 
2292
2375
 
2293
- static Address IC_utilities[] = {
2376
+ static const Address IC_utilities[] = {
2294
2377
  #define ADDR(name) FUNCTION_ADDR(name),
2295
2378
  IC_UTIL_LIST(ADDR)
2296
2379
  NULL