Index: src/module-resolve-set-inl.h |
diff --git a/src/module-resolve-set-inl.h b/src/module-resolve-set-inl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..55cbff70a364287e3bd8195647b5f930ef51851e |
--- /dev/null |
+++ b/src/module-resolve-set-inl.h |
@@ -0,0 +1,68 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_MODULE_RESOLVE_SET_INL_H_ |
+#define V8_MODULE_RESOLVE_SET_INL_H_ |
+ |
+#include <unordered_map> |
+#include <unordered_set> |
+#include <utility> |
+ |
+#include "src/objects-inl.h" // inl version required for hashing |
+#include "src/zone/zone-allocator.h" |
+#include "src/zone/zone.h" |
+ |
+namespace v8 { |
+namespace internal { |
+ |
+template <typename T> |
+struct Module::HandleValueHash { |
+ V8_INLINE size_t operator()(Handle<T> handle) const { return handle->Hash(); } |
+}; |
+ |
+struct Module::ModuleHandleEqual { |
+ V8_INLINE bool operator()(Handle<Module> lhs, Handle<Module> rhs) const { |
+ return *lhs == *rhs; |
+ } |
+}; |
+ |
+struct Module::StringHandleEqual { |
+ V8_INLINE bool operator()(Handle<String> lhs, Handle<String> rhs) const { |
+ return lhs->Equals(*rhs); |
+ } |
+}; |
+ |
+class Module::UnorderedStringSet |
+ : public std::unordered_set<Handle<String>, HandleValueHash<String>, |
+ StringHandleEqual, |
+ zone_allocator<Handle<String>>> { |
+ public: |
+ explicit UnorderedStringSet(Zone* zone) |
+ : std::unordered_set<Handle<String>, HandleValueHash<String>, |
+ StringHandleEqual, zone_allocator<Handle<String>>>( |
+ 2, HandleValueHash<String>(), StringHandleEqual(), |
+ zone_allocator<Handle<String>>(zone)) {} |
+}; |
+ |
+class Module::ResolveSet |
+ : public std::unordered_map< |
+ Handle<Module>, UnorderedStringSet*, HandleValueHash<Module>, |
+ ModuleHandleEqual, zone_allocator<std::pair<const Handle<Module>, |
+ UnorderedStringSet*>>> { |
+ public: |
+ explicit ResolveSet(Zone* zone) |
+ : std::unordered_map<Handle<Module>, UnorderedStringSet*, |
+ HandleValueHash<Module>, ModuleHandleEqual, |
+ zone_allocator<std::pair<const Handle<Module>, |
+ UnorderedStringSet*>>>( |
+ 2 /* bucket count */, HandleValueHash<Module>(), |
+ ModuleHandleEqual(), |
+ zone_allocator< |
+ std::pair<const Handle<Module>, UnorderedStringSet*>>(zone)) {} |
+}; |
+ |
+} // namespace internal |
+} // namespace v8 |
+ |
+#endif // V8_MODULE_RESOLVE_SET_INL_H_ |