MB-7629: Add support for Javascript view reduce functions

Besides those built-in reduce functions _sum, _count, _stats for view
btree and view id btree, this is to add generic reduce functions
for view btree to support Javascript view reduce functions. Unit tests
are also included.

Change-Id: I7a8988b359173b91357f6e6cfe51e87032b039bd
Reviewed-on: http://review.couchbase.org/27175
Tested-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>