Ignore:
Timestamp:
Feb 9, 2016, 10:01:28 PM (10 years ago)
Author:
[email protected]
Message:

calling methods off super in a class constructor should check for TDZ
https://bugs.webkit.org/show_bug.cgi?id=154060

Reviewed by Ryosuke Niwa.

In a class constructor we need to check for TDZ when calling a method
off the super class. This is because, for super method calls, we use
the derived class's newly constructed object as the super method's
this value.

  • bytecompiler/NodesCodegen.cpp:

(JSC::FunctionCallDotNode::emitBytecode):

  • tests/stress/super-method-calls-check-tdz.js: Added.

(Base):
(Derived):
(test):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r196323 r196361  
    919919    CallArguments callArguments(generator, m_args);
    920920    bool baseIsSuper = m_base->isSuperNode();
    921     if (baseIsSuper)
     921    if (baseIsSuper) {
     922        generator.emitTDZCheck(generator.thisRegister());
    922923        generator.emitMove(callArguments.thisRegister(), generator.thisRegister());
    923     else
     924    } else
    924925        generator.emitNode(callArguments.thisRegister(), m_base);
    925926    generator.emitExpressionInfo(subexpressionDivot(), subexpressionStart(), subexpressionEnd());
Note: See TracChangeset for help on using the changeset viewer.