Optimization of HashTraits<RefPtr<P> >::emptyValue()

HashTraits<RefPtr<P> >::emptyValue() is better just to return zero pointer
rather than access static RefPtr instance, further HashTraits<RefPtr<P> >::passOut() can be overriden to accept raw pointer (for empty value).
This all should improve HashMap performance in case its value type is RefPtr.

Review URL: https://chromiumcodereview.appspot.com/14877006

git-svn-id: svn://svn.chromium.org/blink/trunk@150425 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h
index 8aa9fe1..490e370 100644
--- a/Source/wtf/HashTable.h
+++ b/Source/wtf/HashTable.h
@@ -303,7 +303,7 @@
     template<typename HashFunctions> class IdentityHashTranslator {
     public:
         template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); }
-        template<typename T> static bool equal(const T& a, const T& b) { return HashFunctions::equal(a, b); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return HashFunctions::equal(a, b); }
         template<typename T, typename U> static void translate(T& location, const U&, const T& value) { location = value; }
     };
 
diff --git a/Source/wtf/HashTraits.h b/Source/wtf/HashTraits.h
index 3739e02..636587c 100644
--- a/Source/wtf/HashTraits.h
+++ b/Source/wtf/HashTraits.h
@@ -140,17 +140,14 @@
     };
 
     template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > {
-        static RefPtr<P>& emptyValue()
-        {
-            static RefPtr<P>& null = *(new RefPtr<P>);
-            return null;
-        }
+        static P* emptyValue() { return 0; }
 
         typedef PassRefPtr<P> PassInType;
         static void store(PassRefPtr<P> value, RefPtr<P>& storage) { storage = value; }
 
         typedef PassRefPtr<P> PassOutType;
         static PassRefPtr<P> passOut(RefPtr<P>& value) { return value.release(); }
+        static PassRefPtr<P> passOut(P* value) { return value; }
 
         typedef P* PeekType;
         static PeekType peek(const RefPtr<P>& value) { return value.get(); }