Browse files

Merge commit 'v0.1.100'

Conflicts:
	lib/module.js
  • Loading branch information...
2 parents 5ce9bd4 + a6b8586 commit 2d08b6359a4e1b344325ad533c8518dc7b048757 Herbert Voj����k committed Jul 11, 2010
Showing with 6,398 additions and 3,450 deletions.
  1. +2 −0 .gitignore
  2. +13 −9 AUTHORS
  3. +20 −1 ChangeLog
  4. +7 −9 benchmark/http_simple.js
  5. +14 −14 benchmark/http_simple.rb
  6. +2 −2 benchmark/run.js
  7. +2 −4 bin/node-repl
  8. +89 −160 deps/http_parser/http_parser.c
  9. +24 −23 deps/http_parser/http_parser.h
  10. +138 −11 deps/http_parser/test.c
  11. +43 −0 deps/v8/ChangeLog
  12. +9 −3 deps/v8/benchmarks/README.txt
  13. +30 −10 deps/v8/benchmarks/base.js
  14. +1 −1 deps/v8/benchmarks/crypto.js
  15. +4 −4 deps/v8/benchmarks/deltablue.js
  16. +1 −1 deps/v8/benchmarks/earley-boyer.js
  17. +1 −1 deps/v8/benchmarks/raytrace.js
  18. +1 −1 deps/v8/benchmarks/regexp.js
  19. +9 −4 deps/v8/benchmarks/revisions.html
  20. +1 −1 deps/v8/benchmarks/richards.js
  21. +1 −1 deps/v8/benchmarks/run.html
  22. +18 −3 deps/v8/benchmarks/splay.js
  23. +3 −1 deps/v8/include/v8-profiler.h
  24. +3 −5 deps/v8/include/v8.h
  25. +5 −3 deps/v8/src/api.cc
  26. +0 −5 deps/v8/src/arm/assembler-arm-inl.h
  27. +71 −7 deps/v8/src/arm/assembler-arm.cc
  28. +23 −1 deps/v8/src/arm/assembler-arm.h
  29. +632 −264 deps/v8/src/arm/codegen-arm.cc
  30. +102 −2 deps/v8/src/arm/codegen-arm.h
  31. +1 −1 deps/v8/src/arm/constants-arm.cc
  32. +3 −0 deps/v8/src/arm/constants-arm.h
  33. +23 −4 deps/v8/src/arm/disasm-arm.cc
  34. +1 −2 deps/v8/src/arm/fast-codegen-arm.cc
  35. +12 −13 deps/v8/src/arm/full-codegen-arm.cc
  36. +166 −183 deps/v8/src/arm/ic-arm.cc
  37. +16 −0 deps/v8/src/arm/jump-target-arm.cc
  38. +132 −27 deps/v8/src/arm/macro-assembler-arm.cc
  39. +57 −7 deps/v8/src/arm/macro-assembler-arm.h
  40. +15 −3 deps/v8/src/arm/simulator-arm.cc
  41. +3 −5 deps/v8/src/arm/stub-cache-arm.cc
  42. +44 −0 deps/v8/src/arm/virtual-frame-arm.cc
  43. +11 −2 deps/v8/src/arm/virtual-frame-arm.h
  44. +2 −2 deps/v8/src/array.js
  45. +3 −1 deps/v8/src/ast-inl.h
  46. +1 −0 deps/v8/src/bootstrapper.cc
  47. +1 −0 deps/v8/src/builtins.cc
  48. +4 −4 deps/v8/src/checks.h
  49. +1 −0 deps/v8/src/code-stubs.h
  50. +47 −12 deps/v8/src/debug-debugger.js
  51. +5 −3 deps/v8/src/debug.cc
  52. +2 −2 deps/v8/src/debug.h
  53. +111 −3 deps/v8/src/execution.cc
  54. +12 −1 deps/v8/src/execution.h
  55. +11 −0 deps/v8/src/factory.cc
  56. +4 −0 deps/v8/src/factory.h
  57. +3 −1 deps/v8/src/flag-definitions.h
  58. +10 −0 deps/v8/src/handles.cc
  59. +6 −0 deps/v8/src/handles.h
  60. +8 −0 deps/v8/src/heap-profiler.cc
  61. +7 −0 deps/v8/src/heap-profiler.h
  62. +97 −15 deps/v8/src/heap.cc
  63. +52 −0 deps/v8/src/heap.h
  64. +0 −4 deps/v8/src/ia32/assembler-ia32-inl.h
  65. +5 −11 deps/v8/src/ia32/assembler-ia32.cc
  66. +8 −2 deps/v8/src/ia32/assembler-ia32.h
  67. +43 −16 deps/v8/src/ia32/codegen-ia32.cc
  68. +1 −1 deps/v8/src/ia32/full-codegen-ia32.cc
  69. +141 −195 deps/v8/src/ia32/ic-ia32.cc
  70. +7 −2 deps/v8/src/ia32/stub-cache-ia32.cc
  71. +28 −4 deps/v8/src/ic.cc
  72. +0 −4 deps/v8/src/ic.h
  73. +2 −2 deps/v8/src/json.js
  74. +20 −4 deps/v8/src/jsregexp.cc
  75. +2 −0 deps/v8/src/jump-target-heavy.h
  76. +4 −0 deps/v8/src/jump-target-light-inl.h
  77. +4 −0 deps/v8/src/jump-target-light.h
  78. +5 −5 deps/v8/src/log.cc
  79. +5 −0 deps/v8/src/objects-debug.cc
  80. +39 −15 deps/v8/src/objects-inl.h
  81. +54 −31 deps/v8/src/objects.cc
  82. +65 −14 deps/v8/src/objects.h
  83. +34 −13 deps/v8/src/profile-generator.cc
  84. +7 −2 deps/v8/src/profile-generator.h
  85. +1 −3 deps/v8/src/regexp-macro-assembler.cc
  86. +10 −7 deps/v8/src/regexp.js
  87. +57 −53 deps/v8/src/runtime.cc
  88. +8 −4 deps/v8/src/runtime.js
  89. +2 −1 deps/v8/src/scanner.cc
  90. +60 −53 deps/v8/src/scanner.h
  91. +12 −0 deps/v8/src/scopeinfo.cc
  92. +3 −0 deps/v8/src/scopeinfo.h
  93. +1 −0 deps/v8/src/stub-cache.cc
  94. +1 −1 deps/v8/src/type-info.h
  95. +1 −1 deps/v8/src/utils.h
  96. +4 −0 deps/v8/src/v8-counters.h
  97. +14 −3 deps/v8/src/v8natives.js
  98. +1 −1 deps/v8/src/version.cc
  99. +0 −5 deps/v8/src/x64/assembler-x64-inl.h
  100. +113 −24 deps/v8/src/x64/assembler-x64.cc
  101. +27 −10 deps/v8/src/x64/assembler-x64.h
  102. +317 −352 deps/v8/src/x64/codegen-x64.cc
  103. +37 −19 deps/v8/src/x64/disasm-x64.cc
  104. +4 −3 deps/v8/src/x64/full-codegen-x64.cc
  105. +200 −293 deps/v8/src/x64/ic-x64.cc
  106. +117 −75 deps/v8/src/x64/macro-assembler-x64.cc
  107. +13 −1 deps/v8/src/x64/macro-assembler-x64.h
  108. +19 −20 deps/v8/src/x64/stub-cache-x64.cc
  109. +39 −17 deps/v8/src/x64/virtual-frame-x64.cc
  110. +1 −1 deps/v8/src/x64/virtual-frame-x64.h
  111. +2 −1 deps/v8/test/cctest/SConscript
  112. +158 −46 deps/v8/test/cctest/test-api.cc
  113. +51 −2 deps/v8/test/cctest/test-debug.cc
  114. +62 −0 deps/v8/test/cctest/test-disasm-arm.cc
  115. +3 −1 deps/v8/test/cctest/test-disasm-ia32.cc
  116. +2 −0 deps/v8/test/cctest/test-func-name-inference.cc
  117. +103 −44 deps/v8/test/cctest/test-heap-profiler.cc
  118. +4 −0 deps/v8/test/cctest/test-liveedit.cc
  119. +2 −2 deps/v8/test/cctest/test-profile-generator.cc
  120. +10 −0 deps/v8/test/cctest/test-serialize.cc
  121. +56 −0 deps/v8/test/cctest/test-type-info.cc
  122. +1 −1 deps/v8/test/es5conform/README
  123. +115 −102 deps/v8/test/es5conform/es5conform.status
  124. +14 −1 deps/v8/test/mjsunit/apply.js
  125. +10 −2 deps/v8/test/mjsunit/debug-setbreakpoint.js
  126. +35 −0 deps/v8/test/mjsunit/for-in.js
  127. +15 −10 deps/v8/test/mjsunit/math-sqrt.js
  128. +0 −3 deps/v8/test/mjsunit/mjsunit.status
  129. +53 −0 deps/v8/test/mjsunit/mod.js
  130. +46 −0 deps/v8/test/mjsunit/regress/regress-45469.js
  131. +56 −0 deps/v8/test/mjsunit/regress/regress-747.js
  132. +36 −0 deps/v8/test/mjsunit/regress/regress-752.js
  133. +36 −0 deps/v8/test/mjsunit/regress/regress-753.js
  134. +39 −0 deps/v8/test/mjsunit/regress/regress-754.js
  135. +5 −0 deps/v8/test/mjsunit/smi-ops.js
  136. +95 −0 deps/v8/test/mjsunit/string-externalize.js
  137. +86 −0 deps/v8/test/mjsunit/to_number_order.js
  138. +43 −9 deps/v8/test/mozilla/mozilla.status
  139. +25 −13 deps/v8/tools/stats-viewer.py
  140. +151 −159 doc/api.markdown
  141. +1 −1 doc/api_header.html
  142. +195 −0 doc/cla.html
  143. +25 −13 doc/index.html
  144. +16 −2 lib/buffer.js
  145. +1 −1 lib/crypto.js
  146. +23 −13 lib/dns.js
  147. +0 −81 lib/ini.js
  148. +0 −166 lib/mjsunit.js
  149. +0 −3 lib/module.js
  150. +5 −5 lib/net.js
  151. +70 −115 lib/querystring.js
  152. +1 −1 lib/readline.js
  153. +29 −28 lib/repl.js
  154. +1 −1 lib/string_decoder.js
  155. +25 −5 lib/sys.js
  156. +18 −9 src/node.cc
  157. +36 −2 src/node.js
  158. +14 −7 src/node_buffer.cc
  159. +5 −5 src/node_cares.cc
  160. +1 −1 src/node_child_process.cc
  161. +1 −1 src/node_crypto.cc
  162. +6 −50 src/node_events.cc
  163. +0 −2 src/node_events.h
  164. +3 −3 src/node_file.cc
  165. +16 −4 src/node_http_parser.cc
  166. +2 −2 src/node_idle_watcher.cc
  167. +1 −1 src/node_io_watcher.cc
  168. +168 −8 src/node_net.cc
  169. +164 −71 src/node_script.cc
  170. +25 −2 src/node_script.h
  171. +1 −1 src/node_signal_watcher.cc
  172. +3 −3 src/node_signal_watcher.h
  173. +1 −0 src/platform.h
  174. +20 −0 src/platform_darwin.cc
  175. +12 −0 src/platform_freebsd.cc
  176. +7 −0 src/platform_linux.cc
  177. +4 −0 src/platform_none.cc
  178. +22 −0 src/platform_sunos.cc
  179. +2 −2 test/disabled/test-cat.js
  180. +5 −5 test/disabled/test-dns.js
  181. +3 −3 test/disabled/test-eio-race3.js
  182. +2 −2 test/disabled/test-http-big-proxy-responses.js
  183. +2 −2 test/disabled/test-http-head-request.js
  184. +1 −1 test/disabled/test-http-stress.js
  185. +1 −1 test/disabled/test-remote-module-loading.js
  186. +5 −5 test/disabled/tls_client.js
  187. +2 −2 test/disabled/tls_server.js
  188. +2 −2 test/fixtures/b/c.js
  189. +2 −2 test/fixtures/child_process_should_emit_error.js
  190. +1 −1 test/fixtures/cycles/folder/foo.js
  191. +1 −1 test/fixtures/exit.js
  192. +1 −1 test/fixtures/print-10-lines.js
  193. +1 −1 test/message/2100bytes.js
  194. +1 −1 test/message/hello_world.js
  195. +7 −7 test/message/undefined_reference_in_new_context.out
  196. +1 −1 test/pummel/test-child-process-spawn-loop.js
  197. +3 −3 test/pummel/test-http-client-reconnect-bug.js
  198. +3 −3 test/pummel/test-keep-alive.js
  199. +3 −3 test/pummel/test-net-many-clients.js
  200. +4 −4 test/pummel/test-net-pause.js
  201. +6 −6 test/pummel/test-net-pingpong-delay.js
  202. +3 −3 test/pummel/test-net-pingpong.js
  203. +5 −5 test/pummel/test-net-throttle.js
  204. +9 −9 test/pummel/test-net-timeout.js
  205. +4 −4 test/pummel/test-net-tls.js
  206. +2 −2 test/pummel/test-timers.js
  207. +2 −2 test/pummel/test-watch-file.js
  208. +89 −5 test/simple/test-buffer.js
  209. +2 −2 test/simple/test-child-process-buffering.js
  210. +8 −8 test/simple/test-child-process-custom-fds.js
  211. +1 −1 test/simple/test-child-process-env.js
  212. +3 −3 test/simple/test-child-process-ipc.js
  213. +2 −2 test/simple/test-child-process-stdin.js
  214. +3 −3 test/simple/test-child-process-stdout-flush.js
  215. +3 −3 test/simple/test-crypto.js
  216. +6 −6 test/simple/test-dgram-pingpong.js
  217. +5 −5 test/simple/test-eio-race.js
  218. +3 −3 test/simple/test-eio-race2.js
  219. +2 −2 test/simple/test-eio-race4.js
  220. +1 −1 test/simple/test-error-reporting.js
  221. +3 −3 test/simple/test-event-emitter-add-listeners.js
  222. +1 −1 test/simple/test-event-emitter-modify-in-emit.js
  223. +3 −3 test/simple/test-event-emitter-remove-listeners.js
  224. +3 −3 test/simple/test-exception-handler.js
  225. +6 −6 test/simple/test-exec.js
  226. +19 −0 test/simple/test-executable-path.js
  227. +1 −1 test/simple/test-file-read-noexist.js
  228. +2 −2 test/simple/test-fs-chmod.js
  229. +1 −1 test/simple/test-fs-error-messages.js
  230. +1 −1 test/simple/test-fs-read-buffer.js
  231. +1 −1 test/simple/test-fs-read.js
  232. +1 −1 test/simple/test-fs-readfile-empty.js
  233. +5 −5 test/simple/test-fs-realpath.js
  234. +8 −8 test/simple/test-fs-stat.js
  235. +2 −2 test/simple/test-fs-symlink.js
  236. +4 −4 test/simple/test-fs-write.js
  237. +1 −1 test/simple/test-http-1.0.js
  238. +1 −1 test/simple/test-http-304.js
  239. +6 −6 test/simple/test-http-cat.js
  240. +2 −2 test/simple/test-http-chunked.js
  241. +3 −3 test/simple/test-http-client-upload.js
  242. +2 −2 test/simple/test-http-exceptions.js
  243. +4 −4 test/simple/test-http-full-response.js
  244. +1 −1 test/simple/test-http-malformed-request.js
  245. +4 −4 test/simple/test-http-parser.js
  246. +3 −3 test/simple/test-http-set-timeout.js
  247. +3 −3 test/simple/test-http-tls.js
  248. +1 −1 test/simple/test-http-upgrade-client.js
  249. +1 −1 test/simple/test-http-upgrade-server2.js
  250. +12 −12 test/simple/test-http-wget.js
  251. +1 −1 test/simple/test-http-write-empty-string.js
  252. +0 −59 test/simple/test-ini.js
  253. +1 −1 test/simple/test-memory-usage.js
  254. +5 −5 test/simple/test-mkdir-rmdir.js
  255. +1 −1 test/simple/test-module-loading.js
  256. +4 −4 test/simple/test-net-binary.js
  257. +7 −7 test/simple/test-net-pingpong.js
  258. +5 −5 test/simple/test-net-reconnect.js
  259. +2 −2 test/simple/test-net-tls.js
  260. +3 −3 test/simple/test-next-tick-ordering.js
  261. +43 −0 test/simple/test-pump-file2tcp.js
  262. +9 −0 test/simple/test-querystring.js
  263. +4 −4 test/simple/test-readdir.js
  264. +2 −2 test/simple/test-regression-object-prototype.js
  265. +1 −1 test/simple/test-repl.js
  266. +20 −0 test/simple/test-script-context.js
  267. +18 −0 test/simple/test-script-static-context.js
  268. +1 −1 test/simple/test-sendfd.js
  269. +4 −4 test/simple/test-signal-handler.js
  270. +3 −3 test/simple/test-signal-unregister.js
  271. +2 −2 test/simple/test-stdin-from-file.js
  272. +4 −4 test/simple/test-stdout-to-file.js
  273. +1 −1 test/simple/test-string-decoder.js
  274. +7 −7 test/simple/test-url.js
  275. +1 −1 test/simple/test-utf8-scripts.js
  276. +13 −0 tools/updateAuthors.awk
  277. +7 −1 wscript
