зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673553 part 73 - Turn CanReuseScriptForClone check in CloneFunctionObject into an assertion. r=tcampbell
CanReuseScriptForClone returned false for singleton functions, but these are gone now. Depends on D98504 Differential Revision: https://phabricator.services.mozilla.com/D98505
This commit is contained in:
Родитель
9865e1dd67
Коммит
d08386a27e
|
@ -37,18 +37,8 @@ inline JSFunction* CloneFunctionObject(JSContext* cx, HandleFunction fun,
|
||||||
gc::AllocKind extendedFinalizeKind = gc::AllocKind::FUNCTION_EXTENDED;
|
gc::AllocKind extendedFinalizeKind = gc::AllocKind::FUNCTION_EXTENDED;
|
||||||
gc::AllocKind kind = fun->isExtended() ? extendedFinalizeKind : finalizeKind;
|
gc::AllocKind kind = fun->isExtended() ? extendedFinalizeKind : finalizeKind;
|
||||||
|
|
||||||
if (CanReuseScriptForClone(cx->realm(), fun, enclosingEnv)) {
|
MOZ_ASSERT(CanReuseScriptForClone(cx->realm(), fun, enclosingEnv));
|
||||||
return CloneFunctionReuseScript(cx, fun, enclosingEnv, kind, proto);
|
return CloneFunctionReuseScript(cx, fun, enclosingEnv, kind, proto);
|
||||||
}
|
|
||||||
|
|
||||||
RootedScript script(cx, JSFunction::getOrCreateScript(cx, fun));
|
|
||||||
if (!script) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
RootedScope enclosingScope(cx, script->enclosingScope());
|
|
||||||
Rooted<ScriptSourceObject*> sourceObject(cx, script->sourceObject());
|
|
||||||
return CloneFunctionAndScript(cx, fun, enclosingEnv, enclosingScope,
|
|
||||||
sourceObject, kind, proto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace js */
|
} /* namespace js */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче