зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675804 - Part 5: Encode ScriptStencil.gcThings at once. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D96924
This commit is contained in:
Родитель
51be9f67e9
Коммит
5b01fc228a
|
@ -15,12 +15,6 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace js::frontend;
|
using namespace js::frontend;
|
||||||
|
|
||||||
template <XDRMode mode>
|
|
||||||
static XDRResult XDRTaggedScriptThingIndex(XDRState<mode>* xdr,
|
|
||||||
TaggedScriptThingIndex& thing) {
|
|
||||||
return xdr->codeUint32(thing.rawData());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <XDRMode mode>
|
template <XDRMode mode>
|
||||||
/* static */ XDRResult StencilXDR::Script(XDRState<mode>* xdr,
|
/* static */ XDRResult StencilXDR::Script(XDRState<mode>* xdr,
|
||||||
ScriptStencil& stencil) {
|
ScriptStencil& stencil) {
|
||||||
|
@ -156,9 +150,17 @@ template <XDRMode mode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TaggedScriptThingIndex& thing : stencil.gcThings) {
|
#ifdef __cpp_lib_has_unique_object_representations
|
||||||
MOZ_TRY(XDRTaggedScriptThingIndex(xdr, thing));
|
// 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))) {
|
if (xdrFlags & (1 << uint8_t(XdrFlags::HasSharedData))) {
|
||||||
MOZ_TRY(StencilXDR::SharedData<mode>(xdr, stencil.sharedData));
|
MOZ_TRY(StencilXDR::SharedData<mode>(xdr, stencil.sharedData));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче