make folly::toJson retain non-ascii chars if encode_non_ascii is disabled

Summary:
folly::toJson as demonstrated by the test cases was wrongly encoding utf8 strings.
specifically, a utf8 char made up of x bytes was encodeded into x unicode chars.

for example, the char:
\u2665
which is made of 3 bytes:
\xe2\x99\xa5
was encoded correctly when using encode_non_ascii = true:
"\u2665"
but when encode_non_ascii = false, the json value was wrongly set as:
"\u00e2\u0099\u00a5"

because we use an signed char that wrongly detects non-readable chars with
ascii value > 127 as control chars with ascii value < 32 (\t, \n, etc.)

Test Plan: run the test

Reviewed By: delong.j@fb.com

FB internal diff: D612782
[Conv] MaxString specialization for __int128

Summary: Just that.

Test Plan: .

Reviewed By: igorzi@fb.com

FB internal diff: D613291
update function_benchmark to test exception handling

Summary:
Add benchmarks for throwing an exception versus returning
std::exception_ptr or other types of return values.

Throwing an exception is very expensive.  Calling std::make_exception_ptr()
without ever throwing is nearly as bad.

The exc_ptr_param_return tests were the ones I was most interested in.
(Accepting a std::exception_ptr* argument so the caller can indicate if they
want to receive an exception or not.)  This is fast if the caller doesn't care
about the exception value, but very slow if an error occurs and an
exception_ptr is required.

Test Plan:
======================================================================
folly/test/function_benchmark/main.cpp    relative  time/iter  iters/s
======================================================================
throw_exception                                        3.90us  256.25K
catch_no_exception                                     1.88ns  533.25M
return_exc_ptr                                         2.79us  357.85K
exc_ptr_param_return                                   2.83us  353.25K
exc_ptr_param_return_null                              2.25ns  444.38M
return_string                                         69.39ns   14.41M
return_string_noexcept                                69.39ns   14.41M
return_code                                            1.50ns  666.54M
return_code_noexcept                                   1.50ns  666.54M

Reviewed By: rajat@fb.com

FB internal diff: D616474
[Conv] Remove __int128 overload

Summary: parseInt128 is only available for GCC 4.7 and above.

Test Plan: .

Reviewed By: igorzi@fb.com

FB internal diff: D618456

Blame Revision: rFBCODEeaec97e2991f
Subprocess library, modeled after python's subprocess module

Summary:
Surprised we don't have one.  The API is modeled after Python's
subprocess module, http://docs.python.org/2/library/subprocess.html

Inspired by
https://www.facebook.com/groups/fbcode/permalink/445399858830192/, plus
I needed this functionality now.

Test Plan: test added

Reviewed By: chip@fb.com

FB internal diff: D614056
fix typos in comment; RV_* do not have to be public

Test Plan: subprocess_test

Reviewed By: chip@fb.com

FB internal diff: D619189
Retry wait() on EINTR; clean up signal handling

Test Plan: subprocess_test

Reviewed By: delong.j@fb.com

FB internal diff: D619713
ints used as flags (bitwise): so C

Summary:
Changed communicate() flags from int to a class.
Made Options and CommunicateFlags composable with |
Simplified API so you don't have to type Subprocess::Options().stdout(Subprocess::PIPE)

Test Plan: subprocess_test

Reviewed By: chip@fb.com

FB internal diff: D620186
Augment DynamicConverter's is_container check

Summary:
DynamicConverter uses some simple heuristics to determine if a
class is a container. One of those tests was to check that the
constructor 'template <class Iterator> [container-name](Iterator first,
Iterator last)' was present. That test was performed by checking if the
class could be constructed by two parameters of some dummy class.

However, it is possible to restrict the template parameter such that it
only accepts iterators, and not any arbitrary dummy class. This would be
useful, for example, to solve overload ambiguity with constructors like
'vector(const T& val, size_type n)', where T and size_type are the same
(see N3337 23.2.3 item 14). It also (I believe) produces more meaningful
compiler errors when a non-iterator is supplied, since it errors at the
function callsite instead of inside the constructor itself.

The new FBVector implementation uses such a feature, and so checking for
[container-name](dummy, dummy) will fail. Hence the dummy class has been
upgraded to reverse_iterator<T*>, a valid iterator class which almost
certainly does not have a specialized contructor in any class (and hence
will not cause any visible change in class_is_container's value).

Test Plan:
Run DynamicConverterTest; it has tests for the correctness of
class_is_container.

Reviewed By: delong.j@fb.com

FB internal diff: D620607
Adding usage example for BENCHMARK_DRAW_LINE()

Summary:
Yes, I admit, I was dumb enough to try it in a benchmark's
body.

Test Plan: review

Reviewed By: tudorb@fb.com

FB internal diff: D622613
Clang complains about errors in folly String-inl.h and FBString.h (P1825995)

Summary: fixing clang errors (used clang 3.1)

Test Plan: doh

Reviewed By: tudorb@fb.com

FB internal diff: D622593
add IOBuf::moveToFbString

Summary:
Convert a IOBuf chain into a fbstring, with zero copies in the common case
(unshared, unchained, no headroom) and one copy in all other cases.

Test Plan: tests added

Reviewed By: simpkins@fb.com

FB internal diff: D621210
Enabling format("{}", format(...))

Summary:
If your format string ends up being conditional, it's handy to be able to chain
together formatters.

Test Plan: Unit tests

Reviewed By: tudorb@fb.com

FB internal diff: D625502
Adding support for printing arbitrary pointers

Summary: We should be able to print ##Foo*##, even if we can't print ##Foo##.

Test Plan: Unit Tests.

Reviewed By: tudorb@fb.com

FB internal diff: D625977
Composed, for lightweight operator composition

Summary:
Sometimes it'll be handy to have a custom operator which is little more than the
composition of a few base operators. This makes that really easy to do, as shown
in examples, tests, and benchmarks.

Test Plan: Unit tests, benchmarks

Reviewed By: rsagula@fb.com

FB internal diff: D617152
Fix example for folly::format

Summary: That's all.

Test Plan: .

Reviewed By: tjackson@fb.com

FB internal diff: D618824
constexpr-ize folly/Bits.h

Summary:
Want to be able to call them from other constexpr functions
and from within static_assert()s.

Test Plan: compiled and ran folly tests

Reviewed By: tudorb@fb.com

FB internal diff: D627413
movify generators (but mostly operators)

Summary: Make things work with non-copyable generators.

Test Plan: folly/experimental/test

Reviewed By: tjackson@fb.com

FB internal diff: D628520
add split operator

Summary:
Also added eachAs (cast each value as a given type) and eachTo (use folly::to
on each value)

Test Plan: test added

Reviewed By: tjackson@fb.com

FB internal diff: D628868
fix comments

Test Plan: no

Reviewed By: tjackson@fb.com

FB internal diff: D629502