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
@@ -31,14 +31,14 @@
31
31
  namespace v8 {
32
32
  namespace internal {
33
33
 
34
- #ifndef V8_NATIVE_REGEXP
34
+ #ifdef V8_INTERPRETED_REGEXP
35
35
  class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
36
36
  public:
37
37
  RegExpMacroAssemblerIA32() { }
38
38
  virtual ~RegExpMacroAssemblerIA32() { }
39
39
  };
40
40
 
41
- #else
41
+ #else // V8_INTERPRETED_REGEXP
42
42
  class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
43
43
  public:
44
44
  RegExpMacroAssemblerIA32(Mode mode, int registers_to_save);
@@ -123,8 +123,7 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
123
123
  static const int kInputStart = kStartIndex + kPointerSize;
124
124
  static const int kInputEnd = kInputStart + kPointerSize;
125
125
  static const int kRegisterOutput = kInputEnd + kPointerSize;
126
- static const int kAtStart = kRegisterOutput + kPointerSize;
127
- static const int kStackHighEnd = kAtStart + kPointerSize;
126
+ static const int kStackHighEnd = kRegisterOutput + kPointerSize;
128
127
  static const int kDirectCall = kStackHighEnd + kPointerSize;
129
128
  // Below the frame pointer - local stack variables.
130
129
  // When adding local variables remember to push space for them in
@@ -133,8 +132,9 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
133
132
  static const int kBackup_edi = kBackup_esi - kPointerSize;
134
133
  static const int kBackup_ebx = kBackup_edi - kPointerSize;
135
134
  static const int kInputStartMinusOne = kBackup_ebx - kPointerSize;
135
+ static const int kAtStart = kInputStartMinusOne - kPointerSize;
136
136
  // First register address. Following registers are below it on the stack.
137
- static const int kRegisterZero = kInputStartMinusOne - kPointerSize;
137
+ static const int kRegisterZero = kAtStart - kPointerSize;
138
138
 
139
139
  // Initial size of code buffer.
140
140
  static const size_t kRegExpCodeSize = 1024;
@@ -187,21 +187,6 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
187
187
  // (ecx) and increments it by a word size.
188
188
  inline void Pop(Register target);
189
189
 
190
- // Before calling a C-function from generated code, align arguments on stack.
191
- // After aligning the frame, arguments must be stored in esp[0], esp[4],
192
- // etc., not pushed. The argument count assumes all arguments are word sized.
193
- // Some compilers/platforms require the stack to be aligned when calling
194
- // C++ code.
195
- // Needs a scratch register to do some arithmetic. This register will be
196
- // trashed.
197
- inline void FrameAlign(int num_arguments, Register scratch);
198
-
199
- // Calls a C function and cleans up the space for arguments allocated
200
- // by FrameAlign. The called function is not allowed to trigger a garbage
201
- // collection, since that might move the code and invalidate the return
202
- // address (unless this is somehow accounted for).
203
- inline void CallCFunction(ExternalReference function, int num_arguments);
204
-
205
190
  MacroAssembler* masm_;
206
191
 
207
192
  // Which mode to generate code for (ASCII or UC16).
@@ -223,7 +208,7 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
223
208
  Label check_preempt_label_;
224
209
  Label stack_overflow_label_;
225
210
  };
226
- #endif // V8_NATIVE_REGEXP
211
+ #endif // V8_INTERPRETED_REGEXP
227
212
 
228
213
  }} // namespace v8::internal
229
214
 
@@ -29,6 +29,7 @@
29
29
 
30
30
  #include "codegen-inl.h"
31
31
  #include "register-allocator-inl.h"
32
+ #include "virtual-frame-inl.h"
32
33
 
33
34
  namespace v8 {
34
35
  namespace internal {
@@ -41,13 +42,40 @@ void Result::ToRegister() {
41
42
  if (is_constant()) {
42
43
  Result fresh = CodeGeneratorScope::Current()->allocator()->Allocate();
43
44
  ASSERT(fresh.is_valid());
44
- if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) {
45
+ if (is_untagged_int32()) {
46
+ fresh.set_untagged_int32(true);
47
+ if (handle()->IsSmi()) {
48
+ CodeGeneratorScope::Current()->masm()->Set(
49
+ fresh.reg(),
50
+ Immediate(Smi::cast(*handle())->value()));
51
+ } else if (handle()->IsHeapNumber()) {
52
+ double double_value = HeapNumber::cast(*handle())->value();
53
+ int32_t value = DoubleToInt32(double_value);
54
+ if (double_value == 0 && signbit(double_value)) {
55
+ // Negative zero must not be converted to an int32 unless
56
+ // the context allows it.
57
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal);
58
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal);
59
+ } else if (double_value == value) {
60
+ CodeGeneratorScope::Current()->masm()->Set(
61
+ fresh.reg(), Immediate(value));
62
+ } else {
63
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal);
64
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal);
65
+ }
66
+ } else {
67
+ // Constant is not a number. This was not predicted by AST analysis.
68
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal);
69
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal);
70
+ }
71
+ } else if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) {
45
72
  CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle());
46
73
  } else {
47
74
  CodeGeneratorScope::Current()->masm()->Set(fresh.reg(),
48
75
  Immediate(handle()));
49
76
  }
50
77
  // This result becomes a copy of the fresh one.
78
+ fresh.set_type_info(type_info());
51
79
  *this = fresh;
52
80
  }
53
81
  ASSERT(is_register());
@@ -63,13 +91,39 @@ void Result::ToRegister(Register target) {
63
91
  CodeGeneratorScope::Current()->masm()->mov(fresh.reg(), reg());
64
92
  } else {
65
93
  ASSERT(is_constant());
66
- if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) {
67
- CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle());
94
+ if (is_untagged_int32()) {
95
+ if (handle()->IsSmi()) {
96
+ CodeGeneratorScope::Current()->masm()->Set(
97
+ fresh.reg(),
98
+ Immediate(Smi::cast(*handle())->value()));
99
+ } else {
100
+ ASSERT(handle()->IsHeapNumber());
101
+ double double_value = HeapNumber::cast(*handle())->value();
102
+ int32_t value = DoubleToInt32(double_value);
103
+ if (double_value == 0 && signbit(double_value)) {
104
+ // Negative zero must not be converted to an int32 unless
105
+ // the context allows it.
106
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal);
107
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal);
108
+ } else if (double_value == value) {
109
+ CodeGeneratorScope::Current()->masm()->Set(
110
+ fresh.reg(), Immediate(value));
111
+ } else {
112
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal);
113
+ CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal);
114
+ }
115
+ }
68
116
  } else {
69
- CodeGeneratorScope::Current()->masm()->Set(fresh.reg(),
70
- Immediate(handle()));
117
+ if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) {
118
+ CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle());
119
+ } else {
120
+ CodeGeneratorScope::Current()->masm()->Set(fresh.reg(),
121
+ Immediate(handle()));
122
+ }
71
123
  }
72
124
  }
125
+ fresh.set_type_info(type_info());
126
+ fresh.set_untagged_int32(is_untagged_int32());
73
127
  *this = fresh;
74
128
  } else if (is_register() && reg().is(target)) {
75
129
  ASSERT(CodeGeneratorScope::Current()->has_valid_frame());
@@ -53,8 +53,8 @@ class SimulatorStack : public v8::internal::AllStatic {
53
53
 
54
54
  // Call the generated regexp code directly. The entry function pointer should
55
55
  // expect eight int/pointer sized arguments and return an int.
56
- #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
57
- entry(p0, p1, p2, p3, p4, p5, p6, p7)
56
+ #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
57
+ entry(p0, p1, p2, p3, p4, p5, p6)
58
58
 
59
59
  #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
60
60
  reinterpret_cast<TryCatch*>(try_catch_address)
@@ -152,21 +152,6 @@ void StubCache::GenerateProbe(MacroAssembler* masm,
152
152
  }
153
153
 
154
154
 
155
- static void PushInterceptorArguments(MacroAssembler* masm,
156
- Register receiver,
157
- Register holder,
158
- Register name,
159
- JSObject* holder_obj) {
160
- __ push(receiver);
161
- __ push(holder);
162
- __ push(name);
163
- InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor();
164
- __ mov(receiver, Immediate(Handle<Object>(interceptor)));
165
- __ push(receiver);
166
- __ push(FieldOperand(receiver, InterceptorInfo::kDataOffset));
167
- }
168
-
169
-
170
155
  void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
171
156
  int index,
172
157
  Register prototype) {
@@ -225,30 +210,30 @@ static void GenerateStringCheck(MacroAssembler* masm,
225
210
 
226
211
  void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
227
212
  Register receiver,
228
- Register scratch,
213
+ Register scratch1,
214
+ Register scratch2,
229
215
  Label* miss) {
230
- Label load_length, check_wrapper;
216
+ Label check_wrapper;
231
217
 
232
218
  // Check if the object is a string leaving the instance type in the
233
219
  // scratch register.
234
- GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper);
220
+ GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper);
235
221
 
236
222
  // Load length from the string and convert to a smi.
237
- __ bind(&load_length);
238
223
  __ mov(eax, FieldOperand(receiver, String::kLengthOffset));
239
- __ SmiTag(eax);
240
224
  __ ret(0);
241
225
 
242
226
  // Check if the object is a JSValue wrapper.
243
227
  __ bind(&check_wrapper);
244
- __ cmp(scratch, JS_VALUE_TYPE);
228
+ __ cmp(scratch1, JS_VALUE_TYPE);
245
229
  __ j(not_equal, miss, not_taken);
246
230
 
247
231
  // Check if the wrapped value is a string and load the length
248
232
  // directly if it is.
249
- __ mov(receiver, FieldOperand(receiver, JSValue::kValueOffset));
250
- GenerateStringCheck(masm, receiver, scratch, miss, miss);
251
- __ jmp(&load_length);
233
+ __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset));
234
+ GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
235
+ __ mov(eax, FieldOperand(scratch2, String::kLengthOffset));
236
+ __ ret(0);
252
237
  }
