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
@@ -29,6 +29,8 @@
29
29
  #ifndef V8_MIPS_CODEGEN_MIPS_INL_H_
30
30
  #define V8_MIPS_CODEGEN_MIPS_INL_H_
31
31
 
32
+ #include "virtual-frame-mips.h"
33
+
32
34
  namespace v8 {
33
35
  namespace internal {
34
36
 
@@ -42,23 +44,15 @@ void DeferredCode::Jump() {
42
44
  }
43
45
 
44
46
 
45
- void Reference::GetValueAndSpill() {
46
- GetValue();
47
- }
48
-
49
-
50
- void CodeGenerator::VisitAndSpill(Statement* statement) {
51
- Visit(statement);
47
+ // Note: this has been hacked for submisson. Mips branches require two
48
+ // additional operands: Register src1, const Operand& src2.
49
+ void DeferredCode::Branch(Condition cond) {
50
+ __ Branch(&entry_label_, cond, zero_reg, Operand(0));
52
51
  }
53
52
 
54
53
 
55
- void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
56
- VisitStatements(statements);
57
- }
58
-
59
-
60
- void CodeGenerator::LoadAndSpill(Expression* expression) {
61
- Load(expression);
54
+ void Reference::GetValueAndSpill() {
55
+ GetValue();
62
56
  }
63
57
 
64
58
 
@@ -31,36 +31,62 @@
31
31
  #if defined(V8_TARGET_ARCH_MIPS)
32
32
 
33
33
  #include "bootstrapper.h"
34
+ #include "code-stubs.h"
34
35
  #include "codegen-inl.h"
35
36
  #include "compiler.h"
36
37
  #include "debug.h"
37
38
  #include "ic-inl.h"
39
+ #include "jsregexp.h"
40
+ #include "jump-target-inl.h"
38
41
  #include "parser.h"
42
+ #include "regexp-macro-assembler.h"
43
+ #include "regexp-stack.h"
39
44
  #include "register-allocator-inl.h"
40
45
  #include "runtime.h"
41
46
  #include "scopes.h"
47
+ #include "stub-cache.h"
42
48
  #include "virtual-frame-inl.h"
43
-
44
-
49
+ #include "virtual-frame-mips-inl.h"
45
50
 
46
51
  namespace v8 {
47
52
  namespace internal {
48
53
 
49
- #define __ ACCESS_MASM(masm_)
50
-
51
54
 
55
+ #define __ ACCESS_MASM(masm_)
52
56
 
53
- // -----------------------------------------------------------------------------
57
+ // -------------------------------------------------------------------------
54
58
  // Platform-specific DeferredCode functions.
55
59
 
56
-
57
60
  void DeferredCode::SaveRegisters() {
58
- UNIMPLEMENTED_MIPS();
61
+ // On MIPS you either have a completely spilled frame or you
62
+ // handle it yourself, but at the moment there's no automation
63
+ // of registers and deferred code.
59
64
  }
60
65
 
61
66
 
62
67
  void DeferredCode::RestoreRegisters() {
63
- UNIMPLEMENTED_MIPS();
68
+ }
69
+
70
+
71
+ // -------------------------------------------------------------------------
72
+ // Platform-specific RuntimeCallHelper functions.
73
+
74
+ void VirtualFrameRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
75
+ frame_state_->frame()->AssertIsSpilled();
76
+ }
77
+
78
+
79
+ void VirtualFrameRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
80
+ }
81
+
82
+
83
+ void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
84
+ masm->EnterInternalFrame();
85
+ }
86
+
87
+
88
+ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
89
+ masm->LeaveInternalFrame();
64
90
  }
65
91
 
66
92
 
@@ -69,21 +95,28 @@ void DeferredCode::RestoreRegisters() {
69
95
 
70
96
  CodeGenState::CodeGenState(CodeGenerator* owner)
71
97
  : owner_(owner),
72
- true_target_(NULL),
73
- false_target_(NULL),
74
- previous_(NULL) {
75
- owner_->set_state(this);
98
+ previous_(owner->state()) {
99
+ owner->set_state(this);
76
100
  }
77
101
 
78
102
 
79
- CodeGenState::CodeGenState(CodeGenerator* owner,
103
+ ConditionCodeGenState::ConditionCodeGenState(CodeGenerator* owner,
80
104
  JumpTarget* true_target,
81
105
  JumpTarget* false_target)
82
- : owner_(owner),
106
+ : CodeGenState(owner),
83
107
  true_target_(true_target),
84
- false_target_(false_target),
85
- previous_(owner->state()) {
86
- owner_->set_state(this);
108
+ false_target_(false_target) {
109
+ owner->set_state(this);
110
+ }
111
+
112
+
113
+ TypeInfoCodeGenState::TypeInfoCodeGenState(CodeGenerator* owner,
114
+ Slot* slot,
115
+ TypeInfo type_info)
116
+ : CodeGenState(owner),
117
+ slot_(slot) {
118
+ owner->set_state(this);
119
+ old_type_info_ = owner->set_type_info(slot, type_info);
87
120
  }
88
121
 
89
122
 
@@ -93,16 +126,25 @@ CodeGenState::~CodeGenState() {
93
126
  }
94
127
 
95
128
 
129
+ TypeInfoCodeGenState::~TypeInfoCodeGenState() {
130
+ owner()->set_type_info(slot_, old_type_info_);
131
+ }
132
+
133
+
96
134
  // -----------------------------------------------------------------------------
97
- // CodeGenerator implementation
135
+ // CodeGenerator implementation.
98
136
 
99
137
  CodeGenerator::CodeGenerator(MacroAssembler* masm)
100
138
  : deferred_(8),
101
139
  masm_(masm),
140
+ info_(NULL),
102
141
  frame_(NULL),
103
142
  allocator_(NULL),
104
143
  cc_reg_(cc_always),
105
144
  state_(NULL),
145
+ loop_nesting_(0),
146
+ type_info_(NULL),
147
+ function_return_(JumpTarget::BIDIRECTIONAL),
106
148
  function_return_is_shadowed_(false) {
107
149
  }
108
150
 
@@ -114,356 +156,249 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm)
114
156
  // cp: callee's context
115
157
 
116
158
  void CodeGenerator::Generate(CompilationInfo* info) {
117
- // Record the position for debugging purposes.
118
- CodeForFunctionPosition(info->function());
119
-
120
- // Initialize state.
121
- info_ = info;
122
- ASSERT(allocator_ == NULL);
123
- RegisterAllocator register_allocator(this);
124
- allocator_ = &register_allocator;
125
- ASSERT(frame_ == NULL);
126
- frame_ = new VirtualFrame();
127
- cc_reg_ = cc_always;
128
-
129
- {
130
- CodeGenState state(this);
131
-
132
- // Registers:
133
- // a1: called JS function
134
- // ra: return address
135
- // fp: caller's frame pointer
136
- // sp: stack pointer
137
- // cp: callee's context
138
- //
139
- // Stack:
140
- // arguments
141
- // receiver
142
-
143
- frame_->Enter();
144
-
145
- // Allocate space for locals and initialize them.
146
- frame_->AllocateStackSlots();
147
-
148
- // Initialize the function return target.
149
- function_return_.set_direction(JumpTarget::BIDIRECTIONAL);
150
- function_return_is_shadowed_ = false;
151
-
152
- VirtualFrame::SpilledScope spilled_scope;
153
- if (scope()->num_heap_slots() > 0) {
154
- UNIMPLEMENTED_MIPS();
155
- }
156
-
157
- {
158
- Comment cmnt2(masm_, "[ copy context parameters into .context");
159
-
160
- // Note that iteration order is relevant here! If we have the same
161
- // parameter twice (e.g., function (x, y, x)), and that parameter
162
- // needs to be copied into the context, it must be the last argument
163
- // passed to the parameter that needs to be copied. This is a rare
164
- // case so we don't check for it, instead we rely on the copying
165
- // order: such a parameter is copied repeatedly into the same
166
- // context location and thus the last value is what is seen inside
167
- // the function.
168
- for (int i = 0; i < scope()->num_parameters(); i++) {
169
- UNIMPLEMENTED_MIPS();
170
- }
171
- }
172
-
173
- // Store the arguments object. This must happen after context
174
- // initialization because the arguments object may be stored in the
175
- // context.
176
- if (scope()->arguments() != NULL) {
177
- UNIMPLEMENTED_MIPS();
178
- }
179
-
180
- // Generate code to 'execute' declarations and initialize functions
181
- // (source elements). In case of an illegal redeclaration we need to
182
- // handle that instead of processing the declarations.
183
- if (scope()->HasIllegalRedeclaration()) {
184
- Comment cmnt(masm_, "[ illegal redeclarations");
185
- scope()->VisitIllegalRedeclaration(this);
186
- } else {
187
- Comment cmnt(masm_, "[ declarations");
188
- ProcessDeclarations(scope()->declarations());
189
- // Bail out if a stack-overflow exception occurred when processing
190
- // declarations.
191
- if (HasStackOverflow()) return;
192
- }
193
-
194
- if (FLAG_trace) {
195
- UNIMPLEMENTED_MIPS();
196
- }
197
-
198
- // Compile the body of the function in a vanilla state. Don't
199
- // bother compiling all the code if the scope has an illegal
200
- // redeclaration.
201
- if (!scope()->HasIllegalRedeclaration()) {
202
- Comment cmnt(masm_, "[ function body");
203
- #ifdef DEBUG
204
- bool is_builtin = Bootstrapper::IsActive();
205
- bool should_trace =
206
- is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls;
207
- if (should_trace) {
208
- UNIMPLEMENTED_MIPS();
209
- }
210
- #endif
211
- VisitStatementsAndSpill(info->function()->body());
212
- }
213
- }
159
+ UNIMPLEMENTED_MIPS();
160
+ }
214
161
 
215
- if (has_valid_frame() || function_return_.is_linked()) {
216
- if (!function_return_.is_linked()) {
217
- CodeForReturnPosition(info->function());
218
- }
219
- // Registers:
220
- // v0: result
221
- // sp: stack pointer
222
- // fp: frame pointer
223
- // cp: callee's context
224
-
225
- __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
226
-
227
- function_return_.Bind();
228
- if (FLAG_trace) {
229
- UNIMPLEMENTED_MIPS();
230
- }
231
-
232
- // Add a label for checking the size of the code used for returning.
233
- Label check_exit_codesize;
234
- masm_->bind(&check_exit_codesize);
235
-
236
- masm_->mov(sp, fp);
237
- masm_->lw(fp, MemOperand(sp, 0));
238
- masm_->lw(ra, MemOperand(sp, 4));
239
- masm_->addiu(sp, sp, 8);
240
-
241
- // Here we use masm_-> instead of the __ macro to avoid the code coverage
242
- // tool from instrumenting as we rely on the code size here.
243
- // TODO(MIPS): Should we be able to use more than 0x1ffe parameters?
244
- masm_->addiu(sp, sp, (scope()->num_parameters() + 1) * kPointerSize);
245
- masm_->Jump(ra);
246
- // The Jump automatically generates a nop in the branch delay slot.
247
-
248
- // Check that the size of the code used for returning matches what is
249
- // expected by the debugger.
250
- ASSERT_EQ(kJSReturnSequenceLength,
251
- masm_->InstructionsGeneratedSince(&check_exit_codesize));
252
- }
253
162
 
254
- // Code generation state must be reset.
255
- ASSERT(!has_cc());
256
- ASSERT(state_ == NULL);
257
- ASSERT(!function_return_is_shadowed_);
258
- function_return_.Unuse();
259
- DeleteFrame();
163
+ int CodeGenerator::NumberOfSlot(Slot* slot) {
164
+ UNIMPLEMENTED_MIPS();
165
+ return 0;
166
+ }
260
167
 
261
- // Process any deferred code using the register allocator.
262
- if (!HasStackOverflow()) {
263
- ProcessDeferred();
264
- }
265
168
 
266
- allocator_ = NULL;
169
+ MemOperand CodeGenerator::SlotOperand(Slot* slot, Register tmp) {
170
+ UNIMPLEMENTED_MIPS();
171
+ return MemOperand(zero_reg, 0);
267
172
  }
268
173
 
269
174
 
270
- void CodeGenerator::LoadReference(Reference* ref) {
271
- VirtualFrame::SpilledScope spilled_scope;
272
- Comment cmnt(masm_, "[ LoadReference");
273
- Expression* e = ref->expression();
274
- Property* property = e->AsProperty();
275
- Variable* var = e->AsVariableProxy()->AsVariable();
175
+ MemOperand CodeGenerator::ContextSlotOperandCheckExtensions(
176
+ Slot* slot,
177
+ Register tmp,
178
+ Register tmp2,
179
+ JumpTarget* slow) {
180
+ UNIMPLEMENTED_MIPS();
181
+ return MemOperand(zero_reg, 0);
182
+ }
276
183
 
277
- if (property != NULL) {
278
- UNIMPLEMENTED_MIPS();
279
- } else if (var != NULL) {
280
- // The expression is a variable proxy that does not rewrite to a
281
- // property. Global variables are treated as named property references.
282
- if (var->is_global()) {
283
- LoadGlobal();
284
- ref->set_type(Reference::NAMED);
285
- } else {
286
- ASSERT(var->slot() != NULL);
287
- ref->set_type(Reference::SLOT);
288
- }
289
- } else {
290
- UNIMPLEMENTED_MIPS();
291
- }
184
+
185
+ void CodeGenerator::LoadCondition(Expression* x,
186
+ JumpTarget* true_target,
187
+ JumpTarget* false_target,
188
+ bool force_cc) {
189
+ UNIMPLEMENTED_MIPS();
190
+ }
191
+
192
+
193
+ void CodeGenerator::Load(Expression* x) {
194
+ UNIMPLEMENTED_MIPS();
195
+ }
196
+
197
+
198
+ void CodeGenerator::LoadGlobal() {
199
+ UNIMPLEMENTED_MIPS();
200
+ }
201
+
202
+
203
+ void CodeGenerator::LoadGlobalReceiver(Register scratch) {
204
+ UNIMPLEMENTED_MIPS();
205
+ }
206
+
207
+
208
+ ArgumentsAllocationMode CodeGenerator::ArgumentsMode() {
209
+ UNIMPLEMENTED_MIPS();
210
+ return EAGER_ARGUMENTS_ALLOCATION;
211
+ }
212
+
213
+
214
+ void CodeGenerator::StoreArgumentsObject(bool initial) {
215
+ UNIMPLEMENTED_MIPS();
216
+ }
217
+
218
+
219
+ void CodeGenerator::LoadTypeofExpression(Expression* x) {
220
+ UNIMPLEMENTED_MIPS();
221
+ }
222
+
223
+
224
+ Reference::Reference(CodeGenerator* cgen,
225
+ Expression* expression,
226
+ bool persist_after_get)
227
+ : cgen_(cgen),
228
+ expression_(expression),
229
+ type_(ILLEGAL),
230
+ persist_after_get_(persist_after_get) {
231
+ UNIMPLEMENTED_MIPS();
232
+ }
233
+
234
+
235
+ Reference::~Reference() {
236
+ UNIMPLEMENTED_MIPS();
237
+ }
238
+
239
+
240
+ void CodeGenerator::LoadReference(Reference* ref) {
241
+ UNIMPLEMENTED_MIPS();
292
242
  }
293
243
 
294
244
 
295
245
  void CodeGenerator::UnloadReference(Reference* ref) {
296
- VirtualFrame::SpilledScope spilled_scope;
297
- // Pop a reference from the stack while preserving TOS.
298
- Comment cmnt(masm_, "[ UnloadReference");
299
- int size = ref->size();
300
- if (size > 0) {
301
- frame_->EmitPop(a0);
302
- frame_->Drop(size);
303
- frame_->EmitPush(a0);
304
- }
305
- ref->set_unloaded();
246
+ UNIMPLEMENTED_MIPS();
306
247
  }
307
248
 
308
249
 
309
- MemOperand CodeGenerator::SlotOperand(Slot* slot, Register tmp) {
310
- // Currently, this assertion will fail if we try to assign to
311
- // a constant variable that is constant because it is read-only
312
- // (such as the variable referring to a named function expression).
313
- // We need to implement assignments to read-only variables.
314
- // Ideally, we should do this during AST generation (by converting
315
- // such assignments into expression statements); however, in general
316
- // we may not be able to make the decision until past AST generation,
317
- // that is when the entire program is known.
318
- ASSERT(slot != NULL);
319
- int index = slot->index();
320
- switch (slot->type()) {
321
- case Slot::PARAMETER:
322
- UNIMPLEMENTED_MIPS();
323
- return MemOperand(no_reg, 0);
324
-
325
- case Slot::LOCAL:
326
- return frame_->LocalAt(index);
327
-
328
- case Slot::CONTEXT: {
329
- UNIMPLEMENTED_MIPS();
330
- return MemOperand(no_reg, 0);
331
- }
332
-
333
- default:
334
- UNREACHABLE();
335
- return MemOperand(no_reg, 0);
336
- }
250
+ // ECMA-262, section 9.2, page 30: ToBoolean(). Convert the given
251
+ // register to a boolean in the condition code register. The code
252
+ // may jump to 'false_target' in case the register converts to 'false'.
253
+ void CodeGenerator::ToBoolean(JumpTarget* true_target,
254
+ JumpTarget* false_target) {
255
+ UNIMPLEMENTED_MIPS();
337
256
  }
338
257
 
339
258
 
340
- // Loads a value on TOS. If it is a boolean value, the result may have been
341
- // (partially) translated into branches, or it may have set the condition
342
- // code register. If force_cc is set, the value is forced to set the
343
- // condition code register and no value is pushed. If the condition code
344
- // register was set, has_cc() is true and cc_reg_ contains the condition to
345
- // test for 'true'.
346
- void CodeGenerator::LoadCondition(Expression* x,
347
- JumpTarget* true_target,
348
- JumpTarget* false_target,
349
- bool force_cc) {
350
- ASSERT(!has_cc());
351
- int original_height = frame_->height();
352
-
353
- { CodeGenState new_state(this, true_target, false_target);
354
- Visit(x);
355
-
356
- // If we hit a stack overflow, we may not have actually visited
357
- // the expression. In that case, we ensure that we have a
358
- // valid-looking frame state because we will continue to generate
359
- // code as we unwind the C++ stack.
360
- //
361
- // It's possible to have both a stack overflow and a valid frame
362
- // state (eg, a subexpression overflowed, visiting it returned
363
- // with a dummied frame state, and visiting this expression
364
- // returned with a normal-looking state).
365
- if (HasStackOverflow() &&
366
- has_valid_frame() &&
367
- !has_cc() &&
368
- frame_->height() == original_height) {
369
- true_target->Jump();
370
- }
371
- }
372
- if (force_cc && frame_ != NULL && !has_cc()) {
373
- // Convert the TOS value to a boolean in the condition code register.
374
- UNIMPLEMENTED_MIPS();
259
+ void CodeGenerator::GenericBinaryOperation(Token::Value op,
260
+ OverwriteMode overwrite_mode,
261
+ GenerateInlineSmi inline_smi,
262
+ int constant_rhs) {
263
+ UNIMPLEMENTED_MIPS();
264
+ }
265
+
266
+
267
+ class DeferredInlineSmiOperation: public DeferredCode {
268
+ public:
269
+ DeferredInlineSmiOperation(Token::Value op,
270
+ int value,
271
+ bool reversed,
272
+ OverwriteMode overwrite_mode,
273
+ Register tos)
274
+ : op_(op),
275
+ value_(value),
276
+ reversed_(reversed),
277
+ overwrite_mode_(overwrite_mode),
278
+ tos_register_(tos) {
279
+ set_comment("[ DeferredInlinedSmiOperation");
375
280
  }
376
- ASSERT(!force_cc || !has_valid_frame() || has_cc());
377
- ASSERT(!has_valid_frame() ||
378
- (has_cc() && frame_->height() == original_height) ||
379
- (!has_cc() && frame_->height() == original_height + 1));
281
+
282
+ virtual void Generate();
283
+ // This stub makes explicit calls to SaveRegisters(), RestoreRegisters() and
284
+ // Exit(). Currently on MIPS SaveRegisters() and RestoreRegisters() are empty
285
+ // methods, it is the responsibility of the deferred code to save and restore
286
+ // registers.
287
+ virtual bool AutoSaveAndRestore() { return false; }
288
+
289
+ void JumpToNonSmiInput(Condition cond, Register cmp1, const Operand& cmp2);
290
+ void JumpToAnswerOutOfRange(Condition cond,
291
+ Register cmp1,
292
+ const Operand& cmp2);
293
+
294
+ private:
295
+ void GenerateNonSmiInput();
296
+ void GenerateAnswerOutOfRange();
297
+ void WriteNonSmiAnswer(Register answer,
298
+ Register heap_number,
299
+ Register scratch);
300
+
301
+ Token::Value op_;
302
+ int value_;
303
+ bool reversed_;
304
+ OverwriteMode overwrite_mode_;
305
+ Register tos_register_;
306
+ Label non_smi_input_;
307
+ Label answer_out_of_range_;
308
+ };
309
+
310
+
311
+ // For bit operations we try harder and handle the case where the input is not
312
+ // a Smi but a 32bits integer without calling the generic stub.
313
+ void DeferredInlineSmiOperation::JumpToNonSmiInput(Condition cond,
314
+ Register cmp1,
315
+ const Operand& cmp2) {
316
+ UNIMPLEMENTED_MIPS();
380
317
  }
381
318
 
382
319
 
383
- void CodeGenerator::Load(Expression* x) {
384
- #ifdef DEBUG
385
- int original_height = frame_->height();
386
- #endif
387
- JumpTarget true_target;
388
- JumpTarget false_target;
389
- LoadCondition(x, &true_target, &false_target, false);
320
+ // For bit operations the result is always 32bits so we handle the case where
321
+ // the result does not fit in a Smi without calling the generic stub.
322
+ void DeferredInlineSmiOperation::JumpToAnswerOutOfRange(Condition cond,
323
+ Register cmp1,
324
+ const Operand& cmp2) {
325
+ UNIMPLEMENTED_MIPS();
326
+ }
390
327
 
391
- if (has_cc()) {
392
- UNIMPLEMENTED_MIPS();
393
- }
394
328
 
395
- if (true_target.is_linked() || false_target.is_linked()) {
396
- UNIMPLEMENTED_MIPS();
397
- }
398
- ASSERT(has_valid_frame());
399
- ASSERT(!has_cc());
400
- ASSERT(frame_->height() == original_height + 1);
329
+ // On entry the non-constant side of the binary operation is in tos_register_
330
+ // and the constant smi side is nowhere. The tos_register_ is not used by the
331
+ // virtual frame. On exit the answer is in the tos_register_ and the virtual
332
+ // frame is unchanged.
333
+ void DeferredInlineSmiOperation::Generate() {
334
+ UNIMPLEMENTED_MIPS();
401
335
  }
402
336
 
403
337
 
404
- void CodeGenerator::LoadGlobal() {
405
- VirtualFrame::SpilledScope spilled_scope;
406
- __ lw(a0, GlobalObject());
407
- frame_->EmitPush(a0);
338
+ // Convert and write the integer answer into heap_number.
339
+ void DeferredInlineSmiOperation::WriteNonSmiAnswer(Register answer,
340
+ Register heap_number,
341
+ Register scratch) {
342
+ UNIMPLEMENTED_MIPS();
408
343
  }
409
344
 
410
345
 
411
- void CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) {
412
- VirtualFrame::SpilledScope spilled_scope;
413
- if (slot->type() == Slot::LOOKUP) {
414
- UNIMPLEMENTED_MIPS();
415
- } else {
416
- __ lw(a0, SlotOperand(slot, a2));
417
- frame_->EmitPush(a0);
418
- if (slot->var()->mode() == Variable::CONST) {
419
- UNIMPLEMENTED_MIPS();
420
- }
421
- }
346
+ void DeferredInlineSmiOperation::GenerateNonSmiInput() {
347
+ UNIMPLEMENTED_MIPS();
422
348
  }
423
349
 
424
350
 
425
- void CodeGenerator::StoreToSlot(Slot* slot, InitState init_state) {
426
- ASSERT(slot != NULL);
427
- if (slot->type() == Slot::LOOKUP) {
428
- UNIMPLEMENTED_MIPS();
429
- } else {
430
- ASSERT(!slot->var()->is_dynamic());
431
-
432
- JumpTarget exit;
433
- if (init_state == CONST_INIT) {
434
- UNIMPLEMENTED_MIPS();
435
- }
436
-
437
- // We must execute the store. Storing a variable must keep the
438
- // (new) value on the stack. This is necessary for compiling
439
- // assignment expressions.
440
- //
441
- // Note: We will reach here even with slot->var()->mode() ==
442
- // Variable::CONST because of const declarations which will
443
- // initialize consts to 'the hole' value and by doing so, end up
444
- // calling this code. a2 may be loaded with context; used below in
445
- // RecordWrite.
446
- frame_->EmitPop(a0);
447
- __ sw(a0, SlotOperand(slot, a2));
448
- frame_->EmitPush(a0);
449
- if (slot->type() == Slot::CONTEXT) {
450
- UNIMPLEMENTED_MIPS();
451
- }
452
- // If we definitely did not jump over the assignment, we do not need
453
- // to bind the exit label. Doing so can defeat peephole
454
- // optimization.
455
- if (init_state == CONST_INIT || slot->type() == Slot::CONTEXT) {
456
- exit.Bind();
457
- }
458
- }
351
+ void DeferredInlineSmiOperation::GenerateAnswerOutOfRange() {
352
+ UNIMPLEMENTED_MIPS();
353
+ }
354
+
355
+
356
+ void CodeGenerator::SmiOperation(Token::Value op,
357
+ Handle<Object> value,
358
+ bool reversed,
359
+ OverwriteMode mode) {
360
+ UNIMPLEMENTED_MIPS();
361
+ }
362
+
363
+
364
+ // On MIPS we load registers condReg1 and condReg2 with the values which should
365
+ // be compared. With the CodeGenerator::cc_reg_ condition, functions will be
366
+ // able to evaluate correctly the condition. (eg CodeGenerator::Branch)
367
+ void CodeGenerator::Comparison(Condition cc,
368
+ Expression* left,
369
+ Expression* right,
370
+ bool strict) {
371
+ UNIMPLEMENTED_MIPS();
372
+ }
373
+
374
+
375
+ void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args,
376
+ CallFunctionFlags flags,
377
+ int position) {
378
+ UNIMPLEMENTED_MIPS();
379
+ }
380
+
381
+
382
+ void CodeGenerator::CallApplyLazy(Expression* applicand,
383
+ Expression* receiver,
384
+ VariableProxy* arguments,
385
+ int position) {
386
+ UNIMPLEMENTED_MIPS();
387
+ }
388
+
389
+
390
+ void CodeGenerator::Branch(bool if_true, JumpTarget* target) {
391
+ UNIMPLEMENTED_MIPS();
392
+ }
393
+
394
+
395
+ void CodeGenerator::CheckStack() {
396
+ UNIMPLEMENTED_MIPS();
459
397
  }
460
398
 
461
399
 
462
400
  void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
463
- VirtualFrame::SpilledScope spilled_scope;
464
- for (int i = 0; frame_ != NULL && i < statements->length(); i++) {
465
- VisitAndSpill(statements->at(i));
466
- }
401
+ UNIMPLEMENTED_MIPS();
467
402
  }
468
403
 
469
404
 
@@ -473,14 +408,7 @@ void CodeGenerator::VisitBlock(Block* node) {
473
408
 
474
409
 
475
410
  void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
476
- VirtualFrame::SpilledScope spilled_scope;
477
- frame_->EmitPush(cp);
478
- __ li(t0, Operand(pairs));
479
- frame_->EmitPush(t0);
480
- __ li(t0, Operand(Smi::FromInt(is_eval() ? 1 : 0)));
481
- frame_->EmitPush(t0);
482
- frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
483
- // The result is discarded.
411
+ UNIMPLEMENTED_MIPS();
484
412
  }
485
413
 
486
414
 
@@ -490,17 +418,7 @@ void CodeGenerator::VisitDeclaration(Declaration* node) {
490
418
 
491
419
 
492
420
  void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) {
493
- #ifdef DEBUG
494
- int original_height = frame_->height();
495
- #endif
496
- VirtualFrame::SpilledScope spilled_scope;
497
- Comment cmnt(masm_, "[ ExpressionStatement");
498
- CodeForStatementPosition(node);
499
- Expression* expression = node->expression();
500
- expression->MarkAsStatement();
501
- LoadAndSpill(expression);
502
- frame_->Drop();
503
- ASSERT(frame_->height() == original_height);
421
+ UNIMPLEMENTED_MIPS();
504
422
  }
505
423
 
506
424
 
@@ -525,22 +443,12 @@ void CodeGenerator::VisitBreakStatement(BreakStatement* node) {
525
443
 
526
444
 
527
445
  void CodeGenerator::VisitReturnStatement(ReturnStatement* node) {
528
- VirtualFrame::SpilledScope spilled_scope;
529
- Comment cmnt(masm_, "[ ReturnStatement");
530
-
531
- CodeForStatementPosition(node);
532
- LoadAndSpill(node->expression());
533
- if (function_return_is_shadowed_) {
534
- frame_->EmitPop(v0);
535
- function_return_.Jump();
536
- } else {
537
- // Pop the result from the frame and prepare the frame for
538
- // returning thus making it easier to merge.
539
- frame_->EmitPop(v0);
540
- frame_->PrepareForReturn();
541
-
542
- function_return_.Jump();
543
- }
446
+ UNIMPLEMENTED_MIPS();
447
+ }
448
+
449
+
450
+ void CodeGenerator::GenerateReturnSequence() {
451
+ UNIMPLEMENTED_MIPS();
544
452
  }
545
453
 
546
454
 
@@ -594,6 +502,13 @@ void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) {
594
502
  }
595
503
 
596
504
 
505
+ void CodeGenerator::InstantiateFunction(
506
+ Handle<SharedFunctionInfo> function_info,
507
+ bool pretenure) {
508
+ UNIMPLEMENTED_MIPS();
509
+ }
510
+
511
+
597
512
  void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
598
513
  UNIMPLEMENTED_MIPS();
599
514
  }
@@ -610,46 +525,49 @@ void CodeGenerator::VisitConditional(Conditional* node) {
610
525
  }
611
526
 
612
527
 
528
+ void CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) {
529
+ UNIMPLEMENTED_MIPS();
530
+ }
531
+
532
+
533
+ void CodeGenerator::LoadFromSlotCheckForArguments(Slot* slot,
534
+ TypeofState state) {
535
+ UNIMPLEMENTED_MIPS();
536
+ }
537
+
538
+
539
+ void CodeGenerator::StoreToSlot(Slot* slot, InitState init_state) {
540
+ UNIMPLEMENTED_MIPS();
541
+ }
542
+
543
+
544
+ void CodeGenerator::LoadFromGlobalSlotCheckExtensions(Slot* slot,
545
+ TypeofState typeof_state,
546
+ JumpTarget* slow) {
547
+ UNIMPLEMENTED_MIPS();
548
+ }
549
+
550
+
551
+ void CodeGenerator::EmitDynamicLoadFromSlotFastCase(Slot* slot,
552
+ TypeofState typeof_state,
553
+ JumpTarget* slow,
554
+ JumpTarget* done) {
555
+ UNIMPLEMENTED_MIPS();
556
+ }
557
+
558
+
613
559
  void CodeGenerator::VisitSlot(Slot* node) {
614
- #ifdef DEBUG
615
- int original_height = frame_->height();
616
- #endif
617
- VirtualFrame::SpilledScope spilled_scope;
618
- Comment cmnt(masm_, "[ Slot");
619
- LoadFromSlot(node, typeof_state());
620
- ASSERT(frame_->height() == original_height + 1);
560
+ UNIMPLEMENTED_MIPS();
621
561
  }
622
562
 
623
563
 
624
564
  void CodeGenerator::VisitVariableProxy(VariableProxy* node) {
625
- #ifdef DEBUG
626
- int original_height = frame_->height();
627
- #endif
628
- VirtualFrame::SpilledScope spilled_scope;
629
- Comment cmnt(masm_, "[ VariableProxy");
630
-
631
- Variable* var = node->var();
632
- Expression* expr = var->rewrite();
633
- if (expr != NULL) {
634
- Visit(expr);
635
- } else {
636
- ASSERT(var->is_global());
637
- Reference ref(this, node);
638
- ref.GetValueAndSpill();
639
- }
640
- ASSERT(frame_->height() == original_height + 1);
565
+ UNIMPLEMENTED_MIPS();
641
566
  }
642
567
 
643
568
 
644
569
  void CodeGenerator::VisitLiteral(Literal* node) {
645
- #ifdef DEBUG
646
- int original_height = frame_->height();
647
- #endif
648
- VirtualFrame::SpilledScope spilled_scope;
649
- Comment cmnt(masm_, "[ Literal");
650
- __ li(t0, Operand(node->handle()));
651
- frame_->EmitPush(t0);
652
- ASSERT(frame_->height() == original_height + 1);
570
+ UNIMPLEMENTED_MIPS();
653
571
  }
654
572
 
655
573
 
@@ -673,48 +591,23 @@ void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) {
673
591
  }
674
592
 
675
593
 
594
+ void CodeGenerator::EmitSlotAssignment(Assignment* node) {
595
+ UNIMPLEMENTED_MIPS();
596
+ }
597
+
598
+
599
+ void CodeGenerator::EmitNamedPropertyAssignment(Assignment* node) {
600
+ UNIMPLEMENTED_MIPS();
601
+ }
602
+
603
+
604
+ void CodeGenerator::EmitKeyedPropertyAssignment(Assignment* node) {
605
+ UNIMPLEMENTED_MIPS();
606
+ }
607
+
608
+
676
609
  void CodeGenerator::VisitAssignment(Assignment* node) {
677
- #ifdef DEBUG
678
- int original_height = frame_->height();
679
- #endif
680
- VirtualFrame::SpilledScope spilled_scope;
681
- Comment cmnt(masm_, "[ Assignment");
682
-
683
- { Reference target(this, node->target());
684
- if (target.is_illegal()) {
685
- // Fool the virtual frame into thinking that we left the assignment's
686
- // value on the frame.
687
- frame_->EmitPush(zero_reg);
688
- ASSERT(frame_->height() == original_height + 1);
689
- return;
690
- }
691
-
692
- if (node->op() == Token::ASSIGN ||
693
- node->op() == Token::INIT_VAR ||
694
- node->op() == Token::INIT_CONST) {
695
- LoadAndSpill(node->value());
696
- } else {
697
- UNIMPLEMENTED_MIPS();
698
- }
699
-
700
- Variable* var = node->target()->AsVariableProxy()->AsVariable();
701
- if (var != NULL &&
702
- (var->mode() == Variable::CONST) &&
703
- node->op() != Token::INIT_VAR && node->op() != Token::INIT_CONST) {
704
- // Assignment ignored - leave the value on the stack.
705
- } else {
706
- CodeForSourcePosition(node->position());
707
- if (node->op() == Token::INIT_CONST) {
708
- // Dynamic constant initializations must use the function context
709
- // and initialize the actual constant declared. Dynamic variable
710
- // initializations are simply assignments and use SetValue.
711
- target.SetValue(CONST_INIT);
712
- } else {
713
- target.SetValue(NOT_CONST_INIT);
714
- }
715
- }
716
- }
717
- ASSERT(frame_->height() == original_height + 1);
610
+ UNIMPLEMENTED_MIPS();
718
611
  }
719
612
 
720
613
 
@@ -729,73 +622,7 @@ void CodeGenerator::VisitProperty(Property* node) {
729
622
 
730
623
 
731
624
  void CodeGenerator::VisitCall(Call* node) {
732
- #ifdef DEBUG
733
- int original_height = frame_->height();
734
- #endif
735
- VirtualFrame::SpilledScope spilled_scope;
736
- Comment cmnt(masm_, "[ Call");
737
-
738
- Expression* function = node->expression();
739
- ZoneList<Expression*>* args = node->arguments();
740
-
741
- // Standard function call.
742
- // Check if the function is a variable or a property.
743
- Variable* var = function->AsVariableProxy()->AsVariable();
744
- Property* property = function->AsProperty();
745
-
746
- // ------------------------------------------------------------------------
747
- // Fast-case: Use inline caching.
748
- // ---
749
- // According to ECMA-262, section 11.2.3, page 44, the function to call
750
- // must be resolved after the arguments have been evaluated. The IC code
751
- // automatically handles this by loading the arguments before the function
752
- // is resolved in cache misses (this also holds for megamorphic calls).
753
- // ------------------------------------------------------------------------
754
-
755
- if (var != NULL && var->is_possibly_eval()) {
756
- UNIMPLEMENTED_MIPS();
757
- } else if (var != NULL && !var->is_this() && var->is_global()) {
758
- // ----------------------------------
759
- // JavaScript example: 'foo(1, 2, 3)' // foo is global
760
- // ----------------------------------
761
-
762
- int arg_count = args->length();
763
-
764
- // We need sp to be 8 bytes aligned when calling the stub.
765
- __ SetupAlignedCall(t0, arg_count);
766
-
767
- // Pass the global object as the receiver and let the IC stub
768
- // patch the stack to use the global proxy as 'this' in the
769
- // invoked function.
770
- LoadGlobal();
771
-
772
- // Load the arguments.
773
- for (int i = 0; i < arg_count; i++) {
774
- LoadAndSpill(args->at(i));
775
- }
776
-
777
- // Setup the receiver register and call the IC initialization code.
778
- __ li(a2, Operand(var->name()));
779
- InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
780
- Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop);
781
- CodeForSourcePosition(node->position());
782
- frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT,
783
- arg_count + 1);
784
- __ ReturnFromAlignedCall();
785
- __ lw(cp, frame_->Context());
786
- // Remove the function from the stack.
787
- frame_->EmitPush(v0);
788
-
789
- } else if (var != NULL && var->slot() != NULL &&
790
- var->slot()->type() == Slot::LOOKUP) {
791
- UNIMPLEMENTED_MIPS();
792
- } else if (property != NULL) {
793
- UNIMPLEMENTED_MIPS();
794
- } else {
795
- UNIMPLEMENTED_MIPS();
796
- }
797
-
798
- ASSERT(frame_->height() == original_height + 1);
625
+ UNIMPLEMENTED_MIPS();
799
626
  }
800
627
 
801
628
 
@@ -839,30 +666,112 @@ void CodeGenerator::GenerateMathPow(ZoneList<Expression*>* args) {
839
666
  }
840
667
 
841
668
 
842
- void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) {
669
+ void CodeGenerator::GenerateMathSqrt(ZoneList<Expression*>* args) {
843
670
  UNIMPLEMENTED_MIPS();
844
671
  }
845
672
 
846
673
 
847
- void CodeGenerator::GenerateMathSin(ZoneList<Expression*>* args) {
674
+ class DeferredStringCharCodeAt : public DeferredCode {
675
+ public:
676
+ DeferredStringCharCodeAt(Register object,
677
+ Register index,
678
+ Register scratch,
679
+ Register result)
680
+ : result_(result),
681
+ char_code_at_generator_(object,
682
+ index,
683
+ scratch,
684
+ result,
685
+ &need_conversion_,
686
+ &need_conversion_,
687
+ &index_out_of_range_,
688
+ STRING_INDEX_IS_NUMBER) {}
689
+
690
+ StringCharCodeAtGenerator* fast_case_generator() {
691
+ return &char_code_at_generator_;
692
+ }
693
+
694
+ virtual void Generate() {
695
+ UNIMPLEMENTED_MIPS();
696
+ }
697
+
698
+ private:
699
+ Register result_;
700
+
701
+ Label need_conversion_;
702
+ Label index_out_of_range_;
703
+
704
+ StringCharCodeAtGenerator char_code_at_generator_;
705
+ };
706
+
707
+
708
+ void CodeGenerator::GenerateStringCharCodeAt(ZoneList<Expression*>* args) {
848
709
  UNIMPLEMENTED_MIPS();
849
710
  }
850
711
 
851
712
 
852
- void CodeGenerator::GenerateMathSqrt(ZoneList<Expression*>* args) {
713
+ class DeferredStringCharFromCode : public DeferredCode {
714
+ public:
715
+ DeferredStringCharFromCode(Register code,
716
+ Register result)
717
+ : char_from_code_generator_(code, result) {}
718
+
719
+ StringCharFromCodeGenerator* fast_case_generator() {
720
+ return &char_from_code_generator_;
721
+ }
722
+
723
+ virtual void Generate() {
724
+ VirtualFrameRuntimeCallHelper call_helper(frame_state());
725
+ char_from_code_generator_.GenerateSlow(masm(), call_helper);
726
+ }
727
+
728
+ private:
729
+ StringCharFromCodeGenerator char_from_code_generator_;
730
+ };
731
+
732
+
733
+ void CodeGenerator::GenerateStringCharFromCode(ZoneList<Expression*>* args) {
853
734
  UNIMPLEMENTED_MIPS();
854
735
  }
855
736
 
856
737
 
857
- // This should generate code that performs a charCodeAt() call or returns
858
- // undefined in order to trigger the slow case, Runtime_StringCharCodeAt.
859
- // It is not yet implemented on ARM, so it always goes to the slow case.
860
- void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
738
+ class DeferredStringCharAt : public DeferredCode {
739
+ public:
740
+ DeferredStringCharAt(Register object,
741
+ Register index,
742
+ Register scratch1,
743
+ Register scratch2,
744
+ Register result)
745
+ : result_(result),
746
+ char_at_generator_(object,
747
+ index,
748
+ scratch1,
749
+ scratch2,
750
+ result,
751
+ &need_conversion_,
752
+ &need_conversion_,
753
+ &index_out_of_range_,
754
+ STRING_INDEX_IS_NUMBER) {}
755
+
756
+ StringCharAtGenerator* fast_case_generator() {
757
+ return &char_at_generator_;
758
+ }
759
+
760
+ virtual void Generate() {
861
761
  UNIMPLEMENTED_MIPS();
862
762
  }
863
763
 
764
+ private:
765
+ Register result_;
864
766
 
865
- void CodeGenerator::GenerateCharFromCode(ZoneList<Expression*>* args) {
767
+ Label need_conversion_;
768
+ Label index_out_of_range_;
769
+
770
+ StringCharAtGenerator char_at_generator_;
771
+ };
772
+
773
+
774
+ void CodeGenerator::GenerateStringCharAt(ZoneList<Expression*>* args) {
866
775
  UNIMPLEMENTED_MIPS();
867
776
  }
868
777
 
@@ -877,47 +786,72 @@ void CodeGenerator::GenerateIsRegExp(ZoneList<Expression*>* args) {
877
786
  }
878
787
 
879
788
 
880
- void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
789
+ void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) {
881
790
  UNIMPLEMENTED_MIPS();
882
791
  }
883
792
 
884
793
 
885
- void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
794
+ void CodeGenerator::GenerateIsSpecObject(ZoneList<Expression*>* args) {
886
795
  UNIMPLEMENTED_MIPS();
887
796
  }
888
797
 
889
798
 
890
- void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) {
799
+ class DeferredIsStringWrapperSafeForDefaultValueOf : public DeferredCode {
800
+ public:
801
+ DeferredIsStringWrapperSafeForDefaultValueOf(Register object,
802
+ Register map_result,
803
+ Register scratch1,
804
+ Register scratch2)
805
+ : object_(object),
806
+ map_result_(map_result),
807
+ scratch1_(scratch1),
808
+ scratch2_(scratch2) { }
809
+
810
+ virtual void Generate() {
811
+ UNIMPLEMENTED_MIPS();
812
+ }
813
+
814
+ private:
815
+ Register object_;
816
+ Register map_result_;
817
+ Register scratch1_;
818
+ Register scratch2_;
819
+ };
820
+
821
+
822
+ void CodeGenerator::GenerateIsStringWrapperSafeForDefaultValueOf(
823
+ ZoneList<Expression*>* args) {
891
824
  UNIMPLEMENTED_MIPS();
892
825
  }
893
826
 
894
827
 
895
- void CodeGenerator::GenerateRandomHeapNumber(ZoneList<Expression*>* args) {
828
+ void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
896
829
  UNIMPLEMENTED_MIPS();
897
830
  }
898
831
 
899
832
 
900
- void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
833
+ void CodeGenerator::GenerateIsUndetectableObject(ZoneList<Expression*>* args) {
901
834
  UNIMPLEMENTED_MIPS();
902
835
  }
903
836
 
904
837
 
905
- void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) {
838
+ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
906
839
  UNIMPLEMENTED_MIPS();
907
840
  }
908
841
 
909
842
 
910
- void CodeGenerator::GenerateIsSpecObject(ZoneList<Expression*>* args) {
843
+ void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
911
844
  UNIMPLEMENTED_MIPS();
912
845
  }
913
846
 
914
847
 
915
- void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
848
+ void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) {
916
849
  UNIMPLEMENTED_MIPS();
917
850
  }
918
851
 
919
852
 
920
- void CodeGenerator::GenerateIsUndetectableObject(ZoneList<Expression*>* args) {
853
+ void CodeGenerator::GenerateRandomHeapNumber(
854
+ ZoneList<Expression*>* args) {
921
855
  UNIMPLEMENTED_MIPS();
922
856
  }
923
857
 
@@ -942,491 +876,333 @@ void CodeGenerator::GenerateRegExpExec(ZoneList<Expression*>* args) {
942
876
  }
943
877
 
944
878
 
945
- void CodeGenerator::GenerateNumberToString(ZoneList<Expression*>* args) {
879
+ void CodeGenerator::GenerateRegExpConstructResult(ZoneList<Expression*>* args) {
946
880
  UNIMPLEMENTED_MIPS();
947
881
  }
948
882
 
949
883
 
950
- void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
884
+ class DeferredSearchCache: public DeferredCode {
885
+ public:
886
+ DeferredSearchCache(Register dst, Register cache, Register key)
887
+ : dst_(dst), cache_(cache), key_(key) {
888
+ set_comment("[ DeferredSearchCache");
889
+ }
890
+
891
+ virtual void Generate();
892
+
893
+ private:
894
+ Register dst_, cache_, key_;
895
+ };
896
+
897
+
898
+ void DeferredSearchCache::Generate() {
951
899
  UNIMPLEMENTED_MIPS();
952
900
  }
953
901
 
954
902
 
955
- void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
903
+ void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) {
956
904
  UNIMPLEMENTED_MIPS();
957
905
  }
958
906
 
959
907
 
960
- void CodeGenerator::VisitCountOperation(CountOperation* node) {
908
+ void CodeGenerator::GenerateNumberToString(ZoneList<Expression*>* args) {
961
909
  UNIMPLEMENTED_MIPS();
962
910
  }
963
911
 
964
912
 
965
- void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
913
+ class DeferredSwapElements: public DeferredCode {
914
+ public:
915
+ DeferredSwapElements(Register object, Register index1, Register index2)
916
+ : object_(object), index1_(index1), index2_(index2) {
917
+ set_comment("[ DeferredSwapElements");
918
+ }
919
+
920
+ virtual void Generate();
921
+
922
+ private:
923
+ Register object_, index1_, index2_;
924
+ };
925
+
926
+
927
+ void DeferredSwapElements::Generate() {
966
928
  UNIMPLEMENTED_MIPS();
967
929
  }
968
930
 
969
931
 
970
- void CodeGenerator::VisitThisFunction(ThisFunction* node) {
932
+ void CodeGenerator::GenerateSwapElements(ZoneList<Expression*>* args) {
971
933
  UNIMPLEMENTED_MIPS();
972
934
  }
973
935
 
974
936
 
975
- void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
937
+ void CodeGenerator::GenerateCallFunction(ZoneList<Expression*>* args) {
976
938
  UNIMPLEMENTED_MIPS();
977
939
  }
978
940
 
979
941
 
980
- #ifdef DEBUG
981
- bool CodeGenerator::HasValidEntryRegisters() { return true; }
982
- #endif
942
+ void CodeGenerator::GenerateMathSin(ZoneList<Expression*>* args) {
943
+ UNIMPLEMENTED_MIPS();
944
+ }
983
945
 
984
946
 
985
- #undef __
986
- #define __ ACCESS_MASM(masm)
947
+ void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) {
948
+ UNIMPLEMENTED_MIPS();
949
+ }
987
950
 
988
- // -----------------------------------------------------------------------------
989
- // Reference support
990
951
 
991
- Reference::Reference(CodeGenerator* cgen,
992
- Expression* expression,
993
- bool persist_after_get)
994
- : cgen_(cgen),
995
- expression_(expression),
996
- type_(ILLEGAL),
997
- persist_after_get_(persist_after_get) {
998
- cgen->LoadReference(this);
952
+ void CodeGenerator::GenerateMathLog(ZoneList<Expression*>* args) {
953
+ UNIMPLEMENTED_MIPS();
999
954
  }
1000
955
 
1001
956
 
1002
- Reference::~Reference() {
1003
- ASSERT(is_unloaded() || is_illegal());
957
+ void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
958
+ UNIMPLEMENTED_MIPS();
1004
959
  }
1005
960
 
1006
961
 
1007
- Handle<String> Reference::GetName() {
1008
- ASSERT(type_ == NAMED);
1009
- Property* property = expression_->AsProperty();
1010
- if (property == NULL) {
1011
- // Global variable reference treated as a named property reference.
1012
- VariableProxy* proxy = expression_->AsVariableProxy();
1013
- ASSERT(proxy->AsVariable() != NULL);
1014
- ASSERT(proxy->AsVariable()->is_global());
1015
- return proxy->name();
1016
- } else {
1017
- Literal* raw_name = property->key()->AsLiteral();
1018
- ASSERT(raw_name != NULL);
1019
- return Handle<String>(String::cast(*raw_name->handle()));
1020
- }
962
+ void CodeGenerator::GenerateIsRegExpEquivalent(ZoneList<Expression*>* args) {
963
+ UNIMPLEMENTED_MIPS();
1021
964
  }
1022
965
 
1023
966
 
1024
- void Reference::GetValue() {
1025
- ASSERT(cgen_->HasValidEntryRegisters());
1026
- ASSERT(!is_illegal());
1027
- ASSERT(!cgen_->has_cc());
1028
- Property* property = expression_->AsProperty();
1029
- if (property != NULL) {
1030
- cgen_->CodeForSourcePosition(property->position());
1031
- }
967
+ void CodeGenerator::GenerateHasCachedArrayIndex(ZoneList<Expression*>* args) {
968
+ UNIMPLEMENTED_MIPS();
969
+ }
1032
970
 
1033
- switch (type_) {
1034
- case SLOT: {
1035
- UNIMPLEMENTED_MIPS();
1036
- break;
1037
- }
1038
971
 
1039
- case NAMED: {
1040
- UNIMPLEMENTED_MIPS();
1041
- break;
1042
- }
972
+ void CodeGenerator::GenerateGetCachedArrayIndex(ZoneList<Expression*>* args) {
973
+ UNIMPLEMENTED_MIPS();
974
+ }
1043
975
 
1044
- case KEYED: {
1045
- UNIMPLEMENTED_MIPS();
1046
- break;
1047
- }
1048
976
 
1049
- default:
1050
- UNREACHABLE();
1051
- }
977
+ void CodeGenerator::GenerateFastAsciiArrayJoin(ZoneList<Expression*>* args) {
978
+ UNIMPLEMENTED_MIPS();
1052
979
  }
1053
980
 
1054
981
 
1055
- void Reference::SetValue(InitState init_state) {
1056
- ASSERT(!is_illegal());
1057
- ASSERT(!cgen_->has_cc());
1058
- MacroAssembler* masm = cgen_->masm();
1059
- Property* property = expression_->AsProperty();
1060
- if (property != NULL) {
1061
- cgen_->CodeForSourcePosition(property->position());
1062
- }
982
+ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
983
+ UNIMPLEMENTED_MIPS();
984
+ }
985
+
1063
986
 
1064
- switch (type_) {
1065
- case SLOT: {
1066
- Comment cmnt(masm, "[ Store to Slot");
1067
- Slot* slot = expression_->AsVariableProxy()->AsVariable()->slot();
1068
- cgen_->StoreToSlot(slot, init_state);
1069
- cgen_->UnloadReference(this);
1070
- break;
1071
- }
1072
-
1073
- case NAMED: {
1074
- UNIMPLEMENTED_MIPS();
1075
- break;
1076
- }
1077
-
1078
- case KEYED: {
1079
- UNIMPLEMENTED_MIPS();
1080
- break;
1081
- }
1082
-
1083
- default:
1084
- UNREACHABLE();
987
+ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
988
+ UNIMPLEMENTED_MIPS();
989
+ }
990
+
991
+
992
+ class DeferredCountOperation: public DeferredCode {
993
+ public:
994
+ DeferredCountOperation(Register value,
995
+ bool is_increment,
996
+ bool is_postfix,
997
+ int target_size)
998
+ : value_(value),
999
+ is_increment_(is_increment),
1000
+ is_postfix_(is_postfix),
1001
+ target_size_(target_size) {}
1002
+
1003
+ virtual void Generate() {
1004
+ UNIMPLEMENTED_MIPS();
1085
1005
  }
1006
+
1007
+ private:
1008
+ Register value_;
1009
+ bool is_increment_;
1010
+ bool is_postfix_;
1011
+ int target_size_;
1012
+ };
1013
+
1014
+
1015
+ void CodeGenerator::VisitCountOperation(CountOperation* node) {
1016
+ UNIMPLEMENTED_MIPS();
1086
1017
  }
1087
1018
 
1088
1019
 
1089
- // On entry a0 and a1 are the things to be compared. On exit v0 is 0,
1090
- // positive or negative to indicate the result of the comparison.
1091
- void CompareStub::Generate(MacroAssembler* masm) {
1020
+ void CodeGenerator::GenerateLogicalBooleanOperation(BinaryOperation* node) {
1092
1021
  UNIMPLEMENTED_MIPS();
1093
- __ break_(0x765);
1094
1022
  }
1095
1023
 
1096
1024
 
1097
- Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) {
1025
+ void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
1098
1026
  UNIMPLEMENTED_MIPS();
1099
- return Handle<Code>::null();
1100
1027
  }
1101
1028
 
1102
1029
 
1103
- void StackCheckStub::Generate(MacroAssembler* masm) {
1030
+ void CodeGenerator::VisitThisFunction(ThisFunction* node) {
1104
1031
  UNIMPLEMENTED_MIPS();
1105
- __ break_(0x790);
1106
1032
  }
1107
1033
 
1108
1034
 
1109
- void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
1035
+ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
1110
1036
  UNIMPLEMENTED_MIPS();
1111
- __ break_(0x808);
1112
1037
  }
1113
1038
 
1114
1039
 
1115
- void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
1116
- UncatchableExceptionType type) {
1040
+ void CodeGenerator::VisitCompareToNull(CompareToNull* node) {
1117
1041
  UNIMPLEMENTED_MIPS();
1118
- __ break_(0x815);
1119
1042
  }
1120
1043
 
1121
- void CEntryStub::GenerateCore(MacroAssembler* masm,
1122
- Label* throw_normal_exception,
1123
- Label* throw_termination_exception,
1124
- Label* throw_out_of_memory_exception,
1125
- bool do_gc,
1126
- bool always_allocate) {
1127
- // s0: number of arguments including receiver (C callee-saved)
1128
- // s1: pointer to the first argument (C callee-saved)
1129
- // s2: pointer to builtin function (C callee-saved)
1130
1044
 
1131
- if (do_gc) {
1132
- UNIMPLEMENTED_MIPS();
1045
+ class DeferredReferenceGetNamedValue: public DeferredCode {
1046
+ public:
1047
+ explicit DeferredReferenceGetNamedValue(Register receiver,
1048
+ Handle<String> name,
1049
+ bool is_contextual)
1050
+ : receiver_(receiver),
1051
+ name_(name),
1052
+ is_contextual_(is_contextual),
1053
+ is_dont_delete_(false) {
1054
+ set_comment(is_contextual
1055
+ ? "[ DeferredReferenceGetNamedValue (contextual)"
1056
+ : "[ DeferredReferenceGetNamedValue");
1133
1057
  }
1134
1058
 
1135
- ExternalReference scope_depth =
1136
- ExternalReference::heap_always_allocate_scope_depth();
1137
- if (always_allocate) {
1138
- UNIMPLEMENTED_MIPS();
1059
+ virtual void Generate();
1060
+
1061
+ void set_is_dont_delete(bool value) {
1062
+ ASSERT(is_contextual_);
1063
+ is_dont_delete_ = value;
1139
1064
  }
1140
1065
 
1141
- // Call C built-in.
1142
- // a0 = argc, a1 = argv
1143
- __ mov(a0, s0);
1144
- __ mov(a1, s1);
1066
+ private:
1067
+ Register receiver_;
1068
+ Handle<String> name_;
1069
+ bool is_contextual_;
1070
+ bool is_dont_delete_;
1071
+ };
1145
1072
 
1146
- __ CallBuiltin(s2);
1147
1073
 
1148
- if (always_allocate) {
1149
- UNIMPLEMENTED_MIPS();
1074
+
1075
+ void DeferredReferenceGetNamedValue::Generate() {
1076
+ UNIMPLEMENTED_MIPS();
1077
+ }
1078
+
1079
+
1080
+ class DeferredReferenceGetKeyedValue: public DeferredCode {
1081
+ public:
1082
+ DeferredReferenceGetKeyedValue(Register key, Register receiver)
1083
+ : key_(key), receiver_(receiver) {
1084
+ set_comment("[ DeferredReferenceGetKeyedValue");
1150
1085
  }
1151
1086
 
1152
- // Check for failure result.
1153
- Label failure_returned;
1154
- ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0);
1155
- __ addiu(a2, v0, 1);
1156
- __ andi(t0, a2, kFailureTagMask);
1157
- __ Branch(eq, &failure_returned, t0, Operand(zero_reg));
1158
-
1159
- // Exit C frame and return.
1160
- // v0:v1: result
1161
- // sp: stack pointer
1162
- // fp: frame pointer
1163
- __ LeaveExitFrame(mode_);
1164
-
1165
- // Check if we should retry or throw exception.
1166
- Label retry;
1167
- __ bind(&failure_returned);
1168
- ASSERT(Failure::RETRY_AFTER_GC == 0);
1169
- __ andi(t0, v0, ((1 << kFailureTypeTagSize) - 1) << kFailureTagSize);
1170
- __ Branch(eq, &retry, t0, Operand(zero_reg));
1171
-
1172
- // Special handling of out of memory exceptions.
1173
- Failure* out_of_memory = Failure::OutOfMemoryException();
1174
- __ Branch(eq, throw_out_of_memory_exception,
1175
- v0, Operand(reinterpret_cast<int32_t>(out_of_memory)));
1176
-
1177
- // Retrieve the pending exception and clear the variable.
1178
- __ LoadExternalReference(t0, ExternalReference::the_hole_value_location());
1179
- __ lw(a3, MemOperand(t0));
1180
- __ LoadExternalReference(t0,
1181
- ExternalReference(Top::k_pending_exception_address));
1182
- __ lw(v0, MemOperand(t0));
1183
- __ sw(a3, MemOperand(t0));
1184
-
1185
- // Special handling of termination exceptions which are uncatchable
1186
- // by javascript code.
1187
- __ Branch(eq, throw_termination_exception,
1188
- v0, Operand(Factory::termination_exception()));
1189
-
1190
- // Handle normal exception.
1191
- __ b(throw_normal_exception);
1192
- __ nop(); // Branch delay slot nop.
1193
-
1194
- __ bind(&retry); // pass last failure (r0) as parameter (r0) when retrying
1195
- }
1196
-
1197
- void CEntryStub::Generate(MacroAssembler* masm) {
1198
- // Called from JavaScript; parameters are on stack as if calling JS function
1199
- // a0: number of arguments including receiver
1200
- // a1: pointer to builtin function
1201
- // fp: frame pointer (restored after C call)
1202
- // sp: stack pointer (restored as callee's sp after C call)
1203
- // cp: current context (C callee-saved)
1204
-
1205
- // NOTE: Invocations of builtins may return failure objects
1206
- // instead of a proper result. The builtin entry handles
1207
- // this by performing a garbage collection and retrying the
1208
- // builtin once.
1209
-
1210
- // Enter the exit frame that transitions from JavaScript to C++.
1211
- __ EnterExitFrame(mode_, s0, s1, s2);
1212
-
1213
- // s0: number of arguments (C callee-saved)
1214
- // s1: pointer to first argument (C callee-saved)
1215
- // s2: pointer to builtin function (C callee-saved)
1216
-
1217
- Label throw_normal_exception;
1218
- Label throw_termination_exception;
1219
- Label throw_out_of_memory_exception;
1220
-
1221
- // Call into the runtime system.
1222
- GenerateCore(masm,
1223
- &throw_normal_exception,
1224
- &throw_termination_exception,
1225
- &throw_out_of_memory_exception,
1226
- false,
1227
- false);
1228
-
1229
- // Do space-specific GC and retry runtime call.
1230
- GenerateCore(masm,
1231
- &throw_normal_exception,
1232
- &throw_termination_exception,
1233
- &throw_out_of_memory_exception,
1234
- true,
1235
- false);
1236
-
1237
- // Do full GC and retry runtime call one final time.
1238
- Failure* failure = Failure::InternalError();
1239
- __ li(v0, Operand(reinterpret_cast<int32_t>(failure)));
1240
- GenerateCore(masm,
1241
- &throw_normal_exception,
1242
- &throw_termination_exception,
1243
- &throw_out_of_memory_exception,
1244
- true,
1245
- true);
1246
-
1247
- __ bind(&throw_out_of_memory_exception);
1248
- GenerateThrowUncatchable(masm, OUT_OF_MEMORY);
1249
-
1250
- __ bind(&throw_termination_exception);
1251
- GenerateThrowUncatchable(masm, TERMINATION);
1252
-
1253
- __ bind(&throw_normal_exception);
1254
- GenerateThrowTOS(masm);
1255
- }
1256
-
1257
- void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
1258
- Label invoke, exit;
1259
-
1260
- // Registers:
1261
- // a0: entry address
1262
- // a1: function
1263
- // a2: reveiver
1264
- // a3: argc
1265
- //
1266
- // Stack:
1267
- // 4 args slots
1268
- // args
1269
-
1270
- // Save callee saved registers on the stack.
1271
- __ MultiPush((kCalleeSaved | ra.bit()) & ~sp.bit());
1272
-
1273
- // We build an EntryFrame.
1274
- __ li(t3, Operand(-1)); // Push a bad frame pointer to fail if it is used.
1275
- int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
1276
- __ li(t2, Operand(Smi::FromInt(marker)));
1277
- __ li(t1, Operand(Smi::FromInt(marker)));
1278
- __ LoadExternalReference(t0, ExternalReference(Top::k_c_entry_fp_address));
1279
- __ lw(t0, MemOperand(t0));
1280
- __ MultiPush(t0.bit() | t1.bit() | t2.bit() | t3.bit());
1281
-
1282
- // Setup frame pointer for the frame to be pushed.
1283
- __ addiu(fp, sp, -EntryFrameConstants::kCallerFPOffset);
1284
-
1285
- // Load argv in s0 register.
1286
- __ lw(s0, MemOperand(sp, (kNumCalleeSaved + 1) * kPointerSize +
1287
- StandardFrameConstants::kCArgsSlotsSize));
1288
-
1289
- // Registers:
1290
- // a0: entry_address
1291
- // a1: function
1292
- // a2: reveiver_pointer
1293
- // a3: argc
1294
- // s0: argv
1295
- //
1296
- // Stack:
1297
- // caller fp |
1298
- // function slot | entry frame
1299
- // context slot |
1300
- // bad fp (0xff...f) |
1301
- // callee saved registers + ra
1302
- // 4 args slots
1303
- // args
1304
-
1305
- // Call a faked try-block that does the invoke.
1306
- __ bal(&invoke);
1307
- __ nop(); // Branch delay slot nop.
1308
-
1309
- // Caught exception: Store result (exception) in the pending
1310
- // exception field in the JSEnv and return a failure sentinel.
1311
- // Coming in here the fp will be invalid because the PushTryHandler below
1312
- // sets it to 0 to signal the existence of the JSEntry frame.
1313
- __ LoadExternalReference(t0,
1314
- ExternalReference(Top::k_pending_exception_address));
1315
- __ sw(v0, MemOperand(t0)); // We come back from 'invoke'. result is in v0.
1316
- __ li(v0, Operand(reinterpret_cast<int32_t>(Failure::Exception())));
1317
- __ b(&exit);
1318
- __ nop(); // Branch delay slot nop.
1319
-
1320
- // Invoke: Link this frame into the handler chain.
1321
- __ bind(&invoke);
1322
- __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER);
1323
- // If an exception not caught by another handler occurs, this handler
1324
- // returns control to the code after the bal(&invoke) above, which
1325
- // restores all kCalleeSaved registers (including cp and fp) to their
1326
- // saved values before returning a failure to C.
1327
-
1328
- // Clear any pending exceptions.
1329
- __ LoadExternalReference(t0, ExternalReference::the_hole_value_location());
1330
- __ lw(t1, MemOperand(t0));
1331
- __ LoadExternalReference(t0,
1332
- ExternalReference(Top::k_pending_exception_address));
1333
- __ sw(t1, MemOperand(t0));
1334
-
1335
- // Invoke the function by calling through JS entry trampoline builtin.
1336
- // Notice that we cannot store a reference to the trampoline code directly in
1337
- // this stub, because runtime stubs are not traversed when doing GC.
1338
-
1339
- // Registers:
1340
- // a0: entry_address
1341
- // a1: function
1342
- // a2: reveiver_pointer
1343
- // a3: argc
1344
- // s0: argv
1345
- //
1346
- // Stack:
1347
- // handler frame
1348
- // entry frame
1349
- // callee saved registers + ra
1350
- // 4 args slots
1351
- // args
1352
-
1353
- if (is_construct) {
1354
- ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline);
1355
- __ LoadExternalReference(t0, construct_entry);
1356
- } else {
1357
- ExternalReference entry(Builtins::JSEntryTrampoline);
1358
- __ LoadExternalReference(t0, entry);
1087
+ virtual void Generate();
1088
+
1089
+ private:
1090
+ Register key_;
1091
+ Register receiver_;
1092
+ };
1093
+
1094
+
1095
+ void DeferredReferenceGetKeyedValue::Generate() {
1096
+ UNIMPLEMENTED_MIPS();
1097
+ }
1098
+
1099
+
1100
+ class DeferredReferenceSetKeyedValue: public DeferredCode {
1101
+ public:
1102
+ DeferredReferenceSetKeyedValue(Register value,
1103
+ Register key,
1104
+ Register receiver)
1105
+ : value_(value), key_(key), receiver_(receiver) {
1106
+ set_comment("[ DeferredReferenceSetKeyedValue");
1359
1107
  }
1360
- __ lw(t9, MemOperand(t0)); // deref address
1361
1108
 
1362
- // Call JSEntryTrampoline.
1363
- __ addiu(t9, t9, Code::kHeaderSize - kHeapObjectTag);
1364
- __ CallBuiltin(t9);
1109
+ virtual void Generate();
1365
1110
 
1366
- // Unlink this frame from the handler chain. When reading the
1367
- // address of the next handler, there is no need to use the address
1368
- // displacement since the current stack pointer (sp) points directly
1369
- // to the stack handler.
1370
- __ lw(t1, MemOperand(sp, StackHandlerConstants::kNextOffset));
1371
- __ LoadExternalReference(t0, ExternalReference(Top::k_handler_address));
1372
- __ sw(t1, MemOperand(t0));
1111
+ private:
1112
+ Register value_;
1113
+ Register key_;
1114
+ Register receiver_;
1115
+ };
1373
1116
 
1374
- // This restores sp to its position before PushTryHandler.
1375
- __ addiu(sp, sp, StackHandlerConstants::kSize);
1376
1117
 
1377
- __ bind(&exit); // v0 holds result
1378
- // Restore the top frame descriptors from the stack.
1379
- __ Pop(t1);
1380
- __ LoadExternalReference(t0, ExternalReference(Top::k_c_entry_fp_address));
1381
- __ sw(t1, MemOperand(t0));
1118
+ void DeferredReferenceSetKeyedValue::Generate() {
1119
+ UNIMPLEMENTED_MIPS();
1120
+ }
1121
+
1382
1122
 
1383
- // Reset the stack to the callee saved registers.
1384
- __ addiu(sp, sp, -EntryFrameConstants::kCallerFPOffset);
1123
+ class DeferredReferenceSetNamedValue: public DeferredCode {
1124
+ public:
1125
+ DeferredReferenceSetNamedValue(Register value,
1126
+ Register receiver,
1127
+ Handle<String> name)
1128
+ : value_(value), receiver_(receiver), name_(name) {
1129
+ set_comment("[ DeferredReferenceSetNamedValue");
1130
+ }
1385
1131
 
1386
- // Restore callee saved registers from the stack.
1387
- __ MultiPop((kCalleeSaved | ra.bit()) & ~sp.bit());
1388
- // Return.
1389
- __ Jump(ra);
1132
+ virtual void Generate();
1133
+
1134
+ private:
1135
+ Register value_;
1136
+ Register receiver_;
1137
+ Handle<String> name_;
1138
+ };
1139
+
1140
+
1141
+ void DeferredReferenceSetNamedValue::Generate() {
1142
+ UNIMPLEMENTED_MIPS();
1390
1143
  }
1391
1144
 
1392
1145
 
1393
- // This stub performs an instanceof, calling the builtin function if
1394
- // necessary. Uses a1 for the object, a0 for the function that it may
1395
- // be an instance of (these are fetched from the stack).
1396
- void InstanceofStub::Generate(MacroAssembler* masm) {
1146
+ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
1397
1147
  UNIMPLEMENTED_MIPS();
1398
- __ break_(0x845);
1399
1148
  }
1400
1149
 
1401
1150
 
1402
- void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
1151
+ void CodeGenerator::EmitNamedStore(Handle<String> name, bool is_contextual) {
1403
1152
  UNIMPLEMENTED_MIPS();
1404
- __ break_(0x851);
1405
1153
  }
1406
1154
 
1407
1155
 
1408
- void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
1156
+ void CodeGenerator::EmitKeyedLoad() {
1409
1157
  UNIMPLEMENTED_MIPS();
1410
- __ break_(0x857);
1411
1158
  }
1412
1159
 
1413
1160
 
1414
- void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
1161
+ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
1162
+ WriteBarrierCharacter wb_info) {
1415
1163
  UNIMPLEMENTED_MIPS();
1416
- __ break_(0x863);
1417
1164
  }
1418
1165
 
1419
1166
 
1420
- const char* CompareStub::GetName() {
1167
+ #ifdef DEBUG
1168
+ bool CodeGenerator::HasValidEntryRegisters() {
1421
1169
  UNIMPLEMENTED_MIPS();
1422
- return NULL; // UNIMPLEMENTED RETURN
1170
+ return false;
1423
1171
  }
1172
+ #endif
1424
1173
 
1425
1174
 
1426
- int CompareStub::MinorKey() {
1427
- // Encode the two parameters in a unique 16 bit value.
1428
- ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15));
1429
- return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0);
1175
+ #undef __
1176
+ #define __ ACCESS_MASM(masm)
1177
+
1178
+ // -----------------------------------------------------------------------------
1179
+ // Reference support.
1180
+
1181
+
1182
+ Handle<String> Reference::GetName() {
1183
+ UNIMPLEMENTED_MIPS();
1184
+ return Handle<String>();
1185
+ }
1186
+
1187
+
1188
+ void Reference::DupIfPersist() {
1189
+ UNIMPLEMENTED_MIPS();
1190
+ }
1191
+
1192
+
1193
+ void Reference::GetValue() {
1194
+ UNIMPLEMENTED_MIPS();
1195
+ }
1196
+
1197
+
1198
+ void Reference::SetValue(InitState init_state, WriteBarrierCharacter wb_info) {
1199
+ UNIMPLEMENTED_MIPS();
1200
+ }
1201
+
1202
+
1203
+ const char* GenericBinaryOpStub::GetName() {
1204
+ UNIMPLEMENTED_MIPS();
1205
+ return name_;
1430
1206
  }
1431
1207
 
1432
1208