therubyracer 0.7.4 → 0.7.5

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 (482) hide show
  1. data/History.txt +11 -0
  2. data/Rakefile +1 -1
  3. data/ext/v8/extconf.rb +0 -18
  4. data/ext/v8/rr.cpp +2 -2
  5. data/ext/v8/upstream/{2.1.10 → 2.3.3}/AUTHORS +1 -0
  6. data/ext/v8/upstream/{2.1.10 → 2.3.3}/ChangeLog +239 -0
  7. data/ext/v8/upstream/{2.1.10 → 2.3.3}/LICENSE +0 -0
  8. data/ext/v8/upstream/{2.1.10 → 2.3.3}/SConstruct +29 -17
  9. data/ext/v8/upstream/{2.1.10 → 2.3.3}/include/v8-debug.h +61 -3
  10. data/ext/v8/upstream/{2.1.10 → 2.3.3}/include/v8-profiler.h +182 -5
  11. data/ext/v8/upstream/{2.1.10 → 2.3.3}/include/v8.h +458 -257
  12. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/SConscript +2 -5
  13. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/accessors.cc +2 -2
  14. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/accessors.h +0 -0
  15. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/allocation.cc +0 -0
  16. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/allocation.h +0 -0
  17. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/api.cc +574 -30
  18. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/api.h +12 -10
  19. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/apinatives.js +0 -0
  20. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/apiutils.h +0 -0
  21. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arguments.h +0 -0
  22. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/assembler-arm-inl.h +38 -15
  23. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/assembler-arm.cc +646 -101
  24. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/assembler-arm.h +174 -15
  25. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/builtins-arm.cc +56 -47
  26. data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +48 -0
  27. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/codegen-arm.cc +2957 -1448
  28. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/codegen-arm.h +230 -74
  29. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/constants-arm.cc +25 -1
  30. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/constants-arm.h +16 -1
  31. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/cpu-arm.cc +4 -0
  32. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/debug-arm.cc +76 -6
  33. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/disasm-arm.cc +168 -20
  34. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/fast-codegen-arm.cc +5 -2
  35. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/frames-arm.cc +4 -4
  36. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/frames-arm.h +0 -0
  37. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/full-codegen-arm.cc +1558 -248
  38. data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +2258 -0
  39. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/jump-target-arm.cc +55 -103
  40. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/macro-assembler-arm.cc +358 -185
  41. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/macro-assembler-arm.h +136 -41
  42. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/regexp-macro-assembler-arm.cc +26 -5
  43. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/regexp-macro-assembler-arm.h +0 -0
  44. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/register-allocator-arm-inl.h +0 -0
  45. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/register-allocator-arm.cc +4 -0
  46. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/register-allocator-arm.h +0 -0
  47. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/simulator-arm.cc +203 -22
  48. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/simulator-arm.h +7 -0
  49. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/stub-cache-arm.cc +531 -324
  50. data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm-inl.h +59 -0
  51. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/virtual-frame-arm.cc +247 -81
  52. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/arm/virtual-frame-arm.h +99 -83
  53. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/array.js +2 -2
  54. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/assembler.cc +6 -13
  55. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/assembler.h +36 -10
  56. data/ext/v8/upstream/2.3.3/src/ast-inl.h +81 -0
  57. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ast.cc +14 -0
  58. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ast.h +20 -35
  59. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/bootstrapper.cc +32 -1
  60. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/bootstrapper.h +0 -4
  61. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/builtins.cc +50 -33
  62. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/builtins.h +2 -0
  63. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/bytecodes-irregexp.h +0 -0
  64. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/cached-powers.h +0 -0
  65. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/char-predicates-inl.h +0 -0
  66. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/char-predicates.h +0 -0
  67. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/checks.cc +0 -0
  68. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/checks.h +8 -6
  69. data/ext/v8/upstream/2.3.3/src/circular-queue-inl.h +53 -0
  70. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/circular-queue.cc +0 -0
  71. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/circular-queue.h +0 -26
  72. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/code-stubs.cc +2 -4
  73. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/code-stubs.h +1 -0
  74. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/code.h +0 -0
  75. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/codegen-inl.h +0 -0
  76. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/codegen.cc +44 -13
  77. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/codegen.h +310 -31
  78. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/compilation-cache.cc +28 -0
  79. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/compilation-cache.h +3 -0
  80. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/compiler.cc +45 -14
  81. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/compiler.h +0 -0
  82. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/contexts.cc +11 -11
  83. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/contexts.h +0 -0
  84. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/conversions-inl.h +0 -0
  85. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/conversions.cc +25 -11
  86. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/conversions.h +0 -0
  87. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/counters.cc +0 -0
  88. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/counters.h +0 -0
  89. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/cpu-profiler-inl.h +2 -1
  90. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/cpu-profiler.cc +68 -24
  91. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/cpu-profiler.h +19 -11
  92. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/cpu.h +0 -0
  93. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8-debug.cc +0 -0
  94. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8-debug.h +0 -0
  95. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8-posix.cc +0 -0
  96. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8-readline.cc +0 -0
  97. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8-windows.cc +0 -0
  98. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8.cc +3 -0
  99. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8.h +0 -0
  100. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/d8.js +55 -2
  101. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/data-flow.cc +3 -0
  102. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/data-flow.h +0 -0
  103. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/date.js +68 -137
  104. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/dateparser-inl.h +0 -0
  105. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/dateparser.cc +2 -8
  106. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/dateparser.h +0 -0
  107. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/debug-agent.cc +3 -3
  108. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/debug-agent.h +0 -0
  109. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/debug-debugger.js +81 -23
  110. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/debug.cc +275 -81
  111. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/debug.h +85 -6
  112. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/disasm.h +0 -0
  113. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/disassembler.cc +1 -1
  114. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/disassembler.h +0 -0
  115. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/diy-fp.cc +0 -0
  116. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/diy-fp.h +0 -0
  117. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/double.h +0 -0
  118. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/dtoa-config.c +0 -0
  119. data/ext/v8/upstream/2.3.3/src/dtoa.cc +77 -0
  120. data/ext/v8/upstream/2.3.3/src/dtoa.h +81 -0
  121. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/execution.cc +111 -3
  122. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/execution.h +12 -1
  123. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/factory.cc +25 -3
  124. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/factory.h +16 -9
  125. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/fast-codegen.cc +0 -0
  126. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/fast-codegen.h +0 -0
  127. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/fast-dtoa.cc +2 -9
  128. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/fast-dtoa.h +1 -2
  129. data/ext/v8/upstream/2.3.3/src/fixed-dtoa.cc +405 -0
  130. data/ext/v8/upstream/{2.1.10/src/jump-target-light.cc → 2.3.3/src/fixed-dtoa.h} +22 -53
  131. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/flag-definitions.h +14 -6
  132. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/flags.cc +5 -9
  133. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/flags.h +0 -0
  134. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/flow-graph.cc +0 -0
  135. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/flow-graph.h +0 -0
  136. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/frame-element.cc +0 -0
  137. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/frame-element.h +0 -0
  138. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/frames-inl.h +0 -0
  139. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/frames.cc +5 -2
  140. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/frames.h +1 -0
  141. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/full-codegen.cc +387 -20
  142. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/full-codegen.h +102 -5
  143. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/func-name-inferrer.cc +0 -0
  144. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/func-name-inferrer.h +0 -0
  145. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/global-handles.cc +8 -4
  146. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/global-handles.h +0 -0
  147. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/globals.h +44 -7
  148. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/handles-inl.h +0 -0
  149. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/handles.cc +19 -0
  150. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/handles.h +8 -0
  151. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/hashmap.cc +0 -0
  152. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/hashmap.h +0 -0
  153. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/heap-inl.h +56 -14
  154. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/heap-profiler.cc +85 -1
  155. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/heap-profiler.h +45 -1
  156. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/heap.cc +994 -396
  157. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/heap.h +220 -65
  158. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/assembler-ia32-inl.h +41 -12
  159. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/assembler-ia32.cc +94 -24
  160. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/assembler-ia32.h +32 -4
  161. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/builtins-ia32.cc +42 -30
  162. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/codegen-ia32-inl.h +0 -0
  163. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/codegen-ia32.cc +1758 -916
  164. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/codegen-ia32.h +67 -74
  165. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/cpu-ia32.cc +4 -0
  166. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/debug-ia32.cc +46 -0
  167. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/disasm-ia32.cc +37 -6
  168. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/fast-codegen-ia32.cc +4 -0
  169. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/fast-codegen-ia32.h +0 -0
  170. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/frames-ia32.cc +4 -0
  171. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/frames-ia32.h +0 -0
  172. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/full-codegen-ia32.cc +1465 -198
  173. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/ic-ia32.cc +688 -367
  174. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/jump-target-ia32.cc +4 -0
  175. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/macro-assembler-ia32.cc +82 -180
  176. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/macro-assembler-ia32.h +41 -25
  177. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/regexp-macro-assembler-ia32.cc +68 -24
  178. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/regexp-macro-assembler-ia32.h +1 -2
  179. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/register-allocator-ia32-inl.h +0 -0
  180. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/register-allocator-ia32.cc +4 -0
  181. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/register-allocator-ia32.h +0 -0
  182. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/simulator-ia32.cc +0 -0
  183. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/simulator-ia32.h +0 -0
  184. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/stub-cache-ia32.cc +649 -302
  185. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/virtual-frame-ia32.cc +23 -1
  186. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ia32/virtual-frame-ia32.h +18 -27
  187. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ic-inl.h +30 -3
  188. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ic.cc +384 -66
  189. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/ic.h +65 -24
  190. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/interpreter-irregexp.cc +0 -0
  191. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/interpreter-irregexp.h +0 -0
  192. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/json.js +3 -3
  193. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jsregexp.cc +20 -4
  194. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jsregexp.h +0 -0
  195. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jump-target-heavy-inl.h +0 -0
  196. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jump-target-heavy.cc +79 -13
  197. data/ext/v8/upstream/{2.1.10/src/jump-target.h → 2.3.3/src/jump-target-heavy.h} +5 -47
  198. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jump-target-inl.h +0 -0
  199. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jump-target-light-inl.h +16 -2
  200. data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +110 -0
  201. data/ext/v8/upstream/2.3.3/src/jump-target-light.h +192 -0
  202. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/jump-target.cc +0 -64
  203. data/ext/v8/upstream/2.3.3/src/jump-target.h +90 -0
  204. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/list-inl.h +0 -0
  205. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/list.h +0 -0
  206. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/liveedit-debugger.js +141 -28
  207. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/liveedit.cc +19 -7
  208. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/liveedit.h +0 -0
  209. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/log-inl.h +0 -0
  210. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/log-utils.cc +0 -0
  211. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/log-utils.h +0 -0
  212. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/log.cc +12 -11
  213. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/log.h +12 -0
  214. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/macro-assembler.h +0 -16
  215. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/macros.py +21 -0
  216. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mark-compact.cc +120 -109
  217. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mark-compact.h +25 -37
  218. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/math.js +0 -0
  219. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/memory.h +0 -0
  220. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/messages.cc +8 -3
  221. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/messages.h +2 -1
  222. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/messages.js +15 -7
  223. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/assembler-mips-inl.h +0 -0
  224. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/assembler-mips.cc +12 -1
  225. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/assembler-mips.h +4 -1
  226. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/builtins-mips.cc +3 -0
  227. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/codegen-mips-inl.h +0 -0
  228. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/codegen-mips.cc +9 -0
  229. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/codegen-mips.h +1 -0
  230. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/constants-mips.cc +5 -0
  231. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/constants-mips.h +0 -0
  232. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/cpu-mips.cc +4 -0
  233. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/debug-mips.cc +3 -0
  234. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/disasm-mips.cc +3 -0
  235. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/fast-codegen-mips.cc +3 -0
  236. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/frames-mips.cc +3 -0
  237. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/frames-mips.h +0 -0
  238. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/full-codegen-mips.cc +5 -1
  239. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/ic-mips.cc +3 -0
  240. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/jump-target-mips.cc +3 -0
  241. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/macro-assembler-mips.cc +3 -0
  242. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/macro-assembler-mips.h +0 -0
  243. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/register-allocator-mips-inl.h +0 -0
  244. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/register-allocator-mips.cc +3 -0
  245. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/register-allocator-mips.h +0 -0
  246. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/simulator-mips.cc +3 -0
  247. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/simulator-mips.h +0 -0
  248. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/stub-cache-mips.cc +3 -0
  249. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/virtual-frame-mips.cc +3 -0
  250. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mips/virtual-frame-mips.h +0 -0
  251. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mirror-debugger.js +46 -4
  252. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/mksnapshot.cc +0 -0
  253. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/natives.h +0 -0
  254. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/objects-debug.cc +8 -1
  255. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/objects-inl.h +235 -62
  256. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/objects.cc +497 -231
  257. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/objects.h +355 -149
  258. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/oprofile-agent.cc +0 -0
  259. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/oprofile-agent.h +0 -0
  260. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/parser.cc +31 -6
  261. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/parser.h +1 -1
  262. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-freebsd.cc +9 -6
  263. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-linux.cc +26 -6
  264. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-macos.cc +11 -6
  265. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-nullos.cc +0 -0
  266. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-openbsd.cc +6 -0
  267. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-posix.cc +0 -0
  268. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-solaris.cc +69 -23
  269. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform-win32.cc +15 -11
  270. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/platform.h +10 -6
  271. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/powers-ten.h +0 -0
  272. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/prettyprinter.cc +0 -0
  273. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/prettyprinter.h +0 -0
  274. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/profile-generator-inl.h +26 -2
  275. data/ext/v8/upstream/2.3.3/src/profile-generator.cc +1830 -0
  276. data/ext/v8/upstream/2.3.3/src/profile-generator.h +853 -0
  277. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/property.cc +0 -0
  278. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/property.h +0 -0
  279. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
  280. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler-irregexp.cc +0 -0
  281. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler-irregexp.h +0 -0
  282. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler-tracer.cc +0 -0
  283. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler-tracer.h +0 -0
  284. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler.cc +1 -3
  285. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-macro-assembler.h +0 -0
  286. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-stack.cc +0 -0
  287. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp-stack.h +0 -0
  288. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/regexp.js +25 -4
  289. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/register-allocator-inl.h +0 -0
  290. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/register-allocator.cc +4 -3
  291. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/register-allocator.h +0 -0
  292. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/rewriter.cc +85 -8
  293. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/rewriter.h +0 -0
  294. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/runtime.cc +547 -221
  295. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/runtime.h +5 -1
  296. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/runtime.js +23 -31
  297. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scanner.cc +12 -6
  298. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scanner.h +60 -53
  299. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scopeinfo.cc +156 -168
  300. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scopeinfo.h +58 -62
  301. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scopes.cc +0 -0
  302. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/scopes.h +0 -0
  303. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/serialize.cc +320 -242
  304. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/serialize.h +81 -48
  305. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/shell.h +0 -0
  306. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/simulator.h +0 -0
  307. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/smart-pointer.h +0 -0
  308. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/snapshot-common.cc +0 -0
  309. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/snapshot-empty.cc +0 -0
  310. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/snapshot.h +0 -0
  311. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/spaces-inl.h +177 -74
  312. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/spaces.cc +138 -315
  313. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/spaces.h +155 -124
  314. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/splay-tree-inl.h +0 -0
  315. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/splay-tree.h +0 -0
  316. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/string-stream.cc +0 -0
  317. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/string-stream.h +0 -0
  318. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/string.js +113 -119
  319. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/stub-cache.cc +242 -97
  320. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/stub-cache.h +118 -55
  321. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/third_party/dtoa/COPYING +0 -0
  322. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/third_party/dtoa/dtoa.c +4 -0
  323. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/third_party/valgrind/valgrind.h +0 -0
  324. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/token.cc +0 -0
  325. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/token.h +0 -0
  326. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/top.cc +107 -26
  327. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/top.h +9 -4
  328. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/type-info.cc +0 -0
  329. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/type-info.h +2 -2
  330. data/ext/v8/upstream/2.3.3/src/unbound-queue-inl.h +95 -0
  331. data/ext/v8/upstream/2.3.3/src/unbound-queue.h +67 -0
  332. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/unicode-inl.h +0 -0
  333. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/unicode.cc +0 -0
  334. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/unicode.h +0 -0
  335. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/uri.js +0 -0
  336. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/utils.cc +0 -0
  337. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/utils.h +83 -1
  338. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8-counters.cc +0 -0
  339. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8-counters.h +20 -0
  340. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8.cc +5 -1
  341. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8.h +0 -0
  342. data/ext/v8/upstream/2.3.3/src/v8dll-main.cc +39 -0
  343. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8natives.js +210 -33
  344. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8threads.cc +1 -1
  345. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/v8threads.h +1 -1
  346. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/variables.cc +0 -0
  347. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/variables.h +0 -0
  348. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/version.cc +3 -3
  349. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/version.h +0 -0
  350. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame-heavy-inl.h +40 -0
  351. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame-heavy.cc +0 -0
  352. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame-inl.h +0 -0
  353. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame-light-inl.h +106 -5
  354. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame-light.cc +4 -1
  355. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame.cc +0 -0
  356. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/virtual-frame.h +0 -0
  357. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/vm-state-inl.h +6 -3
  358. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/vm-state.cc +1 -1
  359. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/vm-state.h +6 -4
  360. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/assembler-x64-inl.h +42 -5
  361. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/assembler-x64.cc +285 -53
  362. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/assembler-x64.h +54 -18
  363. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/builtins-x64.cc +31 -33
  364. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/codegen-x64-inl.h +0 -0
  365. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/codegen-x64.cc +9787 -8722
  366. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/codegen-x64.h +82 -47
  367. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/cpu-x64.cc +4 -0
  368. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/debug-x64.cc +55 -6
  369. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/disasm-x64.cc +42 -19
  370. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/fast-codegen-x64.cc +4 -0
  371. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/frames-x64.cc +4 -0
  372. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/frames-x64.h +4 -0
  373. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/full-codegen-x64.cc +1487 -210
  374. data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +1907 -0
  375. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/jump-target-x64.cc +4 -0
  376. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/macro-assembler-x64.cc +366 -338
  377. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/macro-assembler-x64.h +83 -38
  378. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/regexp-macro-assembler-x64.cc +82 -23
  379. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/regexp-macro-assembler-x64.h +1 -2
  380. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/register-allocator-x64-inl.h +6 -5
  381. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/register-allocator-x64.cc +4 -0
  382. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/register-allocator-x64.h +1 -1
  383. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/simulator-x64.cc +0 -0
  384. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/simulator-x64.h +0 -0
  385. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/stub-cache-x64.cc +556 -377
  386. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/virtual-frame-x64.cc +197 -98
  387. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/x64/virtual-frame-x64.h +37 -28
  388. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/zone-inl.h +0 -0
  389. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/zone.cc +0 -0
  390. data/ext/v8/upstream/{2.1.10 → 2.3.3}/src/zone.h +0 -0
  391. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/codemap.js +0 -0
  392. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/consarray.js +0 -0
  393. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/csvparser.js +0 -0
  394. data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +317 -0
  395. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/generate-ten-powers.scm +0 -0
  396. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/gyp/v8.gyp +87 -20
  397. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/js2c.py +19 -15
  398. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/jsmin.py +0 -0
  399. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/linux-tick-processor +0 -0
  400. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/linux-tick-processor.py +0 -0
  401. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/logreader.js +0 -0
  402. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/mac-nm +0 -0
  403. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/mac-tick-processor +0 -0
  404. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/annotate +0 -0
  405. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/common +0 -0
  406. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/dump +0 -0
  407. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/report +0 -0
  408. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/reset +0 -0
  409. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/run +0 -0
  410. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/shutdown +0 -0
  411. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/oprofile/start +0 -0
  412. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/presubmit.py +0 -0
  413. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/process-heap-prof.py +0 -0
  414. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/profile.js +0 -0
  415. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/profile_view.js +0 -0
  416. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/run-valgrind.py +0 -0
  417. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/splaytree.js +0 -0
  418. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/splaytree.py +0 -0
  419. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/stats-viewer.py +25 -13
  420. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/test.py +0 -0
  421. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/tickprocessor-driver.js +0 -0
  422. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/tickprocessor.js +0 -0
  423. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/tickprocessor.py +0 -0
  424. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/utils.py +0 -0
  425. data/ext/v8/upstream/2.3.3/tools/v8.xcodeproj/project.pbxproj +1855 -0
  426. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/README.txt +0 -0
  427. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/arm.vsprops +0 -0
  428. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/common.vsprops +0 -0
  429. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/d8.vcproj +0 -0
  430. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/d8_arm.vcproj +0 -0
  431. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/d8_x64.vcproj +0 -0
  432. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/d8js2c.cmd +0 -0
  433. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/debug.vsprops +0 -0
  434. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/ia32.vsprops +0 -0
  435. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/js2c.cmd +0 -0
  436. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/release.vsprops +0 -0
  437. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8.sln +0 -0
  438. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8.vcproj +0 -0
  439. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_arm.sln +0 -0
  440. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_arm.vcproj +0 -0
  441. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_base.vcproj +40 -0
  442. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_base_arm.vcproj +20 -0
  443. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_base_x64.vcproj +16 -0
  444. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_cctest.vcproj +4 -0
  445. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
  446. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
  447. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
  448. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
  449. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_process_sample.vcproj +0 -0
  450. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
  451. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
  452. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_shell_sample.vcproj +0 -0
  453. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -0
  454. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -0
  455. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_snapshot.vcproj +0 -0
  456. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
  457. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
  458. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
  459. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_x64.sln +0 -0
  460. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/v8_x64.vcproj +0 -0
  461. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/visual_studio/x64.vsprops +0 -0
  462. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/windows-tick-processor.bat +0 -0
  463. data/ext/v8/upstream/{2.1.10 → 2.3.3}/tools/windows-tick-processor.py +0 -0
  464. data/ext/v8/upstream/Makefile +1 -1
  465. data/ext/v8/v8_template.cpp +94 -2
  466. data/ext/v8/v8_try_catch.cpp +2 -2
  467. data/lib/v8.rb +1 -1
  468. data/lib/v8/access.rb +93 -40
  469. data/lib/v8/cli.rb +1 -1
  470. data/lib/v8/function.rb +14 -2
  471. data/spec/redjs/jsapi_spec.rb +231 -42
  472. data/therubyracer.gemspec +3 -3
  473. metadata +463 -453
  474. data/ext/v8/upstream/2.1.10/src/arm/assembler-thumb2-inl.h +0 -263
  475. data/ext/v8/upstream/2.1.10/src/arm/assembler-thumb2.cc +0 -1878
  476. data/ext/v8/upstream/2.1.10/src/arm/assembler-thumb2.h +0 -1036
  477. data/ext/v8/upstream/2.1.10/src/arm/codegen-arm-inl.h +0 -72
  478. data/ext/v8/upstream/2.1.10/src/arm/ic-arm.cc +0 -1833
  479. data/ext/v8/upstream/2.1.10/src/circular-queue-inl.h +0 -101
  480. data/ext/v8/upstream/2.1.10/src/profile-generator.cc +0 -583
  481. data/ext/v8/upstream/2.1.10/src/profile-generator.h +0 -364
  482. data/ext/v8/upstream/2.1.10/src/x64/ic-x64.cc +0 -1621
