Bug 1743357 - Part 3: Remove CompilationStencil::steal. r=nbp

Depends on D132356

Differential Revision: https://phabricator.services.mozilla.com/D132357
This commit is contained in:
Tooru Fujisawa 2021-11-30 16:09:25 +00:00
Родитель fea01a452e
Коммит 017e5fb2f9
2 изменённых файлов: 0 добавлений и 83 удалений

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

@ -1148,9 +1148,6 @@ struct CompilationStencil {
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
}
// Steal ExtensibleCompilationStencil content.
[[nodiscard]] bool steal(JSContext* cx, ExtensibleCompilationStencil&& other);
bool isModule() const;
#ifdef DEBUG

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

@ -2533,86 +2533,6 @@ void ExtensibleCompilationStencil::assertNoExternalDependency() const {
}
#endif // DEBUG
template <typename T, typename VectorT>
bool CopyVectorToSpan(JSContext* cx, LifoAlloc& alloc, mozilla::Span<T>& span,
VectorT& vec) {
auto len = vec.length();
if (len == 0) {
return true;
}
auto* p = alloc.newArrayUninitialized<T>(len);
if (!p) {
js::ReportOutOfMemory(cx);
return false;
}
span = mozilla::Span(p, len);
memcpy(span.data(), vec.begin(), sizeof(T) * len);
return true;
}
bool CompilationStencil::steal(JSContext* cx,
ExtensibleCompilationStencil&& other) {
#ifdef DEBUG
other.assertNoExternalDependency();
#endif
canLazilyParse = other.canLazilyParse;
functionKey = other.functionKey;
MOZ_ASSERT(alloc.isEmpty());
alloc.steal(&other.alloc);
if (!CopyVectorToSpan(cx, alloc, scriptData, other.scriptData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, scriptExtra, other.scriptExtra)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, gcThingData, other.gcThingData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, scopeData, other.scopeData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, scopeNames, other.scopeNames)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, regExpData, other.regExpData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, bigIntData, other.bigIntData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, objLiteralData, other.objLiteralData)) {
return false;
}
if (!CopyVectorToSpan(cx, alloc, parserAtomData,
other.parserAtoms.entries())) {
return false;
}
sharedData = std::move(other.sharedData);
moduleMetadata = std::move(other.moduleMetadata);
asmJS = std::move(other.asmJS);
#ifdef DEBUG
assertNoExternalDependency();
#endif
return true;
}
template <typename T, typename VectorT>
[[nodiscard]] bool CopySpanToVector(JSContext* cx, VectorT& vec,
mozilla::Span<T>& span) {