Ignore:
Timestamp:
Oct 11, 2020, 11:21:10 AM (5 years ago)
Author:
[email protected]
Message:

[JSC] arguments.callee should become ThrowTypeError if function has non simple parameter list
https://bugs.webkit.org/show_bug.cgi?id=217574

Reviewed by Darin Adler.

JSTests:

  • stress/arguments-and-non-simple-parameters.js: Added.

(shouldBe):
(ThrowTypeError.Object.getOwnPropertyDescriptor):
(testUnmappedArguments):
(testMappedArguments):
(argumentGenerator2.inner):
(argumentGenerator2):
(argumentGenerator3.inner):
(argumentGenerator3):
(argumentGenerator4):
(argumentGenerator5.inner.inner2):
(argumentGenerator5.inner):
(argumentGenerator5):
(argumentGenerator6):
(argumentGenerator7.inner):
(argumentGenerator7):
(argumentGenerator8.inner):
(argumentGenerator8):
(argumentGenerator9.inner):
(argumentGenerator9):
(argumentGenerator10.inner.inner2):
(argumentGenerator10.inner):
(argumentGenerator10):

  • test262/expectations.yaml:

Source/JavaScriptCore:

We should set ThrowTypeError in ClonedArguments when the callee is strict mode or callee has non simple parameter list[1].
We propagate NonSimpleParameterList information from parser and use it when materializing "callee" property of ClonedArguments.

[1]: https://tc39.es/ecma262/#sec-functiondeclarationinstantiation

  • parser/Nodes.h:

(JSC::ScopeNode::isStrictMode const):
(JSC::ScopeNode::usesNonSimpleParameterList const):
(JSC::ScopeNode::setFeatures): Deleted.
(JSC::ScopeNode::setUsesArguments): Deleted.

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseInner):

  • parser/ParserModes.h:
  • runtime/ClonedArguments.cpp:

(JSC::ClonedArguments::getOwnPropertySlot):
(JSC::ClonedArguments::materializeSpecials):

  • runtime/ScriptExecutable.h:

(JSC::ScriptExecutable::usesNonSimpleParameterList const):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r266264 r268323  
    18711871        int startLineStartOffset() const { return m_startLineStartOffset; }
    18721872
    1873         void setFeatures(CodeFeatures features) { m_features = features; }
    18741873        CodeFeatures features() { return m_features; }
    18751874        InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures() { return m_innerArrowFunctionCodeFeatures; }
     
    18861885        bool usesArrowFunction() const { return m_features & ArrowFunctionFeature; }
    18871886        bool isStrictMode() const { return m_features & StrictModeFeature; }
    1888         void setUsesArguments() { m_features |= ArgumentsFeature; }
    18891887        bool usesThis() const { return m_features & ThisFeature; }
    18901888        bool usesSuperCall() const { return m_features & SuperCallFeature; }
     
    18961894        bool captures(const Identifier& ident) { return captures(ident.impl()); }
    18971895        bool hasSloppyModeHoistedFunction(UniquedStringImpl* uid) const { return m_sloppyModeHoistedFunctions.contains(uid); }
     1896        bool usesNonSimpleParameterList() const { return m_features & NonSimpleParameterListFeature; }
    18981897
    18991898        bool needsNewTargetRegisterForThisScope() const
Note: See TracChangeset for help on using the changeset viewer.