Changeset 201542 in webkit


Ignore:
Timestamp:
May 31, 2016, 9:30:57 PM (9 years ago)
Author:
Yusuke Suzuki
Message:

Unreviewed, roll out r201481, r201523: 0.3% regression in Octane code-load
https://bugs.webkit.org/show_bug.cgi?id=158249

Source/JavaScriptCore:

  • API/JSScriptRef.cpp:

(parseScript):

  • CMakeLists.txt:
  • DerivedSources.make:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • builtins/AsyncFunctionPrototype.js: Removed.

(asyncFunctionResume): Deleted.

  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::createExecutable):

  • bytecode/BytecodeList.json:
  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeOffset): Deleted.
(JSC::computeDefsForBytecodeOffset): Deleted.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::dumpBytecode): Deleted.

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::isArrowFunction):
(JSC::UnlinkedCodeBlock::isOrdinaryArrowFunction): Deleted.
(JSC::UnlinkedCodeBlock::isAsyncArrowFunction): Deleted.

  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::generateUnlinkedFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::fromGlobalCode):
(JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):

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

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
(JSC::BytecodeGenerator::emitNewMethodDefinition):
(JSC::BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment):
(JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): Deleted.
(JSC::BytecodeGenerator::emitNewFunction): Deleted.

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::makeFunction):

  • bytecompiler/NodesCodegen.cpp:

(JSC::FunctionNode::emitBytecode): Deleted.

  • inspector/agents/InspectorRuntimeAgent.cpp:

(Inspector::InspectorRuntimeAgent::parse):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass): Deleted.

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emitNewFuncCommon): Deleted.
(JSC::JIT::emit_op_new_async_func): Deleted.
(JSC::JIT::emitNewFuncExprCommon): Deleted.
(JSC::JIT::emit_op_new_async_func_exp): Deleted.

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • jsc.cpp:

(runInteractive):
(printUsageStatement): Deleted.

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL): Deleted.

  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter.asm:
  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createAsyncFunctionBody): Deleted.

  • parser/Keywords.table:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::Parser):
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::isArrowFunctionParameters):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseImportClauseItem):
(JSC::Parser<LexerType>::parseImportDeclaration):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
(JSC::Parser<LexerType>::printUnexpectedTokenText):
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements): Deleted.
(JSC::Parser<LexerType>::parseVariableDeclarationList): Deleted.
(JSC::Parser<LexerType>::parseDestructuringPattern): Deleted.
(JSC::Parser<LexerType>::parseFunctionDeclarationStatement): Deleted.
(JSC::Parser<LexerType>::parseFormalParameters): Deleted.
(JSC::stringForFunctionMode): Deleted.
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration): Deleted.
(JSC::Parser<LexerType>::parseExpressionOrLabelStatement): Deleted.
(JSC::Parser<LexerType>::parseAwaitExpression): Deleted.
(JSC::Parser<LexerType>::parseAsyncFunctionExpression): Deleted.
(JSC::Parser<LexerType>::parseUnaryExpression): Deleted.

  • parser/Parser.h:

(JSC::Scope::Scope):
(JSC::Parser::ExpressionErrorClassifier::propagateExpressionErrorClass):
(JSC::Parser::closestParentOrdinaryFunctionNonLexicalScope):
(JSC::Parser::pushScope):
(JSC::Parser::popScopeInternal):
(JSC::Parser::matchSpecIdentifier):
(JSC::parse):
(JSC::Scope::setSourceParseMode): Deleted.
(JSC::Scope::isAsyncFunction): Deleted.
(JSC::Scope::isAsyncFunctionBoundary): Deleted.
(JSC::Scope::isModule): Deleted.
(JSC::Scope::setIsFunction): Deleted.
(JSC::Scope::setIsAsyncArrowFunction): Deleted.
(JSC::Scope::setIsAsyncFunction): Deleted.
(JSC::Scope::setIsAsyncFunctionBody): Deleted.
(JSC::Scope::setIsAsyncArrowFunctionBody): Deleted.
(JSC::Parser::ExpressionErrorClassifier::forceClassifyExpressionError): Deleted.
(JSC::Parser::ExpressionErrorClassifier::indicatesPossibleAsyncArrowFunction): Deleted.
(JSC::Parser::forceClassifyExpressionError): Deleted.
(JSC::Parser::declarationTypeToVariableKind): Deleted.
(JSC::Parser::upperScope): Deleted.
(JSC::Parser::isDisallowedIdentifierAwait): Deleted.
(JSC::Parser::disallowedIdentifierAwaitReason): Deleted.

  • parser/ParserModes.h:

(JSC::isFunctionParseMode):
(JSC::isModuleParseMode):
(JSC::isProgramParseMode):
(JSC::SourceParseModeSet::SourceParseModeSet): Deleted.
(JSC::SourceParseModeSet::contains): Deleted.
(JSC::SourceParseModeSet::mergeSourceParseModes): Deleted.
(JSC::isAsyncFunctionParseMode): Deleted.
(JSC::isAsyncArrowFunctionParseMode): Deleted.
(JSC::isAsyncFunctionWrapperParseMode): Deleted.
(JSC::isAsyncFunctionBodyParseMode): Deleted.
(JSC::constructAbilityForParseMode): Deleted.

  • parser/ParserTokens.h:
  • parser/SourceCodeKey.h:

(JSC::SourceCodeKey::SourceCodeKey):
(JSC::SourceCodeKey::operator==):
(JSC::SourceCodeKey::runtimeFlags): Deleted.

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createAsyncFunctionBody): Deleted.

  • runtime/AsyncFunctionConstructor.cpp: Removed.

(JSC::AsyncFunctionConstructor::AsyncFunctionConstructor): Deleted.
(JSC::AsyncFunctionConstructor::finishCreation): Deleted.
(JSC::callAsyncFunctionConstructor): Deleted.
(JSC::constructAsyncFunctionConstructor): Deleted.
(JSC::AsyncFunctionConstructor::getCallData): Deleted.
(JSC::AsyncFunctionConstructor::getConstructData): Deleted.

  • runtime/AsyncFunctionConstructor.h: Removed.

(JSC::AsyncFunctionConstructor::create): Deleted.
(JSC::AsyncFunctionConstructor::createStructure): Deleted.

  • runtime/AsyncFunctionPrototype.cpp: Removed.

(JSC::AsyncFunctionPrototype::AsyncFunctionPrototype): Deleted.
(JSC::AsyncFunctionPrototype::finishCreation): Deleted.

  • runtime/AsyncFunctionPrototype.h: Removed.

(JSC::AsyncFunctionPrototype::create): Deleted.
(JSC::AsyncFunctionPrototype::createStructure): Deleted.

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getProgramCodeBlock):
(JSC::CodeCache::getEvalCodeBlock):
(JSC::CodeCache::getModuleProgramCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/CodeCache.h:
  • runtime/CommonIdentifiers.h:
  • runtime/Completion.cpp:

(JSC::checkSyntax):
(JSC::checkModuleSyntax):

  • runtime/Completion.h:
  • runtime/Executable.cpp:

(JSC::ScriptExecutable::newCodeBlockFor):
(JSC::ProgramExecutable::checkSyntax):

  • runtime/Executable.h:
  • runtime/FunctionConstructor.cpp:

(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/FunctionConstructor.h:
  • runtime/JSAsyncFunction.cpp: Removed.

(JSC::JSAsyncFunction::JSAsyncFunction): Deleted.
(JSC::JSAsyncFunction::createImpl): Deleted.
(JSC::JSAsyncFunction::create): Deleted.
(JSC::JSAsyncFunction::createWithInvalidatedReallocationWatchpoint): Deleted.

  • runtime/JSAsyncFunction.h: Removed.

(JSC::JSAsyncFunction::allocationSize): Deleted.
(JSC::JSAsyncFunction::createStructure): Deleted.

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getOwnPropertySlot):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::createProgramCodeBlock):
(JSC::JSGlobalObject::createEvalCodeBlock):
(JSC::JSGlobalObject::createModuleProgramCodeBlock):
(JSC::JSGlobalObject::init): Deleted.

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::asyncFunctionPrototype): Deleted.
(JSC::JSGlobalObject::asyncFunctionStructure): Deleted.

  • runtime/ModuleLoaderObject.cpp:

(JSC::moduleLoaderObjectParseModule):

  • runtime/RuntimeFlags.h:

(JSC::RuntimeFlags::operator==): Deleted.
(JSC::RuntimeFlags::operator!=): Deleted.

  • tests/stress/async-await-basic.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(shouldThrow): Deleted.
(shouldThrowAsync): Deleted.
(shouldThrowSyntaxError): Deleted.
(let.AsyncFunction.async): Deleted.
(async.asyncFunctionForProto): Deleted.
(Object.getPrototypeOf.async): Deleted.
(Object.getPrototypeOf.async.method): Deleted.
(async): Deleted.
(async.method): Deleted.
(async.asyncNonConstructorDecl): Deleted.
(shouldThrow.new.async): Deleted.
(shouldThrow.new.async.nonConstructor): Deleted.
(async.asyncDecl): Deleted.
(async.f): Deleted.
(MyError): Deleted.
(async.asyncDeclThrower): Deleted.
(shouldThrowAsync.async): Deleted.
(resolveLater): Deleted.
(rejectLater): Deleted.
(async.resumeAfterNormal): Deleted.
(O.async.resumeAfterNormal): Deleted.
(resumeAfterNormalArrow.async): Deleted.
(async.resumeAfterThrow): Deleted.
(O.async.resumeAfterThrow): Deleted.
(resumeAfterThrowArrow.async): Deleted.
(catch): Deleted.

  • tests/stress/async-await-module-reserved-word.js: Removed.

(shouldThrow): Deleted.
(SyntaxError.Canstring_appeared_hereawait.checkModuleSyntaxError.String.raw.await): Deleted.
(checkModuleSyntaxError.String.raw.await): Deleted.
(checkModuleSyntaxError.String.raw.async.await): Deleted.
(SyntaxError.Cannot.declare.named): Deleted.

  • tests/stress/async-await-mozilla.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(shouldThrow): Deleted.
(shouldThrowAsync): Deleted.
(assert): Deleted.
(shouldThrowSyntaxError): Deleted.
(mozSemantics.async.empty): Deleted.
(mozSemantics.async.simpleReturn): Deleted.
(mozSemantics.async.simpleAwait): Deleted.
(mozSemantics.async.simpleAwaitAsync): Deleted.
(mozSemantics.async.returnOtherAsync): Deleted.
(mozSemantics.async.simpleThrower): Deleted.
(mozSemantics.async.delegatedThrower): Deleted.
(mozSemantics.async.tryCatch): Deleted.
(mozSemantics.async.tryCatchThrow): Deleted.
(mozSemantics.async.wellFinally): Deleted.
(mozSemantics.async.finallyMayFail): Deleted.
(mozSemantics.async.embedded.async.inner): Deleted.
(mozSemantics.async.embedded): Deleted.
(mozSemantics.async.fib): Deleted.
(mozSemantics.async.isOdd.async.isEven): Deleted.
(mozSemantics.async.isOdd): Deleted.
(mozSemantics.hardcoreFib.async.fib2): Deleted.
(mozSemantics.namedAsyncExpr.async.simple): Deleted.
(mozSemantics.async.executionOrder.async.first): Deleted.
(mozSemantics.async.executionOrder.async.second): Deleted.
(mozSemantics.async.executionOrder.async.third): Deleted.
(mozSemantics.async.executionOrder): Deleted.
(mozSemantics.async.miscellaneous): Deleted.
(mozSemantics.thrower): Deleted.
(mozSemantics.async.defaultArgs): Deleted.
(mozSemantics.shouldThrow): Deleted.
(mozSemantics): Deleted.
(mozMethods.X): Deleted.
(mozMethods.X.prototype.async.getValue): Deleted.
(mozMethods.X.prototype.setValue): Deleted.
(mozMethods.X.prototype.async.increment): Deleted.
(mozMethods.X.prototype.async.getBaseClassName): Deleted.
(mozMethods.X.async.getStaticValue): Deleted.
(mozMethods.Y.prototype.async.getBaseClassName): Deleted.
(mozMethods.Y): Deleted.
(mozFunctionNameInferrence.async.test): Deleted.
(mozSyntaxErrors): Deleted.

  • tests/stress/async-await-reserved-word.js: Removed.

(assert): Deleted.
(shouldThrowSyntaxError): Deleted.
(AsyncFunction.async): Deleted.

  • tests/stress/async_arrow_functions_lexical_arguments_binding.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(shouldThrowAsync): Deleted.
(noArgumentsArrow2.async): Deleted.

  • tests/stress/async_arrow_functions_lexical_new.target_binding.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(shouldThrowAsync): Deleted.
(C1): Deleted.
(C2): Deleted.
(shouldThrowAsync.async): Deleted.

  • tests/stress/async_arrow_functions_lexical_super_binding.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(BaseClass.prototype.baseClassValue): Deleted.
(BaseClass.prototype.get property): Deleted.
(BaseClass): Deleted.
(ChildClass.prototype.asyncSuperProp): Deleted.
(ChildClass.prototype.asyncSuperProp2): Deleted.
(ChildClass): Deleted.
(ChildClass2): Deleted.

  • tests/stress/async_arrow_functions_lexical_this_binding.js: Removed.

(shouldBe): Deleted.
(shouldBeAsync): Deleted.
(d.y): Deleted.

Source/WebKit/mac:

  • WebView/WebPreferencesPrivate.h:

Source/WebKit/win:

  • Interfaces/IWebPreferencesPrivate.idl:

Source/WebKit2:

  • UIProcess/API/C/WKPreferencesRefPrivate.h:
  • UIProcess/API/Cocoa/WKPreferencesPrivate.h:
