therubyracer 0.8.1.pre2 → 0.8.1

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