libv8-sgonyea 3.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (500) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +76 -0
  5. data/Rakefile +113 -0
  6. data/ext/libv8/extconf.rb +28 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +30 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/v8/.gitignore +35 -0
  12. data/lib/libv8/v8/AUTHORS +44 -0
  13. data/lib/libv8/v8/ChangeLog +2839 -0
  14. data/lib/libv8/v8/LICENSE +52 -0
  15. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  16. data/lib/libv8/v8/LICENSE.v8 +26 -0
  17. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  18. data/lib/libv8/v8/SConstruct +1478 -0
  19. data/lib/libv8/v8/build/README.txt +49 -0
  20. data/lib/libv8/v8/build/all.gyp +18 -0
  21. data/lib/libv8/v8/build/armu.gypi +32 -0
  22. data/lib/libv8/v8/build/common.gypi +144 -0
  23. data/lib/libv8/v8/build/gyp_v8 +145 -0
  24. data/lib/libv8/v8/include/v8-debug.h +395 -0
  25. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  26. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  27. data/lib/libv8/v8/include/v8-testing.h +104 -0
  28. data/lib/libv8/v8/include/v8.h +4124 -0
  29. data/lib/libv8/v8/include/v8stdint.h +53 -0
  30. data/lib/libv8/v8/preparser/SConscript +38 -0
  31. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  32. data/lib/libv8/v8/src/SConscript +368 -0
  33. data/lib/libv8/v8/src/accessors.cc +767 -0
  34. data/lib/libv8/v8/src/accessors.h +123 -0
  35. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  36. data/lib/libv8/v8/src/allocation.cc +122 -0
  37. data/lib/libv8/v8/src/allocation.h +143 -0
  38. data/lib/libv8/v8/src/api.cc +5845 -0
  39. data/lib/libv8/v8/src/api.h +574 -0
  40. data/lib/libv8/v8/src/apinatives.js +110 -0
  41. data/lib/libv8/v8/src/apiutils.h +73 -0
  42. data/lib/libv8/v8/src/arguments.h +118 -0
  43. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  44. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  45. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  46. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  47. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  48. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  49. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  50. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  51. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  52. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  53. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  54. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  55. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  56. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  57. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  58. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  59. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  60. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  61. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  62. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  63. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  64. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  65. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  66. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  67. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  68. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  69. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  70. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  71. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  72. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  73. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  74. data/lib/libv8/v8/src/array.js +1366 -0
  75. data/lib/libv8/v8/src/assembler.cc +1207 -0
  76. data/lib/libv8/v8/src/assembler.h +858 -0
  77. data/lib/libv8/v8/src/ast-inl.h +112 -0
  78. data/lib/libv8/v8/src/ast.cc +1146 -0
  79. data/lib/libv8/v8/src/ast.h +2188 -0
  80. data/lib/libv8/v8/src/atomicops.h +167 -0
  81. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  82. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  83. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  84. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  85. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  86. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  87. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  88. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  89. data/lib/libv8/v8/src/bignum.cc +768 -0
  90. data/lib/libv8/v8/src/bignum.h +140 -0
  91. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  92. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  93. data/lib/libv8/v8/src/builtins.cc +1707 -0
  94. data/lib/libv8/v8/src/builtins.h +371 -0
  95. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  96. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  97. data/lib/libv8/v8/src/cached-powers.h +65 -0
  98. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  99. data/lib/libv8/v8/src/char-predicates.h +67 -0
  100. data/lib/libv8/v8/src/checks.cc +110 -0
  101. data/lib/libv8/v8/src/checks.h +296 -0
  102. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  103. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  104. data/lib/libv8/v8/src/circular-queue.h +103 -0
  105. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  106. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  107. data/lib/libv8/v8/src/code.h +70 -0
  108. data/lib/libv8/v8/src/codegen.cc +231 -0
  109. data/lib/libv8/v8/src/codegen.h +84 -0
  110. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  111. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  112. data/lib/libv8/v8/src/compiler.cc +786 -0
  113. data/lib/libv8/v8/src/compiler.h +312 -0
  114. data/lib/libv8/v8/src/contexts.cc +347 -0
  115. data/lib/libv8/v8/src/contexts.h +391 -0
  116. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  117. data/lib/libv8/v8/src/conversions.cc +1131 -0
  118. data/lib/libv8/v8/src/conversions.h +135 -0
  119. data/lib/libv8/v8/src/counters.cc +93 -0
  120. data/lib/libv8/v8/src/counters.h +254 -0
  121. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  122. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  123. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  124. data/lib/libv8/v8/src/cpu.h +69 -0
  125. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  126. data/lib/libv8/v8/src/d8-debug.h +158 -0
  127. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  128. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  129. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  130. data/lib/libv8/v8/src/d8.cc +803 -0
  131. data/lib/libv8/v8/src/d8.gyp +91 -0
  132. data/lib/libv8/v8/src/d8.h +235 -0
  133. data/lib/libv8/v8/src/d8.js +2798 -0
  134. data/lib/libv8/v8/src/data-flow.cc +66 -0
  135. data/lib/libv8/v8/src/data-flow.h +205 -0
  136. data/lib/libv8/v8/src/date.js +1103 -0
  137. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  138. data/lib/libv8/v8/src/dateparser.cc +178 -0
  139. data/lib/libv8/v8/src/dateparser.h +266 -0
  140. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  141. data/lib/libv8/v8/src/debug-agent.h +129 -0
  142. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  143. data/lib/libv8/v8/src/debug.cc +3165 -0
  144. data/lib/libv8/v8/src/debug.h +1057 -0
  145. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  146. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  147. data/lib/libv8/v8/src/disasm.h +80 -0
  148. data/lib/libv8/v8/src/disassembler.cc +343 -0
  149. data/lib/libv8/v8/src/disassembler.h +58 -0
  150. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  151. data/lib/libv8/v8/src/diy-fp.h +117 -0
  152. data/lib/libv8/v8/src/double.h +238 -0
  153. data/lib/libv8/v8/src/dtoa.cc +103 -0
  154. data/lib/libv8/v8/src/dtoa.h +85 -0
  155. data/lib/libv8/v8/src/execution.cc +849 -0
  156. data/lib/libv8/v8/src/execution.h +297 -0
  157. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  158. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  159. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  160. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  161. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  162. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  163. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  164. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  165. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  166. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  167. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  168. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  169. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  170. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  171. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  172. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  173. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  174. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  175. data/lib/libv8/v8/src/factory.cc +1222 -0
  176. data/lib/libv8/v8/src/factory.h +442 -0
  177. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  178. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  179. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  180. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  181. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  182. data/lib/libv8/v8/src/flags.cc +551 -0
  183. data/lib/libv8/v8/src/flags.h +79 -0
  184. data/lib/libv8/v8/src/frames-inl.h +247 -0
  185. data/lib/libv8/v8/src/frames.cc +1243 -0
  186. data/lib/libv8/v8/src/frames.h +870 -0
  187. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  188. data/lib/libv8/v8/src/full-codegen.h +771 -0
  189. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  190. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  191. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  192. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  193. data/lib/libv8/v8/src/global-handles.cc +665 -0
  194. data/lib/libv8/v8/src/global-handles.h +284 -0
  195. data/lib/libv8/v8/src/globals.h +325 -0
  196. data/lib/libv8/v8/src/handles-inl.h +177 -0
  197. data/lib/libv8/v8/src/handles.cc +987 -0
  198. data/lib/libv8/v8/src/handles.h +382 -0
  199. data/lib/libv8/v8/src/hashmap.cc +230 -0
  200. data/lib/libv8/v8/src/hashmap.h +123 -0
  201. data/lib/libv8/v8/src/heap-inl.h +704 -0
  202. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  203. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  204. data/lib/libv8/v8/src/heap.cc +5930 -0
  205. data/lib/libv8/v8/src/heap.h +2268 -0
  206. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  207. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  208. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  209. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  210. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  211. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  212. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  213. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  214. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  215. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  216. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  217. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  218. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  219. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  220. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  221. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  222. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  223. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  224. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  225. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  226. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  227. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  228. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  229. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  230. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  231. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  232. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  233. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  234. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  235. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  236. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  237. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  238. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  239. data/lib/libv8/v8/src/ic-inl.h +130 -0
  240. data/lib/libv8/v8/src/ic.cc +2577 -0
  241. data/lib/libv8/v8/src/ic.h +736 -0
  242. data/lib/libv8/v8/src/inspector.cc +63 -0
  243. data/lib/libv8/v8/src/inspector.h +62 -0
  244. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  245. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  246. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  247. data/lib/libv8/v8/src/isolate.cc +1869 -0
  248. data/lib/libv8/v8/src/isolate.h +1382 -0
  249. data/lib/libv8/v8/src/json-parser.cc +504 -0
  250. data/lib/libv8/v8/src/json-parser.h +161 -0
  251. data/lib/libv8/v8/src/json.js +342 -0
  252. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  253. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  254. data/lib/libv8/v8/src/list-inl.h +212 -0
  255. data/lib/libv8/v8/src/list.h +174 -0
  256. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  257. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  258. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  259. data/lib/libv8/v8/src/lithium.cc +190 -0
  260. data/lib/libv8/v8/src/lithium.h +597 -0
  261. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  262. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  263. data/lib/libv8/v8/src/liveedit.h +180 -0
  264. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  265. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  266. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  267. data/lib/libv8/v8/src/log-inl.h +59 -0
  268. data/lib/libv8/v8/src/log-utils.cc +428 -0
  269. data/lib/libv8/v8/src/log-utils.h +231 -0
  270. data/lib/libv8/v8/src/log.cc +1993 -0
  271. data/lib/libv8/v8/src/log.h +476 -0
  272. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  273. data/lib/libv8/v8/src/macros.py +178 -0
  274. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  275. data/lib/libv8/v8/src/mark-compact.h +506 -0
  276. data/lib/libv8/v8/src/math.js +264 -0
  277. data/lib/libv8/v8/src/messages.cc +179 -0
  278. data/lib/libv8/v8/src/messages.h +113 -0
  279. data/lib/libv8/v8/src/messages.js +1096 -0
  280. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  281. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  282. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  283. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  284. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  285. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  286. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  287. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  288. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  289. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  290. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  291. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  292. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  293. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  294. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  295. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  296. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  297. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  298. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  299. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  300. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  301. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  302. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  303. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  304. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  305. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  306. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  307. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  308. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  309. data/lib/libv8/v8/src/natives.h +64 -0
  310. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  311. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  312. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  313. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  314. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  315. data/lib/libv8/v8/src/objects.cc +10585 -0
  316. data/lib/libv8/v8/src/objects.h +6838 -0
  317. data/lib/libv8/v8/src/parser.cc +4997 -0
  318. data/lib/libv8/v8/src/parser.h +765 -0
  319. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  320. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  321. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  322. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  323. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  324. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  325. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  326. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  327. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  328. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  329. data/lib/libv8/v8/src/platform-tls.h +50 -0
  330. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  331. data/lib/libv8/v8/src/platform.h +667 -0
  332. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  333. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  334. data/lib/libv8/v8/src/preparse-data.h +225 -0
  335. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  336. data/lib/libv8/v8/src/preparser.cc +1450 -0
  337. data/lib/libv8/v8/src/preparser.h +493 -0
  338. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  339. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  340. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  341. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  342. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  343. data/lib/libv8/v8/src/property.cc +105 -0
  344. data/lib/libv8/v8/src/property.h +365 -0
  345. data/lib/libv8/v8/src/proxy.js +83 -0
  346. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  347. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  348. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  349. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  350. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  351. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  352. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  353. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  354. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  355. data/lib/libv8/v8/src/regexp.js +483 -0
  356. data/lib/libv8/v8/src/rewriter.cc +360 -0
  357. data/lib/libv8/v8/src/rewriter.h +50 -0
  358. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  359. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  360. data/lib/libv8/v8/src/runtime.cc +12227 -0
  361. data/lib/libv8/v8/src/runtime.h +652 -0
  362. data/lib/libv8/v8/src/runtime.js +649 -0
  363. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  364. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  365. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  366. data/lib/libv8/v8/src/scanner-base.h +670 -0
  367. data/lib/libv8/v8/src/scanner.cc +345 -0
  368. data/lib/libv8/v8/src/scanner.h +146 -0
  369. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  370. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  371. data/lib/libv8/v8/src/scopes.cc +1150 -0
  372. data/lib/libv8/v8/src/scopes.h +507 -0
  373. data/lib/libv8/v8/src/serialize.cc +1574 -0
  374. data/lib/libv8/v8/src/serialize.h +589 -0
  375. data/lib/libv8/v8/src/shell.h +55 -0
  376. data/lib/libv8/v8/src/simulator.h +43 -0
  377. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  378. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  379. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  380. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  381. data/lib/libv8/v8/src/snapshot.h +91 -0
  382. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  383. data/lib/libv8/v8/src/spaces.cc +3145 -0
  384. data/lib/libv8/v8/src/spaces.h +2369 -0
  385. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  386. data/lib/libv8/v8/src/splay-tree.h +205 -0
  387. data/lib/libv8/v8/src/string-search.cc +41 -0
  388. data/lib/libv8/v8/src/string-search.h +568 -0
  389. data/lib/libv8/v8/src/string-stream.cc +592 -0
  390. data/lib/libv8/v8/src/string-stream.h +191 -0
  391. data/lib/libv8/v8/src/string.js +994 -0
  392. data/lib/libv8/v8/src/strtod.cc +440 -0
  393. data/lib/libv8/v8/src/strtod.h +40 -0
  394. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  395. data/lib/libv8/v8/src/stub-cache.h +924 -0
  396. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  397. data/lib/libv8/v8/src/token.cc +63 -0
  398. data/lib/libv8/v8/src/token.h +288 -0
  399. data/lib/libv8/v8/src/type-info.cc +507 -0
  400. data/lib/libv8/v8/src/type-info.h +272 -0
  401. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  402. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  403. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  404. data/lib/libv8/v8/src/unicode.cc +1624 -0
  405. data/lib/libv8/v8/src/unicode.h +280 -0
  406. data/lib/libv8/v8/src/uri.js +408 -0
  407. data/lib/libv8/v8/src/utils-inl.h +48 -0
  408. data/lib/libv8/v8/src/utils.cc +371 -0
  409. data/lib/libv8/v8/src/utils.h +800 -0
  410. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  411. data/lib/libv8/v8/src/v8-counters.h +314 -0
  412. data/lib/libv8/v8/src/v8.cc +213 -0
  413. data/lib/libv8/v8/src/v8.h +131 -0
  414. data/lib/libv8/v8/src/v8checks.h +64 -0
  415. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  416. data/lib/libv8/v8/src/v8globals.h +512 -0
  417. data/lib/libv8/v8/src/v8memory.h +82 -0
  418. data/lib/libv8/v8/src/v8natives.js +1310 -0
  419. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  420. data/lib/libv8/v8/src/v8threads.cc +464 -0
  421. data/lib/libv8/v8/src/v8threads.h +165 -0
  422. data/lib/libv8/v8/src/v8utils.h +319 -0
  423. data/lib/libv8/v8/src/variables.cc +114 -0
  424. data/lib/libv8/v8/src/variables.h +167 -0
  425. data/lib/libv8/v8/src/version.cc +116 -0
  426. data/lib/libv8/v8/src/version.h +68 -0
  427. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  428. data/lib/libv8/v8/src/vm-state.h +71 -0
  429. data/lib/libv8/v8/src/win32-headers.h +96 -0
  430. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  431. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  432. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  433. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  434. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  435. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  436. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  437. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  438. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  439. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  440. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  441. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  442. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  443. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  444. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  445. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  446. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  447. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  448. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  449. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  450. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  451. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  452. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  453. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  454. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  455. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  456. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  457. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  458. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  459. data/lib/libv8/v8/src/zone-inl.h +140 -0
  460. data/lib/libv8/v8/src/zone.cc +196 -0
  461. data/lib/libv8/v8/src/zone.h +240 -0
  462. data/lib/libv8/v8/tools/codemap.js +265 -0
  463. data/lib/libv8/v8/tools/consarray.js +93 -0
  464. data/lib/libv8/v8/tools/csvparser.js +78 -0
  465. data/lib/libv8/v8/tools/disasm.py +92 -0
  466. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  467. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  468. data/lib/libv8/v8/tools/gcmole/README +62 -0
  469. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  470. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  471. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  472. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  473. data/lib/libv8/v8/tools/grokdump.py +841 -0
  474. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  475. data/lib/libv8/v8/tools/js2c.py +364 -0
  476. data/lib/libv8/v8/tools/jsmin.py +280 -0
  477. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  478. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  479. data/lib/libv8/v8/tools/logreader.js +185 -0
  480. data/lib/libv8/v8/tools/mac-nm +18 -0
  481. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  482. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  483. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  484. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  485. data/lib/libv8/v8/tools/presubmit.py +305 -0
  486. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  487. data/lib/libv8/v8/tools/profile.js +751 -0
  488. data/lib/libv8/v8/tools/profile_view.js +219 -0
  489. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  490. data/lib/libv8/v8/tools/splaytree.js +316 -0
  491. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  492. data/lib/libv8/v8/tools/test.py +1510 -0
  493. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  494. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  495. data/lib/libv8/v8/tools/utils.py +96 -0
  496. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  497. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  498. data/lib/libv8/version.rb +5 -0
  499. data/libv8.gemspec +36 -0
  500. metadata +578 -0
