Bug 1683623 - Part 2: Remove ScriptStencil parameter from BytecodeEmitter::intoScriptStencil. r=tcampbell

Depends on D100715

Differential Revision: https://phabricator.services.mozilla.com/D100716
This commit is contained in:
Tooru Fujisawa 2021-01-04 21:09:33 +00:00
Родитель 462f74dc4e
Коммит 85f143cb80
3 изменённых файлов: 17 добавлений и 18 удалений

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

@ -2590,9 +2590,7 @@ bool BytecodeEmitter::emitScript(ParseNode* body) {
}
// Create a Stencil and convert it into a JSScript.
return intoScriptStencil(
&compilationInfo.stencil.scriptData[CompilationInfo::TopLevelIndex],
CompilationInfo::TopLevelIndex);
return intoScriptStencil(CompilationInfo::TopLevelIndex);
}
js::UniquePtr<ImmutableScriptData> BytecodeEmitter::createImmutableScriptData(
@ -11289,8 +11287,7 @@ bool BytecodeEmitter::newSrcNoteOperand(ptrdiff_t operand) {
return SrcNoteWriter::writeOperand(operand, allocator);
}
bool BytecodeEmitter::intoScriptStencil(ScriptStencil* script,
ScriptIndex scriptIndex) {
bool BytecodeEmitter::intoScriptStencil(ScriptIndex scriptIndex) {
js::UniquePtr<ImmutableScriptData> immutableScriptData =
createImmutableScriptData(cx);
if (!immutableScriptData) {
@ -11310,7 +11307,9 @@ bool BytecodeEmitter::intoScriptStencil(ScriptStencil* script,
return false;
}
std::uninitialized_copy(things.begin(), things.end(), stencilThings.begin());
script->gcThings = stencilThings;
ScriptStencil& script = compilationInfo.stencil.scriptData[scriptIndex];
script.gcThings = stencilThings;
// Hand over the ImmutableScriptData instance generated by BCE.
auto* sharedData =
@ -11325,22 +11324,22 @@ bool BytecodeEmitter::intoScriptStencil(ScriptStencil* script,
return false;
}
script->hasSharedData = true;
script.hasSharedData = true;
// Update flags specific to functions.
if (sc->isFunctionBox()) {
FunctionBox* funbox = sc->asFunctionBox();
MOZ_ASSERT(script == &funbox->functionStencil());
MOZ_ASSERT(&script == &funbox->functionStencil());
funbox->copyUpdatedImmutableFlags();
MOZ_ASSERT(funbox->extent().sourceStart == script->extent.sourceStart);
MOZ_ASSERT(funbox->extent().sourceEnd == script->extent.sourceEnd);
MOZ_ASSERT(funbox->extent().toStringStart == script->extent.toStringStart);
MOZ_ASSERT(funbox->extent().toStringEnd == script->extent.toStringEnd);
MOZ_ASSERT(funbox->extent().lineno == script->extent.lineno);
MOZ_ASSERT(funbox->extent().column == script->extent.column);
MOZ_ASSERT(script->isFunction());
MOZ_ASSERT(funbox->extent().sourceStart == script.extent.sourceStart);
MOZ_ASSERT(funbox->extent().sourceEnd == script.extent.sourceEnd);
MOZ_ASSERT(funbox->extent().toStringStart == script.extent.toStringStart);
MOZ_ASSERT(funbox->extent().toStringEnd == script.extent.toStringEnd);
MOZ_ASSERT(funbox->extent().lineno == script.extent.lineno);
MOZ_ASSERT(funbox->extent().column == script.extent.column);
MOZ_ASSERT(script.isFunction());
} else {
sc->copyScriptFields(*script);
sc->copyScriptFields(script);
}
return true;

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

@ -306,7 +306,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
unsigned errorNumber, ...);
// Fill in a ScriptStencil using this BCE data.
bool intoScriptStencil(ScriptStencil* script, ScriptIndex scriptIndex);
bool intoScriptStencil(ScriptIndex scriptIndex);
// If pn contains a useful expression, return true with *answer set to true.
// If pn contains a useless expression, return true with *answer set to

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

@ -671,7 +671,7 @@ bool FunctionScriptEmitter::emitEndBody() {
bool FunctionScriptEmitter::intoStencil() {
MOZ_ASSERT(state_ == State::EndBody);
if (!bce_->intoScriptStencil(&funbox_->functionStencil(), funbox_->index())) {
if (!bce_->intoScriptStencil(funbox_->index())) {
return false;
}