Bug 1602114 - Remove sourceObjectOut param from CompileGlobalScript r=tcampbell

Depends on D58641

Differential Revision: https://phabricator.services.mozilla.com/D59911

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Gaudet 2020-01-14 21:41:15 +00:00
Родитель 43010a5d55
Коммит 15c2d2ae87
3 изменённых файлов: 25 добавлений и 40 удалений

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

@ -125,13 +125,11 @@ class MOZ_STACK_CLASS GlobalScriptInfo final : public BytecodeCompiler {
GlobalSharedContext* sharedContext() { return &globalsc_; }
};
extern JSScript* CompileGlobalScript(
GlobalScriptInfo& info, JS::SourceText<char16_t>& srcBuf,
ScriptSourceObject** sourceObjectOut = nullptr);
extern JSScript* CompileGlobalScript(GlobalScriptInfo& info,
JS::SourceText<char16_t>& srcBuf);
extern JSScript* CompileGlobalScript(
GlobalScriptInfo& info, JS::SourceText<mozilla::Utf8Unit>& srcBuf,
ScriptSourceObject** sourceObjectOut = nullptr);
extern JSScript* CompileGlobalScript(GlobalScriptInfo& info,
JS::SourceText<mozilla::Utf8Unit>& srcBuf);
class MOZ_STACK_CLASS EvalScriptInfo final : public BytecodeCompiler {
JS::Handle<JSObject*> environment_;

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

@ -207,14 +207,12 @@ static void tellDebuggerAboutCompiledScript(JSContext* cx,
}
template <typename Unit>
static JSScript* CreateGlobalScript(
GlobalScriptInfo& info, JS::SourceText<Unit>& srcBuf,
ScriptSourceObject** sourceObjectOut = nullptr) {
static JSScript* CreateGlobalScript(GlobalScriptInfo& info,
JS::SourceText<Unit>& srcBuf) {
AutoAssertReportedException assertException(info.context());
LifoAllocScope allocScope(&info.context()->tempLifoAlloc());
frontend::ScriptCompiler<Unit> compiler(srcBuf);
AutoInitializeSourceObject autoSSO(info, sourceObjectOut);
if (!compiler.prepareScriptParse(allocScope, info)) {
return nullptr;
@ -230,16 +228,14 @@ static JSScript* CreateGlobalScript(
return info.getScript();
}
JSScript* frontend::CompileGlobalScript(
GlobalScriptInfo& info, JS::SourceText<char16_t>& srcBuf,
ScriptSourceObject** sourceObjectOut /* = nullptr */) {
return CreateGlobalScript(info, srcBuf, sourceObjectOut);
JSScript* frontend::CompileGlobalScript(GlobalScriptInfo& info,
JS::SourceText<char16_t>& srcBuf) {
return CreateGlobalScript(info, srcBuf);
}
JSScript* frontend::CompileGlobalScript(
GlobalScriptInfo& info, JS::SourceText<Utf8Unit>& srcBuf,
ScriptSourceObject** sourceObjectOut /* = nullptr */) {
return CreateGlobalScript(info, srcBuf, sourceObjectOut);
JSScript* frontend::CompileGlobalScript(GlobalScriptInfo& info,
JS::SourceText<Utf8Unit>& srcBuf) {
return CreateGlobalScript(info, srcBuf);
}
template <typename Unit>

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

@ -589,34 +589,25 @@ template <typename Unit>
void ScriptParseTask<Unit>::parse(JSContext* cx) {
MOZ_ASSERT(cx->isHelperThreadContext());
JSScript* script;
Rooted<ScriptSourceObject*> sourceObject(cx);
{
ScopeKind scopeKind =
options.nonSyntacticScope ? ScopeKind::NonSyntactic : ScopeKind::Global;
LifoAllocScope allocScope(&cx->tempLifoAlloc());
frontend::ParseInfo parseInfo(cx, allocScope);
if (!parseInfo.initFromOptions(cx, options)) {
return;
}
frontend::GlobalScriptInfo info(cx, parseInfo, options, scopeKind);
script = frontend::CompileGlobalScript(
info, data,
/* sourceObjectOut = */ &sourceObject.get());
}
if (script) {
scripts.infallibleAppend(script);
ScopeKind scopeKind =
options.nonSyntacticScope ? ScopeKind::NonSyntactic : ScopeKind::Global;
LifoAllocScope allocScope(&cx->tempLifoAlloc());
frontend::ParseInfo parseInfo(cx, allocScope);
if (!parseInfo.initFromOptions(cx, options)) {
return;
}
// Whatever happens to the top-level script compilation (even if it fails),
// we must finish initializing the SSO. This is because there may be valid
// inner scripts observable by the debugger which reference the partially-
// initialized SSO.
if (sourceObject) {
sourceObjects.infallibleAppend(sourceObject);
sourceObjects.infallibleAppend(parseInfo.sourceObject);
frontend::GlobalScriptInfo info(cx, parseInfo, options, scopeKind);
JSScript* script = frontend::CompileGlobalScript(info, data);
if (script) {
scripts.infallibleAppend(script);
}
}