Bug 1520129 - Remove redundant isSelfHostedBuiltin checks in GetFunctionThis / JSOP_FUNCTIONTHIS. r=anba

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-01-16 09:14:38 +00:00
Родитель 47a5dd1fb8
Коммит fb6b8ae778
4 изменённых файлов: 9 добавлений и 6 удалений

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

@ -1740,8 +1740,8 @@ bool BaselineCodeGen<Handler>::emit_JSOP_FUNCTIONTHIS() {
frame.pushThis();
// In strict mode code or self-hosted functions, |this| is left alone.
if (script->strict() || (function() && function()->isSelfHostedBuiltin())) {
// In strict mode code, |this| is left alone.
if (script->strict()) {
return true;
}

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

@ -12852,8 +12852,8 @@ AbortReasonOr<Ok> IonBuilder::jsop_functionthis() {
MOZ_ASSERT(info().funMaybeLazy());
MOZ_ASSERT(!info().funMaybeLazy()->isArrow());
if (script()->strict() || info().funMaybeLazy()->isSelfHostedBuiltin()) {
// No need to wrap primitive |this| in strict mode or self-hosted code.
if (script()->strict()) {
// No need to wrap primitive |this| in strict mode.
current->pushSlot(info().thisSlot());
return Ok();
}

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

@ -119,12 +119,14 @@ bool js::GetFunctionThis(JSContext* cx, AbstractFramePtr frame,
MOZ_ASSERT(frame.isFunctionFrame());
MOZ_ASSERT(!frame.callee()->isArrow());
if (frame.thisArgument().isObject() || frame.callee()->strict() ||
frame.callee()->isSelfHostedBuiltin()) {
if (frame.thisArgument().isObject() || frame.callee()->strict()) {
res.set(frame.thisArgument());
return true;
}
MOZ_ASSERT(!frame.callee()->isSelfHostedBuiltin(),
"Self-hosted builtins must be strict");
RootedValue thisv(cx, frame.thisArgument());
// If there is a NSVO on environment chain, use it as basis for fallback

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

@ -3347,6 +3347,7 @@ bool JSRuntime::cloneSelfHostedFunctionScript(JSContext* cx,
MOZ_ASSERT(sourceFun->nargs() == targetFun->nargs());
MOZ_ASSERT(sourceScript->hasRest() == targetFun->nonLazyScript()->hasRest());
MOZ_ASSERT(targetFun->strict(), "Self-hosted builtins must be strict");
// The target function might have been relazified after its flags changed.
targetFun->setFlags(targetFun->flags() | sourceFun->flags());