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

Unified Diff: src/modules.cc

Issue 1481613002: Create ast/ and parsing/ subdirectories and move appropriate files (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 1 month 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/parameter-initializer-rewriter.h » ('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
deleted file mode 100644
index f72693cd66dfee76abf2e58bf78316aa02add477..0000000000000000000000000000000000000000
--- a/src/modules.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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/modules.h"
-
-#include "src/ast-value-factory.h"
-
-namespace v8 {
-namespace internal {
-
-
-void ModuleDescriptor::AddLocalExport(const AstRawString* export_name,
- const AstRawString* local_name,
- Zone* zone, bool* ok) {
- DCHECK(!IsFrozen());
- void* key = const_cast<AstRawString*>(export_name);
-
- ZoneAllocationPolicy allocator(zone);
-
- if (exports_ == nullptr) {
- exports_ = new (zone->New(sizeof(ZoneHashMap)))
- ZoneHashMap(ZoneHashMap::PointersMatch,
- ZoneHashMap::kDefaultHashMapCapacity, allocator);
- }
-
- ZoneHashMap::Entry* p =
- exports_->LookupOrInsert(key, export_name->hash(), allocator);
- DCHECK_NOT_NULL(p);
- if (p->value != nullptr) {
- // Duplicate export.
- *ok = false;
- return;
- }
-
- p->value = const_cast<AstRawString*>(local_name);
-}
-
-
-void ModuleDescriptor::AddModuleRequest(const AstRawString* module_specifier,
- Zone* zone) {
- // TODO(adamk): Avoid this O(N) operation on each insert by storing
- // a HashMap, or by de-duping after parsing.
- if (requested_modules_.Contains(module_specifier)) return;
- requested_modules_.Add(module_specifier, zone);
-}
-
-
-const AstRawString* ModuleDescriptor::LookupLocalExport(
- const AstRawString* export_name, Zone* zone) {
- if (exports_ == nullptr) return nullptr;
- ZoneHashMap::Entry* entry = exports_->Lookup(
- const_cast<AstRawString*>(export_name), export_name->hash());
- if (entry == nullptr) return nullptr;
- DCHECK_NOT_NULL(entry->value);
- return static_cast<const AstRawString*>(entry->value);
-}
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/modules.h ('k') | src/parameter-initializer-rewriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698