Skip to content

Commit a98f794

Browse files
committed
[JSC] implement async functions proposal
https://bugs.webkit.org/show_bug.cgi?id=156147 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: Adds support for `async` functions, proposed in https://tc39.github.io/ecmascript-asyncawait/. On the front-end side, "await" becomes a contextual keyword when used within an async function, which triggers parsing an AwaitExpression. "await" becomes an illegal identifier name within these contexts. The bytecode generated from an "await" expression is identical to that generated in a "yield" expression in a Generator, as AsyncFunction reuses generator's state machine mechanism. There are numerous syntactic forms for language features, including a variation on ArrowFunctions, requiring the keyword `async` to precede ArrowFormalParameters, and similarly, MethodDefinitions, which are ordinary MethodDefinitions preceded by the keyword `async`. An async function desugars to the following: ``` async function asyncFn() { } becomes: function asyncFn() { let generator = { @GeneratorNext: function(@Generator, @generatorState, @generatorValue, @generatorResumeMode) { // generator state machine stuff here }, @generatorState: 0, @generatorThis: this, @generatorFrame: null }; return @asyncFunctionResume(generator, undefined, GeneratorResumeMode::NormalMode); } ``` `@asyncFunctionResume()` is similar to `@generatorResume`, with the exception that it will wrap the result of invoking `@generatorNext()` in a Promise, and will avoid allocating an iterator result object. If the generator has yielded (an AwaitExpression has occurred), resumption will occur automatically once the await-expression operand is finished, via Promise chaining. * API/JSScriptRef.cpp: (parseScript): * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * builtins/AsyncFunctionPrototype.js: Added. (asyncFunctionResume): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::finishCreation): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::isArrowFunction): (JSC::UnlinkedCodeBlock::isOrdinaryArrowFunction): (JSC::UnlinkedCodeBlock::isAsyncArrowFunction): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): (JSC::UnlinkedFunctionExecutable::fromGlobalCode): (JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor): * bytecode/UnlinkedFunctionExecutable.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewArrowFunctionExpression): (JSC::BytecodeGenerator::emitNewMethodDefinition): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::makeFunction): * bytecompiler/NodesCodegen.cpp: (JSC::FunctionNode::emitBytecode): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::parse): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_async_func_exp): * jit/JITOperations.cpp: * jit/JITOperations.h: * jsc.cpp: (runInteractive): (printUsageStatement): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * parser/ASTBuilder.h: (JSC::ASTBuilder::createAsyncFunctionBody): * parser/Keywords.table: * parser/Parser.cpp: (JSC::Parser<LexerType>::Parser): (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::isArrowFunctionParameters): (JSC::Parser<LexerType>::parseAsyncFunctionSourceElements): (JSC::Parser<LexerType>::parseStatementListItem): (JSC::Parser<LexerType>::parseVariableDeclarationList): (JSC::Parser<LexerType>::parseDestructuringPattern): (JSC::Parser<LexerType>::parseStatement): (JSC::Parser<LexerType>::parseFunctionDeclarationStatement): (JSC::Parser<LexerType>::parseFormalParameters): (JSC::stringForFunctionMode): (JSC::Parser<LexerType>::parseFunctionParameters): (JSC::Parser<LexerType>::parseFunctionInfo): (JSC::Parser<LexerType>::parseAsyncFunctionDeclaration): (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseExpressionOrLabelStatement): (JSC::Parser<LexerType>::parseImportClauseItem): (JSC::Parser<LexerType>::parseImportDeclaration): (JSC::Parser<LexerType>::parseExportDeclaration): (JSC::Parser<LexerType>::parseAssignmentExpression): (JSC::Parser<LexerType>::parseAwaitExpression): (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): (JSC::Parser<LexerType>::parseAsyncFunctionExpression): (JSC::Parser<LexerType>::parsePrimaryExpression): (JSC::Parser<LexerType>::parseMemberExpression): (JSC::Parser<LexerType>::parseArrowFunctionExpression): (JSC::Parser<LexerType>::parseUnaryExpression): (JSC::Parser<LexerType>::printUnexpectedTokenText): * parser/Parser.h: (JSC::isIdentifierOrKeyword): (JSC::Scope::Scope): (JSC::Scope::setSourceParseMode): (JSC::Scope::isAsyncFunction): (JSC::Scope::isAsyncFunctionBoundary): (JSC::Scope::isModule): (JSC::Scope::setIsFunction): (JSC::Scope::setIsAsyncArrowFunction): (JSC::Scope::setIsAsyncFunction): (JSC::Scope::setIsAsyncFunctionBody): (JSC::Scope::setIsAsyncArrowFunctionBody): (JSC::Parser::ExpressionErrorClassifier::forceClassifyExpressionError): (JSC::Parser::ExpressionErrorClassifier::propagateExpressionErrorClass): (JSC::Parser::ExpressionErrorClassifier::indicatesPossibleAsyncArrowFunction): (JSC::Parser::forceClassifyExpressionError): (JSC::Parser::declarationTypeToVariableKind): (JSC::Parser::closestParentOrdinaryFunctionNonLexicalScope): (JSC::Parser::pushScope): (JSC::Parser::popScopeInternal): (JSC::Parser::matchSpecIdentifier): (JSC::Parser::isDisallowedIdentifierAwait): (JSC::Parser::disallowedIdentifierAwaitReason): (JSC::parse): * parser/ParserModes.h: (JSC::isFunctionParseMode): (JSC::isAsyncFunctionParseMode): (JSC::isAsyncArrowFunctionParseMode): (JSC::isAsyncFunctionWrapperParseMode): (JSC::isAsyncFunctionBodyParseMode): (JSC::isModuleParseMode): (JSC::isProgramParseMode): (JSC::constructAbilityForParseMode): * parser/ParserTokens.h: * parser/SourceCodeKey.h: (JSC::SourceCodeKey::SourceCodeKey): (JSC::SourceCodeKey::runtimeFlags): (JSC::SourceCodeKey::operator==): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createAsyncFunctionBody): * runtime/AsyncFunctionConstructor.cpp: Added. (JSC::AsyncFunctionConstructor::AsyncFunctionConstructor): (JSC::AsyncFunctionConstructor::finishCreation): (JSC::callAsyncFunctionConstructor): (JSC::constructAsyncFunctionConstructor): (JSC::AsyncFunctionConstructor::getCallData): (JSC::AsyncFunctionConstructor::getConstructData): * runtime/AsyncFunctionConstructor.h: Added. (JSC::AsyncFunctionConstructor::create): (JSC::AsyncFunctionConstructor::createStructure): * runtime/AsyncFunctionPrototype.cpp: Added. (JSC::AsyncFunctionPrototype::AsyncFunctionPrototype): (JSC::AsyncFunctionPrototype::finishCreation): * runtime/AsyncFunctionPrototype.h: Added. (JSC::AsyncFunctionPrototype::create): (JSC::AsyncFunctionPrototype::createStructure): * 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: Added. (JSC::JSAsyncFunction::JSAsyncFunction): (JSC::JSAsyncFunction::createImpl): (JSC::JSAsyncFunction::create): (JSC::JSAsyncFunction::createWithInvalidatedReallocationWatchpoint): * runtime/JSAsyncFunction.h: Added. (JSC::JSAsyncFunction::allocationSize): (JSC::JSAsyncFunction::createStructure): * runtime/JSFunction.cpp: (JSC::JSFunction::getOwnPropertySlot): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::createProgramCodeBlock): (JSC::JSGlobalObject::createEvalCodeBlock): (JSC::JSGlobalObject::createModuleProgramCodeBlock): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::asyncFunctionPrototype): (JSC::JSGlobalObject::asyncFunctionStructure): * runtime/ModuleLoaderObject.cpp: (JSC::moduleLoaderObjectParseModule): * runtime/RuntimeFlags.h: (JSC::RuntimeFlags::operator==): (JSC::RuntimeFlags::operator!=): * tests/stress/async-await-basic.js: Added. (shouldBe): (shouldBeAsync): (shouldThrow): (shouldThrowAsync): (let.AsyncFunction.async): (async.asyncFunctionForProto): (Object.getPrototypeOf.async): (Object.getPrototypeOf.async.method): (async): (async.method): (async.asyncNonConstructorDecl): (shouldThrow.new.async): (shouldThrow.new.async.nonConstructor): (async.asyncDecl): (async.f): (MyError): (async.asyncDeclThrower): (shouldThrowAsync.async): (resolveLater): (rejectLater): (async.resumeAfterNormal): (O.async.resumeAfterNormal): (resumeAfterNormalArrow.async): (async.resumeAfterThrow): (O.async.resumeAfterThrow): (resumeAfterThrowArrow.async): (catch): * tests/stress/async-await-module-reserved-word.js: Added. (shouldThrow): (SyntaxError.Canstring_appeared_hereawait.checkModuleSyntaxError.String.raw.await): (checkModuleSyntaxError.String.raw.await): (checkModuleSyntaxError.String.raw.async.await): (SyntaxError.Cannot.declare.named): * tests/stress/async-await-mozilla.js: Added. (shouldBe): (shouldBeAsync): (shouldThrow): (shouldThrowAsync): (assert): (shouldThrowSyntaxError): (mozSemantics.async.empty): (mozSemantics.async.simpleReturn): (mozSemantics.async.simpleAwait): (mozSemantics.async.simpleAwaitAsync): (mozSemantics.async.returnOtherAsync): (mozSemantics.async.simpleThrower): (mozSemantics.async.delegatedThrower): (mozSemantics.async.tryCatch): (mozSemantics.async.tryCatchThrow): (mozSemantics.async.wellFinally): (mozSemantics.async.finallyMayFail): (mozSemantics.async.embedded.async.inner): (mozSemantics.async.embedded): (mozSemantics.async.fib): (mozSemantics.async.isOdd.async.isEven): (mozSemantics.async.isOdd): (mozSemantics.hardcoreFib.async.fib2): (mozSemantics.namedAsyncExpr.async.simple): (mozSemantics.async.executionOrder.async.first): (mozSemantics.async.executionOrder.async.second): (mozSemantics.async.executionOrder.async.third): (mozSemantics.async.executionOrder): (mozSemantics.async.miscellaneous): (mozSemantics.thrower): (mozSemantics.async.defaultArgs): (mozSemantics.shouldThrow): (mozSemantics): (mozMethods.X): (mozMethods.X.prototype.async.getValue): (mozMethods.X.prototype.setValue): (mozMethods.X.prototype.async.increment): (mozMethods.X.prototype.async.getBaseClassName): (mozMethods.X.async.getStaticValue): (mozMethods.Y.prototype.async.getBaseClassName): (mozMethods.Y): (mozFunctionNameInferrence.async.test): (mozSyntaxErrors): * tests/stress/async-await-reserved-word.js: Added. (assert): (shouldThrowSyntaxError): (AsyncFunction.async): * tests/stress/async_arrow_functions_lexical_arguments_binding.js: Added. (shouldBe): (shouldBeAsync): (shouldThrowAsync): (noArgumentsArrow2.async): * tests/stress/async_arrow_functions_lexical_new.target_binding.js: Added. (shouldBe): (shouldBeAsync): (shouldThrowAsync): (C1): (C2): (shouldThrowAsync.async): * tests/stress/async_arrow_functions_lexical_super_binding.js: Added. (shouldBe): (shouldBeAsync): (BaseClass.prototype.baseClassValue): (BaseClass): (ChildClass.prototype.asyncSuperProp): (ChildClass.prototype.asyncSuperProp2): (ChildClass): * tests/stress/async_arrow_functions_lexical_this_binding.js: Added. (shouldBe): (shouldBeAsync): (d.y): Source/WebKit/mac: * WebView/WebPreferencesPrivate.h: Source/WebKit/win: * Interfaces/IWebPreferencesPrivate.idl: Source/WebKit2: * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Canonical link: https://commits.webkit.org/176281@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0068757 commit a98f794