View
2 .gitignore
@@ -3,9 +3,11 @@ build
tags
.lock-wscript
*.pyc
+*.patch
doc/api.xml
doc/api.html
doc/changelog.html
doc/node.1
+tmp/
node
node_g
View
22 AUTHORS
@@ -10,7 +10,7 @@ Jeff Smick <sprsquish@gmail.com>
Jon Crosby <jon@joncrosby.me>
Felix Geisendörfer <felix@debuggable.com>
Ray Morgan <rmorgan@zappos.com>
-Jérémy Lal <holisme@gmail.com>
+Jérémy Lal <kapouer@melix.org>
Isaac Z. Schlueter <i@izs.me>
Brandon Beacher <brandon.beacher@gmail.com>
Tim Caswell <tim@creationix.com>
@@ -22,11 +22,11 @@ Rhys Jones <rhys@wave.to>
Jan Lehnardt <jan@apache.org>
Simon Willison <simon@simonwillison.net>
Chew Choon Keat <choonkeat@gmail.com>
-Jed Schmidt <tr@nslator.jp>
+Jered Schmidt <tr@nslator.jp>
Michaeljohn Clement <inimino@inimino.org>
Karl Guertin <grayrest@gr.ayre.st>
Xavier Shay <xavier@rhnh.net>
-Christopher Lenz <chris@lamech.local>
+Christopher Lenz <cmlenz@gmail.com>
TJ Holowaychuk <tj@vision-media.ca>
Johan Dahlberg <jfd@distrop.com>
Simon Cornelius P. Umacob <simoncpu@gmail.com>
@@ -38,13 +38,13 @@ David Sklar <david.sklar@gmail.com>
Charles Lehner <celehner1@gmail.com>
Elliott Cable <me@ell.io>
Benjamin Thomas <benjamin@benjaminthomas.org>
-Vanilla Hsu <v@fatpipi.com>
+San-Tai Hsu <v@fatpipi.com>
Ben Williamson <benw@pobox.com>
Joseph Pecoraro <joepeck02@gmail.com>
Erich Ocean <erich.ocean@me.com>
Alexis Sellier <self@cloudhead.net>
Blaine Cook <romeda@gmail.com>
-Standa Opichal <opichals@gmail.com>
+Stanislav Opichal <opichals@gmail.com>
Aaron Heckmann <aaron.heckmann@gmail.com>
Mikeal Rogers <mikeal.rogers@gmail.com>
Matt Brubeck <mbrubeck@limpet.net>
@@ -59,10 +59,10 @@ Arlo Breault <arlolra@gmail.com>
Kris Kowal <kris.kowal@cixar.com>
Jacek Becela <jacek.becela@gmail.com>
Rob Ellis <kazoomer@gmail.com>
-Tim-Smart <timehAndGod@gmail.com>
+Tim Smart <timehAndGod@gmail.com>
Herbert Vojčík <herby@mailbox.sk>
Krishna Rajendran <krishna@emptybox.org>
-pyrotechnick <pyrotechnick@feistystudios.com>
+Nicholas Kinsey <pyrotechnick@feistystudios.com>
Scott Taylor <scott@railsnewbie.com>
Carson McDonald <carson@ioncannon.net>
Matt Ranney <mjr@ranney.com>
@@ -71,13 +71,13 @@ Julian Lamb <thepurlieu@gmail.com>
Brian Hammond <brian@fictorial.com>
Mathias Pettersson <mape@mape.me>
Trevor Blackwell <tlb@tlb.org>
-Thomas Lee <tom@tom-debian.sensis.com.au>
+Thomas Lee <thomas.lee@shinetech.com>
Daniel Berger <code+node@dpbis.net>
Paulo Matias <paulo.matias@usp.br>
Peter Griess <pg@std.in>
Jonathan Knezek <jdknezek@gmail.com>
Jonathan Rentzsch <jwr.git@redshed.net>
-Ben Noordhuis <bnoordhuis@bender.(none)>
+Ben Noordhuis <info@bnoordhuis.nl>
Elijah Insua <tmpvar@gmail.com>
Andrew Johnston <apjohnsto@gmail.com>
Brian White <mscdex@mscdex.net>
@@ -90,3 +90,7 @@ Paul Querna <pquerna@apache.org>
Ben Lowery <ben@blowery.org>
Peter Dekkers <soderblom.peter@gmail.com>
David Siegel <david@artcom.de>
+Marshall Culpepper <marshall.law@gmail.com>
+Ruben Rodriguez <cha0s@therealcha0s.net>
+Dmitry Baranovskiy <Dmitry@Baranovskiy.com>
+Blake Mizerany <blake.mizerany@gmail.com>
View
21 ChangeLog
@@ -1,4 +1,23 @@
-2010.06.21, Version 0.1.99
+2010.07.03, Version 0.1.100
+
+* process.execPath (Marshall Culpepper)
+
+* sys.pump (Mikeal Rogers)
+
+* Remove ini and mjsunit libraries.
+
+* Introduce console.log() and friends.
+
+* Switch order of arguments for Buffer.write (Blake Mizerany)
+
+* On overlapping buffers use memmove (Matt Ranney)
+
+* Resolve .local domains with getaddrinfo()
+
+* Upgrade http-parser, V8 to 2.2.21
+
+
+2010.06.21, Version 0.1.99, a620b7298f68f68a855306437a3b60b650d61d78
* Datagram sockets (Paul Querna)
View
16 benchmark/http_simple.js
@@ -3,14 +3,12 @@ Buffer = require("buffer").Buffer;
port = parseInt(process.env.PORT || 8000);
-var puts = require("sys").puts;
-
var old = (process.argv[2] == 'old');
-puts('pid ' + process.pid);
+console.log('pid ' + process.pid);
http = require(old ? "http_old" : 'http');
-if (old) puts('old version');
+if (old) console.log('old version');
fixed = ""
for (var i = 0; i < 20*1024; i++) {
@@ -30,9 +28,9 @@ http.createServer(function (req, res) {
if (command == "bytes") {
var n = parseInt(arg, 10)
if (n <= 0)
- throw "bytes called with n <= 0"
+ throw "bytes called with n <= 0"
if (stored[n] === undefined) {
- puts("create stored[n]");
+ console.log("create stored[n]");
stored[n] = "";
for (var i = 0; i < n; i++) {
stored[n] += "C"
@@ -44,7 +42,7 @@ http.createServer(function (req, res) {
var n = parseInt(arg, 10)
if (n <= 0) throw new Error("bytes called with n <= 0");
if (storedBuffer[n] === undefined) {
- puts("create storedBuffer[n]");
+ console.log("create storedBuffer[n]");
storedBuffer[n] = new Buffer(n);
for (var i = 0; i < n; i++) {
storedBuffer[n][i] = "C".charCodeAt(0);
@@ -66,7 +64,7 @@ http.createServer(function (req, res) {
var content_length = body.length.toString();
- res.writeHead( status
+ res.writeHead( status
, { "Content-Type": "text/plain"
, "Content-Length": content_length
}
@@ -79,4 +77,4 @@ http.createServer(function (req, res) {
}
}).listen(port);
-puts('Listening at http://127.0.0.1:'+port+'/');
+console.log('Listening at http://127.0.0.1:'+port+'/');
View
28 benchmark/http_simple.rb
@@ -7,45 +7,45 @@ def fib(n)
def wait(seconds)
n = (seconds / 0.01).to_i
- n.times do
+ n.times do
sleep(0.01)
- #File.read(DIR + '/yahoo.html')
+ #File.read(DIR + '/yahoo.html')
end
end
class SimpleApp
@@responses = {}
-
+
def initialize
@count = 0
end
-
+
def deferred?(env)
false
end
-
+
def call(env)
path = env['PATH_INFO'] || env['REQUEST_URI']
commands = path.split('/')
-
+
@count += 1
if commands.include?('periodical_activity') and @count % 10 != 1
return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"]
end
-
+
if commands.include?('fibonacci')
n = commands.last.to_i
raise "fibonacci called with n <= 0" if n <= 0
body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ')
status = 200
-
+
elsif commands.include?('wait')
n = commands.last.to_f
raise "wait called with n <= 0" if n <= 0
wait(n)
body = "waited about #{n} seconds"
status = 200
-
+
elsif commands.include?('bytes')
n = commands.last.to_i
raise "bytes called with n <= 0" if n <= 0
@@ -56,17 +56,17 @@ def call(env)
n = 20 * 1024;
body = @@responses[n] || "C"*n
status = 200
-
+
elsif commands.include?('test_post_length')
input_body = ""
while chunk = env['rack.input'].read(512)
- input_body << chunk
+ input_body << chunk
end
if env['CONTENT_LENGTH'].to_i == input_body.length
body = "Content-Length matches input length"
status = 200
else
- body = "Content-Length doesn't matches input length!
+ body = "Content-Length doesn't matches input length!
content_length = #{env['CONTENT_LENGTH'].to_i}
input_body.length = #{input_body.length}"
status = 500
@@ -75,7 +75,7 @@ def call(env)
status = 404
body = "Undefined url"
end
-
+
body += "\r\n"
headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }
[status, headers, [body]]
@@ -90,6 +90,6 @@ def call(env)
require 'thin'
require 'ebb'
# Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000)
- Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
+ Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
# Ebb::start_server(SimpleApp.new, :port => 8000)
end
View
4 benchmark/run.js
@@ -22,9 +22,9 @@ function runNext (i) {
sys.print(benchmarks[i] + ": ");
exec(benchmarks[i], function (elapsed, code) {
if (code != 0) {
- sys.puts("ERROR ");
+ console.log("ERROR ");
}
- sys.puts(elapsed);
+ console.log(elapsed);
runNext(i+1);
});
};
View
6 bin/node-repl
@@ -1,9 +1,7 @@
#!/usr/bin/env node
-var puts = require("sys").puts;
-
-puts("Type '.help' for options.");
-puts("(The REPL can also be started by typing 'node' without arguments)");
+console.log("Type '.help' for options.");
+console.log("(The REPL can also be started by typing 'node' without arguments)");
require('repl').start();
View
249 deps/http_parser/http_parser.c
@@ -77,7 +77,30 @@ do { \
#define CLOSE "close"
-static const unsigned char lowcase[] =
+static const char *method_strings[] =
+ { "DELETE"
+ , "GET"
+ , "HEAD"
+ , "POST"
+ , "PUT"
+ , "CONNECT"
+ , "OPTIONS"
+ , "TRACE"
+ , "COPY"
+ , "LOCK"
+ , "MKCOL"
+ , "MOVE"
+ , "PROPFIND"
+ , "PROPPATCH"
+ , "UNLOCK"
+ , "REPORT"
+ , "MKACTIVITY"
+ , "CHECKOUT"
+ , "MERGE"
+ };
+
+
+static const char lowcase[256] =
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0"
"\0abcdefghijklmnopqrstuvwxyz\0\0\0\0_"
@@ -248,35 +271,6 @@ enum flags
#endif
-#define ngx_str3_cmp(m, c0, c1, c2) \
- m[0] == c0 && m[1] == c1 && m[2] == c2
-
-#define ngx_str3Ocmp(m, c0, c1, c2, c3) \
- m[0] == c0 && m[2] == c2 && m[3] == c3
-
-#define ngx_str4cmp(m, c0, c1, c2, c3) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3
-
-#define ngx_str5cmp(m, c0, c1, c2, c3, c4) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 && m[4] == c4
-
-#define ngx_str6cmp(m, c0, c1, c2, c3, c4, c5) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
- && m[4] == c4 && m[5] == c5
-
-#define ngx_str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
- && m[4] == c4 && m[5] == c5 && m[6] == c6
-
-#define ngx_str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
- && m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7
-
-#define ngx_str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
- m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
- && m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7 && m[8] == c8
-
-
size_t http_parser_execute (http_parser *parser,
const http_parser_settings *settings,
const char *data,
@@ -327,9 +321,10 @@ size_t http_parser_execute (http_parser *parser,
for (p=data, pe=data+len; p != pe; p++) {
ch = *p;
- if (++nread > HTTP_MAX_HEADER_SIZE && PARSING_HEADER(state)) {
+ if (PARSING_HEADER(state)) {
+ ++nread;
/* Buffer overflow attack */
- goto error;
+ if (nread > HTTP_MAX_HEADER_SIZE) goto error;
}
switch (state) {
@@ -353,10 +348,7 @@ size_t http_parser_execute (http_parser *parser,
state = s_res_or_resp_H;
else {
parser->type = HTTP_REQUEST;
- if (ch < 'A' || 'Z' < ch) goto error;
- parser->buffer[0] = ch;
- index = 0;
- state = s_req_method;
+ goto start_req_method_assign;
}
break;
}
@@ -366,12 +358,10 @@ size_t http_parser_execute (http_parser *parser,
parser->type = HTTP_RESPONSE;
state = s_res_HT;
} else {
- if (ch < 'A' || 'Z' < ch) goto error;
+ if (ch != 'E') goto error;
parser->type = HTTP_REQUEST;
- parser->method = (enum http_method) 0;
- parser->buffer[0] = 'H';
- parser->buffer[1] = ch;
- index = 1;
+ parser->method = HTTP_HEAD;
+ index = 2;
state = s_req_method;
}
break;
@@ -534,128 +524,64 @@ size_t http_parser_execute (http_parser *parser,
if (ch < 'A' || 'Z' < ch) goto error;
+ start_req_method_assign:
parser->method = (enum http_method) 0;
- index = 0;
- parser->buffer[0] = ch;
+ index = 1;
+ switch (ch) {
+ case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break;
+ case 'D': parser->method = HTTP_DELETE; break;
+ case 'G': parser->method = HTTP_GET; break;
+ case 'H': parser->method = HTTP_HEAD; break;
+ case 'L': parser->method = HTTP_LOCK; break;
+ case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE */ break;
+ case 'O': parser->method = HTTP_OPTIONS; break;
+ case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
+ case 'R': parser->method = HTTP_REPORT; break;
+ case 'T': parser->method = HTTP_TRACE; break;
+ case 'U': parser->method = HTTP_UNLOCK; break;
+ default: goto error;
+ }
state = s_req_method;
break;
}
case s_req_method:
- if (ch == ' ') {
- assert(index+1 < HTTP_PARSER_MAX_METHOD_LEN);
- parser->buffer[index+1] = '\0';
-
- switch (index+1) {
- case 3:
- if (ngx_str3_cmp(parser->buffer, 'G', 'E', 'T')) {
- parser->method = HTTP_GET;
- break;
- }
-
- if (ngx_str3_cmp(parser->buffer, 'P', 'U', 'T')) {
- parser->method = HTTP_PUT;
- break;
- }
-
- break;
-
- case 4:
- if (ngx_str4cmp(parser->buffer, 'P', 'O', 'S', 'T')) {
- parser->method = HTTP_POST;
- break;
- }
-
- if (ngx_str4cmp(parser->buffer, 'H', 'E', 'A', 'D')) {
- parser->method = HTTP_HEAD;
- break;
- }
-
- if (ngx_str4cmp(parser->buffer, 'C', 'O', 'P', 'Y')) {
- parser->method = HTTP_COPY;
- break;
- }
-
- if (ngx_str4cmp(parser->buffer, 'M', 'O', 'V', 'E')) {
- parser->method = HTTP_MOVE;
- break;
- }
-
- break;
-
- case 5:
- if (ngx_str5cmp(parser->buffer, 'M', 'K', 'C', 'O', 'L')) {
- parser->method = HTTP_MKCOL;
- break;
- }
-
- if (ngx_str5cmp(parser->buffer, 'T', 'R', 'A', 'C', 'E')) {
- parser->method = HTTP_TRACE;
- break;
- }
-
- break;
-
- case 6:
- if (ngx_str6cmp(parser->buffer, 'D', 'E', 'L', 'E', 'T', 'E')) {
- parser->method = HTTP_DELETE;
- break;
- }
-
- if (ngx_str6cmp(parser->buffer, 'U', 'N', 'L', 'O', 'C', 'K')) {
- parser->method = HTTP_UNLOCK;
- break;
- }
-
- break;
-
- case 7:
- if (ngx_str7_cmp(parser->buffer,
- 'O', 'P', 'T', 'I', 'O', 'N', 'S', '\0')) {
- parser->method = HTTP_OPTIONS;
- break;
- }
-
- if (ngx_str7_cmp(parser->buffer,
- 'C', 'O', 'N', 'N', 'E', 'C', 'T', '\0')) {
- parser->method = HTTP_CONNECT;
- break;
- }
-
- break;
-
- case 8:
- if (ngx_str8cmp(parser->buffer,
- 'P', 'R', 'O', 'P', 'F', 'I', 'N', 'D')) {
- parser->method = HTTP_PROPFIND;
- break;
- }
-
- break;
-
- case 9:
- if (ngx_str9cmp(parser->buffer,
- 'P', 'R', 'O', 'P', 'P', 'A', 'T', 'C', 'H')) {
- parser->method = HTTP_PROPPATCH;
- break;
- }
+ {
+ if (ch == '\0')
+ goto error;
- break;
- }
+ const char *matcher = method_strings[parser->method];
+ if (ch == ' ' && matcher[index] == '\0') {
state = s_req_spaces_before_url;
- break;
- }
-
- if (ch < 'A' || 'Z' < ch) goto error;
-
- if (++index >= HTTP_PARSER_MAX_METHOD_LEN - 1) {
+ } else if (ch == matcher[index]) {
+ ; // nada
+ } else if (parser->method == HTTP_CONNECT) {
+ if (index == 1 && ch == 'H') {
+ parser->method = HTTP_CHECKOUT;
+ } else if (index == 2 && ch == 'P') {
+ parser->method = HTTP_COPY;
+ }
+ } else if (parser->method == HTTP_MKCOL) {
+ if (index == 1 && ch == 'O') {
+ parser->method = HTTP_MOVE;
+ } else if (index == 1 && ch == 'E') {
+ parser->method = HTTP_MERGE;
+ } else if (index == 2 && ch == 'A') {
+ parser->method = HTTP_MKACTIVITY;
+ }
+ } else if (index == 1 && parser->method == HTTP_POST && ch == 'R') {
+ parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */
+ } else if (index == 1 && parser->method == HTTP_POST && ch == 'U') {
+ parser->method = HTTP_PUT;
+ } else if (index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
+ parser->method = HTTP_PROPPATCH;
+ } else {
goto error;
}
- parser->buffer[index] = ch;
-
+ ++index;
break;
-
+ }
case s_req_spaces_before_url:
{
if (ch == ' ') break;
@@ -1069,7 +995,7 @@ size_t http_parser_execute (http_parser *parser,
case s_header_field:
{
- c = lowcase[(int)ch];
+ c = lowcase[(unsigned char)ch];
if (c) {
switch (header_state) {
@@ -1205,7 +1131,7 @@ size_t http_parser_execute (http_parser *parser,
state = s_header_value;
index = 0;
- c = lowcase[(int)ch];
+ c = lowcase[(unsigned char)ch];
if (!c) {
if (ch == CR) {
@@ -1266,7 +1192,7 @@ size_t http_parser_execute (http_parser *parser,
case s_header_value:
{
- c = lowcase[(int)ch];
+ c = lowcase[(unsigned char)ch];
if (!c) {
if (ch == CR) {
@@ -1378,7 +1304,6 @@ size_t http_parser_execute (http_parser *parser,
break;
}
- parser->body_read = 0;
nread = 0;
if (parser->flags & F_UPGRADE) parser->upgrade = 1;
@@ -1439,12 +1364,12 @@ size_t http_parser_execute (http_parser *parser,
}
case s_body_identity:
- to_read = MIN(pe - p, (ssize_t)(parser->content_length - parser->body_read));
+ to_read = MIN(pe - p, (ssize_t)parser->content_length);
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
p += to_read - 1;
- parser->body_read += to_read;
- if (parser->body_read == parser->content_length) {
+ parser->content_length -= to_read;
+ if (parser->content_length == 0) {
CALLBACK2(message_complete);
state = NEW_MESSAGE();
}
@@ -1457,7 +1382,6 @@ size_t http_parser_execute (http_parser *parser,
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
p += to_read - 1;
- parser->body_read += to_read;
}
break;
@@ -1598,6 +1522,12 @@ http_should_keep_alive (http_parser *parser)
}
+const char * http_method_str (enum http_method m)
+{
+ return method_strings[m];
+}
+
+
void
http_parser_init (http_parser *parser, enum http_parser_type t)
{
@@ -1606,4 +1536,3 @@ http_parser_init (http_parser *parser, enum http_parser_type t)
parser->nread = 0;
parser->upgrade = 0;
}
-
View
47 deps/http_parser/http_parser.h
@@ -63,29 +63,30 @@ typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
typedef int (*http_cb) (http_parser*);
-/* Should be at least one longer than the longest request method */
-#define HTTP_PARSER_MAX_METHOD_LEN 10
-
-
/* Request Methods */
enum http_method
- { HTTP_DELETE = 0x0001
- , HTTP_GET = 0x0002
- , HTTP_HEAD = 0x0004
- , HTTP_POST = 0x0008
- , HTTP_PUT = 0x0010
+ { HTTP_DELETE = 0
+ , HTTP_GET
+ , HTTP_HEAD
+ , HTTP_POST
+ , HTTP_PUT
/* pathological */
- , HTTP_CONNECT = 0x0020
- , HTTP_OPTIONS = 0x0040
- , HTTP_TRACE = 0x0080
+ , HTTP_CONNECT
+ , HTTP_OPTIONS
+ , HTTP_TRACE
/* webdav */
- , HTTP_COPY = 0x0100
- , HTTP_LOCK = 0x0200
- , HTTP_MKCOL = 0x0400
- , HTTP_MOVE = 0x0800
- , HTTP_PROPFIND = 0x1000
- , HTTP_PROPPATCH = 0x2000
- , HTTP_UNLOCK = 0x4000
+ , HTTP_COPY
+ , HTTP_LOCK
+ , HTTP_MKCOL
+ , HTTP_MOVE
+ , HTTP_PROPFIND
+ , HTTP_PROPPATCH
+ , HTTP_UNLOCK
+ /* subversion */
+ , HTTP_REPORT
+ , HTTP_MKACTIVITY
+ , HTTP_CHECKOUT
+ , HTTP_MERGE
};
@@ -102,15 +103,13 @@ struct http_parser {
char flags;
size_t nread;
- ssize_t body_read;
ssize_t content_length;
/** READ-ONLY **/
- unsigned short status_code; /* responses only */
- unsigned short method; /* requests only */
unsigned short http_major;
unsigned short http_minor;
- char buffer[HTTP_PARSER_MAX_METHOD_LEN];
+ unsigned short status_code; /* responses only */
+ unsigned char method; /* requests only */
/* 1 = Upgrade header was present and the parser has exited because of that.
* 0 = No upgrade header present.
@@ -155,6 +154,8 @@ size_t http_parser_execute(http_parser *parser,
*/
int http_should_keep_alive(http_parser *parser);
+/* Returns a string version of the HTTP method. */
+const char *http_method_str(enum http_method);
#ifdef __cplusplus
}
View
149 deps/http_parser/test.c
@@ -519,6 +519,25 @@ const struct message requests[] =
,.body= ""
}
+#define REPORT_REQ 18
+, {.name= "report request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "REPORT /test HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_REPORT
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/test"
+ ,.request_url= "/test"
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
, {.name= NULL } /* sentinel */
};
@@ -932,6 +951,19 @@ static http_parser_settings settings_count_body =
,.on_message_complete = message_complete_cb
};
+static http_parser_settings settings_null =
+ {.on_message_begin = 0
+ ,.on_header_field = 0
+ ,.on_header_value = 0
+ ,.on_path = 0
+ ,.on_url = 0
+ ,.on_fragment = 0
+ ,.on_query_string = 0
+ ,.on_body = 0
+ ,.on_headers_complete = 0
+ ,.on_message_complete = 0
+ };
+
void
parser_init (enum http_parser_type type)
{
@@ -1168,23 +1200,80 @@ test_message_count_body (const struct message *message)
}
void
-test_error (const char *buf)
+test_simple (const char *buf, int should_pass)
{
parser_init(HTTP_REQUEST);
size_t parsed;
-
+ int pass;
parsed = parse(buf, strlen(buf));
- if (parsed != strlen(buf)) goto out;
+ pass = (parsed == strlen(buf));
parsed = parse(NULL, 0);
- if (parsed != 0) goto out;
+ pass &= (parsed == 0);
- fprintf(stderr, "\n*** Error expected but none found ***\n\n%s", buf);
+ parser_free();
+
+ if (pass != should_pass) {
+ fprintf(stderr, "\n*** test_simple expected %s ***\n\n%s", should_pass ? "success" : "error", buf);
+ exit(1);
+ }
+}
+
+void
+test_header_overflow_error (int req)
+{
+ http_parser parser;
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
+ size_t parsed;
+ const char *buf;
+ buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n";
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
+ assert(parsed == strlen(buf));
+
+ buf = "header-key: header-value\r\n";
+ int i;
+ for (i = 0; i < 10000; i++) {
+ if (http_parser_execute(&parser, &settings_null, buf, strlen(buf)) != strlen(buf)) {
+ //fprintf(stderr, "error found on iter %d\n", i);
+ return;
+ }
+ }
+
+ fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n");
exit(1);
+}
+
+void
+test_no_overflow_long_body (int req, size_t length)
+{
+ http_parser parser;
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
+ size_t parsed;
+ size_t i;
+ char buf1[3000];
+ size_t buf1len = sprintf(buf1, "%s\r\nConnection: Keep-Alive\r\nContent-Length: %zu\r\n\r\n",
+ req ? "POST / HTTP/1.0" : "HTTP/1.0 200 OK", length);
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
+ if (parsed != buf1len)
+ goto err;
+
+ for (i = 0; i < length; i++) {
+ char foo = 'a';
+ parsed = http_parser_execute(&parser, &settings_null, &foo, 1);
+ if (parsed != 1)
+ goto err;
+ }
+
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
+ if (parsed != buf1len) goto err;
return;
-out:
- parser_free();
+ err:
+ fprintf(stderr,
+ "\n*** error in test_no_overflow_long_body %s of length %zu ***\n",
+ req ? "REQUEST" : "RESPONSE",
+ length);
+ exit(1);
}
void
@@ -1410,6 +1499,16 @@ main (void)
for (request_count = 0; requests[request_count].name; request_count++);
for (response_count = 0; responses[response_count].name; response_count++);
+ //// OVERFLOW CONDITIONS
+
+ test_header_overflow_error(HTTP_REQUEST);
+ test_no_overflow_long_body(HTTP_REQUEST, 1000);
+ test_no_overflow_long_body(HTTP_REQUEST, 100000);
+
+ test_header_overflow_error(HTTP_RESPONSE);
+ test_no_overflow_long_body(HTTP_RESPONSE, 1000);
+ test_no_overflow_long_body(HTTP_RESPONSE, 100000);
+
//// RESPONSES
for (i = 0; i < response_count; i++) {
@@ -1476,8 +1575,36 @@ main (void)
/// REQUESTS
- test_error("hello world");
- test_error("GET / HTP/1.1\r\n\r\n");
+ test_simple("hello world", 0);
+ test_simple("GET / HTP/1.1\r\n\r\n", 0);
+
+ test_simple("ASDF / HTTP/1.1\r\n\r\n", 0);
+ test_simple("PROPPATCHA / HTTP/1.1\r\n\r\n", 0);
+ test_simple("GETA / HTTP/1.1\r\n\r\n", 0);
+
+ static const char *all_methods[] = {
+ "DELETE",
+ "GET",
+ "HEAD",
+ "POST",
+ "PUT",
+ "CONNECT",
+ "OPTIONS",
+ "TRACE",
+ "COPY",
+ "LOCK",
+ "MKCOL",
+ "MOVE",
+ "PROPFIND",
+ "PROPPATCH",
+ "UNLOCK",
+ 0 };
+ const char **this_method;
+ for (this_method = all_methods; *this_method; this_method++) {
+ char buf[200];
+ sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
+ test_simple(buf, 1);
+ }
const char *dumbfuck2 =
"GET / HTTP/1.1\r\n"
@@ -1514,7 +1641,7 @@ main (void)
"\tRA==\r\n"
"\t-----END CERTIFICATE-----\r\n"
"\r\n";
- test_error(dumbfuck2);
+ test_simple(dumbfuck2, 0);
#if 0
// NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body
@@ -1526,7 +1653,7 @@ main (void)
"Accept: */*\r\n"
"\r\n"
"HELLO";
- test_error(bad_get_no_headers_no_body);
+ test_simple(bad_get_no_headers_no_body, 0);
#endif
/* TODO sending junk and large headers gets rejected */
View
43 deps/v8/ChangeLog
@@ -1,3 +1,46 @@
+2010-06-30: Version 2.2.21
+
+ Fix bug in externalizing some ASCII strings (Chromium issue 47824).
+
+ Update JSON.stringify to floor the space parameter (issue 753).
+
+ Update the Mozilla test expectations to the newest version.
+
+ Update the ES5 Conformance Test expectations to the latest version.
+
+ Update the V8 benchmark suite.
+
+ Provide actual breakpoints locations in response to setBreakpoint
+ and listBreakpoints requests.
+
+2010-06-28: Version 2.2.20
+ Fix bug with for-in on x64 platform (issue 748).
+
+ Fix crash bug on x64 platform (issue 756).
+
+ Fix bug in Object.getOwnPropertyNames. (chromium issue 41243).
+
+ Fix a bug on ARM that caused the result of 1 << x to be
+ miscalculated for some inputs.
+
+ Performance improvements on all platforms.
+
+2010-06-23: Version 2.2.19
+
+ Fix bug that causes the build to break when profillingsupport=off
+ (issue 738).
+
+ Added expose-externalize-string flag for testing extensions.
+
+ Resolve linker issues with using V8 as a DLL causing a number of
+ problems with unresolved symbols.
+
+ Fix build failure for cctests when ENABLE_DEBUGGER_SUPPORT is not
+ defined.
+
+ Performance improvements on all platforms.
+
+
2010-06-16: Version 2.2.18
Added API functions to retrieve information on indexed properties
View
12 deps/v8/benchmarks/README.txt
@@ -66,6 +66,12 @@ extensions enabled.
Changes from Version 5 to Version 6
===================================
-Removed dead code from the RayTrace benchmark and changed the Splay
-benchmark to avoid converting the same numeric key to a string over
-and over again.
+Removed dead code from the RayTrace benchmark and fixed a couple of
+typos in the DeltaBlue implementation. Changed the Splay benchmark to
+avoid converting the same numeric key to a string over and over again
+and to avoid inserting and removing the same element repeatedly thus
+increasing pressure on the memory subsystem.
+
+Furthermore, the benchmark runner was changed to run the benchmarks
+for at least a few times to stabilize the reported numbers on slower
+machines.
View
40 deps/v8/benchmarks/base.js
@@ -198,15 +198,33 @@ BenchmarkSuite.prototype.NotifyError = function(error) {
// Runs a single benchmark for at least a second and computes the
// average time it takes to run a single iteration.
-BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) {
- var elapsed = 0;
- var start = new Date();
- for (var n = 0; elapsed < 1000; n++) {
- benchmark.run();
- elapsed = new Date() - start;
+BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark, data) {
+ function Measure(data) {
+ var elapsed = 0;
+ var start = new Date();
+ for (var n = 0; elapsed < 1000; n++) {
+ benchmark.run();
+ elapsed = new Date() - start;
+ }
+ if (data != null) {
+ data.runs += n;
+ data.elapsed += elapsed;
+ }
+ }
+
+ if (data == null) {
+ // Measure the benchmark once for warm up and throw the result
+ // away. Return a fresh data object.
+ Measure(null);
+ return { runs: 0, elapsed: 0 };
+ } else {
+ Measure(data);
+ // If we've run too few iterations, we continue for another second.
+ if (data.runs < 32) return data;
+ var usec = (data.elapsed * 1000) / data.runs;
+ this.NotifyStep(new BenchmarkResult(benchmark, usec));
+ return null;
}
- var usec = (elapsed * 1000) / n;
- this.NotifyStep(new BenchmarkResult(benchmark, usec));
}
@@ -220,6 +238,7 @@ BenchmarkSuite.prototype.RunStep = function(runner) {
var length = this.benchmarks.length;
var index = 0;
var suite = this;
+ var data;
// Run the setup, the actual benchmark, and the tear down in three
// separate steps to allow the framework to yield between any of the
@@ -241,12 +260,13 @@ BenchmarkSuite.prototype.RunStep = function(runner) {
function RunNextBenchmark() {
try {
- suite.RunSingleBenchmark(suite.benchmarks[index]);
+ data = suite.RunSingleBenchmark(suite.benchmarks[index], data);
} catch (e) {
suite.NotifyError(e);
return null;
}
- return RunNextTearDown;
+ // If data is null, we're done with this benchmark.
+ return (data == null) ? RunNextTearDown : RunNextBenchmark();
}
function RunNextTearDown() {
View
2 deps/v8/benchmarks/crypto.js
@@ -31,7 +31,7 @@
// The code has been adapted for use as a benchmark by Google.
-var Crypto = new BenchmarkSuite('Crypto', 203037, [
+var Crypto = new BenchmarkSuite('Crypto', 110465, [
new Benchmark("Encrypt", encrypt),
new Benchmark("Decrypt", decrypt)
]);
View
8 deps/v8/benchmarks/deltablue.js
@@ -23,13 +23,13 @@
// more like a JavaScript program.
-var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [
+var DeltaBlue = new BenchmarkSuite('DeltaBlue', 30282, [
new Benchmark('DeltaBlue', deltaBlue)
]);
/**
- * A JavaScript implementation of the DeltaBlue constrain-solving
+ * A JavaScript implementation of the DeltaBlue constraint-solving
* algorithm, as described in:
*
* "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver"
@@ -349,13 +349,13 @@ function BinaryConstraint(var1, var2, strength) {
BinaryConstraint.inheritsFrom(Constraint);
/**
- * Decides if this constratint can be satisfied and which way it
+ * Decides if this constraint can be satisfied and which way it
* should flow based on the relative strength of the variables related,
* and record that decision.
*/
BinaryConstraint.prototype.chooseMethod = function (mark) {
if (this.v1.mark == mark) {
- this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength))
+ this.direction = (this.v2.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength))
? Direction.FORWARD
: Direction.NONE;
}
View
2 deps/v8/benchmarks/earley-boyer.js
@@ -1,7 +1,7 @@
// This file is automatically generated by scheme2js, except for the
// benchmark harness code at the beginning and end of the file.
-var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 765819, [
+var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 280581, [
new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }),
new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); })
]);
View
2 deps/v8/benchmarks/raytrace.js
@@ -8,7 +8,7 @@
// untouched. This file also contains a copy of parts of the Prototype
// JavaScript framework which is used by the ray tracer.
-var RayTrace = new BenchmarkSuite('RayTrace', 932666, [
+var RayTrace = new BenchmarkSuite('RayTrace', 533115, [
new Benchmark('RayTrace', renderScene)
]);
View
2 deps/v8/benchmarks/regexp.js
@@ -35,7 +35,7 @@
// letters in the data are encoded using ROT13 in a way that does not
// affect how the regexps match their input.
-var RegRxp = new BenchmarkSuite('RegExp', 995230, [
+var RegRxp = new BenchmarkSuite('RegExp', 601250, [
new Benchmark("RegExp", runRegExpBenchmark)
]);
View
13 deps/v8/benchmarks/revisions.html
@@ -22,10 +22,15 @@
<div class="subtitle"><h3>Version 6 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v6/run.html">link</a>)</h3></div>
-<p>Removed dead code from the RayTrace benchmark and changed the Splay
-benchmark to avoid converting the same numeric key to a string over
-and over again.
-</p>
+<p>Removed dead code from the RayTrace benchmark and fixed a couple of
+typos in the DeltaBlue implementation. Changed the Splay benchmark to
+avoid converting the same numeric key to a string over and over again
+and to avoid inserting and removing the same element repeatedly thus
+increasing pressure on the memory subsystem.</p>
+
+<p>Furthermore, the benchmark runner was changed to run the benchmarks
+for at least a few times to stabilize the reported numbers on slower
+machines.</p>
<div class="subtitle"><h3>Version 5 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v5/run.html">link</a>)</h3></div>
View
2 deps/v8/benchmarks/richards.js
@@ -35,7 +35,7 @@
// Martin Richards.
-var Richards = new BenchmarkSuite('Richards', 34886, [
+var Richards = new BenchmarkSuite('Richards', 20687, [
new Benchmark("Richards", runRichards)
]);
View
2 deps/v8/benchmarks/run.html
@@ -116,7 +116,7 @@
<li><b>RegExp</b><br>Regular expression benchmark generated by extracting regular expression operations from 50 of the most popular web pages
(<i>1614 lines</i>).
</li>
-<li><b>Splay</b><br>Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (<i>379 lines</i>).</li>
+<li><b>Splay</b><br>Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (<i>394 lines</i>).</li>
</ul>
<p>
View
21 deps/v8/benchmarks/splay.js
@@ -33,7 +33,7 @@
// also has to deal with a lot of changes to the large tree object
// graph.
-var Splay = new BenchmarkSuite('Splay', 126125, [
+var Splay = new BenchmarkSuite('Splay', 21915, [
new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown)
]);
@@ -231,8 +231,23 @@ SplayTree.prototype.find = function(key) {
/**
+ * @return {SplayTree.Node} Node having the maximum key value.
+ */
+SplayTree.prototype.findMax = function(opt_startNode) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ var current = opt_startNode || this.root_;
+ while (current.right) {
+ current = current.right;
+ }
+ return current;
+};
+
+
+/**
* @return {SplayTree.Node} Node having the maximum key value that
- * is less or equal to the specified key value.
+ * is less than the specified key value.
*/
SplayTree.prototype.findGreatestLessThan = function(key) {
if (this.isEmpty()) {
@@ -243,7 +258,7 @@ SplayTree.prototype.findGreatestLessThan = function(key) {
this.splay_(key);
// Now the result is either the root node or the greatest node in
// the left subtree.
- if (this.root_.key <= key) {
+ if (this.root_.key < key) {
return this.root_;
} else if (this.root_.left) {
return this.findMax(this.root_.left);
View
4 deps/v8/include/v8-profiler.h
@@ -196,7 +196,9 @@ class V8EXPORT HeapGraphEdge {
enum Type {
CONTEXT_VARIABLE = 0, // A variable from a function context.
ELEMENT = 1, // An element of an array.
- PROPERTY = 2 // A named object property.
+ PROPERTY = 2, // A named object property.
+ INTERNAL = 3 // A link that can't be accessed from JS,
+ // thus, its name isn't a real property name.
};
/** Returns edge type (see HeapGraphEdge::Type). */
View
8 deps/v8/include/v8.h
@@ -3211,11 +3211,9 @@ class Internals {
static const int kFullStringRepresentationMask = 0x07;
static const int kExternalTwoByteRepresentationTag = 0x02;
- // These constants are compiler dependent so their values must be
- // defined within the implementation.
- V8EXPORT static int kJSObjectType;
- V8EXPORT static int kFirstNonstringType;
- V8EXPORT static int kProxyType;
+ static const int kJSObjectType = 0x9f;
+ static const int kFirstNonstringType = 0x80;
+ static const int kProxyType = 0x85;
static inline bool HasHeapObjectTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
View
8 deps/v8/src/api.cc
@@ -106,9 +106,6 @@ static i::HandleScopeImplementer thread_local;
static FatalErrorCallback exception_behavior = NULL;
-int i::Internals::kJSObjectType = JS_OBJECT_TYPE;
-int i::Internals::kFirstNonstringType = FIRST_NONSTRING_TYPE;
-int i::Internals::kProxyType = PROXY_TYPE;
static void DefaultFatalErrorHandler(const char* location,
const char* message) {
@@ -2609,6 +2606,8 @@ void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
return;
}
i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(length, data);
+ self->set_map(
+ *i::Factory::GetSlowElementsMap(i::Handle<i::Map>(self->map())));
self->set_elements(*pixels);
}
@@ -2662,6 +2661,8 @@ void v8::Object::SetIndexedPropertiesToExternalArrayData(
}
i::Handle<i::ExternalArray> array =
i::Factory::NewExternalArray(length, array_type, data);
+ self->set_map(
+ *i::Factory::GetSlowElementsMap(i::Handle<i::Map>(self->map())));
self->set_elements(*array);
}
@@ -4460,6 +4461,7 @@ Handle<Value> HeapGraphEdge::GetName() const {
reinterpret_cast<const i::HeapGraphEdge*>(this);
switch (edge->type()) {
case i::HeapGraphEdge::CONTEXT_VARIABLE:
+ case i::HeapGraphEdge::INTERNAL:
case i::HeapGraphEdge::PROPERTY:
return Handle<String>(ToApi<String>(i::Factory::LookupAsciiSymbol(
edge->name())));
View
5 deps/v8/src/arm/assembler-arm-inl.h
@@ -45,11 +45,6 @@
namespace v8 {
namespace internal {
-Condition NegateCondition(Condition cc) {
- ASSERT(cc != al);
- return static_cast<Condition>(cc ^ ne);
-}
-
void RelocInfo::apply(intptr_t delta) {
if (RelocInfo::IsInternalReference(rmode_)) {
View
78 deps/v8/src/arm/assembler-arm.cc
@@ -282,6 +282,11 @@ const Instr kBlxRegPattern =
const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16;
const Instr kMovMvnPattern = 0xd * B21;
const Instr kMovMvnFlip = B22;
+const Instr kMovLeaveCCMask = 0xdff * B16;
+const Instr kMovLeaveCCPattern = 0x1a0 * B16;
+const Instr kMovwMask = 0xff * B20;
+const Instr kMovwPattern = 0x30 * B20;
+const Instr kMovwLeaveCCFlip = 0x5 * B21;
const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12;
const Instr kCmpCmnPattern = 0x15 * B20;
const Instr kCmpCmnFlip = B21;
@@ -389,6 +394,12 @@ void Assembler::Align(int m) {
}
+void Assembler::CodeTargetAlign() {
+ // Preferred alignment of jump targets on some ARM chips.
+ Align(8);
+}
+
+
bool Assembler::IsNop(Instr instr, int type) {
// Check for mov rx, rx.
ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop.
@@ -640,6 +651,12 @@ void Assembler::next(Label* L) {
}
+static Instr EncodeMovwImmediate(uint32_t immediate) {
+ ASSERT(immediate < 0x10000);
+ return ((immediate & 0xf000) << 4) | (immediate & 0xfff);
+}
+
+
// Low-level code emission routines depending on the addressing mode.
// If this returns true then you have to use the rotate_imm and immed_8
// that it returns, because it may have already changed the instruction
@@ -664,6 +681,15 @@ static bool fits_shifter(uint32_t imm32,
if (fits_shifter(~imm32, rotate_imm, immed_8, NULL)) {
*instr ^= kMovMvnFlip;
return true;
+ } else if ((*instr & kMovLeaveCCMask) == kMovLeaveCCPattern) {
+ if (CpuFeatures::IsSupported(ARMv7)) {
+ if (imm32 < 0x10000) {
+ *instr ^= kMovwLeaveCCFlip;
+ *instr |= EncodeMovwImmediate(imm32);
+ *rotate_imm = *immed_8 = 0; // Not used for movw.
+ return true;
+ }
+ }
}
} else if ((*instr & kCmpCmnMask) == kCmpCmnPattern) {
if (fits_shifter(-imm32, rotate_imm, immed_8, NULL)) {
@@ -695,7 +721,7 @@ static bool fits_shifter(uint32_t imm32,
// if they can be encoded in the ARM's 12 bits of immediate-offset instruction
// space. There is no guarantee that the relocated location can be similarly
// encoded.
-static bool MustUseIp(RelocInfo::Mode rmode) {
+static bool MustUseConstantPool(RelocInfo::Mode rmode) {
if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
#ifdef DEBUG
if (!Serializer::enabled()) {
@@ -712,7 +738,7 @@ static bool MustUseIp(RelocInfo::Mode rmode) {
bool Operand::is_single_instruction() const {
if (rm_.is_valid()) return true;
- if (MustUseIp(rmode_)) return false;
+ if (MustUseConstantPool(rmode_)) return false;
uint32_t dummy1, dummy2;
return fits_shifter(imm32_, &dummy1, &dummy2, NULL);
}
@@ -728,19 +754,34 @@ void Assembler::addrmod1(Instr instr,
// Immediate.
uint32_t rotate_imm;
uint32_t immed_8;
- if (MustUseIp(x.rmode_) ||
+ if (MustUseConstantPool(x.rmode_) ||
!fits_shifter(x.imm32_, &rotate_imm, &immed_8, &instr)) {
// The immediate operand cannot be encoded as a shifter operand, so load
// it first to register ip and change the original instruction to use ip.
// However, if the original instruction is a 'mov rd, x' (not setting the
// condition code), then replace it with a 'ldr rd, [pc]'.
- RecordRelocInfo(x.rmode_, x.imm32_);
CHECK(!rn.is(ip)); // rn should never be ip, or will be trashed
Condition cond = static_cast<Condition>(instr & CondMask);
if ((instr & ~CondMask) == 13*B21) { // mov, S not set
- ldr(rd, MemOperand(pc, 0), cond);
+ if (MustUseConstantPool(x.rmode_) ||
+ !CpuFeatures::IsSupported(ARMv7)) {
+ RecordRelocInfo(x.rmode_, x.imm32_);
+ ldr(rd, MemOperand(pc, 0), cond);
+ } else {
+ // Will probably use movw, will certainly not use constant pool.
+ mov(rd, Operand(x.imm32_ & 0xffff), LeaveCC, cond);
+ movt(rd, static_cast<uint32_t>(x.imm32_) >> 16, cond);
+ }
} else {
- ldr(ip, MemOperand(pc, 0), cond);
+ // If this is not a mov or mvn instruction we may still be able to avoid
+ // a constant pool entry by using mvn or movw.
+ if (!MustUseConstantPool(x.rmode_) &&
+ (instr & kMovMvnMask) != kMovMvnPattern) {
+ mov(ip, x, LeaveCC, cond);
+ } else {
+ RecordRelocInfo(x.rmode_, x.imm32_);
+ ldr(ip, MemOperand(pc, 0), cond);
+ }
addrmod1(instr, rn, rd, Operand(ip));
}
return;
@@ -1051,6 +1092,17 @@ void Assembler::mov(Register dst, const Operand& src, SBit s, Condition cond) {
}
+void Assembler::movw(Register reg, uint32_t immediate, Condition cond) {
+ ASSERT(immediate < 0x10000);
+ mov(reg, Operand(immediate), LeaveCC, cond);
+}
+
+
+void Assembler::movt(Register reg, uint32_t immediate, Condition cond) {
+ emit(cond | 0x34*B20 | reg.code()*B12 | EncodeMovwImmediate(immediate));
+}
+
+
void Assembler::bic(Register dst, Register src1, const Operand& src2,
SBit s, Condition cond) {
addrmod1(cond | 14*B21 | s, src1, dst, src2);
@@ -1231,7 +1283,7 @@ void Assembler::msr(SRegisterFieldMask fields, const Operand& src,
// Immediate.
uint32_t rotate_imm;
uint32_t immed_8;
- if (MustUseIp(src.rmode_) ||
+ if (MustUseConstantPool(src.rmode_) ||
!fits_shifter(src.imm32_, &rotate_imm, &immed_8, NULL)) {
// Immediate operand cannot be encoded, load it first to register ip.
RecordRelocInfo(src.rmode_, src.imm32_);
@@ -2060,6 +2112,18 @@ void Assembler::vmrs(Register dst, Condition cond) {
}
+
+void Assembler::vsqrt(const DwVfpRegister dst,
+ const DwVfpRegister src,
+ const Condition cond) {
+ // cond(31-28) | 11101 (27-23)| D=?(22) | 11 (21-20) | 0001 (19-16) |
+ // Vd(15-12) | 101(11-9) | sz(8)=1 | 11 (7-6) | M(5)=? | 0(4) | Vm(3-0)
+ ASSERT(CpuFeatures::IsEnabled(VFP3));
+ emit(cond | 0xE*B24 | B23 | 0x3*B20 | B16 |
+ dst.code()*B12 | 0x5*B9 | B8 | 3*B6 | src.code());
+}
+
+
// Pseudo instructions.
void Assembler::nop(int type) {
// This is mov rx, rx.
View
24 deps/v8/src/arm/assembler-arm.h