253
238
 
254
239
 
@@ -284,20 +269,32 @@ void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
284
269
  }
285
270
 
286
271
 
272
+ static void PushInterceptorArguments(MacroAssembler* masm,
273
+ Register receiver,
274
+ Register holder,
275
+ Register name,
276
+ JSObject* holder_obj) {
277
+ __ push(name);
278
+ InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor();
279
+ ASSERT(!Heap::InNewSpace(interceptor));
280
+ Register scratch = name;
281
+ __ mov(scratch, Immediate(Handle<Object>(interceptor)));
282
+ __ push(scratch);
283
+ __ push(receiver);
284
+ __ push(holder);
285
+ __ push(FieldOperand(scratch, InterceptorInfo::kDataOffset));
286
+ }
287
+
288
+
287
289
  static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm,
288
290
  Register receiver,
289
291
  Register holder,
290
292
  Register name,
291
293
  JSObject* holder_obj) {
292
294
  PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
293
-
294
- ExternalReference ref =
295
- ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly));
296
- __ mov(eax, Immediate(5));
297
- __ mov(ebx, Immediate(ref));
298
-
299
- CEntryStub stub(1);
300
- __ CallStub(&stub);
295
+ __ CallExternalReference(
296
+ ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)),
297
+ 5);
301
298
  }
302
299
 
303
300
 
