Bug 1283924 - Baldr: tidy how ModuleKind is set (r=sunfish)

MozReview-Commit-ID: 1pZf96RncII

--HG--
extra : rebase_source : a7304a5beb102008c23a5879d99f12e2b099311f
This commit is contained in:
Luke Wagner 2016-08-16 16:20:46 -05:00
Родитель 6f3f4fb97a
Коммит dcbcdc16d8
3 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -310,7 +310,8 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod
}
AsmJSMetadata()
: cacheResult(CacheResult::Miss),
: Metadata(ModuleKind::AsmJS),
cacheResult(CacheResult::Miss),
srcStart(0),
srcBodyStart(0),
strict(false)

Просмотреть файл

@ -419,9 +419,10 @@ class MetadataCacheablePod
uint32_t minMemoryLength;
uint32_t maxMemoryLength;
MetadataCacheablePod() {
explicit MetadataCacheablePod(ModuleKind kind) {
mozilla::PodZero(this);
startFuncIndex_ = NO_START_FUNCTION;
this->kind = kind;
}
bool hasStartFunction() const {
@ -440,6 +441,7 @@ class MetadataCacheablePod
struct Metadata : ShareableBase<Metadata>, MetadataCacheablePod
{
explicit Metadata(ModuleKind kind = ModuleKind::Wasm) : MetadataCacheablePod(kind) {}
virtual ~Metadata() {}
MetadataCacheablePod& pod() { return *this; }

Просмотреть файл

@ -100,6 +100,7 @@ bool
ModuleGenerator::init(UniqueModuleGeneratorData shared, CompileArgs&& args,
Metadata* maybeAsmJSMetadata)
{
shared_ = Move(shared);
alwaysBaseline_ = args.alwaysBaseline;
if (!exportedFuncs_.init())
@ -109,20 +110,18 @@ ModuleGenerator::init(UniqueModuleGeneratorData shared, CompileArgs&& args,
// asm.js passes in an AsmJSMetadata subclass to use instead.
if (maybeAsmJSMetadata) {
MOZ_ASSERT(shared->kind == ModuleKind::AsmJS);
metadata_ = maybeAsmJSMetadata;
MOZ_ASSERT(isAsmJS());
} else {
metadata_ = js_new<Metadata>();
if (!metadata_)
return false;
MOZ_ASSERT(!isAsmJS());
}
metadata_->kind = shared->kind;
metadata_->filename = Move(args.filename);
metadata_->assumptions = Move(args.assumptions);
shared_ = Move(shared);
// For asm.js, the Vectors in ModuleGeneratorData are max-sized reservations
// and will be initialized in a linear order via init* functions as the
// module is generated. For wasm, the Vectors are correctly-sized and