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

Unified Diff: src/modules.cc

Issue 934323004: Teach ModuleDescriptor about basic local exports (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handled review comments, added message tests 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
Index: src/modules.cc
diff --git a/src/modules.cc b/src/modules.cc
index eb01cf08e49bc9e6714f5a3ce725fce108f8d3f2..5fab34dcbd30c43adc2ba20e4f61ec11d805b43f 100644
--- a/src/modules.cc
+++ b/src/modules.cc
@@ -11,28 +11,27 @@
namespace v8 {
namespace internal {
-// ---------------------------------------------------------------------------
-// Addition.
-void ModuleDescriptor::Add(const AstRawString* name, Zone* zone, bool* ok) {
- void* key = const_cast<AstRawString*>(name);
+void ModuleDescriptor::AddLocalExport(const AstRawString* export_name,
+ const AstRawString* local_name,
+ Zone* zone, bool* ok) {
+ void* key = const_cast<AstRawString*>(export_name);
- ZoneHashMap** map = &exports_;
ZoneAllocationPolicy allocator(zone);
- if (*map == nullptr) {
- *map = new (zone->New(sizeof(ZoneHashMap)))
+ if (exports_ == nullptr) {
+ exports_ = new (zone->New(sizeof(ZoneHashMap)))
ZoneHashMap(ZoneHashMap::PointersMatch,
ZoneHashMap::kDefaultHashMapCapacity, allocator);
}
ZoneHashMap::Entry* p =
- (*map)->Lookup(key, name->hash(), !IsFrozen(), allocator);
+ exports_->Lookup(key, export_name->hash(), !IsFrozen(), allocator);
if (p == nullptr || p->value != nullptr) {
*ok = false;
}
- p->value = key;
+ p->value = const_cast<AstRawString*>(local_name);
}
}
} // namespace v8::internal
« no previous file with comments | « src/modules.h ('k') | src/parser.h » ('j') | test/message/export-duplicate.out » ('J')

Powered by Google App Engine
This is Rietveld 408576698