@@ -325,7 +322,7 @@ static void CompileLoadInterceptor(Compiler* compiler,
325
322
  stub_compiler->CheckPrototypes(object, receiver, holder,
326
323
  scratch1, scratch2, name, miss);
327
324
 
328
- if (lookup->IsValid() && lookup->IsCacheable()) {
325
+ if (lookup->IsProperty() && lookup->IsCacheable()) {
329
326
  compiler->CompileCacheable(masm,
330
327
  stub_compiler,
331
328
  receiver,
@@ -347,19 +344,6 @@ static void CompileLoadInterceptor(Compiler* compiler,
347
344
  }
348
345
 
349
346
 
350
- static void LookupPostInterceptor(JSObject* holder,
351
- String* name,
352
- LookupResult* lookup) {
353
- holder->LocalLookupRealNamedProperty(name, lookup);
354
- if (lookup->IsNotFound()) {
355
- Object* proto = holder->GetPrototype();
356
- if (proto != Heap::null_value()) {
357
- proto->Lookup(name, lookup);
358
- }
359
- }
360
- }
361
-
362
-
363
347
  class LoadInterceptorCompiler BASE_EMBEDDED {
364
348
  public:
365
349
  explicit LoadInterceptorCompiler(Register name) : name_(name) {}
@@ -374,7 +358,7 @@ class LoadInterceptorCompiler BASE_EMBEDDED {
374
358
  LookupResult* lookup,
375
359
  String* name,
376
360
  Label* miss_label) {
377
- AccessorInfo* callback = 0;
361
+ AccessorInfo* callback = NULL;
378
362
  bool optimize = false;
379
363
  // So far the most popular follow ups for interceptor loads are FIELD
380
364
  // and CALLBACKS, so inline only them, other cases may be added
@@ -461,7 +445,7 @@ class LoadInterceptorCompiler BASE_EMBEDDED {
461
445
 
462
446
  ExternalReference ref =
463
447
  ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
464
- __ TailCallRuntime(ref, 5, 1);
448
+ __ TailCallExternalReference(ref, 5, 1);
465
449
 
466
450
  __ bind(&cleanup);
467
451
  __ pop(scratch1);
@@ -483,7 +467,7 @@ class LoadInterceptorCompiler BASE_EMBEDDED {
483
467
 
484
468
  ExternalReference ref = ExternalReference(
485
469
  IC_Utility(IC::kLoadPropertyWithInterceptorForLoad));
486
- __ TailCallRuntime(ref, 5, 1);
470
+ __ TailCallExternalReference(ref, 5, 1);
487
471
  }
488
472
 
489
473
  private:
@@ -491,89 +475,234 @@ class LoadInterceptorCompiler BASE_EMBEDDED {
491
475
  };
492
476
 
493
477
 
478
+ // Reserves space for the extra arguments to FastHandleApiCall in the
479
+ // caller's frame.
480
+ //
481
+ // These arguments are set by CheckPrototypes and GenerateFastApiCall.
482
+ static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
483
+ // ----------- S t a t e -------------
484
+ // -- esp[0] : return address
485
+ // -- esp[4] : last argument in the internal frame of the caller
486
+ // -----------------------------------
487
+ __ pop(scratch);
488
+ __ push(Immediate(Smi::FromInt(0)));
489
+ __ push(Immediate(Smi::FromInt(0)));
490
+ __ push(Immediate(Smi::FromInt(0)));
491
+ __ push(Immediate(Smi::FromInt(0)));
492
+ __ push(scratch);
493
+ }
494
+
495
+
496
+ // Undoes the effects of ReserveSpaceForFastApiCall.
497
+ static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
498
+ // ----------- S t a t e -------------
499
+ // -- esp[0] : return address
500
+ // -- esp[4] : last fast api call extra argument
501
+ // -- ...
502
+ // -- esp[16] : first fast api call extra argument
503
+ // -- esp[20] : last argument in the internal frame
504
+ // -----------------------------------
505
+ __ pop(scratch);
506
+ __ add(Operand(esp), Immediate(kPointerSize * 4));
507
+ __ push(scratch);
508
+ }
509
+
510
+
511
+ // Generates call to FastHandleApiCall builtin.
512
+ static void GenerateFastApiCall(MacroAssembler* masm,
513
+ const CallOptimization& optimization,
514
+ int argc) {
515
+ // ----------- S t a t e -------------
516
+ // -- esp[0] : return address
517
+ // -- esp[4] : object passing the type check
518
+ // (last fast api call extra argument,
519
+ // set by CheckPrototypes)
520
+ // -- esp[8] : api call data
521
+ // -- esp[12] : api callback
522
+ // -- esp[16] : api function
523
+ // (first fast api call extra argument)
524
+ // -- esp[20] : last argument
525
+ // -- ...
526
+ // -- esp[(argc + 5) * 4] : first argument
527
+ // -- esp[(argc + 6) * 4] : receiver
528
+ // -----------------------------------
529
+
530
+ // Get the function and setup the context.
531
+ JSFunction* function = optimization.constant_function();
532
+ __ mov(edi, Immediate(Handle<JSFunction>(function)));
533
+ __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
534
+
535
+ // Pass the additional arguments FastHandleApiCall expects.
536
+ __ mov(Operand(esp, 4 * kPointerSize), edi);
537
+ bool info_loaded = false;
538
+ Object* callback = optimization.api_call_info()->callback();
539
+ if (Heap::InNewSpace(callback)) {
540
+ info_loaded = true;
541
+ __ mov(ecx, Handle<CallHandlerInfo>(optimization.api_call_info()));
542
+ __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kCallbackOffset));
543
+ __ mov(Operand(esp, 3 * kPointerSize), ebx);
544
+ } else {
545
+ __ mov(Operand(esp, 3 * kPointerSize), Immediate(Handle<Object>(callback)));
546
+ }
547
+ Object* call_data = optimization.api_call_info()->data();
548
+ if (Heap::InNewSpace(call_data)) {
549
+ if (!info_loaded) {
550
+ __ mov(ecx, Handle<CallHandlerInfo>(optimization.api_call_info()));
551
+ }
552
+ __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset));
553
+ __ mov(Operand(esp, 2 * kPointerSize), ebx);
554
+ } else {
555
+ __ mov(Operand(esp, 2 * kPointerSize),
556
+ Immediate(Handle<Object>(call_data)));
557
+ }
558
+
559
+ // Set the number of arguments.
560
+ __ mov(eax, Immediate(argc + 4));
561
+
562
+ // Jump to the fast api call builtin (tail call).
563
+ Handle<Code> code = Handle<Code>(
564
+ Builtins::builtin(Builtins::FastHandleApiCall));
565
+ ParameterCount expected(0);
566
+ __ InvokeCode(code, expected, expected,
567
+ RelocInfo::CODE_TARGET, JUMP_FUNCTION);
568
+ }
569
+
570
+
494
571
  class CallInterceptorCompiler BASE_EMBEDDED {
495
572
  public:
496
- CallInterceptorCompiler(const ParameterCount& arguments, Register name)
497
- : arguments_(arguments), argc_(arguments.immediate()), name_(name) {}
573
+ CallInterceptorCompiler(StubCompiler* stub_compiler,
574
+ const ParameterCount& arguments,
575
+ Register name)
576
+ : stub_compiler_(stub_compiler),
577
+ arguments_(arguments),
578
+ name_(name) {}
579
+
580
+ void Compile(MacroAssembler* masm,
581
+ JSObject* object,
582
+ JSObject* holder,
583
+ String* name,
584
+ LookupResult* lookup,
585
+ Register receiver,
586
+ Register scratch1,
587
+ Register scratch2,
588
+ Label* miss) {
589
+ ASSERT(holder->HasNamedInterceptor());
590
+ ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
591
+
592
+ // Check that the receiver isn't a smi.
593
+ __ test(receiver, Immediate(kSmiTagMask));
594
+ __ j(zero, miss, not_taken);
595
+
596
+ CallOptimization optimization(lookup);
597
+
598
+ if (optimization.is_constant_call()) {
599
+ CompileCacheable(masm,
600
+ object,
601
+ receiver,
602
+ scratch1,
603
+ scratch2,
604
+ holder,
605
+ lookup,
606
+ name,
607
+ optimization,
608
+ miss);
609
+ } else {
610
+ CompileRegular(masm,
611
+ object,
612
+ receiver,
613
+ scratch1,
614
+ scratch2,
615
+ name,
616
+ holder,
617
+ miss);
618
+ }
619
+ }
498
620
 
621
+ private:
499
622
  void CompileCacheable(MacroAssembler* masm,
500
- StubCompiler* stub_compiler,
623
+ JSObject* object,
501
624
  Register receiver,
502
- Register holder,
503
625
  Register scratch1,
504
626
  Register scratch2,
505
627
  JSObject* holder_obj,
506
628
  LookupResult* lookup,
507
629
  String* name,
630
+ const CallOptimization& optimization,
508
631
  Label* miss_label) {
509
- JSFunction* function = 0;
510
- bool optimize = false;
511
- // So far the most popular case for failed interceptor is
512
- // CONSTANT_FUNCTION sitting below.
513
- if (lookup->type() == CONSTANT_FUNCTION) {
514
- function = lookup->GetConstantFunction();
515
- // JSArray holder is a special case for call constant function
516
- // (see the corresponding code).
517
- if (function->is_compiled() && !holder_obj->IsJSArray()) {
518
- optimize = true;
632
+ ASSERT(optimization.is_constant_call());
633
+ ASSERT(!lookup->holder()->IsGlobalObject());
634
+
635
+ int depth1 = kInvalidProtoDepth;
636
+ int depth2 = kInvalidProtoDepth;
637
+ bool can_do_fast_api_call = false;
638
+ if (optimization.is_simple_api_call() &&
639
+ !lookup->holder()->IsGlobalObject()) {
640
+ depth1 = optimization.GetPrototypeDepthOfExpectedType(object, holder_obj);
641
+ if (depth1 == kInvalidProtoDepth) {
642
+ depth2 = optimization.GetPrototypeDepthOfExpectedType(holder_obj,
643
+ lookup->holder());
519
644
  }
645
+ can_do_fast_api_call = (depth1 != kInvalidProtoDepth) ||
646
+ (depth2 != kInvalidProtoDepth);
520
647
  }
521
648
 
522
- if (!optimize) {
523
- CompileRegular(masm, receiver, holder, scratch2, holder_obj, miss_label);
524
- return;
649
+ __ IncrementCounter(&Counters::call_const_interceptor, 1);
650
+
651
+ if (can_do_fast_api_call) {
652
+ __ IncrementCounter(&Counters::call_const_interceptor_fast_api, 1);
653
+ ReserveSpaceForFastApiCall(masm, scratch1);
525
654
  }
526
655
 
527
- __ EnterInternalFrame();
528
- __ push(holder); // Save the holder.
529
- __ push(name_); // Save the name.
656
+ Label miss_cleanup;
657
+ Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
658
+ Register holder =
659
+ stub_compiler_->CheckPrototypes(object, receiver, holder_obj,
660
+ scratch1, scratch2, name,
661
+ depth1, miss);
530
662
 
531
- CompileCallLoadPropertyWithInterceptor(masm,
532
- receiver,
533
- holder,
534
- name_,
535
- holder_obj);
663
+ Label regular_invoke;
664
+ LoadWithInterceptor(masm, receiver, holder, holder_obj, &regular_invoke);
536
665
 
537
- __ pop(name_); // Restore the name.
538
- __ pop(receiver); // Restore the holder.
539
- __ LeaveInternalFrame();
666
+ // Generate code for the failed interceptor case.
540
667
 
541
- __ cmp(eax, Factory::no_interceptor_result_sentinel());
542
- Label invoke;
543
- __ j(not_equal, &invoke);
544
-
545
- stub_compiler->CheckPrototypes(holder_obj, receiver,
546
- lookup->holder(), scratch1,
547
- scratch2,
548
- name,
549
- miss_label);
550
- if (lookup->holder()->IsGlobalObject()) {
551
- __ mov(edx, Operand(esp, (argc_ + 1) * kPointerSize));
552
- __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
553
- __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edx);
554
- }
668
+ // Check the lookup is still valid.
669
+ stub_compiler_->CheckPrototypes(holder_obj, receiver,
670
+ lookup->holder(),
671
+ scratch1, scratch2, name,
672
+ depth2, miss);
555
673
 
556
- ASSERT(function->is_compiled());
557
- // Get the function and setup the context.
558
- __ mov(edi, Immediate(Handle<JSFunction>(function)));
559
- __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
674
+ if (can_do_fast_api_call) {
675
+ GenerateFastApiCall(masm, optimization, arguments_.immediate());
676
+ } else {
677
+ __ InvokeFunction(optimization.constant_function(), arguments_,
678
+ JUMP_FUNCTION);
679
+ }
560
680
 
561
- // Jump to the cached code (tail call).
562
- ASSERT(function->is_compiled());
563
- Handle<Code> code(function->code());
564
- ParameterCount expected(function->shared()->formal_parameter_count());
565
- __ InvokeCode(code, expected, arguments_,
566
- RelocInfo::CODE_TARGET, JUMP_FUNCTION);
681
+ if (can_do_fast_api_call) {
682
+ __ bind(&miss_cleanup);
683
+ FreeSpaceForFastApiCall(masm, scratch1);
684
+ __ jmp(miss_label);
685
+ }
567
686
 
568
- __ bind(&invoke);
687
+ __ bind(&regular_invoke);
688
+ if (can_do_fast_api_call) {
689
+ FreeSpaceForFastApiCall(masm, scratch1);
690
+ }
569
691
  }
570
692
 
571
693
  void CompileRegular(MacroAssembler* masm,
694
+ JSObject* object,
572
695
  Register receiver,
573
- Register holder,
574
- Register scratch,
696
+ Register scratch1,
697
+ Register scratch2,
698
+ String* name,
575
699
  JSObject* holder_obj,
576
700
  Label* miss_label) {
701
+ Register holder =
702
+ stub_compiler_->CheckPrototypes(object, receiver, holder_obj,
703
+ scratch1, scratch2, name,
704
+ miss_label);
705
+
577
706
  __ EnterInternalFrame();
578
707
  // Save the name_ register across the call.
579
708
  __ push(name_);
@@ -584,22 +713,41 @@ class CallInterceptorCompiler BASE_EMBEDDED {
584
713
  name_,
585
714
  holder_obj);
586
715
 
587
- ExternalReference ref = ExternalReference(
588
- IC_Utility(IC::kLoadPropertyWithInterceptorForCall));
589
- __ mov(eax, Immediate(5));
590
- __ mov(ebx, Immediate(ref));
591
-
592
- CEntryStub stub(1);
593
- __ CallStub(&stub);
716
+ __ CallExternalReference(
717
+ ExternalReference(
718
+ IC_Utility(IC::kLoadPropertyWithInterceptorForCall)),
719
+ 5);
594
720
 
595
721
  // Restore the name_ register.
596
722
  __ pop(name_);
597
723
  __ LeaveInternalFrame();
598
724
  }
599
725
 
600
- private:
726
+ void LoadWithInterceptor(MacroAssembler* masm,
727
+ Register receiver,
728
+ Register holder,
729
+ JSObject* holder_obj,
730
+ Label* interceptor_succeeded) {
731
+ __ EnterInternalFrame();
732
+ __ push(holder); // Save the holder.
733
+ __ push(name_); // Save the name.
734
+
735
+ CompileCallLoadPropertyWithInterceptor(masm,
736
+ receiver,
737
+ holder,
738
+ name_,
739
+ holder_obj);
740
+
741
+ __ pop(name_); // Restore the name.
742
+ __ pop(receiver); // Restore the holder.
743
+ __ LeaveInternalFrame();
744
+
745
+ __ cmp(eax, Factory::no_interceptor_result_sentinel());
746
+ __ j(not_equal, interceptor_succeeded);
747
+ }
748
+
749
+ StubCompiler* stub_compiler_;
601
750
  const ParameterCount& arguments_;
602
- int argc_;
603
751
  Register name_;
604
752
  };
605
753
 
@@ -618,8 +766,9 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) {
618
766
  }
619
767
 
620
768
 
769
+ // Both name_reg and receiver_reg are preserved on jumps to miss_label,
770
+ // but may be destroyed if store is successful.
621
771
  void StubCompiler::GenerateStoreField(MacroAssembler* masm,
622
- Builtins::Name storage_extend,
623
772
  JSObject* object,
624
773
  int index,
625
774
  Map* transition,
@@ -649,9 +798,13 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
649
798
  if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) {
650
799
  // The properties must be extended before we can store the value.
651
800
  // We jump to a runtime call that extends the properties array.
652
- __ mov(ecx, Immediate(Handle<Map>(transition)));
653
- Handle<Code> ic(Builtins::builtin(storage_extend));
654
- __ jmp(ic, RelocInfo::CODE_TARGET);
801
+ __ pop(scratch); // Return address.
802
+ __ push(receiver_reg);
803
+ __ push(Immediate(Handle<Map>(transition)));
804
+ __ push(eax);
805
+ __ push(scratch);
806
+ __ TailCallExternalReference(
807
+ ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 3, 1);
655
808
  return;
656
809
  }
657
810
 
@@ -694,6 +847,26 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
694
847
  }
695
848
 
696
849
 
850
+ // Generate code to check that a global property cell is empty. Create
851
+ // the property cell at compilation time if no cell exists for the
852
+ // property.
853
+ static Object* GenerateCheckPropertyCell(MacroAssembler* masm,
854
+ GlobalObject* global,
855
+ String* name,
856
+ Register scratch,
857
+ Label* miss) {
858
+ Object* probe = global->EnsurePropertyCell(name);
859
+ if (probe->IsFailure()) return probe;
860
+ JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
861
+ ASSERT(cell->value()->IsTheHole());
862
+ __ mov(scratch, Immediate(Handle<Object>(cell)));
863
+ __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
864
+ Immediate(Factory::the_hole_value()));
865
+ __ j(not_equal, miss, not_taken);
866
+ return cell;
867
+ }
868
+
869
+
697
870
  #undef __
698
871
  #define __ ACCESS_MASM(masm())
699
872
 
@@ -704,32 +877,32 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
704
877
  Register holder_reg,
705
878
  Register scratch,
706
879
  String* name,
880
+ int push_at_depth,
707
881
  Label* miss) {
708
882
  // Check that the maps haven't changed.
709
883
  Register result =
710
- masm()->CheckMaps(object, object_reg, holder, holder_reg, scratch, miss);
884
+ masm()->CheckMaps(object, object_reg, holder, holder_reg, scratch,
885
+ push_at_depth, miss);
711
886
 
712
887
  // If we've skipped any global objects, it's not enough to verify
713
- // that their maps haven't changed.
888
+ // that their maps haven't changed. We also need to check that the
889
+ // property cell for the property is still empty.
714
890
  while (object != holder) {
715
891
  if (object->IsGlobalObject()) {
716
- GlobalObject* global = GlobalObject::cast(object);
717
- Object* probe = global->EnsurePropertyCell(name);
718
- if (probe->IsFailure()) {
719
- set_failure(Failure::cast(probe));
892
+ Object* cell = GenerateCheckPropertyCell(masm(),
893
+ GlobalObject::cast(object),
894
+ name,
895
+ scratch,
896
+ miss);
897
+ if (cell->IsFailure()) {
898
+ set_failure(Failure::cast(cell));
720
899
  return result;
721
900
  }
722
- JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
723
- ASSERT(cell->value()->IsTheHole());
724
- __ mov(scratch, Immediate(Handle<Object>(cell)));
725
- __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
726
- Immediate(Factory::the_hole_value()));
727
- __ j(not_equal, miss, not_taken);
728
901
  }
729
902
  object = JSObject::cast(object->GetPrototype());
730
903
  }
731
904
 
732
- // Return the register containin the holder.
905
+ // Return the register containing the holder.
733
906
  return result;
734
907
  }
735
908
 
@@ -788,17 +961,16 @@ bool StubCompiler::GenerateLoadCallback(JSObject* object,
788
961
  __ push(receiver); // receiver
789
962
  __ push(reg); // holder
790
963
  __ mov(other, Immediate(callback_handle));
791
- __ push(other);
792
964
  __ push(FieldOperand(other, AccessorInfo::kDataOffset)); // data
793
965
  __ push(name_reg); // name
794
966
  // Save a pointer to where we pushed the arguments pointer.
795
- // This will be passed as the const Arguments& to the C++ callback.
967
+ // This will be passed as the const AccessorInfo& to the C++ callback.
796
968
  __ mov(eax, esp);
797
- __ add(Operand(eax), Immediate(5 * kPointerSize));
969
+ __ add(Operand(eax), Immediate(4 * kPointerSize));
798
970
  __ mov(ebx, esp);
799
971
 
800
972
  // Do call through the api.
801
- ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace);
973
+ ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace);
802
974
  Address getter_address = v8::ToCData<Address>(callback->getter());
803
975
  ApiFunction fun(getter_address);
804
976
  ApiGetterEntryStub stub(callback_handle, &fun);
@@ -900,7 +1072,7 @@ Object* StubCompiler::CompileLazyCompile(Code::Flags flags) {
900
1072
  }
901
1073
 
902
1074
 
