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
@@ -38,13 +38,22 @@ namespace internal {
38
38
  // TranscendentalCache runtime function.
39
39
  class TranscendentalCacheStub: public CodeStub {
40
40
  public:
41
- explicit TranscendentalCacheStub(TranscendentalCache::Type type)
42
- : type_(type) {}
41
+ enum ArgumentType {
42
+ TAGGED = 0 << TranscendentalCache::kTranscendentalTypeBits,
43
+ UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits
44
+ };
45
+
46
+ TranscendentalCacheStub(TranscendentalCache::Type type,
47
+ ArgumentType argument_type)
48
+ : type_(type), argument_type_(argument_type) { }
43
49
  void Generate(MacroAssembler* masm);
44
50
  private:
45
51
  TranscendentalCache::Type type_;
52
+ ArgumentType argument_type_;
53
+ void GenerateCallCFunction(MacroAssembler* masm, Register scratch);
54
+
46
55
  Major MajorKey() { return TranscendentalCache; }
47
- int MinorKey() { return type_; }
56
+ int MinorKey() { return type_ | argument_type_; }
48
57
  Runtime::FunctionId RuntimeFunction();
49
58
  };
50
59
 
@@ -302,6 +311,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
302
311
  void GenerateSmiStub(MacroAssembler* masm);
303
312
  void GenerateInt32Stub(MacroAssembler* masm);
304
313
  void GenerateHeapNumberStub(MacroAssembler* masm);
314
+ void GenerateOddballStub(MacroAssembler* masm);
305
315
  void GenerateStringStub(MacroAssembler* masm);
306
316
  void GenerateGenericStub(MacroAssembler* masm);
307
317
  void GenerateAddStrings(MacroAssembler* masm);
@@ -579,6 +589,9 @@ class RegExpCEntryStub: public CodeStub {
579
589
  private:
580
590
  Major MajorKey() { return RegExpCEntry; }
581
591
  int MinorKey() { return 0; }
592
+
593
+ bool NeedsImmovableCode() { return true; }
594
+
582
595
  const char* GetName() { return "RegExpCEntryStub"; }
583
596
  };
584
597
 
@@ -592,66 +605,19 @@ class DirectCEntryStub: public CodeStub {
592
605
  public:
593
606
  DirectCEntryStub() {}
594
607
  void Generate(MacroAssembler* masm);
595
- void GenerateCall(MacroAssembler* masm, ApiFunction *function);
608
+ void GenerateCall(MacroAssembler* masm, ExternalReference function);
596
609
  void GenerateCall(MacroAssembler* masm, Register target);
597
610
 
598
611
  private:
599
612
  Major MajorKey() { return DirectCEntry; }
600
613
  int MinorKey() { return 0; }
614
+
615
+ bool NeedsImmovableCode() { return true; }
616
+
601
617
  const char* GetName() { return "DirectCEntryStub"; }
602
618
  };
603
619
 
604
620
 
605
- // Generate code to load an element from a pixel array. The receiver is assumed
606
- // to not be a smi and to have elements, the caller must guarantee this
607
- // precondition. If key is not a smi, then the generated code branches to
608
- // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi
609
- // check has already been performed on key so that the smi check is not
610
- // generated. If key is not a valid index within the bounds of the pixel array,
611
- // the generated code jumps to out_of_range. receiver, key and elements are
612
- // unchanged throughout the generated code sequence.
613
- void GenerateFastPixelArrayLoad(MacroAssembler* masm,
614
- Register receiver,
615
- Register key,
616
- Register elements_map,
617
- Register elements,
618
- Register scratch1,
619
- Register scratch2,
620
- Register result,
621
- Label* not_pixel_array,
622
- Label* key_not_smi,
623
- Label* out_of_range);
624
-
625
- // Generate code to store an element into a pixel array, clamping values between
626
- // [0..255]. The receiver is assumed to not be a smi and to have elements, the
627
- // caller must guarantee this precondition. If key is not a smi, then the
628
- // generated code branches to key_not_smi. Callers can specify NULL for
629
- // key_not_smi to signal that a smi check has already been performed on key so
630
- // that the smi check is not generated. If value is not a smi, the generated
631
- // code will branch to value_not_smi. If the receiver doesn't have pixel array
632
- // elements, the generated code will branch to not_pixel_array, unless
633
- // not_pixel_array is NULL, in which case the caller must ensure that the
634
- // receiver has pixel array elements. If key is not a valid index within the
635
- // bounds of the pixel array, the generated code jumps to out_of_range. If
636
- // load_elements_from_receiver is true, then the elements of receiver is loaded
637
- // into elements, otherwise elements is assumed to already be the receiver's
638
- // elements. If load_elements_map_from_elements is true, elements_map is loaded
639
- // from elements, otherwise it is assumed to already contain the element map.
640
- void GenerateFastPixelArrayStore(MacroAssembler* masm,
641
- Register receiver,
642
- Register key,
643
- Register value,
644
- Register elements,
645
- Register elements_map,
646
- Register scratch1,
647
- Register scratch2,
648
- bool load_elements_from_receiver,
649
- bool load_elements_map_from_elements,
650
- Label* key_not_smi,
651
- Label* value_not_smi,
652
- Label* not_pixel_array,
653
- Label* out_of_range);
654
-
655
621
  } } // namespace v8::internal
656
622
 
657
623
  #endif // V8_ARM_CODE_STUBS_ARM_H_
