libv8 3.11.8.17 → 3.16.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (754) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/Gemfile +1 -1
  4. data/Rakefile +6 -7
  5. data/lib/libv8/version.rb +1 -1
  6. data/vendor/v8/.gitignore +24 -3
  7. data/vendor/v8/AUTHORS +7 -0
  8. data/vendor/v8/ChangeLog +839 -0
  9. data/vendor/v8/DEPS +1 -1
  10. data/vendor/v8/Makefile.android +92 -0
  11. data/vendor/v8/OWNERS +11 -0
  12. data/vendor/v8/PRESUBMIT.py +71 -0
  13. data/vendor/v8/SConstruct +34 -39
  14. data/vendor/v8/build/android.gypi +56 -37
  15. data/vendor/v8/build/common.gypi +112 -30
  16. data/vendor/v8/build/gyp_v8 +1 -1
  17. data/vendor/v8/build/standalone.gypi +15 -11
  18. data/vendor/v8/include/v8-debug.h +9 -1
  19. data/vendor/v8/include/v8-preparser.h +4 -3
  20. data/vendor/v8/include/v8-profiler.h +25 -25
  21. data/vendor/v8/include/v8-testing.h +4 -3
  22. data/vendor/v8/include/v8.h +994 -540
  23. data/vendor/v8/preparser/preparser-process.cc +3 -3
  24. data/vendor/v8/samples/lineprocessor.cc +20 -27
  25. data/vendor/v8/samples/process.cc +18 -14
  26. data/vendor/v8/samples/shell.cc +16 -15
  27. data/vendor/v8/src/SConscript +15 -14
  28. data/vendor/v8/src/accessors.cc +169 -77
  29. data/vendor/v8/src/accessors.h +4 -0
  30. data/vendor/v8/src/allocation-inl.h +2 -2
  31. data/vendor/v8/src/allocation.h +7 -7
  32. data/vendor/v8/src/api.cc +810 -497
  33. data/vendor/v8/src/api.h +85 -60
  34. data/vendor/v8/src/arm/assembler-arm-inl.h +179 -22
  35. data/vendor/v8/src/arm/assembler-arm.cc +633 -264
  36. data/vendor/v8/src/arm/assembler-arm.h +264 -197
  37. data/vendor/v8/src/arm/builtins-arm.cc +117 -27
  38. data/vendor/v8/src/arm/code-stubs-arm.cc +1241 -700
  39. data/vendor/v8/src/arm/code-stubs-arm.h +35 -138
  40. data/vendor/v8/src/arm/codegen-arm.cc +285 -16
  41. data/vendor/v8/src/arm/codegen-arm.h +22 -0
  42. data/vendor/v8/src/arm/constants-arm.cc +5 -3
  43. data/vendor/v8/src/arm/constants-arm.h +24 -11
  44. data/vendor/v8/src/arm/debug-arm.cc +3 -3
  45. data/vendor/v8/src/arm/deoptimizer-arm.cc +382 -92
  46. data/vendor/v8/src/arm/disasm-arm.cc +61 -12
  47. data/vendor/v8/src/arm/frames-arm.h +0 -14
  48. data/vendor/v8/src/arm/full-codegen-arm.cc +332 -304
  49. data/vendor/v8/src/arm/ic-arm.cc +180 -259
  50. data/vendor/v8/src/arm/lithium-arm.cc +364 -316
  51. data/vendor/v8/src/arm/lithium-arm.h +512 -275
  52. data/vendor/v8/src/arm/lithium-codegen-arm.cc +1768 -809
  53. data/vendor/v8/src/arm/lithium-codegen-arm.h +97 -35
  54. data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +12 -5
  55. data/vendor/v8/src/arm/macro-assembler-arm.cc +439 -228
  56. data/vendor/v8/src/arm/macro-assembler-arm.h +116 -70
  57. data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +54 -44
  58. data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +3 -10
  59. data/vendor/v8/src/arm/simulator-arm.cc +272 -238
  60. data/vendor/v8/src/arm/simulator-arm.h +38 -8
  61. data/vendor/v8/src/arm/stub-cache-arm.cc +522 -895
  62. data/vendor/v8/src/array.js +101 -70
  63. data/vendor/v8/src/assembler.cc +270 -19
  64. data/vendor/v8/src/assembler.h +110 -15
  65. data/vendor/v8/src/ast.cc +79 -69
  66. data/vendor/v8/src/ast.h +255 -301
  67. data/vendor/v8/src/atomicops.h +7 -1
  68. data/vendor/v8/src/atomicops_internals_tsan.h +335 -0
  69. data/vendor/v8/src/bootstrapper.cc +481 -418
  70. data/vendor/v8/src/bootstrapper.h +4 -4
  71. data/vendor/v8/src/builtins.cc +498 -311
  72. data/vendor/v8/src/builtins.h +75 -47
  73. data/vendor/v8/src/checks.cc +2 -1
  74. data/vendor/v8/src/checks.h +8 -0
  75. data/vendor/v8/src/code-stubs-hydrogen.cc +253 -0
  76. data/vendor/v8/src/code-stubs.cc +249 -84
  77. data/vendor/v8/src/code-stubs.h +501 -169
  78. data/vendor/v8/src/codegen.cc +36 -18
  79. data/vendor/v8/src/codegen.h +25 -3
  80. data/vendor/v8/src/collection.js +54 -17
  81. data/vendor/v8/src/compilation-cache.cc +24 -16
  82. data/vendor/v8/src/compilation-cache.h +15 -6
  83. data/vendor/v8/src/compiler.cc +497 -195
  84. data/vendor/v8/src/compiler.h +246 -38
  85. data/vendor/v8/src/contexts.cc +64 -24
  86. data/vendor/v8/src/contexts.h +60 -29
  87. data/vendor/v8/src/conversions-inl.h +24 -14
  88. data/vendor/v8/src/conversions.h +7 -4
  89. data/vendor/v8/src/counters.cc +21 -12
  90. data/vendor/v8/src/counters.h +44 -16
  91. data/vendor/v8/src/cpu-profiler.h +1 -1
  92. data/vendor/v8/src/d8-debug.cc +2 -2
  93. data/vendor/v8/src/d8-readline.cc +13 -2
  94. data/vendor/v8/src/d8.cc +681 -273
  95. data/vendor/v8/src/d8.gyp +4 -4
  96. data/vendor/v8/src/d8.h +38 -18
  97. data/vendor/v8/src/d8.js +0 -617
  98. data/vendor/v8/src/data-flow.h +55 -0
  99. data/vendor/v8/src/date.js +1 -42
  100. data/vendor/v8/src/dateparser-inl.h +5 -1
  101. data/vendor/v8/src/debug-agent.cc +10 -15
  102. data/vendor/v8/src/debug-debugger.js +147 -149
  103. data/vendor/v8/src/debug.cc +323 -164
  104. data/vendor/v8/src/debug.h +26 -14
  105. data/vendor/v8/src/deoptimizer.cc +765 -290
  106. data/vendor/v8/src/deoptimizer.h +130 -28
  107. data/vendor/v8/src/disassembler.cc +10 -4
  108. data/vendor/v8/src/elements-kind.cc +7 -2
  109. data/vendor/v8/src/elements-kind.h +19 -0
  110. data/vendor/v8/src/elements.cc +607 -285
  111. data/vendor/v8/src/elements.h +36 -13
  112. data/vendor/v8/src/execution.cc +52 -31
  113. data/vendor/v8/src/execution.h +4 -4
  114. data/vendor/v8/src/extensions/externalize-string-extension.cc +5 -4
  115. data/vendor/v8/src/extensions/gc-extension.cc +5 -1
  116. data/vendor/v8/src/extensions/statistics-extension.cc +153 -0
  117. data/vendor/v8/src/{inspector.h → extensions/statistics-extension.h} +12 -23
  118. data/vendor/v8/src/factory.cc +101 -134
  119. data/vendor/v8/src/factory.h +36 -31
  120. data/vendor/v8/src/flag-definitions.h +102 -25
  121. data/vendor/v8/src/flags.cc +9 -5
  122. data/vendor/v8/src/frames-inl.h +10 -0
  123. data/vendor/v8/src/frames.cc +116 -26
  124. data/vendor/v8/src/frames.h +96 -12
  125. data/vendor/v8/src/full-codegen.cc +219 -74
  126. data/vendor/v8/src/full-codegen.h +63 -21
  127. data/vendor/v8/src/func-name-inferrer.cc +8 -7
  128. data/vendor/v8/src/func-name-inferrer.h +5 -3
  129. data/vendor/v8/src/gdb-jit.cc +71 -57
  130. data/vendor/v8/src/global-handles.cc +230 -101
  131. data/vendor/v8/src/global-handles.h +26 -27
  132. data/vendor/v8/src/globals.h +17 -19
  133. data/vendor/v8/src/handles-inl.h +59 -12
  134. data/vendor/v8/src/handles.cc +180 -200
  135. data/vendor/v8/src/handles.h +80 -11
  136. data/vendor/v8/src/hashmap.h +60 -40
  137. data/vendor/v8/src/heap-inl.h +107 -45
  138. data/vendor/v8/src/heap-profiler.cc +38 -19
  139. data/vendor/v8/src/heap-profiler.h +24 -14
  140. data/vendor/v8/src/heap.cc +1123 -738
  141. data/vendor/v8/src/heap.h +385 -146
  142. data/vendor/v8/src/hydrogen-instructions.cc +700 -217
  143. data/vendor/v8/src/hydrogen-instructions.h +1158 -472
  144. data/vendor/v8/src/hydrogen.cc +3319 -1662
  145. data/vendor/v8/src/hydrogen.h +411 -170
  146. data/vendor/v8/src/ia32/assembler-ia32-inl.h +46 -16
  147. data/vendor/v8/src/ia32/assembler-ia32.cc +131 -61
  148. data/vendor/v8/src/ia32/assembler-ia32.h +115 -57
  149. data/vendor/v8/src/ia32/builtins-ia32.cc +99 -5
  150. data/vendor/v8/src/ia32/code-stubs-ia32.cc +787 -495
  151. data/vendor/v8/src/ia32/code-stubs-ia32.h +10 -100
  152. data/vendor/v8/src/ia32/codegen-ia32.cc +227 -23
  153. data/vendor/v8/src/ia32/codegen-ia32.h +14 -0
  154. data/vendor/v8/src/ia32/deoptimizer-ia32.cc +428 -87
  155. data/vendor/v8/src/ia32/disasm-ia32.cc +28 -1
  156. data/vendor/v8/src/ia32/frames-ia32.h +6 -16
  157. data/vendor/v8/src/ia32/full-codegen-ia32.cc +280 -272
  158. data/vendor/v8/src/ia32/ic-ia32.cc +150 -250
  159. data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +1600 -517
  160. data/vendor/v8/src/ia32/lithium-codegen-ia32.h +90 -24
  161. data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +10 -6
  162. data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.h +2 -2
  163. data/vendor/v8/src/ia32/lithium-ia32.cc +405 -302
  164. data/vendor/v8/src/ia32/lithium-ia32.h +526 -271
  165. data/vendor/v8/src/ia32/macro-assembler-ia32.cc +378 -119
  166. data/vendor/v8/src/ia32/macro-assembler-ia32.h +62 -28
  167. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +43 -30
  168. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +2 -10
  169. data/vendor/v8/src/ia32/stub-cache-ia32.cc +492 -678
  170. data/vendor/v8/src/ic-inl.h +9 -4
  171. data/vendor/v8/src/ic.cc +836 -923
  172. data/vendor/v8/src/ic.h +228 -247
  173. data/vendor/v8/src/incremental-marking-inl.h +26 -30
  174. data/vendor/v8/src/incremental-marking.cc +276 -248
  175. data/vendor/v8/src/incremental-marking.h +29 -37
  176. data/vendor/v8/src/interface.cc +34 -25
  177. data/vendor/v8/src/interface.h +69 -25
  178. data/vendor/v8/src/interpreter-irregexp.cc +2 -2
  179. data/vendor/v8/src/isolate.cc +382 -76
  180. data/vendor/v8/src/isolate.h +109 -56
  181. data/vendor/v8/src/json-parser.h +217 -104
  182. data/vendor/v8/src/json-stringifier.h +745 -0
  183. data/vendor/v8/src/json.js +10 -132
  184. data/vendor/v8/src/jsregexp-inl.h +106 -0
  185. data/vendor/v8/src/jsregexp.cc +517 -285
  186. data/vendor/v8/src/jsregexp.h +145 -117
  187. data/vendor/v8/src/list-inl.h +35 -22
  188. data/vendor/v8/src/list.h +46 -19
  189. data/vendor/v8/src/lithium-allocator-inl.h +22 -2
  190. data/vendor/v8/src/lithium-allocator.cc +85 -70
  191. data/vendor/v8/src/lithium-allocator.h +21 -39
  192. data/vendor/v8/src/lithium.cc +259 -5
  193. data/vendor/v8/src/lithium.h +131 -32
  194. data/vendor/v8/src/liveedit-debugger.js +52 -3
  195. data/vendor/v8/src/liveedit.cc +393 -113
  196. data/vendor/v8/src/liveedit.h +7 -3
  197. data/vendor/v8/src/log-utils.cc +4 -2
  198. data/vendor/v8/src/log.cc +170 -140
  199. data/vendor/v8/src/log.h +62 -11
  200. data/vendor/v8/src/macro-assembler.h +17 -0
  201. data/vendor/v8/src/macros.py +2 -0
  202. data/vendor/v8/src/mark-compact-inl.h +3 -23
  203. data/vendor/v8/src/mark-compact.cc +801 -830
  204. data/vendor/v8/src/mark-compact.h +154 -47
  205. data/vendor/v8/src/marking-thread.cc +85 -0
  206. data/vendor/v8/src/{inspector.cc → marking-thread.h} +32 -24
  207. data/vendor/v8/src/math.js +12 -18
  208. data/vendor/v8/src/messages.cc +18 -8
  209. data/vendor/v8/src/messages.js +314 -261
  210. data/vendor/v8/src/mips/assembler-mips-inl.h +58 -6
  211. data/vendor/v8/src/mips/assembler-mips.cc +92 -75
  212. data/vendor/v8/src/mips/assembler-mips.h +54 -60
  213. data/vendor/v8/src/mips/builtins-mips.cc +116 -17
  214. data/vendor/v8/src/mips/code-stubs-mips.cc +919 -556
  215. data/vendor/v8/src/mips/code-stubs-mips.h +22 -131
  216. data/vendor/v8/src/mips/codegen-mips.cc +281 -6
  217. data/vendor/v8/src/mips/codegen-mips.h +22 -0
  218. data/vendor/v8/src/mips/constants-mips.cc +2 -0
  219. data/vendor/v8/src/mips/constants-mips.h +12 -2
  220. data/vendor/v8/src/mips/deoptimizer-mips.cc +286 -50
  221. data/vendor/v8/src/mips/disasm-mips.cc +13 -0
  222. data/vendor/v8/src/mips/full-codegen-mips.cc +297 -284
  223. data/vendor/v8/src/mips/ic-mips.cc +182 -263
  224. data/vendor/v8/src/mips/lithium-codegen-mips.cc +1208 -556
  225. data/vendor/v8/src/mips/lithium-codegen-mips.h +72 -19
  226. data/vendor/v8/src/mips/lithium-gap-resolver-mips.cc +9 -2
  227. data/vendor/v8/src/mips/lithium-mips.cc +290 -302
  228. data/vendor/v8/src/mips/lithium-mips.h +463 -266
  229. data/vendor/v8/src/mips/macro-assembler-mips.cc +208 -115
  230. data/vendor/v8/src/mips/macro-assembler-mips.h +67 -24
  231. data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +40 -25
  232. data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +3 -9
  233. data/vendor/v8/src/mips/simulator-mips.cc +112 -40
  234. data/vendor/v8/src/mips/simulator-mips.h +5 -0
  235. data/vendor/v8/src/mips/stub-cache-mips.cc +502 -884
  236. data/vendor/v8/src/mirror-debugger.js +157 -30
  237. data/vendor/v8/src/mksnapshot.cc +88 -14
  238. data/vendor/v8/src/object-observe.js +235 -0
  239. data/vendor/v8/src/objects-debug.cc +178 -176
  240. data/vendor/v8/src/objects-inl.h +1333 -486
  241. data/vendor/v8/src/objects-printer.cc +125 -43
  242. data/vendor/v8/src/objects-visiting-inl.h +578 -6
  243. data/vendor/v8/src/objects-visiting.cc +2 -2
  244. data/vendor/v8/src/objects-visiting.h +172 -79
  245. data/vendor/v8/src/objects.cc +3533 -2885
  246. data/vendor/v8/src/objects.h +1352 -1131
  247. data/vendor/v8/src/optimizing-compiler-thread.cc +152 -0
  248. data/vendor/v8/src/optimizing-compiler-thread.h +111 -0
  249. data/vendor/v8/src/parser.cc +390 -500
  250. data/vendor/v8/src/parser.h +45 -33
  251. data/vendor/v8/src/platform-cygwin.cc +10 -21
  252. data/vendor/v8/src/platform-freebsd.cc +36 -41
  253. data/vendor/v8/src/platform-linux.cc +160 -124
  254. data/vendor/v8/src/platform-macos.cc +30 -27
  255. data/vendor/v8/src/platform-nullos.cc +17 -1
  256. data/vendor/v8/src/platform-openbsd.cc +19 -50
  257. data/vendor/v8/src/platform-posix.cc +14 -0
  258. data/vendor/v8/src/platform-solaris.cc +20 -53
  259. data/vendor/v8/src/platform-win32.cc +49 -26
  260. data/vendor/v8/src/platform.h +40 -1
  261. data/vendor/v8/src/preparser.cc +8 -5
  262. data/vendor/v8/src/preparser.h +2 -2
  263. data/vendor/v8/src/prettyprinter.cc +16 -0
  264. data/vendor/v8/src/prettyprinter.h +2 -0
  265. data/vendor/v8/src/profile-generator-inl.h +1 -0
  266. data/vendor/v8/src/profile-generator.cc +209 -147
  267. data/vendor/v8/src/profile-generator.h +15 -12
  268. data/vendor/v8/src/property-details.h +46 -31
  269. data/vendor/v8/src/property.cc +27 -46
  270. data/vendor/v8/src/property.h +163 -83
  271. data/vendor/v8/src/proxy.js +7 -2
  272. data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +4 -13
  273. data/vendor/v8/src/regexp-macro-assembler-irregexp.h +1 -2
  274. data/vendor/v8/src/regexp-macro-assembler-tracer.cc +1 -11
  275. data/vendor/v8/src/regexp-macro-assembler-tracer.h +0 -1
  276. data/vendor/v8/src/regexp-macro-assembler.cc +31 -14
  277. data/vendor/v8/src/regexp-macro-assembler.h +14 -11
  278. data/vendor/v8/src/regexp-stack.cc +1 -0
  279. data/vendor/v8/src/regexp.js +9 -8
  280. data/vendor/v8/src/rewriter.cc +18 -7
  281. data/vendor/v8/src/runtime-profiler.cc +52 -43
  282. data/vendor/v8/src/runtime-profiler.h +0 -25
  283. data/vendor/v8/src/runtime.cc +2006 -2023
  284. data/vendor/v8/src/runtime.h +56 -49
  285. data/vendor/v8/src/safepoint-table.cc +12 -18
  286. data/vendor/v8/src/safepoint-table.h +11 -8
  287. data/vendor/v8/src/scanner.cc +1 -0
  288. data/vendor/v8/src/scanner.h +4 -10
  289. data/vendor/v8/src/scopeinfo.cc +35 -9
  290. data/vendor/v8/src/scopeinfo.h +64 -3
  291. data/vendor/v8/src/scopes.cc +251 -156
  292. data/vendor/v8/src/scopes.h +61 -27
  293. data/vendor/v8/src/serialize.cc +348 -396
  294. data/vendor/v8/src/serialize.h +125 -114
  295. data/vendor/v8/src/small-pointer-list.h +11 -11
  296. data/vendor/v8/src/{smart-array-pointer.h → smart-pointers.h} +64 -15
  297. data/vendor/v8/src/snapshot-common.cc +64 -15
  298. data/vendor/v8/src/snapshot-empty.cc +7 -1
  299. data/vendor/v8/src/snapshot.h +9 -2
  300. data/vendor/v8/src/spaces-inl.h +17 -0
  301. data/vendor/v8/src/spaces.cc +477 -183
  302. data/vendor/v8/src/spaces.h +238 -58
  303. data/vendor/v8/src/splay-tree-inl.h +8 -7
  304. data/vendor/v8/src/splay-tree.h +24 -10
  305. data/vendor/v8/src/store-buffer.cc +12 -5
  306. data/vendor/v8/src/store-buffer.h +2 -4
  307. data/vendor/v8/src/string-search.h +22 -6
  308. data/vendor/v8/src/string-stream.cc +11 -8
  309. data/vendor/v8/src/string.js +47 -15
  310. data/vendor/v8/src/stub-cache.cc +461 -224
  311. data/vendor/v8/src/stub-cache.h +164 -102
  312. data/vendor/v8/src/sweeper-thread.cc +105 -0
  313. data/vendor/v8/src/sweeper-thread.h +81 -0
  314. data/vendor/v8/src/token.h +1 -0
  315. data/vendor/v8/src/transitions-inl.h +220 -0
  316. data/vendor/v8/src/transitions.cc +160 -0
  317. data/vendor/v8/src/transitions.h +207 -0
  318. data/vendor/v8/src/type-info.cc +182 -181
  319. data/vendor/v8/src/type-info.h +31 -19
  320. data/vendor/v8/src/unicode-inl.h +62 -106
  321. data/vendor/v8/src/unicode.cc +57 -67
  322. data/vendor/v8/src/unicode.h +45 -91
  323. data/vendor/v8/src/uri.js +57 -29
  324. data/vendor/v8/src/utils.h +105 -5
  325. data/vendor/v8/src/v8-counters.cc +54 -11
  326. data/vendor/v8/src/v8-counters.h +134 -19
  327. data/vendor/v8/src/v8.cc +29 -29
  328. data/vendor/v8/src/v8.h +1 -0
  329. data/vendor/v8/src/v8conversions.cc +26 -22
  330. data/vendor/v8/src/v8globals.h +56 -43
  331. data/vendor/v8/src/v8natives.js +83 -30
  332. data/vendor/v8/src/v8threads.cc +42 -21
  333. data/vendor/v8/src/v8threads.h +4 -1
  334. data/vendor/v8/src/v8utils.cc +9 -93
  335. data/vendor/v8/src/v8utils.h +37 -33
  336. data/vendor/v8/src/variables.cc +6 -3
  337. data/vendor/v8/src/variables.h +6 -13
  338. data/vendor/v8/src/version.cc +2 -2
  339. data/vendor/v8/src/vm-state-inl.h +11 -0
  340. data/vendor/v8/src/x64/assembler-x64-inl.h +39 -8
  341. data/vendor/v8/src/x64/assembler-x64.cc +78 -64
  342. data/vendor/v8/src/x64/assembler-x64.h +38 -33
  343. data/vendor/v8/src/x64/builtins-x64.cc +105 -7
  344. data/vendor/v8/src/x64/code-stubs-x64.cc +790 -413
  345. data/vendor/v8/src/x64/code-stubs-x64.h +10 -106
  346. data/vendor/v8/src/x64/codegen-x64.cc +210 -8
  347. data/vendor/v8/src/x64/codegen-x64.h +20 -1
  348. data/vendor/v8/src/x64/deoptimizer-x64.cc +336 -75
  349. data/vendor/v8/src/x64/disasm-x64.cc +15 -0
  350. data/vendor/v8/src/x64/frames-x64.h +0 -14
  351. data/vendor/v8/src/x64/full-codegen-x64.cc +293 -270
  352. data/vendor/v8/src/x64/ic-x64.cc +153 -251
  353. data/vendor/v8/src/x64/lithium-codegen-x64.cc +1379 -531
  354. data/vendor/v8/src/x64/lithium-codegen-x64.h +67 -23
  355. data/vendor/v8/src/x64/lithium-gap-resolver-x64.cc +2 -2
  356. data/vendor/v8/src/x64/lithium-x64.cc +349 -289
  357. data/vendor/v8/src/x64/lithium-x64.h +460 -250
  358. data/vendor/v8/src/x64/macro-assembler-x64.cc +350 -177
  359. data/vendor/v8/src/x64/macro-assembler-x64.h +67 -49
  360. data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +46 -33
  361. data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +2 -3
  362. data/vendor/v8/src/x64/stub-cache-x64.cc +484 -653
  363. data/vendor/v8/src/zone-inl.h +9 -27
  364. data/vendor/v8/src/zone.cc +5 -5
  365. data/vendor/v8/src/zone.h +53 -27
  366. data/vendor/v8/test/benchmarks/testcfg.py +5 -0
  367. data/vendor/v8/test/cctest/cctest.cc +4 -0
  368. data/vendor/v8/test/cctest/cctest.gyp +3 -1
  369. data/vendor/v8/test/cctest/cctest.h +57 -9
  370. data/vendor/v8/test/cctest/cctest.status +15 -15
  371. data/vendor/v8/test/cctest/test-accessors.cc +26 -0
  372. data/vendor/v8/test/cctest/test-alloc.cc +22 -30
  373. data/vendor/v8/test/cctest/test-api.cc +1943 -314
  374. data/vendor/v8/test/cctest/test-assembler-arm.cc +133 -13
  375. data/vendor/v8/test/cctest/test-assembler-ia32.cc +1 -1
  376. data/vendor/v8/test/cctest/test-assembler-mips.cc +12 -0
  377. data/vendor/v8/test/cctest/test-ast.cc +4 -2
  378. data/vendor/v8/test/cctest/test-compiler.cc +61 -29
  379. data/vendor/v8/test/cctest/test-dataflow.cc +2 -2
  380. data/vendor/v8/test/cctest/test-debug.cc +212 -33
  381. data/vendor/v8/test/cctest/test-decls.cc +257 -11
  382. data/vendor/v8/test/cctest/test-dictionary.cc +24 -10
  383. data/vendor/v8/test/cctest/test-disasm-arm.cc +118 -1
  384. data/vendor/v8/test/cctest/test-disasm-ia32.cc +3 -2
  385. data/vendor/v8/test/cctest/test-flags.cc +14 -1
  386. data/vendor/v8/test/cctest/test-func-name-inference.cc +7 -4
  387. data/vendor/v8/test/cctest/test-global-object.cc +51 -0
  388. data/vendor/v8/test/cctest/test-hashing.cc +32 -23
  389. data/vendor/v8/test/cctest/test-heap-profiler.cc +131 -77
  390. data/vendor/v8/test/cctest/test-heap.cc +1084 -143
  391. data/vendor/v8/test/cctest/test-list.cc +1 -1
  392. data/vendor/v8/test/cctest/test-liveedit.cc +3 -2
  393. data/vendor/v8/test/cctest/test-lockers.cc +12 -13
  394. data/vendor/v8/test/cctest/test-log.cc +10 -8
  395. data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +2 -2
  396. data/vendor/v8/test/cctest/test-mark-compact.cc +44 -22
  397. data/vendor/v8/test/cctest/test-object-observe.cc +434 -0
  398. data/vendor/v8/test/cctest/test-parsing.cc +86 -39
  399. data/vendor/v8/test/cctest/test-platform-linux.cc +6 -0
  400. data/vendor/v8/test/cctest/test-platform-win32.cc +7 -0
  401. data/vendor/v8/test/cctest/test-random.cc +5 -4
  402. data/vendor/v8/test/cctest/test-regexp.cc +137 -101
  403. data/vendor/v8/test/cctest/test-serialize.cc +150 -230
  404. data/vendor/v8/test/cctest/test-sockets.cc +1 -1
  405. data/vendor/v8/test/cctest/test-spaces.cc +139 -0
  406. data/vendor/v8/test/cctest/test-strings.cc +736 -74
  407. data/vendor/v8/test/cctest/test-thread-termination.cc +10 -11
  408. data/vendor/v8/test/cctest/test-threads.cc +4 -4
  409. data/vendor/v8/test/cctest/test-utils.cc +16 -0
  410. data/vendor/v8/test/cctest/test-weakmaps.cc +7 -3
  411. data/vendor/v8/test/cctest/testcfg.py +64 -5
  412. data/vendor/v8/test/es5conform/testcfg.py +5 -0
  413. data/vendor/v8/test/message/message.status +1 -1
  414. data/vendor/v8/test/message/overwritten-builtins.out +3 -0
  415. data/vendor/v8/test/message/testcfg.py +89 -8
  416. data/vendor/v8/test/message/try-catch-finally-no-message.out +26 -26
  417. data/vendor/v8/test/mjsunit/accessor-map-sharing.js +18 -2
  418. data/vendor/v8/test/mjsunit/allocation-site-info.js +126 -0
  419. data/vendor/v8/test/mjsunit/array-bounds-check-removal.js +62 -1
  420. data/vendor/v8/test/mjsunit/array-iteration.js +1 -1
  421. data/vendor/v8/test/mjsunit/array-literal-transitions.js +2 -0
  422. data/vendor/v8/test/mjsunit/array-natives-elements.js +317 -0
  423. data/vendor/v8/test/mjsunit/array-reduce.js +8 -8
  424. data/vendor/v8/test/mjsunit/array-slice.js +12 -0
  425. data/vendor/v8/test/mjsunit/array-store-and-grow.js +4 -1
  426. data/vendor/v8/test/mjsunit/assert-opt-and-deopt.js +1 -1
  427. data/vendor/v8/test/mjsunit/bugs/bug-2337.js +53 -0
  428. data/vendor/v8/test/mjsunit/compare-known-objects-slow.js +69 -0
  429. data/vendor/v8/test/mjsunit/compiler/alloc-object-huge.js +3 -1
  430. data/vendor/v8/test/mjsunit/compiler/inline-accessors.js +368 -0
  431. data/vendor/v8/test/mjsunit/compiler/inline-arguments.js +87 -1
  432. data/vendor/v8/test/mjsunit/compiler/inline-closures.js +49 -0
  433. data/vendor/v8/test/mjsunit/compiler/inline-construct.js +55 -43
  434. data/vendor/v8/test/mjsunit/compiler/inline-literals.js +39 -0
  435. data/vendor/v8/test/mjsunit/compiler/multiply-add.js +69 -0
  436. data/vendor/v8/test/mjsunit/compiler/optimized-closures.js +57 -0
  437. data/vendor/v8/test/mjsunit/compiler/parallel-proto-change.js +44 -0
  438. data/vendor/v8/test/mjsunit/compiler/property-static.js +69 -0
  439. data/vendor/v8/test/mjsunit/compiler/proto-chain-constant.js +55 -0
  440. data/vendor/v8/test/mjsunit/compiler/proto-chain-load.js +44 -0
  441. data/vendor/v8/test/mjsunit/compiler/regress-gvn.js +3 -2
  442. data/vendor/v8/test/mjsunit/compiler/regress-or.js +6 -2
  443. data/vendor/v8/test/mjsunit/compiler/rotate.js +224 -0
  444. data/vendor/v8/test/mjsunit/compiler/uint32.js +173 -0
  445. data/vendor/v8/test/mjsunit/count-based-osr.js +2 -1
  446. data/vendor/v8/test/mjsunit/d8-os.js +3 -3
  447. data/vendor/v8/test/mjsunit/date-parse.js +3 -0
  448. data/vendor/v8/test/mjsunit/date.js +22 -0
  449. data/vendor/v8/test/mjsunit/debug-break-inline.js +1 -0
  450. data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized-double.js +22 -12
  451. data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized.js +21 -10
  452. data/vendor/v8/test/mjsunit/debug-liveedit-compile-error.js +60 -0
  453. data/vendor/v8/test/mjsunit/debug-liveedit-double-call.js +142 -0
  454. data/vendor/v8/test/mjsunit/debug-liveedit-literals.js +94 -0
  455. data/vendor/v8/test/mjsunit/debug-liveedit-restart-frame.js +153 -0
  456. data/vendor/v8/test/mjsunit/debug-multiple-breakpoints.js +1 -1
  457. data/vendor/v8/test/mjsunit/debug-script-breakpoints-closure.js +67 -0
  458. data/vendor/v8/test/mjsunit/debug-script-breakpoints-nested.js +82 -0
  459. data/vendor/v8/test/mjsunit/debug-script.js +4 -2
  460. data/vendor/v8/test/mjsunit/debug-set-variable-value.js +308 -0
  461. data/vendor/v8/test/mjsunit/debug-stepout-scope-part1.js +190 -0
  462. data/vendor/v8/test/mjsunit/debug-stepout-scope-part2.js +83 -0
  463. data/vendor/v8/test/mjsunit/debug-stepout-scope-part3.js +80 -0
  464. data/vendor/v8/test/mjsunit/debug-stepout-scope-part4.js +80 -0
  465. data/vendor/v8/test/mjsunit/debug-stepout-scope-part5.js +77 -0
  466. data/vendor/v8/test/mjsunit/debug-stepout-scope-part6.js +79 -0
  467. data/vendor/v8/test/mjsunit/debug-stepout-scope-part7.js +79 -0
  468. data/vendor/v8/test/mjsunit/{debug-stepout-scope.js → debug-stepout-scope-part8.js} +0 -189
  469. data/vendor/v8/test/mjsunit/delete-non-configurable.js +74 -0
  470. data/vendor/v8/test/mjsunit/deopt-minus-zero.js +56 -0
  471. data/vendor/v8/test/mjsunit/elements-kind.js +6 -4
  472. data/vendor/v8/test/mjsunit/elements-length-no-holey.js +33 -0
  473. data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +46 -19
  474. data/vendor/v8/test/mjsunit/error-accessors.js +54 -0
  475. data/vendor/v8/test/mjsunit/error-constructors.js +1 -14
  476. data/vendor/v8/test/mjsunit/error-tostring.js +8 -0
  477. data/vendor/v8/test/mjsunit/eval-stack-trace.js +204 -0
  478. data/vendor/v8/test/mjsunit/external-array.js +364 -1
  479. data/vendor/v8/test/mjsunit/fast-array-length.js +37 -0
  480. data/vendor/v8/test/mjsunit/fast-non-keyed.js +113 -0
  481. data/vendor/v8/test/mjsunit/fast-prototype.js +117 -0
  482. data/vendor/v8/test/mjsunit/function-call.js +14 -18
  483. data/vendor/v8/test/mjsunit/fuzz-natives-part1.js +230 -0
  484. data/vendor/v8/test/mjsunit/fuzz-natives-part2.js +229 -0
  485. data/vendor/v8/test/mjsunit/fuzz-natives-part3.js +229 -0
  486. data/vendor/v8/test/mjsunit/{fuzz-natives.js → fuzz-natives-part4.js} +12 -2
  487. data/vendor/v8/test/mjsunit/generated-transition-stub.js +218 -0
  488. data/vendor/v8/test/mjsunit/greedy.js +1 -1
  489. data/vendor/v8/test/mjsunit/harmony/block-conflicts.js +2 -1
  490. data/vendor/v8/test/mjsunit/harmony/block-let-crankshaft.js +1 -1
  491. data/vendor/v8/test/mjsunit/harmony/collections.js +69 -11
  492. data/vendor/v8/test/mjsunit/harmony/debug-blockscopes.js +2 -2
  493. data/vendor/v8/test/mjsunit/harmony/module-linking.js +180 -3
  494. data/vendor/v8/test/mjsunit/harmony/module-parsing.js +31 -0
  495. data/vendor/v8/test/mjsunit/harmony/module-recompile.js +87 -0
  496. data/vendor/v8/test/mjsunit/harmony/module-resolution.js +15 -2
  497. data/vendor/v8/test/mjsunit/harmony/object-observe.js +1056 -0
  498. data/vendor/v8/test/mjsunit/harmony/proxies-json.js +178 -0
  499. data/vendor/v8/test/mjsunit/harmony/proxies.js +25 -10
  500. data/vendor/v8/test/mjsunit/json-parser-recursive.js +33 -0
  501. data/vendor/v8/test/mjsunit/json-stringify-recursive.js +52 -0
  502. data/vendor/v8/test/mjsunit/json.js +38 -2
  503. data/vendor/v8/test/mjsunit/json2.js +153 -0
  504. data/vendor/v8/test/mjsunit/limit-locals.js +5 -4
  505. data/vendor/v8/test/mjsunit/manual-parallel-recompile.js +79 -0
  506. data/vendor/v8/test/mjsunit/math-exp-precision.js +64 -0
  507. data/vendor/v8/test/mjsunit/math-floor-negative.js +59 -0
  508. data/vendor/v8/test/mjsunit/math-floor-of-div-minus-zero.js +41 -0
  509. data/vendor/v8/test/mjsunit/math-floor-of-div-nosudiv.js +288 -0
  510. data/vendor/v8/test/mjsunit/math-floor-of-div.js +81 -9
  511. data/vendor/v8/test/mjsunit/{math-floor.js → math-floor-part1.js} +1 -72
  512. data/vendor/v8/test/mjsunit/math-floor-part2.js +76 -0
  513. data/vendor/v8/test/mjsunit/math-floor-part3.js +78 -0
  514. data/vendor/v8/test/mjsunit/math-floor-part4.js +76 -0
  515. data/vendor/v8/test/mjsunit/mirror-object.js +43 -9
  516. data/vendor/v8/test/mjsunit/mjsunit.js +1 -1
  517. data/vendor/v8/test/mjsunit/mjsunit.status +52 -27
  518. data/vendor/v8/test/mjsunit/mul-exhaustive-part1.js +491 -0
  519. data/vendor/v8/test/mjsunit/mul-exhaustive-part10.js +470 -0
  520. data/vendor/v8/test/mjsunit/mul-exhaustive-part2.js +525 -0
  521. data/vendor/v8/test/mjsunit/mul-exhaustive-part3.js +532 -0
  522. data/vendor/v8/test/mjsunit/mul-exhaustive-part4.js +509 -0
  523. data/vendor/v8/test/mjsunit/mul-exhaustive-part5.js +505 -0
  524. data/vendor/v8/test/mjsunit/mul-exhaustive-part6.js +554 -0
  525. data/vendor/v8/test/mjsunit/mul-exhaustive-part7.js +497 -0
  526. data/vendor/v8/test/mjsunit/mul-exhaustive-part8.js +526 -0
  527. data/vendor/v8/test/mjsunit/mul-exhaustive-part9.js +533 -0
  528. data/vendor/v8/test/mjsunit/new-function.js +34 -0
  529. data/vendor/v8/test/mjsunit/numops-fuzz-part1.js +1172 -0
  530. data/vendor/v8/test/mjsunit/numops-fuzz-part2.js +1178 -0
  531. data/vendor/v8/test/mjsunit/numops-fuzz-part3.js +1178 -0
  532. data/vendor/v8/test/mjsunit/numops-fuzz-part4.js +1177 -0
  533. data/vendor/v8/test/mjsunit/object-define-property.js +107 -2
  534. data/vendor/v8/test/mjsunit/override-read-only-property.js +6 -4
  535. data/vendor/v8/test/mjsunit/packed-elements.js +2 -2
  536. data/vendor/v8/test/mjsunit/parse-int-float.js +4 -4
  537. data/vendor/v8/test/mjsunit/pixel-array-rounding.js +1 -1
  538. data/vendor/v8/test/mjsunit/readonly.js +228 -0
  539. data/vendor/v8/test/mjsunit/regexp-capture-3.js +16 -18
  540. data/vendor/v8/test/mjsunit/regexp-capture.js +2 -0
  541. data/vendor/v8/test/mjsunit/regexp-global.js +122 -0
  542. data/vendor/v8/test/mjsunit/regexp-results-cache.js +78 -0
  543. data/vendor/v8/test/mjsunit/regress/regress-1117.js +12 -3
  544. data/vendor/v8/test/mjsunit/regress/regress-1118.js +1 -1
  545. data/vendor/v8/test/mjsunit/regress/regress-115100.js +36 -0
  546. data/vendor/v8/test/mjsunit/regress/regress-1199637.js +1 -3
  547. data/vendor/v8/test/mjsunit/regress/regress-121407.js +1 -1
  548. data/vendor/v8/test/mjsunit/regress/regress-131923.js +30 -0
  549. data/vendor/v8/test/mjsunit/regress/regress-131994.js +70 -0
  550. data/vendor/v8/test/mjsunit/regress/regress-133211.js +35 -0
  551. data/vendor/v8/test/mjsunit/regress/regress-133211b.js +39 -0
  552. data/vendor/v8/test/mjsunit/regress/regress-136048.js +34 -0
  553. data/vendor/v8/test/mjsunit/regress/regress-137768.js +73 -0
  554. data/vendor/v8/test/mjsunit/regress/regress-143967.js +34 -0
  555. data/vendor/v8/test/mjsunit/regress/regress-145201.js +107 -0
  556. data/vendor/v8/test/mjsunit/regress/regress-147497.js +45 -0
  557. data/vendor/v8/test/mjsunit/regress/regress-148378.js +38 -0
  558. data/vendor/v8/test/mjsunit/regress/regress-1563.js +1 -1
  559. data/vendor/v8/test/mjsunit/regress/regress-1591.js +48 -0
  560. data/vendor/v8/test/mjsunit/regress/regress-164442.js +45 -0
  561. data/vendor/v8/test/mjsunit/regress/regress-165637.js +61 -0
  562. data/vendor/v8/test/mjsunit/regress/regress-166379.js +39 -0
  563. data/vendor/v8/test/mjsunit/regress/regress-166553.js +33 -0
  564. data/vendor/v8/test/mjsunit/regress/regress-1692.js +1 -1
  565. data/vendor/v8/test/mjsunit/regress/regress-171641.js +40 -0
  566. data/vendor/v8/test/mjsunit/regress/regress-1980.js +1 -1
  567. data/vendor/v8/test/mjsunit/regress/regress-2073.js +99 -0
  568. data/vendor/v8/test/mjsunit/regress/regress-2119.js +36 -0
  569. data/vendor/v8/test/mjsunit/regress/regress-2156.js +39 -0
  570. data/vendor/v8/test/mjsunit/regress/regress-2163.js +70 -0
  571. data/vendor/v8/test/mjsunit/regress/regress-2170.js +58 -0
  572. data/vendor/v8/test/mjsunit/regress/regress-2172.js +35 -0
  573. data/vendor/v8/test/mjsunit/regress/regress-2185-2.js +145 -0
  574. data/vendor/v8/test/mjsunit/regress/regress-2185.js +38 -0
  575. data/vendor/v8/test/mjsunit/regress/regress-2186.js +49 -0
  576. data/vendor/v8/test/mjsunit/regress/regress-2193.js +58 -0
  577. data/vendor/v8/test/mjsunit/regress/regress-2219.js +32 -0
  578. data/vendor/v8/test/mjsunit/regress/regress-2225.js +65 -0
  579. data/vendor/v8/test/mjsunit/regress/regress-2226.js +36 -0
  580. data/vendor/v8/test/mjsunit/regress/regress-2234.js +41 -0
  581. data/vendor/v8/test/mjsunit/regress/regress-2243.js +31 -0
  582. data/vendor/v8/test/mjsunit/regress/regress-2249.js +33 -0
  583. data/vendor/v8/test/mjsunit/regress/regress-2250.js +68 -0
  584. data/vendor/v8/test/mjsunit/regress/regress-2261.js +113 -0
  585. data/vendor/v8/test/mjsunit/regress/regress-2263.js +30 -0
  586. data/vendor/v8/test/mjsunit/regress/regress-2284.js +32 -0
  587. data/vendor/v8/test/mjsunit/regress/regress-2285.js +32 -0
  588. data/vendor/v8/test/mjsunit/regress/regress-2286.js +32 -0
  589. data/vendor/v8/test/mjsunit/regress/regress-2289.js +34 -0
  590. data/vendor/v8/test/mjsunit/regress/regress-2291.js +36 -0
  591. data/vendor/v8/test/mjsunit/regress/regress-2294.js +70 -0
  592. data/vendor/v8/test/mjsunit/regress/regress-2296.js +40 -0
  593. data/vendor/v8/test/mjsunit/regress/regress-2315.js +40 -0
  594. data/vendor/v8/test/mjsunit/regress/regress-2318.js +66 -0
  595. data/vendor/v8/test/mjsunit/regress/regress-2322.js +36 -0
  596. data/vendor/v8/test/mjsunit/regress/regress-2326.js +54 -0
  597. data/vendor/v8/test/mjsunit/regress/regress-2336.js +53 -0
  598. data/vendor/v8/test/mjsunit/regress/regress-2339.js +59 -0
  599. data/vendor/v8/test/mjsunit/regress/regress-2346.js +123 -0
  600. data/vendor/v8/test/mjsunit/regress/regress-2373.js +29 -0
  601. data/vendor/v8/test/mjsunit/regress/regress-2374.js +33 -0
  602. data/vendor/v8/test/mjsunit/regress/regress-2398.js +41 -0
  603. data/vendor/v8/test/mjsunit/regress/regress-2410.js +36 -0
  604. data/vendor/v8/test/mjsunit/regress/regress-2416.js +75 -0
  605. data/vendor/v8/test/mjsunit/regress/regress-2419.js +37 -0
  606. data/vendor/v8/test/mjsunit/regress/regress-2433.js +36 -0
  607. data/vendor/v8/test/mjsunit/regress/regress-2437.js +156 -0
  608. data/vendor/v8/test/mjsunit/regress/regress-2438.js +52 -0
  609. data/vendor/v8/test/mjsunit/regress/regress-2443.js +129 -0
  610. data/vendor/v8/test/mjsunit/regress/regress-2444.js +120 -0
  611. data/vendor/v8/test/mjsunit/regress/regress-2489.js +50 -0
  612. data/vendor/v8/test/mjsunit/regress/regress-2499.js +40 -0
  613. data/vendor/v8/test/mjsunit/regress/regress-334.js +1 -1
  614. data/vendor/v8/test/mjsunit/regress/regress-492.js +39 -1
  615. data/vendor/v8/test/mjsunit/regress/regress-builtin-array-op.js +38 -0
  616. data/vendor/v8/test/mjsunit/regress/regress-cnlt-elements.js +43 -0
  617. data/vendor/v8/test/mjsunit/regress/regress-cnlt-enum-indices.js +45 -0
  618. data/vendor/v8/test/mjsunit/regress/regress-cntl-descriptors-enum.js +46 -0
  619. data/vendor/v8/test/mjsunit/regress/regress-convert-enum.js +60 -0
  620. data/vendor/v8/test/mjsunit/regress/regress-convert-enum2.js +46 -0
  621. data/vendor/v8/test/mjsunit/regress/regress-convert-transition.js +40 -0
  622. data/vendor/v8/test/mjsunit/regress/regress-crbug-119926.js +3 -1
  623. data/vendor/v8/test/mjsunit/regress/regress-crbug-125148.js +90 -0
  624. data/vendor/v8/test/mjsunit/regress/regress-crbug-134055.js +63 -0
  625. data/vendor/v8/test/mjsunit/regress/regress-crbug-134609.js +59 -0
  626. data/vendor/v8/test/mjsunit/regress/regress-crbug-135008.js +45 -0
  627. data/vendor/v8/test/mjsunit/regress/regress-crbug-135066.js +55 -0
  628. data/vendor/v8/test/mjsunit/regress/regress-crbug-137689.js +47 -0
  629. data/vendor/v8/test/mjsunit/regress/regress-crbug-138887.js +48 -0
  630. data/vendor/v8/test/mjsunit/regress/regress-crbug-140083.js +44 -0
  631. data/vendor/v8/test/mjsunit/regress/regress-crbug-142087.js +38 -0
  632. data/vendor/v8/test/mjsunit/regress/regress-crbug-142218.js +44 -0
  633. data/vendor/v8/test/mjsunit/regress/regress-crbug-145961.js +39 -0
  634. data/vendor/v8/test/mjsunit/regress/regress-crbug-146910.js +33 -0
  635. data/vendor/v8/test/mjsunit/regress/regress-crbug-147475.js +48 -0
  636. data/vendor/v8/test/mjsunit/regress/regress-crbug-148376.js +35 -0
  637. data/vendor/v8/test/mjsunit/regress/regress-crbug-150545.js +53 -0
  638. data/vendor/v8/test/mjsunit/regress/regress-crbug-150729.js +39 -0
  639. data/vendor/v8/test/mjsunit/regress/regress-crbug-157019.js +54 -0
  640. data/vendor/v8/test/mjsunit/regress/regress-crbug-157520.js +38 -0
  641. data/vendor/v8/test/mjsunit/regress/regress-crbug-158185.js +39 -0
  642. data/vendor/v8/test/mjsunit/regress/regress-crbug-160010.js +35 -0
  643. data/vendor/v8/test/mjsunit/regress/regress-crbug-162085.js +71 -0
  644. data/vendor/v8/test/mjsunit/regress/regress-crbug-168545.js +34 -0
  645. data/vendor/v8/test/mjsunit/regress/regress-crbug-170856.js +33 -0
  646. data/vendor/v8/test/mjsunit/regress/regress-crbug-172345.js +34 -0
  647. data/vendor/v8/test/mjsunit/regress/regress-crbug-173974.js +36 -0
  648. data/vendor/v8/test/mjsunit/regress/regress-crbug-18639.js +9 -5
  649. data/vendor/v8/test/mjsunit/regress/regress-debug-code-recompilation.js +2 -1
  650. data/vendor/v8/test/mjsunit/regress/regress-deep-proto.js +45 -0
  651. data/vendor/v8/test/mjsunit/regress/regress-delete-empty-double.js +40 -0
  652. data/vendor/v8/test/mjsunit/regress/regress-iteration-order.js +42 -0
  653. data/vendor/v8/test/mjsunit/regress/regress-json-stringify-gc.js +41 -0
  654. data/vendor/v8/test/mjsunit/regress/regress-latin-1.js +78 -0
  655. data/vendor/v8/test/mjsunit/regress/regress-load-elements.js +49 -0
  656. data/vendor/v8/test/mjsunit/regress/regress-observe-empty-double-array.js +38 -0
  657. data/vendor/v8/test/mjsunit/regress/regress-undefined-store-keyed-fast-element.js +37 -0
  658. data/vendor/v8/test/mjsunit/shift-for-integer-div.js +59 -0
  659. data/vendor/v8/test/mjsunit/stack-traces-gc.js +119 -0
  660. data/vendor/v8/test/mjsunit/stack-traces-overflow.js +122 -0
  661. data/vendor/v8/test/mjsunit/stack-traces.js +39 -1
  662. data/vendor/v8/test/mjsunit/str-to-num.js +7 -2
  663. data/vendor/v8/test/mjsunit/strict-mode.js +36 -11
  664. data/vendor/v8/test/mjsunit/string-charcodeat.js +3 -0
  665. data/vendor/v8/test/mjsunit/string-natives.js +72 -0
  666. data/vendor/v8/test/mjsunit/string-split.js +17 -0
  667. data/vendor/v8/test/mjsunit/testcfg.py +76 -6
  668. data/vendor/v8/test/mjsunit/tools/tickprocessor.js +4 -1
  669. data/vendor/v8/test/mjsunit/try-finally-continue.js +72 -0
  670. data/vendor/v8/test/mjsunit/typed-array-slice.js +61 -0
  671. data/vendor/v8/test/mjsunit/unbox-double-arrays.js +2 -0
  672. data/vendor/v8/test/mjsunit/uri.js +12 -0
  673. data/vendor/v8/test/mjsunit/with-readonly.js +4 -2
  674. data/vendor/v8/test/mozilla/mozilla.status +19 -113
  675. data/vendor/v8/test/mozilla/testcfg.py +122 -3
  676. data/vendor/v8/test/preparser/preparser.status +5 -0
  677. data/vendor/v8/test/preparser/strict-identifiers.pyt +1 -1
  678. data/vendor/v8/test/preparser/testcfg.py +101 -5
  679. data/vendor/v8/test/sputnik/sputnik.status +1 -1
  680. data/vendor/v8/test/sputnik/testcfg.py +5 -0
  681. data/vendor/v8/test/test262/README +2 -2
  682. data/vendor/v8/test/test262/test262.status +13 -36
  683. data/vendor/v8/test/test262/testcfg.py +102 -8
  684. data/vendor/v8/tools/android-build.sh +0 -0
  685. data/vendor/v8/tools/android-ll-prof.sh +69 -0
  686. data/vendor/v8/tools/android-run.py +109 -0
  687. data/vendor/v8/tools/android-sync.sh +105 -0
  688. data/vendor/v8/tools/bash-completion.sh +0 -0
  689. data/vendor/v8/tools/check-static-initializers.sh +0 -0
  690. data/vendor/v8/tools/common-includes.sh +15 -22
  691. data/vendor/v8/tools/disasm.py +4 -4
  692. data/vendor/v8/tools/fuzz-harness.sh +0 -0
  693. data/vendor/v8/tools/gen-postmortem-metadata.py +6 -8
  694. data/vendor/v8/tools/grokdump.py +404 -129
  695. data/vendor/v8/tools/gyp/v8.gyp +105 -43
  696. data/vendor/v8/tools/linux-tick-processor +5 -5
  697. data/vendor/v8/tools/ll_prof.py +75 -15
  698. data/vendor/v8/tools/merge-to-branch.sh +2 -2
  699. data/vendor/v8/tools/plot-timer-events +70 -0
  700. data/vendor/v8/tools/plot-timer-events.js +510 -0
  701. data/vendor/v8/tools/presubmit.py +1 -0
  702. data/vendor/v8/tools/push-to-trunk.sh +14 -4
  703. data/vendor/v8/tools/run-llprof.sh +69 -0
  704. data/vendor/v8/tools/run-tests.py +372 -0
  705. data/vendor/v8/tools/run-valgrind.py +1 -1
  706. data/vendor/v8/tools/status-file-converter.py +39 -0
  707. data/vendor/v8/tools/test-server.py +224 -0
  708. data/vendor/v8/tools/test-wrapper-gypbuild.py +13 -16
  709. data/vendor/v8/tools/test.py +10 -19
  710. data/vendor/v8/tools/testrunner/README +174 -0
  711. data/vendor/v8/tools/testrunner/__init__.py +26 -0
  712. data/vendor/v8/tools/testrunner/local/__init__.py +26 -0
  713. data/vendor/v8/tools/testrunner/local/commands.py +153 -0
  714. data/vendor/v8/tools/testrunner/local/execution.py +182 -0
  715. data/vendor/v8/tools/testrunner/local/old_statusfile.py +460 -0
  716. data/vendor/v8/tools/testrunner/local/progress.py +238 -0
  717. data/vendor/v8/tools/testrunner/local/statusfile.py +145 -0
  718. data/vendor/v8/tools/testrunner/local/testsuite.py +187 -0
  719. data/vendor/v8/tools/testrunner/local/utils.py +108 -0
  720. data/vendor/v8/tools/testrunner/local/verbose.py +99 -0
  721. data/vendor/v8/tools/testrunner/network/__init__.py +26 -0
  722. data/vendor/v8/tools/testrunner/network/distro.py +90 -0
  723. data/vendor/v8/tools/testrunner/network/endpoint.py +124 -0
  724. data/vendor/v8/tools/testrunner/network/network_execution.py +253 -0
  725. data/vendor/v8/tools/testrunner/network/perfdata.py +120 -0
  726. data/vendor/v8/tools/testrunner/objects/__init__.py +26 -0
  727. data/vendor/v8/tools/testrunner/objects/context.py +50 -0
  728. data/vendor/v8/tools/testrunner/objects/output.py +60 -0
  729. data/vendor/v8/tools/testrunner/objects/peer.py +80 -0
  730. data/vendor/v8/tools/testrunner/objects/testcase.py +83 -0
  731. data/vendor/v8/tools/testrunner/objects/workpacket.py +90 -0
  732. data/vendor/v8/tools/testrunner/server/__init__.py +26 -0
  733. data/vendor/v8/tools/testrunner/server/compression.py +111 -0
  734. data/vendor/v8/tools/testrunner/server/constants.py +51 -0
  735. data/vendor/v8/tools/testrunner/server/daemon.py +147 -0
  736. data/vendor/v8/tools/testrunner/server/local_handler.py +119 -0
  737. data/vendor/v8/tools/testrunner/server/main.py +245 -0
  738. data/vendor/v8/tools/testrunner/server/presence_handler.py +120 -0
  739. data/vendor/v8/tools/testrunner/server/signatures.py +63 -0
  740. data/vendor/v8/tools/testrunner/server/status_handler.py +112 -0
  741. data/vendor/v8/tools/testrunner/server/work_handler.py +150 -0
  742. data/vendor/v8/tools/tick-processor.html +168 -0
  743. data/vendor/v8/tools/tickprocessor-driver.js +5 -3
  744. data/vendor/v8/tools/tickprocessor.js +58 -15
  745. metadata +534 -30
  746. data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +0 -11
  747. data/patches/do-not-imply-vfp3-and-armv7.patch +0 -44
  748. data/patches/fPIC-on-x64.patch +0 -14
  749. data/vendor/v8/src/liveobjectlist-inl.h +0 -126
  750. data/vendor/v8/src/liveobjectlist.cc +0 -2631
  751. data/vendor/v8/src/liveobjectlist.h +0 -319
  752. data/vendor/v8/test/mjsunit/mul-exhaustive.js +0 -4629
  753. data/vendor/v8/test/mjsunit/numops-fuzz.js +0 -4609
  754. data/vendor/v8/test/mjsunit/regress/regress-1969.js +0 -5045
