Commit 26ae9380 authored by Daniel Clifford's avatar Daniel Clifford Committed by Commit Bot

Convert ZoneList to ZoneVector in Module data structures

BUG=v8:6333,v8:6921
R=franzih@chromium.org

Change-Id: I18995282d372069ab576b87cebea4b405aa01c2c
Reviewed-on: https://chromium-review.googlesource.com/719005
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: 's avatarFranziska Hinkelmann <franzih@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48755}
parent 0454a842
......@@ -21,8 +21,8 @@ class ModuleDescriptor : public ZoneObject {
public:
explicit ModuleDescriptor(Zone* zone)
: module_requests_(zone),
special_exports_(1, zone),
namespace_imports_(1, zone),
special_exports_(zone),
namespace_imports_(zone),
regular_exports_(zone),
regular_imports_(zone) {}
......@@ -130,7 +130,7 @@ class ModuleDescriptor : public ZoneObject {
}
// Namespace imports.
const ZoneList<const Entry*>& namespace_imports() const {
const ZoneVector<const Entry*>& namespace_imports() const {
return namespace_imports_;
}
......@@ -140,7 +140,7 @@ class ModuleDescriptor : public ZoneObject {
}
// Star exports and explicitly indirect exports.
const ZoneList<const Entry*>& special_exports() const {
const ZoneVector<const Entry*>& special_exports() const {
return special_exports_;
}
......@@ -161,7 +161,7 @@ class ModuleDescriptor : public ZoneObject {
void AddSpecialExport(const Entry* entry, Zone* zone) {
DCHECK_NULL(entry->local_name);
DCHECK_LE(0, entry->module_request);
special_exports_.Add(entry, zone);
special_exports_.push_back(entry);
}
void AddRegularImport(Entry* entry) {
......@@ -179,7 +179,7 @@ class ModuleDescriptor : public ZoneObject {
DCHECK_NULL(entry->export_name);
DCHECK_NOT_NULL(entry->local_name);
DCHECK_LE(0, entry->module_request);
namespace_imports_.Add(entry, zone);
namespace_imports_.push_back(entry);
}
Handle<FixedArray> SerializeRegularExports(Isolate* isolate,
......@@ -188,10 +188,9 @@ class ModuleDescriptor : public ZoneObject {
Handle<ModuleInfo> module_info);
private:
// TODO(neis): Use STL datastructure instead of ZoneList?
ZoneMap<const AstRawString*, ModuleRequest> module_requests_;
ZoneList<const Entry*> special_exports_;
ZoneList<const Entry*> namespace_imports_;
ZoneVector<const Entry*> special_exports_;
ZoneVector<const Entry*> namespace_imports_;
ZoneMultimap<const AstRawString*, Entry*> regular_exports_;
ZoneMap<const AstRawString*, Entry*> regular_imports_;
......
......@@ -854,8 +854,8 @@ Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, Zone* zone,
}
// Serialize special exports.
Handle<FixedArray> special_exports =
isolate->factory()->NewFixedArray(descr->special_exports().length());
Handle<FixedArray> special_exports = isolate->factory()->NewFixedArray(
static_cast<int>(descr->special_exports().size()));
{
int i = 0;
for (auto entry : descr->special_exports()) {
......@@ -865,8 +865,8 @@ Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, Zone* zone,
}
// Serialize namespace imports.
Handle<FixedArray> namespace_imports =
isolate->factory()->NewFixedArray(descr->namespace_imports().length());
Handle<FixedArray> namespace_imports = isolate->factory()->NewFixedArray(
static_cast<int>(descr->namespace_imports().size()));
{
int i = 0;
for (auto entry : descr->namespace_imports()) {
......
......@@ -6309,7 +6309,7 @@ TEST(ModuleParsingInternals) {
}
}
CHECK_EQ(3, descriptor->special_exports().length());
CHECK_EQ(3, descriptor->special_exports().size());
CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0);
CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2);
CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa",
......@@ -6355,7 +6355,7 @@ TEST(ModuleParsingInternals) {
CheckEntry(entry, "y", "x", nullptr, -1);
}
CHECK_EQ(2, descriptor->namespace_imports().length());
CHECK_EQ(2, descriptor->namespace_imports().size());
CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4);
CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr,
4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment