Ignore:
Timestamp:
Dec 29, 2015, 3:49:35 AM (10 years ago)
Author:
Yusuke Suzuki
Message:

[ES6][ES7] Drop Constructability of generator function
https://bugs.webkit.org/show_bug.cgi?id=152383

Reviewed by Saam Barati.

We drop the constructability of generator functions.
This functionality is already landed in ES 2016 draft[1].
And this simplifies the existing JSC's generator implementation;
dropping GeneratorThisMode flag.

[1]: https://github.com/tc39/ecma262/releases/tag/es2016-draft-20151201

(JSC::createExecutableInternal):

  • bytecode/ExecutableInfo.h:

(JSC::ExecutableInfo::ExecutableInfo):
(JSC::ExecutableInfo::generatorThisMode): Deleted.

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted.

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::generatorThisMode): Deleted.

  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::generateUnlinkedFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):

  • bytecode/UnlinkedFunctionExecutable.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator): Deleted.

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::makeFunction):
(JSC::BytecodeGenerator::generatorThisMode): Deleted.

  • bytecompiler/NodesCodegen.cpp:

(JSC::ThisNode::emitBytecode):

  • interpreter/Interpreter.cpp:

(JSC::eval): Deleted.

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/Executable.h:
  • runtime/GeneratorThisMode.h: Removed.
  • tests/stress/generator-eval-this.js:

(shouldThrow):

  • tests/stress/generator-is-not-constructible.js: Added.

(shouldThrow):
(A.staticGen):
(A.prototype.gen):
(A):
(TypeError):

  • tests/stress/generator-this.js:

(shouldBe.g.next):

  • tests/stress/generator-with-new-target.js:

(shouldThrow):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h

    r193766 r194435  
    2727#define ExecutableInfo_h
    2828
    29 #include "GeneratorThisMode.h"
    3029#include "ParserModes.h"
    3130
     
    3534// https://bugs.webkit.org/show_bug.cgi?id=151547
    3635struct ExecutableInfo {
    37     ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, GeneratorThisMode generatorThisMode, SuperBinding superBinding, SourceParseMode parseMode, bool isDerivedConstructorContext, bool isArrowFunctionContext)
     36    ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, bool isDerivedConstructorContext, bool isArrowFunctionContext)
    3837        : m_needsActivation(needsActivation)
    3938        , m_usesEval(usesEval)
     
    4140        , m_isConstructor(isConstructor)
    4241        , m_isBuiltinFunction(isBuiltinFunction)
    43         , m_generatorThisMode(static_cast<unsigned>(generatorThisMode))
    4442        , m_constructorKind(static_cast<unsigned>(constructorKind))
    4543        , m_superBinding(static_cast<unsigned>(superBinding))
     
    5048        ASSERT(m_constructorKind == static_cast<unsigned>(constructorKind));
    5149        ASSERT(m_superBinding == static_cast<unsigned>(superBinding));
    52         ASSERT(m_generatorThisMode == static_cast<unsigned>(generatorThisMode));
    5350    }
    5451
     
    5855    bool isConstructor() const { return m_isConstructor; }
    5956    bool isBuiltinFunction() const { return m_isBuiltinFunction; }
    60     GeneratorThisMode generatorThisMode() const { return static_cast<GeneratorThisMode>(m_generatorThisMode); }
    6157    ConstructorKind constructorKind() const { return static_cast<ConstructorKind>(m_constructorKind); }
    6258    SuperBinding superBinding() const { return static_cast<SuperBinding>(m_superBinding); }
     
    7167    unsigned m_isConstructor : 1;
    7268    unsigned m_isBuiltinFunction : 1;
    73     unsigned m_generatorThisMode : 1;
    7469    unsigned m_constructorKind : 2;
    7570    unsigned m_superBinding : 1;
Note: See TracChangeset for help on using the changeset viewer.