@@ -132,8 +132,6 @@ TypeInfoCodeGenState::~TypeInfoCodeGenState() {
132
132
  // -------------------------------------------------------------------------
133
133
  // CodeGenerator implementation
134
134
 
135
- int CodeGenerator::inlined_write_barrier_size_ = -1;
136
-
137
135
  CodeGenerator::CodeGenerator(MacroAssembler* masm)
138
136
  : deferred_(8),
139
137
  masm_(masm),
@@ -307,7 +305,7 @@ void CodeGenerator::Generate(CompilationInfo* info) {
307
305
  if (!scope()->HasIllegalRedeclaration()) {
308
306
  Comment cmnt(masm_, "[ function body");
309
307
  #ifdef DEBUG
310
- bool is_builtin = Bootstrapper::IsActive();
308
+ bool is_builtin = Isolate::Current()->bootstrapper()->IsActive();
311
309
  bool should_trace =
312
310
  is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls;
313
311
  if (should_trace) {
@@ -577,11 +575,13 @@ void CodeGenerator::LoadGlobalReceiver(Register scratch) {
577
575
 
578
576
  ArgumentsAllocationMode CodeGenerator::ArgumentsMode() {
579
577
  if (scope()->arguments() == NULL) return NO_ARGUMENTS_ALLOCATION;
580
- ASSERT(scope()->arguments_shadow() != NULL);
578
+
579
+ // In strict mode there is no need for shadow arguments.
580
+ ASSERT(scope()->arguments_shadow() != NULL || scope()->is_strict_mode());
581
581
  // We don't want to do lazy arguments allocation for functions that
582
582
  // have heap-allocated contexts, because it interfers with the
583
583
  // uninitialized const tracking in the context objects.
584
- return (scope()->num_heap_slots() > 0)
584
+ return (scope()->num_heap_slots() > 0 || scope()->is_strict_mode())
585
585
  ? EAGER_ARGUMENTS_ALLOCATION
586
586
  : LAZY_ARGUMENTS_ALLOCATION;
587
587
  }
@@ -599,7 +599,9 @@ void CodeGenerator::StoreArgumentsObject(bool initial) {
599
599
  frame_->EmitPushRoot(Heap::kArgumentsMarkerRootIndex);
600
600
  } else {
601
601
  frame_->SpillAll();
602
- ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
602
+ ArgumentsAccessStub stub(is_strict_mode()
603
+ ? ArgumentsAccessStub::NEW_STRICT
604
+ : ArgumentsAccessStub::NEW_NON_STRICT);
603
605
  __ ldr(r2, frame_->Function());
604
606
  // The receiver is below the arguments, the return address, and the
605
607
  // frame pointer on the stack.
@@ -615,7 +617,9 @@ void CodeGenerator::StoreArgumentsObject(bool initial) {
615
617
  Variable* arguments = scope()->arguments();
616
618
  Variable* shadow = scope()->arguments_shadow();
617
619
  ASSERT(arguments != NULL && arguments->AsSlot() != NULL);
618
- ASSERT(shadow != NULL && shadow->AsSlot() != NULL);
620
+ ASSERT((shadow != NULL && shadow->AsSlot() != NULL) ||
621
+ scope()->is_strict_mode());
622
+
619
623
  JumpTarget done;
620
624
  if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) {
621
625
  // We have to skip storing into the arguments slot if it has
@@ -629,7 +633,9 @@ void CodeGenerator::StoreArgumentsObject(bool initial) {
629
633
  }
630
634
  StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT);
631
635
  if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind();
632
- StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT);
636
+ if (shadow != NULL) {
637
+ StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT);
638
+ }
633
639
  }
634
640
 
635
641
 
@@ -1153,7 +1159,7 @@ void DeferredInlineSmiOperation::GenerateNonSmiInput() {
1153
1159
  }
1154
1160
  // Check that the *signed* result fits in a smi. Not necessary for AND, SAR
1155
1161
  // if the shift if more than 0 or SHR if the shit is more than 1.
1156
- if (!( (op_ == Token::AND) ||
1162
+ if (!( (op_ == Token::AND && value_ >= 0) ||
1157
1163
  ((op_ == Token::SAR) && (shift_value > 0)) ||
1158
1164
  ((op_ == Token::SHR) && (shift_value > 1)))) {
1159
1165
  __ add(r3, int32, Operand(0x40000000), SetCC);
@@ -1414,8 +1420,10 @@ void CodeGenerator::SmiOperation(Token::Value op,
1414
1420
  default: UNREACHABLE();
1415
1421
  }
1416
1422
  deferred->BindExit();
1417
- TypeInfo result_type =
1418
- (op == Token::BIT_AND) ? TypeInfo::Smi() : TypeInfo::Integer32();
1423
+ TypeInfo result_type = TypeInfo::Integer32();
1424
+ if (op == Token::BIT_AND && int_value >= 0) {
1425
+ result_type = TypeInfo::Smi();
1426
+ }
1419
1427
  frame_->EmitPush(tos, result_type);
1420
1428
  }
1421
1429
  break;
@@ -1714,7 +1722,7 @@ void CodeGenerator::CallApplyLazy(Expression* applicand,
1714
1722
  // Load applicand.apply onto the stack. This will usually
1715
1723
  // give us a megamorphic load site. Not super, but it works.
1716
1724
  Load(applicand);
1717
- Handle<String> name = Factory::LookupAsciiSymbol("apply");
1725
+ Handle<String> name = FACTORY->LookupAsciiSymbol("apply");
1718
1726
  frame_->Dup();
1719
1727
  frame_->CallLoadIC(name, RelocInfo::CODE_TARGET);
1720
1728
  frame_->EmitPush(r0);
@@ -1777,7 +1785,8 @@ void CodeGenerator::CallApplyLazy(Expression* applicand,
1777
1785
  __ JumpIfSmi(r0, &build_args);
1778
1786
  __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE);
1779
1787
  __ b(ne, &build_args);
1780
- Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply));
1788
+ Handle<Code> apply_code(
1789
+ Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply));
1781
1790
  __ ldr(r1, FieldMemOperand(r0, JSFunction::kCodeEntryOffset));
1782
1791
  __ sub(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag));
1783
1792
  __ cmp(r1, Operand(apply_code));
@@ -1938,8 +1947,9 @@ void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
1938
1947
  frame_->EmitPush(cp);
1939
1948
  frame_->EmitPush(Operand(pairs));
1940
1949
  frame_->EmitPush(Operand(Smi::FromInt(is_eval() ? 1 : 0)));
1950
+ frame_->EmitPush(Operand(Smi::FromInt(strict_mode_flag())));
1941
1951
 
1942
- frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
1952
+ frame_->CallRuntime(Runtime::kDeclareGlobals, 4);
1943
1953
  // The result is discarded.
1944
1954
  }
1945
1955
 
@@ -1991,7 +2001,7 @@ void CodeGenerator::VisitDeclaration(Declaration* node) {
1991
2001
  // If we have a function or a constant, we need to initialize the variable.
1992
2002
  Expression* val = NULL;
1993
2003
  if (node->mode() == Variable::CONST) {
1994
- val = new Literal(Factory::the_hole_value());
2004
+ val = new Literal(FACTORY->the_hole_value());
1995
2005
  } else {
1996
2006
  val = node->fun(); // NULL if we don't have a function
1997
2007
  }
@@ -2848,7 +2858,7 @@ void CodeGenerator::VisitTryCatchStatement(TryCatchStatement* node) {
2848
2858
  function_return_is_shadowed_ = function_return_was_shadowed;
2849
2859
 
2850
2860
  // Get an external reference to the handler address.
2851
- ExternalReference handler_address(Top::k_handler_address);
2861
+ ExternalReference handler_address(Isolate::k_handler_address, isolate());
2852
2862
 
2853
2863
  // If we can fall off the end of the try block, unlink from try chain.
2854
2864
  if (has_valid_frame()) {
@@ -2964,7 +2974,7 @@ void CodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* node) {
2964
2974
  function_return_is_shadowed_ = function_return_was_shadowed;
2965
2975
 
2966
2976
  // Get an external reference to the handler address.
2967
- ExternalReference handler_address(Top::k_handler_address);
2977
+ ExternalReference handler_address(Isolate::k_handler_address, isolate());
2968
2978
 
2969
2979
  // If we can fall off the end of the try block, unlink from the try
2970
2980
  // chain and set the state on the frame to FALLING.
@@ -3105,10 +3115,11 @@ void CodeGenerator::InstantiateFunction(
3105
3115
  bool pretenure) {
3106
3116
  // Use the fast case closure allocation code that allocates in new
3107
3117
  // space for nested functions that don't need literals cloning.
3108
- if (scope()->is_function_scope() &&
3109
- function_info->num_literals() == 0 &&
3110
- !pretenure) {
3111
- FastNewClosureStub stub;
3118
+ if (!pretenure &&
3119
+ scope()->is_function_scope() &&
3120
+ function_info->num_literals() == 0) {
3121
+ FastNewClosureStub stub(
3122
+ function_info->strict_mode() ? kStrictMode : kNonStrictMode);
3112
3123
  frame_->EmitPush(Operand(function_info));
3113
3124
  frame_->SpillAll();
3114
3125
  frame_->CallStub(&stub, 1);
@@ -3118,8 +3129,8 @@ void CodeGenerator::InstantiateFunction(
3118
3129
  frame_->EmitPush(cp);
3119
3130
  frame_->EmitPush(Operand(function_info));
3120
3131
  frame_->EmitPush(Operand(pretenure
3121
- ? Factory::true_value()
3122
- : Factory::false_value()));
3132
+ ? FACTORY->true_value()
3133
+ : FACTORY->false_value()));
3123
3134
  frame_->CallRuntime(Runtime::kNewClosure, 3);
3124
3135
  frame_->EmitPush(r0);
3125
3136
  }
@@ -3287,7 +3298,8 @@ void CodeGenerator::StoreToSlot(Slot* slot, InitState init_state) {
3287
3298
  // context slot followed by initialization.
3288
3299
  frame_->CallRuntime(Runtime::kInitializeConstContextSlot, 3);
3289
3300
  } else {
3290
- frame_->CallRuntime(Runtime::kStoreContextSlot, 3);
3301
+ frame_->EmitPush(Operand(Smi::FromInt(strict_mode_flag())));
3302
+ frame_->CallRuntime(Runtime::kStoreContextSlot, 4);
3291
3303
  }
3292
3304
  // Storing a variable must keep the (new) value on the expression
3293
3305
  // stack. This is necessary for compiling assignment expressions.
@@ -3618,7 +3630,8 @@ void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) {
3618
3630
  // else fall through
3619
3631
  case ObjectLiteral::Property::COMPUTED:
3620
3632
  if (key->handle()->IsSymbol()) {
3621
- Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
3633
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
3634
+ Builtins::kStoreIC_Initialize));
3622
3635
  Load(value);
3623
3636
  if (property->emit_store()) {
3624
3637
  frame_->PopToR0();
@@ -3637,7 +3650,8 @@ void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) {
3637
3650
  Load(key);
3638
3651
  Load(value);
3639
3652
  if (property->emit_store()) {
3640
- frame_->CallRuntime(Runtime::kSetProperty, 3);
3653
+ frame_->EmitPush(Operand(Smi::FromInt(NONE))); // PropertyAttributes
3654
+ frame_->CallRuntime(Runtime::kSetProperty, 4);
3641
3655
  } else {
3642
3656
  frame_->Drop(3);
3643
3657
  }
@@ -3680,11 +3694,12 @@ void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
3680
3694
  frame_->EmitPush(Operand(Smi::FromInt(node->literal_index())));
3681
3695
  frame_->EmitPush(Operand(node->constant_elements()));
3682
3696
  int length = node->values()->length();
3683
- if (node->constant_elements()->map() == Heap::fixed_cow_array_map()) {
3697
+ if (node->constant_elements()->map() == HEAP->fixed_cow_array_map()) {
3684
3698
  FastCloneShallowArrayStub stub(
3685
3699
  FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
3686
3700
  frame_->CallStub(&stub, 3);
3687
- __ IncrementCounter(&Counters::cow_arrays_created_stub, 1, r1, r2);
3701
+ __ IncrementCounter(masm_->isolate()->counters()->cow_arrays_created_stub(),
3702
+ 1, r1, r2);
3688
3703
  } else if (node->depth() > 1) {
3689
3704
  frame_->CallRuntime(Runtime::kCreateArrayLiteral, 3);
3690
3705
  } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
@@ -4240,7 +4255,8 @@ void CodeGenerator::VisitCall(Call* node) {
4240
4255
  // Setup the name register and call the IC initialization code.
4241
4256
  __ mov(r2, Operand(var->name()));
4242
4257
  InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4243
- Handle<Code> stub = StubCache::ComputeCallInitialize(arg_count, in_loop);
4258
+ Handle<Code> stub =
4259
+ ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop);
4244
4260
  CodeForSourcePosition(node->position());
4245
4261
  frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT,
4246
4262
  arg_count + 1);
@@ -4335,7 +4351,7 @@ void CodeGenerator::VisitCall(Call* node) {
4335
4351
  __ mov(r2, Operand(name));
4336
4352
  InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4337
4353
  Handle<Code> stub =
4338
- StubCache::ComputeCallInitialize(arg_count, in_loop);
4354
+ ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop);
4339
4355
  CodeForSourcePosition(node->position());
4340
4356
  frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4341
4357
  __ ldr(cp, frame_->Context());
@@ -4377,7 +4393,8 @@ void CodeGenerator::VisitCall(Call* node) {
4377
4393
  // Load the key into r2 and call the IC initialization code.
4378
4394
  InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4379
4395
  Handle<Code> stub =
4380
- StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
4396
+ ISOLATE->stub_cache()->ComputeKeyedCallInitialize(arg_count,
4397
+ in_loop);
4381
4398
  CodeForSourcePosition(node->position());
4382
4399
  frame_->SpillAll();
4383
4400
  __ ldr(r2, frame_->ElementAt(arg_count + 1));
@@ -4442,7 +4459,8 @@ void CodeGenerator::VisitCallNew(CallNew* node) {
4442
4459
  // Call the construct call builtin that handles allocation and
4443
4460
  // constructor invocation.
4444
4461
  CodeForSourcePosition(node->position());
4445
- Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall));
4462
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
4463
+ Builtins::kJSConstructCall));
4446
4464
  frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1);
4447
4465
  frame_->EmitPush(r0);
4448
4466
 
@@ -4491,13 +4509,13 @@ void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) {
4491
4509
 
4492
4510
  // Functions have class 'Function'.
4493
4511
  function.Bind();
4494
- __ mov(tos, Operand(Factory::function_class_symbol()));
4512
+ __ mov(tos, Operand(FACTORY->function_class_symbol()));
4495
4513
  frame_->EmitPush(tos);
4496
4514
  leave.Jump();
4497
4515
 
4498
4516
  // Objects with a non-function constructor have class 'Object'.
4499
4517
  non_function_constructor.Bind();
4500
- __ mov(tos, Operand(Factory::Object_symbol()));
4518
+ __ mov(tos, Operand(FACTORY->Object_symbol()));
4501
4519
  frame_->EmitPush(tos);
4502
4520
  leave.Jump();
4503
4521
 
@@ -5138,7 +5156,7 @@ class DeferredIsStringWrapperSafeForDefaultValueOf : public DeferredCode {
5138
5156
  Label entry, loop;
5139
5157
  // The use of ip to store the valueOf symbol asumes that it is not otherwise
5140
5158
  // used in the loop below.
5141
- __ mov(ip, Operand(Factory::value_of_symbol()));
5159
+ __ mov(ip, Operand(FACTORY->value_of_symbol()));
5142
5160
  __ jmp(&entry);
5143
5161
  __ bind(&loop);
5144
5162
  __ ldr(scratch2_, MemOperand(map_result_, 0));
@@ -5170,11 +5188,11 @@ class DeferredIsStringWrapperSafeForDefaultValueOf : public DeferredCode {
5170
5188
 
5171
5189
  // Set the bit in the map to indicate that it has been checked safe for
5172
5190
  // default valueOf and set true result.
5173
- __ ldr(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset));
5191
+ __ ldrb(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset));
5174
5192
  __ orr(scratch1_,
5175
5193
  scratch1_,
5176
5194
  Operand(1 << Map::kStringWrapperSafeForDefaultValueOf));
5177
- __ str(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset));
5195
+ __ strb(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset));
5178
5196
  __ mov(map_result_, Operand(1));
5179
5197
  __ jmp(exit_label());
5180
5198
  __ bind(&false_result);
@@ -5342,8 +5360,9 @@ void CodeGenerator::GenerateRandomHeapNumber(
5342
5360
  // by computing:
5343
5361
  // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
5344
5362
  if (CpuFeatures::IsSupported(VFP3)) {
5345
- __ PrepareCallCFunction(0, r1);
5346
- __ CallCFunction(ExternalReference::random_uint32_function(), 0);
5363
+ __ PrepareCallCFunction(1, r0);
5364
+ __ mov(r0, Operand(ExternalReference::isolate_address()));
5365
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
5347
5366
 
5348
5367
  CpuFeatures::Scope scope(VFP3);
5349
5368
  // 0x41300000 is the top half of 1.0 x 2^20 as a double.
@@ -5361,10 +5380,11 @@ void CodeGenerator::GenerateRandomHeapNumber(
5361
5380
  __ vstr(d7, r0, HeapNumber::kValueOffset);
5362
5381
  frame_->EmitPush(r4);
5363
5382
  } else {
5383
+ __ PrepareCallCFunction(2, r0);
5364
5384
  __ mov(r0, Operand(r4));
5365
- __ PrepareCallCFunction(1, r1);
5385
+ __ mov(r1, Operand(ExternalReference::isolate_address()));
5366
5386
  __ CallCFunction(
5367
- ExternalReference::fill_heap_number_with_random_function(), 1);
5387
+ ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
5368
5388
  frame_->EmitPush(r0);
5369
5389
  }
5370
5390
  }
@@ -5465,7 +5485,7 @@ void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) {
5465
5485
  int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
5466
5486
 
5467
5487
  Handle<FixedArray> jsfunction_result_caches(
5468
- Top::global_context()->jsfunction_result_caches());
5488
+ Isolate::Current()->global_context()->jsfunction_result_caches());
5469
5489
  if (jsfunction_result_caches->length() <= cache_id) {
5470
5490
  __ Abort("Attempt to use undefined cache.");
5471
5491
  frame_->EmitPushRoot(Heap::kUndefinedValueRootIndex);
@@ -5575,8 +5595,8 @@ void CodeGenerator::GenerateSwapElements(ZoneList<Expression*>* args) {
5575
5595
  // Fetch the map and check if array is in fast case.
5576
5596
  // Check that object doesn't require security checks and
5577
5597
  // has no indexed interceptor.
5578
- __ CompareObjectType(object, tmp1, tmp2, FIRST_JS_OBJECT_TYPE);
5579
- deferred->Branch(lt);
5598
+ __ CompareObjectType(object, tmp1, tmp2, JS_ARRAY_TYPE);
5599
+ deferred->Branch(ne);
5580
5600
  __ ldrb(tmp2, FieldMemOperand(tmp1, Map::kBitFieldOffset));
5581
5601
  __ tst(tmp2, Operand(KeyedLoadIC::kSlowCaseBitFieldMask));
5582
5602
  deferred->Branch(ne);
@@ -5656,7 +5676,8 @@ void CodeGenerator::GenerateMathSin(ZoneList<Expression*>* args) {
5656
5676
  ASSERT_EQ(args->length(), 1);
5657
5677
  Load(args->at(0));
5658
5678
  if (CpuFeatures::IsSupported(VFP3)) {
5659
- TranscendentalCacheStub stub(TranscendentalCache::SIN);
5679
+ TranscendentalCacheStub stub(TranscendentalCache::SIN,
5680
+ TranscendentalCacheStub::TAGGED);
5660
5681
  frame_->SpillAllButCopyTOSToR0();
5661
5682
  frame_->CallStub(&stub, 1);
5662
5683
  } else {
@@ -5670,7 +5691,8 @@ void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) {
5670
5691
  ASSERT_EQ(args->length(), 1);
5671
5692
  Load(args->at(0));
5672
5693
  if (CpuFeatures::IsSupported(VFP3)) {
5673
- TranscendentalCacheStub stub(TranscendentalCache::COS);
5694
+ TranscendentalCacheStub stub(TranscendentalCache::COS,
5695
+ TranscendentalCacheStub::TAGGED);
5674
5696
  frame_->SpillAllButCopyTOSToR0();
5675
5697
  frame_->CallStub(&stub, 1);
5676
5698
  } else {
@@ -5684,7 +5706,8 @@ void CodeGenerator::GenerateMathLog(ZoneList<Expression*>* args) {
5684
5706
  ASSERT_EQ(args->length(), 1);
5685
5707
  Load(args->at(0));
5686
5708
  if (CpuFeatures::IsSupported(VFP3)) {
5687
- TranscendentalCacheStub stub(TranscendentalCache::LOG);
5709
+ TranscendentalCacheStub stub(TranscendentalCache::LOG,
5710
+ TranscendentalCacheStub::TAGGED);
5688
5711
  frame_->SpillAllButCopyTOSToR0();
5689
5712
  frame_->CallStub(&stub, 1);
5690
5713
  } else {
@@ -5787,7 +5810,7 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
5787
5810
 
5788
5811
  ZoneList<Expression*>* args = node->arguments();
5789
5812
  Comment cmnt(masm_, "[ CallRuntime");
5790
- Runtime::Function* function = node->function();
5813
+ const Runtime::Function* function = node->function();
5791
5814
 
5792
5815
  if (function == NULL) {
5793
5816
  // Prepare stack for calling JS runtime function.
@@ -5811,7 +5834,8 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
5811
5834
  // Call the JS runtime function.
5812
5835
  __ mov(r2, Operand(node->name()));
5813
5836
  InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
5814
- Handle<Code> stub = StubCache::ComputeCallInitialize(arg_count, in_loop);
5837
+ Handle<Code> stub =
5838
+ ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop);
5815
5839
  frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
5816
5840
  __ ldr(cp, frame_->Context());
5817
5841
  frame_->EmitPush(r0);
@@ -6346,7 +6370,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6346
6370
 
6347
6371
  Register scratch = VirtualFrame::scratch0();
6348
6372
 
6349
- if (check->Equals(Heap::number_symbol())) {
6373
+ if (check->Equals(HEAP->number_symbol())) {
6350
6374
  __ tst(tos, Operand(kSmiTagMask));
6351
6375
  true_target()->Branch(eq);
6352
6376
  __ ldr(tos, FieldMemOperand(tos, HeapObject::kMapOffset));
@@ -6354,7 +6378,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6354
6378
  __ cmp(tos, ip);
6355
6379
  cc_reg_ = eq;
6356
6380
 
6357
- } else if (check->Equals(Heap::string_symbol())) {
6381
+ } else if (check->Equals(HEAP->string_symbol())) {
6358
6382
  __ tst(tos, Operand(kSmiTagMask));
6359
6383
  false_target()->Branch(eq);
6360
6384
 
@@ -6370,7 +6394,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6370
6394
  __ cmp(scratch, Operand(FIRST_NONSTRING_TYPE));
6371
6395
  cc_reg_ = lt;
6372
6396
 
6373
- } else if (check->Equals(Heap::boolean_symbol())) {
6397
+ } else if (check->Equals(HEAP->boolean_symbol())) {
6374
6398
  __ LoadRoot(ip, Heap::kTrueValueRootIndex);
6375
6399
  __ cmp(tos, ip);
6376
6400
  true_target()->Branch(eq);
@@ -6378,7 +6402,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6378
6402
  __ cmp(tos, ip);
6379
6403
  cc_reg_ = eq;
6380
6404
 
6381
- } else if (check->Equals(Heap::undefined_symbol())) {
6405
+ } else if (check->Equals(HEAP->undefined_symbol())) {
6382
6406
  __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
6383
6407
  __ cmp(tos, ip);
6384
6408
  true_target()->Branch(eq);
@@ -6394,7 +6418,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6394
6418
 
6395
6419
  cc_reg_ = eq;
6396
6420
 
6397
- } else if (check->Equals(Heap::function_symbol())) {
6421
+ } else if (check->Equals(HEAP->function_symbol())) {
6398
6422
  __ tst(tos, Operand(kSmiTagMask));
6399
6423
  false_target()->Branch(eq);
6400
6424
  Register map_reg = scratch;
@@ -6404,7 +6428,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
6404
6428
  __ CompareInstanceType(map_reg, tos, JS_REGEXP_TYPE);
6405
6429
  cc_reg_ = eq;
6406
6430
 
6407
- } else if (check->Equals(Heap::object_symbol())) {
6431
+ } else if (check->Equals(HEAP->object_symbol())) {
6408
6432
  __ tst(tos, Operand(kSmiTagMask));
6409
6433
  false_target()->Branch(eq);
6410
6434
 
@@ -6566,8 +6590,10 @@ void DeferredReferenceGetNamedValue::Generate() {
6566
6590
  Register scratch1 = VirtualFrame::scratch0();
6567
6591
  Register scratch2 = VirtualFrame::scratch1();
6568
6592
  ASSERT(!receiver_.is(scratch1) && !receiver_.is(scratch2));
6569
- __ DecrementCounter(&Counters::named_load_inline, 1, scratch1, scratch2);
6570
- __ IncrementCounter(&Counters::named_load_inline_miss, 1, scratch1, scratch2);
6593
+ __ DecrementCounter(masm_->isolate()->counters()->named_load_inline(),
6594
+ 1, scratch1, scratch2);
6595
+ __ IncrementCounter(masm_->isolate()->counters()->named_load_inline_miss(),
6596
+ 1, scratch1, scratch2);
6571
6597
 
6572
6598
  // Ensure receiver in r0 and name in r2 to match load ic calling convention.
6573
6599
  __ Move(r0, receiver_);
@@ -6575,7 +6601,8 @@ void DeferredReferenceGetNamedValue::Generate() {
6575
6601
 
6576
6602
  // The rest of the instructions in the deferred code must be together.
6577
6603
  { Assembler::BlockConstPoolScope block_const_pool(masm_);
6578
- Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
6604
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
6605
+ Builtins::kLoadIC_Initialize));
6579
6606
  RelocInfo::Mode mode = is_contextual_
6580
6607
  ? RelocInfo::CODE_TARGET_CONTEXT
6581
6608
  : RelocInfo::CODE_TARGET;
@@ -6637,8 +6664,10 @@ void DeferredReferenceGetKeyedValue::Generate() {
6637
6664
 
6638
6665
  Register scratch1 = VirtualFrame::scratch0();
6639
6666
  Register scratch2 = VirtualFrame::scratch1();
6640
- __ DecrementCounter(&Counters::keyed_load_inline, 1, scratch1, scratch2);
6641
- __ IncrementCounter(&Counters::keyed_load_inline_miss, 1, scratch1, scratch2);
6667
+ __ DecrementCounter(masm_->isolate()->counters()->keyed_load_inline(),
6668
+ 1, scratch1, scratch2);
6669
+ __ IncrementCounter(masm_->isolate()->counters()->keyed_load_inline_miss(),
6670
+ 1, scratch1, scratch2);
6642
6671
 
6643
6672
  // Ensure key in r0 and receiver in r1 to match keyed load ic calling
6644
6673
  // convention.
@@ -6649,7 +6678,8 @@ void DeferredReferenceGetKeyedValue::Generate() {
6649
6678
  // The rest of the instructions in the deferred code must be together.
6650
6679
  { Assembler::BlockConstPoolScope block_const_pool(masm_);
6651
6680
  // Call keyed load IC. It has the arguments key and receiver in r0 and r1.
6652
- Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
6681
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
6682
+ Builtins::kKeyedLoadIC_Initialize));
6653
6683
  __ Call(ic, RelocInfo::CODE_TARGET);
6654
6684
  // The call must be followed by a nop instruction to indicate that the
6655
6685
  // keyed load has been inlined.
@@ -6674,8 +6704,12 @@ class DeferredReferenceSetKeyedValue: public DeferredCode {
6674
6704
  public:
6675
6705
  DeferredReferenceSetKeyedValue(Register value,
6676
6706
  Register key,
6677
- Register receiver)
6678
- : value_(value), key_(key), receiver_(receiver) {
6707
+ Register receiver,
6708
+ StrictModeFlag strict_mode)
6709
+ : value_(value),
6710
+ key_(key),
6711
+ receiver_(receiver),
6712
+ strict_mode_(strict_mode) {
6679
6713
  set_comment("[ DeferredReferenceSetKeyedValue");
6680
6714
  }
6681
6715
 
@@ -6685,15 +6719,17 @@ class DeferredReferenceSetKeyedValue: public DeferredCode {
6685
6719
  Register value_;
6686
6720
  Register key_;
6687
6721
  Register receiver_;
6722
+ StrictModeFlag strict_mode_;
6688
6723
  };
6689
6724
 
6690
6725
 
6691
6726
  void DeferredReferenceSetKeyedValue::Generate() {
6692
6727
  Register scratch1 = VirtualFrame::scratch0();
6693
6728
  Register scratch2 = VirtualFrame::scratch1();
6694
- __ DecrementCounter(&Counters::keyed_store_inline, 1, scratch1, scratch2);
6695
- __ IncrementCounter(
6696
- &Counters::keyed_store_inline_miss, 1, scratch1, scratch2);
6729
+ __ DecrementCounter(masm_->isolate()->counters()->keyed_store_inline(),
6730
+ 1, scratch1, scratch2);
6731
+ __ IncrementCounter(masm_->isolate()->counters()->keyed_store_inline_miss(),
6732
+ 1, scratch1, scratch2);
6697
6733
 
6698
6734
  // Ensure value in r0, key in r1 and receiver in r2 to match keyed store ic
6699
6735
  // calling convention.
@@ -6706,7 +6742,10 @@ void DeferredReferenceSetKeyedValue::Generate() {
6706
6742
  { Assembler::BlockConstPoolScope block_const_pool(masm_);
6707
6743
  // Call keyed store IC. It has the arguments value, key and receiver in r0,
6708
6744
  // r1 and r2.
6709
- Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
6745
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
6746
+ (strict_mode_ == kStrictMode)
6747
+ ? Builtins::kKeyedStoreIC_Initialize_Strict
6748
+ : Builtins::kKeyedStoreIC_Initialize));
6710
6749
  __ Call(ic, RelocInfo::CODE_TARGET);
6711
6750
  // The call must be followed by a nop instruction to indicate that the
6712
6751
  // keyed store has been inlined.
@@ -6724,8 +6763,12 @@ class DeferredReferenceSetNamedValue: public DeferredCode {
6724
6763
  public:
6725
6764
  DeferredReferenceSetNamedValue(Register value,
6726
6765
  Register receiver,
6727
- Handle<String> name)
6728
- : value_(value), receiver_(receiver), name_(name) {
6766
+ Handle<String> name,
6767
+ StrictModeFlag strict_mode)
6768
+ : value_(value),
6769
+ receiver_(receiver),
6770
+ name_(name),
6771
+ strict_mode_(strict_mode) {
6729
6772
  set_comment("[ DeferredReferenceSetNamedValue");
6730
6773
  }
6731
6774
 
@@ -6735,6 +6778,7 @@ class DeferredReferenceSetNamedValue: public DeferredCode {
6735
6778
  Register value_;
6736
6779
  Register receiver_;
6737
6780
  Handle<String> name_;
6781
+ StrictModeFlag strict_mode_;
6738
6782
  };
6739
6783
 
6740
6784
 
@@ -6754,7 +6798,9 @@ void DeferredReferenceSetNamedValue::Generate() {
6754
6798
  { Assembler::BlockConstPoolScope block_const_pool(masm_);
6755
6799
  // Call keyed store IC. It has the arguments value, key and receiver in r0,
6756
6800
  // r1 and r2.
6757
- Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
6801
+ Handle<Code> ic(Isolate::Current()->builtins()->builtin(
6802
+ (strict_mode_ == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict
6803
+ : Builtins::kStoreIC_Initialize));
6758
6804
  __ Call(ic, RelocInfo::CODE_TARGET);
6759
6805
  // The call must be followed by a nop instruction to indicate that the
6760
6806
  // named store has been inlined.
@@ -6778,7 +6824,7 @@ void DeferredReferenceSetNamedValue::Generate() {
6778
6824
  void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6779
6825
  bool contextual_load_in_builtin =
6780
6826
  is_contextual &&
6781
- (Bootstrapper::IsActive() ||
6827
+ (ISOLATE->bootstrapper()->IsActive() ||
6782
6828
  (!info_->closure().is_null() && info_->closure()->IsBuiltin()));
6783
6829
 
6784
6830
  if (scope()->is_global_scope() ||
@@ -6800,11 +6846,12 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6800
6846
  // Counter will be decremented in the deferred code. Placed here to avoid
6801
6847
  // having it in the instruction stream below where patching will occur.
6802
6848
  if (is_contextual) {
6803
- __ IncrementCounter(&Counters::named_load_global_inline, 1,
6804
- frame_->scratch0(), frame_->scratch1());
6849
+ __ IncrementCounter(
6850
+ masm_->isolate()->counters()->named_load_global_inline(),
6851
+ 1, frame_->scratch0(), frame_->scratch1());
6805
6852
  } else {
6806
- __ IncrementCounter(&Counters::named_load_inline, 1,
6807
- frame_->scratch0(), frame_->scratch1());
6853
+ __ IncrementCounter(masm_->isolate()->counters()->named_load_inline(),
6854
+ 1, frame_->scratch0(), frame_->scratch1());
6808
6855
  }
6809
6856
 
6810
6857
  // The following instructions are the inlined load of an in-object property.
@@ -6836,8 +6883,9 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6836
6883
  }
6837
6884
  }
6838
6885
  if (is_dont_delete) {
6839
- __ IncrementCounter(&Counters::dont_delete_hint_hit, 1,
6840
- frame_->scratch0(), frame_->scratch1());
6886
+ __ IncrementCounter(
6887
+ masm_->isolate()->counters()->dont_delete_hint_hit(),
6888
+ 1, frame_->scratch0(), frame_->scratch1());
6841
6889
  }
6842
6890
  }
6843
6891
 
@@ -6873,7 +6921,7 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6873
6921
  // Check the map. The null map used below is patched by the inline cache
6874
6922
  // code. Therefore we can't use a LoadRoot call.
6875
6923
  __ ldr(scratch, FieldMemOperand(receiver, HeapObject::kMapOffset));
6876
- __ mov(scratch2, Operand(Factory::null_value()));
6924
+ __ mov(scratch2, Operand(FACTORY->null_value()));
6877
6925
  __ cmp(scratch, scratch2);
6878
6926
  deferred->Branch(ne);
6879
6927
 
@@ -6882,7 +6930,7 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6882
6930
  InlinedNamedLoadInstructions += 1;
6883
6931
  #endif
6884
6932
  // Load the (initially invalid) cell and get its value.
6885
- masm()->mov(receiver, Operand(Factory::null_value()));
6933
+ masm()->mov(receiver, Operand(FACTORY->null_value()));
6886
6934
  __ ldr(receiver,
6887
6935
  FieldMemOperand(receiver, JSGlobalPropertyCell::kValueOffset));
6888
6936
 
@@ -6892,13 +6940,13 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
6892
6940
  #ifdef DEBUG
6893
6941
  InlinedNamedLoadInstructions += 3;
6894
6942
  #endif
6895
- __ cmp(receiver, Operand(Factory::the_hole_value()));
6943
+ __ cmp(receiver, Operand(FACTORY->the_hole_value()));
6896
6944
  deferred->Branch(eq);
6897
6945
  } else if (FLAG_debug_code) {
6898
6946
  #ifdef DEBUG
6899
6947
  InlinedNamedLoadInstructions += 3;
6900
6948
  #endif
6901
- __ cmp(receiver, Operand(Factory::the_hole_value()));
6949
+ __ cmp(receiver, Operand(FACTORY->the_hole_value()));
6902
6950
  __ b(&check_the_hole, eq);
6903
6951
  __ bind(&cont);
6904
6952
  }
@@ -6943,7 +6991,8 @@ void CodeGenerator::EmitNamedStore(Handle<String> name, bool is_contextual) {
6943
6991
  Register receiver = r1;
6944
6992
 
6945
6993
  DeferredReferenceSetNamedValue* deferred =
6946
- new DeferredReferenceSetNamedValue(value, receiver, name);
6994
+ new DeferredReferenceSetNamedValue(
6995
+ value, receiver, name, strict_mode_flag());
6947
6996
 
6948
6997
  // Check that the receiver is a heap object.
6949
6998
  __ tst(receiver, Operand(kSmiTagMask));
@@ -6965,7 +7014,7 @@ void CodeGenerator::EmitNamedStore(Handle<String> name, bool is_contextual) {
6965
7014
  Label check_inlined_codesize;
6966
7015
  masm_->bind(&check_inlined_codesize);
6967
7016
  #endif
6968
- __ mov(scratch0, Operand(Factory::null_value()));
7017
+ __ mov(scratch0, Operand(FACTORY->null_value()));
6969
7018
  __ cmp(scratch0, scratch1);
6970
7019
  deferred->Branch(ne);
6971
7020
 
@@ -6995,11 +7044,11 @@ void CodeGenerator::EmitNamedStore(Handle<String> name, bool is_contextual) {
6995
7044
  // Check that this is the first inlined write barrier or that
6996
7045
  // this inlined write barrier has the same size as all the other
6997
7046
  // inlined write barriers.
6998
- ASSERT((inlined_write_barrier_size_ == -1) ||
6999
- (inlined_write_barrier_size_ ==
7047
+ ASSERT((Isolate::Current()->inlined_write_barrier_size() == -1) ||
7048
+ (Isolate::Current()->inlined_write_barrier_size() ==
7000
7049
  masm()->InstructionsGeneratedSince(&record_write_start)));
7001
- inlined_write_barrier_size_ =
7002
- masm()->InstructionsGeneratedSince(&record_write_start);
7050
+ Isolate::Current()->set_inlined_write_barrier_size(
7051
+ masm()->InstructionsGeneratedSince(&record_write_start));
7003
7052
 
7004
7053
  // Make sure that the expected number of instructions are generated.
7005
7054
  ASSERT_EQ(GetInlinedNamedStoreInstructionsAfterPatch(),
@@ -7021,8 +7070,8 @@ void CodeGenerator::EmitKeyedLoad() {
7021
7070
 
7022
7071
  // Counter will be decremented in the deferred code. Placed here to avoid
7023
7072
  // having it in the instruction stream below where patching will occur.
7024
- __ IncrementCounter(&Counters::keyed_load_inline, 1,
7025
- frame_->scratch0(), frame_->scratch1());
7073
+ __ IncrementCounter(masm_->isolate()->counters()->keyed_load_inline(),
7074
+ 1, frame_->scratch0(), frame_->scratch1());
7026
7075
 
7027
7076
  // Load the key and receiver from the stack.
7028
7077
  bool key_is_known_smi = frame_->KnownSmiAt(0);
@@ -7058,7 +7107,7 @@ void CodeGenerator::EmitKeyedLoad() {
7058
7107
  Label check_inlined_codesize;
7059
7108
  masm_->bind(&check_inlined_codesize);
7060
7109
  #endif
7061
- __ mov(scratch2, Operand(Factory::null_value()));
7110
+ __ mov(scratch2, Operand(FACTORY->null_value()));
7062
7111
  __ cmp(scratch1, scratch2);
7063
7112
  deferred->Branch(ne);
7064
7113
 
@@ -7108,9 +7157,8 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7108
7157
 
7109
7158
  // Counter will be decremented in the deferred code. Placed here to avoid
7110
7159
  // having it in the instruction stream below where patching will occur.
7111
- __ IncrementCounter(&Counters::keyed_store_inline, 1,
7112
- scratch1, scratch2);
7113
-
7160
+ __ IncrementCounter(masm_->isolate()->counters()->keyed_store_inline(),
7161
+ 1, scratch1, scratch2);
7114
7162
 
7115
7163
 
7116
7164
  // Load the value, key and receiver from the stack.
@@ -7129,7 +7177,8 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7129
7177
 
7130
7178
  // The deferred code expects value, key and receiver in registers.
7131
7179
  DeferredReferenceSetKeyedValue* deferred =
7132
- new DeferredReferenceSetKeyedValue(value, key, receiver);
7180
+ new DeferredReferenceSetKeyedValue(
7181
+ value, key, receiver, strict_mode_flag());
7133
7182
 
7134
7183
  // Check that the value is a smi. As this inlined code does not set the
7135
7184
  // write barrier it is only possible to store smi values.
@@ -7159,18 +7208,14 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7159
7208
  __ CompareObjectType(receiver, scratch1, scratch1, JS_ARRAY_TYPE);
7160
7209
  deferred->Branch(ne);
7161
7210
 
7162
- // Check that the key is within bounds. Both the key and the length of
7163
- // the JSArray are smis. Use unsigned comparison to handle negative keys.
7164
- __ ldr(scratch1, FieldMemOperand(receiver, JSArray::kLengthOffset));
7165
- __ cmp(scratch1, key);
7166
- deferred->Branch(ls); // Unsigned less equal.
7167
-
7168
7211
  // Get the elements array from the receiver.
7169
7212
  __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset));
7170
7213
  if (!value_is_harmless && wb_info != LIKELY_SMI) {
7171
7214
  Label ok;
7172
- __ and_(scratch2, scratch1, Operand(ExternalReference::new_space_mask()));
7173
- __ cmp(scratch2, Operand(ExternalReference::new_space_start()));
7215
+ __ and_(scratch2,
7216
+ scratch1,
7217
+ Operand(ExternalReference::new_space_mask(isolate())));
7218
+ __ cmp(scratch2, Operand(ExternalReference::new_space_start(isolate())));
7174
7219
  __ tst(value, Operand(kSmiTagMask), ne);
7175
7220
  deferred->Branch(ne);
7176
7221
  #ifdef DEBUG
@@ -7179,6 +7224,7 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7179
7224
  }
7180
7225
  // Check that the elements array is not a dictionary.
7181
7226
  __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset));
7227
+
7182
7228
  // The following instructions are the part of the inlined store keyed
7183
7229
  // property code which can be patched. Therefore the exact number of
7184
7230
  // instructions generated need to be fixed, so the constant pool is blocked
@@ -7194,10 +7240,18 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7194
7240
  // comparison to always fail so that we will hit the IC call in the
7195
7241
  // deferred code which will allow the debugger to break for fast case
7196
7242
  // stores.
7197
- __ mov(scratch3, Operand(Factory::fixed_array_map()));
7243
+ __ mov(scratch3, Operand(FACTORY->fixed_array_map()));
7198
7244
  __ cmp(scratch2, scratch3);
7199
7245
  deferred->Branch(ne);
7200
7246
 
7247
+ // Check that the key is within bounds. Both the key and the length of
7248
+ // the JSArray are smis (because the fixed array check above ensures the
7249
+ // elements are in fast case). Use unsigned comparison to handle negative
7250
+ // keys.
7251
+ __ ldr(scratch3, FieldMemOperand(receiver, JSArray::kLengthOffset));
7252
+ __ cmp(scratch3, key);
7253
+ deferred->Branch(ls); // Unsigned less equal.
7254
+
7201
7255
  // Store the value.
7202
7256
  __ add(scratch1, scratch1,
7203
7257
  Operand(FixedArray::kHeaderSize - kHeapObjectTag));
@@ -7214,7 +7268,7 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
7214
7268
 
7215
7269
  deferred->BindExit();
7216
7270
  } else {
7217
- frame()->CallKeyedStoreIC();
7271
+ frame()->CallKeyedStoreIC(strict_mode_flag());
7218
7272
  }
7219
7273
  }
7220
7274
 
@@ -7356,7 +7410,7 @@ void Reference::SetValue(InitState init_state, WriteBarrierCharacter wb_info) {
7356
7410
  const char* GenericBinaryOpStub::GetName() {
7357
7411
  if (name_ != NULL) return name_;
7358
7412
  const int len = 100;
7359
- name_ = Bootstrapper::AllocateAutoDeletedArray(len);
7413
+ name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(len);
7360
7414
  if (name_ == NULL) return "OOM";
7361
7415
  const char* op_name = Token::Name(op_);
7362
7416
  const char* overwrite_name;
@@ -7376,7 +7430,6 @@ const char* GenericBinaryOpStub::GetName() {
7376
7430
  return name_;
7377
7431
  }
7378
7432
 
7379
-
7380
7433
  #undef __
7381
7434
 
7382
7435
  } } // namespace v8::internal