Changeset 197815 in webkit for trunk/Source/JavaScriptCore/jit/JITThunks.h
- Timestamp:
- Mar 8, 2016, 4:01:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITThunks.h
r195000 r197815 37 37 #include "WeakHandleOwner.h" 38 38 #include "WeakInlines.h" 39 #include <tuple> 39 40 #include <wtf/HashMap.h> 40 41 #include <wtf/RefPtr.h> … … 68 69 typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap; 69 70 CTIStubMap m_ctiStubMap; 70 typedef HashMap<std::pair<NativeFunction, NativeFunction>, Weak<NativeExecutable>> HostFunctionStubMap; 71 72 typedef std::tuple<NativeFunction, NativeFunction, String> HostFunctionKey; 73 74 struct HostFunctionHash { 75 static unsigned hash(const HostFunctionKey& key) 76 { 77 unsigned hash = WTF::pairIntHash(hashPointer(std::get<0>(key)), hashPointer(std::get<1>(key))); 78 if (!std::get<2>(key).isNull()) 79 hash = WTF::pairIntHash(hash, DefaultHash<String>::Hash::hash(std::get<2>(key))); 80 return hash; 81 } 82 static bool equal(const HostFunctionKey& a, const HostFunctionKey& b) 83 { 84 return (std::get<0>(a) == std::get<0>(b)) && (std::get<1>(a) == std::get<1>(b)) && (std::get<2>(a) == std::get<2>(b)); 85 } 86 static const bool safeToCompareToEmptyOrDeleted = true; 87 88 private: 89 static inline unsigned hashPointer(NativeFunction p) 90 { 91 return DefaultHash<NativeFunction>::Hash::hash(p); 92 } 93 }; 94 95 struct HostFunctionHashTrait : WTF::GenericHashTraits<HostFunctionKey> { 96 static const bool emptyValueIsZero = true; 97 static EmptyValueType emptyValue() { return std::make_tuple(nullptr, nullptr, String()); } 98 99 static void constructDeletedValue(HostFunctionKey& slot) { std::get<0>(slot) = reinterpret_cast<NativeFunction>(-1); } 100 static bool isDeletedValue(const HostFunctionKey& value) { return std::get<0>(value) == reinterpret_cast<NativeFunction>(-1); } 101 }; 102 103 typedef HashMap<HostFunctionKey, Weak<NativeExecutable>, HostFunctionHash, HostFunctionHashTrait> HostFunctionStubMap; 71 104 std::unique_ptr<HostFunctionStubMap> m_hostFunctionStubMap; 72 105 Lock m_lock;
Note:
See TracChangeset
for help on using the changeset viewer.