therubyracer 0.6.3 → 0.7.0.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

Files changed (520) hide show
  1. data/Rakefile +10 -9
  2. data/ext/v8/callbacks.cpp +15 -8
  3. data/ext/v8/converters.cpp +7 -8
  4. data/ext/v8/converters.h +0 -2
  5. data/ext/v8/extconf.rb +2 -0
  6. data/ext/v8/rr.cpp +169 -0
  7. data/ext/v8/rr.h +34 -0
  8. data/ext/v8/upstream/{2.0.6 → 2.1.10}/AUTHORS +8 -1
  9. data/ext/v8/upstream/{2.0.6 → 2.1.10}/ChangeLog +198 -0
  10. data/ext/v8/upstream/{2.0.6 → 2.1.10}/LICENSE +0 -0
  11. data/ext/v8/upstream/{2.0.6 → 2.1.10}/SConstruct +152 -38
  12. data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8-debug.h +52 -4
  13. data/ext/v8/upstream/2.1.10/include/v8-profiler.h +176 -0
  14. data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8.h +227 -48
  15. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/SConscript +60 -10
  16. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.cc +5 -39
  17. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.h +0 -0
  18. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.cc +0 -0
  19. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.h +0 -0
  20. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.cc +477 -57
  21. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.h +8 -4
  22. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apinatives.js +1 -1
  23. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apiutils.h +0 -0
  24. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arguments.h +5 -6
  25. data/ext/v8/upstream/{2.0.6/src/arm/assembler-thumb2-inl.h → 2.1.10/src/arm/assembler-arm-inl.h} +42 -27
  26. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.cc +430 -216
  27. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.h +199 -110
  28. data/ext/v8/upstream/{2.0.6/src/arm/assembler-arm-inl.h → 2.1.10/src/arm/assembler-thumb2-inl.h} +4 -18
  29. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.cc +142 -85
  30. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.h +18 -9
  31. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/builtins-arm.cc +127 -87
  32. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm-inl.h +3 -5
  33. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm.cc +4634 -1427
  34. data/ext/v8/upstream/2.1.10/src/arm/codegen-arm.h +946 -0
  35. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.cc +21 -3
  36. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.h +39 -13
  37. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/cpu-arm.cc +9 -3
  38. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/debug-arm.cc +34 -8
  39. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/disasm-arm.cc +262 -117
  40. data/ext/v8/upstream/2.1.10/src/arm/fast-codegen-arm.cc +238 -0
  41. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.cc +0 -0
  42. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.h +0 -0
  43. data/ext/v8/upstream/{2.0.6/src/arm/fast-codegen-arm.cc → 2.1.10/src/arm/full-codegen-arm.cc} +453 -283
  44. data/ext/v8/upstream/2.1.10/src/arm/ic-arm.cc +1833 -0
  45. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/jump-target-arm.cc +3 -29
  46. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.cc +564 -104
  47. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.h +255 -46
  48. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.cc +78 -104
  49. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.h +6 -22
  50. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm-inl.h +0 -3
  51. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.cc +0 -0
  52. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.h +2 -1
  53. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.cc +557 -180
  54. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.h +52 -4
  55. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/stub-cache-arm.cc +904 -240
  56. data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.cc +668 -0
  57. data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.h +503 -0
  58. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/array.js +82 -109
  59. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.cc +49 -13
  60. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.h +27 -5
  61. data/ext/v8/upstream/2.1.10/src/ast.cc +1138 -0
  62. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ast.h +354 -53
  63. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.cc +609 -501
  64. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.h +27 -8
  65. data/ext/v8/upstream/2.1.10/src/builtins.cc +1512 -0
  66. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/builtins.h +41 -25
  67. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bytecodes-irregexp.h +0 -0
  68. data/ext/v8/upstream/2.1.10/src/cached-powers.h +119 -0
  69. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates-inl.h +0 -0
  70. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates.h +0 -0
  71. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.cc +0 -0
  72. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.h +25 -1
  73. data/ext/v8/upstream/2.1.10/src/circular-queue-inl.h +101 -0
  74. data/ext/v8/upstream/2.1.10/src/circular-queue.cc +121 -0
  75. data/ext/v8/upstream/2.1.10/src/circular-queue.h +129 -0
  76. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.cc +23 -8
  77. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.h +16 -4
  78. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code.h +0 -0
  79. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen-inl.h +6 -34
  80. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.cc +73 -92
  81. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.h +164 -68
  82. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.cc +117 -73
  83. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.h +18 -17
  84. data/ext/v8/upstream/2.1.10/src/compiler.cc +623 -0
  85. data/ext/v8/upstream/2.1.10/src/compiler.h +299 -0
  86. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.cc +0 -0
  87. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.h +8 -11
  88. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions-inl.h +28 -13
  89. data/ext/v8/upstream/2.1.10/src/conversions.cc +1105 -0
  90. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions.h +9 -4
  91. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.cc +0 -0
  92. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.h +1 -1
  93. data/ext/v8/upstream/2.1.10/src/cpu-profiler-inl.h +99 -0
  94. data/ext/v8/upstream/2.1.10/src/cpu-profiler.cc +494 -0
  95. data/ext/v8/upstream/2.1.10/src/cpu-profiler.h +277 -0
  96. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/cpu.h +0 -0
  97. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.cc +15 -4
  98. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.h +0 -0
  99. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-posix.cc +18 -0
  100. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-readline.cc +2 -2
  101. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-windows.cc +0 -0
  102. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.cc +10 -6
  103. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.h +2 -0
  104. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.js +43 -38
  105. data/ext/v8/upstream/2.1.10/src/data-flow.cc +755 -0
  106. data/ext/v8/upstream/2.1.10/src/data-flow.h +278 -0
  107. data/ext/v8/upstream/{2.0.6/src/date-delay.js → 2.1.10/src/date.js} +100 -110
  108. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser-inl.h +11 -2
  109. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.cc +24 -26
  110. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.h +8 -4
  111. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.cc +3 -1
  112. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.h +0 -0
  113. data/ext/v8/upstream/{2.0.6/src/debug-delay.js → 2.1.10/src/debug-debugger.js} +111 -15
  114. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.cc +156 -96
  115. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.h +53 -5
  116. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disasm.h +0 -0
  117. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.cc +2 -8
  118. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.h +0 -0
  119. data/ext/v8/upstream/2.1.10/src/diy-fp.cc +58 -0
  120. data/ext/v8/upstream/2.1.10/src/diy-fp.h +117 -0
  121. data/ext/v8/upstream/2.1.10/src/double.h +169 -0
  122. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dtoa-config.c +4 -3
  123. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.cc +22 -22
  124. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.h +17 -4
  125. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.cc +70 -46
  126. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.h +27 -17
  127. data/ext/v8/upstream/2.1.10/src/fast-codegen.cc +746 -0
  128. data/ext/v8/upstream/2.1.10/src/fast-codegen.h +161 -0
  129. data/ext/v8/upstream/2.1.10/src/fast-dtoa.cc +512 -0
  130. data/ext/v8/upstream/2.1.10/src/fast-dtoa.h +59 -0
  131. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flag-definitions.h +32 -11
  132. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.cc +0 -0
  133. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.h +0 -0
  134. data/ext/v8/upstream/2.1.10/src/flow-graph.cc +763 -0
  135. data/ext/v8/upstream/2.1.10/src/flow-graph.h +180 -0
  136. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.cc +1 -4
  137. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.h +49 -11
  138. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames-inl.h +2 -0
  139. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.cc +91 -17
  140. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.h +24 -2
  141. data/ext/v8/upstream/{2.0.6/src/fast-codegen.cc → 2.1.10/src/full-codegen.cc} +549 -198
  142. data/ext/v8/upstream/{2.0.6/src/fast-codegen.h → 2.1.10/src/full-codegen.h} +109 -29
  143. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.cc +0 -0
  144. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.h +0 -0
  145. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.cc +0 -0
  146. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.h +0 -0
  147. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/globals.h +67 -43
  148. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles-inl.h +0 -0
  149. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.cc +124 -129
  150. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.h +33 -15
  151. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.cc +0 -0
  152. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.h +0 -0
  153. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-inl.h +56 -12
  154. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.cc +2 -2
  155. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.h +2 -0
  156. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.cc +413 -221
  157. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.h +192 -67
  158. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32-inl.h +6 -0
  159. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.cc +187 -32
  160. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.h +31 -4
  161. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/builtins-ia32.cc +160 -133
  162. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32-inl.h +0 -0
  163. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32.cc +5533 -2177
  164. data/ext/v8/upstream/{2.0.6/src/x64/codegen-x64.h → 2.1.10/src/ia32/codegen-ia32.h} +453 -134
  165. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/cpu-ia32.cc +0 -0
  166. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/debug-ia32.cc +63 -8
  167. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/disasm-ia32.cc +99 -16
  168. data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.cc +950 -0
  169. data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.h +155 -0
  170. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.cc +0 -0
  171. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.h +0 -0
  172. data/ext/v8/upstream/{2.0.6/src/ia32/fast-codegen-ia32.cc → 2.1.10/src/ia32/full-codegen-ia32.cc} +454 -253
  173. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/ic-ia32.cc +545 -390
  174. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/jump-target-ia32.cc +1 -0
  175. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.cc +330 -139
  176. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.h +96 -30
  177. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.cc +73 -89
  178. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.h +6 -21
  179. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32-inl.h +0 -0
  180. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.cc +59 -5
  181. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.h +0 -0
  182. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.cc +0 -0
  183. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.h +2 -2
  184. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/stub-cache-ia32.cc +745 -303
  185. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.cc +278 -71
  186. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.h +78 -22
  187. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic-inl.h +0 -0
  188. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.cc +172 -89
  189. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.h +51 -20
  190. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.cc +0 -0
  191. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.h +0 -0
  192. data/ext/v8/upstream/{2.0.6/src/json-delay.js → 2.1.10/src/json.js} +26 -12
  193. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.cc +151 -118
  194. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.h +31 -7
  195. data/ext/v8/upstream/2.1.10/src/jump-target-heavy-inl.h +51 -0
  196. data/ext/v8/upstream/{2.0.6/src/jump-target.cc → 2.1.10/src/jump-target-heavy.cc} +164 -184
  197. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target-inl.h +8 -9
  198. data/ext/v8/upstream/{2.0.6/src/usage-analyzer.h → 2.1.10/src/jump-target-light-inl.h} +9 -7
  199. data/ext/v8/upstream/2.1.10/src/jump-target-light.cc +86 -0
  200. data/ext/v8/upstream/2.1.10/src/jump-target.cc +155 -0
  201. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target.h +6 -0
  202. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list-inl.h +0 -0
  203. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list.h +2 -1
  204. data/ext/v8/upstream/2.1.10/src/liveedit-debugger.js +944 -0
  205. data/ext/v8/upstream/2.1.10/src/liveedit.cc +1468 -0
  206. data/ext/v8/upstream/2.1.10/src/liveedit.h +170 -0
  207. data/ext/v8/upstream/2.1.10/src/log-inl.h +59 -0
  208. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.cc +3 -9
  209. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.h +1 -4
  210. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.cc +198 -95
  211. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.h +50 -49
  212. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macro-assembler.h +9 -0
  213. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macros.py +30 -11
  214. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.cc +464 -152
  215. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.h +41 -20
  216. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/math.js +9 -8
  217. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/memory.h +0 -0
  218. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.cc +1 -0
  219. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.h +0 -0
  220. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.js +46 -9
  221. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips-inl.h +215 -0
  222. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.cc +1208 -0
  223. data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.h +665 -0
  224. data/ext/v8/upstream/2.1.10/src/mips/builtins-mips.cc +202 -0
  225. data/ext/v8/upstream/2.1.10/src/mips/codegen-mips-inl.h +70 -0
  226. data/ext/v8/upstream/2.1.10/src/mips/codegen-mips.cc +1428 -0
  227. data/ext/v8/upstream/{2.0.6/src/arm/codegen-arm.h → 2.1.10/src/mips/codegen-mips.h} +103 -205
  228. data/ext/v8/upstream/2.1.10/src/mips/constants-mips.cc +323 -0
  229. data/ext/v8/upstream/2.1.10/src/mips/constants-mips.h +525 -0
  230. data/ext/v8/upstream/2.1.10/src/mips/cpu-mips.cc +69 -0
  231. data/ext/v8/upstream/2.1.10/src/mips/debug-mips.cc +128 -0
  232. data/ext/v8/upstream/2.1.10/src/mips/disasm-mips.cc +784 -0
  233. data/ext/v8/upstream/2.1.10/src/mips/fast-codegen-mips.cc +74 -0
  234. data/ext/v8/upstream/2.1.10/src/mips/frames-mips.cc +99 -0
  235. data/ext/v8/upstream/2.1.10/src/mips/frames-mips.h +164 -0
  236. data/ext/v8/upstream/2.1.10/src/mips/full-codegen-mips.cc +273 -0
  237. data/ext/v8/upstream/2.1.10/src/mips/ic-mips.cc +217 -0
  238. data/ext/v8/upstream/2.1.10/src/mips/jump-target-mips.cc +172 -0
  239. data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.cc +1323 -0
  240. data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.h +461 -0
  241. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips-inl.h +137 -0
  242. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.cc +60 -0
  243. data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.h +46 -0
  244. data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.cc +1648 -0
  245. data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.h +311 -0
  246. data/ext/v8/upstream/2.1.10/src/mips/stub-cache-mips.cc +400 -0
  247. data/ext/v8/upstream/2.1.10/src/mips/virtual-frame-mips.cc +316 -0
  248. data/ext/v8/upstream/{2.0.6/src/arm/virtual-frame-arm.h → 2.1.10/src/mips/virtual-frame-mips.h} +87 -71
  249. data/ext/v8/upstream/{2.0.6/src/mirror-delay.js → 2.1.10/src/mirror-debugger.js} +51 -45
  250. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mksnapshot.cc +97 -10
  251. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/natives.h +6 -6
  252. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-debug.cc +47 -5
  253. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-inl.h +154 -38
  254. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.cc +528 -280
  255. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.h +302 -95
  256. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.cc +25 -33
  257. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.h +9 -1
  258. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.cc +444 -72
  259. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.h +4 -2
  260. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-freebsd.cc +32 -13
  261. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-linux.cc +59 -25
  262. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-macos.cc +30 -13
  263. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-nullos.cc +0 -0
  264. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-openbsd.cc +21 -2
  265. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-posix.cc +0 -18
  266. data/ext/v8/upstream/2.1.10/src/platform-solaris.cc +607 -0
  267. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-win32.cc +16 -17
  268. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform.h +25 -8
  269. data/ext/v8/upstream/2.1.10/src/powers-ten.h +2461 -0
  270. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.cc +49 -29
  271. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.h +3 -1
  272. data/ext/v8/upstream/2.1.10/src/profile-generator-inl.h +124 -0
  273. data/ext/v8/upstream/2.1.10/src/profile-generator.cc +583 -0
  274. data/ext/v8/upstream/2.1.10/src/profile-generator.h +364 -0
  275. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.cc +1 -1
  276. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.h +12 -24
  277. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp-inl.h +2 -2
  278. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.cc +2 -2
  279. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.h +2 -2
  280. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.cc +2 -2
  281. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.h +0 -0
  282. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.cc +33 -10
  283. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.h +12 -4
  284. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.cc +0 -0
  285. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.h +0 -0
  286. data/ext/v8/upstream/{2.0.6/src/regexp-delay.js → 2.1.10/src/regexp.js} +180 -58
  287. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator-inl.h +68 -1
  288. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.cc +5 -2
  289. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.h +42 -17
  290. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.cc +110 -4
  291. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.h +0 -0
  292. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.cc +2733 -623
  293. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.h +43 -20
  294. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.js +46 -35
  295. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.cc +278 -36
  296. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.h +97 -26
  297. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.cc +3 -3
  298. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.h +1 -0
  299. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.cc +11 -12
  300. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.h +0 -1
  301. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.cc +298 -175
  302. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.h +184 -40
  303. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/shell.h +0 -0
  304. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/simulator.h +2 -0
  305. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/smart-pointer.h +0 -0
  306. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot-common.cc +16 -31
  307. data/ext/v8/upstream/2.1.10/src/snapshot-empty.cc +50 -0
  308. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot.h +13 -1
  309. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces-inl.h +35 -27
  310. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.cc +256 -42
  311. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.h +136 -42
  312. data/ext/v8/upstream/{2.0.6/src/zone-inl.h → 2.1.10/src/splay-tree-inl.h} +102 -89
  313. data/ext/v8/upstream/2.1.10/src/splay-tree.h +203 -0
  314. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.cc +0 -0
  315. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.h +0 -0
  316. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string.js +260 -149
  317. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.cc +195 -69
  318. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.h +127 -12
  319. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/COPYING +0 -0
  320. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/dtoa.c +0 -0
  321. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/valgrind/valgrind.h +0 -0
  322. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.cc +0 -0
  323. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.h +0 -0
  324. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.cc +26 -31
  325. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.h +3 -4
  326. data/ext/v8/upstream/2.1.10/src/type-info.cc +53 -0
  327. data/ext/v8/upstream/2.1.10/src/type-info.h +244 -0
  328. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode-inl.h +0 -0
  329. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.cc +0 -0
  330. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.h +0 -0
  331. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/uri.js +6 -6
  332. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.cc +0 -37
  333. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.h +121 -50
  334. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.cc +0 -0
  335. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.h +130 -98
  336. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.cc +42 -11
  337. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.h +4 -2
  338. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8natives.js +202 -37
  339. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.cc +11 -0
  340. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.h +15 -0
  341. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.cc +7 -51
  342. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.h +5 -35
  343. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.cc +3 -3
  344. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.h +0 -0
  345. data/ext/v8/upstream/2.1.10/src/virtual-frame-heavy-inl.h +152 -0
  346. data/ext/v8/upstream/{2.0.6/src/virtual-frame.cc → 2.1.10/src/virtual-frame-heavy.cc} +107 -176
  347. data/ext/v8/upstream/2.1.10/src/virtual-frame-inl.h +39 -0
  348. data/ext/v8/upstream/2.1.10/src/virtual-frame-light-inl.h +69 -0
  349. data/ext/v8/upstream/2.1.10/src/virtual-frame-light.cc +49 -0
  350. data/ext/v8/upstream/2.1.10/src/virtual-frame.cc +49 -0
  351. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/virtual-frame.h +2 -0
  352. data/ext/v8/upstream/{2.0.6/src/log-inl.h → 2.1.10/src/vm-state-inl.h} +28 -20
  353. data/ext/v8/upstream/{2.0.6/src/snapshot-empty.cc → 2.1.10/src/vm-state.cc} +5 -6
  354. data/ext/v8/upstream/2.1.10/src/vm-state.h +75 -0
  355. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64-inl.h +11 -0
  356. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.cc +285 -93
  357. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.h +81 -78
  358. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/builtins-x64.cc +130 -87
  359. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64-inl.h +0 -0
  360. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64.cc +4520 -1317
  361. data/ext/v8/upstream/{2.0.6/src/ia32/codegen-ia32.h → 2.1.10/src/x64/codegen-x64.h} +362 -141
  362. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/cpu-x64.cc +0 -0
  363. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/debug-x64.cc +20 -4
  364. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/disasm-x64.cc +121 -44
  365. data/ext/v8/upstream/2.1.10/src/x64/fast-codegen-x64.cc +246 -0
  366. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.cc +0 -0
  367. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.h +0 -0
  368. data/ext/v8/upstream/{2.0.6/src/x64/fast-codegen-x64.cc → 2.1.10/src/x64/full-codegen-x64.cc} +404 -231
  369. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/ic-x64.cc +346 -117
  370. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/jump-target-x64.cc +1 -0
  371. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.cc +537 -181
  372. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.h +140 -34
  373. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.cc +74 -96
  374. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.h +8 -25
  375. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64-inl.h +1 -1
  376. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.cc +3 -0
  377. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.h +0 -0
  378. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.cc +0 -0
  379. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.h +2 -2
  380. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/stub-cache-x64.cc +785 -288
  381. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.cc +128 -52
  382. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.h +40 -19
  383. data/ext/v8/upstream/2.1.10/src/zone-inl.h +82 -0
  384. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.cc +1 -0
  385. data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.h +6 -90
  386. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/codemap.js +12 -0
  387. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/consarray.js +0 -0
  388. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/csvparser.js +22 -37
  389. data/ext/v8/upstream/2.1.10/tools/generate-ten-powers.scm +286 -0
  390. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/gyp/v8.gyp +86 -24
  391. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/js2c.py +22 -22
  392. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/jsmin.py +0 -0
  393. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor +10 -1
  394. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor.py +0 -0
  395. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/logreader.js +34 -16
  396. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-nm +0 -0
  397. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-tick-processor +0 -0
  398. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/annotate +0 -0
  399. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/common +0 -0
  400. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/dump +0 -0
  401. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/report +0 -0
  402. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/reset +0 -0
  403. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/run +0 -0
  404. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/shutdown +0 -0
  405. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/start +0 -0
  406. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/presubmit.py +0 -0
  407. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/process-heap-prof.py +0 -0
  408. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile.js +70 -0
  409. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile_view.js +0 -0
  410. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/run-valgrind.py +0 -0
  411. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.js +0 -0
  412. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.py +0 -0
  413. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/stats-viewer.py +0 -0
  414. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/test.py +7 -7
  415. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor-driver.js +7 -1
  416. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.js +140 -9
  417. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.py +40 -4
  418. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/utils.py +6 -0
  419. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/README.txt +0 -0
  420. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/arm.vsprops +1 -1
  421. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/common.vsprops +1 -2
  422. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8.vcproj +0 -6
  423. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_arm.vcproj +193 -199
  424. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_x64.vcproj +16 -8
  425. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8js2c.cmd +0 -0
  426. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/debug.vsprops +0 -0
  427. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/ia32.vsprops +5 -1
  428. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/js2c.cmd +1 -1
  429. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/release.vsprops +0 -0
  430. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.sln +0 -0
  431. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.vcproj +11 -7
  432. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.sln +0 -0
  433. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.vcproj +227 -223
  434. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base.vcproj +137 -5
  435. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_arm.vcproj +116 -4
  436. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_x64.vcproj +125 -4
  437. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest.vcproj +12 -6
  438. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_arm.vcproj +12 -6
  439. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_x64.vcproj +11 -11
  440. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot.vcproj +0 -6
  441. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -6
  442. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample.vcproj +0 -6
  443. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_arm.vcproj +145 -151
  444. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_x64.vcproj +16 -6
  445. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample.vcproj +0 -6
  446. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_arm.vcproj +145 -151
  447. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_x64.vcproj +16 -8
  448. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  449. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  450. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  451. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  452. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.sln +0 -0
  453. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.vcproj +11 -7
  454. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/x64.vsprops +5 -1
  455. data/ext/v8/upstream/2.1.10/tools/windows-tick-processor.bat +29 -0
  456. data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/windows-tick-processor.py +0 -0
  457. data/ext/v8/upstream/Makefile +8 -2
  458. data/ext/v8/v8.cpp +21 -73
  459. data/ext/v8/v8_array.cpp +56 -0
  460. data/ext/v8/v8_array.h +8 -0
  461. data/ext/v8/v8_callbacks.cpp +121 -0
  462. data/ext/v8/v8_callbacks.h +8 -0
  463. data/ext/v8/v8_cxt.cpp +74 -77
  464. data/ext/v8/v8_cxt.h +2 -9
  465. data/ext/v8/v8_date.cpp +26 -0
  466. data/ext/v8/v8_date.h +6 -0
  467. data/ext/v8/v8_exception.cpp +55 -0
  468. data/ext/v8/v8_exception.h +6 -0
  469. data/ext/v8/v8_external.cpp +50 -0
  470. data/ext/v8/v8_external.h +8 -0
  471. data/ext/v8/v8_func.cpp +76 -18
  472. data/ext/v8/v8_func.h +5 -4
  473. data/ext/v8/v8_msg.cpp +55 -46
  474. data/ext/v8/v8_msg.h +3 -11
  475. data/ext/v8/v8_obj.cpp +67 -36
  476. data/ext/v8/v8_obj.h +6 -8
  477. data/ext/v8/v8_ref.cpp +25 -9
  478. data/ext/v8/v8_ref.h +3 -5
  479. data/ext/v8/v8_script.cpp +17 -10
  480. data/ext/v8/v8_script.h +3 -3
  481. data/ext/v8/v8_str.cpp +34 -6
  482. data/ext/v8/v8_str.h +4 -2
  483. data/ext/v8/v8_template.cpp +195 -33
  484. data/ext/v8/v8_template.h +4 -5
  485. data/ext/v8/v8_try_catch.cpp +99 -0
  486. data/ext/v8/v8_try_catch.h +5 -0
  487. data/ext/v8/v8_value.cpp +164 -0
  488. data/ext/v8/v8_value.h +10 -0
  489. data/lib/v8.rb +3 -1
  490. data/lib/v8/access.rb +60 -0
  491. data/lib/v8/array.rb +15 -0
  492. data/lib/v8/callbacks.rb +88 -0
  493. data/lib/v8/cli.rb +1 -1
  494. data/lib/v8/context.rb +55 -66
  495. data/lib/v8/function.rb +20 -2
  496. data/lib/v8/object.rb +14 -12
  497. data/lib/v8/ruby_error.rb +3 -0
  498. data/lib/v8/to.rb +59 -7
  499. data/spec/ext/cxt_spec.rb +2 -15
  500. data/spec/ext/func_spec.rb +17 -10
  501. data/spec/ext/try_catch_spec.rb +32 -0
  502. data/spec/foo.rb +17 -0
  503. data/spec/redjs/jsapi_spec.rb +173 -96
  504. data/spec/spec_helper.rb +7 -0
  505. data/spec/v8/to_spec.rb +0 -1
  506. data/therubyracer.gemspec +6 -6
  507. metadata +493 -386
  508. data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +0 -849
  509. data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +0 -412
  510. data/ext/v8/upstream/2.0.6/src/ast.cc +0 -512
  511. data/ext/v8/upstream/2.0.6/src/builtins.cc +0 -851
  512. data/ext/v8/upstream/2.0.6/src/compiler.cc +0 -1132
  513. data/ext/v8/upstream/2.0.6/src/compiler.h +0 -107
  514. data/ext/v8/upstream/2.0.6/src/conversions.cc +0 -709
  515. data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +0 -426
  516. data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +0 -5
  517. data/ext/v8/upstream/no-strict-aliasing.patch +0 -13
  518. data/ext/v8/v8_standalone.cpp +0 -69
  519. data/ext/v8/v8_standalone.h +0 -31
  520. data/spec/ext/obj_spec.rb +0 -13