Location:
trunk/Source
Files:
15 deleted
54 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSScriptRef.cpp

    r201481 r201542  
    7676{
    7777    return !!JSC::parse<JSC::ProgramNode>(
    78         vm, RuntimeFlags(), source, Identifier(), JSParserBuiltinMode::NotBuiltin,
     78        vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    7979        JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
    8080        error);
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r201532 r201542  
    609609    runtime/ArrayIteratorPrototype.cpp
    610610    runtime/ArrayPrototype.cpp
    611     runtime/AsyncFunctionConstructor.cpp
    612     runtime/AsyncFunctionPrototype.cpp
    613611    runtime/BasicBlockLocation.cpp
    614612    runtime/BooleanConstructor.cpp
     
    685683    runtime/JSArrayBufferView.cpp
    686684    runtime/JSArrayIterator.cpp
    687     runtime/JSAsyncFunction.cpp
    688685    runtime/JSBoundFunction.cpp
    689686    runtime/JSBoundSlotBaseFunction.cpp
     
    12141211    ${JAVASCRIPTCORE_DIR}/builtins/ArrayIteratorPrototype.js
    12151212    ${JAVASCRIPTCORE_DIR}/builtins/ArrayPrototype.js
    1216     ${JAVASCRIPTCORE_DIR}/builtins/AsyncFunctionPrototype.js
    12171213    ${JAVASCRIPTCORE_DIR}/builtins/DatePrototype.js
    12181214    ${JAVASCRIPTCORE_DIR}/builtins/FunctionPrototype.js
  • trunk/Source/JavaScriptCore/ChangeLog

    r201532 r201542  
     12016-05-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Unreviewed, roll out r201481, r201523: 0.3% regression in Octane code-load
     4        https://bugs.webkit.org/show_bug.cgi?id=158249
     5
     6        * API/JSScriptRef.cpp:
     7        (parseScript):
     8        * CMakeLists.txt:
     9        * DerivedSources.make:
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11        * builtins/AsyncFunctionPrototype.js: Removed.
     12        (asyncFunctionResume): Deleted.
     13        * builtins/BuiltinExecutables.cpp:
     14        (JSC::BuiltinExecutables::createExecutable):
     15        * bytecode/BytecodeList.json:
     16        * bytecode/BytecodeUseDef.h:
     17        (JSC::computeUsesForBytecodeOffset): Deleted.
     18        (JSC::computeDefsForBytecodeOffset): Deleted.
     19        * bytecode/CodeBlock.cpp:
     20        (JSC::CodeBlock::finishCreation):
     21        (JSC::CodeBlock::dumpBytecode): Deleted.
     22        * bytecode/UnlinkedCodeBlock.h:
     23        (JSC::UnlinkedCodeBlock::isArrowFunction):
     24        (JSC::UnlinkedCodeBlock::isOrdinaryArrowFunction): Deleted.
     25        (JSC::UnlinkedCodeBlock::isAsyncArrowFunction): Deleted.
     26        * bytecode/UnlinkedFunctionExecutable.cpp:
     27        (JSC::generateUnlinkedFunctionCodeBlock):
     28        (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
     29        (JSC::UnlinkedFunctionExecutable::fromGlobalCode):
     30        (JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):
     31        * bytecode/UnlinkedFunctionExecutable.h:
     32        * bytecompiler/BytecodeGenerator.cpp:
     33        (JSC::BytecodeGenerator::BytecodeGenerator):
     34        (JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
     35        (JSC::BytecodeGenerator::emitNewMethodDefinition):
     36        (JSC::BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment):
     37        (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): Deleted.
     38        (JSC::BytecodeGenerator::emitNewFunction): Deleted.
     39        * bytecompiler/BytecodeGenerator.h:
     40        (JSC::BytecodeGenerator::makeFunction):
     41        * bytecompiler/NodesCodegen.cpp:
     42        (JSC::FunctionNode::emitBytecode): Deleted.
     43        * inspector/agents/InspectorRuntimeAgent.cpp:
     44        (Inspector::InspectorRuntimeAgent::parse):
     45        * jit/JIT.cpp:
     46        (JSC::JIT::privateCompileMainPass): Deleted.
     47        * jit/JIT.h:
     48        * jit/JITOpcodes.cpp:
     49        (JSC::JIT::emitNewFuncCommon): Deleted.
     50        (JSC::JIT::emit_op_new_async_func): Deleted.
     51        (JSC::JIT::emitNewFuncExprCommon): Deleted.
     52        (JSC::JIT::emit_op_new_async_func_exp): Deleted.
     53        * jit/JITOperations.cpp:
     54        * jit/JITOperations.h:
     55        * jsc.cpp:
     56        (runInteractive):
     57        (printUsageStatement): Deleted.
     58        * llint/LLIntSlowPaths.cpp:
     59        (JSC::LLInt::LLINT_SLOW_PATH_DECL): Deleted.
     60        * llint/LLIntSlowPaths.h:
     61        * llint/LowLevelInterpreter.asm:
     62        * parser/ASTBuilder.h:
     63        (JSC::ASTBuilder::createAsyncFunctionBody): Deleted.
     64        * parser/Keywords.table:
     65        * parser/Parser.cpp:
     66        (JSC::Parser<LexerType>::Parser):
     67        (JSC::Parser<LexerType>::parseInner):
     68        (JSC::Parser<LexerType>::isArrowFunctionParameters):
     69        (JSC::Parser<LexerType>::parseStatementListItem):
     70        (JSC::Parser<LexerType>::parseStatement):
     71        (JSC::Parser<LexerType>::parseFunctionParameters):
     72        (JSC::Parser<LexerType>::parseFunctionInfo):
     73        (JSC::Parser<LexerType>::parseClass):
     74        (JSC::Parser<LexerType>::parseImportClauseItem):
     75        (JSC::Parser<LexerType>::parseImportDeclaration):
     76        (JSC::Parser<LexerType>::parseExportDeclaration):
     77        (JSC::Parser<LexerType>::parseAssignmentExpression):
     78        (JSC::Parser<LexerType>::parseProperty):
     79        (JSC::Parser<LexerType>::parsePropertyMethod):
     80        (JSC::Parser<LexerType>::parsePrimaryExpression):
     81        (JSC::Parser<LexerType>::parseMemberExpression):
     82        (JSC::Parser<LexerType>::parseArrowFunctionExpression):
     83        (JSC::Parser<LexerType>::printUnexpectedTokenText):
     84        (JSC::Parser<LexerType>::parseAsyncFunctionSourceElements): Deleted.
     85        (JSC::Parser<LexerType>::parseVariableDeclarationList): Deleted.
     86        (JSC::Parser<LexerType>::parseDestructuringPattern): Deleted.
     87        (JSC::Parser<LexerType>::parseFunctionDeclarationStatement): Deleted.
     88        (JSC::Parser<LexerType>::parseFormalParameters): Deleted.
     89        (JSC::stringForFunctionMode): Deleted.
     90        (JSC::Parser<LexerType>::parseAsyncFunctionDeclaration): Deleted.
     91        (JSC::Parser<LexerType>::parseExpressionOrLabelStatement): Deleted.
     92        (JSC::Parser<LexerType>::parseAwaitExpression): Deleted.
     93        (JSC::Parser<LexerType>::parseAsyncFunctionExpression): Deleted.
     94        (JSC::Parser<LexerType>::parseUnaryExpression): Deleted.
     95        * parser/Parser.h:
     96        (JSC::Scope::Scope):
     97        (JSC::Parser::ExpressionErrorClassifier::propagateExpressionErrorClass):
     98        (JSC::Parser::closestParentOrdinaryFunctionNonLexicalScope):
     99        (JSC::Parser::pushScope):
     100        (JSC::Parser::popScopeInternal):
     101        (JSC::Parser::matchSpecIdentifier):
     102        (JSC::parse):
     103        (JSC::Scope::setSourceParseMode): Deleted.
     104        (JSC::Scope::isAsyncFunction): Deleted.
     105        (JSC::Scope::isAsyncFunctionBoundary): Deleted.
     106        (JSC::Scope::isModule): Deleted.
     107        (JSC::Scope::setIsFunction): Deleted.
     108        (JSC::Scope::setIsAsyncArrowFunction): Deleted.
     109        (JSC::Scope::setIsAsyncFunction): Deleted.
     110        (JSC::Scope::setIsAsyncFunctionBody): Deleted.
     111        (JSC::Scope::setIsAsyncArrowFunctionBody): Deleted.
     112        (JSC::Parser::ExpressionErrorClassifier::forceClassifyExpressionError): Deleted.
     113        (JSC::Parser::ExpressionErrorClassifier::indicatesPossibleAsyncArrowFunction): Deleted.
     114        (JSC::Parser::forceClassifyExpressionError): Deleted.
     115        (JSC::Parser::declarationTypeToVariableKind): Deleted.
     116        (JSC::Parser::upperScope): Deleted.
     117        (JSC::Parser::isDisallowedIdentifierAwait): Deleted.
     118        (JSC::Parser::disallowedIdentifierAwaitReason): Deleted.
     119        * parser/ParserModes.h:
     120        (JSC::isFunctionParseMode):
     121        (JSC::isModuleParseMode):
     122        (JSC::isProgramParseMode):
     123        (JSC::SourceParseModeSet::SourceParseModeSet): Deleted.
     124        (JSC::SourceParseModeSet::contains): Deleted.
     125        (JSC::SourceParseModeSet::mergeSourceParseModes): Deleted.
     126        (JSC::isAsyncFunctionParseMode): Deleted.
     127        (JSC::isAsyncArrowFunctionParseMode): Deleted.
     128        (JSC::isAsyncFunctionWrapperParseMode): Deleted.
     129        (JSC::isAsyncFunctionBodyParseMode): Deleted.
     130        (JSC::constructAbilityForParseMode): Deleted.
     131        * parser/ParserTokens.h:
     132        * parser/SourceCodeKey.h:
     133        (JSC::SourceCodeKey::SourceCodeKey):
     134        (JSC::SourceCodeKey::operator==):
     135        (JSC::SourceCodeKey::runtimeFlags): Deleted.
     136        * parser/SyntaxChecker.h:
     137        (JSC::SyntaxChecker::createAsyncFunctionBody): Deleted.
     138        * runtime/AsyncFunctionConstructor.cpp: Removed.
     139        (JSC::AsyncFunctionConstructor::AsyncFunctionConstructor): Deleted.
     140        (JSC::AsyncFunctionConstructor::finishCreation): Deleted.
     141        (JSC::callAsyncFunctionConstructor): Deleted.
     142        (JSC::constructAsyncFunctionConstructor): Deleted.
     143        (JSC::AsyncFunctionConstructor::getCallData): Deleted.
     144        (JSC::AsyncFunctionConstructor::getConstructData): Deleted.
     145        * runtime/AsyncFunctionConstructor.h: Removed.
     146        (JSC::AsyncFunctionConstructor::create): Deleted.
     147        (JSC::AsyncFunctionConstructor::createStructure): Deleted.
     148        * runtime/AsyncFunctionPrototype.cpp: Removed.
     149        (JSC::AsyncFunctionPrototype::AsyncFunctionPrototype): Deleted.
     150        (JSC::AsyncFunctionPrototype::finishCreation): Deleted.
     151        * runtime/AsyncFunctionPrototype.h: Removed.
     152        (JSC::AsyncFunctionPrototype::create): Deleted.
     153        (JSC::AsyncFunctionPrototype::createStructure): Deleted.
     154        * runtime/CodeCache.cpp:
     155        (JSC::CodeCache::getGlobalCodeBlock):
     156        (JSC::CodeCache::getProgramCodeBlock):
     157        (JSC::CodeCache::getEvalCodeBlock):
     158        (JSC::CodeCache::getModuleProgramCodeBlock):
     159        (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
     160        * runtime/CodeCache.h:
     161        * runtime/CommonIdentifiers.h:
     162        * runtime/Completion.cpp:
     163        (JSC::checkSyntax):
     164        (JSC::checkModuleSyntax):
     165        * runtime/Completion.h:
     166        * runtime/Executable.cpp:
     167        (JSC::ScriptExecutable::newCodeBlockFor):
     168        (JSC::ProgramExecutable::checkSyntax):
     169        * runtime/Executable.h:
     170        * runtime/FunctionConstructor.cpp:
     171        (JSC::constructFunctionSkippingEvalEnabledCheck):
     172        * runtime/FunctionConstructor.h:
     173        * runtime/JSAsyncFunction.cpp: Removed.
     174        (JSC::JSAsyncFunction::JSAsyncFunction): Deleted.
     175        (JSC::JSAsyncFunction::createImpl): Deleted.
     176        (JSC::JSAsyncFunction::create): Deleted.
     177        (JSC::JSAsyncFunction::createWithInvalidatedReallocationWatchpoint): Deleted.
     178        * runtime/JSAsyncFunction.h: Removed.
     179        (JSC::JSAsyncFunction::allocationSize): Deleted.
     180        (JSC::JSAsyncFunction::createStructure): Deleted.
     181        * runtime/JSFunction.cpp:
     182        (JSC::JSFunction::getOwnPropertySlot):
     183        * runtime/JSGlobalObject.cpp:
     184        (JSC::JSGlobalObject::createProgramCodeBlock):
     185        (JSC::JSGlobalObject::createEvalCodeBlock):
     186        (JSC::JSGlobalObject::createModuleProgramCodeBlock):
     187        (JSC::JSGlobalObject::init): Deleted.
     188        * runtime/JSGlobalObject.h:
     189        (JSC::JSGlobalObject::asyncFunctionPrototype): Deleted.
     190        (JSC::JSGlobalObject::asyncFunctionStructure): Deleted.
     191        * runtime/ModuleLoaderObject.cpp:
     192        (JSC::moduleLoaderObjectParseModule):
     193        * runtime/RuntimeFlags.h:
     194        (JSC::RuntimeFlags::operator==): Deleted.
     195        (JSC::RuntimeFlags::operator!=): Deleted.
     196        * tests/stress/async-await-basic.js: Removed.
     197        (shouldBe): Deleted.
     198        (shouldBeAsync): Deleted.
     199        (shouldThrow): Deleted.
     200        (shouldThrowAsync): Deleted.
     201        (shouldThrowSyntaxError): Deleted.
     202        (let.AsyncFunction.async): Deleted.
     203        (async.asyncFunctionForProto): Deleted.
     204        (Object.getPrototypeOf.async): Deleted.
     205        (Object.getPrototypeOf.async.method): Deleted.
     206        (async): Deleted.
     207        (async.method): Deleted.
     208        (async.asyncNonConstructorDecl): Deleted.
     209        (shouldThrow.new.async): Deleted.
     210        (shouldThrow.new.async.nonConstructor): Deleted.
     211        (async.asyncDecl): Deleted.
     212        (async.f): Deleted.
     213        (MyError): Deleted.
     214        (async.asyncDeclThrower): Deleted.
     215        (shouldThrowAsync.async): Deleted.
     216        (resolveLater): Deleted.
     217        (rejectLater): Deleted.
     218        (async.resumeAfterNormal): Deleted.
     219        (O.async.resumeAfterNormal): Deleted.
     220        (resumeAfterNormalArrow.async): Deleted.
     221        (async.resumeAfterThrow): Deleted.
     222        (O.async.resumeAfterThrow): Deleted.
     223        (resumeAfterThrowArrow.async): Deleted.
     224        (catch): Deleted.
     225        * tests/stress/async-await-module-reserved-word.js: Removed.
     226        (shouldThrow): Deleted.
     227        (SyntaxError.Canstring_appeared_hereawait.checkModuleSyntaxError.String.raw.await): Deleted.
     228        (checkModuleSyntaxError.String.raw.await): Deleted.
     229        (checkModuleSyntaxError.String.raw.async.await): Deleted.
     230        (SyntaxError.Cannot.declare.named): Deleted.
     231        * tests/stress/async-await-mozilla.js: Removed.
     232        (shouldBe): Deleted.
     233        (shouldBeAsync): Deleted.
     234        (shouldThrow): Deleted.
     235        (shouldThrowAsync): Deleted.
     236        (assert): Deleted.
     237        (shouldThrowSyntaxError): Deleted.
     238        (mozSemantics.async.empty): Deleted.
     239        (mozSemantics.async.simpleReturn): Deleted.
     240        (mozSemantics.async.simpleAwait): Deleted.
     241        (mozSemantics.async.simpleAwaitAsync): Deleted.
     242        (mozSemantics.async.returnOtherAsync): Deleted.
     243        (mozSemantics.async.simpleThrower): Deleted.
     244        (mozSemantics.async.delegatedThrower): Deleted.
     245        (mozSemantics.async.tryCatch): Deleted.
     246        (mozSemantics.async.tryCatchThrow): Deleted.
     247        (mozSemantics.async.wellFinally): Deleted.
     248        (mozSemantics.async.finallyMayFail): Deleted.
     249        (mozSemantics.async.embedded.async.inner): Deleted.
     250        (mozSemantics.async.embedded): Deleted.
     251        (mozSemantics.async.fib): Deleted.
     252        (mozSemantics.async.isOdd.async.isEven): Deleted.
     253        (mozSemantics.async.isOdd): Deleted.
     254        (mozSemantics.hardcoreFib.async.fib2): Deleted.
     255        (mozSemantics.namedAsyncExpr.async.simple): Deleted.
     256        (mozSemantics.async.executionOrder.async.first): Deleted.
     257        (mozSemantics.async.executionOrder.async.second): Deleted.
     258        (mozSemantics.async.executionOrder.async.third): Deleted.
     259        (mozSemantics.async.executionOrder): Deleted.
     260        (mozSemantics.async.miscellaneous): Deleted.
     261        (mozSemantics.thrower): Deleted.
     262        (mozSemantics.async.defaultArgs): Deleted.
     263        (mozSemantics.shouldThrow): Deleted.
     264        (mozSemantics): Deleted.
     265        (mozMethods.X): Deleted.
     266        (mozMethods.X.prototype.async.getValue): Deleted.
     267        (mozMethods.X.prototype.setValue): Deleted.
     268        (mozMethods.X.prototype.async.increment): Deleted.
     269        (mozMethods.X.prototype.async.getBaseClassName): Deleted.
     270        (mozMethods.X.async.getStaticValue): Deleted.
     271        (mozMethods.Y.prototype.async.getBaseClassName): Deleted.
     272        (mozMethods.Y): Deleted.
     273        (mozFunctionNameInferrence.async.test): Deleted.
     274        (mozSyntaxErrors): Deleted.
     275        * tests/stress/async-await-reserved-word.js: Removed.
     276        (assert): Deleted.
     277        (shouldThrowSyntaxError): Deleted.
     278        (AsyncFunction.async): Deleted.
     279        * tests/stress/async_arrow_functions_lexical_arguments_binding.js: Removed.
     280        (shouldBe): Deleted.
     281        (shouldBeAsync): Deleted.
     282        (shouldThrowAsync): Deleted.
     283        (noArgumentsArrow2.async): Deleted.
     284        * tests/stress/async_arrow_functions_lexical_new.target_binding.js: Removed.
     285        (shouldBe): Deleted.
     286        (shouldBeAsync): Deleted.
     287        (shouldThrowAsync): Deleted.
     288        (C1): Deleted.
     289        (C2): Deleted.
     290        (shouldThrowAsync.async): Deleted.
     291        * tests/stress/async_arrow_functions_lexical_super_binding.js: Removed.
     292        (shouldBe): Deleted.
     293        (shouldBeAsync): Deleted.
     294        (BaseClass.prototype.baseClassValue): Deleted.
     295        (BaseClass.prototype.get property): Deleted.
     296        (BaseClass): Deleted.
     297        (ChildClass.prototype.asyncSuperProp): Deleted.
     298        (ChildClass.prototype.asyncSuperProp2): Deleted.
     299        (ChildClass): Deleted.
     300        (ChildClass2): Deleted.
     301        * tests/stress/async_arrow_functions_lexical_this_binding.js: Removed.
     302        (shouldBe): Deleted.
     303        (shouldBeAsync): Deleted.
     304        (d.y): Deleted.
     305
    13062016-05-31  Commit Queue  <commit-queue@webkit.org>
    2307
  • trunk/Source/JavaScriptCore/DerivedSources.make

    r201481 r201542  
    8585    $(JavaScriptCore)/builtins/ArrayIteratorPrototype.js \
    8686    $(JavaScriptCore)/builtins/ArrayPrototype.js \
    87     $(JavaScriptCore)/builtins/AsyncFunctionPrototype.js \
    8887    $(JavaScriptCore)/builtins/DatePrototype.js \
    8988    $(JavaScriptCore)/builtins/FunctionPrototype.js \
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r201532 r201542  
    11801180                5370B4F51BF26202005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5370B4F31BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp */; };
    11811181                5370B4F61BF26205005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5370B4F41BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.h */; };
    1182                 5BD3A0671CAE325700F84BA3 /* AsyncFunctionConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5BD3A0611CAE325700F84BA3 /* AsyncFunctionConstructor.cpp */; };
    1183                 5BD3A0681CAE325700F84BA3 /* AsyncFunctionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 5BD3A0621CAE325700F84BA3 /* AsyncFunctionConstructor.h */; };
    1184                 5BD3A0691CAE325700F84BA3 /* AsyncFunctionPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5BD3A0631CAE325700F84BA3 /* AsyncFunctionPrototype.cpp */; };
    1185                 5BD3A06A1CAE325700F84BA3 /* AsyncFunctionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 5BD3A0641CAE325700F84BA3 /* AsyncFunctionPrototype.h */; };
    1186                 5BD3A06B1CAE325700F84BA3 /* JSAsyncFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5BD3A0651CAE325700F84BA3 /* JSAsyncFunction.cpp */; };
    1187                 5BD3A06E1CAE35BF00F84BA3 /* JSAsyncFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5BD3A06D1CAE35BF00F84BA3 /* JSAsyncFunction.h */; };
    11881182                53917E7B1B7906FA000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 53917E7A1B7906E4000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h */; };
    11891183                53F6BF6D1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    33303324                53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunctionAllocationProfile.h; sourceTree = "<group>"; };
    33313325                593D43CCA0BBE06D89C59707 /* MapDataInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapDataInlines.h; sourceTree = "<group>"; };
    3332                 5BD3A0611CAE325700F84BA3 /* AsyncFunctionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFunctionConstructor.cpp; sourceTree = "<group>"; };
    3333                 5BD3A0621CAE325700F84BA3 /* AsyncFunctionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFunctionConstructor.h; sourceTree = "<group>"; };
    3334                 5BD3A0631CAE325700F84BA3 /* AsyncFunctionPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFunctionPrototype.cpp; sourceTree = "<group>"; };
    3335                 5BD3A0641CAE325700F84BA3 /* AsyncFunctionPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFunctionPrototype.h; sourceTree = "<group>"; };
    3336                 5BD3A0651CAE325700F84BA3 /* JSAsyncFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAsyncFunction.cpp; sourceTree = "<group>"; };
    3337                 5BD3A06D1CAE35BF00F84BA3 /* JSAsyncFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAsyncFunction.h; sourceTree = "<group>"; };
    3338                 5BF474881CB1C5DB0002BAD7 /* AsyncFunctionPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AsyncFunctionPrototype.js; sourceTree = "<group>"; };
    33393326                5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
    33403327                5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = JSC.xcconfig; sourceTree = "<group>"; };
     
    55345521                                F692A84E0255597D01FF60F7 /* ArrayPrototype.h */,
    55355522                                0FB7F38A15ED8E3800F167B2 /* ArrayStorage.h */,
    5536                                 5BD3A0611CAE325700F84BA3 /* AsyncFunctionConstructor.cpp */,
    5537                                 5BD3A0621CAE325700F84BA3 /* AsyncFunctionConstructor.h */,
    5538                                 5BD3A0631CAE325700F84BA3 /* AsyncFunctionPrototype.cpp */,
    5539                                 5BD3A0641CAE325700F84BA3 /* AsyncFunctionPrototype.h */,
    55405523                                52678F8C1A031009006A306D /* BasicBlockLocation.cpp */,
    55415524                                52678F8D1A031009006A306D /* BasicBlockLocation.h */,
     
    57145697                                A7BDAEC417F4EA1400F6140C /* JSArrayIterator.cpp */,
    57155698                                A7BDAEC517F4EA1400F6140C /* JSArrayIterator.h */,
    5716                                 5BD3A0651CAE325700F84BA3 /* JSAsyncFunction.cpp */,
    5717                                 5BD3A06D1CAE35BF00F84BA3 /* JSAsyncFunction.h */,
    57185699                                86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */,
    57195700                                86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */,
     
    68696850                        isa = PBXGroup;
    68706851                        children = (
    6871                                 5BF474881CB1C5DB0002BAD7 /* AsyncFunctionPrototype.js */,
    68726852                                A7D801A01880D66E0026C39B /* ArrayPrototype.js */,
    68736853                                7CF9BC581B65D9A3009DB1EF /* ArrayConstructor.js */,
     
    71877167                                0F2B66DF17B6B5AB00A7AE3F /* DataView.h in Headers */,
    71887168                                BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */,
    7189                                 5BD3A0681CAE325700F84BA3 /* AsyncFunctionConstructor.h in Headers */,
    71907169                                996B731A1BDA08D100331B84 /* DateConstructor.lut.h in Headers */,
    71917170                                41359CF30FDD89AD00206180 /* DateConversion.h in Headers */,
     
    75457524                                2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */,
    75467525                                A5339EC91BB4B4600054F005 /* HeapObserver.h in Headers */,
    7547                                 5BD3A06A1CAE325700F84BA3 /* AsyncFunctionPrototype.h in Headers */,
    75487526                                2A6F462617E959CE00C45C98 /* HeapOperation.h in Headers */,
    75497527                                14F97447138C853E00DA1C67 /* HeapRootVisitor.h in Headers */,
     
    80898067                                14142E511B796ECE00F4BF4B /* UnlinkedFunctionExecutable.h in Headers */,
    80908068                                0F2E892C16D028AD009E4FD2 /* UnusedPointer.h in Headers */,
    8091                                 5BD3A06E1CAE35BF00F84BA3 /* JSAsyncFunction.h in Headers */,
    80928069                                99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */,
    80938070                                0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
     
    86568633                                0FEC858D1BDACDC70080FF74 /* AirTmp.cpp in Sources */,
    86578634                                0FEC85901BDACDC70080FF74 /* AirValidate.cpp in Sources */,
    8658                                 5BD3A06B1CAE325700F84BA3 /* JSAsyncFunction.cpp in Sources */,
    86598635                                147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
    86608636                                0F743BAA16B88249009F9277 /* ARM64Disassembler.cpp in Sources */,
     
    92709246                                0F13912916771C33009CCB07 /* ProfilerBytecodeSequence.cpp in Sources */,
    92719247                                0FF729AF166AD35C000F5BA3 /* ProfilerCompilation.cpp in Sources */,
    9272                                 5BD3A0671CAE325700F84BA3 /* AsyncFunctionConstructor.cpp in Sources */,
    92739248                                0FF729B0166AD35C000F5BA3 /* ProfilerCompilationKind.cpp in Sources */,
    92749249                                0FF729B1166AD35C000F5BA3 /* ProfilerCompiledBytecode.cpp in Sources */,
     
    94059380                                1ACF7377171CA6FB00C9BB1E /* Weak.cpp in Sources */,
    94069381                                14E84F9E14EE1ACC00D6D5D4 /* WeakBlock.cpp in Sources */,
    9407                                 5BD3A0691CAE325700F84BA3 /* AsyncFunctionPrototype.cpp in Sources */,
    94089382                                14F7256514EE265E00B1652B /* WeakHandleOwner.cpp in Sources */,
    94099383                                A7CA3AE317DA41AE006538AF /* WeakMapConstructor.cpp in Sources */,
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp

    r201481 r201542  
    8080    RefPtr<SourceProvider> sourceOverride = isParsingDefaultConstructor ? source.provider() : nullptr;
    8181    std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
    82         &vm, RuntimeFlags(), source, Identifier(), builtinMode,
     82        &vm, source, Identifier(), builtinMode,
    8383        JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error,
    8484        &positionBeforeLastNewline, constructorKind);
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.json

    r201532 r201542  
    100100            { "name" : "op_new_generator_func", "length" : 4 },
    101101            { "name" : "op_new_generator_func_exp", "length" : 4 },
    102             { "name" : "op_new_async_func", "length" : 4 },
    103             { "name" : "op_new_async_func_exp", "length" : 4 },
    104102            { "name" : "op_set_function_name", "length" : 3 },
    105103            { "name" : "op_call", "length" : 9 },
  • trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h

    r201532 r201542  
    150150    case op_get_enumerable_length:
    151151    case op_new_func_exp:
    152     case op_new_async_func_exp:
    153152    case op_new_generator_func_exp:
    154153    case op_to_index_string:
     
    181180    case op_unsigned:
    182181    case op_new_func:
    183     case op_new_async_func:
    184182    case op_new_generator_func:
    185183    case op_get_parent_scope:
     
    381379    case op_new_func:
    382380    case op_new_func_exp:
    383     case op_new_async_func:
    384     case op_new_async_func_exp:
    385381    case op_new_generator_func:
    386382    case op_new_generator_func_exp:
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r201532 r201542  
    14131413            break;
    14141414        }
    1415         case op_new_async_func: {
    1416             int r0 = (++it)->u.operand;
    1417             int r1 = (++it)->u.operand;
    1418             int f0 = (++it)->u.operand;
    1419             printLocationAndOp(out, exec, location, it, "new_async_func");
    1420             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
    1421             break;
    1422         }
    1423         case op_new_async_func_exp: {
    1424             int r0 = (++it)->u.operand;
    1425             int r1 = (++it)->u.operand;
    1426             int f0 = (++it)->u.operand;
    1427             printLocationAndOp(out, exec, location, it, "new_async_func_exp");
    1428             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
    1429             break;
    1430         }
    14311415        case op_new_func_exp: {
    14321416            int r0 = (++it)->u.operand;
     
    23342318
    23352319    // Perform bytecode liveness analysis to determine which locals are live and should be resumed when executing op_resume.
    2336     if (unlinkedCodeBlock->parseMode() == SourceParseMode::GeneratorBodyMode || isAsyncFunctionBodyParseMode(unlinkedCodeBlock->parseMode())) {
     2320    if (unlinkedCodeBlock->parseMode() == SourceParseMode::GeneratorBodyMode) {
    23372321        if (size_t count = mergePointBytecodeOffsets.size()) {
    23382322            createRareDataIfNecessary();
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r201481 r201542  
    119119    bool usesEval() const { return m_usesEval; }
    120120    SourceParseMode parseMode() const { return m_parseMode; }
    121     bool isArrowFunction() const { return isOrdinaryArrowFunction() || isAsyncArrowFunction(); }
    122     bool isOrdinaryArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; }
    123     bool isAsyncArrowFunction() const { return m_parseMode == SourceParseMode::AsyncArrowFunctionMode; }
     121    bool isArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; }
    124122    DerivedContextType derivedContextType() const { return static_cast<DerivedContextType>(m_derivedContextType); }
    125123    EvalContextType evalContextType() const { return static_cast<EvalContextType>(m_evalContextType); }
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp

    r201523 r201542  
    4949
    5050static UnlinkedFunctionCodeBlock* generateUnlinkedFunctionCodeBlock(
    51     VM& vm, const RuntimeFlags& runtimeFlags, UnlinkedFunctionExecutable* executable, const SourceCode& source,
     51    VM& vm, UnlinkedFunctionExecutable* executable, const SourceCode& source,
    5252    CodeSpecializationKind kind, DebuggerMode debuggerMode,
    5353    UnlinkedFunctionKind functionKind, ParserError& error, SourceParseMode parseMode)
     
    5757    ASSERT(isFunctionParseMode(executable->parseMode()));
    5858    std::unique_ptr<FunctionNode> function = parse<FunctionNode>(
    59         &vm, runtimeFlags, source, executable->name(), builtinMode, strictMode, executable->parseMode(), executable->superBinding(), error, nullptr);
     59        &vm, source, executable->name(), builtinMode, strictMode, executable->parseMode(), executable->superBinding(), error, nullptr);
    6060
    6161    if (!function) {
     
    9292    , m_parameterCount(node->parameterCount())
    9393    , m_features(0)
    94     , m_sourceParseMode(node->parseMode())
    9594    , m_isInStrictContext(node->isInStrictContext())
    9695    , m_hasCapturedVariables(false)
     
    101100    , m_superBinding(static_cast<unsigned>(node->superBinding()))
    102101    , m_derivedContextType(static_cast<unsigned>(derivedContextType))
     102    , m_sourceParseMode(static_cast<unsigned>(node->parseMode()))
    103103    , m_name(node->ident())
    104104    , m_ecmaName(node->ecmaName())
     
    113113    ASSERT(m_superBinding == static_cast<unsigned>(node->superBinding()));
    114114    ASSERT(m_derivedContextType == static_cast<unsigned>(derivedContextType));
     115    ASSERT(m_sourceParseMode == static_cast<unsigned>(node->parseMode()));
    115116
    116117    m_parentScopeTDZVariables.swap(parentScopeTDZVariables);
     
    175176    VM& vm = exec.vm();
    176177    CodeCache* codeCache = vm.codeCache();
    177     UnlinkedFunctionExecutable* executable = codeCache->getFunctionExecutableFromGlobalCode(vm, exec.lexicalGlobalObject()->runtimeFlags(), name, source, error);
     178    UnlinkedFunctionExecutable* executable = codeCache->getFunctionExecutableFromGlobalCode(vm, name, source, error);
    178179
    179180    auto& globalObject = *exec.lexicalGlobalObject();
     
    190191
    191192UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::unlinkedCodeBlockFor(
    192     VM& vm, const RuntimeFlags& runtimeFlags, const SourceCode& source, CodeSpecializationKind specializationKind,
     193    VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind,
    193194    DebuggerMode debuggerMode, ParserError& error, SourceParseMode parseMode)
    194195{
     
    205206
    206207    UnlinkedFunctionCodeBlock* result = generateUnlinkedFunctionCodeBlock(
    207         vm, runtimeFlags, this, source, specializationKind, debuggerMode,
     208        vm, this, source, specializationKind, debuggerMode,
    208209        isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction,
    209210        error, parseMode);
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h

    r201523 r201542  
    5151class FunctionExecutable;
    5252class ParserError;
    53 class RuntimeFlags;
    5453class SourceCode;
    5554class SourceProvider;
     
    103102
    104103    UnlinkedFunctionCodeBlock* unlinkedCodeBlockFor(
    105         VM&, const RuntimeFlags&, const SourceCode&, CodeSpecializationKind, DebuggerMode,
     104        VM&, const SourceCode&, CodeSpecializationKind, DebuggerMode,
    106105        ParserError&, SourceParseMode);
    107106
     
    159158    unsigned m_parameterCount;
    160159    CodeFeatures m_features;
    161     SourceParseMode m_sourceParseMode;
    162160    unsigned m_isInStrictContext : 1;
    163161    unsigned m_hasCapturedVariables : 1;
     
    168166    unsigned m_superBinding : 1;
    169167    unsigned m_derivedContextType: 2;
     168    unsigned m_sourceParseMode : 4; // SourceParseMode
    170169
    171170    WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall;
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r201532 r201542  
    3333
    3434#include "BuiltinExecutables.h"
    35 #include "BuiltinNames.h"
    3635#include "BytecodeLivenessAnalysis.h"
    3736#include "Interpreter.h"
     
    249248    bool needsArguments = (functionNode->usesArguments() || codeBlock->usesEval() || (functionNode->usesArrowFunction() && !codeBlock->isArrowFunction() && isArgumentsUsedInInnerArrowFunction()));
    250249
    251     // Generator and AsyncFunction never provides "arguments". "arguments" reference will be resolved in an upper generator function scope.
    252     if (parseMode == SourceParseMode::GeneratorBodyMode || isAsyncFunctionBodyParseMode(parseMode))
     250    // Generator never provides "arguments". "arguments" reference will be resolved in an upper generator function scope.
     251    if (parseMode == SourceParseMode::GeneratorBodyMode)
    253252        needsArguments = false;
    254253
    255     if ((parseMode == SourceParseMode::GeneratorWrapperFunctionMode || isAsyncFunctionWrapperParseMode(parseMode)) && needsArguments) {
     254    if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode && needsArguments) {
    256255        // Generator does not provide "arguments". Instead, wrapping GeneratorFunction provides "arguments".
    257256        // This is because arguments of a generator should be evaluated before starting it.
     
    300299
    301300    // Before emitting a scope creation, emit a generator prologue that contains jump based on a generator's state.
    302     if (parseMode == SourceParseMode::GeneratorBodyMode || isAsyncFunctionBodyParseMode(parseMode)) {
     301    if (parseMode == SourceParseMode::GeneratorBodyMode) {
    303302        m_generatorRegister = &m_parameters[1];
    304303
     
    315314    if (functionNameIsInScope(functionNode->ident(), functionNode->functionMode())) {
    316315        ASSERT(parseMode != SourceParseMode::GeneratorBodyMode);
    317         ASSERT(parseMode != SourceParseMode::AsyncFunctionBodyMode);
    318         ASSERT(parseMode != SourceParseMode::AsyncArrowFunctionBodyMode);
    319316        bool isDynamicScope = functionNameScopeIsDynamic(codeBlock->usesEval(), codeBlock->isStrictMode());
    320317        bool isFunctionNameCaptured = captures(functionNode->ident().impl());
     
    541538    }
    542539
    543     case SourceParseMode::AsyncArrowFunctionMode:
    544     case SourceParseMode::AsyncMethodMode:
    545     case SourceParseMode::AsyncFunctionMode: {
    546         ASSERT(!isConstructor());
    547         ASSERT(constructorKind() == ConstructorKind::None);
    548         m_generatorRegister = addVar();
    549 
    550         if (parseMode != SourceParseMode::AsyncArrowFunctionMode) {
    551             if (functionNode->usesThis() || codeBlock->usesEval()) {
    552                 m_codeBlock->addPropertyAccessInstruction(instructions().size());
    553                 emitOpcode(op_to_this);
    554                 instructions().append(kill(&m_thisRegister));
    555                 instructions().append(0);
    556                 instructions().append(0);
    557             }
    558 
    559             emitMove(m_generatorRegister, &m_calleeRegister);
    560             emitCreateThis(m_generatorRegister);
    561         } else
    562             emitMove(m_generatorRegister, &m_calleeRegister);
    563         break;
    564     }
    565 
    566     case SourceParseMode::AsyncFunctionBodyMode:
    567     case SourceParseMode::AsyncArrowFunctionBodyMode:
    568540    case SourceParseMode::GeneratorBodyMode: {
    569541        // |this| is already filled correctly before here.
     
    596568    // We need load |super| & |this| for arrow function before initializeDefaultParameterValuesAndSetupFunctionScopeStack
    597569    // if we have default parameter expression. Because |super| & |this| values can be used there
    598     //
    599     // Also load here for AsyncArrowFunctions, as they may refer to |super| in their formal parameter expressions as well.
    600     if ((SourceParseMode::ArrowFunctionMode == parseMode || parseMode == SourceParseMode::AsyncArrowFunctionMode) && !isSimpleParameterList) {
     570    if (SourceParseMode::ArrowFunctionMode == parseMode && !isSimpleParameterList) {
    601571        if (functionNode->usesThis() || functionNode->usesSuperProperty())
    602572            emitLoadThisFromArrowFunctionLexicalEnvironment();
     
    617587    // because a function's default parameter ExpressionNodes will use temporary registers.
    618588    pushTDZVariables(*parentScopeTDZVariables, TDZCheckOptimization::DoNotOptimize);
    619 
    620     TryData* tryFormalParametersData = nullptr;
    621     if (isAsyncFunctionWrapperParseMode(parseMode) && !isSimpleParameterList) {
    622         RefPtr<Label> tryFormalParametersStart = emitLabel(newLabel().get());
    623         tryFormalParametersData = pushTry(tryFormalParametersStart.get());
    624     }
    625 
    626589    initializeDefaultParameterValuesAndSetupFunctionScopeStack(parameters, isSimpleParameterList, functionNode, functionSymbolTable, symbolTableConstantIndex, captures, shouldCreateArgumentsVariableInParameterScope);
    627 
    628     if (isAsyncFunctionWrapperParseMode(parseMode) && !isSimpleParameterList) {
    629         RefPtr<Label> didNotThrow = newLabel();
    630         emitJump(didNotThrow.get());
    631         RefPtr<RegisterID> exception = newTemporary();
    632         RefPtr<RegisterID> thrownValue = newTemporary();
    633         RefPtr<Label> catchHere = emitLabel(newLabel().get());
    634         popTryAndEmitCatch(tryFormalParametersData, exception.get(), thrownValue.get(), catchHere.get(), HandlerType::Catch);
    635 
    636         // return @Promise.@reject(thrownValue);
    637         Variable promiseVar = variable(m_vm->propertyNames->PromisePrivateName);
    638         RefPtr<RegisterID> scope = emitResolveScope(newTemporary(), promiseVar);
    639         RefPtr<RegisterID> promiseConstructor = emitGetFromScope(newTemporary(), scope.get(), promiseVar, ResolveMode::ThrowIfNotFound);
    640         RefPtr<RegisterID> promiseReject = emitGetById(newTemporary(), promiseConstructor.get(), m_vm->propertyNames->builtinNames().rejectPrivateName());
    641 
    642         CallArguments args(*this, nullptr, 1);
    643 
    644         emitMove(args.thisRegister(), promiseConstructor.get());
    645         emitMove(args.argumentRegister(0), thrownValue.get());
    646 
    647         JSTextPosition divot(functionNode->firstLine(), functionNode->startOffset(), functionNode->lineStartOffset());
    648 
    649         RefPtr<RegisterID> result = emitCall(newTemporary(), promiseReject.get(), NoExpectedFunction, args, divot, divot, divot);
    650         emitReturn(result.get());
    651 
    652         emitLabel(didNotThrow.get());
    653     }
    654 
     590   
    655591    // If we don't have  default parameter expression, then loading |this| inside an arrow function must be done
    656592    // after initializeDefaultParameterValuesAndSetupFunctionScopeStack() because that function sets up the
    657593    // SymbolTable stack and emitLoadThisFromArrowFunctionLexicalEnvironment() consults the SymbolTable stack
    658     //
    659     // For AsyncArrowFunctionBody functions, the lexical environment may have been loaded by the wrapper function,
    660     // but may need to be loaded separately if it's used again in the function body.
    661     // FIXME: only require loading the lexical context once per async arrow function.
    662     if ((SourceParseMode::ArrowFunctionMode == parseMode && isSimpleParameterList) || SourceParseMode::AsyncArrowFunctionBodyMode == parseMode) {
     594    if (SourceParseMode::ArrowFunctionMode == parseMode && isSimpleParameterList) {
    663595        if (functionNode->usesThis() || functionNode->usesSuperProperty())
    664596            emitLoadThisFromArrowFunctionLexicalEnvironment();
     
    29552887        opcodeID = op_new_generator_func_exp;
    29562888        break;
    2957 
    2958     case SourceParseMode::AsyncFunctionMode:
    2959     case SourceParseMode::AsyncMethodMode:
    2960     case SourceParseMode::AsyncArrowFunctionMode:
    2961         opcodeID = op_new_async_func_exp;
    2962         break;
    2963 
    29642889    default:
    29652890        break;
     
    29802905RegisterID* BytecodeGenerator::emitNewArrowFunctionExpression(RegisterID* dst, ArrowFuncExprNode* func)
    29812906{
    2982     ASSERT(func->metadata()->parseMode() == SourceParseMode::ArrowFunctionMode || func->metadata()->parseMode() == SourceParseMode::AsyncArrowFunctionMode);
     2907    ASSERT(func->metadata()->parseMode() == SourceParseMode::ArrowFunctionMode);
    29832908    emitNewFunctionExpressionCommon(dst, func->metadata());
    29842909    return dst;
     
    29902915        || func->metadata()->parseMode() == SourceParseMode::GetterMode
    29912916        || func->metadata()->parseMode() == SourceParseMode::SetterMode
    2992         || func->metadata()->parseMode() == SourceParseMode::MethodMode
    2993         || func->metadata()->parseMode() == SourceParseMode::AsyncMethodMode);
     2917        || func->metadata()->parseMode() == SourceParseMode::MethodMode);
    29942918    emitNewFunctionExpressionCommon(dst, func->metadata());
    29952919    return dst;
     
    30182942    if (function->parseMode() == SourceParseMode::GeneratorWrapperFunctionMode)
    30192943        emitOpcode(op_new_generator_func);
    3020     else if (function->parseMode() == SourceParseMode::AsyncFunctionMode)
    3021         emitOpcode(op_new_async_func);
    30222944    else
    30232945        emitOpcode(op_new_func);
     
    43084230RegisterID* BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment(const Identifier& identifier)
    43094231{
    4310     ASSERT(m_codeBlock->isArrowFunction() || parseMode() == SourceParseMode::AsyncArrowFunctionBodyMode || m_codeBlock->isArrowFunctionContext() || constructorKind() == ConstructorKind::Derived || m_codeType == EvalCode);
     4232    ASSERT(m_codeBlock->isArrowFunction() || m_codeBlock->isArrowFunctionContext() || constructorKind() == ConstructorKind::Derived || m_codeType == EvalCode);
    43114233
    43124234    return emitResolveScope(nullptr, variable(identifier, ThisResolutionType::Scoped));
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r201481 r201542  
    823823            DerivedContextType newDerivedContextType = DerivedContextType::None;
    824824
    825             if (metadata->parseMode() == SourceParseMode::ArrowFunctionMode || metadata->parseMode() == SourceParseMode::AsyncArrowFunctionMode) {
     825            if (metadata->parseMode() == SourceParseMode::ArrowFunctionMode) {
    826826                if (constructorKind() == ConstructorKind::Derived || isDerivedConstructorContext())
    827827                    newDerivedContextType = DerivedContextType::DerivedConstructorContext;
     
    837837            SourceParseMode parseMode = metadata->parseMode();
    838838            ConstructAbility constructAbility = ConstructAbility::CanConstruct;
    839             if (parseMode == SourceParseMode::GetterMode || parseMode == SourceParseMode::SetterMode || parseMode == SourceParseMode::ArrowFunctionMode || parseMode == SourceParseMode::GeneratorWrapperFunctionMode || isAsyncFunctionParseMode(parseMode))
     839            if (parseMode == SourceParseMode::GetterMode || parseMode == SourceParseMode::SetterMode || parseMode == SourceParseMode::ArrowFunctionMode || parseMode == SourceParseMode::GeneratorWrapperFunctionMode)
    840840                constructAbility = ConstructAbility::CannotConstruct;
    841841            else if (parseMode == SourceParseMode::MethodMode && metadata->constructorKind() == ConstructorKind::None)
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r201481 r201542  
    32663266    }
    32673267
    3268     case SourceParseMode::AsyncFunctionMode:
    3269     case SourceParseMode::AsyncMethodMode:
    3270     case SourceParseMode::AsyncArrowFunctionMode: {
    3271         StatementNode* singleStatement = this->singleStatement();
    3272         ASSERT(singleStatement->isExprStatement());
    3273         ExprStatementNode* exprStatement = static_cast<ExprStatementNode*>(singleStatement);
    3274         ExpressionNode* expr = exprStatement->expr();
    3275         ASSERT(expr->isFuncExprNode());
    3276         FuncExprNode* funcExpr = static_cast<FuncExprNode*>(expr);
    3277 
    3278         RefPtr<RegisterID> next = generator.newTemporary();
    3279         generator.emitNode(next.get(), funcExpr);
    3280 
    3281         if (generator.superBinding() == SuperBinding::Needed || generator.parseMode() == SourceParseMode::AsyncArrowFunctionMode) {
    3282             // FIXME: Don't always load home object for async arrows
    3283             RefPtr<RegisterID> homeObject = emitHomeObjectForCallee(generator);
    3284             emitPutHomeObject(generator, next.get(), homeObject.get());
    3285         }
    3286 
    3287         // FIXME: Currently, we just create an object and store generator related fields as its properties for ease.
    3288         // But to make it efficient, we will introduce JSGenerator class, add opcode new_generator and use its C++ fields instead of these private properties.
    3289         // https://bugs.webkit.org/show_bug.cgi?id=151545
    3290 
    3291         generator.emitDirectPutById(generator.generatorRegister(), generator.propertyNames().generatorNextPrivateName, next.get(), PropertyNode::KnownDirect);
    3292 
    3293         generator.emitDirectPutById(generator.generatorRegister(), generator.propertyNames().generatorThisPrivateName, generator.thisRegister(), PropertyNode::KnownDirect);
    3294 
    3295         RegisterID* initialState = generator.emitLoad(nullptr, jsNumber(0));
    3296         generator.emitDirectPutById(generator.generatorRegister(), generator.propertyNames().generatorStatePrivateName, initialState, PropertyNode::KnownDirect);
    3297 
    3298         generator.emitDirectPutById(generator.generatorRegister(), generator.propertyNames().generatorFramePrivateName, generator.emitLoad(nullptr, jsNull()), PropertyNode::KnownDirect);
    3299 
    3300         ASSERT(startOffset() >= lineStartOffset());
    3301         generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset());
    3302 
    3303         // load @asyncFunctionResume, and call.
    3304         RefPtr<RegisterID> startAsyncFunction = generator.newTemporary();
    3305         auto var = generator.variable(generator.propertyNames().builtinNames().asyncFunctionResumePrivateName());
    3306 
    3307         RefPtr<RegisterID> scope = generator.newTemporary();
    3308         generator.moveToDestinationIfNeeded(scope.get(), generator.emitResolveScope(scope.get(), var));
    3309         generator.emitGetFromScope(startAsyncFunction.get(), scope.get(), var, ThrowIfNotFound);
    3310 
    3311         // return @asyncFunctionResume.@call(this, @generator, @undefined, GeneratorResumeMode::NormalMode)
    3312         CallArguments args(generator, nullptr, 3);
    3313         unsigned argumentCount = 0;
    3314         generator.emitLoad(args.thisRegister(), jsUndefined());
    3315         generator.emitMove(args.argumentRegister(argumentCount++), generator.generatorRegister());
    3316         generator.emitLoad(args.argumentRegister(argumentCount++), jsUndefined());
    3317         generator.emitLoad(args.argumentRegister(argumentCount++), jsNumber(static_cast<int32_t>(JSGeneratorFunction::GeneratorResumeMode::NormalMode)));
    3318         // JSTextPosition(int _line, int _offset, int _lineStartOffset)
    3319         JSTextPosition divot(firstLine(), startOffset(), lineStartOffset());
    3320 
    3321         RefPtr<RegisterID> result = generator.newTemporary();
    3322         generator.emitCall(result.get(), startAsyncFunction.get(), NoExpectedFunction, args, divot, divot, divot);
    3323         generator.emitReturn(result.get());
    3324         break;
    3325     }
    3326 
    3327     case SourceParseMode::AsyncArrowFunctionBodyMode:
    3328     case SourceParseMode::AsyncFunctionBodyMode:
    33293268    case SourceParseMode::GeneratorBodyMode: {
    33303269        RefPtr<Label> generatorBodyLabel = generator.newLabel();
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp

    r201481 r201542  
    4242#include "JSLock.h"
    4343#include "ParserError.h"
    44 #include "RuntimeFlags.h"
    4544#include "ScriptDebugServer.h"
    4645#include "SourceCode.h"
     
    9291
    9392    ParserError error;
    94     checkSyntax(m_vm, RuntimeFlags(), JSC::makeSource(expression), error);
     93    checkSyntax(m_vm, JSC::makeSource(expression), error);
    9594
    9695    switch (error.syntaxErrorType()) {
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r201532 r201542  
    284284        DEFINE_OP(op_new_generator_func)
    285285        DEFINE_OP(op_new_generator_func_exp)
    286         DEFINE_OP(op_new_async_func)
    287         DEFINE_OP(op_new_async_func_exp)
    288286        DEFINE_OP(op_new_object)
    289287        DEFINE_OP(op_new_regexp)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r201487 r201542  
    554554        void emit_op_new_generator_func(Instruction*);
    555555        void emit_op_new_generator_func_exp(Instruction*);
    556         void emit_op_new_async_func(Instruction*);
    557         void emit_op_new_async_func_exp(Instruction*);
    558556        void emit_op_new_object(Instruction*);
    559557        void emit_op_new_regexp(Instruction*);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r201487 r201542  
    972972    if (opcodeID == op_new_func)
    973973        callOperation(operationNewFunction, dst, regT0, funcExec);
    974     else if (opcodeID == op_new_async_func)
    975         callOperation(operationNewAsyncFunction, dst, regT0, funcExec);
    976974    else {
    977975        ASSERT(opcodeID == op_new_generator_func);
     
    986984
    987985void JIT::emit_op_new_generator_func(Instruction* currentInstruction)
    988 {
    989     emitNewFuncCommon(currentInstruction);
    990 }
    991 
    992 void JIT::emit_op_new_async_func(Instruction* currentInstruction)
    993986{
    994987    emitNewFuncCommon(currentInstruction);
     
    10161009    if (opcodeID == op_new_func_exp)
    10171010        callOperation(operationNewFunction, dst, regT0, function);
    1018     else if (opcodeID == op_new_async_func_exp)
    1019         callOperation(operationNewAsyncFunction, dst, regT0, function);
    10201011    else {
    10211012        ASSERT(opcodeID == op_new_generator_func_exp);
     
    10321023
    10331024void JIT::emit_op_new_generator_func_exp(Instruction* currentInstruction)
    1034 {
    1035     emitNewFuncExprCommon(currentInstruction);
    1036 }
    1037 
    1038 void JIT::emit_op_new_async_func_exp(Instruction* currentInstruction)
    10391025{
    10401026    emitNewFuncExprCommon(currentInstruction);
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r201481 r201542  
    4747#include "JITExceptions.h"
    4848#include "JITToDFGDeferredCompilationCallback.h"
    49 #include "JSAsyncFunction.h"
    5049#include "JSCInlines.h"
    5150#include "JSGeneratorFunction.h"
     
    11021101{
    11031102    return operationNewFunctionCommon<JSFunction>(exec, scope, functionExecutable, true);
    1104 }
    1105 
    1106 EncodedJSValue JIT_OPERATION operationNewAsyncFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable)
    1107 {
    1108     return operationNewFunctionCommon<JSAsyncFunction>(exec, scope, functionExecutable, false);
    1109 }
    1110 
    1111 EncodedJSValue JIT_OPERATION operationNewAsyncFunctionWithInvalidatedReallocationWatchpoint(ExecState* exec, JSScope* scope, JSCell* functionExecutable)
    1112 {
    1113     return operationNewFunctionCommon<JSAsyncFunction>(exec, scope, functionExecutable, true);
    11141103}
    11151104
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r201481 r201542  
    346346EncodedJSValue JIT_OPERATION operationNewFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
    347347EncodedJSValue JIT_OPERATION operationNewFunctionWithInvalidatedReallocationWatchpoint(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
    348 EncodedJSValue JIT_OPERATION operationNewAsyncFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
    349 EncodedJSValue JIT_OPERATION operationNewAsyncFunctionWithInvalidatedReallocationWatchpoint(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
    350348EncodedJSValue JIT_OPERATION operationNewGeneratorFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
    351349EncodedJSValue JIT_OPERATION operationNewGeneratorFunctionWithInvalidatedReallocationWatchpoint(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jsc.cpp

    r201481 r201542  
    20982098            source = source + line;
    20992099            source = source + '\n';
    2100             checkSyntax(globalObject->vm(), globalObject->runtimeFlags(), makeSource(source, interpreterName), error);
     2100            checkSyntax(globalObject->vm(), makeSource(source, interpreterName), error);
    21012101            if (!line[0])
    21022102                break;
     
    21612161    fprintf(stderr, "  --dumpOptions              Dumps all non-default JSC VM options before continuing\n");
    21622162    fprintf(stderr, "  --<jsc VM option>=<value>  Sets the specified JSC VM option\n");
    2163 
    21642163    fprintf(stderr, "\n");
    21652164
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r201532 r201542  
    4141#include "JIT.h"
    4242#include "JITExceptions.h"
    43 #include "JSAsyncFunction.h"
    4443#include "JSLexicalEnvironment.h"
    4544#include "JSCInlines.h"
     
    10771076}
    10781077
    1079 LLINT_SLOW_PATH_DECL(slow_path_new_async_func)
    1080 {
    1081     LLINT_BEGIN();
    1082     CodeBlock* codeBlock = exec->codeBlock();
    1083     JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope();
    1084 #if LLINT_SLOW_PATH_TRACING
    1085     dataLogF("Creating async function!\n");
    1086 #endif
    1087     LLINT_RETURN(JSAsyncFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope));
    1088 }
    1089 
    10901078LLINT_SLOW_PATH_DECL(slow_path_new_generator_func)
    10911079{
     
    11191107
    11201108    LLINT_RETURN(JSGeneratorFunction::create(vm, executable, scope));
    1121 }
    1122 
    1123 LLINT_SLOW_PATH_DECL(slow_path_new_async_func_exp)
    1124 {
    1125     LLINT_BEGIN();
    1126    
    1127     CodeBlock* codeBlock = exec->codeBlock();
    1128     JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope();
    1129     FunctionExecutable* executable = codeBlock->functionExpr(pc[3].u.operand);
    1130    
    1131     LLINT_RETURN(JSAsyncFunction::create(vm, executable, scope));
    11321109}
    11331110
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h

    r201487 r201542  
    101101LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_func);
    102102LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_func_exp);
    103 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_async_func);
    104 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_async_func_exp);
    105103LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_generator_func);
    106104LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_generator_func_exp);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r201487 r201542  
    12411241
    12421242
    1243 _llint_op_new_async_func:
    1244     traceExecution()
    1245     callSlowPath(_llint_slow_path_new_async_func)
    1246     dispatch(4)
    1247 
    1248 
    12491243_llint_op_new_generator_func:
    12501244    traceExecution()
     
    15021496    dispatch(0)
    15031497
     1498
    15041499_llint_op_new_func_exp:
    15051500    traceExecution()
     
    15101505    traceExecution()
    15111506    callSlowPath(_llint_slow_path_new_generator_func_exp)
    1512     dispatch(4)
    1513 
    1514 _llint_op_new_async_func_exp:
    1515     traceExecution()
    1516     callSlowPath(_llint_slow_path_new_async_func_exp)
    15171507    dispatch(4)
    15181508
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r201481 r201542  
    381381    }
    382382
    383     ExpressionNode* createAsyncFunctionBody(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo, SourceParseMode parseMode)
    384     {
    385         if (parseMode == SourceParseMode::AsyncArrowFunctionBodyMode) {
    386             SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.body->isArrowFunctionBodyExpression() ? functionInfo.endOffset - 1 : functionInfo.endOffset, functionInfo.startLine, functionInfo.parametersStartColumn);
    387             FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *functionInfo.name, functionInfo.body, source);
    388             functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
    389             return result;
    390         }
    391         return createFunctionExpr(location, functionInfo);
    392     }
    393 
    394383    ExpressionNode* createMethodDefinition(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& functionInfo)
    395384    {
  • trunk/Source/JavaScriptCore/parser/Keywords.table

    r201481 r201542  
    88
    99# Keywords.
    10 await           AWAIT
    1110break           BREAK
    1211case            CASE
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r201523 r201542  
    196196
    197197template <typename LexerType>
    198 Parser<LexerType>::Parser(VM* vm, RuntimeFlags runtimeFlags, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding, ConstructorKind defaultConstructorKind, DerivedContextType derivedContextType, bool isEvalContext, EvalContextType evalContextType)
     198Parser<LexerType>::Parser(VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding, ConstructorKind defaultConstructorKind, DerivedContextType derivedContextType, bool isEvalContext, EvalContextType evalContextType)
    199199    : m_vm(vm)
    200200    , m_source(&source)
    201201    , m_hasStackOverflow(false)
    202     , m_runtimeFlags(runtimeFlags)
    203202    , m_allowsIn(true)
    204203    , m_syntaxAlreadyValidated(source.provider()->isValid())
     
    254253    SetForScope<FunctionParsePhase> functionParsePhasePoisoner(m_parserState.functionParsePhase, FunctionParsePhase::Body);
    255254
    256     bool isArrowFunctionBodyExpression = parseMode == SourceParseMode::AsyncArrowFunctionBodyMode && !match(OPENBRACE);
     255    bool isArrowFunctionBodyExpression = false;
    257256    if (m_lexer->isReparsingFunction()) {
    258257        ParserFunctionInfo<ASTBuilder> functionInfo;
    259         if (SourceParseModeSet(SourceParseMode::GeneratorBodyMode).contains(parseMode) || isAsyncFunctionBodyParseMode(parseMode))
     258        if (parseMode == SourceParseMode::GeneratorBodyMode)
    260259            m_parameters = createGeneratorParameters(context);
    261260        else
    262261            m_parameters = parseFunctionParameters(context, parseMode, functionInfo);
    263262
    264         if (SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(parseMode) && !hasError()) {
     263        if (parseMode == SourceParseMode::ArrowFunctionMode && !hasError()) {
    265264            // The only way we could have an error wile reparsing is if we run out of stack space.
    266265            RELEASE_ASSERT(match(ARROWFUNCTION));
     
    279278    // The only way we can error this early is if we reparse a function and we run out of stack space.
    280279    if (!hasError()) {
    281         if (isAsyncFunctionWrapperParseMode(parseMode))
    282             sourceElements = parseAsyncFunctionSourceElements(context, parseMode, isArrowFunctionBodyExpression, CheckForStrictMode);
    283         else if (isArrowFunctionBodyExpression)
     280        if (isArrowFunctionBodyExpression)
    284281            sourceElements = parseArrowFunctionSingleExpressionBodySourceElements(context);
    285282        else if (isModuleParseMode(parseMode))
    286283            sourceElements = parseModuleSourceElements(context, parseMode);
    287         else if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode)
    288             sourceElements = parseGeneratorFunctionSourceElements(context, CheckForStrictMode);
    289         else
    290             sourceElements = parseSourceElements(context, CheckForStrictMode);
     284        else {
     285            if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode)
     286                sourceElements = parseGeneratorFunctionSourceElements(context, CheckForStrictMode);
     287            else
     288                sourceElements = parseSourceElements(context, CheckForStrictMode);
     289        }
    291290    }
    292291
     
    308307        varDeclarations.markVariableAsCaptured(entry);
    309308
    310     if (SourceParseModeSet(SourceParseMode::GeneratorWrapperFunctionMode).contains(parseMode) || isAsyncFunctionWrapperParseMode(parseMode)) {
     309    if (parseMode == SourceParseMode::GeneratorWrapperFunctionMode) {
    311310        if (scope->usedVariablesContains(m_vm->propertyNames->arguments.impl()))
    312311            context.propagateArgumentsUse();
     
    353352bool Parser<LexerType>::isArrowFunctionParameters()
    354353{
    355     if (match(OPENPAREN)) {
    356         SavePoint saveArrowFunctionPoint = createSavePoint();
    357         next();
    358         bool isArrowFunction = false;
     354    bool isOpenParen = match(OPENPAREN);
     355    bool isIdent = match(IDENT);
     356   
     357    if (!isOpenParen && !isIdent)
     358        return false;
     359
     360    bool isArrowFunction = false;
     361    SavePoint saveArrowFunctionPoint = createSavePoint();
     362       
     363    if (isIdent) {
     364        next();
     365        isArrowFunction = match(ARROWFUNCTION);
     366    } else {
     367        RELEASE_ASSERT(isOpenParen);
     368        next();
    359369        if (match(CLOSEPAREN)) {
    360370            next();
     
    368378            unsigned parametersCount = 0;
    369379            isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount) && consume(CLOSEPAREN) && match(ARROWFUNCTION);
    370 
     380               
    371381            popScope(fakeScope, syntaxChecker.NeedsFreeVariableInfo);
    372382        }
    373         restoreSavePoint(saveArrowFunctionPoint);
    374         return isArrowFunction;
    375     }
    376 
    377     if (matchSpecIdentifier()) {
    378         SavePoint saveArrowFunctionPoint = createSavePoint();
    379         next();
    380         bool isArrowFunction = match(ARROWFUNCTION);
    381         restoreSavePoint(saveArrowFunctionPoint);
    382         return isArrowFunction;
    383     }
    384 
    385     return false;
     383    }
     384       
     385    restoreSavePoint(saveArrowFunctionPoint);
     386       
     387    return isArrowFunction;
    386388}
    387389
     
    528530
    529531template <typename LexerType>
    530 template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseAsyncFunctionSourceElements(TreeBuilder& context, SourceParseMode parseMode, bool isArrowFunctionBodyExpression, SourceElementsMode mode)
    531 {
    532     ASSERT(isAsyncFunctionWrapperParseMode(parseMode));
    533     auto sourceElements = context.createSourceElements();
    534 
    535     unsigned functionKeywordStart = tokenStart();
    536     JSTokenLocation startLocation(tokenLocation());
    537     JSTextPosition start = tokenStartPosition();
    538     unsigned startColumn = tokenColumn();
    539     int functionNameStart = m_token.m_location.startOffset;
    540     int parametersStart = m_token.m_location.startOffset;
    541 
    542     ParserFunctionInfo<TreeBuilder> info;
    543     info.name = &m_vm->propertyNames->nullIdentifier;
    544     createGeneratorParameters(context);
    545     info.startOffset = parametersStart;
    546     info.startLine = tokenLine();
    547     info.parameterCount = 4; // generator, state, value, resume mode
    548     SourceParseMode innerParseMode = parseMode == SourceParseMode::AsyncArrowFunctionMode
    549         ? SourceParseMode::AsyncArrowFunctionBodyMode
    550         : SourceParseMode::AsyncFunctionBodyMode;
    551     {
    552         AutoPopScopeRef asyncFunctionBodyScope(this, pushScope());
    553         asyncFunctionBodyScope->setSourceParseMode(innerParseMode);
    554         SyntaxChecker asyncFunctionContext(const_cast<VM*>(m_vm), m_lexer.get());
    555         if (isArrowFunctionBodyExpression)
    556             failIfFalse(parseArrowFunctionSingleExpressionBodySourceElements(asyncFunctionContext), "Cannot parse the body of async arrow function");
    557         else
    558             failIfFalse(parseSourceElements(asyncFunctionContext, mode), "Cannot parse the body of async function");
    559         popScope(asyncFunctionBodyScope, TreeBuilder::NeedsFreeVariableInfo);
    560     }
    561     info.body = context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, tokenColumn(), functionKeywordStart, functionNameStart, parametersStart, strictMode(), ConstructorKind::None, m_superBinding, info.parameterCount, innerParseMode, isArrowFunctionBodyExpression);
    562 
    563     info.endLine = tokenLine();
    564     info.endOffset = isArrowFunctionBodyExpression ? tokenLocation().endOffset : m_token.m_data.offset;
    565     info.parametersStartColumn = startColumn;
    566 
    567     auto functionExpr = context.createAsyncFunctionBody(startLocation, info, innerParseMode);
    568     auto statement = context.createExprStatement(startLocation, functionExpr, start, m_lastTokenEndPosition.line);
    569     context.appendStatement(sourceElements, statement);
    570 
    571     return sourceElements;
    572 }
    573 
    574 template <typename LexerType>
    575532template <class TreeBuilder> TreeStatement Parser<LexerType>::parseStatementListItem(TreeBuilder& context, const Identifier*& directive, unsigned* directiveLiteralLength)
    576533{
     
    581538    TreeStatement result = 0;
    582539    bool shouldSetEndOffset = true;
    583 
    584540    switch (m_token.m_type) {
    585541    case CONSTTOKEN:
     
    596552            // But we would like to enter parseVariableDeclaration and raise an error under the context of parseVariableDeclaration
    597553            // to raise consistent errors between "var", "const" and "let".
    598             if (!(match(IDENT) || match(LET) || match(YIELD) || match(AWAIT)) && !match(OPENBRACE) && !match(OPENBRACKET))
     554            if (!(match(IDENT) || match(LET) || match(YIELD)) && !match(OPENBRACE) && !match(OPENBRACKET))
    599555                shouldParseVariableDeclaration = false;
    600556            restoreSavePoint(savePoint);
     
    616572        break;
    617573    case IDENT:
    618         // FIXME: This branch contributes to a 1% octane code-load regression.
    619         // https://bugs.webkit.org/show_bug.cgi?id=158211
    620         if (UNLIKELY(*m_token.m_data.ident == m_vm->propertyNames->async)) {
    621             if (m_runtimeFlags.isAsyncAwaitEnabled()) {
    622                 // Eagerly parse as AsyncFunctionDeclaration. This is the uncommon case,
    623                 // but could be mistakenly parsed as an AsyncFunctionExpression.
    624                 SavePoint savePoint = createSavePoint();
    625                 next();
    626                 if (UNLIKELY(match(FUNCTION) && !m_lexer->prevTerminator())) {
    627                     result = parseAsyncFunctionDeclaration(context);
    628                     break;
    629                 }
    630                 restoreSavePoint(savePoint);
    631             }
    632         }
    633         FALLTHROUGH;
    634     case AWAIT:
    635574    case YIELD: {
    636575        // This is a convenient place to notice labeled statements
     
    741680            failIfTrue(match(LET) && (declarationType == DeclarationType::LetDeclaration || declarationType == DeclarationType::ConstDeclaration),
    742681                "Can't use 'let' as an identifier name for a LexicalDeclaration");
    743             semanticFailIfTrue(isDisallowedIdentifierAwait(m_token), "Can't use 'await' as a ", declarationTypeToVariableKind(declarationType), " ", disallowedIdentifierAwaitReason());
    744682            JSTextPosition varStart = tokenStartPosition();
    745683            JSTokenLocation varStartLocation(tokenLocation());
     
    10641002                        failIfTrueIfStrict(isEvalOrArguments, "Cannot modify '", propertyName->impl(), "' in strict mode");
    10651003                    }
    1066                     semanticFailIfTrue(isDisallowedIdentifierAwait(identifierToken), "Can't use 'await' as a ", destructuringKindToVariableKindName(kind), " ", disallowedIdentifierAwaitReason());
    10671004                    innerPattern = createBindingPattern(context, kind, exportType, *propertyName, identifierToken, bindingContext, duplicateIdentifier);
    10681005                }
     
    11331070        }
    11341071        failIfTrue(match(LET) && (kind == DestructuringKind::DestructureToLet || kind == DestructuringKind::DestructureToConst), "Can't use 'let' as an identifier name for a LexicalDeclaration");
    1135         semanticFailIfTrue(isDisallowedIdentifierAwait(m_token), "Can't use 'await' as a ", destructuringKindToVariableKindName(kind), " ", disallowedIdentifierAwaitReason());
    11361072        pattern = createBindingPattern(context, kind, exportType, *m_token.m_data.ident, m_token, bindingContext, duplicateIdentifier);
    11371073        next();
     
    16821618        break;
    16831619    case FUNCTION: {
    1684         const bool isAsync = false;
    1685         result = parseFunctionDeclarationStatement(context, isAsync, parentAllowsFunctionDeclarationAsStatement);
     1620        if (!strictMode()) {
     1621            failIfFalse(parentAllowsFunctionDeclarationAsStatement, "Function declarations are only allowed inside block statements or at the top level of a program");
     1622            if (currentScope()->isFunction()) {
     1623                // Any function declaration that isn't in a block is a syntax error unless it's
     1624                // in an if/else statement. If it's in an if/else statement, we will magically
     1625                // treat it as if the if/else statement is inside a block statement.
     1626                // to the very top like a "var". For example:
     1627                // function a() {
     1628                //     if (cond) function foo() { }
     1629                // }
     1630                // will be rewritten as:
     1631                // function a() {
     1632                //     if (cond) { function foo() { } }
     1633                // }
     1634                AutoPopScopeRef blockScope(this, pushScope());
     1635                blockScope->setIsLexicalScope();
     1636                blockScope->preventVarDeclarations();
     1637                JSTokenLocation location(tokenLocation());
     1638                int start = tokenLine();
     1639
     1640                TreeStatement function = parseFunctionDeclaration(context);
     1641                propagateError();
     1642                failIfFalse(function, "Expected valid function statement after 'function' keyword");
     1643                TreeSourceElements sourceElements = context.createSourceElements();
     1644                context.appendStatement(sourceElements, function);
     1645                result = context.createBlockStatement(location, sourceElements, start, m_lastTokenEndPosition.line, currentScope()->finalizeLexicalEnvironment(), currentScope()->takeFunctionDeclarations());
     1646                popScope(blockScope, TreeBuilder::NeedsFreeVariableInfo);
     1647            } else {
     1648                // We only implement annex B.3.3 if we're in function mode. Otherwise, we fall back
     1649                // to hoisting behavior.
     1650                // FIXME: https://bugs.webkit.org/show_bug.cgi?id=155813
     1651                DepthManager statementDepth(&m_statementDepth);
     1652                m_statementDepth = 1;
     1653                result = parseFunctionDeclaration(context);
     1654            }
     1655        } else
     1656            failWithMessage("Function declarations are only allowed inside blocks or switch statements in strict mode");
    16861657        break;
    16871658    }
     
    17351706        return 0;
    17361707    case IDENT:
    1737         // FIXME: This branch contributes to a 1% octane code-load regression.
    1738         // https://bugs.webkit.org/show_bug.cgi?id=158211
    1739         if (UNLIKELY(*m_token.m_data.ident == m_vm->propertyNames->async)) {
    1740             if (m_runtimeFlags.isAsyncAwaitEnabled()) {
    1741                 SavePoint savePoint = createSavePoint();
    1742                 next();
    1743                 if (match(FUNCTION) && !m_lexer->prevTerminator()) {
    1744                     const bool isAsync = true;
    1745                     result = parseFunctionDeclarationStatement(context, isAsync, parentAllowsFunctionDeclarationAsStatement);
    1746                     break;
    1747                 }
    1748                 restoreSavePoint(savePoint);
    1749             }
    1750         }
    1751         FALLTHROUGH;
    1752     case AWAIT:
    17531708    case YIELD: {
    17541709        bool allowFunctionDeclarationAsStatement = false;
     
    17761731
    17771732template <typename LexerType>
    1778 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDeclarationStatement(TreeBuilder& context, bool isAsync, bool parentAllowsFunctionDeclarationAsStatement)
    1779 {
    1780     semanticFailIfTrue(strictMode(), "Function declarations are only allowed inside blocks or switch statements in strict mode");
    1781     failIfFalse(parentAllowsFunctionDeclarationAsStatement, "Function declarations are only allowed inside block statements or at the top level of a program");
    1782     if (!currentScope()->isFunction()) {
    1783         // We only implement annex B.3.3 if we're in function mode. Otherwise, we fall back
    1784         // to hoisting behavior.
    1785         // FIXME: https://bugs.webkit.org/show_bug.cgi?id=155813
    1786         DepthManager statementDepth(&m_statementDepth);
    1787         m_statementDepth = 1;
    1788         if (isAsync)
    1789             return parseAsyncFunctionDeclaration(context);
    1790         return parseFunctionDeclaration(context);
    1791     }
    1792 
    1793     // Any function declaration that isn't in a block is a syntax error unless it's
    1794     // in an if/else statement. If it's in an if/else statement, we will magically
    1795     // treat it as if the if/else statement is inside a block statement.
    1796     // to the very top like a "var". For example:
    1797     // function a() {
    1798     //     if (cond) function foo() { }
    1799     // }
    1800     // will be rewritten as:
    1801     // function a() {
    1802     //     if (cond) { function foo() { } }
    1803     // }
    1804     AutoPopScopeRef blockScope(this, pushScope());
    1805     blockScope->setIsLexicalScope();
    1806     blockScope->preventVarDeclarations();
    1807     JSTokenLocation location(tokenLocation());
    1808     int start = tokenLine();
    1809 
    1810     TreeStatement function = 0;
    1811     if (!isAsync)
    1812         function = parseFunctionDeclaration(context);
    1813     else
    1814         function = parseAsyncFunctionDeclaration(context);
    1815     propagateError();
    1816     failIfFalse(function, "Expected valid function statement after 'function' keyword");
    1817     TreeSourceElements sourceElements = context.createSourceElements();
    1818     context.appendStatement(sourceElements, function);
    1819     TreeStatement result = context.createBlockStatement(location, sourceElements, start, m_lastTokenEndPosition.line, currentScope()->finalizeLexicalEnvironment(), currentScope()->takeFunctionDeclarations());
    1820     popScope(blockScope, TreeBuilder::NeedsFreeVariableInfo);
    1821     return result;
    1822 }
    1823 
    1824 template <typename LexerType>
    18251733template <class TreeBuilder> bool Parser<LexerType>::parseFormalParameters(TreeBuilder& context, TreeFormalParameterList list, unsigned& parameterCount)
    18261734{
     
    18451753            next();
    18461754            failIfFalse(matchSpecIdentifier(), "Rest parameter '...' should be followed by a variable identifier");
    1847             semanticFailIfTrue(!m_parserState.allowAwait && match(AWAIT), "Can't use 'await' as a parameter name in an async function");
    18481755            declareRestOrNormalParameter(*m_token.m_data.ident, &duplicateParameter);
    18491756            propagateError();
     
    19111818    case SourceParseMode::ArrowFunctionMode:
    19121819        return "arrow function";
    1913     case SourceParseMode::AsyncFunctionMode:
    1914     case SourceParseMode::AsyncFunctionBodyMode:
    1915         return "async function";
    1916     case SourceParseMode::AsyncMethodMode:
    1917         return "async method";
    1918     case SourceParseMode::AsyncArrowFunctionBodyMode:
    1919     case SourceParseMode::AsyncArrowFunctionMode:
    1920         return "async arrow function";
    19211820    case SourceParseMode::ProgramMode:
    19221821    case SourceParseMode::ModuleAnalyzeMode:
     
    19311830template <typename LexerType> template <class TreeBuilder, class FunctionInfoType> typename TreeBuilder::FormalParameterList Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, SourceParseMode mode, FunctionInfoType& functionInfo)
    19321831{
    1933     ASSERT(!(SourceParseModeSet(SourceParseMode::ProgramMode, SourceParseMode::ModuleAnalyzeMode, SourceParseMode::ModuleEvaluateMode).contains(mode)));
     1832    RELEASE_ASSERT(mode != SourceParseMode::ProgramMode && mode != SourceParseMode::ModuleAnalyzeMode && mode != SourceParseMode::ModuleEvaluateMode);
    19341833    TreeFormalParameterList parameterList = context.createFormalParameterList();
    19351834    SetForScope<FunctionParsePhase> functionParsePhasePoisoner(m_parserState.functionParsePhase, FunctionParsePhase::Parameters);
    19361835   
    1937     if (SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode)) {
    1938         if (!matchSpecIdentifier() && !match(OPENPAREN)) {
     1836    if (mode == SourceParseMode::ArrowFunctionMode) {
     1837        if (!match(IDENT) && !match(OPENPAREN)) {
    19391838            semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
    19401839            failWithMessage("Expected an arrow function input parameter");
     
    20271926    RELEASE_ASSERT(isFunctionParseMode(mode));
    20281927
    2029     bool isDisallowedAwaitFunctionName = isDisallowedIdentifierAwait(m_token);
    2030     const char* isDisallowedAwaitFunctionNameReason = isDisallowedAwaitFunctionName ? disallowedIdentifierAwaitReason() : nullptr;
    2031 
     1928    bool upperScopeIsGenerator = currentScope()->isGenerator();
    20321929    AutoPopScopeRef functionScope(this, pushScope());
    20331930    functionScope->setSourceParseMode(mode);
     
    20681965           
    20691966            FunctionBodyType functionBodyType;
    2070             if (SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode))
     1967            if (mode == SourceParseMode::ArrowFunctionMode)
    20711968                functionBodyType = cachedInfo->isBodyArrowExpression ?  ArrowFunctionBodyExpression : ArrowFunctionBodyBlock;
    20721969            else
     
    21112008    SyntaxChecker syntaxChecker(const_cast<VM*>(m_vm), m_lexer.get());
    21122009
    2113     if (SourceParseModeSet(SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode).contains(mode)) {
     2010    if (mode == SourceParseMode::ArrowFunctionMode) {
    21142011        startLocation = tokenLocation();
    21152012        functionInfo.startLine = tokenLine();
    21162013        startColumn = tokenColumn();
     2014
    21172015        parametersStart = m_token.m_location.startOffset;
    21182016        functionInfo.startOffset = parametersStart;
     
    21212019        if (loadCachedFunction())
    21222020            return true;
    2123         {
    2124             SetForScope<bool> overrideAllowAwait(m_parserState.allowAwait, !isAsyncFunctionParseMode(mode));
    2125             parseFunctionParameters(syntaxChecker, mode, functionInfo);
    2126         }
    2127 
     2021        parseFunctionParameters(syntaxChecker, mode, functionInfo);
    21282022        propagateError();
    21292023
     
    21552049        //     function * BindingIdentifier[Yield]opt ( FormalParameters[Yield] ) { GeneratorBody }
    21562050        //
    2157         // The name of FunctionExpression and AsyncFunctionExpression can accept "yield" even in the context of generator.
    2158         bool upperScopeIsGenerator = false;
    2159         if (!(functionDefinitionType == FunctionDefinitionType::Expression && SourceParseModeSet(SourceParseMode::NormalFunctionMode, SourceParseMode::AsyncFunctionMode).contains(mode)))
    2160             upperScopeIsGenerator = upperScope(1)->isGenerator();
     2051        // The name of FunctionExpression can accept "yield" even in the context of generator.
     2052        if (functionDefinitionType == FunctionDefinitionType::Expression && mode == SourceParseMode::NormalFunctionMode)
     2053            upperScopeIsGenerator = false;
    21612054
    21622055        if (matchSpecIdentifier(upperScopeIsGenerator)) {
    2163             bool allowsAwait = functionDefinitionType == FunctionDefinitionType::Declaration || mode != SourceParseMode::AsyncFunctionMode;
    21642056            functionInfo.name = m_token.m_data.ident;
    21652057            m_parserState.lastFunctionName = functionInfo.name;
    2166             if (allowsAwait)
    2167                 semanticFailIfTrue(isDisallowedAwaitFunctionName, "Cannot declare function named 'await' ", isDisallowedAwaitFunctionNameReason);
    2168             else
    2169                 semanticFailIfTrue(isDisallowedAwaitFunctionName, "Cannot declare async function named 'await'");
    2170            
    21712058            next();
    21722059            if (!nameIsInContainingScope)
    21732060                failIfTrueIfStrict(functionScope->declareCallee(functionInfo.name) & DeclarationResult::InvalidStrictMode, "'", functionInfo.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
    21742061        } else if (requirements == FunctionNeedsName) {
    2175             if (match(OPENPAREN)) {
    2176                 semanticFailIfTrue(mode == SourceParseMode::NormalFunctionMode, "Function statements must have a name");
    2177                 semanticFailIfTrue(mode == SourceParseMode::AsyncFunctionMode, "Async function statements must have a name");
    2178             }
     2062            if (match(OPENPAREN) && mode == SourceParseMode::NormalFunctionMode)
     2063                semanticFail("Function statements must have a name");
    21792064            semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
    21802065            failDueToUnexpectedToken();
     
    21922077        if (loadCachedFunction())
    21932078            return true;
    2194         {
    2195             SetForScope<bool> overrideAllowAwait(m_parserState.allowAwait, !isAsyncFunctionParseMode(mode));
    2196             parseFunctionParameters(syntaxChecker, mode, functionInfo);
    2197             propagateError();
    2198         }
     2079        parseFunctionParameters(syntaxChecker, mode, functionInfo);
     2080        propagateError();
    21992081       
    22002082        matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body");
     
    22402122    };
    22412123
    2242     if (UNLIKELY((SourceParseModeSet(SourceParseMode::GeneratorWrapperFunctionMode).contains(mode)) || isAsyncFunctionWrapperParseMode(mode))) {
     2124    if (mode == SourceParseMode::GeneratorWrapperFunctionMode) {
    22432125        AutoPopScopeRef generatorBodyScope(this, pushScope());
    2244         SourceParseMode innerParseMode = SourceParseMode::GeneratorBodyMode;
    2245         if (isAsyncFunctionWrapperParseMode(mode)) {
    2246             innerParseMode = mode == SourceParseMode::AsyncArrowFunctionMode
    2247                 ? SourceParseMode::AsyncArrowFunctionBodyMode
    2248                 : SourceParseMode::AsyncFunctionBodyMode;
    2249         }
    2250         generatorBodyScope->setSourceParseMode(innerParseMode);
     2126        generatorBodyScope->setSourceParseMode(SourceParseMode::GeneratorBodyMode);
    22512127        generatorBodyScope->setConstructorKind(ConstructorKind::None);
    22522128        generatorBodyScope->setExpectedSuperBinding(expectedSuperBinding);
     
    22662142    context.setEndOffset(functionInfo.body, m_lexer->currentOffset());
    22672143    if (functionScope->strictMode() && functionInfo.name) {
    2268         RELEASE_ASSERT((SourceParseModeSet(SourceParseMode::NormalFunctionMode, SourceParseMode::MethodMode, SourceParseMode::ArrowFunctionMode, SourceParseMode::GeneratorBodyMode, SourceParseMode::GeneratorWrapperFunctionMode).contains(mode)) || isAsyncFunctionWrapperParseMode(mode));
     2144        RELEASE_ASSERT(mode == SourceParseMode::NormalFunctionMode || mode == SourceParseMode::MethodMode || mode == SourceParseMode::ArrowFunctionMode || mode == SourceParseMode::GeneratorBodyMode || mode == SourceParseMode::GeneratorWrapperFunctionMode);
    22692145        semanticFailIfTrue(m_vm->propertyNames->arguments == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
    22702146        semanticFailIfTrue(m_vm->propertyNames->eval == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
     
    23532229
    23542230template <typename LexerType>
    2355 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseAsyncFunctionDeclaration(TreeBuilder& context, ExportType exportType)
    2356 {
    2357     ASSERT(match(FUNCTION));
    2358     JSTokenLocation location(tokenLocation());
    2359     unsigned functionKeywordStart = tokenStart();
    2360     next();
    2361     ParserFunctionInfo<TreeBuilder> functionInfo;
    2362     SourceParseMode parseMode = SourceParseMode::AsyncFunctionMode;
    2363 
    2364     failIfFalse((parseFunctionInfo(context, FunctionNeedsName, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Declaration)), "Cannot parse this async function");
    2365     failIfFalse(functionInfo.name, "Async function statements must have a name");
    2366 
    2367     std::pair<DeclarationResultMask, ScopeRef> functionDeclaration = declareFunction(functionInfo.name);
    2368     DeclarationResultMask declarationResult = functionDeclaration.first;
    2369     failIfTrueIfStrict(declarationResult & DeclarationResult::InvalidStrictMode, "Cannot declare an async function named '", functionInfo.name->impl(), "' in strict mode");
    2370     if (declarationResult & DeclarationResult::InvalidDuplicateDeclaration)
    2371         internalFailWithMessage(false, "Cannot declare an async function that shadows a let/const/class/function variable '", functionInfo.name->impl(), "' in strict mode");
    2372     if (exportType == ExportType::Exported) {
    2373         semanticFailIfFalse(exportName(*functionInfo.name), "Cannot export a duplicate function name: '", functionInfo.name->impl(), "'");
    2374         currentScope()->moduleScopeData().exportBinding(*functionInfo.name);
    2375     }
    2376 
    2377     TreeStatement result = context.createFuncDeclStatement(location, functionInfo);
    2378     if (TreeBuilder::CreatesAST)
    2379         functionDeclaration.second->appendFunction(getMetadata(functionInfo));
    2380     return result;
    2381 }
    2382 
    2383 template <typename LexerType>
    23842231template <class TreeBuilder> TreeStatement Parser<LexerType>::parseClassDeclaration(TreeBuilder& context, ExportType exportType)
    23852232{
     
    24792326        bool isSetter = false;
    24802327        bool isGenerator = false;
    2481         bool isAsyncMethod = false;
    24822328        if (consume(TIMES))
    24832329            isGenerator = true;
    2484 
    2485 parseMethod:
    24862330        switch (m_token.m_type) {
    24872331        namedKeyword:
     
    24922336            break;
    24932337        case IDENT:
    2494         case AWAIT:
    24952338            ident = m_token.m_data.ident;
    24962339            ASSERT(ident);
    24972340            next();
    2498             if (!isGenerator && !isAsyncMethod && (matchIdentifierOrKeyword() || match(STRING) || match(DOUBLE) || match(INTEGER) || match(OPENBRACKET))) {
     2341            if (!isGenerator && (matchIdentifierOrKeyword() || match(STRING) || match(DOUBLE) || match(INTEGER) || match(OPENBRACKET))) {
    24992342                isGetter = *ident == propertyNames.get;
    25002343                isSetter = *ident == propertyNames.set;
    2501                 if (UNLIKELY(!isAsyncMethod && *ident == propertyNames.async && !m_lexer->prevTerminator())) {
    2502                     if (m_runtimeFlags.isAsyncAwaitEnabled()) {
    2503                         isAsyncMethod = true;
    2504                         goto parseMethod;
    2505                     }
    2506                 }
    25072344            }
    25082345            break;
     
    25362373            bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor;
    25372374            SourceParseMode parseMode = SourceParseMode::MethodMode;
    2538             if (isAsyncMethod) {
    2539                 isConstructor = false;
    2540                 parseMode = SourceParseMode::AsyncMethodMode;
    2541                 semanticFailIfTrue(*ident == m_vm->propertyNames->prototype, "Cannot declare an async method named 'prototype'");
    2542                 semanticFailIfTrue(*ident == m_vm->propertyNames->constructor, "Cannot declare an async method named 'constructor'");
    2543             } else if (isGenerator) {
     2375            if (isGenerator) {
    25442376                isConstructor = false;
    25452377                parseMode = SourceParseMode::GeneratorWrapperFunctionMode;
     
    26242456            return context.createExprStatement(location, expression, start, m_lastTokenEndPosition.line);
    26252457        }
    2626         // FIXME: This branch contributes to a 1% octane code-load regression.
    2627         // https://bugs.webkit.org/show_bug.cgi?id=158211
    2628         if (UNLIKELY(match(AWAIT)))
    2629             semanticFailIfTrue(isDisallowedIdentifierAwait(m_token), "Can't use 'await' as a label ", disallowedIdentifierAwaitReason());
    26302458        const Identifier* ident = m_token.m_data.ident;
    26312459        JSTextPosition end = tokenEndPosition();
     
    28242652        next();
    28252653
    2826         failIfFalse(matchSpecIdentifier(), "Expected a variable name for the import declaration");
     2654        matchOrFail(IDENT, "Expected a variable name for the import declaration");
    28272655        localNameToken = m_token;
    28282656        localName = m_token.m_data.ident;
     
    28462674        if (matchContextualKeyword(m_vm->propertyNames->as)) {
    28472675            next();
    2848             failIfFalse(matchSpecIdentifier(), "Expected a variable name for the import declaration");
     2676            matchOrFail(IDENT, "Expected a variable name for the import declaration");
    28492677            localNameToken = m_token;
    28502678            localName = m_token.m_data.ident;
     
    28572685        // ImportedDefaultBinding :
    28582686        // ImportedBinding
    2859         ASSERT(matchSpecIdentifier());
     2687        ASSERT(match(IDENT));
    28602688        localNameToken = m_token;
    28612689        localName = m_token.m_data.ident;
     
    28662694    }
    28672695
    2868     semanticFailIfTrue(localNameToken.m_type == AWAIT, "Cannot use 'await' as an imported binding name");
    28692696    semanticFailIfTrue(localNameToken.m_type & KeywordTokenFlag, "Cannot use keyword as imported binding name");
    28702697    DeclarationResultMask declarationResult = declareVariable(localName, DeclarationType::ConstDeclaration, (specifierType == ImportSpecifierType::NamespaceImport) ? DeclarationImportType::ImportedNamespace : DeclarationImportType::Imported);
     
    28972724
    28982725    bool isFinishedParsingImport = false;
    2899     if (matchSpecIdentifier()) {
     2726    if (match(IDENT)) {
    29002727        // ImportedDefaultBinding :
    29012728        // ImportedBinding
     
    30072834        bool isFunctionOrClassDeclaration = false;
    30082835        const Identifier* localName = nullptr;
    3009         bool isAsyncFunctionExport = false;
    30102836        SavePoint savePoint = createSavePoint();
    3011 
    3012         if (UNLIKELY(matchContextualKeyword(m_vm->propertyNames->async))) {
    3013             if (m_runtimeFlags.isAsyncAwaitEnabled()) {
    3014                 next();
    3015                 if (UNLIKELY(match(FUNCTION) && !m_lexer->prevTerminator()))
    3016                     isAsyncFunctionExport = true;
    3017                 else
    3018                     restoreSavePoint(savePoint);
    3019             }
    3020         }
    30212837
    30222838        bool startsWithFunction = match(FUNCTION);
     
    30372853                DepthManager statementDepth(&m_statementDepth);
    30382854                m_statementDepth = 1;
    3039                 if (UNLIKELY(isAsyncFunctionExport)) {
    3040                     ASSERT(m_runtimeFlags.isAsyncAwaitEnabled());
    3041                     result = parseAsyncFunctionDeclaration(context);
    3042                 } else
    3043                     result = parseFunctionDeclaration(context);
     2855                result = parseFunctionDeclaration(context);
    30442856            } else {
    30452857                ASSERT(match(CLASSTOKEN));
     
    30562868            // In the above example, *default* is the invisible variable to the users.
    30572869            // We use the private symbol to represent the name of this variable.
    3058             ExpressionErrorClassifier classifier(this);
    30592870            JSTokenLocation location(tokenLocation());
    30602871            JSTextPosition start = tokenStartPosition();
    30612872            TreeExpression expression = parseAssignmentExpression(context);
    3062 
    30632873            failIfFalse(expression, "Cannot parse expression");
    30642874
     
    31632973
    31642974        default:
    3165             if (UNLIKELY(matchContextualKeyword(m_vm->propertyNames->async))) {
    3166                 if (m_runtimeFlags.isAsyncAwaitEnabled()) {
    3167                     next();
    3168                     semanticFailIfFalse(match(FUNCTION) && !m_lexer->prevTerminator(), "Expected 'function' keyword following 'async' keyword with no preceding line terminator");
    3169                     result = parseAsyncFunctionDeclaration(context, ExportType::Exported);
    3170                     break;
    3171                 }
    3172             }
    3173 
    31742975            failWithMessage("Expected either a declaration or a variable statement");
    31752976            break;
     
    32363037   
    32373038    failIfStackOverflow();
    3238 
    3239     if (match(YIELD) && !isYIELDMaskedAsIDENT(currentScope()->isGenerator()))
    3240         return parseYieldExpression(context);
    3241 
    32423039    JSTextPosition start = tokenStartPosition();
    32433040    JSTokenLocation location(tokenLocation());
     
    32463043    bool maybeAssignmentPattern = match(OPENBRACE) || match(OPENBRACKET);
    32473044    bool wasOpenParen = match(OPENPAREN);
    3248     // Do not use matchSpecIdentifier() here since it is slower than isIdentifierOrKeyword.
    3249     // Whether spec identifier is will be validated by isArrowFunctionParameters().
    3250     bool wasIdentifierOrKeyword = isIdentifierOrKeyword(m_token);
    3251     bool maybeValidArrowFunctionStart = wasOpenParen || wasIdentifierOrKeyword;
     3045    bool isValidArrowFunctionStart = match(OPENPAREN) || match(IDENT);
    32523046    SavePoint savePoint = createSavePoint();
    32533047    size_t usedVariablesSize = 0;
    3254 
    3255     // FIXME: This branch contributes to a 1% octane code-load regression.
    3256     // https://bugs.webkit.org/show_bug.cgi?id=158211
    3257     if (wasOpenParen || (wasIdentifierOrKeyword && m_runtimeFlags.isAsyncAwaitEnabled() && UNLIKELY(*m_token.m_data.ident == m_vm->propertyNames->async))) {
     3048    if (wasOpenParen) {
    32583049        usedVariablesSize = currentScope()->currentUsedVariablesSize();
    32593050        currentScope()->pushUsedVariableSet();
    32603051    }
    32613052
     3053    if (match(YIELD) && !isYIELDMaskedAsIDENT(currentScope()->isGenerator()))
     3054        return parseYieldExpression(context);
     3055
    32623056    TreeExpression lhs = parseConditionalExpression(context);
    32633057
    3264     if (maybeValidArrowFunctionStart && !match(EOFTOK)) {
     3058    if (isValidArrowFunctionStart && !match(EOFTOK)) {
    32653059        bool isArrowFunctionToken = match(ARROWFUNCTION);
    32663060        if (!lhs || isArrowFunctionToken) {
    32673061            SavePointWithError errorRestorationSavePoint = createSavePointForError();
    32683062            restoreSavePoint(savePoint);
    3269             bool isAsyncArrow = false;
    3270             if (UNLIKELY(classifier.indicatesPossibleAsyncArrowFunction())) {
    3271                 ASSERT(m_runtimeFlags.isAsyncAwaitEnabled());
    3272                 ASSERT(matchContextualKeyword(m_vm->propertyNames->async));
    3273                 next();
    3274                 isAsyncArrow = !m_lexer->prevTerminator();
    3275             }
    32763063            if (isArrowFunctionParameters()) {
    3277                 if (wasOpenParen || isAsyncArrow)
     3064                if (wasOpenParen)
    32783065                    currentScope()->revertToPreviousUsedVariables(usedVariablesSize);
    3279                 return parseArrowFunctionExpression(context, isAsyncArrow);
     3066                return parseArrowFunctionExpression(context);
    32803067            }
    32813068            restoreSavePointWithError(errorRestorationSavePoint);
     
    33963183        return context.createYield(location);
    33973184    }
    3398     return context.createYield(location, argument, delegate, divotStart, argumentStart, lastTokenEndPosition());
    3399 }
    3400 
    3401 template <typename LexerType>
    3402 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseAwaitExpression(TreeBuilder& context)
    3403 {
    3404     // AwaitExpression desugared to YieldExpression
    3405     ASSERT(match(AWAIT));
    3406     ASSERT(currentScope()->isAsyncFunction());
    3407     failIfTrue(m_parserState.functionParsePhase == FunctionParsePhase::Parameters, "Cannot use await expression within parameters");
    3408     JSTokenLocation location(tokenLocation());
    3409     JSTextPosition divotStart = tokenStartPosition();
    3410     next();
    3411     JSTextPosition argumentStart = tokenStartPosition();
    3412     TreeExpression argument = parseUnaryExpression(context);
    3413     failIfFalse(argument, "Failed to parse await expression");
    3414     const bool delegate = false;
    34153185    return context.createYield(location, argument, delegate, divotStart, argumentStart, lastTokenEndPosition());
    34163186}
     
    35023272    bool isGenerator = false;
    35033273    bool isClassProperty = false;
    3504     bool isAsyncMethod = false;
    35053274    if (consume(TIMES))
    35063275        isGenerator = true;
    3507 
    3508 parseProperty:
    35093276    switch (m_token.m_type) {
    35103277    namedProperty:
    35113278    case IDENT:
    3512     case AWAIT:
    35133279        wasIdent = true;
    35143280        FALLTHROUGH;
     
    35163282        const Identifier* ident = m_token.m_data.ident;
    35173283        unsigned getterOrSetterStartOffset = tokenStart();
    3518         if (complete || (wasIdent && !isGenerator && (*ident == m_vm->propertyNames->get || *ident == m_vm->propertyNames->set || *ident == m_vm->propertyNames->async)))
     3284        if (complete || (wasIdent && !isGenerator && (*ident == m_vm->propertyNames->get || *ident == m_vm->propertyNames->set)))
    35193285            nextExpectIdentifier(LexerFlagsIgnoreReservedWords);
    35203286        else
    35213287            nextExpectIdentifier(LexerFlagsIgnoreReservedWords | TreeBuilder::DontBuildKeywords);
    35223288
    3523         if (!isGenerator && !isAsyncMethod && match(COLON)) {
     3289        if (!isGenerator && match(COLON)) {
    35243290            next();
    35253291            TreeExpression node = parseAssignmentExpressionOrPropagateErrorClass(context);
     
    35303296
    35313297        if (match(OPENPAREN)) {
    3532             auto method = parsePropertyMethod(context, ident, isGenerator, isAsyncMethod);
     3298            auto method = parsePropertyMethod(context, ident, isGenerator);
    35333299            propagateError();
    35343300            return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty);
    35353301        }
    3536 
    3537         failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list");
     3302        failIfTrue(isGenerator, "Expected a parenthesis for argument list");
    35383303
    35393304        failIfFalse(wasIdent, "Expected an identifier as property name");
     
    35573322        else if (*ident == m_vm->propertyNames->set)
    35583323            type = PropertyNode::Setter;
    3559         else if (UNLIKELY(m_runtimeFlags.isAsyncAwaitEnabled() && !isGenerator && !isAsyncMethod && *ident == m_vm->propertyNames->async)) {
    3560             isAsyncMethod = true;
    3561             failIfTrue(m_lexer->prevTerminator(), "Expected a property name following keyword 'async'");
    3562             goto parseProperty;
    3563         } else
     3324        else
    35643325            failWithMessage("Expected a ':' following the property name '", ident->impl(), "'");
    35653326        return parseGetterSetter(context, complete, type, getterOrSetterStartOffset, ConstructorKind::None, isClassProperty);
     
    35723333        if (match(OPENPAREN)) {
    35733334            const Identifier& ident = m_parserArena.identifierArena().makeNumericIdentifier(const_cast<VM*>(m_vm), propertyName);
    3574             auto method = parsePropertyMethod(context, &ident, isGenerator, isAsyncMethod);
     3335            auto method = parsePropertyMethod(context, &ident, isGenerator);
    35753336            propagateError();
    35763337            return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::Needed, isClassProperty);
    35773338        }
    3578         failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list");
     3339        failIfTrue(isGenerator, "Expected a parenthesis for argument list");
    35793340
    35803341        consumeOrFail(COLON, "Expected ':' after property name");
     
    35913352
    35923353        if (match(OPENPAREN)) {
    3593             auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator, isAsyncMethod);
     3354            auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator);
    35943355            propagateError();
    35953356            return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty);
    35963357        }
    3597         failIfTrue(isGenerator || isAsyncMethod, "Expected a parenthesis for argument list");
     3358        failIfTrue(isGenerator, "Expected a parenthesis for argument list");
    35983359
    35993360        consumeOrFail(COLON, "Expected ':' after property name");
     
    36103371
    36113372template <typename LexerType>
    3612 template <class TreeBuilder> TreeExpression Parser<LexerType>::parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator, bool isAsync)
     3373template <class TreeBuilder> TreeExpression Parser<LexerType>::parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator)
    36133374{
    36143375    JSTokenLocation methodLocation(tokenLocation());
    36153376    unsigned methodStart = tokenStart();
    36163377    ParserFunctionInfo<TreeBuilder> methodInfo;
    3617     SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : isAsync ? SourceParseMode::AsyncMethodMode : SourceParseMode::MethodMode;
     3378    SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : SourceParseMode::MethodMode;
    36183379    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method");
    36193380    methodInfo.name = methodName;
     
    38733634
    38743635template <typename LexerType>
    3875 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseAsyncFunctionExpression(TreeBuilder& context)
    3876 {
    3877     ASSERT(match(FUNCTION));
    3878     JSTokenLocation location(tokenLocation());
    3879     unsigned functionKeywordStart = tokenStart();
    3880     next();
    3881     ParserFunctionInfo<TreeBuilder> functionInfo;
    3882     functionInfo.name = &m_vm->propertyNames->nullIdentifier;
    3883     SourceParseMode parseMode = SourceParseMode::AsyncFunctionMode;
    3884     failIfFalse(parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Expression), "Cannot parse async function expression");
    3885     return context.createFunctionExpr(location, functionInfo);
    3886 }
    3887 
    3888 template <typename LexerType>
    38893636template <class TreeBuilder> typename TreeBuilder::TemplateString Parser<LexerType>::parseTemplateString(TreeBuilder& context, bool isTemplateHead, typename LexerType::RawStringsBuildMode rawStringsBuildMode, bool& elementIsTail)
    38903637{
     
    39763723        return context.createThisExpr(location);
    39773724    }
    3978     case AWAIT:
    39793725    case IDENT: {
    39803726    identifierExpression:
     
    39833729        JSTokenLocation location(tokenLocation());
    39843730        next();
    3985         // FIXME: This branch contributes to a 1% octane code-load regression.
    3986         // https://bugs.webkit.org/show_bug.cgi?id=158211
    3987         if (UNLIKELY(match(FUNCTION) && !m_lexer->prevTerminator() && *ident == m_vm->propertyNames->async)) {
    3988             if (m_runtimeFlags.isAsyncAwaitEnabled())
    3989                 return parseAsyncFunctionExpression(context);
    3990         }
     3731        if (UNLIKELY(match(ARROWFUNCTION)))
     3732            return 0;
    39913733        currentScope()->useVariable(ident, m_vm->propertyNames->eval == *ident);
    39923734        m_parserState.lastIdentifier = ident;
     
    41643906    }
    41653907
    4166     bool baseIsAsyncKeyword = false;
    41673908    if (baseIsSuper) {
    41683909        ScopeRef closestOrdinaryFunctionScope = closestParentOrdinaryFunctionNonLexicalScope();
     
    41823923            }
    41833924        }
    4184     } else if (!baseIsNewTarget) {
    4185         // FIXME: This branch contributes to a 1% octane code-load regression.
    4186         // https://bugs.webkit.org/show_bug.cgi?id=158211
    4187         const bool isAsync = matchContextualKeyword(m_vm->propertyNames->async);
     3925    } else if (!baseIsNewTarget)
    41883926        base = parsePrimaryExpression(context);
    4189         failIfFalse(base, "Cannot parse base expression");
    4190         if (UNLIKELY(m_runtimeFlags.isAsyncAwaitEnabled() && isAsync && context.isResolve(base) && !m_lexer->prevTerminator())) {
    4191             if (matchSpecIdentifier()) {
    4192                 // AsyncArrowFunction
    4193                 forceClassifyExpressionError(ErrorIndicatesAsyncArrowFunction);
    4194                 return 0;
    4195             }
    4196             baseIsAsyncKeyword = true;
    4197         }
    4198     }
    41993927
    42003928    failIfFalse(base, "Cannot parse base expression");
    4201 
    42023929    while (true) {
    42033930        location = tokenLocation();
     
    42323959                JSTextPosition expressionEnd = lastTokenEndPosition();
    42333960                TreeArguments arguments = parseArguments(context);
    4234                 if (UNLIKELY(baseIsAsyncKeyword && (!arguments || match(ARROWFUNCTION))))
    4235                     forceClassifyExpressionError(ErrorIndicatesAsyncArrowFunction);
    42363961                failIfFalse(arguments, "Cannot parse call arguments");
    42373962                if (baseIsSuper) {
     
    42924017
    42934018template <typename LexerType>
    4294 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context, bool isAsync)
     4019template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context)
    42954020{
    42964021    JSTokenLocation location;
     
    43004025    ParserFunctionInfo<TreeBuilder> info;
    43014026    info.name = &m_vm->propertyNames->nullIdentifier;
    4302     SourceParseMode parseMode = isAsync ? SourceParseMode::AsyncArrowFunctionMode : SourceParseMode::ArrowFunctionMode;
    4303 
    4304     failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, FunctionDefinitionType::Expression)), "Cannot parse arrow function expression");
     4027    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::ArrowFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, FunctionDefinitionType::Expression)), "Cannot parse arrow function expression");
    43054028
    43064029    return context.createArrowFunctionExpr(location, info);
     
    43464069    bool requiresLExpr = false;
    43474070    unsigned lastOperator = 0;
    4348 
    4349     // FIXME: This branch contributes to a 1% octane code-load regression.
    4350     // https://bugs.webkit.org/show_bug.cgi?id=158211
    4351     if (UNLIKELY(match(AWAIT))) {
    4352         if (m_runtimeFlags.isAsyncAwaitEnabled() && currentFunctionScope()->isAsyncFunction())
    4353             return parseAwaitExpression(context);
    4354     }
    4355 
    43564071    while (isUnaryOp(m_token.m_type)) {
    43574072        if (strictMode()) {
     
    45344249        out.print("Invalid private name '", getToken(), "'");
    45354250        return;
    4536 
     4251           
    45374252    case IDENT:
    45384253        out.print("Unexpected identifier '", getToken(), "'");
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r201523 r201542  
    3434#include "ParserFunctionInfo.h"
    3535#include "ParserTokens.h"
    36 #include "RuntimeFlags.h"
    3736#include "SourceProvider.h"
    3837#include "SourceProviderCache.h"
     
    155154
    156155public:
    157     Scope(const VM* vm, bool isFunction, bool isGenerator, bool strictMode, bool isArrowFunction, bool isAsyncFunction)
     156    Scope(const VM* vm, bool isFunction, bool isGenerator, bool strictMode, bool isArrowFunction)
    158157        : m_vm(vm)
    159158        , m_shadowsArguments(false)
     
    170169        , m_isArrowFunction(isArrowFunction)
    171170        , m_isArrowFunctionBoundary(false)
    172         , m_isAsyncFunction(isAsyncFunction)
    173         , m_isAsyncFunctionBoundary(false)
    174171        , m_isLexicalScope(false)
    175172        , m_isFunctionBoundary(false)
     
    259256    {
    260257        switch (mode) {
    261         case SourceParseMode::AsyncArrowFunctionBodyMode:
    262             setIsAsyncArrowFunctionBody();
    263             break;
    264 
    265         case SourceParseMode::AsyncFunctionBodyMode:
    266             setIsAsyncFunctionBody();
    267             break;
    268 
    269258        case SourceParseMode::GeneratorBodyMode:
    270259            setIsGenerator();
     
    286275            break;
    287276
    288         case SourceParseMode::AsyncFunctionMode:
    289         case SourceParseMode::AsyncMethodMode:
    290             setIsAsyncFunction();
    291             break;
    292 
    293         case SourceParseMode::AsyncArrowFunctionMode:
    294             setIsAsyncArrowFunction();
    295             break;
    296 
    297277        case SourceParseMode::ProgramMode:
    298278            break;
     
    309289    bool isGenerator() const { return m_isGenerator; }
    310290    bool isGeneratorBoundary() const { return m_isGeneratorBoundary; }
    311     bool isAsyncFunction() const { return m_isAsyncFunction; }
    312     bool isAsyncFunctionBoundary() const { return m_isAsyncFunctionBoundary; }
    313291
    314292    bool hasArguments() const { return m_hasArguments; }
     
    338316        ASSERT(m_moduleScopeData);
    339317        return *m_moduleScopeData;
    340     }
    341 
    342     bool isModule() const
    343     {
    344         return !!m_moduleScopeData;
    345318    }
    346319
     
    727700        m_isArrowFunctionBoundary = false;
    728701        m_isArrowFunction = false;
    729         m_isAsyncFunctionBoundary = false;
    730         m_isAsyncFunction = false;
    731702    }
    732703
     
    750721        m_isArrowFunctionBoundary = true;
    751722        m_isArrowFunction = true;
    752     }
    753 
    754     void setIsAsyncArrowFunction()
    755     {
    756         setIsArrowFunction();
    757         m_isAsyncFunction = true;
    758     }
    759 
    760     void setIsAsyncFunction()
    761     {
    762         setIsFunction();
    763         m_isAsyncFunction = true;
    764     }
    765 
    766     void setIsAsyncFunctionBody()
    767     {
    768         setIsFunction();
    769         m_hasArguments = false;
    770         m_isAsyncFunction = true;
    771         m_isAsyncFunctionBoundary = true;
    772     }
    773 
    774     void setIsAsyncArrowFunctionBody()
    775     {
    776         setIsArrowFunction();
    777         m_hasArguments = false;
    778         m_isAsyncFunction = true;
    779         m_isAsyncFunctionBoundary = true;
    780723    }
    781724
     
    799742    bool m_isArrowFunction;
    800743    bool m_isArrowFunctionBoundary;
    801     bool m_isAsyncFunction;
    802     bool m_isAsyncFunctionBoundary;
    803744    bool m_isLexicalScope;
    804745    bool m_isFunctionBoundary;
     
    874815
    875816public:
    876     Parser(VM*, RuntimeFlags, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, SourceParseMode, SuperBinding, ConstructorKind defaultConstructorKind = ConstructorKind::None, DerivedContextType = DerivedContextType::None, bool isEvalContext = false, EvalContextType = EvalContextType::None);
     817    Parser(VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, SourceParseMode, SuperBinding, ConstructorKind defaultConstructorKind = ConstructorKind::None, DerivedContextType = DerivedContextType::None, bool isEvalContext = false, EvalContextType = EvalContextType::None);
    877818    ~Parser();
    878819
     
    963904
    964905    enum ExpressionErrorClass {
    965         ErrorIndicatesNothing = 0,
    966         ErrorIndicatesPattern,
    967         ErrorIndicatesAsyncArrowFunction
     906        ErrorIndicatesNothing,
     907        ErrorIndicatesPattern
    968908    };
    969909
     
    989929        }
    990930
    991         void forceClassifyExpressionError(ExpressionErrorClass classification)
    992         {
    993             m_class = classification;
    994         }
    995 
    996931        void reclassifyExpressionError(ExpressionErrorClass oldClassification, ExpressionErrorClass classification)
    997932        {
     
    1003938        void propagateExpressionErrorClass()
    1004939        {
    1005             if (m_previous)
     940            if (m_previous && m_class != ErrorIndicatesNothing)
    1006941                m_previous->m_class = m_class;
    1007942        }
    1008943
    1009944        bool indicatesPossiblePattern() const { return m_class == ErrorIndicatesPattern; }
    1010         bool indicatesPossibleAsyncArrowFunction() const { return m_class == ErrorIndicatesAsyncArrowFunction; }
     945
    1011946    private:
    1012947        ExpressionErrorClass m_class;
     
    1019954        if (m_expressionErrorClassifier)
    1020955            m_expressionErrorClassifier->classifyExpressionError(classification);
    1021     }
    1022 
    1023     ALWAYS_INLINE void forceClassifyExpressionError(ExpressionErrorClass classification)
    1024     {
    1025         if (m_expressionErrorClassifier)
    1026             m_expressionErrorClassifier->forceClassifyExpressionError(classification);
    1027956    }
    1028957
     
    1048977    }
    1049978
    1050     ALWAYS_INLINE const char* declarationTypeToVariableKind(DeclarationType type)
    1051     {
    1052         switch (type) {
    1053         case DeclarationType::VarDeclaration:
    1054             return "variable name";
    1055         case DeclarationType::LetDeclaration:
    1056         case DeclarationType::ConstDeclaration:
    1057             return "lexical variable name";
    1058         }
    1059         RELEASE_ASSERT_NOT_REACHED();
    1060         return "invalid";
    1061     }
    1062 
    1063979    ALWAYS_INLINE AssignmentContext assignmentContextFromDeclarationType(DeclarationType type)
    1064980    {
     
    1073989    ALWAYS_INLINE bool isEvalOrArguments(const Identifier* ident) { return isEvalOrArgumentsIdentifier(m_vm, ident); }
    1074990
    1075     ScopeRef upperScope(unsigned n)
    1076     {
    1077         ASSERT(m_scopeStack.size() >= (1 + n));
    1078         return ScopeRef(&m_scopeStack, m_scopeStack.size() - 1 - n);
    1079     }
    1080 
    1081991    ScopeRef currentScope()
    1082992    {
     
    11231033        unsigned i = m_scopeStack.size() - 1;
    11241034        ASSERT(i < m_scopeStack.size() && m_scopeStack.size());
    1125         while (i && (!m_scopeStack[i].isFunctionBoundary() || m_scopeStack[i].isGeneratorBoundary() || m_scopeStack[i].isArrowFunctionBoundary() || m_scopeStack[i].isAsyncFunctionBoundary()))
     1035        while (i && (!m_scopeStack[i].isFunctionBoundary() || m_scopeStack[i].isGeneratorBoundary() || m_scopeStack[i].isArrowFunctionBoundary()))
    11261036            i--;
    11271037        // When reaching the top level scope (it can be non ordinary function scope), we return it.
     
    11351045        bool isGenerator = false;
    11361046        bool isArrowFunction = false;
    1137         bool isAsyncFunction = false;
    11381047        if (!m_scopeStack.isEmpty()) {
    11391048            isStrict = m_scopeStack.last().strictMode();
     
    11411050            isGenerator = m_scopeStack.last().isGenerator();
    11421051            isArrowFunction = m_scopeStack.last().isArrowFunction();
    1143             isAsyncFunction = m_scopeStack.last().isAsyncFunction();
    1144         }
    1145         m_scopeStack.constructAndAppend(m_vm, isFunction, isGenerator, isStrict, isArrowFunction, isAsyncFunction);
     1052        }
     1053        m_scopeStack.constructAndAppend(m_vm, isFunction, isGenerator, isStrict, isArrowFunction);
    11461054        return currentScope();
    11471055    }
     
    11551063        if (m_scopeStack.last().isArrowFunction())
    11561064            m_scopeStack.last().setInnerArrowFunctionUsesEvalAndUseArgumentsIfNeeded();
    1157 
     1065       
    11581066        if (!(m_scopeStack.last().isFunctionBoundary() && !m_scopeStack.last().isArrowFunctionBoundary()))
    11591067            m_scopeStack[m_scopeStack.size() - 2].mergeInnerArrowFunctionFeatures(m_scopeStack.last().innerArrowFunctionFeatures());
     
    14521360    ALWAYS_INLINE bool matchSpecIdentifier(bool inGenerator)
    14531361    {
    1454         return match(IDENT) || match(AWAIT) || isLETMaskedAsIDENT() || isYIELDMaskedAsIDENT(inGenerator);
    1455     }
    1456 
    1457     // http://ecma-international.org/ecma-262/6.0/#sec-generator-function-definitions-static-semantics-early-errors
     1362        return match(IDENT) || isLETMaskedAsIDENT() || isYIELDMaskedAsIDENT(inGenerator);
     1363    }
     1364
    14581365    ALWAYS_INLINE bool matchSpecIdentifier()
    14591366    {
    1460         return match(IDENT) || match(AWAIT) || isLETMaskedAsIDENT() || isYIELDMaskedAsIDENT(currentScope()->isGenerator());
     1367        return matchSpecIdentifier(currentScope()->isGenerator());
    14611368    }
    14621369
    14631370    template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode);
    14641371    template <class TreeBuilder> TreeSourceElements parseGeneratorFunctionSourceElements(TreeBuilder&, SourceElementsMode);
    1465     template <class TreeBuilder> TreeSourceElements parseAsyncFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode);
    14661372    template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength);
    14671373    template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0);
     
    14691375    template <class TreeBuilder> TreeStatement parseClassDeclaration(TreeBuilder&, ExportType = ExportType::NotExported);
    14701376    template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported);
    1471     template <class TreeBuilder> TreeStatement parseFunctionDeclarationStatement(TreeBuilder&, bool isAsync, bool parentAllowsFunctionDeclarationAsStatement);
    1472     template <class TreeBuilder> TreeStatement parseAsyncFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported);
    14731377    template <class TreeBuilder> TreeStatement parseVariableDeclaration(TreeBuilder&, DeclarationType, ExportType = ExportType::NotExported);
    14741378    template <class TreeBuilder> TreeStatement parseDoWhileStatement(TreeBuilder&);
     
    14971401    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseBinaryExpression(TreeBuilder&);
    14981402    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseUnaryExpression(TreeBuilder&);
    1499     template <class TreeBuilder> NEVER_INLINE TreeExpression parseAwaitExpression(TreeBuilder&);
    15001403    template <class TreeBuilder> TreeExpression parseMemberExpression(TreeBuilder&);
    15011404    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parsePrimaryExpression(TreeBuilder&);
     
    15041407    template <class TreeBuilder> NEVER_INLINE TreeExpression parseStrictObjectLiteral(TreeBuilder&);
    15051408    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseFunctionExpression(TreeBuilder&);
    1506     template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseAsyncFunctionExpression(TreeBuilder&);
    15071409    template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&);
    15081410    template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseArgument(TreeBuilder&, ArgumentType&);
    15091411    template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict);
    1510     template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator, bool isAsyncMethod);
     1412    template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator);
    15111413    template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty);
    15121414    template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, SyntaxChecker&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, SourceParseMode);
     
    15151417    template <class TreeBuilder> TreeExpression parseVariableDeclarationList(TreeBuilder&, int& declarations, TreeDestructuringPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext, DeclarationType, ExportType, bool& forLoopConstDoesNotHaveInitializer);
    15161418    template <class TreeBuilder> TreeSourceElements parseArrowFunctionSingleExpressionBodySourceElements(TreeBuilder&);
    1517     template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder&, bool isAsync);
     1419    template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder&);
    15181420    template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern createBindingPattern(TreeBuilder&, DestructuringKind, ExportType, const Identifier&, JSToken, AssignmentContext, const Identifier** duplicateIdentifier);
    15191421    template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern createAssignmentElement(TreeBuilder&, TreeExpression&, const JSTextPosition&, const JSTextPosition&);
     
    15731475    }
    15741476
    1575     bool isDisallowedIdentifierAwait(const JSToken& token)
    1576     {
    1577         return token.m_type == AWAIT && (!m_parserState.allowAwait || currentScope()->isAsyncFunctionBoundary() || currentScope()->isModule());
    1578     }
    1579 
    1580     const char* disallowedIdentifierAwaitReason()
    1581     {
    1582         if (!m_parserState.allowAwait || currentScope()->isAsyncFunctionBoundary())
    1583             return "in an async function";
    1584         if (currentScope()->isModule())
    1585             return "in a module";
    1586         RELEASE_ASSERT_NOT_REACHED();
    1587         return nullptr;
    1588     }
    1589 
    15901477    enum class FunctionParsePhase { Parameters, Body };
    15911478    struct ParserState {
     
    15961483        const Identifier* lastIdentifier { nullptr };
    15971484        const Identifier* lastFunctionName { nullptr };
    1598         bool allowAwait { true };
    15991485    };
    16001486
     
    17071593    String m_errorMessage;
    17081594    JSToken m_token;
    1709     RuntimeFlags m_runtimeFlags;
    17101595    bool m_allowsIn;
    17111596    JSTextPosition m_lastTokenEndPosition;
     
    18401725template <class ParsedNode>
    18411726std::unique_ptr<ParsedNode> parse(
    1842     VM* vm, RuntimeFlags runtimeFlags, const SourceCode& source,
     1727    VM* vm, const SourceCode& source,
    18431728    const Identifier& name, JSParserBuiltinMode builtinMode,
    18441729    JSParserStrictMode strictMode, SourceParseMode parseMode, SuperBinding superBinding,
     
    18481733    ASSERT(!source.provider()->source().isNull());
    18491734    if (source.provider()->source().is8Bit()) {
    1850         Parser<Lexer<LChar>> parser(vm, runtimeFlags, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
     1735        Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
    18511736        std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
    18521737        if (positionBeforeLastNewline)
     
    18591744    }
    18601745    ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string");
    1861     Parser<Lexer<UChar>> parser(vm, runtimeFlags, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
     1746    Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType);
    18621747    std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
    18631748    if (positionBeforeLastNewline)
  • trunk/Source/JavaScriptCore/parser/ParserModes.h

    r201523 r201542  
    2828#define ParserModes_h
    2929
    30 #include "ConstructAbility.h"
    3130#include "Identifier.h"
    3231
     
    4443enum class FunctionMode { FunctionExpression, FunctionDeclaration, MethodDefinition };
    4544
    46 // When you add a new source parse mode, do not forget to ensure that the predicates defined in this
    47 // file work with the newly added mode.
    48 enum class SourceParseMode : uint16_t {
    49     NormalFunctionMode            = 0b0000000000000001,
    50     GeneratorBodyMode             = 0b0000000000000010,
    51     GeneratorWrapperFunctionMode  = 0b0000000000000100,
    52     GetterMode                    = 0b0000000000001000,
    53     SetterMode                    = 0b0000000000010000,
    54     MethodMode                    = 0b0000000000100000,
    55     ArrowFunctionMode             = 0b0000000001000000,
    56     AsyncFunctionBodyMode         = 0b0000000010000000,
    57     AsyncArrowFunctionBodyMode    = 0b0000000100000000,
    58     AsyncFunctionMode             = 0b0000001000000000,
    59     AsyncMethodMode               = 0b0000010000000000,
    60     AsyncArrowFunctionMode        = 0b0000100000000000,
    61     ProgramMode                   = 0b0001000000000000,
    62     ModuleAnalyzeMode             = 0b0010000000000000,
    63     ModuleEvaluateMode            = 0b0100000000000000,
     45enum class SourceParseMode : uint8_t {
     46    NormalFunctionMode,
     47    GeneratorBodyMode,
     48    GeneratorWrapperFunctionMode,
     49    GetterMode,
     50    SetterMode,
     51    MethodMode,
     52    ArrowFunctionMode,
     53    ProgramMode,
     54    ModuleAnalyzeMode,
     55    ModuleEvaluateMode
    6456};
    6557
    66 class SourceParseModeSet {
    67 public:
    68     template<typename... Modes>
    69     SourceParseModeSet(Modes... args)
    70         : m_mask(mergeSourceParseModes(args...))
    71     {
     58inline bool isFunctionParseMode(SourceParseMode parseMode)
     59{
     60    switch (parseMode) {
     61    case SourceParseMode::NormalFunctionMode:
     62    case SourceParseMode::GeneratorBodyMode:
     63    case SourceParseMode::GeneratorWrapperFunctionMode:
     64    case SourceParseMode::GetterMode:
     65    case SourceParseMode::SetterMode:
     66    case SourceParseMode::MethodMode:
     67    case SourceParseMode::ArrowFunctionMode:
     68        return true;
     69
     70    case SourceParseMode::ProgramMode:
     71    case SourceParseMode::ModuleAnalyzeMode:
     72    case SourceParseMode::ModuleEvaluateMode:
     73        return false;
    7274    }
    73 
    74     ALWAYS_INLINE bool contains(SourceParseMode mode)
    75     {
    76         return static_cast<unsigned>(mode) & m_mask;
    77     }
    78 
    79 private:
    80     ALWAYS_INLINE static unsigned mergeSourceParseModes(SourceParseMode mode)
    81     {
    82         return static_cast<unsigned>(mode);
    83     }
    84 
    85     template<typename... Rest>
    86     ALWAYS_INLINE static unsigned mergeSourceParseModes(SourceParseMode mode, Rest... rest)
    87     {
    88         return static_cast<unsigned>(mode) | mergeSourceParseModes(rest...);
    89     }
    90 
    91     const unsigned m_mask;
    92 };
    93 
    94 ALWAYS_INLINE bool isFunctionParseMode(SourceParseMode parseMode)
    95 {
    96     return SourceParseModeSet(
    97         SourceParseMode::NormalFunctionMode,
    98         SourceParseMode::GeneratorBodyMode,
    99         SourceParseMode::GeneratorWrapperFunctionMode,
    100         SourceParseMode::GetterMode,
    101         SourceParseMode::SetterMode,
    102         SourceParseMode::MethodMode,
    103         SourceParseMode::ArrowFunctionMode,
    104         SourceParseMode::AsyncFunctionBodyMode,
    105         SourceParseMode::AsyncFunctionMode,
    106         SourceParseMode::AsyncMethodMode,
    107         SourceParseMode::AsyncArrowFunctionMode,
    108         SourceParseMode::AsyncArrowFunctionBodyMode).contains(parseMode);
     75    RELEASE_ASSERT_NOT_REACHED();
     76    return false;
    10977}
    11078
    111 ALWAYS_INLINE bool isAsyncFunctionParseMode(SourceParseMode parseMode)
     79inline bool isModuleParseMode(SourceParseMode parseMode)
    11280{
    113     return SourceParseModeSet(
    114         SourceParseMode::AsyncFunctionBodyMode,
    115         SourceParseMode::AsyncFunctionMode,
    116         SourceParseMode::AsyncMethodMode,
    117         SourceParseMode::AsyncArrowFunctionMode,
    118         SourceParseMode::AsyncArrowFunctionBodyMode).contains(parseMode);
     81    switch (parseMode) {
     82    case SourceParseMode::ModuleAnalyzeMode:
     83    case SourceParseMode::ModuleEvaluateMode:
     84        return true;
     85
     86    case SourceParseMode::NormalFunctionMode:
     87    case SourceParseMode::GeneratorBodyMode:
     88    case SourceParseMode::GeneratorWrapperFunctionMode:
     89    case SourceParseMode::GetterMode:
     90    case SourceParseMode::SetterMode:
     91    case SourceParseMode::MethodMode:
     92    case SourceParseMode::ArrowFunctionMode:
     93    case SourceParseMode::ProgramMode:
     94        return false;
     95    }
     96    RELEASE_ASSERT_NOT_REACHED();
     97    return false;
    11998}
    12099
    121 ALWAYS_INLINE bool isAsyncArrowFunctionParseMode(SourceParseMode parseMode)
     100inline bool isProgramParseMode(SourceParseMode parseMode)
    122101{
    123     return SourceParseModeSet(
    124         SourceParseMode::AsyncArrowFunctionMode,
    125         SourceParseMode::AsyncArrowFunctionBodyMode).contains(parseMode);
    126 }
     102    switch (parseMode) {
     103    case SourceParseMode::ProgramMode:
     104        return true;
    127105
    128 ALWAYS_INLINE bool isAsyncFunctionWrapperParseMode(SourceParseMode parseMode)
    129 {
    130     return SourceParseModeSet(
    131         SourceParseMode::AsyncArrowFunctionMode,
    132         SourceParseMode::AsyncFunctionMode,
    133         SourceParseMode::AsyncMethodMode).contains(parseMode);
    134 }
    135 
    136 ALWAYS_INLINE bool isAsyncFunctionBodyParseMode(SourceParseMode parseMode)
    137 {
    138     return SourceParseModeSet(
    139         SourceParseMode::AsyncFunctionBodyMode,
    140         SourceParseMode::AsyncArrowFunctionBodyMode).contains(parseMode);
    141 }
    142 
    143 ALWAYS_INLINE bool isModuleParseMode(SourceParseMode parseMode)
    144 {
    145     return SourceParseModeSet(
    146         SourceParseMode::ModuleAnalyzeMode,
    147         SourceParseMode::ModuleEvaluateMode).contains(parseMode);
    148 }
    149 
    150 ALWAYS_INLINE bool isProgramParseMode(SourceParseMode parseMode)
    151 {
    152     return SourceParseModeSet(SourceParseMode::ProgramMode).contains(parseMode);
    153 }
    154 
    155 ALWAYS_INLINE ConstructAbility constructAbilityForParseMode(SourceParseMode parseMode)
    156 {
    157     if (parseMode == SourceParseMode::NormalFunctionMode)
    158         return ConstructAbility::CanConstruct;
    159     return ConstructAbility::CannotConstruct;
     106    case SourceParseMode::NormalFunctionMode:
     107    case SourceParseMode::GeneratorBodyMode:
     108    case SourceParseMode::GeneratorWrapperFunctionMode:
     109    case SourceParseMode::GetterMode:
     110    case SourceParseMode::SetterMode:
     111    case SourceParseMode::MethodMode:
     112    case SourceParseMode::ArrowFunctionMode:
     113    case SourceParseMode::ModuleAnalyzeMode:
     114    case SourceParseMode::ModuleEvaluateMode:
     115        return false;
     116    }
     117    RELEASE_ASSERT_NOT_REACHED();
     118    return false;
    160119}
    161120
  • trunk/Source/JavaScriptCore/parser/ParserTokens.h

    r201523 r201542  
    8383    EXTENDS,
    8484    SUPER,
    85     AWAIT,
    8685    OPENBRACE = 0,
    8786    CLOSEBRACE,
  • trunk/Source/JavaScriptCore/parser/SourceCodeKey.h

    r201481 r201542  
    2929
    3030#include "ParserModes.h"
    31 #include "RuntimeFlags.h"
    3231#include "SourceCode.h"
    3332#include <wtf/HashTraits.h>
     
    6867    }
    6968
    70     SourceCodeKey(const SourceCode& sourceCode, const RuntimeFlags& runtimeFlags, const String& name, SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
     69    SourceCodeKey(const SourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext)
    7170        : m_sourceCode(sourceCode)
    7271        , m_name(name)
    7372        , m_flags(codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext)
    7473        , m_hash(sourceCode.hash())
    75         , m_runtimeFlags(runtimeFlags)
    7674    {
    7775    }
     
    9492    StringView string() const { return m_sourceCode.view(); }
    9593
    96     const RuntimeFlags& runtimeFlags() const { return m_runtimeFlags; }
    97 
    9894    bool operator==(const SourceCodeKey& other) const
    9995    {
     
    10298            && m_flags == other.m_flags
    10399            && m_name == other.m_name
    104             && string() == other.string()
    105             && m_runtimeFlags == other.runtimeFlags();
     100            && string() == other.string();
    106101    }
    107102
     
    122117    SourceCodeFlags m_flags;
    123118    unsigned m_hash;
    124     RuntimeFlags m_runtimeFlags;
    125119};
    126120
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r201481 r201542  
    185185    ClassExpression createClassExpr(const JSTokenLocation&, const ParserClassInfo<SyntaxChecker>&, VariableEnvironment&, ExpressionType, ExpressionType, PropertyList, PropertyList) { return ClassExpr; }
    186186    ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    187     ExpressionType createAsyncFunctionBody(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
    188187    int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, SuperBinding, unsigned, SourceParseMode, bool, InnerArrowFunctionCodeFeatures = NoInnerArrowFunctionFeatures) { return FunctionBodyResult; }
    189188    ExpressionType createArrowFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r201481 r201542  
    8282
    8383template <class UnlinkedCodeBlockType, class ExecutableType>
    84 UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, const RuntimeFlags& runtimeFlags, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
     84UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
    8585{
    8686    DerivedContextType derivedContextType = executable->derivedContextType();
    8787    bool isArrowFunctionContext = executable->isArrowFunctionContext();
    88     SourceCodeKey key(source, runtimeFlags, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext);
     88    SourceCodeKey key(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode, derivedContextType, evalContextType, isArrowFunctionContext);
    8989    SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
    9090    // FIXME: We should do something smart for TDZ instead of just disabling caching.
     
    105105    typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
    106106    std::unique_ptr<RootNode> rootNode = parse<RootNode>(
    107         &vm, runtimeFlags, source, Identifier(), builtinMode, strictMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
     107        &vm, source, Identifier(), builtinMode, strictMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
    108108    if (!rootNode)
    109109        return nullptr;
     
    134134}
    135135
    136 UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM& vm, const RuntimeFlags& runtimeFlags, ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error)
     136UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM& vm, ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error)
    137137{
    138138    VariableEnvironment emptyParentTDZVariables;
    139     return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, runtimeFlags, executable, source, builtinMode, strictMode, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
    140 }
    141 
    142 UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM& vm, const RuntimeFlags& runtimeFlags, EvalExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
    143 {
    144     return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, runtimeFlags, executable, source, builtinMode, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
    145 }
    146 
    147 UnlinkedModuleProgramCodeBlock* CodeCache::getModuleProgramCodeBlock(VM& vm, const RuntimeFlags& runtimeFlags, ModuleProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError& error)
     139    return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
     140}
     141
     142UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM& vm, EvalExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
     143{
     144    return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
     145}
     146
     147UnlinkedModuleProgramCodeBlock* CodeCache::getModuleProgramCodeBlock(VM& vm, ModuleProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError& error)
    148148{
    149149    VariableEnvironment emptyParentTDZVariables;
    150     return getGlobalCodeBlock<UnlinkedModuleProgramCodeBlock>(vm, runtimeFlags, executable, source, builtinMode, JSParserStrictMode::Strict, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
     150    return getGlobalCodeBlock<UnlinkedModuleProgramCodeBlock>(vm, executable, source, builtinMode, JSParserStrictMode::Strict, debuggerMode, error, EvalContextType::None, &emptyParentTDZVariables);
    151151}
    152152
    153153// FIXME: There's no need to add the function's name to the key here. It's already in the source code.
    154 UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(VM& vm, const RuntimeFlags& runtimeFlags, const Identifier& name, const SourceCode& source, ParserError& error)
     154UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(VM& vm, const Identifier& name, const SourceCode& source, ParserError& error)
    155155{
    156156    bool isArrowFunctionContext = false;
    157157    SourceCodeKey key(
    158         source, runtimeFlags, name.string(), SourceCodeType::FunctionType,
     158        source, name.string(), SourceCodeType::FunctionType,
    159159        JSParserBuiltinMode::NotBuiltin,
    160160        JSParserStrictMode::NotStrict,
     
    172172    JSTextPosition positionBeforeLastNewline;
    173173    std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
    174         &vm, runtimeFlags, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
     174        &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    175175        JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
    176176        error, &positionBeforeLastNewline);
     
    202202    // The Function constructor only has access to global variables, so no variables will be under TDZ.
    203203    VariableEnvironment emptyTDZVariables;
    204 
    205     ConstructAbility constructAbility = constructAbilityForParseMode(metadata->parseMode());
    206     UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, constructAbility, emptyTDZVariables, DerivedContextType::None);
     204    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None);
    207205
    208206    functionExecutable->setSourceURLDirective(source.provider()->sourceURL());
  • trunk/Source/JavaScriptCore/runtime/CodeCache.h

    r201481 r201542  
    5050class UnlinkedProgramCodeBlock;
    5151class VM;
    52 class RuntimeFlags;
    5352class VariableEnvironment;
    5453
     
    189188    ~CodeCache();
    190189
    191     UnlinkedProgramCodeBlock* getProgramCodeBlock(VM&, const RuntimeFlags&, ProgramExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&);
    192     UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&, const RuntimeFlags&, EvalExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
    193     UnlinkedModuleProgramCodeBlock* getModuleProgramCodeBlock(VM&, const RuntimeFlags&, ModuleProgramExecutable*, const SourceCode&, JSParserBuiltinMode, DebuggerMode, ParserError&);
    194     UnlinkedFunctionExecutable* getFunctionExecutableFromGlobalCode(VM&, const RuntimeFlags&, const Identifier&, const SourceCode&, ParserError&);
     190    UnlinkedProgramCodeBlock* getProgramCodeBlock(VM&, ProgramExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&);
     191    UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&, EvalExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
     192    UnlinkedModuleProgramCodeBlock* getModuleProgramCodeBlock(VM&, ModuleProgramExecutable*, const SourceCode&, JSParserBuiltinMode, DebuggerMode, ParserError&);
     193    UnlinkedFunctionExecutable* getFunctionExecutableFromGlobalCode(VM&, const Identifier&, const SourceCode&, ParserError&);
    195194
    196195    void clear()
     
    201200private:
    202201    template <class UnlinkedCodeBlockType, class ExecutableType>
    203     UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, const RuntimeFlags&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
     202    UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType, const VariableEnvironment*);
    204203
    205204    CodeCacheMap m_sourceCode;
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r201481 r201542  
    107107    macro(as) \
    108108    macro(assign) \
    109     macro(async) \
    110109    macro(back) \
    111110    macro(bind) \
     
    268267
    269268#define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \
    270     macro(await) \
    271269    macro(break) \
    272270    macro(case) \
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r201481 r201542  
    4040#include "ModuleLoaderObject.h"
    4141#include "Parser.h"
    42 #include "RuntimeFlags.h"
    4342#include "ScriptProfilingScope.h"
    4443#include <wtf/WTFThreadData.h>
     
    6261}
    6362   
    64 bool checkSyntax(VM& vm, const RuntimeFlags& runtimeFlags, const SourceCode& source, ParserError& error)
     63bool checkSyntax(VM& vm, const SourceCode& source, ParserError& error)
    6564{
    6665    JSLockHolder lock(vm);
    6766    RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
    6867    return !!parse<ProgramNode>(
    69         &vm, runtimeFlags, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
     68        &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    7069        JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
    7170}
     
    7776    RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
    7877    std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
    79         &vm, exec->lexicalGlobalObject()->runtimeFlags(), source, Identifier(), JSParserBuiltinMode::NotBuiltin,
     78        &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    8079        JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
    8180    if (!moduleProgramNode)
  • trunk/Source/JavaScriptCore/runtime/Completion.h

    r201481 r201542  
    3434class JSObject;
    3535class ParserError;
    36 class RuntimeFlags;
    3736class SourceCode;
    3837class VM;
    3938class JSInternalPromise;
    4039
    41 JS_EXPORT_PRIVATE bool checkSyntax(VM&, const RuntimeFlags&, const SourceCode&, ParserError&);
     40JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&);
    4241JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0);
    4342JS_EXPORT_PRIVATE bool checkModuleSyntax(ExecState*, const SourceCode&, ParserError&);
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r201481 r201542  
    315315    UnlinkedFunctionCodeBlock* unlinkedCodeBlock =
    316316        executable->m_unlinkedExecutable->unlinkedCodeBlockFor(
    317             *vm, globalObject->runtimeFlags(), executable->m_source, kind, debuggerMode, error,
     317            *vm, executable->m_source, kind, debuggerMode, error,
    318318            executable->parseMode());
    319319    recordParse(
     
    570570    JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
    571571    std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>(
    572         vm, lexicalGlobalObject->runtimeFlags(), m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
     572        vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
    573573        JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
    574574    if (programNode)
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r201481 r201542  
    653653    bool isClass() const { return !classSource().isNull(); }
    654654    bool isArrowFunction() const { return parseMode() == SourceParseMode::ArrowFunctionMode; }
    655     bool isAsyncFunction() const { return isAsyncFunctionParseMode(parseMode()); }
    656655    bool isGetter() const { return parseMode() == SourceParseMode::GetterMode; }
    657656    bool isSetter() const { return parseMode() == SourceParseMode::SetterMode; }
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r201481 r201542  
    9696    String program;
    9797    if (args.isEmpty())
    98         program = makeString("{", functionConstructionMode == FunctionConstructionMode::Async ? "async function " : "function ", functionConstructionMode == FunctionConstructionMode::Generator ? "*" : "", functionName.string(), "() {\n\n}}");
     98        program = makeString("{function ", functionConstructionMode == FunctionConstructionMode::Generator ? "*" : "", functionName.string(), "() {\n\n}}");
    9999    else if (args.size() == 1)
    100         program = makeString("{", functionConstructionMode == FunctionConstructionMode::Async ? "async function " : "function ", functionConstructionMode == FunctionConstructionMode::Generator ? "*" : "", functionName.string(), "() {\n", args.at(0).toString(exec)->value(exec), "\n}}");
     100        program = makeString("{function ", functionConstructionMode == FunctionConstructionMode::Generator ? "*" : "", functionName.string(), "() {\n", args.at(0).toString(exec)->value(exec), "\n}}");
    101101    else {
    102102        StringBuilder builder;
    103         if (functionConstructionMode == FunctionConstructionMode::Async)
    104             builder.appendLiteral("{async function ");
    105         else {
    106             builder.appendLiteral("{function ");
    107             if (functionConstructionMode == FunctionConstructionMode::Generator)
    108                 builder.append('*');
    109         }
     103        builder.appendLiteral("{function ");
     104        if (functionConstructionMode == FunctionConstructionMode::Generator)
     105            builder.append('*');
    110106        builder.append(functionName.string());
    111107        builder.append('(');
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.h

    r201481 r201542  
    6060    Function,
    6161    Generator,
    62     Async
    6362};
    6463
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r201481 r201542  
    352352        return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    353353
    354     if (propertyName == exec->propertyNames().prototype && !thisObject->jsExecutable()->isArrowFunction() && !thisObject->jsExecutable()->isAsyncFunction()) {
     354    if (propertyName == exec->propertyNames().prototype && !thisObject->jsExecutable()->isArrowFunction()) {
    355355        VM& vm = exec->vm();
    356356        unsigned attributes;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r201481 r201542  
    3434#include "ArrayIteratorPrototype.h"
    3535#include "ArrayPrototype.h"
    36 #include "AsyncFunctionConstructor.h"
    37 #include "AsyncFunctionPrototype.h"
    3836#include "BooleanConstructor.h"
    3937#include "BooleanPrototype.h"
     
    6765#include "JSArrayBufferPrototype.h"
    6866#include "JSArrayIterator.h"
    69 #include "JSAsyncFunction.h"
    7067#include "JSBoundFunction.h"
    7168#include "JSBoundSlotBaseFunction.h"
     
    616613        });
    617614
    618     m_asyncFunctionPrototype.set(vm, this, AsyncFunctionPrototype::create(vm, AsyncFunctionPrototype::createStructure(vm, this, m_functionPrototype.get())));
    619     AsyncFunctionConstructor* asyncFunctionConstructor = AsyncFunctionConstructor::create(vm, AsyncFunctionConstructor::createStructure(vm, this, functionConstructor), m_asyncFunctionPrototype.get());
    620     m_asyncFunctionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, asyncFunctionConstructor, DontEnum | ReadOnly);
    621     m_asyncFunctionStructure.set(vm, this, JSAsyncFunction::createStructure(vm, this, m_asyncFunctionPrototype.get()));
    622 
    623615    m_generatorFunctionPrototype.set(vm, this, GeneratorFunctionPrototype::create(vm, GeneratorFunctionPrototype::createStructure(vm, this, m_functionPrototype.get())));
    624616    GeneratorFunctionConstructor* generatorFunctionConstructor = GeneratorFunctionConstructor::create(vm, GeneratorFunctionConstructor::createStructure(vm, this, functionConstructor), m_generatorFunctionPrototype.get());
     
    773765        GlobalPropertyInfo(vm.propertyNames->builtinNames().thisTimeValuePrivateName(), privateFuncThisTimeValue, DontEnum | DontDelete | ReadOnly),
    774766        GlobalPropertyInfo(vm.propertyNames->builtinNames().thisNumberValuePrivateName(), privateFuncThisNumberValue, DontEnum | DontDelete | ReadOnly),
    775         GlobalPropertyInfo(vm.propertyNames->builtinNames().asyncFunctionResumePrivateName(), JSFunction::createBuiltinFunction(vm, asyncFunctionPrototypeAsyncFunctionResumeCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
    776 
    777767#if ENABLE(INTL)
    778768        GlobalPropertyInfo(vm.propertyNames->builtinNames().CollatorPrivateName(), intl->getDirect(vm, vm.propertyNames->Collator), DontEnum | DontDelete | ReadOnly),
     
    12271217    DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
    12281218    UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()->getProgramCodeBlock(
    1229         vm(), runtimeFlags(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode,
     1219        vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode,
    12301220        debuggerMode, error);
    12311221
     
    12491239   
    12501240    UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm().codeCache()->getEvalCodeBlock(
    1251         vm(), runtimeFlags(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
     1241        vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
    12521242
    12531243    if (hasDebugger())
     
    12671257    DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
    12681258    UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()->getModuleProgramCodeBlock(
    1269         vm(), runtimeFlags(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, debuggerMode, error);
     1259        vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, debuggerMode, error);
    12701260
    12711261    if (hasDebugger())
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r201481 r201542  
    5757
    5858class ArrayPrototype;
    59 class AsyncFunctionPrototype;
    6059class BooleanPrototype;
    6160class ConsoleClient;
     
    258257    WriteBarrier<FunctionPrototype> m_functionPrototype;
    259258    WriteBarrier<ArrayPrototype> m_arrayPrototype;
    260     WriteBarrier<AsyncFunctionPrototype> m_asyncFunctionPrototype;
    261259    WriteBarrier<RegExpPrototype> m_regExpPrototype;
    262260    WriteBarrier<IteratorPrototype> m_iteratorPrototype;
     
    300298    WriteBarrier<Structure> m_privateNameStructure;
    301299    WriteBarrier<Structure> m_regExpStructure;
    302     WriteBarrier<Structure> m_asyncFunctionStructure;
    303300    WriteBarrier<Structure> m_generatorFunctionStructure;
    304301    WriteBarrier<Structure> m_dollarVMStructure;
     
    505502    FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
    506503    ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); }
    507     AsyncFunctionPrototype* asyncFunctionPrototype() const { return m_asyncFunctionPrototype.get(); }
    508504    JSObject* booleanPrototype() const { return m_booleanObjectStructure.prototype(this); }
    509505    StringPrototype* stringPrototype() const { return m_stringPrototype.get(); }
     
    574570    Structure* mapStructure() const { return m_mapStructure.get(); }
    575571    Structure* regExpStructure() const { return m_regExpStructure.get(); }
    576     Structure* asyncFunctionStructure() const { return m_asyncFunctionStructure.get(); }
    577572    Structure* generatorFunctionStructure() const { return m_generatorFunctionStructure.get(); }
    578573    Structure* setStructure() const { return m_setStructure.get(this); }
  • trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp

    r201481 r201542  
    276276    ParserError error;
    277277    std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
    278         &vm, exec->vmEntryGlobalObject()->runtimeFlags(), sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
     278        &vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
    279279        JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
    280280
  • trunk/Source/JavaScriptCore/runtime/RuntimeFlags.h

    r201481 r201542  
    3131namespace JSC {
    3232
    33 // macro(name, flagName, isEnabledFlag)
    34 #define JSC_RUNTIME_FLAG(macro) \
    35     macro(AsyncAwaitEnabled, true)
     33// macro(name, isEnabledFlag)
     34#define JSC_RUNTIME_FLAG(macro)
    3635
    3736class RuntimeFlags {
     
    9291    }
    9392
    94     bool operator==(const RuntimeFlags& other) const
    95     {
    96         return m_flags == other.m_flags;
    97     }
    98 
    99     bool operator!=(const RuntimeFlags& other) const
    100     {
    101         return m_flags != other.m_flags;
    102     }
    103 
    10493private:
    10594    unsigned m_flags;
  • trunk/Source/WebKit/mac/ChangeLog

    r201482 r201542  
     12016-05-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Unreviewed, roll out r201481, r201523: 0.3% regression in Octane code-load
     4        https://bugs.webkit.org/show_bug.cgi?id=158249
     5
     6        * WebView/WebPreferencesPrivate.h:
     7
    182016-05-27  Chris Dumez  <cdumez@apple.com>
    29
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r201481 r201542  
    5454
    5555typedef enum {
    56     WebKitJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1u << 0,
    5756    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
    5857} WebKitJavaScriptRuntimeFlags;
  • trunk/Source/WebKit/win/ChangeLog

    r201481 r201542  
     12016-05-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Unreviewed, roll out r201481, r201523: 0.3% regression in Octane code-load
     4        https://bugs.webkit.org/show_bug.cgi?id=158249
     5
     6        * Interfaces/IWebPreferencesPrivate.idl:
     7
    182016-05-27  Caitlin Potter  <caitp@igalia.com>
    29
  • trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r201481 r201542  
    3333
    3434typedef enum WebKitJavaScriptRuntimeFlags {
    35     WebKitJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1, // 1u << 0
    3635    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
    3736} WebKitJavaScriptRuntimeFlags;
  • trunk/Source/WebKit2/ChangeLog

    r201535 r201542  
     12016-05-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Unreviewed, roll out r201481, r201523: 0.3% regression in Octane code-load
     4        https://bugs.webkit.org/show_bug.cgi?id=158249
     5
     6        * UIProcess/API/C/WKPreferencesRefPrivate.h:
     7        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     8
    192016-05-31  Beth Dakin  <bdakin@apple.com>
    210
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h

    r201481 r201542  
    5151
    5252enum WKJavaScriptRuntimeFlags {
    53     kWKJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1 << 0,
    5453    kWKJavaScriptRuntimeFlagsAllEnabled = 0
    5554};
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r201481 r201542  
    4444
    4545typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
    46     _WKJavaScriptRuntimeFlagsAsyncAwaitEnabled = 1 << 0,
    4746    _WKJavaScriptRuntimeFlagsAllEnabled = 0
    4847} WK_ENUM_AVAILABLE(10_11, 9_0);
Note: See TracChangeset for help on using the changeset viewer.