Bug 1693611 - Part 1: Rename StencilXDR::BigInt to StencilXDR::codeBigInt. r=mgaudet

Subsequent patches move other XDR functions into StencilXDR.
To avoid name collision between method and type name, prepend `code` to method.

Also reorder to match the field order.

Differential Revision: https://phabricator.services.mozilla.com/D105912
This commit is contained in:
Tooru Fujisawa 2021-03-08 23:32:20 +00:00
Родитель 12b75a5e93
Коммит 6f7ba2f05f
2 изменённых файлов: 21 добавлений и 19 удалений

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

@ -157,6 +157,18 @@ static XDRResult XDRSpanContent(XDRState<mode>* xdr, mozilla::Span<T>& span) {
return XDRSpanContent(xdr, span, size);
}
template <XDRMode mode>
/* static */ XDRResult StencilXDR::codeBigInt(XDRState<mode>* xdr,
BigIntStencil& stencil) {
uint32_t size;
if (mode == XDR_ENCODE) {
size = stencil.source_.size();
}
MOZ_TRY(xdr->codeUint32(&size));
return XDRSpanContent(xdr, stencil.source_, size);
}
template <XDRMode mode>
static XDRResult XDRStencilModuleMetadata(XDRState<mode>* xdr,
StencilModuleMetadata& stencil) {
@ -251,18 +263,6 @@ template <XDRMode mode>
return Ok();
}
template <XDRMode mode>
/* static */ XDRResult StencilXDR::BigInt(XDRState<mode>* xdr,
BigIntStencil& stencil) {
uint32_t size;
if (mode == XDR_ENCODE) {
size = stencil.source_.size();
}
MOZ_TRY(xdr->codeUint32(&size));
return XDRSpanContent(xdr, stencil.source_, size);
}
template <XDRMode mode>
/* static */
XDRResult StencilXDR::SharedData(XDRState<mode>* xdr,
@ -536,7 +536,7 @@ XDRResult XDRCompilationStencil(XDRState<mode>* xdr,
MOZ_TRY(XDRSpanInitialized(xdr, stencil.bigIntData, bigIntSize));
for (auto& entry : stencil.bigIntData) {
MOZ_TRY(StencilXDR::BigInt(xdr, entry));
MOZ_TRY(StencilXDR::codeBigInt(xdr, entry));
}
MOZ_TRY(XDRSpanInitialized(xdr, stencil.objLiteralData, objLiteralSize));

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

@ -7,10 +7,12 @@
#ifndef frontend_StencilXdr_h
#define frontend_StencilXdr_h
#include "mozilla/RefPtr.h" // RefPtr
#include "frontend/ObjLiteral.h" // ObjLiteralStencil
#include "frontend/Stencil.h" // *Stencil
#include "vm/Scope.h" // Scope, ScopeKindString
#include "vm/Xdr.h" // XDRMode, XDRResult, XDREncoder
#include "frontend/Stencil.h" // BitIntStencil, ScopeStencil, BaseParserScopeData
#include "vm/SharedStencil.h" // SharedImmutableScriptData
#include "vm/Xdr.h" // XDRMode, XDRResult, XDRState
namespace js {
namespace frontend {
@ -40,6 +42,9 @@ struct CanCopyDataToDisk {
// relevant struct internals.
class StencilXDR {
public:
template <XDRMode mode>
static XDRResult codeBigInt(XDRState<mode>* xdr, BigIntStencil& stencil);
template <XDRMode mode>
static XDRResult ScopeData(XDRState<mode>* xdr, ScopeStencil& stencil,
BaseParserScopeData*& baseScopeData);
@ -47,9 +52,6 @@ class StencilXDR {
template <XDRMode mode>
static XDRResult ObjLiteral(XDRState<mode>* xdr, ObjLiteralStencil& stencil);
template <XDRMode mode>
static XDRResult BigInt(XDRState<mode>* xdr, BigIntStencil& stencil);
template <XDRMode mode>
static XDRResult SharedData(js::XDRState<mode>* xdr,
RefPtr<SharedImmutableScriptData>& sisd);