903
- Object* CallStubCompiler::CompileCallField(Object* object,
1075
+ Object* CallStubCompiler::CompileCallField(JSObject* object,
904
1076
  JSObject* holder,
905
1077
  int index,
906
1078
  String* name) {
@@ -922,9 +1094,7 @@ Object* CallStubCompiler::CompileCallField(Object* object,
922
1094
  __ j(zero, &miss, not_taken);
923
1095
 
924
1096
  // Do the right check and compute the holder register.
925
- Register reg =
926
- CheckPrototypes(JSObject::cast(object), edx, holder,
927
- ebx, eax, name, &miss);
1097
+ Register reg = CheckPrototypes(object, edx, holder, ebx, eax, name, &miss);
928
1098
 
929
1099
  GenerateFastPropertyLoad(masm(), edi, reg, holder, index);
930
1100
 
@@ -954,6 +1124,246 @@ Object* CallStubCompiler::CompileCallField(Object* object,
954
1124
  }
955
1125
 
956
1126
 
1127
+ Object* CallStubCompiler::CompileArrayPushCall(Object* object,
1128
+ JSObject* holder,
1129
+ JSFunction* function,
1130
+ String* name,
1131
+ CheckType check) {
1132
+ // ----------- S t a t e -------------
1133
+ // -- ecx : name
1134
+ // -- esp[0] : return address
1135
+ // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1136
+ // -- ...
1137
+ // -- esp[(argc + 1) * 4] : receiver
1138
+ // -----------------------------------
1139
+ ASSERT(check == RECEIVER_MAP_CHECK);
1140
+
1141
+ // If object is not an array, bail out to regular call.
1142
+ if (!object->IsJSArray()) {
1143
+ return Heap::undefined_value();
1144
+ }
1145
+
1146
+ Label miss;
1147
+
1148
+ // Get the receiver from the stack.
1149
+ const int argc = arguments().immediate();
1150
+ __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1151
+
1152
+ // Check that the receiver isn't a smi.
1153
+ __ test(edx, Immediate(kSmiTagMask));
1154
+ __ j(zero, &miss);
1155
+
1156
+ CheckPrototypes(JSObject::cast(object), edx,
1157
+ holder, ebx,
1158
+ eax, name, &miss);
1159
+
1160
+ if (argc == 0) {
1161
+ // Noop, return the length.
1162
+ __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1163
+ __ ret((argc + 1) * kPointerSize);
1164
+ } else {
1165
+ // Get the elements array of the object.
1166
+ __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
1167
+
1168
+ // Check that the elements are in fast mode (not dictionary).
1169
+ __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1170
+ Immediate(Factory::fixed_array_map()));
1171
+ __ j(not_equal, &miss);
1172
+
1173
+ if (argc == 1) { // Otherwise fall through to call builtin.
1174
+ Label call_builtin, exit, with_rset_update, attempt_to_grow_elements;
1175
+
1176
+ // Get the array's length into eax and calculate new length.
1177
+ __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1178
+ STATIC_ASSERT(kSmiTagSize == 1);
1179
+ STATIC_ASSERT(kSmiTag == 0);
1180
+ __ add(Operand(eax), Immediate(Smi::FromInt(argc)));
1181
+
1182
+ // Get the element's length into ecx.
1183
+ __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
1184
+ __ SmiTag(ecx);
1185
+
1186
+ // Check if we could survive without allocation.
1187
+ __ cmp(eax, Operand(ecx));
1188
+ __ j(greater, &attempt_to_grow_elements);
1189
+
1190
+ // Save new length.
1191
+ __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1192
+
1193
+ // Push the element.
1194
+ __ lea(edx, FieldOperand(ebx,
1195
+ eax, times_half_pointer_size,
1196
+ FixedArray::kHeaderSize - argc * kPointerSize));
1197
+ __ mov(ecx, Operand(esp, argc * kPointerSize));
1198
+ __ mov(Operand(edx, 0), ecx);
1199
+
1200
+ // Check if value is a smi.
1201
+ __ test(ecx, Immediate(kSmiTagMask));
1202
+ __ j(not_zero, &with_rset_update);
1203
+
1204
+ __ bind(&exit);
1205
+ __ ret((argc + 1) * kPointerSize);
1206
+
1207
+ __ bind(&with_rset_update);
1208
+
1209
+ __ InNewSpace(ebx, ecx, equal, &exit);
1210
+
1211
+ RecordWriteStub stub(ebx, edx, ecx);
1212
+ __ CallStub(&stub);
1213
+ __ ret((argc + 1) * kPointerSize);
1214
+
1215
+ __ bind(&attempt_to_grow_elements);
1216
+ ExternalReference new_space_allocation_top =
1217
+ ExternalReference::new_space_allocation_top_address();
1218
+ ExternalReference new_space_allocation_limit =
1219
+ ExternalReference::new_space_allocation_limit_address();
1220
+
1221
+ const int kAllocationDelta = 4;
1222
+ // Load top.
1223
+ __ mov(ecx, Operand::StaticVariable(new_space_allocation_top));
1224
+
1225
+ // Check if it's the end of elements.
1226
+ __ lea(edx, FieldOperand(ebx,
1227
+ eax, times_half_pointer_size,
1228
+ FixedArray::kHeaderSize - argc * kPointerSize));
1229
+ __ cmp(edx, Operand(ecx));
1230
+ __ j(not_equal, &call_builtin);
1231
+ __ add(Operand(ecx), Immediate(kAllocationDelta * kPointerSize));
1232
+ __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit));
1233
+ __ j(above, &call_builtin);
1234
+
1235
+ // We fit and could grow elements.
1236
+ __ mov(Operand::StaticVariable(new_space_allocation_top), ecx);
1237
+ __ mov(ecx, Operand(esp, argc * kPointerSize));
1238
+
1239
+ // Push the argument...
1240
+ __ mov(Operand(edx, 0), ecx);
1241
+ // ... and fill the rest with holes.
1242
+ for (int i = 1; i < kAllocationDelta; i++) {
1243
+ __ mov(Operand(edx, i * kPointerSize),
1244
+ Immediate(Factory::the_hole_value()));
1245
+ }
1246
+
1247
+ // Restore receiver to edx as finish sequence assumes it's here.
1248
+ __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1249
+
1250
+ // Increment element's and array's sizes.
1251
+ __ add(FieldOperand(ebx, FixedArray::kLengthOffset),
1252
+ Immediate(kAllocationDelta));
1253
+ __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1254
+
1255
+ // Elements are in new space, so no remembered set updates are necessary.
1256
+ __ ret((argc + 1) * kPointerSize);
1257
+
1258
+ __ bind(&call_builtin);
1259
+ }
1260
+
1261
+ __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1262
+ argc + 1,
1263
+ 1);
1264
+ }
1265
+
1266
+ __ bind(&miss);
1267
+
1268
+ Handle<Code> ic = ComputeCallMiss(arguments().immediate());
1269
+ __ jmp(ic, RelocInfo::CODE_TARGET);
1270
+
1271
+ // Return the generated code.
1272
+ String* function_name = NULL;
1273
+ if (function->shared()->name()->IsString()) {
1274
+ function_name = String::cast(function->shared()->name());
1275
+ }
1276
+ return GetCode(CONSTANT_FUNCTION, function_name);
1277
+ }
1278
+
1279
+
1280
+ Object* CallStubCompiler::CompileArrayPopCall(Object* object,
1281
+ JSObject* holder,
1282
+ JSFunction* function,
1283
+ String* name,
1284
+ CheckType check) {
1285
+ // ----------- S t a t e -------------
1286
+ // -- ecx : name
1287
+ // -- esp[0] : return address
1288
+ // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1289
+ // -- ...
1290
+ // -- esp[(argc + 1) * 4] : receiver
1291
+ // -----------------------------------
1292
+ ASSERT(check == RECEIVER_MAP_CHECK);
1293
+
1294
+ // If object is not an array, bail out to regular call.
1295
+ if (!object->IsJSArray()) {
1296
+ return Heap::undefined_value();
1297
+ }
1298
+
1299
+ Label miss, return_undefined, call_builtin;
1300
+
1301
+ // Get the receiver from the stack.
1302
+ const int argc = arguments().immediate();
1303
+ __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1304
+
1305
+ // Check that the receiver isn't a smi.
1306
+ __ test(edx, Immediate(kSmiTagMask));
1307
+ __ j(zero, &miss);
1308
+ CheckPrototypes(JSObject::cast(object), edx,
1309
+ holder, ebx,
1310
+ eax, name, &miss);
1311
+
1312
+ // Get the elements array of the object.
1313
+ __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
1314
+
1315
+ // Check that the elements are in fast mode (not dictionary).
1316
+ __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1317
+ Immediate(Factory::fixed_array_map()));
1318
+ __ j(not_equal, &miss);
1319
+
1320
+ // Get the array's length into ecx and calculate new length.
1321
+ __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset));
1322
+ __ sub(Operand(ecx), Immediate(Smi::FromInt(1)));
1323
+ __ j(negative, &return_undefined);
1324
+
1325
+ // Get the last element.
1326
+ STATIC_ASSERT(kSmiTagSize == 1);
1327
+ STATIC_ASSERT(kSmiTag == 0);
1328
+ __ mov(eax, FieldOperand(ebx,
1329
+ ecx, times_half_pointer_size,
1330
+ FixedArray::kHeaderSize));
1331
+ __ cmp(Operand(eax), Immediate(Factory::the_hole_value()));
1332
+ __ j(equal, &call_builtin);
1333
+
1334
+ // Set the array's length.
1335
+ __ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx);
1336
+
1337
+ // Fill with the hole.
1338
+ __ mov(FieldOperand(ebx,
1339
+ ecx, times_half_pointer_size,
1340
+ FixedArray::kHeaderSize),
1341
+ Immediate(Factory::the_hole_value()));
1342
+ __ ret((argc + 1) * kPointerSize);
1343
+
1344
+ __ bind(&return_undefined);
1345
+ __ mov(eax, Immediate(Factory::undefined_value()));
1346
+ __ ret((argc + 1) * kPointerSize);
1347
+
1348
+ __ bind(&call_builtin);
1349
+ __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
1350
+ argc + 1,
1351
+ 1);
1352
+
1353
+ __ bind(&miss);
1354
+
1355
+ Handle<Code> ic = ComputeCallMiss(arguments().immediate());
1356
+ __ jmp(ic, RelocInfo::CODE_TARGET);
1357
+
1358
+ // Return the generated code.
1359
+ String* function_name = NULL;
1360
+ if (function->shared()->name()->IsString()) {
1361
+ function_name = String::cast(function->shared()->name());
1362
+ }
1363
+ return GetCode(CONSTANT_FUNCTION, function_name);
1364
+ }
1365
+
1366
+
957
1367
  Object* CallStubCompiler::CompileCallConstant(Object* object,
958
1368
  JSObject* holder,
959
1369
  JSFunction* function,
@@ -966,7 +1376,19 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
966
1376
  // -- ...
967
1377
  // -- esp[(argc + 1) * 4] : receiver
968
1378
  // -----------------------------------
969
- Label miss;
1379
+
1380
+ SharedFunctionInfo* function_info = function->shared();
1381
+ if (function_info->HasCustomCallGenerator()) {
1382
+ CustomCallGenerator generator =
1383
+ ToCData<CustomCallGenerator>(function_info->function_data());
1384
+ Object* result = generator(this, object, holder, function, name, check);
1385
+ // undefined means bail out to regular compiler.
1386
+ if (!result->IsUndefined()) {
1387
+ return result;
1388
+ }
1389
+ }
1390
+
1391
+ Label miss_in_smi_check;
970
1392
 
971
1393
  // Get the receiver from the stack.
972
1394
  const int argc = arguments().immediate();
@@ -975,104 +1397,123 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
975
1397
  // Check that the receiver isn't a smi.
976
1398
  if (check != NUMBER_CHECK) {
977
1399
  __ test(edx, Immediate(kSmiTagMask));
978
- __ j(zero, &miss, not_taken);
1400
+ __ j(zero, &miss_in_smi_check, not_taken);
979
1401
  }
980
1402
 
981
1403
  // Make sure that it's okay not to patch the on stack receiver
982
1404
  // unless we're doing a receiver map check.
983
1405
  ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
984
1406
 
1407
+ CallOptimization optimization(function);
1408
+ int depth = kInvalidProtoDepth;
1409
+ Label miss;
1410
+
985
1411
  switch (check) {
986
1412
  case RECEIVER_MAP_CHECK:
1413
+ __ IncrementCounter(&Counters::call_const, 1);
1414
+
1415
+ if (optimization.is_simple_api_call() && !object->IsGlobalObject()) {
1416
+ depth = optimization.GetPrototypeDepthOfExpectedType(
1417
+ JSObject::cast(object), holder);
1418
+ }
1419
+
1420
+ if (depth != kInvalidProtoDepth) {
1421
+ __ IncrementCounter(&Counters::call_const_fast_api, 1);
1422
+ ReserveSpaceForFastApiCall(masm(), eax);
1423
+ }
1424
+
987
1425
  // Check that the maps haven't changed.
988
1426
  CheckPrototypes(JSObject::cast(object), edx, holder,
989
- ebx, eax, name, &miss);
1427
+ ebx, eax, name, depth, &miss);
990
1428
 
991
1429
  // Patch the receiver on the stack with the global proxy if
992
1430
  // necessary.
993
1431
  if (object->IsGlobalObject()) {
1432
+ ASSERT(depth == kInvalidProtoDepth);
994
1433
  __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
995
1434
  __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
996
1435
  }
997
1436
  break;
998
1437
 
999
1438
  case STRING_CHECK:
1000
- // Check that the object is a two-byte string or a symbol.
1001
- __ mov(eax, FieldOperand(edx, HeapObject::kMapOffset));
1002
- __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset));
1003
- __ cmp(eax, FIRST_NONSTRING_TYPE);
1004
- __ j(above_equal, &miss, not_taken);
1005
- // Check that the maps starting from the prototype haven't changed.
1006
- GenerateLoadGlobalFunctionPrototype(masm(),
1007
- Context::STRING_FUNCTION_INDEX,
1008
- eax);
1009
- CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1010
- ebx, edx, name, &miss);
1439
+ if (!function->IsBuiltin()) {
1440
+ // Calling non-builtins with a value as receiver requires boxing.
1441
+ __ jmp(&miss);
1442
+ } else {
1443
+ // Check that the object is a string or a symbol.
1444
+ __ mov(eax, FieldOperand(edx, HeapObject::kMapOffset));
1445
+ __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset));
1446
+ __ cmp(eax, FIRST_NONSTRING_TYPE);
1447
+ __ j(above_equal, &miss, not_taken);
1448
+ // Check that the maps starting from the prototype haven't changed.
1449
+ GenerateLoadGlobalFunctionPrototype(masm(),
1450
+ Context::STRING_FUNCTION_INDEX,
1451
+ eax);
1452
+ CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1453
+ ebx, edx, name, &miss);
1454
+ }
1011
1455
  break;
1012
1456
 
1013
1457
  case NUMBER_CHECK: {
1014
- Label fast;
1015
- // Check that the object is a smi or a heap number.
1016
- __ test(edx, Immediate(kSmiTagMask));
1017
- __ j(zero, &fast, taken);
1018
- __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax);
1019
- __ j(not_equal, &miss, not_taken);
1020
- __ bind(&fast);
1021
- // Check that the maps starting from the prototype haven't changed.
1022
- GenerateLoadGlobalFunctionPrototype(masm(),
1023
- Context::NUMBER_FUNCTION_INDEX,
1024
- eax);
1025
- CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1026
- ebx, edx, name, &miss);
1458
+ if (!function->IsBuiltin()) {
1459
+ // Calling non-builtins with a value as receiver requires boxing.
1460
+ __ jmp(&miss);
1461
+ } else {
1462
+ Label fast;
1463
+ // Check that the object is a smi or a heap number.
1464
+ __ test(edx, Immediate(kSmiTagMask));
1465
+ __ j(zero, &fast, taken);
1466
+ __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax);
1467
+ __ j(not_equal, &miss, not_taken);
1468
+ __ bind(&fast);
1469
+ // Check that the maps starting from the prototype haven't changed.
1470
+ GenerateLoadGlobalFunctionPrototype(masm(),
1471
+ Context::NUMBER_FUNCTION_INDEX,
1472
+ eax);
1473
+ CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1474
+ ebx, edx, name, &miss);
1475
+ }
1027
1476
  break;
1028
1477
  }
1029
1478
 
1030
1479
  case BOOLEAN_CHECK: {
1031
- Label fast;
1032
- // Check that the object is a boolean.
1033
- __ cmp(edx, Factory::true_value());
1034
- __ j(equal, &fast, taken);
1035
- __ cmp(edx, Factory::false_value());
1036
- __ j(not_equal, &miss, not_taken);
1037
- __ bind(&fast);
1038
- // Check that the maps starting from the prototype haven't changed.
1039
- GenerateLoadGlobalFunctionPrototype(masm(),
1040
- Context::BOOLEAN_FUNCTION_INDEX,
1041
- eax);
1042
- CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1043
- ebx, edx, name, &miss);
1480
+ if (!function->IsBuiltin()) {
1481
+ // Calling non-builtins with a value as receiver requires boxing.
1482
+ __ jmp(&miss);
1483
+ } else {
1484
+ Label fast;
1485
+ // Check that the object is a boolean.
1486
+ __ cmp(edx, Factory::true_value());
1487
+ __ j(equal, &fast, taken);
1488
+ __ cmp(edx, Factory::false_value());
1489
+ __ j(not_equal, &miss, not_taken);
1490
+ __ bind(&fast);
1491
+ // Check that the maps starting from the prototype haven't changed.
1492
+ GenerateLoadGlobalFunctionPrototype(masm(),
1493
+ Context::BOOLEAN_FUNCTION_INDEX,
1494
+ eax);
1495
+ CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1496
+ ebx, edx, name, &miss);
1497
+ }
1044
1498
  break;
1045
1499
  }
1046
1500
 
1047
- case JSARRAY_HAS_FAST_ELEMENTS_CHECK:
1048
- CheckPrototypes(JSObject::cast(object), edx, holder,
1049
- ebx, eax, name, &miss);
1050
- // Make sure object->HasFastElements().
1051
- // Get the elements array of the object.
1052
- __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset));
1053
- // Check that the object is in fast mode (not dictionary).
1054
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1055
- Immediate(Factory::fixed_array_map()));
1056
- __ j(not_equal, &miss, not_taken);
1057
- break;
1058
-
1059
1501
  default:
1060
1502
  UNREACHABLE();
1061
1503
  }
1062
1504
 
1063
- // Get the function and setup the context.
1064
- __ mov(edi, Immediate(Handle<JSFunction>(function)));
1065
- __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
1066
-
1067
- // Jump to the cached code (tail call).
1068
- ASSERT(function->is_compiled());
1069
- Handle<Code> code(function->code());
1070
- ParameterCount expected(function->shared()->formal_parameter_count());
1071
- __ InvokeCode(code, expected, arguments(),
1072
- RelocInfo::CODE_TARGET, JUMP_FUNCTION);
1505
+ if (depth != kInvalidProtoDepth) {
1506
+ GenerateFastApiCall(masm(), optimization, argc);
1507
+ } else {
1508
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1509
+ }
1073
1510
 
1074
1511
  // Handle call cache miss.
1075
1512
  __ bind(&miss);
1513
+ if (depth != kInvalidProtoDepth) {
1514
+ FreeSpaceForFastApiCall(masm(), eax);
1515
+ }
1516
+ __ bind(&miss_in_smi_check);
1076
1517
  Handle<Code> ic = ComputeCallMiss(arguments().immediate());
1077
1518
  __ jmp(ic, RelocInfo::CODE_TARGET);
1078
1519
 
@@ -1085,7 +1526,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
1085
1526
  }
1086
1527
 
1087
1528
 