@@ -50,11 +50,12 @@
50
50
 
51
51
  // Setup for Linux shared library export. See v8.h in this directory for
52
52
  // information on how to build/use V8 as shared library.
53
- #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
53
+ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \
54
+ (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
54
55
  #define V8EXPORT __attribute__ ((visibility("default")))
55
- #else // defined(__GNUC__) && (__GNUC__ >= 4)
56
+ #else
56
57
  #define V8EXPORT
57
- #endif // defined(__GNUC__) && (__GNUC__ >= 4)
58
+ #endif
58
59
 
59
60
  #endif // _WIN32
60
61
 
@@ -38,6 +38,9 @@
38
38
  #ifndef V8_H_
39
39
  #define V8_H_
40
40
 
41
+ // TODO(svenpanne) Remove me when the Chrome bindings are adapted.
42
+ #define V8_DISABLE_DEPRECATIONS 1
43
+
41
44
  #include "v8stdint.h"
42
45
 
43
46
  #ifdef _WIN32
@@ -63,18 +66,35 @@
63
66
  #else // _WIN32
64
67
 
65
68
  // Setup for Linux shared library export.
66
- #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
69
+ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \
70
+ (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
67
71
  #ifdef BUILDING_V8_SHARED
68
72
  #define V8EXPORT __attribute__ ((visibility("default")))
69
73
  #else
70
74
  #define V8EXPORT
71
75
  #endif
72
- #else // defined(__GNUC__) && (__GNUC__ >= 4)
76
+ #else
73
77
  #define V8EXPORT
74
- #endif // defined(__GNUC__) && (__GNUC__ >= 4)
78
+ #endif
75
79
 
76
80
  #endif // _WIN32
77
81
 
82
+ #if defined(__GNUC__) && !defined(DEBUG)
83
+ #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator
84
+ #elif defined(_MSC_VER) && !defined(DEBUG)
85
+ #define V8_INLINE(declarator) __forceinline declarator
86
+ #else
87
+ #define V8_INLINE(declarator) inline declarator
88
+ #endif
89
+
90
+ #if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS
91
+ #define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated))
92
+ #elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS
93
+ #define V8_DEPRECATED(declarator) __declspec(deprecated) declarator
94
+ #else
95
+ #define V8_DEPRECATED(declarator) declarator
96
+ #endif
97
+
78
98
  /**
79
99
  * The v8 JavaScript engine.
80
100
  */
@@ -100,6 +120,7 @@ class Function;
100
120
  class Date;
101
121
  class ImplementationUtilities;
102
122
  class Signature;
123
+ class AccessorSignature;
103
124
  template <class T> class Handle;
104
125
  template <class T> class Local;
105
126
  template <class T> class Persistent;
@@ -136,6 +157,10 @@ class Isolate;
136
157
  typedef void (*WeakReferenceCallback)(Persistent<Value> object,
137
158
  void* parameter);
138
159
 
160
+ // TODO(svenpanne) Temporary definition until Chrome is in sync.
161
+ typedef void (*NearDeathCallback)(Isolate* isolate,
162
+ Persistent<Value> object,
163
+ void* parameter);
139
164
 
140
165
  // --- Handles ---
141
166
 
@@ -174,12 +199,12 @@ template <class T> class Handle {
174
199
  /**
175
200
  * Creates an empty handle.
176
201
  */
177
- inline Handle() : val_(0) {}
202
+ V8_INLINE(Handle()) : val_(0) {}
178
203
 
179
204
  /**
180
205
  * Creates a new handle for the specified value.
181
206
  */
182
- inline explicit Handle(T* val) : val_(val) {}
207
+ V8_INLINE(explicit Handle(T* val)) : val_(val) {}
183
208
 
184
209
  /**
185
210
  * Creates a handle for the contents of the specified handle. This
@@ -191,7 +216,7 @@ template <class T> class Handle {
191
216
  * Handle<String> to a variable declared as Handle<Value>, is legal
192
217
  * because String is a subclass of Value.
193
218
  */
194
- template <class S> inline Handle(Handle<S> that)
219
+ template <class S> V8_INLINE(Handle(Handle<S> that))
195
220
  : val_(reinterpret_cast<T*>(*that)) {
196
221
  /**
197
222
  * This check fails when trying to convert between incompatible
@@ -204,16 +229,16 @@ template <class T> class Handle {
204
229
  /**
205
230
  * Returns true if the handle is empty.
206
231
  */
207
- inline bool IsEmpty() const { return val_ == 0; }
232
+ V8_INLINE(bool IsEmpty() const) { return val_ == 0; }
208
233
 
209
234
  /**
210
235
  * Sets the handle to be empty. IsEmpty() will then return true.
211
236
  */
212
- inline void Clear() { val_ = 0; }
237
+ V8_INLINE(void Clear()) { val_ = 0; }
213
238
 
214
- inline T* operator->() const { return val_; }
239
+ V8_INLINE(T* operator->() const) { return val_; }
215
240
 
216
- inline T* operator*() const { return val_; }
241
+ V8_INLINE(T* operator*() const) { return val_; }
217
242
 
218
243
  /**
219
244
  * Checks whether two handles are the same.
@@ -221,7 +246,7 @@ template <class T> class Handle {
221
246
  * to which they refer are identical.
222
247
  * The handles' references are not checked.
223
248
  */
224
- template <class S> inline bool operator==(Handle<S> that) const {
249
+ template <class S> V8_INLINE(bool operator==(Handle<S> that) const) {
225
250
  internal::Object** a = reinterpret_cast<internal::Object**>(**this);
226
251
  internal::Object** b = reinterpret_cast<internal::Object**>(*that);
227
252
  if (a == 0) return b == 0;
@@ -235,11 +260,11 @@ template <class T> class Handle {
235
260
  * the objects to which they refer are different.
236
261
  * The handles' references are not checked.
237
262
  */
238
- template <class S> inline bool operator!=(Handle<S> that) const {
263
+ template <class S> V8_INLINE(bool operator!=(Handle<S> that) const) {
239
264
  return !operator==(that);
240
265
  }
241
266
 
242
- template <class S> static inline Handle<T> Cast(Handle<S> that) {
267
+ template <class S> V8_INLINE(static Handle<T> Cast(Handle<S> that)) {
243
268
  #ifdef V8_ENABLE_CHECKS
244
269
  // If we're going to perform the type check then we have to check
245
270
  // that the handle isn't empty before doing the checked cast.
@@ -248,7 +273,7 @@ template <class T> class Handle {
248
273
  return Handle<T>(T::Cast(*that));
249
274
  }
250
275
 
251
- template <class S> inline Handle<S> As() {
276
+ template <class S> V8_INLINE(Handle<S> As()) {
252
277
  return Handle<S>::Cast(*this);
253
278
  }
254
279
 
@@ -266,8 +291,8 @@ template <class T> class Handle {
266
291
  */
267
292
  template <class T> class Local : public Handle<T> {
268
293
  public:
269
- inline Local();
270
- template <class S> inline Local(Local<S> that)
294
+ V8_INLINE(Local());
295
+ template <class S> V8_INLINE(Local(Local<S> that))
271
296
  : Handle<T>(reinterpret_cast<T*>(*that)) {
272
297
  /**
273
298
  * This check fails when trying to convert between incompatible
@@ -276,8 +301,8 @@ template <class T> class Local : public Handle<T> {
276
301
  */
277
302
  TYPE_CHECK(T, S);
278
303
  }
279
- template <class S> inline Local(S* that) : Handle<T>(that) { }
280
- template <class S> static inline Local<T> Cast(Local<S> that) {
304
+ template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { }
305
+ template <class S> V8_INLINE(static Local<T> Cast(Local<S> that)) {
281
306
  #ifdef V8_ENABLE_CHECKS
282
307
  // If we're going to perform the type check then we have to check
283
308
  // that the handle isn't empty before doing the checked cast.
@@ -286,15 +311,17 @@ template <class T> class Local : public Handle<T> {
286
311
  return Local<T>(T::Cast(*that));
287
312
  }
288
313
 
289
- template <class S> inline Local<S> As() {
314
+ template <class S> V8_INLINE(Local<S> As()) {
290
315
  return Local<S>::Cast(*this);
291
316
  }
292
317
 
293
- /** Create a local handle for the content of another handle.
294
- * The referee is kept alive by the local handle even when
295
- * the original handle is destroyed/disposed.
318
+ /**
319
+ * Create a local handle for the content of another handle.
320
+ * The referee is kept alive by the local handle even when
321
+ * the original handle is destroyed/disposed.
296
322
  */
297
- inline static Local<T> New(Handle<T> that);
323
+ V8_INLINE(static Local<T> New(Handle<T> that));
324
+ V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that));
298
325
  };
299
326
 
300
327
 
@@ -321,7 +348,7 @@ template <class T> class Persistent : public Handle<T> {
321
348
  * Creates an empty persistent handle that doesn't point to any
322
349
  * storage cell.
323
350
  */
324
- inline Persistent();
351
+ V8_INLINE(Persistent());
325
352
 
326
353
  /**
327
354
  * Creates a persistent handle for the same storage cell as the
@@ -334,7 +361,7 @@ template <class T> class Persistent : public Handle<T> {
334
361
  * Persistent<String> to a variable declared as Persistent<Value>,
335
362
  * is allowed as String is a subclass of Value.
336
363
  */
337
- template <class S> inline Persistent(Persistent<S> that)
364
+ template <class S> V8_INLINE(Persistent(Persistent<S> that))
338
365
  : Handle<T>(reinterpret_cast<T*>(*that)) {
339
366
  /**
340
367
  * This check fails when trying to convert between incompatible
@@ -344,16 +371,16 @@ template <class T> class Persistent : public Handle<T> {
344
371
  TYPE_CHECK(T, S);
345
372
  }
346
373
 
347
- template <class S> inline Persistent(S* that) : Handle<T>(that) { }
374
+ template <class S> V8_INLINE(Persistent(S* that)) : Handle<T>(that) { }
348
375
 
349
376
  /**
350
377
  * "Casts" a plain handle which is known to be a persistent handle
351
378
  * to a persistent handle.
352
379
  */
353
- template <class S> explicit inline Persistent(Handle<S> that)
380
+ template <class S> explicit V8_INLINE(Persistent(Handle<S> that))
354
381
  : Handle<T>(*that) { }
355
382
 
356
- template <class S> static inline Persistent<T> Cast(Persistent<S> that) {
383
+ template <class S> V8_INLINE(static Persistent<T> Cast(Persistent<S> that)) {
357
384
  #ifdef V8_ENABLE_CHECKS
358
385
  // If we're going to perform the type check then we have to check
359
386
  // that the handle isn't empty before doing the checked cast.
@@ -362,15 +389,20 @@ template <class T> class Persistent : public Handle<T> {
362
389
  return Persistent<T>(T::Cast(*that));
363
390
  }
364
391
 
365
- template <class S> inline Persistent<S> As() {
392
+ template <class S> V8_INLINE(Persistent<S> As()) {
366
393
  return Persistent<S>::Cast(*this);
367
394
  }
368
395
 
396
+ /** Deprecated. Use Isolate version instead. */
397
+ V8_DEPRECATED(static Persistent<T> New(Handle<T> that));
398
+
369
399
  /**
370
- * Creates a new persistent handle for an existing local or
371
- * persistent handle.
400
+ * Creates a new persistent handle for an existing local or persistent handle.
372
401
  */
373
- inline static Persistent<T> New(Handle<T> that);
402
+ V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that));
403
+
404
+ /** Deprecated. Use Isolate version instead. */
405
+ V8_DEPRECATED(void Dispose());
374
406
 
375
407
  /**
376
408
  * Releases the storage cell referenced by this persistent handle.
@@ -378,43 +410,87 @@ template <class T> class Persistent : public Handle<T> {
378
410
  * This handle's reference, and any other references to the storage
379
411
  * cell remain and IsEmpty will still return false.
380
412
  */
381
- inline void Dispose();
413
+ V8_INLINE(void Dispose(Isolate* isolate));
414
+
415
+ /** Deprecated. Use Isolate version instead. */
416
+ V8_DEPRECATED(void MakeWeak(void* parameters,
417
+ WeakReferenceCallback callback));
382
418
 
383
419
  /**
384
420
  * Make the reference to this object weak. When only weak handles
385
421
  * refer to the object, the garbage collector will perform a
386
- * callback to the given V8::WeakReferenceCallback function, passing
422
+ * callback to the given V8::NearDeathCallback function, passing
387
423
  * it the object reference and the given parameters.
388
424
  */
389
- inline void MakeWeak(void* parameters, WeakReferenceCallback callback);
425
+ V8_INLINE(void MakeWeak(Isolate* isolate,
426
+ void* parameters,
427
+ NearDeathCallback callback));
428
+
429
+ /** Deprecated. Use Isolate version instead. */
430
+ V8_DEPRECATED(void ClearWeak());
390
431
 
391
- /** Clears the weak reference to this object.*/
392
- inline void ClearWeak();
432
+ /** Clears the weak reference to this object. */
433
+ V8_INLINE(void ClearWeak(Isolate* isolate));
434
+
435
+ /** Deprecated. Use Isolate version instead. */
436
+ V8_DEPRECATED(void MarkIndependent());
393
437
 
394
438
  /**
395
- * Marks the reference to this object independent. Garbage collector
396
- * is free to ignore any object groups containing this object.
397
- * Weak callback for an independent handle should not
398
- * assume that it will be preceded by a global GC prologue callback
399
- * or followed by a global GC epilogue callback.
439
+ * Marks the reference to this object independent. Garbage collector is free
440
+ * to ignore any object groups containing this object. Weak callback for an
441
+ * independent handle should not assume that it will be preceded by a global
442
+ * GC prologue callback or followed by a global GC epilogue callback.
400
443
  */
401
- inline void MarkIndependent();
444
+ V8_INLINE(void MarkIndependent(Isolate* isolate));
445
+
446
+ /** Deprecated. Use Isolate version instead. */
447
+ V8_DEPRECATED(void MarkPartiallyDependent());
402
448
 
403
449
  /**
404
- *Checks if the handle holds the only reference to an object.
450
+ * Marks the reference to this object partially dependent. Partially dependent
451
+ * handles only depend on other partially dependent handles and these
452
+ * dependencies are provided through object groups. It provides a way to build
453
+ * smaller object groups for young objects that represent only a subset of all
454
+ * external dependencies. This mark is automatically cleared after each
455
+ * garbage collection.
405
456
  */
406
- inline bool IsNearDeath() const;
457
+ V8_INLINE(void MarkPartiallyDependent(Isolate* isolate));
458
+
459
+ /** Deprecated. Use Isolate version instead. */
460
+ V8_DEPRECATED(bool IsIndependent() const);
461
+
462
+ /** Returns true if this handle was previously marked as independent. */
463
+ V8_INLINE(bool IsIndependent(Isolate* isolate) const);
464
+
465
+ /** Deprecated. Use Isolate version instead. */
466
+ V8_DEPRECATED(bool IsNearDeath() const);
467
+
468
+ /** Checks if the handle holds the only reference to an object. */
469
+ V8_INLINE(bool IsNearDeath(Isolate* isolate) const);
470
+
471
+ /** Deprecated. Use Isolate version instead. */
472
+ V8_DEPRECATED(bool IsWeak() const);
473
+
474
+ /** Returns true if the handle's reference is weak. */
475
+ V8_INLINE(bool IsWeak(Isolate* isolate) const);
476
+
477
+ /** Deprecated. Use Isolate version instead. */
478
+ V8_DEPRECATED(void SetWrapperClassId(uint16_t class_id));
407
479
 
408
480
  /**
409
- * Returns true if the handle's reference is weak.
481
+ * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
482
+ * description in v8-profiler.h for details.
410
483
  */
411
- inline bool IsWeak() const;
484
+ V8_INLINE(void SetWrapperClassId(Isolate* isolate, uint16_t class_id));
485
+
486
+ /** Deprecated. Use Isolate version instead. */
487
+ V8_DEPRECATED(uint16_t WrapperClassId() const);
412
488
 
413
489
  /**
414
- * Assigns a wrapper class ID to the handle. See RetainedObjectInfo
415
- * interface description in v8-profiler.h for details.
490
+ * Returns the class ID previously assigned to this handle or 0 if no class ID
491
+ * was previously assigned.
416
492
  */
417
- inline void SetWrapperClassId(uint16_t class_id);
493
+ V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const);
418
494
 
419
495
  private:
420
496
  friend class ImplementationUtilities;
@@ -457,12 +533,14 @@ class V8EXPORT HandleScope {
457
533
  * Creates a new handle with the given value.
458
534
  */
459
535
  static internal::Object** CreateHandle(internal::Object* value);
536
+ static internal::Object** CreateHandle(internal::Isolate* isolate,
537
+ internal::Object* value);
460
538
  // Faster version, uses HeapObject to obtain the current Isolate.
461
539
  static internal::Object** CreateHandle(internal::HeapObject* value);
462
540
 
463
541
  private:
464
- // Make it impossible to create heap-allocated or illegal handle
465
- // scopes by disallowing certain operations.
542
+ // Make it hard to create heap-allocated or illegal handle scopes by
543
+ // disallowing certain operations.
466
544
  HandleScope(const HandleScope&);
467
545
  void operator=(const HandleScope&);
468
546
  void* operator new(size_t size);
@@ -475,7 +553,7 @@ class V8EXPORT HandleScope {
475
553
  internal::Object** next;
476
554
  internal::Object** limit;
477
555
  int level;
478
- inline void Initialize() {
556
+ V8_INLINE(void Initialize()) {
479
557
  next = limit = NULL;
480
558
  level = 0;
481
559
  }
@@ -568,16 +646,16 @@ class V8EXPORT ScriptData { // NOLINT
568
646
  */
569
647
  class ScriptOrigin {
570
648
  public:
571
- inline ScriptOrigin(
649
+ V8_INLINE(ScriptOrigin(
572
650
  Handle<Value> resource_name,
573
651
  Handle<Integer> resource_line_offset = Handle<Integer>(),
574
- Handle<Integer> resource_column_offset = Handle<Integer>())
652
+ Handle<Integer> resource_column_offset = Handle<Integer>()))
575
653
  : resource_name_(resource_name),
576
654
  resource_line_offset_(resource_line_offset),
577
655
  resource_column_offset_(resource_column_offset) { }
578
- inline Handle<Value> ResourceName() const;
579
- inline Handle<Integer> ResourceLineOffset() const;
580
- inline Handle<Integer> ResourceColumnOffset() const;
656
+ V8_INLINE(Handle<Value> ResourceName() const);
657
+ V8_INLINE(Handle<Integer> ResourceLineOffset() const);
658
+ V8_INLINE(Handle<Integer> ResourceColumnOffset() const);
581
659
  private:
582
660
  Handle<Value> resource_name_;
583
661
  Handle<Integer> resource_line_offset_;
@@ -859,173 +937,179 @@ class V8EXPORT StackFrame {
859
937
  /**
860
938
  * The superclass of all JavaScript values and objects.
861
939
  */
862
- class Value : public Data {
940
+ class V8EXPORT Value : public Data {
863
941
  public:
864
942
  /**
865
943
  * Returns true if this value is the undefined value. See ECMA-262
866
944
  * 4.3.10.
867
945
  */
868
- inline bool IsUndefined() const;
946
+ V8_INLINE(bool IsUndefined() const);
869
947
 
870
948
  /**
871
949
  * Returns true if this value is the null value. See ECMA-262
872
950
  * 4.3.11.
873
951
  */
874
- inline bool IsNull() const;
952
+ V8_INLINE(bool IsNull() const);
875
953
 
876
954
  /**
877
955
  * Returns true if this value is true.
878
956
  */
879
- V8EXPORT bool IsTrue() const;
957
+ bool IsTrue() const;
880
958
 
881
959
  /**
882
960
  * Returns true if this value is false.
883
961
  */
884
- V8EXPORT bool IsFalse() const;
962
+ bool IsFalse() const;
885
963
 
886
964
  /**
887
965
  * Returns true if this value is an instance of the String type.
888
966
  * See ECMA-262 8.4.
889
967
  */
890
- inline bool IsString() const;
968
+ V8_INLINE(bool IsString() const);
891
969
 
892
970
  /**
893
971
  * Returns true if this value is a function.
894
972
  */
895
- V8EXPORT bool IsFunction() const;
973
+ bool IsFunction() const;
896
974
 
897
975
  /**
898
976
  * Returns true if this value is an array.
899
977
  */
900
- V8EXPORT bool IsArray() const;
978
+ bool IsArray() const;
901
979
 
902
980
  /**
903
981
  * Returns true if this value is an object.
904
982
  */
905
- V8EXPORT bool IsObject() const;
983
+ bool IsObject() const;
906
984
 
907
985
  /**
908
986
  * Returns true if this value is boolean.
909
987
  */
910
- V8EXPORT bool IsBoolean() const;
988
+ bool IsBoolean() const;
911
989
 
912
990
  /**
913
991
  * Returns true if this value is a number.
914
992
  */
915
- V8EXPORT bool IsNumber() const;
993
+ bool IsNumber() const;
916
994
 
917
995
  /**
918
996
  * Returns true if this value is external.
919
997
  */
920
- V8EXPORT bool IsExternal() const;
998
+ bool IsExternal() const;
921
999
 
922
1000
  /**
923
1001
  * Returns true if this value is a 32-bit signed integer.
924
1002
  */
925
- V8EXPORT bool IsInt32() const;
1003
+ bool IsInt32() const;
926
1004
 
927
1005
  /**
928
1006
  * Returns true if this value is a 32-bit unsigned integer.
929
1007
  */
930
- V8EXPORT bool IsUint32() const;
1008
+ bool IsUint32() const;
931
1009
 
932
1010
  /**
933
1011
  * Returns true if this value is a Date.
934
1012
  */
935
- V8EXPORT bool IsDate() const;
1013
+ bool IsDate() const;
936
1014
 
937
1015
  /**
938
1016
  * Returns true if this value is a Boolean object.
939
1017
  */
940
- V8EXPORT bool IsBooleanObject() const;
1018
+ bool IsBooleanObject() const;
941
1019
 
942
1020
  /**
943
1021
  * Returns true if this value is a Number object.
944
1022
  */
945
- V8EXPORT bool IsNumberObject() const;
1023
+ bool IsNumberObject() const;
946
1024
 
947
1025
  /**
948
1026
  * Returns true if this value is a String object.
949
1027
  */
950
- V8EXPORT bool IsStringObject() const;
1028
+ bool IsStringObject() const;
951
1029
 
952
1030
  /**
953
1031
  * Returns true if this value is a NativeError.
954
1032
  */
955
- V8EXPORT bool IsNativeError() const;
1033
+ bool IsNativeError() const;
956
1034
 
957
1035
  /**
958
1036
  * Returns true if this value is a RegExp.
959
1037
  */
960
- V8EXPORT bool IsRegExp() const;
1038
+ bool IsRegExp() const;
961
1039
 
962
- V8EXPORT Local<Boolean> ToBoolean() const;
963
- V8EXPORT Local<Number> ToNumber() const;
964
- V8EXPORT Local<String> ToString() const;
965
- V8EXPORT Local<String> ToDetailString() const;
966
- V8EXPORT Local<Object> ToObject() const;
967
- V8EXPORT Local<Integer> ToInteger() const;
968
- V8EXPORT Local<Uint32> ToUint32() const;
969
- V8EXPORT Local<Int32> ToInt32() const;
1040
+ Local<Boolean> ToBoolean() const;
1041
+ Local<Number> ToNumber() const;
1042
+ Local<String> ToString() const;
1043
+ Local<String> ToDetailString() const;
1044
+ Local<Object> ToObject() const;
1045
+ Local<Integer> ToInteger() const;
1046
+ Local<Uint32> ToUint32() const;
1047
+ Local<Int32> ToInt32() const;
970
1048
 
971
1049
  /**
972
1050
  * Attempts to convert a string to an array index.
973
1051
  * Returns an empty handle if the conversion fails.
974
1052
  */
975
- V8EXPORT Local<Uint32> ToArrayIndex() const;
1053
+ Local<Uint32> ToArrayIndex() const;
976
1054
 
977
- V8EXPORT bool BooleanValue() const;
978
- V8EXPORT double NumberValue() const;
979
- V8EXPORT int64_t IntegerValue() const;
980
- V8EXPORT uint32_t Uint32Value() const;
981
- V8EXPORT int32_t Int32Value() const;
1055
+ bool BooleanValue() const;
1056
+ double NumberValue() const;
1057
+ int64_t IntegerValue() const;
1058
+ uint32_t Uint32Value() const;
1059
+ int32_t Int32Value() const;
982
1060
 
983
1061
  /** JS == */
984
- V8EXPORT bool Equals(Handle<Value> that) const;
985
- V8EXPORT bool StrictEquals(Handle<Value> that) const;
1062
+ bool Equals(Handle<Value> that) const;
1063
+ bool StrictEquals(Handle<Value> that) const;
986
1064
 
987
1065
  private:
988
- inline bool QuickIsUndefined() const;
989
- inline bool QuickIsNull() const;
990
- inline bool QuickIsString() const;
991
- V8EXPORT bool FullIsUndefined() const;
992
- V8EXPORT bool FullIsNull() const;
993
- V8EXPORT bool FullIsString() const;
1066
+ V8_INLINE(bool QuickIsUndefined() const);
1067
+ V8_INLINE(bool QuickIsNull() const);
1068
+ V8_INLINE(bool QuickIsString() const);
1069
+ bool FullIsUndefined() const;
1070
+ bool FullIsNull() const;
1071
+ bool FullIsString() const;
994
1072
  };
995
1073
 
996
1074
 
997
1075
  /**
998
1076
  * The superclass of primitive values. See ECMA-262 4.3.2.
999
1077
  */
1000
- class Primitive : public Value { };
1078
+ class V8EXPORT Primitive : public Value { };
1001
1079
 
1002
1080
 
1003
1081
  /**
1004
1082
  * A primitive boolean value (ECMA-262, 4.3.14). Either the true
1005
1083
  * or false value.
1006
1084
  */
1007
- class Boolean : public Primitive {
1085
+ class V8EXPORT Boolean : public Primitive {
1008
1086
  public:
1009
- V8EXPORT bool Value() const;
1010
- static inline Handle<Boolean> New(bool value);
1087
+ bool Value() const;
1088
+ V8_INLINE(static Handle<Boolean> New(bool value));
1011
1089
  };
1012
1090
 
1013
1091
 
1014
1092
  /**
1015
1093
  * A JavaScript string value (ECMA-262, 4.3.17).
1016
1094
  */
1017
- class String : public Primitive {
1095
+ class V8EXPORT String : public Primitive {
1018
1096
  public:
1097
+ enum Encoding {
1098
+ UNKNOWN_ENCODING = 0x1,
1099
+ TWO_BYTE_ENCODING = 0x0,
1100
+ ASCII_ENCODING = 0x4,
1101
+ ONE_BYTE_ENCODING = 0x4
1102
+ };
1019
1103
  /**
1020
1104
  * Returns the number of characters in this string.
1021
1105
  */
1022
- V8EXPORT int Length() const;
1106
+ int Length() const;
1023
1107
 
1024
1108
  /**
1025
1109
  * Returns the number of bytes in the UTF-8 encoded
1026
1110
  * representation of this string.
1027
1111
  */
1028
- V8EXPORT int Utf8Length() const;
1112
+ int Utf8Length() const;
1029
1113
 
1030
1114
  /**
1031
1115
  * A fast conservative check for non-ASCII characters. May
@@ -1033,7 +1117,12 @@ class String : public Primitive {
1033
1117
  * false you can be sure that all characters are in the range
1034
1118
  * 0-127.
1035
1119
  */
1036
- V8EXPORT bool MayContainNonAscii() const;
1120
+ bool MayContainNonAscii() const;
1121
+
1122
+ /**
1123
+ * Returns whether this string contains only one byte data.
1124
+ */
1125
+ bool IsOneByte() const;
1037
1126
 
1038
1127
  /**
1039
1128
  * Write the contents of the string to an external buffer.
@@ -1063,40 +1152,46 @@ class String : public Primitive {
1063
1152
  enum WriteOptions {
1064
1153
  NO_OPTIONS = 0,
1065
1154
  HINT_MANY_WRITES_EXPECTED = 1,
1066
- NO_NULL_TERMINATION = 2
1155
+ NO_NULL_TERMINATION = 2,
1156
+ PRESERVE_ASCII_NULL = 4
1067
1157
  };
1068
1158
 
1069
1159
  // 16-bit character codes.
1070
- V8EXPORT int Write(uint16_t* buffer,
1071
- int start = 0,
1072
- int length = -1,
1073
- int options = NO_OPTIONS) const;
1160
+ int Write(uint16_t* buffer,
1161
+ int start = 0,
1162
+ int length = -1,
1163
+ int options = NO_OPTIONS) const;
1074
1164
  // ASCII characters.
1075
- V8EXPORT int WriteAscii(char* buffer,
1076
- int start = 0,
1077
- int length = -1,
1078
- int options = NO_OPTIONS) const;
1165
+ int WriteAscii(char* buffer,
1166
+ int start = 0,
1167
+ int length = -1,
1168
+ int options = NO_OPTIONS) const;
1169
+ // One byte characters.
1170
+ int WriteOneByte(uint8_t* buffer,
1171
+ int start = 0,
1172
+ int length = -1,
1173
+ int options = NO_OPTIONS) const;
1079
1174
  // UTF-8 encoded characters.
1080
- V8EXPORT int WriteUtf8(char* buffer,
1081
- int length = -1,
1082
- int* nchars_ref = NULL,
1083
- int options = NO_OPTIONS) const;
1175
+ int WriteUtf8(char* buffer,
1176
+ int length = -1,
1177
+ int* nchars_ref = NULL,
1178
+ int options = NO_OPTIONS) const;
1084
1179
 
1085
1180
  /**
1086
1181
  * A zero length string.
1087
1182
  */
1088
- V8EXPORT static v8::Local<v8::String> Empty();
1089
- inline static v8::Local<v8::String> Empty(Isolate* isolate);
1183
+ static v8::Local<v8::String> Empty();
1184
+ V8_INLINE(static v8::Local<v8::String> Empty(Isolate* isolate));
1090
1185
 
1091
1186
  /**
1092
1187
  * Returns true if the string is external
1093
1188
  */
1094
- V8EXPORT bool IsExternal() const;
1189
+ bool IsExternal() const;
1095
1190
 
1096
1191
  /**
1097
1192
  * Returns true if the string is both external and ASCII
1098
1193
  */
1099
- V8EXPORT bool IsExternalAscii() const;
1194
+ bool IsExternalAscii() const;
1100
1195
 
1101
1196
  class V8EXPORT ExternalStringResourceBase { // NOLINT
1102
1197
  public:
@@ -1177,44 +1272,48 @@ class String : public Primitive {
1177
1272
  ExternalAsciiStringResource() {}
1178
1273
  };
1179
1274
 
1275
+ typedef ExternalAsciiStringResource ExternalOneByteStringResource;
1276
+
1277
+ /**
1278
+ * If the string is an external string, return the ExternalStringResourceBase
1279
+ * regardless of the encoding, otherwise return NULL. The encoding of the
1280
+ * string is returned in encoding_out.
1281
+ */
1282
+ V8_INLINE(ExternalStringResourceBase* GetExternalStringResourceBase(
1283
+ Encoding* encoding_out) const);
1284
+
1180
1285
  /**
1181
1286
  * Get the ExternalStringResource for an external string. Returns
1182
1287
  * NULL if IsExternal() doesn't return true.
1183
1288
  */
1184
- inline ExternalStringResource* GetExternalStringResource() const;
1289
+ V8_INLINE(ExternalStringResource* GetExternalStringResource() const);
1185
1290
 
1186
1291
  /**
1187
1292
  * Get the ExternalAsciiStringResource for an external ASCII string.
1188
1293
  * Returns NULL if IsExternalAscii() doesn't return true.
1189
1294
  */
1190
- V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResource()
1191
- const;
1295
+ const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1192
1296
 
1193
- static inline String* Cast(v8::Value* obj);
1297
+ V8_INLINE(static String* Cast(v8::Value* obj));
1194
1298
 
1195
1299
  /**
1196
1300
  * Allocates a new string from either UTF-8 encoded or ASCII data.
1197
- * The second parameter 'length' gives the buffer length.
1198
- * If the data is UTF-8 encoded, the caller must
1199
- * be careful to supply the length parameter.
1200
- * If it is not given, the function calls
1201
- * 'strlen' to determine the buffer length, it might be
1202
- * wrong if 'data' contains a null character.
1301
+ * The second parameter 'length' gives the buffer length. If omitted,
1302
+ * the function calls 'strlen' to determine the buffer length.
1203
1303
  */
1204
- V8EXPORT static Local<String> New(const char* data, int length = -1);
1304
+ static Local<String> New(const char* data, int length = -1);
1205
1305
 
1206
1306
  /** Allocates a new string from 16-bit character codes.*/
1207
- V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
1307
+ static Local<String> New(const uint16_t* data, int length = -1);
1208
1308
 
1209
1309
  /** Creates a symbol. Returns one if it exists already.*/
1210
- V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1);
1310
+ static Local<String> NewSymbol(const char* data, int length = -1);
1211
1311
 
1212
1312
  /**
1213
1313
  * Creates a new string by concatenating the left and the right strings
1214
1314
  * passed in as parameters.
1215
1315
  */
1216
- V8EXPORT static Local<String> Concat(Handle<String> left,
1217
- Handle<String> right);
1316
+ static Local<String> Concat(Handle<String> left, Handle<String> right);
1218
1317
 
1219
1318
  /**
1220
1319
  * Creates a new external string using the data defined in the given
@@ -1224,7 +1323,7 @@ class String : public Primitive {
1224
1323
  * should the underlying buffer be deallocated or modified except through the
1225
1324
  * destructor of the external string resource.
1226
1325
  */
1227
- V8EXPORT static Local<String> NewExternal(ExternalStringResource* resource);
1326
+ static Local<String> NewExternal(ExternalStringResource* resource);
1228
1327
 
1229
1328
  /**
1230
1329
  * Associate an external string resource with this string by transforming it
@@ -1235,7 +1334,7 @@ class String : public Primitive {
1235
1334
  * The string is not modified if the operation fails. See NewExternal for
1236
1335
  * information on the lifetime of the resource.
1237
1336
  */
1238
- V8EXPORT bool MakeExternal(ExternalStringResource* resource);
1337
+ bool MakeExternal(ExternalStringResource* resource);
1239
1338
 
1240
1339
  /**
1241
1340
  * Creates a new external string using the ASCII data defined in the given
@@ -1244,8 +1343,8 @@ class String : public Primitive {
1244
1343
  * this function should not otherwise delete or modify the resource. Neither
1245
1344
  * should the underlying buffer be deallocated or modified except through the
1246
1345
  * destructor of the external string resource.
1247
- */ V8EXPORT static Local<String> NewExternal(
1248
- ExternalAsciiStringResource* resource);
1346
+ */
1347
+ static Local<String> NewExternal(ExternalAsciiStringResource* resource);
1249
1348
 
1250
1349
  /**
1251
1350
  * Associate an external string resource with this string by transforming it
@@ -1256,20 +1355,18 @@ class String : public Primitive {
1256
1355
  * The string is not modified if the operation fails. See NewExternal for
1257
1356
  * information on the lifetime of the resource.
1258
1357
  */
1259
- V8EXPORT bool MakeExternal(ExternalAsciiStringResource* resource);
1358
+ bool MakeExternal(ExternalAsciiStringResource* resource);
1260
1359
 
1261
1360
  /**
1262
1361
  * Returns true if this string can be made external.
1263
1362
  */
1264
- V8EXPORT bool CanMakeExternal();
1363
+ bool CanMakeExternal();
1265
1364
 
1266
1365
  /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/
1267
- V8EXPORT static Local<String> NewUndetectable(const char* data,
1268
- int length = -1);
1366
+ static Local<String> NewUndetectable(const char* data, int length = -1);
1269
1367
 
1270
1368
  /** Creates an undetectable string from the supplied 16-bit character codes.*/
1271
- V8EXPORT static Local<String> NewUndetectable(const uint16_t* data,
1272
- int length = -1);
1369
+ static Local<String> NewUndetectable(const uint16_t* data, int length = -1);
1273
1370
 
1274
1371
  /**
1275
1372
  * Converts an object to a UTF-8-encoded character array. Useful if
@@ -1340,59 +1437,63 @@ class String : public Primitive {
1340
1437
  };
1341
1438
 
1342
1439
  private:
1343
- V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) const;
1344
- V8EXPORT static void CheckCast(v8::Value* obj);
1440
+ void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
1441
+ Encoding encoding) const;
1442
+ void VerifyExternalStringResource(ExternalStringResource* val) const;
1443
+ static void CheckCast(v8::Value* obj);
1345
1444
  };
1346
1445
 
1347
1446
 
1348
1447
  /**
1349
1448
  * A JavaScript number value (ECMA-262, 4.3.20)
1350
1449
  */
1351
- class Number : public Primitive {
1450
+ class V8EXPORT Number : public Primitive {
1352
1451
  public:
1353
- V8EXPORT double Value() const;
1354
- V8EXPORT static Local<Number> New(double value);
1355
- static inline Number* Cast(v8::Value* obj);
1452
+ double Value() const;
1453
+ static Local<Number> New(double value);
1454
+ V8_INLINE(static Number* Cast(v8::Value* obj));
1356
1455
  private:
1357
- V8EXPORT Number();
1358
- V8EXPORT static void CheckCast(v8::Value* obj);
1456
+ Number();
1457
+ static void CheckCast(v8::Value* obj);
1359
1458
  };
1360
1459
 
1361
1460
 
1362
1461
  /**
1363
1462
  * A JavaScript value representing a signed integer.
1364
1463
  */
1365
- class Integer : public Number {
1464
+ class V8EXPORT Integer : public Number {
1366
1465
  public:
1367
- V8EXPORT static Local<Integer> New(int32_t value);
1368
- V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value);
1369
- V8EXPORT int64_t Value() const;
1370
- static inline Integer* Cast(v8::Value* obj);
1466
+ static Local<Integer> New(int32_t value);
1467
+ static Local<Integer> NewFromUnsigned(uint32_t value);
1468
+ static Local<Integer> New(int32_t value, Isolate*);
1469
+ static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
1470
+ int64_t Value() const;
1471
+ V8_INLINE(static Integer* Cast(v8::Value* obj));
1371
1472
  private:
1372
- V8EXPORT Integer();
1373
- V8EXPORT static void CheckCast(v8::Value* obj);
1473
+ Integer();
1474
+ static void CheckCast(v8::Value* obj);
1374
1475
  };
1375
1476
 
1376
1477
 
1377
1478
  /**
1378
1479
  * A JavaScript value representing a 32-bit signed integer.
1379
1480
  */
1380
- class Int32 : public Integer {
1481
+ class V8EXPORT Int32 : public Integer {
1381
1482
  public:
1382
- V8EXPORT int32_t Value() const;
1483
+ int32_t Value() const;
1383
1484
  private:
1384
- V8EXPORT Int32();
1485
+ Int32();
1385
1486
  };
1386
1487
 
1387
1488
 
1388
1489
  /**
1389
1490
  * A JavaScript value representing a 32-bit unsigned integer.
1390
1491
  */
1391
- class Uint32 : public Integer {
1492
+ class V8EXPORT Uint32 : public Integer {
1392
1493
  public:
1393
- V8EXPORT uint32_t Value() const;
1494
+ uint32_t Value() const;
1394
1495
  private:
1395
- V8EXPORT Uint32();
1496
+ Uint32();
1396
1497
  };
1397
1498
 
1398
1499
 
@@ -1453,14 +1554,13 @@ enum AccessControl {
1453
1554
  /**
1454
1555
  * A JavaScript object (ECMA-262, 4.3.3)
1455
1556
  */
1456
- class Object : public Value {
1557
+ class V8EXPORT Object : public Value {
1457
1558
  public:
1458
- V8EXPORT bool Set(Handle<Value> key,
1459
- Handle<Value> value,
1460
- PropertyAttribute attribs = None);
1559
+ bool Set(Handle<Value> key,
1560
+ Handle<Value> value,
1561
+ PropertyAttribute attribs = None);
1461
1562
 
1462
- V8EXPORT bool Set(uint32_t index,
1463
- Handle<Value> value);
1563
+ bool Set(uint32_t index, Handle<Value> value);
1464
1564
 
1465
1565
  // Sets a local property on this object bypassing interceptors and
1466
1566
  // overriding accessors or read-only properties.
@@ -1470,41 +1570,41 @@ class Object : public Value {
1470
1570
  // will only be returned if the interceptor doesn't return a value.
1471
1571
  //
1472
1572
  // Note also that this only works for named properties.
1473
- V8EXPORT bool ForceSet(Handle<Value> key,
1474
- Handle<Value> value,
1475
- PropertyAttribute attribs = None);
1573
+ bool ForceSet(Handle<Value> key,
1574
+ Handle<Value> value,
1575
+ PropertyAttribute attribs = None);
1476
1576
 
1477
- V8EXPORT Local<Value> Get(Handle<Value> key);
1577
+ Local<Value> Get(Handle<Value> key);
1478
1578
 
1479
- V8EXPORT Local<Value> Get(uint32_t index);
1579
+ Local<Value> Get(uint32_t index);
1480
1580
 
1481
1581
  /**
1482
1582
  * Gets the property attributes of a property which can be None or
1483
1583
  * any combination of ReadOnly, DontEnum and DontDelete. Returns
1484
1584
  * None when the property doesn't exist.
1485
1585
  */
1486
- V8EXPORT PropertyAttribute GetPropertyAttributes(Handle<Value> key);
1586
+ PropertyAttribute GetPropertyAttributes(Handle<Value> key);
1487
1587
 
1488
1588
  // TODO(1245389): Replace the type-specific versions of these
1489
1589
  // functions with generic ones that accept a Handle<Value> key.
1490
- V8EXPORT bool Has(Handle<String> key);
1590
+ bool Has(Handle<String> key);
1491
1591
 
1492
- V8EXPORT bool Delete(Handle<String> key);
1592
+ bool Delete(Handle<String> key);
1493
1593
 
1494
1594
  // Delete a property on this object bypassing interceptors and
1495
1595
  // ignoring dont-delete attributes.
1496
- V8EXPORT bool ForceDelete(Handle<Value> key);
1596
+ bool ForceDelete(Handle<Value> key);
1497
1597
 
1498
- V8EXPORT bool Has(uint32_t index);
1598
+ bool Has(uint32_t index);
1499
1599
 
1500
- V8EXPORT bool Delete(uint32_t index);
1600
+ bool Delete(uint32_t index);
1501
1601
 
1502
- V8EXPORT bool SetAccessor(Handle<String> name,
1503
- AccessorGetter getter,
1504
- AccessorSetter setter = 0,
1505
- Handle<Value> data = Handle<Value>(),
1506
- AccessControl settings = DEFAULT,
1507
- PropertyAttribute attribute = None);
1602
+ bool SetAccessor(Handle<String> name,
1603
+ AccessorGetter getter,
1604
+ AccessorSetter setter = 0,
1605
+ Handle<Value> data = Handle<Value>(),
1606
+ AccessControl settings = DEFAULT,
1607
+ PropertyAttribute attribute = None);
1508
1608
 
1509
1609
  /**
1510
1610
  * Returns an array containing the names of the enumerable properties
@@ -1512,93 +1612,107 @@ class Object : public Value {
1512
1612
  * array returned by this method contains the same values as would
1513
1613
  * be enumerated by a for-in statement over this object.
1514
1614
  */
1515
- V8EXPORT Local<Array> GetPropertyNames();
1615
+ Local<Array> GetPropertyNames();
1516
1616
 
1517
1617
  /**
1518
1618
  * This function has the same functionality as GetPropertyNames but
1519
1619
  * the returned array doesn't contain the names of properties from
1520
1620
  * prototype objects.
1521
1621
  */
1522
- V8EXPORT Local<Array> GetOwnPropertyNames();
1622
+ Local<Array> GetOwnPropertyNames();
1523
1623
 
1524
1624
  /**
1525
1625
  * Get the prototype object. This does not skip objects marked to
1526
1626
  * be skipped by __proto__ and it does not consult the security
1527
1627
  * handler.
1528
1628
  */
1529
- V8EXPORT Local<Value> GetPrototype();
1629
+ Local<Value> GetPrototype();
1530
1630
 
1531
1631
  /**
1532
1632
  * Set the prototype object. This does not skip objects marked to
1533
1633
  * be skipped by __proto__ and it does not consult the security
1534
1634
  * handler.
1535
1635
  */
1536
- V8EXPORT bool SetPrototype(Handle<Value> prototype);
1636
+ bool SetPrototype(Handle<Value> prototype);
1537
1637
 
1538
1638
  /**
1539
1639
  * Finds an instance of the given function template in the prototype
1540
1640
  * chain.
1541
1641
  */
1542
- V8EXPORT Local<Object> FindInstanceInPrototypeChain(
1543
- Handle<FunctionTemplate> tmpl);
1642
+ Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl);
1544
1643
 
1545
1644
  /**
1546
1645
  * Call builtin Object.prototype.toString on this object.
1547
1646
  * This is different from Value::ToString() that may call
1548
1647
  * user-defined toString function. This one does not.
1549
1648
  */
1550
- V8EXPORT Local<String> ObjectProtoToString();
1649
+ Local<String> ObjectProtoToString();
1650
+
1651
+ /**
1652
+ * Returns the function invoked as a constructor for this object.
1653
+ * May be the null value.
1654
+ */
1655
+ Local<Value> GetConstructor();
1551
1656
 
1552
1657
  /**
1553
1658
  * Returns the name of the function invoked as a constructor for this object.
1554
1659
  */
1555
- V8EXPORT Local<String> GetConstructorName();
1660
+ Local<String> GetConstructorName();
1556
1661
 
1557
1662
  /** Gets the number of internal fields for this Object. */
1558
- V8EXPORT int InternalFieldCount();
1559
- /** Gets the value in an internal field. */
1560
- inline Local<Value> GetInternalField(int index);
1663
+ int InternalFieldCount();
1664
+
1665
+ /** Gets the value from an internal field. */
1666
+ V8_INLINE(Local<Value> GetInternalField(int index));
1667
+
1561
1668
  /** Sets the value in an internal field. */
1562
- V8EXPORT void SetInternalField(int index, Handle<Value> value);
1669
+ void SetInternalField(int index, Handle<Value> value);
1563
1670
 
1564
- /** Gets a native pointer from an internal field. */
1565
- inline void* GetPointerFromInternalField(int index);
1671
+ /**
1672
+ * Gets a 2-byte-aligned native pointer from an internal field. This field
1673
+ * must have been set by SetAlignedPointerInInternalField, everything else
1674
+ * leads to undefined behavior.
1675
+ */
1676
+ V8_INLINE(void* GetAlignedPointerFromInternalField(int index));
1566
1677
 
1567
- /** Sets a native pointer in an internal field. */
1568
- V8EXPORT void SetPointerInInternalField(int index, void* value);
1678
+ /**
1679
+ * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
1680
+ * a field, GetAlignedPointerFromInternalField must be used, everything else
1681
+ * leads to undefined behavior.
1682
+ */
1683
+ void SetAlignedPointerInInternalField(int index, void* value);
1569
1684
 
1570
1685
  // Testers for local properties.
1571
- V8EXPORT bool HasOwnProperty(Handle<String> key);
1572
- V8EXPORT bool HasRealNamedProperty(Handle<String> key);
1573
- V8EXPORT bool HasRealIndexedProperty(uint32_t index);
1574
- V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key);
1686
+ bool HasOwnProperty(Handle<String> key);
1687
+ bool HasRealNamedProperty(Handle<String> key);
1688
+ bool HasRealIndexedProperty(uint32_t index);
1689
+ bool HasRealNamedCallbackProperty(Handle<String> key);
1575
1690
 
1576
1691
  /**
1577
1692
  * If result.IsEmpty() no real property was located in the prototype chain.
1578
1693
  * This means interceptors in the prototype chain are not called.
1579
1694
  */
1580
- V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain(
1581
- Handle<String> key);
1695
+ Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key);
1582
1696
 
1583
1697
  /**
1584
1698
  * If result.IsEmpty() no real property was located on the object or
1585
1699
  * in the prototype chain.
1586
1700
  * This means interceptors in the prototype chain are not called.
1587
1701
  */
1588
- V8EXPORT Local<Value> GetRealNamedProperty(Handle<String> key);
1702
+ Local<Value> GetRealNamedProperty(Handle<String> key);
1589
1703
 
1590
1704
  /** Tests for a named lookup interceptor.*/
1591
- V8EXPORT bool HasNamedLookupInterceptor();
1705
+ bool HasNamedLookupInterceptor();
1592
1706
 
1593
1707
  /** Tests for an index lookup interceptor.*/
1594
- V8EXPORT bool HasIndexedLookupInterceptor();
1708
+ bool HasIndexedLookupInterceptor();
1595
1709
 
1596
1710
  /**
1597
1711
  * Turns on access check on the object if the object is an instance of
1598
1712
  * a template that has access check callbacks. If an object has no
1599
1713
  * access check info, the object cannot be accessed by anyone.
1600
1714
  */
1601
- V8EXPORT void TurnOnAccessCheck();
1715
+ void TurnOnAccessCheck();
1602
1716
 
1603
1717
  /**
1604
1718
  * Returns the identity hash for this object. The current implementation
@@ -1607,7 +1721,7 @@ class Object : public Value {
1607
1721
  * The return value will never be 0. Also, it is not guaranteed to be
1608
1722
  * unique.
1609
1723
  */
1610
- V8EXPORT int GetIdentityHash();
1724
+ int GetIdentityHash();
1611
1725
 
1612
1726
  /**
1613
1727
  * Access hidden properties on JavaScript objects. These properties are
@@ -1615,9 +1729,9 @@ class Object : public Value {
1615
1729
  * C++ API. Hidden properties introduced by V8 internally (for example the
1616
1730
  * identity hash) are prefixed with "v8::".
1617
1731
  */
1618
- V8EXPORT bool SetHiddenValue(Handle<String> key, Handle<Value> value);
1619
- V8EXPORT Local<Value> GetHiddenValue(Handle<String> key);
1620
- V8EXPORT bool DeleteHiddenValue(Handle<String> key);
1732
+ bool SetHiddenValue(Handle<String> key, Handle<Value> value);
1733
+ Local<Value> GetHiddenValue(Handle<String> key);
1734
+ bool DeleteHiddenValue(Handle<String> key);
1621
1735
 
1622
1736
  /**
1623
1737
  * Returns true if this is an instance of an api function (one
@@ -1626,18 +1740,18 @@ class Object : public Value {
1626
1740
  * conservative and may return true for objects that haven't actually
1627
1741
  * been modified.
1628
1742
  */
1629
- V8EXPORT bool IsDirty();
1743
+ bool IsDirty();
1630
1744
 
1631
1745
  /**
1632
1746
  * Clone this object with a fast but shallow copy. Values will point
1633
1747
  * to the same values as the original object.
1634
1748
  */
1635
- V8EXPORT Local<Object> Clone();
1749
+ Local<Object> Clone();
1636
1750
 
1637
1751
  /**
1638
1752
  * Returns the context in which the object was created.
1639
1753
  */
1640
- V8EXPORT Local<Context> CreationContext();
1754
+ Local<Context> CreationContext();
1641
1755
 
1642
1756
  /**
1643
1757
  * Set the backing store of the indexed properties to be managed by the
@@ -1646,10 +1760,10 @@ class Object : public Value {
1646
1760
  * Note: The embedding program still owns the data and needs to ensure that
1647
1761
  * the backing store is preserved while V8 has a reference.
1648
1762
  */
1649
- V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
1650
- V8EXPORT bool HasIndexedPropertiesInPixelData();
1651
- V8EXPORT uint8_t* GetIndexedPropertiesPixelData();
1652
- V8EXPORT int GetIndexedPropertiesPixelDataLength();
1763
+ void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
1764
+ bool HasIndexedPropertiesInPixelData();
1765
+ uint8_t* GetIndexedPropertiesPixelData();
1766
+ int GetIndexedPropertiesPixelDataLength();
1653
1767
 
1654
1768
  /**
1655
1769
  * Set the backing store of the indexed properties to be managed by the
@@ -1658,93 +1772,83 @@ class Object : public Value {
1658
1772
  * Note: The embedding program still owns the data and needs to ensure that
1659
1773
  * the backing store is preserved while V8 has a reference.
1660
1774
  */
1661
- V8EXPORT void SetIndexedPropertiesToExternalArrayData(
1662
- void* data,
1663
- ExternalArrayType array_type,
1664
- int number_of_elements);
1665
- V8EXPORT bool HasIndexedPropertiesInExternalArrayData();
1666
- V8EXPORT void* GetIndexedPropertiesExternalArrayData();
1667
- V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
1668
- V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
1775
+ void SetIndexedPropertiesToExternalArrayData(void* data,
1776
+ ExternalArrayType array_type,
1777
+ int number_of_elements);
1778
+ bool HasIndexedPropertiesInExternalArrayData();
1779
+ void* GetIndexedPropertiesExternalArrayData();
1780
+ ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
1781
+ int GetIndexedPropertiesExternalArrayDataLength();
1669
1782
 
1670
1783
  /**
1671
1784
  * Checks whether a callback is set by the
1672
1785
  * ObjectTemplate::SetCallAsFunctionHandler method.
1673
1786
  * When an Object is callable this method returns true.
1674
1787
  */
1675
- V8EXPORT bool IsCallable();
1788
+ bool IsCallable();
1676
1789
 
1677
1790
  /**
1678
1791
  * Call an Object as a function if a callback is set by the
1679
1792
  * ObjectTemplate::SetCallAsFunctionHandler method.
1680
1793
  */
1681
- V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv,
1682
- int argc,
1683
- Handle<Value> argv[]);
1794
+ Local<Value> CallAsFunction(Handle<Object> recv,
1795
+ int argc,
1796
+ Handle<Value> argv[]);
1684
1797
 
1685
1798
  /**
1686
1799
  * Call an Object as a constructor if a callback is set by the
1687
1800
  * ObjectTemplate::SetCallAsFunctionHandler method.
1688
1801
  * Note: This method behaves like the Function::NewInstance method.
1689
1802
  */
1690
- V8EXPORT Local<Value> CallAsConstructor(int argc,
1691
- Handle<Value> argv[]);
1803
+ Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
1692
1804
 
1693
- V8EXPORT static Local<Object> New();
1694
- static inline Object* Cast(Value* obj);
1805
+ static Local<Object> New();
1806
+ V8_INLINE(static Object* Cast(Value* obj));
1695
1807
 
1696
1808
  private:
1697
- V8EXPORT Object();
1698
- V8EXPORT static void CheckCast(Value* obj);
1699
- V8EXPORT Local<Value> CheckedGetInternalField(int index);
1700
- V8EXPORT void* SlowGetPointerFromInternalField(int index);
1701
-
1702
- /**
1703
- * If quick access to the internal field is possible this method
1704
- * returns the value. Otherwise an empty handle is returned.
1705
- */
1706
- inline Local<Value> UncheckedGetInternalField(int index);
1809
+ Object();
1810
+ static void CheckCast(Value* obj);
1811
+ Local<Value> SlowGetInternalField(int index);
1812
+ void* SlowGetAlignedPointerFromInternalField(int index);
1707
1813
  };
1708
1814
 
1709
1815
 
1710
1816
  /**
1711
1817
  * An instance of the built-in array constructor (ECMA-262, 15.4.2).
1712
1818
  */
1713
- class Array : public Object {
1819
+ class V8EXPORT Array : public Object {
1714
1820
  public:
1715
- V8EXPORT uint32_t Length() const;
1821
+ uint32_t Length() const;
1716
1822
 
1717
1823
  /**
1718
1824
  * Clones an element at index |index|. Returns an empty
1719
1825
  * handle if cloning fails (for any reason).
1720
1826
  */
1721
- V8EXPORT Local<Object> CloneElementAt(uint32_t index);
1827
+ Local<Object> CloneElementAt(uint32_t index);
1722
1828
 
1723
1829
  /**
1724
1830
  * Creates a JavaScript array with the given length. If the length
1725
1831
  * is negative the returned array will have length 0.
1726
1832
  */
1727
- V8EXPORT static Local<Array> New(int length = 0);
1833
+ static Local<Array> New(int length = 0);
1728
1834
 
1729
- static inline Array* Cast(Value* obj);
1835
+ V8_INLINE(static Array* Cast(Value* obj));
1730
1836
  private:
1731
- V8EXPORT Array();
1732
- V8EXPORT static void CheckCast(Value* obj);
1837
+ Array();
1838
+ static void CheckCast(Value* obj);
1733
1839
  };
1734
1840
 
1735
1841
 
1736
1842
  /**
1737
1843
  * A JavaScript function object (ECMA-262, 15.3).
1738
1844
  */
1739
- class Function : public Object {
1845
+ class V8EXPORT Function : public Object {
1740
1846
  public:
1741
- V8EXPORT Local<Object> NewInstance() const;
1742
- V8EXPORT Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
1743
- V8EXPORT Local<Value> Call(Handle<Object> recv,
1744
- int argc,
1745
- Handle<Value> argv[]);
1746
- V8EXPORT void SetName(Handle<String> name);
1747
- V8EXPORT Handle<Value> GetName() const;
1847
+ Local<Object> NewInstance() const;
1848
+ Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
1849
+ Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
1850
+ void SetName(Handle<String> name);
1851
+ Handle<Value> GetName() const;
1748
1852
 
1749
1853
  /**
1750
1854
  * Name inferred from variable or property assignment of this function.
@@ -1752,43 +1856,43 @@ class Function : public Object {
1752
1856
  * in an OO style, where many functions are anonymous but are assigned
1753
1857
  * to object properties.
1754
1858
  */
1755
- V8EXPORT Handle<Value> GetInferredName() const;
1859
+ Handle<Value> GetInferredName() const;
1756
1860
 
1757
1861
  /**
1758
1862
  * Returns zero based line number of function body and
1759
1863
  * kLineOffsetNotFound if no information available.
1760
1864
  */
1761
- V8EXPORT int GetScriptLineNumber() const;
1865
+ int GetScriptLineNumber() const;
1762
1866
  /**
1763
1867
  * Returns zero based column number of function body and
1764
1868
  * kLineOffsetNotFound if no information available.
1765
1869
  */
1766
- V8EXPORT int GetScriptColumnNumber() const;
1767
- V8EXPORT Handle<Value> GetScriptId() const;
1768
- V8EXPORT ScriptOrigin GetScriptOrigin() const;
1769
- static inline Function* Cast(Value* obj);
1770
- V8EXPORT static const int kLineOffsetNotFound;
1870
+ int GetScriptColumnNumber() const;
1871
+ Handle<Value> GetScriptId() const;
1872
+ ScriptOrigin GetScriptOrigin() const;
1873
+ V8_INLINE(static Function* Cast(Value* obj));
1874
+ static const int kLineOffsetNotFound;
1771
1875
 
1772
1876
  private:
1773
- V8EXPORT Function();
1774
- V8EXPORT static void CheckCast(Value* obj);
1877
+ Function();
1878
+ static void CheckCast(Value* obj);
1775
1879
  };
1776
1880
 
1777
1881
 
1778
1882
  /**
1779
1883
  * An instance of the built-in Date constructor (ECMA-262, 15.9).
1780
1884
  */
1781
- class Date : public Object {
1885
+ class V8EXPORT Date : public Object {
1782
1886
  public:
1783
- V8EXPORT static Local<Value> New(double time);
1887
+ static Local<Value> New(double time);
1784
1888
 
1785
1889
  /**
1786
1890
  * A specialization of Value::NumberValue that is more efficient
1787
1891
  * because we know the structure of this object.
1788
1892
  */
1789
- V8EXPORT double NumberValue() const;
1893
+ double NumberValue() const;
1790
1894
 
1791
- static inline Date* Cast(v8::Value* obj);
1895
+ V8_INLINE(static Date* Cast(v8::Value* obj));
1792
1896
 
1793
1897
  /**
1794
1898
  * Notification that the embedder has changed the time zone,
@@ -1802,74 +1906,74 @@ class Date : public Object {
1802
1906
  * This API should not be called more than needed as it will
1803
1907
  * negatively impact the performance of date operations.
1804
1908
  */
1805
- V8EXPORT static void DateTimeConfigurationChangeNotification();
1909
+ static void DateTimeConfigurationChangeNotification();
1806
1910
 
1807
1911
  private:
1808
- V8EXPORT static void CheckCast(v8::Value* obj);
1912
+ static void CheckCast(v8::Value* obj);
1809
1913
  };
1810
1914
 
1811
1915
 
1812
1916
  /**
1813
1917
  * A Number object (ECMA-262, 4.3.21).
1814
1918
  */
1815
- class NumberObject : public Object {
1919
+ class V8EXPORT NumberObject : public Object {
1816
1920
  public:
1817
- V8EXPORT static Local<Value> New(double value);
1921
+ static Local<Value> New(double value);
1818
1922
 
1819
1923
  /**
1820
1924
  * Returns the Number held by the object.
1821
1925
  */
1822
- V8EXPORT double NumberValue() const;
1926
+ double NumberValue() const;
1823
1927
 
1824
- static inline NumberObject* Cast(v8::Value* obj);
1928
+ V8_INLINE(static NumberObject* Cast(v8::Value* obj));
1825
1929
 
1826
1930
  private:
1827
- V8EXPORT static void CheckCast(v8::Value* obj);
1931
+ static void CheckCast(v8::Value* obj);
1828
1932
  };
1829
1933
 
1830
1934
 
1831
1935
  /**
1832
1936
  * A Boolean object (ECMA-262, 4.3.15).
1833
1937
  */
1834
- class BooleanObject : public Object {
1938
+ class V8EXPORT BooleanObject : public Object {
1835
1939
  public:
1836
- V8EXPORT static Local<Value> New(bool value);
1940
+ static Local<Value> New(bool value);
1837
1941
 
1838
1942
  /**
1839
1943
  * Returns the Boolean held by the object.
1840
1944
  */
1841
- V8EXPORT bool BooleanValue() const;
1945
+ bool BooleanValue() const;
1842
1946
 
1843
- static inline BooleanObject* Cast(v8::Value* obj);
1947
+ V8_INLINE(static BooleanObject* Cast(v8::Value* obj));
1844
1948
 
1845
1949
  private:
1846
- V8EXPORT static void CheckCast(v8::Value* obj);
1950
+ static void CheckCast(v8::Value* obj);
1847
1951
  };
1848
1952
 
1849
1953
 
1850
1954
  /**
1851
1955
  * A String object (ECMA-262, 4.3.18).
1852
1956
  */
1853
- class StringObject : public Object {
1957
+ class V8EXPORT StringObject : public Object {
1854
1958
  public:
1855
- V8EXPORT static Local<Value> New(Handle<String> value);
1959
+ static Local<Value> New(Handle<String> value);
1856
1960
 
1857
1961
  /**
1858
1962
  * Returns the String held by the object.
1859
1963
  */
1860
- V8EXPORT Local<String> StringValue() const;
1964
+ Local<String> StringValue() const;
1861
1965
 
1862
- static inline StringObject* Cast(v8::Value* obj);
1966
+ V8_INLINE(static StringObject* Cast(v8::Value* obj));
1863
1967
 
1864
1968
  private:
1865
- V8EXPORT static void CheckCast(v8::Value* obj);
1969
+ static void CheckCast(v8::Value* obj);
1866
1970
  };
1867
1971
 
1868
1972
 
1869
1973
  /**
1870
1974
  * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
1871
1975
  */
1872
- class RegExp : public Object {
1976
+ class V8EXPORT RegExp : public Object {
1873
1977
  public:
1874
1978
  /**
1875
1979
  * Regular expression flag bits. They can be or'ed to enable a set
@@ -1892,51 +1996,37 @@ class RegExp : public Object {
1892
1996
  * static_cast<RegExp::Flags>(kGlobal | kMultiline))
1893
1997
  * is equivalent to evaluating "/foo/gm".
1894
1998
  */
1895
- V8EXPORT static Local<RegExp> New(Handle<String> pattern,
1896
- Flags flags);
1999
+ static Local<RegExp> New(Handle<String> pattern, Flags flags);
1897
2000
 
1898
2001
  /**
1899
2002
  * Returns the value of the source property: a string representing
1900
2003
  * the regular expression.
1901
2004
  */
1902
- V8EXPORT Local<String> GetSource() const;
2005
+ Local<String> GetSource() const;
1903
2006
 
1904
2007
  /**
1905
2008
  * Returns the flags bit field.
1906
2009
  */
1907
- V8EXPORT Flags GetFlags() const;
2010
+ Flags GetFlags() const;
1908
2011
 
1909
- static inline RegExp* Cast(v8::Value* obj);
2012
+ V8_INLINE(static RegExp* Cast(v8::Value* obj));
1910
2013
 
1911
2014
  private:
1912
- V8EXPORT static void CheckCast(v8::Value* obj);
2015
+ static void CheckCast(v8::Value* obj);
1913
2016
  };
1914
2017
 
1915
2018
 
1916
2019
  /**
1917
- * A JavaScript value that wraps a C++ void*. This type of value is
1918
- * mainly used to associate C++ data structures with JavaScript
1919
- * objects.
1920
- *
1921
- * The Wrap function V8 will return the most optimal Value object wrapping the
1922
- * C++ void*. The type of the value is not guaranteed to be an External object
1923
- * and no assumptions about its type should be made. To access the wrapped
1924
- * value Unwrap should be used, all other operations on that object will lead
1925
- * to unpredictable results.
2020
+ * A JavaScript value that wraps a C++ void*. This type of value is mainly used
2021
+ * to associate C++ data structures with JavaScript objects.
1926
2022
  */
1927
- class External : public Value {
2023
+ class V8EXPORT External : public Value {
1928
2024
  public:
1929
- V8EXPORT static Local<Value> Wrap(void* data);
1930
- static inline void* Unwrap(Handle<Value> obj);
1931
-
1932
- V8EXPORT static Local<External> New(void* value);
1933
- static inline External* Cast(Value* obj);
1934
- V8EXPORT void* Value() const;
2025
+ static Local<External> New(void* value);
2026
+ V8_INLINE(static External* Cast(Value* obj));
2027
+ void* Value() const;
1935
2028
  private:
1936
- V8EXPORT External();
1937
- V8EXPORT static void CheckCast(v8::Value* obj);
1938
- static inline void* QuickUnwrap(Handle<v8::Value> obj);
1939
- V8EXPORT static void* FullUnwrap(Handle<v8::Value> obj);
2029
+ static void CheckCast(v8::Value* obj);
1940
2030
  };
1941
2031
 
1942
2032
 
@@ -1951,7 +2041,7 @@ class V8EXPORT Template : public Data {
1951
2041
  /** Adds a property to each instance created by this template.*/
1952
2042
  void Set(Handle<String> name, Handle<Data> value,
1953
2043
  PropertyAttribute attributes = None);
1954
- inline void Set(const char* name, Handle<Data> value);
2044
+ V8_INLINE(void Set(const char* name, Handle<Data> value));
1955
2045
  private:
1956
2046
  Template();
1957
2047
 
@@ -1966,16 +2056,16 @@ class V8EXPORT Template : public Data {
1966
2056
  * including the receiver, the number and values of arguments, and
1967
2057
  * the holder of the function.
1968
2058
  */
1969
- class Arguments {
2059
+ class V8EXPORT Arguments {
1970
2060
  public:
1971
- inline int Length() const;
1972
- inline Local<Value> operator[](int i) const;
1973
- inline Local<Function> Callee() const;
1974
- inline Local<Object> This() const;
1975
- inline Local<Object> Holder() const;
1976
- inline bool IsConstructCall() const;
1977
- inline Local<Value> Data() const;
1978
- inline Isolate* GetIsolate() const;
2061
+ V8_INLINE(int Length() const);
2062
+ V8_INLINE(Local<Value> operator[](int i) const);
2063
+ V8_INLINE(Local<Function> Callee() const);
2064
+ V8_INLINE(Local<Object> This() const);
2065
+ V8_INLINE(Local<Object> Holder() const);
2066
+ V8_INLINE(bool IsConstructCall() const);
2067
+ V8_INLINE(Local<Value> Data() const);
2068
+ V8_INLINE(Isolate* GetIsolate() const);
1979
2069
 
1980
2070
  private:
1981
2071
  static const int kIsolateIndex = 0;
@@ -1984,10 +2074,10 @@ class Arguments {
1984
2074
  static const int kHolderIndex = -3;
1985
2075
 
1986
2076
  friend class ImplementationUtilities;
1987
- inline Arguments(internal::Object** implicit_args,
2077
+ V8_INLINE(Arguments(internal::Object** implicit_args,
1988
2078
  internal::Object** values,
1989
2079
  int length,
1990
- bool is_construct_call);
2080
+ bool is_construct_call));
1991
2081
  internal::Object** implicit_args_;
1992
2082
  internal::Object** values_;
1993
2083
  int length_;
@@ -2001,12 +2091,12 @@ class Arguments {
2001
2091
  */
2002
2092
  class V8EXPORT AccessorInfo {
2003
2093
  public:
2004
- inline AccessorInfo(internal::Object** args)
2094
+ V8_INLINE(AccessorInfo(internal::Object** args))
2005
2095
  : args_(args) { }
2006
- inline Isolate* GetIsolate() const;
2007
- inline Local<Value> Data() const;
2008
- inline Local<Object> This() const;
2009
- inline Local<Object> Holder() const;
2096
+ V8_INLINE(Isolate* GetIsolate() const);
2097
+ V8_INLINE(Local<Value> Data() const);
2098
+ V8_INLINE(Local<Object> This() const);
2099
+ V8_INLINE(Local<Object> Holder() const);
2010
2100
 
2011
2101
  private:
2012
2102
  internal::Object** args_;
@@ -2224,7 +2314,8 @@ class V8EXPORT FunctionTemplate : public Template {
2224
2314
  static Local<FunctionTemplate> New(
2225
2315
  InvocationCallback callback = 0,
2226
2316
  Handle<Value> data = Handle<Value>(),
2227
- Handle<Signature> signature = Handle<Signature>());
2317
+ Handle<Signature> signature = Handle<Signature>(),
2318
+ int length = 0);
2228
2319
  /** Returns the unique function instance in the current execution context.*/
2229
2320
  Local<Function> GetFunction();
2230
2321
 
@@ -2236,6 +2327,9 @@ class V8EXPORT FunctionTemplate : public Template {
2236
2327
  void SetCallHandler(InvocationCallback callback,
2237
2328
  Handle<Value> data = Handle<Value>());
2238
2329
 
2330
+ /** Set the predefined length property for the FunctionTemplate. */
2331
+ void SetLength(int length);
2332
+
2239
2333
  /** Get the InstanceTemplate. */
2240
2334
  Local<ObjectTemplate> InstanceTemplate();
2241
2335
 
@@ -2248,7 +2342,6 @@ class V8EXPORT FunctionTemplate : public Template {
2248
2342
  */
2249
2343
  Local<ObjectTemplate> PrototypeTemplate();
2250
2344
 
2251
-
2252
2345
  /**
2253
2346
  * Set the class name of the FunctionTemplate. This is used for
2254
2347
  * printing objects created with the function created from the
@@ -2289,7 +2382,8 @@ class V8EXPORT FunctionTemplate : public Template {
2289
2382
  AccessorSetter setter,
2290
2383
  Handle<Value> data,
2291
2384
  AccessControl settings,
2292
- PropertyAttribute attributes);
2385
+ PropertyAttribute attributes,
2386
+ Handle<AccessorSignature> signature);
2293
2387
  void SetNamedInstancePropertyHandler(NamedPropertyGetter getter,
2294
2388
  NamedPropertySetter setter,
2295
2389
  NamedPropertyQuery query,
@@ -2347,13 +2441,20 @@ class V8EXPORT ObjectTemplate : public Template {
2347
2441
  * cross-context access.
2348
2442
  * \param attribute The attributes of the property for which an accessor
2349
2443
  * is added.
2444
+ * \param signature The signature describes valid receivers for the accessor
2445
+ * and is used to perform implicit instance checks against them. If the
2446
+ * receiver is incompatible (i.e. is not an instance of the constructor as
2447
+ * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
2448
+ * thrown and no callback is invoked.
2350
2449
  */
2351
2450
  void SetAccessor(Handle<String> name,
2352
2451
  AccessorGetter getter,
2353
2452
  AccessorSetter setter = 0,
2354
2453
  Handle<Value> data = Handle<Value>(),
2355
2454
  AccessControl settings = DEFAULT,
2356
- PropertyAttribute attribute = None);
2455
+ PropertyAttribute attribute = None,
2456
+ Handle<AccessorSignature> signature =
2457
+ Handle<AccessorSignature>());
2357
2458
 
2358
2459
  /**
2359
2460
  * Sets a named property handler on the object template.
@@ -2457,8 +2558,8 @@ class V8EXPORT ObjectTemplate : public Template {
2457
2558
 
2458
2559
 
2459
2560
  /**
2460
- * A Signature specifies which receivers and arguments a function can
2461
- * legally be called with.
2561
+ * A Signature specifies which receivers and arguments are valid
2562
+ * parameters to a function.
2462
2563
  */
2463
2564
  class V8EXPORT Signature : public Data {
2464
2565
  public:
@@ -2471,6 +2572,19 @@ class V8EXPORT Signature : public Data {
2471
2572
  };
2472
2573
 
2473
2574
 
2575
+ /**
2576
+ * An AccessorSignature specifies which receivers are valid parameters
2577
+ * to an accessor callback.
2578
+ */
2579
+ class V8EXPORT AccessorSignature : public Data {
2580
+ public:
2581
+ static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
2582
+ Handle<FunctionTemplate>());
2583
+ private:
2584
+ AccessorSignature();
2585
+ };
2586
+
2587
+
2474
2588
  /**
2475
2589
  * A utility for determining the type of objects based on the template
2476
2590
  * they were constructed from.
@@ -2550,7 +2664,7 @@ void V8EXPORT RegisterExtension(Extension* extension);
2550
2664
  */
2551
2665
  class V8EXPORT DeclareExtension {
2552
2666
  public:
2553
- inline DeclareExtension(Extension* extension) {
2667
+ V8_INLINE(DeclareExtension(Extension* extension)) {
2554
2668
  RegisterExtension(extension);
2555
2669
  }
2556
2670
  };
@@ -2564,10 +2678,10 @@ Handle<Primitive> V8EXPORT Null();
2564
2678
  Handle<Boolean> V8EXPORT True();
2565
2679
  Handle<Boolean> V8EXPORT False();
2566
2680
 
2567
- inline Handle<Primitive> Undefined(Isolate* isolate);
2568
- inline Handle<Primitive> Null(Isolate* isolate);
2569
- inline Handle<Boolean> True(Isolate* isolate);
2570
- inline Handle<Boolean> False(Isolate* isolate);
2681
+ V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate));
2682
+ V8_INLINE(Handle<Primitive> Null(Isolate* isolate));
2683
+ V8_INLINE(Handle<Boolean> True(Isolate* isolate));
2684
+ V8_INLINE(Handle<Boolean> False(Isolate* isolate));
2571
2685
 
2572
2686
 
2573
2687
  /**
@@ -2608,7 +2722,7 @@ bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
2608
2722
  typedef void (*FatalErrorCallback)(const char* location, const char* message);
2609
2723
 
2610
2724
 
2611
- typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> data);
2725
+ typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error);
2612
2726
 
2613
2727
 
2614
2728
  /**
@@ -2721,6 +2835,7 @@ class V8EXPORT HeapStatistics {
2721
2835
  HeapStatistics();
2722
2836
  size_t total_heap_size() { return total_heap_size_; }
2723
2837
  size_t total_heap_size_executable() { return total_heap_size_executable_; }
2838
+ size_t total_physical_size() { return total_physical_size_; }
2724
2839
  size_t used_heap_size() { return used_heap_size_; }
2725
2840
  size_t heap_size_limit() { return heap_size_limit_; }
2726
2841
 
@@ -2729,11 +2844,15 @@ class V8EXPORT HeapStatistics {
2729
2844
  void set_total_heap_size_executable(size_t size) {
2730
2845
  total_heap_size_executable_ = size;
2731
2846
  }
2847
+ void set_total_physical_size(size_t size) {
2848
+ total_physical_size_ = size;
2849
+ }
2732
2850
  void set_used_heap_size(size_t size) { used_heap_size_ = size; }
2733
2851
  void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
2734
2852
 
2735
2853
  size_t total_heap_size_;
2736
2854
  size_t total_heap_size_executable_;
2855
+ size_t total_physical_size_;
2737
2856
  size_t used_heap_size_;
2738
2857
  size_t heap_size_limit_;
2739
2858
 
@@ -2819,13 +2938,13 @@ class V8EXPORT Isolate {
2819
2938
  /**
2820
2939
  * Associate embedder-specific data with the isolate
2821
2940
  */
2822
- inline void SetData(void* data);
2941
+ V8_INLINE(void SetData(void* data));
2823
2942
 
2824
2943
  /**
2825
2944
  * Retrieve embedder-specific data from the isolate.
2826
2945
  * Returns NULL if SetData has never been called.
2827
2946
  */
2828
- inline void* GetData();
2947
+ V8_INLINE(void* GetData());
2829
2948
 
2830
2949
  private:
2831
2950
  Isolate();
@@ -2837,7 +2956,7 @@ class V8EXPORT Isolate {
2837
2956
  };
2838
2957
 
2839
2958
 
2840
- class StartupData {
2959
+ class V8EXPORT StartupData {
2841
2960
  public:
2842
2961
  enum CompressionAlgorithm {
2843
2962
  kUncompressed,
@@ -2887,17 +3006,86 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
2887
3006
  * resolving the location of a return address on the stack. Profilers that
2888
3007
  * change the return address on the stack can use this to resolve the stack
2889
3008
  * location to whereever the profiler stashed the original return address.
2890
- * When invoked, return_addr_location will point to a location on stack where
2891
- * a machine return address resides, this function should return either the
2892
- * same pointer, or a pointer to the profiler's copy of the original return
2893
- * address.
3009
+ *
3010
+ * \param return_addr_location points to a location on stack where a machine
3011
+ * return address resides.
3012
+ * \returns either return_addr_location, or else a pointer to the profiler's
3013
+ * copy of the original return address.
3014
+ *
3015
+ * \note the resolver function must not cause garbage collection.
2894
3016
  */
2895
3017
  typedef uintptr_t (*ReturnAddressLocationResolver)(
2896
3018
  uintptr_t return_addr_location);
2897
3019
 
2898
3020
 
2899
3021
  /**
2900
- * Interface for iterating though all external resources in the heap.
3022
+ * FunctionEntryHook is the type of the profile entry hook called at entry to
3023
+ * any generated function when function-level profiling is enabled.
3024
+ *
3025
+ * \param function the address of the function that's being entered.
3026
+ * \param return_addr_location points to a location on stack where the machine
3027
+ * return address resides. This can be used to identify the caller of
3028
+ * \p function, and/or modified to divert execution when \p function exits.
3029
+ *
3030
+ * \note the entry hook must not cause garbage collection.
3031
+ */
3032
+ typedef void (*FunctionEntryHook)(uintptr_t function,
3033
+ uintptr_t return_addr_location);
3034
+
3035
+
3036
+ /**
3037
+ * A JIT code event is issued each time code is added, moved or removed.
3038
+ *
3039
+ * \note removal events are not currently issued.
3040
+ */
3041
+ struct JitCodeEvent {
3042
+ enum EventType {
3043
+ CODE_ADDED,
3044
+ CODE_MOVED,
3045
+ CODE_REMOVED
3046
+ };
3047
+
3048
+ // Type of event.
3049
+ EventType type;
3050
+ // Start of the instructions.
3051
+ void* code_start;
3052
+ // Size of the instructions.
3053
+ size_t code_len;
3054
+
3055
+ union {
3056
+ // Only valid for CODE_ADDED.
3057
+ struct {
3058
+ // Name of the object associated with the code, note that the string is
3059
+ // not zero-terminated.
3060
+ const char* str;
3061
+ // Number of chars in str.
3062
+ size_t len;
3063
+ } name;
3064
+ // New location of instructions. Only valid for CODE_MOVED.
3065
+ void* new_code_start;
3066
+ };
3067
+ };
3068
+
3069
+ /**
3070
+ * Option flags passed to the SetJitCodeEventHandler function.
3071
+ */
3072
+ enum JitCodeEventOptions {
3073
+ kJitCodeEventDefault = 0,
3074
+ // Generate callbacks for already existent code.
3075
+ kJitCodeEventEnumExisting = 1
3076
+ };
3077
+
3078
+
3079
+ /**
3080
+ * Callback function passed to SetJitCodeEventHandler.
3081
+ *
3082
+ * \param event code add, move or removal event.
3083
+ */
3084
+ typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
3085
+
3086
+
3087
+ /**
3088
+ * Interface for iterating through all external resources in the heap.
2901
3089
  */
2902
3090
  class V8EXPORT ExternalResourceVisitor { // NOLINT
2903
3091
  public:
@@ -2906,6 +3094,17 @@ class V8EXPORT ExternalResourceVisitor { // NOLINT
2906
3094
  };
2907
3095
 
2908
3096
 
3097
+ /**
3098
+ * Interface for iterating through all the persistent handles in the heap.
3099
+ */
3100
+ class V8EXPORT PersistentHandleVisitor { // NOLINT
3101
+ public:
3102
+ virtual ~PersistentHandleVisitor() {}
3103
+ virtual void VisitPersistentHandle(Persistent<Value> value,
3104
+ uint16_t class_id) {}
3105
+ };
3106
+
3107
+
2909
3108
  /**
2910
3109
  * Container class for static utility functions.
2911
3110
  */
@@ -2971,8 +3170,7 @@ class V8EXPORT V8 {
2971
3170
  * The same message listener can be added more than once and in that
2972
3171
  * case it will be called more than once for each message.
2973
3172
  */
2974
- static bool AddMessageListener(MessageCallback that,
2975
- Handle<Value> data = Handle<Value>());
3173
+ static bool AddMessageListener(MessageCallback that);
2976
3174
 
2977
3175
  /**
2978
3176
  * Remove all message listeners from the specified callback function.
@@ -3018,12 +3216,6 @@ class V8EXPORT V8 {
3018
3216
  static void SetCreateHistogramFunction(CreateHistogramCallback);
3019
3217
  static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
3020
3218
 
3021
- /**
3022
- * Enables the computation of a sliding window of states. The sliding
3023
- * window information is recorded in statistics counters.
3024
- */
3025
- static void EnableSlidingStateWindow();
3026
-
3027
3219
  /** Callback function for reporting failed access checks.*/
3028
3220
  static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
3029
3221
 
@@ -3054,7 +3246,7 @@ class V8EXPORT V8 {
3054
3246
  * or delete properties for example) since it is possible such
3055
3247
  * operations will result in the allocation of objects.
3056
3248
  */
3057
- static void SetGlobalGCPrologueCallback(GCCallback);
3249
+ V8_DEPRECATED(static void SetGlobalGCPrologueCallback(GCCallback));
3058
3250
 
3059
3251
  /**
3060
3252
  * Enables the host application to receive a notification after a
@@ -3083,7 +3275,7 @@ class V8EXPORT V8 {
3083
3275
  * or delete properties for example) since it is possible such
3084
3276
  * operations will result in the allocation of objects.
3085
3277
  */
3086
- static void SetGlobalGCEpilogueCallback(GCCallback);
3278
+ V8_DEPRECATED(static void SetGlobalGCEpilogueCallback(GCCallback));
3087
3279
 
3088
3280
  /**
3089
3281
  * Enables the host application to provide a mechanism to be notified
@@ -3118,12 +3310,19 @@ class V8EXPORT V8 {
3118
3310
  * After each garbage collection, object groups are removed. It is
3119
3311
  * intended to be used in the before-garbage-collection callback
3120
3312
  * function, for instance to simulate DOM tree connections among JS
3121
- * wrapper objects.
3313
+ * wrapper objects. Object groups for all dependent handles need to
3314
+ * be provided for kGCTypeMarkSweepCompact collections, for all other
3315
+ * garbage collection types it is sufficient to provide object groups
3316
+ * for partially dependent handles only.
3122
3317
  * See v8-profiler.h for RetainedObjectInfo interface description.
3123
3318
  */
3124
3319
  static void AddObjectGroup(Persistent<Value>* objects,
3125
3320
  size_t length,
3126
3321
  RetainedObjectInfo* info = NULL);
3322
+ static void AddObjectGroup(Isolate* isolate,
3323
+ Persistent<Value>* objects,
3324
+ size_t length,
3325
+ RetainedObjectInfo* info = NULL);
3127
3326
 
3128
3327
  /**
3129
3328
  * Allows the host application to declare implicit references between
@@ -3156,6 +3355,43 @@ class V8EXPORT V8 {
3156
3355
  static void SetReturnAddressLocationResolver(
3157
3356
  ReturnAddressLocationResolver return_address_resolver);
3158
3357
 
3358
+ /**
3359
+ * Allows the host application to provide the address of a function that's
3360
+ * invoked on entry to every V8-generated function.
3361
+ * Note that \p entry_hook is invoked at the very start of each
3362
+ * generated function.
3363
+ *
3364
+ * \param entry_hook a function that will be invoked on entry to every
3365
+ * V8-generated function.
3366
+ * \returns true on success on supported platforms, false on failure.
3367
+ * \note Setting a new entry hook function when one is already active will
3368
+ * fail.
3369
+ */
3370
+ static bool SetFunctionEntryHook(FunctionEntryHook entry_hook);
3371
+
3372
+ /**
3373
+ * Allows the host application to provide the address of a function that is
3374
+ * notified each time code is added, moved or removed.
3375
+ *
3376
+ * \param options options for the JIT code event handler.
3377
+ * \param event_handler the JIT code event handler, which will be invoked
3378
+ * each time code is added, moved or removed.
3379
+ * \note \p event_handler won't get notified of existent code.
3380
+ * \note since code removal notifications are not currently issued, the
3381
+ * \p event_handler may get notifications of code that overlaps earlier
3382
+ * code notifications. This happens when code areas are reused, and the
3383
+ * earlier overlapping code areas should therefore be discarded.
3384
+ * \note the events passed to \p event_handler and the strings they point to
3385
+ * are not guaranteed to live past each call. The \p event_handler must
3386
+ * copy strings and other parameters it needs to keep around.
3387
+ * \note the set of events declared in JitCodeEvent::EventType is expected to
3388
+ * grow over time, and the JitCodeEvent structure is expected to accrue
3389
+ * new members. The \p event_handler function must ignore event codes
3390
+ * it does not recognize to maintain future compatibility.
3391
+ */
3392
+ static void SetJitCodeEventHandler(JitCodeEventOptions options,
3393
+ JitCodeEventHandler event_handler);
3394
+
3159
3395
  /**
3160
3396
  * Adjusts the amount of registered external memory. Used to give
3161
3397
  * V8 an indication of the amount of externally allocated memory
@@ -3271,11 +3507,27 @@ class V8EXPORT V8 {
3271
3507
 
3272
3508
  /**
3273
3509
  * Iterates through all external resources referenced from current isolate
3274
- * heap. This method is not expected to be used except for debugging purposes
3275
- * and may be quite slow.
3510
+ * heap. GC is not invoked prior to iterating, therefore there is no
3511
+ * guarantee that visited objects are still alive.
3276
3512
  */
3277
3513
  static void VisitExternalResources(ExternalResourceVisitor* visitor);
3278
3514
 
3515
+ /**
3516
+ * Iterates through all the persistent handles in the current isolate's heap
3517
+ * that have class_ids.
3518
+ */
3519
+ static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
3520
+
3521
+ /**
3522
+ * Iterates through all the persistent handles in the current isolate's heap
3523
+ * that have class_ids and are candidates to be marked as partially dependent
3524
+ * handles. This will visit handles to young objects created since the last
3525
+ * garbage collection but is free to visit an arbitrary superset of these
3526
+ * objects.
3527
+ */
3528
+ static void VisitHandlesForPartialDependence(
3529
+ Isolate* isolate, PersistentHandleVisitor* visitor);
3530
+
3279
3531
  /**
3280
3532
  * Optional notification that the embedder is idle.
3281
3533
  * V8 uses the notification to reduce memory footprint.
@@ -3307,17 +3559,17 @@ class V8EXPORT V8 {
3307
3559
  private:
3308
3560
  V8();
3309
3561
 
3310
- static internal::Object** GlobalizeReference(internal::Object** handle);
3311
- static void DisposeGlobal(internal::Object** global_handle);
3312
- static void MakeWeak(internal::Object** global_handle,
3562
+ static internal::Object** GlobalizeReference(internal::Isolate* isolate,
3563
+ internal::Object** handle);
3564
+ static void DisposeGlobal(internal::Isolate* isolate,
3565
+ internal::Object** global_handle);
3566
+ static void MakeWeak(internal::Isolate* isolate,
3567
+ internal::Object** global_handle,
3313
3568
  void* data,
3314
- WeakReferenceCallback);
3315
- static void ClearWeak(internal::Object** global_handle);
3316
- static void MarkIndependent(internal::Object** global_handle);
3317
- static bool IsGlobalNearDeath(internal::Object** global_handle);
3318
- static bool IsGlobalWeak(internal::Object** global_handle);
3319
- static void SetWrapperClassId(internal::Object** global_handle,
3320
- uint16_t class_id);
3569
+ WeakReferenceCallback weak_reference_callback,
3570
+ NearDeathCallback near_death_callback);
3571
+ static void ClearWeak(internal::Isolate* isolate,
3572
+ internal::Object** global_handle);
3321
3573
 
3322
3574
  template <class T> friend class Handle;
3323
3575
  template <class T> friend class Local;
@@ -3332,7 +3584,9 @@ class V8EXPORT V8 {
3332
3584
  class V8EXPORT TryCatch {
3333
3585
  public:
3334
3586
  /**
3335
- * Creates a new try/catch block and registers it with v8.
3587
+ * Creates a new try/catch block and registers it with v8. Note that
3588
+ * all TryCatch blocks should be stack allocated because the memory
3589
+ * location itself is compared against JavaScript try/catch blocks.
3336
3590
  */
3337
3591
  TryCatch();
3338
3592
 
@@ -3422,6 +3676,12 @@ class V8EXPORT TryCatch {
3422
3676
  void SetCaptureMessage(bool value);
3423
3677
 
3424
3678
  private:
3679
+ // Make it hard to create heap-allocated TryCatch blocks.
3680
+ TryCatch(const TryCatch&);
3681
+ void operator=(const TryCatch&);
3682
+ void* operator new(size_t size);
3683
+ void operator delete(void*, size_t);
3684
+
3425
3685
  v8::internal::Isolate* isolate_;
3426
3686
  void* next_;
3427
3687
  void* exception_;
@@ -3562,13 +3822,37 @@ class V8EXPORT Context {
3562
3822
  /** Returns true if V8 has a current context. */
3563
3823
  static bool InContext();
3564
3824
 
3825
+ /** Returns an isolate associated with a current context. */
3826
+ v8::Isolate* GetIsolate();
3827
+
3565
3828
  /**
3566
- * Associate an additional data object with the context. This is mainly used
3567
- * with the debugger to provide additional information on the context through
3568
- * the debugger API.
3829
+ * Gets the embedder data with the given index, which must have been set by a
3830
+ * previous call to SetEmbedderData with the same index. Note that index 0
3831
+ * currently has a special meaning for Chrome's debugger.
3569
3832
  */
3570
- void SetData(Handle<String> data);
3571
- Local<Value> GetData();
3833
+ V8_INLINE(Local<Value> GetEmbedderData(int index));
3834
+
3835
+ /**
3836
+ * Sets the embedder data with the given index, growing the data as
3837
+ * needed. Note that index 0 currently has a special meaning for Chrome's
3838
+ * debugger.
3839
+ */
3840
+ void SetEmbedderData(int index, Handle<Value> value);
3841
+
3842
+ /**
3843
+ * Gets a 2-byte-aligned native pointer from the embedder data with the given
3844
+ * index, which must have bees set by a previous call to
3845
+ * SetAlignedPointerInEmbedderData with the same index. Note that index 0
3846
+ * currently has a special meaning for Chrome's debugger.
3847
+ */
3848
+ V8_INLINE(void* GetAlignedPointerFromEmbedderData(int index));
3849
+
3850
+ /**
3851
+ * Sets a 2-byte-aligned native pointer in the embedder data with the given
3852
+ * index, growing the data as needed. Note that index 0 currently has a
3853
+ * special meaning for Chrome's debugger.
3854
+ */
3855
+ void SetAlignedPointerInEmbedderData(int index, void* value);
3572
3856
 
3573
3857
  /**
3574
3858
  * Control whether code generation from strings is allowed. Calling
@@ -3591,16 +3875,23 @@ class V8EXPORT Context {
3591
3875
  */
3592
3876
  bool IsCodeGenerationFromStringsAllowed();
3593
3877
 
3878
+ /**
3879
+ * Sets the error description for the exception that is thrown when
3880
+ * code generation from strings is not allowed and 'eval' or the 'Function'
3881
+ * constructor are called.
3882
+ */
3883
+ void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message);
3884
+
3594
3885
  /**
3595
3886
  * Stack-allocated class which sets the execution context for all
3596
3887
  * operations executed within a local scope.
3597
3888
  */
3598
3889
  class Scope {
3599
3890
  public:
3600
- explicit inline Scope(Handle<Context> context) : context_(context) {
3891
+ explicit V8_INLINE(Scope(Handle<Context> context)) : context_(context) {
3601
3892
  context_->Enter();
3602
3893
  }
3603
- inline ~Scope() { context_->Exit(); }
3894
+ V8_INLINE(~Scope()) { context_->Exit(); }
3604
3895
  private:
3605
3896
  Handle<Context> context_;
3606
3897
  };
@@ -3610,25 +3901,26 @@ class V8EXPORT Context {
3610
3901
  friend class Script;
3611
3902
  friend class Object;
3612
3903
  friend class Function;
3904
+
3905
+ Local<Value> SlowGetEmbedderData(int index);
3906
+ void* SlowGetAlignedPointerFromEmbedderData(int index);
3613
3907
  };
3614
3908
 
3615
3909
 
3616
3910
  /**
3617
- * Multiple threads in V8 are allowed, but only one thread at a time
3618
- * is allowed to use any given V8 isolate. See Isolate class
3619
- * comments. The definition of 'using V8 isolate' includes
3620
- * accessing handles or holding onto object pointers obtained
3621
- * from V8 handles while in the particular V8 isolate. It is up
3622
- * to the user of V8 to ensure (perhaps with locking) that this
3623
- * constraint is not violated. In addition to any other synchronization
3624
- * mechanism that may be used, the v8::Locker and v8::Unlocker classes
3625
- * must be used to signal thead switches to V8.
3911
+ * Multiple threads in V8 are allowed, but only one thread at a time is allowed
3912
+ * to use any given V8 isolate, see the comments in the Isolate class. The
3913
+ * definition of 'using a V8 isolate' includes accessing handles or holding onto
3914
+ * object pointers obtained from V8 handles while in the particular V8 isolate.
3915
+ * It is up to the user of V8 to ensure, perhaps with locking, that this
3916
+ * constraint is not violated. In addition to any other synchronization
3917
+ * mechanism that may be used, the v8::Locker and v8::Unlocker classes must be
3918
+ * used to signal thead switches to V8.
3626
3919
  *
3627
- * v8::Locker is a scoped lock object. While it's
3628
- * active (i.e. between its construction and destruction) the current thread is
3629
- * allowed to use the locked isolate. V8 guarantees that an isolate can be
3630
- * locked by at most one thread at any time. In other words, the scope of a
3631
- * v8::Locker is a critical section.
3920
+ * v8::Locker is a scoped lock object. While it's active, i.e. between its
3921
+ * construction and destruction, the current thread is allowed to use the locked
3922
+ * isolate. V8 guarantees that an isolate can be locked by at most one thread at
3923
+ * any time. In other words, the scope of a v8::Locker is a critical section.
3632
3924
  *
3633
3925
  * Sample usage:
3634
3926
  * \code
@@ -3642,9 +3934,9 @@ class V8EXPORT Context {
3642
3934
  * } // Destructor called here
3643
3935
  * \endcode
3644
3936
  *
3645
- * If you wish to stop using V8 in a thread A you can do this either
3646
- * by destroying the v8::Locker object as above or by constructing a
3647
- * v8::Unlocker object:
3937
+ * If you wish to stop using V8 in a thread A you can do this either by
3938
+ * destroying the v8::Locker object as above or by constructing a v8::Unlocker
3939
+ * object:
3648
3940
  *
3649
3941
  * \code
3650
3942
  * {
@@ -3657,19 +3949,17 @@ class V8EXPORT Context {
3657
3949
  * isolate->Enter();
3658
3950
  * \endcode
3659
3951
  *
3660
- * The Unlocker object is intended for use in a long-running callback
3661
- * from V8, where you want to release the V8 lock for other threads to
3662
- * use.
3952
+ * The Unlocker object is intended for use in a long-running callback from V8,
3953
+ * where you want to release the V8 lock for other threads to use.
3663
3954
  *
3664
- * The v8::Locker is a recursive lock. That is, you can lock more than
3665
- * once in a given thread. This can be useful if you have code that can
3666
- * be called either from code that holds the lock or from code that does
3667
- * not. The Unlocker is not recursive so you can not have several
3668
- * Unlockers on the stack at once, and you can not use an Unlocker in a
3669
- * thread that is not inside a Locker's scope.
3955
+ * The v8::Locker is a recursive lock, i.e. you can lock more than once in a
3956
+ * given thread. This can be useful if you have code that can be called either
3957
+ * from code that holds the lock or from code that does not. The Unlocker is
3958
+ * not recursive so you can not have several Unlockers on the stack at once, and
3959
+ * you can not use an Unlocker in a thread that is not inside a Locker's scope.
3670
3960
  *
3671
- * An unlocker will unlock several lockers if it has to and reinstate
3672
- * the correct depth of locking on its destruction. eg.:
3961
+ * An unlocker will unlock several lockers if it has to and reinstate the
3962
+ * correct depth of locking on its destruction, e.g.:
3673
3963
  *
3674
3964
  * \code
3675
3965
  * // V8 not locked.
@@ -3692,17 +3982,21 @@ class V8EXPORT Context {
3692
3982
  * }
3693
3983
  * // V8 Now no longer locked.
3694
3984
  * \endcode
3695
- *
3696
- *
3697
3985
  */
3698
3986
  class V8EXPORT Unlocker {
3699
3987
  public:
3700
3988
  /**
3701
- * Initialize Unlocker for a given Isolate. NULL means default isolate.
3989
+ * Initialize Unlocker for a given Isolate.
3702
3990
  */
3703
- explicit Unlocker(Isolate* isolate = NULL);
3991
+ V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); }
3992
+
3993
+ /** Deprecated. Use Isolate version instead. */
3994
+ V8_DEPRECATED(Unlocker());
3995
+
3704
3996
  ~Unlocker();
3705
3997
  private:
3998
+ void Initialize(Isolate* isolate);
3999
+
3706
4000
  internal::Isolate* isolate_;
3707
4001
  };
3708
4002
 
@@ -3710,9 +4004,13 @@ class V8EXPORT Unlocker {
3710
4004
  class V8EXPORT Locker {
3711
4005
  public:
3712
4006
  /**
3713
- * Initialize Locker for a given Isolate. NULL means default isolate.
4007
+ * Initialize Locker for a given Isolate.
3714
4008
  */
3715
- explicit Locker(Isolate* isolate = NULL);
4009
+ V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); }
4010
+
4011
+ /** Deprecated. Use Isolate version instead. */
4012
+ V8_DEPRECATED(Locker());
4013
+
3716
4014
  ~Locker();
3717
4015
 
3718
4016
  /**
@@ -3730,10 +4028,10 @@ class V8EXPORT Locker {
3730
4028
  static void StopPreemption();
3731
4029
 
3732
4030
  /**
3733
- * Returns whether or not the locker for a given isolate, or default isolate
3734
- * if NULL is given, is locked by the current thread.
4031
+ * Returns whether or not the locker for a given isolate, is locked by the
4032
+ * current thread.
3735
4033
  */
3736
- static bool IsLocked(Isolate* isolate = NULL);
4034
+ static bool IsLocked(Isolate* isolate);
3737
4035
 
3738
4036
  /**
3739
4037
  * Returns whether v8::Locker is being used by this V8 instance.
@@ -3741,6 +4039,8 @@ class V8EXPORT Locker {
3741
4039
  static bool IsActive();
3742
4040
 
3743
4041
  private:
4042
+ void Initialize(Isolate* isolate);
4043
+
3744
4044
  bool has_lock_;
3745
4045
  bool top_level_;
3746
4046
  internal::Isolate* isolate_;
@@ -3838,47 +4138,27 @@ template <size_t ptr_size> struct SmiTagging;
3838
4138
  template <> struct SmiTagging<4> {
3839
4139
  static const int kSmiShiftSize = 0;
3840
4140
  static const int kSmiValueSize = 31;
3841
- static inline int SmiToInt(internal::Object* value) {
4141
+ V8_INLINE(static int SmiToInt(internal::Object* value)) {
3842
4142
  int shift_bits = kSmiTagSize + kSmiShiftSize;
3843
4143
  // Throw away top 32 bits and shift down (requires >> to be sign extending).
3844
4144
  return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits;
3845
4145
  }
3846
-
3847
- // For 32-bit systems any 2 bytes aligned pointer can be encoded as smi
3848
- // with a plain reinterpret_cast.
3849
- static const uintptr_t kEncodablePointerMask = 0x1;
3850
- static const int kPointerToSmiShift = 0;
3851
4146
  };
3852
4147
 
3853
4148
  // Smi constants for 64-bit systems.
3854
4149
  template <> struct SmiTagging<8> {
3855
4150
  static const int kSmiShiftSize = 31;
3856
4151
  static const int kSmiValueSize = 32;
3857
- static inline int SmiToInt(internal::Object* value) {
4152
+ V8_INLINE(static int SmiToInt(internal::Object* value)) {
3858
4153
  int shift_bits = kSmiTagSize + kSmiShiftSize;
3859
4154
  // Shift down and throw away top 32 bits.
3860
4155
  return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits);
3861
4156
  }
3862
-
3863
- // To maximize the range of pointers that can be encoded
3864
- // in the available 32 bits, we require them to be 8 bytes aligned.
3865
- // This gives 2 ^ (32 + 3) = 32G address space covered.
3866
- // It might be not enough to cover stack allocated objects on some platforms.
3867
- static const int kPointerAlignment = 3;
3868
-
3869
- static const uintptr_t kEncodablePointerMask =
3870
- ~(uintptr_t(0xffffffff) << kPointerAlignment);
3871
-
3872
- static const int kPointerToSmiShift =
3873
- kSmiTagSize + kSmiShiftSize - kPointerAlignment;
3874
4157
  };
3875
4158
 
3876
4159
  typedef SmiTagging<kApiPointerSize> PlatformSmiTagging;
3877
4160
  const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
3878
4161
  const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
3879
- const uintptr_t kEncodablePointerMask =
3880
- PlatformSmiTagging::kEncodablePointerMask;
3881
- const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;
3882
4162
 
3883
4163
  /**
3884
4164
  * This class exports constants and functionality from within v8 that
@@ -3896,8 +4176,13 @@ class Internals {
3896
4176
  static const int kOddballKindOffset = 3 * kApiPointerSize;
3897
4177
  static const int kForeignAddressOffset = kApiPointerSize;
3898
4178
  static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
4179
+ static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
4180
+ static const int kContextHeaderSize = 2 * kApiPointerSize;
4181
+ static const int kContextEmbedderDataIndex = 54;
3899
4182
  static const int kFullStringRepresentationMask = 0x07;
4183
+ static const int kStringEncodingMask = 0x4;
3900
4184
  static const int kExternalTwoByteRepresentationTag = 0x02;
4185
+ static const int kExternalAsciiRepresentationTag = 0x06;
3901
4186
 
3902
4187
  static const int kIsolateStateOffset = 0;
3903
4188
  static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
@@ -3906,9 +4191,17 @@ class Internals {
3906
4191
  static const int kNullValueRootIndex = 7;
3907
4192
  static const int kTrueValueRootIndex = 8;
3908
4193
  static const int kFalseValueRootIndex = 9;
3909
- static const int kEmptySymbolRootIndex = 128;
4194
+ static const int kEmptySymbolRootIndex = 119;
4195
+
4196
+ static const int kNodeClassIdOffset = 1 * kApiPointerSize;
4197
+ static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
4198
+ static const int kNodeStateMask = 0xf;
4199
+ static const int kNodeStateIsWeakValue = 2;
4200
+ static const int kNodeStateIsNearDeathValue = 4;
4201
+ static const int kNodeIsIndependentShift = 4;
4202
+ static const int kNodeIsPartiallyDependentShift = 5;
3910
4203
 
3911
- static const int kJSObjectType = 0xaa;
4204
+ static const int kJSObjectType = 0xab;
3912
4205
  static const int kFirstNonstringType = 0x80;
3913
4206
  static const int kOddballType = 0x82;
3914
4207
  static const int kForeignType = 0x85;
@@ -3916,85 +4209,103 @@ class Internals {
3916
4209
  static const int kUndefinedOddballKind = 5;
3917
4210
  static const int kNullOddballKind = 3;
3918
4211
 
3919
- static inline bool HasHeapObjectTag(internal::Object* value) {
4212
+ V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) {
3920
4213
  return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
3921
4214
  kHeapObjectTag);
3922
4215
  }
3923
4216
 
3924
- static inline bool HasSmiTag(internal::Object* value) {
3925
- return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag);
3926
- }
3927
-
3928
- static inline int SmiValue(internal::Object* value) {
4217
+ V8_INLINE(static int SmiValue(internal::Object* value)) {
3929
4218
  return PlatformSmiTagging::SmiToInt(value);
3930
4219
  }
3931
4220
 
3932
- static inline int GetInstanceType(internal::Object* obj) {
4221
+ V8_INLINE(static int GetInstanceType(internal::Object* obj)) {
3933
4222
  typedef internal::Object O;
3934
4223
  O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
3935
4224
  return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
3936
4225
  }
3937
4226
 
3938
- static inline int GetOddballKind(internal::Object* obj) {
4227
+ V8_INLINE(static int GetOddballKind(internal::Object* obj)) {
3939
4228
  typedef internal::Object O;
3940
4229
  return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
3941
4230
  }
3942
4231
 
3943
- static inline void* GetExternalPointerFromSmi(internal::Object* value) {
3944
- const uintptr_t address = reinterpret_cast<uintptr_t>(value);
3945
- return reinterpret_cast<void*>(address >> kPointerToSmiShift);
3946
- }
3947
-
3948
- static inline void* GetExternalPointer(internal::Object* obj) {
3949
- if (HasSmiTag(obj)) {
3950
- return GetExternalPointerFromSmi(obj);
3951
- } else if (GetInstanceType(obj) == kForeignType) {
3952
- return ReadField<void*>(obj, kForeignAddressOffset);
3953
- } else {
3954
- return NULL;
3955
- }
3956
- }
3957
-
3958
- static inline bool IsExternalTwoByteString(int instance_type) {
4232
+ V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) {
3959
4233
  int representation = (instance_type & kFullStringRepresentationMask);
3960
4234
  return representation == kExternalTwoByteRepresentationTag;
3961
4235
  }
3962
4236
 
3963
- static inline bool IsInitialized(v8::Isolate* isolate) {
4237
+ V8_INLINE(static bool IsInitialized(v8::Isolate* isolate)) {
3964
4238
  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
3965
4239
  return *reinterpret_cast<int*>(addr) == 1;
3966
4240
  }
3967
4241
 
3968
- static inline void SetEmbedderData(v8::Isolate* isolate, void* data) {
4242
+ V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
4243
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
4244
+ return *addr & (1 << shift);
4245
+ }
4246
+
4247
+ V8_INLINE(static void UpdateNodeFlag(internal::Object** obj,
4248
+ bool value, int shift)) {
4249
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
4250
+ uint8_t mask = 1 << shift;
4251
+ *addr = (*addr & ~mask) | (value << shift);
4252
+ }
4253
+
4254
+ V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) {
4255
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
4256
+ return *addr & kNodeStateMask;
4257
+ }
4258
+
4259
+ V8_INLINE(static void UpdateNodeState(internal::Object** obj,
4260
+ uint8_t value)) {
4261
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
4262
+ *addr = (*addr & ~kNodeStateMask) | value;
4263
+ }
4264
+
4265
+ V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) {
3969
4266
  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3970
4267
  kIsolateEmbedderDataOffset;
3971
4268
  *reinterpret_cast<void**>(addr) = data;
3972
4269
  }
3973
4270
 
3974
- static inline void* GetEmbedderData(v8::Isolate* isolate) {
4271
+ V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) {
3975
4272
  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3976
4273
  kIsolateEmbedderDataOffset;
3977
4274
  return *reinterpret_cast<void**>(addr);
3978
4275
  }
3979
4276
 
3980
- static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) {
4277
+ V8_INLINE(static internal::Object** GetRoot(v8::Isolate* isolate,
4278
+ int index)) {
3981
4279
  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
3982
4280
  return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
3983
4281
  }
3984
4282
 
3985
4283
  template <typename T>
3986
- static inline T ReadField(Object* ptr, int offset) {
4284
+ V8_INLINE(static T ReadField(Object* ptr, int offset)) {
3987
4285
  uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
3988
4286
  return *reinterpret_cast<T*>(addr);
3989
4287
  }
3990
4288
 
3991
- static inline bool CanCastToHeapObject(void* o) { return false; }
3992
- static inline bool CanCastToHeapObject(Context* o) { return true; }
3993
- static inline bool CanCastToHeapObject(String* o) { return true; }
3994
- static inline bool CanCastToHeapObject(Object* o) { return true; }
3995
- static inline bool CanCastToHeapObject(Message* o) { return true; }
3996
- static inline bool CanCastToHeapObject(StackTrace* o) { return true; }
3997
- static inline bool CanCastToHeapObject(StackFrame* o) { return true; }
4289
+ template <typename T>
4290
+ V8_INLINE(static T ReadEmbedderData(Context* context, int index)) {
4291
+ typedef internal::Object O;
4292
+ typedef internal::Internals I;
4293
+ O* ctx = *reinterpret_cast<O**>(context);
4294
+ int embedder_data_offset = I::kContextHeaderSize +
4295
+ (internal::kApiPointerSize * I::kContextEmbedderDataIndex);
4296
+ O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset);
4297
+ int value_offset =
4298
+ I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index);
4299
+ return I::ReadField<T>(embedder_data, value_offset);
4300
+ }
4301
+
4302
+ V8_INLINE(static bool CanCastToHeapObject(void* o)) { return false; }
4303
+ V8_INLINE(static bool CanCastToHeapObject(Context* o)) { return true; }
4304
+ V8_INLINE(static bool CanCastToHeapObject(String* o)) { return true; }
4305
+ V8_INLINE(static bool CanCastToHeapObject(Object* o)) { return true; }
4306
+ V8_INLINE(static bool CanCastToHeapObject(Message* o)) { return true; }
4307
+ V8_INLINE(static bool CanCastToHeapObject(StackTrace* o)) { return true; }
4308
+ V8_INLINE(static bool CanCastToHeapObject(StackFrame* o)) { return true; }
3998
4309
  };
3999
4310
 
4000
4311
  } // namespace internal
@@ -4017,32 +4328,91 @@ Local<T> Local<T>::New(Handle<T> that) {
4017
4328
  }
4018
4329
 
4019
4330
 
4331
+ template <class T>
4332
+ Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) {
4333
+ if (that.IsEmpty()) return Local<T>();
4334
+ T* that_ptr = *that;
4335
+ internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
4336
+ return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
4337
+ reinterpret_cast<internal::Isolate*>(isolate), *p)));
4338
+ }
4339
+
4340
+
4020
4341
  template <class T>
4021
4342
  Persistent<T> Persistent<T>::New(Handle<T> that) {
4343
+ return New(Isolate::GetCurrent(), that);
4344
+ }
4345
+
4346
+
4347
+ template <class T>
4348
+ Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) {
4022
4349
  if (that.IsEmpty()) return Persistent<T>();
4023
4350
  internal::Object** p = reinterpret_cast<internal::Object**>(*that);
4024
- return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p)));
4351
+ return Persistent<T>(reinterpret_cast<T*>(
4352
+ V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
4353
+ p)));
4354
+ }
4355
+
4356
+
4357
+ template <class T>
4358
+ bool Persistent<T>::IsIndependent() const {
4359
+ return IsIndependent(Isolate::GetCurrent());
4360
+ }
4361
+
4362
+
4363
+ template <class T>
4364
+ bool Persistent<T>::IsIndependent(Isolate* isolate) const {
4365
+ typedef internal::Internals I;
4366
+ if (this->IsEmpty()) return false;
4367
+ if (!I::IsInitialized(isolate)) return false;
4368
+ return I::GetNodeFlag(reinterpret_cast<internal::Object**>(**this),
4369
+ I::kNodeIsIndependentShift);
4025
4370
  }
4026
4371
 
4027
4372
 
4028
4373
  template <class T>
4029
4374
  bool Persistent<T>::IsNearDeath() const {
4375
+ return IsNearDeath(Isolate::GetCurrent());
4376
+ }
4377
+
4378
+
4379
+ template <class T>
4380
+ bool Persistent<T>::IsNearDeath(Isolate* isolate) const {
4381
+ typedef internal::Internals I;
4030
4382
  if (this->IsEmpty()) return false;
4031
- return V8::IsGlobalNearDeath(reinterpret_cast<internal::Object**>(**this));
4383
+ if (!I::IsInitialized(isolate)) return false;
4384
+ return I::GetNodeState(reinterpret_cast<internal::Object**>(**this)) ==
4385
+ I::kNodeStateIsNearDeathValue;
4032
4386
  }
4033
4387
 
4034
4388
 
4035
4389
  template <class T>
4036
4390
  bool Persistent<T>::IsWeak() const {
4391
+ return IsWeak(Isolate::GetCurrent());
4392
+ }
4393
+
4394
+
4395
+ template <class T>
4396
+ bool Persistent<T>::IsWeak(Isolate* isolate) const {
4397
+ typedef internal::Internals I;
4037
4398
  if (this->IsEmpty()) return false;
4038
- return V8::IsGlobalWeak(reinterpret_cast<internal::Object**>(**this));
4399
+ if (!I::IsInitialized(isolate)) return false;
4400
+ return I::GetNodeState(reinterpret_cast<internal::Object**>(**this)) ==
4401
+ I::kNodeStateIsWeakValue;
4039
4402
  }
4040
4403
 
4041
4404
 
4042
4405
  template <class T>
4043
4406
  void Persistent<T>::Dispose() {
4407
+ Dispose(Isolate::GetCurrent());
4408
+ }
4409
+
4410
+
4411
+ template <class T>
4412
+ void Persistent<T>::Dispose(Isolate* isolate) {
4044
4413
  if (this->IsEmpty()) return;
4045
- V8::DisposeGlobal(reinterpret_cast<internal::Object**>(**this));
4414
+ V8::DisposeGlobal(reinterpret_cast<internal::Isolate*>(isolate),
4415
+ reinterpret_cast<internal::Object**>(**this));
4046
4416
  }
4047
4417
 
4048
4418
 
@@ -4051,24 +4421,94 @@ Persistent<T>::Persistent() : Handle<T>() { }
4051
4421
 
4052
4422
  template <class T>
4053
4423
  void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) {
4054
- V8::MakeWeak(reinterpret_cast<internal::Object**>(**this),
4424
+ Isolate* isolate = Isolate::GetCurrent();
4425
+ V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate),
4426
+ reinterpret_cast<internal::Object**>(**this),
4055
4427
  parameters,
4428
+ callback,
4429
+ NULL);
4430
+ }
4431
+
4432
+ template <class T>
4433
+ void Persistent<T>::MakeWeak(Isolate* isolate,
4434
+ void* parameters,
4435
+ NearDeathCallback callback) {
4436
+ V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate),
4437
+ reinterpret_cast<internal::Object**>(**this),
4438
+ parameters,
4439
+ NULL,
4056
4440
  callback);
4057
4441
  }
4058
4442
 
4059
4443
  template <class T>
4060
4444
  void Persistent<T>::ClearWeak() {
4061
- V8::ClearWeak(reinterpret_cast<internal::Object**>(**this));
4445
+ ClearWeak(Isolate::GetCurrent());
4446
+ }
4447
+
4448
+ template <class T>
4449
+ void Persistent<T>::ClearWeak(Isolate* isolate) {
4450
+ V8::ClearWeak(reinterpret_cast<internal::Isolate*>(isolate),
4451
+ reinterpret_cast<internal::Object**>(**this));
4062
4452
  }
4063
4453
 
4064
4454
  template <class T>
4065
4455
  void Persistent<T>::MarkIndependent() {
4066
- V8::MarkIndependent(reinterpret_cast<internal::Object**>(**this));
4456
+ MarkIndependent(Isolate::GetCurrent());
4457
+ }
4458
+
4459
+ template <class T>
4460
+ void Persistent<T>::MarkIndependent(Isolate* isolate) {
4461
+ typedef internal::Internals I;
4462
+ if (this->IsEmpty()) return;
4463
+ if (!I::IsInitialized(isolate)) return;
4464
+ I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(**this),
4465
+ true,
4466
+ I::kNodeIsIndependentShift);
4467
+ }
4468
+
4469
+ template <class T>
4470
+ void Persistent<T>::MarkPartiallyDependent() {
4471
+ MarkPartiallyDependent(Isolate::GetCurrent());
4472
+ }
4473
+
4474
+ template <class T>
4475
+ void Persistent<T>::MarkPartiallyDependent(Isolate* isolate) {
4476
+ typedef internal::Internals I;
4477
+ if (this->IsEmpty()) return;
4478
+ if (!I::IsInitialized(isolate)) return;
4479
+ I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(**this),
4480
+ true,
4481
+ I::kNodeIsPartiallyDependentShift);
4067
4482
  }
4068
4483
 
4069
4484
  template <class T>
4070
4485
  void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
4071
- V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id);
4486
+ SetWrapperClassId(Isolate::GetCurrent(), class_id);
4487
+ }
4488
+
4489
+ template <class T>
4490
+ void Persistent<T>::SetWrapperClassId(Isolate* isolate, uint16_t class_id) {
4491
+ typedef internal::Internals I;
4492
+ if (this->IsEmpty()) return;
4493
+ if (!I::IsInitialized(isolate)) return;
4494
+ internal::Object** obj = reinterpret_cast<internal::Object**>(**this);
4495
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
4496
+ *reinterpret_cast<uint16_t*>(addr) = class_id;
4497
+ }
4498
+
4499
+ template <class T>
4500
+ uint16_t Persistent<T>::WrapperClassId() const {
4501
+ return WrapperClassId(Isolate::GetCurrent());
4502
+ }
4503
+
4504
+ template <class T>
4505
+ uint16_t Persistent<T>::WrapperClassId(Isolate* isolate) const {
4506
+ typedef internal::Internals I;
4507
+ if (this->IsEmpty()) return 0;
4508
+ if (!I::IsInitialized(isolate)) return 0;
4509
+ internal::Object** obj = reinterpret_cast<internal::Object**>(**this);
4510
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
4511
+ return *reinterpret_cast<uint16_t*>(addr);
4072
4512
  }
4073
4513
 
4074
4514
  Arguments::Arguments(internal::Object** implicit_args,
@@ -4157,63 +4597,35 @@ void Template::Set(const char* name, v8::Handle<Data> value) {
4157
4597
 
4158
4598
  Local<Value> Object::GetInternalField(int index) {
4159
4599
  #ifndef V8_ENABLE_CHECKS
4160
- Local<Value> quick_result = UncheckedGetInternalField(index);
4161
- if (!quick_result.IsEmpty()) return quick_result;
4162
- #endif
4163
- return CheckedGetInternalField(index);
4164
- }
4165
-
4166
-
4167
- Local<Value> Object::UncheckedGetInternalField(int index) {
4168
4600
  typedef internal::Object O;
4169
4601
  typedef internal::Internals I;
4170
4602
  O* obj = *reinterpret_cast<O**>(this);
4603
+ // Fast path: If the object is a plain JSObject, which is the common case, we
4604
+ // know where to find the internal fields and can return the value directly.
4171
4605
  if (I::GetInstanceType(obj) == I::kJSObjectType) {
4172
- // If the object is a plain JSObject, which is the common case,
4173
- // we know where to find the internal fields and can return the
4174
- // value directly.
4175
4606
  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
4176
4607
  O* value = I::ReadField<O*>(obj, offset);
4177
4608
  O** result = HandleScope::CreateHandle(value);
4178
4609
  return Local<Value>(reinterpret_cast<Value*>(result));
4179
- } else {
4180
- return Local<Value>();
4181
4610
  }
4182
- }
4183
-
4184
-
4185
- void* External::Unwrap(Handle<v8::Value> obj) {
4186
- #ifdef V8_ENABLE_CHECKS
4187
- return FullUnwrap(obj);
4188
- #else
4189
- return QuickUnwrap(obj);
4190
4611
  #endif
4612
+ return SlowGetInternalField(index);
4191
4613
  }
4192
4614
 
4193
4615
 
4194
- void* External::QuickUnwrap(Handle<v8::Value> wrapper) {
4195
- typedef internal::Object O;
4196
- O* obj = *reinterpret_cast<O**>(const_cast<v8::Value*>(*wrapper));
4197
- return internal::Internals::GetExternalPointer(obj);
4198
- }
4199
-
4200
-
4201
- void* Object::GetPointerFromInternalField(int index) {
4616
+ void* Object::GetAlignedPointerFromInternalField(int index) {
4617
+ #ifndef V8_ENABLE_CHECKS
4202
4618
  typedef internal::Object O;
4203
4619
  typedef internal::Internals I;
4204
-
4205
4620
  O* obj = *reinterpret_cast<O**>(this);
4206
-
4621
+ // Fast path: If the object is a plain JSObject, which is the common case, we
4622
+ // know where to find the internal fields and can return the value directly.
4207
4623
  if (I::GetInstanceType(obj) == I::kJSObjectType) {
4208
- // If the object is a plain JSObject, which is the common case,
4209
- // we know where to find the internal fields and can return the
4210
- // value directly.
4211
4624
  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
4212
- O* value = I::ReadField<O*>(obj, offset);
4213
- return I::GetExternalPointer(value);
4625
+ return I::ReadField<void*>(obj, offset);
4214
4626
  }
4215
-
4216
- return SlowGetPointerFromInternalField(index);
4627
+ #endif
4628
+ return SlowGetAlignedPointerFromInternalField(index);
4217
4629
  }
4218
4630
 
4219
4631
 
@@ -4252,6 +4664,26 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
4252
4664
  }
4253
4665
 
4254
4666
 
4667
+ String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
4668
+ String::Encoding* encoding_out) const {
4669
+ typedef internal::Object O;
4670
+ typedef internal::Internals I;
4671
+ O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
4672
+ int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
4673
+ *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
4674
+ ExternalStringResourceBase* resource = NULL;
4675
+ if (type == I::kExternalAsciiRepresentationTag ||
4676
+ type == I::kExternalTwoByteRepresentationTag) {
4677
+ void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
4678
+ resource = static_cast<ExternalStringResourceBase*>(value);
4679
+ }
4680
+ #ifdef V8_ENABLE_CHECKS
4681
+ VerifyExternalStringResourceBase(resource, *encoding_out);
4682
+ #endif
4683
+ return resource;
4684
+ }
4685
+
4686
+
4255
4687
  bool Value::IsUndefined() const {
4256
4688
  #ifdef V8_ENABLE_CHECKS
4257
4689
  return FullIsUndefined();
@@ -4461,6 +4893,28 @@ void* Isolate::GetData() {
4461
4893
  }
4462
4894
 
4463
4895
 
4896
+ Local<Value> Context::GetEmbedderData(int index) {
4897
+ #ifndef V8_ENABLE_CHECKS
4898
+ typedef internal::Object O;
4899
+ typedef internal::Internals I;
4900
+ O** result = HandleScope::CreateHandle(I::ReadEmbedderData<O*>(this, index));
4901
+ return Local<Value>(reinterpret_cast<Value*>(result));
4902
+ #else
4903
+ return SlowGetEmbedderData(index);
4904
+ #endif
4905
+ }
4906
+
4907
+
4908
+ void* Context::GetAlignedPointerFromEmbedderData(int index) {
4909
+ #ifndef V8_ENABLE_CHECKS
4910
+ typedef internal::Internals I;
4911
+ return I::ReadEmbedderData<void*>(this, index);
4912
+ #else
4913
+ return SlowGetAlignedPointerFromEmbedderData(index);
4914
+ #endif
4915
+ }
4916
+
4917
+
4464
4918
  /**
4465
4919
  * \example shell.cc
4466
4920
  * A simple shell that takes a list of expressions on the