From e6416b3f503acc36064a208f31557e38a1756f08 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Tue, 9 Mar 2021 04:57:32 +0000 Subject: [PATCH] Bug 1693611 - Part 11: Remove XDRStencilDecoder::{hasOptions,options}. r=mgaudet Differential Revision: https://phabricator.services.mozilla.com/D105922 --- js/src/frontend/Stencil.cpp | 4 ++-- js/src/jsapi.cpp | 2 +- js/src/vm/HelperThreads.cpp | 2 +- js/src/vm/Xdr.h | 20 +++++--------------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/js/src/frontend/Stencil.cpp b/js/src/frontend/Stencil.cpp index daba97b7a679..1bb50fb273ed 100644 --- a/js/src/frontend/Stencil.cpp +++ b/js/src/frontend/Stencil.cpp @@ -1387,7 +1387,7 @@ bool CompilationStencil::deserializeStencils(JSContext* cx, *succeededOut = false; } MOZ_ASSERT(parserAtomData.empty()); - XDRStencilDecoder decoder(cx, &input.options, range); + XDRStencilDecoder decoder(cx, range); XDRResult res = decoder.codeStencil(input, *this); if (res.isErr()) { @@ -3502,7 +3502,7 @@ JS::TranscodeResult JS::DecodeStencil(JSContext* cx, if (!stencil) { return TranscodeResult::Throw; } - XDRStencilDecoder decoder(cx, &options, range); + XDRStencilDecoder decoder(cx, range); XDRResult res = decoder.codeStencil(input.get(), *stencil); if (res.isErr()) { return res.unwrapErr(); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index d27bf5090c64..4d3c590a20e4 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -5726,7 +5726,7 @@ static JS::TranscodeResult DecodeStencil(JSContext* cx, frontend::CompilationInput& input, frontend::CompilationStencil& stencil, size_t cursorIndex) { - XDRStencilDecoder decoder(cx, &input.options, buffer, cursorIndex); + XDRStencilDecoder decoder(cx, buffer, cursorIndex); if (!input.initForGlobal(cx)) { return JS::TranscodeResult::Throw; diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index 67bafa01d456..d5172bcddefe 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -820,7 +820,7 @@ void ScriptDecodeTask::parse(JSContext* cx) { return; } - XDRStencilDecoder decoder(cx, &options, range); + XDRStencilDecoder decoder(cx, range); XDRResult res = decoder.codeStencil(*stencilInput_, *stencil_); if (!res.isOk()) { stencil_.reset(); diff --git a/js/src/vm/Xdr.h b/js/src/vm/Xdr.h index f33f0c56ff9a..3b82e82a1639 100644 --- a/js/src/vm/Xdr.h +++ b/js/src/vm/Xdr.h @@ -552,7 +552,7 @@ class XDROffThreadDecoder : public XDRDecoder { */ /* - * The stencil decoder accepts `options` and `range` as input. + * The stencil decoder accepts `range` as input. * * The decoded stencils are outputted to the default-initialized * `stencil` parameter of `codeStencil` method. @@ -562,29 +562,19 @@ class XDROffThreadDecoder : public XDRDecoder { */ class XDRStencilDecoder : public XDRDecoderBase { public: - XDRStencilDecoder(JSContext* cx, const JS::ReadOnlyCompileOptions* options, - JS::TranscodeBuffer& buffer, size_t cursor) - : XDRDecoderBase(cx, buffer, cursor), options_(options) { + XDRStencilDecoder(JSContext* cx, JS::TranscodeBuffer& buffer, size_t cursor) + : XDRDecoderBase(cx, buffer, cursor) { MOZ_ASSERT(JS::IsTranscodingBytecodeAligned(buffer.begin())); MOZ_ASSERT(JS::IsTranscodingBytecodeOffsetAligned(cursor)); - MOZ_ASSERT(options_); } - XDRStencilDecoder(JSContext* cx, const JS::ReadOnlyCompileOptions* options, - const JS::TranscodeRange& range) - : XDRDecoderBase(cx, range), options_(options) { + XDRStencilDecoder(JSContext* cx, const JS::TranscodeRange& range) + : XDRDecoderBase(cx, range) { MOZ_ASSERT(JS::IsTranscodingBytecodeAligned(range.begin().get())); - MOZ_ASSERT(options_); } - bool hasOptions() const override { return true; } - const JS::ReadOnlyCompileOptions& options() override { return *options_; } - XDRResult codeStencil(frontend::CompilationInput& input, frontend::CompilationStencil& stencil); - - private: - const JS::ReadOnlyCompileOptions* options_; }; class XDRStencilEncoder : public XDREncoder {