Bug 1635635 - Move definition of FunctionCreationData. r=mgaudet

This patch is just code motion for the next one.

Depends on D73883

Differential Revision: https://phabricator.services.mozilla.com/D74035
This commit is contained in:
Ted Campbell 2020-05-06 16:07:09 +00:00
Родитель 067091a79a
Коммит ebaeec7f90
1 изменённых файлов: 29 добавлений и 29 удалений

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

@ -68,35 +68,6 @@ class FunctionIndex : public TypedIndex<FunctionIndexType> {
using Base::Base;
};
// Metadata that can be used to allocate a JSFunction object.
//
// Keeping metadata separate allows the parser to generate
// metadata without requiring immediate access to the garbage
// collector.
struct FunctionCreationData {
// All moves but not copies to avoid expensive surprises.
FunctionCreationData() = default;
FunctionCreationData(const FunctionCreationData&) = delete;
FunctionCreationData(FunctionCreationData&& data) = default;
// Data used to instantiate the lazy script before script emission.
// -------
mozilla::Maybe<frontend::AtomVector> closedOverBindings = {};
// This is traced by the functionbox
mozilla::Maybe<Vector<FunctionIndex>> innerFunctionIndexes = {};
// -------
bool createLazyScript(JSContext* cx, CompilationInfo& compilationInfo,
HandleFunction function, FunctionBox* funbox,
HandleScriptSourceObject sourceObject);
bool hasLazyScriptData() const {
return closedOverBindings && innerFunctionIndexes;
}
void trace(JSTracer* trc) {}
};
FunctionFlags InitialFunctionFlags(FunctionSyntaxKind kind,
GeneratorKind generatorKind,
FunctionAsyncKind asyncKind,
@ -364,6 +335,35 @@ using ScriptThingVariant =
// A vector of things destined to be converted to GC things.
using ScriptThingsVector = Vector<ScriptThingVariant>;
// Metadata that can be used to allocate a JSFunction object.
//
// Keeping metadata separate allows the parser to generate
// metadata without requiring immediate access to the garbage
// collector.
struct FunctionCreationData {
// All moves but not copies to avoid expensive surprises.
FunctionCreationData() = default;
FunctionCreationData(const FunctionCreationData&) = delete;
FunctionCreationData(FunctionCreationData&& data) = default;
// Data used to instantiate the lazy script before script emission.
// -------
mozilla::Maybe<frontend::AtomVector> closedOverBindings = {};
// This is traced by the functionbox
mozilla::Maybe<Vector<FunctionIndex>> innerFunctionIndexes = {};
// -------
bool createLazyScript(JSContext* cx, CompilationInfo& compilationInfo,
HandleFunction function, FunctionBox* funbox,
HandleScriptSourceObject sourceObject);
bool hasLazyScriptData() const {
return closedOverBindings && innerFunctionIndexes;
}
void trace(JSTracer* trc) {}
};
// Data used to instantiate the non-lazy script.
class ScriptStencil {
public: