GenericHashTraits::peek() is producing copies of passed-in temporary values
https://bugs.webkit.org/show_bug.cgi?id=131461

Patch by Zan Dobersek <zdobersek@igalia.com> on 2014-08-24
Reviewed by Darin Adler.

Source/WTF:

* wtf/HashTraits.h:
(WTF::GenericHashTraits::peek): Make this method a template that passes through
the passed-in value without copying, achieved by using universal references and
std::forward<>().

Tools:

Add a test case that checks the number of copies and moves of the mapped objects
when calling HashMap::get(). Exactly one copy of the mapped value should be
performed when there exists a value that is mapped to the specified key, and
exactly one move and no copies of the empty value should be performed when there
isn't any mapped value for the specified key.

* TestWebKitAPI/Tests/WTF/CopyMoveCounter.h: Added.
(CopyMoveCounter::TestingScope::TestingScope):
(CopyMoveCounter::CopyMoveCounter):
(CopyMoveCounter::operator=):
* TestWebKitAPI/Tests/WTF/HashMap.cpp:
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172895 268f45cc-cd09-0410-ab3c-d52691b4dbfc