Issue #1691 - Part 7f: Split up compile and execute so we can use ClassicScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Refactor nsJSUtils::ExecutionContext to separate compilation and execution steps and allow extraction of compiled JSScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1366773 Move buffer argument from JS::StartIncrementalEncoding to JS::FinishIncrementalEncoding.

(cherry picked from commit d4b520b08b958e116dfeeffdc61f3425610d1ce9)
This commit is contained in:
Brian Smith 2023-04-20 10:15:52 -05:00 • committed by roytam1
commit c69a47c393
10 changed files with 154 additions and 125 deletions

View file

@ -410,18 +410,15 @@ class XDRIncrementalEncoder : public XDREncoder
// Tree of slices.
SlicesTree tree_;
JS::TranscodeBuffer slices_;
JS::TranscodeBuffer& buffer_;
bool oom_;
public:
XDRIncrementalEncoder(ExclusiveContext* cx, JS::TranscodeBuffer& buffer, size_t cursor)
XDRIncrementalEncoder(ExclusiveContext* cx)
: XDREncoder(cx, slices_, 0),
scope_(nullptr),
node_(nullptr),
buffer_(buffer),
oom_(false)
{
MOZ_ASSERT(buffer.length() == cursor, "NYI");
}
virtual ~XDRIncrementalEncoder() {}
@ -434,9 +431,9 @@ class XDRIncrementalEncoder : public XDREncoder
void createOrReplaceSubTree(AutoXDRTree* child) override;
void endSubTree() override;
// In the current XDRBuffer, move replaceable-parts to form a linear
// sequence of bytes.
MOZ_MUST_USE bool linearize();
// Append the content collected during the incremental encoding into the
// buffer given as argument.
MOZ_MUST_USE bool linearize(JS::TranscodeBuffer& buffer);
};
} /* namespace js */