Backed out changeset 5a5bb14b79fe (bug 1666983) for SM bustages on Stencil.cpp

This commit is contained in:
Narcis Beleuzu 2020-10-06 02:59:32 +03:00
Родитель 66f9a28e83
Коммит 1d6a1aa539
2 изменённых файлов: 9 добавлений и 65 удалений

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

@ -3231,10 +3231,6 @@ FunctionNode* Parser<FullParseHandler, Unit>::standaloneLazyFunction(
return null(); return null();
} }
if (fun->isClassConstructor()) {
funbox->setCtorToStringEnd(fun->baseScript()->extent().toStringEnd);
}
if (!CheckParseTree(cx_, alloc_, funNode)) { if (!CheckParseTree(cx_, alloc_, funNode)) {
return null(); return null();
} }

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

@ -428,29 +428,29 @@ static bool InstantiateScriptStencils(JSContext* cx,
// includes standalone functions and functions being delazified. // includes standalone functions and functions being delazified.
static bool InstantiateTopLevel(JSContext* cx, CompilationInfo& compilationInfo, static bool InstantiateTopLevel(JSContext* cx, CompilationInfo& compilationInfo,
CompilationGCOutput& gcOutput) { CompilationGCOutput& gcOutput) {
ScriptStencil& scriptStencil = ScriptStencil& script =
compilationInfo.stencil.scriptData[CompilationInfo::TopLevelIndex]; compilationInfo.stencil.scriptData[CompilationInfo::TopLevelIndex];
RootedFunction fun(cx); RootedFunction fun(cx);
if (scriptStencil.isFunction()) { if (script.isFunction()) {
fun = gcOutput.functions[CompilationInfo::TopLevelIndex]; fun = gcOutput.functions[CompilationInfo::TopLevelIndex];
} }
// Top-level asm.js does not generate a JSScript. // Top-level asm.js does not generate a JSScript.
if (scriptStencil.functionFlags.isAsmJSNative()) { if (script.functionFlags.isAsmJSNative()) {
return true; return true;
} }
MOZ_ASSERT(scriptStencil.sharedData); MOZ_ASSERT(script.sharedData);
if (compilationInfo.input.lazy) { if (compilationInfo.input.lazy) {
gcOutput.script = JSScript::CastFromLazy(compilationInfo.input.lazy); gcOutput.script = JSScript::CastFromLazy(compilationInfo.input.lazy);
if (!JSScript::fullyInitFromStencil(cx, compilationInfo, gcOutput, if (!JSScript::fullyInitFromStencil(cx, compilationInfo, gcOutput,
gcOutput.script, scriptStencil, fun)) { gcOutput.script, script, fun)) {
return false; return false;
} }
if (scriptStencil.allowRelazify) { if (script.allowRelazify) {
MOZ_ASSERT(gcOutput.script->isRelazifiable()); MOZ_ASSERT(gcOutput.script->isRelazifiable());
gcOutput.script->setAllowRelazify(); gcOutput.script->setAllowRelazify();
} }
@ -459,18 +459,18 @@ static bool InstantiateTopLevel(JSContext* cx, CompilationInfo& compilationInfo,
} }
gcOutput.script = gcOutput.script =
JSScript::fromStencil(cx, compilationInfo, gcOutput, scriptStencil, fun); JSScript::fromStencil(cx, compilationInfo, gcOutput, script, fun);
if (!gcOutput.script) { if (!gcOutput.script) {
return false; return false;
} }
if (scriptStencil.allowRelazify) { if (script.allowRelazify) {
MOZ_ASSERT(gcOutput.script->isRelazifiable()); MOZ_ASSERT(gcOutput.script->isRelazifiable());
gcOutput.script->setAllowRelazify(); gcOutput.script->setAllowRelazify();
} }
// Finish initializing the ModuleObject if needed. // Finish initializing the ModuleObject if needed.
if (scriptStencil.isModule()) { if (script.isModule()) {
gcOutput.module->initScriptSlots(gcOutput.script); gcOutput.module->initScriptSlots(gcOutput.script);
gcOutput.module->initStatusSlot(); gcOutput.module->initStatusSlot();
@ -551,54 +551,6 @@ static void LinkEnclosingLazyScript(CompilationInfo& compilationInfo,
} }
} }
#ifdef DEBUG
// Some fields aren't used in delazification, given the target functions and
// scripts are already instantiated, but they still should match.
static void AssertDelazificationFieldsMatch(CompilationInfo& compilationInfo,
CompilationGCOutput& gcOutput) {
for (auto item : compilationInfo.functionScriptStencils(gcOutput)) {
auto& scriptStencil = item.script;
auto& fun = item.function;
BaseScript* script = fun->baseScript();
// TreatAsRunOnce is updated by UpdateEmittedInnerFunctions.
uint32_t acceptableDifferenceForScript =
uint32_t(ImmutableScriptFlagsEnum::TreatAsRunOnce);
MOZ_ASSERT(
(uint32_t(script->immutableFlags()) | acceptableDifferenceForScript) ==
(uint32_t(scriptStencil.immutableFlags) |
acceptableDifferenceForScript));
MOZ_ASSERT(script->extent().sourceStart ==
scriptStencil.extent.sourceStart);
MOZ_ASSERT(script->extent().sourceEnd == scriptStencil.extent.sourceEnd);
MOZ_ASSERT(script->extent().toStringStart ==
scriptStencil.extent.toStringStart);
MOZ_ASSERT(script->extent().toStringEnd ==
scriptStencil.extent.toStringEnd);
MOZ_ASSERT(script->extent().lineno == scriptStencil.extent.lineno);
MOZ_ASSERT(script->extent().column == scriptStencil.extent.column);
// Names are updated by SetTypeAndNameForExposedFunctions.
constexpr uint16_t HAS_INFERRED_NAME =
uint16_t(FunctionFlags::Flags::HAS_INFERRED_NAME);
constexpr uint16_t HAS_GUESSED_ATOM =
uint16_t(FunctionFlags::Flags::HAS_GUESSED_ATOM);
constexpr uint16_t acceptableDifferenceForFunction =
HAS_INFERRED_NAME | HAS_GUESSED_ATOM;
MOZ_ASSERT((fun->flags().toRaw() | acceptableDifferenceForFunction) ==
(scriptStencil.functionFlags.toRaw() |
acceptableDifferenceForFunction));
// FIXME: If this function is lazily parsed again, nargs isn't set to
// correct value (bug 1666978).
MOZ_ASSERT_IF(scriptStencil.sharedData,
fun->nargs() == scriptStencil.nargs);
}
}
#endif // DEBUG
// When delazifying, use the existing JSFunctions. The initial and delazifying // When delazifying, use the existing JSFunctions. The initial and delazifying
// parse are required to generate the same sequence of functions for lazy // parse are required to generate the same sequence of functions for lazy
// parsing to work at all. // parsing to work at all.
@ -634,10 +586,6 @@ bool CompilationInfo::instantiateStencils(JSContext* cx,
if (input.lazy) { if (input.lazy) {
FunctionsFromExistingLazy(*this, gcOutput); FunctionsFromExistingLazy(*this, gcOutput);
#ifdef DEBUG
AssertDelazificationFieldsMatch(*this, gcOutput);
#endif
} else { } else {
if (!InstantiateScriptSourceObject(cx, *this, gcOutput)) { if (!InstantiateScriptSourceObject(cx, *this, gcOutput)) {
return false; return false;