1088
- Object* CallStubCompiler::CompileCallInterceptor(Object* object,
1529
+ Object* CallStubCompiler::CompileCallInterceptor(JSObject* object,
1089
1530
  JSObject* holder,
1090
1531
  String* name) {
1091
1532
  // ----------- S t a t e -------------
@@ -1106,18 +1547,16 @@ Object* CallStubCompiler::CompileCallInterceptor(Object* object,
1106
1547
  // Get the receiver from the stack.
1107
1548
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1108
1549
 
1109
- CallInterceptorCompiler compiler(arguments(), ecx);
1110
- CompileLoadInterceptor(&compiler,
1111
- this,
1112
- masm(),
1113
- JSObject::cast(object),
1114
- holder,
1115
- name,
1116
- &lookup,
1117
- edx,
1118
- ebx,
1119
- edi,
1120
- &miss);
1550
+ CallInterceptorCompiler compiler(this, arguments(), ecx);
1551
+ compiler.Compile(masm(),
1552
+ object,
1553
+ holder,
1554
+ name,
1555
+ &lookup,
1556
+ edx,
1557
+ ebx,
1558
+ edi,
1559
+ &miss);
1121
1560
 
1122
1561
  // Restore receiver.
1123
1562
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
@@ -1240,21 +1679,17 @@ Object* StoreStubCompiler::CompileStoreField(JSObject* object,
1240
1679
  // ----------- S t a t e -------------
1241
1680
  // -- eax : value
1242
1681
  // -- ecx : name
1682
+ // -- edx : receiver
1243
1683
  // -- esp[0] : return address
1244
- // -- esp[4] : receiver
1245
1684
  // -----------------------------------
1246
1685
  Label miss;
1247
1686
 
1248
- // Get the object from the stack.
1249
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
1250
-
1251
1687
  // Generate store field code. Trashes the name register.
1252
1688
  GenerateStoreField(masm(),
1253
- Builtins::StoreIC_ExtendStorage,
1254
1689
  object,
1255
1690
  index,
1256
1691
  transition,
1257
- ebx, ecx, edx,
1692
+ edx, ecx, ebx,
1258
1693
  &miss);
1259
1694
 
1260
1695
  // Handle store cache miss.
@@ -1274,26 +1709,23 @@ Object* StoreStubCompiler::CompileStoreCallback(JSObject* object,
1274
1709
  // ----------- S t a t e -------------
1275
1710
  // -- eax : value
1276
1711
  // -- ecx : name
1712
+ // -- edx : receiver
1277
1713
  // -- esp[0] : return address
1278
- // -- esp[4] : receiver
1279
1714
  // -----------------------------------
1280
1715
  Label miss;
1281
1716
 
1282
- // Get the object from the stack.
1283
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
1284
-
1285
1717
  // Check that the object isn't a smi.
1286
- __ test(ebx, Immediate(kSmiTagMask));
1718
+ __ test(edx, Immediate(kSmiTagMask));
1287
1719
  __ j(zero, &miss, not_taken);
1288
1720
 
1289
1721
  // Check that the map of the object hasn't changed.
1290
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1722
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
1291
1723
  Immediate(Handle<Map>(object->map())));
1292
1724
  __ j(not_equal, &miss, not_taken);
1293
1725
 
1294
1726
  // Perform global security token check if needed.
1295
1727
  if (object->IsJSGlobalProxy()) {
1296
- __ CheckAccessGlobalProxy(ebx, edx, &miss);
1728
+ __ CheckAccessGlobalProxy(edx, ebx, &miss);
1297
1729
  }
1298
1730
 
1299
1731
  // Stub never generated for non-global objects that require access
@@ -1301,7 +1733,7 @@ Object* StoreStubCompiler::CompileStoreCallback(JSObject* object,
1301
1733
  ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
1302
1734
 
1303
1735
  __ pop(ebx); // remove the return address
1304
- __ push(Operand(esp, 0)); // receiver
1736
+ __ push(edx); // receiver
1305
1737
  __ push(Immediate(Handle<AccessorInfo>(callback))); // callback info
1306
1738
  __ push(ecx); // name
1307
1739
  __ push(eax); // value
@@ -1310,11 +1742,10 @@ Object* StoreStubCompiler::CompileStoreCallback(JSObject* object,
1310
1742
  // Do tail-call to the runtime system.
1311
1743
  ExternalReference store_callback_property =
1312
1744
  ExternalReference(IC_Utility(IC::kStoreCallbackProperty));
1313
- __ TailCallRuntime(store_callback_property, 4, 1);
1745
+ __ TailCallExternalReference(store_callback_property, 4, 1);
1314
1746
 
1315
1747
  // Handle store cache miss.
1316
1748
  __ bind(&miss);
1317
- __ mov(ecx, Immediate(Handle<String>(name))); // restore name
1318
1749
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1319
1750
  __ jmp(ic, RelocInfo::CODE_TARGET);
1320
1751
 
@@ -1328,26 +1759,23 @@ Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
1328
1759
  // ----------- S t a t e -------------
1329
1760
  // -- eax : value
1330
1761
  // -- ecx : name
1762
+ // -- edx : receiver
1331
1763
  // -- esp[0] : return address
1332
- // -- esp[4] : receiver
1333
1764
  // -----------------------------------
1334
1765
  Label miss;
1335
1766
 
1336
- // Get the object from the stack.
1337
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
1338
-
1339
1767
  // Check that the object isn't a smi.
1340
- __ test(ebx, Immediate(kSmiTagMask));
1768
+ __ test(edx, Immediate(kSmiTagMask));
1341
1769
  __ j(zero, &miss, not_taken);
1342
1770
 
1343
1771
  // Check that the map of the object hasn't changed.
1344
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1772
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
1345
1773
  Immediate(Handle<Map>(receiver->map())));
1346
1774
  __ j(not_equal, &miss, not_taken);
1347
1775
 
1348
1776
  // Perform global security token check if needed.
1349
1777
  if (receiver->IsJSGlobalProxy()) {
1350
- __ CheckAccessGlobalProxy(ebx, edx, &miss);
1778
+ __ CheckAccessGlobalProxy(edx, ebx, &miss);
1351
1779
  }
1352
1780
 
1353
1781
  // Stub never generated for non-global objects that require access
@@ -1355,7 +1783,7 @@ Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
1355
1783
  ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
1356
1784
 
1357
1785
  __ pop(ebx); // remove the return address
1358
- __ push(Operand(esp, 0)); // receiver
1786
+ __ push(edx); // receiver
1359
1787
  __ push(ecx); // name
1360
1788
  __ push(eax); // value
1361
1789
  __ push(ebx); // restore return address
@@ -1363,11 +1791,10 @@ Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
1363
1791
  // Do tail-call to the runtime system.
1364
1792
  ExternalReference store_ic_property =
1365
1793
  ExternalReference(IC_Utility(IC::kStoreInterceptorProperty));
1366
- __ TailCallRuntime(store_ic_property, 3, 1);
1794
+ __ TailCallExternalReference(store_ic_property, 3, 1);
1367
1795
 
1368
1796
  // Handle store cache miss.
1369
1797
  __ bind(&miss);
1370
- __ mov(ecx, Immediate(Handle<String>(name))); // restore name
1371
1798
  Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1372
1799
  __ jmp(ic, RelocInfo::CODE_TARGET);
1373
1800
 
@@ -1382,14 +1809,13 @@ Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
1382
1809
  // ----------- S t a t e -------------
1383
1810
  // -- eax : value
1384
1811
  // -- ecx : name
1812
+ // -- edx : receiver
1385
1813
  // -- esp[0] : return address
1386
- // -- esp[4] : receiver
1387
1814
  // -----------------------------------
1388
1815
  Label miss;
1389
1816
 
1390
1817
  // Check that the map of the global has not changed.
1391
- __ mov(ebx, Operand(esp, kPointerSize));
1392
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1818
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
1393
1819
  Immediate(Handle<Map>(object->map())));
1394
1820
  __ j(not_equal, &miss, not_taken);
1395
1821
 
@@ -1418,30 +1844,24 @@ Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
1418
1844
  String* name) {
1419
1845
  // ----------- S t a t e -------------
1420
1846
  // -- eax : value
1847
+ // -- ecx : key
1848
+ // -- edx : receiver
1421
1849
  // -- esp[0] : return address
1422
- // -- esp[4] : key
1423
- // -- esp[8] : receiver
1424
1850
  // -----------------------------------
1425
1851
  Label miss;
1426
1852
 
1427
1853
  __ IncrementCounter(&Counters::keyed_store_field, 1);
1428
1854
 
1429
- // Get the name from the stack.
1430
- __ mov(ecx, Operand(esp, 1 * kPointerSize));
1431
1855
  // Check that the name has not changed.
1432
1856
  __ cmp(Operand(ecx), Immediate(Handle<String>(name)));
1433
1857
  __ j(not_equal, &miss, not_taken);
1434
1858
 
1435
- // Get the object from the stack.
1436
- __ mov(ebx, Operand(esp, 2 * kPointerSize));
1437
-
1438
1859
  // Generate store field code. Trashes the name register.
1439
1860
  GenerateStoreField(masm(),
1440
- Builtins::KeyedStoreIC_ExtendStorage,
1441
1861
  object,
1442
1862
  index,
1443
1863
  transition,
1444
- ebx, ecx, edx,
1864
+ edx, ecx, ebx,
1445
1865
  &miss);
1446
1866
 
1447
1867
  // Handle store cache miss.
@@ -1455,19 +1875,60 @@ Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
1455
1875
  }
1456
1876
 
1457
1877
 
1878
+ Object* LoadStubCompiler::CompileLoadNonexistent(String* name,
1879
+ JSObject* object,
1880
+ JSObject* last) {
1881
+ // ----------- S t a t e -------------
1882
+ // -- eax : receiver
1883
+ // -- ecx : name
1884
+ // -- esp[0] : return address
1885
+ // -----------------------------------
1886
+ Label miss;
1887
+
1888
+ // Check that the receiver isn't a smi.
1889
+ __ test(eax, Immediate(kSmiTagMask));
1890
+ __ j(zero, &miss, not_taken);
1891
+
1892
+ // Check the maps of the full prototype chain. Also check that
1893
+ // global property cells up to (but not including) the last object
1894
+ // in the prototype chain are empty.
1895
+ CheckPrototypes(object, eax, last, ebx, edx, name, &miss);
1896
+
1897
+ // If the last object in the prototype chain is a global object,
1898
+ // check that the global property cell is empty.
1899
+ if (last->IsGlobalObject()) {
1900
+ Object* cell = GenerateCheckPropertyCell(masm(),
1901
+ GlobalObject::cast(last),
1902
+ name,
1903
+ edx,
1904
+ &miss);
1905
+ if (cell->IsFailure()) return cell;
1906
+ }
1907
+
1908
+ // Return undefined if maps of the full prototype chain are still the
1909
+ // same and no global property with this name contains a value.
1910
+ __ mov(eax, Factory::undefined_value());
1911
+ __ ret(0);
1912
+
1913
+ __ bind(&miss);
1914
+ GenerateLoadMiss(masm(), Code::LOAD_IC);
1915
+
1916
+ // Return the generated code.
1917
+ return GetCode(NONEXISTENT, Heap::empty_string());
1918
+ }
1919
+
1458
1920
 
1459
1921
  Object* LoadStubCompiler::CompileLoadField(JSObject* object,
1460
1922
  JSObject* holder,
1461
1923
  int index,
1462
1924
  String* name) {
1463
1925
  // ----------- S t a t e -------------
1926
+ // -- eax : receiver
1464
1927
  // -- ecx : name
1465
1928
  // -- esp[0] : return address
1466
- // -- esp[4] : receiver
1467
1929
  // -----------------------------------
1468
1930
  Label miss;
1469
1931
 
1470
- __ mov(eax, Operand(esp, kPointerSize));
1471
1932
  GenerateLoadField(object, holder, eax, ebx, edx, index, name, &miss);
1472
1933
  __ bind(&miss);
1473
1934
  GenerateLoadMiss(masm(), Code::LOAD_IC);
@@ -1482,13 +1943,12 @@ Object* LoadStubCompiler::CompileLoadCallback(String* name,
1482
1943
  JSObject* holder,
1483
1944
  AccessorInfo* callback) {
1484
1945
  // ----------- S t a t e -------------
1946
+ // -- eax : receiver
1485
1947
  // -- ecx : name
1486
1948
  // -- esp[0] : return address
1487
- // -- esp[4] : receiver
1488
1949
  // -----------------------------------
1489
1950
  Label miss;
1490
1951
 
1491
- __ mov(eax, Operand(esp, kPointerSize));
1492
1952
  Failure* failure = Failure::InternalError();
1493
1953
  bool success = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx,
1494
1954
  callback, name, &miss, &failure);
@@ -1507,13 +1967,12 @@ Object* LoadStubCompiler::CompileLoadConstant(JSObject* object,
1507
1967
  Object* value,
1508
1968
  String* name) {
1509
1969
  // ----------- S t a t e -------------
1970
+ // -- eax : receiver
1510
1971
  // -- ecx : name
1511
1972
  // -- esp[0] : return address
1512
- // -- esp[4] : receiver
1513
1973
  // -----------------------------------
1514
1974
  Label miss;
1515
1975
 
1516
- __ mov(eax, Operand(esp, kPointerSize));
1517
1976
  GenerateLoadConstant(object, holder, eax, ebx, edx, value, name, &miss);
1518
1977
  __ bind(&miss);
1519
1978
  GenerateLoadMiss(masm(), Code::LOAD_IC);
@@ -1527,16 +1986,15 @@ Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1527
1986
  JSObject* holder,
1528
1987
  String* name) {
1529
1988
  // ----------- S t a t e -------------
1989
+ // -- eax : receiver
1530
1990
  // -- ecx : name
1531
1991
  // -- esp[0] : return address
1532
- // -- esp[4] : receiver
1533
1992
  // -----------------------------------
1534
1993
  Label miss;
1535
1994
 
1536
1995
  LookupResult lookup;
1537
1996
  LookupPostInterceptor(holder, name, &lookup);
1538
1997
 
1539
- __ mov(eax, Operand(esp, kPointerSize));
1540
1998
  // TODO(368): Compile in the whole chain: all the interceptors in
1541
1999
  // prototypes and ultimate answer.
1542
2000
  GenerateLoadInterceptor(receiver,
@@ -1563,15 +2021,12 @@ Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
1563
2021
  String* name,
1564
2022
  bool is_dont_delete) {
1565
2023
  // ----------- S t a t e -------------
2024
+ // -- eax : receiver
1566
2025
  // -- ecx : name
1567
2026
  // -- esp[0] : return address
1568
- // -- esp[4] : receiver
1569
2027
  // -----------------------------------
1570
2028
  Label miss;
1571
2029
 
1572
- // Get the receiver from the stack.
1573
- __ mov(eax, Operand(esp, kPointerSize));
1574
-
1575
2030
  // If the object is the holder then we know that it's a global
1576
2031
  // object which can only happen for contextual loads. In this case,
1577
2032
  // the receiver cannot be a smi.
@@ -1584,19 +2039,20 @@ Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
1584
2039
  CheckPrototypes(object, eax, holder, ebx, edx, name, &miss);
1585
2040
 
1586
2041
  // Get the value from the cell.
1587
- __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell)));
1588
- __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset));
2042
+ __ mov(ebx, Immediate(Handle<JSGlobalPropertyCell>(cell)));
2043
+ __ mov(ebx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset));
1589
2044
 
