1. Sep 10, 2013
    • Trevor Norris's avatar
      buffer: optimize common encoding cases · 59dac01e
      Trevor Norris authored
      String#toLowerCase() is incredibly slow and was costing a 15-30%
      performance hit for Buffers less than 1KB. Now instead it'll attempt to
      find the correct encoding directly from the passed encoding, only then
      afterwards it'll lowercase.
      
      The optimization for not passing any encoding at all is still at the top
      of the method.
      
      At most this may add 10% performance hit for passing a mixed case
      encoding.
      59dac01e
  2. Sep 09, 2013
    • Ben Noordhuis's avatar
      test: move slow tests to test/pummel/ · 204228b5
      Ben Noordhuis authored
      Slowness being somewhat subjective but determined by running the
      test suite a few times and picking off everything that consistently
      clocks in at 2 seconds or more.
      
      Honorable mention for simple/test-tls-server-large-request, it often
      runs for 10 (!) seconds or more.
      204228b5
  3. Sep 08, 2013
  4. Sep 07, 2013
    • isaacs's avatar
      process: use exit 1 for uncaughtException · b30a03ed
      isaacs authored
      Since it is Unix tradition to use exit code 1 for general-purpose script
      bail-out, and the way of doing that in Node is to throw an exception and
      not catch it, it makes the most sense to exit with 1 when an exception
      goes uncaught.
      
      Move the `Invalid Argument` exit to 9, so that it's something specific,
      and clear that it's a node internal error.
      
      Also, document the exit codes that we use.
      b30a03ed
    • isaacs's avatar
      process: Fix regression from a5dba82e · 39aafcf8
      isaacs authored
      Respect numeric string args to process.exit(code)
      39aafcf8
    • isaacs's avatar
      process: Use exit code 8 consistently · 6808706c
      isaacs authored
      This should always be used in the case of an uncaughtException
      6808706c
    • isaacs's avatar
      process: Add exitCode property · a5dba82e
      isaacs authored
      This allows one to set a specific status code, while still letting the
      process exit gracefully once all async operations are completed.
      a5dba82e
    • Ben Noordhuis's avatar
      src: fix multi-base class ObjectWrap::Unwrap<T>() · b89b97dd
      Ben Noordhuis authored
      Fix pointer unwrapping when T is a class with more than one base class.
      
      Before this commit, the wrapped void* pointer was cast directly to T*
      without going through ObjectWrap* first, possibly leading to a class
      instance pointer that points to the wrong vtable.
      
      This change required some cleanup in various files; some classes
      used private rather than public inheritance, others didn't derive
      from ObjectWrap at all...
      
      Fixes #6188.
      b89b97dd
  5. Sep 06, 2013
    • Ben Noordhuis's avatar
      src: add multi-context support · 756b6222
      Ben Noordhuis authored
      This commit makes it possible to use multiple V8 execution contexts
      within a single event loop.  Put another way, handle and request wrap
      objects now "remember" the context they belong to and switch back to
      that context when the time comes to call into JS land.
      
      This could have been done in a quick and hacky way by calling
      v8::Object::GetCreationContext() on the wrap object right before
      making a callback but that leaves a fairly wide margin for bugs.
      
      Instead, we make the context explicit through a new Environment class
      that encapsulates everything (or almost everything) that belongs to
      the context.  Variables that used to be a static or a global are now
      members of the aforementioned class.  An additional benefit is that
      this approach should make it relatively straightforward to add full
      isolate support in due course.
      
      There is no JavaScript API yet but that will be added in the near
      future.
      
      This work was graciously sponsored by GitHub, Inc.
      756b6222
    • Ben Noordhuis's avatar
      test: don't call process.exit() in debugger tests · 81655a22
      Ben Noordhuis authored
      process.exit() tends to hide bugs, both in tests and node.js.
      Rewrite the tests so that the event loop exits naturally.
      81655a22
    • isaacs's avatar
      Merge remote-tracking branch 'ry/v0.10' · aaf4f8d6
      isaacs authored
      Conflicts:
      	deps/uv/ChangeLog
      	deps/uv/src/version.c
      	deps/uv/src/win/fs.c
      	lib/_stream_transform.js
      aaf4f8d6
    • isaacs's avatar
      npm: upgrade to v1.3.10 · 1be09dfc
      isaacs authored
      1be09dfc
    • Trevor Norris's avatar
      handle_wrap: properly don't abort on unwrap · f218d94a
      Trevor Norris authored
      From commit 756ae2c5 all the WRAP/UNWRAP were moved to a single location
      for ease of use. In a single location NO_ABORT should have been used but
      wasn't. This caused HandleWrap::Close to abort. Below is the applicable
      code change as demonstration there was no abort specified when
      unwrapping the object.
      
       void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
          HandleScope scope(node_isolate);
      
           -  HandleWrap *wrap = static_cast<HandleWrap*>(
           -      args.This()->GetAlignedPointerFromInternalField(0));
           +  HandleWrap* wrap;
           +  UNWRAP(args.This(), HandleWrap, wrap);
      
      Also included a test that will reproduce the abort.
      f218d94a
    • isaacs's avatar
      stream: objectMode transforms allow falsey values · 1da7bcc2
      isaacs authored
      Closes #6183
      1da7bcc2
    • Ben Noordhuis's avatar
      src: fix solaris 10 build error · 6df4741f
      Ben Noordhuis authored
      Stop gcc from getting confused, explicitly cast the return value from
      getuid() and getgid() to uint32_t.  Fixes the following build error:
      
          ../src/node.cc: In function 'void node::GetUid(const
          v8::FunctionCallbackInfo<v8::Value>&)':
          ../src/node.cc:1552:37: error: call of overloaded 'Set(uid_t)' is
          ambiguous
          ../src/node.cc:1552:37: note: candidates are:
          ../deps/v8/include/v8.h:5939:6: note: void
          v8::ReturnValue<T>::Set(bool) [with T = v8::Value]
          ../deps/v8/include/v8.h:5909:6: note: void
          v8::ReturnValue<T>::Set(double) [with T = v8::Value]
          ../deps/v8/include/v8.h:5915:6: note: void
          v8::ReturnValue<T>::Set(int32_t) [with T = v8::Value, int32_t = int]
          ../deps/v8/include/v8.h:5926:6: note: void
          v8::ReturnValue<T>::Set(uint32_t) [with T = v8::Value, uint32_t =
          unsigned int]
      
      Fixes #6182.
      6df4741f
    • Ben Noordhuis's avatar
      test: move slow test from simple/ to pummel/ · b4b3a4de
      Ben Noordhuis authored
      Move simple/test-http-many-keep-alive-connections to the pummel/
      directory, it takes about 2.5 seconds to complete.
      b4b3a4de
  6. Sep 05, 2013
    • Bert Belder's avatar
      uv: upgrade to v0.10.16 · 6301613f
      Bert Belder authored
      6301613f
    • Fedor Indutny's avatar
      tls: socket.renegotiate(options, callback) · af76b086
      Fedor Indutny authored
      This utility function allows renegotiaion of secure connection after
      establishing it.
      
      fix #2496
      af76b086
    • Timothy J Fontaine's avatar
      Merge remote-tracking branch 'upstream/v0.10' · 8ee50cea
      Timothy J Fontaine authored
      Conflicts:
      	ChangeLog
      	src/node_version.h
      8ee50cea
    • Timothy J Fontaine's avatar
      blog: Post for v0.11.7 · 8b052066
      Timothy J Fontaine authored
      8b052066
    • Timothy J Fontaine's avatar
      Now working on 0.11.8 · 5b1a0e6e
      Timothy J Fontaine authored
      5b1a0e6e
    • Timothy J Fontaine's avatar
      Merge branch 'v0.11.7-release' · 5a6b2853
      Timothy J Fontaine authored
      5a6b2853
    • Timothy J Fontaine's avatar
      2013.08.21, Version 0.11.7 (Unstable) · be52549b
      Timothy J Fontaine authored
      * uv: upgrade to v0.11.13
      
      * v8: upgrade to 3.20.17
      
      * buffer: adhere to INSPECT_MAX_BYTES (Timothy J Fontaine)
      
      * buffer: fix regression for large buffer creation (Trevor Norris)
      
      * buffer: don't throw if slice length too long (Trevor Norris)
      
      * buffer: Buffer(buf) constructor copies into the proper buffer (Ben Noordhuis)
      
      * cli: remove --max-stack-size (Ben Noordhuis)
      
      * cli: unknown command line options are errors (Ben Noordhuis)
      
      * child_process: exec accept buffer as an encoding (Seth Fitzsimmons)
      
      * crypto: make randomBytes/pbkdf2 callbacks domain aware (Ben Noordhuis)
      
      * domain: deprecate domain.dispose(). (Forrest L Norvell)
      
      * fs: Expose birthtime on stat objects (isaacs)
      
      * http: Only send connection:keep-alive if necessary (isaacs)
      
      * repl: Catch syntax errors better (isaacs, Nathan Rajlich)
      
      * stream: change default highWaterMark for objectMode to 16 (Mathias Buus)
      
      * stream: make setEncoding/pause/resume chainable (Julian Gruber, isaacs)
      
      * util: pass opts to custom inspect functions (Timothy J Fontaine)
      
      * vm: rewritten to behave like Contextify (Domenic Denicola)
      be52549b
    • Timothy J Fontaine's avatar
      blog: Post for v0.10.18 · 9c19c1e1
      Timothy J Fontaine authored
      9c19c1e1
    • Timothy J Fontaine's avatar
      Now working on 0.10.19 · 65ed79a6
      Timothy J Fontaine authored
      65ed79a6
    • Timothy J Fontaine's avatar
      86d881f8
    • isaacs's avatar
      http: Only send connection:keep-alive if necessary · 15a5a4a9
      isaacs authored
      In cases where the Agent has maxSockets=Infinity, and
      keepAlive=false, there's no case where we won't immediately close the
      connection after the response is completed.
      
      Since we're going to close it anyway, send a `connection:close` header
      rather than a `connection:keep-alive` header.  Still send the
      `connection:keep-alive` if the agent will actually reuse the socket,
      however.
      
      Closes #5838
      15a5a4a9
    • isaacs's avatar
      stream: return this from pause()/resume() · 689e5c9d
      isaacs authored
      689e5c9d
    • Julian Gruber's avatar
      stream: make setEncoding chainable · f91b0478
      Julian Gruber authored
      f91b0478
    • isaacs's avatar
      repl: Simplify paren wrap, continuation-detection · 9ef9a9de
      isaacs authored
      This simplifies the logic that was in isSyntaxError, as well as the
      choice to wrap command input in parens to coerce to an expression
      statement.
      
      1. Rather than a growing blacklist of allowed-to-throw syntax errors,
      just sniff for the one we really care about ("Unexpected end of input")
      and let all the others pass through.
      
      2. Wrapping {a:1} in parens makes sense, because blocks and line labels
      are silly and confusing and should not be in JavaScript at all.
      However, wrapping functions and other types of programs in parens is
      weird and required yet *more* hacking to work around.  By only wrapping
      statements that start with { and end with }, we can handle the confusing
      use-case, without having to then do extra work for functions and other
      cases.
      
      This also fixes the repl wart where `console.log)(` works in the repl,
      but only by virtue of the fact that it's wrapped in parens first, as
      well as potential side effects of double-running the commands, such as:
      
          > x = 1
          1
          > eval('x++; throw new SyntaxError("e")')
          ... ^C
          > x
          3
      9ef9a9de
    • Nathan Rajlich's avatar
      repl: treat "Assignment to const" as syntax error · 54fbb1da
      Nathan Rajlich authored
      Adding a new `repl-harmony` test file here because adding the
      `--use_strict --harmony` flags on the main repl test file was causing
      lots of unrelated failures, due to global variable assignments and
      things like that. This new test file is based off of the original
      repl.js test file, but has a lot of the tests stripped out. A test case
      for this commit is included though.
      
      Fixes #6132.
      54fbb1da
    • isaacs's avatar
      repl: Catch syntax errors better · 4631c503
      isaacs authored
      Replace the growing list of 'isSyntaxError' whackamole conditions with a
      smarter approach.  This creates a vm Script object *first*, which will
      parse the code and raise a SyntaxError right away.
      
      We still do need the test function, but only because strict mode syntax
      errors are not recoverable, and should be raised right away.  Really, we
      should probably *only* continue on "unexpected end of input" SyntaxErrors.
      
      Also fixes a very difficult-to-test nit where the '...' indentation is
      not properly cleared when you ^C out of a syntax error.
      
      Closes #6093
      4631c503
    • Timothy J Fontaine's avatar
      2013.09.04, Version 0.10.18 (Stable) · 67a1f0c5
      Timothy J Fontaine authored
      * uv: Upgrade to v0.10.15
      
      * stream: Don't crash on unset _events property (isaacs)
      
      * stream: Pass 'buffer' encoding with decoded writable chunks (isaacs)
      67a1f0c5
    • Ben Noordhuis's avatar
      uv: upgrade to v0.11.13 · 7494c84f
      Ben Noordhuis authored
      This commit changes src/tcp_wrap.cc and src/udp_wrap.cc just enough to
      get by (i.e. to compile and function correctly.)
      
      The new libuv API allows for more cleanup and deduplication but I'm
      saving that for another day.
      7494c84f
  7. Sep 04, 2013
  8. Sep 03, 2013