src: use v8::String::NewFrom*() functions
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 7 Aug 2013 19:50:41 +0000 (21:50 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 9 Aug 2013 09:44:50 +0000 (11:44 +0200)
commitf674b09f40d22915e15b6968aafc5d25ac8178a2
treeb227505171dffe126aefde9855b4db2c765e70e1
parentc0e70354dbf7dcc76e69dd1973451eb10a2ebdfe
src: use v8::String::NewFrom*() functions

* Change calls to String::New() and String::NewSymbol() to their
  respective one-byte, two-byte and UTF-8 counterparts.

* Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and
  turns it into a v8::Local<v8::String>.

* Add helper functions that make v8::String::NewFromOneByte() easier to
  work with. Said function expects a `const uint8_t*` but almost every
  call site deals with `const char*` or `const unsigned char*`. Helps
  us avoid doing reinterpret_casts all over the place.

* Code that handles file system paths keeps using UTF-8 for backwards
  compatibility reasons. At least now the use of UTF-8 is explicit.

* Remove v8::String::NewSymbol() entirely. Almost all call sites were
  effectively minor de-optimizations. If you create a string only once,
  there is no point in making it a symbol. If you are create the same
  string repeatedly, it should probably be cached in a persistent
  handle.
29 files changed:
src/cares_wrap.cc
src/fs_event_wrap.cc
src/handle_wrap.cc
src/node.cc
src/node.h
src/node_buffer.cc
src/node_counters.cc
src/node_crypto.cc
src/node_dtrace.cc
src/node_file.cc
src/node_http_parser.cc
src/node_internals.h
src/node_javascript.cc
src/node_os.cc
src/node_script.cc
src/node_stat_watcher.cc
src/node_zlib.cc
src/pipe_wrap.cc
src/process_wrap.cc
src/signal_wrap.cc
src/smalloc.cc
src/stream_wrap.cc
src/string_bytes.cc
src/tcp_wrap.cc
src/timer_wrap.cc
src/tls_wrap.cc
src/tty_wrap.cc
src/udp_wrap.cc
src/uv.cc