mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-06 00:31:27 +00:00
Bug 1623932 - Remove support for storing GCCellPtrs in the GCThingList r=caroline
Differential Revision: https://phabricator.services.mozilla.com/D67642 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
731551f663
commit
466060466e
@ -2438,12 +2438,12 @@ bool BytecodeEmitter::emitScript(ParseNode* body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<BCEScriptStencil> stencil(cx, BCEScriptStencil(*this));
|
||||
if (!stencil.get().init(cx, nslots)) {
|
||||
BCEScriptStencil stencil(*this);
|
||||
if (!stencil.init(cx, nslots)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!JSScript::fullyInitFromStencil(cx, script, stencil.get())) {
|
||||
if (!JSScript::fullyInitFromStencil(cx, script, stencil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,7 @@ void GCThingList::finishInnerFunctions() {
|
||||
}
|
||||
|
||||
AbstractScopePtr GCThingList::getScope(size_t index) const {
|
||||
auto& elem = vector[index].get();
|
||||
if (elem.is<JS::GCCellPtr>()) {
|
||||
return AbstractScopePtr(&elem.as<JS::GCCellPtr>().as<Scope>());
|
||||
}
|
||||
const ScriptThingVariant& elem = vector[index];
|
||||
if (elem.is<EmptyGlobalScopeType>()) {
|
||||
return AbstractScopePtr(&compilationInfo.cx->global()->emptyGlobalScope());
|
||||
}
|
||||
@ -68,11 +65,6 @@ bool js::frontend::EmitScriptThingsVector(JSContext* cx,
|
||||
uint32_t i;
|
||||
mozilla::Span<JS::GCCellPtr>& output;
|
||||
|
||||
bool operator()(const JS::GCCellPtr& value) {
|
||||
output[i] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator()(const BigIntIndex& index) {
|
||||
BigIntCreationData& data = compilationInfo.bigIntData[index];
|
||||
BigInt* bi = data.createBigInt(cx);
|
||||
|
@ -46,7 +46,7 @@ class FunctionBox;
|
||||
|
||||
struct MOZ_STACK_CLASS GCThingList {
|
||||
CompilationInfo& compilationInfo;
|
||||
JS::Rooted<ScriptThingsVector> vector;
|
||||
ScriptThingsVector vector;
|
||||
|
||||
// Last emitted function.
|
||||
FunctionBox* lastbox = nullptr;
|
||||
@ -106,7 +106,7 @@ struct MOZ_STACK_CLASS GCThingList {
|
||||
return getScope(*firstScopeIndex);
|
||||
}
|
||||
|
||||
ScriptThingsVector stealGCThings() { return std::move(vector.get()); }
|
||||
ScriptThingsVector stealGCThings() { return std::move(vector); }
|
||||
};
|
||||
|
||||
MOZ_MUST_USE bool EmitScriptThingsVector(JSContext* cx,
|
||||
|
@ -85,7 +85,7 @@ class SmooshScriptStencil : public ScriptStencil {
|
||||
result_.is_function, /* funLength = */ 0,
|
||||
mozilla::MakeSpan(result_.bytecode.data, result_.bytecode.len),
|
||||
mozilla::Span<const jssrcnote>(), mozilla::Span<const uint32_t>(),
|
||||
scopeNotes, mozilla::Span<const JSTryNote>());
|
||||
scopeNotes, mozilla::Span<const TryNote>());
|
||||
if (!immutableScriptData) {
|
||||
return false;
|
||||
}
|
||||
@ -352,13 +352,12 @@ JSScript* Smoosh::compileGlobalScript(CompilationInfo& compilationInfo,
|
||||
RootedScript script(cx,
|
||||
JSScript::Create(cx, cx->global(), options, sso, extent));
|
||||
|
||||
Rooted<SmooshScriptStencil> stencil(
|
||||
cx, SmooshScriptStencil(cx, smoosh, compilationInfo));
|
||||
if (!stencil.get().init(cx)) {
|
||||
SmooshScriptStencil stencil(cx, smoosh, compilationInfo);
|
||||
if (!stencil.init(cx)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!JSScript::fullyInitFromStencil(cx, script, stencil.get())) {
|
||||
if (!JSScript::fullyInitFromStencil(cx, script, stencil)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -740,11 +740,11 @@ bool FunctionScriptEmitter::initScript(
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<BCEScriptStencil> stencil(bce_->cx, BCEScriptStencil(*bce_));
|
||||
if (!stencil.get().init(bce_->cx, nslots)) {
|
||||
BCEScriptStencil stencil(*bce_);
|
||||
if (!stencil.init(bce_->cx, nslots)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSScript::fullyInitFromStencil(bce_->cx, bce_->script, stencil.get())) {
|
||||
if (!JSScript::fullyInitFromStencil(bce_->cx, bce_->script, stencil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -567,15 +567,4 @@ class ObjLiteralCreationData {
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
// Ignore GC tracing for the ObjLiteralCreationData. It contains JSAtom
|
||||
// pointers, but these are already held and rooted by the parser. (We must
|
||||
// specify GC policy for the creation data because it is placed in the
|
||||
// GC-things vector.)
|
||||
template <>
|
||||
struct GCPolicy<js::ObjLiteralCreationData>
|
||||
: JS::IgnoreGCPolicy<js::ObjLiteralCreationData> {};
|
||||
} // namespace JS
|
||||
|
||||
#endif // frontend_ObjLiteral_h
|
||||
|
@ -444,15 +444,13 @@ class ScopeCreationData {
|
||||
class EmptyGlobalScopeType {};
|
||||
|
||||
// These types all end up being baked into GC things as part of stencil
|
||||
// instantiation. Currently, GCCellPtr is part of this list while we complete
|
||||
// Stencil, but eventually will be removed.
|
||||
// instantiation.
|
||||
using ScriptThingVariant =
|
||||
mozilla::Variant<JS::GCCellPtr, BigIntIndex, ObjLiteralCreationData,
|
||||
RegExpIndex, ScopeIndex, FunctionIndex,
|
||||
EmptyGlobalScopeType>;
|
||||
mozilla::Variant<BigIntIndex, ObjLiteralCreationData, RegExpIndex,
|
||||
ScopeIndex, FunctionIndex, EmptyGlobalScopeType>;
|
||||
|
||||
// A vector of things destined to be converted to GC things.
|
||||
using ScriptThingsVector = GCVector<ScriptThingVariant>;
|
||||
using ScriptThingsVector = Vector<ScriptThingVariant>;
|
||||
|
||||
// Data used to instantiate the non-lazy script.
|
||||
class ScriptStencil {
|
||||
@ -485,7 +483,7 @@ class ScriptStencil {
|
||||
|
||||
js::frontend::FunctionBox* functionBox = nullptr;
|
||||
|
||||
ScriptStencil(JSContext* cx) : gcThings(cx) {}
|
||||
explicit ScriptStencil(JSContext* cx) : gcThings(cx) {}
|
||||
|
||||
// Store all GC things into `gcthings`.
|
||||
// `gcthings.Length()` is `this.ngcthings`.
|
||||
@ -498,8 +496,6 @@ class ScriptStencil {
|
||||
|
||||
// Call `FunctionBox::finish` for all inner functions.
|
||||
virtual void finishInnerFunctions() const = 0;
|
||||
|
||||
void trace(JSTracer* trc) { gcThings.trace(trc); }
|
||||
};
|
||||
|
||||
} /* namespace frontend */
|
||||
@ -513,17 +509,5 @@ struct GCPolicy<js::frontend::ScopeCreationData*> {
|
||||
(*data)->trace(trc);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct GCPolicy<js::frontend::TypedIndex<T>>
|
||||
: JS::IgnoreGCPolicy<js::frontend::TypedIndex<T>> {};
|
||||
|
||||
template <>
|
||||
struct GCPolicy<js::frontend::FunctionIndex>
|
||||
: JS::IgnoreGCPolicy<js::frontend::FunctionIndex> {};
|
||||
|
||||
template <>
|
||||
struct GCPolicy<js::frontend::EmptyGlobalScopeType>
|
||||
: JS::IgnoreGCPolicy<js::frontend::EmptyGlobalScopeType> {};
|
||||
} // namespace JS
|
||||
#endif /* frontend_Stencil_h */
|
||||
|
Loading…
x
Reference in New Issue
Block a user