1590
2045
  // Check for deleted property if property can actually be deleted.
1591
2046
  if (!is_dont_delete) {
1592
- __ cmp(eax, Factory::the_hole_value());
2047
+ __ cmp(ebx, Factory::the_hole_value());
1593
2048
  __ j(equal, &miss, not_taken);
1594
2049
  } else if (FLAG_debug_code) {
1595
- __ cmp(eax, Factory::the_hole_value());
2050
+ __ cmp(ebx, Factory::the_hole_value());
1596
2051
  __ Check(not_equal, "DontDelete cells can't contain the hole");
1597
2052
  }
1598
2053
 
1599
2054
  __ IncrementCounter(&Counters::named_load_global_inline, 1);
2055
+ __ mov(eax, ebx);
1600
2056
  __ ret(0);
1601
2057
 
1602
2058
  __ bind(&miss);
@@ -1613,21 +2069,19 @@ Object* KeyedLoadStubCompiler::CompileLoadField(String* name,
1613
2069
  JSObject* holder,
1614
2070
  int index) {
1615
2071
  // ----------- S t a t e -------------
2072
+ // -- eax : key
2073
+ // -- edx : receiver
1616
2074
  // -- esp[0] : return address
1617
- // -- esp[4] : name
1618
- // -- esp[8] : receiver
1619
2075
  // -----------------------------------
1620
2076
  Label miss;
1621
2077
 
1622
- __ mov(eax, Operand(esp, kPointerSize));
1623
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1624
2078
  __ IncrementCounter(&Counters::keyed_load_field, 1);
1625
2079
 
1626
2080
  // Check that the name has not changed.
1627
2081
  __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1628
2082
  __ j(not_equal, &miss, not_taken);
1629
2083
 
1630
- GenerateLoadField(receiver, holder, ecx, ebx, edx, index, name, &miss);
2084
+ GenerateLoadField(receiver, holder, edx, ebx, ecx, index, name, &miss);
1631
2085
 
1632
2086
  __ bind(&miss);
1633
2087
  __ DecrementCounter(&Counters::keyed_load_field, 1);
@@ -1643,14 +2097,12 @@ Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name,
1643
2097
  JSObject* holder,
1644
2098
  AccessorInfo* callback) {
1645
2099
  // ----------- S t a t e -------------
2100
+ // -- eax : key
2101
+ // -- edx : receiver
1646
2102
  // -- esp[0] : return address
1647
- // -- esp[4] : name
1648
- // -- esp[8] : receiver
1649
2103
  // -----------------------------------
1650
2104
  Label miss;
1651
2105
 
1652
- __ mov(eax, Operand(esp, kPointerSize));
1653
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1654
2106
  __ IncrementCounter(&Counters::keyed_load_callback, 1);
1655
2107
 
1656
2108
  // Check that the name has not changed.
@@ -1658,7 +2110,7 @@ Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name,
1658
2110
  __ j(not_equal, &miss, not_taken);
1659
2111
 
1660
2112
  Failure* failure = Failure::InternalError();
1661
- bool success = GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx,
2113
+ bool success = GenerateLoadCallback(receiver, holder, edx, eax, ebx, ecx,
1662
2114
  callback, name, &miss, &failure);
1663
2115
  if (!success) return failure;
1664
2116
 
@@ -1676,21 +2128,19 @@ Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
1676
2128
  JSObject* holder,
1677
2129
  Object* value) {
1678
2130
  // ----------- S t a t e -------------
2131
+ // -- eax : key
2132
+ // -- edx : receiver
1679
2133
  // -- esp[0] : return address
1680
- // -- esp[4] : name
1681
- // -- esp[8] : receiver
1682
2134
  // -----------------------------------
1683
2135
  Label miss;
1684
2136
 
1685
- __ mov(eax, Operand(esp, kPointerSize));
1686
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1687
2137
  __ IncrementCounter(&Counters::keyed_load_constant_function, 1);
1688
2138
 
1689
2139
  // Check that the name has not changed.
1690
2140
  __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1691
2141
  __ j(not_equal, &miss, not_taken);
1692
2142
 
1693
- GenerateLoadConstant(receiver, holder, ecx, ebx, edx,
2143
+ GenerateLoadConstant(receiver, holder, edx, ebx, ecx,
1694
2144
  value, name, &miss);
1695
2145
  __ bind(&miss);
1696
2146
  __ DecrementCounter(&Counters::keyed_load_constant_function, 1);
@@ -1705,14 +2155,12 @@ Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1705
2155
  JSObject* holder,
1706
2156
  String* name) {
1707
2157
  // ----------- S t a t e -------------
2158
+ // -- eax : key
2159
+ // -- edx : receiver
1708
2160
  // -- esp[0] : return address
1709
- // -- esp[4] : name
1710
- // -- esp[8] : receiver
1711
2161
  // -----------------------------------
1712
2162
  Label miss;
1713
2163
 
1714
- __ mov(eax, Operand(esp, kPointerSize));
1715
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1716
2164
  __ IncrementCounter(&Counters::keyed_load_interceptor, 1);
1717
2165
 
1718
2166
  // Check that the name has not changed.
@@ -1724,9 +2172,9 @@ Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1724
2172
  GenerateLoadInterceptor(receiver,
1725
2173
  holder,
1726
2174
  &lookup,
1727
- ecx,
1728
- eax,
1729
2175
  edx,
2176
+ eax,
2177
+ ecx,
1730
2178
  ebx,
1731
2179
  name,
1732
2180
  &miss);
@@ -1743,21 +2191,19 @@ Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1743
2191
 
1744
2192
  Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
1745
2193
  // ----------- S t a t e -------------
2194
+ // -- eax : key
2195
+ // -- edx : receiver
1746
2196
  // -- esp[0] : return address
1747
- // -- esp[4] : name
1748
- // -- esp[8] : receiver
1749
2197
  // -----------------------------------
1750
2198
  Label miss;
1751
2199
 
1752
- __ mov(eax, Operand(esp, kPointerSize));
1753
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1754
2200
  __ IncrementCounter(&Counters::keyed_load_array_length, 1);
1755
2201
 
1756
2202
  // Check that the name has not changed.
1757
2203
  __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1758
2204
  __ j(not_equal, &miss, not_taken);
1759
2205
 
1760
- GenerateLoadArrayLength(masm(), ecx, edx, &miss);
2206
+ GenerateLoadArrayLength(masm(), edx, ecx, &miss);
1761
2207
  __ bind(&miss);
1762
2208
  __ DecrementCounter(&Counters::keyed_load_array_length, 1);
1763
2209
  GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
@@ -1769,21 +2215,19 @@ Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
1769
2215
 
1770
2216
  Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
1771
2217
  // ----------- S t a t e -------------
2218
+ // -- eax : key
2219
+ // -- edx : receiver
1772
2220
  // -- esp[0] : return address
1773
- // -- esp[4] : name
1774
- // -- esp[8] : receiver
1775
2221
  // -----------------------------------
1776
2222
  Label miss;
1777
2223
 
1778
- __ mov(eax, Operand(esp, kPointerSize));
1779
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1780
2224
  __ IncrementCounter(&Counters::keyed_load_string_length, 1);
1781
2225
 
1782
2226
  // Check that the name has not changed.
1783
2227
  __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1784
2228
  __ j(not_equal, &miss, not_taken);
1785
2229
 
1786
- GenerateLoadStringLength(masm(), ecx, edx, &miss);
2230
+ GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss);
1787
2231
  __ bind(&miss);
1788
2232
  __ DecrementCounter(&Counters::keyed_load_string_length, 1);
1789
2233
  GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
@@ -1795,21 +2239,19 @@ Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
1795
2239
 
1796
2240
  Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
1797
2241
  // ----------- S t a t e -------------
2242
+ // -- eax : key
2243
+ // -- edx : receiver
1798
2244
  // -- esp[0] : return address
1799
- // -- esp[4] : name
1800
- // -- esp[8] : receiver
1801
2245
  // -----------------------------------
1802
2246
  Label miss;
1803
2247
 
1804
- __ mov(eax, Operand(esp, kPointerSize));
1805
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
1806
2248
  __ IncrementCounter(&Counters::keyed_load_function_prototype, 1);
1807
2249
 
1808
2250
  // Check that the name has not changed.
1809
2251
  __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1810
2252
  __ j(not_equal, &miss, not_taken);
1811
2253
 
1812
- GenerateLoadFunctionPrototype(masm(), ecx, edx, ebx, &miss);
2254
+ GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss);
1813
2255
  __ bind(&miss);
1814
2256
  __ DecrementCounter(&Counters::keyed_load_function_prototype, 1);
1815
2257
  GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);