File without changes
File without changes
@@ -120,8 +120,6 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match(
120
120
  int start_offset = previous_index;
121
121
  int end_offset = subject_ptr->length();
122
122
 
123
- bool is_ascii = subject->IsAsciiRepresentation();
124
-
125
123
  // The string has been flattened, so it it is a cons string it contains the
126
124
  // full string in the first part.
127
125
  if (StringShape(subject_ptr).IsCons()) {
@@ -129,7 +127,7 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match(
129
127
  subject_ptr = ConsString::cast(subject_ptr)->first();
130
128
  }
131
129
  // Ensure that an underlying string has the same ascii-ness.
132
- ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii);
130
+ bool is_ascii = subject_ptr->IsAsciiRepresentation();
133
131
  ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString());
134
132
  // String is now either Sequential or External
135
133
  int char_size_shift = is_ascii ? 0 : 1;
@@ -230,7 +230,10 @@ function RegExpExec(string) {
230
230
  var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo);
231
231
 
232
232
  if (matchIndices == null) {
233
- if (this.global) this.lastIndex = 0;
233
+ if (this.global) {
234
+ this.lastIndex = 0;
235
+ if (lastIndex != 0) return matchIndices;
236
+ }
234
237
  cache.lastIndex = lastIndex;
235
238
  cache.regExp = this;
236
239
  cache.subject = s;
@@ -257,6 +260,10 @@ function RegExpExec(string) {
257
260
  }
258
261
 
259
262
 
263
+ // One-element cache for the simplified test regexp.
264
+ var regexp_key;
265
+ var regexp_val;
266
+
260
267
  // Section 15.10.6.3 doesn't actually make sense, but the intention seems to be
261
268
  // that test is defined in terms of String.prototype.exec. However, it probably
262
269
  // means the original value of String.prototype.exec, which is what everybody
@@ -281,9 +288,7 @@ function RegExpTest(string) {
281
288
  }
282
289
 
283
290
  var lastIndex = this.lastIndex;
284
-
285
291
  var cache = regExpCache;
286
-
287
292
  if (%_ObjectEquals(cache.type, 'test') &&
288
293
  %_ObjectEquals(cache.regExp, this) &&
289
294
  %_ObjectEquals(cache.subject, string) &&
@@ -291,6 +296,22 @@ function RegExpTest(string) {
291
296
  return cache.answer;
292
297
  }
293
298
 
299
+ // Remove irrelevant preceeding '.*' in a test regexp. The expression
300
+ // checks whether this.source starts with '.*' and that the third
301
+ // char is not a '?'
302
+ if (%_StringCharCodeAt(this.source,0) == 46 && // '.'
303
+ %_StringCharCodeAt(this.source,1) == 42 && // '*'
304
+ %_StringCharCodeAt(this.source,2) != 63) { // '?'
305
+ if (!%_ObjectEquals(regexp_key, this)) {
306
+ regexp_key = this;
307
+ regexp_val = new $RegExp(this.source.substring(2, this.source.length),
308
+ (this.global ? 'g' : '')
309
+ + (this.ignoreCase ? 'i' : '')
310
+ + (this.multiline ? 'm' : ''));
311
+ }
312
+ if (!regexp_val.test(s)) return false;
313
+ }
314
+
294
315
  var length = s.length;
295
316
  var i = this.global ? TO_INTEGER(lastIndex) : 0;
296
317
 
@@ -299,7 +320,7 @@ function RegExpTest(string) {
299
320
  cache.subject = s;
300
321
  cache.lastIndex = i;
301
322
 
302
- if (i < 0 || i > s.length) {
323
+ if (i < 0 || i > length) {
303
324
  this.lastIndex = 0;
304
325
  cache.answer = false;
305
326
  return false;
@@ -84,15 +84,16 @@ Result RegisterAllocator::Allocate() {
84
84
 
85
85
  Result RegisterAllocator::Allocate(Register target) {
86
86
  // If the target is not referenced, it can simply be allocated.
87
- if (!is_used(target)) {
87
+ if (!is_used(RegisterAllocator::ToNumber(target))) {
88
88
  return Result(target);
89
89
  }
90
90
  // If the target is only referenced in the frame, it can be spilled and
91
91
  // then allocated.
92
92
  ASSERT(cgen_->has_valid_frame());
93
- if (cgen_->frame()->is_used(target) && count(target) == 1) {
93
+ if (cgen_->frame()->is_used(RegisterAllocator::ToNumber(target)) &&
94
+ count(target) == 1) {
94
95
  cgen_->frame()->Spill(target);
95
- ASSERT(!is_used(target));
96
+ ASSERT(!is_used(RegisterAllocator::ToNumber(target)));
96
97
  return Result(target);
97
98
  }
98
99
  // Otherwise (if it's referenced outside the frame) we cannot allocate it.
@@ -87,11 +87,13 @@ void AstOptimizer::VisitBlock(Block* node) {
87
87
 
88
88
 
89
89
  void AstOptimizer::VisitExpressionStatement(ExpressionStatement* node) {
90
+ node->expression()->set_no_negative_zero(true);
90
91
  Visit(node->expression());
91
92
  }
92
93
 
93
94
 
94
95
  void AstOptimizer::VisitIfStatement(IfStatement* node) {
96
+ node->condition()->set_no_negative_zero(true);
95
97
  Visit(node->condition());
96
98
  Visit(node->then_statement());
97
99
  if (node->HasElseStatement()) {
@@ -101,6 +103,7 @@ void AstOptimizer::VisitIfStatement(IfStatement* node) {
101
103
 
102
104
 
103
105
  void AstOptimizer::VisitDoWhileStatement(DoWhileStatement* node) {
106
+ node->cond()->set_no_negative_zero(true);
104
107
  Visit(node->cond());
105
108
  Visit(node->body());
106
109
  }
@@ -108,6 +111,7 @@ void AstOptimizer::VisitDoWhileStatement(DoWhileStatement* node) {
108
111
 
109
112
  void AstOptimizer::VisitWhileStatement(WhileStatement* node) {
110
113
  has_function_literal_ = false;
114
+ node->cond()->set_no_negative_zero(true);
111
115
  Visit(node->cond());
112
116
  node->may_have_function_literal_ = has_function_literal_;
113
117
  Visit(node->body());
@@ -120,6 +124,7 @@ void AstOptimizer::VisitForStatement(ForStatement* node) {
120
124
  }
121
125
  if (node->cond() != NULL) {
122
126
  has_function_literal_ = false;
127
+ node->cond()->set_no_negative_zero(true);
123
128
  Visit(node->cond());
124
129
  node->may_have_function_literal_ = has_function_literal_;
125
130
  }
@@ -151,6 +156,7 @@ void AstOptimizer::VisitTryFinallyStatement(TryFinallyStatement* node) {
151
156
 
152
157
 
153
158
  void AstOptimizer::VisitSwitchStatement(SwitchStatement* node) {
159
+ node->tag()->set_no_negative_zero(true);
154
160
  Visit(node->tag());
155
161
  for (int i = 0; i < node->cases()->length(); i++) {
156
162
  CaseClause* clause = node->cases()->at(i);
@@ -444,6 +450,7 @@ void AstOptimizer::VisitUnaryOperation(UnaryOperation* node) {
444
450
  if (FLAG_safe_int32_compiler) {
445
451
  switch (node->op()) {
446
452
  case Token::BIT_NOT:
453
+ node->expression()->set_no_negative_zero(true);
447
454
  node->expression()->set_to_int32(true);
448
455
  // Fall through.
449
456
  case Token::ADD:
@@ -476,10 +483,49 @@ void AstOptimizer::VisitCountOperation(CountOperation* node) {
476
483
  }
477
484
 
478
485
 
486
+ static bool CouldBeNegativeZero(AstNode* node) {
487
+ Literal* literal = node->AsLiteral();
488
+ if (literal != NULL) {
489
+ Handle<Object> handle = literal->handle();
490
+ if (handle->IsString() || handle->IsSmi()) {
491
+ return false;
492
+ } else if (handle->IsHeapNumber()) {
493
+ double double_value = HeapNumber::cast(*handle)->value();
494
+ if (double_value != 0) {
495
+ return false;
496
+ }
497
+ }
498
+ }
499
+ BinaryOperation* binary = node->AsBinaryOperation();
500
+ if (binary != NULL && Token::IsBitOp(binary->op())) {
501
+ return false;
502
+ }
503
+ return true;
504
+ }
505
+
506
+
507
+ static bool CouldBePositiveZero(AstNode* node) {
508
+ Literal* literal = node->AsLiteral();
509
+ if (literal != NULL) {
510
+ Handle<Object> handle = literal->handle();
511
+ if (handle->IsSmi()) {
512
+ if (Smi::cast(*handle) != Smi::FromInt(0)) {
513
+ return false;
514
+ }
515
+ } else if (handle->IsHeapNumber()) {
516
+ // Heap number literal can't be +0, because that's a Smi.
517
+ return false;
518
+ }
519
+ }
520
+ return true;
521
+ }
522
+
523
+
479
524
  void AstOptimizer::VisitBinaryOperation(BinaryOperation* node) {
480
525
  // Depending on the operation we can propagate this node's type down the
481
526
  // AST nodes.
482
- switch (node->op()) {
527
+ Token::Value op = node->op();
528
+ switch (op) {
483
529
  case Token::COMMA:
484
530
  case Token::OR:
485
531
  node->left()->set_no_negative_zero(true);
@@ -503,23 +549,54 @@ void AstOptimizer::VisitBinaryOperation(BinaryOperation* node) {
503
549
  node->left()->set_no_negative_zero(true);
504
550
  node->right()->set_no_negative_zero(true);
505
551
  break;
552
+ case Token::MUL: {
553
+ VariableProxy* lvar_proxy = node->left()->AsVariableProxy();
554
+ VariableProxy* rvar_proxy = node->right()->AsVariableProxy();
555
+ if (lvar_proxy != NULL && rvar_proxy != NULL) {
556
+ Variable* lvar = lvar_proxy->AsVariable();
557
+ Variable* rvar = rvar_proxy->AsVariable();
558
+ if (lvar != NULL && rvar != NULL) {
559
+ if (lvar->mode() == Variable::VAR && rvar->mode() == Variable::VAR) {
560
+ Slot* lslot = lvar->slot();
561
+ Slot* rslot = rvar->slot();
562
+ if (lslot->type() == rslot->type() &&
563
+ (lslot->type() == Slot::PARAMETER ||
564
+ lslot->type() == Slot::LOCAL) &&
565
+ lslot->index() == rslot->index()) {
566
+ // A number squared doesn't give negative zero.
567
+ node->set_no_negative_zero(true);
568
+ }
569
+ }
570
+ }
571
+ }
572
+ }
506
573
  case Token::ADD:
507
574
  case Token::SUB:
508
- case Token::MUL:
509
575
  case Token::DIV:
510
- case Token::MOD:
576
+ case Token::MOD: {
511
577
  if (node->type()->IsLikelySmi()) {
512
578
  node->left()->type()->SetAsLikelySmiIfUnknown();
513
579
  node->right()->type()->SetAsLikelySmiIfUnknown();
514
580
  }
515
- node->left()->set_no_negative_zero(node->no_negative_zero());
516
- node->right()->set_no_negative_zero(node->no_negative_zero());
581
+ if (op == Token::ADD && (!CouldBeNegativeZero(node->left()) ||
582
+ !CouldBeNegativeZero(node->right()))) {
583
+ node->left()->set_no_negative_zero(true);
584
+ node->right()->set_no_negative_zero(true);
585
+ } else if (op == Token::SUB && (!CouldBeNegativeZero(node->left()) ||
586
+ !CouldBePositiveZero(node->right()))) {
587
+ node->left()->set_no_negative_zero(true);
588
+ node->right()->set_no_negative_zero(true);
589
+ } else {
590
+ node->left()->set_no_negative_zero(node->no_negative_zero());
591
+ node->right()->set_no_negative_zero(node->no_negative_zero());
592
+ }
517
593
  if (node->op() == Token::DIV) {
518
594
  node->right()->set_no_negative_zero(false);
519
595
  } else if (node->op() == Token::MOD) {
520
596
  node->right()->set_no_negative_zero(true);
521
597
  }
522
598
  break;
599
+ }
523
600
  default:
524
601
  UNREACHABLE();
525
602
  break;
@@ -530,7 +607,7 @@ void AstOptimizer::VisitBinaryOperation(BinaryOperation* node) {
530
607
 
531
608
  // After visiting the operand nodes we have to check if this node's type
532
609
  // can be updated. If it does, then we can push that information down
533
- // towards the leafs again if the new information is an upgrade over the
610
+ // towards the leaves again if the new information is an upgrade over the
534
611
  // previous type of the operand nodes.
535
612
  if (node->type()->IsUnknown()) {
536
613
  if (node->left()->type()->IsLikelySmi() ||
@@ -590,7 +667,7 @@ void AstOptimizer::VisitBinaryOperation(BinaryOperation* node) {
590
667
 
591
668
  void AstOptimizer::VisitCompareOperation(CompareOperation* node) {
592
669
  if (node->type()->IsKnown()) {
593
- // Propagate useful information down towards the leafs.
670
+ // Propagate useful information down towards the leaves.
594
671
  node->left()->type()->SetAsLikelySmiIfUnknown();
595
672
  node->right()->type()->SetAsLikelySmiIfUnknown();
596
673
  }
@@ -604,7 +681,7 @@ void AstOptimizer::VisitCompareOperation(CompareOperation* node) {
604
681
 
605
682
  // After visiting the operand nodes we have to check if this node's type
606
683
  // can be updated. If it does, then we can push that information down
607
- // towards the leafs again if the new information is an upgrade over the
684
+ // towards the leaves again if the new information is an upgrade over the
608
685
  // previous type of the operand nodes.
609
686
  if (node->type()->IsUnknown()) {
610
687
  if (node->left()->type()->IsLikelySmi() ||
File without changes
@@ -212,23 +212,42 @@ static Handle<Map> ComputeObjectLiteralMap(
212
212
  Handle<Context> context,
213
213
  Handle<FixedArray> constant_properties,
214
214
  bool* is_result_from_cache) {
215
- int number_of_properties = constant_properties->length() / 2;
215
+ int properties_length = constant_properties->length();
216
+ int number_of_properties = properties_length / 2;
216
217
  if (FLAG_canonicalize_object_literal_maps) {
217
- // First find prefix of consecutive symbol keys.
218
+ // Check that there are only symbols and array indices among keys.
218
219
  int number_of_symbol_keys = 0;
219
- while ((number_of_symbol_keys < number_of_properties) &&
220
- (constant_properties->get(number_of_symbol_keys*2)->IsSymbol())) {
221
- number_of_symbol_keys++;
220
+ for (int p = 0; p != properties_length; p += 2) {
221
+ Object* key = constant_properties->get(p);
222
+ uint32_t element_index = 0;
223
+ if (key->IsSymbol()) {
224
+ number_of_symbol_keys++;
225
+ } else if (key->ToArrayIndex(&element_index)) {
226
+ // An index key does not require space in the property backing store.
227
+ number_of_properties--;
228
+ } else {
229
+ // Bail out as a non-symbol non-index key makes caching impossible.
230
+ // ASSERT to make sure that the if condition after the loop is false.
231
+ ASSERT(number_of_symbol_keys != number_of_properties);
232
+ break;
233
+ }
222
234
  }
223
- // Based on the number of prefix symbols key we decide whether
224
- // to use the map cache in the global context.
235
+ // If we only have symbols and array indices among keys then we can
236
+ // use the map cache in the global context.
225
237
  const int kMaxKeys = 10;
226
238
  if ((number_of_symbol_keys == number_of_properties) &&
227
239
  (number_of_symbol_keys < kMaxKeys)) {
228
240
  // Create the fixed array with the key.
229
241
  Handle<FixedArray> keys = Factory::NewFixedArray(number_of_symbol_keys);
230
- for (int i = 0; i < number_of_symbol_keys; i++) {
231
- keys->set(i, constant_properties->get(i*2));
242
+ if (number_of_symbol_keys > 0) {
243
+ int index = 0;
244
+ for (int p = 0; p < properties_length; p += 2) {
245
+ Object* key = constant_properties->get(p);
246
+ if (key->IsSymbol()) {
247
+ keys->set(index++, key);
248
+ }
249
+ }
250
+ ASSERT(index == number_of_symbol_keys);
232
251
  }
233
252
  *is_result_from_cache = true;
234
253
  return Factory::ObjectLiteralMapFromCache(context, keys);
@@ -291,7 +310,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
291
310
  Handle<String> name(String::cast(*key));
292
311
  ASSERT(!name->AsArrayIndex(&element_index));
293
312
  result = SetProperty(boilerplate, name, value, NONE);
294
- } else if (Array::IndexFromObject(*key, &element_index)) {
313
+ } else if (key->ToArrayIndex(&element_index)) {
295
314
  // Array index (uint32).
296
315
  result = SetElement(boilerplate, element_index, value);
297
316
  } else {
@@ -569,6 +588,18 @@ static void GetOwnPropertyImplementation(JSObject* obj,
569
588
  }
570
589
 
571
590
 
591
+ // Enumerator used as indices into the array returned from GetOwnProperty
592
+ enum PropertyDescriptorIndices {
593
+ IS_ACCESSOR_INDEX,
594
+ VALUE_INDEX,
595
+ GETTER_INDEX,
596
+ SETTER_INDEX,
597
+ WRITABLE_INDEX,
598
+ ENUMERABLE_INDEX,
599
+ CONFIGURABLE_INDEX,
600
+ DESCRIPTOR_SIZE
601
+ };
602
+
572
603
  // Returns an array with the property description:
573
604
  // if args[1] is not a property on args[0]
574
605
  // returns undefined
@@ -579,18 +610,63 @@ static void GetOwnPropertyImplementation(JSObject* obj,
579
610
  static Object* Runtime_GetOwnProperty(Arguments args) {
580
611
  ASSERT(args.length() == 2);
581
612
  HandleScope scope;
582
- Handle<FixedArray> elms = Factory::NewFixedArray(5);
613
+ Handle<FixedArray> elms = Factory::NewFixedArray(DESCRIPTOR_SIZE);
583
614
  Handle<JSArray> desc = Factory::NewJSArrayWithElements(elms);
584
615
  LookupResult result;
585
616
  CONVERT_CHECKED(JSObject, obj, args[0]);
586
617
  CONVERT_CHECKED(String, name, args[1]);
587
618
 
619
+ // This could be an element.
620
+ uint32_t index;
621
+ if (name->AsArrayIndex(&index)) {
622
+ if (!obj->HasLocalElement(index)) {
623
+ return Heap::undefined_value();
624
+ }
625
+
626
+ // Special handling of string objects according to ECMAScript 5 15.5.5.2.
627
+ // Note that this might be a string object with elements other than the
628
+ // actual string value. This is covered by the subsequent cases.
629
+ if (obj->IsStringObjectWithCharacterAt(index)) {
630
+ JSValue* js_value = JSValue::cast(obj);
631
+ String* str = String::cast(js_value->value());
632
+ elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
633
+ elms->set(VALUE_INDEX, str->SubString(index, index+1));
634
+ elms->set(WRITABLE_INDEX, Heap::false_value());
635
+ elms->set(ENUMERABLE_INDEX, Heap::false_value());
636
+ elms->set(CONFIGURABLE_INDEX, Heap::false_value());
637
+ return *desc;
638
+ }
639
+
640
+ // This can potentially be an element in the elements dictionary or
641
+ // a fast element.
642
+ if (obj->HasDictionaryElements()) {
643
+ NumberDictionary* dictionary = obj->element_dictionary();
644
+ int entry = dictionary->FindEntry(index);
645
+ PropertyDetails details = dictionary->DetailsAt(entry);
646
+ elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
647
+ elms->set(VALUE_INDEX, dictionary->ValueAt(entry));
648
+ elms->set(WRITABLE_INDEX, Heap::ToBoolean(!details.IsReadOnly()));
649
+ elms->set(ENUMERABLE_INDEX, Heap::ToBoolean(!details.IsDontEnum()));
650
+ elms->set(CONFIGURABLE_INDEX, Heap::ToBoolean(!details.IsDontDelete()));
651
+ return *desc;
652
+ } else {
653
+ // Elements that are stored as array elements always has:
654
+ // writable: true, configurable: true, enumerable: true.
655
+ elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
656
+ elms->set(VALUE_INDEX, obj->GetElement(index));
657
+ elms->set(WRITABLE_INDEX, Heap::true_value());
658
+ elms->set(ENUMERABLE_INDEX, Heap::true_value());
659
+ elms->set(CONFIGURABLE_INDEX, Heap::true_value());
660
+ return *desc;
661
+ }
662
+ }
663
+
588
664
  // Use recursive implementation to also traverse hidden prototypes
589
665
  GetOwnPropertyImplementation(obj, name, &result);
590
666
 
591
- if (!result.IsProperty())
667
+ if (!result.IsProperty()) {
592
668
  return Heap::undefined_value();
593
-
669
+ }
594
670
  if (result.type() == CALLBACKS) {
595
671
  Object* structure = result.GetCallbackObject();
596
672
  if (structure->IsProxy() || structure->IsAccessorInfo()) {
@@ -598,29 +674,35 @@ static Object* Runtime_GetOwnProperty(Arguments args) {
598
674
  // an API defined callback.
599
675
  Object* value = obj->GetPropertyWithCallback(
600
676
  obj, structure, name, result.holder());
601
- elms->set(0, Heap::false_value());
602
- elms->set(1, value);
603
- elms->set(2, Heap::ToBoolean(!result.IsReadOnly()));
677
+ elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
678
+ elms->set(VALUE_INDEX, value);
679
+ elms->set(WRITABLE_INDEX, Heap::ToBoolean(!result.IsReadOnly()));
604
680
  } else if (structure->IsFixedArray()) {
605
681
  // __defineGetter__/__defineSetter__ callback.
606
- elms->set(0, Heap::true_value());
607
- elms->set(1, FixedArray::cast(structure)->get(0));
608
- elms->set(2, FixedArray::cast(structure)->get(1));
682
+ elms->set(IS_ACCESSOR_INDEX, Heap::true_value());
683
+ elms->set(GETTER_INDEX, FixedArray::cast(structure)->get(0));
684
+ elms->set(SETTER_INDEX, FixedArray::cast(structure)->get(1));
609
685
  } else {
610
686
  return Heap::undefined_value();
611
687
  }
612
688
  } else {
613
- elms->set(0, Heap::false_value());
614
- elms->set(1, result.GetLazyValue());
615
- elms->set(2, Heap::ToBoolean(!result.IsReadOnly()));
689
+ elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
690
+ elms->set(VALUE_INDEX, result.GetLazyValue());
691
+ elms->set(WRITABLE_INDEX, Heap::ToBoolean(!result.IsReadOnly()));
616
692
  }
617
693
 
618
- elms->set(3, Heap::ToBoolean(!result.IsDontEnum()));
619
- elms->set(4, Heap::ToBoolean(!result.IsDontDelete()));
694
+ elms->set(ENUMERABLE_INDEX, Heap::ToBoolean(!result.IsDontEnum()));
695
+ elms->set(CONFIGURABLE_INDEX, Heap::ToBoolean(!result.IsDontDelete()));
620
696
  return *desc;
621
697
  }
622
698
 
623
699
 
700
+ static Object* Runtime_PreventExtensions(Arguments args) {
701
+ ASSERT(args.length() == 1);
702
+ CONVERT_CHECKED(JSObject, obj, args[0]);
703
+ return obj->PreventExtensions();
704
+ }
705
+
624
706
  static Object* Runtime_IsExtensible(Arguments args) {
625
707
  ASSERT(args.length() == 1);
626
708
  CONVERT_CHECKED(JSObject, obj, args[0]);
@@ -1325,18 +1407,9 @@ static Object* Runtime_FinishArrayPrototypeSetup(Arguments args) {
1325
1407
  }
1326
1408
 
1327
1409
 
1328
- static void SetCustomCallGenerator(Handle<JSFunction> function,
1329
- ExternalReference* generator) {
1330
- if (function->shared()->function_data()->IsUndefined()) {
1331
- function->shared()->set_function_data(*FromCData(generator->address()));
1332
- }
1333
- }
1334
-
1335
-
1336
1410
  static Handle<JSFunction> InstallBuiltin(Handle<JSObject> holder,
1337
1411
  const char* name,
1338
- Builtins::Name builtin_name,
1339
- ExternalReference* generator = NULL) {
1412
+ Builtins::Name builtin_name) {
1340
1413
  Handle<String> key = Factory::LookupAsciiSymbol(name);
1341
1414
  Handle<Code> code(Builtins::builtin(builtin_name));
1342
1415
  Handle<JSFunction> optimized = Factory::NewFunction(key,
@@ -1345,44 +1418,18 @@ static Handle<JSFunction> InstallBuiltin(Handle<JSObject> holder,
1345
1418
  code,
1346
1419
  false);
1347
1420
  optimized->shared()->DontAdaptArguments();
1348
- if (generator != NULL) {
1349
- SetCustomCallGenerator(optimized, generator);
1350
- }
1351
1421
  SetProperty(holder, key, optimized, NONE);
1352
1422
  return optimized;
1353
1423
  }
1354
1424
 
1355
1425
 
1356
- Object* CompileArrayPushCall(CallStubCompiler* compiler,
1357
- Object* object,
1358
- JSObject* holder,
1359
- JSFunction* function,
1360
- String* name,
1361
- StubCompiler::CheckType check) {
1362
- return compiler->CompileArrayPushCall(object, holder, function, name, check);
1363
- }
1364
-
1365
-
1366
- Object* CompileArrayPopCall(CallStubCompiler* compiler,
1367
- Object* object,
1368
- JSObject* holder,
1369
- JSFunction* function,
1370
- String* name,
1371
- StubCompiler::CheckType check) {
1372
- return compiler->CompileArrayPopCall(object, holder, function, name, check);
1373
- }
1374
-
1375
-
1376
1426
  static Object* Runtime_SpecialArrayFunctions(Arguments args) {
1377
1427
  HandleScope scope;
1378
1428
  ASSERT(args.length() == 1);
1379
1429
  CONVERT_ARG_CHECKED(JSObject, holder, 0);
1380
1430
 
1381
- ExternalReference pop = ExternalReference::compile_array_pop_call();
1382
- ExternalReference push = ExternalReference::compile_array_push_call();
1383
-
1384
- InstallBuiltin(holder, "pop", Builtins::ArrayPop, &pop);
1385
- InstallBuiltin(holder, "push", Builtins::ArrayPush, &push);
1431
+ InstallBuiltin(holder, "pop", Builtins::ArrayPop);
1432
+ InstallBuiltin(holder, "push", Builtins::ArrayPush);
1386
1433
  InstallBuiltin(holder, "shift", Builtins::ArrayShift);
1387
1434
  InstallBuiltin(holder, "unshift", Builtins::ArrayUnshift);
1388
1435
  InstallBuiltin(holder, "slice", Builtins::ArraySlice);
@@ -1578,9 +1625,10 @@ static Object* Runtime_SetCode(Arguments args) {
1578
1625
  if (!EnsureCompiled(shared, KEEP_EXCEPTION)) {
1579
1626
  return Failure::Exception();
1580
1627
  }
1581
- // Set the code, formal parameter count, and the length of the target
1582
- // function.
1628
+ // Set the code, scope info, formal parameter count,
1629
+ // and the length of the target function.
1583
1630
  target->set_code(fun->code());
1631
+ target->shared()->set_scope_info(shared->scope_info());
1584
1632
  target->shared()->set_length(shared->length());
1585
1633
  target->shared()->set_formal_parameter_count(
1586
1634
  shared->formal_parameter_count());
@@ -1616,25 +1664,9 @@ static Object* Runtime_SetCode(Arguments args) {
1616
1664
  }
1617
1665
 
1618
1666
 
1619
- static Object* CharCodeAt(String* subject, Object* index) {
1620
- uint32_t i = 0;
1621
- if (!Array::IndexFromObject(index, &i)) return Heap::nan_value();
1622
- // Flatten the string. If someone wants to get a char at an index
1623
- // in a cons string, it is likely that more indices will be
1624
- // accessed.
1625
- Object* flat = subject->TryFlatten();
1626
- if (flat->IsFailure()) return flat;
1627
- subject = String::cast(flat);
1628
- if (i >= static_cast<uint32_t>(subject->length())) {
1629
- return Heap::nan_value();
1630
- }
1631
- return Smi::FromInt(subject->Get(i));
1632
- }
1633
-
1634
-
1635
1667
  static Object* CharFromCode(Object* char_code) {
1636
1668
  uint32_t code;
1637
- if (Array::IndexFromObject(char_code, &code)) {
1669
+ if (char_code->ToArrayIndex(&code)) {
1638
1670
  if (code <= 0xffff) {
1639
1671
  return Heap::LookupSingleCharacterStringFromCode(code);
1640
1672
  }
@@ -1649,21 +1681,31 @@ static Object* Runtime_StringCharCodeAt(Arguments args) {
1649
1681
 
1650
1682
  CONVERT_CHECKED(String, subject, args[0]);
1651
1683
  Object* index = args[1];
1652
- return CharCodeAt(subject, index);
1653
- }
1684
+ RUNTIME_ASSERT(index->IsNumber());
1654
1685
 
1686
+ uint32_t i = 0;
1687
+ if (index->IsSmi()) {
1688
+ int value = Smi::cast(index)->value();
1689
+ if (value < 0) return Heap::nan_value();
1690
+ i = value;
1691
+ } else {
1692
+ ASSERT(index->IsHeapNumber());
1693
+ double value = HeapNumber::cast(index)->value();
1694
+ i = static_cast<uint32_t>(DoubleToInteger(value));
1695
+ }
1655
1696
 
1656
- static Object* Runtime_StringCharAt(Arguments args) {
1657
- NoHandleAllocation ha;
1658
- ASSERT(args.length() == 2);
1697
+ // Flatten the string. If someone wants to get a char at an index
1698
+ // in a cons string, it is likely that more indices will be
1699
+ // accessed.
1700
+ Object* flat = subject->TryFlatten();
1701
+ if (flat->IsFailure()) return flat;
1702
+ subject = String::cast(flat);
1659
1703
 
1660
- CONVERT_CHECKED(String, subject, args[0]);
1661
- Object* index = args[1];
1662
- Object* code = CharCodeAt(subject, index);
1663
- if (code == Heap::nan_value()) {
1664
- return Heap::undefined_value();
1704
+ if (i >= static_cast<uint32_t>(subject->length())) {
1705
+ return Heap::nan_value();
1665
1706
  }
1666
- return CharFromCode(code);
1707
+
1708
+ return Smi::FromInt(subject->Get(i));
1667
1709
  }
1668
1710
 
1669
1711
 
@@ -2263,6 +2305,134 @@ static Object* StringReplaceRegExpWithString(String* subject,
2263
2305
  }
2264
2306
 
2265
2307
 
2308
+ template <typename ResultSeqString>
2309
+ static Object* StringReplaceRegExpWithEmptyString(String* subject,
2310
+ JSRegExp* regexp,
2311
+ JSArray* last_match_info) {
2312
+ ASSERT(subject->IsFlat());
2313
+
2314
+ HandleScope handles;
2315
+
2316
+ Handle<String> subject_handle(subject);
2317
+ Handle<JSRegExp> regexp_handle(regexp);
2318
+ Handle<JSArray> last_match_info_handle(last_match_info);
2319
+ Handle<Object> match = RegExpImpl::Exec(regexp_handle,
2320
+ subject_handle,
2321
+ 0,
2322
+ last_match_info_handle);
2323
+ if (match.is_null()) return Failure::Exception();
2324
+ if (match->IsNull()) return *subject_handle;
2325
+
2326
+ ASSERT(last_match_info_handle->HasFastElements());
2327
+
2328
+ HandleScope loop_scope;
2329
+ int start, end;
2330
+ {
2331
+ AssertNoAllocation match_info_array_is_not_in_a_handle;
2332
+ FixedArray* match_info_array =
2333
+ FixedArray::cast(last_match_info_handle->elements());
2334
+
2335
+ start = RegExpImpl::GetCapture(match_info_array, 0);
2336
+ end = RegExpImpl::GetCapture(match_info_array, 1);
2337
+ }
2338
+
2339
+ int length = subject->length();
2340
+ int new_length = length - (end - start);
2341
+ if (new_length == 0) {
2342
+ return Heap::empty_string();
2343
+ }
2344
+ Handle<ResultSeqString> answer;
2345
+ if (ResultSeqString::kHasAsciiEncoding) {
2346
+ answer =
2347
+ Handle<ResultSeqString>::cast(Factory::NewRawAsciiString(new_length));
2348
+ } else {
2349
+ answer =
2350
+ Handle<ResultSeqString>::cast(Factory::NewRawTwoByteString(new_length));
2351
+ }
2352
+
2353
+ // If the regexp isn't global, only match once.
2354
+ if (!regexp_handle->GetFlags().is_global()) {
2355
+ if (start > 0) {
2356
+ String::WriteToFlat(*subject_handle,
2357
+ answer->GetChars(),
2358
+ 0,
2359
+ start);
2360
+ }
2361
+ if (end < length) {
2362
+ String::WriteToFlat(*subject_handle,
2363
+ answer->GetChars() + start,
2364
+ end,
2365
+ length);
2366
+ }
2367
+ return *answer;
2368
+ }
2369
+
2370
+ int prev = 0; // Index of end of last match.
2371
+ int next = 0; // Start of next search (prev unless last match was empty).
2372
+ int position = 0;
2373
+
2374
+ do {
2375
+ if (prev < start) {
2376
+ // Add substring subject[prev;start] to answer string.
2377
+ String::WriteToFlat(*subject_handle,
2378
+ answer->GetChars() + position,
2379
+ prev,
2380
+ start);
2381
+ position += start - prev;
2382
+ }
2383
+ prev = end;
2384
+ next = end;
2385
+ // Continue from where the match ended, unless it was an empty match.
2386
+ if (start == end) {
2387
+ next++;
2388
+ if (next > length) break;
2389
+ }
2390
+ match = RegExpImpl::Exec(regexp_handle,
2391
+ subject_handle,
2392
+ next,
2393
+ last_match_info_handle);
2394
+ if (match.is_null()) return Failure::Exception();
2395
+ if (match->IsNull()) break;
2396
+
2397
+ ASSERT(last_match_info_handle->HasFastElements());
2398
+ HandleScope loop_scope;
2399
+ {
2400
+ AssertNoAllocation match_info_array_is_not_in_a_handle;
2401
+ FixedArray* match_info_array =
2402
+ FixedArray::cast(last_match_info_handle->elements());
2403
+ start = RegExpImpl::GetCapture(match_info_array, 0);
2404
+ end = RegExpImpl::GetCapture(match_info_array, 1);
2405
+ }
2406
+ } while (true);
2407
+
2408
+ if (prev < length) {
2409
+ // Add substring subject[prev;length] to answer string.
2410
+ String::WriteToFlat(*subject_handle,
2411
+ answer->GetChars() + position,
2412
+ prev,
2413
+ length);
2414
+ position += length - prev;
2415
+ }
2416
+
2417
+ if (position == 0) {
2418
+ return Heap::empty_string();
2419
+ }
2420
+
2421
+ // Shorten string and fill
2422
+ int string_size = ResultSeqString::SizeFor(position);
2423
+ int allocated_string_size = ResultSeqString::SizeFor(new_length);
2424
+ int delta = allocated_string_size - string_size;
2425
+
2426
+ answer->set_length(position);
2427
+ if (delta == 0) return *answer;
2428
+
2429
+ Address end_of_string = answer->address() + string_size;
2430
+ Heap::CreateFillerObjectAt(end_of_string, delta);
2431
+
2432
+ return *answer;
2433
+ }
2434
+
2435
+
2266
2436
  static Object* Runtime_StringReplaceRegExpWithString(Arguments args) {
2267
2437
  ASSERT(args.length() == 4);
2268
2438
 
@@ -2289,6 +2459,16 @@ static Object* Runtime_StringReplaceRegExpWithString(Arguments args) {
2289
2459
 
2290
2460
  ASSERT(last_match_info->HasFastElements());
2291
2461
 
2462
+ if (replacement->length() == 0) {
2463
+ if (subject->HasOnlyAsciiChars()) {
2464
+ return StringReplaceRegExpWithEmptyString<SeqAsciiString>(
2465
+ subject, regexp, last_match_info);
2466
+ } else {
2467
+ return StringReplaceRegExpWithEmptyString<SeqTwoByteString>(
2468
+ subject, regexp, last_match_info);
2469
+ }
2470
+ }
2471
+
2292
2472
  return StringReplaceRegExpWithString(subject,
2293
2473
  regexp,
2294
2474
  replacement,
@@ -2766,13 +2946,17 @@ int Runtime::StringMatch(Handle<String> sub,
2766
2946
  // algorithm is unnecessary overhead.
2767
2947
  if (pattern_length == 1) {
2768
2948
  AssertNoAllocation no_heap_allocation; // ensure vectors stay valid
2769
- if (sub->IsAsciiRepresentation()) {
2949
+ String* seq_sub = *sub;
2950
+ if (seq_sub->IsConsString()) {
2951
+ seq_sub = ConsString::cast(seq_sub)->first();
2952
+ }
2953
+ if (seq_sub->IsAsciiRepresentation()) {
2770
2954
  uc16 pchar = pat->Get(0);
2771
2955
  if (pchar > String::kMaxAsciiCharCode) {
2772
2956
  return -1;
2773
2957
  }
2774
2958
  Vector<const char> ascii_vector =
2775
- sub->ToAsciiVector().SubVector(start_index, subject_length);
2959
+ seq_sub->ToAsciiVector().SubVector(start_index, subject_length);
2776
2960
  const void* pos = memchr(ascii_vector.start(),
2777
2961
  static_cast<const char>(pchar),
2778
2962
  static_cast<size_t>(ascii_vector.length()));
@@ -2782,7 +2966,9 @@ int Runtime::StringMatch(Handle<String> sub,
2782
2966
  return static_cast<int>(reinterpret_cast<const char*>(pos)
2783
2967
  - ascii_vector.start() + start_index);
2784
2968
  }
2785
- return SingleCharIndexOf(sub->ToUC16Vector(), pat->Get(0), start_index);
2969
+ return SingleCharIndexOf(seq_sub->ToUC16Vector(),
2970
+ pat->Get(0),
2971
+ start_index);
2786
2972
  }
2787
2973
 
2788
2974
  if (!pat->IsFlat()) {
@@ -2790,19 +2976,29 @@ int Runtime::StringMatch(Handle<String> sub,
2790
2976
  }
2791
2977
 
2792
2978
  AssertNoAllocation no_heap_allocation; // ensure vectors stay valid
2979
+ // Extract flattened substrings of cons strings before determining asciiness.
2980
+ String* seq_sub = *sub;
2981
+ if (seq_sub->IsConsString()) {
2982
+ seq_sub = ConsString::cast(seq_sub)->first();
2983
+ }
2984
+ String* seq_pat = *pat;
2985
+ if (seq_pat->IsConsString()) {
2986
+ seq_pat = ConsString::cast(seq_pat)->first();
2987
+ }
2988
+
2793
2989
  // dispatch on type of strings
2794
- if (pat->IsAsciiRepresentation()) {
2795
- Vector<const char> pat_vector = pat->ToAsciiVector();
2796
- if (sub->IsAsciiRepresentation()) {
2797
- return StringSearch(sub->ToAsciiVector(), pat_vector, start_index);
2990
+ if (seq_pat->IsAsciiRepresentation()) {
2991
+ Vector<const char> pat_vector = seq_pat->ToAsciiVector();
2992
+ if (seq_sub->IsAsciiRepresentation()) {
2993
+ return StringSearch(seq_sub->ToAsciiVector(), pat_vector, start_index);
2798
2994
  }
2799
- return StringSearch(sub->ToUC16Vector(), pat_vector, start_index);
2995
+ return StringSearch(seq_sub->ToUC16Vector(), pat_vector, start_index);
2800
2996
  }
2801
- Vector<const uc16> pat_vector = pat->ToUC16Vector();
2802
- if (sub->IsAsciiRepresentation()) {
2803
- return StringSearch(sub->ToAsciiVector(), pat_vector, start_index);
2997
+ Vector<const uc16> pat_vector = seq_pat->ToUC16Vector();
2998
+ if (seq_sub->IsAsciiRepresentation()) {
2999
+ return StringSearch(seq_sub->ToAsciiVector(), pat_vector, start_index);
2804
3000
  }
2805
- return StringSearch(sub->ToUC16Vector(), pat_vector, start_index);
3001
+ return StringSearch(seq_sub->ToUC16Vector(), pat_vector, start_index);
2806
3002
  }
2807
3003
 
2808
3004
 
@@ -2815,7 +3011,7 @@ static Object* Runtime_StringIndexOf(Arguments args) {
2815
3011
 
2816
3012
  Object* index = args[2];
2817
3013
  uint32_t start_index;
2818
- if (!Array::IndexFromObject(index, &start_index)) return Smi::FromInt(-1);
3014
+ if (!index->ToArrayIndex(&start_index)) return Smi::FromInt(-1);
2819
3015
 
2820
3016
  RUNTIME_ASSERT(start_index <= static_cast<uint32_t>(sub->length()));
2821
3017
  int position = Runtime::StringMatch(sub, pat, start_index);
@@ -2865,7 +3061,7 @@ static Object* Runtime_StringLastIndexOf(Arguments args) {
2865
3061
 
2866
3062
  Object* index = args[2];
2867
3063
  uint32_t start_index;
2868
- if (!Array::IndexFromObject(index, &start_index)) return Smi::FromInt(-1);
3064
+ if (!index->ToArrayIndex(&start_index)) return Smi::FromInt(-1);
2869
3065
 
2870
3066
  uint32_t pat_length = pat->length();
2871
3067
  uint32_t sub_length = sub->length();
@@ -3692,7 +3888,7 @@ Object* Runtime::GetObjectProperty(Handle<Object> object, Handle<Object> key) {
3692
3888
 
3693
3889
  // Check if the given key is an array index.
3694
3890
  uint32_t index;
3695
- if (Array::IndexFromObject(*key, &index)) {
3891
+ if (key->ToArrayIndex(&index)) {
3696
3892
  return GetElementOrCharAt(object, index);
3697
3893
  }
3698
3894
 
@@ -3833,11 +4029,29 @@ static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) {
3833
4029
  int unchecked = flag->value();
3834
4030
  RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
3835
4031
 
4032
+ PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
4033
+
4034
+ // Check if this is an element.
4035
+ uint32_t index;
4036
+ bool is_element = name->AsArrayIndex(&index);
4037
+
4038
+ // Special case for elements if any of the flags are true.
4039
+ // If elements are in fast case we always implicitly assume that:
4040
+ // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false.
4041
+ if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) &&
4042
+ is_element) {
4043
+ // Normalize the elements to enable attributes on the property.
4044
+ js_object->NormalizeElements();
4045
+ NumberDictionary* dictionary = js_object->element_dictionary();
4046
+ // Make sure that we never go back to fast case.
4047
+ dictionary->set_requires_slow_elements();
4048
+ PropertyDetails details = PropertyDetails(attr, NORMAL);
4049
+ dictionary->Set(index, *obj_value, details);
4050
+ }
4051
+
3836
4052
  LookupResult result;
3837
4053
  js_object->LocalLookupRealNamedProperty(*name, &result);
3838
4054
 
3839
- PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
3840
-
3841
4055
  // Take special care when attributes are different and there is already
3842
4056
  // a property. For simplicity we normalize the property which enables us
3843
4057
  // to not worry about changing the instance_descriptor and creating a new
@@ -3853,6 +4067,7 @@ static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) {
3853
4067
  *obj_value,
3854
4068
  attr);
3855
4069
  }
4070
+
3856
4071
  return Runtime::SetObjectProperty(js_object, name, obj_value, attr);
3857
4072
  }
3858
4073
 
@@ -3878,7 +4093,7 @@ Object* Runtime::SetObjectProperty(Handle<Object> object,
3878
4093
 
3879
4094
  // Check if the given key is an array index.
3880
4095
  uint32_t index;
3881
- if (Array::IndexFromObject(*key, &index)) {
4096
+ if (key->ToArrayIndex(&index)) {
3882
4097
  // In Firefox/SpiderMonkey, Safari and Opera you can access the characters
3883
4098
  // of a string using [] notation. We need to support this too in
3884
4099
  // JavaScript.
@@ -3930,7 +4145,7 @@ Object* Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
3930
4145
 
3931
4146
  // Check if the given key is an array index.
3932
4147
  uint32_t index;
3933
- if (Array::IndexFromObject(*key, &index)) {
4148
+ if (key->ToArrayIndex(&index)) {
3934
4149
  // In Firefox/SpiderMonkey, Safari and Opera you can access the characters
3935
4150
  // of a string using [] notation. We need to support this too in
3936
4151
  // JavaScript.
@@ -3977,7 +4192,7 @@ Object* Runtime::ForceDeleteObjectProperty(Handle<JSObject> js_object,
3977
4192
 
3978
4193
  // Check if the given key is an array index.
3979
4194
  uint32_t index;
3980
- if (Array::IndexFromObject(*key, &index)) {
4195
+ if (key->ToArrayIndex(&index)) {
3981
4196
  // In Firefox/SpiderMonkey, Safari and Opera you can access the
3982
4197
  // characters of a string using [] notation. In the case of a
3983
4198
  // String object we just need to redirect the deletion to the
@@ -4390,7 +4605,7 @@ static Object* Runtime_GetArgumentsProperty(Arguments args) {
4390
4605
  // Try to convert the key to an index. If successful and within
4391
4606
  // index return the the argument from the frame.
4392
4607
  uint32_t index;
4393
- if (Array::IndexFromObject(args[0], &index) && index < n) {
4608
+ if (args[0]->ToArrayIndex(&index) && index < n) {
4394
4609
  return frame->GetParameter(index);
4395
4610
  }
4396
4611
 
@@ -4911,16 +5126,6 @@ static Object* ConvertCaseHelper(String* s,
4911
5126
  }
4912
5127
 
4913
5128
 
4914
- static inline SeqAsciiString* TryGetSeqAsciiString(String* s) {
4915
- if (!s->IsFlat() || !s->IsAsciiRepresentation()) return NULL;
4916
- if (s->IsConsString()) {
4917
- ASSERT(ConsString::cast(s)->second()->length() == 0);
4918
- return SeqAsciiString::cast(ConsString::cast(s)->first());
4919
- }
4920
- return SeqAsciiString::cast(s);
4921
- }
4922
-
4923
-
4924
5129
  namespace {
4925
5130
 
4926
5131
  struct ToLowerTraits {
@@ -4967,7 +5172,7 @@ static Object* ConvertCase(
4967
5172
  unibrow::Mapping<typename ConvertTraits::UnibrowConverter, 128>* mapping) {
4968
5173
  NoHandleAllocation ha;
4969
5174
  CONVERT_CHECKED(String, s, args[0]);
4970
- s->TryFlatten();
5175
+ s = s->TryFlattenGetString();
4971
5176
 
4972
5177
  const int length = s->length();
4973
5178
  // Assume that the string is not empty; we need this assumption later
@@ -4979,13 +5184,12 @@ static Object* ConvertCase(
4979
5184
  // character is also ascii. This is currently the case, but it
4980
5185
  // might break in the future if we implement more context and locale
4981
5186
  // dependent upper/lower conversions.
4982
- SeqAsciiString* seq_ascii = TryGetSeqAsciiString(s);
4983
- if (seq_ascii != NULL) {
5187
+ if (s->IsSeqAsciiString()) {
4984
5188
  Object* o = Heap::AllocateRawAsciiString(length);
4985
5189
  if (o->IsFailure()) return o;
4986
5190
  SeqAsciiString* result = SeqAsciiString::cast(o);
4987
5191
  bool has_changed_character = ConvertTraits::ConvertAscii(
4988
- result->GetChars(), seq_ascii->GetChars(), length);
5192
+ result->GetChars(), SeqAsciiString::cast(s)->GetChars(), length);
4989
5193
  return has_changed_character ? result : s;
4990
5194
  }
4991
5195
 
@@ -5322,6 +5526,25 @@ static Object* Runtime_NumberToInteger(Arguments args) {
5322
5526
  }
5323
5527
 
5324
5528
 
5529
+ static Object* Runtime_NumberToIntegerMapMinusZero(Arguments args) {
5530
+ NoHandleAllocation ha;
5531
+ ASSERT(args.length() == 1);
5532
+
5533
+ CONVERT_DOUBLE_CHECKED(number, args[0]);
5534
+
5535
+ // We do not include 0 so that we don't have to treat +0 / -0 cases.
5536
+ if (number > 0 && number <= Smi::kMaxValue) {
5537
+ return Smi::FromInt(static_cast<int>(number));
5538
+ }
5539
+
5540
+ double double_value = DoubleToInteger(number);
5541
+ // Map both -0 and +0 to +0.
5542
+ if (double_value == 0) double_value = 0;
5543
+
5544
+ return Heap::NumberFromDouble(double_value);
5545
+ }
5546
+
5547
+
5325
5548
  static Object* Runtime_NumberToJSUint32(Arguments args) {
5326
5549
  NoHandleAllocation ha;
5327
5550
  ASSERT(args.length() == 1);
@@ -5372,7 +5595,7 @@ static Object* Runtime_NumberAdd(Arguments args) {
5372
5595
 
5373
5596
  CONVERT_DOUBLE_CHECKED(x, args[0]);
5374
5597
  CONVERT_DOUBLE_CHECKED(y, args[1]);
5375
- return Heap::AllocateHeapNumber(x + y);
5598
+ return Heap::NumberFromDouble(x + y);
5376
5599
  }
5377
5600
 
5378
5601
 
@@ -5382,7 +5605,7 @@ static Object* Runtime_NumberSub(Arguments args) {
5382
5605
 
5383
5606
  CONVERT_DOUBLE_CHECKED(x, args[0]);
5384
5607
  CONVERT_DOUBLE_CHECKED(y, args[1]);
5385
- return Heap::AllocateHeapNumber(x - y);
5608
+ return Heap::NumberFromDouble(x - y);
5386
5609
  }
5387
5610
 
5388
5611
 
@@ -5392,7 +5615,7 @@ static Object* Runtime_NumberMul(Arguments args) {
5392
5615
 
5393
5616
  CONVERT_DOUBLE_CHECKED(x, args[0]);
5394
5617
  CONVERT_DOUBLE_CHECKED(y, args[1]);
5395
- return Heap::AllocateHeapNumber(x * y);
5618
+ return Heap::NumberFromDouble(x * y);
5396
5619
  }
5397
5620
 
5398
5621
 
@@ -5401,7 +5624,15 @@ static Object* Runtime_NumberUnaryMinus(Arguments args) {
5401
5624
  ASSERT(args.length() == 1);
5402
5625
 
5403
5626
  CONVERT_DOUBLE_CHECKED(x, args[0]);
5404
- return Heap::AllocateHeapNumber(-x);
5627
+ return Heap::NumberFromDouble(-x);
5628
+ }
5629
+
5630
+
5631
+ static Object* Runtime_NumberAlloc(Arguments args) {
5632
+ NoHandleAllocation ha;
5633
+ ASSERT(args.length() == 0);
5634
+
5635
+ return Heap::NumberFromDouble(9876543210.0);
5405
5636
  }
5406
5637
 
5407
5638
 
@@ -5507,7 +5738,7 @@ static Object* Runtime_StringBuilderConcat(Arguments args) {
5507
5738
  if (first->IsString()) return first;
5508
5739
  }
5509
5740
 
5510
- bool ascii = special->IsAsciiRepresentation();
5741
+ bool ascii = special->HasOnlyAsciiChars();
5511
5742
  int position = 0;
5512
5743
  for (int i = 0; i < array_length; i++) {
5513
5744
  int increment = 0;
@@ -5548,7 +5779,7 @@ static Object* Runtime_StringBuilderConcat(Arguments args) {
5548
5779
  String* element = String::cast(elt);
5549
5780
  int element_length = element->length();
5550
5781
  increment = element_length;
5551
- if (ascii && !element->IsAsciiRepresentation()) {
5782
+ if (ascii && !element->HasOnlyAsciiChars()) {
5552
5783
  ascii = false;
5553
5784
  }
5554
5785
  } else {
@@ -6003,7 +6234,7 @@ static Object* Runtime_Math_pow(Arguments args) {
6003
6234
  // custom powi() function than the generic pow().
6004
6235
  if (args[1]->IsSmi()) {
6005
6236
  int y = Smi::cast(args[1])->value();
6006
- return Heap::AllocateHeapNumber(powi(x, y));
6237
+ return Heap::NumberFromDouble(powi(x, y));
6007
6238
  }
6008
6239
 
6009
6240
  CONVERT_DOUBLE_CHECKED(y, args[1]);
@@ -6492,8 +6723,8 @@ static Object* Runtime_NewArgumentsFast(Arguments args) {
6492
6723
  if (obj->IsFailure()) return obj;
6493
6724
 
6494
6725
  AssertNoAllocation no_gc;
6495
- reinterpret_cast<Array*>(obj)->set_map(Heap::fixed_array_map());
6496
- FixedArray* array = FixedArray::cast(obj);
6726
+ FixedArray* array = reinterpret_cast<FixedArray*>(obj);
6727
+ array->set_map(Heap::fixed_array_map());
6497
6728
  array->set_length(length);
6498
6729
 
6499
6730
  WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
@@ -6520,6 +6751,26 @@ static Object* Runtime_NewClosure(Arguments args) {
6520
6751
  return *result;
6521
6752
  }
6522
6753
 
6754
+ static Object* Runtime_NewObjectFromBound(Arguments args) {
6755
+ HandleScope scope;
6756
+ ASSERT(args.length() == 2);
6757
+ CONVERT_ARG_CHECKED(JSFunction, function, 0);
6758
+ CONVERT_ARG_CHECKED(JSArray, params, 1);
6759
+
6760
+ FixedArray* fixed = FixedArray::cast(params->elements());
6761
+
6762
+ bool exception = false;
6763
+ Object*** param_data = NewArray<Object**>(fixed->length());
6764
+ for (int i = 0; i < fixed->length(); i++) {
6765
+ Handle<Object> val = Handle<Object>(fixed->get(i));
6766
+ param_data[i] = val.location();
6767
+ }
6768
+
6769
+ Handle<Object> result = Execution::New(
6770
+ function, fixed->length(), param_data, &exception);
6771
+ return *result;
6772
+ }
6773
+
6523
6774
 
6524
6775
  static Code* ComputeConstructStub(Handle<JSFunction> function) {
6525
6776
  Handle<Object> prototype = Factory::null_value();
@@ -6657,7 +6908,7 @@ static Object* Runtime_NewContext(Arguments args) {
6657
6908
  ASSERT(args.length() == 1);
6658
6909
 
6659
6910
  CONVERT_CHECKED(JSFunction, function, args[0]);
6660
- int length = ScopeInfo<>::NumberOfContextSlots(function->code());
6911
+ int length = function->shared()->scope_info()->NumberOfContextSlots();
6661
6912
  Object* result = Heap::AllocateFunctionContext(length, function);
6662
6913
  if (result->IsFailure()) return result;
6663
6914
 
@@ -7207,6 +7458,24 @@ static Object* Runtime_CompileString(Arguments args) {
7207
7458
  }
7208
7459
 
7209
7460
 
7461
+ static ObjectPair CompileGlobalEval(Handle<String> source,
7462
+ Handle<Object> receiver) {
7463
+ // Deal with a normal eval call with a string argument. Compile it
7464
+ // and return the compiled function bound in the local context.
7465
+ Handle<SharedFunctionInfo> shared = Compiler::CompileEval(
7466
+ source,
7467
+ Handle<Context>(Top::context()),
7468
+ Top::context()->IsGlobalContext(),
7469
+ Compiler::DONT_VALIDATE_JSON);
7470
+ if (shared.is_null()) return MakePair(Failure::Exception(), NULL);
7471
+ Handle<JSFunction> compiled = Factory::NewFunctionFromSharedFunctionInfo(
7472
+ shared,
7473
+ Handle<Context>(Top::context()),
7474
+ NOT_TENURED);
7475
+ return MakePair(*compiled, *receiver);
7476
+ }
7477
+
7478
+
7210
7479
  static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) {
7211
7480
  ASSERT(args.length() == 3);
7212
7481
  if (!args[0]->IsJSFunction()) {
@@ -7272,20 +7541,27 @@ static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) {
7272
7541
  return MakePair(*callee, Top::context()->global()->global_receiver());
7273
7542
  }
7274
7543
 
7275
- // Deal with a normal eval call with a string argument. Compile it
7276
- // and return the compiled function bound in the local context.
7277
- Handle<String> source = args.at<String>(1);
7278
- Handle<SharedFunctionInfo> shared = Compiler::CompileEval(
7279
- source,
7280
- Handle<Context>(Top::context()),
7281
- Top::context()->IsGlobalContext(),
7282
- Compiler::DONT_VALIDATE_JSON);
7283
- if (shared.is_null()) return MakePair(Failure::Exception(), NULL);
7284
- callee = Factory::NewFunctionFromSharedFunctionInfo(
7285
- shared,
7286
- Handle<Context>(Top::context()),
7287
- NOT_TENURED);
7288
- return MakePair(*callee, args[2]);
7544
+ return CompileGlobalEval(args.at<String>(1), args.at<Object>(2));
7545
+ }
7546
+
7547
+
7548
+ static ObjectPair Runtime_ResolvePossiblyDirectEvalNoLookup(Arguments args) {
7549
+ ASSERT(args.length() == 3);
7550
+ if (!args[0]->IsJSFunction()) {
7551
+ return MakePair(Top::ThrowIllegalOperation(), NULL);
7552
+ }
7553
+
7554
+ HandleScope scope;
7555
+ Handle<JSFunction> callee = args.at<JSFunction>(0);
7556
+
7557
+ // 'eval' is bound in the global context, but it may have been overwritten.
7558
+ // Compare it to the builtin 'GlobalEval' function to make sure.
7559
+ if (*callee != Top::global_context()->global_eval_fun() ||
7560
+ !args[1]->IsString()) {
7561
+ return MakePair(*callee, Top::context()->global()->global_receiver());
7562
+ }
7563
+
7564
+ return CompileGlobalEval(args.at<String>(1), args.at<Object>(2));
7289
7565
  }
7290
7566
 
7291
7567
 
@@ -7378,7 +7654,7 @@ class ArrayConcatVisitor {
7378
7654
  uint32_t index_limit_;
7379
7655
  // Index after last seen index. Always less than or equal to index_limit_.
7380
7656
  uint32_t index_offset_;
7381
- bool fast_elements_;
7657
+ const bool fast_elements_;
7382
7658
  };
7383
7659
 
7384
7660
 
@@ -7695,13 +7971,14 @@ static Object* Runtime_ArrayConcat(Arguments args) {
7695
7971
  // The backing storage array must have non-existing elements to
7696
7972
  // preserve holes across concat operations.
7697
7973
  storage = Factory::NewFixedArrayWithHoles(result_length);
7698
-
7974
+ result->set_map(*Factory::GetFastElementsMap(Handle<Map>(result->map())));
7699
7975
  } else {
7700
7976
  // TODO(126): move 25% pre-allocation logic into Dictionary::Allocate
7701
7977
  uint32_t at_least_space_for = estimate_nof_elements +
7702
7978
  (estimate_nof_elements >> 2);
7703
7979
  storage = Handle<FixedArray>::cast(
7704
7980
  Factory::NewNumberDictionary(at_least_space_for));
7981
+ result->set_map(*Factory::GetSlowElementsMap(Handle<Map>(result->map())));
7705
7982
  }
7706
7983
 
7707
7984
  Handle<Object> len = Factory::NewNumber(static_cast<double>(result_length));
@@ -7751,9 +8028,19 @@ static Object* Runtime_MoveArrayContents(Arguments args) {
7751
8028
  ASSERT(args.length() == 2);
7752
8029
  CONVERT_CHECKED(JSArray, from, args[0]);
7753
8030
  CONVERT_CHECKED(JSArray, to, args[1]);
7754
- to->SetContent(FixedArray::cast(from->elements()));
8031
+ HeapObject* new_elements = from->elements();
8032
+ Object* new_map;
8033
+ if (new_elements->map() == Heap::fixed_array_map()) {
8034
+ new_map = to->map()->GetFastElementsMap();
8035
+ } else {
8036
+ new_map = to->map()->GetSlowElementsMap();
8037
+ }
8038
+ if (new_map->IsFailure()) return new_map;
8039
+ to->set_map(Map::cast(new_map));
8040
+ to->set_elements(new_elements);
7755
8041
  to->set_length(from->length());
7756
- from->SetContent(Heap::empty_fixed_array());
8042
+ Object* obj = from->ResetElements();
8043
+ if (obj->IsFailure()) return obj;
7757
8044
  from->set_length(Smi::FromInt(0));
7758
8045
  return to;
7759
8046
  }
@@ -7782,8 +8069,8 @@ static Object* Runtime_SwapElements(Arguments args) {
7782
8069
  Handle<Object> key2 = args.at<Object>(2);
7783
8070
 
7784
8071
  uint32_t index1, index2;
7785
- if (!Array::IndexFromObject(*key1, &index1)
7786
- || !Array::IndexFromObject(*key2, &index2)) {
8072
+ if (!key1->ToArrayIndex(&index1)
8073
+ || !key2->ToArrayIndex(&index2)) {
7787
8074
  return Top::ThrowIllegalOperation();
7788
8075
  }
7789
8076
 
@@ -7814,17 +8101,19 @@ static Object* Runtime_GetArrayKeys(Arguments args) {
7814
8101
  for (int i = 0; i < keys_length; i++) {
7815
8102
  Object* key = keys->get(i);
7816
8103
  uint32_t index;
7817
- if (!Array::IndexFromObject(key, &index) || index >= length) {
8104
+ if (!key->ToArrayIndex(&index) || index >= length) {
7818
8105
  // Zap invalid keys.
7819
8106
  keys->set_undefined(i);
7820
8107
  }
7821
8108
  }
7822
8109
  return *Factory::NewJSArrayWithElements(keys);
7823
8110
  } else {
8111
+ ASSERT(array->HasFastElements());
7824
8112
  Handle<FixedArray> single_interval = Factory::NewFixedArray(2);
7825
8113
  // -1 means start of array.
7826
8114
  single_interval->set(0, Smi::FromInt(-1));
7827
- uint32_t actual_length = static_cast<uint32_t>(array->elements()->length());
8115
+ uint32_t actual_length =
8116
+ static_cast<uint32_t>(FixedArray::cast(array->elements())->length());
7828
8117
  uint32_t min_length = actual_length < length ? actual_length : length;
7829
8118
  Handle<Object> length_object =
7830
8119
  Factory::NewNumber(static_cast<double>(min_length));
@@ -8178,8 +8467,9 @@ static const int kFrameDetailsArgumentCountIndex = 3;
8178
8467
  static const int kFrameDetailsLocalCountIndex = 4;
8179
8468
  static const int kFrameDetailsSourcePositionIndex = 5;
8180
8469
  static const int kFrameDetailsConstructCallIndex = 6;
8181
- static const int kFrameDetailsDebuggerFrameIndex = 7;
8182
- static const int kFrameDetailsFirstDynamicIndex = 8;
8470
+ static const int kFrameDetailsAtReturnIndex = 7;
8471
+ static const int kFrameDetailsDebuggerFrameIndex = 8;
8472
+ static const int kFrameDetailsFirstDynamicIndex = 9;
8183
8473
 
8184
8474
  // Return an array with frame details
8185
8475
  // args[0]: number: break id
@@ -8193,9 +8483,11 @@ static const int kFrameDetailsFirstDynamicIndex = 8;
8193
8483
  // 4: Local count
8194
8484
  // 5: Source position
8195
8485
  // 6: Constructor call
8196
- // 7: Debugger frame
8486
+ // 7: Is at return
8487
+ // 8: Debugger frame
8197
8488
  // Arguments name, value
8198
8489
  // Locals name, value
8490
+ // Return value if any
8199
8491
  static Object* Runtime_GetFrameDetails(Arguments args) {
8200
8492
  HandleScope scope;
8201
8493
  ASSERT(args.length() == 2);
@@ -8236,9 +8528,10 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8236
8528
  // Check for constructor frame.
8237
8529
  bool constructor = it.frame()->IsConstructor();
8238
8530
 
8239
- // Get code and read scope info from it for local variable information.
8240
- Handle<Code> code(it.frame()->code());
8241
- ScopeInfo<> info(*code);
8531
+ // Get scope info and read from it for local variable information.
8532
+ Handle<JSFunction> function(JSFunction::cast(it.frame()->function()));
8533
+ Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
8534
+ ScopeInfo<> info(*scope_info);
8242
8535
 
8243
8536
  // Get the context.
8244
8537
  Handle<Context> context(Context::cast(it.frame()->context()));
@@ -8266,13 +8559,43 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8266
8559
  }
8267
8560
  ASSERT(context->is_function_context());
8268
8561
  locals->set(i * 2 + 1,
8269
- context->get(ScopeInfo<>::ContextSlotIndex(*code, *name,
8270
- NULL)));
8562
+ context->get(scope_info->ContextSlotIndex(*name, NULL)));
8271
8563
  }
8272
8564
  }
8273
8565
 
8274
- // Now advance to the arguments adapter frame (if any). If contains all
8275
- // the provided parameters and
8566
+ // Check whether this frame is positioned at return.
8567
+ int at_return = (index == 0) ? Debug::IsBreakAtReturn(it.frame()) : false;
8568
+
8569
+ // If positioned just before return find the value to be returned and add it
8570
+ // to the frame information.
8571
+ Handle<Object> return_value = Factory::undefined_value();
8572
+ if (at_return) {
8573
+ StackFrameIterator it2;
8574
+ Address internal_frame_sp = NULL;
8575
+ while (!it2.done()) {
8576
+ if (it2.frame()->is_internal()) {
8577
+ internal_frame_sp = it2.frame()->sp();
8578
+ } else {
8579
+ if (it2.frame()->is_java_script()) {
8580
+ if (it2.frame()->id() == it.frame()->id()) {
8581
+ // The internal frame just before the JavaScript frame contains the
8582
+ // value to return on top. A debug break at return will create an
8583
+ // internal frame to store the return value (eax/rax/r0) before
8584
+ // entering the debug break exit frame.
8585
+ if (internal_frame_sp != NULL) {
8586
+ return_value =
8587
+ Handle<Object>(Memory::Object_at(internal_frame_sp));
8588
+ break;
8589
+ }
8590
+ }
8591
+ }
8592
+
8593
+ // Indicate that the previous frame was not an internal frame.
8594
+ internal_frame_sp = NULL;
8595
+ }
8596
+ it2.Advance();
8597
+ }
8598
+ }
8276
8599
 
8277
8600
  // Now advance to the arguments adapter frame (if any). It contains all
8278
8601
  // the provided parameters whereas the function frame always have the number
@@ -8289,7 +8612,8 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8289
8612
 
8290
8613
  // Calculate the size of the result.
8291
8614
  int details_size = kFrameDetailsFirstDynamicIndex +
8292
- 2 * (argument_count + info.NumberOfLocals());
8615
+ 2 * (argument_count + info.NumberOfLocals()) +
8616
+ (at_return ? 1 : 0);
8293
8617
  Handle<FixedArray> details = Factory::NewFixedArray(details_size);
8294
8618
 
8295
8619
  // Add the frame id.
@@ -8315,6 +8639,9 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8315
8639
  // Add the constructor information.
8316
8640
  details->set(kFrameDetailsConstructCallIndex, Heap::ToBoolean(constructor));
8317
8641
 
8642
+ // Add the at return information.
8643
+ details->set(kFrameDetailsAtReturnIndex, Heap::ToBoolean(at_return));
8644
+
8318
8645
  // Add information on whether this frame is invoked in the debugger context.
8319
8646
  details->set(kFrameDetailsDebuggerFrameIndex,
8320
8647
  Heap::ToBoolean(*save->context() == *Debug::debug_context()));
@@ -8344,6 +8671,11 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8344
8671
  details->set(details_index++, locals->get(i));
8345
8672
  }
8346
8673
 
8674
+ // Add the value being returned.
8675
+ if (at_return) {
8676
+ details->set(details_index++, *return_value);
8677
+ }
8678
+
8347
8679
  // Add the receiver (same as in function frame).
8348
8680
  // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE
8349
8681
  // THE FRAME ITERATOR TO WRAP THE RECEIVER.
@@ -8367,18 +8699,17 @@ static Object* Runtime_GetFrameDetails(Arguments args) {
8367
8699
 
8368
8700
 
8369
8701
  // Copy all the context locals into an object used to materialize a scope.
8370
- static void CopyContextLocalsToScopeObject(Handle<Code> code,
8371
- ScopeInfo<>& scope_info,
8372
- Handle<Context> context,
8373
- Handle<JSObject> scope_object) {
8702
+ static void CopyContextLocalsToScopeObject(
8703
+ Handle<SerializedScopeInfo> serialized_scope_info,
8704
+ ScopeInfo<>& scope_info,
8705
+ Handle<Context> context,
8706
+ Handle<JSObject> scope_object) {
8374
8707
  // Fill all context locals to the context extension.
8375
8708
  for (int i = Context::MIN_CONTEXT_SLOTS;
8376
8709
  i < scope_info.number_of_context_slots();
8377
8710
  i++) {
8378
- int context_index =
8379
- ScopeInfo<>::ContextSlotIndex(*code,
8380
- *scope_info.context_slot_name(i),
8381
- NULL);
8711
+ int context_index = serialized_scope_info->ContextSlotIndex(
8712
+ *scope_info.context_slot_name(i), NULL);
8382
8713
 
8383
8714
  // Don't include the arguments shadow (.arguments) context variable.
8384
8715
  if (*scope_info.context_slot_name(i) != Heap::arguments_shadow_symbol()) {
@@ -8394,8 +8725,9 @@ static void CopyContextLocalsToScopeObject(Handle<Code> code,
8394
8725
  // frame.
8395
8726
  static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) {
8396
8727
  Handle<JSFunction> function(JSFunction::cast(frame->function()));
8397
- Handle<Code> code(function->code());
8398
- ScopeInfo<> scope_info(*code);
8728
+ Handle<SharedFunctionInfo> shared(function->shared());
8729
+ Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info());
8730
+ ScopeInfo<> scope_info(*serialized_scope_info);
8399
8731
 
8400
8732
  // Allocate and initialize a JSObject with all the arguments, stack locals
8401
8733
  // heap locals and extension properties of the debugged function.
@@ -8418,7 +8750,7 @@ static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) {
8418
8750
  // Third fill all context locals.
8419
8751
  Handle<Context> frame_context(Context::cast(frame->context()));
8420
8752
  Handle<Context> function_context(frame_context->fcontext());
8421
- CopyContextLocalsToScopeObject(code, scope_info,
8753
+ CopyContextLocalsToScopeObject(serialized_scope_info, scope_info,
8422
8754
  function_context, local_scope);
8423
8755
 
8424
8756
  // Finally copy any properties from the function context extension. This will
@@ -8445,8 +8777,9 @@ static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) {
8445
8777
  static Handle<JSObject> MaterializeClosure(Handle<Context> context) {
8446
8778
  ASSERT(context->is_function_context());
8447
8779
 
8448
- Handle<Code> code(context->closure()->code());
8449
- ScopeInfo<> scope_info(*code);
8780
+ Handle<SharedFunctionInfo> shared(context->closure()->shared());
8781
+ Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info());
8782
+ ScopeInfo<> scope_info(*serialized_scope_info);
8450
8783
 
8451
8784
  // Allocate and initialize a JSObject with all the content of theis function
8452
8785
  // closure.
@@ -8454,9 +8787,8 @@ static Handle<JSObject> MaterializeClosure(Handle<Context> context) {
8454
8787
 
8455
8788
  // Check whether the arguments shadow object exists.
8456
8789
  int arguments_shadow_index =
8457
- ScopeInfo<>::ContextSlotIndex(*code,
8458
- Heap::arguments_shadow_symbol(),
8459
- NULL);
8790
+ shared->scope_info()->ContextSlotIndex(Heap::arguments_shadow_symbol(),
8791
+ NULL);
8460
8792
  if (arguments_shadow_index >= 0) {
8461
8793
  // In this case all the arguments are available in the arguments shadow
8462
8794
  // object.
@@ -8470,7 +8802,8 @@ static Handle<JSObject> MaterializeClosure(Handle<Context> context) {
8470
8802
  }
8471
8803
 
8472
8804
  // Fill all context locals to the context extension.
8473
- CopyContextLocalsToScopeObject(code, scope_info, context, closure_scope);
8805
+ CopyContextLocalsToScopeObject(serialized_scope_info, scope_info,
8806
+ context, closure_scope);
8474
8807
 
8475
8808
  // Finally copy any properties from the function context extension. This will
8476
8809
  // be variables introduced by eval.
@@ -8519,8 +8852,8 @@ class ScopeIterator {
8519
8852
  // created for evaluating top level code and it is not a real local scope.
8520
8853
  // Checking for the existence of .result seems fragile, but the scope info
8521
8854
  // saved with the code object does not otherwise have that information.
8522
- Handle<Code> code(function_->code());
8523
- int index = ScopeInfo<>::StackSlotIndex(*code, Heap::result_symbol());
8855
+ int index = function_->shared()->scope_info()->
8856
+ StackSlotIndex(Heap::result_symbol());
8524
8857
  at_local_ = index < 0;
8525
8858
  } else if (context_->is_function_context()) {
8526
8859
  at_local_ = true;
@@ -8634,8 +8967,7 @@ class ScopeIterator {
8634
8967
 
8635
8968
  case ScopeIterator::ScopeTypeLocal: {
8636
8969
  PrintF("Local:\n");
8637
- Handle<Code> code(function_->code());
8638
- ScopeInfo<> scope_info(*code);
8970
+ ScopeInfo<> scope_info(function_->shared()->scope_info());
8639
8971
  scope_info.Print();
8640
8972
  if (!CurrentContext().is_null()) {
8641
8973
  CurrentContext()->Print();
@@ -8934,9 +9266,9 @@ static Object* Runtime_SetFunctionBreakPoint(Arguments args) {
8934
9266
  Handle<Object> break_point_object_arg = args.at<Object>(2);
8935
9267
 
8936
9268
  // Set break point.
8937
- Debug::SetBreakPoint(shared, source_position, break_point_object_arg);
9269
+ Debug::SetBreakPoint(shared, break_point_object_arg, &source_position);
8938
9270
 
8939
- return Heap::undefined_value();
9271
+ return Smi::FromInt(source_position);
8940
9272
  }
8941
9273
 
8942
9274
 
@@ -8954,8 +9286,6 @@ Object* Runtime::FindSharedFunctionInfoInScript(Handle<Script> script,
8954
9286
  // The current candidate for the source position:
8955
9287
  int target_start_position = RelocInfo::kNoPosition;
8956
9288
  Handle<SharedFunctionInfo> target;
8957
- // The current candidate for the last function in script:
8958
- Handle<SharedFunctionInfo> last;
8959
9289
  while (!done) {
8960
9290
  HeapIterator iterator;
8961
9291
  for (HeapObject* obj = iterator.next();
@@ -8996,25 +9326,12 @@ Object* Runtime::FindSharedFunctionInfoInScript(Handle<Script> script,
8996
9326
  }
8997
9327
  }
8998
9328
  }
8999
-
9000
- // Keep track of the last function in the script.
9001
- if (last.is_null() ||
9002
- shared->end_position() > last->start_position()) {
9003
- last = shared;
9004
- }
9005
9329
  }
9006
9330
  }
9007
9331
  }
9008
9332
 
9009
- // Make sure some candidate is selected.
9010
9333
  if (target.is_null()) {
9011
- if (!last.is_null()) {
9012
- // Position after the last function - use last.
9013
- target = last;
9014
- } else {
9015
- // Unable to find function - possibly script without any function.
9016
- return Heap::undefined_value();
9017
- }
9334
+ return Heap::undefined_value();
9018
9335
  }
9019
9336
 
9020
9337
  // If the candidate found is compiled we are done. NOTE: when lazy
@@ -9032,8 +9349,9 @@ Object* Runtime::FindSharedFunctionInfoInScript(Handle<Script> script,
9032
9349
  }
9033
9350
 
9034
9351
 
9035
- // Change the state of a break point in a script. NOTE: Regarding performance
9036
- // see the NOTE for GetScriptFromScriptData.
9352
+ // Changes the state of a break point in a script and returns source position
9353
+ // where break point was set. NOTE: Regarding performance see the NOTE for
9354
+ // GetScriptFromScriptData.
9037
9355
  // args[0]: script to set break point in
9038
9356
  // args[1]: number: break source position (within the script source)
9039
9357
  // args[2]: number: break point object
@@ -9061,7 +9379,16 @@ static Object* Runtime_SetScriptBreakPoint(Arguments args) {
9061
9379
  } else {
9062
9380
  position = source_position - shared->start_position();
9063
9381
  }
9064
- Debug::SetBreakPoint(shared, position, break_point_object_arg);
9382
+ Debug::SetBreakPoint(shared, break_point_object_arg, &position);
9383
+ position += shared->start_position();
9384
+
9385
+ // The result position may become beyond script source end.
9386
+ // This is expected when the function is toplevel. This may become
9387
+ // a problem later when actual position gets converted into line/column.
9388
+ if (shared->is_toplevel() && position == shared->end_position()) {
9389
+ position = shared->end_position() - 1;
9390
+ }
9391
+ return Smi::FromInt(position);
9065
9392
  }
9066
9393
  return Heap::undefined_value();
9067
9394
  }
@@ -9171,7 +9498,7 @@ static Handle<Context> CopyWithContextChain(Handle<Context> context_chain,
9171
9498
  // Runtime_DebugEvaluate.
9172
9499
  static Handle<Object> GetArgumentsObject(JavaScriptFrame* frame,
9173
9500
  Handle<JSFunction> function,
9174
- Handle<Code> code,
9501
+ Handle<SerializedScopeInfo> scope_info,
9175
9502
  const ScopeInfo<>* sinfo,
9176
9503
  Handle<Context> function_context) {
9177
9504
  // Try to find the value of 'arguments' to pass as parameter. If it is not
@@ -9179,15 +9506,14 @@ static Handle<Object> GetArgumentsObject(JavaScriptFrame* frame,
9179
9506
  // does not support eval) then create an 'arguments' object.
9180
9507
  int index;
9181
9508
  if (sinfo->number_of_stack_slots() > 0) {
9182
- index = ScopeInfo<>::StackSlotIndex(*code, Heap::arguments_symbol());
9509
+ index = scope_info->StackSlotIndex(Heap::arguments_symbol());
9183
9510
  if (index != -1) {
9184
9511
  return Handle<Object>(frame->GetExpression(index));
9185
9512
  }
9186
9513
  }
9187
9514
 
9188
9515
  if (sinfo->number_of_context_slots() > Context::MIN_CONTEXT_SLOTS) {
9189
- index = ScopeInfo<>::ContextSlotIndex(*code, Heap::arguments_symbol(),
9190
- NULL);
9516
+ index = scope_info->ContextSlotIndex(Heap::arguments_symbol(), NULL);
9191
9517
  if (index != -1) {
9192
9518
  return Handle<Object>(function_context->get(index));
9193
9519
  }
@@ -9238,8 +9564,8 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
9238
9564
  JavaScriptFrameIterator it(id);
9239
9565
  JavaScriptFrame* frame = it.frame();
9240
9566
  Handle<JSFunction> function(JSFunction::cast(frame->function()));
9241
- Handle<Code> code(function->code());
9242
- ScopeInfo<> sinfo(*code);
9567
+ Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
9568
+ ScopeInfo<> sinfo(*scope_info);
9243
9569
 
9244
9570
  // Traverse the saved contexts chain to find the active context for the
9245
9571
  // selected frame.
@@ -9261,7 +9587,7 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
9261
9587
  Factory::NewFunction(Factory::empty_string(), Factory::undefined_value());
9262
9588
  go_between->set_context(function->context());
9263
9589
  #ifdef DEBUG
9264
- ScopeInfo<> go_between_sinfo(go_between->shared()->code());
9590
+ ScopeInfo<> go_between_sinfo(go_between->shared()->scope_info());
9265
9591
  ASSERT(go_between_sinfo.number_of_parameters() == 0);
9266
9592
  ASSERT(go_between_sinfo.number_of_context_slots() == 0);
9267
9593
  #endif
@@ -9307,8 +9633,8 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
9307
9633
  &has_pending_exception);
9308
9634
  if (has_pending_exception) return Failure::Exception();
9309
9635
 
9310
- Handle<Object> arguments = GetArgumentsObject(frame, function, code, &sinfo,
9311
- function_context);
9636
+ Handle<Object> arguments = GetArgumentsObject(frame, function, scope_info,
9637
+ &sinfo, function_context);
9312
9638
 
9313
9639
  // Invoke the evaluation function and return the result.
9314
9640
  const int argc = 2;