зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1589904
- Remove LazyScript::functionNonDelazifying() r=jandem
Replace with LazyScript::function() for the same reasons as removing JSScript::functionNonDelazifying(). Depends on D50505 Differential Revision: https://phabricator.services.mozilla.com/D50506 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a622f19648
Коммит
cc2ee58041
|
@ -153,7 +153,7 @@ static JSScript* DelazifyScript(JSContext* cx, Handle<LazyScript*> lazyScript) {
|
|||
}
|
||||
MOZ_ASSERT(lazyScript->enclosingScriptHasEverBeenCompiled());
|
||||
|
||||
RootedFunction fun(cx, lazyScript->functionNonDelazifying());
|
||||
RootedFunction fun(cx, lazyScript->function());
|
||||
AutoRealm ar(cx, fun);
|
||||
return JSFunction::getOrCreateScript(cx, fun);
|
||||
}
|
||||
|
@ -334,8 +334,8 @@ bool DebuggerScript::CallData::getDisplayName() {
|
|||
if (!ensureScriptMaybeLazy()) {
|
||||
return false;
|
||||
}
|
||||
JSFunction* func = CallScriptMethod(obj, &JSScript::function,
|
||||
&LazyScript::functionNonDelazifying);
|
||||
JSFunction* func =
|
||||
CallScriptMethod(obj, &JSScript::function, &LazyScript::function);
|
||||
Debugger* dbg = Debugger::fromChildJSObject(obj);
|
||||
|
||||
JSString* name = func ? func->displayAtom() : nullptr;
|
||||
|
|
|
@ -165,7 +165,7 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::parseLazyFunction(
|
|||
tokenizer_->seek(firstOffset);
|
||||
|
||||
// For now, only function declarations and function expression are supported.
|
||||
RootedFunction func(cx_, lazyScript_->functionNonDelazifying());
|
||||
RootedFunction func(cx_, lazyScript_->function());
|
||||
bool isExpr = func->isLambda();
|
||||
MOZ_ASSERT(func->kind() == FunctionFlags::FunctionKind::NormalFunction);
|
||||
|
||||
|
@ -266,7 +266,7 @@ JS::Result<FunctionBox*> BinASTParserPerTokenizer<Tok>::buildFunctionBox(
|
|||
BINJS_TRY_VAR(fun, AllocNewFunction(cx_, fcd));
|
||||
MOZ_ASSERT(fun->explicitName() == atom);
|
||||
} else {
|
||||
BINJS_TRY_VAR(fun, lazyScript_->functionNonDelazifying());
|
||||
BINJS_TRY_VAR(fun, lazyScript_->function());
|
||||
}
|
||||
|
||||
mozilla::Maybe<Directives> directives;
|
||||
|
@ -321,8 +321,7 @@ JS::Result<Ok> BinASTParserPerTokenizer<Tok>::finishEagerFunction(
|
|||
FunctionBox* funbox, uint32_t nargs) {
|
||||
// If this is delazification of a canonical function, the JSFunction object
|
||||
// already has correct `nargs_`.
|
||||
if (!lazyScript_ ||
|
||||
lazyScript_->functionNonDelazifying() != funbox->function()) {
|
||||
if (!lazyScript_ || lazyScript_->function() != funbox->function()) {
|
||||
funbox->setArgCount(nargs);
|
||||
funbox->synchronizeArgCount();
|
||||
} else {
|
||||
|
|
|
@ -932,8 +932,7 @@ class MOZ_STACK_CLASS AutoAssertFunctionDelazificationCompletion {
|
|||
template <typename Unit>
|
||||
static bool CompileLazyFunctionImpl(JSContext* cx, Handle<LazyScript*> lazy,
|
||||
const Unit* units, size_t length) {
|
||||
MOZ_ASSERT(cx->compartment() ==
|
||||
lazy->functionNonDelazifying()->compartment());
|
||||
MOZ_ASSERT(cx->compartment() == lazy->compartment());
|
||||
|
||||
// We can only compile functions whose parents have previously been
|
||||
// compiled, because compilation requires full information about the
|
||||
|
@ -943,7 +942,7 @@ static bool CompileLazyFunctionImpl(JSContext* cx, Handle<LazyScript*> lazy,
|
|||
MOZ_ASSERT(!lazy->isBinAST());
|
||||
|
||||
AutoAssertReportedException assertException(cx);
|
||||
Rooted<JSFunction*> fun(cx, lazy->functionNonDelazifying());
|
||||
Rooted<JSFunction*> fun(cx, lazy->function());
|
||||
AutoAssertFunctionDelazificationCompletion delazificationCompletion(cx, fun);
|
||||
|
||||
JS::CompileOptions options(cx);
|
||||
|
@ -1045,8 +1044,7 @@ bool frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy,
|
|||
bool frontend::CompileLazyBinASTFunction(JSContext* cx,
|
||||
Handle<LazyScript*> lazy,
|
||||
const uint8_t* buf, size_t length) {
|
||||
MOZ_ASSERT(cx->compartment() ==
|
||||
lazy->functionNonDelazifying()->compartment());
|
||||
MOZ_ASSERT(cx->compartment() == lazy->compartment());
|
||||
|
||||
// We can only compile functions whose parents have previously been
|
||||
// compiled, because compilation requires full information about the
|
||||
|
@ -1055,7 +1053,7 @@ bool frontend::CompileLazyBinASTFunction(JSContext* cx,
|
|||
MOZ_ASSERT(lazy->isBinAST());
|
||||
|
||||
AutoAssertReportedException assertException(cx);
|
||||
Rooted<JSFunction*> fun(cx, lazy->functionNonDelazifying());
|
||||
Rooted<JSFunction*> fun(cx, lazy->function());
|
||||
AutoAssertFunctionDelazificationCompletion delazificationCompletion(cx, fun);
|
||||
|
||||
CompileOptions options(cx);
|
||||
|
|
|
@ -90,7 +90,7 @@ static void TraverseInnerLazyScriptsForLazyScript(
|
|||
// LazyScript::CreateForXDR temporarily initializes innerFunctions with
|
||||
// its own function, but it should be overwritten with correct
|
||||
// inner functions before getting inserted into parent's innerFunctions.
|
||||
MOZ_ASSERT(fun != enclosingLazyScript->functionNonDelazifying());
|
||||
MOZ_ASSERT(fun != enclosingLazyScript->function());
|
||||
|
||||
if (!fun->isInterpretedLazy()) {
|
||||
return;
|
||||
|
|
|
@ -1538,7 +1538,7 @@ static bool DelazifyCanonicalScriptedFunction(JSContext* cx,
|
|||
Rooted<LazyScript*> lazy(cx, fun->lazyScript());
|
||||
|
||||
MOZ_ASSERT(!lazy->maybeScript(), "Script is already compiled!");
|
||||
MOZ_ASSERT(lazy->functionNonDelazifying() == fun);
|
||||
MOZ_ASSERT(lazy->function() == fun);
|
||||
|
||||
ScriptSource* ss = lazy->scriptSource();
|
||||
size_t sourceStart = lazy->sourceStart();
|
||||
|
@ -1646,7 +1646,7 @@ bool JSFunction::delazifyLazilyInterpretedFunction(JSContext* cx,
|
|||
|
||||
if (fun->hasLazyScript()) {
|
||||
Rooted<LazyScript*> lazy(cx, fun->lazyScript());
|
||||
RootedFunction canonicalFun(cx, lazy->functionNonDelazifying());
|
||||
RootedFunction canonicalFun(cx, lazy->function());
|
||||
|
||||
// If this function is non-canonical, then use the canonical function first
|
||||
// to get the delazified script. This may result in calling this method
|
||||
|
|
|
@ -702,7 +702,7 @@ class JSFunction : public js::NativeObject {
|
|||
// use lazyScript->script_ here as it may be null in some cases,
|
||||
// see bug 976536.
|
||||
js::LazyScript* lazy = lazyScript();
|
||||
JSFunction* fun = lazy->functionNonDelazifying();
|
||||
JSFunction* fun = lazy->function();
|
||||
MOZ_ASSERT(fun);
|
||||
return fun->nonLazyScript();
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ class JSFunction : public js::NativeObject {
|
|||
return nonLazyScript()->function();
|
||||
}
|
||||
if (hasLazyScript()) {
|
||||
return lazyScript()->functionNonDelazifying();
|
||||
return lazyScript()->function();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1250,7 +1250,7 @@ XDRResult js::XDRLazyScript(XDRState<mode>* xdr, HandleScope enclosingScope,
|
|||
// to a JSScript. We don't encode it: we can just delazify the
|
||||
// lazy script.
|
||||
|
||||
MOZ_ASSERT(fun == lazy->functionNonDelazifying());
|
||||
MOZ_ASSERT(fun == lazy->function());
|
||||
|
||||
sourceStart = lazy->sourceStart();
|
||||
sourceEnd = lazy->sourceEnd();
|
||||
|
@ -3905,7 +3905,7 @@ JSScript* JSScript::Create(JSContext* cx, HandleObject functionOrGlobal,
|
|||
/* static */ JSScript* JSScript::CreateFromLazy(JSContext* cx,
|
||||
Handle<LazyScript*> lazy) {
|
||||
RootedScriptSourceObject sourceObject(cx, lazy->sourceObject());
|
||||
RootedObject fun(cx, lazy->functionNonDelazifying());
|
||||
RootedObject fun(cx, lazy->function());
|
||||
RootedScript script(cx,
|
||||
JSScript::New(cx, fun, sourceObject, lazy->sourceStart(),
|
||||
lazy->sourceEnd(), lazy->toStringStart(),
|
||||
|
|
|
@ -3328,9 +3328,7 @@ class LazyScript : public BaseScript {
|
|||
uint32_t sourceStart, uint32_t sourceEnd, uint32_t toStringStart,
|
||||
uint32_t toStringEnd, uint32_t lineno, uint32_t column);
|
||||
|
||||
JSFunction* functionNonDelazifying() const {
|
||||
return &functionOrGlobal_->as<JSFunction>();
|
||||
}
|
||||
JSFunction* function() const { return &functionOrGlobal_->as<JSFunction>(); }
|
||||
|
||||
bool canRelazify() const {
|
||||
// Only functions without inner functions or direct eval are re-lazified.
|
||||
|
|
Загрузка…
Ссылка в новой задаче