Bug 1675804 - Part 5: Encode ScriptStencil.gcThings at once. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D96924
This commit is contained in:
Tooru Fujisawa 2020-11-14 00:04:28 +00:00
Родитель 51be9f67e9
Коммит 5b01fc228a
1 изменённых файлов: 11 добавлений и 9 удалений

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

@ -15,12 +15,6 @@
using namespace js;
using namespace js::frontend;
template <XDRMode mode>
static XDRResult XDRTaggedScriptThingIndex(XDRState<mode>* xdr,
TaggedScriptThingIndex& thing) {
return xdr->codeUint32(thing.rawData());
}
template <XDRMode mode>
/* static */ XDRResult StencilXDR::Script(XDRState<mode>* xdr,
ScriptStencil& stencil) {
@ -156,9 +150,17 @@ template <XDRMode mode>
}
}
for (TaggedScriptThingIndex& thing : stencil.gcThings) {
MOZ_TRY(XDRTaggedScriptThingIndex(xdr, thing));
}
#ifdef __cpp_lib_has_unique_object_representations
// We check endianess before decoding so if structures are fully packed, we
// may transcode them directly as raw bytes.
static_assert(
std::has_unique_object_representations<TaggedScriptThingIndex>(),
"TaggedScriptThingIndex structure must be fully packed");
#endif
MOZ_TRY(xdr->codeBytes(
const_cast<TaggedScriptThingIndex*>(stencil.gcThings.data()),
sizeof(TaggedScriptThingIndex) * xdrFields.numGcThings));
if (xdrFlags & (1 << uint8_t(XdrFlags::HasSharedData))) {
MOZ_TRY(StencilXDR::SharedData<mode>(xdr, stencil.sharedData));