therubyracer 0.9.0beta2 → 0.9.0beta3

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 (920) hide show
  1. data/.gitmodules +3 -0
  2. data/ext/v8/upstream/Makefile +1 -2
  3. data/ext/v8/upstream/v8/.gitignore +33 -0
  4. data/ext/v8/upstream/v8/AUTHORS +42 -0
  5. data/ext/v8/upstream/v8/ChangeLog +2663 -0
  6. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE +0 -0
  7. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.strongtalk +0 -0
  8. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.v8 +0 -0
  9. data/ext/v8/upstream/{3.1.8 → v8}/LICENSE.valgrind +0 -0
  10. data/ext/v8/upstream/v8/SConstruct +1473 -0
  11. data/ext/v8/upstream/{3.1.8 → v8}/build/README.txt +0 -0
  12. data/ext/v8/upstream/{3.1.8 → v8}/build/all.gyp +0 -0
  13. data/ext/v8/upstream/{3.1.8 → v8}/build/armu.gypi +0 -0
  14. data/ext/v8/upstream/{3.1.8 → v8}/build/common.gypi +0 -0
  15. data/ext/v8/upstream/{3.1.8 → v8}/build/gyp_v8 +0 -0
  16. data/ext/v8/upstream/v8/include/v8-debug.h +394 -0
  17. data/ext/v8/upstream/v8/include/v8-preparser.h +116 -0
  18. data/ext/v8/upstream/v8/include/v8-profiler.h +505 -0
  19. data/ext/v8/upstream/v8/include/v8-testing.h +104 -0
  20. data/ext/v8/upstream/v8/include/v8.h +4000 -0
  21. data/ext/v8/upstream/{3.1.8 → v8}/include/v8stdint.h +0 -0
  22. data/ext/v8/upstream/v8/preparser/SConscript +38 -0
  23. data/ext/v8/upstream/v8/preparser/preparser-process.cc +169 -0
  24. data/ext/v8/upstream/v8/src/SConscript +380 -0
  25. data/ext/v8/upstream/v8/src/accessors.cc +766 -0
  26. data/ext/v8/upstream/{3.1.8 → v8}/src/accessors.h +0 -0
  27. data/ext/v8/upstream/v8/src/allocation-inl.h +49 -0
  28. data/ext/v8/upstream/v8/src/allocation.cc +122 -0
  29. data/ext/v8/upstream/v8/src/allocation.h +143 -0
  30. data/ext/v8/upstream/v8/src/api.cc +5678 -0
  31. data/ext/v8/upstream/v8/src/api.h +572 -0
  32. data/ext/v8/upstream/{3.1.8 → v8}/src/apinatives.js +0 -0
  33. data/ext/v8/upstream/v8/src/apiutils.h +73 -0
  34. data/ext/v8/upstream/v8/src/arguments.h +116 -0
  35. data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +353 -0
  36. data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +2877 -0
  37. data/ext/v8/upstream/v8/src/arm/assembler-arm.h +1382 -0
  38. data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +1634 -0
  39. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +6917 -0
  40. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +623 -0
  41. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/codegen-arm-inl.h +0 -0
  42. data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +7437 -0
  43. data/ext/v8/upstream/v8/src/arm/codegen-arm.h +595 -0
  44. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/constants-arm.cc +0 -0
  45. data/ext/v8/upstream/v8/src/arm/constants-arm.h +778 -0
  46. data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +149 -0
  47. data/ext/v8/upstream/v8/src/arm/debug-arm.cc +317 -0
  48. data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +737 -0
  49. data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +1503 -0
  50. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/frames-arm.cc +0 -0
  51. data/ext/v8/upstream/v8/src/arm/frames-arm.h +168 -0
  52. data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +4374 -0
  53. data/ext/v8/upstream/v8/src/arm/ic-arm.cc +1793 -0
  54. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/jump-target-arm.cc +0 -0
  55. data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +2120 -0
  56. data/ext/v8/upstream/v8/src/arm/lithium-arm.h +2179 -0
  57. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +4132 -0
  58. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +329 -0
  59. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  60. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/lithium-gap-resolver-arm.h +0 -0
  61. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +2939 -0
  62. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +1071 -0
  63. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  64. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  65. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm-inl.h +0 -0
  66. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm.cc +0 -0
  67. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/register-allocator-arm.h +0 -0
  68. data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +3288 -0
  69. data/ext/v8/upstream/v8/src/arm/simulator-arm.h +413 -0
  70. data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +4034 -0
  71. data/ext/v8/upstream/{3.1.8 → v8}/src/arm/virtual-frame-arm-inl.h +0 -0
  72. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +843 -0
  73. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +523 -0
  74. data/ext/v8/upstream/v8/src/array.js +1249 -0
  75. data/ext/v8/upstream/v8/src/assembler.cc +1067 -0
  76. data/ext/v8/upstream/v8/src/assembler.h +823 -0
  77. data/ext/v8/upstream/v8/src/ast-inl.h +112 -0
  78. data/ext/v8/upstream/v8/src/ast.cc +1078 -0
  79. data/ext/v8/upstream/v8/src/ast.h +2234 -0
  80. data/ext/v8/upstream/v8/src/atomicops.h +167 -0
  81. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_arm_gcc.h +0 -0
  82. data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +169 -0
  83. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_gcc.cc +0 -0
  84. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_gcc.h +0 -0
  85. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_macosx.h +0 -0
  86. data/ext/v8/upstream/{3.1.8 → v8}/src/atomicops_internals_x86_msvc.h +0 -0
  87. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum-dtoa.cc +0 -0
  88. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum-dtoa.h +0 -0
  89. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum.cc +0 -0
  90. data/ext/v8/upstream/{3.1.8 → v8}/src/bignum.h +0 -0
  91. data/ext/v8/upstream/v8/src/bootstrapper.cc +2138 -0
  92. data/ext/v8/upstream/v8/src/bootstrapper.h +185 -0
  93. data/ext/v8/upstream/v8/src/builtins.cc +1708 -0
  94. data/ext/v8/upstream/v8/src/builtins.h +368 -0
  95. data/ext/v8/upstream/{3.1.8 → v8}/src/bytecodes-irregexp.h +0 -0
  96. data/ext/v8/upstream/{3.1.8 → v8}/src/cached-powers.cc +0 -0
  97. data/ext/v8/upstream/{3.1.8 → v8}/src/cached-powers.h +0 -0
  98. data/ext/v8/upstream/{3.1.8 → v8}/src/char-predicates-inl.h +0 -0
  99. data/ext/v8/upstream/{3.1.8 → v8}/src/char-predicates.h +0 -0
  100. data/ext/v8/upstream/v8/src/checks.cc +110 -0
  101. data/ext/v8/upstream/v8/src/checks.h +296 -0
  102. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue-inl.h +0 -0
  103. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue.cc +0 -0
  104. data/ext/v8/upstream/{3.1.8 → v8}/src/circular-queue.h +0 -0
  105. data/ext/v8/upstream/v8/src/code-stubs.cc +240 -0
  106. data/ext/v8/upstream/v8/src/code-stubs.h +971 -0
  107. data/ext/v8/upstream/{3.1.8 → v8}/src/code.h +0 -0
  108. data/ext/v8/upstream/v8/src/codegen-inl.h +68 -0
  109. data/ext/v8/upstream/v8/src/codegen.cc +505 -0
  110. data/ext/v8/upstream/v8/src/codegen.h +245 -0
  111. data/ext/v8/upstream/v8/src/compilation-cache.cc +540 -0
  112. data/ext/v8/upstream/v8/src/compilation-cache.h +287 -0
  113. data/ext/v8/upstream/v8/src/compiler.cc +792 -0
  114. data/ext/v8/upstream/v8/src/compiler.h +307 -0
  115. data/ext/v8/upstream/v8/src/contexts.cc +327 -0
  116. data/ext/v8/upstream/v8/src/contexts.h +382 -0
  117. data/ext/v8/upstream/{3.1.8 → v8}/src/conversions-inl.h +0 -0
  118. data/ext/v8/upstream/v8/src/conversions.cc +1125 -0
  119. data/ext/v8/upstream/{3.1.8 → v8}/src/conversions.h +0 -0
  120. data/ext/v8/upstream/v8/src/counters.cc +93 -0
  121. data/ext/v8/upstream/v8/src/counters.h +254 -0
  122. data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +101 -0
  123. data/ext/v8/upstream/v8/src/cpu-profiler.cc +606 -0
  124. data/ext/v8/upstream/v8/src/cpu-profiler.h +305 -0
  125. data/ext/v8/upstream/v8/src/cpu.h +67 -0
  126. data/ext/v8/upstream/v8/src/d8-debug.cc +367 -0
  127. data/ext/v8/upstream/v8/src/d8-debug.h +158 -0
  128. data/ext/v8/upstream/v8/src/d8-posix.cc +695 -0
  129. data/ext/v8/upstream/{3.1.8 → v8}/src/d8-readline.cc +0 -0
  130. data/ext/v8/upstream/{3.1.8 → v8}/src/d8-windows.cc +0 -0
  131. data/ext/v8/upstream/v8/src/d8.cc +796 -0
  132. data/ext/v8/upstream/v8/src/d8.gyp +88 -0
  133. data/ext/v8/upstream/{3.1.8 → v8}/src/d8.h +0 -0
  134. data/ext/v8/upstream/{3.1.8 → v8}/src/d8.js +0 -0
  135. data/ext/v8/upstream/{3.1.8 → v8}/src/data-flow.cc +0 -0
  136. data/ext/v8/upstream/v8/src/data-flow.h +379 -0
  137. data/ext/v8/upstream/{3.1.8 → v8}/src/date.js +0 -0
  138. data/ext/v8/upstream/{3.1.8 → v8}/src/dateparser-inl.h +0 -0
  139. data/ext/v8/upstream/{3.1.8 → v8}/src/dateparser.cc +0 -0
  140. data/ext/v8/upstream/v8/src/dateparser.h +265 -0
  141. data/ext/v8/upstream/v8/src/debug-agent.cc +447 -0
  142. data/ext/v8/upstream/v8/src/debug-agent.h +129 -0
  143. data/ext/v8/upstream/{3.1.8 → v8}/src/debug-debugger.js +0 -0
  144. data/ext/v8/upstream/v8/src/debug.cc +3188 -0
  145. data/ext/v8/upstream/v8/src/debug.h +1055 -0
  146. data/ext/v8/upstream/v8/src/deoptimizer.cc +1296 -0
  147. data/ext/v8/upstream/v8/src/deoptimizer.h +629 -0
  148. data/ext/v8/upstream/v8/src/disasm.h +80 -0
  149. data/ext/v8/upstream/v8/src/disassembler.cc +339 -0
  150. data/ext/v8/upstream/{3.1.8 → v8}/src/disassembler.h +0 -0
  151. data/ext/v8/upstream/{3.1.8 → v8}/src/diy-fp.cc +0 -0
  152. data/ext/v8/upstream/{3.1.8 → v8}/src/diy-fp.h +0 -0
  153. data/ext/v8/upstream/{3.1.8 → v8}/src/double.h +0 -0
  154. data/ext/v8/upstream/{3.1.8 → v8}/src/dtoa.cc +0 -0
  155. data/ext/v8/upstream/{3.1.8 → v8}/src/dtoa.h +0 -0
  156. data/ext/v8/upstream/v8/src/execution.cc +791 -0
  157. data/ext/v8/upstream/v8/src/execution.h +291 -0
  158. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +250 -0
  159. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +89 -0
  160. data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +55 -0
  161. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +284 -0
  162. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/experimental/i18n-extension.h +0 -0
  163. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +141 -0
  164. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/externalize-string-extension.h +0 -0
  165. data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +58 -0
  166. data/ext/v8/upstream/{3.1.8 → v8}/src/extensions/gc-extension.h +0 -0
  167. data/ext/v8/upstream/v8/src/factory.cc +1194 -0
  168. data/ext/v8/upstream/v8/src/factory.h +436 -0
  169. data/ext/v8/upstream/{3.1.8 → v8}/src/fast-dtoa.cc +0 -0
  170. data/ext/v8/upstream/{3.1.8 → v8}/src/fast-dtoa.h +0 -0
  171. data/ext/v8/upstream/{3.1.8 → v8}/src/fixed-dtoa.cc +0 -0
  172. data/ext/v8/upstream/{3.1.8 → v8}/src/fixed-dtoa.h +0 -0
  173. data/ext/v8/upstream/v8/src/flag-definitions.h +556 -0
  174. data/ext/v8/upstream/{3.1.8 → v8}/src/flags.cc +0 -0
  175. data/ext/v8/upstream/{3.1.8 → v8}/src/flags.h +0 -0
  176. data/ext/v8/upstream/v8/src/frame-element.cc +37 -0
  177. data/ext/v8/upstream/v8/src/frame-element.h +269 -0
  178. data/ext/v8/upstream/v8/src/frames-inl.h +236 -0
  179. data/ext/v8/upstream/v8/src/frames.cc +1273 -0
  180. data/ext/v8/upstream/v8/src/frames.h +854 -0
  181. data/ext/v8/upstream/v8/src/full-codegen.cc +1385 -0
  182. data/ext/v8/upstream/v8/src/full-codegen.h +753 -0
  183. data/ext/v8/upstream/v8/src/func-name-inferrer.cc +91 -0
  184. data/ext/v8/upstream/v8/src/func-name-inferrer.h +111 -0
  185. data/ext/v8/upstream/v8/src/gdb-jit.cc +1548 -0
  186. data/ext/v8/upstream/{3.1.8 → v8}/src/gdb-jit.h +0 -0
  187. data/ext/v8/upstream/v8/src/global-handles.cc +596 -0
  188. data/ext/v8/upstream/v8/src/global-handles.h +239 -0
  189. data/ext/v8/upstream/v8/src/globals.h +325 -0
  190. data/ext/v8/upstream/v8/src/handles-inl.h +177 -0
  191. data/ext/v8/upstream/v8/src/handles.cc +965 -0
  192. data/ext/v8/upstream/v8/src/handles.h +372 -0
  193. data/ext/v8/upstream/{3.1.8 → v8}/src/hashmap.cc +0 -0
  194. data/ext/v8/upstream/v8/src/hashmap.h +121 -0
  195. data/ext/v8/upstream/v8/src/heap-inl.h +703 -0
  196. data/ext/v8/upstream/v8/src/heap-profiler.cc +1173 -0
  197. data/ext/v8/upstream/v8/src/heap-profiler.h +396 -0
  198. data/ext/v8/upstream/v8/src/heap.cc +5856 -0
  199. data/ext/v8/upstream/v8/src/heap.h +2264 -0
  200. data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +1639 -0
  201. data/ext/v8/upstream/v8/src/hydrogen-instructions.h +3657 -0
  202. data/ext/v8/upstream/v8/src/hydrogen.cc +6011 -0
  203. data/ext/v8/upstream/v8/src/hydrogen.h +1137 -0
  204. data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +430 -0
  205. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +2846 -0
  206. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +1159 -0
  207. data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +1596 -0
  208. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +6549 -0
  209. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +495 -0
  210. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/codegen-ia32-inl.h +0 -0
  211. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +10385 -0
  212. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +801 -0
  213. data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +88 -0
  214. data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +312 -0
  215. data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  216. data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +1620 -0
  217. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/frames-ia32.cc +0 -0
  218. data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +140 -0
  219. data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +4357 -0
  220. data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +1779 -0
  221. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/jump-target-ia32.cc +0 -0
  222. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +4158 -0
  223. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +318 -0
  224. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +466 -0
  225. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/lithium-gap-resolver-ia32.h +0 -0
  226. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +2181 -0
  227. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +2235 -0
  228. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +2056 -0
  229. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +807 -0
  230. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +1264 -0
  231. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  232. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/register-allocator-ia32-inl.h +0 -0
  233. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +157 -0
  234. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/register-allocator-ia32.h +0 -0
  235. data/ext/v8/upstream/{3.1.8 → v8}/src/ia32/simulator-ia32.cc +0 -0
  236. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +72 -0
  237. data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +3711 -0
  238. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +1366 -0
  239. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +650 -0
  240. data/ext/v8/upstream/v8/src/ic-inl.h +130 -0
  241. data/ext/v8/upstream/v8/src/ic.cc +2389 -0
  242. data/ext/v8/upstream/v8/src/ic.h +675 -0
  243. data/ext/v8/upstream/{3.1.8 → v8}/src/inspector.cc +0 -0
  244. data/ext/v8/upstream/{3.1.8 → v8}/src/inspector.h +0 -0
  245. data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +659 -0
  246. data/ext/v8/upstream/v8/src/interpreter-irregexp.h +49 -0
  247. data/ext/v8/upstream/v8/src/isolate.cc +883 -0
  248. data/ext/v8/upstream/v8/src/isolate.h +1306 -0
  249. data/ext/v8/upstream/v8/src/json.js +342 -0
  250. data/ext/v8/upstream/v8/src/jsregexp.cc +5371 -0
  251. data/ext/v8/upstream/v8/src/jsregexp.h +1483 -0
  252. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-heavy-inl.h +0 -0
  253. data/ext/v8/upstream/v8/src/jump-target-heavy.cc +427 -0
  254. data/ext/v8/upstream/v8/src/jump-target-heavy.h +238 -0
  255. data/ext/v8/upstream/v8/src/jump-target-inl.h +48 -0
  256. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-light-inl.h +0 -0
  257. data/ext/v8/upstream/v8/src/jump-target-light.cc +111 -0
  258. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target-light.h +0 -0
  259. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target.cc +0 -0
  260. data/ext/v8/upstream/{3.1.8 → v8}/src/jump-target.h +0 -0
  261. data/ext/v8/upstream/{3.1.8 → v8}/src/list-inl.h +0 -0
  262. data/ext/v8/upstream/{3.1.8 → v8}/src/list.h +0 -0
  263. data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +142 -0
  264. data/ext/v8/upstream/v8/src/lithium-allocator.cc +2105 -0
  265. data/ext/v8/upstream/v8/src/lithium-allocator.h +630 -0
  266. data/ext/v8/upstream/v8/src/lithium.cc +169 -0
  267. data/ext/v8/upstream/{3.1.8 → v8}/src/lithium.h +0 -0
  268. data/ext/v8/upstream/{3.1.8 → v8}/src/liveedit-debugger.js +0 -0
  269. data/ext/v8/upstream/v8/src/liveedit.cc +1693 -0
  270. data/ext/v8/upstream/v8/src/liveedit.h +179 -0
  271. data/ext/v8/upstream/{3.1.8 → v8}/src/liveobjectlist-inl.h +0 -0
  272. data/ext/v8/upstream/v8/src/liveobjectlist.cc +2589 -0
  273. data/ext/v8/upstream/v8/src/liveobjectlist.h +322 -0
  274. data/ext/v8/upstream/{3.1.8 → v8}/src/log-inl.h +0 -0
  275. data/ext/v8/upstream/v8/src/log-utils.cc +423 -0
  276. data/ext/v8/upstream/v8/src/log-utils.h +229 -0
  277. data/ext/v8/upstream/v8/src/log.cc +1666 -0
  278. data/ext/v8/upstream/v8/src/log.h +446 -0
  279. data/ext/v8/upstream/{3.1.8 → v8}/src/macro-assembler.h +0 -0
  280. data/ext/v8/upstream/{3.1.8 → v8}/src/macros.py +0 -0
  281. data/ext/v8/upstream/v8/src/mark-compact.cc +3092 -0
  282. data/ext/v8/upstream/v8/src/mark-compact.h +506 -0
  283. data/ext/v8/upstream/{3.1.8 → v8}/src/math.js +0 -0
  284. data/ext/v8/upstream/v8/src/messages.cc +166 -0
  285. data/ext/v8/upstream/{3.1.8 → v8}/src/messages.h +0 -0
  286. data/ext/v8/upstream/v8/src/messages.js +1090 -0
  287. data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +335 -0
  288. data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +2093 -0
  289. data/ext/v8/upstream/v8/src/mips/assembler-mips.h +1066 -0
  290. data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +148 -0
  291. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +752 -0
  292. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +511 -0
  293. data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +64 -0
  294. data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +1213 -0
  295. data/ext/v8/upstream/v8/src/mips/codegen-mips.h +633 -0
  296. data/ext/v8/upstream/v8/src/mips/constants-mips.cc +352 -0
  297. data/ext/v8/upstream/v8/src/mips/constants-mips.h +723 -0
  298. data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +90 -0
  299. data/ext/v8/upstream/v8/src/mips/debug-mips.cc +155 -0
  300. data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +91 -0
  301. data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +1023 -0
  302. data/ext/v8/upstream/v8/src/mips/frames-mips.cc +48 -0
  303. data/ext/v8/upstream/v8/src/mips/frames-mips.h +179 -0
  304. data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +727 -0
  305. data/ext/v8/upstream/v8/src/mips/ic-mips.cc +244 -0
  306. data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +80 -0
  307. data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +65 -0
  308. data/ext/v8/upstream/v8/src/mips/lithium-mips.h +304 -0
  309. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +3327 -0
  310. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +1058 -0
  311. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +478 -0
  312. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +250 -0
  313. data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +134 -0
  314. data/ext/v8/upstream/{3.1.8 → v8}/src/mips/register-allocator-mips.cc +0 -0
  315. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +47 -0
  316. data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +2438 -0
  317. data/ext/v8/upstream/v8/src/mips/simulator-mips.h +394 -0
  318. data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +601 -0
  319. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +58 -0
  320. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +307 -0
  321. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +530 -0
  322. data/ext/v8/upstream/v8/src/mirror-debugger.js +2381 -0
  323. data/ext/v8/upstream/v8/src/mksnapshot.cc +256 -0
  324. data/ext/v8/upstream/{3.1.8 → v8}/src/natives.h +0 -0
  325. data/ext/v8/upstream/v8/src/objects-debug.cc +722 -0
  326. data/ext/v8/upstream/v8/src/objects-inl.h +4166 -0
  327. data/ext/v8/upstream/v8/src/objects-printer.cc +801 -0
  328. data/ext/v8/upstream/v8/src/objects-visiting.cc +142 -0
  329. data/ext/v8/upstream/v8/src/objects-visiting.h +422 -0
  330. data/ext/v8/upstream/v8/src/objects.cc +10296 -0
  331. data/ext/v8/upstream/v8/src/objects.h +6662 -0
  332. data/ext/v8/upstream/v8/src/parser.cc +5168 -0
  333. data/ext/v8/upstream/v8/src/parser.h +823 -0
  334. data/ext/v8/upstream/v8/src/platform-cygwin.cc +811 -0
  335. data/ext/v8/upstream/v8/src/platform-freebsd.cc +854 -0
  336. data/ext/v8/upstream/v8/src/platform-linux.cc +1120 -0
  337. data/ext/v8/upstream/v8/src/platform-macos.cc +865 -0
  338. data/ext/v8/upstream/v8/src/platform-nullos.cc +504 -0
  339. data/ext/v8/upstream/v8/src/platform-openbsd.cc +672 -0
  340. data/ext/v8/upstream/v8/src/platform-posix.cc +424 -0
  341. data/ext/v8/upstream/v8/src/platform-solaris.cc +796 -0
  342. data/ext/v8/upstream/v8/src/platform-tls-mac.h +62 -0
  343. data/ext/v8/upstream/v8/src/platform-tls-win32.h +62 -0
  344. data/ext/v8/upstream/v8/src/platform-tls.h +50 -0
  345. data/ext/v8/upstream/v8/src/platform-win32.cc +2072 -0
  346. data/ext/v8/upstream/v8/src/platform.h +693 -0
  347. data/ext/v8/upstream/v8/src/preparse-data.cc +185 -0
  348. data/ext/v8/upstream/{3.1.8 → v8}/src/preparse-data.h +0 -0
  349. data/ext/v8/upstream/v8/src/preparser-api.cc +219 -0
  350. data/ext/v8/upstream/v8/src/preparser.cc +1205 -0
  351. data/ext/v8/upstream/{3.1.8 → v8}/src/preparser.h +0 -0
  352. data/ext/v8/upstream/v8/src/prettyprinter.cc +1530 -0
  353. data/ext/v8/upstream/v8/src/prettyprinter.h +223 -0
  354. data/ext/v8/upstream/{3.1.8 → v8}/src/profile-generator-inl.h +0 -0
  355. data/ext/v8/upstream/v8/src/profile-generator.cc +3095 -0
  356. data/ext/v8/upstream/v8/src/profile-generator.h +1125 -0
  357. data/ext/v8/upstream/v8/src/property.cc +102 -0
  358. data/ext/v8/upstream/v8/src/property.h +348 -0
  359. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  360. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +470 -0
  361. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-irregexp.h +0 -0
  362. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-tracer.cc +0 -0
  363. data/ext/v8/upstream/{3.1.8 → v8}/src/regexp-macro-assembler-tracer.h +0 -0
  364. data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +266 -0
  365. data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +236 -0
  366. data/ext/v8/upstream/v8/src/regexp-stack.cc +111 -0
  367. data/ext/v8/upstream/v8/src/regexp-stack.h +147 -0
  368. data/ext/v8/upstream/v8/src/regexp.js +483 -0
  369. data/ext/v8/upstream/v8/src/register-allocator-inl.h +141 -0
  370. data/ext/v8/upstream/v8/src/register-allocator.cc +98 -0
  371. data/ext/v8/upstream/v8/src/register-allocator.h +310 -0
  372. data/ext/v8/upstream/v8/src/rewriter.cc +1024 -0
  373. data/ext/v8/upstream/{3.1.8 → v8}/src/rewriter.h +0 -0
  374. data/ext/v8/upstream/v8/src/runtime-profiler.cc +478 -0
  375. data/ext/v8/upstream/v8/src/runtime-profiler.h +192 -0
  376. data/ext/v8/upstream/v8/src/runtime.cc +11949 -0
  377. data/ext/v8/upstream/v8/src/runtime.h +643 -0
  378. data/ext/v8/upstream/{3.1.8 → v8}/src/runtime.js +0 -0
  379. data/ext/v8/upstream/v8/src/safepoint-table.cc +256 -0
  380. data/ext/v8/upstream/v8/src/safepoint-table.h +269 -0
  381. data/ext/v8/upstream/v8/src/scanner-base.cc +964 -0
  382. data/ext/v8/upstream/v8/src/scanner-base.h +664 -0
  383. data/ext/v8/upstream/v8/src/scanner.cc +584 -0
  384. data/ext/v8/upstream/v8/src/scanner.h +196 -0
  385. data/ext/v8/upstream/v8/src/scopeinfo.cc +631 -0
  386. data/ext/v8/upstream/v8/src/scopeinfo.h +249 -0
  387. data/ext/v8/upstream/v8/src/scopes.cc +1093 -0
  388. data/ext/v8/upstream/v8/src/scopes.h +508 -0
  389. data/ext/v8/upstream/v8/src/serialize.cc +1574 -0
  390. data/ext/v8/upstream/v8/src/serialize.h +589 -0
  391. data/ext/v8/upstream/{3.1.8 → v8}/src/shell.h +0 -0
  392. data/ext/v8/upstream/{3.1.8 → v8}/src/simulator.h +0 -0
  393. data/ext/v8/upstream/v8/src/small-pointer-list.h +163 -0
  394. data/ext/v8/upstream/{3.1.8 → v8}/src/smart-pointer.h +0 -0
  395. data/ext/v8/upstream/v8/src/snapshot-common.cc +82 -0
  396. data/ext/v8/upstream/{3.1.8 → v8}/src/snapshot-empty.cc +0 -0
  397. data/ext/v8/upstream/v8/src/snapshot.h +73 -0
  398. data/ext/v8/upstream/v8/src/spaces-inl.h +529 -0
  399. data/ext/v8/upstream/v8/src/spaces.cc +3147 -0
  400. data/ext/v8/upstream/v8/src/spaces.h +2368 -0
  401. data/ext/v8/upstream/{3.1.8 → v8}/src/splay-tree-inl.h +0 -0
  402. data/ext/v8/upstream/{3.1.8 → v8}/src/splay-tree.h +0 -0
  403. data/ext/v8/upstream/v8/src/string-search.cc +41 -0
  404. data/ext/v8/upstream/v8/src/string-search.h +568 -0
  405. data/ext/v8/upstream/v8/src/string-stream.cc +592 -0
  406. data/ext/v8/upstream/{3.1.8 → v8}/src/string-stream.h +0 -0
  407. data/ext/v8/upstream/v8/src/string.js +915 -0
  408. data/ext/v8/upstream/{3.1.8 → v8}/src/strtod.cc +0 -0
  409. data/ext/v8/upstream/{3.1.8 → v8}/src/strtod.h +0 -0
  410. data/ext/v8/upstream/v8/src/stub-cache.cc +1940 -0
  411. data/ext/v8/upstream/v8/src/stub-cache.h +866 -0
  412. data/ext/v8/upstream/{3.1.8 → v8}/src/third_party/valgrind/valgrind.h +0 -0
  413. data/ext/v8/upstream/v8/src/token.cc +63 -0
  414. data/ext/v8/upstream/v8/src/token.h +288 -0
  415. data/ext/v8/upstream/v8/src/top.cc +983 -0
  416. data/ext/v8/upstream/v8/src/type-info.cc +472 -0
  417. data/ext/v8/upstream/v8/src/type-info.h +290 -0
  418. data/ext/v8/upstream/{3.1.8 → v8}/src/unbound-queue-inl.h +0 -0
  419. data/ext/v8/upstream/{3.1.8 → v8}/src/unbound-queue.h +0 -0
  420. data/ext/v8/upstream/{3.1.8 → v8}/src/unicode-inl.h +0 -0
  421. data/ext/v8/upstream/v8/src/unicode.cc +1624 -0
  422. data/ext/v8/upstream/v8/src/unicode.h +280 -0
  423. data/ext/v8/upstream/{3.1.8 → v8}/src/uri.js +0 -0
  424. data/ext/v8/upstream/{3.1.8 → v8}/src/utils.cc +0 -0
  425. data/ext/v8/upstream/v8/src/utils.h +796 -0
  426. data/ext/v8/upstream/v8/src/v8-counters.cc +62 -0
  427. data/ext/v8/upstream/v8/src/v8-counters.h +311 -0
  428. data/ext/v8/upstream/v8/src/v8.cc +215 -0
  429. data/ext/v8/upstream/v8/src/v8.h +130 -0
  430. data/ext/v8/upstream/{3.1.8 → v8}/src/v8checks.h +0 -0
  431. data/ext/v8/upstream/{3.1.8 → v8}/src/v8dll-main.cc +0 -0
  432. data/ext/v8/upstream/v8/src/v8globals.h +486 -0
  433. data/ext/v8/upstream/{3.1.8/src/memory.h → v8/src/v8memory.h} +0 -0
  434. data/ext/v8/upstream/v8/src/v8natives.js +1293 -0
  435. data/ext/v8/upstream/{3.1.8 → v8}/src/v8preparserdll-main.cc +0 -0
  436. data/ext/v8/upstream/v8/src/v8threads.cc +453 -0
  437. data/ext/v8/upstream/v8/src/v8threads.h +164 -0
  438. data/ext/v8/upstream/v8/src/v8utils.h +317 -0
  439. data/ext/v8/upstream/{3.1.8 → v8}/src/variables.cc +0 -0
  440. data/ext/v8/upstream/v8/src/variables.h +212 -0
  441. data/ext/v8/upstream/v8/src/version.cc +116 -0
  442. data/ext/v8/upstream/v8/src/version.h +68 -0
  443. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-heavy-inl.h +0 -0
  444. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-heavy.cc +0 -0
  445. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-inl.h +0 -0
  446. data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +171 -0
  447. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame-light.cc +0 -0
  448. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame.cc +0 -0
  449. data/ext/v8/upstream/{3.1.8 → v8}/src/virtual-frame.h +0 -0
  450. data/ext/v8/upstream/v8/src/vm-state-inl.h +138 -0
  451. data/ext/v8/upstream/v8/src/vm-state.h +70 -0
  452. data/ext/v8/upstream/v8/src/win32-headers.h +96 -0
  453. data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +456 -0
  454. data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +2954 -0
  455. data/ext/v8/upstream/v8/src/x64/assembler-x64.h +1630 -0
  456. data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +1493 -0
  457. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +5132 -0
  458. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +477 -0
  459. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/codegen-x64-inl.h +0 -0
  460. data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +8843 -0
  461. data/ext/v8/upstream/v8/src/x64/codegen-x64.h +753 -0
  462. data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +88 -0
  463. data/ext/v8/upstream/v8/src/x64/debug-x64.cc +318 -0
  464. data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +815 -0
  465. data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +1752 -0
  466. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/frames-x64.cc +0 -0
  467. data/ext/v8/upstream/v8/src/x64/frames-x64.h +130 -0
  468. data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +4339 -0
  469. data/ext/v8/upstream/v8/src/x64/ic-x64.cc +1752 -0
  470. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/jump-target-x64.cc +0 -0
  471. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +3970 -0
  472. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +318 -0
  473. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/lithium-gap-resolver-x64.cc +0 -0
  474. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/lithium-gap-resolver-x64.h +0 -0
  475. data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +2115 -0
  476. data/ext/v8/upstream/v8/src/x64/lithium-x64.h +2161 -0
  477. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +2911 -0
  478. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +1984 -0
  479. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  480. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  481. data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +87 -0
  482. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +95 -0
  483. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/register-allocator-x64.h +0 -0
  484. data/ext/v8/upstream/{3.1.8 → v8}/src/x64/simulator-x64.cc +0 -0
  485. data/ext/v8/upstream/v8/src/x64/simulator-x64.h +71 -0
  486. data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +3460 -0
  487. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +1296 -0
  488. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +597 -0
  489. data/ext/v8/upstream/v8/src/zone-inl.h +129 -0
  490. data/ext/v8/upstream/v8/src/zone.cc +196 -0
  491. data/ext/v8/upstream/v8/src/zone.h +236 -0
  492. data/ext/v8/upstream/{3.1.8 → v8}/tools/codemap.js +0 -0
  493. data/ext/v8/upstream/{3.1.8 → v8}/tools/consarray.js +0 -0
  494. data/ext/v8/upstream/{3.1.8 → v8}/tools/csvparser.js +0 -0
  495. data/ext/v8/upstream/{3.1.8 → v8}/tools/disasm.py +0 -0
  496. data/ext/v8/upstream/v8/tools/freebsd-tick-processor +10 -0
  497. data/ext/v8/upstream/{3.1.8 → v8}/tools/gc-nvp-trace-processor.py +0 -0
  498. data/ext/v8/upstream/{3.1.8 → v8}/tools/generate-ten-powers.scm +0 -0
  499. data/ext/v8/upstream/{3.1.8 → v8}/tools/grokdump.py +0 -0
  500. data/ext/v8/upstream/v8/tools/gyp/v8.gyp +844 -0
  501. data/ext/v8/upstream/{3.1.8 → v8}/tools/js2c.py +0 -0
  502. data/ext/v8/upstream/{3.1.8 → v8}/tools/jsmin.py +0 -0
  503. data/ext/v8/upstream/v8/tools/linux-tick-processor +35 -0
  504. data/ext/v8/upstream/{3.1.8 → v8}/tools/ll_prof.py +0 -0
  505. data/ext/v8/upstream/{3.1.8 → v8}/tools/logreader.js +0 -0
  506. data/ext/v8/upstream/{3.1.8 → v8}/tools/mac-nm +0 -0
  507. data/ext/v8/upstream/{3.1.8 → v8}/tools/mac-tick-processor +0 -0
  508. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/README +0 -0
  509. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/SConstruct +0 -0
  510. data/ext/v8/upstream/{3.1.8 → v8}/tools/oom_dump/oom_dump.cc +0 -0
  511. data/ext/v8/upstream/{3.1.8 → v8}/tools/presubmit.py +0 -0
  512. data/ext/v8/upstream/{3.1.8 → v8}/tools/process-heap-prof.py +0 -0
  513. data/ext/v8/upstream/{3.1.8 → v8}/tools/profile.js +0 -0
  514. data/ext/v8/upstream/{3.1.8 → v8}/tools/profile_view.js +0 -0
  515. data/ext/v8/upstream/{3.1.8 → v8}/tools/run-valgrind.py +0 -0
  516. data/ext/v8/upstream/{3.1.8 → v8}/tools/splaytree.js +0 -0
  517. data/ext/v8/upstream/{3.1.8 → v8}/tools/stats-viewer.py +0 -0
  518. data/ext/v8/upstream/v8/tools/test.py +1490 -0
  519. data/ext/v8/upstream/{3.1.8 → v8}/tools/tickprocessor-driver.js +0 -0
  520. data/ext/v8/upstream/v8/tools/tickprocessor.js +877 -0
  521. data/ext/v8/upstream/{3.1.8 → v8}/tools/utils.py +0 -0
  522. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/README.txt +0 -0
  523. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/arm.vsprops +0 -0
  524. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/common.vsprops +0 -0
  525. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8.vcproj +0 -0
  526. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8_arm.vcproj +0 -0
  527. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8_x64.vcproj +0 -0
  528. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/d8js2c.cmd +0 -0
  529. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/debug.vsprops +0 -0
  530. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/ia32.vsprops +0 -0
  531. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/js2c.cmd +0 -0
  532. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/release.vsprops +0 -0
  533. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8.sln +0 -0
  534. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8.vcproj +0 -0
  535. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_arm.sln +0 -0
  536. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_arm.vcproj +0 -0
  537. data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +1308 -0
  538. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +1238 -0
  539. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +1300 -0
  540. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest.vcproj +0 -0
  541. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  542. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  543. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  544. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  545. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  546. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  547. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  548. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample.vcproj +0 -0
  549. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -0
  550. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -0
  551. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  552. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  553. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  554. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  555. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_x64.sln +0 -0
  556. data/ext/v8/upstream/{3.1.8 → v8}/tools/visual_studio/v8_x64.vcproj +0 -0
  557. data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +18 -0
  558. data/ext/v8/upstream/{3.1.8 → v8}/tools/windows-tick-processor.bat +0 -0
  559. data/ext/v8/v8_callbacks.cpp +52 -92
  560. data/ext/v8/v8_date.cpp +2 -3
  561. data/ext/v8/v8_object.cpp +4 -0
  562. data/ext/v8/v8_template.cpp +2 -2
  563. data/ext/v8/v8_try_catch.cpp +8 -38
  564. data/lib/v8/version.rb +1 -1
  565. data/spec/ext/ext_spec_helper.rb +2 -20
  566. data/spec/ext/object_spec.rb +0 -12
  567. data/spec/ext/try_catch_spec.rb +29 -1
  568. data/spec/spec_helper.rb +1 -0
  569. data/spec/v8/portal/proxies_spec.rb +1 -84
  570. data/specmem/handle_memspec.rb +41 -0
  571. data/specmem/object_memspec.rb +16 -0
  572. data/specmem/proxies_memspec.rb +86 -0
  573. data/specmem/spec_helper.rb +24 -0
  574. data/therubyracer.gemspec +7 -2
  575. metadata +564 -541
  576. data/ext/v8/upstream/3.1.8/.gitignore +0 -31
  577. data/ext/v8/upstream/3.1.8/AUTHORS +0 -40
  578. data/ext/v8/upstream/3.1.8/ChangeLog +0 -2566
  579. data/ext/v8/upstream/3.1.8/SConstruct +0 -1192
  580. data/ext/v8/upstream/3.1.8/include/v8-debug.h +0 -384
  581. data/ext/v8/upstream/3.1.8/include/v8-preparser.h +0 -116
  582. data/ext/v8/upstream/3.1.8/include/v8-profiler.h +0 -426
  583. data/ext/v8/upstream/3.1.8/include/v8-testing.h +0 -99
  584. data/ext/v8/upstream/3.1.8/include/v8.h +0 -3846
  585. data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +0 -206
  586. data/ext/v8/upstream/3.1.8/src/SConscript +0 -356
  587. data/ext/v8/upstream/3.1.8/src/accessors.cc +0 -907
  588. data/ext/v8/upstream/3.1.8/src/allocation.cc +0 -204
  589. data/ext/v8/upstream/3.1.8/src/allocation.h +0 -176
  590. data/ext/v8/upstream/3.1.8/src/api.cc +0 -5191
  591. data/ext/v8/upstream/3.1.8/src/api.h +0 -508
  592. data/ext/v8/upstream/3.1.8/src/apiutils.h +0 -80
  593. data/ext/v8/upstream/3.1.8/src/arguments.h +0 -105
  594. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +0 -352
  595. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +0 -2756
  596. data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +0 -1294
  597. data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +0 -1628
  598. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +0 -6783
  599. data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +0 -657
  600. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +0 -7403
  601. data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +0 -595
  602. data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +0 -769
  603. data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +0 -147
  604. data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +0 -315
  605. data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +0 -700
  606. data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +0 -1439
  607. data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +0 -168
  608. data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +0 -4230
  609. data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +0 -1799
  610. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +0 -2041
  611. data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +0 -2046
  612. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +0 -3822
  613. data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +0 -312
  614. data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +0 -303
  615. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +0 -2701
  616. data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +0 -1015
  617. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +0 -1280
  618. data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +0 -252
  619. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +0 -3165
  620. data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +0 -402
  621. data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +0 -4077
  622. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +0 -843
  623. data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +0 -520
  624. data/ext/v8/upstream/3.1.8/src/array.js +0 -1231
  625. data/ext/v8/upstream/3.1.8/src/assembler.cc +0 -973
  626. data/ext/v8/upstream/3.1.8/src/assembler.h +0 -787
  627. data/ext/v8/upstream/3.1.8/src/ast-inl.h +0 -107
  628. data/ext/v8/upstream/3.1.8/src/ast.cc +0 -1067
  629. data/ext/v8/upstream/3.1.8/src/ast.h +0 -2177
  630. data/ext/v8/upstream/3.1.8/src/atomicops.h +0 -165
  631. data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +0 -1888
  632. data/ext/v8/upstream/3.1.8/src/bootstrapper.h +0 -118
  633. data/ext/v8/upstream/3.1.8/src/builtins.cc +0 -1586
  634. data/ext/v8/upstream/3.1.8/src/builtins.h +0 -339
  635. data/ext/v8/upstream/3.1.8/src/checks.cc +0 -110
  636. data/ext/v8/upstream/3.1.8/src/checks.h +0 -292
  637. data/ext/v8/upstream/3.1.8/src/code-stubs.cc +0 -230
  638. data/ext/v8/upstream/3.1.8/src/code-stubs.h +0 -950
  639. data/ext/v8/upstream/3.1.8/src/codegen-inl.h +0 -64
  640. data/ext/v8/upstream/3.1.8/src/codegen.cc +0 -495
  641. data/ext/v8/upstream/3.1.8/src/codegen.h +0 -245
  642. data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +0 -654
  643. data/ext/v8/upstream/3.1.8/src/compilation-cache.h +0 -112
  644. data/ext/v8/upstream/3.1.8/src/compiler.cc +0 -806
  645. data/ext/v8/upstream/3.1.8/src/compiler.h +0 -290
  646. data/ext/v8/upstream/3.1.8/src/contexts.cc +0 -320
  647. data/ext/v8/upstream/3.1.8/src/contexts.h +0 -376
  648. data/ext/v8/upstream/3.1.8/src/conversions.cc +0 -1069
  649. data/ext/v8/upstream/3.1.8/src/counters.cc +0 -78
  650. data/ext/v8/upstream/3.1.8/src/counters.h +0 -242
  651. data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +0 -100
  652. data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +0 -554
  653. data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +0 -291
  654. data/ext/v8/upstream/3.1.8/src/cpu.h +0 -65
  655. data/ext/v8/upstream/3.1.8/src/d8-debug.cc +0 -367
  656. data/ext/v8/upstream/3.1.8/src/d8-debug.h +0 -157
  657. data/ext/v8/upstream/3.1.8/src/d8-posix.cc +0 -693
  658. data/ext/v8/upstream/3.1.8/src/d8.cc +0 -792
  659. data/ext/v8/upstream/3.1.8/src/d8.gyp +0 -85
  660. data/ext/v8/upstream/3.1.8/src/data-flow.h +0 -379
  661. data/ext/v8/upstream/3.1.8/src/dateparser.h +0 -263
  662. data/ext/v8/upstream/3.1.8/src/debug-agent.cc +0 -446
  663. data/ext/v8/upstream/3.1.8/src/debug-agent.h +0 -131
  664. data/ext/v8/upstream/3.1.8/src/debug.cc +0 -3085
  665. data/ext/v8/upstream/3.1.8/src/debug.h +0 -1025
  666. data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +0 -1185
  667. data/ext/v8/upstream/3.1.8/src/deoptimizer.h +0 -529
  668. data/ext/v8/upstream/3.1.8/src/disasm.h +0 -77
  669. data/ext/v8/upstream/3.1.8/src/disassembler.cc +0 -338
  670. data/ext/v8/upstream/3.1.8/src/execution.cc +0 -735
  671. data/ext/v8/upstream/3.1.8/src/execution.h +0 -322
  672. data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +0 -53
  673. data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +0 -264
  674. data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +0 -141
  675. data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +0 -58
  676. data/ext/v8/upstream/3.1.8/src/factory.cc +0 -1087
  677. data/ext/v8/upstream/3.1.8/src/factory.h +0 -432
  678. data/ext/v8/upstream/3.1.8/src/flag-definitions.h +0 -552
  679. data/ext/v8/upstream/3.1.8/src/frame-element.cc +0 -42
  680. data/ext/v8/upstream/3.1.8/src/frame-element.h +0 -277
  681. data/ext/v8/upstream/3.1.8/src/frames-inl.h +0 -210
  682. data/ext/v8/upstream/3.1.8/src/frames.cc +0 -1232
  683. data/ext/v8/upstream/3.1.8/src/frames.h +0 -826
  684. data/ext/v8/upstream/3.1.8/src/full-codegen.cc +0 -1382
  685. data/ext/v8/upstream/3.1.8/src/full-codegen.h +0 -751
  686. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +0 -90
  687. data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +0 -111
  688. data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +0 -1547
  689. data/ext/v8/upstream/3.1.8/src/global-handles.cc +0 -534
  690. data/ext/v8/upstream/3.1.8/src/global-handles.h +0 -181
  691. data/ext/v8/upstream/3.1.8/src/globals.h +0 -325
  692. data/ext/v8/upstream/3.1.8/src/handles-inl.h +0 -80
  693. data/ext/v8/upstream/3.1.8/src/handles.cc +0 -910
  694. data/ext/v8/upstream/3.1.8/src/handles.h +0 -424
  695. data/ext/v8/upstream/3.1.8/src/hashmap.h +0 -121
  696. data/ext/v8/upstream/3.1.8/src/heap-inl.h +0 -587
  697. data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +0 -1128
  698. data/ext/v8/upstream/3.1.8/src/heap-profiler.h +0 -381
  699. data/ext/v8/upstream/3.1.8/src/heap.cc +0 -5610
  700. data/ext/v8/upstream/3.1.8/src/heap.h +0 -2218
  701. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +0 -1490
  702. data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +0 -3493
  703. data/ext/v8/upstream/3.1.8/src/hydrogen.cc +0 -6056
  704. data/ext/v8/upstream/3.1.8/src/hydrogen.h +0 -1091
  705. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +0 -429
  706. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +0 -2800
  707. data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +0 -1093
  708. data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +0 -1590
  709. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +0 -6624
  710. data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +0 -536
  711. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +0 -10354
  712. data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +0 -798
  713. data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +0 -87
  714. data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +0 -309
  715. data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +0 -664
  716. data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +0 -1597
  717. data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +0 -140
  718. data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +0 -4278
  719. data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +0 -1786
  720. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +0 -3880
  721. data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +0 -309
  722. data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +0 -460
  723. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +0 -2095
  724. data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +0 -2127
  725. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +0 -2031
  726. data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +0 -798
  727. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1253
  728. data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +0 -215
  729. data/ext/v8/upstream/3.1.8/src/ia32/register-allocator-ia32.cc +0 -157
  730. data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +0 -72
  731. data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +0 -3732
  732. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +0 -1360
  733. data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +0 -646
  734. data/ext/v8/upstream/3.1.8/src/ic-inl.h +0 -129
  735. data/ext/v8/upstream/3.1.8/src/ic.cc +0 -2333
  736. data/ext/v8/upstream/3.1.8/src/ic.h +0 -639
  737. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +0 -655
  738. data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.h +0 -48
  739. data/ext/v8/upstream/3.1.8/src/json.js +0 -342
  740. data/ext/v8/upstream/3.1.8/src/jsregexp.cc +0 -5340
  741. data/ext/v8/upstream/3.1.8/src/jsregexp.h +0 -1484
  742. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +0 -430
  743. data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +0 -244
  744. data/ext/v8/upstream/3.1.8/src/jump-target-inl.h +0 -48
  745. data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +0 -111
  746. data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +0 -140
  747. data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +0 -2093
  748. data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +0 -644
  749. data/ext/v8/upstream/3.1.8/src/lithium.cc +0 -168
  750. data/ext/v8/upstream/3.1.8/src/liveedit.cc +0 -1650
  751. data/ext/v8/upstream/3.1.8/src/liveedit.h +0 -174
  752. data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +0 -2527
  753. data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +0 -322
  754. data/ext/v8/upstream/3.1.8/src/log-utils.cc +0 -336
  755. data/ext/v8/upstream/3.1.8/src/log-utils.h +0 -232
  756. data/ext/v8/upstream/3.1.8/src/log.cc +0 -1608
  757. data/ext/v8/upstream/3.1.8/src/log.h +0 -379
  758. data/ext/v8/upstream/3.1.8/src/mark-compact.cc +0 -2957
  759. data/ext/v8/upstream/3.1.8/src/mark-compact.h +0 -433
  760. data/ext/v8/upstream/3.1.8/src/messages.cc +0 -164
  761. data/ext/v8/upstream/3.1.8/src/messages.js +0 -1071
  762. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips-inl.h +0 -215
  763. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.cc +0 -1219
  764. data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +0 -667
  765. data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +0 -205
  766. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips-inl.h +0 -70
  767. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.cc +0 -1437
  768. data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +0 -431
  769. data/ext/v8/upstream/3.1.8/src/mips/constants-mips.cc +0 -328
  770. data/ext/v8/upstream/3.1.8/src/mips/constants-mips.h +0 -525
  771. data/ext/v8/upstream/3.1.8/src/mips/cpu-mips.cc +0 -73
  772. data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +0 -127
  773. data/ext/v8/upstream/3.1.8/src/mips/disasm-mips.cc +0 -787
  774. data/ext/v8/upstream/3.1.8/src/mips/fast-codegen-mips.cc +0 -77
  775. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +0 -96
  776. data/ext/v8/upstream/3.1.8/src/mips/frames-mips.h +0 -164
  777. data/ext/v8/upstream/3.1.8/src/mips/full-codegen-mips.cc +0 -277
  778. data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +0 -208
  779. data/ext/v8/upstream/3.1.8/src/mips/jump-target-mips.cc +0 -175
  780. data/ext/v8/upstream/3.1.8/src/mips/macro-assembler-mips.cc +0 -1326
  781. data/ext/v8/upstream/3.1.8/src/mips/macro-assembler-mips.h +0 -461
  782. data/ext/v8/upstream/3.1.8/src/mips/register-allocator-mips-inl.h +0 -137
  783. data/ext/v8/upstream/3.1.8/src/mips/register-allocator-mips.h +0 -46
  784. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +0 -1650
  785. data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +0 -311
  786. data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +0 -418
  787. data/ext/v8/upstream/3.1.8/src/mips/virtual-frame-mips.cc +0 -319
  788. data/ext/v8/upstream/3.1.8/src/mips/virtual-frame-mips.h +0 -548
  789. data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +0 -2380
  790. data/ext/v8/upstream/3.1.8/src/mksnapshot.cc +0 -256
  791. data/ext/v8/upstream/3.1.8/src/objects-debug.cc +0 -722
  792. data/ext/v8/upstream/3.1.8/src/objects-inl.h +0 -3946
  793. data/ext/v8/upstream/3.1.8/src/objects-printer.cc +0 -801
  794. data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +0 -142
  795. data/ext/v8/upstream/3.1.8/src/objects-visiting.h +0 -401
  796. data/ext/v8/upstream/3.1.8/src/objects.cc +0 -10044
  797. data/ext/v8/upstream/3.1.8/src/objects.h +0 -6571
  798. data/ext/v8/upstream/3.1.8/src/parser.cc +0 -5165
  799. data/ext/v8/upstream/3.1.8/src/parser.h +0 -802
  800. data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +0 -745
  801. data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +0 -702
  802. data/ext/v8/upstream/3.1.8/src/platform-linux.cc +0 -981
  803. data/ext/v8/upstream/3.1.8/src/platform-macos.cc +0 -732
  804. data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +0 -498
  805. data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +0 -657
  806. data/ext/v8/upstream/3.1.8/src/platform-posix.cc +0 -399
  807. data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +0 -714
  808. data/ext/v8/upstream/3.1.8/src/platform-win32.cc +0 -1974
  809. data/ext/v8/upstream/3.1.8/src/platform.h +0 -636
  810. data/ext/v8/upstream/3.1.8/src/preparse-data.cc +0 -183
  811. data/ext/v8/upstream/3.1.8/src/preparser-api.cc +0 -213
  812. data/ext/v8/upstream/3.1.8/src/preparser.cc +0 -1205
  813. data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +0 -1539
  814. data/ext/v8/upstream/3.1.8/src/prettyprinter.h +0 -223
  815. data/ext/v8/upstream/3.1.8/src/profile-generator.cc +0 -2899
  816. data/ext/v8/upstream/3.1.8/src/profile-generator.h +0 -1151
  817. data/ext/v8/upstream/3.1.8/src/property.cc +0 -96
  818. data/ext/v8/upstream/3.1.8/src/property.h +0 -337
  819. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +0 -470
  820. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +0 -257
  821. data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +0 -231
  822. data/ext/v8/upstream/3.1.8/src/regexp-stack.cc +0 -103
  823. data/ext/v8/upstream/3.1.8/src/regexp-stack.h +0 -123
  824. data/ext/v8/upstream/3.1.8/src/regexp.js +0 -483
  825. data/ext/v8/upstream/3.1.8/src/register-allocator-inl.h +0 -141
  826. data/ext/v8/upstream/3.1.8/src/register-allocator.cc +0 -104
  827. data/ext/v8/upstream/3.1.8/src/register-allocator.h +0 -320
  828. data/ext/v8/upstream/3.1.8/src/rewriter.cc +0 -1023
  829. data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +0 -443
  830. data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +0 -77
  831. data/ext/v8/upstream/3.1.8/src/runtime.cc +0 -11592
  832. data/ext/v8/upstream/3.1.8/src/runtime.h +0 -582
  833. data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +0 -253
  834. data/ext/v8/upstream/3.1.8/src/safepoint-table.h +0 -263
  835. data/ext/v8/upstream/3.1.8/src/scanner-base.cc +0 -971
  836. data/ext/v8/upstream/3.1.8/src/scanner-base.h +0 -653
  837. data/ext/v8/upstream/3.1.8/src/scanner.cc +0 -586
  838. data/ext/v8/upstream/3.1.8/src/scanner.h +0 -194
  839. data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +0 -636
  840. data/ext/v8/upstream/3.1.8/src/scopeinfo.h +0 -238
  841. data/ext/v8/upstream/3.1.8/src/scopes.cc +0 -1063
  842. data/ext/v8/upstream/3.1.8/src/scopes.h +0 -494
  843. data/ext/v8/upstream/3.1.8/src/serialize.cc +0 -1535
  844. data/ext/v8/upstream/3.1.8/src/serialize.h +0 -584
  845. data/ext/v8/upstream/3.1.8/src/snapshot-common.cc +0 -82
  846. data/ext/v8/upstream/3.1.8/src/snapshot.h +0 -71
  847. data/ext/v8/upstream/3.1.8/src/spaces-inl.h +0 -524
  848. data/ext/v8/upstream/3.1.8/src/spaces.cc +0 -3254
  849. data/ext/v8/upstream/3.1.8/src/spaces.h +0 -2362
  850. data/ext/v8/upstream/3.1.8/src/string-search.cc +0 -40
  851. data/ext/v8/upstream/3.1.8/src/string-search.h +0 -567
  852. data/ext/v8/upstream/3.1.8/src/string-stream.cc +0 -584
  853. data/ext/v8/upstream/3.1.8/src/string.js +0 -915
  854. data/ext/v8/upstream/3.1.8/src/stub-cache.cc +0 -1878
  855. data/ext/v8/upstream/3.1.8/src/stub-cache.h +0 -849
  856. data/ext/v8/upstream/3.1.8/src/token.cc +0 -63
  857. data/ext/v8/upstream/3.1.8/src/token.h +0 -288
  858. data/ext/v8/upstream/3.1.8/src/top.cc +0 -1152
  859. data/ext/v8/upstream/3.1.8/src/top.h +0 -608
  860. data/ext/v8/upstream/3.1.8/src/type-info.cc +0 -406
  861. data/ext/v8/upstream/3.1.8/src/type-info.h +0 -283
  862. data/ext/v8/upstream/3.1.8/src/unicode.cc +0 -1624
  863. data/ext/v8/upstream/3.1.8/src/unicode.h +0 -280
  864. data/ext/v8/upstream/3.1.8/src/utils.h +0 -793
  865. data/ext/v8/upstream/3.1.8/src/v8-counters.cc +0 -55
  866. data/ext/v8/upstream/3.1.8/src/v8-counters.h +0 -290
  867. data/ext/v8/upstream/3.1.8/src/v8.cc +0 -270
  868. data/ext/v8/upstream/3.1.8/src/v8.h +0 -127
  869. data/ext/v8/upstream/3.1.8/src/v8globals.h +0 -480
  870. data/ext/v8/upstream/3.1.8/src/v8natives.js +0 -1252
  871. data/ext/v8/upstream/3.1.8/src/v8threads.cc +0 -440
  872. data/ext/v8/upstream/3.1.8/src/v8threads.h +0 -157
  873. data/ext/v8/upstream/3.1.8/src/v8utils.h +0 -354
  874. data/ext/v8/upstream/3.1.8/src/variables.h +0 -212
  875. data/ext/v8/upstream/3.1.8/src/version.cc +0 -95
  876. data/ext/v8/upstream/3.1.8/src/version.h +0 -64
  877. data/ext/v8/upstream/3.1.8/src/virtual-frame-light-inl.h +0 -170
  878. data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +0 -134
  879. data/ext/v8/upstream/3.1.8/src/vm-state.h +0 -68
  880. data/ext/v8/upstream/3.1.8/src/win32-headers.h +0 -95
  881. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +0 -455
  882. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +0 -3162
  883. data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +0 -1584
  884. data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +0 -1492
  885. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +0 -5150
  886. data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +0 -519
  887. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +0 -8835
  888. data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +0 -750
  889. data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +0 -86
  890. data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +0 -316
  891. data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +0 -781
  892. data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +0 -1737
  893. data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +0 -130
  894. data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +0 -3984
  895. data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +0 -1761
  896. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +0 -3639
  897. data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +0 -305
  898. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +0 -2044
  899. data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +0 -2052
  900. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +0 -2660
  901. data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +0 -1852
  902. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +0 -1382
  903. data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +0 -278
  904. data/ext/v8/upstream/3.1.8/src/x64/register-allocator-x64-inl.h +0 -87
  905. data/ext/v8/upstream/3.1.8/src/x64/register-allocator-x64.cc +0 -91
  906. data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +0 -71
  907. data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +0 -3509
  908. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +0 -1292
  909. data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +0 -593
  910. data/ext/v8/upstream/3.1.8/src/zone-inl.h +0 -83
  911. data/ext/v8/upstream/3.1.8/src/zone.cc +0 -195
  912. data/ext/v8/upstream/3.1.8/src/zone.h +0 -233
  913. data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +0 -869
  914. data/ext/v8/upstream/3.1.8/tools/linux-tick-processor +0 -33
  915. data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +0 -863
  916. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +0 -1296
  917. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +0 -1234
  918. data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +0 -1296
  919. data/ext/v8/upstream/3.1.8/tools/visual_studio/x64.vsprops +0 -17
  920. data/spec/ext/mem_spec.rb +0 -42
