Bug 1186424: Split ModuleCompiler into ModuleCompiler/ModuleValidator; r=luke

This commit is contained in:
Benjamin Bouvier 2015-07-27 16:25:23 +02:00
parent 5fb3c87653
commit cb89d880df
2 changed files with 862 additions and 678 deletions

View File

@ -442,6 +442,7 @@ class AsmJSModule
uint32_t startOffsetInModule_; // Store module-start-relative offsets
uint32_t endOffsetInModule_; // so preserved by serialization.
} pod;
uint32_t funcIndex_;
friend class AsmJSModule;
@ -449,7 +450,8 @@ class AsmJSModule
uint32_t startOffsetInModule, uint32_t endOffsetInModule,
PropertyName* maybeFieldName,
ArgCoercionVector&& argCoercions,
ReturnType returnType)
ReturnType returnType,
uint32_t funcIndex)
{
MOZ_ASSERT(name->isTenured());
MOZ_ASSERT_IF(maybeFieldName, maybeFieldName->isTenured());
@ -462,6 +464,7 @@ class AsmJSModule
pod.codeOffset_ = UINT32_MAX;
pod.startOffsetInModule_ = startOffsetInModule;
pod.endOffsetInModule_ = endOffsetInModule;
funcIndex_ = funcIndex;
}
ExportedFunction(PropertyName* name,
@ -476,6 +479,7 @@ class AsmJSModule
pod.isChangeHeap_ = true;
pod.startOffsetInModule_ = startOffsetInModule;
pod.endOffsetInModule_ = endOffsetInModule;
funcIndex_ = UINT32_MAX;
}
void trace(JSTracer* trc) {
@ -489,6 +493,7 @@ class AsmJSModule
ExportedFunction(ExportedFunction&& rhs) {
name_ = rhs.name_;
maybeFieldName_ = rhs.maybeFieldName_;
funcIndex_ = rhs.funcIndex_;
argCoercions_ = mozilla::Move(rhs.argCoercions_);
mozilla::PodZero(&pod); // zero padding for Valgrind
pod = rhs.pod;
@ -497,6 +502,10 @@ class AsmJSModule
PropertyName* name() const {
return name_;
}
uint32_t funcIndex() const {
MOZ_ASSERT(funcIndex_ != UINT32_MAX);
return funcIndex_;
}
PropertyName* maybeFieldName() const {
return maybeFieldName_;
}
@ -1245,7 +1254,8 @@ class AsmJSModule
uint32_t funcSrcEnd,
PropertyName* maybeFieldName,
ArgCoercionVector&& argCoercions,
ReturnType returnType)
ReturnType returnType,
uint32_t funcIndex)
{
// NB: funcSrcBegin/funcSrcEnd are given relative to the ScriptSource
// (the entire file) and ExportedFunctions store offsets relative to
@ -1254,7 +1264,7 @@ class AsmJSModule
MOZ_ASSERT(srcStart_ < funcSrcBegin);
MOZ_ASSERT(funcSrcBegin < funcSrcEnd);
ExportedFunction func(name, funcSrcBegin - srcStart_, funcSrcEnd - srcStart_,
maybeFieldName, mozilla::Move(argCoercions), returnType);
maybeFieldName, mozilla::Move(argCoercions), returnType, funcIndex);
return exports_.length() < UINT32_MAX && exports_.append(mozilla::Move(func));
}
bool addExportedChangeHeap(PropertyName* name,

File diff suppressed because it is too large Load Diff