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

Side by Side Diff: src/modules.cc

Issue 935723004: Rename Interface to ModuleDescriptor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/modules.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 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 #include "src/v8.h"
6
7 #include "src/modules.h"
8
9 #include "src/ast-value-factory.h"
10
11 namespace v8 {
12 namespace internal {
13
14 // ---------------------------------------------------------------------------
15 // Addition.
16
17 void ModuleDescriptor::Add(const AstRawString* name, Zone* zone, bool* ok) {
18 void* key = const_cast<AstRawString*>(name);
19
20 ZoneHashMap** map = &exports_;
21 ZoneAllocationPolicy allocator(zone);
22
23 if (*map == nullptr) {
24 *map = new (zone->New(sizeof(ZoneHashMap)))
25 ZoneHashMap(ZoneHashMap::PointersMatch,
26 ZoneHashMap::kDefaultHashMapCapacity, allocator);
27 }
28
29 ZoneHashMap::Entry* p =
30 (*map)->Lookup(key, name->hash(), !IsFrozen(), allocator);
31 if (p == nullptr || p->value != nullptr) {
32 *ok = false;
33 }
34
35 p->value = key;
36 }
37 }
38 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/modules.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698