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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/modules.h ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/modules.cc
diff --git a/src/modules.cc b/src/modules.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eb01cf08e49bc9e6714f5a3ce725fce108f8d3f2
--- /dev/null
+++ b/src/modules.cc
@@ -0,0 +1,38 @@
+// Copyright 2012 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.
+
+#include "src/v8.h"
+
+#include "src/modules.h"
+
+#include "src/ast-value-factory.h"
+
+namespace v8 {
+namespace internal {
+
+// ---------------------------------------------------------------------------
+// Addition.
+
+void ModuleDescriptor::Add(const AstRawString* name, Zone* zone, bool* ok) {
+ void* key = const_cast<AstRawString*>(name);
+
+ ZoneHashMap** map = &exports_;
+ ZoneAllocationPolicy allocator(zone);
+
+ if (*map == nullptr) {
+ *map = new (zone->New(sizeof(ZoneHashMap)))
+ ZoneHashMap(ZoneHashMap::PointersMatch,
+ ZoneHashMap::kDefaultHashMapCapacity, allocator);
+ }
+
+ ZoneHashMap::Entry* p =
+ (*map)->Lookup(key, name->hash(), !IsFrozen(), allocator);
+ if (p == nullptr || p->value != nullptr) {
+ *ok = false;
+ }
+
+ p->value = key;
+}
+}
+} // namespace v8::internal
« 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