Ignore:
Timestamp:
Dec 6, 2015, 5:54:43 PM (10 years ago)
Author:
[email protected]
Message:

REGRESSION(r193584): Causes heap use-after-free crashes in Web Inspector tests with AddressSanitizer (Requested by ddkilzer on #webkit).
https://bugs.webkit.org/show_bug.cgi?id=151929

Reverted changeset:

"[ES6] "super" and "this" should be lexically bound inside an
arrow function and should live in a JSLexicalEnvironment"
https://bugs.webkit.org/show_bug.cgi?id=149338
http://trac.webkit.org/changeset/193584

File:
1 edited

Legend:

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

    r193584 r193606  
    147147RegisterID* ThisNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    148148{
    149     if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext())
    150         generator.emitLoadThisFromArrowFunctionLexicalEnvironment();
    151 
    152     if (m_shouldAlwaysEmitTDZCheck || generator.constructorKind() == ConstructorKind::Derived || generator.generatorThisMode() == GeneratorThisMode::Empty || generator.isDerivedConstructorContext())
     149    if (m_shouldAlwaysEmitTDZCheck || generator.constructorKind() == ConstructorKind::Derived || generator.generatorThisMode() == GeneratorThisMode::Empty)
    153150        generator.emitTDZCheck(generator.thisRegister());
    154151
     
    168165    if (dst == generator.ignoredResult())
    169166        return 0;
    170 
    171     if (generator.isDerivedConstructorContext())
    172         return generator.emitGetById(generator.finalDestination(dst), generator.emitLoadDerivedConstructorFromArrowFunctionLexicalEnvironment(), generator.propertyNames().underscoreProto);
    173167
    174168    RegisterID callee;
     
    703697RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    704698{
    705     // We need try to load 'this' before call eval in constructor, because 'this' can created by 'super' in some of the arrow function
    706     // var A = class A {
    707     //   constructor () { this.id = 'A'; }
    708     // }
    709     //
    710     // var B = class B extend A {
    711     //    constructor () {
    712     //       var arrow = () => super();
    713     //       arrow();
    714     //       eval("this.id = 'B'");
    715     //    }
    716     // }
    717     if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext())
    718         generator.emitLoadThisFromArrowFunctionLexicalEnvironment();
    719 
    720699    Variable var = generator.variable(generator.propertyNames().eval);
    721700    if (RegisterID* local = var.local()) {
     
    745724    CallArguments callArguments(generator, m_args);
    746725    if (m_expr->isSuperNode()) {
    747         ASSERT(generator.isConstructor() || generator.isDerivedConstructorContext());
    748         ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator.isDerivedConstructorContext());
     726        ASSERT(generator.isConstructor());
     727        ASSERT(generator.constructorKind() == ConstructorKind::Derived);
    749728        generator.emitMove(callArguments.thisRegister(), generator.newTarget());
    750729        RegisterID* ret = generator.emitConstruct(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
    751730        generator.emitMove(generator.thisRegister(), ret);
    752        
    753         bool isConstructorKindDerived = generator.constructorKind() == ConstructorKind::Derived;
    754         if (generator.isDerivedConstructorContext() || (isConstructorKindDerived && generator.needsToUpdateArrowFunctionContext()))
    755             generator.emitPutThisToArrowFunctionContextScope();
    756        
    757731        return ret;
    758732    }
     
    30793053        // If there is no return we must automatically insert one.
    30803054        if (!returnNode) {
    3081             if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext())
    3082                 generator.emitLoadThisFromArrowFunctionLexicalEnvironment(); // Arrow function can invoke 'super' in constructor and before leave constructor we need load 'this' from lexical arrow function environment
    3083            
    30843055            RegisterID* r0 = generator.isConstructor() ? generator.thisRegister() : generator.emitLoad(0, jsUndefined());
    30853056            generator.emitProfileType(r0, ProfileTypeBytecodeFunctionReturnStatement); // Do not emit expression info for this profile because it's not in the user's source code.
Note: See TracChangeset for help on using the changeset viewer.