зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1575055 - Unify JS::CompileOptions::canLazilyParse and forceFullParse_. r=jandem
If either the Realm or the request needs full-parsing, we disable lazy parsing. Differential Revision: https://phabricator.services.mozilla.com/D42560 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3cab8e70c6
Коммит
179e9bf7ab
|
@ -114,7 +114,6 @@ class JS_PUBLIC_API TransitiveCompileOptions {
|
|||
public:
|
||||
// POD options.
|
||||
bool selfHostingMode = false;
|
||||
bool canLazilyParse = true;
|
||||
bool extraWarningsOption = false;
|
||||
bool werrorOption = false;
|
||||
AsmJSOption asmJSOption = AsmJSOption::Disabled;
|
||||
|
@ -408,11 +407,6 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
|||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setCanLazilyParse(bool clp) {
|
||||
canLazilyParse = clp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setSourceIsLazy(bool l) {
|
||||
sourceIsLazy = l;
|
||||
return *this;
|
||||
|
@ -447,6 +441,11 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
|||
CompileOptions& setIntroductionInfoToCaller(JSContext* cx,
|
||||
const char* introductionType);
|
||||
|
||||
CompileOptions& setForceFullParse() {
|
||||
forceFullParse_ = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setForceStrictMode() {
|
||||
forceStrictMode_ = true;
|
||||
return *this;
|
||||
|
|
|
@ -3631,7 +3631,7 @@ static bool reflect_parse(JSContext* cx, uint32_t argc, Value* vp) {
|
|||
|
||||
CompileOptions options(cx);
|
||||
options.setFileAndLine(filename.get(), lineno);
|
||||
options.setCanLazilyParse(false);
|
||||
options.setForceFullParse();
|
||||
options.allowHTMLComments = target == ParseGoal::Script;
|
||||
mozilla::Range<const char16_t> chars = linearChars.twoByteRange();
|
||||
UsedNameTracker usedNames(cx);
|
||||
|
|
|
@ -402,8 +402,8 @@ bool BytecodeCompiler::createScriptSource(
|
|||
}
|
||||
|
||||
bool BytecodeCompiler::canLazilyParse() const {
|
||||
return options.canLazilyParse && !options.discardSource &&
|
||||
!options.sourceIsLazy && !options.forceFullParse();
|
||||
return !options.discardSource && !options.sourceIsLazy &&
|
||||
!options.forceFullParse();
|
||||
}
|
||||
|
||||
template <typename Unit>
|
||||
|
|
|
@ -3527,7 +3527,6 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions(
|
|||
forceFullParse_ = rhs.forceFullParse_;
|
||||
forceStrictMode_ = rhs.forceStrictMode_;
|
||||
selfHostingMode = rhs.selfHostingMode;
|
||||
canLazilyParse = rhs.canLazilyParse;
|
||||
extraWarningsOption = rhs.extraWarningsOption;
|
||||
werrorOption = rhs.werrorOption;
|
||||
asmJSOption = rhs.asmJSOption;
|
||||
|
|
|
@ -942,7 +942,7 @@ static bool InitModuleLoader(JSContext* cx) {
|
|||
options.setIntroductionType("shell module loader");
|
||||
options.setFileAndLine("shell/ModuleLoader.js", 1);
|
||||
options.setSelfHostingMode(false);
|
||||
options.setCanLazilyParse(false);
|
||||
options.setForceFullParse();
|
||||
options.werrorOption = true;
|
||||
options.setForceStrictMode();
|
||||
|
||||
|
|
|
@ -2626,7 +2626,7 @@ void js::FillSelfHostingCompileOptions(CompileOptions& options) {
|
|||
options.setIntroductionType("self-hosted");
|
||||
options.setFileAndLine("self-hosted", 1);
|
||||
options.setSelfHostingMode(true);
|
||||
options.setCanLazilyParse(false);
|
||||
options.setForceFullParse();
|
||||
options.werrorOption = true;
|
||||
options.extraWarningsOption = true;
|
||||
options.setForceStrictMode();
|
||||
|
|
|
@ -92,9 +92,11 @@ nsresult AsyncScriptCompiler::Start(
|
|||
mCharset = aOptions.mCharset;
|
||||
|
||||
CompileOptions options(aCx);
|
||||
options.setFile(mURL.get())
|
||||
.setNoScriptRval(!aOptions.mHasReturnValue)
|
||||
.setCanLazilyParse(aOptions.mLazilyParse);
|
||||
options.setFile(mURL.get()).setNoScriptRval(!aOptions.mHasReturnValue);
|
||||
|
||||
if (!aOptions.mLazilyParse) {
|
||||
options.setForceFullParse();
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!mOptions.copy(aCx, options))) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
Загрузка…
Ссылка в новой задаче