Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1433)

Side by Side Diff: src/module-resolve-set-inl.h

Issue 2367623004: [modules] Detect and throw exceptions for cyclic dependencies (Closed)
Patch Set: Update golden files Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/messages.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_MODULE_RESOLVE_SET_INL_H_
6 #define V8_MODULE_RESOLVE_SET_INL_H_
7
8 #include <unordered_map>
9 #include <unordered_set>
10 #include <utility>
11
12 #include "src/objects-inl.h" // inl version required for hashing
13 #include "src/zone/zone-allocator.h"
14 #include "src/zone/zone.h"
15
16 namespace v8 {
17 namespace internal {
18
19 template <typename T>
20 struct Module::HandleValueHash {
21 V8_INLINE size_t operator()(Handle<T> handle) const { return handle->Hash(); }
22 };
23
24 struct Module::ModuleHandleEqual {
25 V8_INLINE bool operator()(Handle<Module> lhs, Handle<Module> rhs) const {
26 return *lhs == *rhs;
27 }
28 };
29
30 struct Module::StringHandleEqual {
31 V8_INLINE bool operator()(Handle<String> lhs, Handle<String> rhs) const {
32 return lhs->Equals(*rhs);
33 }
34 };
35
36 class Module::UnorderedStringSet
37 : public std::unordered_set<Handle<String>, HandleValueHash<String>,
38 StringHandleEqual,
39 zone_allocator<Handle<String>>> {
40 public:
41 explicit UnorderedStringSet(Zone* zone)
42 : std::unordered_set<Handle<String>, HandleValueHash<String>,
43 StringHandleEqual, zone_allocator<Handle<String>>>(
44 2, HandleValueHash<String>(), StringHandleEqual(),
45 zone_allocator<Handle<String>>(zone)) {}
46 };
47
48 class Module::ResolveSet
49 : public std::unordered_map<
50 Handle<Module>, UnorderedStringSet*, HandleValueHash<Module>,
51 ModuleHandleEqual, zone_allocator<std::pair<const Handle<Module>,
52 UnorderedStringSet*>>> {
53 public:
54 explicit ResolveSet(Zone* zone)
55 : std::unordered_map<Handle<Module>, UnorderedStringSet*,
56 HandleValueHash<Module>, ModuleHandleEqual,
57 zone_allocator<std::pair<const Handle<Module>,
58 UnorderedStringSet*>>>(
59 2 /* bucket count */, HandleValueHash<Module>(),
60 ModuleHandleEqual(),
61 zone_allocator<
62 std::pair<const Handle<Module>, UnorderedStringSet*>>(zone)) {}
63 };
64
65 } // namespace internal
66 } // namespace v8
67
68 #endif // V8_MODULE_RESOLVE_SET_INL_H_
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698