@@ -0,0 +1,238 @@
1
+ // Copyright 2010 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "v8.h"
29
+
30
+ #include "codegen-inl.h"
31
+ #include "fast-codegen.h"
32
+ #include "scopes.h"
33
+
34
+ namespace v8 {
35
+ namespace internal {
36
+
37
+ #define __ ACCESS_MASM(masm())
38
+
39
+ Register FastCodeGenerator::accumulator0() { return r0; }
40
+ Register FastCodeGenerator::accumulator1() { return r1; }
41
+ Register FastCodeGenerator::scratch0() { return r3; }
42
+ Register FastCodeGenerator::scratch1() { return r4; }
43
+ Register FastCodeGenerator::scratch2() { return r5; }
44
+ Register FastCodeGenerator::receiver_reg() { return r2; }
45
+ Register FastCodeGenerator::context_reg() { return cp; }
46
+
47
+
48
+ void FastCodeGenerator::EmitLoadReceiver() {
49
+ // Offset 2 is due to return address and saved frame pointer.
50
+ int index = 2 + scope()->num_parameters();
51
+ __ ldr(receiver_reg(), MemOperand(sp, index * kPointerSize));
52
+ }
53
+
54
+
55
+ void FastCodeGenerator::EmitGlobalVariableLoad(Handle<Object> cell) {
56
+ ASSERT(!destination().is(no_reg));
57
+ ASSERT(cell->IsJSGlobalPropertyCell());
58
+
59
+ __ mov(destination(), Operand(cell));
60
+ __ ldr(destination(),
61
+ FieldMemOperand(destination(), JSGlobalPropertyCell::kValueOffset));
62
+ if (FLAG_debug_code) {
63
+ __ mov(ip, Operand(Factory::the_hole_value()));
64
+ __ cmp(destination(), ip);
65
+ __ Check(ne, "DontDelete cells can't contain the hole");
66
+ }
67
+
68
+ // The loaded value is not known to be a smi.
69
+ clear_as_smi(destination());
70
+ }
71
+
72
+
73
+ void FastCodeGenerator::EmitThisPropertyStore(Handle<String> name) {
74
+ LookupResult lookup;
75
+ info()->receiver()->Lookup(*name, &lookup);
76
+
77
+ ASSERT(lookup.holder() == *info()->receiver());
78
+ ASSERT(lookup.type() == FIELD);
79
+ Handle<Map> map(Handle<HeapObject>::cast(info()->receiver())->map());
80
+ int index = lookup.GetFieldIndex() - map->inobject_properties();
81
+ int offset = index * kPointerSize;
82
+
83
+ // We will emit the write barrier unless the stored value is statically
84
+ // known to be a smi.
85
+ bool needs_write_barrier = !is_smi(accumulator0());
86
+
87
+ // Negative offsets are inobject properties.
88
+ if (offset < 0) {
89
+ offset += map->instance_size();
90
+ __ str(accumulator0(), FieldMemOperand(receiver_reg(), offset));
91
+ if (needs_write_barrier) {
92
+ // Preserve receiver from write barrier.
93
+ __ mov(scratch0(), receiver_reg());
94
+ }
95
+ } else {
96
+ offset += FixedArray::kHeaderSize;
97
+ __ ldr(scratch0(),
98
+ FieldMemOperand(receiver_reg(), JSObject::kPropertiesOffset));
99
+ __ str(accumulator0(), FieldMemOperand(scratch0(), offset));
100
+ }
101
+
102
+ if (needs_write_barrier) {
103
+ __ mov(scratch1(), Operand(offset));
104
+ __ RecordWrite(scratch0(), scratch1(), scratch2());
105
+ }
106
+
107
+ if (destination().is(accumulator1())) {
108
+ __ mov(accumulator1(), accumulator0());
109
+ if (is_smi(accumulator0())) {
110
+ set_as_smi(accumulator1());
111
+ } else {
112
+ clear_as_smi(accumulator1());
113
+ }
114
+ }
115
+ }
116
+
117
+
118
+ void FastCodeGenerator::EmitThisPropertyLoad(Handle<String> name) {
119
+ ASSERT(!destination().is(no_reg));
120
+ LookupResult lookup;
121
+ info()->receiver()->Lookup(*name, &lookup);
122
+
123
+ ASSERT(lookup.holder() == *info()->receiver());
124
+ ASSERT(lookup.type() == FIELD);
125
+ Handle<Map> map(Handle<HeapObject>::cast(info()->receiver())->map());
126
+ int index = lookup.GetFieldIndex() - map->inobject_properties();
127
+ int offset = index * kPointerSize;
128
+
129
+ // Perform the load. Negative offsets are inobject properties.
130
+ if (offset < 0) {
131
+ offset += map->instance_size();
132
+ __ ldr(destination(), FieldMemOperand(receiver_reg(), offset));
133
+ } else {
134
+ offset += FixedArray::kHeaderSize;
135
+ __ ldr(scratch0(),
136
+ FieldMemOperand(receiver_reg(), JSObject::kPropertiesOffset));
137
+ __ ldr(destination(), FieldMemOperand(scratch0(), offset));
138
+ }
139
+
140
+ // The loaded value is not known to be a smi.
141
+ clear_as_smi(destination());
142
+ }
143
+
144
+
145
+ void FastCodeGenerator::EmitBitOr() {
146
+ if (is_smi(accumulator0()) && is_smi(accumulator1())) {
147
+ // If both operands are known to be a smi then there is no need to check
148
+ // the operands or result. There is no need to perform the operation in
149
+ // an effect context.
150
+ if (!destination().is(no_reg)) {
151
+ __ orr(destination(), accumulator1(), Operand(accumulator0()));
152
+ }
153
+ } else {
154
+ // Left is in accumulator1, right in accumulator0.
155
+ if (destination().is(accumulator0())) {
156
+ __ mov(scratch0(), accumulator0());
157
+ __ orr(destination(), accumulator1(), Operand(accumulator1()));
158
+ Label* bailout =
159
+ info()->AddBailout(accumulator1(), scratch0()); // Left, right.
160
+ __ BranchOnNotSmi(destination(), bailout);
161
+ } else if (destination().is(accumulator1())) {
162
+ __ mov(scratch0(), accumulator1());
163
+ __ orr(destination(), accumulator1(), Operand(accumulator0()));
164
+ Label* bailout = info()->AddBailout(scratch0(), accumulator0());
165
+ __ BranchOnNotSmi(destination(), bailout);
166
+ } else {
167
+ ASSERT(destination().is(no_reg));
168
+ __ orr(scratch0(), accumulator1(), Operand(accumulator0()));
169
+ Label* bailout = info()->AddBailout(accumulator1(), accumulator0());
170
+ __ BranchOnNotSmi(scratch0(), bailout);
171
+ }
172
+ }
173
+
174
+ // If we didn't bailout, the result (in fact, both inputs too) is known to
175
+ // be a smi.
176
+ set_as_smi(accumulator0());
177
+ set_as_smi(accumulator1());
178
+ }
179
+
180
+
181
+ void FastCodeGenerator::Generate(CompilationInfo* compilation_info) {
182
+ ASSERT(info_ == NULL);
183
+ info_ = compilation_info;
184
+ Comment cmnt(masm_, "[ function compiled by fast code generator");
185
+
186
+ // Save the caller's frame pointer and set up our own.
187
+ Comment prologue_cmnt(masm(), ";; Prologue");
188
+ __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
189
+ __ add(fp, sp, Operand(2 * kPointerSize));
190
+ // Note that we keep a live register reference to cp (context) at
191
+ // this point.
192
+
193
+ Label* bailout_to_beginning = info()->AddBailout();
194
+ // Receiver (this) is allocated to a fixed register.
195
+ if (info()->has_this_properties()) {
196
+ Comment cmnt(masm(), ";; MapCheck(this)");
197
+ if (FLAG_print_ir) {
198
+ PrintF("MapCheck(this)\n");
199
+ }
200
+ ASSERT(info()->has_receiver() && info()->receiver()->IsHeapObject());
201
+ Handle<HeapObject> object = Handle<HeapObject>::cast(info()->receiver());
202
+ Handle<Map> map(object->map());
203
+ EmitLoadReceiver();
204
+ __ CheckMap(receiver_reg(), scratch0(), map, bailout_to_beginning, false);
205
+ }
206
+
207
+ // If there is a global variable access check if the global object is the
208
+ // same as at lazy-compilation time.
209
+ if (info()->has_globals()) {
210
+ Comment cmnt(masm(), ";; MapCheck(GLOBAL)");
211
+ if (FLAG_print_ir) {
212
+ PrintF("MapCheck(GLOBAL)\n");
213
+ }
214
+ ASSERT(info()->has_global_object());
215
+ Handle<Map> map(info()->global_object()->map());
216
+ __ ldr(scratch0(), CodeGenerator::GlobalObject());
217
+ __ CheckMap(scratch0(), scratch1(), map, bailout_to_beginning, true);
218
+ }
219
+
220
+ VisitStatements(function()->body());
221
+
222
+ Comment return_cmnt(masm(), ";; Return(<undefined>)");
223
+ if (FLAG_print_ir) {
224
+ PrintF("Return(<undefined>)\n");
225
+ }
226
+ __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
227
+ __ mov(sp, fp);
228
+ __ ldm(ia_w, sp, fp.bit() | lr.bit());
229
+ int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize;
230
+ __ add(sp, sp, Operand(sp_delta));
231
+ __ Jump(lr);
232
+ }
233
+
234
+
235
+ #undef __
236
+
237
+
238
+ } } // namespace v8::internal
@@ -30,8 +30,9 @@
30
30
  #include "codegen-inl.h"
