Bug 1693611 - Part 7: Move XDRCheckCompilationStencil to StencilXDR. r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D105918
This commit is contained in:
Tooru Fujisawa 2021-03-09 04:57:30 +00:00
Родитель 5f06fb1b56
Коммит 3d3f8f96bf
4 изменённых файлов: 37 добавлений и 36 удалений

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

@ -656,30 +656,30 @@ template XDRResult XDRCompilationStencil(XDRState<XDR_ENCODE>* xdr,
template XDRResult XDRCompilationStencil(XDRState<XDR_DECODE>* xdr,
CompilationStencil& stencil);
template <XDRMode mode>
XDRResult XDRCheckCompilationStencil(XDRState<mode>* xdr,
CompilationStencil& stencil) {
if (stencil.asmJS) {
return xdr->fail(JS::TranscodeResult::Failure_AsmJSNotSupported);
}
return Ok();
}
template XDRResult XDRCheckCompilationStencil(XDRState<XDR_ENCODE>* xdr,
CompilationStencil& stencil);
template <XDRMode mode>
XDRResult XDRCheckCompilationStencil(XDRState<mode>* xdr,
ExtensibleCompilationStencil& stencil) {
if (stencil.asmJS) {
return xdr->fail(JS::TranscodeResult::Failure_AsmJSNotSupported);
}
return Ok();
}
template XDRResult XDRCheckCompilationStencil(
XDRState<XDR_ENCODE>* xdr, ExtensibleCompilationStencil& stencil);
} // namespace js
template <XDRMode mode>
/* static */ XDRResult StencilXDR::checkCompilationStencil(
XDRState<mode>* xdr, CompilationStencil& stencil) {
if (stencil.asmJS) {
return xdr->fail(JS::TranscodeResult::Failure_AsmJSNotSupported);
}
return Ok();
}
template XDRResult StencilXDR::checkCompilationStencil(
XDRState<XDR_ENCODE>* xdr, CompilationStencil& stencil);
template <XDRMode mode>
/* static */ XDRResult StencilXDR::checkCompilationStencil(
XDRState<mode>* xdr, ExtensibleCompilationStencil& stencil) {
if (stencil.asmJS) {
return xdr->fail(JS::TranscodeResult::Failure_AsmJSNotSupported);
}
return Ok();
}
template XDRResult StencilXDR::checkCompilationStencil(
XDRState<XDR_ENCODE>* xdr, ExtensibleCompilationStencil& stencil);

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

@ -73,6 +73,14 @@ class StencilXDR {
template <XDRMode mode>
static XDRResult codeModuleMetadata(XDRState<mode>* xdr,
StencilModuleMetadata& stencil);
template <XDRMode mode>
static XDRResult checkCompilationStencil(XDRState<mode>* xdr,
CompilationStencil& stencil);
template <XDRMode mode>
static XDRResult checkCompilationStencil(
XDRState<mode>* xdr, ExtensibleCompilationStencil& stencil);
};
} /* namespace frontend */

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

@ -20,6 +20,7 @@
#include "builtin/ModuleObject.h"
#include "debugger/DebugAPI.h"
#include "frontend/CompilationStencil.h" // frontend::{CompilationStencil, ExtensibleCompilationStencil, CompilationStencilMerger, BorrowingCompilationStencil}
#include "frontend/StencilXdr.h" // frontend::StencilXDR
#include "js/BuildId.h" // JS::BuildIdCharVector
#include "vm/JSContext.h"
#include "vm/JSScript.h"
@ -346,7 +347,7 @@ XDRResult XDRStencilEncoder::codeStencil(
return fail(JS::TranscodeResult::Failure);
}
MOZ_TRY(XDRCheckCompilationStencil(this, stencil));
MOZ_TRY(frontend::StencilXDR::checkCompilationStencil(this, stencil));
MOZ_TRY(XDRStencilHeader(this, &input.options, stencil.source));
MOZ_TRY(XDRCompilationStencil(this, stencil));
@ -372,7 +373,7 @@ XDRResult XDRIncrementalStencilEncoder::setInitial(
return fail(JS::TranscodeResult::Failure);
}
MOZ_TRY(XDRCheckCompilationStencil(this, *initial));
MOZ_TRY(frontend::StencilXDR::checkCompilationStencil(this, *initial));
merger_ = cx()->new_<frontend::CompilationStencilMerger>();
if (!merger_) {

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

@ -643,14 +643,6 @@ template <XDRMode mode>
XDRResult XDRCompilationStencil(XDRState<mode>* xdr,
frontend::CompilationStencil& stencil);
template <XDRMode mode>
XDRResult XDRCheckCompilationStencil(XDRState<mode>* xdr,
frontend::CompilationStencil& stencil);
template <XDRMode mode>
XDRResult XDRCheckCompilationStencil(
XDRState<mode>* xdr, frontend::ExtensibleCompilationStencil& stencil);
} /* namespace js */
#endif /* vm_Xdr_h */