@@ -0,0 +1,130 @@
1
+ // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #ifndef V8_IC_INL_H_
29
+ #define V8_IC_INL_H_
30
+
31
+ #include "ic.h"
32
+ #include "debug.h"
33
+ #include "macro-assembler.h"
34
+
35
+ namespace v8 {
36
+ namespace internal {
37
+
38
+
39
+ Address IC::address() {
40
+ // Get the address of the call.
41
+ Address result = pc() - Assembler::kCallTargetAddressOffset;
42
+
43
+ #ifdef ENABLE_DEBUGGER_SUPPORT
44
+ Debug* debug = Isolate::Current()->debug();
45
+ // First check if any break points are active if not just return the address
46
+ // of the call.
47
+ if (!debug->has_break_points()) return result;
48
+
49
+ // At least one break point is active perform additional test to ensure that
50
+ // break point locations are updated correctly.
51
+ if (debug->IsDebugBreak(Assembler::target_address_at(result))) {
52
+ // If the call site is a call to debug break then return the address in
53
+ // the original code instead of the address in the running code. This will
54
+ // cause the original code to be updated and keeps the breakpoint active in
55
+ // the running code.
56
+ return OriginalCodeAddress();
57
+ } else {
58
+ // No break point here just return the address of the call.
59
+ return result;
60
+ }
61
+ #else
62
+ return result;
63
+ #endif
64
+ }
65
+
66
+
67
+ Code* IC::GetTargetAtAddress(Address address) {
68
+ // Get the target address of the IC.
69
+ Address target = Assembler::target_address_at(address);
70
+ // Convert target address to the code object. Code::GetCodeFromTargetAddress
71
+ // is safe for use during GC where the map might be marked.
72
+ Code* result = Code::GetCodeFromTargetAddress(target);
73
+ ASSERT(result->is_inline_cache_stub());
74
+ return result;
75
+ }
76
+
77
+
78
+ void IC::SetTargetAtAddress(Address address, Code* target) {
79
+ ASSERT(target->is_inline_cache_stub() || target->is_compare_ic_stub());
80
+ #ifdef DEBUG
81
+ // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark
82
+ // ICs as strict mode. The strict-ness of the IC must be preserved.
83
+ Code* old_target = GetTargetAtAddress(address);
84
+ if (old_target->kind() == Code::STORE_IC ||
85
+ old_target->kind() == Code::KEYED_STORE_IC) {
86
+ ASSERT(old_target->extra_ic_state() == target->extra_ic_state());
87
+ }
88
+ #endif
89
+ Assembler::set_target_address_at(address, target->instruction_start());
90
+ }
91
+
92
+
93
+ InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object,
94
+ JSObject* holder) {
95
+ if (object->IsJSObject()) {
96
+ return GetCodeCacheForObject(JSObject::cast(object), holder);
97
+ }
98
+ // If the object is a value, we use the prototype map for the cache.
99
+ ASSERT(object->IsString() || object->IsNumber() || object->IsBoolean());
100
+ return PROTOTYPE_MAP;
101
+ }
102
+
103
+
104
+ InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object,
105
+ JSObject* holder) {
106
+ // Fast-properties and global objects store stubs in their own maps.
107
+ // Slow properties objects use prototype's map (unless the property is its own
108
+ // when holder == object). It works because slow properties objects having
109
+ // the same prototype (or a prototype with the same map) and not having
110
+ // the property are interchangeable for such a stub.
111
+ if (holder != object &&
112
+ !object->HasFastProperties() &&
113
+ !object->IsJSGlobalProxy() &&
114
+ !object->IsJSGlobalObject()) {
115
+ return PROTOTYPE_MAP;
116
+ }
117
+ return OWN_MAP;
118
+ }
119
+
120
+
121
+ JSObject* IC::GetCodeCacheHolder(Object* object, InlineCacheHolderFlag holder) {
122
+ Object* map_owner = (holder == OWN_MAP ? object : object->GetPrototype());
123
+ ASSERT(map_owner->IsJSObject());
124
+ return JSObject::cast(map_owner);
125
+ }
126
+
127
+
128
+ } } // namespace v8::internal
129
+
130
+ #endif // V8_IC_INL_H_
@@ -0,0 +1,2389 @@
1
+ // Copyright 2006-2009 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "v8.h"
29
+
30
+ #include "accessors.h"
31
+ #include "api.h"
32
+ #include "arguments.h"
33
+ #include "codegen.h"
34
+ #include "execution.h"
35
+ #include "ic-inl.h"
36
+ #include "runtime.h"
37
+ #include "stub-cache.h"
38
+
39
+ namespace v8 {
40
+ namespace internal {
41
+
42
+ #ifdef DEBUG
43
+ static char TransitionMarkFromState(IC::State state) {
44
+ switch (state) {
45
+ case UNINITIALIZED: return '0';
46
+ case PREMONOMORPHIC: return 'P';
47
+ case MONOMORPHIC: return '1';
48
+ case MONOMORPHIC_PROTOTYPE_FAILURE: return '^';
49
+ case MEGAMORPHIC: return 'N';
50
+
51
+ // We never see the debugger states here, because the state is
52
+ // computed from the original code - not the patched code. Let
53
+ // these cases fall through to the unreachable code below.
54
+ case DEBUG_BREAK: break;
55
+ case DEBUG_PREPARE_STEP_IN: break;
56
+ }
57
+ UNREACHABLE();
58
+ return 0;
59
+ }
60
+
61
+ void IC::TraceIC(const char* type,
62
+ Handle<Object> name,
63
+ State old_state,
64
+ Code* new_target,
65
+ const char* extra_info) {
66
+ if (FLAG_trace_ic) {
67
+ State new_state = StateFrom(new_target,
68
+ HEAP->undefined_value(),
69
+ HEAP->undefined_value());
70
+ PrintF("[%s (%c->%c)%s", type,
71
+ TransitionMarkFromState(old_state),
72
+ TransitionMarkFromState(new_state),
73
+ extra_info);
74
+ name->Print();
75
+ PrintF("]\n");
76
+ }
77
+ }
78
+ #endif
79
+
80
+
81
+ IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) {
82
+ ASSERT(isolate == Isolate::Current());
83
+ // To improve the performance of the (much used) IC code, we unfold
84
+ // a few levels of the stack frame iteration code. This yields a
85
+ // ~35% speedup when running DeltaBlue with the '--nouse-ic' flag.
86
+ const Address entry =
87
+ Isolate::c_entry_fp(isolate->thread_local_top());
88
+ Address* pc_address =
89
+ reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
90
+ Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
91
+ // If there's another JavaScript frame on the stack, we need to look
92
+ // one frame further down the stack to find the frame pointer and
93
+ // the return address stack slot.
94
+ if (depth == EXTRA_CALL_FRAME) {
95
+ const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
96
+ pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
97
+ fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
98
+ }
99
+ #ifdef DEBUG
100
+ StackFrameIterator it;
101
+ for (int i = 0; i < depth + 1; i++) it.Advance();
102
+ StackFrame* frame = it.frame();
103
+ ASSERT(fp == frame->fp() && pc_address == frame->pc_address());
104
+ #endif
105
+ fp_ = fp;
106
+ pc_address_ = pc_address;
107
+ }
108
+
109
+
110
+ #ifdef ENABLE_DEBUGGER_SUPPORT
111
+ Address IC::OriginalCodeAddress() {
112
+ HandleScope scope;
113
+ // Compute the JavaScript frame for the frame pointer of this IC
114
+ // structure. We need this to be able to find the function
115
+ // corresponding to the frame.
116
+ StackFrameIterator it;
117
+ while (it.frame()->fp() != this->fp()) it.Advance();
118
+ JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame());
119
+ // Find the function on the stack and both the active code for the
120
+ // function and the original code.
121
+ JSFunction* function = JSFunction::cast(frame->function());
122
+ Handle<SharedFunctionInfo> shared(function->shared());
123
+ Code* code = shared->code();
124
+ ASSERT(Debug::HasDebugInfo(shared));
125
+ Code* original_code = Debug::GetDebugInfo(shared)->original_code();
126
+ ASSERT(original_code->IsCode());
127
+ // Get the address of the call site in the active code. This is the
128
+ // place where the call to DebugBreakXXX is and where the IC
129
+ // normally would be.
130
+ Address addr = pc() - Assembler::kCallTargetAddressOffset;
131
+ // Return the address in the original code. This is the place where
132
+ // the call which has been overwritten by the DebugBreakXXX resides
133
+ // and the place where the inline cache system should look.
134
+ intptr_t delta =
135
+ original_code->instruction_start() - code->instruction_start();
136
+ return addr + delta;
137
+ }
138
+ #endif
139
+
140
+
141
+ static bool HasNormalObjectsInPrototypeChain(Isolate* isolate,
142
+ LookupResult* lookup,
143
+ Object* receiver) {
144
+ Object* end = lookup->IsProperty()
145
+ ? lookup->holder() : isolate->heap()->null_value();
146
+ for (Object* current = receiver;
147
+ current != end;
148
+ current = current->GetPrototype()) {
149
+ if (current->IsJSObject() &&
150
+ !JSObject::cast(current)->HasFastProperties() &&
151
+ !current->IsJSGlobalProxy() &&
152
+ !current->IsJSGlobalObject()) {
153
+ return true;
154
+ }
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+
161
+ static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
162
+ Object* receiver,
163
+ Object* name) {
164
+ InlineCacheHolderFlag cache_holder =
165
+ Code::ExtractCacheHolderFromFlags(target->flags());
166
+
167
+ if (cache_holder == OWN_MAP && !receiver->IsJSObject()) {
168
+ // The stub was generated for JSObject but called for non-JSObject.
169
+ // IC::GetCodeCacheHolder is not applicable.
170
+ return false;
171
+ } else if (cache_holder == PROTOTYPE_MAP &&
172
+ receiver->GetPrototype()->IsNull()) {
173
+ // IC::GetCodeCacheHolder is not applicable.
174
+ return false;
175
+ }
176
+ Map* map = IC::GetCodeCacheHolder(receiver, cache_holder)->map();
177
+
178
+ // Decide whether the inline cache failed because of changes to the
179
+ // receiver itself or changes to one of its prototypes.
180
+ //
181
+ // If there are changes to the receiver itself, the map of the
182
+ // receiver will have changed and the current target will not be in
183
+ // the receiver map's code cache. Therefore, if the current target
184
+ // is in the receiver map's code cache, the inline cache failed due
185
+ // to prototype check failure.
186
+ int index = map->IndexInCodeCache(name, target);
187
+ if (index >= 0) {
188
+ map->RemoveFromCodeCache(String::cast(name), target, index);
189
+ return true;
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+
196
+ IC::State IC::StateFrom(Code* target, Object* receiver, Object* name) {
197
+ IC::State state = target->ic_state();
198
+
199
+ if (state != MONOMORPHIC || !name->IsString()) return state;
200
+ if (receiver->IsUndefined() || receiver->IsNull()) return state;
201
+
202
+ // For keyed load/store/call, the most likely cause of cache failure is
203
+ // that the key has changed. We do not distinguish between
204
+ // prototype and non-prototype failures for keyed access.
205
+ Code::Kind kind = target->kind();
206
+ if (kind == Code::KEYED_LOAD_IC ||
207
+ kind == Code::KEYED_STORE_IC ||
208
+ kind == Code::KEYED_CALL_IC) {
209
+ return MONOMORPHIC;
210
+ }
211
+
212
+ // Remove the target from the code cache if it became invalid
213
+ // because of changes in the prototype chain to avoid hitting it
214
+ // again.
215
+ // Call stubs handle this later to allow extra IC state
216
+ // transitions.
217
+ if (kind != Code::CALL_IC &&
218
+ TryRemoveInvalidPrototypeDependentStub(target, receiver, name)) {
219
+ return MONOMORPHIC_PROTOTYPE_FAILURE;
220
+ }
221
+
222
+ // The builtins object is special. It only changes when JavaScript
223
+ // builtins are loaded lazily. It is important to keep inline
224
+ // caches for the builtins object monomorphic. Therefore, if we get
225
+ // an inline cache miss for the builtins object after lazily loading
226
+ // JavaScript builtins, we return uninitialized as the state to
227
+ // force the inline cache back to monomorphic state.
228
+ if (receiver->IsJSBuiltinsObject()) {
229
+ return UNINITIALIZED;
230
+ }
231
+
232
+ return MONOMORPHIC;
233
+ }
234
+
235
+
236
+ RelocInfo::Mode IC::ComputeMode() {
237
+ Address addr = address();
238
+ Code* code = Code::cast(isolate()->heap()->FindCodeObject(addr));
239
+ for (RelocIterator it(code, RelocInfo::kCodeTargetMask);
240
+ !it.done(); it.next()) {
241
+ RelocInfo* info = it.rinfo();
242
+ if (info->pc() == addr) return info->rmode();
243
+ }
244
+ UNREACHABLE();
245
+ return RelocInfo::NONE;
246
+ }
247
+
248
+
249
+ Failure* IC::TypeError(const char* type,
250
+ Handle<Object> object,
251
+ Handle<Object> key) {
252
+ HandleScope scope(isolate());
253
+ Handle<Object> args[2] = { key, object };
254
+ Handle<Object> error = isolate()->factory()->NewTypeError(
255
+ type, HandleVector(args, 2));
256
+ return isolate()->Throw(*error);
257
+ }
258
+
259
+
260
+ Failure* IC::ReferenceError(const char* type, Handle<String> name) {
261
+ HandleScope scope(isolate());
262
+ Handle<Object> error = isolate()->factory()->NewReferenceError(
263
+ type, HandleVector(&name, 1));
264
+ return isolate()->Throw(*error);
265
+ }
266
+
267
+
268
+ void IC::Clear(Address address) {
269
+ Code* target = GetTargetAtAddress(address);
270
+
271
+ // Don't clear debug break inline cache as it will remove the break point.
272
+ if (target->ic_state() == DEBUG_BREAK) return;
273
+
274
+ switch (target->kind()) {
275
+ case Code::LOAD_IC: return LoadIC::Clear(address, target);
276
+ case Code::KEYED_LOAD_IC:
277
+ case Code::KEYED_EXTERNAL_ARRAY_LOAD_IC:
278
+ return KeyedLoadIC::Clear(address, target);
279
+ case Code::STORE_IC: return StoreIC::Clear(address, target);
280
+ case Code::KEYED_STORE_IC:
281
+ case Code::KEYED_EXTERNAL_ARRAY_STORE_IC:
282
+ return KeyedStoreIC::Clear(address, target);
283
+ case Code::CALL_IC: return CallIC::Clear(address, target);
284
+ case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target);
285
+ case Code::BINARY_OP_IC:
286
+ case Code::TYPE_RECORDING_BINARY_OP_IC:
287
+ case Code::COMPARE_IC:
288
+ // Clearing these is tricky and does not
289
+ // make any performance difference.
290
+ return;
291
+ default: UNREACHABLE();
292
+ }
293
+ }
294
+
295
+
296
+ void CallICBase::Clear(Address address, Code* target) {
297
+ State state = target->ic_state();
298
+ if (state == UNINITIALIZED) return;
299
+ Code* code =
300
+ Isolate::Current()->stub_cache()->FindCallInitialize(
301
+ target->arguments_count(),
302
+ target->ic_in_loop(),
303
+ target->kind());
304
+ SetTargetAtAddress(address, code);
305
+ }
306
+
307
+
308
+ void KeyedLoadIC::ClearInlinedVersion(Address address) {
309
+ // Insert null as the map to check for to make sure the map check fails
310
+ // sending control flow to the IC instead of the inlined version.
311
+ PatchInlinedLoad(address, HEAP->null_value());
312
+ }
313
+
314
+
315
+ void KeyedLoadIC::Clear(Address address, Code* target) {
316
+ if (target->ic_state() == UNINITIALIZED) return;
317
+ // Make sure to also clear the map used in inline fast cases. If we
318
+ // do not clear these maps, cached code can keep objects alive
319
+ // through the embedded maps.
320
+ ClearInlinedVersion(address);
321
+ SetTargetAtAddress(address, initialize_stub());
322
+ }
323
+
324
+
325
+ void LoadIC::ClearInlinedVersion(Address address) {
326
+ // Reset the map check of the inlined inobject property load (if
327
+ // present) to guarantee failure by holding an invalid map (the null
328
+ // value). The offset can be patched to anything.
329
+ Heap* heap = HEAP;
330
+ PatchInlinedLoad(address, heap->null_value(), 0);
331
+ PatchInlinedContextualLoad(address,
332
+ heap->null_value(),
333
+ heap->null_value(),
334
+ true);
335
+ }
336
+
337
+
338
+ void LoadIC::Clear(Address address, Code* target) {
339
+ if (target->ic_state() == UNINITIALIZED) return;
340
+ ClearInlinedVersion(address);
341
+ SetTargetAtAddress(address, initialize_stub());
342
+ }
343
+
344
+
345
+ void StoreIC::ClearInlinedVersion(Address address) {
346
+ // Reset the map check of the inlined inobject property store (if
347
+ // present) to guarantee failure by holding an invalid map (the null
348
+ // value). The offset can be patched to anything.
349
+ PatchInlinedStore(address, HEAP->null_value(), 0);
350
+ }
351
+
352
+
353
+ void StoreIC::Clear(Address address, Code* target) {
354
+ if (target->ic_state() == UNINITIALIZED) return;
355
+ ClearInlinedVersion(address);
356
+ SetTargetAtAddress(address,
357
+ (target->extra_ic_state() == kStrictMode)
358
+ ? initialize_stub_strict()
359
+ : initialize_stub());
360
+ }
361
+
362
+
363
+ void KeyedStoreIC::ClearInlinedVersion(Address address) {
364
+ // Insert null as the elements map to check for. This will make
365
+ // sure that the elements fast-case map check fails so that control
366
+ // flows to the IC instead of the inlined version.
367
+ PatchInlinedStore(address, HEAP->null_value());
368
+ }
369
+
370
+
371
+ void KeyedStoreIC::RestoreInlinedVersion(Address address) {
372
+ // Restore the fast-case elements map check so that the inlined
373
+ // version can be used again.
374
+ PatchInlinedStore(address, HEAP->fixed_array_map());
375
+ }
376
+
377
+
378
+ void KeyedStoreIC::Clear(Address address, Code* target) {
379
+ if (target->ic_state() == UNINITIALIZED) return;
380
+ SetTargetAtAddress(address,
381
+ (target->extra_ic_state() == kStrictMode)
382
+ ? initialize_stub_strict()
383
+ : initialize_stub());
384
+ }
385
+
386
+
387
+ static bool HasInterceptorGetter(JSObject* object) {
388
+ return !object->GetNamedInterceptor()->getter()->IsUndefined();
389
+ }
390
+
391
+
392
+ static void LookupForRead(Object* object,
393
+ String* name,
394
+ LookupResult* lookup) {
395
+ AssertNoAllocation no_gc; // pointers must stay valid
396
+
397
+ // Skip all the objects with named interceptors, but
398
+ // without actual getter.
399
+ while (true) {
400
+ object->Lookup(name, lookup);
401
+ // Besides normal conditions (property not found or it's not
402
+ // an interceptor), bail out if lookup is not cacheable: we won't
403
+ // be able to IC it anyway and regular lookup should work fine.
404
+ if (!lookup->IsFound()
405
+ || (lookup->type() != INTERCEPTOR)
406
+ || !lookup->IsCacheable()) {
407
+ return;
408
+ }
409
+
410
+ JSObject* holder = lookup->holder();
411
+ if (HasInterceptorGetter(holder)) {
412
+ return;
413
+ }
414
+
415
+ holder->LocalLookupRealNamedProperty(name, lookup);
416
+ if (lookup->IsProperty()) {
417
+ ASSERT(lookup->type() != INTERCEPTOR);
418
+ return;
419
+ }
420
+
421
+ Object* proto = holder->GetPrototype();
422
+ if (proto->IsNull()) {
423
+ lookup->NotFound();
424
+ return;
425
+ }
426
+
427
+ object = proto;
428
+ }
429
+ }
430
+
431
+
432
+ Object* CallICBase::TryCallAsFunction(Object* object) {
433
+ HandleScope scope(isolate());
434
+ Handle<Object> target(object, isolate());
435
+ Handle<Object> delegate = Execution::GetFunctionDelegate(target);
436
+
437
+ if (delegate->IsJSFunction()) {
438
+ // Patch the receiver and use the delegate as the function to
439
+ // invoke. This is used for invoking objects as if they were
440
+ // functions.
441
+ const int argc = this->target()->arguments_count();
442
+ StackFrameLocator locator;
443
+ JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
444
+ int index = frame->ComputeExpressionsCount() - (argc + 1);
445
+ frame->SetExpression(index, *target);
446
+ }
447
+
448
+ return *delegate;
449
+ }
450
+
451
+
452
+ void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
453
+ Handle<Object> object) {
454
+ if (callee->IsJSFunction()) {
455
+ Handle<JSFunction> function = Handle<JSFunction>::cast(callee);
456
+ if (function->shared()->strict_mode() || function->IsBuiltin()) {
457
+ // Do not wrap receiver for strict mode functions or for builtins.
458
+ return;
459
+ }
460
+ }
461
+
462
+ // And only wrap string, number or boolean.
463
+ if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
464
+ // Change the receiver to the result of calling ToObject on it.
465
+ const int argc = this->target()->arguments_count();
466
+ StackFrameLocator locator;
467
+ JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
468
+ int index = frame->ComputeExpressionsCount() - (argc + 1);
469
+ frame->SetExpression(index, *isolate()->factory()->ToObject(object));
470
+ }
471
+ }
472
+
473
+
474
+ MaybeObject* CallICBase::LoadFunction(State state,
475
+ Code::ExtraICState extra_ic_state,
476
+ Handle<Object> object,
477
+ Handle<String> name) {
478
+ // If the object is undefined or null it's illegal to try to get any
479
+ // of its properties; throw a TypeError in that case.
480
+ if (object->IsUndefined() || object->IsNull()) {
481
+ return TypeError("non_object_property_call", object, name);
482
+ }
483
+
484
+ // Check if the name is trivially convertible to an index and get
485
+ // the element if so.
486
+ uint32_t index;
487
+ if (name->AsArrayIndex(&index)) {
488
+ Object* result;
489
+ { MaybeObject* maybe_result = object->GetElement(index);
490
+ if (!maybe_result->ToObject(&result)) return maybe_result;
491
+ }
492
+
493
+ if (result->IsJSFunction()) return result;
494
+
495
+ // Try to find a suitable function delegate for the object at hand.
496
+ result = TryCallAsFunction(result);
497
+ if (result->IsJSFunction()) return result;
498
+
499
+ // Otherwise, it will fail in the lookup step.
500
+ }
501
+
502
+ // Lookup the property in the object.
503
+ LookupResult lookup;
504
+ LookupForRead(*object, *name, &lookup);
505
+
506
+ if (!lookup.IsProperty()) {
507
+ // If the object does not have the requested property, check which
508
+ // exception we need to throw.
509
+ if (IsContextual(object)) {
510
+ return ReferenceError("not_defined", name);
511
+ }
512
+ return TypeError("undefined_method", object, name);
513
+ }
514
+
515
+ // Lookup is valid: Update inline cache and stub cache.
516
+ if (FLAG_use_ic) {
517
+ UpdateCaches(&lookup, state, extra_ic_state, object, name);
518
+ }
519
+
520
+ // Get the property.
521
+ PropertyAttributes attr;
522
+ Object* result;
523
+ { MaybeObject* maybe_result =
524
+ object->GetProperty(*object, &lookup, *name, &attr);
525
+ if (!maybe_result->ToObject(&result)) return maybe_result;
526
+ }
527
+
528
+ if (lookup.type() == INTERCEPTOR) {
529
+ // If the object does not have the requested property, check which
530
+ // exception we need to throw.
531
+ if (attr == ABSENT) {
532
+ if (IsContextual(object)) {
533
+ return ReferenceError("not_defined", name);
534
+ }
535
+ return TypeError("undefined_method", object, name);
536
+ }
537
+ }
538
+
539
+ ASSERT(!result->IsTheHole());
540
+
541
+ HandleScope scope(isolate());
542
+ // Wrap result in a handle because ReceiverToObjectIfRequired may allocate
543
+ // new object and cause GC.
544
+ Handle<Object> result_handle(result);
545
+ // Make receiver an object if the callee requires it. Strict mode or builtin
546
+ // functions do not wrap the receiver, non-strict functions and objects
547
+ // called as functions do.
548
+ ReceiverToObjectIfRequired(result_handle, object);
549
+
550
+ if (result_handle->IsJSFunction()) {
551
+ #ifdef ENABLE_DEBUGGER_SUPPORT
552
+ // Handle stepping into a function if step into is active.
553
+ Debug* debug = isolate()->debug();
554
+ if (debug->StepInActive()) {
555
+ // Protect the result in a handle as the debugger can allocate and might
556
+ // cause GC.
557
+ Handle<JSFunction> function(JSFunction::cast(*result_handle), isolate());
558
+ debug->HandleStepIn(function, object, fp(), false);
559
+ return *function;
560
+ }
561
+ #endif
562
+
563
+ return *result_handle;
564
+ }
565
+
566
+ // Try to find a suitable function delegate for the object at hand.
567
+ result_handle = Handle<Object>(TryCallAsFunction(*result_handle));
568
+ if (result_handle->IsJSFunction()) return *result_handle;
569
+
570
+ return TypeError("property_not_function", object, name);
571
+ }
572
+
573
+
574
+ bool CallICBase::TryUpdateExtraICState(LookupResult* lookup,
575
+ Handle<Object> object,
576
+ Code::ExtraICState* extra_ic_state) {
577
+ ASSERT(kind_ == Code::CALL_IC);
578
+ if (lookup->type() != CONSTANT_FUNCTION) return false;
579
+ JSFunction* function = lookup->GetConstantFunction();
580
+ if (!function->shared()->HasBuiltinFunctionId()) return false;
581
+
582
+ // Fetch the arguments passed to the called function.
583
+ const int argc = target()->arguments_count();
584
+ Address entry = isolate()->c_entry_fp(isolate()->thread_local_top());
585
+ Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
586
+ Arguments args(argc + 1,
587
+ &Memory::Object_at(fp +
588
+ StandardFrameConstants::kCallerSPOffset +
589
+ argc * kPointerSize));
590
+ switch (function->shared()->builtin_function_id()) {
591
+ case kStringCharCodeAt:
592
+ case kStringCharAt:
593
+ if (object->IsString()) {
594
+ String* string = String::cast(*object);
595
+ // Check there's the right string value or wrapper in the receiver slot.
596
+ ASSERT(string == args[0] || string == JSValue::cast(args[0])->value());
597
+ // If we're in the default (fastest) state and the index is
598
+ // out of bounds, update the state to record this fact.
599
+ if (*extra_ic_state == DEFAULT_STRING_STUB &&
600
+ argc >= 1 && args[1]->IsNumber()) {
601
+ double index;
602
+ if (args[1]->IsSmi()) {
603
+ index = Smi::cast(args[1])->value();
604
+ } else {
605
+ ASSERT(args[1]->IsHeapNumber());
606
+ index = DoubleToInteger(HeapNumber::cast(args[1])->value());
607
+ }
608
+ if (index < 0 || index >= string->length()) {
609
+ *extra_ic_state = STRING_INDEX_OUT_OF_BOUNDS;
610
+ return true;
611
+ }
612
+ }
613
+ }
614
+ break;
615
+ default:
616
+ return false;
617
+ }
618
+ return false;
619
+ }
620
+
621
+
622
+ MaybeObject* CallICBase::ComputeMonomorphicStub(
623
+ LookupResult* lookup,
624
+ State state,
625
+ Code::ExtraICState extra_ic_state,
626
+ Handle<Object> object,
627
+ Handle<String> name) {
628
+ int argc = target()->arguments_count();
629
+ InLoopFlag in_loop = target()->ic_in_loop();
630
+ MaybeObject* maybe_code = NULL;
631
+ switch (lookup->type()) {
632
+ case FIELD: {
633
+ int index = lookup->GetFieldIndex();
634
+ maybe_code = isolate()->stub_cache()->ComputeCallField(argc,
635
+ in_loop,
636
+ kind_,
637
+ *name,
638
+ *object,
639
+ lookup->holder(),
640
+ index);
641
+ break;
642
+ }
643
+ case CONSTANT_FUNCTION: {
644
+ // Get the constant function and compute the code stub for this
645
+ // call; used for rewriting to monomorphic state and making sure
646
+ // that the code stub is in the stub cache.
647
+ JSFunction* function = lookup->GetConstantFunction();
648
+ maybe_code =
649
+ isolate()->stub_cache()->ComputeCallConstant(argc,
650
+ in_loop,
651
+ kind_,
652
+ extra_ic_state,
653
+ *name,
654
+ *object,
655
+ lookup->holder(),
656
+ function);
657
+ break;
658
+ }
659
+ case NORMAL: {
660
+ if (!object->IsJSObject()) return NULL;
661
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
662
+
663
+ if (lookup->holder()->IsGlobalObject()) {
664
+ GlobalObject* global = GlobalObject::cast(lookup->holder());
665
+ JSGlobalPropertyCell* cell =
666
+ JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
667
+ if (!cell->value()->IsJSFunction()) return NULL;
668
+ JSFunction* function = JSFunction::cast(cell->value());
669
+ maybe_code = isolate()->stub_cache()->ComputeCallGlobal(argc,
670
+ in_loop,
671
+ kind_,
672
+ *name,
673
+ *receiver,
674
+ global,
675
+ cell,
676
+ function);
677
+ } else {
678
+ // There is only one shared stub for calling normalized
679
+ // properties. It does not traverse the prototype chain, so the
680
+ // property must be found in the receiver for the stub to be
681
+ // applicable.
682
+ if (lookup->holder() != *receiver) return NULL;
683
+ maybe_code = isolate()->stub_cache()->ComputeCallNormal(argc,
684
+ in_loop,
685
+ kind_,
686
+ *name,
687
+ *receiver);
688
+ }
689
+ break;
690
+ }
691
+ case INTERCEPTOR: {
692
+ ASSERT(HasInterceptorGetter(lookup->holder()));
693
+ maybe_code = isolate()->stub_cache()->ComputeCallInterceptor(
694
+ argc,
695
+ kind_,
696
+ *name,
697
+ *object,
698
+ lookup->holder());
699
+ break;
700
+ }
701
+ default:
702
+ maybe_code = NULL;
703
+ break;
704
+ }
705
+ return maybe_code;
706
+ }
707
+
708
+
709
+ void CallICBase::UpdateCaches(LookupResult* lookup,
710
+ State state,
711
+ Code::ExtraICState extra_ic_state,
712
+ Handle<Object> object,
713
+ Handle<String> name) {
714
+ // Bail out if we didn't find a result.
715
+ if (!lookup->IsProperty() || !lookup->IsCacheable()) return;
716
+
717
+ if (lookup->holder() != *object &&
718
+ HasNormalObjectsInPrototypeChain(
719
+ isolate(), lookup, object->GetPrototype())) {
720
+ // Suppress optimization for prototype chains with slow properties objects
721
+ // in the middle.
722
+ return;
723
+ }
724
+
725
+ // Compute the number of arguments.
726
+ int argc = target()->arguments_count();
727
+ InLoopFlag in_loop = target()->ic_in_loop();
728
+ MaybeObject* maybe_code = NULL;
729
+ bool had_proto_failure = false;
730
+ if (state == UNINITIALIZED) {
731
+ // This is the first time we execute this inline cache.
732
+ // Set the target to the pre monomorphic stub to delay
733
+ // setting the monomorphic state.
734
+ maybe_code = isolate()->stub_cache()->ComputeCallPreMonomorphic(argc,
735
+ in_loop,
736
+ kind_);
737
+ } else if (state == MONOMORPHIC) {
738
+ if (kind_ == Code::CALL_IC &&
739
+ TryUpdateExtraICState(lookup, object, &extra_ic_state)) {
740
+ maybe_code = ComputeMonomorphicStub(lookup,
741
+ state,
742
+ extra_ic_state,
743
+ object,
744
+ name);
745
+ } else if (kind_ == Code::CALL_IC &&
746
+ TryRemoveInvalidPrototypeDependentStub(target(),
747
+ *object,
748
+ *name)) {
749
+ had_proto_failure = true;
750
+ maybe_code = ComputeMonomorphicStub(lookup,
751
+ state,
752
+ extra_ic_state,
753
+ object,
754
+ name);
755
+ } else {
756
+ maybe_code = isolate()->stub_cache()->ComputeCallMegamorphic(argc,
757
+ in_loop,
758
+ kind_);
759
+ }
760
+ } else {
761
+ maybe_code = ComputeMonomorphicStub(lookup,
762
+ state,
763
+ extra_ic_state,
764
+ object,
765
+ name);
766
+ }
767
+
768
+ // If we're unable to compute the stub (not enough memory left), we
769
+ // simply avoid updating the caches.
770
+ Object* code;
771
+ if (maybe_code == NULL || !maybe_code->ToObject(&code)) return;
772
+
773
+ // Patch the call site depending on the state of the cache.
774
+ if (state == UNINITIALIZED ||
775
+ state == PREMONOMORPHIC ||
776
+ state == MONOMORPHIC ||
777
+ state == MONOMORPHIC_PROTOTYPE_FAILURE) {
778
+ set_target(Code::cast(code));
779
+ } else if (state == MEGAMORPHIC) {
780
+ // Cache code holding map should be consistent with
781
+ // GenerateMonomorphicCacheProbe. It is not the map which holds the stub.
782
+ Map* map = JSObject::cast(object->IsJSObject() ? *object :
783
+ object->GetPrototype())->map();
784
+
785
+ // Update the stub cache.
786
+ isolate()->stub_cache()->Set(*name, map, Code::cast(code));
787
+ }
788
+
789
+ USE(had_proto_failure);
790
+ #ifdef DEBUG
791
+ if (had_proto_failure) state = MONOMORPHIC_PROTOTYPE_FAILURE;
792
+ TraceIC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC",
793
+ name, state, target(), in_loop ? " (in-loop)" : "");
794
+ #endif
795
+ }
796
+
797
+
798
+ MaybeObject* KeyedCallIC::LoadFunction(State state,
799
+ Handle<Object> object,
800
+ Handle<Object> key) {
801
+ if (key->IsSymbol()) {
802
+ return CallICBase::LoadFunction(state,
803
+ Code::kNoExtraICState,
804
+ object,
805
+ Handle<String>::cast(key));
806
+ }
807
+
808
+ if (object->IsUndefined() || object->IsNull()) {
809
+ return TypeError("non_object_property_call", object, key);
810
+ }
811
+
812
+ if (FLAG_use_ic && state != MEGAMORPHIC && !object->IsAccessCheckNeeded()) {
813
+ int argc = target()->arguments_count();
814
+ InLoopFlag in_loop = target()->ic_in_loop();
815
+ MaybeObject* maybe_code = isolate()->stub_cache()->ComputeCallMegamorphic(
816
+ argc, in_loop, Code::KEYED_CALL_IC);
817
+ Object* code;
818
+ if (maybe_code->ToObject(&code)) {
819
+ set_target(Code::cast(code));
820
+ #ifdef DEBUG
821
+ TraceIC(
822
+ "KeyedCallIC", key, state, target(), in_loop ? " (in-loop)" : "");
823
+ #endif
824
+ }
825
+ }
826
+
827
+ HandleScope scope(isolate());
828
+ Handle<Object> result = GetProperty(object, key);
829
+ RETURN_IF_EMPTY_HANDLE(isolate(), result);
830
+
831
+ // Make receiver an object if the callee requires it. Strict mode or builtin
832
+ // functions do not wrap the receiver, non-strict functions and objects
833
+ // called as functions do.
834
+ ReceiverToObjectIfRequired(result, object);
835
+
836
+ if (result->IsJSFunction()) return *result;
837
+ result = Handle<Object>(TryCallAsFunction(*result));
838
+ if (result->IsJSFunction()) return *result;
839
+
840
+ return TypeError("property_not_function", object, key);
841
+ }
842
+
843
+
844
+ #ifdef DEBUG
845
+ #define TRACE_IC_NAMED(msg, name) \
846
+ if (FLAG_trace_ic) PrintF(msg, *(name)->ToCString())
847
+ #else
848
+ #define TRACE_IC_NAMED(msg, name)
849
+ #endif
850
+
851
+
852
+ MaybeObject* LoadIC::Load(State state,
853
+ Handle<Object> object,
854
+ Handle<String> name) {
855
+ // If the object is undefined or null it's illegal to try to get any
856
+ // of its properties; throw a TypeError in that case.
857
+ if (object->IsUndefined() || object->IsNull()) {
858
+ return TypeError("non_object_property_load", object, name);
859
+ }
860
+
861
+ if (FLAG_use_ic) {
862
+ Code* non_monomorphic_stub =
863
+ (state == UNINITIALIZED) ? pre_monomorphic_stub() : megamorphic_stub();
864
+
865
+ // Use specialized code for getting the length of strings and
866
+ // string wrapper objects. The length property of string wrapper
867
+ // objects is read-only and therefore always returns the length of
868
+ // the underlying string value. See ECMA-262 15.5.5.1.
869
+ if ((object->IsString() || object->IsStringWrapper()) &&
870
+ name->Equals(isolate()->heap()->length_symbol())) {
871
+ HandleScope scope(isolate());
872
+ #ifdef DEBUG
873
+ if (FLAG_trace_ic) PrintF("[LoadIC : +#length /string]\n");
874
+ #endif
875
+ if (state == PREMONOMORPHIC) {
876
+ if (object->IsString()) {
877
+ Map* map = HeapObject::cast(*object)->map();
878
+ const int offset = String::kLengthOffset;
879
+ PatchInlinedLoad(address(), map, offset);
880
+ set_target(isolate()->builtins()->builtin(
881
+ Builtins::kLoadIC_StringLength));
882
+ } else {
883
+ set_target(isolate()->builtins()->builtin(
884
+ Builtins::kLoadIC_StringWrapperLength));
885
+ }
886
+ } else if (state == MONOMORPHIC && object->IsStringWrapper()) {
887
+ set_target(isolate()->builtins()->builtin(
888
+ Builtins::kLoadIC_StringWrapperLength));
889
+ } else {
890
+ set_target(non_monomorphic_stub);
891
+ }
892
+ // Get the string if we have a string wrapper object.
893
+ if (object->IsJSValue()) {
894
+ object = Handle<Object>(Handle<JSValue>::cast(object)->value(),
895
+ isolate());
896
+ }
897
+ return Smi::FromInt(String::cast(*object)->length());
898
+ }
899
+
900
+ // Use specialized code for getting the length of arrays.
901
+ if (object->IsJSArray() &&
902
+ name->Equals(isolate()->heap()->length_symbol())) {
903
+ #ifdef DEBUG
904
+ if (FLAG_trace_ic) PrintF("[LoadIC : +#length /array]\n");
905
+ #endif
906
+ if (state == PREMONOMORPHIC) {
907
+ Map* map = HeapObject::cast(*object)->map();
908
+ const int offset = JSArray::kLengthOffset;
909
+ PatchInlinedLoad(address(), map, offset);
910
+ set_target(isolate()->builtins()->builtin(
911
+ Builtins::kLoadIC_ArrayLength));
912
+ } else {
913
+ set_target(non_monomorphic_stub);
914
+ }
915
+ return JSArray::cast(*object)->length();
916
+ }
917
+
918
+ // Use specialized code for getting prototype of functions.
919
+ if (object->IsJSFunction() &&
920
+ name->Equals(isolate()->heap()->prototype_symbol()) &&
921
+ JSFunction::cast(*object)->should_have_prototype()) {
922
+ #ifdef DEBUG
923
+ if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n");
924
+ #endif
925
+ if (state == PREMONOMORPHIC) {
926
+ set_target(isolate()->builtins()->builtin(
927
+ Builtins::kLoadIC_FunctionPrototype));
928
+ } else {
929
+ set_target(non_monomorphic_stub);
930
+ }
931
+ return Accessors::FunctionGetPrototype(*object, 0);
932
+ }
933
+ }
934
+
935
+ // Check if the name is trivially convertible to an index and get
936
+ // the element if so.
937
+ uint32_t index;
938
+ if (name->AsArrayIndex(&index)) return object->GetElement(index);
939
+
940
+ // Named lookup in the object.
941
+ LookupResult lookup;
942
+ LookupForRead(*object, *name, &lookup);
943
+
944
+ // If we did not find a property, check if we need to throw an exception.
945
+ if (!lookup.IsProperty()) {
946
+ if (FLAG_strict || IsContextual(object)) {
947
+ return ReferenceError("not_defined", name);
948
+ }
949
+ LOG(isolate(), SuspectReadEvent(*name, *object));
950
+ }
951
+
952
+ bool can_be_inlined_precheck =
953
+ FLAG_use_ic &&
954
+ lookup.IsProperty() &&
955
+ lookup.IsCacheable() &&
956
+ lookup.holder() == *object &&
957
+ !object->IsAccessCheckNeeded();
958
+
959
+ bool can_be_inlined =
960
+ can_be_inlined_precheck &&
961
+ state == PREMONOMORPHIC &&
962
+ lookup.type() == FIELD;
963
+
964
+ bool can_be_inlined_contextual =
965
+ can_be_inlined_precheck &&
966
+ state == UNINITIALIZED &&
967
+ lookup.holder()->IsGlobalObject() &&
968
+ lookup.type() == NORMAL;
969
+
970
+ if (can_be_inlined) {
971
+ Map* map = lookup.holder()->map();
972
+ // Property's index in the properties array. If negative we have
973
+ // an inobject property.
974
+ int index = lookup.GetFieldIndex() - map->inobject_properties();
975
+ if (index < 0) {
976
+ // Index is an offset from the end of the object.
977
+ int offset = map->instance_size() + (index * kPointerSize);
978
+ if (PatchInlinedLoad(address(), map, offset)) {
979
+ set_target(megamorphic_stub());
980
+ TRACE_IC_NAMED("[LoadIC : inline patch %s]\n", name);
981
+ return lookup.holder()->FastPropertyAt(lookup.GetFieldIndex());
982
+ } else {
983
+ TRACE_IC_NAMED("[LoadIC : no inline patch %s (patching failed)]\n",
984
+ name);
985
+ }
986
+ } else {
987
+ TRACE_IC_NAMED("[LoadIC : no inline patch %s (not inobject)]\n", name);
988
+ }
989
+ } else if (can_be_inlined_contextual) {
990
+ Map* map = lookup.holder()->map();
991
+ JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(
992
+ lookup.holder()->property_dictionary()->ValueAt(
993
+ lookup.GetDictionaryEntry()));
994
+ if (PatchInlinedContextualLoad(address(),
995
+ map,
996
+ cell,
997
+ lookup.IsDontDelete())) {
998
+ set_target(megamorphic_stub());
999
+ TRACE_IC_NAMED("[LoadIC : inline contextual patch %s]\n", name);
1000
+ ASSERT(cell->value() != isolate()->heap()->the_hole_value());
1001
+ return cell->value();
1002
+ }
1003
+ } else {
1004
+ if (FLAG_use_ic && state == PREMONOMORPHIC) {
1005
+ TRACE_IC_NAMED("[LoadIC : no inline patch %s (not inlinable)]\n", name);
1006
+ }
1007
+ }
1008
+
1009
+ // Update inline cache and stub cache.
1010
+ if (FLAG_use_ic) {
1011
+ UpdateCaches(&lookup, state, object, name);
1012
+ }
1013
+
1014
+ PropertyAttributes attr;
1015
+ if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
1016
+ // Get the property.
1017
+ Object* result;
1018
+ { MaybeObject* maybe_result =
1019
+ object->GetProperty(*object, &lookup, *name, &attr);
1020
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1021
+ }
1022
+ // If the property is not present, check if we need to throw an
1023
+ // exception.
1024
+ if (attr == ABSENT && IsContextual(object)) {
1025
+ return ReferenceError("not_defined", name);
1026
+ }
1027
+ return result;
1028
+ }
1029
+
1030
+ // Get the property.
1031
+ return object->GetProperty(*object, &lookup, *name, &attr);
1032
+ }
1033
+
1034
+
1035
+ void LoadIC::UpdateCaches(LookupResult* lookup,
1036
+ State state,
1037
+ Handle<Object> object,
1038
+ Handle<String> name) {
1039
+ // Bail out if the result is not cacheable.
1040
+ if (!lookup->IsCacheable()) return;
1041
+
1042
+ // Loading properties from values is not common, so don't try to
1043
+ // deal with non-JS objects here.
1044
+ if (!object->IsJSObject()) return;
1045
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1046
+
1047
+ if (HasNormalObjectsInPrototypeChain(isolate(), lookup, *object)) return;
1048
+
1049
+ // Compute the code stub for this load.
1050
+ MaybeObject* maybe_code = NULL;
1051
+ Object* code;
1052
+ if (state == UNINITIALIZED) {
1053
+ // This is the first time we execute this inline cache.
1054
+ // Set the target to the pre monomorphic stub to delay
1055
+ // setting the monomorphic state.
1056
+ maybe_code = pre_monomorphic_stub();
1057
+ } else if (!lookup->IsProperty()) {
1058
+ // Nonexistent property. The result is undefined.
1059
+ maybe_code = isolate()->stub_cache()->ComputeLoadNonexistent(*name,
1060
+ *receiver);
1061
+ } else {
1062
+ // Compute monomorphic stub.
1063
+ switch (lookup->type()) {
1064
+ case FIELD: {
1065
+ maybe_code = isolate()->stub_cache()->ComputeLoadField(
1066
+ *name,
1067
+ *receiver,
1068
+ lookup->holder(),
1069
+ lookup->GetFieldIndex());
1070
+ break;
1071
+ }
1072
+ case CONSTANT_FUNCTION: {
1073
+ Object* constant = lookup->GetConstantFunction();
1074
+ maybe_code = isolate()->stub_cache()->ComputeLoadConstant(
1075
+ *name, *receiver, lookup->holder(), constant);
1076
+ break;
1077
+ }
1078
+ case NORMAL: {
1079
+ if (lookup->holder()->IsGlobalObject()) {
1080
+ GlobalObject* global = GlobalObject::cast(lookup->holder());
1081
+ JSGlobalPropertyCell* cell =
1082
+ JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
1083
+ maybe_code = isolate()->stub_cache()->ComputeLoadGlobal(*name,
1084
+ *receiver,
1085
+ global,
1086
+ cell,
1087
+ lookup->IsDontDelete());
1088
+ } else {
1089
+ // There is only one shared stub for loading normalized
1090
+ // properties. It does not traverse the prototype chain, so the
1091
+ // property must be found in the receiver for the stub to be
1092
+ // applicable.
1093
+ if (lookup->holder() != *receiver) return;
1094
+ maybe_code = isolate()->stub_cache()->ComputeLoadNormal();
1095
+ }
1096
+ break;
1097
+ }
1098
+ case CALLBACKS: {
1099
+ if (!lookup->GetCallbackObject()->IsAccessorInfo()) return;
1100
+ AccessorInfo* callback =
1101
+ AccessorInfo::cast(lookup->GetCallbackObject());
1102
+ if (v8::ToCData<Address>(callback->getter()) == 0) return;
1103
+ maybe_code = isolate()->stub_cache()->ComputeLoadCallback(
1104
+ *name, *receiver, lookup->holder(), callback);
1105
+ break;
1106
+ }
1107
+ case INTERCEPTOR: {
1108
+ ASSERT(HasInterceptorGetter(lookup->holder()));
1109
+ maybe_code = isolate()->stub_cache()->ComputeLoadInterceptor(
1110
+ *name, *receiver, lookup->holder());
1111
+ break;
1112
+ }
1113
+ default:
1114
+ return;
1115
+ }
1116
+ }
1117
+
1118
+ // If we're unable to compute the stub (not enough memory left), we
1119
+ // simply avoid updating the caches.
1120
+ if (maybe_code == NULL || !maybe_code->ToObject(&code)) return;
1121
+
1122
+ // Patch the call site depending on the state of the cache.
1123
+ if (state == UNINITIALIZED || state == PREMONOMORPHIC ||
1124
+ state == MONOMORPHIC_PROTOTYPE_FAILURE) {
1125
+ set_target(Code::cast(code));
1126
+ } else if (state == MONOMORPHIC) {
1127
+ set_target(megamorphic_stub());
1128
+ } else if (state == MEGAMORPHIC) {
1129
+ // Cache code holding map should be consistent with
1130
+ // GenerateMonomorphicCacheProbe.
1131
+ Map* map = JSObject::cast(object->IsJSObject() ? *object :
1132
+ object->GetPrototype())->map();
1133
+
1134
+ isolate()->stub_cache()->Set(*name, map, Code::cast(code));
1135
+ }
1136
+
1137
+ #ifdef DEBUG
1138
+ TraceIC("LoadIC", name, state, target());
1139
+ #endif
1140
+ }
1141
+
1142
+
1143
+ MaybeObject* KeyedLoadIC::Load(State state,
1144
+ Handle<Object> object,
1145
+ Handle<Object> key) {
1146
+ // Check for values that can be converted into a symbol.
1147
+ // TODO(1295): Remove this code.
1148
+ HandleScope scope(isolate());
1149
+ if (key->IsHeapNumber() &&
1150
+ isnan(HeapNumber::cast(*key)->value())) {
1151
+ key = isolate()->factory()->nan_symbol();
1152
+ } else if (key->IsUndefined()) {
1153
+ key = isolate()->factory()->undefined_symbol();
1154
+ }
1155
+
1156
+ if (key->IsSymbol()) {
1157
+ Handle<String> name = Handle<String>::cast(key);
1158
+
1159
+ // If the object is undefined or null it's illegal to try to get any
1160
+ // of its properties; throw a TypeError in that case.
1161
+ if (object->IsUndefined() || object->IsNull()) {
1162
+ return TypeError("non_object_property_load", object, name);
1163
+ }
1164
+
1165
+ if (FLAG_use_ic) {
1166
+ // TODO(1073): don't ignore the current stub state.
1167
+
1168
+ // Use specialized code for getting the length of strings.
1169
+ if (object->IsString() &&
1170
+ name->Equals(isolate()->heap()->length_symbol())) {
1171
+ Handle<String> string = Handle<String>::cast(object);
1172
+ Object* code = NULL;
1173
+ { MaybeObject* maybe_code =
1174
+ isolate()->stub_cache()->ComputeKeyedLoadStringLength(*name,
1175
+ *string);
1176
+ if (!maybe_code->ToObject(&code)) return maybe_code;
1177
+ }
1178
+ set_target(Code::cast(code));
1179
+ #ifdef DEBUG
1180
+ TraceIC("KeyedLoadIC", name, state, target());
1181
+ #endif // DEBUG
1182
+ return Smi::FromInt(string->length());
1183
+ }
1184
+
1185
+ // Use specialized code for getting the length of arrays.
1186
+ if (object->IsJSArray() &&
1187
+ name->Equals(isolate()->heap()->length_symbol())) {
1188
+ Handle<JSArray> array = Handle<JSArray>::cast(object);
1189
+ Object* code;
1190
+ { MaybeObject* maybe_code =
1191
+ isolate()->stub_cache()->ComputeKeyedLoadArrayLength(*name,
1192
+ *array);
1193
+ if (!maybe_code->ToObject(&code)) return maybe_code;
1194
+ }
1195
+ set_target(Code::cast(code));
1196
+ #ifdef DEBUG
1197
+ TraceIC("KeyedLoadIC", name, state, target());
1198
+ #endif // DEBUG
1199
+ return JSArray::cast(*object)->length();
1200
+ }
1201
+
1202
+ // Use specialized code for getting prototype of functions.
1203
+ if (object->IsJSFunction() &&
1204
+ name->Equals(isolate()->heap()->prototype_symbol()) &&
1205
+ JSFunction::cast(*object)->should_have_prototype()) {
1206
+ Handle<JSFunction> function = Handle<JSFunction>::cast(object);
1207
+ Object* code;
1208
+ { MaybeObject* maybe_code =
1209
+ isolate()->stub_cache()->ComputeKeyedLoadFunctionPrototype(
1210
+ *name, *function);
1211
+ if (!maybe_code->ToObject(&code)) return maybe_code;
1212
+ }
1213
+ set_target(Code::cast(code));
1214
+ #ifdef DEBUG
1215
+ TraceIC("KeyedLoadIC", name, state, target());
1216
+ #endif // DEBUG
1217
+ return Accessors::FunctionGetPrototype(*object, 0);
1218
+ }
1219
+ }
1220
+
1221
+ // Check if the name is trivially convertible to an index and get
1222
+ // the element or char if so.
1223
+ uint32_t index = 0;
1224
+ if (name->AsArrayIndex(&index)) {
1225
+ HandleScope scope(isolate());
1226
+ // Rewrite to the generic keyed load stub.
1227
+ if (FLAG_use_ic) set_target(generic_stub());
1228
+ return Runtime::GetElementOrCharAt(isolate(), object, index);
1229
+ }
1230
+
1231
+ // Named lookup.
1232
+ LookupResult lookup;
1233
+ LookupForRead(*object, *name, &lookup);
1234
+
1235
+ // If we did not find a property, check if we need to throw an exception.
1236
+ if (!lookup.IsProperty()) {
1237
+ if (FLAG_strict || IsContextual(object)) {
1238
+ return ReferenceError("not_defined", name);
1239
+ }
1240
+ }
1241
+
1242
+ if (FLAG_use_ic) {
1243
+ UpdateCaches(&lookup, state, object, name);
1244
+ }
1245
+
1246
+ PropertyAttributes attr;
1247
+ if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
1248
+ // Get the property.
1249
+ Object* result;
1250
+ { MaybeObject* maybe_result =
1251
+ object->GetProperty(*object, &lookup, *name, &attr);
1252
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1253
+ }
1254
+ // If the property is not present, check if we need to throw an
1255
+ // exception.
1256
+ if (attr == ABSENT && IsContextual(object)) {
1257
+ return ReferenceError("not_defined", name);
1258
+ }
1259
+ return result;
1260
+ }
1261
+
1262
+ return object->GetProperty(*object, &lookup, *name, &attr);
1263
+ }
1264
+
1265
+ // Do not use ICs for objects that require access checks (including
1266
+ // the global object).
1267
+ bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1268
+
1269
+ if (use_ic) {
1270
+ Code* stub = generic_stub();
1271
+ if (state == UNINITIALIZED) {
1272
+ if (object->IsString() && key->IsNumber()) {
1273
+ stub = string_stub();
1274
+ } else if (object->IsJSObject()) {
1275
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1276
+ if (receiver->HasExternalArrayElements()) {
1277
+ MaybeObject* probe =
1278
+ isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray(
1279
+ *receiver, false, kNonStrictMode);
1280
+ stub = probe->IsFailure() ?
1281
+ NULL : Code::cast(probe->ToObjectUnchecked());
1282
+ } else if (receiver->HasIndexedInterceptor()) {
1283
+ stub = indexed_interceptor_stub();
1284
+ } else if (key->IsSmi() &&
1285
+ receiver->map()->has_fast_elements()) {
1286
+ MaybeObject* probe =
1287
+ isolate()->stub_cache()->ComputeKeyedLoadSpecialized(*receiver);
1288
+ stub = probe->IsFailure() ?
1289
+ NULL : Code::cast(probe->ToObjectUnchecked());
1290
+ }
1291
+ }
1292
+ }
1293
+ if (stub != NULL) set_target(stub);
1294
+
1295
+ #ifdef DEBUG
1296
+ TraceIC("KeyedLoadIC", key, state, target());
1297
+ #endif // DEBUG
1298
+
1299
+ // For JSObjects with fast elements that are not value wrappers
1300
+ // and that do not have indexed interceptors, we initialize the
1301
+ // inlined fast case (if present) by patching the inlined map
1302
+ // check.
1303
+ if (object->IsJSObject() &&
1304
+ !object->IsJSValue() &&
1305
+ !JSObject::cast(*object)->HasIndexedInterceptor() &&
1306
+ JSObject::cast(*object)->HasFastElements()) {
1307
+ Map* map = JSObject::cast(*object)->map();
1308
+ PatchInlinedLoad(address(), map);
1309
+ }
1310
+ }
1311
+
1312
+ // Get the property.
1313
+ return Runtime::GetObjectProperty(isolate(), object, key);
1314
+ }
1315
+
1316
+
1317
+ void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state,
1318
+ Handle<Object> object, Handle<String> name) {
1319
+ // Bail out if we didn't find a result.
1320
+ if (!lookup->IsProperty() || !lookup->IsCacheable()) return;
1321
+
1322
+ if (!object->IsJSObject()) return;
1323
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1324
+
1325
+ if (HasNormalObjectsInPrototypeChain(isolate(), lookup, *object)) return;
1326
+
1327
+ // Compute the code stub for this load.
1328
+ MaybeObject* maybe_code = NULL;
1329
+ Object* code;
1330
+
1331
+ if (state == UNINITIALIZED) {
1332
+ // This is the first time we execute this inline cache.
1333
+ // Set the target to the pre monomorphic stub to delay
1334
+ // setting the monomorphic state.
1335
+ maybe_code = pre_monomorphic_stub();
1336
+ } else {
1337
+ // Compute a monomorphic stub.
1338
+ switch (lookup->type()) {
1339
+ case FIELD: {
1340
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadField(
1341
+ *name, *receiver, lookup->holder(), lookup->GetFieldIndex());
1342
+ break;
1343
+ }
1344
+ case CONSTANT_FUNCTION: {
1345
+ Object* constant = lookup->GetConstantFunction();
1346
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadConstant(
1347
+ *name, *receiver, lookup->holder(), constant);
1348
+ break;
1349
+ }
1350
+ case CALLBACKS: {
1351
+ if (!lookup->GetCallbackObject()->IsAccessorInfo()) return;
1352
+ AccessorInfo* callback =
1353
+ AccessorInfo::cast(lookup->GetCallbackObject());
1354
+ if (v8::ToCData<Address>(callback->getter()) == 0) return;
1355
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadCallback(
1356
+ *name, *receiver, lookup->holder(), callback);
1357
+ break;
1358
+ }
1359
+ case INTERCEPTOR: {
1360
+ ASSERT(HasInterceptorGetter(lookup->holder()));
1361
+ maybe_code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor(
1362
+ *name, *receiver, lookup->holder());
1363
+ break;
1364
+ }
1365
+ default: {
1366
+ // Always rewrite to the generic case so that we do not
1367
+ // repeatedly try to rewrite.
1368
+ maybe_code = generic_stub();
1369
+ break;
1370
+ }
1371
+ }
1372
+ }
1373
+
1374
+ // If we're unable to compute the stub (not enough memory left), we
1375
+ // simply avoid updating the caches.
1376
+ if (maybe_code == NULL || !maybe_code->ToObject(&code)) return;
1377
+
1378
+ // Patch the call site depending on the state of the cache. Make
1379
+ // sure to always rewrite from monomorphic to megamorphic.
1380
+ ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE);
1381
+ if (state == UNINITIALIZED || state == PREMONOMORPHIC) {
1382
+ set_target(Code::cast(code));
1383
+ } else if (state == MONOMORPHIC) {
1384
+ set_target(megamorphic_stub());
1385
+ }
1386
+
1387
+ #ifdef DEBUG
1388
+ TraceIC("KeyedLoadIC", name, state, target());
1389
+ #endif
1390
+ }
1391
+
1392
+
1393
+ static bool StoreICableLookup(LookupResult* lookup) {
1394
+ // Bail out if we didn't find a result.
1395
+ if (!lookup->IsPropertyOrTransition() || !lookup->IsCacheable()) return false;
1396
+
1397
+ // If the property is read-only, we leave the IC in its current
1398
+ // state.
1399
+ if (lookup->IsReadOnly()) return false;
1400
+
1401
+ return true;
1402
+ }
1403
+
1404
+
1405
+ static bool LookupForWrite(JSObject* object,
1406
+ String* name,
1407
+ LookupResult* lookup) {
1408
+ object->LocalLookup(name, lookup);
1409
+ if (!StoreICableLookup(lookup)) {
1410
+ return false;
1411
+ }
1412
+
1413
+ if (lookup->type() == INTERCEPTOR) {
1414
+ if (object->GetNamedInterceptor()->setter()->IsUndefined()) {
1415
+ object->LocalLookupRealNamedProperty(name, lookup);
1416
+ return StoreICableLookup(lookup);
1417
+ }
1418
+ }
1419
+
1420
+ return true;
1421
+ }
1422
+
1423
+
1424
+ MaybeObject* StoreIC::Store(State state,
1425
+ StrictModeFlag strict_mode,
1426
+ Handle<Object> object,
1427
+ Handle<String> name,
1428
+ Handle<Object> value) {
1429
+ // If the object is undefined or null it's illegal to try to set any
1430
+ // properties on it; throw a TypeError in that case.
1431
+ if (object->IsUndefined() || object->IsNull()) {
1432
+ return TypeError("non_object_property_store", object, name);
1433
+ }
1434
+
1435
+ if (!object->IsJSObject()) {
1436
+ // The length property of string values is read-only. Throw in strict mode.
1437
+ if (strict_mode == kStrictMode && object->IsString() &&
1438
+ name->Equals(isolate()->heap()->length_symbol())) {
1439
+ return TypeError("strict_read_only_property", object, name);
1440
+ }
1441
+ // Ignore stores where the receiver is not a JSObject.
1442
+ return *value;
1443
+ }
1444
+
1445
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1446
+
1447
+ // Check if the given name is an array index.
1448
+ uint32_t index;
1449
+ if (name->AsArrayIndex(&index)) {
1450
+ HandleScope scope(isolate());
1451
+ Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1452
+ if (result.is_null()) return Failure::Exception();
1453
+ return *value;
1454
+ }
1455
+
1456
+ // Use specialized code for setting the length of arrays.
1457
+ if (receiver->IsJSArray()
1458
+ && name->Equals(isolate()->heap()->length_symbol())
1459
+ && receiver->AllowsSetElementsLength()) {
1460
+ #ifdef DEBUG
1461
+ if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n");
1462
+ #endif
1463
+ Builtins::Name target = (strict_mode == kStrictMode)
1464
+ ? Builtins::kStoreIC_ArrayLength_Strict
1465
+ : Builtins::kStoreIC_ArrayLength;
1466
+ set_target(isolate()->builtins()->builtin(target));
1467
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1468
+ }
1469
+
1470
+ // Lookup the property locally in the receiver.
1471
+ if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
1472
+ LookupResult lookup;
1473
+
1474
+ if (LookupForWrite(*receiver, *name, &lookup)) {
1475
+ bool can_be_inlined =
1476
+ state == UNINITIALIZED &&
1477
+ lookup.IsProperty() &&
1478
+ lookup.holder() == *receiver &&
1479
+ lookup.type() == FIELD &&
1480
+ !receiver->IsAccessCheckNeeded();
1481
+
1482
+ if (can_be_inlined) {
1483
+ Map* map = lookup.holder()->map();
1484
+ // Property's index in the properties array. If negative we have
1485
+ // an inobject property.
1486
+ int index = lookup.GetFieldIndex() - map->inobject_properties();
1487
+ if (index < 0) {
1488
+ // Index is an offset from the end of the object.
1489
+ int offset = map->instance_size() + (index * kPointerSize);
1490
+ if (PatchInlinedStore(address(), map, offset)) {
1491
+ set_target((strict_mode == kStrictMode)
1492
+ ? megamorphic_stub_strict()
1493
+ : megamorphic_stub());
1494
+ #ifdef DEBUG
1495
+ if (FLAG_trace_ic) {
1496
+ PrintF("[StoreIC : inline patch %s]\n", *name->ToCString());
1497
+ }
1498
+ #endif
1499
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1500
+ #ifdef DEBUG
1501
+
1502
+ } else {
1503
+ if (FLAG_trace_ic) {
1504
+ PrintF("[StoreIC : no inline patch %s (patching failed)]\n",
1505
+ *name->ToCString());
1506
+ }
1507
+ }
1508
+ } else {
1509
+ if (FLAG_trace_ic) {
1510
+ PrintF("[StoreIC : no inline patch %s (not inobject)]\n",
1511
+ *name->ToCString());
1512
+ }
1513
+ }
1514
+ } else {
1515
+ if (state == PREMONOMORPHIC) {
1516
+ if (FLAG_trace_ic) {
1517
+ PrintF("[StoreIC : no inline patch %s (not inlinable)]\n",
1518
+ *name->ToCString());
1519
+ #endif
1520
+ }
1521
+ }
1522
+ }
1523
+
1524
+ // If no inlined store ic was patched, generate a stub for this
1525
+ // store.
1526
+ UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1527
+ } else {
1528
+ // Strict mode doesn't allow setting non-existent global property
1529
+ // or an assignment to a read only property.
1530
+ if (strict_mode == kStrictMode) {
1531
+ if (lookup.IsFound() && lookup.IsReadOnly()) {
1532
+ return TypeError("strict_read_only_property", object, name);
1533
+ } else if (IsContextual(object)) {
1534
+ return ReferenceError("not_defined", name);
1535
+ }
1536
+ }
1537
+ }
1538
+ }
1539
+
1540
+ if (receiver->IsJSGlobalProxy()) {
1541
+ // Generate a generic stub that goes to the runtime when we see a global
1542
+ // proxy as receiver.
1543
+ Code* stub = (strict_mode == kStrictMode)
1544
+ ? global_proxy_stub_strict()
1545
+ : global_proxy_stub();
1546
+ if (target() != stub) {
1547
+ set_target(stub);
1548
+ #ifdef DEBUG
1549
+ TraceIC("StoreIC", name, state, target());
1550
+ #endif
1551
+ }
1552
+ }
1553
+
1554
+ // Set the property.
1555
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1556
+ }
1557
+
1558
+
1559
+ void StoreIC::UpdateCaches(LookupResult* lookup,
1560
+ State state,
1561
+ StrictModeFlag strict_mode,
1562
+ Handle<JSObject> receiver,
1563
+ Handle<String> name,
1564
+ Handle<Object> value) {
1565
+ // Skip JSGlobalProxy.
1566
+ ASSERT(!receiver->IsJSGlobalProxy());
1567
+
1568
+ ASSERT(StoreICableLookup(lookup));
1569
+
1570
+ // If the property has a non-field type allowing map transitions
1571
+ // where there is extra room in the object, we leave the IC in its
1572
+ // current state.
1573
+ PropertyType type = lookup->type();
1574
+
1575
+ // Compute the code stub for this store; used for rewriting to
1576
+ // monomorphic state and making sure that the code stub is in the
1577
+ // stub cache.
1578
+ MaybeObject* maybe_code = NULL;
1579
+ Object* code = NULL;
1580
+ switch (type) {
1581
+ case FIELD: {
1582
+ maybe_code = isolate()->stub_cache()->ComputeStoreField(
1583
+ *name, *receiver, lookup->GetFieldIndex(), NULL, strict_mode);
1584
+ break;
1585
+ }
1586
+ case MAP_TRANSITION: {
1587
+ if (lookup->GetAttributes() != NONE) return;
1588
+ HandleScope scope(isolate());
1589
+ ASSERT(type == MAP_TRANSITION);
1590
+ Handle<Map> transition(lookup->GetTransitionMap());
1591
+ int index = transition->PropertyIndexFor(*name);
1592
+ maybe_code = isolate()->stub_cache()->ComputeStoreField(
1593
+ *name, *receiver, index, *transition, strict_mode);
1594
+ break;
1595
+ }
1596
+ case NORMAL: {
1597
+ if (receiver->IsGlobalObject()) {
1598
+ // The stub generated for the global object picks the value directly
1599
+ // from the property cell. So the property must be directly on the
1600
+ // global object.
1601
+ Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
1602
+ JSGlobalPropertyCell* cell =
1603
+ JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup));
1604
+ maybe_code = isolate()->stub_cache()->ComputeStoreGlobal(
1605
+ *name, *global, cell, strict_mode);
1606
+ } else {
1607
+ if (lookup->holder() != *receiver) return;
1608
+ maybe_code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode);
1609
+ }
1610
+ break;
1611
+ }
1612
+ case CALLBACKS: {
1613
+ if (!lookup->GetCallbackObject()->IsAccessorInfo()) return;
1614
+ AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject());
1615
+ if (v8::ToCData<Address>(callback->setter()) == 0) return;
1616
+ maybe_code = isolate()->stub_cache()->ComputeStoreCallback(
1617
+ *name, *receiver, callback, strict_mode);
1618
+ break;
1619
+ }
1620
+ case INTERCEPTOR: {
1621
+ ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined());
1622
+ maybe_code = isolate()->stub_cache()->ComputeStoreInterceptor(
1623
+ *name, *receiver, strict_mode);
1624
+ break;
1625
+ }
1626
+ default:
1627
+ return;
1628
+ }
1629
+
1630
+ // If we're unable to compute the stub (not enough memory left), we
1631
+ // simply avoid updating the caches.
1632
+ if (maybe_code == NULL || !maybe_code->ToObject(&code)) return;
1633
+
1634
+ // Patch the call site depending on the state of the cache.
1635
+ if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) {
1636
+ set_target(Code::cast(code));
1637
+ } else if (state == MONOMORPHIC) {
1638
+ // Only move to megamorphic if the target changes.
1639
+ if (target() != Code::cast(code)) {
1640
+ set_target((strict_mode == kStrictMode)
1641
+ ? megamorphic_stub_strict()
1642
+ : megamorphic_stub());
1643
+ }
1644
+ } else if (state == MEGAMORPHIC) {
1645
+ // Update the stub cache.
1646
+ isolate()->stub_cache()->Set(*name,
1647
+ receiver->map(),
1648
+ Code::cast(code));
1649
+ }
1650
+
1651
+ #ifdef DEBUG
1652
+ TraceIC("StoreIC", name, state, target());
1653
+ #endif
1654
+ }
1655
+
1656
+
1657
+ MaybeObject* KeyedStoreIC::Store(State state,
1658
+ StrictModeFlag strict_mode,
1659
+ Handle<Object> object,
1660
+ Handle<Object> key,
1661
+ Handle<Object> value) {
1662
+ if (key->IsSymbol()) {
1663
+ Handle<String> name = Handle<String>::cast(key);
1664
+
1665
+ // If the object is undefined or null it's illegal to try to set any
1666
+ // properties on it; throw a TypeError in that case.
1667
+ if (object->IsUndefined() || object->IsNull()) {
1668
+ return TypeError("non_object_property_store", object, name);
1669
+ }
1670
+
1671
+ // Ignore stores where the receiver is not a JSObject.
1672
+ if (!object->IsJSObject()) return *value;
1673
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1674
+
1675
+ // Check if the given name is an array index.
1676
+ uint32_t index;
1677
+ if (name->AsArrayIndex(&index)) {
1678
+ HandleScope scope(isolate());
1679
+ Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1680
+ if (result.is_null()) return Failure::Exception();
1681
+ return *value;
1682
+ }
1683
+
1684
+ // Lookup the property locally in the receiver.
1685
+ LookupResult lookup;
1686
+ receiver->LocalLookup(*name, &lookup);
1687
+
1688
+ // Update inline cache and stub cache.
1689
+ if (FLAG_use_ic) {
1690
+ UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1691
+ }
1692
+
1693
+ // Set the property.
1694
+ return receiver->SetProperty(*name, *value, NONE, strict_mode);
1695
+ }
1696
+
1697
+ // Do not use ICs for objects that require access checks (including
1698
+ // the global object).
1699
+ bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1700
+ ASSERT(!(use_ic && object->IsJSGlobalProxy()));
1701
+
1702
+ if (use_ic) {
1703
+ Code* stub =
1704
+ (strict_mode == kStrictMode) ? generic_stub_strict() : generic_stub();
1705
+ if (state == UNINITIALIZED) {
1706
+ if (object->IsJSObject()) {
1707
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1708
+ if (receiver->HasExternalArrayElements()) {
1709
+ MaybeObject* probe =
1710
+ isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray(
1711
+ *receiver, true, strict_mode);
1712
+ stub = probe->IsFailure() ?
1713
+ NULL : Code::cast(probe->ToObjectUnchecked());
1714
+ } else if (key->IsSmi() && receiver->map()->has_fast_elements()) {
1715
+ MaybeObject* probe =
1716
+ isolate()->stub_cache()->ComputeKeyedStoreSpecialized(
1717
+ *receiver, strict_mode);
1718
+ stub = probe->IsFailure() ?
1719
+ NULL : Code::cast(probe->ToObjectUnchecked());
1720
+ }
1721
+ }
1722
+ }
1723
+ if (stub != NULL) set_target(stub);
1724
+ }
1725
+
1726
+ // Set the property.
1727
+ return Runtime::SetObjectProperty(
1728
+ isolate(), object , key, value, NONE, strict_mode);
1729
+ }
1730
+
1731
+
1732
+ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1733
+ State state,
1734
+ StrictModeFlag strict_mode,
1735
+ Handle<JSObject> receiver,
1736
+ Handle<String> name,
1737
+ Handle<Object> value) {
1738
+ // Skip JSGlobalProxy.
1739
+ if (receiver->IsJSGlobalProxy()) return;
1740
+
1741
+ // Bail out if we didn't find a result.
1742
+ if (!lookup->IsPropertyOrTransition() || !lookup->IsCacheable()) return;
1743
+
1744
+ // If the property is read-only, we leave the IC in its current
1745
+ // state.
1746
+ if (lookup->IsReadOnly()) return;
1747
+
1748
+ // If the property has a non-field type allowing map transitions
1749
+ // where there is extra room in the object, we leave the IC in its
1750
+ // current state.
1751
+ PropertyType type = lookup->type();
1752
+
1753
+ // Compute the code stub for this store; used for rewriting to
1754
+ // monomorphic state and making sure that the code stub is in the
1755
+ // stub cache.
1756
+ MaybeObject* maybe_code = NULL;
1757
+ Object* code = NULL;
1758
+
1759
+ switch (type) {
1760
+ case FIELD: {
1761
+ maybe_code = isolate()->stub_cache()->ComputeKeyedStoreField(
1762
+ *name, *receiver, lookup->GetFieldIndex(), NULL, strict_mode);
1763
+ break;
1764
+ }
1765
+ case MAP_TRANSITION: {
1766
+ if (lookup->GetAttributes() == NONE) {
1767
+ HandleScope scope(isolate());
1768
+ ASSERT(type == MAP_TRANSITION);
1769
+ Handle<Map> transition(lookup->GetTransitionMap());
1770
+ int index = transition->PropertyIndexFor(*name);
1771
+ maybe_code = isolate()->stub_cache()->ComputeKeyedStoreField(
1772
+ *name, *receiver, index, *transition, strict_mode);
1773
+ break;
1774
+ }
1775
+ // fall through.
1776
+ }
1777
+ default: {
1778
+ // Always rewrite to the generic case so that we do not
1779
+ // repeatedly try to rewrite.
1780
+ maybe_code = (strict_mode == kStrictMode)
1781
+ ? generic_stub_strict()
1782
+ : generic_stub();
1783
+ break;
1784
+ }
1785
+ }
1786
+
1787
+ // If we're unable to compute the stub (not enough memory left), we
1788
+ // simply avoid updating the caches.
1789
+ if (maybe_code == NULL || !maybe_code->ToObject(&code)) return;
1790
+
1791
+ // Patch the call site depending on the state of the cache. Make
1792
+ // sure to always rewrite from monomorphic to megamorphic.
1793
+ ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE);
1794
+ if (state == UNINITIALIZED || state == PREMONOMORPHIC) {
1795
+ set_target(Code::cast(code));
1796
+ } else if (state == MONOMORPHIC) {
1797
+ set_target((strict_mode == kStrictMode)
1798
+ ? megamorphic_stub_strict()
1799
+ : megamorphic_stub());
1800
+ }
1801
+
1802
+ #ifdef DEBUG
1803
+ TraceIC("KeyedStoreIC", name, state, target());
1804
+ #endif
1805
+ }
1806
+
1807
+
1808
+ // ----------------------------------------------------------------------------
1809
+ // Static IC stub generators.
1810
+ //
1811
+
1812
+ static JSFunction* CompileFunction(Isolate* isolate,
1813
+ JSFunction* function,
1814
+ InLoopFlag in_loop) {
1815
+ // Compile now with optimization.
1816
+ HandleScope scope(isolate);
1817
+ Handle<JSFunction> function_handle(function, isolate);
1818
+ if (in_loop == IN_LOOP) {
1819
+ CompileLazyInLoop(function_handle, CLEAR_EXCEPTION);
1820
+ } else {
1821
+ CompileLazy(function_handle, CLEAR_EXCEPTION);
1822
+ }
1823
+ return *function_handle;
1824
+ }
1825
+
1826
+
1827
+ // Used from ic-<arch>.cc.
1828
+ RUNTIME_FUNCTION(MaybeObject*, CallIC_Miss) {
1829
+ NoHandleAllocation na;
1830
+ ASSERT(args.length() == 2);
1831
+ CallIC ic(isolate);
1832
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1833
+ Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1834
+ MaybeObject* maybe_result = ic.LoadFunction(state,
1835
+ extra_ic_state,
1836
+ args.at<Object>(0),
1837
+ args.at<String>(1));
1838
+ Object* result;
1839
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1840
+
1841
+ // The first time the inline cache is updated may be the first time the
1842
+ // function it references gets called. If the function was lazily compiled
1843
+ // then the first call will trigger a compilation. We check for this case
1844
+ // and we do the compilation immediately, instead of waiting for the stub
1845
+ // currently attached to the JSFunction object to trigger compilation. We
1846
+ // do this in the case where we know that the inline cache is inside a loop,
1847
+ // because then we know that we want to optimize the function.
1848
+ if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
1849
+ return result;
1850
+ }
1851
+ return CompileFunction(isolate,
1852
+ JSFunction::cast(result),
1853
+ ic.target()->ic_in_loop());
1854
+ }
1855
+
1856
+
1857
+ // Used from ic-<arch>.cc.
1858
+ RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_Miss) {
1859
+ NoHandleAllocation na;
1860
+ ASSERT(args.length() == 2);
1861
+ KeyedCallIC ic(isolate);
1862
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1863
+ Object* result;
1864
+ { MaybeObject* maybe_result =
1865
+ ic.LoadFunction(state, args.at<Object>(0), args.at<Object>(1));
1866
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1867
+ }
1868
+
1869
+ if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
1870
+ return result;
1871
+ }
1872
+ return CompileFunction(isolate,
1873
+ JSFunction::cast(result),
1874
+ ic.target()->ic_in_loop());
1875
+ }
1876
+
1877
+
1878
+ // Used from ic-<arch>.cc.
1879
+ RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
1880
+ NoHandleAllocation na;
1881
+ ASSERT(args.length() == 2);
1882
+ LoadIC ic(isolate);
1883
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1884
+ return ic.Load(state, args.at<Object>(0), args.at<String>(1));
1885
+ }
1886
+
1887
+
1888
+ // Used from ic-<arch>.cc
1889
+ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
1890
+ NoHandleAllocation na;
1891
+ ASSERT(args.length() == 2);
1892
+ KeyedLoadIC ic(isolate);
1893
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1894
+ return ic.Load(state, args.at<Object>(0), args.at<Object>(1));
1895
+ }
1896
+
1897
+
1898
+ // Used from ic-<arch>.cc.
1899
+ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) {
1900
+ NoHandleAllocation na;
1901
+ ASSERT(args.length() == 3);
1902
+ StoreIC ic(isolate);
1903
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1904
+ Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1905
+ return ic.Store(state,
1906
+ static_cast<StrictModeFlag>(extra_ic_state & kStrictMode),
1907
+ args.at<Object>(0),
1908
+ args.at<String>(1),
1909
+ args.at<Object>(2));
1910
+ }
1911
+
1912
+
1913
+ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
1914
+ NoHandleAllocation nha;
1915
+
1916
+ ASSERT(args.length() == 2);
1917
+ JSObject* receiver = JSObject::cast(args[0]);
1918
+ Object* len = args[1];
1919
+
1920
+ // The generated code should filter out non-Smis before we get here.
1921
+ ASSERT(len->IsSmi());
1922
+
1923
+ Object* result;
1924
+ { MaybeObject* maybe_result = receiver->SetElementsLength(len);
1925
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1926
+ }
1927
+ return len;
1928
+ }
1929
+
1930
+
1931
+ // Extend storage is called in a store inline cache when
1932
+ // it is necessary to extend the properties array of a
1933
+ // JSObject.
1934
+ RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) {
1935
+ NoHandleAllocation na;
1936
+ ASSERT(args.length() == 3);
1937
+
1938
+ // Convert the parameters
1939
+ JSObject* object = JSObject::cast(args[0]);
1940
+ Map* transition = Map::cast(args[1]);
1941
+ Object* value = args[2];
1942
+
1943
+ // Check the object has run out out property space.
1944
+ ASSERT(object->HasFastProperties());
1945
+ ASSERT(object->map()->unused_property_fields() == 0);
1946
+
1947
+ // Expand the properties array.
1948
+ FixedArray* old_storage = object->properties();
1949
+ int new_unused = transition->unused_property_fields();
1950
+ int new_size = old_storage->length() + new_unused + 1;
1951
+ Object* result;
1952
+ { MaybeObject* maybe_result = old_storage->CopySize(new_size);
1953
+ if (!maybe_result->ToObject(&result)) return maybe_result;
1954
+ }
1955
+ FixedArray* new_storage = FixedArray::cast(result);
1956
+ new_storage->set(old_storage->length(), value);
1957
+
1958
+ // Set the new property value and do the map transition.
1959
+ object->set_properties(new_storage);
1960
+ object->set_map(transition);
1961
+
1962
+ // Return the stored value.
1963
+ return value;
1964
+ }
1965
+
1966
+
1967
+ // Used from ic-<arch>.cc.
1968
+ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Miss) {
1969
+ NoHandleAllocation na;
1970
+ ASSERT(args.length() == 3);
1971
+ KeyedStoreIC ic(isolate);
1972
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1973
+ Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
1974
+ return ic.Store(state,
1975
+ static_cast<StrictModeFlag>(extra_ic_state & kStrictMode),
1976
+ args.at<Object>(0),
1977
+ args.at<Object>(1),
1978
+ args.at<Object>(2));
1979
+ }
1980
+
1981
+
1982
+ void BinaryOpIC::patch(Code* code) {
1983
+ set_target(code);
1984
+ }
1985
+
1986
+
1987
+ const char* BinaryOpIC::GetName(TypeInfo type_info) {
1988
+ switch (type_info) {
1989
+ case UNINIT_OR_SMI: return "UninitOrSmi";
1990
+ case DEFAULT: return "Default";
1991
+ case GENERIC: return "Generic";
1992
+ case HEAP_NUMBERS: return "HeapNumbers";
1993
+ case STRINGS: return "Strings";
1994
+ default: return "Invalid";
1995
+ }
1996
+ }
1997
+
1998
+
1999
+ BinaryOpIC::State BinaryOpIC::ToState(TypeInfo type_info) {
2000
+ switch (type_info) {
2001
+ case UNINIT_OR_SMI:
2002
+ return UNINITIALIZED;
2003
+ case DEFAULT:
2004
+ case HEAP_NUMBERS:
2005
+ case STRINGS:
2006
+ return MONOMORPHIC;
2007
+ case GENERIC:
2008
+ return MEGAMORPHIC;
2009
+ }
2010
+ UNREACHABLE();
2011
+ return UNINITIALIZED;
2012
+ }
2013
+
2014
+
2015
+ BinaryOpIC::TypeInfo BinaryOpIC::GetTypeInfo(Object* left,
2016
+ Object* right) {
2017
+ if (left->IsSmi() && right->IsSmi()) {
2018
+ // If we have two smi inputs we can reach here because
2019
+ // of an overflow. Enter default state.
2020
+ return DEFAULT;
2021
+ }
2022
+
2023
+ if (left->IsNumber() && right->IsNumber()) {
2024
+ return HEAP_NUMBERS;
2025
+ }
2026
+
2027
+ if (left->IsString() || right->IsString()) {
2028
+ // Patching for fast string ADD makes sense even if only one of the
2029
+ // arguments is a string.
2030
+ return STRINGS;
2031
+ }
2032
+
2033
+ return GENERIC;
2034
+ }
2035
+
2036
+
2037
+ // defined in code-stubs-<arch>.cc
2038
+ Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info);
2039
+
2040
+
2041
+ RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) {
2042
+ ASSERT(args.length() == 5);
2043
+
2044
+ HandleScope scope(isolate);
2045
+ Handle<Object> left = args.at<Object>(0);
2046
+ Handle<Object> right = args.at<Object>(1);
2047
+ int key = Smi::cast(args[2])->value();
2048
+ Token::Value op = static_cast<Token::Value>(Smi::cast(args[3])->value());
2049
+ BinaryOpIC::TypeInfo previous_type =
2050
+ static_cast<BinaryOpIC::TypeInfo>(Smi::cast(args[4])->value());
2051
+
2052
+ BinaryOpIC::TypeInfo type = BinaryOpIC::GetTypeInfo(*left, *right);
2053
+ Handle<Code> code = GetBinaryOpStub(key, type);
2054
+ if (!code.is_null()) {
2055
+ BinaryOpIC ic(isolate);
2056
+ ic.patch(*code);
2057
+ if (FLAG_trace_ic) {
2058
+ PrintF("[BinaryOpIC (%s->%s)#%s]\n",
2059
+ BinaryOpIC::GetName(previous_type),
2060
+ BinaryOpIC::GetName(type),
2061
+ Token::Name(op));
2062
+ }
2063
+ }
2064
+
2065
+ Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2066
+ isolate->thread_local_top()->context_->builtins(), isolate);
2067
+ Object* builtin = NULL; // Initialization calms down the compiler.
2068
+ switch (op) {
2069
+ case Token::ADD:
2070
+ builtin = builtins->javascript_builtin(Builtins::ADD);
2071
+ break;
2072
+ case Token::SUB:
2073
+ builtin = builtins->javascript_builtin(Builtins::SUB);
2074
+ break;
2075
+ case Token::MUL:
2076
+ builtin = builtins->javascript_builtin(Builtins::MUL);
2077
+ break;
2078
+ case Token::DIV:
2079
+ builtin = builtins->javascript_builtin(Builtins::DIV);
2080
+ break;
2081
+ case Token::MOD:
2082
+ builtin = builtins->javascript_builtin(Builtins::MOD);
2083
+ break;
2084
+ case Token::BIT_AND:
2085
+ builtin = builtins->javascript_builtin(Builtins::BIT_AND);
2086
+ break;
2087
+ case Token::BIT_OR:
2088
+ builtin = builtins->javascript_builtin(Builtins::BIT_OR);
2089
+ break;
2090
+ case Token::BIT_XOR:
2091
+ builtin = builtins->javascript_builtin(Builtins::BIT_XOR);
2092
+ break;
2093
+ case Token::SHR:
2094
+ builtin = builtins->javascript_builtin(Builtins::SHR);
2095
+ break;
2096
+ case Token::SAR:
2097
+ builtin = builtins->javascript_builtin(Builtins::SAR);
2098
+ break;
2099
+ case Token::SHL:
2100
+ builtin = builtins->javascript_builtin(Builtins::SHL);
2101
+ break;
2102
+ default:
2103
+ UNREACHABLE();
2104
+ }
2105
+
2106
+ Handle<JSFunction> builtin_function(JSFunction::cast(builtin),
2107
+ isolate);
2108
+
2109
+ bool caught_exception;
2110
+ Object** builtin_args[] = { right.location() };
2111
+ Handle<Object> result = Execution::Call(builtin_function,
2112
+ left,
2113
+ ARRAY_SIZE(builtin_args),
2114
+ builtin_args,
2115
+ &caught_exception);
2116
+ if (caught_exception) {
2117
+ return Failure::Exception();
2118
+ }
2119
+ return *result;
2120
+ }
2121
+
2122
+
2123
+ void TRBinaryOpIC::patch(Code* code) {
2124
+ set_target(code);
2125
+ }
2126
+
2127
+
2128
+ const char* TRBinaryOpIC::GetName(TypeInfo type_info) {
2129
+ switch (type_info) {
2130
+ case UNINITIALIZED: return "Uninitialized";
2131
+ case SMI: return "SMI";
2132
+ case INT32: return "Int32s";
2133
+ case HEAP_NUMBER: return "HeapNumbers";
2134
+ case ODDBALL: return "Oddball";
2135
+ case STRING: return "Strings";
2136
+ case GENERIC: return "Generic";
2137
+ default: return "Invalid";
2138
+ }
2139
+ }
2140
+
2141
+
2142
+ TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) {
2143
+ switch (type_info) {
2144
+ case UNINITIALIZED:
2145
+ return ::v8::internal::UNINITIALIZED;
2146
+ case SMI:
2147
+ case INT32:
2148
+ case HEAP_NUMBER:
2149
+ case ODDBALL:
2150
+ case STRING:
2151
+ return MONOMORPHIC;
2152
+ case GENERIC:
2153
+ return MEGAMORPHIC;
2154
+ }
2155
+ UNREACHABLE();
2156
+ return ::v8::internal::UNINITIALIZED;
2157
+ }
2158
+
2159
+
2160
+ TRBinaryOpIC::TypeInfo TRBinaryOpIC::JoinTypes(TRBinaryOpIC::TypeInfo x,
2161
+ TRBinaryOpIC::TypeInfo y) {
2162
+ if (x == UNINITIALIZED) return y;
2163
+ if (y == UNINITIALIZED) return x;
2164
+ if (x == STRING && y == STRING) return STRING;
2165
+ if (x == STRING || y == STRING) return GENERIC;
2166
+ if (x >= y) return x;
2167
+ return y;
2168
+ }
2169
+
2170
+ TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left,
2171
+ Handle<Object> right) {
2172
+ ::v8::internal::TypeInfo left_type =
2173
+ ::v8::internal::TypeInfo::TypeFromValue(left);
2174
+ ::v8::internal::TypeInfo right_type =
2175
+ ::v8::internal::TypeInfo::TypeFromValue(right);
2176
+
2177
+ if (left_type.IsSmi() && right_type.IsSmi()) {
2178
+ return SMI;
2179
+ }
2180
+
2181
+ if (left_type.IsInteger32() && right_type.IsInteger32()) {
2182
+ // Platforms with 32-bit Smis have no distinct INT32 type.
2183
+ if (kSmiValueSize == 32) return SMI;
2184
+ return INT32;
2185
+ }
2186
+
2187
+ if (left_type.IsNumber() && right_type.IsNumber()) {
2188
+ return HEAP_NUMBER;
2189
+ }
2190
+
2191
+ if (left_type.IsString() || right_type.IsString()) {
2192
+ // Patching for fast string ADD makes sense even if only one of the
2193
+ // arguments is a string.
2194
+ return STRING;
2195
+ }
2196
+
2197
+ // Check for oddball objects.
2198
+ if (left->IsUndefined() && right->IsNumber()) return ODDBALL;
2199
+ if (left->IsNumber() && right->IsUndefined()) return ODDBALL;
2200
+
2201
+ return GENERIC;
2202
+ }
2203
+
2204
+
2205
+ // defined in code-stubs-<arch>.cc
2206
+ // Only needed to remove dependency of ic.cc on code-stubs-<arch>.h.
2207
+ Handle<Code> GetTypeRecordingBinaryOpStub(int key,
2208
+ TRBinaryOpIC::TypeInfo type_info,
2209
+ TRBinaryOpIC::TypeInfo result_type);
2210
+
2211
+
2212
+ RUNTIME_FUNCTION(MaybeObject*, TypeRecordingBinaryOp_Patch) {
2213
+ ASSERT(args.length() == 5);
2214
+
2215
+ HandleScope scope(isolate);
2216
+ Handle<Object> left = args.at<Object>(0);
2217
+ Handle<Object> right = args.at<Object>(1);
2218
+ int key = Smi::cast(args[2])->value();
2219
+ Token::Value op = static_cast<Token::Value>(Smi::cast(args[3])->value());
2220
+ TRBinaryOpIC::TypeInfo previous_type =
2221
+ static_cast<TRBinaryOpIC::TypeInfo>(Smi::cast(args[4])->value());
2222
+
2223
+ TRBinaryOpIC::TypeInfo type = TRBinaryOpIC::GetTypeInfo(left, right);
2224
+ type = TRBinaryOpIC::JoinTypes(type, previous_type);
2225
+ TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED;
2226
+ if (type == TRBinaryOpIC::STRING && op != Token::ADD) {
2227
+ type = TRBinaryOpIC::GENERIC;
2228
+ }
2229
+ if (type == TRBinaryOpIC::SMI &&
2230
+ previous_type == TRBinaryOpIC::SMI) {
2231
+ if (op == Token::DIV || op == Token::MUL || kSmiValueSize == 32) {
2232
+ // Arithmetic on two Smi inputs has yielded a heap number.
2233
+ // That is the only way to get here from the Smi stub.
2234
+ // With 32-bit Smis, all overflows give heap numbers, but with
2235
+ // 31-bit Smis, most operations overflow to int32 results.
2236
+ result_type = TRBinaryOpIC::HEAP_NUMBER;
2237
+ } else {
2238
+ // Other operations on SMIs that overflow yield int32s.
2239
+ result_type = TRBinaryOpIC::INT32;
2240
+ }
2241
+ }
2242
+ if (type == TRBinaryOpIC::INT32 &&
2243
+ previous_type == TRBinaryOpIC::INT32) {
2244
+ // We must be here because an operation on two INT32 types overflowed.
2245
+ result_type = TRBinaryOpIC::HEAP_NUMBER;
2246
+ }
2247
+
2248
+ Handle<Code> code = GetTypeRecordingBinaryOpStub(key, type, result_type);
2249
+ if (!code.is_null()) {
2250
+ if (FLAG_trace_ic) {
2251
+ PrintF("[TypeRecordingBinaryOpIC (%s->(%s->%s))#%s]\n",
2252
+ TRBinaryOpIC::GetName(previous_type),
2253
+ TRBinaryOpIC::GetName(type),
2254
+ TRBinaryOpIC::GetName(result_type),
2255
+ Token::Name(op));
2256
+ }
2257
+ TRBinaryOpIC ic(isolate);
2258
+ ic.patch(*code);
2259
+
2260
+ // Activate inlined smi code.
2261
+ if (previous_type == TRBinaryOpIC::UNINITIALIZED) {
2262
+ PatchInlinedSmiCode(ic.address());
2263
+ }
2264
+ }
2265
+
2266
+ Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2267
+ isolate->thread_local_top()->context_->builtins(), isolate);
2268
+ Object* builtin = NULL; // Initialization calms down the compiler.
2269
+ switch (op) {
2270
+ case Token::ADD:
2271
+ builtin = builtins->javascript_builtin(Builtins::ADD);
2272
+ break;
2273
+ case Token::SUB:
2274
+ builtin = builtins->javascript_builtin(Builtins::SUB);
2275
+ break;
2276
+ case Token::MUL:
2277
+ builtin = builtins->javascript_builtin(Builtins::MUL);
2278
+ break;
2279
+ case Token::DIV:
2280
+ builtin = builtins->javascript_builtin(Builtins::DIV);
2281
+ break;
2282
+ case Token::MOD:
2283
+ builtin = builtins->javascript_builtin(Builtins::MOD);
2284
+ break;
2285
+ case Token::BIT_AND:
2286
+ builtin = builtins->javascript_builtin(Builtins::BIT_AND);
2287
+ break;
2288
+ case Token::BIT_OR:
2289
+ builtin = builtins->javascript_builtin(Builtins::BIT_OR);
2290
+ break;
2291
+ case Token::BIT_XOR:
2292
+ builtin = builtins->javascript_builtin(Builtins::BIT_XOR);
2293
+ break;
2294
+ case Token::SHR:
2295
+ builtin = builtins->javascript_builtin(Builtins::SHR);
2296
+ break;
2297
+ case Token::SAR:
2298
+ builtin = builtins->javascript_builtin(Builtins::SAR);
2299
+ break;
2300
+ case Token::SHL:
2301
+ builtin = builtins->javascript_builtin(Builtins::SHL);
2302
+ break;
2303
+ default:
2304
+ UNREACHABLE();
2305
+ }
2306
+
2307
+ Handle<JSFunction> builtin_function(JSFunction::cast(builtin), isolate);
2308
+
2309
+ bool caught_exception;
2310
+ Object** builtin_args[] = { right.location() };
2311
+ Handle<Object> result = Execution::Call(builtin_function,
2312
+ left,
2313
+ ARRAY_SIZE(builtin_args),
2314
+ builtin_args,
2315
+ &caught_exception);
2316
+ if (caught_exception) {
2317
+ return Failure::Exception();
2318
+ }
2319
+ return *result;
2320
+ }
2321
+
2322
+
2323
+ Handle<Code> CompareIC::GetUninitialized(Token::Value op) {
2324
+ ICCompareStub stub(op, UNINITIALIZED);
2325
+ return stub.GetCode();
2326
+ }
2327
+
2328
+
2329
+ CompareIC::State CompareIC::ComputeState(Code* target) {
2330
+ int key = target->major_key();
2331
+ if (key == CodeStub::Compare) return GENERIC;
2332
+ ASSERT(key == CodeStub::CompareIC);
2333
+ return static_cast<State>(target->compare_state());
2334
+ }
2335
+
2336
+
2337
+ const char* CompareIC::GetStateName(State state) {
2338
+ switch (state) {
2339
+ case UNINITIALIZED: return "UNINITIALIZED";
2340
+ case SMIS: return "SMIS";
2341
+ case HEAP_NUMBERS: return "HEAP_NUMBERS";
2342
+ case OBJECTS: return "OBJECTS";
2343
+ case GENERIC: return "GENERIC";
2344
+ default:
2345
+ UNREACHABLE();
2346
+ return NULL;
2347
+ }
2348
+ }
2349
+
2350
+
2351
+ CompareIC::State CompareIC::TargetState(State state,
2352
+ bool has_inlined_smi_code,
2353
+ Handle<Object> x,
2354
+ Handle<Object> y) {
2355
+ if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC;
2356
+ if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS;
2357
+ if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2358
+ x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2359
+ if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2360
+ if (state == UNINITIALIZED &&
2361
+ x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2362
+ return GENERIC;
2363
+ }
2364
+
2365
+
2366
+ // Used from ic_<arch>.cc.
2367
+ RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2368
+ NoHandleAllocation na;
2369
+ ASSERT(args.length() == 3);
2370
+ CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value()));
2371
+ ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2372
+ return ic.target();
2373
+ }
2374
+
2375
+
2376
+ static const Address IC_utilities[] = {
2377
+ #define ADDR(name) FUNCTION_ADDR(name),
2378
+ IC_UTIL_LIST(ADDR)
2379
+ NULL
2380
+ #undef ADDR
2381
+ };
2382
+
2383
+
2384
+ Address IC::AddressFromUtilityId(IC::UtilityId id) {
2385
+ return IC_utilities[id];
2386
+ }
2387
+
2388
+
2389
+ } } // namespace v8::internal