31
31
  #include "compiler.h"
32
32
  #include "debug.h"
33
- #include "fast-codegen.h"
33
+ #include "full-codegen.h"
34
34
  #include "parser.h"
35
+ #include "scopes.h"
35
36
 
36
37
  namespace v8 {
37
38
  namespace internal {
@@ -52,80 +53,93 @@ namespace internal {
52
53
  //
53
54
  // The function builds a JS frame. Please see JavaScriptFrameConstants in
54
55
  // frames-arm.h for its layout.
55
- void FastCodeGenerator::Generate(FunctionLiteral* fun) {
56
- function_ = fun;
57
- SetFunctionPosition(fun);
58
- int locals_count = fun->scope()->num_stack_slots();
59
-
60
- __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
61
- if (locals_count > 0) {
62
- // Load undefined value here, so the value is ready for the loop below.
56
+ void FullCodeGenerator::Generate(CompilationInfo* info, Mode mode) {
57
+ ASSERT(info_ == NULL);
58
+ info_ = info;
59
+ SetFunctionPosition(function());
60
+ Comment cmnt(masm_, "[ function compiled by full code generator");
61
+
62
+ if (mode == PRIMARY) {
63
+ int locals_count = scope()->num_stack_slots();
64
+
65
+ __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
66
+ if (locals_count > 0) {
67
+ // Load undefined value here, so the value is ready for the loop
68
+ // below.
63
69
  __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
64
- }
65
- // Adjust fp to point to caller's fp.
66
- __ add(fp, sp, Operand(2 * kPointerSize));
67
-
68
- { Comment cmnt(masm_, "[ Allocate locals");
69
- for (int i = 0; i < locals_count; i++) {
70
- __ push(ip);
71
70
  }
72
- }
71
+ // Adjust fp to point to caller's fp.
72
+ __ add(fp, sp, Operand(2 * kPointerSize));
73
73
 
74
- bool function_in_register = true;
74
+ { Comment cmnt(masm_, "[ Allocate locals");
75
+ for (int i = 0; i < locals_count; i++) {
76
+ __ push(ip);
77
+ }
78
+ }
75
79
 
76
- // Possibly allocate a local context.
77
- if (fun->scope()->num_heap_slots() > 0) {
78
- Comment cmnt(masm_, "[ Allocate local context");
79
- // Argument to NewContext is the function, which is in r1.
80
- __ push(r1);
81
- __ CallRuntime(Runtime::kNewContext, 1);
82
- function_in_register = false;
83
- // Context is returned in both r0 and cp. It replaces the context
84
- // passed to us. It's saved in the stack and kept live in cp.
85
- __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
86
- // Copy any necessary parameters into the context.
87
- int num_parameters = fun->scope()->num_parameters();
88
- for (int i = 0; i < num_parameters; i++) {
89
- Slot* slot = fun->scope()->parameter(i)->slot();
90
- if (slot != NULL && slot->type() == Slot::CONTEXT) {
91
- int parameter_offset = StandardFrameConstants::kCallerSPOffset +
92
- (num_parameters - 1 - i) * kPointerSize;
93
- // Load parameter from stack.
94
- __ ldr(r0, MemOperand(fp, parameter_offset));
95
- // Store it in the context
96
- __ str(r0, MemOperand(cp, Context::SlotOffset(slot->index())));
80
+ bool function_in_register = true;
81
+
82
+ // Possibly allocate a local context.
83
+ if (scope()->num_heap_slots() > 0) {
84
+ Comment cmnt(masm_, "[ Allocate local context");
85
+ // Argument to NewContext is the function, which is in r1.
86
+ __ push(r1);
87
+ __ CallRuntime(Runtime::kNewContext, 1);
88
+ function_in_register = false;
89
+ // Context is returned in both r0 and cp. It replaces the context
90
+ // passed to us. It's saved in the stack and kept live in cp.
91
+ __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
92
+ // Copy any necessary parameters into the context.
93
+ int num_parameters = scope()->num_parameters();
94
+ for (int i = 0; i < num_parameters; i++) {
95
+ Slot* slot = scope()->parameter(i)->slot();
96
+ if (slot != NULL && slot->type() == Slot::CONTEXT) {
97
+ int parameter_offset = StandardFrameConstants::kCallerSPOffset +
98
+ (num_parameters - 1 - i) * kPointerSize;
99
+ // Load parameter from stack.
100
+ __ ldr(r0, MemOperand(fp, parameter_offset));
101
+ // Store it in the context.
102
+ __ mov(r1, Operand(Context::SlotOffset(slot->index())));
103
+ __ str(r0, MemOperand(cp, r1));
104
+ // Update the write barrier. This clobbers all involved
105
+ // registers, so we have use a third register to avoid
106
+ // clobbering cp.
107
+ __ mov(r2, Operand(cp));
108
+ __ RecordWrite(r2, r1, r0);
109
+ }
97
110
  }
98
111
  }
99
- }
100
112
 
101
- Variable* arguments = fun->scope()->arguments()->AsVariable();
102
- if (arguments != NULL) {
103
- // Function uses arguments object.
104
- Comment cmnt(masm_, "[ Allocate arguments object");
105
- if (!function_in_register) {
106
- // Load this again, if it's used by the local context below.
107
- __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
108
- } else {
109
- __ mov(r3, r1);
113
+ Variable* arguments = scope()->arguments()->AsVariable();
114
+ if (arguments != NULL) {
115
+ // Function uses arguments object.
116
+ Comment cmnt(masm_, "[ Allocate arguments object");
117
+ if (!function_in_register) {
118
+ // Load this again, if it's used by the local context below.
119
+ __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
120
+ } else {
121
+ __ mov(r3, r1);
122
+ }
123
+ // Receiver is just before the parameters on the caller's stack.
124
+ int offset = scope()->num_parameters() * kPointerSize;
125
+ __ add(r2, fp,
126
+ Operand(StandardFrameConstants::kCallerSPOffset + offset));
127
+ __ mov(r1, Operand(Smi::FromInt(scope()->num_parameters())));
128
+ __ Push(r3, r2, r1);
129
+
130
+ // Arguments to ArgumentsAccessStub:
131
+ // function, receiver address, parameter count.
132
+ // The stub will rewrite receiever and parameter count if the previous
133
+ // stack frame was an arguments adapter frame.
134
+ ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
135
+ __ CallStub(&stub);
136
+ // Duplicate the value; move-to-slot operation might clobber registers.
137
+ __ mov(r3, r0);
138
+ Move(arguments->slot(), r0, r1, r2);
139
+ Slot* dot_arguments_slot =
140
+ scope()->arguments_shadow()->AsVariable()->slot();
141
+ Move(dot_arguments_slot, r3, r1, r2);
110
142
  }
111
- // Receiver is just before the parameters on the caller's stack.
112
- __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset +
113
- fun->num_parameters() * kPointerSize));
114
- __ mov(r1, Operand(Smi::FromInt(fun->num_parameters())));
115
- __ stm(db_w, sp, r3.bit() | r2.bit() | r1.bit());
116
-
117
- // Arguments to ArgumentsAccessStub:
118
- // function, receiver address, parameter count.
119
- // The stub will rewrite receiever and parameter count if the previous
120
- // stack frame was an arguments adapter frame.
121
- ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
122
- __ CallStub(&stub);
123
- // Duplicate the value; move-to-slot operation might clobber registers.
124
- __ mov(r3, r0);
125
- Move(arguments->slot(), r0, r1, r2);
126
- Slot* dot_arguments_slot =
127
- fun->scope()->arguments_shadow()->AsVariable()->slot();
128
- Move(dot_arguments_slot, r3, r1, r2);
129
143
  }
130
144
 
131
145
  // Check the stack for overflow or break request.
@@ -133,19 +147,19 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
133
147
  // added to the implicit 8 byte offset that always applies to operations
134
148
  // with pc and gives a return address 12 bytes down.
135
149
  { Comment cmnt(masm_, "[ Stack check");
136
- __ LoadRoot(r2, Heap::kStackLimitRootIndex);
137
- __ add(lr, pc, Operand(Assembler::kInstrSize));
138
- __ cmp(sp, Operand(r2));
139
- StackCheckStub stub;
140
- __ mov(pc,
141
- Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
142
- RelocInfo::CODE_TARGET),
143
- LeaveCC,
144
- lo);
150
+ __ LoadRoot(r2, Heap::kStackLimitRootIndex);
151
+ __ add(lr, pc, Operand(Assembler::kInstrSize));
152
+ __ cmp(sp, Operand(r2));
153
+ StackCheckStub stub;
154
+ __ mov(pc,
155
+ Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
156
+ RelocInfo::CODE_TARGET),
157
+ LeaveCC,
158
+ lo);
145
159
  }
146
160
 
147
161
  { Comment cmnt(masm_, "[ Declarations");
148
- VisitDeclarations(fun->scope()->declarations());
162
+ VisitDeclarations(scope()->declarations());
149
163
  }
150
164
 
151
165
  if (FLAG_trace) {
@@ -154,7 +168,7 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
154
168
 
155
169
  { Comment cmnt(masm_, "[ Body");
156
170
  ASSERT(loop_depth() == 0);
157
- VisitStatements(fun->body());
171
+ VisitStatements(function()->body());
158
172
  ASSERT(loop_depth() == 0);
159
173
  }
160
174
 
@@ -163,11 +177,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
163
177
  // body.
164
178
  __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
165
179
  }
166
- EmitReturnSequence(function_->end_position());
180
+ EmitReturnSequence(function()->end_position());
167
181
  }
168
182
 
169
183
 
170
- void FastCodeGenerator::EmitReturnSequence(int position) {
184
+ void FullCodeGenerator::EmitReturnSequence(int position) {
171
185
  Comment cmnt(masm_, "[ Return sequence");
172
186
  if (return_label_.is_bound()) {
173
187
  __ b(&return_label_);
@@ -180,41 +194,39 @@ void FastCodeGenerator::EmitReturnSequence(int position) {
180
194
  __ CallRuntime(Runtime::kTraceExit, 1);
181
195
  }
182
196
 
197
+ #ifdef DEBUG
183
198
  // Add a label for checking the size of the code used for returning.
184
199
  Label check_exit_codesize;
185
200
  masm_->bind(&check_exit_codesize);
186
-
187
- // Calculate the exact length of the return sequence and make sure that
188
- // the constant pool is not emitted inside of the return sequence.
189
- int num_parameters = function_->scope()->num_parameters();
190
- int32_t sp_delta = (num_parameters + 1) * kPointerSize;
191
- int return_sequence_length = Assembler::kJSReturnSequenceLength;
192
- if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
193
- // Additional mov instruction generated.
194
- return_sequence_length++;
201
+ #endif
202
+ // Make sure that the constant pool is not emitted inside of the return
203
+ // sequence.
204
+ { Assembler::BlockConstPoolScope block_const_pool(masm_);
205
+ // Here we use masm_-> instead of the __ macro to avoid the code coverage
206
+ // tool from instrumenting as we rely on the code size here.
207
+ int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize;
208
+ CodeGenerator::RecordPositions(masm_, position);
209
+ __ RecordJSReturn();
210
+ masm_->mov(sp, fp);
211
+ masm_->ldm(ia_w, sp, fp.bit() | lr.bit());
212
+ masm_->add(sp, sp, Operand(sp_delta));
213
+ masm_->Jump(lr);
195
214
  }
196
- masm_->BlockConstPoolFor(return_sequence_length);
197
-
198
- CodeGenerator::RecordPositions(masm_, position);
199
- __ RecordJSReturn();
200
- __ mov(sp, fp);
201
- __ ldm(ia_w, sp, fp.bit() | lr.bit());
202
- __ add(sp, sp, Operand(sp_delta));
203
- __ Jump(lr);
204
215
 
216
+ #ifdef DEBUG
205
217
  // Check that the size of the code used for returning matches what is
206
- // expected by the debugger. The add instruction above is an addressing
207
- // mode 1 instruction where there are restrictions on which immediate values
208
- // can be encoded in the instruction and which immediate values requires
209
- // use of an additional instruction for moving the immediate to a temporary
210
- // register.
211
- ASSERT_EQ(return_sequence_length,
212
- masm_->InstructionsGeneratedSince(&check_exit_codesize));
218
+ // expected by the debugger. If the sp_delts above cannot be encoded in the
219
+ // add instruction the add will generate two instructions.
220
+ int return_sequence_length =
221
+ masm_->InstructionsGeneratedSince(&check_exit_codesize);
222
+ CHECK(return_sequence_length == Assembler::kJSReturnSequenceLength ||
223
+ return_sequence_length == Assembler::kJSReturnSequenceLength + 1);
224
+ #endif
213
225
  }
214
226
  }
215
227
 
216
228
 
217
- void FastCodeGenerator::Apply(Expression::Context context, Register reg) {
229
+ void FullCodeGenerator::Apply(Expression::Context context, Register reg) {
218
230
  switch (context) {
219
231
  case Expression::kUninitialized:
220
232
  UNREACHABLE();
@@ -250,7 +262,7 @@ void FastCodeGenerator::Apply(Expression::Context context, Register reg) {
250
262
  }
251
263
 
252
264
 
253
- void FastCodeGenerator::Apply(Expression::Context context, Slot* slot) {
265
+ void FullCodeGenerator::Apply(Expression::Context context, Slot* slot) {
254
266
  switch (context) {
255
267
  case Expression::kUninitialized:
256
268
  UNREACHABLE();
@@ -270,7 +282,7 @@ void FastCodeGenerator::Apply(Expression::Context context, Slot* slot) {
270
282
  }
271
283
 
272
284
 
273
- void FastCodeGenerator::Apply(Expression::Context context, Literal* lit) {
285
+ void FullCodeGenerator::Apply(Expression::Context context, Literal* lit) {
274
286
  switch (context) {
275
287
  case Expression::kUninitialized:
276
288
  UNREACHABLE();
@@ -290,7 +302,7 @@ void FastCodeGenerator::Apply(Expression::Context context, Literal* lit) {
290
302
  }
291
303
 
292
304
 
293
- void FastCodeGenerator::ApplyTOS(Expression::Context context) {
305
+ void FullCodeGenerator::ApplyTOS(Expression::Context context) {
294
306
  switch (context) {
295
307
  case Expression::kUninitialized:
296
308
  UNREACHABLE();
@@ -323,7 +335,7 @@ void FastCodeGenerator::ApplyTOS(Expression::Context context) {
323
335
  }
324
336
 
325
337
 
326
- void FastCodeGenerator::DropAndApply(int count,
338
+ void FullCodeGenerator::DropAndApply(int count,
327
339
  Expression::Context context,
328
340
  Register reg) {
329
341
  ASSERT(count > 0);
@@ -371,7 +383,7 @@ void FastCodeGenerator::DropAndApply(int count,
371
383
  }
372
384
 
373
385
 
374
- void FastCodeGenerator::Apply(Expression::Context context,
386
+ void FullCodeGenerator::Apply(Expression::Context context,
375
387
  Label* materialize_true,
376
388
  Label* materialize_false) {
377
389
  switch (context) {
@@ -432,7 +444,7 @@ void FastCodeGenerator::Apply(Expression::Context context,
432
444
  }
433
445
 
434
446
 
435
- void FastCodeGenerator::DoTest(Expression::Context context) {
447
+ void FullCodeGenerator::DoTest(Expression::Context context) {
436
448
  // The value to test is pushed on the stack, and duplicated on the stack
437
449
  // if necessary (for value/test and test/value contexts).
438
450
  ASSERT_NE(NULL, true_label_);
@@ -495,14 +507,14 @@ void FastCodeGenerator::DoTest(Expression::Context context) {
495
507
  }
496
508
 
497
509
 
498
- MemOperand FastCodeGenerator::EmitSlotSearch(Slot* slot, Register scratch) {
510
+ MemOperand FullCodeGenerator::EmitSlotSearch(Slot* slot, Register scratch) {
499
511
  switch (slot->type()) {
500
512
  case Slot::PARAMETER:
501
513
  case Slot::LOCAL:
502
514
  return MemOperand(fp, SlotOffset(slot));
503
515
  case Slot::CONTEXT: {
504
516
  int context_chain_length =
505
- function_->scope()->ContextChainLength(slot->var()->scope());
517
+ scope()->ContextChainLength(slot->var()->scope());
506
518
  __ LoadContext(scratch, context_chain_length);
507
519
  return CodeGenerator::ContextOperand(scratch, slot->index());
508
520
  }
@@ -514,14 +526,14 @@ MemOperand FastCodeGenerator::EmitSlotSearch(Slot* slot, Register scratch) {
514
526
  }
515
527
 
516
528
 
517
- void FastCodeGenerator::Move(Register destination, Slot* source) {
529
+ void FullCodeGenerator::Move(Register destination, Slot* source) {
518
530
  // Use destination as scratch.
519
531
  MemOperand slot_operand = EmitSlotSearch(source, destination);
520
532
  __ ldr(destination, slot_operand);
521
533
  }
522
534
 
523
535
 
524
- void FastCodeGenerator::Move(Slot* dst,
536
+ void FullCodeGenerator::Move(Slot* dst,
525
537
  Register src,
526
538
  Register scratch1,
527
539
  Register scratch2) {
@@ -537,7 +549,7 @@ void FastCodeGenerator::Move(Slot* dst,
537
549
  }
538
550
 
539
551
 
540
- void FastCodeGenerator::VisitDeclaration(Declaration* decl) {
552
+ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
541
553
  Comment cmnt(masm_, "[ Declaration");
542
554
  Variable* var = decl->proxy()->var();
543
555
  ASSERT(var != NULL); // Must have been resolved.
@@ -562,7 +574,7 @@ void FastCodeGenerator::VisitDeclaration(Declaration* decl) {
562
574
  // this specific context.
563
575
 
564
576
  // The variable in the decl always resides in the current context.
565
- ASSERT_EQ(0, function_->scope()->ContextChainLength(var->scope()));
577
+ ASSERT_EQ(0, scope()->ContextChainLength(var->scope()));
566
578
  if (FLAG_debug_code) {
567
579
  // Check if we have the correct context pointer.
568
580
  __ ldr(r1,
@@ -581,7 +593,8 @@ void FastCodeGenerator::VisitDeclaration(Declaration* decl) {
581
593
  int offset = Context::SlotOffset(slot->index());
582
594
  __ mov(r2, Operand(offset));
583
595
  // We know that we have written a function, which is not a smi.
584
- __ RecordWrite(cp, r2, result_register());
596
+ __ mov(r1, Operand(cp));
597
+ __ RecordWrite(r1, r2, result_register());
585
598
  }
586
599
  break;
587
600
 
@@ -637,83 +650,76 @@ void FastCodeGenerator::VisitDeclaration(Declaration* decl) {
637
650
  }
638
651
 
639
652
 
640
- void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
653
+ void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
641
654
  // Call the runtime to declare the globals.
642
655
  // The context is the first argument.
643
656
  __ mov(r1, Operand(pairs));
644
- __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0)));
657
+ __ mov(r0, Operand(Smi::FromInt(is_eval() ? 1 : 0)));
645
658
  __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit());
646
659
  __ CallRuntime(Runtime::kDeclareGlobals, 3);
647
660
  // Return value is ignored.
648
661
  }
649
662
 
650
663
 
651
- void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
664
+ void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
652
665
  Comment cmnt(masm_, "[ FunctionLiteral");
653
666
 
654
- // Build the function boilerplate and instantiate it.
655
- Handle<JSFunction> boilerplate =
656
- Compiler::BuildBoilerplate(expr, script_, this);
667
+ // Build the shared function info and instantiate the function based
668
+ // on it.
669
+ Handle<SharedFunctionInfo> function_info =
670
+ Compiler::BuildFunctionInfo(expr, script(), this);
657
671
  if (HasStackOverflow()) return;
658
672
 
659
- ASSERT(boilerplate->IsBoilerplate());
660
-
661
673
  // Create a new closure.
662
- __ mov(r0, Operand(boilerplate));
674
+ __ mov(r0, Operand(function_info));
663
675
  __ stm(db_w, sp, cp.bit() | r0.bit());
664
676
  __ CallRuntime(Runtime::kNewClosure, 2);
665
- Apply(expr->context(), r0);
677
+ Apply(context_, r0);
666
678
  }
667
679
 
668
680
 
669
- void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
681
+ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
670
682
  Comment cmnt(masm_, "[ VariableProxy");
671
- EmitVariableLoad(expr->var(), expr->context());
683
+ EmitVariableLoad(expr->var(), context_);
672
684
  }
673
685
 
674
686
 
675
- void FastCodeGenerator::EmitVariableLoad(Variable* var,
687
+ void FullCodeGenerator::EmitVariableLoad(Variable* var,
676
688
  Expression::Context context) {
677
- Expression* rewrite = var->rewrite();
678
- if (rewrite == NULL) {
679
- ASSERT(var->is_global());
689
+ // Four cases: non-this global variables, lookup slots, all other
690
+ // types of slots, and parameters that rewrite to explicit property
691
+ // accesses on the arguments object.
692
+ Slot* slot = var->slot();
693
+ Property* property = var->AsProperty();
694
+
695
+ if (var->is_global() && !var->is_this()) {
680
696
  Comment cmnt(masm_, "Global variable");
681
697
  // Use inline caching. Variable name is passed in r2 and the global
682
698
  // object on the stack.
683
- __ ldr(ip, CodeGenerator::GlobalObject());
684
- __ push(ip);
699
+ __ ldr(r0, CodeGenerator::GlobalObject());
700
+ __ push(r0);
685
701
  __ mov(r2, Operand(var->name()));
686
702
  Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
687
703
  __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
688
704
  DropAndApply(1, context, r0);
689
- } else if (rewrite->AsSlot() != NULL) {
690
- Slot* slot = rewrite->AsSlot();
691
- if (FLAG_debug_code) {
692
- switch (slot->type()) {
693
- case Slot::PARAMETER:
694
- case Slot::LOCAL: {
695
- Comment cmnt(masm_, "Stack slot");
696
- break;
697
- }
698
- case Slot::CONTEXT: {
699
- Comment cmnt(masm_, "Context slot");
700
- break;
701
- }
702
- case Slot::LOOKUP:
703
- UNIMPLEMENTED();
704
- break;
705
- }
706
- }
705
+
706
+ } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
707
+ Comment cmnt(masm_, "Lookup slot");
708
+ __ mov(r1, Operand(var->name()));
709
+ __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name.
710
+ __ CallRuntime(Runtime::kLoadContextSlot, 2);
711
+ Apply(context, r0);
712
+
713
+ } else if (slot != NULL) {
714
+ Comment cmnt(masm_, (slot->type() == Slot::CONTEXT)
715
+ ? "Context slot"
716
+ : "Stack slot");
707
717
  Apply(context, slot);
718
+
708
719
  } else {
709
- Comment cmnt(masm_, "Variable rewritten to property");
710
- // A variable has been rewritten into an explicit access to an object
711
- // property.
712
- Property* property = rewrite->AsProperty();
720
+ Comment cmnt(masm_, "Rewritten parameter");
713
721
  ASSERT_NOT_NULL(property);
714
-
715
- // The only property expressions that can occur are of the form
716
- // "slot[literal]".
722
+ // Rewritten parameter accesses are of the form "slot[literal]".
717
723
 
718
724
  // Assert that the object is in a slot.
719
725
  Variable* object_var = property->obj()->AsVariableProxy()->AsVariable();
@@ -722,7 +728,7 @@ void FastCodeGenerator::EmitVariableLoad(Variable* var,
722
728
  ASSERT_NOT_NULL(object_slot);
723
729
 
724
730
  // Load the object.
725
- Move(r2, object_slot);
731
+ Move(r1, object_slot);
726
732
 
727
733
  // Assert that the key is a smi.
728
734
  Literal* key_literal = property->key()->AsLiteral();
@@ -730,12 +736,12 @@ void FastCodeGenerator::EmitVariableLoad(Variable* var,
730
736
  ASSERT(key_literal->handle()->IsSmi());
731
737
 
732
738
  // Load the key.
733
- __ mov(r1, Operand(key_literal->handle()));
739
+ __ mov(r0, Operand(key_literal->handle()));
734
740
 
735
741
  // Push both as arguments to ic.
736
- __ stm(db_w, sp, r2.bit() | r1.bit());
742
+ __ Push(r1, r0);
737
743
 
738
- // Do a keyed property load.
744
+ // Call keyed load IC. It has all arguments on the stack and the key in r0.
739
745
  Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
740
746
  __ Call(ic, RelocInfo::CODE_TARGET);
741
747
 
@@ -745,7 +751,7 @@ void FastCodeGenerator::EmitVariableLoad(Variable* var,
745
751
  }
746
752
 
747
753
 
748
- void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
754
+ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
749
755
  Comment cmnt(masm_, "[ RegExpLiteral");
750
756
  Label done;
751
757
  // Registers will be used as follows:
@@ -765,24 +771,25 @@ void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
765
771
  __ mov(r3, Operand(Smi::FromInt(expr->literal_index())));
766
772
  __ mov(r2, Operand(expr->pattern()));
767
773
  __ mov(r1, Operand(expr->flags()));
768
- __ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit());
774
+ __ Push(r4, r3, r2, r1);
769
775
  __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4);
770
776
  __ bind(&done);
771
- Apply(expr->context(), r0);
777
+ Apply(context_, r0);
772
778
  }
773
779
 
774
780
 
775
- void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
781
+ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
776
782
  Comment cmnt(masm_, "[ ObjectLiteral");
777
- __ ldr(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
778
- __ ldr(r2, FieldMemOperand(r2, JSFunction::kLiteralsOffset));
779
- __ mov(r1, Operand(Smi::FromInt(expr->literal_index())));
780
- __ mov(r0, Operand(expr->constant_properties()));
781
- __ stm(db_w, sp, r2.bit() | r1.bit() | r0.bit());
783
+ __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
784
+ __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
785
+ __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
786
+ __ mov(r1, Operand(expr->constant_properties()));
787
+ __ mov(r0, Operand(Smi::FromInt(expr->fast_elements() ? 1 : 0)));
788
+ __ Push(r3, r2, r1, r0);
782
789
  if (expr->depth() > 1) {
783
- __ CallRuntime(Runtime::kCreateObjectLiteral, 3);
790
+ __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
784
791
  } else {
785
- __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 3);
792
+ __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
786
793
  }
787
794
 
788
795
  // If result_saved is true the result is on top of the stack. If
@@ -809,9 +816,9 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
809
816
  if (key->handle()->IsSymbol()) {
810
817
  VisitForValue(value, kAccumulator);
811
818
  __ mov(r2, Operand(key->handle()));
819
+ __ ldr(r1, MemOperand(sp));
812
820
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
813
821
  __ Call(ic, RelocInfo::CODE_TARGET);
814
- // StoreIC leaves the receiver on the stack.
815
822
  break;
816
823
  }
817
824
  // Fall through.
@@ -840,20 +847,20 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
840
847
  }
841
848
 
842
849
  if (result_saved) {
843
- ApplyTOS(expr->context());
850
+ ApplyTOS(context_);
844
851
  } else {
845
- Apply(expr->context(), r0);
852
+ Apply(context_, r0);
846
853
  }
847
854
  }
848
855
 
849
856
 
850
- void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
857
+ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
851
858
  Comment cmnt(masm_, "[ ArrayLiteral");
852
859
  __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
853
860
  __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
854
861
  __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
855
862
  __ mov(r1, Operand(expr->constant_elements()));
856
- __ stm(db_w, sp, r3.bit() | r2.bit() | r1.bit());
863
+ __ Push(r3, r2, r1);
857
864
  if (expr->depth() > 1) {
858
865
  __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
859
866
  } else {
@@ -893,53 +900,151 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
893
900
  }
894
901
 
895
902
  if (result_saved) {
896
- ApplyTOS(expr->context());
903
+ ApplyTOS(context_);
897
904
  } else {
898
- Apply(expr->context(), r0);
905
+ Apply(context_, r0);
906
+ }
907
+ }
908
+
909
+
910
+ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
911
+ Comment cmnt(masm_, "[ Assignment");
912
+ ASSERT(expr->op() != Token::INIT_CONST);
913
+ // Left-hand side can only be a property, a global or a (parameter or local)
914
+ // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY.
915
+ enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
916
+ LhsKind assign_type = VARIABLE;
917
+ Property* prop = expr->target()->AsProperty();
918
+ if (prop != NULL) {
919
+ assign_type =
920
+ (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
921
+ }
922
+
923
+ // Evaluate LHS expression.
924
+ switch (assign_type) {
925
+ case VARIABLE:
926
+ // Nothing to do here.
927
+ break;
928
+ case NAMED_PROPERTY:
929
+ if (expr->is_compound()) {
930
+ // We need the receiver both on the stack and in the accumulator.
931
+ VisitForValue(prop->obj(), kAccumulator);
932
+ __ push(result_register());
933
+ } else {
934
+ VisitForValue(prop->obj(), kStack);
935
+ }
936
+ break;
937
+ case KEYED_PROPERTY:
938
+ VisitForValue(prop->obj(), kStack);
939
+ VisitForValue(prop->key(), kStack);
940
+ break;
941
+ }
942
+
943
+ // If we have a compound assignment: Get value of LHS expression and
944
+ // store in on top of the stack.
945
+ if (expr->is_compound()) {
946
+ Location saved_location = location_;
947
+ location_ = kStack;
948
+ switch (assign_type) {
949
+ case VARIABLE:
950
+ EmitVariableLoad(expr->target()->AsVariableProxy()->var(),
951
+ Expression::kValue);
952
+ break;
953
+ case NAMED_PROPERTY:
954
+ EmitNamedPropertyLoad(prop);
955
+ __ push(result_register());
956
+ break;
957
+ case KEYED_PROPERTY:
958
+ EmitKeyedPropertyLoad(prop);
959
+ __ push(result_register());
960
+ break;
961
+ }
962
+ location_ = saved_location;
963
+ }
964
+
965
+ // Evaluate RHS expression.
966
+ Expression* rhs = expr->value();
967
+ VisitForValue(rhs, kAccumulator);
968
+
969
+ // If we have a compound assignment: Apply operator.
970
+ if (expr->is_compound()) {
971
+ Location saved_location = location_;
972
+ location_ = kAccumulator;
973
+ EmitBinaryOp(expr->binary_op(), Expression::kValue);
974
+ location_ = saved_location;
975
+ }
976
+
977
+ // Record source position before possible IC call.
978
+ SetSourcePosition(expr->position());
979
+
980
+ // Store the value.
981
+ switch (assign_type) {
982
+ case VARIABLE:
983
+ EmitVariableAssignment(expr->target()->AsVariableProxy()->var(),
984
+ context_);
985
+ break;
986
+ case NAMED_PROPERTY:
987
+ EmitNamedPropertyAssignment(expr);
988
+ break;
989
+ case KEYED_PROPERTY:
990
+ EmitKeyedPropertyAssignment(expr);
991
+ break;
899
992
  }
900
993
  }
901
994
 
902
995
 
903
- void FastCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
996
+ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
904
997
  SetSourcePosition(prop->position());
905
998
  Literal* key = prop->key()->AsLiteral();
906
999
  __ mov(r2, Operand(key->handle()));
1000
+ __ ldr(r0, MemOperand(sp, 0));
907
1001
  Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
908
1002
  __ Call(ic, RelocInfo::CODE_TARGET);
909
1003
  }
910
1004
 
911
1005
 
912
- void FastCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
1006
+ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
913
1007
  SetSourcePosition(prop->position());
1008
+ // Call keyed load IC. It has all arguments on the stack and the key in r0.
1009
+ __ ldr(r0, MemOperand(sp, 0));
914
1010
  Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
915
1011
  __ Call(ic, RelocInfo::CODE_TARGET);
916
1012
  }
917
1013
 
918
1014
 
919
- void FastCodeGenerator::EmitBinaryOp(Token::Value op,
1015
+ void FullCodeGenerator::EmitBinaryOp(Token::Value op,
920
1016
  Expression::Context context) {
921
1017
  __ pop(r1);
922
- GenericBinaryOpStub stub(op, NO_OVERWRITE);
1018
+ GenericBinaryOpStub stub(op, NO_OVERWRITE, r1, r0);
923
1019
  __ CallStub(&stub);
924
1020
  Apply(context, r0);
925
1021
  }
926
1022
 
927
1023
 
928
- void FastCodeGenerator::EmitVariableAssignment(Variable* var,
1024
+ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
929
1025
  Expression::Context context) {
1026
+ // Three main cases: global variables, lookup slots, and all other
1027
+ // types of slots. Left-hand-side parameters that rewrite to
1028
+ // explicit property accesses do not reach here.
930
1029
  ASSERT(var != NULL);
931
1030
  ASSERT(var->is_global() || var->slot() != NULL);
1031
+
1032
+ Slot* slot = var->slot();
932
1033
  if (var->is_global()) {
1034
+ ASSERT(!var->is_this());
933
1035
  // Assignment to a global variable. Use inline caching for the
934
1036
  // assignment. Right-hand-side value is passed in r0, variable name in
935
- // r2, and the global object on the stack.
1037
+ // r2, and the global object in r1.
936
1038
  __ mov(r2, Operand(var->name()));
937
- __ ldr(ip, CodeGenerator::GlobalObject());
938
- __ push(ip);
1039
+ __ ldr(r1, CodeGenerator::GlobalObject());
939
1040
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
940
1041
  __ Call(ic, RelocInfo::CODE_TARGET);
941
- // Overwrite the global object on the stack with the result if needed.
942
- DropAndApply(1, context, r0);
1042
+
1043
+ } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
1044
+ __ push(result_register()); // Value.
1045
+ __ mov(r1, Operand(var->name()));
1046
+ __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name.
1047
+ __ CallRuntime(Runtime::kStoreContextSlot, 3);
943
1048
 
944
1049
  } else if (var->slot() != NULL) {
945
1050
  Slot* slot = var->slot();
@@ -966,16 +1071,17 @@ void FastCodeGenerator::EmitVariableAssignment(Variable* var,
966
1071
  UNREACHABLE();
967
1072
  break;
968
1073
  }
969
- Apply(context, result_register());
1074
+
970
1075
  } else {
971
1076
  // Variables rewritten as properties are not treated as variables in
972
1077
  // assignments.
973
1078
  UNREACHABLE();
974
1079
  }
1080
+ Apply(context, result_register());
975
1081
  }
976
1082
 
977
1083
 
978
- void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
1084
+ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
979
1085
  // Assignment to a property, using a named store IC.
980
1086
  Property* prop = expr->target()->AsProperty();
981
1087
  ASSERT(prop != NULL);
@@ -995,6 +1101,12 @@ void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
995
1101
  // Record source code position before IC call.
996
1102
  SetSourcePosition(expr->position());
997
1103
  __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1104
+ if (expr->ends_initialization_block()) {
1105
+ __ ldr(r1, MemOperand(sp));
1106
+ } else {
1107
+ __ pop(r1);
1108
+ }
1109
+
998
1110
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
999
1111
  __ Call(ic, RelocInfo::CODE_TARGET);
1000
1112
 
@@ -1005,13 +1117,14 @@ void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
1005
1117
  __ push(ip);
1006
1118
  __ CallRuntime(Runtime::kToFastProperties, 1);
1007
1119
  __ pop(r0);
1120
+ DropAndApply(1, context_, r0);
1121
+ } else {
1122
+ Apply(context_, r0);
1008
1123
  }
1009
-
1010
- DropAndApply(1, expr->context(), r0);
1011
1124
  }
1012
1125
 
1013
1126
 
1014
- void FastCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
1127
+ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
1015
1128
  // Assignment to a property, using a keyed store IC.
1016
1129
 
1017
1130
  // If the assignment starts a block of assignments to the same object,
@@ -1042,11 +1155,11 @@ void FastCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
1042
1155
  }
1043
1156
 
1044
1157
  // Receiver and key are still on stack.
1045
- DropAndApply(2, expr->context(), r0);
1158
+ DropAndApply(2, context_, r0);
1046
1159
  }
1047
1160
 
1048
1161
 
1049
- void FastCodeGenerator::VisitProperty(Property* expr) {
1162
+ void FullCodeGenerator::VisitProperty(Property* expr) {
1050
1163
  Comment cmnt(masm_, "[ Property");
1051
1164
  Expression* key = expr->key();
1052
1165
 
@@ -1056,17 +1169,17 @@ void FastCodeGenerator::VisitProperty(Property* expr) {
1056
1169
  if (key->IsPropertyName()) {
1057
1170
  EmitNamedPropertyLoad(expr);
1058
1171
  // Drop receiver left on the stack by IC.
1059
- DropAndApply(1, expr->context(), r0);
1172
+ DropAndApply(1, context_, r0);
1060
1173
  } else {
1061
1174
  VisitForValue(expr->key(), kStack);
1062
1175
  EmitKeyedPropertyLoad(expr);
1063
1176
  // Drop key and receiver left on the stack by IC.
1064
- DropAndApply(2, expr->context(), r0);
1177
+ DropAndApply(2, context_, r0);
1065
1178
  }
1066
1179
  }
1067
1180
 
1068
- void FastCodeGenerator::EmitCallWithIC(Call* expr,
1069
- Handle<Object> ignored,
1181
+ void FullCodeGenerator::EmitCallWithIC(Call* expr,
1182
+ Handle<Object> name,
1070
1183
  RelocInfo::Mode mode) {
1071
1184
  // Code common for calls using the IC.
1072
1185
  ZoneList<Expression*>* args = expr->arguments();
@@ -1074,20 +1187,20 @@ void FastCodeGenerator::EmitCallWithIC(Call* expr,
1074
1187
  for (int i = 0; i < arg_count; i++) {
1075
1188
  VisitForValue(args->at(i), kStack);
1076
1189
  }
1190
+ __ mov(r2, Operand(name));
1077
1191
  // Record source position for debugger.
1078
1192
  SetSourcePosition(expr->position());
1079
1193
  // Call the IC initialization code.
1080
- Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
1081
- NOT_IN_LOOP);
1194
+ InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1195
+ Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop);
1082
1196
  __ Call(ic, mode);
1083
1197
  // Restore context register.
1084
1198
  __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1085
- // Discard the function left on TOS.
1086
- DropAndApply(1, expr->context(), r0);
1199
+ Apply(context_, r0);
1087
1200
  }
1088
1201
 
1089
1202
 
1090
- void FastCodeGenerator::EmitCallWithStub(Call* expr) {
1203
+ void FullCodeGenerator::EmitCallWithStub(Call* expr) {
1091
1204
  // Code common for calls using the call stub.
1092
1205
  ZoneList<Expression*>* args = expr->arguments();
1093
1206
  int arg_count = args->length();
@@ -1096,16 +1209,15 @@ void FastCodeGenerator::EmitCallWithStub(Call* expr) {
1096
1209
  }
1097
1210
  // Record source position for debugger.
1098
1211
  SetSourcePosition(expr->position());
1099
- CallFunctionStub stub(arg_count, NOT_IN_LOOP);
1212
+ CallFunctionStub stub(arg_count, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
1100
1213
  __ CallStub(&stub);
1101
1214
  // Restore context register.
1102
1215
  __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1103
- // Discard the function left on TOS.
1104
- DropAndApply(1, expr->context(), r0);
1216
+ DropAndApply(1, context_, r0);
1105
1217
  }
1106
1218
 
1107
1219
 
1108
- void FastCodeGenerator::VisitCall(Call* expr) {
1220
+ void FullCodeGenerator::VisitCall(Call* expr) {
1109
1221
  Comment cmnt(masm_, "[ Call");
1110
1222
  Expression* fun = expr->expression();
1111
1223
  Variable* var = fun->AsVariableProxy()->AsVariable();
@@ -1114,11 +1226,9 @@ void FastCodeGenerator::VisitCall(Call* expr) {
1114
1226
  // Call to the identifier 'eval'.
1115
1227
  UNREACHABLE();
1116
1228
  } else if (var != NULL && !var->is_this() && var->is_global()) {
1117
- // Call to a global variable.
1118
- __ mov(r1, Operand(var->name()));
1119
- // Push global object as receiver for the call IC lookup.
1229
+ // Push global object as receiver for the call IC.
1120
1230
  __ ldr(r0, CodeGenerator::GlobalObject());
1121
- __ stm(db_w, sp, r1.bit() | r0.bit());
1231
+ __ push(r0);
1122
1232
  EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT);
1123
1233
  } else if (var != NULL && var->slot() != NULL &&
1124
1234
  var->slot()->type() == Slot::LOOKUP) {
@@ -1130,8 +1240,6 @@ void FastCodeGenerator::VisitCall(Call* expr) {
1130
1240
  Literal* key = prop->key()->AsLiteral();
1131
1241
  if (key != NULL && key->handle()->IsSymbol()) {
1132
1242
  // Call to a named property, use call IC.
1133
- __ mov(r0, Operand(key->handle()));
1134
- __ push(r0);
1135
1243
  VisitForValue(prop->obj(), kStack);
1136
1244
  EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
1137
1245
  } else {
@@ -1141,6 +1249,9 @@ void FastCodeGenerator::VisitCall(Call* expr) {
1141
1249
  VisitForValue(prop->key(), kStack);
1142
1250
  // Record source code position for IC call.
1143
1251
  SetSourcePosition(prop->position());
1252
+ // Call keyed load IC. It has all arguments on the stack and the key in
1253
+ // r0.
1254
+ __ ldr(r0, MemOperand(sp, 0));
1144
1255
  Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1145
1256
  __ Call(ic, RelocInfo::CODE_TARGET);
1146
1257
  // Load receiver object into r1.
@@ -1163,7 +1274,7 @@ void FastCodeGenerator::VisitCall(Call* expr) {
1163
1274
  if (lit != NULL &&
1164
1275
  lit->name()->Equals(Heap::empty_string()) &&
1165
1276
  loop_depth() == 0) {
1166
- lit->set_try_fast_codegen(true);
1277
+ lit->set_try_full_codegen(true);
1167
1278
  }
1168
1279
  VisitForValue(fun, kStack);
1169
1280
  // Load global receiver object.
@@ -1176,7 +1287,7 @@ void FastCodeGenerator::VisitCall(Call* expr) {
1176
1287
  }
1177
1288
 
1178
1289
 
1179
- void FastCodeGenerator::VisitCallNew(CallNew* expr) {
1290
+ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
1180
1291
  Comment cmnt(masm_, "[ CallNew");
1181
1292
  // According to ECMA-262, section 11.2.2, page 44, the function
1182
1293
  // expression in new calls must be evaluated before the
@@ -1207,20 +1318,19 @@ void FastCodeGenerator::VisitCallNew(CallNew* expr) {
1207
1318
  __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
1208
1319
 
1209
1320
  // Replace function on TOS with result in r0, or pop it.
1210
- DropAndApply(1, expr->context(), r0);
1321
+ DropAndApply(1, context_, r0);
1211
1322
  }
1212
1323
 
1213
1324
 
1214
- void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1325
+ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1215
1326
  Comment cmnt(masm_, "[ CallRuntime");
1216
1327
  ZoneList<Expression*>* args = expr->arguments();
1217
1328
 
1218
1329
  if (expr->is_jsruntime()) {
1219
1330
  // Prepare for calling JS runtime function.
1220
- __ mov(r1, Operand(expr->name()));
1221
1331
  __ ldr(r0, CodeGenerator::GlobalObject());
1222
1332
  __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset));
1223
- __ stm(db_w, sp, r1.bit() | r0.bit());
1333
+ __ push(r0);
1224
1334
  }
1225
1335
 
1226
1336
  // Push the arguments ("left-to-right").
@@ -1231,28 +1341,26 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1231
1341
 
1232
1342
  if (expr->is_jsruntime()) {
1233
1343
  // Call the JS runtime function.
1344
+ __ mov(r2, Operand(expr->name()));
1234
1345
  Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
1235
1346
  NOT_IN_LOOP);
1236
1347
  __ Call(ic, RelocInfo::CODE_TARGET);
1237
1348
  // Restore context register.
1238
1349
  __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1239
- // Discard the function left on TOS.
1240
- DropAndApply(1, expr->context(), r0);
1241
1350
  } else {
1242
1351
  // Call the C runtime function.
1243
1352
  __ CallRuntime(expr->function(), arg_count);
1244
- Apply(expr->context(), r0);
1245
1353
  }
1354
+ Apply(context_, r0);
1246
1355
  }
1247
1356
 
1248
1357
 
1249
- void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1358
+ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1250
1359
  switch (expr->op()) {
1251
1360
  case Token::VOID: {
1252
1361
  Comment cmnt(masm_, "[ UnaryOperation (VOID)");
1253
- ASSERT_EQ(Expression::kEffect, expr->expression()->context());
1254
- Visit(expr->expression());
1255
- switch (expr->context()) {
1362
+ VisitForEffect(expr->expression());
1363
+ switch (context_) {
1256
1364
  case Expression::kUninitialized:
1257
1365
  UNREACHABLE();
1258
1366
  break;
@@ -1289,14 +1397,12 @@ void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1289
1397
 
1290
1398
  case Token::NOT: {
1291
1399
  Comment cmnt(masm_, "[ UnaryOperation (NOT)");
1292
- ASSERT_EQ(Expression::kTest, expr->expression()->context());
1293
-
1294
1400
  Label materialize_true, materialize_false, done;
1295
1401
  // Initially assume a pure test context. Notice that the labels are
1296
1402
  // swapped.
1297
1403
  Label* if_true = false_label_;
1298
1404
  Label* if_false = true_label_;
1299
- switch (expr->context()) {
1405
+ switch (context_) {
1300
1406
  case Expression::kUninitialized:
1301
1407
  UNREACHABLE();
1302
1408
  break;
@@ -1318,14 +1424,12 @@ void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1318
1424
  break;
1319
1425
  }
1320
1426
  VisitForControl(expr->expression(), if_true, if_false);
1321
- Apply(expr->context(), if_false, if_true); // Labels swapped.
1427
+ Apply(context_, if_false, if_true); // Labels swapped.
1322
1428
  break;
1323
1429
  }
1324
1430
 
1325
1431
  case Token::TYPEOF: {
1326
1432
  Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)");
1327
- ASSERT_EQ(Expression::kValue, expr->expression()->context());
1328
-
1329
1433
  VariableProxy* proxy = expr->expression()->AsVariableProxy();
1330
1434
  if (proxy != NULL &&
1331
1435
  !proxy->var()->is_this() &&
@@ -1352,7 +1456,60 @@ void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1352
1456
  }
1353
1457
 
1354
1458
  __ CallRuntime(Runtime::kTypeof, 1);
1355
- Apply(expr->context(), r0);
1459
+ Apply(context_, r0);
1460
+ break;
1461
+ }
1462
+
1463
+ case Token::ADD: {
1464
+ Comment cmt(masm_, "[ UnaryOperation (ADD)");
1465
+ VisitForValue(expr->expression(), kAccumulator);
1466
+ Label no_conversion;
1467
+ __ tst(result_register(), Operand(kSmiTagMask));
1468
+ __ b(eq, &no_conversion);
1469
+ __ push(r0);
1470
+ __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS);
1471
+ __ bind(&no_conversion);
1472
+ Apply(context_, result_register());
1473
+ break;
1474
+ }
1475
+
1476
+ case Token::SUB: {
1477
+ Comment cmt(masm_, "[ UnaryOperation (SUB)");
1478
+ bool overwrite =
1479
+ (expr->expression()->AsBinaryOperation() != NULL &&
1480
+ expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
1481
+ GenericUnaryOpStub stub(Token::SUB, overwrite);
1482
+ // GenericUnaryOpStub expects the argument to be in the
1483
+ // accumulator register r0.
1484
+ VisitForValue(expr->expression(), kAccumulator);
1485
+ __ CallStub(&stub);
1486
+ Apply(context_, r0);
1487
+ break;
1488
+ }
1489
+
1490
+ case Token::BIT_NOT: {
1491
+ Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)");
1492
+ bool overwrite =
1493
+ (expr->expression()->AsBinaryOperation() != NULL &&
1494
+ expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
1495
+ GenericUnaryOpStub stub(Token::BIT_NOT, overwrite);
1496
+ // GenericUnaryOpStub expects the argument to be in the
1497
+ // accumulator register r0.
1498
+ VisitForValue(expr->expression(), kAccumulator);
1499
+ // Avoid calling the stub for Smis.
1500
+ Label smi, done;
1501
+ __ tst(result_register(), Operand(kSmiTagMask));
1502
+ __ b(eq, &smi);
1503
+ // Non-smi: call stub leaving result in accumulator register.
1504
+ __ CallStub(&stub);
1505
+ __ b(&done);
1506
+ // Perform operation directly on Smis.
1507
+ __ bind(&smi);
1508
+ __ mvn(result_register(), Operand(result_register()));
1509
+ // Bit-clear inverted smi-tag.
1510
+ __ bic(result_register(), result_register(), Operand(kSmiTagMask));
1511
+ __ bind(&done);
1512
+ Apply(context_, result_register());
1356
1513
  break;
1357
1514
  }
1358
1515
 
@@ -1362,7 +1519,7 @@ void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1362
1519
  }
1363
1520
 
1364
1521
 
1365
- void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1522
+ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
1366
1523
  Comment cmnt(masm_, "[ CountOperation");
1367
1524
 
1368
1525
  // Expression can only be a property, a global or a (parameter or local)
@@ -1373,23 +1530,21 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1373
1530
  // In case of a property we use the uninitialized expression context
1374
1531
  // of the key to detect a named property.
1375
1532
  if (prop != NULL) {
1376
- assign_type = (prop->key()->context() == Expression::kUninitialized)
1377
- ? NAMED_PROPERTY
1378
- : KEYED_PROPERTY;
1533
+ assign_type =
1534
+ (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
1379
1535
  }
1380
1536
 
1381
1537
  // Evaluate expression and get value.
1382
1538
  if (assign_type == VARIABLE) {
1383
1539
  ASSERT(expr->expression()->AsVariableProxy()->var() != NULL);
1384
1540
  Location saved_location = location_;
1385
- location_ = kStack;
1541
+ location_ = kAccumulator;
1386
1542
  EmitVariableLoad(expr->expression()->AsVariableProxy()->var(),
1387
1543
  Expression::kValue);
1388
1544
  location_ = saved_location;
1389
1545
  } else {
1390
1546
  // Reserve space for result of postfix operation.
1391
- if (expr->is_postfix() && expr->context() != Expression::kEffect) {
1392
- ASSERT(expr->context() != Expression::kUninitialized);
1547
+ if (expr->is_postfix() && context_ != Expression::kEffect) {
1393
1548
  __ mov(ip, Operand(Smi::FromInt(0)));
1394
1549
  __ push(ip);
1395
1550
  }
@@ -1400,15 +1555,19 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1400
1555
  VisitForValue(prop->key(), kStack);
1401
1556
  EmitKeyedPropertyLoad(prop);
1402
1557
  }
1403
- __ push(r0);
1404
1558
  }
1405
1559
 
1406
- // Convert to number.
1560
+ // Call ToNumber only if operand is not a smi.
1561
+ Label no_conversion;
1562
+ __ tst(r0, Operand(kSmiTagMask));
1563
+ __ b(eq, &no_conversion);
1564
+ __ push(r0);
1407
1565
  __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS);
1566
+ __ bind(&no_conversion);
1408
1567
 
1409
1568
  // Save result for postfix expressions.
1410
1569
  if (expr->is_postfix()) {
1411
- switch (expr->context()) {
1570
+ switch (context_) {
1412
1571
  case Expression::kUninitialized:
1413
1572
  UNREACHABLE();
1414
1573
  case Expression::kEffect:
@@ -1436,12 +1595,25 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1436
1595
  }
1437
1596
  }
1438
1597
 
1439
- // Call stub for +1/-1.
1440
- __ mov(r1, Operand(expr->op() == Token::INC
1441
- ? Smi::FromInt(1)
1442
- : Smi::FromInt(-1)));
1443
- GenericBinaryOpStub stub(Token::ADD, NO_OVERWRITE);
1598
+
1599
+ // Inline smi case if we are in a loop.
1600
+ Label stub_call, done;
1601
+ int count_value = expr->op() == Token::INC ? 1 : -1;
1602
+ if (loop_depth() > 0) {
1603
+ __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
1604
+ __ b(vs, &stub_call);
1605
+ // We could eliminate this smi check if we split the code at
1606
+ // the first smi check before calling ToNumber.
1607
+ __ tst(r0, Operand(kSmiTagMask));
1608
+ __ b(eq, &done);
1609
+ __ bind(&stub_call);
1610
+ // Call stub. Undo operation first.
1611
+ __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
1612
+ }
1613
+ __ mov(r1, Operand(Smi::FromInt(count_value)));
1614
+ GenericBinaryOpStub stub(Token::ADD, NO_OVERWRITE, r1, r0);
1444
1615
  __ CallStub(&stub);
1616
+ __ bind(&done);
1445
1617
 
1446
1618
  // Store the value returned in r0.
1447
1619
  switch (assign_type) {
@@ -1451,25 +1623,25 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1451
1623
  Expression::kEffect);
1452
1624
  // For all contexts except kEffect: We have the result on
1453
1625
  // top of the stack.
1454
- if (expr->context() != Expression::kEffect) {
1455
- ApplyTOS(expr->context());
1626
+ if (context_ != Expression::kEffect) {
1627
+ ApplyTOS(context_);
1456
1628
  }
1457
1629
  } else {
1458
1630
  EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
1459
- expr->context());
1631
+ context_);
1460
1632
  }
1461
1633
  break;
1462
1634
  case NAMED_PROPERTY: {
1463
1635
  __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1636
+ __ pop(r1);
1464
1637
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1465
1638
  __ Call(ic, RelocInfo::CODE_TARGET);
1466
1639
  if (expr->is_postfix()) {
1467
- __ Drop(1); // Result is on the stack under the receiver.
1468
- if (expr->context() != Expression::kEffect) {
1469
- ApplyTOS(expr->context());
1640
+ if (context_ != Expression::kEffect) {
1641
+ ApplyTOS(context_);
1470
1642
  }
1471
1643
  } else {
1472
- DropAndApply(1, expr->context(), r0);
1644
+ Apply(context_, r0);
1473
1645
  }
1474
1646
  break;
1475
1647
  }
@@ -1478,11 +1650,11 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1478
1650
  __ Call(ic, RelocInfo::CODE_TARGET);
1479
1651
  if (expr->is_postfix()) {
1480
1652
  __ Drop(2); // Result is on the stack under the key and the receiver.
1481
- if (expr->context() != Expression::kEffect) {
1482
- ApplyTOS(expr->context());
1653
+ if (context_ != Expression::kEffect) {
1654
+ ApplyTOS(context_);
1483
1655
  }
1484
1656
  } else {
1485
- DropAndApply(2, expr->context(), r0);
1657
+ DropAndApply(2, context_, r0);
1486
1658
  }
1487
1659
  break;
1488
1660
  }
@@ -1490,13 +1662,11 @@ void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1490
1662
  }
1491
1663
 
1492
1664
 
1493
- void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
1665
+ void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
1494
1666
  Comment cmnt(masm_, "[ BinaryOperation");
1495
1667
  switch (expr->op()) {
1496
1668
  case Token::COMMA:
1497
- ASSERT_EQ(Expression::kEffect, expr->left()->context());
1498
- ASSERT_EQ(expr->context(), expr->right()->context());
1499
- Visit(expr->left());
1669
+ VisitForEffect(expr->left());
1500
1670
  Visit(expr->right());
1501
1671
  break;
1502
1672
 
@@ -1518,7 +1688,7 @@ void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
1518
1688
  case Token::SAR:
1519
1689
  VisitForValue(expr->left(), kStack);
1520
1690
  VisitForValue(expr->right(), kAccumulator);
1521
- EmitBinaryOp(expr->op(), expr->context());
1691
+ EmitBinaryOp(expr->op(), context_);
1522
1692
  break;
1523
1693
 
1524
1694
  default:
@@ -1527,7 +1697,7 @@ void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
1527
1697
  }
1528
1698
 
1529
1699
 
1530
- void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1700
+ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1531
1701
  Comment cmnt(masm_, "[ CompareOperation");
1532
1702
 
1533
1703
  // Always perform the comparison for its control flow. Pack the result
@@ -1536,7 +1706,7 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1536
1706
  // Initially assume we are in a test context.
1537
1707
  Label* if_true = true_label_;
1538
1708
  Label* if_false = false_label_;
1539
- switch (expr->context()) {
1709
+ switch (context_) {
1540
1710
  case Expression::kUninitialized:
1541
1711
  UNREACHABLE();
1542
1712
  break;
@@ -1596,13 +1766,13 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1596
1766
  __ pop(r1);
1597
1767
  break;
1598
1768
  case Token::GT:
1599
- // Reverse left and right sizes to obtain ECMA-262 conversion order.
1769
+ // Reverse left and right sides to obtain ECMA-262 conversion order.
1600
1770
  cc = lt;
1601
1771
  __ mov(r1, result_register());
1602
1772
  __ pop(r0);
1603
1773
  break;
1604
1774
  case Token::LTE:
1605
- // Reverse left and right sizes to obtain ECMA-262 conversion order.
1775
+ // Reverse left and right sides to obtain ECMA-262 conversion order.
1606
1776
  cc = ge;
1607
1777
  __ mov(r1, result_register());
1608
1778
  __ pop(r0);
@@ -1630,7 +1800,7 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1630
1800
  __ bind(&slow_case);
1631
1801
  CompareStub stub(cc, strict);
1632
1802
  __ CallStub(&stub);
1633
- __ tst(r0, r0);
1803
+ __ cmp(r0, Operand(0));
1634
1804
  __ b(cc, if_true);
1635
1805
  __ jmp(if_false);
1636
1806
  }
@@ -1638,29 +1808,29 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1638
1808
 
1639
1809
  // Convert the result of the comparison into one expected for this
1640
1810
  // expression's context.
1641
- Apply(expr->context(), if_true, if_false);
1811
+ Apply(context_, if_true, if_false);
1642
1812
  }
1643
1813
 
1644
1814
 
1645
- void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
1815
+ void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) {
1646
1816
  __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1647
- Apply(expr->context(), r0);
1817
+ Apply(context_, r0);
1648
1818
  }
1649
1819
 
1650
1820
 
1651
- Register FastCodeGenerator::result_register() { return r0; }
1821
+ Register FullCodeGenerator::result_register() { return r0; }
1652
1822
 
1653
1823
 
1654
- Register FastCodeGenerator::context_register() { return cp; }
1824
+ Register FullCodeGenerator::context_register() { return cp; }
1655
1825
 
1656
1826
 
1657
- void FastCodeGenerator::StoreToFrameField(int frame_offset, Register value) {
1827
+ void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) {
1658
1828
  ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset);
1659
1829
  __ str(value, MemOperand(fp, frame_offset));
1660
1830
  }
1661
1831
 
1662
1832
 
1663
- void FastCodeGenerator::LoadContextField(Register dst, int context_index) {
1833
+ void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
1664
1834
  __ ldr(dst, CodeGenerator::ContextOperand(cp, context_index));
1665
1835
  }
1666
1836
 
@@ -1668,7 +1838,7 @@ void FastCodeGenerator::LoadContextField(Register dst, int context_index) {
1668
1838
  // ----------------------------------------------------------------------------
1669
1839
  // Non-local control flow support.
1670
1840
 
1671
- void FastCodeGenerator::EnterFinallyBlock() {
1841
+ void FullCodeGenerator::EnterFinallyBlock() {
1672
1842
  ASSERT(!result_register().is(r1));
1673
1843
  // Store result register while executing finally block.
1674
1844
  __ push(result_register());
@@ -1681,7 +1851,7 @@ void FastCodeGenerator::EnterFinallyBlock() {
1681
1851
  }
1682
1852
 
1683
1853
 
1684
- void FastCodeGenerator::ExitFinallyBlock() {
1854
+ void FullCodeGenerator::ExitFinallyBlock() {
1685
1855
  ASSERT(!result_register().is(r1));
1686
1856
  // Restore result register from stack.
1687
1857
  __ pop(r1);