69 files changed

Lines changed: 2853 additions & 172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/JSScriptRef.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct OpaqueJSScript : public SourceProvider {
7575
static bool parseScript(VM* vm, const SourceCode& source, ParserError& error)
7676
{
7777
return !!JSC::parse<JSC::ProgramNode>(
78-
vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
78+
vm, RuntimeFlags(), source, Identifier(), JSParserBuiltinMode::NotBuiltin,
7979
JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded,
8080
error);
8181
}

‎Source/JavaScriptCore/CMakeLists.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ set(JavaScriptCore_SOURCES
609609
runtime/ArrayConstructor.cpp
610610
runtime/ArrayIteratorPrototype.cpp
611611
runtime/ArrayPrototype.cpp
612+
runtime/AsyncFunctionConstructor.cpp
613+
runtime/AsyncFunctionPrototype.cpp
612614
runtime/BasicBlockLocation.cpp
613615
runtime/BooleanConstructor.cpp
614616
runtime/BooleanObject.cpp
@@ -683,6 +685,7 @@ set(JavaScriptCore_SOURCES
683685
runtime/JSArrayBufferPrototype.cpp
684686
runtime/JSArrayBufferView.cpp
685687
runtime/JSArrayIterator.cpp
688+
runtime/JSAsyncFunction.cpp
686689
runtime/JSBoundFunction.cpp
687690
runtime/JSBoundSlotBaseFunction.cpp
688691
runtime/JSCJSValue.cpp
@@ -1208,6 +1211,7 @@ set(JavaScriptCore_BUILTINS_SOURCES
12081211
${JAVASCRIPTCORE_DIR}/builtins/ArrayConstructor.js
12091212
${JAVASCRIPTCORE_DIR}/builtins/ArrayIteratorPrototype.js
12101213
${JAVASCRIPTCORE_DIR}/builtins/ArrayPrototype.js
1214+
${JAVASCRIPTCORE_DIR}/builtins/AsyncFunctionPrototype.js
12111215
${JAVASCRIPTCORE_DIR}/builtins/DatePrototype.js
12121216
${JAVASCRIPTCORE_DIR}/builtins/FunctionPrototype.js
12131217
${JAVASCRIPTCORE_DIR}/builtins/GeneratorPrototype.js

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 339 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,342 @@
1+
2016-05-27 Caitlin Potter <caitp@igalia.com>
2+
3+
[JSC] implement async functions proposal
4+
https://bugs.webkit.org/show_bug.cgi?id=156147
5+
6+
Reviewed by Yusuke Suzuki.
7+
8+
Adds support for `async` functions, proposed in https://tc39.github.io/ecmascript-asyncawait/.
9+
10+
On the front-end side, "await" becomes a contextual keyword when used within an async function,
11+
which triggers parsing an AwaitExpression. "await" becomes an illegal identifier name within
12+
these contexts. The bytecode generated from an "await" expression is identical to that generated
13+
in a "yield" expression in a Generator, as AsyncFunction reuses generator's state machine mechanism.
14+
15+
There are numerous syntactic forms for language features, including a variation on ArrowFunctions,
16+
requiring the keyword `async` to precede ArrowFormalParameters, and similarly, MethodDefinitions,
17+
which are ordinary MethodDefinitions preceded by the keyword `async`.
18+
19+
An async function desugars to the following:
20+
21+
```
22+
async function asyncFn() {
23+
}
24+
25+
becomes:
26+
27+
function asyncFn() {
28+
let generator = {
29+
@generatorNext: function(@generator, @generatorState, @generatorValue, @generatorResumeMode) {
30+
// generator state machine stuff here
31+
},
32+
@generatorState: 0,
33+
@generatorThis: this,
34+
@generatorFrame: null
35+
};
36+
return @asyncFunctionResume(generator, undefined, GeneratorResumeMode::NormalMode);
37+
}
38+
```
39+
40+
`@asyncFunctionResume()` is similar to `@generatorResume`, with the exception that it will wrap the
41+
result of invoking `@generatorNext()` in a Promise, and will avoid allocating an iterator result
42+
object.
43+
44+
If the generator has yielded (an AwaitExpression has occurred), resumption will occur automatically
45+
once the await-expression operand is finished, via Promise chaining.
46+
47+
* API/JSScriptRef.cpp:
48+
(parseScript):
49+
* CMakeLists.txt:
50+
* DerivedSources.make:
51+
* JavaScriptCore.xcodeproj/project.pbxproj:
52+
* builtins/AsyncFunctionPrototype.js: Added.
53+
(asyncFunctionResume):
54+
* builtins/BuiltinExecutables.cpp:
55+
(JSC::BuiltinExecutables::createExecutable):
56+
* bytecode/BytecodeList.json:
57+
* bytecode/BytecodeUseDef.h:
58+
(JSC::computeUsesForBytecodeOffset):
59+
(JSC::computeDefsForBytecodeOffset):
60+
* bytecode/CodeBlock.cpp:
61+
(JSC::CodeBlock::dumpBytecode):
62+
(JSC::CodeBlock::finishCreation):
63+
* bytecode/UnlinkedCodeBlock.h:
64+
(JSC::UnlinkedCodeBlock::isArrowFunction):
65+
(JSC::UnlinkedCodeBlock::isOrdinaryArrowFunction):
66+
(JSC::UnlinkedCodeBlock::isAsyncArrowFunction):
67+
* bytecode/UnlinkedFunctionExecutable.cpp:
68+
(JSC::generateUnlinkedFunctionCodeBlock):
69+
(JSC::UnlinkedFunctionExecutable::fromGlobalCode):
70+
(JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):
71+
* bytecode/UnlinkedFunctionExecutable.h:
72+
* bytecompiler/BytecodeGenerator.cpp:
73+
(JSC::BytecodeGenerator::BytecodeGenerator):
74+
(JSC::BytecodeGenerator::emitNewFunctionExpressionCommon):
75+
(JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
76+
(JSC::BytecodeGenerator::emitNewMethodDefinition):
77+
(JSC::BytecodeGenerator::emitNewFunction):
78+
(JSC::BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment):
79+
* bytecompiler/BytecodeGenerator.h:
80+
(JSC::BytecodeGenerator::makeFunction):
81+
* bytecompiler/NodesCodegen.cpp:
82+
(JSC::FunctionNode::emitBytecode):
83+
* inspector/agents/InspectorRuntimeAgent.cpp:
84+
(Inspector::InspectorRuntimeAgent::parse):
85+
* jit/JIT.cpp:
86+
(JSC::JIT::privateCompileMainPass):
87+
* jit/JIT.h:
88+
* jit/JITOpcodes.cpp:
89+
(JSC::JIT::emitNewFuncCommon):
90+
(JSC::JIT::emit_op_new_async_func):
91+
(JSC::JIT::emitNewFuncExprCommon):
92+
(JSC::JIT::emit_op_new_async_func_exp):
93+
* jit/JITOperations.cpp:
94+
* jit/JITOperations.h:
95+
* jsc.cpp:
96+
(runInteractive):
97+
(printUsageStatement):
98+
* llint/LLIntSlowPaths.cpp:
99+
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
100+
* llint/LLIntSlowPaths.h:
101+
* llint/LowLevelInterpreter.asm:
102+
* parser/ASTBuilder.h:
103+
(JSC::ASTBuilder::createAsyncFunctionBody):
104+
* parser/Keywords.table:
105+
* parser/Parser.cpp:
106+
(JSC::Parser<LexerType>::Parser):
107+
(JSC::Parser<LexerType>::parseInner):
108+
(JSC::Parser<LexerType>::isArrowFunctionParameters):
109+
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements):
110+
(JSC::Parser<LexerType>::parseStatementListItem):
111+
(JSC::Parser<LexerType>::parseVariableDeclarationList):
112+
(JSC::Parser<LexerType>::parseDestructuringPattern):
113+
(JSC::Parser<LexerType>::parseStatement):
114+
(JSC::Parser<LexerType>::parseFunctionDeclarationStatement):
115+
(JSC::Parser<LexerType>::parseFormalParameters):
116+
(JSC::stringForFunctionMode):
117+
(JSC::Parser<LexerType>::parseFunctionParameters):
118+
(JSC::Parser<LexerType>::parseFunctionInfo):
119+
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
120+
(JSC::Parser<LexerType>::parseClass):
121+
(JSC::Parser<LexerType>::parseExpressionOrLabelStatement):
122+
(JSC::Parser<LexerType>::parseImportClauseItem):
123+
(JSC::Parser<LexerType>::parseImportDeclaration):
124+
(JSC::Parser<LexerType>::parseExportDeclaration):
125+
(JSC::Parser<LexerType>::parseAssignmentExpression):
126+
(JSC::Parser<LexerType>::parseAwaitExpression):
127+
(JSC::Parser<LexerType>::parseProperty):
128+
(JSC::Parser<LexerType>::parsePropertyMethod):
129+
(JSC::Parser<LexerType>::parseAsyncFunctionExpression):
130+
(JSC::Parser<LexerType>::parsePrimaryExpression):
131+
(JSC::Parser<LexerType>::parseMemberExpression):
132+
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
133+
(JSC::Parser<LexerType>::parseUnaryExpression):
134+
(JSC::Parser<LexerType>::printUnexpectedTokenText):
135+
* parser/Parser.h:
136+
(JSC::isIdentifierOrKeyword):
137+
(JSC::Scope::Scope):
138+
(JSC::Scope::setSourceParseMode):
139+
(JSC::Scope::isAsyncFunction):
140+
(JSC::Scope::isAsyncFunctionBoundary):
141+
(JSC::Scope::isModule):
142+
(JSC::Scope::setIsFunction):
143+
(JSC::Scope::setIsAsyncArrowFunction):
144+
(JSC::Scope::setIsAsyncFunction):
145+
(JSC::Scope::setIsAsyncFunctionBody):
146+
(JSC::Scope::setIsAsyncArrowFunctionBody):
147+
(JSC::Parser::ExpressionErrorClassifier::forceClassifyExpressionError):
148+
(JSC::Parser::ExpressionErrorClassifier::propagateExpressionErrorClass):
149+
(JSC::Parser::ExpressionErrorClassifier::indicatesPossibleAsyncArrowFunction):
150+
(JSC::Parser::forceClassifyExpressionError):
151+
(JSC::Parser::declarationTypeToVariableKind):
152+
(JSC::Parser::closestParentOrdinaryFunctionNonLexicalScope):
153+
(JSC::Parser::pushScope):
154+
(JSC::Parser::popScopeInternal):
155+
(JSC::Parser::matchSpecIdentifier):
156+
(JSC::Parser::isDisallowedIdentifierAwait):
157+
(JSC::Parser::disallowedIdentifierAwaitReason):
158+
(JSC::parse):
159+
* parser/ParserModes.h:
160+
(JSC::isFunctionParseMode):
161+
(JSC::isAsyncFunctionParseMode):
162+
(JSC::isAsyncArrowFunctionParseMode):
163+
(JSC::isAsyncFunctionWrapperParseMode):
164+
(JSC::isAsyncFunctionBodyParseMode):
165+
(JSC::isModuleParseMode):
166+
(JSC::isProgramParseMode):
167+
(JSC::constructAbilityForParseMode):
168+
* parser/ParserTokens.h:
169+
* parser/SourceCodeKey.h:
170+
(JSC::SourceCodeKey::SourceCodeKey):
171+
(JSC::SourceCodeKey::runtimeFlags):
172+
(JSC::SourceCodeKey::operator==):
173+
* parser/SyntaxChecker.h:
174+
(JSC::SyntaxChecker::createAsyncFunctionBody):
175+
* runtime/AsyncFunctionConstructor.cpp: Added.
176+
(JSC::AsyncFunctionConstructor::AsyncFunctionConstructor):
177+
(JSC::AsyncFunctionConstructor::finishCreation):
178+
(JSC::callAsyncFunctionConstructor):
179+
(JSC::constructAsyncFunctionConstructor):
180+
(JSC::AsyncFunctionConstructor::getCallData):
181+
(JSC::AsyncFunctionConstructor::getConstructData):
182+
* runtime/AsyncFunctionConstructor.h: Added.
183+
(JSC::AsyncFunctionConstructor::create):
184+
(JSC::AsyncFunctionConstructor::createStructure):
185+
* runtime/AsyncFunctionPrototype.cpp: Added.
186+
(JSC::AsyncFunctionPrototype::AsyncFunctionPrototype):
187+
(JSC::AsyncFunctionPrototype::finishCreation):
188+
* runtime/AsyncFunctionPrototype.h: Added.
189+
(JSC::AsyncFunctionPrototype::create):
190+
(JSC::AsyncFunctionPrototype::createStructure):
191+
* runtime/CodeCache.cpp:
192+
(JSC::CodeCache::getGlobalCodeBlock):
193+
(JSC::CodeCache::getProgramCodeBlock):
194+
(JSC::CodeCache::getEvalCodeBlock):
195+
(JSC::CodeCache::getModuleProgramCodeBlock):
196+
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
197+
* runtime/CodeCache.h:
198+
* runtime/CommonIdentifiers.h:
199+
* runtime/Completion.cpp:
200+
(JSC::checkSyntax):
201+
(JSC::checkModuleSyntax):
202+
* runtime/Completion.h:
203+
* runtime/Executable.cpp:
204+
(JSC::ScriptExecutable::newCodeBlockFor):
205+
(JSC::ProgramExecutable::checkSyntax):
206+
* runtime/Executable.h:
207+
* runtime/FunctionConstructor.cpp:
208+
(JSC::constructFunctionSkippingEvalEnabledCheck):
209+
* runtime/FunctionConstructor.h:
210+
* runtime/JSAsyncFunction.cpp: Added.
211+
(JSC::JSAsyncFunction::JSAsyncFunction):
212+
(JSC::JSAsyncFunction::createImpl):
213+
(JSC::JSAsyncFunction::create):
214+
(JSC::JSAsyncFunction::createWithInvalidatedReallocationWatchpoint):
215+
* runtime/JSAsyncFunction.h: Added.
216+
(JSC::JSAsyncFunction::allocationSize):
217+
(JSC::JSAsyncFunction::createStructure):
218+
* runtime/JSFunction.cpp:
219+
(JSC::JSFunction::getOwnPropertySlot):
220+
* runtime/JSGlobalObject.cpp:
221+
(JSC::JSGlobalObject::init):
222+
(JSC::JSGlobalObject::createProgramCodeBlock):
223+
(JSC::JSGlobalObject::createEvalCodeBlock):
224+
(JSC::JSGlobalObject::createModuleProgramCodeBlock):
225+
* runtime/JSGlobalObject.h:
226+
(JSC::JSGlobalObject::asyncFunctionPrototype):
227+
(JSC::JSGlobalObject::asyncFunctionStructure):
228+
* runtime/ModuleLoaderObject.cpp:
229+
(JSC::moduleLoaderObjectParseModule):
230+
* runtime/RuntimeFlags.h:
231+
(JSC::RuntimeFlags::operator==):
232+
(JSC::RuntimeFlags::operator!=):
233+
* tests/stress/async-await-basic.js: Added.
234+
(shouldBe):
235+
(shouldBeAsync):
236+
(shouldThrow):
237+
(shouldThrowAsync):
238+
(let.AsyncFunction.async):
239+
(async.asyncFunctionForProto):
240+
(Object.getPrototypeOf.async):
241+
(Object.getPrototypeOf.async.method):
242+
(async):
243+
(async.method):
244+
(async.asyncNonConstructorDecl):
245+
(shouldThrow.new.async):
246+
(shouldThrow.new.async.nonConstructor):
247+
(async.asyncDecl):
248+
(async.f):
249+
(MyError):
250+
(async.asyncDeclThrower):
251+
(shouldThrowAsync.async):
252+
(resolveLater):
253+
(rejectLater):
254+
(async.resumeAfterNormal):
255+
(O.async.resumeAfterNormal):
256+
(resumeAfterNormalArrow.async):
257+
(async.resumeAfterThrow):
258+
(O.async.resumeAfterThrow):
259+
(resumeAfterThrowArrow.async):
260+
(catch):
261+
* tests/stress/async-await-module-reserved-word.js: Added.
262+
(shouldThrow):
263+
(SyntaxError.Canstring_appeared_hereawait.checkModuleSyntaxError.String.raw.await):
264+
(checkModuleSyntaxError.String.raw.await):
265+
(checkModuleSyntaxError.String.raw.async.await):
266+
(SyntaxError.Cannot.declare.named):
267+
* tests/stress/async-await-mozilla.js: Added.
268+
(shouldBe):
269+
(shouldBeAsync):
270+
(shouldThrow):
271+
(shouldThrowAsync):
272+
(assert):
273+
(shouldThrowSyntaxError):
274+
(mozSemantics.async.empty):
275+
(mozSemantics.async.simpleReturn):
276+
(mozSemantics.async.simpleAwait):
277+
(mozSemantics.async.simpleAwaitAsync):
278+
(mozSemantics.async.returnOtherAsync):
279+
(mozSemantics.async.simpleThrower):
280+
(mozSemantics.async.delegatedThrower):
281+
(mozSemantics.async.tryCatch):
282+
(mozSemantics.async.tryCatchThrow):
283+
(mozSemantics.async.wellFinally):
284+
(mozSemantics.async.finallyMayFail):
285+
(mozSemantics.async.embedded.async.inner):
286+
(mozSemantics.async.embedded):
287+
(mozSemantics.async.fib):
288+
(mozSemantics.async.isOdd.async.isEven):
289+
(mozSemantics.async.isOdd):
290+
(mozSemantics.hardcoreFib.async.fib2):
291+
(mozSemantics.namedAsyncExpr.async.simple):
292+
(mozSemantics.async.executionOrder.async.first):
293+
(mozSemantics.async.executionOrder.async.second):
294+
(mozSemantics.async.executionOrder.async.third):
295+
(mozSemantics.async.executionOrder):
296+
(mozSemantics.async.miscellaneous):
297+
(mozSemantics.thrower):
298+
(mozSemantics.async.defaultArgs):
299+
(mozSemantics.shouldThrow):
300+
(mozSemantics):
301+
(mozMethods.X):
302+
(mozMethods.X.prototype.async.getValue):
303+
(mozMethods.X.prototype.setValue):
304+
(mozMethods.X.prototype.async.increment):
305+
(mozMethods.X.prototype.async.getBaseClassName):
306+
(mozMethods.X.async.getStaticValue):
307+
(mozMethods.Y.prototype.async.getBaseClassName):
308+
(mozMethods.Y):
309+
(mozFunctionNameInferrence.async.test):
310+
(mozSyntaxErrors):
311+
* tests/stress/async-await-reserved-word.js: Added.
312+
(assert):
313+
(shouldThrowSyntaxError):
314+
(AsyncFunction.async):
315+
* tests/stress/async_arrow_functions_lexical_arguments_binding.js: Added.
316+
(shouldBe):
317+
(shouldBeAsync):
318+
(shouldThrowAsync):
319+
(noArgumentsArrow2.async):
320+
* tests/stress/async_arrow_functions_lexical_new.target_binding.js: Added.
321+
(shouldBe):
322+
(shouldBeAsync):
323+
(shouldThrowAsync):
324+
(C1):
325+
(C2):
326+
(shouldThrowAsync.async):
327+
* tests/stress/async_arrow_functions_lexical_super_binding.js: Added.
328+
(shouldBe):
329+
(shouldBeAsync):
330+
(BaseClass.prototype.baseClassValue):
331+
(BaseClass):
332+
(ChildClass.prototype.asyncSuperProp):
333+
(ChildClass.prototype.asyncSuperProp2):
334+
(ChildClass):
335+
* tests/stress/async_arrow_functions_lexical_this_binding.js: Added.
336+
(shouldBe):
337+
(shouldBeAsync):
338+
(d.y):
339+
1340
2016-05-27 Saam barati <sbarati@apple.com>
2341

3342
DebuggerCallFrame crashes when updated with the globalExec because neither ShadowChicken's algorithm nor StackVisitor's algorithm reasons about the globalExec

‎Source/JavaScriptCore/DerivedSources.make‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ JavaScriptCore_BUILTINS_SOURCES = \
8484
$(JavaScriptCore)/builtins/ArrayConstructor.js \
8585
$(JavaScriptCore)/builtins/ArrayIteratorPrototype.js \
8686
$(JavaScriptCore)/builtins/ArrayPrototype.js \
87+
$(JavaScriptCore)/builtins/AsyncFunctionPrototype.js \
8788
$(JavaScriptCore)/builtins/DatePrototype.js \
8889
$(JavaScriptCore)/builtins/FunctionPrototype.js \
8990
$(JavaScriptCore)/builtins/GeneratorPrototype.js \

0 commit comments

Comments
 (0)