@@ -0,0 +1,52 @@
1
+ This license applies to all parts of V8 that are not externally
2
+ maintained libraries. The externally maintained libraries used by V8
3
+ are:
4
+
5
+ - PCRE test suite, located in
6
+ test/mjsunit/third_party/regexp-pcre.js. This is based on the
7
+ test suite from PCRE-7.3, which is copyrighted by the University
8
+ of Cambridge and Google, Inc. The copyright notice and license
9
+ are embedded in regexp-pcre.js.
10
+
11
+ - Layout tests, located in test/mjsunit/third_party. These are
12
+ based on layout tests from webkit.org which are copyrighted by
13
+ Apple Computer, Inc. and released under a 3-clause BSD license.
14
+
15
+ - Strongtalk assembler, the basis of the files assembler-arm-inl.h,
16
+ assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h,
17
+ assembler-ia32.cc, assembler-ia32.h, assembler.cc and assembler.h.
18
+ This code is copyrighted by Sun Microsystems Inc. and released
19
+ under a 3-clause BSD license.
20
+
21
+ - Valgrind client API header, located at third_party/valgrind/valgrind.h
22
+ This is release under the BSD license.
23
+
24
+ These libraries have their own licenses; we recommend you read them,
25
+ as their terms may differ from the terms below.
26
+
27
+ Copyright 2006-2011, the V8 project authors. All rights reserved.
28
+ Redistribution and use in source and binary forms, with or without
29
+ modification, are permitted provided that the following conditions are
30
+ met:
31
+
32
+ * Redistributions of source code must retain the above copyright
33
+ notice, this list of conditions and the following disclaimer.
34
+ * Redistributions in binary form must reproduce the above
35
+ copyright notice, this list of conditions and the following
36
+ disclaimer in the documentation and/or other materials provided
37
+ with the distribution.
38
+ * Neither the name of Google Inc. nor the names of its
39
+ contributors may be used to endorse or promote products derived
40
+ from this software without specific prior written permission.
41
+
42
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,29 @@
1
+ Copyright (c) 1994-2006 Sun Microsystems Inc.
2
+ All Rights Reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ - Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ - Redistribution in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ - Neither the name of Sun Microsystems or the names of contributors may
16
+ be used to endorse or promote products derived from this software without
17
+ specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,26 @@
1
+ Copyright 2006-2011, the V8 project authors. All rights reserved.
2
+ Redistribution and use in source and binary forms, with or without
3
+ modification, are permitted provided that the following conditions are
4
+ met:
5
+
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above
9
+ copyright notice, this list of conditions and the following
10
+ disclaimer in the documentation and/or other materials provided
11
+ with the distribution.
12
+ * Neither the name of Google Inc. nor the names of its
13
+ contributors may be used to endorse or promote products derived
14
+ from this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,45 @@
1
+ ----------------------------------------------------------------
2
+
3
+ Notice that the following BSD-style license applies to this one
4
+ file (valgrind.h) only. The rest of Valgrind is licensed under the
5
+ terms of the GNU General Public License, version 2, unless
6
+ otherwise indicated. See the COPYING file in the source
7
+ distribution for details.
8
+
9
+ ----------------------------------------------------------------
10
+
11
+ This file is part of Valgrind, a dynamic binary instrumentation
12
+ framework.
13
+
14
+ Copyright (C) 2000-2007 Julian Seward. All rights reserved.
15
+
16
+ Redistribution and use in source and binary forms, with or without
17
+ modification, are permitted provided that the following conditions
18
+ are met:
19
+
20
+ 1. Redistributions of source code must retain the above copyright
21
+ notice, this list of conditions and the following disclaimer.
22
+
23
+ 2. The origin of this software must not be misrepresented; you must
24
+ not claim that you wrote the original software. If you use this
25
+ software in a product, an acknowledgment in the product
26
+ documentation would be appreciated but is not required.
27
+
28
+ 3. Altered source versions must be plainly marked as such, and must
29
+ not be misrepresented as being the original software.
30
+
31
+ 4. The name of the author may not be used to endorse or promote
32
+ products derived from this software without specific prior written
33
+ permission.
34
+
35
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
36
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
37
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
39
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
43
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,1478 @@
1
+ # Copyright 2011 the V8 project authors. All rights reserved.
2
+ # Redistribution and use in source and binary forms, with or without
3
+ # modification, are permitted provided that the following conditions are
4
+ # met:
5
+ #
6
+ # * Redistributions of source code must retain the above copyright
7
+ # notice, this list of conditions and the following disclaimer.
8
+ # * Redistributions in binary form must reproduce the above
9
+ # copyright notice, this list of conditions and the following
10
+ # disclaimer in the documentation and/or other materials provided
11
+ # with the distribution.
12
+ # * Neither the name of Google Inc. nor the names of its
13
+ # contributors may be used to endorse or promote products derived
14
+ # from this software without specific prior written permission.
15
+ #
16
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ import platform
29
+ import re
30
+ import subprocess
31
+ import sys
32
+ import os
33
+ from os.path import join, dirname, abspath
34
+ from types import DictType, StringTypes
35
+ root_dir = dirname(File('SConstruct').rfile().abspath)
36
+ sys.path.insert(0, join(root_dir, 'tools'))
37
+ import js2c, utils
38
+
39
+ # ARM_TARGET_LIB is the path to the dynamic library to use on the target
40
+ # machine if cross-compiling to an arm machine. You will also need to set
41
+ # the additional cross-compiling environment variables to the cross compiler.
42
+ ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB')
43
+ if ARM_TARGET_LIB:
44
+ ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' +
45
+ ARM_TARGET_LIB + '/usr/lib',
46
+ '-Wl,--dynamic-linker=' + ARM_TARGET_LIB +
47
+ '/lib/ld-linux.so.3']
48
+ else:
49
+ ARM_LINK_FLAGS = []
50
+
51
+ GCC_EXTRA_CCFLAGS = []
52
+ GCC_DTOA_EXTRA_CCFLAGS = []
53
+
54
+ LIBRARY_FLAGS = {
55
+ 'all': {
56
+ 'CPPPATH': [join(root_dir, 'src')],
57
+ 'regexp:interpreted': {
58
+ 'CPPDEFINES': ['V8_INTERPRETED_REGEXP']
59
+ },
60
+ 'mode:debug': {
61
+ 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT']
62
+ },
63
+ 'vmstate:on': {
64
+ 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING'],
65
+ },
66
+ 'objectprint:on': {
67
+ 'CPPDEFINES': ['OBJECT_PRINT'],
68
+ },
69
+ 'protectheap:on': {
70
+ 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'],
71
+ },
72
+ 'profilingsupport:on': {
73
+ 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'],
74
+ },
75
+ 'debuggersupport:on': {
76
+ 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
77
+ },
78
+ 'inspector:on': {
79
+ 'CPPDEFINES': ['INSPECTOR'],
80
+ },
81
+ 'fasttls:on': {
82
+ 'CPPDEFINES': ['V8_FAST_TLS'],
83
+ },
84
+ 'liveobjectlist:on': {
85
+ 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR',
86
+ 'LIVE_OBJECT_LIST', 'OBJECT_PRINT'],
87
+ }
88
+ },
89
+ 'gcc': {
90
+ 'all': {
91
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
92
+ 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
93
+ },
94
+ 'visibility:hidden': {
95
+ # Use visibility=default to disable this.
96
+ 'CXXFLAGS': ['-fvisibility=hidden']
97
+ },
98
+ 'strictaliasing:off': {
99
+ 'CCFLAGS': ['-fno-strict-aliasing']
100
+ },
101
+ 'mode:debug': {
102
+ 'CCFLAGS': ['-g', '-O0'],
103
+ 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
104
+ },
105
+ 'mode:release': {
106
+ 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections',
107
+ '-ffunction-sections'],
108
+ },
109
+ 'os:linux': {
110
+ 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS,
111
+ 'library:shared': {
112
+ 'CPPDEFINES': ['V8_SHARED'],
113
+ 'LIBS': ['pthread']
114
+ }
115
+ },
116
+ 'os:macos': {
117
+ 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'],
118
+ 'library:shared': {
119
+ 'CPPDEFINES': ['V8_SHARED']
120
+ }
121
+ },
122
+ 'os:freebsd': {
123
+ 'CPPPATH' : ['/usr/local/include'],
124
+ 'LIBPATH' : ['/usr/local/lib'],
125
+ 'CCFLAGS': ['-ansi'],
126
+ 'LIBS': ['execinfo']
127
+ },
128
+ 'os:openbsd': {
129
+ 'CPPPATH' : ['/usr/local/include'],
130
+ 'LIBPATH' : ['/usr/local/lib'],
131
+ 'CCFLAGS': ['-ansi'],
132
+ },
133
+ 'os:solaris': {
134
+ # On Solaris, to get isinf, INFINITY, fpclassify and other macros one
135
+ # needs to define __C99FEATURES__.
136
+ 'CPPDEFINES': ['__C99FEATURES__'],
137
+ 'CPPPATH' : ['/usr/local/include'],
138
+ 'LIBPATH' : ['/usr/local/lib'],
139
+ 'CCFLAGS': ['-ansi'],
140
+ },
141
+ 'os:win32': {
142
+ 'CCFLAGS': ['-DWIN32'],
143
+ 'CXXFLAGS': ['-DWIN32'],
144
+ },
145
+ 'arch:ia32': {
146
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'],
147
+ 'CCFLAGS': ['-m32'],
148
+ 'LINKFLAGS': ['-m32']
149
+ },
150
+ 'arch:arm': {
151
+ 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
152
+ 'unalignedaccesses:on' : {
153
+ 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1']
154
+ },
155
+ 'unalignedaccesses:off' : {
156
+ 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0']
157
+ },
158
+ 'armeabi:soft' : {
159
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
160
+ 'simulator:none': {
161
+ 'CCFLAGS': ['-mfloat-abi=soft'],
162
+ }
163
+ },
164
+ 'armeabi:softfp' : {
165
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0', 'CAN_USE_VFP_INSTRUCTIONS'],
166
+ 'simulator:none': {
167
+ 'CCFLAGS': ['-mfloat-abi=softfp'],
168
+ }
169
+ },
170
+ 'armeabi:hard' : {
171
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1', 'CAN_USE_VFP_INSTRUCTIONS'],
172
+ 'simulator:none': {
173
+ 'CCFLAGS': ['-mfloat-abi=hard'],
174
+ }
175
+ }
176
+ },
177
+ 'simulator:arm': {
178
+ 'CCFLAGS': ['-m32'],
179
+ 'LINKFLAGS': ['-m32'],
180
+ },
181
+ 'arch:mips': {
182
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
183
+ 'mips_arch_variant:mips32r2': {
184
+ 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
185
+ },
186
+ 'simulator:none': {
187
+ 'CCFLAGS': ['-EL'],
188
+ 'LINKFLAGS': ['-EL'],
189
+ 'mips_arch_variant:mips32r2': {
190
+ 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
191
+ },
192
+ 'mips_arch_variant:mips32r1': {
193
+ 'CCFLAGS': ['-mips32', '-Wa,-mips32']
194
+ },
195
+ 'library:static': {
196
+ 'LINKFLAGS': ['-static', '-static-libgcc']
197
+ },
198
+ 'mipsabi:softfloat': {
199
+ 'CCFLAGS': ['-msoft-float'],
200
+ 'LINKFLAGS': ['-msoft-float']
201
+ },
202
+ 'mipsabi:hardfloat': {
203
+ 'CCFLAGS': ['-mhard-float'],
204
+ 'LINKFLAGS': ['-mhard-float']
205
+ }
206
+ }
207
+ },
208
+ 'simulator:mips': {
209
+ 'CCFLAGS': ['-m32'],
210
+ 'LINKFLAGS': ['-m32'],
211
+ 'mipsabi:softfloat': {
212
+ 'CPPDEFINES': ['__mips_soft_float=1'],
213
+ },
214
+ 'mipsabi:hardfloat': {
215
+ 'CPPDEFINES': ['__mips_hard_float=1'],
216
+ }
217
+ },
218
+ 'arch:x64': {
219
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
220
+ 'CCFLAGS': ['-m64'],
221
+ 'LINKFLAGS': ['-m64'],
222
+ },
223
+ 'gdbjit:on': {
224
+ 'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE']
225
+ },
226
+ 'compress_startup_data:bz2': {
227
+ 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2']
228
+ }
229
+ },
230
+ 'msvc': {
231
+ 'all': {
232
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
233
+ 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'],
234
+ 'CPPDEFINES': ['WIN32'],
235
+ 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'],
236
+ 'CCPDBFLAGS': ['/Zi']
237
+ },
238
+ 'verbose:off': {
239
+ 'DIALECTFLAGS': ['/nologo'],
240
+ 'ARFLAGS': ['/NOLOGO']
241
+ },
242
+ 'arch:ia32': {
243
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'],
244
+ 'LINKFLAGS': ['/MACHINE:X86'],
245
+ 'ARFLAGS': ['/MACHINE:X86']
246
+ },
247
+ 'arch:x64': {
248
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
249
+ 'LINKFLAGS': ['/MACHINE:X64'],
250
+ 'ARFLAGS': ['/MACHINE:X64']
251
+ },
252
+ 'mode:debug': {
253
+ 'CCFLAGS': ['/Od', '/Gm'],
254
+ 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'],
255
+ 'LINKFLAGS': ['/DEBUG'],
256
+ 'msvcrt:static': {
257
+ 'CCFLAGS': ['/MTd']
258
+ },
259
+ 'msvcrt:shared': {
260
+ 'CCFLAGS': ['/MDd']
261
+ }
262
+ },
263
+ 'mode:release': {
264
+ 'CCFLAGS': ['/O2'],
265
+ 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
266
+ 'msvcrt:static': {
267
+ 'CCFLAGS': ['/MT']
268
+ },
269
+ 'msvcrt:shared': {
270
+ 'CCFLAGS': ['/MD']
271
+ },
272
+ 'msvcltcg:on': {
273
+ 'CCFLAGS': ['/GL'],
274
+ 'ARFLAGS': ['/LTCG'],
275
+ 'pgo:off': {
276
+ 'LINKFLAGS': ['/LTCG'],
277
+ },
278
+ 'pgo:instrument': {
279
+ 'LINKFLAGS': ['/LTCG:PGI']
280
+ },
281
+ 'pgo:optimize': {
282
+ 'LINKFLAGS': ['/LTCG:PGO']
283
+ }
284
+ }
285
+ }
286
+ }
287
+ }
288
+
289
+
290
+ V8_EXTRA_FLAGS = {
291
+ 'gcc': {
292
+ 'all': {
293
+ 'WARNINGFLAGS': ['-Wall',
294
+ '-Werror',
295
+ '-W',
296
+ '-Wno-unused-parameter',
297
+ '-Wnon-virtual-dtor']
298
+ },
299
+ 'os:win32': {
300
+ 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
301
+ },
302
+ 'os:linux': {
303
+ 'WARNINGFLAGS': ['-pedantic'],
304
+ 'library:shared': {
305
+ 'soname:on': {
306
+ 'LINKFLAGS': ['-Wl,-soname,${SONAME}']
307
+ }
308
+ }
309
+ },
310
+ 'os:macos': {
311
+ 'WARNINGFLAGS': ['-pedantic']
312
+ },
313
+ 'arch:arm': {
314
+ # This is to silence warnings about ABI changes that some versions of the
315
+ # CodeSourcery G++ tool chain produce for each occurrence of varargs.
316
+ 'WARNINGFLAGS': ['-Wno-abi']
317
+ },
318
+ 'disassembler:on': {
319
+ 'CPPDEFINES': ['ENABLE_DISASSEMBLER']
320
+ }
321
+ },
322
+ 'msvc': {
323
+ 'all': {
324
+ 'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800']
325
+ },
326
+ 'library:shared': {
327
+ 'CPPDEFINES': ['BUILDING_V8_SHARED'],
328
+ 'LIBS': ['winmm', 'ws2_32']
329
+ },
330
+ 'arch:arm': {
331
+ 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
332
+ # /wd4996 is to silence the warning about sscanf
333
+ # used by the arm simulator.
334
+ 'WARNINGFLAGS': ['/wd4996']
335
+ },
336
+ 'arch:mips': {
337
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
338
+ 'mips_arch_variant:mips32r2': {
339
+ 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
340
+ },
341
+ },
342
+ 'disassembler:on': {
343
+ 'CPPDEFINES': ['ENABLE_DISASSEMBLER']
344
+ }
345
+ }
346
+ }
347
+
348
+
349
+ MKSNAPSHOT_EXTRA_FLAGS = {
350
+ 'gcc': {
351
+ 'os:linux': {
352
+ 'LIBS': ['pthread'],
353
+ },
354
+ 'os:macos': {
355
+ 'LIBS': ['pthread'],
356
+ },
357
+ 'os:freebsd': {
358
+ 'LIBS': ['execinfo', 'pthread']
359
+ },
360
+ 'os:solaris': {
361
+ 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
362
+ 'LINKFLAGS': ['-mt']
363
+ },
364
+ 'os:openbsd': {
365
+ 'LIBS': ['execinfo', 'pthread']
366
+ },
367
+ 'os:win32': {
368
+ 'LIBS': ['winmm', 'ws2_32'],
369
+ },
370
+ 'compress_startup_data:bz2': {
371
+ 'os:linux': {
372
+ 'LIBS': ['bz2']
373
+ }
374
+ },
375
+ },
376
+ 'msvc': {
377
+ 'all': {
378
+ 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
379
+ 'LIBS': ['winmm', 'ws2_32']
380
+ }
381
+ }
382
+ }
383
+
384
+
385
+ DTOA_EXTRA_FLAGS = {
386
+ 'gcc': {
387
+ 'all': {
388
+ 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'],
389
+ 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS
390
+ }
391
+ },
392
+ 'msvc': {
393
+ 'all': {
394
+ 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244']
395
+ }
396
+ }
397
+ }
398
+
399
+
400
+ CCTEST_EXTRA_FLAGS = {
401
+ 'all': {
402
+ 'CPPPATH': [join(root_dir, 'src')],
403
+ },
404
+ 'gcc': {
405
+ 'all': {
406
+ 'LIBPATH': [abspath('.')],
407
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
408
+ 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
409
+ 'LINKFLAGS': ['$CCFLAGS'],
410
+ },
411
+ 'os:linux': {
412
+ 'LIBS': ['pthread'],
413
+ },
414
+ 'os:macos': {
415
+ 'LIBS': ['pthread'],
416
+ },
417
+ 'os:freebsd': {
418
+ 'LIBS': ['execinfo', 'pthread']
419
+ },
420
+ 'os:solaris': {
421
+ 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
422
+ 'LINKFLAGS': ['-mt']
423
+ },
424
+ 'os:openbsd': {
425
+ 'LIBS': ['execinfo', 'pthread']
426
+ },
427
+ 'os:win32': {
428
+ 'LIBS': ['winmm', 'ws2_32']
429
+ },
430
+ 'arch:arm': {
431
+ 'LINKFLAGS': ARM_LINK_FLAGS
432
+ },
433
+ },
434
+ 'msvc': {
435
+ 'all': {
436
+ 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
437
+ 'LIBS': ['winmm', 'ws2_32']
438
+ },
439
+ 'library:shared': {
440
+ 'CPPDEFINES': ['USING_V8_SHARED']
441
+ },
442
+ 'arch:ia32': {
443
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
444
+ },
445
+ 'arch:x64': {
446
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
447
+ 'LINKFLAGS': ['/STACK:2091752']
448
+ },
449
+ }
450
+ }
451
+
452
+
453
+ SAMPLE_FLAGS = {
454
+ 'all': {
455
+ 'CPPPATH': [join(abspath('.'), 'include')],
456
+ },
457
+ 'gcc': {
458
+ 'all': {
459
+ 'LIBPATH': ['.'],
460
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
461
+ 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
462
+ 'LINKFLAGS': ['$CCFLAGS'],
463
+ },
464
+ 'os:linux': {
465
+ 'LIBS': ['pthread'],
466
+ },
467
+ 'os:macos': {
468
+ 'LIBS': ['pthread'],
469
+ },
470
+ 'os:freebsd': {
471
+ 'LIBPATH' : ['/usr/local/lib'],
472
+ 'LIBS': ['execinfo', 'pthread']
473
+ },
474
+ 'os:solaris': {
475
+ 'LIBPATH' : ['/usr/local/lib'],
476
+ 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
477
+ 'LINKFLAGS': ['-mt']
478
+ },
479
+ 'os:openbsd': {
480
+ 'LIBPATH' : ['/usr/local/lib'],
481
+ 'LIBS': ['execinfo', 'pthread']
482
+ },
483
+ 'os:win32': {
484
+ 'LIBS': ['winmm', 'ws2_32']
485
+ },
486
+ 'arch:arm': {
487
+ 'LINKFLAGS': ARM_LINK_FLAGS,
488
+ 'armeabi:soft' : {
489
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
490
+ 'simulator:none': {
491
+ 'CCFLAGS': ['-mfloat-abi=soft'],
492
+ }
493
+ },
494
+ 'armeabi:softfp' : {
495
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
496
+ 'simulator:none': {
497
+ 'CCFLAGS': ['-mfloat-abi=softfp'],
498
+ }
499
+ },
500
+ 'armeabi:hard' : {
501
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1', 'CAN_USE_VFP_INSTRUCTIONS'],
502
+ 'simulator:none': {
503
+ 'CCFLAGS': ['-mfloat-abi=hard'],
504
+ }
505
+ }
506
+ },
507
+ 'arch:ia32': {
508
+ 'CCFLAGS': ['-m32'],
509
+ 'LINKFLAGS': ['-m32']
510
+ },
511
+ 'arch:x64': {
512
+ 'CCFLAGS': ['-m64'],
513
+ 'LINKFLAGS': ['-m64']
514
+ },
515
+ 'arch:mips': {
516
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
517
+ 'mips_arch_variant:mips32r2': {
518
+ 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
519
+ },
520
+ 'simulator:none': {
521
+ 'CCFLAGS': ['-EL'],
522
+ 'LINKFLAGS': ['-EL'],
523
+ 'mips_arch_variant:mips32r2': {
524
+ 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
525
+ },
526
+ 'mips_arch_variant:mips32r1': {
527
+ 'CCFLAGS': ['-mips32', '-Wa,-mips32']
528
+ },
529
+ 'library:static': {
530
+ 'LINKFLAGS': ['-static', '-static-libgcc']
531
+ },
532
+ 'mipsabi:softfloat': {
533
+ 'CCFLAGS': ['-msoft-float'],
534
+ 'LINKFLAGS': ['-msoft-float']
535
+ },
536
+ 'mipsabi:hardfloat': {
537
+ 'CCFLAGS': ['-mhard-float'],
538
+ 'LINKFLAGS': ['-mhard-float']
539
+ }
540
+ }
541
+ },
542
+ 'simulator:arm': {
543
+ 'CCFLAGS': ['-m32'],
544
+ 'LINKFLAGS': ['-m32']
545
+ },
546
+ 'simulator:mips': {
547
+ 'CCFLAGS': ['-m32'],
548
+ 'LINKFLAGS': ['-m32']
549
+ },
550
+ 'mode:release': {
551
+ 'CCFLAGS': ['-O2']
552
+ },
553
+ 'mode:debug': {
554
+ 'CCFLAGS': ['-g', '-O0'],
555
+ 'CPPDEFINES': ['DEBUG']
556
+ },
557
+ 'compress_startup_data:bz2': {
558
+ 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'],
559
+ 'os:linux': {
560
+ 'LIBS': ['bz2']
561
+ }
562
+ },
563
+ },
564
+ 'msvc': {
565
+ 'all': {
566
+ 'LIBS': ['winmm', 'ws2_32']
567
+ },
568
+ 'verbose:off': {
569
+ 'CCFLAGS': ['/nologo'],
570
+ 'LINKFLAGS': ['/NOLOGO']
571
+ },
572
+ 'verbose:on': {
573
+ 'LINKFLAGS': ['/VERBOSE']
574
+ },
575
+ 'library:shared': {
576
+ 'CPPDEFINES': ['USING_V8_SHARED']
577
+ },
578
+ 'prof:on': {
579
+ 'LINKFLAGS': ['/MAP']
580
+ },
581
+ 'mode:release': {
582
+ 'CCFLAGS': ['/O2'],
583
+ 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
584
+ 'msvcrt:static': {
585
+ 'CCFLAGS': ['/MT']
586
+ },
587
+ 'msvcrt:shared': {
588
+ 'CCFLAGS': ['/MD']
589
+ },
590
+ 'msvcltcg:on': {
591
+ 'CCFLAGS': ['/GL'],
592
+ 'pgo:off': {
593
+ 'LINKFLAGS': ['/LTCG'],
594
+ },
595
+ },
596
+ 'pgo:instrument': {
597
+ 'LINKFLAGS': ['/LTCG:PGI']
598
+ },
599
+ 'pgo:optimize': {
600
+ 'LINKFLAGS': ['/LTCG:PGO']
601
+ }
602
+ },
603
+ 'arch:ia32': {
604
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
605
+ 'LINKFLAGS': ['/MACHINE:X86']
606
+ },
607
+ 'arch:x64': {
608
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
609
+ 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752']
610
+ },
611
+ 'mode:debug': {
612
+ 'CCFLAGS': ['/Od'],
613
+ 'LINKFLAGS': ['/DEBUG'],
614
+ 'CPPDEFINES': ['DEBUG'],
615
+ 'msvcrt:static': {
616
+ 'CCFLAGS': ['/MTd']
617
+ },
618
+ 'msvcrt:shared': {
619
+ 'CCFLAGS': ['/MDd']
620
+ }
621
+ }
622
+ }
623
+ }
624
+
625
+
626
+ PREPARSER_FLAGS = {
627
+ 'all': {
628
+ 'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')]
629
+ },
630
+ 'gcc': {
631
+ 'all': {
632
+ 'LIBPATH': ['.'],
633
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
634
+ 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
635
+ 'LINKFLAGS': ['$CCFLAGS'],
636
+ },
637
+ 'os:win32': {
638
+ 'LIBS': ['winmm', 'ws2_32']
639
+ },
640
+ 'arch:arm': {
641
+ 'LINKFLAGS': ARM_LINK_FLAGS,
642
+ 'armeabi:soft' : {
643
+ 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
644
+ 'simulator:none': {
645
+ 'CCFLAGS': ['-mfloat-abi=soft'],
646
+ }
647
+ },
648
+ 'armeabi:softfp' : {
649
+ 'simulator:none': {
650
+ 'CCFLAGS': ['-mfloat-abi=softfp'],
651
+ }
652
+ },
653
+ 'armeabi:hard' : {
654
+ 'simulator:none': {
655
+ 'CCFLAGS': ['-mfloat-abi=hard'],
656
+ }
657
+ }
658
+ },
659
+ 'arch:ia32': {
660
+ 'CCFLAGS': ['-m32'],
661
+ 'LINKFLAGS': ['-m32']
662
+ },
663
+ 'arch:x64': {
664
+ 'CCFLAGS': ['-m64'],
665
+ 'LINKFLAGS': ['-m64']
666
+ },
667
+ 'arch:mips': {
668
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
669
+ 'mips_arch_variant:mips32r2': {
670
+ 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
671
+ },
672
+ 'simulator:none': {
673
+ 'CCFLAGS': ['-EL'],
674
+ 'LINKFLAGS': ['-EL'],
675
+ 'mips_arch_variant:mips32r2': {
676
+ 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
677
+ },
678
+ 'mips_arch_variant:mips32r1': {
679
+ 'CCFLAGS': ['-mips32', '-Wa,-mips32']
680
+ },
681
+ 'library:static': {
682
+ 'LINKFLAGS': ['-static', '-static-libgcc']
683
+ },
684
+ 'mipsabi:softfloat': {
685
+ 'CCFLAGS': ['-msoft-float'],
686
+ 'LINKFLAGS': ['-msoft-float']
687
+ },
688
+ 'mipsabi:hardfloat': {
689
+ 'CCFLAGS': ['-mhard-float'],
690
+ 'LINKFLAGS': ['-mhard-float']
691
+ }
692
+ }
693
+ },
694
+ 'simulator:arm': {
695
+ 'CCFLAGS': ['-m32'],
696
+ 'LINKFLAGS': ['-m32']
697
+ },
698
+ 'simulator:mips': {
699
+ 'CCFLAGS': ['-m32'],
700
+ 'LINKFLAGS': ['-m32'],
701
+ 'mipsabi:softfloat': {
702
+ 'CPPDEFINES': ['__mips_soft_float=1'],
703
+ },
704
+ 'mipsabi:hardfloat': {
705
+ 'CPPDEFINES': ['__mips_hard_float=1'],
706
+ }
707
+ },
708
+ 'mode:release': {
709
+ 'CCFLAGS': ['-O2']
710
+ },
711
+ 'mode:debug': {
712
+ 'CCFLAGS': ['-g', '-O0'],
713
+ 'CPPDEFINES': ['DEBUG']
714
+ },
715
+ },
716
+ 'msvc': {
717
+ 'all': {
718
+ 'LIBS': ['winmm', 'ws2_32']
719
+ },
720
+ 'verbose:off': {
721
+ 'CCFLAGS': ['/nologo'],
722
+ 'LINKFLAGS': ['/NOLOGO']
723
+ },
724
+ 'verbose:on': {
725
+ 'LINKFLAGS': ['/VERBOSE']
726
+ },
727
+ 'library:shared': {
728
+ 'CPPDEFINES': ['USING_V8_SHARED']
729
+ },
730
+ 'prof:on': {
731
+ 'LINKFLAGS': ['/MAP']
732
+ },
733
+ 'mode:release': {
734
+ 'CCFLAGS': ['/O2'],
735
+ 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
736
+ 'msvcrt:static': {
737
+ 'CCFLAGS': ['/MT']
738
+ },
739
+ 'msvcrt:shared': {
740
+ 'CCFLAGS': ['/MD']
741
+ },
742
+ 'msvcltcg:on': {
743
+ 'CCFLAGS': ['/GL'],
744
+ 'pgo:off': {
745
+ 'LINKFLAGS': ['/LTCG'],
746
+ },
747
+ },
748
+ 'pgo:instrument': {
749
+ 'LINKFLAGS': ['/LTCG:PGI']
750
+ },
751
+ 'pgo:optimize': {
752
+ 'LINKFLAGS': ['/LTCG:PGO']
753
+ }
754
+ },
755
+ 'arch:ia32': {
756
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
757
+ 'LINKFLAGS': ['/MACHINE:X86']
758
+ },
759
+ 'arch:x64': {
760
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
761
+ 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752']
762
+ },
763
+ 'mode:debug': {
764
+ 'CCFLAGS': ['/Od'],
765
+ 'LINKFLAGS': ['/DEBUG'],
766
+ 'CPPDEFINES': ['DEBUG'],
767
+ 'msvcrt:static': {
768
+ 'CCFLAGS': ['/MTd']
769
+ },
770
+ 'msvcrt:shared': {
771
+ 'CCFLAGS': ['/MDd']
772
+ }
773
+ }
774
+ }
775
+ }
776
+
777
+
778
+ D8_FLAGS = {
779
+ 'gcc': {
780
+ 'all': {
781
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
782
+ 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
783
+ 'LINKFLAGS': ['$CCFLAGS'],
784
+ },
785
+ 'console:readline': {
786
+ 'LIBS': ['readline']
787
+ },
788
+ 'os:linux': {
789
+ 'LIBS': ['pthread'],
790
+ },
791
+ 'os:macos': {
792
+ 'LIBS': ['pthread'],
793
+ },
794
+ 'os:freebsd': {
795
+ 'LIBS': ['pthread'],
796
+ },
797
+ 'os:solaris': {
798
+ 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
799
+ 'LINKFLAGS': ['-mt']
800
+ },
801
+ 'os:openbsd': {
802
+ 'LIBS': ['pthread'],
803
+ },
804
+ 'os:win32': {
805
+ 'LIBS': ['winmm', 'ws2_32'],
806
+ },
807
+ 'arch:arm': {
808
+ 'LINKFLAGS': ARM_LINK_FLAGS
809
+ },
810
+ },
811
+ 'msvc': {
812
+ 'all': {
813
+ 'LIBS': ['winmm', 'ws2_32']
814
+ }
815
+ }
816
+ }
817
+
818
+
819
+ SUFFIXES = {
820
+ 'release': '',
821
+ 'debug': '_g'
822
+ }
823
+
824
+
825
+ def Abort(message):
826
+ print message
827
+ sys.exit(1)
828
+
829
+
830
+ def GuessOS(env):
831
+ return utils.GuessOS()
832
+
833
+
834
+ def GuessArch(env):
835
+ return utils.GuessArchitecture()
836
+
837
+
838
+ def GuessToolchain(env):
839
+ tools = env['TOOLS']
840
+ if 'gcc' in tools:
841
+ return 'gcc'
842
+ elif 'msvc' in tools:
843
+ return 'msvc'
844
+ else:
845
+ return None
846
+
847
+
848
+ def GuessVisibility(env):
849
+ os = env['os']
850
+ toolchain = env['toolchain'];
851
+ if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc':
852
+ # MinGW / Cygwin can't do it.
853
+ return 'default'
854
+ elif os == 'solaris':
855
+ return 'default'
856
+ else:
857
+ return 'hidden'
858
+
859
+
860
+ def GuessStrictAliasing(env):
861
+ # There seems to be a problem with gcc 4.5.x.
862
+ # See http://code.google.com/p/v8/issues/detail?id=884
863
+ # It can be worked around by disabling strict aliasing.
864
+ toolchain = env['toolchain'];
865
+ if toolchain == 'gcc':
866
+ env = Environment(tools=['gcc'])
867
+ # The gcc version should be available in env['CCVERSION'],
868
+ # but when scons detects msvc this value is not set.
869
+ version = subprocess.Popen([env['CC'], '-dumpversion'],
870
+ stdout=subprocess.PIPE).communicate()[0]
871
+ if version.find('4.5') == 0:
872
+ return 'off'
873
+ return 'default'
874
+
875
+
876
+ PLATFORM_OPTIONS = {
877
+ 'arch': {
878
+ 'values': ['arm', 'ia32', 'x64', 'mips'],
879
+ 'guess': GuessArch,
880
+ 'help': 'the architecture to build for'
881
+ },
882
+ 'os': {
883
+ 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin'],
884
+ 'guess': GuessOS,
885
+ 'help': 'the os to build for'
886
+ },
887
+ 'toolchain': {
888
+ 'values': ['gcc', 'msvc'],
889
+ 'guess': GuessToolchain,
890
+ 'help': 'the toolchain to use'
891
+ }
892
+ }
893
+
894
+ SIMPLE_OPTIONS = {
895
+ 'regexp': {
896
+ 'values': ['native', 'interpreted'],
897
+ 'default': 'native',
898
+ 'help': 'Whether to use native or interpreted regexp implementation'
899
+ },
900
+ 'snapshot': {
901
+ 'values': ['on', 'off', 'nobuild'],
902
+ 'default': 'off',
903
+ 'help': 'build using snapshots for faster start-up'
904
+ },
905
+ 'prof': {
906
+ 'values': ['on', 'off'],
907
+ 'default': 'off',
908
+ 'help': 'enable profiling of build target'
909
+ },
910
+ 'gdbjit': {
911
+ 'values': ['on', 'off'],
912
+ 'default': 'off',
913
+ 'help': 'enable GDB JIT interface'
914
+ },
915
+ 'library': {
916
+ 'values': ['static', 'shared'],
917
+ 'default': 'static',
918
+ 'help': 'the type of library to produce'
919
+ },
920
+ 'vmstate': {
921
+ 'values': ['on', 'off'],
922
+ 'default': 'off',
923
+ 'help': 'enable VM state tracking'
924
+ },
925
+ 'objectprint': {
926
+ 'values': ['on', 'off'],
927
+ 'default': 'off',
928
+ 'help': 'enable object printing'
929
+ },
930
+ 'protectheap': {
931
+ 'values': ['on', 'off'],
932
+ 'default': 'off',
933
+ 'help': 'enable heap protection'
934
+ },
935
+ 'profilingsupport': {
936
+ 'values': ['on', 'off'],
937
+ 'default': 'on',
938
+ 'help': 'enable profiling of JavaScript code'
939
+ },
940
+ 'debuggersupport': {
941
+ 'values': ['on', 'off'],
942
+ 'default': 'on',
943
+ 'help': 'enable debugging of JavaScript code'
944
+ },
945
+ 'inspector': {
946
+ 'values': ['on', 'off'],
947
+ 'default': 'off',
948
+ 'help': 'enable inspector features'
949
+ },
950
+ 'liveobjectlist': {
951
+ 'values': ['on', 'off'],
952
+ 'default': 'off',
953
+ 'help': 'enable live object list features in the debugger'
954
+ },
955
+ 'soname': {
956
+ 'values': ['on', 'off'],
957
+ 'default': 'off',
958
+ 'help': 'turn on setting soname for Linux shared library'
959
+ },
960
+ 'msvcrt': {
961
+ 'values': ['static', 'shared'],
962
+ 'default': 'static',
963
+ 'help': 'the type of Microsoft Visual C++ runtime library to use'
964
+ },
965
+ 'msvcltcg': {
966
+ 'values': ['on', 'off'],
967
+ 'default': 'on',
968
+ 'help': 'use Microsoft Visual C++ link-time code generation'
969
+ },
970
+ 'simulator': {
971
+ 'values': ['arm', 'mips', 'none'],
972
+ 'default': 'none',
973
+ 'help': 'build with simulator'
974
+ },
975
+ 'unalignedaccesses': {
976
+ 'values': ['default', 'on', 'off'],
977
+ 'default': 'default',
978
+ 'help': 'set whether the ARM target supports unaligned accesses'
979
+ },
980
+ 'disassembler': {
981
+ 'values': ['on', 'off'],
982
+ 'default': 'off',
983
+ 'help': 'enable the disassembler to inspect generated code'
984
+ },
985
+ 'fasttls': {
986
+ 'values': ['on', 'off'],
987
+ 'default': 'on',
988
+ 'help': 'enable fast thread local storage support '
989
+ '(if available on the current architecture/platform)'
990
+ },
991
+ 'sourcesignatures': {
992
+ 'values': ['MD5', 'timestamp'],
993
+ 'default': 'MD5',
994
+ 'help': 'set how the build system detects file changes'
995
+ },
996
+ 'console': {
997
+ 'values': ['dumb', 'readline'],
998
+ 'default': 'dumb',
999
+ 'help': 'the console to use for the d8 shell'
1000
+ },
1001
+ 'verbose': {
1002
+ 'values': ['on', 'off'],
1003
+ 'default': 'off',
1004
+ 'help': 'more output from compiler and linker'
1005
+ },
1006
+ 'visibility': {
1007
+ 'values': ['default', 'hidden'],
1008
+ 'guess': GuessVisibility,
1009
+ 'help': 'shared library symbol visibility'
1010
+ },
1011
+ 'strictaliasing': {
1012
+ 'values': ['default', 'off'],
1013
+ 'guess': GuessStrictAliasing,
1014
+ 'help': 'assume strict aliasing while optimizing'
1015
+ },
1016
+ 'pgo': {
1017
+ 'values': ['off', 'instrument', 'optimize'],
1018
+ 'default': 'off',
1019
+ 'help': 'select profile guided optimization variant',
1020
+ },
1021
+ 'armeabi': {
1022
+ 'values': ['hard', 'softfp', 'soft'],
1023
+ 'default': 'softfp',
1024
+ 'help': 'generate calling conventiont according to selected ARM EABI variant'
1025
+ },
1026
+ 'mipsabi': {
1027
+ 'values': ['hardfloat', 'softfloat', 'none'],
1028
+ 'default': 'hardfloat',
1029
+ 'help': 'generate calling conventiont according to selected mips ABI'
1030
+ },
1031
+ 'mips_arch_variant': {
1032
+ 'values': ['mips32r2', 'mips32r1'],
1033
+ 'default': 'mips32r2',
1034
+ 'help': 'mips variant'
1035
+ },
1036
+ 'compress_startup_data': {
1037
+ 'values': ['off', 'bz2'],
1038
+ 'default': 'off',
1039
+ 'help': 'compress startup data (snapshot) [Linux only]'
1040
+ },
1041
+ }
1042
+
1043
+ ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS)
1044
+
1045
+
1046
+ def AddOptions(options, result):
1047
+ guess_env = Environment(options=result)
1048
+ for (name, option) in options.iteritems():
1049
+ if 'guess' in option:
1050
+ # Option has a guess function
1051
+ guess = option.get('guess')
1052
+ default = guess(guess_env)
1053
+ else:
1054
+ # Option has a fixed default
1055
+ default = option.get('default')
1056
+ help = '%s (%s)' % (option.get('help'), ", ".join(option['values']))
1057
+ result.Add(name, help, default)
1058
+
1059
+
1060
+ def GetOptions():
1061
+ result = Options()
1062
+ result.Add('mode', 'compilation mode (debug, release)', 'release')
1063
+ result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
1064
+ result.Add('cache', 'directory to use for scons build cache', '')
1065
+ result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '')
1066
+ result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
1067
+ AddOptions(PLATFORM_OPTIONS, result)
1068
+ AddOptions(SIMPLE_OPTIONS, result)
1069
+ return result
1070
+
1071
+
1072
+ def GetTools(opts):
1073
+ env = Environment(options=opts)
1074
+ os = env['os']
1075
+ toolchain = env['toolchain']
1076
+ if os == 'win32' and toolchain == 'gcc':
1077
+ return ['mingw']
1078
+ elif os == 'win32' and toolchain == 'msvc':
1079
+ return ['msvc', 'mslink', 'mslib', 'msvs']
1080
+ else:
1081
+ return ['default']
1082
+
1083
+
1084
+ def GetVersionComponents():
1085
+ MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
1086
+ MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
1087
+ BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)")
1088
+ PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)")
1089
+
1090
+ patterns = [MAJOR_VERSION_PATTERN,
1091
+ MINOR_VERSION_PATTERN,
1092
+ BUILD_NUMBER_PATTERN,
1093
+ PATCH_LEVEL_PATTERN]
1094
+
1095
+ source = open(join(root_dir, 'src', 'version.cc')).read()
1096
+ version_components = []
1097
+ for pattern in patterns:
1098
+ match = pattern.search(source)
1099
+ if match:
1100
+ version_components.append(match.group(1).strip())
1101
+ else:
1102
+ version_components.append('0')
1103
+
1104
+ return version_components
1105
+
1106
+
1107
+ def GetVersion():
1108
+ version_components = GetVersionComponents()
1109
+
1110
+ if version_components[len(version_components) - 1] == '0':
1111
+ version_components.pop()
1112
+ return '.'.join(version_components)
1113
+
1114
+
1115
+ def GetSpecificSONAME():
1116
+ SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"")
1117
+
1118
+ source = open(join(root_dir, 'src', 'version.cc')).read()
1119
+ match = SONAME_PATTERN.search(source)
1120
+
1121
+ if match:
1122
+ return match.group(1).strip()
1123
+ else:
1124
+ return ''
1125
+
1126
+
1127
+ def SplitList(str):
1128
+ return [ s for s in str.split(",") if len(s) > 0 ]
1129
+
1130
+
1131
+ def IsLegal(env, option, values):
1132
+ str = env[option]
1133
+ for s in SplitList(str):
1134
+ if not s in values:
1135
+ Abort("Illegal value for option %s '%s'." % (option, s))
1136
+ return False
1137
+ return True
1138
+
1139
+
1140
+ def VerifyOptions(env):
1141
+ if not IsLegal(env, 'mode', ['debug', 'release']):
1142
+ return False
1143
+ if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]):
1144
+ return False
1145
+ if not IsLegal(env, 'regexp', ["native", "interpreted"]):
1146
+ return False
1147
+ if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on':
1148
+ Abort("Profiling on windows only supported for static library.")
1149
+ if env['gdbjit'] == 'on' and (env['os'] != 'linux' or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')):
1150
+ Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux target.")
1151
+ if env['os'] == 'win32' and env['soname'] == 'on':
1152
+ Abort("Shared Object soname not applicable for Windows.")
1153
+ if env['soname'] == 'on' and env['library'] == 'static':
1154
+ Abort("Shared Object soname not applicable for static library.")
1155
+ if env['os'] != 'win32' and env['pgo'] != 'off':
1156
+ Abort("Profile guided optimization only supported on Windows.")
1157
+ if env['cache'] and not os.path.isdir(env['cache']):
1158
+ Abort("The specified cache directory does not exist.")
1159
+ if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS):
1160
+ print env['arch']
1161
+ print env['simulator']
1162
+ Abort("Option unalignedaccesses only supported for the ARM architecture.")
1163
+ if env['os'] != 'linux' and env['compress_startup_data'] != 'off':
1164
+ Abort("Startup data compression is only available on Linux")
1165
+ for (name, option) in ALL_OPTIONS.iteritems():
1166
+ if (not name in env):
1167
+ message = ("A value for option %s must be specified (%s)." %
1168
+ (name, ", ".join(option['values'])))
1169
+ Abort(message)
1170
+ if not env[name] in option['values']:
1171
+ message = ("Unknown %s value '%s'. Possible values are (%s)." %
1172
+ (name, env[name], ", ".join(option['values'])))
1173
+ Abort(message)
1174
+
1175
+
1176
+ class BuildContext(object):
1177
+
1178
+ def __init__(self, options, env_overrides, samples):
1179
+ self.library_targets = []
1180
+ self.mksnapshot_targets = []
1181
+ self.cctest_targets = []
1182
+ self.sample_targets = []
1183
+ self.d8_targets = []
1184
+ self.options = options
1185
+ self.env_overrides = env_overrides
1186
+ self.samples = samples
1187
+ self.preparser_targets = []
1188
+ self.use_snapshot = (options['snapshot'] != 'off')
1189
+ self.build_snapshot = (options['snapshot'] == 'on')
1190
+ self.flags = None
1191
+
1192
+ def AddRelevantFlags(self, initial, flags):
1193
+ result = initial.copy()
1194
+ toolchain = self.options['toolchain']
1195
+ if toolchain in flags:
1196
+ self.AppendFlags(result, flags[toolchain].get('all'))
1197
+ for option in sorted(self.options.keys()):
1198
+ value = self.options[option]
1199
+ self.AppendFlags(result, flags[toolchain].get(option + ':' + value))
1200
+ self.AppendFlags(result, flags.get('all'))
1201
+ return result
1202
+
1203
+ def AddRelevantSubFlags(self, options, flags):
1204
+ self.AppendFlags(options, flags.get('all'))
1205
+ for option in sorted(self.options.keys()):
1206
+ value = self.options[option]
1207
+ self.AppendFlags(options, flags.get(option + ':' + value))
1208
+
1209
+ def GetRelevantSources(self, source):
1210
+ result = []
1211
+ result += source.get('all', [])
1212
+ for (name, value) in self.options.iteritems():
1213
+ source_value = source.get(name + ':' + value, [])
1214
+ if type(source_value) == dict:
1215
+ result += self.GetRelevantSources(source_value)
1216
+ else:
1217
+ result += source_value
1218
+ return sorted(result)
1219
+
1220
+ def AppendFlags(self, options, added):
1221
+ if not added:
1222
+ return
1223
+ for (key, value) in added.iteritems():
1224
+ if key.find(':') != -1:
1225
+ self.AddRelevantSubFlags(options, { key: value })
1226
+ else:
1227
+ if not key in options:
1228
+ options[key] = value
1229
+ else:
1230
+ prefix = options[key]
1231
+ if isinstance(prefix, StringTypes): prefix = prefix.split()
1232
+ options[key] = prefix + value
1233
+
1234
+ def ConfigureObject(self, env, input, **kw):
1235
+ if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')):
1236
+ kw['CPPPATH'] += env['CPPPATH']
1237
+ if self.options['library'] == 'static':
1238
+ return env.StaticObject(input, **kw)
1239
+ else:
1240
+ return env.SharedObject(input, **kw)
1241
+
1242
+ def ApplyEnvOverrides(self, env):
1243
+ if not self.env_overrides:
1244
+ return
1245
+ if type(env['ENV']) == DictType:
1246
+ env['ENV'].update(**self.env_overrides)
1247
+ else:
1248
+ env['ENV'] = self.env_overrides
1249
+
1250
+
1251
+ def PostprocessOptions(options, os):
1252
+ # Adjust architecture if the simulator option has been set
1253
+ if (options['simulator'] != 'none') and (options['arch'] != options['simulator']):
1254
+ if 'arch' in ARGUMENTS:
1255
+ # Print a warning if arch has explicitly been set
1256
+ print "Warning: forcing architecture to match simulator (%s)" % options['simulator']
1257
+ options['arch'] = options['simulator']
1258
+ if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'):
1259
+ # Print a warning if profiling is enabled without profiling support
1260
+ print "Warning: forcing profilingsupport on when prof is on"
1261
+ options['profilingsupport'] = 'on'
1262
+ if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off':
1263
+ if 'msvcltcg' in ARGUMENTS:
1264
+ print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo']
1265
+ options['msvcltcg'] = 'on'
1266
+ if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'):
1267
+ options['mipsabi'] = 'none'
1268
+ if options['liveobjectlist'] == 'on':
1269
+ if (options['debuggersupport'] != 'on') or (options['mode'] == 'release'):
1270
+ # Print a warning that liveobjectlist will implicitly enable the debugger
1271
+ print "Warning: forcing debuggersupport on for liveobjectlist"
1272
+ options['debuggersupport'] = 'on'
1273
+ options['inspector'] = 'on'
1274
+ options['objectprint'] = 'on'
1275
+
1276
+
1277
+ def ParseEnvOverrides(arg, imports):
1278
+ # The environment overrides are in the format NAME0:value0,NAME1:value1,...
1279
+ # The environment imports are in the format NAME0,NAME1,...
1280
+ overrides = {}
1281
+ for var in imports.split(','):
1282
+ if var in os.environ:
1283
+ overrides[var] = os.environ[var]
1284
+ for override in arg.split(','):
1285
+ pos = override.find(':')
1286
+ if pos == -1:
1287
+ continue
1288
+ overrides[override[:pos].strip()] = override[pos+1:].strip()
1289
+ return overrides
1290
+
1291
+
1292
+ def BuildSpecific(env, mode, env_overrides, tools):
1293
+ options = {'mode': mode}
1294
+ for option in ALL_OPTIONS:
1295
+ options[option] = env[option]
1296
+ PostprocessOptions(options, env['os'])
1297
+
1298
+ context = BuildContext(options, env_overrides, samples=SplitList(env['sample']))
1299
+
1300
+ # Remove variables which can't be imported from the user's external
1301
+ # environment into a construction environment.
1302
+ user_environ = os.environ.copy()
1303
+ try:
1304
+ del user_environ['ENV']
1305
+ except KeyError:
1306
+ pass
1307
+
1308
+ library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS)
1309
+ v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS)
1310
+ mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS)
1311
+ dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS)
1312
+ cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
1313
+ sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS)
1314
+ preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS)
1315
+ d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS)
1316
+
1317
+ context.flags = {
1318
+ 'v8': v8_flags,
1319
+ 'mksnapshot': mksnapshot_flags,
1320
+ 'dtoa': dtoa_flags,
1321
+ 'cctest': cctest_flags,
1322
+ 'sample': sample_flags,
1323
+ 'd8': d8_flags,
1324
+ 'preparser': preparser_flags
1325
+ }
1326
+
1327
+ # Generate library base name.
1328
+ target_id = mode
1329
+ suffix = SUFFIXES[target_id]
1330
+ library_name = 'v8' + suffix
1331
+ preparser_library_name = 'v8preparser' + suffix
1332
+ version = GetVersion()
1333
+ if context.options['soname'] == 'on':
1334
+ # When building shared object with SONAME version the library name.
1335
+ library_name += '-' + version
1336
+
1337
+ # Generate library SONAME if required by the build.
1338
+ if context.options['soname'] == 'on':
1339
+ soname = GetSpecificSONAME()
1340
+ if soname == '':
1341
+ soname = 'lib' + library_name + '.so'
1342
+ env['SONAME'] = soname
1343
+
1344
+ # Build the object files by invoking SCons recursively.
1345
+ (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript(
1346
+ join('src', 'SConscript'),
1347
+ build_dir=join('obj', target_id),
1348
+ exports='context tools',
1349
+ duplicate=False
1350
+ )
1351
+
1352
+ context.mksnapshot_targets.append(mksnapshot)
1353
+
1354
+ # Link the object files into a library.
1355
+ env.Replace(**context.flags['v8'])
1356
+
1357
+ context.ApplyEnvOverrides(env)
1358
+ if context.options['library'] == 'static':
1359
+ library = env.StaticLibrary(library_name, object_files)
1360
+ preparser_library = env.StaticLibrary(preparser_library_name,
1361
+ preparser_files)
1362
+ else:
1363
+ # There seems to be a glitch in the way scons decides where to put
1364
+ # PDB files when compiling using MSVC so we specify it manually.
1365
+ # This should not affect any other platforms.
1366
+ pdb_name = library_name + '.dll.pdb'
1367
+ library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
1368
+ preparser_pdb_name = preparser_library_name + '.dll.pdb';
1369
+ preparser_library = env.SharedLibrary(preparser_library_name,
1370
+ preparser_files,
1371
+ PDB=preparser_pdb_name)
1372
+ context.library_targets.append(library)
1373
+ context.library_targets.append(preparser_library)
1374
+
1375
+ d8_env = Environment(tools=tools)
1376
+ d8_env.Replace(**context.flags['d8'])
1377
+ context.ApplyEnvOverrides(d8_env)
1378
+ shell = d8_env.Program('d8' + suffix, object_files + shell_files)
1379
+ context.d8_targets.append(shell)
1380
+
1381
+ for sample in context.samples:
1382
+ sample_env = Environment(tools=tools)
1383
+ sample_env.Replace(**context.flags['sample'])
1384
+ sample_env.Prepend(LIBS=[library_name])
1385
+ context.ApplyEnvOverrides(sample_env)
1386
+ sample_object = sample_env.SConscript(
1387
+ join('samples', 'SConscript'),
1388
+ build_dir=join('obj', 'sample', sample, target_id),
1389
+ exports='sample context tools',
1390
+ duplicate=False
1391
+ )
1392
+ sample_name = sample + suffix
1393
+ sample_program = sample_env.Program(sample_name, sample_object)
1394
+ sample_env.Depends(sample_program, library)
1395
+ context.sample_targets.append(sample_program)
1396
+
1397
+ cctest_env = env.Copy()
1398
+ cctest_env.Prepend(LIBS=[library_name])
1399
+ cctest_program = cctest_env.SConscript(
1400
+ join('test', 'cctest', 'SConscript'),
1401
+ build_dir=join('obj', 'test', target_id),
1402
+ exports='context object_files tools',
1403
+ duplicate=False
1404
+ )
1405
+ context.cctest_targets.append(cctest_program)
1406
+
1407
+ preparser_env = env.Copy()
1408
+ preparser_env.Replace(**context.flags['preparser'])
1409
+ preparser_env.Prepend(LIBS=[preparser_library_name])
1410
+ context.ApplyEnvOverrides(preparser_env)
1411
+ preparser_object = preparser_env.SConscript(
1412
+ join('preparser', 'SConscript'),
1413
+ build_dir=join('obj', 'preparser', target_id),
1414
+ exports='context',
1415
+ duplicate=False
1416
+ )
1417
+ preparser_name = join('obj', 'preparser', target_id, 'preparser')
1418
+ preparser_program = preparser_env.Program(preparser_name, preparser_object);
1419
+ preparser_env.Depends(preparser_program, preparser_library)
1420
+ context.preparser_targets.append(preparser_program)
1421
+
1422
+ return context
1423
+
1424
+
1425
+ def Build():
1426
+ opts = GetOptions()
1427
+ tools = GetTools(opts)
1428
+ env = Environment(options=opts, tools=tools)
1429
+
1430
+ Help(opts.GenerateHelpText(env))
1431
+ VerifyOptions(env)
1432
+ env_overrides = ParseEnvOverrides(env['env'], env['importenv'])
1433
+
1434
+ SourceSignatures(env['sourcesignatures'])
1435
+
1436
+ libraries = []
1437
+ mksnapshots = []
1438
+ cctests = []
1439
+ samples = []
1440
+ preparsers = []
1441
+ d8s = []
1442
+ modes = SplitList(env['mode'])
1443
+ for mode in modes:
1444
+ context = BuildSpecific(env.Copy(), mode, env_overrides, tools)
1445
+ libraries += context.library_targets
1446
+ mksnapshots += context.mksnapshot_targets
1447
+ cctests += context.cctest_targets
1448
+ samples += context.sample_targets
1449
+ preparsers += context.preparser_targets
1450
+ d8s += context.d8_targets
1451
+
1452
+ env.Alias('library', libraries)
1453
+ env.Alias('mksnapshot', mksnapshots)
1454
+ env.Alias('cctests', cctests)
1455
+ env.Alias('sample', samples)
1456
+ env.Alias('d8', d8s)
1457
+ env.Alias('preparser', preparsers)
1458
+
1459
+ if env['sample']:
1460
+ env.Default('sample')
1461
+ else:
1462
+ env.Default('library')
1463
+
1464
+ if env['cache']:
1465
+ CacheDir(env['cache'])
1466
+
1467
+ # We disable deprecation warnings because we need to be able to use
1468
+ # env.Copy without getting warnings for compatibility with older
1469
+ # version of scons. Also, there's a bug in some revisions that
1470
+ # doesn't allow this flag to be set, so we swallow any exceptions.
1471
+ # Lovely.
1472
+ try:
1473
+ SetOption('warn', 'no-deprecated')
1474
+ except:
1475
+ pass
1476
+
1477
+
1478
+ Build()