Ignore:
Timestamp:
Mar 10, 2016, 12:19:42 AM (9 years ago)
Author:
[email protected]
Message:

How we load new.target in arrow functions is broken
https://bugs.webkit.org/show_bug.cgi?id=155153

Reviewed by Saam Barati.

Fixed not correct approach of caching new.target. In current patch was added code feature
flag that shows that current function is using new.target, when generating byte code an arrow
function we are loading new.target value to its register from arrow function lexical environment.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitLoadNewTargetFromArrowFunctionLexicalEnvironment):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::newTarget):

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createNewTargetExpr):
(JSC::ASTBuilder::usesNewTarget):

  • parser/Nodes.h:

(JSC::ScopeNode::usesNewTarget):

  • parser/ParserModes.h:
  • tests/stress/arrowfunction-lexical-bind-newtarget.js:
File:
1 edited

Legend:

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

    r197296 r197928  
    161161const CodeFeatures SuperCallFeature =            1 << 10;
    162162const CodeFeatures SuperPropertyFeature =        1 << 11;
     163const CodeFeatures NewTargetFeature =            1 << 12;
    163164
    164165const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ModifiedParameterFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
    165     SuperCallFeature | SuperPropertyFeature;
     166    SuperCallFeature | SuperPropertyFeature | NewTargetFeature;
    166167
    167168typedef uint8_t InnerArrowFunctionCodeFeatures;
Note: See TracChangeset for help on using the changeset viewer.