Use canonical function in TypeNewScript::rollbackPartiallyInitializedObjects.

This commit is contained in:
wolfbeast 2018-12-13 11:34:00 +01:00 • committed by Roy Tam
commit 518106945b
3 changed files with 26 additions and 7 deletions

View file

@ -496,12 +496,7 @@ ObjectGroup::defaultNewGroup(ExclusiveContext* cx, const Class* clasp,
// Canonicalize new functions to use the original one associated with its script.
JSFunction* fun = &associated->as<JSFunction>();
if (fun->hasScript())
associated = fun->nonLazyScript()->functionNonDelazifying();
else if (fun->isInterpretedLazy() && !fun->isSelfHostedBuiltin())
associated = fun->lazyScript()->functionNonDelazifying();
else
associated = nullptr;
associated = associated->as<JSFunction>().maybeCanonicalFunction();
// If we have previously cleared the 'new' script information for this
// function, don't try to construct another one.